Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function useFormInputOptions({
unstable_system: { fill = "outline", ...system } = {},
...options
}: BootstrapFormInputOptions): BootstrapFormInputOptions {
const isInvalid = Boolean(
unstable_getIn(options.touched, options.name) &&
unstable_getIn(options.errors, options.name)
);
return {
unstable_system: {
fill,
...system,
palette: isInvalid ? "danger" : system.palette
},
...options
};
}
export function useFormInputOptions({
unstable_system: { fill = "outline", ...system } = {},
...options
}: BootstrapFormInputOptions): BootstrapFormInputOptions {
const isInvalid = Boolean(
unstable_getIn(options.touched, options.name) &&
unstable_getIn(options.errors, options.name)
);
return {
unstable_system: {
fill,
...system,
palette: isInvalid ? "danger" : system.palette
},
...options
};
}
export function useFormGroupOptions({
unstable_system: { fill = "outline", ...system } = {},
...options
}: BootstrapFormGroupOptions): BootstrapFormGroupOptions {
const isInvalid = Boolean(
unstable_getIn(options.touched, options.name) &&
unstable_getIn(options.errors, options.name)
);
return {
unstable_system: {
fill,
...system,
palette: isInvalid ? "danger" : system.palette
},
...options
};
}
export function useFormGroupOptions({
unstable_system: { fill = "outline", ...system } = {},
...options
}: BootstrapFormGroupOptions): BootstrapFormGroupOptions {
const isInvalid = Boolean(
unstable_getIn(options.touched, options.name) &&
unstable_getIn(options.errors, options.name)
);
return {
unstable_system: {
fill,
...system,
palette: isInvalid ? "danger" : system.palette
},
...options
};
}
export function useFormMessageOptions({
unstable_system: system = {},
...options
}: BootstrapFormMessageOptions): BootstrapFormMessageOptions {
const isInvalid = Boolean(unstable_getIn(options.errors, options.name));
return {
unstable_system: {
...system,
palette: isInvalid ? "danger" : system.palette || "success"
},
...options
};
}