diff --git a/src/ui-components/TimeslotCreateForm.d.ts b/src/ui-components/TimeslotCreateForm.d.ts
index 680d954..f15eaaa 100644
--- a/src/ui-components/TimeslotCreateForm.d.ts
+++ b/src/ui-components/TimeslotCreateForm.d.ts
@@ -1,13 +1,12 @@
-/** *************************************************************************
+/***************************************************************************
* The contents of this file were generated with Amplify Studio. *
* Please refrain from making any modifications to this file. *
* Any changes to this file will be overwritten when running amplify pull. *
- ************************************************************************* */
+ **************************************************************************/
import * as React from "react";
-import { EscapeHatchProps } from "@aws-amplify/ui-react/internal";
import { GridProps, TextFieldProps } from "@aws-amplify/ui-react";
-
+import { EscapeHatchProps } from "@aws-amplify/ui-react/internal";
export declare type ValidationResponse = {
hasError: boolean;
errorMessage?: string;
diff --git a/src/ui-components/TimeslotCreateForm.jsx b/src/ui-components/TimeslotCreateForm.jsx
index 5be9ae1..8f21a79 100644
--- a/src/ui-components/TimeslotCreateForm.jsx
+++ b/src/ui-components/TimeslotCreateForm.jsx
@@ -1,14 +1,11 @@
-/** *************************************************************************
+/***************************************************************************
* The contents of this file were generated with Amplify Studio. *
* Please refrain from making any modifications to this file. *
* Any changes to this file will be overwritten when running amplify pull. *
- ************************************************************************* */
+ **************************************************************************/
/* eslint-disable */
import * as React from "react";
-import { fetchByPath, validateField } from "./utils";
-import { Timeslot } from "../models";
-import { getOverrideProps } from "@aws-amplify/ui-react/internal";
import {
Badge,
Button,
@@ -21,6 +18,9 @@ import {
TextField,
useTheme,
} from "@aws-amplify/ui-react";
+import { getOverrideProps } from "@aws-amplify/ui-react/internal";
+import { Timeslot } from "../models";
+import { fetchByPath, validateField } from "./utils";
import { DataStore } from "aws-amplify";
function ArrayField({
items = [],
@@ -37,7 +37,14 @@ function ArrayField({
runValidationTasks,
errorMessage,
}) {
- const { tokens } = useTheme();
+ const labelElement = {label};
+ const {
+ tokens: {
+ components: {
+ fieldmessages: { error: errorStyles },
+ },
+ },
+ } = useTheme();
const [selectedBadgeIndex, setSelectedBadgeIndex] = React.useState();
const [isEditing, setIsEditing] = React.useState();
React.useEffect(() => {
@@ -53,9 +60,9 @@ function ArrayField({
const addItem = async () => {
const { hasError } = runValidationTasks();
if (
- (currentFieldValue !== undefined ||
- currentFieldValue !== null ||
- currentFieldValue !== "") &&
+ currentFieldValue !== undefined &&
+ currentFieldValue !== null &&
+ currentFieldValue !== "" &&
!hasError
) {
const newItems = [...items];
@@ -69,45 +76,8 @@ function ArrayField({
setIsEditing(false);
}
};
- return (
+ const arraySection = (
- {isEditing && children}
- {!isEditing ? (
- <>
- {label}
-
- >
- ) : (
-
- {(currentFieldValue || isEditing) && (
-
- )}
-
-
- )}
{!!items?.length && (
{items.map((value, index) => {
@@ -128,7 +98,7 @@ function ArrayField({
setIsEditing(true);
}}
>
- {value.toString()}
+ {getBadgeText ? getBadgeText(value) : value.toString()}
{
+ const runValidationTasks = async (
+ fieldName,
+ currentValue,
+ getDisplayValue
+ ) => {
+ const value =
+ currentValue && getDisplayValue
+ ? getDisplayValue(currentValue)
+ : currentValue;
let validationResponse = validateField(value, validations[fieldName]);
const customValidator = fetchByPath(onValidate, fieldName);
if (customValidator) {
@@ -332,8 +309,8 @@ export default function TimeslotCreateForm(props) {
}
}
}}
- {...rest}
{...getOverrideProps(overrides, "TimeslotCreateForm")}
+ {...rest}
>
@@ -567,21 +545,16 @@ export default function TimeslotCreateForm(props) {
-