@eldrajs/ui 0.3.6 → 0.3.8

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE-country-flag-icons +25 -0
  3. package/README.md +380 -79
  4. package/dist/PhoneInput-CYGpERg4.js +749 -0
  5. package/dist/{VariantPicker-BB-2Cj32.js → VariantPicker-D_Gg80So.js} +163 -2307
  6. package/dist/componentNames.d.ts +1 -1
  7. package/dist/components/badge/StockBadge.vue.d.ts +1 -1
  8. package/dist/components/chip/Chip.vue.d.ts +10 -0
  9. package/dist/components/dialog/Dialog.vue.d.ts +10 -0
  10. package/dist/components/drawer/Drawer.vue.d.ts +10 -0
  11. package/dist/components/filter-panel/FilterGroup.vue.d.ts +10 -0
  12. package/dist/components/filter-panel/FilterPanel.vue.d.ts +10 -0
  13. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +10 -0
  14. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +10 -0
  15. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +10 -0
  16. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +10 -0
  17. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +10 -0
  18. package/dist/components/lightbox/Lightbox.vue.d.ts +10 -0
  19. package/dist/components/nav-menu/NavMenu.vue.d.ts +10 -0
  20. package/dist/components/notice/Notice.vue.d.ts +28 -0
  21. package/dist/components/notice/types.d.ts +38 -0
  22. package/dist/components/pagination/Pagination.vue.d.ts +10 -0
  23. package/dist/components/price/Price.vue.d.ts +1 -1
  24. package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
  25. package/dist/components/radio/RadioGroup.vue.d.ts +4 -0
  26. package/dist/components/radio/recipes.d.ts +4 -2
  27. package/dist/components/radio/types.d.ts +8 -1
  28. package/dist/components/range-slider/RangeSlider.vue.d.ts +10 -0
  29. package/dist/components/search-bar/SearchBar.vue.d.ts +10 -0
  30. package/dist/components/search-modal/SearchModal.vue.d.ts +10 -0
  31. package/dist/components/select/MultiSelect.vue.d.ts +10 -0
  32. package/dist/components/select/Select.vue.d.ts +10 -0
  33. package/dist/components/site-form/SiteForm.vue.d.ts +10 -0
  34. package/dist/components/spinner/Spinner.vue.d.ts +4 -1
  35. package/dist/components/spinner/types.d.ts +9 -0
  36. package/dist/components/step-indicator/StepIndicator.vue.d.ts +7 -0
  37. package/dist/components/step-indicator/types.d.ts +30 -0
  38. package/dist/components/toast/Toast.vue.d.ts +10 -0
  39. package/dist/components/toast/Toaster.vue.d.ts +10 -0
  40. package/dist/components.css +153 -0
  41. package/dist/icons/paths.d.ts +8 -0
  42. package/dist/index.d.ts +6 -0
  43. package/dist/index.js +621 -302
  44. package/dist/messages/en-US.d.ts +27 -0
  45. package/dist/messages/is-IS.js +11 -1
  46. package/dist/phone/PhoneFlag.vue.d.ts +6 -0
  47. package/dist/phone/PhoneInput.vue.d.ts +220 -0
  48. package/dist/phone/caret.d.ts +14 -0
  49. package/dist/phone/examples.d.ts +2 -0
  50. package/dist/phone/flags.d.ts +8 -0
  51. package/dist/phone/index.d.ts +13 -0
  52. package/dist/phone/phone.d.ts +62 -0
  53. package/dist/phone/phoneFlagData.d.ts +2 -0
  54. package/dist/phone/rule.d.ts +22 -0
  55. package/dist/phone/types.d.ts +63 -0
  56. package/dist/phone/vee-validate/FieldPhoneInput.vue.d.ts +24 -0
  57. package/dist/phone/vee-validate/index.d.ts +3 -0
  58. package/dist/phone/vee-validate/types.d.ts +3 -0
  59. package/dist/phone/vee-validate.js +96 -0
  60. package/dist/phone.js +1 -0
  61. package/dist/phoneFlagData-D9dDT2uC.js +261 -0
  62. package/dist/resolver.d.ts +9 -2
  63. package/dist/resolver.js +18 -4
  64. package/dist/style.css +153 -0
  65. package/dist/useFieldControl-D_b9SC9s.js +273 -0
  66. package/dist/{useMessages-B5nzZghs.js → useMessages-DQQPh1P_.js} +28 -1
  67. package/dist/usePopover-4CQR2hB5.js +2228 -0
  68. package/dist/utilities.css +37 -0
  69. package/dist/vee-validate/FieldCheckbox.vue.d.ts +5 -1
  70. package/dist/vee-validate/FieldCheckboxGroup.vue.d.ts +5 -1
  71. package/dist/vee-validate/FieldCurrencyInput.vue.d.ts +5 -1
  72. package/dist/vee-validate/FieldInput.vue.d.ts +5 -1
  73. package/dist/vee-validate/FieldMultiSelect.vue.d.ts +5 -1
  74. package/dist/vee-validate/FieldQuantityStepper.vue.d.ts +5 -1
  75. package/dist/vee-validate/FieldRadioGroup.vue.d.ts +5 -1
  76. package/dist/vee-validate/FieldSearchBar.vue.d.ts +5 -1
  77. package/dist/vee-validate/FieldSelect.vue.d.ts +5 -1
  78. package/dist/vee-validate/FieldSwitch.vue.d.ts +5 -1
  79. package/dist/vee-validate/FieldTextarea.vue.d.ts +5 -1
  80. package/dist/vee-validate/FieldUnitInput.vue.d.ts +5 -1
  81. package/dist/vee-validate/FieldVariantPicker.vue.d.ts +5 -1
  82. package/dist/vee-validate/context.d.ts +32 -7
  83. package/dist/vee-validate/index.d.ts +8 -5
  84. package/dist/vee-validate/types.d.ts +26 -0
  85. package/dist/vee-validate/useFieldControl.d.ts +59 -10
  86. package/dist/vee-validate.js +114 -197
  87. package/dist/vue-i18n.js +4 -1
  88. package/package.json +20 -3
