@eldrajs/ui 0.3.8 → 0.3.10

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 (76) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE-country-flag-icons +1 -1
  3. package/README.md +93 -4
  4. package/dist/CountryFlag-DOa8lOHp.js +71 -0
  5. package/dist/{PhoneInput-CYGpERg4.js → PhoneInput-BVH32MEg.js} +8 -62
  6. package/dist/{VariantPicker-D_Gg80So.js → VariantPicker-CKDdeFmV.js} +2962 -2531
  7. package/dist/componentNames.d.ts +1 -1
  8. package/dist/components/autocomplete/Autocomplete.vue.d.ts +216 -0
  9. package/dist/components/autocomplete/types.d.ts +50 -0
  10. package/dist/components/button/Button.vue.d.ts +4 -4
  11. package/dist/components/card/ContentCard.vue.d.ts +1 -1
  12. package/dist/components/carousel/Carousel.vue.d.ts +1 -1
  13. package/dist/components/checkbox/Checkbox.vue.d.ts +3 -3
  14. package/dist/components/chip/Chip.vue.d.ts +3 -1
  15. package/dist/components/container/Container.vue.d.ts +1 -1
  16. package/dist/components/dialog/Dialog.vue.d.ts +2 -0
  17. package/dist/components/drawer/Drawer.vue.d.ts +5 -3
  18. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +1 -1
  19. package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
  20. package/dist/components/filter-panel/FilterPanel.vue.d.ts +6 -4
  21. package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
  22. package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
  23. package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +3 -1
  24. package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
  25. package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
  26. package/dist/components/form-layout/FormLayout.vue.d.ts +2 -2
  27. package/dist/components/image/Image.vue.d.ts +3 -3
  28. package/dist/components/input/Input.vue.d.ts +7 -7
  29. package/dist/components/lightbox/Lightbox.vue.d.ts +3 -1
  30. package/dist/components/nav-menu/NavMenu.vue.d.ts +5 -3
  31. package/dist/components/pagination/Pagination.vue.d.ts +4 -2
  32. package/dist/components/popover/Popover.vue.d.ts +3 -3
  33. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +2 -2
  34. package/dist/components/radio/Radio.vue.d.ts +1 -1
  35. package/dist/components/range-slider/RangeSlider.vue.d.ts +3 -1
  36. package/dist/components/search-bar/SearchBar.vue.d.ts +5 -3
  37. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
  38. package/dist/components/search-modal/SearchModal.vue.d.ts +4 -2
  39. package/dist/components/select/MultiSelect.vue.d.ts +13 -10
  40. package/dist/components/select/Select.vue.d.ts +13 -11
  41. package/dist/components/select/SelectPanel.vue.d.ts +1 -1
  42. package/dist/components/select/types.d.ts +7 -1
  43. package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
  44. package/dist/components/skeleton/Skeleton.vue.d.ts +1 -1
  45. package/dist/components/switch/Switch.vue.d.ts +1 -1
  46. package/dist/components/textarea/Textarea.vue.d.ts +3 -3
  47. package/dist/components/toast/Toast.vue.d.ts +3 -1
  48. package/dist/components/toast/Toaster.vue.d.ts +2 -0
  49. package/dist/components/unit-input/UnitInput.vue.d.ts +6 -6
  50. package/dist/{phone/PhoneFlag.vue.d.ts → flag/CountryFlag.vue.d.ts} +3 -0
  51. package/dist/flag/flags.d.ts +8 -0
  52. package/dist/flag/index.d.ts +9 -0
  53. package/dist/flag.js +1 -0
  54. package/dist/index.d.ts +2 -0
  55. package/dist/index.js +5 -4
  56. package/dist/messages/en-US.d.ts +4 -0
  57. package/dist/messages/is-IS.js +2 -0
  58. package/dist/phone/PhoneInput.vue.d.ts +8 -6
  59. package/dist/phone/index.d.ts +1 -1
  60. package/dist/phone/vee-validate.js +4 -4
  61. package/dist/phone.js +3 -1
  62. package/dist/resolver.d.ts +8 -2
  63. package/dist/resolver.js +14 -2
  64. package/dist/useEldraScope-BDbGzt7R.js +32 -0
  65. package/dist/{useFieldControl-D_b9SC9s.js → useFieldControl-CGH6GEWM.js} +2 -2
  66. package/dist/{useMessages-DQQPh1P_.js → useMessages-CYnyGVRG.js} +4 -0
  67. package/dist/{usePopover-4CQR2hB5.js → useOptionList-CPHHDvPF.js} +1477 -1506
  68. package/dist/vee-validate/FieldAutocomplete.vue.d.ts +20 -0
  69. package/dist/vee-validate/Form.vue.d.ts +2 -2
  70. package/dist/vee-validate/index.d.ts +3 -2
  71. package/dist/vee-validate/types.d.ts +4 -1
  72. package/dist/vee-validate/useFieldControl.d.ts +1 -1
  73. package/dist/vee-validate.js +73 -5
  74. package/dist/vue-i18n.js +1 -1
  75. package/package.json +6 -2
  76. package/dist/phone/flags.d.ts +0 -8
