@reliability-design/web 1.4.0 → 1.4.2

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 ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog — @reliability-design/web
2
+
3
+ ## 1.4.1 (2026-07-27)
4
+
5
+ ### Fixed
6
+
7
+ - **Restored all 1.3.x design-token names removed by 1.4.0.** The RelDS 2.0 token rework in 1.4.0 renamed the token taxonomy in `vars.css` and dropped 154 of the 169 custom properties that 1.3.x shipped (`--rel-color-*`, `--rel-colors-*`, `--rel-text-*`, `--rel-background-*`, `--rel-surface-*`, `--rel-spacing-space-*`, `--rel-fontSizes-*`, `--rel-borders-*`, …). Apps referencing those tokens in their own CSS got unresolved `var()`s and lost colors/spacing/type across the board. 1.4.1 appends a **V1 compat alias block** to `vars.css`: every 1.3.x token name resolves again, pointing at its RelDS 2.0 equivalent (or its literal 1.3.x value where 2.0 has no counterpart). No import changes needed — `vars.css` remains the only stylesheet.
8
+
9
+ ### Upgrading
10
+
11
+ - Your lockfile pins the currently resolved version, so a plain `npm i` will **not** pick this up. Run `npm update @reliability-design/web` or `npm i @reliability-design/web@latest`.
12
+ - Works from any 1.x range: `^1.3.0` and `^1.4.0` both admit 1.4.1.
13
+
14
+ ### Notes
15
+
16
+ - The restored V1 names are **deprecated aliases** — removal is targeted for 3.0. Migrate consumer CSS to the RelDS 2.0 semantic tokens (`--rel-text-*`, `--rel-bg-*`, `--rel-border-*`, `--rel-action-*`, `--rel-spacing-*`, …).
17
+ - Aliased tokens follow the RelDS 2.0 **dark palette** (neutral grays). Dark-mode shades therefore differ slightly from 1.3.x's blue-tinted darks; light mode matches 1.3.x closely. Typography scale, spacing, radii, and stroke widths are value-identical to 1.3.x.
18
+
19
+ ## 1.4.0 (2026-07-24)
20
+
21
+ - RelDS 2.0 token rework: `vars.css` regenerated from Figma (`RelDS_A1`) with a new semantic token taxonomy; all components repointed to semantic tokens; structural parity with the 2.0 Figma spec.
22
+ - **Known issue (fixed in 1.4.1):** removed the 1.3.x token names without aliases, breaking consumer apps that referenced them.
@@ -142,8 +142,7 @@ export class RelAlert extends LitElement {
142
142
  color: var(--rel-text-default);
143
143
  }
144
144
 
