@thecb/components 10.12.4 → 10.12.5-beta.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.
Files changed (29) hide show
  1. package/dist/index.cjs.js +304 -690
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.esm.js +305 -689
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/.DS_Store +0 -0
  8. package/src/components/atoms/card/CardText.js +3 -4
  9. package/src/components/atoms/checkbox/Checkbox.js +9 -22
  10. package/src/components/atoms/checkbox/Checkbox.stories.js +13 -17
  11. package/src/components/atoms/checkbox/Checkbox.theme.js +2 -6
  12. package/src/components/atoms/icons/icons.stories.js +1 -5
  13. package/src/components/atoms/icons/index.js +1 -5
  14. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +25 -33
  15. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.stories.js +4 -2
  16. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +7 -15
  17. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +3 -7
  18. package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +13 -16
  19. package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +14 -24
  20. package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +18 -22
  21. package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +41 -43
  22. package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +41 -52
  23. package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +7 -10
  24. package/src/components/molecules/multiple-select-filter/index.d.ts +2 -2
  25. package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +0 -45
  26. package/src/components/atoms/icons/PaymentStatusIcon.d.ts +0 -1
  27. package/src/components/atoms/icons/PaymentStatusIcon.js +0 -28
  28. package/src/components/atoms/icons/PersonIcon.d.ts +0 -1
  29. package/src/components/atoms/icons/PersonIcon.js +0 -28
@@ -9,6 +9,7 @@ import {
9
9
  isChecked,
10
10
  isMaxSelectionReached
11
11
  } from "./util";
12
+ import { GHOST_GREY } from "../../../../constants/colors";
12
13
 
