@eldrajs/ui 0.3.20 → 0.3.22

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 (55) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +71 -31
  3. package/dist/{PhoneInput-CHTpjbtS.js → PhoneInput-D_z9MuDw.js} +2 -2
  4. package/dist/{VariantPicker-BLuaCwee.js → VariantPicker-DgDBOM-w.js} +527 -314
  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/currency-picker/CurrencyPicker.vue.d.ts +27 -1
  9. package/dist/components/currency-picker/types.d.ts +2 -1
  10. package/dist/components/dialog/Dialog.vue.d.ts +2 -0
  11. package/dist/components/drawer/Drawer.vue.d.ts +2 -0
  12. package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
  13. package/dist/components/filter-panel/FilterPanel.vue.d.ts +2 -0
  14. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
  15. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
  16. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -0
  17. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
  18. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
  19. package/dist/components/lightbox/Lightbox.vue.d.ts +2 -0
  20. package/dist/components/load-more/LoadMore.vue.d.ts +1 -1
  21. package/dist/components/nav-menu/NavMenu.vue.d.ts +5 -2
  22. package/dist/components/nav-menu/NavMenuDrawerList.vue.d.ts +39 -0
  23. package/dist/components/nav-menu/navLinks.d.ts +9 -0
  24. package/dist/components/nav-menu/types.d.ts +22 -2
  25. package/dist/components/pagination/Pagination.vue.d.ts +2 -0
  26. package/dist/components/product-card/ProductCard.vue.d.ts +6 -0
  27. package/dist/components/product-card/types.d.ts +25 -2
  28. package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -0
  29. package/dist/components/search-bar/SearchBar.vue.d.ts +2 -0
  30. package/dist/components/search-modal/SearchModal.vue.d.ts +2 -0
  31. package/dist/components/select/MultiSelect.vue.d.ts +2 -0
  32. package/dist/components/select/Select.vue.d.ts +2 -0
  33. package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
  34. package/dist/components/toast/Toast.vue.d.ts +2 -0
  35. package/dist/components/toast/Toaster.vue.d.ts +2 -0
  36. package/dist/components/unit-input/UnitInput.vue.d.ts +8 -0
  37. package/dist/components/unit-input/types.d.ts +13 -1
  38. package/dist/components.css +45 -0
  39. package/dist/index.d.ts +2 -1
  40. package/dist/index.js +699 -331
  41. package/dist/messages/en-US.d.ts +4 -0
  42. package/dist/messages/is-IS.js +3 -1
  43. package/dist/phone/PhoneInput.vue.d.ts +2 -0
  44. package/dist/phone/vee-validate.js +4 -4
  45. package/dist/phone.js +1 -1
  46. package/dist/style.css +45 -0
  47. package/dist/{useFieldControl-B1JvPEeM.js → useFieldControl-D_h1RWyU.js} +18 -7
  48. package/dist/{useMessages-BdN9F1cW.js → useMessages-D8bTGX7c.js} +5 -1
  49. package/dist/{useOptionList-UMUMayec.js → useOptionList-DuAKag8J.js} +1 -0
  50. package/dist/utilities.css +23 -0
  51. package/dist/utils/amount.d.ts +71 -0
  52. package/dist/vee-validate/useFieldControl.d.ts +6 -0
  53. package/dist/vee-validate.js +35 -5
  54. package/dist/vue-i18n.js +1 -1
  55. package/package.json +2 -2
@@ -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
- 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";
1
+ import { d as useEldraUiLocale } from "../useOptionList-DuAKag8J.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-D_h1RWyU.js";
4
+ import { r as phoneRule, t as PhoneInput_default } from "../PhoneInput-D_z9MuDw.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-D_z9MuDw.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 };
package/dist/style.css CHANGED
@@ -972,6 +972,10 @@
972
972
  field-sizing: content;
973
973
  }
974
974
 
975
+ .eldra\:aspect-\(--eldra-nav-menu-card-aspect\) {
976
+ aspect-ratio: var(--eldra-nav-menu-card-aspect);
977
+ }
978
+
975
979
  .eldra\:aspect-square {
976
980
  aspect-ratio: 1;
977
981
  }
@@ -1175,6 +1179,10 @@
1175
1179
  height: 1em;
1176
1180
  }
1177
1181
 
