@eldrajs/ui 0.3.19 → 0.3.21

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 (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +63 -31
  3. package/dist/{PhoneInput-CHTpjbtS.js → PhoneInput-f6wxvduD.js} +1 -1
  4. package/dist/{VariantPicker-CrKQ7jpB.js → VariantPicker-CCci26If.js} +524 -311
  5. package/dist/components/autocomplete/Autocomplete.vue.d.ts +2 -0
  6. package/dist/components/chip/Chip.vue.d.ts +2 -0
  7. package/dist/components/currency-input/CurrencyInput.vue.d.ts +5 -1
  8. package/dist/components/dialog/Dialog.vue.d.ts +2 -0
  9. package/dist/components/drawer/Drawer.vue.d.ts +2 -0
  10. package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
  11. package/dist/components/filter-panel/FilterPanel.vue.d.ts +2 -0
  12. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
  13. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
  14. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -0
  15. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
  16. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
  17. package/dist/components/lightbox/Lightbox.vue.d.ts +2 -0
  18. package/dist/components/load-more/LoadMore.vue.d.ts +1 -1
  19. package/dist/components/nav-menu/NavMenu.vue.d.ts +2 -0
  20. package/dist/components/pagination/Pagination.vue.d.ts +2 -0
  21. package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -0
  22. package/dist/components/search-bar/SearchBar.vue.d.ts +2 -0
  23. package/dist/components/search-modal/SearchModal.vue.d.ts +2 -0
  24. package/dist/components/select/MultiSelect.vue.d.ts +2 -0
  25. package/dist/components/select/Select.vue.d.ts +2 -0
  26. package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
  27. package/dist/components/toast/Toast.vue.d.ts +2 -0
  28. package/dist/components/toast/Toaster.vue.d.ts +2 -0
  29. package/dist/components/unit-input/UnitInput.vue.d.ts +8 -0
  30. package/dist/components/unit-input/types.d.ts +13 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +3 -3
  33. package/dist/messages/en-US.d.ts +4 -0
  34. package/dist/messages/is-IS.js +3 -1
  35. package/dist/phone/PhoneInput.vue.d.ts +2 -0
  36. package/dist/phone/vee-validate.js +3 -3
  37. package/dist/phone.js +1 -1
  38. package/dist/{useFieldControl-B1JvPEeM.js → useFieldControl-BnO3B37W.js} +17 -6
  39. package/dist/{useMessages-BdN9F1cW.js → useMessages-D8bTGX7c.js} +5 -1
  40. package/dist/utils/amount.d.ts +71 -0
  41. package/dist/vee-validate/useFieldControl.d.ts +6 -0
  42. package/dist/vee-validate.js +35 -5
  43. package/dist/vue-i18n.js +1 -1
  44. package/package.json +1 -1
@@ -207,6 +207,8 @@ declare const __VLS_base: import('vue').DefineComponent<AutocompleteProps, {
207
207
  phoneNoMatch: (query: string) => string;
208
208
  phoneInvalid: (country: string) => string;
209
209
  phoneInvalidNumber: string;
210
+ amountNotANumber: string;
211
+ amountNoDecimals: string;
210
212
  }>;
211
213
  minLength: number;
212
214
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -188,6 +188,8 @@ declare const __VLS_base: import('vue').DefineComponent<ChipProps, {}, {}, {}, {
188
188
  phoneNoMatch: (query: string) => string;
189
189
  phoneInvalid: (country: string) => string;
190
190
  phoneInvalidNumber: string;
191
+ amountNotANumber: string;
192
+ amountNoDecimals: string;
191
193
  }>;
192
194
  icon: import('../../index.js').IconComponent;
193
195
  avatar: string | import('../../index.js').ImageMedia | null;
@@ -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<CurrencyInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CurrencyInputProps> & Readonly<{}>, {
8
+ declare const __VLS_base: import('vue').DefineComponent<CurrencyInputProps, {
9
+ formatValue: (amount: number) => string;
10
+ isValid: import('vue').ComputedRef<boolean>;
11
+ invalidReason: import('vue').ComputedRef<import('../../index.js').AmountInvalidReason | null>;
12
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CurrencyInputProps> & Readonly<{}>, {
9
13
  currency: string;
10
14
  narrowSymbol: boolean;
11
15
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -189,6 +189,8 @@ declare const __VLS_base: import('vue').DefineComponent<DialogProps, {
189
189
  phoneNoMatch: (query: string) => string;
190
190
  phoneInvalid: (country: string) => string;
191
191
  phoneInvalidNumber: string;
192
+ amountNotANumber: string;
193
+ amountNoDecimals: string;
192
194
  }>;
193
195
  description: string;
194
196
  dismissable: boolean;
@@ -190,6 +190,8 @@ declare const __VLS_base: import('vue').DefineComponent<DrawerProps, {
190
190
  phoneNoMatch: (query: string) => string;
191
191
  phoneInvalid: (country: string) => string;
192
192
  phoneInvalidNumber: string;
193
+ amountNotANumber: string;
194
+ amountNoDecimals: string;
193
195
  }>;
194
196
  ariaLabel: string;
195
197
  count: number;
@@ -201,6 +201,8 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
201
201
  phoneNoMatch: (query: string) => string;
202
202
  phoneInvalid: (country: string) => string;
203
203
  phoneInvalidNumber: string;
204
+ amountNotANumber: string;
205
+ amountNoDecimals: string;
204
206
  }>;
205
207
  topRule: boolean;
206
208
  escCollapses: boolean;
@@ -220,6 +220,8 @@ declare const __VLS_base: import('vue').DefineComponent<FilterPanelProps, {
220
220
  phoneNoMatch: (query: string) => string;
221
221
  phoneInvalid: (country: string) => string;
222
222
  phoneInvalidNumber: string;
223
+ amountNotANumber: string;
224
+ amountNoDecimals: string;
223
225
  }>;
224
226
  mode: import('./types.js').FilterPanelMode;
225
227
  locale: string;
@@ -170,6 +170,8 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
170
170
  phoneNoMatch: (query: string) => string;
171
171
  phoneInvalid: (country: string) => string;
172
172
  phoneInvalidNumber: string;
173
+ amountNotANumber: string;
174
+ amountNoDecimals: string;
173
175
  }>;
174
176
  dense: boolean;
175
177
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -170,6 +170,8 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
170
170
  phoneNoMatch: (query: string) => string;
171
171
  phoneInvalid: (country: string) => string;
172
172
  phoneInvalidNumber: string;
173
+ amountNotANumber: string;
174
+ amountNoDecimals: string;
173
175
  }>;
174
176
  dense: boolean;
175
177
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -176,6 +176,8 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
176
176
  phoneNoMatch: (query: string) => string;
177
177
  phoneInvalid: (country: string) => string;
178
178
  phoneInvalidNumber: string;
179
+ amountNotANumber: string;
180
+ amountNoDecimals: string;
179
181
  }>;