@@ -0,0 +1,20 @@
1
+ import { FieldAutocompleteProps } from './types.js';
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ [x: string]: ((props: any) => any) | undefined;
5
+ };
6
+ };
7
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
+ declare const __VLS_base: import('vue').DefineComponent<FieldAutocompleteProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FieldAutocompleteProps> & Readonly<{}>, {
9
+ validateOnMount: boolean;
10
+ validateOnBlur: boolean;
11
+ validateOnValueUpdate: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -11,11 +11,11 @@ type __VLS_Slots = {
11
11
  declare const __VLS_base: import('vue').DefineComponent<FormProps, {
12
12
  form: import('vee-validate').FormContext<FormValues, FormValues>;
13
13
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
- submit: (values: FormValues, ctx: SubmissionContext<FormValues>) => any;
15
14
  invalid: (errors: Record<string, string | undefined>) => any;
15
+ submit: (values: FormValues, ctx: SubmissionContext<FormValues>) => any;
16
16
  }, string, import('vue').PublicProps, Readonly<FormProps> & Readonly<{
17
- onSubmit?: ((values: FormValues, ctx: SubmissionContext<FormValues>) => any) | undefined;
18
17
  onInvalid?: ((errors: Record<string, string | undefined>) => any) | undefined;
18
+ onSubmit?: ((values: FormValues, ctx: SubmissionContext<FormValues>) => any) | undefined;
19
19
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
20
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
21
  declare const _default: typeof __VLS_export;
@@ -1,4 +1,5 @@
1
1
  export { default as Form } from './Form.vue.js';
2
+ export { default as FieldAutocomplete } from './FieldAutocomplete.vue.js';
2
3
  export { default as FieldCheckbox } from './FieldCheckbox.vue.js';
3
4
  export { default as FieldCheckboxGroup } from './FieldCheckboxGroup.vue.js';
4
5
  export { default as FieldCurrencyInput } from './FieldCurrencyInput.vue.js';
@@ -13,9 +14,9 @@ export { default as FieldTextarea } from './FieldTextarea.vue.js';
13
14
  export { default as FieldUnitInput } from './FieldUnitInput.vue.js';
14
15
  export { default as FieldVariantPicker } from './FieldVariantPicker.vue.js';
15
16
  export { API_ERRORS_KEY } from './context.js';
16
- export type { FieldBinding, FieldCheckboxGroupProps, FieldCheckboxProps, FieldCurrencyInputProps, FieldInputProps, FieldMultiSelectProps, FieldQuantityStepperProps, FieldRadioGroupProps, FieldSearchBarProps, FieldSelectProps, FieldSwitchProps, FieldTextareaProps, FieldUnitInputProps, FieldVariantPickerProps, FormProps, FormSlotProps, FormValidationSchema, FormValues, } from './types.js';
17
+ export type { FieldAutocompleteProps, FieldBinding, FieldCheckboxGroupProps, FieldCheckboxProps, FieldCurrencyInputProps, FieldInputProps, FieldMultiSelectProps, FieldQuantityStepperProps, FieldRadioGroupProps, FieldSearchBarProps, FieldSelectProps, FieldSwitchProps, FieldTextareaProps, FieldUnitInputProps, FieldVariantPickerProps, FormProps, FormSlotProps, FormValidationSchema, FormValues, } from './types.js';
17
18
  /**
18
- * The building block the thirteen `Field*` components are made of, exported so a consumer wrapping a
19
+ * The building block the fourteen `Field*` components are made of, exported so a consumer wrapping a
19
20
  * control this package does not ship — or one of its own — binds it the same way: the value, the
20
21
  * message shown at the field's own moments (blur, submit, and the two opt-in ones), the `id` the
21
22
  * error summary links to, and the server error that clears when the value changes.
@@ -1,4 +1,5 @@
1
1
  import { FormMeta, FormOptions, RuleExpression } from 'vee-validate';
2
+ import { AutocompleteProps } from '../components/autocomplete/types.js';
2
3
  import { CheckboxGroupProps, CheckboxProps } from '../components/checkbox/types.js';
3
4
  import { FormLayoutProps } from '../components/form-layout/types.js';
4
5
  import { InputProps } from '../components/input/types.js';
@@ -56,7 +57,7 @@ export interface FieldBinding<TValue = unknown> {
56
57
  * field has been touched or the form submitted.
57
58
  *
58
59
  * The default depends on the control. **`false`** for a typed one (`FieldInput`, `FieldTextarea`,
59
- * `FieldCurrencyInput`, `FieldUnitInput`, `FieldSearchBar`): while the customer types, no
60
+ * `FieldCurrencyInput`, `FieldUnitInput`, `FieldSearchBar`, `FieldAutocomplete`): while the customer types, no
60
61
  * message appears and a message already showing stays as it is until the next blur or submit.
61
62
  * **`true`** for a choice (`FieldCheckbox`, `FieldCheckboxGroup`, `FieldRadioGroup`,
62
63
  * `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`,
@@ -73,6 +74,8 @@ export interface FieldBinding<TValue = unknown> {
73
74
  * silently does nothing.
74
75
  */
75
76
  export type FieldInputProps = Omit<InputProps, 'modelValue' | 'invalid'> & FieldBinding<string>;
77
+ /** The field's value is the text in the field, typed or written by a chosen suggestion. */
78
+ export type FieldAutocompleteProps = Omit<AutocompleteProps, 'modelValue' | 'invalid'> & FieldBinding<string>;
76
79
  export type FieldTextareaProps = Omit<TextareaProps, 'modelValue' | 'invalid'> & FieldBinding<string>;
77
80
  /** `number | null`, not a string: a rule compares numbers and the form submits one. */
78
81
  export type FieldUnitInputProps = Omit<UnitInputProps, 'modelValue' | 'invalid'> & FieldBinding<number | null>;
@@ -77,7 +77,7 @@ export interface UseFieldControlReturn<TValue> {
77
77
  * Each `Field*` is a thin SFC over this: `useField(name, rules, { label })` for the value and the
78
78
  * validation, the message the field **shows**, the `id` the form's error summary links to, and the
79
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.
80
+ * the fourteen components agree on all of that rather than fourteen files drifting apart.
81
81
  *
82
82
  * **When a field validates, and when its message changes.** The spec's rule (Form layout →
83
83
  * Behaviour & motion) is "Validate on submit, then on blur for fields that were invalid after the
@@ -1,7 +1,7 @@
1
- import { A as UnitInput_default, C as Switch_default, G as CheckboxGroup_default, K as Checkbox_default, S as focusInvalid, T as Input_default, b as MultiSelect_default, i as SearchBar_default, k as CurrencyInput_default, l as RadioGroup_default, n as Textarea_default, r as Select_default, t as VariantPicker_default, x as FormLayout_default, y as QuantityStepper_default } from "./VariantPicker-D_Gg80So.js";
2
- import { r as useMessages } from "./useMessages-DQQPh1P_.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_b9SC9s.js";
4
- import { $ as useEldraScope } from "./usePopover-4CQR2hB5.js";
1
+ import { B as CheckboxGroup_default, C as Switch_default, E as UnitInput_default, S as focusInvalid, T as CurrencyInput_default, V as Checkbox_default, X as Input_default, Y as Autocomplete_default, b as MultiSelect_default, i as SearchBar_default, l as RadioGroup_default, n as Textarea_default, r as Select_default, t as VariantPicker_default, x as FormLayout_default, y as QuantityStepper_default } from "./VariantPicker-CKDdeFmV.js";
2
+ import { r as useMessages } from "./useMessages-CYnyGVRG.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-CGH6GEWM.js";
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";
7
7
  // src/vee-validate/Form.vue?vue&type=script&setup=true&lang.ts
@@ -265,6 +265,73 @@ var Form_default = /* @__PURE__ */ defineComponent({
265
265
  };
266
266
  }
267
267
  });
268
+ // src/vee-validate/FieldAutocomplete.vue
269
+ var FieldAutocomplete_default = /* @__PURE__ */ defineComponent({
270
+ __name: "FieldAutocomplete",
271
+ props: /*@__PURE__*/ mergeDefaults({
272
+ suggestions: {},
273
+ loading: { type: Boolean },
274
+ minLength: {},
275
+ messages: {},
276
+ classes: {},
277
+ size: {},
278
+ id: {},
279
+ name: {},
280
+ placeholder: {},
281
+ autocomplete: {},
282
+ inputmode: { type: [String, Boolean] },
283
+ leadingIcon: {},
284
+ clearable: { type: Boolean },
285
+ describedBy: {},
286
+ required: { type: Boolean },
287
+ readonly: { type: Boolean },
288
+ disabled: { type: Boolean },
289
+ path: {},
290
+ rules: { type: [
291
+ String,
292
+ Object,
293
+ Function,
294
+ Array
295
+ ] },
296
+ label: {},
297
+ validateOnMount: { type: Boolean },
298
+ validateOnBlur: { type: Boolean },
299
+ validateOnValueUpdate: { type: Boolean }
300
+ }, FIELD_VALIDATION_DEFAULTS),
301
+ setup(__props) {
302
+ /**
303
+ * `Autocomplete` bound to a vee-validate field.
304
+ *
305
+ * Everything an `Autocomplete` takes is forwarded (`suggestions`, `loading`, `minLength`, `size`,
306
+ * `autocomplete`, `classes`, every slot and every attribute, the `select` listener among them);
307
+ * `name` doubles as the field's path and the control's native `name`. The value, `invalid` and the
308
+ * blur that reveals the message are this component's. The field's value is the text, whether it
309
+ * was typed or written by a chosen suggestion.
310
+ */
311
+ const props = __props;
312
+ const { model, invalid, id, onBlur } = useFieldControl(props, { empty: "" });
313
+ const control = useControlProps(props, FIELD_ONLY);
314
+ return (_ctx, _cache) => {
315
+ return openBlock(), createBlock(Autocomplete_default, mergeProps(unref(control), {
316
+ id: unref(id),
317
+ modelValue: unref(model),
318
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
319
+ invalid: unref(invalid),
320
+ onBlur: unref(onBlur)
321
+ }), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, slotName) => {
322
+ return {
323
+ name: slotName,
324
+ fn: withCtx((scope) => [renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope ?? {})))])
325
+ };
326
+ })]), 1040, [
327
+ "id",
328
+ "modelValue",
329
+ "invalid",
330
+ "onBlur"
331
+ ]);
332
+ };
333
+ }
334
+ });
268
335
  // src/vee-validate/FieldCheckbox.vue
