@thecb/components 10.12.2-beta.0 → 10.12.2-beta.1
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/dist/index.cjs.js +36 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +36 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +8 -1
- package/src/components/atoms/checkbox/Checkbox.stories.js +17 -13
- package/src/components/atoms/checkbox/Checkbox.theme.js +6 -2
- package/src/components/atoms/icons/PersonIcon.js +3 -3
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +11 -5
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +13 -5
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +7 -3
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +11 -5
- package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +0 -1
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ const CheckboxLabelContainer = styled.label`
|
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
column-gap: 1rem;
|
|
19
|
+
cursor: pointer;
|
|
19
20
|
`;
|
|
20
21
|
|
|
21
22
|
const CheckboxIcon = styled.svg`
|
|
@@ -134,7 +135,13 @@ const Checkbox = forwardRef(
|
|
|
134
135
|
onKeyDown={e => handleClick(e, onChange)}
|
|
135
136
|
hiddenStyles={hidden}
|
|
136
137
|
background={themeValues.backgroundColor}
|
|
137
|
-
extraStyles={`
|
|
138
|
+
extraStyles={`
|
|
139
|
+
:focus {
|
|
140
|
+
outline: 0;
|
|
141
|
+
}
|
|
142
|
+
${extraStyles};
|
|
143
|
+
margin: ${checkboxMargin};
|
|
144
|
+
`}
|
|
138
145
|
{...rest}
|
|
139
146
|
>
|
|
140
147
|
<CheckboxLabelContainer data-qa={dataQa}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
3
|
import Checkbox from "./Checkbox";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
@@ -10,18 +10,22 @@ const variants = {
|
|
|
10
10
|
const defaultValue = "default";
|
|
11
11
|
const groupId = "props";
|
|
12
12
|
|
|
13
|
-
export const checkbox = () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
13
|
+
export const checkbox = () => {
|
|
14
|
+
const [checked, setChecked] = useState(false);
|
|
15
|
+
return (
|
|
16
|
+
<Checkbox
|
|
17
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
18
|
+
title={text("title", "Checkbox", "props")}
|
|
19
|
+
name={text("name", "Checkbox", "props")}
|
|
20
|
+
checked={checked}
|
|
21
|
+
error={boolean("error", false, "props")}
|
|
22
|
+
disabled={boolean("disabled", false, "props")}
|
|
23
|
+
focused={boolean("focused", false, "props")}
|
|
24
|
+
labelledById={text("labelledById", undefined, "props")}
|
|
25
|
+
onChange={() => setChecked(!checked)}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
const story = page({
|
|
27
31
|
title: "Components|Atoms/Checkbox",
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
MATISSE_BLUE,
|
|
7
7
|
RED,
|
|
8
8
|
CHARADE_GREY,
|
|
9
|
-
STORM_GREY
|
|
9
|
+
STORM_GREY,
|
|
10
|
+
ROYAL_BLUE
|
|
10
11
|
} from "../../../constants/colors";
|
|
11
12
|
|
|
12
13
|
const backgroundColor = { default: `${TRANSPARENT}` };
|
|
@@ -18,7 +19,10 @@ const disabledCheckColor = { default: `${WHITE};` };
|
|
|
18
19
|
const checkColor = { default: `${WHITE};` };
|
|
19
20
|
const errorStyles = { default: `border: 1px solid ${RED};` };
|
|
20
21
|
const focusedStyles = {
|
|
21
|
-
default: `
|
|
22
|
+
default: `
|
|
23
|
+
outline: 3px solid ${ROYAL_BLUE};
|
|
24
|
+
outline-offset: 3px;
|
|
25
|
+
`
|
|
22
26
|
};
|
|
23
27
|
const disabledCheckedStyles = {
|
|
24
28
|
default: `
|
|
@@ -2,8 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
3
3
|
|
|
4
4
|
const PersonIcon = ({
|
|
5
|
-
width = "
|
|
6
|
-
height = "
|
|
5
|
+
width = "20",
|
|
6
|
+
height = "21",
|
|
7
7
|
color = CHARADE_GREY,
|
|
8
8
|
...props
|
|
9
9
|
}) => {
|
|
@@ -19,7 +19,7 @@ const PersonIcon = ({
|
|
|
19
19
|
<path
|
|
20
20
|
fillRule="evenodd"
|
|
21
21
|
clipRule="evenodd"
|
|
22
|
-
d="
|
|
22
|
+
d="M15.25 4.8125H4.75C4.50838 4.8125 4.3125 5.00838 4.3125 5.25V15.75C4.3125 15.9916 4.50838 16.1875 4.75 16.1875H5.625V14.7778C5.625 12.8985 7.02411 11.375 8.75 11.375H11.25C12.9759 11.375 14.375 12.8985 14.375 14.7778V16.1875H15.25C15.4916 16.1875 15.6875 15.9916 15.6875 15.75V5.25C15.6875 5.00838 15.4916 4.8125 15.25 4.8125ZM4.75 17.5H5.625H14.375H15.25C16.2165 17.5 17 16.7165 17 15.75V5.25C17 4.2835 16.2165 3.5 15.25 3.5H4.75C3.7835 3.5 3 4.2835 3 5.25V15.75C3 16.7165 3.7835 17.5 4.75 17.5ZM10 10.5C11.2081 10.5 12.1875 9.52062 12.1875 8.3125C12.1875 7.10438 11.2081 6.125 10 6.125C8.79188 6.125 7.8125 7.10438 7.8125 8.3125C7.8125 9.52062 8.79188 10.5 10 10.5Z"
|
|
23
23
|
fill={color}
|
|
24
24
|
/>
|
|
25
25
|
</svg>
|
|
@@ -100,14 +100,20 @@ const MultipleSelectFilter = ({
|
|
|
100
100
|
setOpened(!opened);
|
|
101
101
|
}}
|
|
102
102
|
opened={opened}
|
|
103
|
+
backgroundHoverColor={
|
|
104
|
+
appliedOptions?.length
|
|
105
|
+
? themeValues.secondaryHoverColor
|
|
106
|
+
: themeValues.primaryHoverColor
|
|
107
|
+
}
|
|
103
108
|
backgroundColor={
|
|
104
|
-
|
|
105
|
-
? themeValues.primaryColor
|
|
106
|
-
: selectedOptions?.length
|
|
109
|
+
appliedOptions?.length
|
|
107
110
|
? themeValues.secondaryColor
|
|
108
|
-
:
|
|
111
|
+
: themeValues.primaryColor
|
|
112
|
+
}
|
|
113
|
+
textColor={appliedOptions?.length ? WHITE : CHARADE_GREY}
|
|
114
|
+
textHoverColor={
|
|
115
|
+
opened && !appliedOptions?.length ? CHARADE_GREY : WHITE
|
|
109
116
|
}
|
|
110
|
-
contentColor={!opened && selectedOptions?.length ? WHITE : CHARADE_GREY}
|
|
111
117
|
name={name}
|
|
112
118
|
filterDropdownID={filterDropdownID}
|
|
113
119
|
hasIcon={hasIcon}
|
|
@@ -39,15 +39,23 @@ const FilterButton = styled(ButtonWithAction)`
|
|
|
39
39
|
padding: 0.5rem;
|
|
40
40
|
border-radius: 0.25rem;
|
|
41
41
|
box-shadow: 0px 1px 2px 0px rgba(41, 42, 51, 0.1);
|
|
42
|
-
${({ textColor }) => `
|
|
43
|
-
color: ${textColor};
|
|
42
|
+
${({ opened, textColor, textHoverColor }) => `
|
|
43
|
+
color: ${opened ? textHoverColor : textColor};
|
|
44
|
+
:hover,
|
|
45
|
+
:active,
|
|
46
|
+
:focus {
|
|
47
|
+
color: ${textHoverColor};
|
|
48
|
+
> * {
|
|
49
|
+
color: ${textHoverColor};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
44
52
|
`}
|
|
45
|
-
${({ backgroundColor }) => `
|
|
46
|
-
background-color: ${backgroundColor};
|
|
53
|
+
${({ opened, backgroundColor, backgroundHoverColor }) => `
|
|
54
|
+
background-color: ${opened ? backgroundHoverColor : backgroundColor};
|
|
47
55
|
:hover,
|
|
48
56
|
:active,
|
|
49
57
|
:focus {
|
|
50
|
-
background-color: ${
|
|
58
|
+
background-color: ${backgroundHoverColor};
|
|
51
59
|
}
|
|
52
60
|
`}
|
|
53
61
|
`;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { INFO_BLUE, MATISSE_BLUE } from "../../../constants/colors";
|
|
1
|
+
import { INFO_BLUE, MATISSE_BLUE, WHITE } from "../../../constants/colors";
|
|
2
2
|
|
|
3
|
-
const primaryColor =
|
|
3
|
+
const primaryColor = WHITE;
|
|
4
|
+
const primaryHoverColor = INFO_BLUE;
|
|
4
5
|
const secondaryColor = MATISSE_BLUE;
|
|
6
|
+
const secondaryHoverColor = "#115D7E";
|
|
5
7
|
|
|
6
8
|
export const fallbackValues = {
|
|
7
9
|
primaryColor,
|
|
8
|
-
|
|
10
|
+
primaryHoverColor,
|
|
11
|
+
secondaryColor,
|
|
12
|
+
secondaryHoverColor
|
|
9
13
|
};
|
|
@@ -11,7 +11,9 @@ const FilterButton = forwardRef(
|
|
|
11
11
|
action = noop,
|
|
12
12
|
opened,
|
|
13
13
|
backgroundColor,
|
|
14
|
-
|
|
14
|
+
backgroundHoverColor,
|
|
15
|
+
textColor,
|
|
16
|
+
textHoverColor,
|
|
15
17
|
name,
|
|
16
18
|
filterDropdownID,
|
|
17
19
|
hasIcon = false,
|
|
@@ -39,6 +41,10 @@ const FilterButton = forwardRef(
|
|
|
39
41
|
aria-expanded={opened}
|
|
40
42
|
aria-controls={filterDropdownID}
|
|
41
43
|
backgroundColor={backgroundColor}
|
|
44
|
+
backgroundHoverColor={backgroundHoverColor}
|
|
45
|
+
textColor={textColor}
|
|
46
|
+
textHoverColor={textHoverColor}
|
|
47
|
+
opened={opened}
|
|
42
48
|
dataQa={`${name}-filter-button`}
|
|
43
49
|
extraStyles={extraStyles}
|
|
44
50
|
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
@@ -52,7 +58,7 @@ const FilterButton = forwardRef(
|
|
|
52
58
|
style={{ display: "flex", flexDirection: "row" }}
|
|
53
59
|
intrinsic
|
|
54
60
|
>
|
|
55
|
-
{hasIcon && <Icon color={
|
|
61
|
+
{hasIcon && <Icon color={opened ? textHoverColor : textColor} />}
|
|
56
62
|
<Center
|
|
57
63
|
as="span"
|
|
58
64
|
style={{
|
|
@@ -64,7 +70,7 @@ const FilterButton = forwardRef(
|
|
|
64
70
|
>
|
|
65
71
|
<Text
|
|
66
72
|
variant="pS"
|
|
67
|
-
color={
|
|
73
|
+
color={opened ? textHoverColor : textColor}
|
|
68
74
|
extraStyles={`
|
|
69
75
|
white-space: nowrap;
|
|
70
76
|
overflow: hidden;
|
|
@@ -74,11 +80,11 @@ const FilterButton = forwardRef(
|
|
|
74
80
|
>
|
|
75
81
|
{btnTextFilterDescription}
|
|
76
82
|
</Text>
|
|
77
|
-
<Text color={
|
|
83
|
+
<Text color={opened ? textHoverColor : textColor} variant="pS">
|
|
78
84
|
{btnTextItemsDescription}
|
|
79
85
|
</Text>
|
|
80
86
|
</Center>
|
|
81
|
-
<DropdownIconV2 color={
|
|
87
|
+
<DropdownIconV2 color={opened ? textHoverColor : textColor} />
|
|
82
88
|
</Center>
|
|
83
89
|
)}
|
|
84
90
|
</StyledFilterButton>
|