@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
package/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ Release-please writes the generated notes from commit messages and does not repl
7
7
 
8
8
  ### Added
9
9
 
10
+ - **`@eldrajs/ui/phone`** — `PhoneInput`, a phone number field with its country inside it: a country button (flag, dialling code) that opens a searchable country list under the field (`preferredCountries` first, then A to Z; found by name, dialling code or ISO code), and a number spaced the way the country writes it as it is typed, with the caret kept in place. `modelValue` is the number in E.164; `v-model:country`, `defaultCountry`, `countries`, `locale`, `size`, `name` (posts the E.164 value), `placeholder` (an example number by default), a `flag` slot and a `change` event (`{ e164, country, callingCode, nationalNumber, valid }`). Typing or pasting a number that starts with `+` picks the country. Also exported: `isValidPhone`, `parsePhone`, `phoneRule`, `phoneCountries`, `phoneCallingCode`, `phoneCountryName`, `phoneExample`, `preloadPhoneFlags`. `libphonenumber-js ^1.13` is a new optional peer, imported by this entry only; the flags (country-flag-icons, MIT) are one lazy chunk. `<EldraPhoneInput>` through the resolver, from `@eldrajs/ui/phone` (`phoneComponentNames`).
11
+ - **`@eldrajs/ui/phone/vee-validate`** — `FieldPhoneInput`, `PhoneInput` bound to a vee-validate field with the typed-control validation defaults; with no `rules` it checks the number against the country the field is on. `phoneRule({ country, locale, messages })` returns `true` or a message naming the country.
12
+ - **Messages** `phoneCountry`, `phoneCountryList`, `phoneSearch`, `phoneSuggested`, `phoneAllCountries`, `phoneNoMatch`, `phoneInvalid` and `phoneInvalidNumber`, in English and Icelandic and through `@eldrajs/ui/vue-i18n`.
13
+ - **`eldra-focus-has-open`** in `utilities.css`: turns an element's `eldra-focus` ring on while a descendant has `aria-expanded="true"`, for a box whose popup opens from a button inside it.
14
+ - **`validateOnMount`, `validateOnBlur` and `validateOnValueUpdate` on every `Field*`**, deciding per field when it validates: on mount (default `false`; the message is shown at once), on blur (default `true`), and on every value change once touched or submitted (default `false` for a typed control, `true` for a choice control). A submit always validates every field. They hold with `rules` on the field and with a `validationSchema` on the `Form` alike. `FIELD_VALIDATION_DEFAULTS`, `FIELD_CHOICE_VALIDATION_DEFAULTS` and `FIELD_VALIDATION_PROPS` are exported from `@eldrajs/ui/vee-validate`, and `FIELD_ONLY` now includes the three names.
15
+ - **`Notice`** — an inline message that stays in the page flow: `tone` (`info`, `success`, `warning`, `danger`; `data-tone` on the root), `title`, `text` / default slot, a default icon per tone (`icon` replaces it, `null` removes it), `headingLevel`, an `actions` slot and `classes`. `role="status"` for `info`, `success` and `warning`, `role="alert"` for `danger`; `announce: false` drops the role. New types `NoticeProps`, `NoticePart`, `NoticeTone`; `<EldraNotice>` through the resolver.
16
+ - **`StepIndicator`** — a non-interactive ordered list of steps: `steps` (`{ label, description? }`), `current` (index from 0), `orientation` (`horizontal`, `vertical`) and `classes`. `aria-current="step"` on the current step, "(completed)" / "(not started)" in visually hidden text on the others. New messages `stepCompleted`, `stepNotStarted`; new types `StepIndicatorProps`, `StepIndicatorStep`, `StepIndicatorOrientation`, `StepIndicatorState`, `StepIndicatorPart`; `<EldraStepIndicator>` through the resolver.
17
+ - **`RadioGroup` cards take a leading icon or logo**: `icon` on an option (a decorative 1.25rem icon between the radio and the title) and a `leading` slot (`{ option }`, for a logo or any other content; it wins over `icon`), centred against the title and the hint together. Cards only. New part `leading`. A card with neither renders as before.
18
+ - **`Spinner`** is exported: the circle `Button` and `LoadMore` draw, for a wait outside them. Decorative unless `label` names it (`role="img"`); 1.125rem unless a size class on it says otherwise. New type `SpinnerProps`; `<EldraSpinner>` through the resolver.
10
19
  - **`Skeleton`'s `box` variant and `height` prop**: one plain shimmering shape that is the component itself, sized by `width` / `height` or by classes on it (`<Skeleton variant="box" width="12rem" height="3rem" />`, `<Skeleton variant="box" class="h-24 rounded-full" />`). Unsized, it is full width and `--eldra-skeleton-box-height` tall (default `1rem`).