1182
+ .eldra\:h-\[calc\(100dvh-var\(--eldra-nav-menu-drawer-top\,0px\)\)\] {
1183
+ height: calc(100dvh - var(--eldra-nav-menu-drawer-top, 0px));
1184
+ }
1185
+
1178
1186
  .eldra\:h-auto {
1179
1187
  height: auto;
1180
1188
  }
@@ -1550,6 +1558,11 @@
1550
1558
  translate: var(--tw-translate-x) var(--tw-translate-y);
1551
1559
  }
1552
1560
 
1561
+ .eldra\:-translate-y-1 {
1562
+ --tw-translate-y: calc(var(--eldra-space-1) * -1);
1563
+ translate: var(--tw-translate-x) var(--tw-translate-y);
1564
+ }
1565
+
1553
1566
  .eldra\:-translate-y-1\/2 {
1554
1567
  --tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
1555
1568
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -1673,6 +1686,10 @@
1673
1686
  animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
1674
1687
  }
1675
1688
 
1689
+ .eldra\:animate-eldra-menu-in {
1690
+ animation: eldra-menu-in var(--eldra-duration-base) var(--eldra-ease-out);
1691
+ }
1692
+
1676
1693
  .eldra\:animate-eldra-spin {
1677
1694
  animation: .7s linear infinite eldra-spin;
1678
1695
  }
@@ -3846,6 +3863,12 @@
3846
3863
  filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
3847
3864
  }
3848
3865
 
3866
+ .eldra\:transition-\[opacity\,translate\,clip-path\] {
3867
+ transition-property: opacity, translate, clip-path;
3868
+ transition-timing-function: var(--tw-ease, var(--eldra-default-transition-timing-function));
3869
+ transition-duration: var(--tw-duration, var(--eldra-default-transition-duration));
3870
+ }
3871
+
3849
3872
  .eldra\:transition-\[rotate\] {
3850
3873
  transition-property: rotate;
3851
3874
  transition-timing-function: var(--tw-ease, var(--eldra-default-transition-timing-function));
@@ -3989,6 +4012,14 @@
3989
4012
  --eldra-radio-card-selected-color: var(--eldra-color-danger);
3990
4013
  }
3991
4014
 
4015
+ .eldra\:\[clip-path\:inset\(0\)\] {
4016
+ clip-path: inset(0);
4017
+ }
4018
+
4019
+ .eldra\:\[clip-path\:inset\(0_0_65\%_0\)\] {
4020
+ clip-path: inset(0 0 65%);
4021
+ }
4022
+
3992
4023
  .eldra\:eldra-rating-half {
3993
4024
  clip-path: inset(0 50% 0 0);
3994
4025
  }
@@ -5225,6 +5256,20 @@
5225
5256
  }
5226
5257
  }
5227
5258
 
5259
+ @keyframes eldra-menu-in {
5260
+ from {
5261
+ opacity: 0;
5262
+ clip-path: inset(0 -3rem 65%);
5263
+ transform: translateY(-.25rem);
5264
+ }
5265
+
5266
+ to {
5267
+ opacity: 1;
5268
+ clip-path: inset(0 -3rem -3rem);
5269
+ transform: none;
5270
+ }
5271
+ }
5272
+
5228
5273
  [data-section-bg="none"] + [data-section-bg="none"], [data-section-bg="surface"] + [data-section-bg="surface"], [data-section-bg="surface-strong"] + [data-section-bg="surface-strong"], [data-section-bg="primary"] + [data-section-bg="primary"], [data-section-bg="accent"] + [data-section-bg="accent"] {
5229
5274
  padding-top: 0;
5230
5275
  }
