Skip to content

Commit

Permalink
chore(deps): upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisMazel committed Aug 5, 2024
1 parent 5870807 commit fc968c7
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 493 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-tailwindcss": "^3.17.4",
"husky": "^9.1.4",
"lerna": "^8.1.7",
"lerna": "^8.1.8",
"lint-staged": "^15.2.8",
"prettier": "^3.3.3",
"ts-node": "11.0.0-beta.1",
Expand Down
154 changes: 0 additions & 154 deletions packages/docs/docs/composables/TestComponent.vue

This file was deleted.

18 changes: 9 additions & 9 deletions packages/docs/docs/composables/use-form-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ With progressive mode, the field becomes valid after the first successful valida
<form class="maz-flex maz-flex-col maz-gap-4" @submit="onSubmitProgressive">
<MazInput
v-model="nameProgressive"
ref="nameRef"
ref="nameProgressiveRef"
label="Enter your name"
:hint="nameMessageProgressive"
:error="!!nameMessageProgressive"
Expand All @@ -414,7 +414,7 @@ With progressive mode, the field becomes valid after the first successful valida
/>
<MazInput
v-model="ageProgressive"
ref="ageRef"
ref="ageProgressiveRef"
type="number"
label="Enter your age"
:hint="ageMessageProgressive"
Expand All @@ -424,7 +424,7 @@ With progressive mode, the field becomes valid after the first successful valida
/>
<MazSelect
v-model="countryProgressive"
ref="countryRef"
ref="countryProgressiveRef"
:options="[{ label: 'France', value: 'FR' }, { label: 'United States', value: 'US' }]"
label="Select your nationality"
:hint="countryMessageProgressive"
Expand All @@ -434,7 +434,7 @@ With progressive mode, the field becomes valid after the first successful valida
/>
<MazCheckbox
v-model="agreeProgressive"
ref="agreeRef"
ref="agreeProgressiveRef"
:hint="agreeMessageProgressive"
:error="!!agreeMessageProgressive"
:class="{ 'has-error-progressive': !!agreeMessageProgressive }"
Expand Down Expand Up @@ -686,7 +686,7 @@ To use the modes `eager` or `blur`, you must use this `useFormField` composable
- `isValidating`: `ComputedRef<boolean>` - Indicates if the field is currently being validated.
- `mode`: `ComputedRef<StrictOptions['mode']>` - The validation mode for the field.
- `value`: `ComputedRef<T>` - The value of the field.
- `validationEvents`: `ComputedRef<{ onBlur?: () => void; }>` - Validation events to bind to the field. They are used to trigger field validation, to be used like this `v-bind="{ ...validationEvents }"` (components must emit `blur` event to trigger field validation) - Not necessary for `lazy`, `aggressive` validation modes or if you use the component reference when initializing the composable.
- `validationEvents`: `ComputedRef<{ onBlur?: () => void; }>` - Validation events to bind to the field. They are used to trigger field validation, to be used like this `v-bind="validationEvents"` (components must emit `blur` event to trigger field validation) - Not necessary for `lazy`, `aggressive` validation modes or if you use the component reference when initializing the composable.

## Types

