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
39 changes: 19 additions & 20 deletions src/lib/components/checkbox/Checkbox.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
import { Text } from '../text/Text.component';
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';

const getCheckmarkSvgUrl = (color: string) => {
const encodedColor = color.replace('#', '%23');
return `url('data:image/svg+xml,%3Csvg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath d="M3 6.68646L5.0671 9L9 3" stroke="${encodedColor}" stroke-width="1.5"/%3E %3C/svg%3E')`;
};

const getIndeterminateSvgUrl = (color: string) => {
const encodedColor = color.replace('#', '%23');
return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cline x1='6' y1='12' x2='20' y2='12' style='stroke:${encodedColor};stroke-width:4'/%3E %3C/svg%3E")`;
};

const CheckboxInput = styled.input`
transform: scale(1.5);`;

export type Props = {
label?: string;
value?: string;
Expand All @@ -22,7 +35,7 @@
className="sc-checkbox"
>
<Stack>
<input
<CheckboxInput
type="checkbox"
checked={checked}
disabled={disabled}
Expand Down Expand Up @@ -77,8 +90,7 @@
border: 0;
background-color: transparent;
background-size: contain;
box-shadow: inset 0 0 0 ${spacing.r1}
${(props) => props.theme.textSecondary};
box-shadow: inset 0 0 0 ${spacing.r1} ${(props) => props.theme.textSecondary};
}

/* Checked */
Expand All @@ -89,30 +101,17 @@

[type='checkbox']:checked::before {
box-shadow: none;
background-image: url('data:image/svg+xml,%3Csvg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath d="M3 6.68646L5.0671 9L9 3" stroke="${(
props,
) =>
props.theme.textPrimary.replace(
'#',
'%23',
)}" stroke-width="1.5"/%3E %3C/svg%3E');
background-image: ${(props) => getCheckmarkSvgUrl(props.theme.textPrimary)};
background-repeat: no-repeat;
background-position: center;
}

/* Indeterminate */

[type='checkbox']:indeterminate::before {
box-shadow: inset 0 0 0 ${spacing.r1}
${(props) => props.theme.selectedActive};
box-shadow: inset 0 0 0 ${spacing.r1} ${(props) => props.theme.selectedActive};
background-color: ${(props) => props.theme.highlight};
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cline x1='6' y1='12' x2='20' y2='12' style='stroke:${(
props,
) =>
props.theme.textPrimary.replace(
'#',
'%23',
)};stroke-width:4'/%3E %3C/svg%3E");
background-image: ${(props) => getIndeterminateSvgUrl(props.theme.textPrimary)};
}

/* Hover & focus */
Expand Down Expand Up @@ -142,4 +141,4 @@
cursor: not-allowed;
background-color: ${(props) => props.theme.textSecondary};
}
`;
`
3 changes: 3 additions & 0 deletions src/lib/components/dropdown/Dropdown.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const DropdownMenuItemStyled = styled.li`
&:active {
background-color: ${getThemePropSelector('highlight')};
}
&:last-child {
border-bottom: 0.3px solid ${getThemePropSelector('border')};
}
`;
const Caret = styled.span`
margin-left: ${spacing.r16};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/infomessage/InfoMessage.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const InfoMessage = ({ title, content, link, linkText }: Props) => {
>
<Stack>
<Icon name="Info-circle" color={theme.infoPrimary} size="lg" />
{typeof title === 'string' ? <Text isEmphazed>{title}</Text> : title}
{typeof title === 'string' ? <Text color="textPrimary" isEmphazed>{title}</Text> : title}
</Stack>
<Text color="textSecondary" isGentleEmphazed>
{content}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/tooltip/Tooltip.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const TooltipOverLayContainer = styled.div<{
(props && props.style && props.style.fontSize) || fontSize.small};
vertical-align: middle;
padding: ${spacing.r4} ${spacing.r8};
max-width: 40rem;
max-width: 20rem;
`;

const TooltipText = styled.div`
Expand Down
Loading