@okta/odyssey-react-mui 1.8.2 → 1.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "1.8.2",
3
+ "version": "1.9.0",
4
4
  "description": "React MUI components for Odyssey, Okta's design system",
5
5
  "author": "Okta, Inc.",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "@mui/system": "^5.14.9",
52
52
  "@mui/utils": "^5.11.2",
53
53
  "@mui/x-date-pickers": "^5.0.15",
54
- "@okta/odyssey-design-tokens": "1.8.2",
54
+ "@okta/odyssey-design-tokens": "1.9.0",
55
55
  "date-fns": "^2.30.0",
56
56
  "i18next": "^23.5.1",
57
57
  "material-react-table": "^2.0.2",
@@ -63,5 +63,5 @@
63
63
  "react": ">=17 <19",
64
64
  "react-dom": ">=17 <19"
65
65
  },
66
- "gitHead": "0b0034e9fa97a5dd852f01249aa5093484040ec9"
66
+ "gitHead": "dbcfcc17285a611b6d6ea641429e1a42ba62e105"
67
67
  }
package/src/Checkbox.tsx CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  Checkbox as MuiCheckbox,
17
17
  CheckboxProps as MuiCheckboxProps,
18
18
  FormControlLabel,
19
+ FormControlLabelProps as MuiFormControlLabelProps,
19
20
  FormHelperText,
20
21
  } from "@mui/material";
21
22
 
@@ -68,6 +69,10 @@ export type CheckboxProps = {
68
69
  * The value attribute of the Checkbox
69
70
  */
70
71
  value?: string;
72
+ /**
73
+ * Callback fired when the blur event happens. Provides event value.
74
+ */
75
+ onBlur?: MuiFormControlLabelProps["onBlur"];
71
76
  } & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> &
72
77
  CheckedFieldProps<MuiCheckboxProps> &
73
78
  SeleniumProps;
@@ -85,6 +90,7 @@ const Checkbox = ({
85
90
  hint,
86
91
  name: nameOverride,
87
92
  onChange: onChangeProp,
93
+ onBlur: onBlurProp,
88
94
  testId,
89
95
  validity = "inherit",
90
96
  value,
@@ -127,6 +133,13 @@ const Checkbox = ({
127
133
  [onChangeProp]
128
134
  );
129
135
 
136
+ const onBlur = useCallback<NonNullable<MuiFormControlLabelProps["onBlur"]>>(
137
+ (event) => {
138
+ onBlurProp?.(event);
139
+ },
140
+ [onBlurProp]
141
+ );
142
+
130
143
  return (
131
144
  <FormControlLabel
132
145
  sx={{ alignItems: "flex-start" }}
@@ -157,6 +170,7 @@ const Checkbox = ({
157
170
  name={nameOverride ?? idOverride}
158
171
  value={value}
159
172
  required={isRequired}
173
+ onBlur={onBlur}
160
174
  />
161
175
  );
162
176
  };
package/src/Radio.tsx CHANGED
@@ -12,6 +12,7 @@
12
12
 
13
13
  import {
14
14
  FormControlLabel,
15
+ FormControlLabelProps as MuiFormControlLabelProps,
15
16
  Radio as MuiRadio,
16
17
  RadioProps as MuiRadioProps,
17
18
  } from "@mui/material";
@@ -41,6 +42,10 @@ export type RadioProps = {
41
42
  * Callback fired when the state is changed. Provides event and checked value.
42
43
  */
43
44
  onChange?: MuiRadioProps["onChange"];
45
+ /**
46
+ * Callback fired when the blur event happens. Provides event value.
47
+ */
48
+ onBlur?: MuiFormControlLabelProps["onBlur"];
44
49
  } & Pick<FieldComponentProps, "isDisabled" | "name"> &
45
50
  SeleniumProps;
46
51
 
@@ -53,6 +58,7 @@ const Radio = ({
53
58
  testId,
54
59
  value,
55
60
  onChange: onChangeProp,
61
+ onBlur: onBlurProp,
56
62
  }: RadioProps) => {
57
63
  const onChange = useCallback<NonNullable<MuiRadioProps["onChange"]>>(
58
64
  (event, checked) => {
@@ -61,6 +67,13 @@ const Radio = ({
61
67
  [onChangeProp]
62
68
  );
63
69
 
70
+ const onBlur = useCallback<NonNullable<MuiFormControlLabelProps["onBlur"]>>(
71
+ (event) => {
72
+ onBlurProp?.(event);
73
+ },
74
+ [onBlurProp]
75
+ );
76
+
64
77
  return (
65
78
  <FormControlLabel
66
79
  checked={isChecked}
@@ -71,6 +84,7 @@ const Radio = ({
71
84
  label={label}
72
85
  name={name}
73
86
  value={value}
87
+ onBlur={onBlur}
74
88
  />
75
89
  );
76
90
  };