@@ -1,6 +1,6 @@
1
- import { $ as FIELD_KEY, rt as useUiId } from "./useOptionList-UMUMayec.js";
1
+ import { $ as FIELD_KEY, rt as useUiId } from "./useOptionList-DuAKag8J.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
  /**
@@ -269,6 +269,7 @@ var kitMerge = extendTailwindMerge({
269
269
  "animate-eldra-spin",
270
270
  "animate-eldra-pulse",
271
271
  "animate-eldra-popover-in",
272
+ "animate-eldra-menu-in",
272
273
  "animate-eldra-dialog-in",
273
274
  "animate-eldra-dialog-in-reduced",
274
275
  "animate-eldra-drawer-in-right",
@@ -1292,6 +1292,29 @@
1292
1292
  transform-origin: var(--eldra-popover-origin, top left);
1293
1293
  }
1294
1294
 
1295
+ /* A `NavMenu` panel's entrance, a full-width mega sheet and a dropdown alike: its top third shows
1296
+ at once and the rest unrolls downward as it fades in and drops 0.25rem into place, over
1297
+ `duration-base` with `ease-out`. Showing the top at once keeps the panel attached to the bar from
1298
+ the first frame, and the short unroll reads as the panel opening rather than arriving. Tried and
1299
+ dropped (WS-1277): the popover entrance, whose growth from a corner read as the panel sliding in
1300
+ from the left; a full unroll, heavy; a fade with a slight scale, flat. The clip reaches 3rem past
1301
+ the sides and bottom so the shadow is never cut off. Reduced motion is the duration token's. */
1302
+ @keyframes eldra-menu-in {
1303
+ from {
1304
+ opacity: 0;
1305
+ transform: translateY(-0.25rem);
1306
+ clip-path: inset(0 -3rem 65% -3rem);
1307
+ }
1308
+ to {
1309
+ opacity: 1;
1310
+ transform: none;
1311
+ clip-path: inset(0 -3rem -3rem -3rem);
1312
+ }
1313
+ }
1314
+ @utility animate-eldra-menu-in {
1315
+ animation: eldra-menu-in var(--eldra-duration-base) var(--eldra-ease-out);
1316
+ }
1317
+
1295
1318
  /* --- Tooltip ---------------------------------------------------------------------------------- */
1296
1319
 
1297
1320
  /* Spec "Tooltip" -> Sizes: "0.8125rem / 1.4, weight 500, one line (no wrap)". The size and line
@@ -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`. */
@@ -1,6 +1,6 @@
1
- import { E as UnitInput_default, H as Checkbox_default, S as Switch_default, T as CurrencyInput_default, V as CheckboxGroup_default, X as Autocomplete_default, Z as Input_default, b as FormLayout_default, c as RadioGroup_default, n as Textarea_default, r as SearchBar_default, t as VariantPicker_default, v as QuantityStepper_default, w as Select_default, x as focusInvalid, y as MultiSelect_default } from "./VariantPicker-BLuaCwee.js";
2
- import { r as useMessages } from "./useMessages-BdN9F1cW.js";
3
- import { a as useControlProps, c as FIELD_ANCHORS_KEY, i as FIELD_VALIDATION_PROPS, l as FIELD_MESSAGES_KEY, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS, s as API_ERRORS_KEY, t as FIELD_CHOICE_VALIDATION_DEFAULTS } from "./useFieldControl-B1JvPEeM.js";
1
+ import { $ as Autocomplete_default, E as UnitInput_default, G as Checkbox_default, S as Switch_default, T as CurrencyInput_default, W as CheckboxGroup_default, b as FormLayout_default, c as RadioGroup_default, et as Input_default, n as Textarea_default, r as SearchBar_default, t as VariantPicker_default, v as QuantityStepper_default, w as Select_default, x as focusInvalid, y as MultiSelect_default } from "./VariantPicker-DgDBOM-w.js";
2
+ import { r as useMessages } from "./useMessages-D8bTGX7c.js";
3
+ import { a as useControlProps, c as FIELD_ANCHORS_KEY, i as FIELD_VALIDATION_PROPS, l as FIELD_MESSAGES_KEY, n as FIELD_ONLY, o as useFieldControl, r as FIELD_VALIDATION_DEFAULTS, s as API_ERRORS_KEY, t as FIELD_CHOICE_VALIDATION_DEFAULTS } from "./useFieldControl-D_h1RWyU.js";
4
4
  import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
5
5
  import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, isRef, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, openBlock, provide, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
6
6
  import { useForm } from "vee-validate";