Expand Down Expand Up @@ -818,10 +818,10 @@ type FormFieldOptions<T> = {
options: { mode: 'progressive', scrollToError: '.has-error-progressive', identifier: 'form-progressive' },
})
const { value: nameProgressive, isValid: nameValidProgressive, hasError: nameErrorProgressive, errorMessage: nameMessageProgressive } = useFormField('name', { ref: 'nameRef', formIdentifier: 'form-progressive' })
const { value: ageProgressive, isValid: ageValidProgressive, hasError: ageErrorProgressive, errorMessage: ageMessageProgressive } = useFormField('age', { ref: 'ageRef', formIdentifier: 'form-progressive' })
const { value: countryProgressive, isValid: countryValidProgressive, hasError: countryErrorProgressive, errorMessage: countryMessageProgressive, validationEventsProgressive } = useFormField('country', { ref: 'countryRef', formIdentifier: 'form-progressive' })
const { value: agreeProgressive, isValid: agreeValidProgressive, hasError: agreeErrorProgressive, errorMessage: agreeMessageProgressive } = useFormField('agree', { ref: 'agreeRef', formIdentifier: 'form-progressive' })
const { value: nameProgressive, isValid: nameValidProgressive, hasError: nameErrorProgressive, errorMessage: nameMessageProgressive } = useFormField('name', { ref: 'nameProgressiveRef', formIdentifier: 'form-progressive' })
const { value: ageProgressive, isValid: ageValidProgressive, hasError: ageErrorProgressive, errorMessage: ageMessageProgressive } = useFormField('age', { ref: 'ageProgressiveRef', formIdentifier: 'form-progressive' })
const { value: countryProgressive, isValid: countryValidProgressive, hasError: countryErrorProgressive, errorMessage: countryMessageProgressive, validationEventsProgressive } = useFormField('country', { ref: 'countryProgressiveRef', formIdentifier: 'form-progressive' })
const { value: agreeProgressive, isValid: agreeValidProgressive, hasError: agreeErrorProgressive, errorMessage: agreeMessageProgressive } = useFormField('agree', { ref: 'agreeProgressiveRef', formIdentifier: 'form-progressive' })
const onSubmitProgressive = handleSubmitProgressive(async (formData) => {
// Form submission logic
Expand Down
4 changes: 1 addition & 3 deletions packages/lib/modules/composables/useFormValidator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ export type ValidationIssues = InferIssue<Validation>[]

export type ExtractModelKey<T> = Extract<keyof T, string>

// make this type not all keys are required
export type FormSchema<Model> = Record<ExtractModelKey<Model>, Validation>

export type CustomInstance<Model extends BaseFormPayload> = ComponentInternalInstance & {
formContexts?: Map<string | symbol | InjectionKey<FormContext<Model>>, FormContext<Model>>
}
// export type FormContextInjectionKey<Model extends BaseFormPayload = BaseFormPayload> = InjectionKey<FormContext<Model>>

export interface FormValidatorOptions<
Model extends BaseFormPayload = BaseFormPayload,
Expand Down Expand Up @@ -120,7 +118,7 @@ export interface FormFieldOptions<FieldType> {
* Useful when you have multiple forms on the same component
* Should be the same as the one used in `useFormValidator`
*/
formIdentifier?: string | symbol | InjectionKey<FormContext>
formIdentifier?: string | symbol
}

export type UseFormValidator<Model extends BaseFormPayload = BaseFormPayload> = typeof useFormValidator<Model>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function useFormField<
payload: payload.value,
schema: internalSchema.value,
setError: fieldMode === 'aggressive',
setErrorIfInvalidAndNotEmpty: true,
setErrorIfInvalidAndNotEmpty: fieldMode === 'lazy',
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/lib/modules/composables/useFormValidator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export function validateForm<
fieldState: fieldsStates[name],
payload,
schema,
setErrorIfInvalidAndNotEmpty: true,
setErrorIfInvalidAndNotEmpty: fieldsStates[name].mode === 'lazy',
}),
),
)
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@nuxt/devtools": "^1.3.9",
"@nuxt/eslint-config": "^0.4.0",
"@nuxt/eslint-config": "^0.5.0",
"@nuxt/module-builder": "^0.8.1",
"@nuxt/schema": "^3.12.4",
"@nuxt/test-utils": "^3.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-module/src/runtime/composables/useAos.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type AosHandler } from 'maz-ui'
import type { AosHandler } from 'maz-ui'
import { useNuxtApp } from '#imports'

export function useAos(): AosHandler {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-module/src/runtime/composables/useToast.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ToasterHandler } from 'maz-ui'
import type { ToasterHandler } from 'maz-ui'
import { useNuxtApp } from '#imports'

export function useToast(): ToasterHandler {
Expand Down
2 changes: 0 additions & 2 deletions packages/playground/src/components/TestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ const { isSubmitting, handleSubmit, model, fieldsStates } = useFormValidator<Sch
options: { mode: 'blur', scrollToError: '.has-error-form' },
})
model.value
const { value: name, errorMessage: nameErrorMessage } = useFormField('name', { ref: 'nameRef' })
const { value: age, errorMessage: ageErrorMessage, isValid: isValidAge } = useFormField('age', { ref: 'ageRef' })
const { value: agree, errorMessage: agreeErrorMessage, isValid: isValidAgree } = useFormField('agree', { ref: 'agreeRef' })
Expand Down
Loading

0 comments on commit fc968c7

Please sign in to comment.