fix: Fix storybook (no-changelog) (#4624)
since we migrated to vite, storybook/webpack aren't doing all the babel transforms. that's we we need to revert all optional-chaining and nullish-coalescing in design-system. Hopefully this will be remedied after we move to vite for storybook.
This commit is contained in:
committed by
GitHub
parent
423ee81e33
commit
58630e43c0
@@ -128,10 +128,10 @@ const slots = useSlots();
|
||||
const inputRef = ref<HTMLTextAreaElement | null>(null);
|
||||
|
||||
function getInputValidationError(): ReturnType<IValidator['validate']> {
|
||||
const rules = props.validationRules ?? [];
|
||||
const rules = props.validationRules || [];
|
||||
const validators = {
|
||||
...VALIDATORS,
|
||||
...(props.validators ?? {}),
|
||||
...(props.validators || {}),
|
||||
} as { [key: string]: IValidator | RuleGroup };
|
||||
|
||||
if (props.required) {
|
||||
|
||||
@@ -49,7 +49,7 @@ export const VALIDATORS: { [key: string]: IValidator | RuleGroup } = {
|
||||
return false;
|
||||
}
|
||||
|
||||
const numberCount = (value.match(/\d/g) ?? []).length;
|
||||
const numberCount = (value.match(/\d/g) || []).length;
|
||||
if (numberCount < config.minimum) {
|
||||
return {
|
||||
messageKey: 'formInput.validator.numbersRequired',
|
||||
@@ -77,7 +77,7 @@ export const VALIDATORS: { [key: string]: IValidator | RuleGroup } = {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uppercaseCount = (value.match(/[A-Z]/g) ?? []).length;
|
||||
const uppercaseCount = (value.match(/[A-Z]/g) || []).length;
|
||||
if (uppercaseCount < config.minimum) {
|
||||
return {
|
||||
messageKey: 'formInput.validator.uppercaseCharsRequired',
|
||||
|
||||
Reference in New Issue
Block a user