269
336
  var FieldCheckbox_default = /* @__PURE__ */ defineComponent({
270
337
  __name: "FieldCheckbox",
@@ -520,6 +587,7 @@ var FieldMultiSelect_default = /* @__PURE__ */ defineComponent({
520
587
  tagPlacement: {},
521
588
  maxTagRows: {},
522
589
  maxSummary: {},
590
+ selectAll: { type: Boolean },
523
591
  classes: {},
524
592
  options: {},
525
593
  name: {},
@@ -1087,4 +1155,4 @@ var FieldVariantPicker_default = /* @__PURE__ */ defineComponent({
1087
1155
  };
1088
1156
  }
1089
1157
  });
1090
- export { API_ERRORS_KEY, FIELD_CHOICE_VALIDATION_DEFAULTS, FIELD_ONLY, FIELD_VALIDATION_DEFAULTS, FIELD_VALIDATION_PROPS, FieldCheckbox_default as FieldCheckbox, FieldCheckboxGroup_default as FieldCheckboxGroup, FieldCurrencyInput_default as FieldCurrencyInput, FieldInput_default as FieldInput, FieldMultiSelect_default as FieldMultiSelect, FieldQuantityStepper_default as FieldQuantityStepper, FieldRadioGroup_default as FieldRadioGroup, FieldSearchBar_default as FieldSearchBar, FieldSelect_default as FieldSelect, FieldSwitch_default as FieldSwitch, FieldTextarea_default as FieldTextarea, FieldUnitInput_default as FieldUnitInput, FieldVariantPicker_default as FieldVariantPicker, Form_default as Form, useFieldControl };
1158
+ export { API_ERRORS_KEY, FIELD_CHOICE_VALIDATION_DEFAULTS, FIELD_ONLY, FIELD_VALIDATION_DEFAULTS, FIELD_VALIDATION_PROPS, FieldAutocomplete_default as FieldAutocomplete, FieldCheckbox_default as FieldCheckbox, FieldCheckboxGroup_default as FieldCheckboxGroup, FieldCurrencyInput_default as FieldCurrencyInput, FieldInput_default as FieldInput, FieldMultiSelect_default as FieldMultiSelect, FieldQuantityStepper_default as FieldQuantityStepper, FieldRadioGroup_default as FieldRadioGroup, FieldSearchBar_default as FieldSearchBar, FieldSelect_default as FieldSelect, FieldSwitch_default as FieldSwitch, FieldTextarea_default as FieldTextarea, FieldUnitInput_default as FieldUnitInput, FieldVariantPicker_default as FieldVariantPicker, Form_default as Form, useFieldControl };
package/dist/vue-i18n.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as enUS, n as provideEldraUiMessages } from "./useMessages-DQQPh1P_.js";
1
+ import { i as enUS, n as provideEldraUiMessages } from "./useMessages-CYnyGVRG.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.8",
3
+ "version": "0.3.10",
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",
@@ -46,6 +46,10 @@
46
46
  "types": "./dist/vue-i18n/index.d.ts",
47
47
  "import": "./dist/vue-i18n.js"
48
48
  },
49
+ "./flag": {
50
+ "types": "./dist/flag/index.d.ts",
51
+ "import": "./dist/flag.js"
52
+ },
49
53
  "./phone": {
50
54
  "types": "./dist/phone/index.d.ts",
51
55
  "import": "./dist/phone.js"
@@ -73,7 +77,7 @@
73
77
  "dependencies": {
74
78
  "@floating-ui/vue": "^1.1.5",
75
79
  "tailwind-merge": "^3.0.0",
76
- "@eldrajs/sdk": "^0.4.3"
80
+ "@eldrajs/sdk": "^0.5.0"
77
81
  },
78
82
  "devDependencies": {
79
83
  "@playwright/test": "1.62.1",
@@ -1,8 +0,0 @@
1
- /** Loads the flags. Safe to call more than once, and ahead of a `PhoneInput` to draw them sooner. */
2
- export declare function preloadPhoneFlags(): Promise<void>;
3
- export interface PhoneFlagArt {
4
- viewBox: string;
5
- body: string;
6
- }
7
- /** A country's flag once the chunk is in; reactive, so a flag drawn before then fills in. */
8
- export declare function phoneFlag(country: string): PhoneFlagArt | undefined;