@okta/odyssey-react-mui 1.9.11 → 1.9.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/CHANGELOG.md +8 -0
- package/dist/Accordion.js +3 -1
- package/dist/Accordion.js.map +1 -1
- package/dist/AllowedProps.js +2 -0
- package/dist/AllowedProps.js.map +1 -0
- package/dist/Autocomplete.js +4 -2
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Badge.js +35 -30
- package/dist/Badge.js.map +1 -1
- package/dist/Banner.js +5 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.js +4 -2
- package/dist/Box.js.map +1 -1
- package/dist/Breadcrumbs.js +5 -1
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Button.js +3 -1
- package/dist/Button.js.map +1 -1
- package/dist/Callout.js +4 -1
- package/dist/Callout.js.map +1 -1
- package/dist/Checkbox.js +5 -2
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.js +4 -2
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/CircularProgress.js.map +1 -1
- package/dist/Dialog.js +2 -0
- package/dist/Dialog.js.map +1 -1
- package/dist/FieldError.js +4 -1
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldHint.js +3 -1
- package/dist/FieldHint.js.map +1 -1
- package/dist/FieldLabel.js +4 -1
- package/dist/FieldLabel.js.map +1 -1
- package/dist/Fieldset.js +4 -1
- package/dist/Fieldset.js.map +1 -1
- package/dist/Form.js +4 -1
- package/dist/Form.js.map +1 -1
- package/dist/Link.js +2 -0
- package/dist/Link.js.map +1 -1
- package/dist/MenuButton.js +3 -1
- package/dist/MenuButton.js.map +1 -1
- package/dist/MenuItem.js.map +1 -1
- package/dist/NativeSelect.js +4 -2
- package/dist/NativeSelect.js.map +1 -1
- package/dist/PasswordField.js +3 -1
- package/dist/PasswordField.js.map +1 -1
- package/dist/Radio.js +2 -0
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +3 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/ScreenReaderText.js +3 -1
- package/dist/ScreenReaderText.js.map +1 -1
- package/dist/SearchField.js +3 -1
- package/dist/SearchField.js.map +1 -1
- package/dist/Select.js +4 -2
- package/dist/Select.js.map +1 -1
- package/dist/Status.js +2 -0
- package/dist/Status.js.map +1 -1
- package/dist/Tabs.js +54 -10
- package/dist/Tabs.js.map +1 -1
- package/dist/Tag.js +5 -3
- package/dist/Tag.js.map +1 -1
- package/dist/TagList.js.map +1 -1
- package/dist/TextField.js +6 -2
- package/dist/TextField.js.map +1 -1
- package/dist/Toast.js +4 -1
- package/dist/Toast.js.map +1 -1
- package/dist/Tooltip.js +3 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Typography.js +32 -10
- package/dist/Typography.js.map +1 -1
- package/dist/labs/Switch.js.map +1 -1
- package/dist/labs/VirtualizedAutocomplete.js +4 -2
- package/dist/labs/VirtualizedAutocomplete.js.map +1 -1
- package/dist/src/Accordion.d.ts +3 -3
- package/dist/src/Accordion.d.ts.map +1 -1
- package/dist/src/{SeleniumProps.d.ts → AllowedProps.d.ts} +6 -2
- package/dist/src/AllowedProps.d.ts.map +1 -0
- package/dist/src/Autocomplete.d.ts +3 -3
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Badge.d.ts +3 -3
- package/dist/src/Badge.d.ts.map +1 -1
- package/dist/src/Banner.d.ts +3 -3
- package/dist/src/Banner.d.ts.map +1 -1
- package/dist/src/Box.d.ts +3 -3
- package/dist/src/Box.d.ts.map +1 -1
- package/dist/src/Breadcrumbs.d.ts +3 -2
- package/dist/src/Breadcrumbs.d.ts.map +1 -1
- package/dist/src/Button.d.ts +3 -3
- package/dist/src/Button.d.ts.map +1 -1
- package/dist/src/Callout.d.ts +3 -3
- package/dist/src/Callout.d.ts.map +1 -1
- package/dist/src/Checkbox.d.ts +3 -3
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +3 -3
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/CircularProgress.d.ts +2 -2
- package/dist/src/CircularProgress.d.ts.map +1 -1
- package/dist/src/Dialog.d.ts +3 -3
- package/dist/src/Dialog.d.ts.map +1 -1
- package/dist/src/FieldError.d.ts +3 -3
- package/dist/src/FieldError.d.ts.map +1 -1
- package/dist/src/FieldHint.d.ts +3 -3
- package/dist/src/FieldHint.d.ts.map +1 -1
- package/dist/src/FieldLabel.d.ts +3 -3
- package/dist/src/FieldLabel.d.ts.map +1 -1
- package/dist/src/Fieldset.d.ts +3 -3
- package/dist/src/Fieldset.d.ts.map +1 -1
- package/dist/src/Form.d.ts +3 -3
- package/dist/src/Form.d.ts.map +1 -1
- package/dist/src/Link.d.ts +3 -3
- package/dist/src/Link.d.ts.map +1 -1
- package/dist/src/MenuButton.d.ts +3 -3
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/MenuItem.d.ts +2 -2
- package/dist/src/MenuItem.d.ts.map +1 -1
- package/dist/src/NativeSelect.d.ts +2 -2
- package/dist/src/NativeSelect.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts +3 -3
- package/dist/src/PasswordField.d.ts.map +1 -1
- package/dist/src/Radio.d.ts +3 -3
- package/dist/src/Radio.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +3 -3
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/ScreenReaderText.d.ts +3 -2
- package/dist/src/ScreenReaderText.d.ts.map +1 -1
- package/dist/src/SearchField.d.ts +3 -3
- package/dist/src/SearchField.d.ts.map +1 -1
- package/dist/src/Select.d.ts +3 -3
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/Status.d.ts +3 -3
- package/dist/src/Status.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts +7 -3
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/src/Tag.d.ts +3 -3
- package/dist/src/Tag.d.ts.map +1 -1
- package/dist/src/TagList.d.ts +2 -2
- package/dist/src/TagList.d.ts.map +1 -1
- package/dist/src/TextField.d.ts +3 -3
- package/dist/src/TextField.d.ts.map +1 -1
- package/dist/src/Toast.d.ts +3 -3
- package/dist/src/Toast.d.ts.map +1 -1
- package/dist/src/Tooltip.d.ts +3 -3
- package/dist/src/Tooltip.d.ts.map +1 -1
- package/dist/src/Typography.d.ts +13 -13
- package/dist/src/Typography.d.ts.map +1 -1
- package/dist/src/labs/Switch.d.ts +2 -2
- package/dist/src/labs/Switch.d.ts.map +1 -1
- package/dist/src/labs/VirtualizedAutocomplete.d.ts +3 -3
- package/dist/src/labs/VirtualizedAutocomplete.d.ts.map +1 -1
- package/dist/theme/components.js +1 -1
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Accordion.tsx +6 -3
- package/src/{SeleniumProps.ts → AllowedProps.ts} +5 -1
- package/src/Autocomplete.tsx +4 -2
- package/src/Badge.tsx +37 -27
- package/src/Banner.tsx +8 -5
- package/src/Box.tsx +4 -3
- package/src/Breadcrumbs.tsx +6 -1
- package/src/Button.tsx +5 -2
- package/src/Callout.tsx +14 -5
- package/src/Checkbox.tsx +6 -4
- package/src/CheckboxGroup.tsx +5 -3
- package/src/CircularProgress.tsx +2 -2
- package/src/Dialog.tsx +4 -3
- package/src/FieldError.tsx +5 -5
- package/src/FieldHint.tsx +10 -4
- package/src/FieldLabel.tsx +11 -5
- package/src/Fieldset.tsx +5 -4
- package/src/Form.tsx +9 -4
- package/src/Link.tsx +4 -2
- package/src/MenuButton.tsx +4 -2
- package/src/MenuItem.tsx +2 -2
- package/src/NativeSelect.tsx +5 -2
- package/src/PasswordField.tsx +5 -2
- package/src/Radio.tsx +4 -2
- package/src/RadioGroup.tsx +5 -3
- package/src/ScreenReaderText.tsx +4 -3
- package/src/SearchField.tsx +5 -2
- package/src/Select.tsx +5 -2
- package/src/Status.tsx +4 -2
- package/src/Tabs.tsx +87 -19
- package/src/Tag.tsx +14 -3
- package/src/TagList.tsx +2 -2
- package/src/TextField.tsx +11 -4
- package/src/Toast.tsx +5 -4
- package/src/Tooltip.tsx +4 -2
- package/src/Typography.tsx +24 -2
- package/src/labs/Switch.tsx +2 -2
- package/src/labs/VirtualizedAutocomplete.tsx +4 -2
- package/src/theme/components.tsx +1 -1
- package/dist/SeleniumProps.js +0 -2
- package/dist/SeleniumProps.js.map +0 -1
- package/dist/src/SeleniumProps.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okta/odyssey-react-mui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.13",
|
|
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.9.
|
|
54
|
+
"@okta/odyssey-design-tokens": "1.9.13",
|
|
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": "
|
|
66
|
+
"gitHead": "747861bf33f9c65b901782e306c16b0ccf26a942"
|
|
67
67
|
}
|
package/src/Accordion.tsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { ReactNode, memo } from "react";
|
|
14
|
-
import type {
|
|
14
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
15
15
|
import {
|
|
16
16
|
Accordion as MuiAccordion,
|
|
17
17
|
AccordionDetails as MuiAccordionDetails,
|
|
@@ -60,7 +60,7 @@ export type AccordionProps = {
|
|
|
60
60
|
isExpanded?: never;
|
|
61
61
|
}
|
|
62
62
|
) &
|
|
63
|
-
|
|
63
|
+
AllowedProps;
|
|
64
64
|
|
|
65
65
|
const Accordion = ({
|
|
66
66
|
children,
|
|
@@ -70,6 +70,7 @@ const Accordion = ({
|
|
|
70
70
|
isDisabled,
|
|
71
71
|
isExpanded,
|
|
72
72
|
onChange,
|
|
73
|
+
translate,
|
|
73
74
|
}: AccordionProps) => {
|
|
74
75
|
return (
|
|
75
76
|
<MuiAccordion
|
|
@@ -81,7 +82,9 @@ const Accordion = ({
|
|
|
81
82
|
className={hasShadow ? `hasShadow` : undefined}
|
|
82
83
|
>
|
|
83
84
|
<MuiAccordionSummary expandIcon={<ChevronDownIcon />}>
|
|
84
|
-
<Support component="div"
|
|
85
|
+
<Support component="div" translate={translate}>
|
|
86
|
+
{label}
|
|
87
|
+
</Support>
|
|
85
88
|
</MuiAccordionSummary>
|
|
86
89
|
<MuiAccordionDetails>{children}</MuiAccordionDetails>
|
|
87
90
|
</MuiAccordion>
|
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export type AllowedProps = {
|
|
14
14
|
/**
|
|
15
15
|
* This prop puts a `data` attribute on an HTML element in this component with the value provided.
|
|
16
16
|
*
|
|
17
17
|
* @deprecated **WARNING:** You should be using Semantic Selectors instead of this property. This is a temporary measure for backwards compatibility with existing Selenium tests.
|
|
18
18
|
*/
|
|
19
19
|
testId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* This prop puts a `translate` attribute on an HTML element. It should be used to indicate whether text within the element should be translated.
|
|
22
|
+
*/
|
|
23
|
+
translate?: "yes" | "no";
|
|
20
24
|
};
|
package/src/Autocomplete.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import { memo, useCallback, useMemo, useRef } from "react";
|
|
|
21
21
|
|
|
22
22
|
import { Field } from "./Field";
|
|
23
23
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
24
|
-
import type {
|
|
24
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
25
25
|
import {
|
|
26
26
|
ComponentControlledState,
|
|
27
27
|
useInputValues,
|
|
@@ -169,7 +169,7 @@ export type AutocompleteProps<
|
|
|
169
169
|
| "isOptional"
|
|
170
170
|
| "name"
|
|
171
171
|
> &
|
|
172
|
-
|
|
172
|
+
AllowedProps;
|
|
173
173
|
|
|
174
174
|
const Autocomplete = <
|
|
175
175
|
OptionType,
|
|
@@ -199,6 +199,7 @@ const Autocomplete = <
|
|
|
199
199
|
value,
|
|
200
200
|
getIsOptionEqualToValue,
|
|
201
201
|
testId,
|
|
202
|
+
translate,
|
|
202
203
|
}: AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {
|
|
203
204
|
const controlledStateRef = useRef(
|
|
204
205
|
getControlState({ controlledValue: value, uncontrolledValue: defaultValue })
|
|
@@ -329,6 +330,7 @@ const Autocomplete = <
|
|
|
329
330
|
readOnly={isReadOnly}
|
|
330
331
|
renderInput={renderInput}
|
|
331
332
|
isOptionEqualToValue={getIsOptionEqualToValue}
|
|
333
|
+
translate={translate}
|
|
332
334
|
/>
|
|
333
335
|
);
|
|
334
336
|
};
|
package/src/Badge.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
DesignTokens,
|
|
18
18
|
} from "./OdysseyDesignTokensContext";
|
|
19
19
|
import { Box } from "./Box";
|
|
20
|
-
import type {
|
|
20
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
21
21
|
|
|
22
22
|
export const badgeTypeValues = ["default", "attention", "danger"] as const;
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ export type BadgeProps = {
|
|
|
25
25
|
badgeContent: number;
|
|
26
26
|
badgeContentMax?: number;
|
|
27
27
|
type?: (typeof badgeTypeValues)[number];
|
|
28
|
-
} &
|
|
28
|
+
} & AllowedProps;
|
|
29
29
|
|
|
30
30
|
const badgeTypeColors = (odysseyTokens: DesignTokens) => ({
|
|
31
31
|
default: {
|
|
@@ -45,24 +45,23 @@ const badgeTypeColors = (odysseyTokens: DesignTokens) => ({
|
|
|
45
45
|
const Badge = ({
|
|
46
46
|
badgeContent,
|
|
47
47
|
badgeContentMax = 999,
|
|
48
|
+
testId,
|
|
49
|
+
translate,
|
|
48
50
|
type = "default",
|
|
49
51
|
}: BadgeProps) => {
|
|
50
52
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
51
53
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
: badgeContent;
|
|
62
|
-
const contentIsLongerThanOneChar = formattedContent?.toString()?.length > 1;
|
|
54
|
+
const renderBadge = useMemo(() => {
|
|
55
|
+
const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;
|
|
56
|
+
const threeDigitLimitedMax =
|
|
57
|
+
greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;
|
|
58
|
+
const isOverContentMax = badgeContent > threeDigitLimitedMax;
|
|
59
|
+
const overContentMaxMessage = `${greaterThanZeroContentMax}+`;
|
|
60
|
+
const formattedContent = isOverContentMax
|
|
61
|
+
? overContentMaxMessage
|
|
62
|
+
: badgeContent.toString();
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
() => ({
|
|
64
|
+
const badgeStyles: CSSProperties = {
|
|
66
65
|
display: "inline-flex",
|
|
67
66
|
alignItems: "center",
|
|
68
67
|
justifyContent: "center",
|
|
@@ -70,27 +69,38 @@ const Badge = ({
|
|
|
70
69
|
height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
|
|
71
70
|
minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
|
|
72
71
|
// 6px horizontal padding per design requirements
|
|
73
|
-
padding:
|
|
72
|
+
padding: "0 6px",
|
|
74
73
|
backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,
|
|
75
74
|
color: badgeTypeColors(odysseyDesignTokens)[type].font,
|
|
76
|
-
borderRadius:
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
borderRadius:
|
|
76
|
+
formattedContent.length > 1
|
|
77
|
+
? `${odysseyDesignTokens.BorderRadiusOuter}`
|
|
78
|
+
: "50%",
|
|
79
79
|
fontSize: `${odysseyDesignTokens.TypographyScale0}`,
|
|
80
80
|
fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,
|
|
81
81
|
fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,
|
|
82
82
|
lineHeight: 1,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,
|
|
84
|
+
transitionProperty: `background-color, color`,
|
|
85
|
+
};
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const hasNotificationCount = badgeContent && badgeContent > 0;
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
return hasNotificationCount ? (
|
|
90
|
+
<Box sx={badgeStyles} data-se={testId} translate={translate}>
|
|
91
|
+
{formattedContent}
|
|
92
|
+
</Box>
|
|
93
|
+
) : null;
|
|
94
|
+
}, [
|
|
95
|
+
badgeContent,
|
|
96
|
+
badgeContentMax,
|
|
97
|
+
odysseyDesignTokens,
|
|
98
|
+
testId,
|
|
99
|
+
translate,
|
|
100
|
+
type,
|
|
101
|
+
]);
|
|
92
102
|
|
|
93
|
-
return
|
|
103
|
+
return renderBadge;
|
|
94
104
|
};
|
|
95
105
|
|
|
96
106
|
const MemoizedBadge = memo(Badge);
|
package/src/Banner.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { ScreenReaderText } from "./ScreenReaderText";
|
|
|
16
16
|
import { memo } from "react";
|
|
17
17
|
import { useTranslation } from "react-i18next";
|
|
18
18
|
|
|
19
|
-
import type {
|
|
19
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
20
20
|
|
|
21
21
|
export const bannerRoleValues = ["status", "alert"] as const;
|
|
22
22
|
export const bannerSeverityValues: AlertColor[] = [
|
|
@@ -56,7 +56,7 @@ export type BannerProps = {
|
|
|
56
56
|
* The text content of the alert
|
|
57
57
|
*/
|
|
58
58
|
text: string;
|
|
59
|
-
} &
|
|
59
|
+
} & AllowedProps;
|
|
60
60
|
|
|
61
61
|
const Banner = ({
|
|
62
62
|
linkUrl,
|
|
@@ -66,6 +66,7 @@ const Banner = ({
|
|
|
66
66
|
severity,
|
|
67
67
|
text,
|
|
68
68
|
testId,
|
|
69
|
+
translate,
|
|
69
70
|
}: BannerProps) => {
|
|
70
71
|
const { t } = useTranslation();
|
|
71
72
|
|
|
@@ -77,10 +78,12 @@ const Banner = ({
|
|
|
77
78
|
severity={severity}
|
|
78
79
|
variant="banner"
|
|
79
80
|
>
|
|
80
|
-
<ScreenReaderText
|
|
81
|
-
|
|
81
|
+
<ScreenReaderText translate={translate}>
|
|
82
|
+
{t(`severity.${severity}`)}:
|
|
83
|
+
</ScreenReaderText>
|
|
84
|
+
<AlertTitle translate={translate}>{text}</AlertTitle>
|
|
82
85
|
{linkUrl && (
|
|
83
|
-
<Link href={linkUrl} variant="monochrome">
|
|
86
|
+
<Link href={linkUrl} variant="monochrome" translate={translate}>
|
|
84
87
|
{linkText}
|
|
85
88
|
</Link>
|
|
86
89
|
)}
|
package/src/Box.tsx
CHANGED
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
import { Box as MuiBox, BoxProps as MuiBoxProps } from "@mui/material";
|
|
14
14
|
import { ReactNode, forwardRef, memo } from "react";
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
17
17
|
|
|
18
18
|
export type BoxProps = {
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
component?: MuiBoxProps["component"];
|
|
21
21
|
id?: MuiBoxProps["id"];
|
|
22
22
|
sx?: MuiBoxProps["sx"];
|
|
23
|
-
} &
|
|
23
|
+
} & AllowedProps;
|
|
24
24
|
|
|
25
25
|
const Box = forwardRef<HTMLElement, BoxProps>(
|
|
26
|
-
({ children, component, id, sx, testId }, ref) => (
|
|
26
|
+
({ children, component, id, sx, testId, translate }, ref) => (
|
|
27
27
|
<MuiBox
|
|
28
28
|
ref={ref}
|
|
29
29
|
children={children}
|
|
@@ -31,6 +31,7 @@ const Box = forwardRef<HTMLElement, BoxProps>(
|
|
|
31
31
|
data-se={testId}
|
|
32
32
|
id={id}
|
|
33
33
|
sx={sx}
|
|
34
|
+
translate={translate}
|
|
34
35
|
/>
|
|
35
36
|
)
|
|
36
37
|
);
|
package/src/Breadcrumbs.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
import { GroupIcon, HomeIcon, UserIcon } from "./icons.generated";
|
|
30
30
|
import { Subordinate } from "./Typography";
|
|
31
31
|
import { useTranslation } from "react-i18next";
|
|
32
|
+
import { AllowedProps } from "./AllowedProps";
|
|
32
33
|
|
|
33
34
|
export type BreadcrumbType = "listItem" | "menuItem" | "currentPage";
|
|
34
35
|
|
|
@@ -42,7 +43,7 @@ export type BreadcrumbsProps = {
|
|
|
42
43
|
children: ReactElement<typeof Breadcrumb>[];
|
|
43
44
|
homeHref?: string;
|
|
44
45
|
maxVisibleItems?: number;
|
|
45
|
-
};
|
|
46
|
+
} & AllowedProps;
|
|
46
47
|
|
|
47
48
|
export type BreadcrumbContextType = {
|
|
48
49
|
breadcrumbType: BreadcrumbType;
|
|
@@ -101,6 +102,8 @@ const BreadcrumbList = ({
|
|
|
101
102
|
children,
|
|
102
103
|
homeHref,
|
|
103
104
|
maxVisibleItems = defaultTruncationValue,
|
|
105
|
+
testId,
|
|
106
|
+
translate,
|
|
104
107
|
}: BreadcrumbsProps) => {
|
|
105
108
|
const { t } = useTranslation();
|
|
106
109
|
|
|
@@ -137,6 +140,8 @@ const BreadcrumbList = ({
|
|
|
137
140
|
<MuiBreadcrumbs
|
|
138
141
|
maxItems={children.length + 1}
|
|
139
142
|
aria-label={t("breadcrumbs.label.text")}
|
|
143
|
+
data-se={testId}
|
|
144
|
+
translate={translate}
|
|
140
145
|
>
|
|
141
146
|
{homeHref && (
|
|
142
147
|
<ButtonBase href={homeHref} aria-label={t("breadcrumbs.home.text")}>
|
package/src/Button.tsx
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
|
|
23
23
|
import { MuiPropsContext, useMuiProps } from "./MuiPropsContext";
|
|
24
24
|
import { Tooltip } from "./Tooltip";
|
|
25
|
-
import type {
|
|
25
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
26
26
|
import { FocusHandle } from "./@types/react-augment";
|
|
27
27
|
|
|
28
28
|
export const buttonSizeValues = ["small", "medium", "large"] as const;
|
|
@@ -113,7 +113,7 @@ export type ButtonProps = {
|
|
|
113
113
|
startIcon?: ReactElement;
|
|
114
114
|
}
|
|
115
115
|
) &
|
|
116
|
-
|
|
116
|
+
AllowedProps;
|
|
117
117
|
|
|
118
118
|
const Button = ({
|
|
119
119
|
ariaDescribedBy,
|
|
@@ -130,6 +130,7 @@ const Button = ({
|
|
|
130
130
|
startIcon,
|
|
131
131
|
testId,
|
|
132
132
|
tooltipText,
|
|
133
|
+
translate,
|
|
133
134
|
type = "button",
|
|
134
135
|
variant,
|
|
135
136
|
}: ButtonProps) => {
|
|
@@ -165,6 +166,7 @@ const Button = ({
|
|
|
165
166
|
ref={ref}
|
|
166
167
|
size={size}
|
|
167
168
|
startIcon={startIcon}
|
|
169
|
+
translate={translate}
|
|
168
170
|
type={type}
|
|
169
171
|
variant={variant}
|
|
170
172
|
>
|
|
@@ -184,6 +186,7 @@ const Button = ({
|
|
|
184
186
|
size,
|
|
185
187
|
startIcon,
|
|
186
188
|
testId,
|
|
189
|
+
translate,
|
|
187
190
|
type,
|
|
188
191
|
variant,
|
|
189
192
|
]
|
package/src/Callout.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import { Alert, AlertTitle, Box } from "@mui/material";
|
|
|
15
15
|
import { ScreenReaderText } from "./ScreenReaderText";
|
|
16
16
|
import { useTranslation } from "react-i18next";
|
|
17
17
|
|
|
18
|
-
import type {
|
|
18
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
19
19
|
|
|
20
20
|
export const calloutRoleValues = ["status", "alert"] as const;
|
|
21
21
|
export const calloutSeverityValues = [
|
|
@@ -44,15 +44,24 @@ export type CalloutProps = {
|
|
|
44
44
|
* The title of the Callout
|
|
45
45
|
*/
|
|
46
46
|
title?: string;
|
|
47
|
-
} &
|
|
47
|
+
} & AllowedProps;
|
|
48
48
|
|
|
49
|
-
const Callout = ({
|
|
49
|
+
const Callout = ({
|
|
50
|
+
children,
|
|
51
|
+
role,
|
|
52
|
+
severity,
|
|
53
|
+
testId,
|
|
54
|
+
title,
|
|
55
|
+
translate,
|
|
56
|
+
}: CalloutProps) => {
|
|
50
57
|
const { t } = useTranslation();
|
|
51
58
|
|
|
52
59
|
return (
|
|
53
60
|
<Alert data-se={testId} role={role} severity={severity} variant="callout">
|
|
54
|
-
<ScreenReaderText
|
|
55
|
-
|
|
61
|
+
<ScreenReaderText translate={translate}>
|
|
62
|
+
{t(`severity.${severity}`)}
|
|
63
|
+
</ScreenReaderText>
|
|
64
|
+
{title && <AlertTitle translate={translate}>{title}</AlertTitle>}
|
|
56
65
|
<Box component="div">{children}</Box>
|
|
57
66
|
</Alert>
|
|
58
67
|
);
|
package/src/Checkbox.tsx
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
|
|
23
23
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
24
24
|
import { Typography } from "./Typography";
|
|
25
|
-
import type {
|
|
25
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
26
26
|
import { ComponentControlledState, getControlState } from "./inputUtils";
|
|
27
27
|
import { CheckedFieldProps } from "./FormCheckedProps";
|
|
28
28
|
import { FocusHandle } from "./@types/react-augment";
|
|
@@ -80,7 +80,7 @@ export type CheckboxProps = {
|
|
|
80
80
|
onBlur?: MuiFormControlLabelProps["onBlur"];
|
|
81
81
|
} & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> &
|
|
82
82
|
CheckedFieldProps<MuiCheckboxProps> &
|
|
83
|
-
|
|
83
|
+
AllowedProps;
|
|
84
84
|
|
|
85
85
|
const Checkbox = ({
|
|
86
86
|
ariaLabel,
|
|
@@ -98,6 +98,7 @@ const Checkbox = ({
|
|
|
98
98
|
onChange: onChangeProp,
|
|
99
99
|
onBlur: onBlurProp,
|
|
100
100
|
testId,
|
|
101
|
+
translate,
|
|
101
102
|
validity = "inherit",
|
|
102
103
|
value,
|
|
103
104
|
}: CheckboxProps) => {
|
|
@@ -141,10 +142,10 @@ const Checkbox = ({
|
|
|
141
142
|
</Typography>
|
|
142
143
|
</>
|
|
143
144
|
)}
|
|
144
|
-
{hint && <FormHelperText>{hint}</FormHelperText>}
|
|
145
|
+
{hint && <FormHelperText translate={translate}>{hint}</FormHelperText>}
|
|
145
146
|
</>
|
|
146
147
|
);
|
|
147
|
-
}, [isRequired, labelProp, hint, t]);
|
|
148
|
+
}, [isRequired, labelProp, hint, t, translate]);
|
|
148
149
|
|
|
149
150
|
const onChange = useCallback<NonNullable<MuiCheckboxProps["onChange"]>>(
|
|
150
151
|
(event, checked) => {
|
|
@@ -192,6 +193,7 @@ const Checkbox = ({
|
|
|
192
193
|
value={value}
|
|
193
194
|
required={isRequired}
|
|
194
195
|
onBlur={onBlur}
|
|
196
|
+
translate={translate}
|
|
195
197
|
/>
|
|
196
198
|
);
|
|
197
199
|
};
|
package/src/CheckboxGroup.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { memo, ReactElement, useCallback } from "react";
|
|
|
16
16
|
import { Checkbox } from "./Checkbox";
|
|
17
17
|
import { Field } from "./Field";
|
|
18
18
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
19
|
-
import type {
|
|
19
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
20
20
|
|
|
21
21
|
export type CheckboxGroupProps = {
|
|
22
22
|
/**
|
|
@@ -37,7 +37,7 @@ export type CheckboxGroupProps = {
|
|
|
37
37
|
FieldComponentProps,
|
|
38
38
|
"errorMessage" | "hint" | "HintLinkComponent" | "isDisabled"
|
|
39
39
|
> &
|
|
40
|
-
|
|
40
|
+
AllowedProps;
|
|
41
41
|
|
|
42
42
|
const CheckboxGroup = ({
|
|
43
43
|
children,
|
|
@@ -48,6 +48,7 @@ const CheckboxGroup = ({
|
|
|
48
48
|
isRequired = false,
|
|
49
49
|
label,
|
|
50
50
|
testId,
|
|
51
|
+
translate,
|
|
51
52
|
}: CheckboxGroupProps) => {
|
|
52
53
|
const renderFieldComponent = useCallback(
|
|
53
54
|
({ ariaDescribedBy, errorMessageElementId, labelElementId }) => (
|
|
@@ -56,11 +57,12 @@ const CheckboxGroup = ({
|
|
|
56
57
|
aria-errormessage={errorMessageElementId}
|
|
57
58
|
aria-labelledby={labelElementId}
|
|
58
59
|
data-se={testId}
|
|
60
|
+
translate={translate}
|
|
59
61
|
>
|
|
60
62
|
{children}
|
|
61
63
|
</MuiFormGroup>
|
|
62
64
|
),
|
|
63
|
-
[children, testId]
|
|
65
|
+
[children, testId, translate]
|
|
64
66
|
);
|
|
65
67
|
|
|
66
68
|
return (
|
package/src/CircularProgress.tsx
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { CircularProgress as MuiCircularProgress } from "@mui/material";
|
|
14
14
|
|
|
15
|
-
import type {
|
|
15
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
16
16
|
|
|
17
17
|
export type CircularProgressProps = {
|
|
18
18
|
/**
|
|
@@ -24,7 +24,7 @@ export type CircularProgressProps = {
|
|
|
24
24
|
* If undefined, the spinner will spin perpetually.
|
|
25
25
|
*/
|
|
26
26
|
value?: number;
|
|
27
|
-
} &
|
|
27
|
+
} & AllowedProps;
|
|
28
28
|
|
|
29
29
|
export const CircularProgress = ({
|
|
30
30
|
ariaLabel,
|
package/src/Dialog.tsx
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
ReactElement,
|
|
29
29
|
} from "react";
|
|
30
30
|
|
|
31
|
-
import type {
|
|
31
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
32
32
|
|
|
33
33
|
export type DialogProps = {
|
|
34
34
|
/**
|
|
@@ -60,7 +60,7 @@ export type DialogProps = {
|
|
|
60
60
|
*/
|
|
61
61
|
title: string;
|
|
62
62
|
ariaLabel: string;
|
|
63
|
-
} &
|
|
63
|
+
} & AllowedProps;
|
|
64
64
|
|
|
65
65
|
const Dialog = ({
|
|
66
66
|
callToActionFirstComponent,
|
|
@@ -71,6 +71,7 @@ const Dialog = ({
|
|
|
71
71
|
onClose,
|
|
72
72
|
testId,
|
|
73
73
|
title,
|
|
74
|
+
translate,
|
|
74
75
|
ariaLabel,
|
|
75
76
|
}: DialogProps) => {
|
|
76
77
|
const [isContentScrollable, setIsContentScrollable] = useState(false);
|
|
@@ -107,7 +108,7 @@ const Dialog = ({
|
|
|
107
108
|
|
|
108
109
|
return (
|
|
109
110
|
<MuiDialog data-se={testId} open={isOpen} onClose={onClose}>
|
|
110
|
-
<DialogTitle>
|
|
111
|
+
<DialogTitle translate={translate}>
|
|
111
112
|
{title}
|
|
112
113
|
<Button
|
|
113
114
|
ariaLabel={ariaLabel}
|
package/src/FieldError.tsx
CHANGED
|
@@ -16,19 +16,19 @@ import { FormHelperText } from "@mui/material";
|
|
|
16
16
|
import { ScreenReaderText } from "./ScreenReaderText";
|
|
17
17
|
import { useTranslation } from "react-i18next";
|
|
18
18
|
|
|
19
|
-
import type {
|
|
19
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
20
20
|
|
|
21
21
|
export type FieldErrorProps = {
|
|
22
22
|
id?: string;
|
|
23
23
|
text: string;
|
|
24
|
-
} &
|
|
24
|
+
} & AllowedProps;
|
|
25
25
|
|
|
26
|
-
const FieldError = ({ id, testId, text }: FieldErrorProps) => {
|
|
26
|
+
const FieldError = ({ id, testId, text, translate }: FieldErrorProps) => {
|
|
27
27
|
const { t } = useTranslation();
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<FormHelperText data-se={testId} error id={id}>
|
|
31
|
-
<ScreenReaderText>{`${t(
|
|
30
|
+
<FormHelperText data-se={testId} error id={id} translate={translate}>
|
|
31
|
+
<ScreenReaderText translate={translate}>{`${t(
|
|
32
32
|
"fielderror.screenreader.text"
|
|
33
33
|
)}:`}</ScreenReaderText>
|
|
34
34
|
{text}
|
package/src/FieldHint.tsx
CHANGED
|
@@ -15,17 +15,23 @@ import { memo } from "react";
|
|
|
15
15
|
import { FormHelperText } from "@mui/material";
|
|
16
16
|
|
|
17
17
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
18
|
-
import type {
|
|
18
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
19
19
|
|
|
20
20
|
export type FieldHintProps = {
|
|
21
21
|
LinkComponent?: FieldComponentProps["HintLinkComponent"];
|
|
22
22
|
id?: string;
|
|
23
23
|
text: string;
|
|
24
|
-
} &
|
|
24
|
+
} & AllowedProps;
|
|
25
25
|
|
|
26
|
-
const FieldHint = ({
|
|
26
|
+
const FieldHint = ({
|
|
27
|
+
id,
|
|
28
|
+
LinkComponent,
|
|
29
|
+
testId,
|
|
30
|
+
text,
|
|
31
|
+
translate,
|
|
32
|
+
}: FieldHintProps) => {
|
|
27
33
|
return (
|
|
28
|
-
<FormHelperText data-se={testId} id={id}>
|
|
34
|
+
<FormHelperText data-se={testId} id={id} translate={translate}>
|
|
29
35
|
{text}
|
|
30
36
|
{LinkComponent && (
|
|
31
37
|
<>
|
package/src/FieldLabel.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { memo, useMemo } from "react";
|
|
|
16
16
|
import { useTranslation } from "react-i18next";
|
|
17
17
|
import { ScreenReaderText } from "./ScreenReaderText";
|
|
18
18
|
import { Subordinate } from "./Typography";
|
|
19
|
-
import type {
|
|
19
|
+
import type { AllowedProps } from "./AllowedProps";
|
|
20
20
|
|
|
21
21
|
export type FieldLabelProps = {
|
|
22
22
|
hasVisibleLabel: boolean;
|
|
@@ -24,7 +24,7 @@ export type FieldLabelProps = {
|
|
|
24
24
|
inputId: string;
|
|
25
25
|
isOptional: boolean;
|
|
26
26
|
text: string;
|
|
27
|
-
} &
|
|
27
|
+
} & AllowedProps;
|
|
28
28
|
|
|
29
29
|
const FieldLabel = ({
|
|
30
30
|
hasVisibleLabel,
|
|
@@ -32,26 +32,32 @@ const FieldLabel = ({
|
|
|
32
32
|
inputId,
|
|
33
33
|
isOptional,
|
|
34
34
|
testId,
|
|
35
|
+
translate,
|
|
35
36
|
text,
|
|
36
37
|
}: FieldLabelProps) => {
|
|
37
38
|
const { t } = useTranslation();
|
|
38
39
|
|
|
39
40
|
const inputLabel = useMemo(
|
|
40
41
|
() => (
|
|
41
|
-
<MuiInputLabel
|
|
42
|
+
<MuiInputLabel
|
|
43
|
+
data-se={testId}
|
|
44
|
+
htmlFor={inputId}
|
|
45
|
+
id={id}
|
|
46
|
+
translate={translate}
|
|
47
|
+
>
|
|
42
48
|
<span>{text}</span>
|
|
43
49
|
{isOptional && (
|
|
44
50
|
<Subordinate>{t("fieldlabel.optional.text")}</Subordinate>
|
|
45
51
|
)}
|
|
46
52
|
</MuiInputLabel>
|
|
47
53
|
),
|
|
48
|
-
[id, inputId, isOptional, testId, text, t]
|
|
54
|
+
[id, inputId, isOptional, testId, translate, text, t]
|
|
49
55
|
);
|
|
50
56
|
|
|
51
57
|
return hasVisibleLabel ? (
|
|
52
58
|
inputLabel
|
|
53
59
|
) : (
|
|
54
|
-
<ScreenReaderText>{inputLabel}</ScreenReaderText>
|
|
60
|
+
<ScreenReaderText translate={translate}>{inputLabel}</ScreenReaderText>
|
|
55
61
|
);
|
|
56
62
|
};
|
|
57
63
|
|