@thecb/components 8.4.10-beta.4 → 8.4.10

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": "8.4.10-beta.4",
3
+ "version": "8.4.10",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -218,7 +218,7 @@ const FormInput = ({
218
218
  themeValues={themeValues}
219
219
  $customHeight={customHeight}
220
220
  $extraStyles={extraStyles}
221
- autocomplete={autocomplete}
221
+ autoComplete={autocomplete}
222
222
  {...props}
223
223
  />
224
224
  ) : (
@@ -244,12 +244,12 @@ const FormInput = ({
244
244
  background={background}
245
245
  $customHeight={customHeight}
246
246
  $extraStyles={extraStyles}
247
- autocomplete={autocomplete}
247
+ autoComplete={autocomplete}
248
248
  {...props}
249
249
  />
250
250
  )}
251
251
  </Box>
252
- <Stack direction="row" justify="space-between">
252
+ <Stack direction="row" justify="space-between" aria-live="polite">
253
253
  {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
254
254
  <Text
255
255
  color={ERROR_COLOR}
@@ -57,30 +57,45 @@ const RadioButtonWithLabel = ({
57
57
  ariaInvalid,
58
58
  themeValues,
59
59
  index,
60
- handleChange = noop // optional, for custom event handling in ingesting app
61
- }) => (
62
- <InputAndLabelContainer
63
- align="center"
64
- childGap="0.5rem"
65
- activeColor={themeValues.activeColor}
66
- >
67
- <HiddenRadioInput
68
- aria-invalid={ariaInvalid}
69
- style={{ marginTop: 0 }}
70
- type="radio"
71
- name={groupName}
72
- id={id}
73
- value={value}
74
- onChange={e => {
75
- setValue(e.target.value);
76
- handleChange(e);
77
- }}
78
- defaultChecked={index === 0}
79
- />
80
- <Text
81
- as="label"
82
- htmlFor={id}
83
- extraStyles={`
60
+ handleChange = noop, // optional, for custom event handling in ingesting app
61
+ field,
62
+ config
63
+ }) => {
64
+ const getDefaultChecked = (value, idx) => {
65
+ const selectionExistsInConfig = config
66
+ .map(c => c.value)
67
+ .includes(field.rawValue);
68
+
69
+ if (selectionExistsInConfig) {
70
+ // if exists, selection comes from the redux-freeform state
71
+ return field.rawValue === value;
72
+ }
73
+ // fallback to first option as default selection
74
+ return idx === 0;
75
+ };
76
+ return (
77
+ <InputAndLabelContainer
78
+ align="center"
79
+ childGap="0.5rem"
80
+ activeColor={themeValues.activeColor}
81
+ >
82
+ <HiddenRadioInput
83
+ aria-invalid={ariaInvalid}
84
+ style={{ marginTop: 0 }}
85
+ type="radio"
86
+ name={groupName}
87
+ id={id}
88
+ value={value}
89
+ onChange={e => {
90
+ setValue(e.target.value);
91
+ handleChange(e);
92
+ }}
93
+ defaultChecked={getDefaultChecked(value, index)}
94
+ />
95
+ <Text
96
+ as="label"
97
+ htmlFor={id}
98
+ extraStyles={`
84
99
  font-size: 1rem;
85
100
  display: flex;
86
101
  width: 100%;
@@ -88,15 +103,16 @@ const RadioButtonWithLabel = ({
88
103
  cursor: pointer;
89
104
  }
90
105
  `}
91
- >
92
- <Circle
93
- activeColor={themeValues.activeColor}
94
- inactiveBorderColor={themeValues.inactiveBorderColor}
95
- />
96
- {labelText}
97
- </Text>
98
- </InputAndLabelContainer>
99
- );
106
+ >
107
+ <Circle
108
+ activeColor={themeValues.activeColor}
109
+ inactiveBorderColor={themeValues.inactiveBorderColor}
110
+ />
111
+ {labelText}
112
+ </Text>
113
+ </InputAndLabelContainer>
114
+ );
115
+ };
100
116
 
101
117
  export default themeComponent(
102
118
  RadioButtonWithLabel,
@@ -3,14 +3,14 @@ import { fallbackValues } from "./SolidDivider.theme";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
  import { Box } from "../layouts";
5
5
 
6
- const SolidDivider = ({ themeValues }) => (
6
+ const SolidDivider = ({ borderColor, borderSize, themeValues }) => (
7
7
  <Box
8
8
  padding="0"
9
9
  minWidth="100%"
10
10
  minHeight="1px"
11
- borderColor={themeValues.borderColor}
12
- borderSize={themeValues.borderSize}
13
- borderWidthOverride={`0px 0px ${themeValues.borderSize} 0px`}
11
+ borderColor={borderColor || themeValues.borderColor}
12
+ borderSize={borderSize || themeValues.borderSize}
13
+ borderWidthOverride={`0px 0px ${borderSize || themeValues.borderSize} 0px`}
14
14
  />
15
15
  );
16
16
 
@@ -46,7 +46,7 @@ const EmailForm = ({
46
46
  showErrors={showErrors}
47
47
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
48
48
  isEmail
49
- autocomplete="email"
49
+ autoComplete="email"
50
50
  />
51
51
  {showWalletCheckbox && (
52
52
  <Checkbox
@@ -16,16 +16,18 @@ import { Box, Cluster } from "../../atoms/layouts";
16
16
  */
17
17
 
18
18
  const Module = ({
19
+ variant = "default",
20
+ as,
21
+ disabled,
19
22
  heading,
23
+ rightTitleContent,
24
+ titleID = "",
20
25
  spacing = "1rem",
21
26
  padding = "0",
27
+ margin = "0",
22
28
  spacingBottom = "2.5rem",
23
- themeValues,
24
- variant = "default",
25
29
  fontSize,
26
- as,
27
- titleID = "",
28
- rightTitleContent,
30
+ themeValues,
29
31
  children
30
32
  }) => {
31
33
  const themedFontSize =
@@ -38,6 +40,7 @@ const Module = ({
38
40
  const themedElemType =
39
41
  variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
40
42
  const computedElemType = as || themedElemType;
43
+ const disabledStyles = "opacity: 0.40;";
41
44
  const headingText = (
42
45
  <Title
43
46
  weight={themeValues.fontWeight}
@@ -53,7 +56,12 @@ const Module = ({
53
56
  );
54
57
 
55
58
  return (
56
- <Fragment>
59
+ <Box
60
+ aria-disabled={disabled}
61
+ extraStyles={disabled && disabledStyles}
62
+ padding="0"
63
+ role={"group"}
64
+ >
57
65
  {heading && !rightTitleContent && headingText}
58
66
  {heading && rightTitleContent && (
59
67
  <Cluster justify="space-between" align="center" nowrap>
@@ -61,7 +69,7 @@ const Module = ({
61
69
  {rightTitleContent}
62
70
  </Cluster>
63
71
  )}
64
- <Box padding={`0 0 ${spacingBottom}`}>
72
+ <Box padding={`0 0 ${spacingBottom}`} extraStyles={`margin: ${margin}`}>
65
73
  <Box
66
74
  padding={padding}
67
75
  background={themeValues.backgroundColor}
@@ -71,7 +79,7 @@ const Module = ({
71
79
  {children}
72
80
  </Box>
73
81
  </Box>
74
- </Fragment>
82
+ </Box>
75
83
  );
76
84
  };
77
85
 
@@ -48,6 +48,8 @@ const RadioGroup = ({
48
48
  groupName={groupName}
49
49
  setValue={setValue}
50
50
  handleChange={handleChange}
51
+ field={field}
52
+ config={config}
51
53
  aria-invalid={field.dirty && field.hasErrors}
52
54
  />
53
55
  ))}
@@ -27,7 +27,7 @@ export const radioGroup = () => (
27
27
  config={config}
28
28
  groupName="radio-button-group"
29
29
  field={{
30
- rawValue: "Hello World",
30
+ rawValue: "bar",
31
31
  dirty: false
32
32
  }}
33
33
  fieldActions={{
@@ -42,6 +42,7 @@ const RadioSection = ({
42
42
  staggeredAnimation = false,
43
43
  initiallyOpen = true,
44
44
  openHeight = "auto",
45
+ containerStyles = "",
45
46
  ariaDescribedBy
46
47
  }) => {
47
48
  const handleKeyDown = (id, e) => {
@@ -98,6 +99,7 @@ const RadioSection = ({
98
99
  padding="1px"
99
100
  border={`1px solid ${themeValues.borderColor}`}
100
101
  borderRadius="4px"
102
+ extraStyles={containerStyles}
101
103
  >
102
104
  <Stack childGap="0">
103
105
  {sections
@@ -36,6 +36,7 @@ const GRECIAN_GREY = "#E5E7EC"; // CBS-200
36
36
  const BLACK_SQUEEZE = "#EAF2F7";
37
37
  const GREY_CHATEAU = "#959CA8"; // CBS-500
38
38
  const COOL_GREY_05 = "#fbfcfd"; // CBS-050
39
+ const MANATEE_GREY = "#878E9B"; // CB-60 (cool)
39
40
  // BLUE
40
41
  const CLOUDBURST_BLUE = "#26395c";
41
42
  const ZODIAC_BLUE = "#14284b";
@@ -171,6 +172,7 @@ export {
171
172
  CHARADE_GREY,
172
173
  GRECIAN_GREY,
173
174
  COOL_GREY_05,
175
+ MANATEE_GREY,
174
176
  BLACK_SQUEEZE,
175
177
  GREY_CHATEAU,
176
178
  CLOUDBURST_BLUE,
@@ -1,5 +1,5 @@
1
1
  export default interface Field {
2
- hasErrors?: boolean;
3
- dirty?: boolean;
4
- rawValue?: string;
2
+ hasErrors: boolean;
3
+ dirty: boolean;
4
+ rawValue: string;
5
5
  }