@@ -844,6 +844,32 @@
844
844
  }
845
845
  }
846
846
  }
847
+ /* The ring while a popup opened from *inside* the element is open: `eldra-focus-open` for a box
848
+ that is not itself the trigger. `PhoneInput`'s field is a box around a country button and a
849
+ number input; the list opens from the button, focus moves into the list's search field (which is
850
+ teleported away), and the field would otherwise lose its ring while its own popup hangs off it.
851
+ A modifier of the same shape as `eldra-focus-open` and `eldra-focus-proxy`: it carries no ring
852
+ of its own and only turns on the one `eldra-focus` put on the element. */
853
+ @utility eldra-focus-has-open {
854
+ &:has([aria-expanded='true']) {
855
+ --eldra-focus-alpha: 1;
856
+ @supports not (color: color-mix(in srgb, red, red)) {
857
+ --tw-ring-offset-shadow:
858
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
859
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
860
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner);
861
+ --tw-ring-shadow: 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
862
+ var(--eldra-color-focus);
863
+ }
864
+ }
865
+ @media (forced-colors: active) {
866
+ &:has([aria-expanded='true']) {
867
+ outline-width: var(--eldra-focus-width);
868
+ outline-offset: var(--eldra-focus-offset);
869
+ outline-color: Highlight;
870
+ }
871
+ }
872
+ }
847
873
  /* Proxy focus (spec 1 "Focus ring" → Proxy focus): "When the focusable element is visually hidden
848
874
  (the radio inside a size pill, the stretched link of a card), draw the ring on the visible shape
849
875
  (the pill, the whole card), not on the hidden element."
@@ -1160,6 +1186,17 @@
1160
1186
  max-width: min(var(--eldra-select-panel-max-width, 22rem), 90vw);
1161
1187
  }
1162
1188
 
1189
+ /* A `PhoneInput` flag's edge. The artwork is 1.25 × 0.875rem; neither its corner nor its hairline
1190
+ is a token (the radius scale starts at 0.375rem, more than a third of the flag's height), so
1191
+ both are per-component variables with literal defaults, the same shape as `eldra-link-radius`.
1192
+ The hairline keeps a white flag visible on a white field, and its fill shows until the artwork
1193
+ has loaded. */
1194
+ @utility eldra-phone-flag {
1195
+ border-radius: var(--eldra-phone-flag-radius, 2px);
1196
+ box-shadow: 0 0 0 1px var(--eldra-phone-flag-border, var(--eldra-color-border));
1197
+ background-color: var(--eldra-phone-flag-fill, var(--eldra-color-surface-strong));
1198
+ }
1199
+
1163
1200
  /* The matched run of a filtered option (spec "Select" -> States, "Option filtered match"):
1164
1201
  "matched characters weight 700, 2px underline at 0.15em offset". None of the three is a token —
1165
1202
  the type styles stop at 600 and no underline offset exists anywhere else — so all three are
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldCheckboxProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCheckboxProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldCheckboxProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCheckboxProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldCheckboxGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCheckboxGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldCheckboxGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCheckboxGroupProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldCurrencyInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCurrencyInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldCurrencyInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldCurrencyInputProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldInputProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldMultiSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldMultiSelectProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldMultiSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldMultiSelectProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldQuantityStepperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldQuantityStepperProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldQuantityStepperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldQuantityStepperProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldRadioGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldRadioGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldRadioGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldRadioGroupProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldSearchBarProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSearchBarProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldSearchBarProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSearchBarProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSelectProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSelectProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldSwitchProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSwitchProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldSwitchProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldSwitchProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldTextareaProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldTextareaProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldTextareaProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldTextareaProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldUnitInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldUnitInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldUnitInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldUnitInputProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -5,7 +5,11 @@ declare const __VLS_template: () => {
5
5
  };
6
6
  };
7
7
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
- declare const __VLS_base: import('vue').DefineComponent<FieldVariantPickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldVariantPickerProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldVariantPickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldVariantPickerProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
14
  declare const _default: typeof __VLS_export;
11
15
  export default _default;
@@ -10,13 +10,13 @@ import { InjectionKey, Ref } from 'vue';
10
10
  * true as soon as the customer edits it, and nothing else would reliably clear it (a rule that
11
11
  * already passes has no new message to overwrite it with).
12
12
  *
13
- * How long an entry survives a change to a *different* field is vee-validate's, not this key's.
14
- * Before the first submit — and with per-field `rules` at any time — only the changed field is
15
- * revalidated, so another field's server error stays put. After a submit, with a form-level
16
- * `validationSchema`, every already-validated field is revalidated on each change
17
- * (`validated-only`), and a field that now passes has its manually set error replaced by that
18
- * pass — so the server's message for it goes too. Send the current map with each response rather
19
- * than treating one as sticky; `src/vee-validate/__tests__/vee-validate.spec.ts` pins both halves.
13
+ * A server error on a *different* field stays on screen while this one is edited: each `Field*`
14
+ * holds the message it shows and changes it only at its own moments (its blur, a submit, its own
15
+ * edit of a server error — see `useFieldControl`). Underneath, vee-validate may already have
16
+ * dropped it: with a form-level `validationSchema`, validating one field revalidates every field
17
+ * that has been validated before (`validated-only`), and a field that now passes has its manually
18
+ * set error replaced by that pass. So the entry is gone for good at that field's next blur or the
19
+ * next submit; send the current map with each response rather than treating one as sticky.
20
20
  *
21
21
  * It is a plain `Ref`, so a consumer can provide one itself and drive server errors from outside a
22
22
  * `Form`:
@@ -46,3 +46,28 @@ export interface FieldAnchorRegistry {
46
46
  }
47
47
  /** The key a `Form` provides its {@link FieldAnchorRegistry} on. Internal to this entry. */