180
182
  locale: string;
181
183
  currency: string;
@@ -170,6 +170,8 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
170
170
  phoneNoMatch: (query: string) => string;
171
171
  phoneInvalid: (country: string) => string;
172
172
  phoneInvalidNumber: string;
173
+ amountNotANumber: string;
174
+ amountNoDecimals: string;
173
175
  }>;
174
176
  dense: boolean;
175
177
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -170,6 +170,8 @@ declare const __VLS_export: import('vue').DefineComponent<FacetProps, {}, {}, {}
170
170
  phoneNoMatch: (query: string) => string;
171
171
  phoneInvalid: (country: string) => string;
172
172
  phoneInvalidNumber: string;
173
+ amountNotANumber: string;
174
+ amountNoDecimals: string;
173
175
  }>;
174
176
  dense: boolean;
175
177
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -177,6 +177,8 @@ declare const __VLS_export: import('vue').DefineComponent<LightboxProps, {
177
177
  phoneNoMatch: (query: string) => string;
178
178
  phoneInvalid: (country: string) => string;
179
179
  phoneInvalidNumber: string;
180
+ amountNotANumber: string;
181
+ amountNoDecimals: string;
180
182
  }>;
181
183
  index: number;
182
184
  thumbnails: boolean;
@@ -5,8 +5,8 @@ declare const __VLS_export: import('vue').DefineComponent<LoadMoreProps, {}, {},
5
5
  onLoad?: (() => any) | undefined;
6
6
  }>, {
7
7
  classes: Partial<Record<import('./types.js').LoadMorePart, string>>;
8
- noun: string;
9
8
  pending: boolean;
9
+ noun: string;
10
10
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
11
  declare const _default: typeof __VLS_export;
12
12
  export default _default;
@@ -206,6 +206,8 @@ declare const __VLS_base: import('vue').DefineComponent<NavMenuProps, {
206
206
  phoneNoMatch: (query: string) => string;
207
207
  phoneInvalid: (country: string) => string;
208
208
  phoneInvalidNumber: string;
209
+ amountNotANumber: string;
210
+ amountNoDecimals: string;
209
211
  }>;
210
212
  variant: NavMenuVariant;
211
213
  linkAs: string | import('vue').Component;
@@ -171,6 +171,8 @@ declare const __VLS_export: import('vue').DefineComponent<PaginationProps, {}, {
171
171
  phoneNoMatch: (query: string) => string;
172
172
  phoneInvalid: (country: string) => string;
173
173
  phoneInvalidNumber: string;
174
+ amountNotANumber: string;
175
+ amountNoDecimals: string;
174
176
  }>;
175
177
  linkAs: string | import('vue').Component;
176
178
  ariaLabel: string;
@@ -194,6 +194,8 @@ declare const __VLS_base: import('vue').DefineComponent<RangeSliderProps, {}, {}
194
194
  phoneNoMatch: (query: string) => string;
195
195
  phoneInvalid: (country: string) => string;
196
196
  phoneInvalidNumber: string;
197
+ amountNotANumber: string;
198
+ amountNoDecimals: string;
197
199
  }>;
198
200
  formatValue: (value: number, end?: RangeSliderEnd) => string;
199
201
  inputs: boolean;
@@ -195,6 +195,8 @@ declare const __VLS_base: import('vue').DefineComponent<SearchBarProps, {}, {},
195
195
  phoneNoMatch: (query: string) => string;
196
196
  phoneInvalid: (country: string) => string;
197
197
  phoneInvalidNumber: string;
198
+ amountNotANumber: string;
199
+ amountNoDecimals: string;
198
200
  }>;
199
201
  pill: boolean;
200
202
  action: string;
@@ -200,6 +200,8 @@ declare const __VLS_base: import('vue').DefineComponent<SearchModalProps, {
200
200
  phoneNoMatch: (query: string) => string;
201
201
  phoneInvalid: (country: string) => string;
202
202
  phoneInvalidNumber: string;
203
+ amountNotANumber: string;
204
+ amountNoDecimals: string;
203
205
  }>;
