@codemonster-ru/vueforge 0.58.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  ColorPicker,
36
36
  MaskedInput,
37
37
  NumberInput,
38
+ Form,
38
39
  FormField,
39
40
  Textarea,
40
41
  FileUpload,
@@ -89,6 +90,20 @@ app.use(VueForge, {
89
90
 
90
91
  ```vue
91
92
  <Button label="Hello" severity="primary" />
93
+ <Form v-model="formValues" :validate="validateForm" @submit="onSubmit">
94
+ <template #default="{ values, errors, touched, setFieldValue, setFieldTouched }">
95
+ <FormField label="Email" :error="touched.email ? errors.email : ''">
96
+ <template #default>
97
+ <Input
98
+ :model-value="String(values.email ?? '')"
99
+ @update:model-value="value => setFieldValue('email', value)"
100
+ @blur="() => setFieldTouched('email', true)"
101
+ />
102
+ </template>
103
+ </FormField>
104
+ <Button type="submit" label="Submit" />
105
+ </template>
106
+ </Form>
92
107
  <FormField label="Name" hint="Required field">
93
108
  <Input v-model="name" placeholder="Your name" />
94
109
  </FormField>
@@ -218,6 +233,7 @@ app.use(VueForge, {
218
233
  - ColorPicker
219
234
  - MaskedInput
220
235
  - NumberInput
236
+ - Form
221
237
  - FormField
222
238
  - Textarea
223
239
  - FileUpload
@@ -276,6 +292,60 @@ Input / Search / Password / Textarea (quick API):
276
292
  - `FilterChips`: compact chip-based filter toggles with single/multiple selection modes and optional clear action.
277
293
  - `SearchInput`, `MentionInput`, `InlineEdit`, `OtpInput`, `ColorPicker`, `MaskedInput`, `Checkbox`, `Select`, `Autocomplete`, `MultiSelect`, `TagInput`, `DatePicker`, `Calendar`, `DateRangePicker`, `DateTimePicker`, `Pagination`, `DataTable`, `SegmentedControl`, and `TreeSelect` also support `variant: 'filled' | 'outlined'`.
278
294
 
295
+ ## Form
296
+
297
+ Props:
298
+
299
+ - `modelValue?: Record<string, unknown>` (v-model)
300
+ - `initialValues?: Record<string, unknown>`
301
+ - `validate?: (values) => Record<string, string> | string | boolean | null | Promise<...>`
302
+ - `validateOn?: 'submit' | 'input' | 'change' | 'blur' | Array<'submit' | 'input' | 'change' | 'blur'>` (default `submit`)
303
+ - `disabled?: boolean`
304
+ - `novalidate?: boolean` (default `true`)
305
+ - `id?: string`
306
+ - `ariaLabel?: string`
307
+ - `ariaLabelledby?: string`
308
+
309
+ Events:
310
+
311
+ - `update:modelValue`
312
+ - `change`
313
+ - `blur`
314
+ - `validate`
315
+ - `submit`
316
+ - `invalidSubmit`
317
+ - `reset`
318
+
319
+ Slots:
320
+
321
+ - `default` - form helpers:
322
+ `{ values, errors, touched, isValid, isDirty, isSubmitting, setFieldValue, setFieldTouched, setFieldError, validate, submit, reset }`
323
+
324
+ Example:
325
+
326
+ ```vue
327
+ <Form v-model="values" :validate="validateForm" validate-on="blur" @submit="send">
328
+ <template #default="{ values, errors, touched, setFieldValue, setFieldTouched }">
329
+ <FormField label="Email" :error="touched.email ? errors.email : ''">
330
+ <template #default>
331
+ <Input
332
+ :model-value="String(values.email ?? '')"
333
+ @update:model-value="value => setFieldValue('email', value)"
334
+ @blur="() => setFieldTouched('email', true)"
335
+ />
336
+ </template>
337
+ </FormField>
338
+ <Button type="submit" label="Send" />
339
+ </template>
340
+ </Form>
341
+ ```
342
+
343
+ ### Form tokens
344
+
345
+ Component tokens (override via `theme.overrides.components.form`):
346
+
347
+ - `gap`, `textColor`, `disabledOpacity`
348
+
279
349
  ## FormField
280
350
 
281
351
  Props:
@@ -305,6 +375,9 @@ Example:
305
375
  </FormField>
306
376
  ```
307
377
 
378
+ When `error` is set, `FormField` applies invalid-state border highlighting to nested form controls.
379
+ Customize these colors via `theme.overrides.components.formField.errorBorderColor` and `errorFocusBorderColor`.
380
+
308
381
  ## InlineEdit
309
382
 
310
383
  Props:
@@ -2439,7 +2512,7 @@ VueForge exposes design tokens as CSS variables generated from the theme preset.
2439
2512
  Typed tokens:
2440
2513
 
2441
2514
  - `ThemeTokens`/`ThemeOptions`/`ThemePreset` are exported for type-safe theming in TS.
2442
- - `components.*` accepts component-specific tokens (typed keys: button/card/checkbox/radio/tabs/accordion/toast/alert/input/inlineEdit/searchInput/mentionInput/passwordInput/otpInput/colorPicker/maskedInput/numberInput/formField/textarea/link/breadcrumbs/menu/modal/confirmDialog/drawer/popover/dropdown/contextMenu/commandPalette/select/autocomplete/combobox/multiselect/taginput/datepicker/calendar/daterangepicker/timepicker/datetimepicker/pagination/switch/segmentedControl/tooltip/skeleton/progress/badge/chip/filterChips/avatar/datatable/slider/stepper/rating/tree/treeselect/virtualScroller).
2515
+ - `components.*` accepts component-specific tokens (typed keys: button/card/checkbox/radio/tabs/accordion/toast/alert/input/inlineEdit/searchInput/mentionInput/passwordInput/otpInput/colorPicker/maskedInput/numberInput/form/formField/textarea/link/breadcrumbs/menu/modal/confirmDialog/drawer/popover/dropdown/contextMenu/commandPalette/select/autocomplete/combobox/multiselect/taginput/datepicker/calendar/daterangepicker/timepicker/datetimepicker/pagination/switch/segmentedControl/tooltip/skeleton/progress/badge/chip/filterChips/avatar/datatable/slider/stepper/rating/tree/treeselect/virtualScroller).
2443
2516
 
2444
2517
  Default core values (from `DefaultTheme`):
2445
2518