@thecb/components 9.2.0-beta.12 → 9.2.0-beta.13

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": "9.2.0-beta.12",
3
+ "version": "9.2.0-beta.13",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -21,8 +21,10 @@ const FormSelect = ({
21
21
  disabled,
22
22
  themeValues,
23
23
  hasTitles = false,
24
- autocompleteValue, // browser autofill value, like country-name or address-level1 for state
25
- smoothScroll = true // whether the browser should animate scroll to selected item on first open
24
+ autocompleteValue, // browser autofill value, like country-name
25
+ smoothScroll = true, // whether the browser should animate scroll to selected item on first open
26
+ dataQa = null,
27
+ widthFitOptions = false
26
28
  }) => {
27
29
  const [open, setOpen] = useState(false);
28
30
  const dropdownRef = useRef(null);
@@ -41,7 +43,12 @@ const FormSelect = ({
41
43
  });
42
44
 
43
45
  return (
44
- <SelectContainer ref={dropdownRef} disabled={disabled}>
46
+ <SelectContainer
47
+ ref={dropdownRef}
48
+ disabled={disabled}
49
+ aria-disabled={disabled}
50
+ data-qa={dataQa}
51
+ >
45
52
  <Box padding="0" minWidth="100%">
46
53
  <Cluster justify="space-between" align="center">
47
54
  <Text
@@ -67,6 +74,7 @@ const FormSelect = ({
67
74
  "error message"
68
75
  )}
69
76
  maxHeight={dropdownMaxHeight}
77
+ widthFitOptions={widthFitOptions}
70
78
  hasTitles={hasTitles}
71
79
  placeholder={options[0] ? options[0].text : ""}
72
80
  options={options}
@@ -76,6 +84,9 @@ const FormSelect = ({
76
84
  isError={
77
85
  (field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
78
86
  }
87
+ ariaInvalid={
88
+ (field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
89
+ }
79
90
  onSelect={
80
91
  onChange ? value => onChange(value) : value => fieldActions.set(value)
81
92
  }
@@ -84,24 +95,27 @@ const FormSelect = ({
84
95
  autocompleteValue={autocompleteValue}
85
96
  smoothScroll={smoothScroll}
86
97
  />
87
- <Stack direction="row" justify="space-between" aria-live="polite">
88
- {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
89
- <Text
90
- color={ERROR_COLOR}
91
- variant="pXS"
92
- weight={themeValues.fontWeight}
93
- extraStyles={`word-break: break-word;
94
- font-family: Public Sans;
95
- &::first-letter {
96
- text-transform: uppercase;
97
- }`}
98
- id={createIdFromString(labelTextWhenNoError, "error message")}
99
- >
100
- {errorMessages[field.errors[0]]}
101
- </Text>
102
- ) : (
103
- <Text extraStyles={`height: ${themeValues.lineHeight};`} />
104
- )}
98
+ <Stack direction="row" justify="space-between">
99
+ <Text
100
+ color={ERROR_COLOR}
101
+ variant="pXS"
102
+ weight={themeValues.fontWeight}
103
+ extraStyles={`
104
+ word-break: break-word;
105
+ font-family: Public Sans;
106
+ &::first-letter {
107
+ text-transform: uppercase;
108
+ }
109
+ `}
110
+ id={createIdFromString(labelTextWhenNoError, "error message")}
111
+ aria-live="polite"
112
+ aria-atomic={true}
113
+ data-qa={createIdFromString(labelTextWhenNoError, "error message")}
114
+ >
115
+ {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
116
+ ? errorMessages[field.errors[0]]
117
+ : ""}
118
+ </Text>
105
119
  </Stack>
106
120
  </SelectContainer>
107
121
  );
@@ -24,19 +24,21 @@ const RadioButton = ({
24
24
  const buttonBorder = {
25
25
  onFocused: {
26
26
  borderColor: themeValues.activeColor,
27
- boxShadow: `0px 0px 4px 0px ${themeValues.activeColor}`
27
+ outline: `3px solid ${themeValues.activeColor}`,
28
+ outlineOffset: "2px"
28
29
  },
29
30
  offFocused: {
30
31
  borderColor: themeValues.activeColor,
31
- boxShadow: `0px 0px 4px 0px ${themeValues.activeColor}`
32
+ outline: `3px solid ${themeValues.activeColor}`,
33
+ outlineOffset: "2px"
32
34
  },
33
35
  on: {
34
36
  borderColor: themeValues.activeColor,
35
- boxShadow: "0px 0px 0px 0px #FFFFFF"
37
+ outline: "0"
36
38
  },
37
39
  off: {
38
40
  borderColor: themeValues.inactiveColor,
39
- boxShadow: "0px 0px 0px 0px #FFFFFF"
41
+ outline: "0"
40
42
  }
41
43
  };
42
44
 
@@ -97,7 +99,7 @@ const RadioButton = ({
97
99
  borderWidth="1px"
98
100
  borderStyle="solid"
99
101
  borderRadius="12px"
100
- margin="4px 14px 4px 4px"
102
+ margin="6px 14px 6px 6px"
101
103
  height="24px"
102
104
  width="24px"
103
105
  variants={buttonBorder}
@@ -1,7 +1,7 @@
1
- import { MATISSE_BLUE, GREY_CHATEAU } from "../../../../constants/colors";
1
+ import { MATISSE_BLUE, STORM_GREY } from "../../../../constants/colors";
2
2
 
3
3
  const activeColor = `${MATISSE_BLUE}`;
4
- const inactiveColor = `${GREY_CHATEAU}`;
4
+ const inactiveColor = `${STORM_GREY}`;
5
5
 
6
6
  export const fallbackValues = {
7
7
  activeColor,
@@ -12,6 +12,7 @@ import {
12
12
  WHITE
13
13
  } from "../../../constants/colors";
14
14
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
15
+ import { generateShadows } from "../../../util/generateShadows";
15
16
 
16
17
  const VARIANTS = {
17
18
  SUCCESS: "success",
@@ -37,7 +38,7 @@ const ToastNotification = ({
37
38
  ? backgroundColor
38
39
  : variant === VARIANTS.SUCCESS
39
40
  ? HINT_GREEN
40
- : variant === "error"
41
+ : variant === VARIANTS.ERROR
41
42
  ? ERROR_BACKGROUND_COLOR
42
43
  : WHITE
43
44
  }
@@ -47,9 +48,7 @@ const ToastNotification = ({
47
48
  tabIndex={toastOpen ? "-1" : "0"}
48
49
  padding="0rem 1rem"
49
50
  borderRadius="4px"
50
- boxShadow="0px 4px 4px rgba(41, 42, 51, 0.15),
51
- 0px 1px 7px rgba(41, 42, 51, 0.2),
52
- 0px 7px 12px rgba(41, 42, 51, 0.15)"
51
+ boxShadow={generateShadows().standard.base}
53
52
  extraStyles={`
54
53
  display: ${toastOpen ? "block" : "none"};
55
54
  position: fixed; bottom: 4rem; left: 4rem;
@@ -58,8 +57,8 @@ const ToastNotification = ({
58
57
  `}
59
58
  >
60
59
  <Cluster align="center" childGap={childGap}>
61
- {variant === "success" && <SuccessfulIconMedium />}
62
- {variant === "error" && <ErroredIcon />}
60
+ {variant === VARIANTS.SUCCESS && <SuccessfulIconMedium />}
61
+ {variant === VARIANTS.ERROR && <ErroredIcon />}
63
62
  <Box padding="1rem 0" maxWidth={maxWidth}>
64
63
  <Paragraph
65
64
  weight={FONT_WEIGHT_SEMIBOLD}