@thecb/components 10.12.5-beta.0 → 10.12.6-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 (30) hide show
  1. package/dist/index.cjs.js +634 -244
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.esm.js +633 -245
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/card/CardText.js +4 -3
  8. package/src/components/atoms/checkbox/Checkbox.js +22 -9
  9. package/src/components/atoms/checkbox/Checkbox.stories.js +17 -13
  10. package/src/components/atoms/checkbox/Checkbox.theme.js +6 -2
  11. package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +45 -0
  12. package/src/components/atoms/icons/PaymentStatusIcon.d.ts +1 -0
  13. package/src/components/atoms/icons/PaymentStatusIcon.js +28 -0
  14. package/src/components/atoms/icons/PersonIcon.d.ts +1 -0
  15. package/src/components/atoms/icons/PersonIcon.js +28 -0
  16. package/src/components/atoms/icons/icons.stories.js +5 -1
  17. package/src/components/atoms/icons/index.js +5 -1
  18. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +33 -25
  19. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.stories.js +2 -4
  20. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +15 -7
  21. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +7 -3
  22. package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +16 -13
  23. package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +24 -14
  24. package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +22 -18
  25. package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +43 -41
  26. package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +52 -41
  27. package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +10 -7
  28. package/src/components/molecules/multiple-select-filter/index.d.ts +2 -2
  29. package/src/constants/regex_constants.js +1 -1
  30. package/src/components/atoms/.DS_Store +0 -0
@@ -1,23 +1,27 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import { FilterDropdownContainer } from "../MultipleSelectFilter.styled";
3
3
 
4
- const FilterDropdown = forwardRef(({ id, ariaOwns, opened, children }, ref) => {
5
- return (
6
- <>
7
- {opened && (
8
- <FilterDropdownContainer
9
- ref={ref}
10
- id={id}
11
- role="combobox"
12
- aria-expanded={opened}
13
- aria-haspopup="listbox"
14
- aria-owns={ariaOwns}
15
- >
16
- {children}
17
- </FilterDropdownContainer>
18
- )}
19
- </>
20
- );
21
- });
4
+ const FilterDropdown = forwardRef(
5
+ ({ id, ariaOwns, ariaControls, opened, extraStyles, children }, ref) => {
6
+ return (
7
+ <>
8
+ {opened && (
9
+ <FilterDropdownContainer
10
+ ref={ref}
11
+ id={id}
12
+ role="combobox"
13
+ aria-expanded={opened}
14
+ aria-haspopup="listbox"
15
+ aria-owns={ariaOwns}
16
+ aria-controls={ariaControls}
17
+ extraStyles={extraStyles}
18
+ >
19
+ {children}
20
+ </FilterDropdownContainer>
21
+ )}
22
+ </>
23
+ );
24
+ }
25
+ );
22
26
 
23
27
  export default FilterDropdown;
@@ -9,7 +9,6 @@ import {
9
9
  isChecked,
10
10
  isMaxSelectionReached
11
11
  } from "./util";
12
- import { GHOST_GREY } from "../../../../constants/colors";
13
12
 
14
13
  const FilterableList = ({
15
14
  id,
@@ -68,23 +67,20 @@ const FilterableList = ({
68
67
  return (
69
68
  <Box
70
69
  id={id}
71
- role="listbox"
72
70
  padding="0"
71
+ role="listbox"
72
+ aria-label="Filter options container"
73
+ onKeyDown={handleKeyDown}
73
74
  extraStyles={`
74
75
  overflow-y: auto;
75
76
  max-height: 250px;
76
77
  display: flex;
77
78
  flex-flow: column;
78
- `}
79
- onKeyDown={handleKeyDown}
79
+ padding-bottom: 0.5rem;
80
+ `}
80
81
  >
81
82
  {sortedAppliedOptions?.length > 0 && (
82
- <Box
83
- padding="0"
84
- extraStyles={
85
- sortedOptions.length > 0 && `border-bottom: 1px solid ${GHOST_GREY}`
86
- }
87
- >
83
+ <>
88
84
  {sortedAppliedOptions.map((option, index) => {
89
85
  const checked = isChecked(option, selectedOptions);
90
86
  const tabIndex =
@@ -102,41 +98,47 @@ const FilterableList = ({
102
98
  tabIndex={tabIndex}
103
99
  name={name}
104
100
  themeValues={themeValues}
101
+ showDivider={
102
+ sortedOptions.length > 0 &&
103
+ index === sortedAppliedOptions.length - 1
104
+ }
105
105
  ></FilterableListItem>
106
106
  );
107
107
  })}
108
- </Box>
108
+ </>
109
109
  )}
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
- })}
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
+ </>
140
142
  </Box>
141
143
  );
142
144
  };
@@ -1,6 +1,7 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import Checkbox from "../../../atoms/checkbox";
3
- import { Box } from "../../../atoms";
3
+ import { GHOST_GREY } from "../../../../constants/colors";
4
+ import CheckboxCheckmarkIcon from "../../../atoms/icons/CheckboxCheckmarkIcon";
4
5
 
5
6
  const FilterableListItem = forwardRef(
6
7
  (
@@ -12,54 +13,64 @@ const FilterableListItem = forwardRef(
12
13
  disabled,
13
14
  tabIndex,
14
15
  name,
16
+ showDivider,
17
+ extraStyles,
15
18
  themeValues
16
19
  },
17
20
  ref
18
21
  ) => {
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
+ }`;
19
33
  return (
20
- <Box
21
- padding="0"
34
+ <Checkbox
22
35
  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}
23
47
  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
- }
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}
47
57
  `}
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>
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
+ />
63
74
  );
64
75
  }
65
76
  );
@@ -22,13 +22,16 @@ 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
- `}
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
+ `}
32
35
  />
33
36
  )}
34
37
  </Box>
@@ -10,7 +10,9 @@ export interface MultipleSelectFilterProps {
10
10
  actions: FieldActions;
11
11
  autocompleteValue?: boolean;
12
12
  btnContentOverride?: JSX.Element;
13
+ btnExtraStyles?: string;
13
14
  disabled: boolean;
15
+ dropdownExtraStyles?: string;
14
16
  extraStyles?: string;
15
17
  fields: {
16
18
  searchTerm: Field;
@@ -24,8 +26,6 @@ export interface MultipleSelectFilterProps {
24
26
  options: SearchableSelectOption[];
25
27
  placeholder?: string;
26
28
  searchable?: boolean;
27
- selectedOptions: SearchableSelectOption[];
28
- setSelectedOptions: (options: SearchableSelectOption[]) => void;
29
29
  themeValues?: any[];
30
30
  truncateBtnTextWidth?: string;
31
31
  }
@@ -1 +1 @@
1
- export const URL_TEST = /(([a-z]{3,6}:\/\/)|(^|\s))([a-zA-Z0-9\-]+\.)+[a-z]{2,13}[\.\?\=\&\%\/\w\-]*\b([^@]|$)/;
1
+ export const URL_TEST = /(([a-z]{3,6}:\/\/)|(^|\s))((\d{1,3}\.){3}\d{1,3}|([a-zA-Z0-9\-]+\.)+[a-z]{2,13})[\.\?\=\&\%\/\w\-]*\b([^@]|$)/;
Binary file