@reliability-design/web 1.4.7 → 1.4.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.
- package/CHANGELOG.md +37 -2
- package/dist/components/rel-accordion/README.md +2 -1
- package/dist/components/rel-autocomplete/README.md +21 -5
- package/dist/components/rel-avatar/README.md +9 -7
- package/dist/components/rel-badge/README.md +4 -5
- package/dist/components/rel-button/README.md +32 -2
- package/dist/components/rel-card/README.md +3 -3
- package/dist/components/rel-carousel/README.md +2 -0
- package/dist/components/rel-checkbox/README.md +7 -4
- package/dist/components/rel-chip/README.md +13 -7
- package/dist/components/rel-container/README.md +8 -8
- package/dist/components/rel-date-picker/README.md +1 -1
- package/dist/components/rel-divider/README.md +11 -1
- package/dist/components/rel-kbd/README.md +2 -2
- package/dist/components/rel-layout/README.md +34 -0
- package/dist/components/rel-menu/README.md +3 -1
- package/dist/components/rel-menubar/README.md +1 -1
- package/dist/components/rel-otp/README.md +4 -3
- package/dist/components/rel-pagination/README.md +2 -2
- package/dist/components/rel-popover/README.md +5 -5
- package/dist/components/rel-progress/README.md +3 -3
- package/dist/components/rel-radio/README.md +1 -1
- package/dist/components/rel-range-picker/README.md +4 -1
- package/dist/components/rel-segmented-button/README.md +2 -1
- package/dist/components/rel-select/README.md +5 -3
- package/dist/components/rel-sheet/README.md +3 -3
- package/dist/components/rel-skeleton/README.md +5 -4
- package/dist/components/rel-slider/README.md +3 -2
- package/dist/components/rel-snackbar/README.md +13 -7
- package/dist/components/rel-stepper/README.md +11 -7
- package/dist/components/rel-switch/README.md +16 -7
- package/dist/components/rel-tab/README.md +4 -2
- package/dist/components/rel-textfield/README.md +18 -1
- package/dist/components/rel-toast/README.md +14 -6
- package/dist/components/rel-tooltip/README.md +13 -2
- package/dist/components/rel-upload/README.md +2 -2
- package/dist/index.d.mts +709 -237
- package/dist/index.d.ts +709 -237
- package/dist/index.js +10397 -7840
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7458 -4901
- package/dist/index.mjs.map +1 -1
- package/dist/styles/focus-ring.ts +84 -0
- package/dist/styles/vars.css +75 -60
- package/dist/{vars-JHTUGNRG.css → vars-DXX6QOAG.css} +75 -60
- package/package.json +1 -1
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
| `error` | `error` | `boolean` | `false` | Puts the field in the error state: danger border, `aria-invalid`, and `errorMessage` replacing the helper text. |
|
|
111
111
|
| `errorMessage` | `errormessage` | `string` | `undefined` | Text shown below the control instead of `helperText` while the field is in the error state. |
|
|
112
112
|
| `helperText` | `helpertext` | `string` | `undefined` | Helper line below the control (preferred over the legacy `supportingText`); linked to the input via `aria-describedby`. |
|
|
113
|
+
| `helperIcon` | `helper-icon` | `string` | `undefined` | Icon name from the generated icon dictionary, rendered before the helper line (Figma "Supporting Icon"). Sized 16px, or 14px at `size="small"`, and it takes the helper's colour — so it turns `--rel-text-danger` in the error state. Decorative: it is hidden from screen readers, since the helper text it sits beside is already announced. |
|
|
113
114
|
| `readonly` | `readonly` | `boolean` | `false` | Makes the input read-only: focusable and selectable but not editable. |
|
|
114
115
|
| `maxLength` | `maxlength` | `number` | `undefined` | Maximum number of characters (native `maxlength`). |
|
|
115
116
|
| `name` | `name` | `string` | `undefined` | Form field name forwarded to the native input, for form submission and autofill. |
|
|
@@ -151,6 +152,7 @@
|
|
|
151
152
|
| `prefix` | The prefix block (leading icon, prefix text and the `prefix` slot) |
|
|
152
153
|
| `suffix` | The suffix block (suffix text, trailing icon and the `suffix` slot) |
|
|
153
154
|
| `helper` | The helper / error text line below the control |
|
|
155
|
+
| `helper-icon` | The leading `rel-icon` in the helper line; rendered only when `helper-icon` is set and there is helper text |
|
|
154
156
|
| `control` | The bordered control box (the fieldset in the legend variant) |
|
|
155
157
|
|
|
156
158
|
## Tokens / CSS Variables
|
|
@@ -161,7 +163,8 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
161
163
|
|
|
162
164
|
| Custom property | Default | Description |
|
|
163
165
|
| --- | --- | --- |
|
|
164
|
-
| `--rel-field-label-reserve` | `calc(var(--rel-body-
|
|
166
|
+
| `--rel-field-label-reserve` | `calc(var(--rel-body-md-regular-line-height) + var(--rel-spacing-2xs))` | Height held for the label row whenever no label renders above the control — `labelStyle="none"`, and `labelStyle="floating"` where the label sits inside the control — so the control still lines up with labelled siblings in a form row. Defaults to that size's label line-height plus the wrapper gap (24px at `small`, 26px at `medium` and `large`). Set to `0` to collapse the row entirely (toolbars, table cells). |
|
|
167
|
+
| `--rel-textfield-surface` | `var(--rel-bg-neutral)` | Colour the floating label's strip paints to mask the border behind it; defaults to the control's own fill (`--rel-bg-neutral`). Set it when the field sits on a tinted or elevated surface, otherwise the strip shows as a light dash across the border. |
|
|
165
168
|
|
|
166
169
|
<!-- readme-gen:end -->
|
|
167
170
|
|
|
@@ -183,6 +186,20 @@ Focus behaviour: `focus()` on the host focuses the inner input / textarea (the h
|
|
|
183
186
|
## Notes / Edge Cases
|
|
184
187
|
|
|
185
188
|
- Attribute spellings: props declared with an explicit `attribute` use kebab-case (`label-style`, `prefix-text`, `clickable-right-icon`, `field-aria-label`, …). The others have Lit's default all-lowercase attribute — `prefixicon`, `righticon`, `helpertext`, `errormessage`, `maxlength`, `fullwidth`, `supportingtext`, `floatinglabel` — see the Attribute column above. HTML attribute names are case-insensitive, so `helperText="…"` in markup also works.
|
|
189
|
+
- **The same logical prop can take a _different_ spelling on `rel-autocomplete` / `rel-select`.** Those components declare an explicit kebab `attribute` where this one falls back to Lit's all-lowercase default, so `prefix-icon` works on `<rel-autocomplete>` and is silently ignored on `<rel-textfield>`. There is no error when this happens — an attribute a component does not observe is inert, so the icon simply never appears. The pairs that differ today:
|
|
190
|
+
|
|
191
|
+
| Prop | `rel-textfield` | `rel-autocomplete` / `rel-select` |
|
|
192
|
+
| --- | --- | --- |
|
|
193
|
+
| `prefixIcon` | `prefixicon` | `prefix-icon` (autocomplete) |
|
|
194
|
+
| `helperText` | `helpertext` | `helper-text` (autocomplete) |
|
|
195
|
+
| `errorMessage` | `errormessage` | `error-message` (autocomplete) |
|
|
196
|
+
| `floatingLabel` | `floatinglabel` | `floating-label` (autocomplete) |
|
|
197
|
+
| `fullWidth` | `fullwidth` | `full-width` (autocomplete) |
|
|
198
|
+
| `leftIcon` | `lefticon` | `left-icon` (select) |
|
|
199
|
+
| `rightIcon` | `righticon` | `right-icon` (select) |
|
|
200
|
+
| `supportingText` | `supportingtext` | `supporting-text` (select) |
|
|
201
|
+
|
|
202
|
+
All three agree on `label-style`, `field-aria-label` and `field-aria-labelledby`. This is an inconsistency, not a design decision: the kebab spellings are the intended direction, and unifying on them means retiring the lowercase ones, which only a major version can do — so it is targeted for 3.0. Until then the Attribute column above is the authority for **this** component. In a Lit template you can sidestep the whole question with a property binding (`.prefixIcon=${…}`), which is spelling-independent; that is also how `rel-autocomplete` drives the field it wraps, so its own forwarding is unaffected by the mismatch.
|
|
186
203
|
- Legacy names still work but the canonical ones win when both are set: `leftIcon` → `prefixIcon`, `supportingText` → `helperText`, `state="error"` → `error`, `state="disabled"` → `disabled`. `lefticon` / `righticon` attributes are also read once at connect time.
|
|
187
204
|
- `errorMessage` replaces the helper line only while the field is in the error state **and** the message is set; otherwise the helper text stays visible. There is no built-in validation — set `error` from your form layer.
|
|
188
205
|
- `state="error"` (legacy) auto-clears to `"default"` as soon as the user types a non-empty value and comes back once the value is emptied again; the `error` boolean never auto-clears.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rel-toast
|
|
2
2
|
|
|
3
|
-
`<rel-toast>` is the transient notification of the Reliability Design System: a
|
|
3
|
+
`<rel-toast>` is the transient notification of the Reliability Design System: a card anchored to one of six viewport positions (bottom centre by default) that shows a short message, an optional action button ("Undo", "Retry") and a dismiss button, then hides itself after `duration` milliseconds. It has two tones — `default` and `destructive` — and is driven by the `show` property (or `open()` / `close()`). Use it for brief confirmations that need no reply; use `<rel-snackbar>` when you need the status tones, a stacked layout or your own positioning, and `<rel-alert>` for messages that must stay on the page.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -74,22 +74,26 @@ rel-toast { --rel-z-toast: 10000; }
|
|
|
74
74
|
| Property | Attribute | Type | Default | Description |
|
|
75
75
|
| --- | --- | --- | --- | --- |
|
|
76
76
|
| `message` | `message` | `string` | `""` | Text of the toast. It is also announced to screen readers through the shared live-region announcer each time `show` becomes true. |
|
|
77
|
-
| `tone` | `tone` | `"
|
|
77
|
+
| `tone` | `tone` | `"neutral" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | `undefined` | Semantic tone (Figma "Tone"): `"neutral"` (default: neutral surface) \| `"destructive"` (danger fill, announced assertively). `"default"` is a deprecated alias of `"neutral"`; `"error"`, `"danger"` and `"critical"` are deprecated aliases of `"destructive"`; each logs a one-time console notice. Takes precedence over the deprecated `type` prop. |
|
|
78
78
|
| `actionLabel` | `actionlabel` | `string` | `undefined` | Label of the optional action button rendered between the message and the dismiss button; the button is omitted when unset. Clicking it fires `action` and then closes the toast. |
|
|
79
79
|
| `duration` | `duration` | `number` | `4000` | Auto-dismiss delay in milliseconds, started each time `show` becomes true. `0` (or a negative value) disables auto-dismiss so the toast stays until `close()` or the dismiss button. Changing it while the toast is visible does not restart the running timer. |
|
|
80
80
|
| `show` | `show` | `boolean` | `false` | Whether the toast is visible. Set it to true (or call `open()`) to show the toast and start the auto-dismiss timer; it is set back to false by `close()`, the dismiss button, the action button and the timer. Reflected. |
|
|
81
|
+
| `dismissible` | `dismissible` | `boolean` | `true` | Shows the trailing dismiss button (Figma "Show Close Button"). Defaults to true; because it is a Lit boolean, `dismissible="false"` is still true — set the property to `false` from script to hide the button. |
|
|
82
|
+
| `position` | `position` | `"top-left" \| "top-center" \| "top-right" \| "bottom-left" \| "bottom-center" \| "bottom-right"` | `"bottom-center"` | Where the toast is anchored: `bottom-center` (default, unchanged from before this prop existed), `bottom-left`, `bottom-right`, `top-left`, `top-center` or `top-right`. Top anchors also animate in from the top edge rather than upward from the bottom. Figma's Toast has axes Content / Show Button / Show Close Button / Tone and no position, so this axis is ours. Reflected. |
|
|
83
|
+
| `size` | `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | `"medium"` | Toast scale: `small`, `medium` (default, unchanged) or `large`. `sm` / `md` / `lg` are alternative spellings and stay supported — normalised to the full words, not deprecated. Scales the padding, the inner gap, the message type role and the close icon. Figma has no Size axis on Toast. Reflected. |
|
|
84
|
+
| `maxVisible` | `max-visible` | `number` | `3` | How many toasts may be on screen at once AT THIS POSITION. Further ones wait their turn rather than being dropped — a notification the user never saw is worse than a late one — and each toast's `duration` only starts once it actually becomes visible, so a queued message cannot expire unseen. Default 3; unbounded stacking just fills the viewport. |
|
|
81
85
|
|
|
82
86
|
#### Deprecated (still supported — removal targeted for 3.0)
|
|
83
87
|
|
|
84
88
|
| Property | Attribute | Type | Use instead |
|
|
85
89
|
| --- | --- | --- | --- |
|
|
86
|
-
| `type` | `type` | `"
|
|
90
|
+
| `type` | `type` | `"neutral" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | Deprecated since 1.4.7 — alias of `tone`; use `tone`. Same values as `tone`; `type="error"` maps to `tone="destructive"` and `type="default"` to `tone="neutral"`. Ignored when `tone` is set. Logs a one-time console notice. |
|
|
87
91
|
|
|
88
92
|
### Public fields / accessors
|
|
89
93
|
|
|
90
94
|
| Name | Type | Description |
|
|
91
95
|
| --- | --- | --- |
|
|
92
|
-
| `resolvedTone` | `ToastTone` | Read-only canonical tone actually rendered: explicit `tone` wins, else `type`, else `"
|
|
96
|
+
| `resolvedTone` | `ToastTone` | Read-only canonical tone actually rendered: explicit `tone` wins, else `type`, else `"neutral"`; deprecated aliases are resolved to `"neutral"` / `"destructive"`. |
|
|
93
97
|
|
|
94
98
|
### Methods
|
|
95
99
|
|
|
@@ -118,7 +122,7 @@ rel-toast { --rel-z-toast: 10000; }
|
|
|
118
122
|
| `base` | The `role="status"` toast container that carries the tone class |
|
|
119
123
|
| `label` | The message text span |
|
|
120
124
|
| `action` | The action button; rendered only when `actionlabel` is set |
|
|
121
|
-
| `close-button` | The dismiss
|
|
125
|
+
| `close-button` | The dismiss button; rendered while `dismissible` is true |
|
|
122
126
|
|
|
123
127
|
## Tokens / CSS Variables
|
|
124
128
|
|
|
@@ -149,7 +153,11 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
149
153
|
## Notes / Edge Cases
|
|
150
154
|
|
|
151
155
|
- `show` is a boolean **property**, not a method: `toast.show()` throws. Use `toast.show = true` or `toast.open()`; the old README's `show()` call was wrong.
|
|
152
|
-
- The host is `position: fixed
|
|
156
|
+
- The host is a full-width `position: fixed` bar (`left: 0; right: 0`) pinned to the edge named by `position`, with `pointer-events: none` (the pill itself restores `pointer-events: all`), so it never blocks clicks around it. The corner positions add a 24px side inset so the toast does not sit flush against the viewport edge; the centred ones keep the full width to centre in, which is why `bottom-center` is unchanged from before the axis existed.
|
|
157
|
+
- Top-anchored toasts animate in from the top edge (`fadeInDown`) rather than sliding upward, which would have read as the toast escaping its own anchor.
|
|
158
|
+
- **Toasts at the same `position` stack automatically.** No wrapper element and no change to your markup: each `rel-toast` registers itself, and up to `max-visible` (default 3) show at once with the newest against the anchor edge. Dismissing one closes the gap for the rest, animated. The six positions are independent stacks, and a toast whose `position` changes while it is showing leaves one and joins the other.
|
|
159
|
+
- **Overflow waits; it is never dropped.** Beyond `max-visible`, further toasts queue in arrival order and appear as earlier ones dismiss. A toast's `duration` does not begin until it is actually on screen, so a queued message cannot expire before anyone has seen it. *Behaviour change*: five toasts at one position used to render on top of each other — now three show and two wait.
|
|
160
|
+
- A single toast is unaffected by any of this: the stack only writes a transform from the second card onward, so a lone toast renders exactly as it did before stacking existed.
|
|
153
161
|
- The auto-dismiss timer starts only when `show` changes to true; changing `duration` on a visible toast does not restart it. Re-showing a visible toast (setting `show = true` again) is a no-op because the value did not change — `close()` it first.
|
|
154
162
|
- `close()` always fires `dismissed`, even when the toast was already hidden.
|
|
155
163
|
- The action button's hover state swaps to `--rel-bg-neutral` / `--rel-text-default` at 75% opacity.
|
|
@@ -60,9 +60,10 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
60
60
|
| Property | Attribute | Type | Default | Description |
|
|
61
61
|
| --- | --- | --- | --- | --- |
|
|
62
62
|
| `text` | `text` | `string` | `""` | Plain-text content of the bubble. Empty text still renders an (empty) bubble on hover, so always set it. |
|
|
63
|
-
| `position` | `position` | `"above" \| "below" \| "left" \| "right"` | `"above"` | Side of the trigger the bubble appears on, 6px away
|
|
63
|
+
| `position` | `position` | `"above" \| "below" \| "left" \| "right"` | `"above"` | Side of the trigger the bubble appears on, centred and 6px away (13px when `show-tail` is set, so the tail clears the trigger; override with `--rel-tooltip-offset`): `above`, `below`, `left` or `right`. No collision detection — pick a side with room in the viewport. |
|
|
64
64
|
| `showTail` | `show-tail` | `boolean` | `false` | Renders the triangular tail (`indicator` part) on the bubble's edge facing the trigger. |
|
|
65
|
-
| `type` | `type` | `"single-line" \| "multi-line"` | `"single-line"` | Figma "Type": `single-line` keeps the text on one line and sizes to content; `multi-line` wraps inside a
|
|
65
|
+
| `type` | `type` | `"single-line" \| "multi-line"` | `"single-line"` | Figma "Type": `single-line` keeps the text on one line and sizes to content; `multi-line` wraps inside a 200px max-width bubble. Reflected. |
|
|
66
|
+
| `tone` | `tone` | `"inverse" \| "neutral"` | `"inverse"` | Bubble appearance: `inverse` (default) is the original inverse-surface bubble, unchanged; `neutral` is a light surface — `--rel-bg-neutral` with `--rel-text-default` and a 1px `--rel-border-default`, tail included. Figma has no such variant; this is a deliberate addition. Reflected. |
|
|
66
67
|
|
|
67
68
|
## Events
|
|
68
69
|
|
|
@@ -83,6 +84,16 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
83
84
|
| `panel` | The tooltip bubble (`role="tooltip"`): background, padding, radius, shadow and max-width. |
|
|
84
85
|
| `indicator` | The triangular tail pointing at the trigger, rendered only when `show-tail` is set. |
|
|
85
86
|
|
|
87
|
+
## Tokens / CSS Variables
|
|
88
|
+
|
|
89
|
+
### Component hooks
|
|
90
|
+
|
|
91
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
92
|
+
|
|
93
|
+
| Custom property | Default | Description |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `--rel-tooltip-offset` | `6px` | Gap between the trigger and the bubble; defaults to `6px`, or `13px` when `show-tail` is set so the tail clears the trigger. |
|
|
96
|
+
|
|
86
97
|
<!-- readme-gen:end -->
|
|
87
98
|
|
|
88
99
|
## Accessibility
|
|
@@ -146,7 +146,7 @@ File upload: `<rel-upload>` renders the dropzone, the format / size hint, the st
|
|
|
146
146
|
|
|
147
147
|
| Part | Description |
|
|
148
148
|
| --- | --- |
|
|
149
|
-
|
|
|
149
|
+
| `browse` | The `rel-button` that opens the file picker (Figma "Browse Button": Size=Medium, Style=Secondary). |
|
|
150
150
|
|
|
151
151
|
### Tokens / CSS Variables
|
|
152
152
|
|
|
@@ -156,7 +156,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
156
156
|
|
|
157
157
|
| Custom property | Default | Description |
|
|
158
158
|
| --- | --- | --- |
|
|
159
|
-
| `--rel-upload-browse-hover-bg` | `
|
|
159
|
+
| `--rel-upload-browse-hover-bg` | `transparent` | Background of the Browse button on hover. Defaults to `transparent`, which is what the underlying `rel-button` secondary style draws (Figma's outline button reacts on its border, not its fill), so this only takes effect when you set it. |
|
|
160
160
|
|
|
161
161
|
### `<rel-upload-actions>`
|
|
162
162
|
|