@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.12.2-beta.0",
3
+ "version": "10.12.2-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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={`outline: none; ${extraStyles}; margin: ${checkboxMargin};`}
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
- <Checkbox
15
- variant={select(variantsLabel, variants, defaultValue, groupId)}
16
- title={text("title", "Checkbox", "props")}
17
- name={text("name", "Checkbox", "props")}
18
- checked={boolean("checked", false, "props")}
19
- error={boolean("error", false, "props")}
20
- disabled={boolean("disabled", false, "props")}
21
- focused={boolean("focused", false, "props")}
22
- labelledById={text("labelledById", undefined, "props")}
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: `box-shadow: 0 0 5px 0 ${MATISSE_BLUE};`
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 = "14",
6
- height = "15",
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="M12.25 1.8125H1.75C1.50838 1.8125 1.3125 2.00838 1.3125 2.25V12.75C1.3125 12.9916 1.50838 13.1875 1.75 13.1875H2.625V11.7778C2.625 9.89848 4.02411 8.375 5.75 8.375H8.25C9.97589 8.375 11.375 9.89848 11.375 11.7778V13.1875H12.25C12.4916 13.1875 12.6875 12.9916 12.6875 12.75V2.25C12.6875 2.00838 12.4916 1.8125 12.25 1.8125ZM1.75 14.5H2.625H11.375H12.25C13.2165 14.5 14 13.7165 14 12.75V2.25C14 1.2835 13.2165 0.5 12.25 0.5H1.75C0.783502 0.5 0 1.2835 0 2.25V12.75C0 13.7165 0.783502 14.5 1.75 14.5ZM7 7.5C8.20812 7.5 9.1875 6.52062 9.1875 5.3125C9.1875 4.10438 8.20812 3.125 7 3.125C5.79188 3.125 4.8125 4.10438 4.8125 5.3125C4.8125 6.52062 5.79188 7.5 7 7.5Z"
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
- opened
105
- ? themeValues.primaryColor
106
- : selectedOptions?.length
109
+ appliedOptions?.length
107
110
  ? themeValues.secondaryColor
108
- : WHITE
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: ${backgroundColor};
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 = INFO_BLUE;
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
- secondaryColor
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
- contentColor,
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={contentColor} />}
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={contentColor}
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={contentColor} variant="pS">
83
+ <Text color={opened ? textHoverColor : textColor} variant="pS">
78
84
  {btnTextItemsDescription}
79
85
  </Text>
80
86
  </Center>
81
- <DropdownIconV2 color={contentColor} />
87
+ <DropdownIconV2 color={opened ? textHoverColor : textColor} />
82
88
  </Center>
83
89
  )}
84
90
  </StyledFilterButton>
@@ -51,7 +51,6 @@ const FilterableListItem = forwardRef(
51
51
  :active,
52
52
  :focus {
53
53
  background-color: ${themeValues.primaryColor};
54
- outline-offset: -3px;
55
54
  }
56
55
  ${showDivider && dividerStyles}
57
56
  ${extraStyles}