@dtdot/lego 2.1.0 → 2.2.0
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.
|
@@ -37,9 +37,9 @@ const Checklist = ({ items, value, onChange, noSplitGap, large }) => {
|
|
|
37
37
|
const unCheckedItems = items.filter((item) => !value.includes(item.id));
|
|
38
38
|
return (React.createElement(LayoutGroup, { "data-testid": 'checklist' },
|
|
39
39
|
unCheckedItems.map((item) => (React.createElement(motion.div, { layoutId: item.id, key: item.id },
|
|
40
|
-
React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large })))),
|
|
40
|
+
React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large, colour: item.colour })))),
|
|
41
41
|
checkedItems.length && !noSplitGap ? React.createElement(ListDivider, null) : null,
|
|
42
42
|
checkedItems.map((item) => (React.createElement(motion.div, { layoutId: item.id, key: item.id },
|
|
43
|
-
React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large }))))));
|
|
43
|
+
React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large, colour: item.colour }))))));
|
|
44
44
|
};
|
|
45
45
|
export default Checklist;
|
|
@@ -4,6 +4,7 @@ export interface ChecklistItemProps {
|
|
|
4
4
|
value: boolean;
|
|
5
5
|
onChange: (value: boolean) => void;
|
|
6
6
|
large: boolean;
|
|
7
|
+
colour?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const ChecklistItem: ({ label, value, onChange, large }: ChecklistItemProps) => JSX.Element;
|
|
9
|
+
declare const ChecklistItem: ({ label, value, onChange, large, colour }: ChecklistItemProps) => JSX.Element;
|
|
9
10
|
export default ChecklistItem;
|
|
@@ -15,7 +15,8 @@ const Outerlabel = styled(motion.label) `
|
|
|
15
15
|
font-weight: ${(props) => props.theme.fonts.default.weight};
|
|
16
16
|
color: ${(props) => (props.checked ? props.theme.colours.defaultBorder : props.theme.colours.defaultFont)};
|
|
17
17
|
|
|
18
|
-
background-color: ${(props) => props.theme.colours.background};
|
|
18
|
+
background-color: ${(props) => props.$highlightColour ? `${props.$highlightColour}20` : props.theme.colours.background};
|
|
19
|
+
border-left: ${(props) => (props.$highlightColour ? `3px solid ${props.$highlightColour}` : '3px solid transparent')};
|
|
19
20
|
|
|
20
21
|
user-select: none;
|
|
21
22
|
cursor: pointer;
|
|
@@ -40,7 +41,7 @@ const Strikethrough = styled.div `
|
|
|
40
41
|
padding-left: 2px;
|
|
41
42
|
background-color: ${(props) => props.theme.colours.defaultBorder};
|
|
42
43
|
`;
|
|
43
|
-
const ChecklistItem = ({ label, value, onChange, large }) => {
|
|
44
|
+
const ChecklistItem = ({ label, value, onChange, large, colour }) => {
|
|
44
45
|
const theme = useTheme();
|
|
45
46
|
const handleChange = (event) => {
|
|
46
47
|
if (event.target.checked) {
|
|
@@ -50,7 +51,7 @@ const ChecklistItem = ({ label, value, onChange, large }) => {
|
|
|
50
51
|
onChange(false);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-testid": value ? 'checklist-item-checked' : 'checklist-item' },
|
|
54
|
+
return (React.createElement(Outerlabel, { checked: value, "$highlightColour": colour, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-testid": value ? 'checklist-item-checked' : 'checklist-item' },
|
|
54
55
|
React.createElement(Checkmark, { checked: value, large: large }),
|
|
55
56
|
React.createElement(Spacer, null),
|
|
56
57
|
label,
|