Skip to content

Commit

Permalink
Merge branch 'main' into efs_fixes_20.12
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 20, 2024
2 parents c740595 + 0d1d63e commit 9cafe74
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const fieldsRepeaterSubsection = buildSubSection({
id: 'fieldsRepeater',
title: 'Fields Repeater',
formTitle: 'Title for each form',
width: 'half',
width: 'full',
fields: {
input: {
component: 'input',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ export const Item = ({
const { setValue, control, clearErrors } = useFormContext()
const prevWatchedValuesRef = useRef<string | (string | undefined)[]>()

const getSpan = (component: string, width: string) => {
if (component !== 'radio' && component !== 'checkbox') {
if (width === 'half') {
return '1/2'
}
if (width === 'third') {
return '1/3'
}
return '1/1'
}
return '1/1'
}

const {
component,
id: itemId,
Expand All @@ -61,9 +74,8 @@ export const Item = ({
defaultValue,
...props
} = item
const isHalfColumn = component !== 'radio' && width === 'half'
const isThirdColumn = component !== 'radio' && width === 'third'
const span = isHalfColumn ? '1/2' : isThirdColumn ? '1/3' : '1/1'

const span = getSpan(component, width)
const Component = componentMapper[component]
const id = `${dataId}[${index}].${itemId}`
const activeValues = index >= 0 && values ? values[index] : undefined
Expand Down Expand Up @@ -203,7 +215,7 @@ export const Item = ({
label={formatText(label, application, formatMessage)}
options={translatedOptions}
placeholder={formatText(placeholder, application, formatMessage)}
split={width === 'half' ? '1/2' : '1/1'}
split={width === 'half' ? '1/2' : width === 'third' ? '1/3' : '1/1'}
error={getFieldError(itemId)}
control={control}
readOnly={Readonly}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ export const Item = ({
const { setValue, control, clearErrors } = useFormContext()
const prevWatchedValuesRef = useRef<string | (string | undefined)[]>()

const getSpan = (component: string, width: string) => {
if (component !== 'radio' && component !== 'checkbox') {
if (width === 'half') {
return '1/2'
}
if (width === 'third') {
return '1/3'
}
return '1/1'
}
return '1/1'
}

const {
component,
id: itemId,
Expand All @@ -61,9 +74,8 @@ export const Item = ({
defaultValue,
...props
} = item
const isHalfColumn = component !== 'radio' && width === 'half'
const isThirdColumn = component !== 'radio' && width === 'third'
const span = isHalfColumn ? '1/2' : isThirdColumn ? '1/3' : '1/1'

const span = getSpan(component, width)
const Component = componentMapper[component]
const id = `${dataId}[${activeIndex}].${itemId}`
const activeValues =
Expand Down Expand Up @@ -203,7 +215,7 @@ export const Item = ({
label={formatText(label, application, formatMessage)}
options={translatedOptions}
placeholder={formatText(placeholder, application, formatMessage)}
split={width === 'half' ? '1/2' : '1/1'}
split={width === 'half' ? '1/2' : width === 'third' ? '1/3' : '1/1'}
error={getFieldError(itemId)}
control={control}
readOnly={Readonly}
Expand Down

0 comments on commit 9cafe74

Please sign in to comment.