Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
},
"dependencies": {
"@cosmicjs/sdk": "^1.5.2",
"@regle/core": "1.9.8",
"@regle/rules": "1.9.8",
"@sentry/vue": "^9.12.0",
"@vue/compiler-dom": "^3.5.13",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vuetify/one": "^2.3.0",
"algoliasearch": "^4.24.0",
"fflate": "^0.8.2",
Expand Down
86 changes: 86 additions & 0 deletions packages/docs/src/examples/v-form/misc-regle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<template>
<form>
<v-text-field
v-model="state.name"
:counter="10"
:error-messages="r$.name.$errors"
label="Name"
required
@blur="r$.name.$touch"
></v-text-field>

<v-text-field
v-model="state.email"
:error-messages="r$.email.$errors"
label="E-mail"
required
@blur="r$.email.$touch"
></v-text-field>

<v-select
v-model="state.select"
:error-messages="r$.select.$errors"
:items="items"
label="Item"
required
@blur="r$.select.$touch"
></v-select>

<v-checkbox
v-model="state.checkbox"
:error-messages="r$.checkbox.$errors"
label="Do you agree?"
required
@blur="r$.checkbox.$touch"
></v-checkbox>

<v-btn
class="me-4"
@click="r$.$validate"
>
submit
</v-btn>
<v-btn @click="clear">
clear
</v-btn>
</form>
</template>

<script setup lang="ts">
import { useRegle } from '@regle/core'
import { checked, email, oneOf, required } from '@regle/rules'

const items = [
'Item 1',
'Item 2',
'Item 3',
'Item 4',
]

const state = ref({
name: '',
email: '',
select: null as string | null,
checkbox: null as boolean | null,
})

const { r$ } = useRegle(state, {
name: { required },
email: { required, email },
select: { required, oneOf: oneOf(items) },
checkbox: { required, checked },
})

function clear () {
r$.$reset({ toOriginalState: true })
}
</script>

<playground-resources lang="json">
{
"imports": {
"@regle/core": "https://www.unpkg.com/@regle/[email protected]/dist/regle-core.min.js",
"@regle/rules": "https://www.unpkg.com/@regle/[email protected]/dist/regle-rules.min.js"
}
}
</playground-resources>
103 changes: 0 additions & 103 deletions packages/docs/src/examples/v-form/misc-vuelidate.vue

This file was deleted.

8 changes: 4 additions & 4 deletions packages/docs/src/pages/en/components/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The `v-form` component makes it easy to add validation to form inputs. All input

::: tip

If you prefer using a 3rd party validation plugin, we provide [examples](#vee-validate) further down the page for integrating both [Vee-validate](https://github.com/baianat/Vee-validate) and [vuelidate](https://github.com/vuelidate/vuelidate) validation libraries.
If you prefer using a 3rd party validation plugin, we provide [examples](#vee-validate) further down the page for integrating both [Vee-validate](https://github.com/baianat/Vee-validate) and [Regle](https://github.com/victorgarciaesgi/regle) validation libraries.

:::

Expand Down Expand Up @@ -127,8 +127,8 @@ The difference between `reset()` and `resetValidation()` is that the former rese

<ExamplesExample file="v-form/misc-vee-validate" />

#### Vuelidate
#### Regle

**vuelidate** documentation can be found [here](https://vuelidate-next.netlify.app/).
**regle** documentation can be found [here](https://reglejs.dev/).

<ExamplesExample file="v-form/misc-vuelidate" />
<ExamplesExample file="v-form/misc-regle" />
2 changes: 1 addition & 1 deletion packages/docs/src/pages/en/components/text-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ You can display a progress bar instead of the bottom line. You can use the defau

#### Custom validation

While the built in `v-form` or 3rd party plugin such as [vuelidate](https://github.com/monterail/vuelidate) or [vee-validation](https://github.com/logaretm/vee-validate) can help streamline your validation process, you can choose to simply control it yourself.
While the built in `v-form` or 3rd party plugin such as [Regle](https://github.com/victorgarciaesgi/regle) or [vee-validation](https://github.com/logaretm/vee-validate) can help streamline your validation process, you can choose to simply control it yourself.

<ExamplesExample file="v-text-field/misc-custom-validation" />

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export default defineConfig(({ command, mode, isSsrBuild }) => {
},

ssr: {
noExternal: ['vue-i18n', '@vuelidate/core', 'pinia'],
noExternal: ['vue-i18n', 'pinia'],
},

server: {
Expand Down
86 changes: 37 additions & 49 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.