@@ -463,6 +463,9 @@ var FieldCurrencyInput_default = /* @__PURE__ */ defineComponent({
463
463
  clearable: { type: Boolean },
464
464
  currency: {},
465
465
  narrowSymbol: { type: Boolean },
466
+ fixedFraction: { type: Boolean },
467
+ nullable: { type: Boolean },
468
+ placeholder: {},
466
469
  size: {},
467
470
  id: {},
468
471
  name: {},
@@ -489,14 +492,26 @@ var FieldCurrencyInput_default = /* @__PURE__ */ defineComponent({
489
492
  * `number | null` value. See `FieldUnitInput` for what is forwarded and why the value is a number.
490
493
  */
491
494
  const props = __props;
492
- const { model, invalid, id, onBlur } = useFieldControl(props, { empty: null });
495
+ const control$ = ref(null);
496
+ const readable = ref(true);
497
+ const messages = useMessages();
498
+ const { model, invalid, id, onBlur } = useFieldControl(props, {
499
+ empty: null,
500
+ unreadable: () => {
501
+ if (readable.value) return void 0;
502
+ return control$.value?.invalidReason === "noDecimals" ? messages.value.amountNoDecimals : messages.value.amountNotANumber;
503
+ }
504
+ });
493
505
  const control = useControlProps(props, FIELD_ONLY);
494
506
  return (_ctx, _cache) => {
495
507
  return openBlock(), createBlock(CurrencyInput_default, mergeProps(unref(control), {
496
508
  id: unref(id),
509
+ ref_key: "control$",
510
+ ref: control$,
497
511
  modelValue: unref(model),
498
512
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
499
513
  invalid: unref(invalid),
514
+ "onUpdate:valid": _cache[1] || (_cache[1] = ($event) => readable.value = $event),
500
515
  onBlur: unref(onBlur)
501
516
  }), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, slotName) => {
502
517
  return {
@@ -1036,6 +1051,9 @@ var FieldUnitInput_default = /* @__PURE__ */ defineComponent({
1036
1051
  isCurrency: { type: Boolean },
1037
1052
  currency: {},
1038
1053
  narrowSymbol: { type: Boolean },
1054
+ fixedFraction: { type: Boolean },
1055
+ nullable: { type: Boolean },
1056
+ placeholder: {},
1039
1057
  size: {},
1040
1058
  id: {},
1041
1059
  name: {},
@@ -1069,14 +1087,26 @@ var FieldUnitInput_default = /* @__PURE__ */ defineComponent({
1069
1087
  * compares numerically) and a form submits one.
1070
1088
  */
1071
1089
  const props = __props;
1072
- const { model, invalid, id, onBlur } = useFieldControl(props, { empty: null });
1090
+ const control$ = ref(null);
1091
+ const readable = ref(true);
1092
+ const messages = useMessages();
1093
+ const { model, invalid, id, onBlur } = useFieldControl(props, {
1094
+ empty: null,
1095
+ unreadable: () => {
1096
+ if (readable.value) return void 0;
1097
+ return control$.value?.invalidReason === "noDecimals" ? messages.value.amountNoDecimals : messages.value.amountNotANumber;
1098
+ }
1099
+ });
1073
1100
  const control = useControlProps(props, FIELD_ONLY);
1074
1101
  return (_ctx, _cache) => {
1075
1102
  return openBlock(), createBlock(UnitInput_default, mergeProps(unref(control), {
1076
1103
  id: unref(id),
1104
+ ref_key: "control$",
1105
+ ref: control$,
1077
1106
  modelValue: unref(model),
1078
1107
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
1079
1108
  invalid: unref(invalid),
1109
+ "onUpdate:valid": _cache[1] || (_cache[1] = ($event) => readable.value = $event),
1080
1110
  onBlur: unref(onBlur)
1081
1111
  }), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, slotName) => {
1082
1112
  return {
package/dist/vue-i18n.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as enUS, n as provideEldraUiMessages } from "./useMessages-BdN9F1cW.js";
1
+ import { i as enUS, n as provideEldraUiMessages } from "./useMessages-D8bTGX7c.js";
2
2
  import { t as formatConjunctionList } from "./listFormat-D9ecpDMT.js";
3
3
  import { numberFormat } from "@eldrajs/sdk/format";
4
4
  import { useI18n } from "vue-i18n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/ui",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "Accessible Vue 3 core components for Eldra storefronts: buttons, forms, selects, cards, overlays and navigation, themed through CSS design tokens.",
5
5
  "keywords": [
6
6
  "accessible",
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@floating-ui/vue": "^1.1.5",
79
79
  "tailwind-merge": "^3.0.0",
80
- "@eldrajs/sdk": "^0.5.4"
80
+ "@eldrajs/sdk": "^0.5.5"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@playwright/test": "1.62.1",