@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.
- package/CHANGELOG.md +23 -0
- package/README.md +71 -31
- package/dist/{PhoneInput-CHTpjbtS.js → PhoneInput-D_z9MuDw.js} +2 -2
- package/dist/{VariantPicker-BLuaCwee.js → VariantPicker-DgDBOM-w.js} +527 -314
- package/dist/components/autocomplete/Autocomplete.vue.d.ts +2 -0
- package/dist/components/chip/Chip.vue.d.ts +2 -0
- package/dist/components/currency-input/CurrencyInput.vue.d.ts +5 -1
- package/dist/components/currency-picker/CurrencyPicker.vue.d.ts +27 -1
- package/dist/components/currency-picker/types.d.ts +2 -1
- package/dist/components/dialog/Dialog.vue.d.ts +2 -0
- package/dist/components/drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +2 -0
- package/dist/components/load-more/LoadMore.vue.d.ts +1 -1
- package/dist/components/nav-menu/NavMenu.vue.d.ts +5 -2
- package/dist/components/nav-menu/NavMenuDrawerList.vue.d.ts +39 -0
- package/dist/components/nav-menu/navLinks.d.ts +9 -0
- package/dist/components/nav-menu/types.d.ts +22 -2
- package/dist/components/pagination/Pagination.vue.d.ts +2 -0
- package/dist/components/product-card/ProductCard.vue.d.ts +6 -0
- package/dist/components/product-card/types.d.ts +25 -2
- package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +2 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +2 -0
- package/dist/components/select/MultiSelect.vue.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +2 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
- package/dist/components/toast/Toast.vue.d.ts +2 -0
- package/dist/components/toast/Toaster.vue.d.ts +2 -0
- package/dist/components/unit-input/UnitInput.vue.d.ts +8 -0
- package/dist/components/unit-input/types.d.ts +13 -1
- package/dist/components.css +45 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +699 -331
- package/dist/messages/en-US.d.ts +4 -0
- package/dist/messages/is-IS.js +3 -1
- package/dist/phone/PhoneInput.vue.d.ts +2 -0
- package/dist/phone/vee-validate.js +4 -4
- package/dist/phone.js +1 -1
- package/dist/style.css +45 -0
- package/dist/{useFieldControl-B1JvPEeM.js → useFieldControl-D_h1RWyU.js} +18 -7
- package/dist/{useMessages-BdN9F1cW.js → useMessages-D8bTGX7c.js} +5 -1
- package/dist/{useOptionList-UMUMayec.js → useOptionList-DuAKag8J.js} +1 -0
- package/dist/utilities.css +23 -0
- package/dist/utils/amount.d.ts +71 -0
- package/dist/vee-validate/useFieldControl.d.ts +6 -0
- package/dist/vee-validate.js +35 -5
- package/dist/vue-i18n.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,8 +5,23 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- `Accordion`: opening an item no longer shows its panel fully open for a frame before it animates. The click opens the `<details>` and starts the height animation in the same task, instead of waiting for the browser's later `toggle`, which a busy page could paint before.
|
|
11
|
+
- `Select` and `MultiSelect`: the chevron's icon fills its `chevron` part instead of keeping a fixed 18px, so `classes.chevron` resizes it and an open picker's chevron turns about its own centre (it used to overflow a smaller part and shift as it rotated).
|
|
12
|
+
|
|
8
13
|
### Added
|
|
9
14
|
|
|
15
|
+
- **`NavMenuLink.current` takes `'true'` (WS-1468).** `current: 'true'` (or `'page'`, same as `true`) sets `aria-current="true"` on an entry that holds the current page without being it, such as a category's ancestor; a top-level trigger with a panel carries `aria-current` too. `containsCurrent` reads every value; new helper `currentMark` in `navLinks`.
|
|
16
|
+
- **`NavMenu` link descriptions are a description, not part of the name (WS-1464).** A linked panel entry with a `description` is named by its label (and the hidden new-tab text) through `aria-labelledby` and described by the description through `aria-describedby`; an entry without one carries neither and draws no empty element. The drawer shows the descriptions too.
|
|
17
|
+
- **`ProductCard` theme wording and order (WS-1277).** New props `vendorPlacement` (`'above'`, the default, or `'below'`: the vendor line after the price), `maxSwatches` (dots before "+N", default `3`), `saleBadgeLabel` (text in place of the "−20%" percentage), `quickAddLabel`, `quickAddName` (the visible text and the full accessible name of quick add, defaulting to the messages as before) and `quickAddIcon` (a leading icon). New parts `saleBadge`, `newBadge`, `soldOutBadge` (each badge's root) and `quickAddLabel` (the button's label, to hide the word on narrow cards while the name stays). Defaults unchanged.
|
|
18
|
+
- **`NavMenu` `drawerMode: 'inline'` (WS-1277).** The narrow-screen menu opens as a disclosure under the bar instead of the modal side sheet (`sheet`, still the default): it hangs from the menu's positioning box as a mega panel does (make the root `static` to hang it from a whole header), fills the window below its top edge and scrolls on its own, with the entries and then the `drawerFooter` slot, which sits at the bottom of the window while the entries are shorter than it (the drawer is `100dvh` tall, so the foot rises with a phone's browser toolbars) and pads its bottom by the device's safe area. It opens the same way as the bar's panels (`duration-base`) and closes back up (`duration-fast`). Its button toggles it, keeps `aria-expanded`/`aria-controls` without `aria-haspopup`, and while open is named by the `close` message and draws an × (the `toggle` slot already gets `open`). No focus trap: `Escape` closes it and puts focus back on the button, and a press outside or focus leaving it closes it, so focus never walks into the page it covers. The `drawer`, `drawerBody` and `drawerFooter` parts style it; `drawerHeader` is the sheet's only. New type `NavMenuDrawerMode`.
|
|
19
|
+
- **`NavMenuLink.tone` (WS-1277).** `'accent'` draws a top-level entry in the accent colour in every state, in the bar and as a drawer row (a "Sale" link), and the entry carries `data-tone`. New type `NavMenuTone`.
|
|
20
|
+
- **`NavMenu` panels carry `data-layout`** (`dropdown` or `mega`) on the `panel` and `content` parts, so a theme can style a dropdown apart from a mega panel. `NavMenuSection` is now exported.
|
|
21
|
+
- **`CurrencyPicker` slots `leading`, `value`, `optionContent` and `label`, and part `label` (WS-1277).** `leading`, `value` and `optionContent` are `Select`'s own, passed through, so a header can draw the closed picker as "Prices in ISK" with an icon and each row as the currency's name with its code apart: `value` gets `{ code, label }` and still defaults to the code, `optionContent` gets `{ code, currencyName, label, selected }`. With `showLabel`, the `label` slot replaces the label's content (an icon beside the words) and the `label` part styles it.
|
|
22
|
+
- **`parseAmount`, `readAmount` and `createAmountEditor`** (`src/utils/amount.ts`): the one amount parser and the format-while-typing editor behind `UnitInput` and `CurrencyInput`, for a consumer reading a typed or pasted amount the same way. Types `AmountReading`, `AmountText`, `AmountEdit`, `AmountEditor`, `AmountEditorOptions`, `AmountInvalidReason`.
|
|
23
|
+
- **`UnitInput` and `CurrencyInput` `fixedFraction`, `nullable` and `placeholder`**, the `update:valid` event, and `isValid` and `invalidReason` on the instance; `CurrencyInput` exposes the same three (WS-1390).
|
|
24
|
+
- **`FieldUnitInput` and `FieldCurrencyInput` fail on text they cannot read (WS-1390)**, before their `rules` run, so the form never submits the number the field held. New messages `amountNotANumber` ("Enter a number." / "Sláðu inn tölu.") and `amountNoDecimals` ("Enter a whole number." / "Sláðu inn heila tölu."). The check is a field rule, so a form-level `validationSchema` that replaces field rules does not see it.
|
|
10
25
|
- **`NavMenu` draws cards (WS-1362).** An entry with `display: 'card'` and a resolved `card` is drawn as a card: its picture cropped to the new `cardAspect` prop (`width:height`, default `4:3`), the title, and `card.price` written with `formatPrice` in the ambient `CURRENCY_KEY` and `LOCALE_KEY` (a plain number without a currency). A column holding cards lays them two to a row in the bar and in the drawer; a plain entry beside them takes a whole row, and the heading, cards and plain entries of that column start at one edge. The column and the columns row carry `data-cards` for a theme to size it. The picture has an empty `alt` since the title beside it names the link. New parts `card`, `cardImage`, `cardTitle`, `cardPrice` (and `drawer…`), new helpers `isCard` and `cardAspectRatio` in `navLinks`. The `panelItem` slot still replaces the card; an entry without a resolved `card` stays a link.
|
|
11
26
|
- **`NavMenuLink.card` and `display` (WS-1326).** A resolved card (`{ image, title, price? }`) rides on the entry and reaches the `panelItem` slot as `link.card`. New type `NavMenuCard`.
|
|
12
27
|
- **`NavMenu` sections (WS-1321).** `NavMenuItem.sections` (new type `NavMenuSection`: `heading`, `headingLink`, `links`, `seeAll`, `display`), which a resolved Studio link carries for a theme that declares `tree.sections`, draws one column per section in a `mega` panel: a heading that links when it has a page, the "see all" entry last (`data-see-all`, and `isSeeAll` in the `panelItem` slot props), a section with only a heading link headed by that link's label, a section with nothing to show left out. `children` and `groups` keep working for a link without sections. New helper `panelRuns` in `navLinks`.
|
|
@@ -96,6 +111,9 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
96
111
|
|
|
97
112
|
### Changed
|
|
98
113
|
|
|
114
|
+
- **`NavMenu` panels open from the bar (WS-1277).** Mega panels and dropdowns now show their top third at once and unroll the rest as they fade in and drop 0.25rem into place (`animate-eldra-menu-in`, `duration-base`), instead of playing the popover entrance, whose growth from the top-left corner read as the panel sliding in from the left.
|
|
115
|
+
|
|
116
|
+
- **`NavMenu` card pictures take their crop from `--eldra-nav-menu-card-aspect`** (set inline from `cardAspect`) through their own class, rather than an inline `aspect-ratio`, so a theme's class on `cardImage`/`drawerCardImage` can crop them differently (WS-1277).
|
|
99
117
|
- **`Autocomplete` shows a single suggestion whose label is exactly the text.** It kept the panel closed for it; shown, the row confirms what was typed, and the panel is there again when the field is focused again.
|
|
100
118
|
- **`@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.
|
|
101
119
|
- **`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.
|
|
@@ -178,6 +196,11 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
178
196
|
|
|
179
197
|
### Fixed
|
|
180
198
|
|
|
199
|
+
- **`NavMenu` marks one top-level entry as current (WS-1277).** A page that is its own entry and also a link in another entry's panel ("Ceramics" beside "Shop") marked both. The entry whose own link is the page wins; failing that, the first entry whose panel holds it.
|
|
200
|
+
|
|
201
|
+
- **`AccordionItem` no longer animates a panel that was open from the start (WS-1277).** The `toggle` a browser fires for a `<details>` created or hydrated open started the height animation from `0`, so every page load replayed the opening of an already open row, and where the page's animations did not advance (a background tab, a throttled preview iframe, a screenshot before the first frame) the panel stayed at height `0` with `overflow: hidden`, clipped, with the next row drawn over its content. Only a change of state animates now.
|
|
202
|
+
- **`UnitInput` and `CurrencyInput` read every amount with one parser (WS-1390).** A paste into a selection, autofill, a virtual keyboard or dictation, an IME composition and a decimal mark arriving without a key event are read like typing, so an amount is no longer read 10 to 1000 times off. The field still formats while typing, with the caret kept. A paste in the other convention is read (`1,000,000` into an Icelandic field is a million); a typed keystroke that would make the text unreadable is refused; text that cannot be read is kept and marked invalid instead of having its characters stripped. A currency without decimals (ISK) takes none, a `,00` tail is dropped and a non-zero fraction is invalid. An emptied field emits `min` (or `null` with `nullable`) at once instead of on blur. The keydown handling of `,`, `.`, Backspace, Delete and the arrow keys over separators is gone: deleting a separator deletes the digit beyond it.
|
|
203
|
+
|
|
181
204
|
- **`SearchBar` `autofocus` focuses after the page's own mount updates have rendered (WS-1277).** It focused inside `onMounted`, before updates other blocks queue in their mounted hooks had drawn, so the field was scrolled into view against a layout about to change and could end a pixel away from where the settled page puts it. It now focuses on the next tick.
|
|
182
205
|
- **`SearchModal` shows its results in Safari, and long results scroll.** The results area took no height in Safari, so the dialog drew only the field and the footer. In every browser, results taller than the dialog's max height were cut off instead of scrolling. The `results` part is now a flex column sized by its content (`flex-auto`, was `flex-1`), and the panel inside it fills it and scrolls (`flex-auto`, was `h-full`).
|
|
183
206
|
- **Opening a `Dialog`, `Drawer`, `Lightbox` or `SearchModal` no longer shifts the page sideways.** The scroll lock hid the page's scrollbar and the content widened into its space; `<html>` is now padded on the right by the scrollbar's width while a modal is open, added to any padding it already has and restored on close. Nothing changes with overlay scrollbars or on a page that does not scroll. A `position: fixed` element that spans the window pads itself with `--eldra-scrollbar-width` (under Added) to stay still too.
|
package/README.md
CHANGED
|
@@ -1713,7 +1713,9 @@ aria-pressed>` that fills `primary`/`primary-contrast` when `selected`, the same
|
|
|
1713
1713
|
that a store that knows those fields knows these; the handful of places this port deliberately
|
|
1714
1714
|
departs from them is listed under the deviations below.
|
|
1715
1715
|
- **`FieldUnitInput` and `FieldCurrencyInput`**, their `./vee-validate` wrappers, binding
|
|
1716
|
-
`number | null`.
|
|
1716
|
+
`number | null`. Text the field cannot read fails the field before its `rules` run, with
|
|
1717
|
+
`amountNotANumber` or, for a fraction where the currency takes none, `amountNoDecimals`; the model
|
|
1718
|
+
keeps the number it held, so without this a rule would pass it and the form would submit it.
|
|
1717
1719
|
- **`provideEldraUiLocale` / `useEldraUiLocale` / `LOCALE_KEY`** (`src/composables/useLocale.ts`) —
|
|
1718
1720
|
the number locale as a provide/inject pair, the same shape as the messages one and deliberately a
|
|
1719
1721
|
separate key: the strings a component renders and the locale its numbers are formatted in are
|
|
@@ -1908,6 +1910,14 @@ children?, layout?, groups? }`, one level of children. Children sharing a `group
|
|
|
1908
1910
|
nothing for a panel takes no room in it (`empty:hidden`), and a menu with no entry to show draws
|
|
1909
1911
|
no empty `<nav>`.
|
|
1910
1912
|
|
|
1913
|
+
**Descriptions.** An entry's `description` is a muted second line under its label in a panel
|
|
1914
|
+
(`description` part, none when it is empty). A linked entry that has one is named by its label alone
|
|
1915
|
+
(`aria-labelledby` on the label and the hidden "opens in a new tab" text) and described by the
|
|
1916
|
+
description (`aria-describedby`), so a screen reader reads the title as the link's name. The
|
|
1917
|
+
drawer draws the same panel content, so the phone menu shows the descriptions too (deliberate: a
|
|
1918
|
+
link's one-line context is as useful on a phone, and the rows have the room). A `panelItem` slot
|
|
1919
|
+
replaces the entry and its ids; it is then up to the slot.
|
|
1920
|
+
|
|
1911
1921
|
**Narrow screens.** Below `collapseBelow` the bar is hidden and a menu button
|
|
1912
1922
|
(`aria-controls` the drawer) opens a left `Drawer`. `md`, `lg` (default) and `xl` are **viewport**
|
|
1913
1923
|
breakpoints, since the menu's own width says nothing about how crowded the header is; `@tablet`,
|
|
@@ -2322,40 +2332,70 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
|
|
|
2322
2332
|
separator in the field to type after. `filterNumericBeforeInput` still accepts it on a
|
|
2323
2333
|
decimal field, for a consumer building one — someone pasting `1,234.50` means 1234.5.
|
|
2324
2334
|
|
|
2325
|
-
**`UnitInput` and `CurrencyInput` do the opposite, on purpose** (see below):
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
- **`UnitInput` and `CurrencyInput`
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2335
|
+
**`UnitInput` and `CurrencyInput` do the opposite, on purpose** (see below): their text always
|
|
2336
|
+
holds a symbol and grouping, and one parser reads whatever arrives.
|
|
2337
|
+
|
|
2338
|
+
- **`UnitInput` and `CurrencyInput` format while they are typed into** (operator decision,
|
|
2339
|
+
2026-09-25, kept 2026-11-26): focused or not, the field shows `$1,234.5`, `1.234 kr.` or
|
|
2340
|
+
`1,234 km`, because that is what a merchant knows these fields to do; a field that showed a plain
|
|
2341
|
+
number under the caret and a formatted one on blur was rejected. Focus does not change the text.
|
|
2342
|
+
|
|
2343
|
+
**One path for every edit.** Each `input` event, however the text came (a keystroke, a paste into
|
|
2344
|
+
a selection, a drop, autofill, a virtual keyboard or dictation, the end of an IME composition),
|
|
2345
|
+
goes through `createAmountEditor().edit` in `src/utils/amount.ts`, exported. It compares the new
|
|
2346
|
+
text with the one the field showed around the caret to find what was inserted and what was
|
|
2347
|
+
removed; the symbol and the grouping in the old text are the field's own and are never read as
|
|
2348
|
+
typed marks. The result is read by one parser, `readAmount`, and formatted back, with the caret
|
|
2349
|
+
after the same digit it followed. Keydown inserts nothing and moves nothing (only the arrows step
|
|
2350
|
+
and Ctrl/Cmd+A selects the amount); during a composition nothing is read until `compositionend`.
|
|
2351
|
+
Earlier versions special-cased `,` and `.` on keydown and stripped every character on each
|
|
2352
|
+
reformat, which read amounts 10 to 1000 times off whenever a mark came without a key event.
|
|
2353
|
+
|
|
2354
|
+
**The parser** (`parseAmount`, strict) reads in the field's locale. Spaces, currency symbols and
|
|
2355
|
+
codes and the unit are stripped; full-width digits and marks read as ASCII. The locale's decimal
|
|
2356
|
+
mark is always the decimal mark, and more decimals than the field takes is unreadable, never
|
|
2357
|
+
grouping. The locale's grouping mark counts only as well-formed groups (`1,234,567`). The other
|
|
2358
|
+
convention is taken where the locale reading is impossible and the other is unambiguous: one
|
|
2359
|
+
other mark followed by one or two digits (`34.90` under `is-IS`), or both marks in a well-formed
|
|
2360
|
+
pattern (`1,234.50` under `is-IS`). A leading mark means `0,5`. In a currency without decimals
|
|
2361
|
+
(ISK; the field then takes no decimals whatever `maxFraction` says) either convention's grouping
|
|
2362
|
+
is accepted, a `,00` tail reads as nothing and a non-zero fraction is unreadable (`noDecimals`).
|
|
2363
|
+
`src/utils/__tests__/amount.spec.ts` holds the table.
|
|
2364
|
+
|
|
2365
|
+
**Text that arrives in bulk is read leniently** (`readAmount(…, lenient)`): when the locale
|
|
2366
|
+
cannot read it, it is read in the other convention, so `1,000,000` pasted into an Icelandic field
|
|
2367
|
+
is a million and shown `1.000.000 kr.`, and `1.000` pasted into an English money field a
|
|
2368
|
+
thousand. A single typed keystroke is read strictly, and a keystroke that would make readable
|
|
2369
|
+
text unreadable is refused: typing a third decimal into `1,00 €` leaves `1,00 €`, never `1.000 €`;
|
|
2370
|
+
a typed letter does nothing. A value above `max` is refused either way.
|
|
2371
|
+
|
|
2372
|
+
**What the text shows.** A typed decimal mark and trailing zeros stay while typing (`12,` and
|
|
2373
|
+
`12,50`), inside the number before a trailing symbol. Blur settles the text: grouped, a bare mark
|
|
2374
|
+
or a zero tail dropped, and with `fixedFraction` (currency only) the currency's own decimals
|
|
2375
|
+
padded (`34,90 €`). Deleting a symbol or a group mark alone deletes the digit beyond it, so
|
|
2376
|
+
Backspace after `1,` removes the `1` and the symbol can never be deleted. Text that cannot be
|
|
2377
|
+
read is left as it came, between the symbols, and marked invalid (`aria-invalid` and the error
|
|
2378
|
+
boundary): at once for unreadable text, on blur for text still being typed (`12,` under `en-US`,
|
|
2379
|
+
which may become `12,500`).
|
|
2380
|
+
|
|
2381
|
+
**What is emitted.** The number the text says, at once. Emptied: `null` with `nullable`, else
|
|
2382
|
+
`clamp(0)` (`min`), at once, and the field shows it on blur (an untouched empty field stays
|
|
2383
|
+
empty). While the text cannot be read the model is the value the field had when editing began,
|
|
2384
|
+
emitted once. `update:valid` (boolean) is emitted on every change of readability and once on
|
|
2385
|
+
mount; the instance exposes `isValid` and `invalidReason` (`notANumber`, `noDecimals` or `null`).
|
|
2386
|
+
A bound `modelValue` the parent does not write back is shown again after the edit, so a clamping
|
|
2387
|
+
or refusing parent is what the field shows; a parent echoing the number never rewrites `12,`.
|
|
2388
|
+
|
|
2389
|
+
**Two deliberate departures from the private components**, each because the private behaviour is
|
|
2347
2390
|
wrong here rather than merely different:
|
|
2348
2391
|
|
|
2349
|
-
1.
|
|
2350
|
-
private component appends it, which is right for `$1,234.` and wrong for every suffix-symbol
|
|
2351
|
-
format — it produced `1,234 km.` and `1.234 kr.,`.
|
|
2352
|
-
2. **`CurrencyInput` forwards only the props that were actually passed.** The private wrapper
|
|
2392
|
+
1. **`CurrencyInput` forwards only the props that were actually passed.** The private wrapper
|
|
2353
2393
|
spreads all of them, so `UnitInput` sees a bound `modelValue` on a field nobody bound and the
|
|
2354
2394
|
reconciliation clears an uncontrolled field a tick after every keystroke.
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2395
|
+
2. **Read-only and disabled fields do nothing at all** — no editing, no caret placement, no
|
|
2396
|
+
stepping, no drag, no clear button.
|
|
2397
|
+
|
|
2398
|
+
The private library's `UnitInput` renders this one, so the two behave the same.
|
|
2359
2399
|
|
|
2360
2400
|
And the package conventions on top of the port: the `data-part` anatomy and `classes`, the three
|
|
2361
2401
|
field sizes, the `FieldWrapper` context (`id`, `invalid`, `required`, composed `describedBy`),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as FIELD_KEY, W as FIELD_RADIUS, Y as FIELD_TEXT, d as useEldraUiLocale, i as SelectPanel_default, nt as joinIds, p as usePopover, r as useOptionList, rt as useUiId, tt as useControllableModel, y as useListbox } from "./useOptionList-
|
|
1
|
+
import { $ as FIELD_KEY, W as FIELD_RADIUS, Y as FIELD_TEXT, d as useEldraUiLocale, i as SelectPanel_default, nt as joinIds, p as usePopover, r as useOptionList, rt as useUiId, tt as useControllableModel, y as useListbox } from "./useOptionList-DuAKag8J.js";
|
|
2
2
|
import { r as useEldraScope } from "./useEldraScope-BDbGzt7R.js";
|
|
3
|
-
import { i as enUS, r as useMessages } from "./useMessages-
|
|
3
|
+
import { i as enUS, r as useMessages } from "./useMessages-D8bTGX7c.js";
|
|
4
4
|
import { t as CountryFlag_default } from "./CountryFlag-DOa8lOHp.js";
|
|
5
5
|
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, toDisplayString, toValue, unref, watch, withCtx } from "vue";
|
|
6
6
|
import { comparator } from "@eldrajs/sdk/format";
|