204
206
  ariaLabel: string;
205
207
  query: string;
@@ -260,6 +260,8 @@ declare const __VLS_base: import('vue').DefineComponent<MultiSelectProps, {}, {}
260
260
  phoneNoMatch: (query: string) => string;
261
261
  phoneInvalid: (country: string) => string;
262
262
  phoneInvalidNumber: string;
263
+ amountNotANumber: string;
264
+ amountNoDecimals: string;
263
265
  }>;
264
266
  showTags: boolean;
265
267
  tagPlacement: "below" | "inside";
@@ -231,6 +231,8 @@ declare const __VLS_base: import('vue').DefineComponent<SelectProps, {}, {}, {},
231
231
  phoneNoMatch: (query: string) => string;
232
232
  phoneInvalid: (country: string) => string;
233
233
  phoneInvalidNumber: string;
234
+ amountNotANumber: string;
235
+ amountNoDecimals: string;
234
236
  }>;
235
237
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
236
238
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -188,6 +188,8 @@ declare const __VLS_base: import('vue').DefineComponent<SiteFormProps, {}, {}, {
188
188
  phoneNoMatch: (query: string) => string;
189
189
  phoneInvalid: (country: string) => string;
190
190
  phoneInvalidNumber: string;
191
+ amountNotANumber: string;
192
+ amountNoDecimals: string;
191
193
  }>;
192
194
  layout: import('./types.js').SiteFormLayout;
193
195
  heading: string;
@@ -173,6 +173,8 @@ declare const __VLS_export: import('vue').DefineComponent<ToastProps, {}, {}, {}
173
173
  phoneNoMatch: (query: string) => string;
174
174
  phoneInvalid: (country: string) => string;
175
175
  phoneInvalidNumber: string;
176
+ amountNotANumber: string;
177
+ amountNoDecimals: string;
176
178
  }>;
177
179
  variant: ToastVariant;
178
180
  action: import('./types.js').ToastAction;
@@ -173,6 +173,8 @@ declare const __VLS_export: import('vue').DefineComponent<ToasterProps, {}, {},
173
173
  phoneNoMatch: (query: string) => string;
174
174
  phoneInvalid: (country: string) => string;
175
175
  phoneInvalidNumber: string;
176
+ amountNotANumber: string;
177
+ amountNoDecimals: string;
176
178
  }>;
177
179
  teleportTo: string | HTMLElement;
178
180
  toasts: ToasterToast[];
@@ -1,3 +1,4 @@
1
+ import { AmountInvalidReason } from '../../utils/amount.js';
1
2
  import { UnitInputProps } from './types.js';
2
3
  declare function formatValue(value: number): string;