48
48
  export declare const FIELD_ANCHORS_KEY: InjectionKey<FieldAnchorRegistry>;
49
+ /**
50
+ * How a `Field*` tells the `Form` above it which message it is **showing**, so the form's error
51
+ * summary and its `errors` slot prop say exactly what the fields say, at the same moment.
52
+ *
53
+ * A field holds its displayed message itself (see `useFieldControl`): it changes on the field's
54
+ * blur, on a submit, and on a value change only when the field asks for that. vee-validate's own
55
+ * `errors` can move at other moments — a form-level schema revalidates already-validated fields
56
+ * whenever any one of them is validated — so the form reads what the fields report rather than
57
+ * `errors`.
58
+ *
59
+ * Internal: not exported from the entry.
60
+ */
61
+ export interface FieldMessageRegistry {
62
+ /** Record the message the field at `path` is showing; `undefined` while it shows none. */
63
+ report(path: string, message: string | undefined): void;
64
+ /** Forget `path`, when the field unmounts or is renamed. */
65
+ forget(path: string): void;
66
+ /**
67
+ * Counts the submits whose validation has finished. A field reads its message again each time
68
+ * it rises: that is the "on submit" moment, after the form has validated every field.
69
+ */
70
+ settled: Readonly<Ref<number>>;
71
+ }
72
+ /** The key a `Form` provides its {@link FieldMessageRegistry} on. Internal to this entry. */
73
+ export declare const FIELD_MESSAGES_KEY: InjectionKey<FieldMessageRegistry>;
@@ -17,11 +17,14 @@ export type { FieldBinding, FieldCheckboxGroupProps, FieldCheckboxProps, FieldCu
17
17
  /**
18
18
  * The building block the thirteen `Field*` components are made of, exported so a consumer wrapping a
19
19
  * control this package does not ship — or one of its own — binds it the same way: the value, the
20
- * message gated on "touched or submitted", the `id` the error summary links to, and the server
21
- * error that clears when the value changes.
20
+ * message shown at the field's own moments (blur, submit, and the two opt-in ones), the `id` the
21
+ * error summary links to, and the server error that clears when the value changes.
22
22
  *
23
23
  * `FIELD_ONLY` comes with it: the prop names a `Field*` keeps for itself and must **not** forward
24
- * to the control it wraps (`path`, `rules`, `label`, `id`). Without it a consumer writing their own
25
- * wrapper has to rediscover the list by reading this package's source.
24
+ * to the control it wraps (`path`, `rules`, `label`, `id` and the three in
25
+ * `FIELD_VALIDATION_PROPS`). Without it a consumer writing their own wrapper has to rediscover the
26
+ * list by reading this package's source. `FIELD_VALIDATION_DEFAULTS` (a typed control) or
27
+ * `FIELD_CHOICE_VALIDATION_DEFAULTS` (a choice control) is what to hand `withDefaults`, so that
28
+ * wrapper's `validateOnBlur` defaults to `true` like every `Field*`'s.
26
29
  */
27
- export { FIELD_ONLY, useFieldControl, type UseFieldControlOptions, type UseFieldControlReturn, } from './useFieldControl.js';
30
+ export { FIELD_CHOICE_VALIDATION_DEFAULTS, FIELD_ONLY, FIELD_VALIDATION_DEFAULTS, FIELD_VALIDATION_PROPS, useFieldControl, type UseFieldControlOptions, type UseFieldControlReturn, } from './useFieldControl.js';
@@ -39,6 +39,32 @@ export interface FieldBinding<TValue = unknown> {
39
39
  rules?: RuleExpression<TValue>;
40
40
  /** The name a rule message uses for this field ("Email address"), not a visible label. */
41
41
  label?: string;
42
+ /**
43
+ * Validates the field as soon as it is mounted **and shows the message at once**, without waiting
44
+ * for a blur or a submit — for a form opened on values that are already known to be wrong (an
45
+ * edit form over stored data). Default `false`.
46
+ */
47
+ validateOnMount?: boolean;
48
+ /**
49
+ * Validates the field when it loses focus, and shows or clears its message then. Default `true`.
50
+ * `false` leaves validation to the submit (or to `validateOnValueUpdate`): a blur then only marks
51
+ * the field touched.
52
+ */
53
+ validateOnBlur?: boolean;
54
+ /**
55
+ * Validates the field on every change of its value, so the message follows each change once the
56
+ * field has been touched or the form submitted.
57
+ *
58
+ * The default depends on the control. **`false`** for a typed one (`FieldInput`, `FieldTextarea`,
59
+ * `FieldCurrencyInput`, `FieldUnitInput`, `FieldSearchBar`): while the customer types, no
60
+ * message appears and a message already showing stays as it is until the next blur or submit.
61
+ * **`true`** for a choice (`FieldCheckbox`, `FieldCheckboxGroup`, `FieldRadioGroup`,
62
+ * `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`,
63
+ * `FieldQuantityStepper`), where one click is the whole value.
64
+ *
65
+ * Read once, when the field is set up — it is vee-validate's own `useField` option.
66
+ */
67
+ validateOnValueUpdate?: boolean;
42
68
  }
43
69
  /**
44
70
  * Every `Field*` takes its component's own props, minus the ones it owns itself: `modelValue`
@@ -4,8 +4,40 @@ import { FieldBinding } from './types.js';
4
4
  type FieldControlProps<TValue> = FieldBinding<TValue> & {
5
5
  id?: string;
6
6
  };
7
+ /** The three props that decide when a field validates. Never forwarded to the wrapped control. */
8
+ export declare const FIELD_VALIDATION_PROPS: readonly ["validateOnMount", "validateOnBlur", "validateOnValueUpdate"];
9
+ /**
10
+ * Their defaults for a **typed** control — `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`,
11
+ * `FieldUnitInput`, `FieldSearchBar` — handed to `withDefaults(defineProps<…>(), …)`. A value
12
+ * there is built up one keystroke at a time, so validating each change would judge a half-typed
13
+ * value; the field validates when it is left instead.
14
+ *
15
+ * They have to be real defaults: Vue casts an absent boolean prop to `false`, never `undefined`,
16
+ * so without one `validateOnBlur` could not default to `true`.
17
+ */
18
+ export declare const FIELD_VALIDATION_DEFAULTS: {
19
+ readonly validateOnMount: false;
20
+ readonly validateOnBlur: true;
21
+ readonly validateOnValueUpdate: false;
22
+ };
23
+ /**
24
+ * Their defaults for a **choice** control — `FieldCheckbox`, `FieldCheckboxGroup`,
25
+ * `FieldRadioGroup`, `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`,
26
+ * `FieldQuantityStepper`. One click or selection is the whole value there — there is no typing in
27
+ * between, and often no blur afterwards — so a box that only validated on blur would go on saying
28
+ * "required" after it had been ticked. These validate on each change as well as on blur.
29
+ *
30
+ * `FieldQuantityStepper` belongs here although it has a text field: a `QuantityStepper` writes its
31
+ * value only when a typed number is committed (on blur or `Enter`) or a button is pressed, never
32
+ * per keystroke, so every change it reports is a complete quantity.
33
+ */
34
+ export declare const FIELD_CHOICE_VALIDATION_DEFAULTS: {
35
+ readonly validateOnMount: false;
36
+ readonly validateOnBlur: true;
37
+ readonly validateOnValueUpdate: true;
38
+ };
7
39
  /** The props a `Field*` keeps for itself and never forwards to the component it wraps. */
8
- export declare const FIELD_ONLY: readonly ["path", "rules", "label", "id"];
40
+ export declare const FIELD_ONLY: readonly ["path", "rules", "label", "id", "validateOnMount", "validateOnBlur", "validateOnValueUpdate"];
9
41
  export interface UseFieldControlOptions<TValue> {
10
42
  /**
11
43
  * What the control is bound to while the field itself holds `undefined` — `''`, `false`, or a
@@ -36,22 +68,39 @@ export interface UseFieldControlReturn<TValue> {
36
68
  ownError: ComputedRef<string | undefined>;
37
69
  /** The `id` to forward to the control, or `undefined` to leave the control's own wiring alone. */
38
70
  id: ComputedRef<string | undefined>;
39
- /** Marks the field touched, which is what reveals a message it already has. */
71
+ /** Marks the field touched and, unless `validateOnBlur` is `false`, validates it. */
40
72
  onBlur: (event?: Event) => void;
41
73
  }
42
74
  /**
43
75
  * The whole of what a `Field*` does, minus the one component it renders.
44
76
  *
45
77
  * Each `Field*` is a thin SFC over this: `useField(name, rules, { label })` for the value and the
46
- * message, a gate that keeps a message hidden until the customer has left the field or submitted
47
- * the form, the `id` the form's error summary links to, and the server error that stops being true
48
- * as soon as the value changes. Keeping it here is what makes the eleven components agree on all
49
- * of that rather than eleven files drifting apart.
78
+ * validation, the message the field **shows**, the `id` the form's error summary links to, and the
79
+ * server error that stops being true as soon as the value changes. Keeping it here is what makes
80
+ * the thirteen components agree on all of that rather than thirteen files drifting apart.
81
+ *
82
+ * **When a field validates, and when its message changes.** The spec's rule (Form layout →
83
+ * Behaviour & motion) is "Validate on submit, then on blur for fields that were invalid after the
84
+ * first submit"; three props per field say which moments apply, and the message on screen changes
85
+ * at those moments and at no other:
86
+ *
87
+ * - **submit**, always: the form validates every field, and each one then shows its result;
88
+ * - **blur**, unless `validateOnBlur` is `false` (default `true`): the field is validated and
89
+ * shows its result. A blur always marks the field touched;
90
+ * - **a value change**, only with `validateOnValueUpdate`: the message follows every change once
91
+ * the field has been touched or the form submitted. Default `false` for a typed control, `true`
92
+ * for a choice control (see the two defaults objects above);
93
+ * - **mount**, only with `validateOnMount` (default `false`): validated and shown at once.
94
+ *
95
+ * So in a typed control, typing changes nothing the customer sees: no message appears, and one
96
+ * already showing stays until the next blur or submit. A choice control answers a click at once.
50
97
  *
51
- * **The gate** is the spec's own rule (Form layout → Behaviour & motion: "Validate on submit, then
52
- * on blur for fields that were invalid after the first submit"). vee-validate revalidates on every
53
- * keystroke, so the field always *knows* its message; showing it only once `meta.touched` or the
54
- * form has been submitted is what stops an error appearing under a half-typed email address.
98
+ * **Why the shown message is held here** rather than read from vee-validate's `errorMessage`. That
99
+ * value can move at moments that are not this field's: with a `validationSchema` on the form,
100
+ * validating one field revalidates every field already validated (`validated-only`), so another
101
+ * field's blur would otherwise clear or change this field's message while it is being typed in.
102
+ * `shown` is a copy taken only at the moments listed above, which is what makes the props true in
103
+ * both setups, per-field `rules` and a form-level schema alike.
55
104
  */
56
105
  export declare function useFieldControl<TValue>(props: FieldControlProps<TValue>, options: UseFieldControlOptions<TValue>): UseFieldControlReturn<TValue>;
57
106
  /**