11
20
  - **`Skeleton` CSS variables**: `--eldra-skeleton-line-height`, `--eldra-skeleton-line-gap` and `--eldra-skeleton-title-height` size the `text` and `title` rows (defaults `0.875rem`, `0.3rem`, `1.5rem`, as before); `--eldra-skeleton-color`, `--eldra-skeleton-highlight` and `--eldra-skeleton-duration` set the fill, the glare and the shimmer's cycle. They apply to `Price`'s loading state too.
12
21
  - **`--eldra-button-border-width`** (default `1px`) sets the border width of every `Button` variant except `link`, at the same height; an attached `ButtonGroup` overlaps its buttons by the same width, so they still share one line.
@@ -74,6 +83,7 @@ Release-please writes the generated notes from commit messages and does not repl
74
83
 
75
84
  ### Changed
76
85
 
86
+ - **`@eldrajs/ui/vee-validate`: typed fields no longer revalidate while typing.** A `Field*` used to validate on every change of its value, so once it had been touched (or the form submitted) its message followed each keystroke. `FieldInput`, `FieldTextarea`, `FieldCurrencyInput`, `FieldUnitInput` and `FieldSearchBar` now validate when they lose focus and when the form is submitted, and never in between: while a value is being typed no message appears, and a message already showing stays until the next blur or submit. The choice controls (`FieldCheckbox`, `FieldCheckboxGroup`, `FieldRadioGroup`, `FieldSwitch`, `FieldSelect`, `FieldMultiSelect`, `FieldVariantPicker`, `FieldQuantityStepper`) keep validating on each change. The `Form`'s error summary and `errors` slot prop now change at the same moments as the fields. Set `validate-on-value-update` on a typed field to get the old live behaviour back.
77
87
  - **`Drawer` opens and closes with a short slide and fade of its panel** instead of sliding the whole viewport-wide root in, and no longer closes instantly. Tune it with `--eldra-drawer-slide` (default `2rem`), `--eldra-drawer-enter-duration` (400ms) and `--eldra-drawer-exit-duration` (260ms); reduced motion fades only. The `animate-eldra-drawer-in-*` classes are no longer on the root.
78
88
  - **The skeleton shimmer is slower and softer**: one sweep over the first 1.8s of a 3s cycle, eased at both ends, then a rest, with the glare a soft band rather than a wash the width of the shape. It was a 1.4s `ease-out` sweep, back to back.
79
89
  - **`Dialog` focuses itself on open, not its first control**, from the keyboard as from a tap, so a form dialog no longer opens with the caret (and, on leaving it, the blur validation) in its first field. `Tab` reaches the first control; mark a field `autofocus` to focus it instead. `useDialog` takes the same behaviour as `focusFirstControl: false`; `Drawer`, `Lightbox` and `SearchModal` are unchanged.
@@ -0,0 +1,25 @@
1
+ The country flags drawn by PhoneInput (dist/phoneFlagData-*.js) are copied from
2
+ country-flag-icons 1.6.20 (https://gitlab.com/catamphetamine/country-flag-icons), under:
3
+
4
+ (The MIT License)
5
+
6
+ Copyright (c) 2020 @catamphetamine <purecatamphetamine@gmail.com>
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining
9
+ a copy of this software and associated documentation files (the
10
+ 'Software'), to deal in the Software without restriction, including
11
+ without limitation the rights to use, copy, modify, merge, publish,
12
+ distribute, sublicense, and/or sell copies of the Software, and to
13
+ permit persons to whom the Software is furnished to do so, subject to
14
+ the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.