diff --git a/src/@optimizely/forms-react/src/components/elements/PredefinedHiddenElementBlock.tsx b/src/@optimizely/forms-react/src/components/elements/PredefinedHiddenElementBlock.tsx index 4d667c7..05e8591 100644 --- a/src/@optimizely/forms-react/src/components/elements/PredefinedHiddenElementBlock.tsx +++ b/src/@optimizely/forms-react/src/components/elements/PredefinedHiddenElementBlock.tsx @@ -1,24 +1,25 @@ -import { PredefinedHidden } from "@optimizely/forms-sdk" +import { PredefinedHidden } from "@optimizely/forms-sdk"; import React from "react"; -import ElementWrapper from "../ElementWrapper"; import { useElement } from "../../hooks/useElement"; -export interface PredefinedHiddenElementBlockProps { +interface PredefinedHiddenElementBlockProps { element: PredefinedHidden } export const PredefinedHiddenElementBlock = (props: PredefinedHiddenElementBlockProps) => { const { element } = props; - const { elementContext, checkVisible } = useElement(element); + const { elementContext, extraAttr } = useElement(element); return ( - - + - + ); } \ No newline at end of file diff --git a/src/@optimizely/forms-react/src/components/elements/ResetButtonElementBlock.tsx b/src/@optimizely/forms-react/src/components/elements/ResetButtonElementBlock.tsx new file mode 100644 index 0000000..60dd345 --- /dev/null +++ b/src/@optimizely/forms-react/src/components/elements/ResetButtonElementBlock.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { ResetButton } from "@optimizely/forms-sdk"; +import { useElement } from "../../hooks/useElement"; + +interface ResetButtonElementBlockProps { + element: ResetButton +} + +export const ResetButtonElementBlock = (props: ResetButtonElementBlockProps) => { + const { element } = props; + const { extraAttr, handleReset } = useElement(element); + + return ( + <> + + + ); +} \ No newline at end of file diff --git a/src/@optimizely/forms-react/src/components/elements/SelectionElementBlock.tsx b/src/@optimizely/forms-react/src/components/elements/SelectionElementBlock.tsx index d388f29..5ac28c1 100644 --- a/src/@optimizely/forms-react/src/components/elements/SelectionElementBlock.tsx +++ b/src/@optimizely/forms-react/src/components/elements/SelectionElementBlock.tsx @@ -4,14 +4,14 @@ import ElementWrapper from "../ElementWrapper"; import { useElement } from "../../hooks/useElement"; import { ElementCaption, ValidationMessage } from "./shared"; -export interface SelectionElementBlockProps { +interface SelectionElementBlockProps { element: Selection } export const SelectionElementBlock = (props: SelectionElementBlockProps) => { const { element } = props; const { elementContext, extraAttr, validatorClasses, handleChange, handleBlur, checkVisible } = useElement(element); - const defaultOptionSelected = !element.properties.allowMultiSelect && !element.properties.items.some(i => i.checked); + return ( @@ -24,8 +24,9 @@ export const SelectionElementBlock = (props: SelectionElementBlockProps) => { autoComplete={element.properties.autoComplete} onChange={handleChange} onBlur={handleBlur} + value={elementContext.value} > -