13
14
  const FilterableList = ({
14
15
  id,
@@ -67,20 +68,23 @@ const FilterableList = ({
67
68
  return (
68
69
  <Box
69
70
  id={id}
70
- padding="0"
71
71
  role="listbox"
72
- aria-label="Filter options container"
73
- onKeyDown={handleKeyDown}
72
+ padding="0"
74
73
  extraStyles={`
75
74
  overflow-y: auto;
76
75
  max-height: 250px;
77
76
  display: flex;
78
77
  flex-flow: column;
79
- padding-bottom: 0.5rem;
80
- `}
78
+ `}
79
+ onKeyDown={handleKeyDown}
81
80
  >
82
81
  {sortedAppliedOptions?.length > 0 && (
83
- <>
82
+ <Box
83
+ padding="0"
84
+ extraStyles={
85
+ sortedOptions.length > 0 && `border-bottom: 1px solid ${GHOST_GREY}`
86
+ }
87
+ >
84
88
  {sortedAppliedOptions.map((option, index) => {
85
89
  const checked = isChecked(option, selectedOptions);
86
90
  const tabIndex =
@@ -98,47 +102,41 @@ const FilterableList = ({
98
102
  tabIndex={tabIndex}
99
103
  name={name}
100
104
  themeValues={themeValues}
101
- showDivider={
102
- sortedOptions.length > 0 &&
103
- index === sortedAppliedOptions.length - 1
104
- }
105
105
  ></FilterableListItem>
106
106
  );
107
107
  })}
108
- </>
108
+ </Box>
109
109
  )}
110
- <>
111
- {sortedOptions.map((option, index) => {
112
- const checked = isChecked(option, selectedOptions);
113
- const isDisabled =
114
- isMaxSelectionReached(maxSelections, selectedOptions) && !checked;
115
- const indexOffset = sortedAppliedOptions?.length
116
- ? sortedAppliedOptions?.length
117
- : 0;
118
- const currentIndex = index === 0 ? indexOffset : index + indexOffset;
119
- const tabIndex =
120
- currentIndex === focusedIndex ||
121
- (indexOffset === 0 &&
122
- currentIndex === indexOffset &&
123
- focusedIndex === -1)
124
- ? "0"
125
- : "-1";
126
- return (
127
- <FilterableListItem
128
- key={currentIndex}
129
- ref={el => (itemRefs.current[currentIndex] = el)}
130
- index={currentIndex}
131
- option={option}
132
- checked={checked}
133
- selectOption={isDisabled ? noop : handleSelectOption}
134
- disabled={isDisabled}
135
- tabIndex={tabIndex}
136
- name={name}
137
- themeValues={themeValues}
138
- ></FilterableListItem>
139
- );
140
- })}
141
- </>
110
+ {sortedOptions.map((option, index) => {
111
+ const checked = isChecked(option, selectedOptions);
112
+ const isDisabled =
113
+ isMaxSelectionReached(maxSelections, selectedOptions) && !checked;
114
+ const indexOffset = sortedAppliedOptions?.length
115
+ ? sortedAppliedOptions?.length
116
+ : 0;
117
+ const currentIndex = index === 0 ? indexOffset : index + indexOffset;
118
+ const tabIndex =
119
+ currentIndex === focusedIndex ||
120
+ (indexOffset === 0 &&
121
+ currentIndex === indexOffset &&
122
+ focusedIndex === -1)
123
+ ? "0"
124
+ : "-1";
125
+ return (
126
+ <FilterableListItem
127
+ key={currentIndex}
128
+ ref={el => (itemRefs.current[currentIndex] = el)}
129
+ index={currentIndex}
130
+ option={option}
131
+ checked={checked}
132
+ selectOption={isDisabled ? noop : handleSelectOption}
133
+ disabled={isDisabled}
134
+ tabIndex={tabIndex}
135
+ name={name}
136
+ themeValues={themeValues}
137
+ ></FilterableListItem>
138
+ );
139
+ })}
142
140
  </Box>
143
141
  );
144
142
  };
@@ -1,7 +1,6 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import Checkbox from "../../../atoms/checkbox";
3
- import { GHOST_GREY } from "../../../../constants/colors";
4
- import CheckboxCheckmarkIcon from "../../../atoms/icons/CheckboxCheckmarkIcon";
3
+ import { Box } from "../../../atoms";
5
4
 
6
5
  const FilterableListItem = forwardRef(
7
6
  (
@@ -13,64 +12,54 @@ const FilterableListItem = forwardRef(
13
12
  disabled,
14
13
  tabIndex,
15
14
  name,
16
- showDivider,
17
- extraStyles,
18
15
  themeValues
19
16
  },
20
17
  ref
21
18
  ) => {
22
- const dividerStyles = `
23
- ::after {
24
- content: '';
25
- position: absolute;
26
- width: 100%;
27
- display: block;
28
- height: 1px;
29
- background-color: ${GHOST_GREY};
30
- bottom: -0.5rem;
31
- left: 0;
32
- }`;
33
19
  return (
34
- <Checkbox
20
+ <Box
21
+ padding="0"
35
22
  key={index}
36
- ref={ref}
37
- title={option.name}
38
- name={option.name}
39
- role="option"
40
- aria-selected={checked}
41
- tabIndex={tabIndex}
42
- dataQa={`${name}-option-${index}`}
43
- checked={checked}
44
- onChange={() => selectOption(option)}
45
- textExtraStyles={`font-size: 0.875rem; margin: 0;`}
46
- disabled={disabled}
47
23
  extraStyles={`
48
- padding: 0.375rem 0.625rem;
49
- margin: 0;
50
- :hover,
51
- :active,
52
- :focus {
53
- background-color: ${themeValues.primaryHoverColor};
54
- }
55
- ${showDivider && dividerStyles}
56
- ${extraStyles}
24
+ :hover,
25
+ :active,
26
+ :focus {
27
+ background-color: ${themeValues.primaryColor};
28
+ }
29
+ `}
30
+ >
31
+ <Checkbox
32
+ ref={ref}
33
+ title={option.name}
34
+ name={option.name}
35
+ checked={checked}
36
+ onChange={() => selectOption(option)}
37
+ textExtraStyles={`font-size: 0.875rem; margin: 0;`}
38
+ disabled={disabled}
39
+ extraStyles={`
40
+ padding: 0.075rem 0.325rem;
41
+ margin: 0;
42
+ :hover,
43
+ :active,
44
+ :focus {
45
+ background-color: ${themeValues.primaryColor};
46
+ }
57
47
  `}
58
- checkboxMargin={showDivider ? "0 0 1rem" : "0"}
59
- hasIconOverride={true}
60
- icon={CheckboxCheckmarkIcon}
61
- checkboxExtraStyles={`
62
- display: flex;
63
- justify-content: center;
64
- align-items: center;
65
- height: 20px;
66
- width: 20px;
67
- ${
68
- checked && !disabled
69
- ? `background: ` + themeValues.secondaryColor + `;`
70
- : ""
71
- }
72
- `}
73
- />
48
+ checkboxMargin="0.3rem"
49
+ role="option"
50
+ checkboxExtraStyles={`
51
+ width: 1.375rem;
52
+ height: 1.375rem;
53
+ ${
54
+ checked && !disabled
55
+ ? `background: ` + themeValues.secondaryColor + `;`
56
+ : ""
57
+ }
58
+ `}
59
+ tabIndex={tabIndex}
60
+ dataQa={`${name}-option-${index}`}
61
+ />
62
+ </Box>
74
63
  );
75
64
  }
76
65
  );
@@ -22,16 +22,13 @@ const SearchBox = ({
22
22
  placeholder={placeholder}
23
23
  disabled={disabled}
24
24
  extraStyles={`
25
- height: 2.875rem;
26
- border: 0;
27
- border-radius: 0;
28
- padding: 0.45rem;
29
- font-size: 0.875rem;
30
- border-bottom: 1px solid ${GHOST_GREY};
31
- :focus {
32
- outline-offset: -3px;
33
- }
34
- `}
25
+ height: 2.875rem;
26
+ border: 0;
27
+ border-radius: 0;
28
+ padding: 0.45rem;
29
+ font-size: 0.875rem;
30
+ border-bottom: 1px solid ${GHOST_GREY};
31
+ `}
35
32
  />
36
33
  )}
37
34
  </Box>
@@ -10,9 +10,7 @@ export interface MultipleSelectFilterProps {
10
10
  actions: FieldActions;
11
11
  autocompleteValue?: boolean;
12
12
  btnContentOverride?: JSX.Element;
13
- btnExtraStyles?: string;
14
13
  disabled: boolean;
15
- dropdownExtraStyles?: string;
16
14
  extraStyles?: string;
17
15
  fields: {
18
16
  searchTerm: Field;
@@ -26,6 +24,8 @@ export interface MultipleSelectFilterProps {
26
24
  options: SearchableSelectOption[];
27
25
  placeholder?: string;
28
26
  searchable?: boolean;
27
+ selectedOptions: SearchableSelectOption[];
28
+ setSelectedOptions: (options: SearchableSelectOption[]) => void;
29
29
  themeValues?: any[];
30
30
  truncateBtnTextWidth?: string;
31
31
  }
@@ -1,45 +0,0 @@
1
- import React from "react";
2
-
3
- const CheckboxCheckmarkIcon = ({
4
- width = "18",
5
- height = "18",
6
- color = "#FEFEFE",
7
- ...props
8
- }) => (
9
- <svg
10
- xmlns="http://www.w3.org/2000/svg"
11
- width={width}
12
- height={height}
13
- viewBox={`0 0 ${width} ${height}`}
14
- fill="none"
15
- {...props}
16
- >
17
- <path
18
- fillRule="evenodd"
19
- clipRule="evenodd"
20
- d="M13.7503 5.35354C13.555 5.15828 13.2385 5.15828 13.0432 5.35354L7.52373 10.873L5.52808 8.87735C5.33282 8.68209 5.01624 8.68209 4.82097 8.87735L4.35348 9.34484C4.15822 9.54011 4.15822 9.85669 4.35348 10.052L6.70268 12.4012L7.17018 12.8687C7.36544 13.0639 7.68203 13.0639 7.87729 12.8687L8.34478 12.4012L14.2178 6.52814C14.4131 6.33288 14.4131 6.0163 14.2178 5.82104L13.7503 5.35354Z"
21
- fill="#FEFEFE"
22
- />
23
- <mask
24
- id="mask0_3361_1486"
25
- style={{ maskType: "luminance" }}
26
- maskUnits="userSpaceOnUse"
27
- x="4"
28
- y="5"
29
- width="11"
30
- height="9"
31
- >
32
- <path
33
- fillRule="evenodd"
34
- clipRule="evenodd"
35
- d="M13.7503 5.35354C13.555 5.15828 13.2385 5.15828 13.0432 5.35354L7.52373 10.873L5.52808 8.87735C5.33282 8.68209 5.01624 8.68209 4.82097 8.87735L4.35348 9.34484C4.15822 9.54011 4.15822 9.85669 4.35348 10.052L6.70268 12.4012L7.17018 12.8687C7.36544 13.0639 7.68203 13.0639 7.87729 12.8687L8.34478 12.4012L14.2178 6.52814C14.4131 6.33288 14.4131 6.0163 14.2178 5.82104L13.7503 5.35354Z"
36
- fill="white"
37
- />
38
- </mask>
39
- <g mask="url(#mask0_3361_1486)">
40
- <rect width={width} height={height} fill={color} />
41
- </g>
42
- </svg>
43
- );
44
-
45
- export default CheckboxCheckmarkIcon;
@@ -1 +0,0 @@
1
- export const PaymentStatusIcon: JSX.Element;
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { CHARADE_GREY } from "../../../constants/colors";
3
-
4
- const PaymentStatusIcon = ({
5
- width = "20",
6
- height = "21",
7
- color = CHARADE_GREY,
8
- ...props
9
- }) => {
10
- return (
11
- <svg
12
- xmlns="http://www.w3.org/2000/svg"
13
- width={width}
14
- height={height}
15
- viewBox={`0 0 ${width} ${height}`}
16
- fill="none"
17
- {...props}
18
- >
19
- <path
20
- fillRule="evenodd"
21
- clipRule="evenodd"
22
- d="M10.875 4.375C10.875 3.89175 11.2668 3.5 11.75 3.5H16.125C16.6082 3.5 17 3.89175 17 4.375V8.75C17 9.23325 16.6082 9.625 16.125 9.625H15.25V15.75C15.25 16.7165 14.4665 17.5 13.5 17.5H4.75C3.7835 17.5 3 16.7165 3 15.75V7C3 6.0335 3.7835 5.25 4.75 5.25H10.875V4.375ZM10.875 8.75V6.5625H4.75C4.50838 6.5625 4.3125 6.75838 4.3125 7V15.75C4.3125 15.9916 4.50838 16.1875 4.75 16.1875H13.5C13.7416 16.1875 13.9375 15.9916 13.9375 15.75V9.625H11.75C11.2668 9.625 10.875 9.23325 10.875 8.75ZM13.9375 7.875C14.6624 7.875 15.25 7.28737 15.25 6.5625C15.25 5.83763 14.6624 5.25 13.9375 5.25C13.2126 5.25 12.625 5.83763 12.625 6.5625C12.625 7.28737 13.2126 7.875 13.9375 7.875Z"
23
- fill={color}
24
- />
25
- </svg>
26
- );
27
- };
28
- export default PaymentStatusIcon;
@@ -1 +0,0 @@
1
- export const PersonIcon: JSX.Element;
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { CHARADE_GREY } from "../../../constants/colors";
3
-
4
- const PersonIcon = ({
5
- width = "20",
6
- height = "21",
7
- color = CHARADE_GREY,
8
- ...props
9
- }) => {
10
- return (
11
- <svg
12
- xmlns="http://www.w3.org/2000/svg"
13
- width={width}
14
- height={height}
15
- viewBox={`0 0 ${width} ${height}`}
16
- fill="none"
17
- {...props}
18
- >
19
- <path
20
- fillRule="evenodd"
21
- clipRule="evenodd"
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
- fill={color}
24
- />
25
- </svg>
26
- );
27
- };
28
- export default PersonIcon;