Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ exports[`<ActionRequirement /> should match snapshot 1`] = `
[
{
"backgroundColor": "transparent",
"borderColor": "#D8385E",
"borderColor": "#A6A298",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down
10 changes: 8 additions & 2 deletions packages/yoga/src/Checkbox/Checkbox.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Checkbox = ({ spacing, colors, borders, radii, fontSizes }) => ({
border: {
width: borders.medium,
radius: radii.xsmall,
color: colors.mediumNew,
},
label: {
padding: {
Expand Down Expand Up @@ -36,9 +37,14 @@ const Checkbox = ({ spacing, colors, borders, radii, fontSizes }) => ({
},
},
disabled: {
backgroundColor: colors.elements.lineAndBorders,
backgroundColor: colors.white,
border: {
color: colors.elements.lineAndBorders,
color: colors.steady,
},
label: {
font: {
color: colors.steady,
},
},
},
});
Expand Down
5 changes: 2 additions & 3 deletions packages/yoga/src/Checkbox/native/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ const CheckBackground = styled.View(
error,
theme: {
yoga: {
colors: { primary, feedback, elements, white },
colors: { primary, feedback, white },
components: { checkbox },
},
},
}) => {
let borderColor = primary;
let borderColor = checkbox.border.color;
let bgColor = 'transparent';

if (error) {
Expand All @@ -83,7 +83,6 @@ const CheckBackground = styled.View(

if (checked) {
bgColor = checkbox.disabled.backgroundColor;
borderColor = elements.lineAndBorders;
}
} else if (checked) {
borderColor = primary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with default checkbox 1`]
[
{
"backgroundColor": "transparent",
"borderColor": "#D8385E",
"borderColor": "#A6A298",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down Expand Up @@ -338,8 +338,8 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled and checked
style={
[
{
"backgroundColor": "#D7D7E0",
"borderColor": "#D7D7E0",
"backgroundColor": "#FFFFFF",
"borderColor": "#8F8F8F",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down Expand Up @@ -519,7 +519,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled checkbox 1`]
[
{
"backgroundColor": "transparent",
"borderColor": "#D7D7E0",
"borderColor": "#8F8F8F",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down Expand Up @@ -1203,8 +1203,8 @@ exports[`<Checkbox /> Snapshots should match snapshot with inverted and checked
style={
[
{
"backgroundColor": "#D7D7E0",
"borderColor": "#D7D7E0",
"backgroundColor": "#FFFFFF",
"borderColor": "#8F8F8F",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down Expand Up @@ -1384,7 +1384,7 @@ exports[`<Checkbox /> Snapshots should match snapshot without label 1`] = `
[
{
"backgroundColor": "transparent",
"borderColor": "#D8385E",
"borderColor": "#A6A298",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down Expand Up @@ -1452,7 +1452,7 @@ exports[`<Checkbox /> Snapshots should match snapshot without label 2`] = `
[
{
"backgroundColor": "transparent",
"borderColor": "#D8385E",
"borderColor": "#A6A298",
"borderRadius": 4,
"borderStyle": "solid",
"borderWidth": 2,
Expand Down
25 changes: 17 additions & 8 deletions packages/yoga/src/Checkbox/web/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const CheckMark = styled.div.attrs(({ checked, disabled }) => ({
indeterminate,
theme: {
yoga: {
colors: { primary, feedback, elements, white },
colors: { primary, feedback, white },
components: { checkbox },
},
},
}) => {
let borderColor = elements.selectionAndIcons;
let borderColor = checkbox.border.color;
let bgColor = 'transparent';
let checkColor = checkbox.checked.icon.color;

Expand All @@ -57,7 +57,7 @@ const CheckMark = styled.div.attrs(({ checked, disabled }) => ({

if (checked || indeterminate) {
bgColor = checkbox.disabled.backgroundColor;
borderColor = elements.lineAndBorders;
borderColor = checkbox.disabled.border.color;
}
} else if (checked || indeterminate) {
borderColor = primary;
Expand Down Expand Up @@ -106,15 +106,24 @@ const Label = styled.label`
cursor: pointer;

${({
disabled,
theme: {
yoga: {
components: { checkbox },
},
},
}) => `
font-size: ${checkbox.label.font.size}px;
color: ${checkbox.label.font.color};
`}
}) => {
let { color } = checkbox.label.font;

if (disabled && checkbox.disabled.label) {
color = checkbox.disabled.label.font.color;
}

return `
font-size: ${checkbox.label.font.size}px;
color: ${color};
`;
}}
`;

const Shadow = styled.span`
Expand Down Expand Up @@ -280,7 +289,7 @@ const Checkbox = ({
inverted={inverted}
disabled={disabled}
>
<Label id={checkboxLabelId}>
<Label id={checkboxLabelId} disabled={disabled}>
<Shadow />
<CheckMark
aria-labelledby={ariaLabel ? undefined : checkboxLabelId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with a given value 1`] = `
background-color: transparent;
border-radius: 4px;
border-width: 2px;
border-color: #9898A6;
border-color: #A6A298;
}

.c6 svg {
Expand Down Expand Up @@ -496,7 +496,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with default checkbox 1`]
background-color: transparent;
border-radius: 4px;
border-width: 2px;
border-color: #9898A6;
border-color: #A6A298;
}

.c6 svg {
Expand Down Expand Up @@ -649,10 +649,10 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled and checked
width: 24px;
height: 24px;
margin-right: 8px;
background-color: #D7D7E0;
background-color: #FFFFFF;
border-radius: 4px;
border-width: 2px;
border-color: #D7D7E0;
border-color: #8F8F8F;
}

.c6 svg {
Expand All @@ -679,7 +679,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled and checked
align-items: center;
cursor: pointer;
font-size: 16px;
color: #231B22;
color: #8F8F8F;
}

.c5 {
Expand Down Expand Up @@ -808,6 +808,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled and checked
>
<label
class="c2 c3"
disabled=""
id="checkbox-label-jest-id"
>
<span
Expand Down Expand Up @@ -883,7 +884,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled checkbox 1`]
background-color: transparent;
border-radius: 4px;
border-width: 2px;
border-color: #D7D7E0;
border-color: #8F8F8F;
}

.c6 svg {
Expand All @@ -910,7 +911,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled checkbox 1`]
align-items: center;
cursor: pointer;
font-size: 16px;
color: #231B22;
color: #8F8F8F;
}

.c5 {
Expand Down Expand Up @@ -997,6 +998,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with disabled checkbox 1`]
>
<label
class="c2 c3"
disabled=""
id="checkbox-label-jest-id"
>
<span
Expand Down Expand Up @@ -2015,10 +2017,10 @@ exports[`<Checkbox /> Snapshots should match snapshot with indeterminate and dis
width: 24px;
height: 24px;
margin-right: 8px;
background-color: #D7D7E0;
background-color: #FFFFFF;
border-radius: 4px;
border-width: 2px;
border-color: #D7D7E0;
border-color: #8F8F8F;
}

.c6 svg {
Expand All @@ -2045,7 +2047,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with indeterminate and dis
align-items: center;
cursor: pointer;
font-size: 16px;
color: #231B22;
color: #8F8F8F;
}

.c5 {
Expand Down Expand Up @@ -2206,6 +2208,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with indeterminate and dis
>
<label
class="c2 c3"
disabled=""
id="checkbox-label-jest-id"
>
<span
Expand Down Expand Up @@ -2751,10 +2754,10 @@ exports[`<Checkbox /> Snapshots should match snapshot with inverted and checked
width: 24px;
height: 24px;
margin-right: 8px;
background-color: #D7D7E0;
background-color: #FFFFFF;
border-radius: 4px;
border-width: 2px;
border-color: #D7D7E0;
border-color: #8F8F8F;
}

.c6 svg {
Expand All @@ -2781,7 +2784,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with inverted and checked
align-items: center;
cursor: pointer;
font-size: 16px;
color: #231B22;
color: #8F8F8F;
}

.c5 {
Expand Down Expand Up @@ -2952,6 +2955,7 @@ exports[`<Checkbox /> Snapshots should match snapshot with inverted and checked
>
<label
class="c2 c3"
disabled=""
id="checkbox-label-jest-id"
>
<span
Expand Down Expand Up @@ -3291,7 +3295,7 @@ exports[`<Checkbox /> Snapshots should match snapshot without props 1`] = `
background-color: transparent;
border-radius: 4px;
border-width: 2px;
border-color: #9898A6;
border-color: #A6A298;
}

.c6 svg {
Expand Down