@f-ewald/components 0.1.0 → 0.2.0
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/README.md +4 -0
- package/custom-elements.json +497 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/radio-cards.d.ts +32 -0
- package/dist/radio-cards.d.ts.map +1 -0
- package/dist/radio-cards.js +111 -0
- package/dist/radio-cards.js.map +1 -0
- package/dist/radio-pills.d.ts +31 -0
- package/dist/radio-pills.d.ts.map +1 -0
- package/dist/radio-pills.js +100 -0
- package/dist/radio-pills.js.map +1 -0
- package/dist/ui-button.d.ts +34 -0
- package/dist/ui-button.d.ts.map +1 -0
- package/dist/ui-button.js +139 -0
- package/dist/ui-button.js.map +1 -0
- package/dist/user-avatar.d.ts +28 -0
- package/dist/user-avatar.d.ts.map +1 -0
- package/dist/user-avatar.js +95 -0
- package/dist/user-avatar.js.map +1 -0
- package/docs/radio-cards.md +58 -0
- package/docs/radio-pills.md +56 -0
- package/docs/ui-button.md +61 -0
- package/docs/user-avatar.md +42 -0
- package/llms.txt +100 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# `<radio-pills>`
|
|
2
|
+
|
|
3
|
+
Single-select group of compact pill-shaped options — for many short,
|
|
4
|
+
same-shaped choices (a basemap style, a unit toggle). For a handful of
|
|
5
|
+
choices where a description matters, use `radio-cards` instead. Wraps
|
|
6
|
+
native radio inputs for keyboard/a11y and fires `change` rather than
|
|
7
|
+
relying on form submission.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import "@f-ewald/components/radio-pills.js";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<radio-pills></radio-pills>
|
|
19
|
+
<script type="module">
|
|
20
|
+
const el = document.querySelector("radio-pills");
|
|
21
|
+
el.options = [
|
|
22
|
+
{ value: "light", label: "Light" },
|
|
23
|
+
{ value: "streets", label: "Streets" },
|
|
24
|
+
];
|
|
25
|
+
el.value = "light";
|
|
26
|
+
el.addEventListener("change", (e) => console.log(e.detail.value));
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Attributes / properties
|
|
31
|
+
|
|
32
|
+
| Property | Attribute | Type | Default | Description |
|
|
33
|
+
| --- | --- | --- | --- | --- |
|
|
34
|
+
| `options` | _(JS property only)_ | `RadioPillOption[]` | `[]` | Options to render, one pill each. |
|
|
35
|
+
| `value` | `value` | `string` | `""` | Currently selected value. |
|
|
36
|
+
|
|
37
|
+
## Events
|
|
38
|
+
|
|
39
|
+
| Event | Description |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `change` | A pill was selected; detail: { value }. |
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
_None._
|
|
46
|
+
|
|
47
|
+
## CSS custom properties
|
|
48
|
+
|
|
49
|
+
| Custom property |
|
|
50
|
+
| --- |
|
|
51
|
+
| `--ui-border` |
|
|
52
|
+
| `--ui-font` |
|
|
53
|
+
| `--ui-font-size-sm` |
|
|
54
|
+
| `--ui-primary` |
|
|
55
|
+
| `--ui-surface-muted` |
|
|
56
|
+
| `--ui-text` |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# `<ui-button>`
|
|
2
|
+
|
|
3
|
+
Button (or link styled as one) with an optional leading icon, in three
|
|
4
|
+
visual weights. Set `href` to render an `<a>` instead of a `<button>` —
|
|
5
|
+
same styling either way — for cross-page navigation that should look like
|
|
6
|
+
an action button; a disabled/busy link stays a real `<a>` with
|
|
7
|
+
`aria-disabled` + `pointer-events: none` rather than losing its href.
|
|
8
|
+
Put the icon in the `icon` slot and the label in the default slot.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@f-ewald/components/ui-button.js";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<ui-button variant="primary">
|
|
20
|
+
<span slot="icon">...</span>
|
|
21
|
+
New property
|
|
22
|
+
</ui-button>
|
|
23
|
+
<ui-button variant="danger">Delete</ui-button>
|
|
24
|
+
<ui-button variant="secondary" href="/properties?edit=42">Edit</ui-button>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Attributes / properties
|
|
28
|
+
|
|
29
|
+
| Property | Attribute | Type | Default | Description |
|
|
30
|
+
| --- | --- | --- | --- | --- |
|
|
31
|
+
| `variant` | `variant` | `ButtonVariant` | `"primary"` | Visual weight. |
|
|
32
|
+
| `href` | `href` | `string | null` | `null` | Renders an `<a href="...">` instead of a `<button>` when set. |
|
|
33
|
+
| `type` | `type` | `"button" | "submit" | "reset"` | `"button"` | Native button `type`. Ignored when `href` is set. |
|
|
34
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables the control and dims it. |
|
|
35
|
+
| `busy` | `busy` | `boolean` | `false` | Shows a spinner in place of the icon slot and disables the control. |
|
|
36
|
+
|
|
37
|
+
## Events
|
|
38
|
+
|
|
39
|
+
_None._
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `(default)` | Button label. |
|
|
46
|
+
| `icon` | Optional leading icon (e.g. an inline SVG). |
|
|
47
|
+
|
|
48
|
+
## CSS custom properties
|
|
49
|
+
|
|
50
|
+
| Custom property |
|
|
51
|
+
| --- |
|
|
52
|
+
| `--ui-border` |
|
|
53
|
+
| `--ui-danger` |
|
|
54
|
+
| `--ui-danger-hover` |
|
|
55
|
+
| `--ui-font` |
|
|
56
|
+
| `--ui-font-size-sm` |
|
|
57
|
+
| `--ui-primary` |
|
|
58
|
+
| `--ui-primary-hover` |
|
|
59
|
+
| `--ui-radius-sm` |
|
|
60
|
+
| `--ui-text` |
|
|
61
|
+
| `--ui-text-muted` |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# `<user-avatar>`
|
|
2
|
+
|
|
3
|
+
Circular avatar. Shows `src` when it loads successfully; falls back to the
|
|
4
|
+
first letter of `name` (uppercased) if `src` is unset or fails to load
|
|
5
|
+
(e.g. an expired OAuth profile-photo URL); falls back further to a generic
|
|
6
|
+
person icon if `name` is also unset. A broken image never leaves a blank
|
|
7
|
+
circle.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import "@f-ewald/components/user-avatar.js";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<user-avatar src="https://example.com/photo.jpg" name="Freddy" size="40"></user-avatar>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Attributes / properties
|
|
22
|
+
|
|
23
|
+
| Property | Attribute | Type | Default | Description |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| `src` | `src` | `string | null` | `null` | Image URL to show. Falls back to initials/icon if unset or it fails to load. |
|
|
26
|
+
| `name` | `name` | `string | null` | `null` | Source string for the fallback initial (e.g. a display name or email) — first character, uppercased. |
|
|
27
|
+
| `size` | `size` | `number` | `32` | Diameter in CSS pixels. |
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
|
|
31
|
+
_None._
|
|
32
|
+
|
|
33
|
+
## Slots
|
|
34
|
+
|
|
35
|
+
_None._
|
|
36
|
+
|
|
37
|
+
## CSS custom properties
|
|
38
|
+
|
|
39
|
+
| Custom property |
|
|
40
|
+
| --- |
|
|
41
|
+
| `--ui-font` |
|
|
42
|
+
| `--ui-primary` |
|
package/llms.txt
CHANGED
|
@@ -234,6 +234,62 @@ Example:
|
|
|
234
234
|
</script>
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
+
## <radio-cards>
|
|
238
|
+
|
|
239
|
+
Single-select group of full-width cards, each with a label and optional
|
|
240
|
+
description — for a handful of meaningfully different choices where the
|
|
241
|
+
description matters. For many short, same-shaped options (a color swatch,
|
|
242
|
+
a basemap style), use `radio-pills` instead. Wraps native radio inputs for
|
|
243
|
+
keyboard/a11y and fires `change` rather than relying on form submission.
|
|
244
|
+
|
|
245
|
+
Import: `import "@f-ewald/components/radio-cards.js";`
|
|
246
|
+
|
|
247
|
+
Properties: `options` (JS property only) : RadioCardOption[], default []; `value` (attribute `value`) : string, default ""
|
|
248
|
+
Events: `change`
|
|
249
|
+
CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
250
|
+
|
|
251
|
+
Example:
|
|
252
|
+
```html
|
|
253
|
+
<radio-cards></radio-cards>
|
|
254
|
+
<script type="module">
|
|
255
|
+
const el = document.querySelector("radio-cards");
|
|
256
|
+
el.options = [
|
|
257
|
+
{ value: "simple", label: "Simple", description: "Quick-ranking view" },
|
|
258
|
+
{ value: "detailed", label: "Detailed", description: "Every section and layer" },
|
|
259
|
+
];
|
|
260
|
+
el.value = "simple";
|
|
261
|
+
el.addEventListener("change", (e) => console.log(e.detail.value));
|
|
262
|
+
</script>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## <radio-pills>
|
|
266
|
+
|
|
267
|
+
Single-select group of compact pill-shaped options — for many short,
|
|
268
|
+
same-shaped choices (a basemap style, a unit toggle). For a handful of
|
|
269
|
+
choices where a description matters, use `radio-cards` instead. Wraps
|
|
270
|
+
native radio inputs for keyboard/a11y and fires `change` rather than
|
|
271
|
+
relying on form submission.
|
|
272
|
+
|
|
273
|
+
Import: `import "@f-ewald/components/radio-pills.js";`
|
|
274
|
+
|
|
275
|
+
Properties: `options` (JS property only) : RadioPillOption[], default []; `value` (attribute `value`) : string, default ""
|
|
276
|
+
Events: `change`
|
|
277
|
+
CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-surface-muted`, `--ui-text`
|
|
278
|
+
|
|
279
|
+
Example:
|
|
280
|
+
```html
|
|
281
|
+
<radio-pills></radio-pills>
|
|
282
|
+
<script type="module">
|
|
283
|
+
const el = document.querySelector("radio-pills");
|
|
284
|
+
el.options = [
|
|
285
|
+
{ value: "light", label: "Light" },
|
|
286
|
+
{ value: "streets", label: "Streets" },
|
|
287
|
+
];
|
|
288
|
+
el.value = "light";
|
|
289
|
+
el.addEventListener("change", (e) => console.log(e.detail.value));
|
|
290
|
+
</script>
|
|
291
|
+
```
|
|
292
|
+
|
|
237
293
|
## <relative-time>
|
|
238
294
|
|
|
239
295
|
Inline relative-time display (e.g. "3 hours ago"). Accepts either a
|
|
@@ -333,6 +389,50 @@ Example:
|
|
|
333
389
|
</script>
|
|
334
390
|
```
|
|
335
391
|
|
|
392
|
+
## <ui-button>
|
|
393
|
+
|
|
394
|
+
Button (or link styled as one) with an optional leading icon, in three
|
|
395
|
+
visual weights. Set `href` to render an `<a>` instead of a `<button>` —
|
|
396
|
+
same styling either way — for cross-page navigation that should look like
|
|
397
|
+
an action button; a disabled/busy link stays a real `<a>` with
|
|
398
|
+
`aria-disabled` + `pointer-events: none` rather than losing its href.
|
|
399
|
+
Put the icon in the `icon` slot and the label in the default slot.
|
|
400
|
+
|
|
401
|
+
Import: `import "@f-ewald/components/ui-button.js";`
|
|
402
|
+
|
|
403
|
+
Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
|
|
404
|
+
Events: none
|
|
405
|
+
CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-danger-hover`, `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
|
|
406
|
+
|
|
407
|
+
Example:
|
|
408
|
+
```html
|
|
409
|
+
<ui-button variant="primary">
|
|
410
|
+
<span slot="icon">...</span>
|
|
411
|
+
New property
|
|
412
|
+
</ui-button>
|
|
413
|
+
<ui-button variant="danger">Delete</ui-button>
|
|
414
|
+
<ui-button variant="secondary" href="/properties?edit=42">Edit</ui-button>
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## <user-avatar>
|
|
418
|
+
|
|
419
|
+
Circular avatar. Shows `src` when it loads successfully; falls back to the
|
|
420
|
+
first letter of `name` (uppercased) if `src` is unset or fails to load
|
|
421
|
+
(e.g. an expired OAuth profile-photo URL); falls back further to a generic
|
|
422
|
+
person icon if `name` is also unset. A broken image never leaves a blank
|
|
423
|
+
circle.
|
|
424
|
+
|
|
425
|
+
Import: `import "@f-ewald/components/user-avatar.js";`
|
|
426
|
+
|
|
427
|
+
Properties: `src` (attribute `src`) : string | null, default null; `name` (attribute `name`) : string | null, default null; `size` (attribute `size`) : number, default 32
|
|
428
|
+
Events: none
|
|
429
|
+
CSS custom properties: `--ui-font`, `--ui-primary`
|
|
430
|
+
|
|
431
|
+
Example:
|
|
432
|
+
```html
|
|
433
|
+
<user-avatar src="https://example.com/photo.jpg" name="Freddy" size="40"></user-avatar>
|
|
434
|
+
```
|
|
435
|
+
|
|
336
436
|
## <weight-bar-chart>
|
|
337
437
|
|
|
338
438
|
Sorted horizontal bar chart of labeled weights (normalized fractions
|