Skip to content

Commit

Permalink
fix: add required crossOrigin field to Amplify UI components
Browse files Browse the repository at this point in the history
  • Loading branch information
bestickley committed Oct 2, 2023
1 parent e0aa8b3 commit dc2cb2b
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/gboost-ui/src/FileUpload/FileName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function FileName(props: FileNameProps): ReactElement {
const { notify } = useNotifications();
return (
<StyledTextField
crossOrigin
isDisabled={isDisabled}
ref={props.inputRef}
labelHidden={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function FilterValue({
} else {
element = (
<TextField
crossOrigin
disabled={!comparator}
label="Value"
labelHidden
Expand All @@ -72,6 +73,7 @@ export function FilterValue({
} else {
element = (
<TextField
crossOrigin
disabled
label="Value"
labelHidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function FilterValue({
} else {
element = (
<TextField
crossOrigin
disabled={!comparator}
label="Value"
labelHidden
Expand All @@ -68,7 +69,9 @@ export function FilterValue({
);
}
} else {
element = <TextField disabled label="Value" labelHidden value="" />;
element = (
<TextField crossOrigin disabled label="Value" labelHidden value="" />
);
}
return element;
}
1 change: 1 addition & 0 deletions packages/gboost-ui/src/SmartFields/SmartCheckboxField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function SmartCheckboxField<T extends FieldValues>(
loadingHeight={32}
>
<CheckboxField
crossOrigin
{...normalizeProps(checkboxFieldProps)}
id={id}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function SmartPhoneNumberField<T extends FieldValues>(
className="amplify-textfield"
>
<PhoneNumberField
crossOrigin
{...normalizeProps(phoneNumberFieldProps)}
id={id}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function SmartRadioGroupField<T extends FieldValues>(
value={value}
>
{options.map((o) => (
<Radio key={o.value} value={o.value}>
<Radio crossOrigin key={o.value} value={o.value}>
{o.label}
</Radio>
))}
Expand Down
1 change: 1 addition & 0 deletions packages/gboost-ui/src/SmartFields/SmartTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function SmartTextField<T extends FieldValues>(
className="amplify-textfield"
>
<TextField
crossOrigin
{...normalizeProps(textFieldProps)}
id={id}
ref={ref}
Expand Down
2 changes: 1 addition & 1 deletion packages/gboost-ui/src/components/Fields/DateTimeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function _DateTimeField(
const { type = "datetime-local" } = props;
// as any b/c TextField thinks it has to support HTMLTextField but we don't need that
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return <TextField ref={ref as any} {...props} type={type} />;
return <TextField crossOrigin ref={ref as any} {...props} type={type} />;
}

// https://fettblog.eu/typescript-react-generic-forward-refs/#option-1%3A-type-assertion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function IFileUploadField(
onClick={(e) => (e.currentTarget.value = "")}
/>
<TextField
crossOrigin
{...textFieldProps}
id={id}
isReadOnly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function MultiCheckboxField(
{options.map((o) => (
<CheckboxContainer key={o.value}>
<CheckboxField
crossOrigin
{...checkboxFields}
label={o.label}
name={o.value}
Expand Down
6 changes: 6 additions & 0 deletions packages/gboost-ui/src/components/TransferList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export interface TransferListProps<T> {
* @deprecatedd
*/
export const defaultListHeight = "300px";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const StyledFieldContainer = styled(Box, {
display: "flex",
flexDirection: "column",
Expand Down Expand Up @@ -220,6 +222,7 @@ function ITransferList<T extends Record<string, any>>(
</StyledHeadingContainer>
{handleFilter && (
<StyledSearchField
crossOrigin
label="Source Filter"
labelHidden
placeholder="Search"
Expand All @@ -232,6 +235,7 @@ function ITransferList<T extends Record<string, any>>(
{sourceKeys.map((s) => (
<li key={s} style={{ display: "flex" }}>
<CheckboxField
crossOrigin
checked={selectedKeys.includes(s)}
label={render(optionsMap[s] as T)}
name={s}
Expand Down Expand Up @@ -273,6 +277,7 @@ function ITransferList<T extends Record<string, any>>(
</StyledHeadingContainer>
{handleFilter && (
<StyledSearchField
crossOrigin
label="Target Filter"
labelHidden
placeholder="Search"
Expand All @@ -285,6 +290,7 @@ function ITransferList<T extends Record<string, any>>(
{targetKeys.map((t) => (
<li key={t}>
<CheckboxField
crossOrigin
checked={selectedKeys.includes(t)}
label={render(optionsMap[t] as T)}
name={t}
Expand Down

0 comments on commit dc2cb2b

Please sign in to comment.