145
- .alert-info .rel-message1,
146
- .alert-info .rel-message2 {
145
+ .alert-info .rel-message1 {
147
146
  color: var(--rel-text-info);
148
147
  }
149
148
 
@@ -152,8 +151,7 @@ export class RelAlert extends LitElement {
152
151
  color: var(--rel-text-default);
153
152
  }
154
153
 
155
- .alert-success .rel-message1,
156
- .alert-success .rel-message2 {
154
+ .alert-success .rel-message1 {
157
155
  color: var(--rel-text-success);
158
156
  }
159
157
 
@@ -162,18 +160,16 @@ export class RelAlert extends LitElement {
162
160
  color: var(--rel-text-default);
163
161
  }
164
162
 
165
- .alert-warning .rel-message1,
166
- .alert-warning .rel-message2 {
163
+ .alert-warning .rel-message1 {
167
164
  color: var(--rel-text-warning);
168
165
  }
169
166
 
170
167
  .alert-error {
171
168
  background: var(--rel-bg-danger-light);
172
- color: var(--rel-text-danger);
169
+ color: var(--rel-text-default);
173
170
  }
174
171
 
175
- .alert-error .rel-message1,
176
- .alert-error .rel-message2 {
172
+ .alert-error .rel-message1 {
177
173
  color: var(--rel-text-danger);
178
174
  }
179
175
 
@@ -0,0 +1,94 @@
1
+ # rel-autocomplete
2
+
3
+ ## Overview
4
+
5
+ A searchable single-select type-ahead field ("autocomplete") for searchable-dropdown and searchbar scenarios. Composes `rel-textfield` for all field chrome (label, sizes, variants, states, icons) and adds a suggestion panel with keyboard navigation, loading / no-results states, and clear/reset.
6
+
7
+ Two data modes:
8
+
9
+ - **Local** — provide `items`; typing filters them client-side (`filter` mode).
10
+ - **Remote** — provide a `searchFn`; input is debounced (`debounce-ms`), queries are latest-wins (stale responses are discarded), and local filtering is bypassed (results arrive pre-filtered).
11
+
12
+ ## Usage
13
+
14
+ ```html
15
+ <!-- Local items (strings) -->
16
+ <rel-autocomplete id="carrier" label="Carrier" prefix-icon="search" clearable></rel-autocomplete>
17
+ <script>
18
+ const ac = document.getElementById("carrier");
19
+ ac.items = ["FedEx Freight", "UPS Freight", "XPO Logistics", "Estes Express"];
20
+ ac.addEventListener("changed", (e) => console.log(e.detail.value, e.detail.item));
21
+ </script>
22
+
23
+ <!-- Object items with icons -->
24
+ <script>
25
+ ac.items = [
26
+ { value: "air", label: "Air", icon: "air" },
27
+ { value: "sea", label: "Sea", icon: "ship" },
28
+ ];
29
+ </script>
30
+
31
+ <!-- Custom fields for arbitrary API shapes -->
32
+ <rel-autocomplete display-field="name" value-field="id"></rel-autocomplete>
33
+
34
+ <!-- Remote data -->
35
+ <script>
36
+ ac.searchFn = async (query) => {
37
+ const res = await fetch(`/api/carriers?q=${encodeURIComponent(query)}`);
38
+ return res.json(); // (string | object)[]
39
+ };
40
+ </script>
41
+ ```
42
+
43
+ ## API
44
+
45
+ ### Attributes/Properties
46
+
47
+ | Name | Type | Default | Description |
48
+ |------|------|---------|-------------|
49
+ | `items` | `(string \| object)[]` | `[]` | Local suggestion list. Objects are read through `display-field` / `value-field`; an `icon` field renders a leading `rel-icon` on the row |
50
+ | `value` | `string` | `""` | Committed value — the selected item's `value-field` string. Typing alone does not change it; selection (or an exact label/value match on Enter/blur) does. Settable externally: the field shows the matching item's label, or the raw string when unknown |
51
+ | `display-field` | `string` | `"label"` | Object key used as the row label |
52
+ | `value-field` | `string` | `"value"` | Object key used as the committed value |
53
+ | `filter` | `"contains" \| "starts-with" \| "none"` | `"contains"` | Local filtering mode. `"none"` shows `items` as-is (use when the app pre-filters). Ignored when `searchFn` is set |
54
+ | `searchFn` | `(query: string) => Promise<items>` | — | Property-only. Async data source; enables debounce + loading + latest-wins handling |
55
+ | `debounce-ms` | `number` | `300` | Debounce before `searchFn` fires |
56
+ | `min-search-length` | `number` | `1` | Minimum typed characters before the panel opens / `searchFn` fires. `0` opens on focus showing all items |
57
+ | `max-suggestions` | `number` | `Infinity` | Optional cap on rendered rows (the panel scrolls regardless) |
58
+ | `clearable` | `boolean` | `false` | Trailing ✕ clears text + value, emits `rel-clear` and `changed` |
59
+ | `loading` | `boolean` | `false` | Externally-controlled loading row (internal `searchFn` loading is automatic) |
60
+ | `no-results-text` | `string` | `"No results found"` | Row shown when a query yields nothing |
61
+ | `loading-text` | `string` | `"Loading…"` | Text next to the loading spinner |
62
+ | `label`, `placeholder`, `size`, `variant`, `floating-label`, `prefix-icon`, `disabled`, `readonly`, `required`, `error`, `error-message`, `helper-text`, `name`, `full-width` | — | — | Passed through to the inner `rel-textfield` unchanged |
63
+
64
+ ## Events
65
+
66
+ | Event | Detail | Description |
67
+ |-------|--------|-------------|
68
+ | `changed` | `{ value: string, item: object \| string \| null }` | An item was selected (or cleared — `value: ""`, `item: null`). This is the form-value event (Angular CVA binds it) |
69
+ | `rel-change` | `string` | Fired on every keystroke with the raw text — use for the controlled/remote pattern (fetch, then set `.items`) |
70
+ | `rel-clear` | — | The clear (✕) affordance was used |
71
+ | `rel-search-error` | `{ query, error }` | `searchFn` rejected — the panel shows the no-results state |
72
+
73
+ ## Keyboard Interactions
74
+
75
+ - Typing — filters (local) or queries (remote) and opens the panel
76
+ - `Arrow Down` / `Arrow Up` — open the panel / move the highlight
77
+ - `Enter` — selects the highlighted row; with no highlight, commits an exact label/value match, otherwise keeps the free text and closes
78
+ - `Escape` — closes the panel without touching the text
79
+ - `Tab` — commits an exact match, closes, and moves on
80
+
81
+ ## Accessibility
82
+
83
+ - Combobox pattern: `role="combobox"` with `aria-expanded`, `aria-controls`, and `aria-activedescendant`; panel is `role="listbox"` with `role="option"` rows
84
+ - Known limitation: the combobox role sits on a wrapper around the field rather than on the `<input>` itself — the input lives in `rel-textfield`'s nested shadow root, which `aria-activedescendant` cannot reference across. This is the standard pragmatic pattern for composed shadow components
85
+ - Loading row uses `role="status"`; disabled/readonly never open the panel
86
+
87
+ ## Notes / Edge Cases
88
+
89
+ - The matched substring in each row renders bold
90
+ - `value` set externally to a string not present in `items` displays the raw string (common with remote data on init); provide the item in `items` to show its label instead
91
+ - `searchFn` rejection is treated as an empty result plus a `rel-search-error` event — the component never throws into the app
92
+ - Form validation is *displayed* (`error`, `error-message`, `required`), not performed — validity logic belongs to the form layer (e.g. Angular validators)
93
+ - CSS parts: `panel`, `list`, `option`, plus re-exported textfield parts (`label`, `control`, `input`, `helper`, `right-icon`)
94
+ - Panel styling matches `rel-select`'s listbox; override via `--rel-autocomplete-bg`, `--rel-autocomplete-menu-border`, `--rel-autocomplete-menu-radius`, `--rel-autocomplete-menu-shadow`, `--rel-autocomplete-option-hover`