3
4
  declare const __VLS_template: () => {
@@ -10,18 +11,22 @@ declare const __VLS_template: () => {
10
11
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
11
12
  declare const __VLS_base: import('vue').DefineComponent<UnitInputProps, {
12
13
  formatValue: typeof formatValue;
14
+ isValid: import('vue').ComputedRef<boolean>;
15
+ invalidReason: import('vue').ComputedRef<AmountInvalidReason | null>;
13
16
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
17
  "update:modelValue": (value: number | null) => any;
15
18
  clear: () => any;
16
19
  blur: (event: FocusEvent) => any;
17
20
  focus: (event: FocusEvent) => any;
18
21
  "update:formattedValue": (value: string) => any;
22
+ "update:valid": (valid: boolean) => any;
19
23
  }, string, import('vue').PublicProps, Readonly<UnitInputProps> & Readonly<{
20
24
  "onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
21
25
  onClear?: (() => any) | undefined;
22
26
  onBlur?: ((event: FocusEvent) => any) | undefined;
23
27
  onFocus?: ((event: FocusEvent) => any) | undefined;
24
28
  "onUpdate:formattedValue"?: ((value: string) => any) | undefined;
29
+ "onUpdate:valid"?: ((valid: boolean) => any) | undefined;
25
30
  }>, {
26
31
  name: string;
27
32
  label: string;
@@ -32,6 +37,7 @@ declare const __VLS_base: import('vue').DefineComponent<UnitInputProps, {
32
37
  unit: string;
33
38
  leadingIcon: import('../../index.js').IconComponent;
34
39
  id: string;
40
+ placeholder: string;
35
41
  min: number;
36
42
  max: number;
37
43
  step: number;
@@ -46,6 +52,8 @@ declare const __VLS_base: import('vue').DefineComponent<UnitInputProps, {
46
52
  maxFraction: number;
47
53
  isCurrency: boolean;
48
54
  enableDragAdjust: boolean;
55
+ fixedFraction: boolean;
56
+ nullable: boolean;
49
57
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
50
58
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
51
59
  declare const _default: typeof __VLS_export;
@@ -24,7 +24,10 @@ export interface UnitInputProps {
24
24
  * `FieldWrapper` the wrapper owns the label, and this is ignored rather than said twice.
25
25
  */
26
26
  label?: string;
27
- /** The most fraction digits the formatted value keeps. Defaults to `2`. */
27
+ /**
28
+ * The most fraction digits the field takes. Defaults to `2`. A currency without decimals (ISK)
29
+ * takes none whatever this says.
30
+ */
28
31
  maxFraction?: number;
29
32
  /** The highest value the field accepts. Typing past it is refused. Defaults to `2 ** 53 - 1`. */
30
33
  max?: number;
@@ -42,6 +45,15 @@ export interface UnitInputProps {
42
45
  currency?: string;
43
46
  /** `$` rather than `US$` where the two differ (`currencyDisplay: 'narrowSymbol'`). Default `false`. */
44
47
  narrowSymbol?: boolean;
48
+ /**
49
+ * Currency only: always the currency's own decimals at rest (`34,90 €`, `4.990 kr.`), and no
50
+ * more while typing. Defaults to `false`.
51
+ */
52
+ fixedFraction?: boolean;
53
+ /** An emptied field stays empty and emits `null`, instead of falling back to `min`. */
54
+ nullable?: boolean;
55
+ /** Shown while empty, in place of the formatted zero. */
56
+ placeholder?: string;
45
57
  /** One of the spec's three field sizes. Defaults to `md`. */
46
58
  size?: InputSize;
47
59
  /** The control's id. Comes from the `FieldWrapper` when there is one; this wins over it. */
package/dist/index.d.ts CHANGED
@@ -149,6 +149,7 @@ export { mixToward } from './utils/color.js';
149
149
  export { joinIds, useUiId } from './utils/id.js';
150
150
  export { applyMask, defaultCharacterMeaning, stripMask } from './utils/mask.js';
151
151
  export { createNumberFormat, currencyFractionDigits, currencySymbol, defaultUnitFormat, formatCurrency, formatNumber, formatUnit, localeSeparators, parseLocaleNumber, toMinorUnits, type NumberFormatOptions, type UnitFormatOptions, } from './utils/number-format.js';
152
+ export { createAmountEditor, parseAmount, readAmount, type AmountEdit, type AmountEditor, type AmountEditorOptions, type AmountInvalidReason, type AmountReading, type AmountText, } from './utils/amount.js';
152
153
  export { filterNumericBeforeInput, type NumericInputFilterOptions } from './utils/numeric-input.js';
153
154
  export { frameAspectRatio } from './utils/ratio.js';
154
155
  export { zoomSizes } from './utils/sizes.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $ as FIELD_KEY, A as ICON_STROKE_WIDTH$6, G as FIELD_SEARCH_APPEARANCE, I as FIELD_CLEAR_BUTTON_BOX, K as FIELD_SIZE, N as FIELD_BASE, R as FIELD_DISABLED, V as FIELD_LIVE, _ as useFloating, a as CURRENCY_KEY, c as provideEldraUiCurrency, d as useEldraUiLocale, et as mergeClass, f as Spinner_default, g as useTeleportTarget, h as topLayerDialog, k as ICON_SIZE_CLASS, l as provideEldraUiLocale, m as useOverlay, n as matchRange, nt as joinIds, o as DEFAULT_UI_LOCALE, p as usePopover, rt as useUiId, s as LOCALE_KEY, tt as useControllableModel, u as useEldraUiCurrency, v as normalizeText, y as useListbox } from "./useOptionList-UMUMayec.js";
2
2
  import { n as provideEldraScope, r as useEldraScope, t as ELDRA_SCOPE_KEY } from "./useEldraScope-BDbGzt7R.js";
3
- import { $ as applyMask, A as defaultUnitFormat, B as tagPadding, C as filterNumericBeforeInput, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as FieldError_default, H as Checkbox_default, I as toMinorUnits, J as FORM_LAYOUT_KEY, K as Button_default, L as useHeadingTag, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as useSlotPresence, R as TAG_FILL, S as Switch_default, T as CurrencyInput_default, U as VisuallyHidden_default, V as CheckboxGroup_default, W as RequiredMark_default, X as Autocomplete_default, Y as FORM_SUBMITTING_KEY, Z as Input_default, _ as radioRecipe, a as ownsShortcut, b as FormLayout_default, c as RadioGroup_default, d as PLAIN_BOX_ONLY, et as defaultCharacterMeaning, f as PLAIN_COLUMNS, g as optionCursor, h as labelRecipe, i as claimShortcut, j as formatCurrency, k as currencySymbol, l as HINT, m as dotRecipe, n as Textarea_default, o as releaseShortcut, p as PLAIN_OPTION, q as Icon_default, r as SearchBar_default, s as SearchResultsPanel_default, t as VariantPicker_default, tt as stripMask, u as INPUT, v as QuantityStepper_default, w as Select_default, x as focusInvalid, y as MultiSelect_default, z as TAG_SHAPE } from "./VariantPicker-CrKQ7jpB.js";
4
- import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-BdN9F1cW.js";
3
+ import { $ as Autocomplete_default, A as defaultUnitFormat, B as useHeadingTag, C as filterNumericBeforeInput, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as Checkbox_default, H as TAG_SHAPE, I as toMinorUnits, J as FieldError_default, K as VisuallyHidden_default, L as createAmountEditor, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as FORM_SUBMITTING_KEY, R as parseAmount, S as Switch_default, T as CurrencyInput_default, U as tagPadding, V as TAG_FILL, W as CheckboxGroup_default, X as Icon_default, Y as Button_default, Z as FORM_LAYOUT_KEY, _ as radioRecipe, a as ownsShortcut, b as FormLayout_default, c as RadioGroup_default, d as PLAIN_BOX_ONLY, et as Input_default, f as PLAIN_COLUMNS, g as optionCursor, h as labelRecipe, i as claimShortcut, it as stripMask, j as formatCurrency, k as currencySymbol, l as HINT, m as dotRecipe, n as Textarea_default, nt as applyMask, o as releaseShortcut, p as PLAIN_OPTION, q as RequiredMark_default, r as SearchBar_default, rt as defaultCharacterMeaning, s as SearchResultsPanel_default, t as VariantPicker_default, tt as useSlotPresence, u as INPUT, v as QuantityStepper_default, w as Select_default, x as focusInvalid, y as MultiSelect_default, z as readAmount } from "./VariantPicker-CCci26If.js";
4
+ import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-D8bTGX7c.js";
5
5
  import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onServerPrefetch, onUnmounted, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
6
6
  import { dateTimeFormat } from "@eldrajs/sdk/format/date";
7
7
  import { formatPrice, numberFormat } from "@eldrajs/sdk/format";
@@ -17142,4 +17142,4 @@ var Tooltip_default = /* @__PURE__ */ defineComponent({
17142
17142
  function mixToward(color, toward, percent) {
17143
17143
  return `color-mix(in oklab, ${color}, ${toward} ${percent}%)`;
17144
17144
  }
17145
- export { ACCORDION_KEY, Accordion_default as Accordion, AccordionItem_default as AccordionItem, Autocomplete_default as Autocomplete, Avatar_default as Avatar, AvatarGroup_default as AvatarGroup, Badge_default as Badge, Breadcrumb_default as Breadcrumb, Button_default as Button, ButtonGroup_default as ButtonGroup, CHIP_GROUP_KEY, CURRENCY_KEY, Carousel_default as Carousel, Checkbox_default as Checkbox, CheckboxGroup_default as CheckboxGroup, Chip_default as Chip, ChipGroup_default as ChipGroup, Container_default as Container, ContentCard_default as ContentCard, CurrencyInput_default as CurrencyInput, CurrencyPicker_default as CurrencyPicker, DEFAULT_UI_LOCALE, Dialog_default as Dialog, Drawer_default as Drawer, ELDRA_SCOPE_KEY, EditorPlaceholder_default as EditorPlaceholder, EmptyState_default as EmptyState, FIELD_KEY, FILTER_SEARCH_FROM, FILTER_VALUES_SHOWN, FORM_LAYOUT_KEY, FORM_SUBMITTING_KEY, FeatureCard_default as FeatureCard, FieldWrapper_default as FieldWrapper, FilterPanel_default as FilterPanel, FormLayout_default as FormLayout, Icon_default as Icon, Image_default as Image, Input_default as Input, LOCALE_KEY, Lightbox_default as Lightbox, Link_default as Link, LoadMore_default as LoadMore, LogoItem_default as LogoItem, MESSAGES_KEY, MultiSelect_default as MultiSelect, NavMenu_default as NavMenu, Notice_default as Notice, Pagination_default as Pagination, Popover_default as Popover, Price_default as Price, ProductCard_default as ProductCard, QuantityStepper_default as QuantityStepper, Radio_default as Radio, RadioGroup_default as RadioGroup, RangeSlider_default as RangeSlider, Rating_default as Rating, SECTION_KEY, SWATCH_INK_LUMINANCE_THRESHOLD, SearchBar_default as SearchBar, SearchModal_default as SearchModal, Section_default as Section, Select_default as Select, SiteForm_default as SiteForm, Skeleton_default as Skeleton, Spinner_default as Spinner, StepIndicator_default as StepIndicator, StockBadge_default as StockBadge, Switch_default as Switch, TABS_KEY, TOAST_HOST_KEY, Tab_default as Tab, TabPanel_default as TabPanel, TablerIcon_default as TablerIcon, Tabs_default as Tabs, Textarea_default as Textarea, Toast_default as Toast, Toaster_default as Toaster, Tooltip_default as Tooltip, UnitInput_default as UnitInput, VariantPicker_default as VariantPicker, VisuallyHidden_default as VisuallyHidden, appliedFilters, applyMask, carouselPerViewStyle, clampRangeThumb, clearedSelection, closeDialog, createNumberFormat, currencyFractionDigits, currencySymbol, currentDialog, defaultCharacterMeaning, enUS as defaultMessages, enUS, defaultUnitFormat, dropOmittedFacets, facetCanShowAll, facetHasHiddenValues, facetIsRenderable, facetIsSearchable, facetRows, facetSelectedCount, facetStartsOpen, facetSummaryLabels, facetValues, filterNumericBeforeInput, foldForSearch, formatCurrency, formatDate, formatNumber, formatUnit, fractionDigits, frameAspectRatio, hasSelection, histogramBarInRange, initialsFromName, isOpenDialog, isRangeAtLimits, isRangeSelection, isValueDisabled, isValueSelected, joinIds, localeSeparators, matchesSearch, mixToward, nearestRangeThumb, normalizeRangeValue, normalizeText, openDialog, parseLocaleNumber, prefersReducedMotion, preloadTablerIcons, provideEldraScope, provideEldraUiCurrency, provideEldraUiLocale, provideEldraUiMessages, rangeKeyTransition, rangeLimits, rangeOf, rangePositionToValue, rangeStepDigits, rangeThumbLimits, rangeValueToPercent, ratingStarStates, removeValue, renderableFacets, resolveCarouselPerView, roundRatingToHalf, selectedValues, setRange, sizeSystemGroups, snapToRangeStep, stripMask, swatchInk, swatchLuminance, tablerIconName, toMinorUnits, toggleValue, topLayerDialog, useCarousel, useControllableModel, useDialog, useEldraUiCurrency, useEldraUiLocale, useFloating, useHeadingTag, useListbox, useMessages, useOverlay, usePopover, useSiteForm, useSlotPresence, useToast, useUiId, visibleFacetValues, zoomSizes };
17145
+ export { ACCORDION_KEY, Accordion_default as Accordion, AccordionItem_default as AccordionItem, Autocomplete_default as Autocomplete, Avatar_default as Avatar, AvatarGroup_default as AvatarGroup, Badge_default as Badge, Breadcrumb_default as Breadcrumb, Button_default as Button, ButtonGroup_default as ButtonGroup, CHIP_GROUP_KEY, CURRENCY_KEY, Carousel_default as Carousel, Checkbox_default as Checkbox, CheckboxGroup_default as CheckboxGroup, Chip_default as Chip, ChipGroup_default as ChipGroup, Container_default as Container, ContentCard_default as ContentCard, CurrencyInput_default as CurrencyInput, CurrencyPicker_default as CurrencyPicker, DEFAULT_UI_LOCALE, Dialog_default as Dialog, Drawer_default as Drawer, ELDRA_SCOPE_KEY, EditorPlaceholder_default as EditorPlaceholder, EmptyState_default as EmptyState, FIELD_KEY, FILTER_SEARCH_FROM, FILTER_VALUES_SHOWN, FORM_LAYOUT_KEY, FORM_SUBMITTING_KEY, FeatureCard_default as FeatureCard, FieldWrapper_default as FieldWrapper, FilterPanel_default as FilterPanel, FormLayout_default as FormLayout, Icon_default as Icon, Image_default as Image, Input_default as Input, LOCALE_KEY, Lightbox_default as Lightbox, Link_default as Link, LoadMore_default as LoadMore, LogoItem_default as LogoItem, MESSAGES_KEY, MultiSelect_default as MultiSelect, NavMenu_default as NavMenu, Notice_default as Notice, Pagination_default as Pagination, Popover_default as Popover, Price_default as Price, ProductCard_default as ProductCard, QuantityStepper_default as QuantityStepper, Radio_default as Radio, RadioGroup_default as RadioGroup, RangeSlider_default as RangeSlider, Rating_default as Rating, SECTION_KEY, SWATCH_INK_LUMINANCE_THRESHOLD, SearchBar_default as SearchBar, SearchModal_default as SearchModal, Section_default as Section, Select_default as Select, SiteForm_default as SiteForm, Skeleton_default as Skeleton, Spinner_default as Spinner, StepIndicator_default as StepIndicator, StockBadge_default as StockBadge, Switch_default as Switch, TABS_KEY, TOAST_HOST_KEY, Tab_default as Tab, TabPanel_default as TabPanel, TablerIcon_default as TablerIcon, Tabs_default as Tabs, Textarea_default as Textarea, Toast_default as Toast, Toaster_default as Toaster, Tooltip_default as Tooltip, UnitInput_default as UnitInput, VariantPicker_default as VariantPicker, VisuallyHidden_default as VisuallyHidden, appliedFilters, applyMask, carouselPerViewStyle, clampRangeThumb, clearedSelection, closeDialog, createAmountEditor, createNumberFormat, currencyFractionDigits, currencySymbol, currentDialog, defaultCharacterMeaning, enUS as defaultMessages, enUS, defaultUnitFormat, dropOmittedFacets, facetCanShowAll, facetHasHiddenValues, facetIsRenderable, facetIsSearchable, facetRows, facetSelectedCount, facetStartsOpen, facetSummaryLabels, facetValues, filterNumericBeforeInput, foldForSearch, formatCurrency, formatDate, formatNumber, formatUnit, fractionDigits, frameAspectRatio, hasSelection, histogramBarInRange, initialsFromName, isOpenDialog, isRangeAtLimits, isRangeSelection, isValueDisabled, isValueSelected, joinIds, localeSeparators, matchesSearch, mixToward, nearestRangeThumb, normalizeRangeValue, normalizeText, openDialog, parseAmount, parseLocaleNumber, prefersReducedMotion, preloadTablerIcons, provideEldraScope, provideEldraUiCurrency, provideEldraUiLocale, provideEldraUiMessages, rangeKeyTransition, rangeLimits, rangeOf, rangePositionToValue, rangeStepDigits, rangeThumbLimits, rangeValueToPercent, ratingStarStates, readAmount, removeValue, renderableFacets, resolveCarouselPerView, roundRatingToHalf, selectedValues, setRange, sizeSystemGroups, snapToRangeStep, stripMask, swatchInk, swatchLuminance, tablerIconName, toMinorUnits, toggleValue, topLayerDialog, useCarousel, useControllableModel, useDialog, useEldraUiCurrency, useEldraUiLocale, useFloating, useHeadingTag, useListbox, useMessages, useOverlay, usePopover, useSiteForm, useSlotPresence, useToast, useUiId, visibleFacetValues, zoomSizes };
@@ -551,6 +551,10 @@ export declare const enUS: {
551
551
  phoneInvalid: (country: string) => string;
552
552
  /** `phoneRule`: the same, when no country is known for the number. */
553
553
  phoneInvalidNumber: string;
554
+ /** `FieldUnitInput` and `FieldCurrencyInput`: the text in the field cannot be read as a number. */
555
+ amountNotANumber: string;
556
+ /** The same, for a fraction in a field that takes whole numbers (a currency without decimals). */
557
+ amountNoDecimals: string;
554
558
  };
555
559
  /**
556
560
  * Every message a component can emit. A consumer overrides any subset of it,
@@ -206,6 +206,8 @@ var isIS = {
206
206
  phoneAllCountries: "Öll lönd",
207
207
  phoneNoMatch: (query) => `Ekkert land passar við „${query}“.`,
208
208
  phoneInvalid: (country) => `Símanúmerið er ekki gilt í landinu sem er valið: ${country}.`,
209
- phoneInvalidNumber: "Sláðu inn gilt símanúmer."
209
+ phoneInvalidNumber: "Sláðu inn gilt símanúmer.",
210
+ amountNotANumber: "Sláðu inn tölu.",
211
+ amountNoDecimals: "Sláðu inn heila tölu."
210
212
  };
211
213
  export { isIS as default, isIS };
@@ -210,6 +210,8 @@ declare const __VLS_base: import('vue').DefineComponent<PhoneInputProps, {
210
210
  phoneNoMatch: (query: string) => string;
211
211
  phoneInvalid: (country: string) => string;
212
212
  phoneInvalidNumber: string;
213
+ amountNotANumber: string;
214
+ amountNoDecimals: string;
213
215
  }>;
214
216
  locale: string;
215
217
  defaultCountry: string;
@@ -1,7 +1,7 @@
1
1
  import { d as useEldraUiLocale } from "../useOptionList-UMUMayec.js";
2
- import { r as useMessages } from "../useMessages-BdN9F1cW.js";
3
- import { a as useControlProps, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS } from "../useFieldControl-B1JvPEeM.js";
4
- import { r as phoneRule, t as PhoneInput_default } from "../PhoneInput-CHTpjbtS.js";
2
+ import { r as useMessages } from "../useMessages-D8bTGX7c.js";
3
+ import { a as useControlProps, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS } from "../useFieldControl-BnO3B37W.js";
4
+ import { r as phoneRule, t as PhoneInput_default } from "../PhoneInput-f6wxvduD.js";
5
5
  import { computed, createBlock, createSlots, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, normalizeProps, openBlock, reactive, ref, renderList, renderSlot, toRefs, unref, withCtx } from "vue";
6
6
  // src/phone/vee-validate/FieldPhoneInput.vue
7
7
  var FieldPhoneInput_default = /* @__PURE__ */ defineComponent({
package/dist/phone.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as parsePhone, c as phoneExample, i as isValidPhone, n as phoneCountryName, o as phoneCallingCode, r as phoneRule, s as phoneCountries, t as PhoneInput_default } from "./PhoneInput-CHTpjbtS.js";
1
+ import { a as parsePhone, c as phoneExample, i as isValidPhone, n as phoneCountryName, o as phoneCallingCode, r as phoneRule, s as phoneCountries, t as PhoneInput_default } from "./PhoneInput-f6wxvduD.js";
2
2
  import { n as preloadCountryFlags } from "./CountryFlag-DOa8lOHp.js";
3
3
  export { PhoneInput_default as PhoneInput, isValidPhone, parsePhone, phoneCallingCode, phoneCountries, phoneCountryName, phoneExample, phoneRule, preloadCountryFlags as preloadPhoneFlags };
@@ -1,6 +1,6 @@
1
1
  import { $ as FIELD_KEY, rt as useUiId } from "./useOptionList-UMUMayec.js";
2
2
  import { computed, inject, onMounted, onScopeDispose, shallowRef, watch } from "vue";
3
- import { FormContextKey, useField } from "vee-validate";
3
+ import { FormContextKey, useField, validate } from "vee-validate";
4
4
  // src/vee-validate/context.ts
5
5
  /**
6
6
  * The server's field errors, keyed by the path a `Field*` validates under (its `path`, or its
@@ -117,13 +117,24 @@ function useFieldControl(props, options) {
117
117
  * would otherwise be both the legend and the key in `values`, and one of the two would be wrong.
118
118
  */
119
119
  const path = computed(() => props.path ?? props.name);
120
- const rules = computed(() => props.rules);
120
+ const unreadable = options.unreadable;
121
+ const rules = computed(() => {
122
+ const own = props.rules;
123
+ if (unreadable === void 0) return own;
124
+ return async (value) => {
125
+ const message = unreadable();
126
+ if (message !== void 0) return message;
127
+ if (own === void 0) return true;
128
+ const result = await validate(value, own, { name: props.label ?? path.value });
129
+ return result.valid || (result.errors[0] ?? false);
130
+ };
131
+ });
121
132
  /**
122
133
  * `validateOnValueUpdate` is vee-validate's own option and is read once, here. `validateOnMount`
123
134
  * is not handed over: the mount-time validation is run below instead, so its result can be shown
124
135
  * when it settles (vee-validate's own run reports to nobody).
125
136
  */
126
- const { value, errorMessage, handleBlur, meta, validate } = useField(path, rules, {
137
+ const { value, errorMessage, handleBlur, meta, validate: validate$1 } = useField(path, rules, {
127
138
  label: () => props.label,
128
139
  initialValue: options.initialValue,
129
140
  validateOnValueUpdate: props.validateOnValueUpdate === true
@@ -188,10 +199,10 @@ function useFieldControl(props, options) {
188
199
  */
189
200
  if (messages !== null) watch(messages.settled, reveal);
190
201
  else if (form !== null) watch(() => form.submitCount.value, (count) => {
191
- if (count > 0) validate().then(reveal);
202
+ if (count > 0) validate$1().then(reveal);
192
203
  });
193
204
  onMounted(() => {
194
- if (props.validateOnMount) validate().then(reveal);
205
+ if (props.validateOnMount) validate$1().then(reveal);
195
206
  });
196
207
  const error = computed(() => shown.value);
197
208
  const invalid = computed(() => error.value !== void 0);
@@ -240,7 +251,7 @@ function useFieldControl(props, options) {
240
251
  */
241
252
  function onBlur(event) {
242
253
  handleBlur(event, false);
243
- if (props.validateOnBlur !== false) validate().then(reveal);
254
+ if (props.validateOnBlur !== false) validate$1().then(reveal);
244
255
  }
245
256
  return {
246
257
  model,
@@ -579,7 +579,11 @@ var enUS = {
579
579
  /** `phoneRule`: the number is not one the chosen country has. `country` is its localised name. */
580
580
  phoneInvalid: (country) => `Enter a valid phone number for ${country}.`,
581
581
  /** `phoneRule`: the same, when no country is known for the number. */
582
- phoneInvalidNumber: "Enter a valid phone number."
582
+ phoneInvalidNumber: "Enter a valid phone number.",
583
+ /** `FieldUnitInput` and `FieldCurrencyInput`: the text in the field cannot be read as a number. */
584
+ amountNotANumber: "Enter a number.",
585
+ /** The same, for a fraction in a field that takes whole numbers (a currency without decimals). */
586
+ amountNoDecimals: "Enter a whole number."
583
587
  };
584
588
  // src/composables/useMessages.ts
585
589
  /**
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The amount a person types into `UnitInput` and `CurrencyInput`: one parser for every way text
3
+ * arrives, and the live formatting that shows it back with its symbol and grouping while it is
4
+ * typed. Framework-free and DOM-free, so every edit is a pure function of the text before it, the
5
+ * text after it and the caret. The rules are in the package README, under `UnitInput`.
6
+ */
7
+ export type AmountInvalidReason = 'notANumber' | 'noDecimals';
8
+ export type AmountReading = {
9
+ kind: 'empty';
10
+ } | {
11
+ kind: 'pending';
12
+ } | {
13
+ kind: 'invalid';
14
+ reason: AmountInvalidReason;
15
+ }
16
+ /** `whole` holds digits only, `fraction` the digits after the decimal mark as typed. */
17
+ | {
18
+ kind: 'number';
19
+ value: number;
20
+ whole: string;
21
+ fraction: string;
22
+ mark: boolean;
23
+ };
24
+ /**
25
+ * Reads a number field's whole text strictly in its locale: `decimal` is the locale's decimal
26
+ * mark, `digits` how many fraction digits the field takes, `symbols` the currency or unit strings
27
+ * its format prints (stripped wherever they are).
28
+ */
29
+ export declare function parseAmount(text: string, symbols: readonly string[], digits: number, decimal: string): AmountReading;
30
+ /**
31
+ * `parseAmount`, and when the locale cannot read the text, the other convention: what a paste,
32
+ * a drop, autofill or dictation brings in whole (`1,000,000` into an Icelandic field is a
33
+ * million, `1.000` into an English money field a thousand). A typed keystroke is read strictly.
34
+ */
35
+ export declare function readAmount(text: string, symbols: readonly string[], digits: number, decimal: string, lenient?: boolean): AmountReading;
36
+ /** The text in the field, and which of its characters are the amount's own (not a symbol, not
37
+ * grouping the format put there). */
38
+ export interface AmountText {
39
+ text: string;
40
+ /** The amount's own characters, digits and the decimal mark (or, while unreadable, as typed). */
41
+ raw: string;
42
+ owned: readonly boolean[];
43
+ reading: AmountReading;
44
+ }
45
+ export interface AmountEditorOptions {
46
+ /** The field's display format: currency or unit style, grouping on, any fraction digits. */
47
+ format: (minimumFractionDigits: number) => Intl.NumberFormat;
48
+ /** The locale's decimal mark. */
49
+ decimal: string;
50
+ /** How many fraction digits the field takes (0 for ISK). */
51
+ digits: number;
52
+ /** The largest value the field takes; a text past it is refused. */
53
+ max: number;
54
+ }
55
+ export type AmountEdit = {
56
+ refused: false;
57
+ next: AmountText;
58
+ caret: number;
59
+ } | {
60
+ refused: true;
61
+ caret: number;
62
+ };
63
+ export declare function createAmountEditor(options: AmountEditorOptions): {
64
+ symbols: string[];
65
+ render: (raw: string, reading: AmountReading, verbatim?: boolean) => AmountText;
66
+ read: (raw: string, lenient?: boolean) => AmountText;
67
+ fromValue: (value: number | null, minimumFractionDigits?: number) => AmountText;
68
+ edit: (previous: AmountText, text: string, caret: number, inputType?: string) => AmountEdit;
69
+ textIndex: (state: AmountText, index: number) => number;
70
+ };
71
+ export type AmountEditor = ReturnType<typeof createAmountEditor>;
@@ -53,6 +53,12 @@ export interface UseFieldControlOptions<TValue> {
53
53
  initialValue?: MaybeRef<TValue>;
54
54
  /** Whether the wrapped component takes an `id` prop. `false` for the three fieldset controls. */
55
55
  hasIdProp?: boolean;
56
+ /**
57
+ * A message for a value the control itself cannot read, checked before the field's `rules`. A
58
+ * `UnitInput` keeps unreadable text on screen while its model holds the last number, so without
59
+ * this a rule would pass that number and the form would submit it.
60
+ */
61
+ unreadable?: () => string | undefined;
56
62
  }
57
63
  export interface UseFieldControlReturn<TValue> {
58
64
  /** The field's value, bound to the control with `v-model`. */