terminoir 0.13.0 → 0.13.1
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 +1 -1
- package/dist/components/Chip.svelte +21 -2
- package/dist/components/Chip.svelte.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ Import from **`terminoir`**:
|
|
|
122
122
|
|-----------|--------|
|
|
123
123
|
| `Button`, `IconButton` | Variants: primary, secondary, ghost, destructive, outline · sizes sm/md/lg · `Button href` renders a link |
|
|
124
124
|
| `Input`, `Textarea`, `Select`, `Checkbox`, `Switch` | `hideLabel` (screen-reader only), `hint`, `error`, `quiet` (borderless until hover/focus, for inline property editing); `Input` `width` for toolbar fields |
|
|
125
|
-
| `Chip`, `Badge` | Status tones; `Chip` `color` dot, `onclick`, removable `onremove` |
|
|
125
|
+
| `Chip`, `Badge` | Status tones; `Chip` `color` dot, `onclick`, removable `onremove`, on/off toggle `pressed` (filters) |
|
|
126
126
|
| `StatusChip` | On/off status: green dot + `activeLabel`, or muted `inactiveLabel` (defaults Connected / Not connected) |
|
|
127
127
|
| `Card`, `CardGrid` | Accent tint, badge, chips, progress, meta, hover lift; `CardGrid columns={2\|3\|4}` fixes the column count on wide screens (one column on phones), also for `Panel`s |
|
|
128
128
|
| `Panel` | Glass panel surface |
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
onremove,
|
|
11
11
|
removeLabel = 'Remove',
|
|
12
12
|
onclick,
|
|
13
|
+
pressed,
|
|
13
14
|
class: className = '',
|
|
14
15
|
children,
|
|
15
16
|
...rest
|
|
@@ -23,6 +24,8 @@
|
|
|
23
24
|
removeLabel?: string;
|
|
24
25
|
/** Makes the chip text a button (e.g. open the linked item). */
|
|
25
26
|
onclick?: (event: MouseEvent) => void;
|
|
27
|
+
/** Makes the chip an on/off toggle (with `onclick`), e.g. a filter. Off chips are muted with a hollow dot. */
|
|
28
|
+
pressed?: boolean;
|
|
26
29
|
class?: string;
|
|
27
30
|
children?: import('svelte').Snippet;
|
|
28
31
|
} & Record<string, unknown> = $props();
|
|
@@ -36,13 +39,19 @@
|
|
|
36
39
|
tone === 'overdue' && 'terminoir-card__chip--overdue',
|
|
37
40
|
tone === 'today' && 'terminoir-card__chip--today',
|
|
38
41
|
tone === 'done' && 'terminoir-card__chip--done',
|
|
42
|
+
pressed === false && 'terminoir-chip--off',
|
|
39
43
|
className,
|
|
40
44
|
)}
|
|
41
45
|
{...rest}
|
|
42
46
|
>
|
|
43
|
-
{#if dot}<span
|
|
47
|
+
{#if dot}<span
|
|
48
|
+
class="terminoir-chip__dot"
|
|
49
|
+
style:background={pressed === false ? 'transparent' : dot}
|
|
50
|
+
style:box-shadow={pressed === false ? `inset 0 0 0 1.5px ${dot}` : undefined}
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
></span>{/if}
|
|
44
53
|
{#if onclick}
|
|
45
|
-
<button type="button" class="terminoir-chip__label terminoir-focusable" {onclick}>{@render children?.()}</button>
|
|
54
|
+
<button type="button" class="terminoir-chip__label terminoir-focusable" aria-pressed={pressed} {onclick}>{@render children?.()}</button>
|
|
46
55
|
{:else}
|
|
47
56
|
<span class="terminoir-chip__label">{@render children?.()}</span>
|
|
48
57
|
{/if}
|
|
@@ -85,6 +94,16 @@
|
|
|
85
94
|
cursor: pointer;
|
|
86
95
|
}
|
|
87
96
|
button.terminoir-chip__label:hover { text-decoration: underline; }
|
|
97
|
+
button.terminoir-chip__label[aria-pressed]:hover { text-decoration: none; }
|
|
98
|
+
.terminoir-chip:has(button[aria-pressed]):hover {
|
|
99
|
+
border-color: color-mix(in srgb, var(--foreground) 28%, transparent);
|
|
100
|
+
}
|
|
101
|
+
.terminoir-chip--off { color: var(--muted-foreground); }
|
|
102
|
+
.terminoir-chip--off:not(.terminoir-card__chip--overdue):not(.terminoir-card__chip--today):not(.terminoir-card__chip--done) {
|
|
103
|
+
background: transparent;
|
|
104
|
+
border-style: dashed;
|
|
105
|
+
}
|
|
106
|
+
|
|
88
107
|
.terminoir-chip__remove {
|
|
89
108
|
display: inline-flex;
|
|
90
109
|
align-items: center;
|
|
@@ -9,6 +9,8 @@ type $$ComponentProps = {
|
|
|
9
9
|
removeLabel?: string;
|
|
10
10
|
/** Makes the chip text a button (e.g. open the linked item). */
|
|
11
11
|
onclick?: (event: MouseEvent) => void;
|
|
12
|
+
/** Makes the chip an on/off toggle (with `onclick`), e.g. a filter. Off chips are muted with a hollow dot. */
|
|
13
|
+
pressed?: boolean;
|
|
12
14
|
class?: string;
|
|
13
15
|
children?: import('svelte').Snippet;
|
|
14
16
|
} & Record<string, unknown>;
|