@kubex/zinc 1.1.20 → 1.1.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/dist/custom-elements.json +97 -75
- package/dist/vscode.html-custom-data.json +12 -12
- package/dist/web-types.json +32 -24
- package/dist/zn.d.ts +6 -1
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +11 -11
- package/docs/pages/components/channel-tile.md +30 -7
- package/package.json +1 -1
- package/scss/shared/_table.scss +0 -4
- package/src/components/channel-tile/channel-tile.component.ts +4 -2
- package/src/components/icon/icon.component.ts +32 -14
- package/src/components/status-indicator/status-indicator.scss +1 -1
|
@@ -7,8 +7,10 @@ layout: component
|
|
|
7
7
|
|
|
8
8
|
The channel tile represents a single slot in a queue or channel rail. It has two faces:
|
|
9
9
|
|
|
10
|
-
- **Active** — the slot is occupied by an in-progress item (header, leading icon, title/subtitle, and a progress/SLA
|
|
11
|
-
|
|
10
|
+
- **Active** — the slot is occupied by an in-progress item (header, leading icon, title/subtitle, and a progress/SLA
|
|
11
|
+
bar).
|
|
12
|
+
- **Available** — the slot is empty and advertising capacity. When `incoming` is set it reserves an arriving item with a
|
|
13
|
+
countdown that can auto-accept.
|
|
12
14
|
|
|
13
15
|
Tiles are designed to sit side by side in a horizontal rail; each is a fixed-width block with a right divider.
|
|
14
16
|
|
|
@@ -31,7 +33,8 @@ Tiles are designed to sit side by side in a horizontal rail; each is a fixed-wid
|
|
|
31
33
|
|
|
32
34
|
### Active Tile
|
|
33
35
|
|
|
34
|
-
The default (occupied) face. Set `header` for the top bar, `icon` + `color` for the leading badge, and `title
|
|
36
|
+
The default (occupied) face. Set `header` for the top bar, `icon` + `color` for the leading badge, and `title`/
|
|
37
|
+
`subtitle` for the item. The `progress` value (0–100) fills the SLA bar along the bottom edge.
|
|
35
38
|
|
|
36
39
|
```html:preview
|
|
37
40
|
<div style="display: flex;">
|
|
@@ -49,7 +52,8 @@ The default (occupied) face. Set `header` for the top bar, `icon` + `color` for
|
|
|
49
52
|
|
|
50
53
|
### Available Tile
|
|
51
54
|
|
|
52
|
-
Set `available` to render the empty face. When `title` is omitted it defaults to "Available". The leading slot shows a
|
|
55
|
+
Set `available` to render the empty face. When `title` is omitted it defaults to "Available". The leading slot shows a
|
|
56
|
+
built-in accept button.
|
|
53
57
|
|
|
54
58
|
```html:preview
|
|
55
59
|
<div style="display: flex;">
|
|
@@ -59,7 +63,8 @@ Set `available` to render the empty face. When `title` is omitted it defaults to
|
|
|
59
63
|
|
|
60
64
|
### Accepting an Item
|
|
61
65
|
|
|
62
|
-
Provide `accept-uri` and the built-in accept button becomes a link to it. When a tile is accepted, a cancelable
|
|
66
|
+
Provide `accept-uri` and the built-in accept button becomes a link to it. When a tile is accepted, a cancelable
|
|
67
|
+
`zn-accept` event fires before the fetch — call `preventDefault()` on it to take over the accept yourself.
|
|
63
68
|
|
|
64
69
|
```html:preview
|
|
65
70
|
<div style="display: flex;">
|
|
@@ -74,7 +79,9 @@ Provide `accept-uri` and the built-in accept button becomes a link to it. When a
|
|
|
74
79
|
|
|
75
80
|
### Incoming with Auto-Accept
|
|
76
81
|
|
|
77
|
-
An `available` tile with `incoming` reserves an arriving item. Provide `reserved-until` (an epoch in seconds or
|
|
82
|
+
An `available` tile with `incoming` reserves an arriving item. Provide `reserved-until` (an epoch in seconds or
|
|
83
|
+
milliseconds marking the end of the window) and `auto-accept-delay` (the window length in milliseconds) to drive the
|
|
84
|
+
countdown overlay. When the window elapses the tile auto-accepts via `accept-uri`.
|
|
78
85
|
|
|
79
86
|
```html:preview
|
|
80
87
|
<div style="display: flex;">
|
|
@@ -118,7 +125,8 @@ Add `rejectable` to an incoming tile to offer a reject control. Pressing it emit
|
|
|
118
125
|
|
|
119
126
|
### Colors
|
|
120
127
|
|
|
121
|
-
The `color` attribute sets the accent (the leading icon badge and the `--channel-tile-color` custom property). Available
|
|
128
|
+
The `color` attribute sets the accent (the leading icon badge and the `--channel-tile-color` custom property). Available
|
|
129
|
+
colors are: `default`, `primary`, `info`, `success`, `warning`, `error`, and `disabled`.
|
|
122
130
|
|
|
123
131
|
```html:preview
|
|
124
132
|
<div style="display: flex; flex-wrap: wrap;">
|
|
@@ -131,6 +139,21 @@ The `color` attribute sets the accent (the leading icon badge and the `--channel
|
|
|
131
139
|
</div>
|
|
132
140
|
```
|
|
133
141
|
|
|
142
|
+
### Custom Title and Subtitle
|
|
143
|
+
|
|
144
|
+
The `title` and `subtitle` attributes cover plain text. For richer content, use the `title` and `subtitle` slots — they
|
|
145
|
+
override the matching attribute (which is used as the fallback when the slot is empty).
|
|
146
|
+
|
|
147
|
+
```html:preview
|
|
148
|
+
<div style="display: flex;">
|
|
149
|
+
<zn-channel-tile header="Acme Support" icon="chat" color="info" progress="60"
|
|
150
|
+
progress-color="rgb(var(--zn-color-info))">
|
|
151
|
+
<span slot="title">Jane <strong>Cooper</strong></span>
|
|
152
|
+
<span slot="subtitle">Billing question · <a href="#">#4821</a></span>
|
|
153
|
+
</zn-channel-tile>
|
|
154
|
+
</div>
|
|
155
|
+
```
|
|
156
|
+
|
|
134
157
|
### Custom Leading Content
|
|
135
158
|
|
|
136
159
|
Use the `leading` slot to replace the leading icon in the active state.
|
package/package.json
CHANGED
package/scss/shared/_table.scss
CHANGED
|
@@ -23,6 +23,8 @@ export type ChannelTileColor =
|
|
|
23
23
|
* Cancelable — call `preventDefault()` to suppress the built-in `accept-uri` fetch.
|
|
24
24
|
* @event zn-reject - Emitted when the reject control is pressed.
|
|
25
25
|
*
|
|
26
|
+
* @slot title - Replaces the primary line. Falls back to the `title` attribute (or "Available" when unset in the available state).
|
|
27
|
+
* @slot subtitle - Replaces the secondary line. Falls back to the `subtitle` attribute.
|
|
26
28
|
* @slot leading - Replaces the leading icon in the active state.
|
|
27
29
|
* @slot action - Action content for the available state (e.g. a form). Falls back to a default accept button.
|
|
28
30
|
* @slot footer - Trailing content (e.g. status badges) in the active state.
|
|
@@ -213,8 +215,8 @@ export default class ZnChannelTile extends ZincElement {
|
|
|
213
215
|
<div class="channel-tile__body">
|
|
214
216
|
${this._renderLeading()}
|
|
215
217
|
<div class="channel-tile__content">
|
|
216
|
-
<h3 class="channel-tile__title">${title}</h3>
|
|
217
|
-
<p class="channel-tile__subtitle">${this.subtitle}</p>
|
|
218
|
+
<h3 class="channel-tile__title"><slot name="title">${title}</slot></h3>
|
|
219
|
+
<p class="channel-tile__subtitle"><slot name="subtitle">${this.subtitle}</slot></p>
|
|
218
220
|
</div>
|
|
219
221
|
<slot name="footer" class="channel-tile__footer"></slot>
|
|
220
222
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {choose} from 'lit/directives/choose.js';
|
|
2
2
|
import {classMap} from "lit/directives/class-map.js";
|
|
3
|
-
import {type CSSResultGroup, html, render, unsafeCSS} from 'lit';
|
|
3
|
+
import {type CSSResultGroup, html, type PropertyValues, render, unsafeCSS} from 'lit';
|
|
4
4
|
import {icons} from 'lucide';
|
|
5
5
|
import {property} from 'lit/decorators.js';
|
|
6
6
|
import {sha256} from '../../utilities/sha256';
|
|
@@ -90,6 +90,8 @@ export default class ZnIcon extends ZincElement {
|
|
|
90
90
|
gravatarOptions = "";
|
|
91
91
|
defaultLibrary: IconLibrary = "material-symbols-outlined";
|
|
92
92
|
|
|
93
|
+
private libraryAutoSet = false;
|
|
94
|
+
|
|
93
95
|
convertToLibrary(input: string): IconLibrary {
|
|
94
96
|
return this.convertIndicatorToLibrary(input) ?? this.defaultLibrary
|
|
95
97
|
}
|
|
@@ -140,6 +142,33 @@ export default class ZnIcon extends ZincElement {
|
|
|
140
142
|
connectedCallback() {
|
|
141
143
|
super.connectedCallback();
|
|
142
144
|
|
|
145
|
+
// load the material icons font if the library is set to material
|
|
146
|
+
render(html`
|
|
147
|
+
<link
|
|
148
|
+
href="https://cdn.jsdelivr.net/gh/kubex/icons@0.0.8/dist/kubex-icons.css"
|
|
149
|
+
rel="stylesheet">
|
|
150
|
+
<link
|
|
151
|
+
href="https://cdn.lineicons.com/5.0/lineicons.css"
|
|
152
|
+
rel="stylesheet">
|
|
153
|
+
<link
|
|
154
|
+
href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined|Material+Icons|Material+Icons+Round|Material+Icons+Sharp|Material+Icons+Two+Tone|Material+Icons+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
|
|
155
|
+
rel="stylesheet">`, document.head);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
protected override willUpdate(changedProperties: PropertyValues<this>) {
|
|
159
|
+
super.willUpdate(changedProperties);
|
|
160
|
+
|
|
161
|
+
if (changedProperties.has('src')) {
|
|
162
|
+
this.parseSrc();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private parseSrc() {
|
|
167
|
+
if (this.libraryAutoSet) {
|
|
168
|
+
this.library = undefined as unknown as IconLibrary;
|
|
169
|
+
this.libraryAutoSet = false;
|
|
170
|
+
}
|
|
171
|
+
|
|
143
172
|
let hashFragment = '';
|
|
144
173
|
|
|
145
174
|
if (this.src && this.src.includes('#')) {
|
|
@@ -157,8 +186,8 @@ export default class ZnIcon extends ZincElement {
|
|
|
157
186
|
if (libraryOrDomain.includes('.')) {
|
|
158
187
|
this.library = this.library ?? "gravatar";
|
|
159
188
|
} else if ((this.library === undefined) && indicatedLibrary !== undefined) {
|
|
160
|
-
// if split[1] is a valid library name, set it
|
|
161
189
|
this.library = indicatedLibrary;
|
|
190
|
+
this.libraryAutoSet = true;
|
|
162
191
|
this.src = this.src.slice(0, atIndex);
|
|
163
192
|
} else if (this.library !== undefined && indicatedLibrary === this.library) {
|
|
164
193
|
this.src = this.src.slice(0, atIndex);
|
|
@@ -173,21 +202,10 @@ export default class ZnIcon extends ZincElement {
|
|
|
173
202
|
} else if (!this.library && this.src && !this.src.includes('/')) {
|
|
174
203
|
this.applyHashFragment(hashFragment);
|
|
175
204
|
this.library = this.defaultLibrary;
|
|
205
|
+
this.libraryAutoSet = true;
|
|
176
206
|
} else {
|
|
177
207
|
this.applyHashFragment(hashFragment);
|
|
178
208
|
}
|
|
179
|
-
|
|
180
|
-
// load the material icons font if the library is set to material
|
|
181
|
-
render(html`
|
|
182
|
-
<link
|
|
183
|
-
href="https://cdn.jsdelivr.net/gh/kubex/icons@0.0.8/dist/kubex-icons.css"
|
|
184
|
-
rel="stylesheet">
|
|
185
|
-
<link
|
|
186
|
-
href="https://cdn.lineicons.com/5.0/lineicons.css"
|
|
187
|
-
rel="stylesheet">
|
|
188
|
-
<link
|
|
189
|
-
href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined|Material+Icons|Material+Icons+Round|Material+Icons+Sharp|Material+Icons+Two+Tone|Material+Icons+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
|
|
190
|
-
rel="stylesheet">`, document.head);
|
|
191
209
|
}
|
|
192
210
|
|
|
193
211
|
private applyHashFragment(hashFragment: string) {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
50% {
|
|
117
117
|
background-color: rgba(var(--indicator-alt-color), 0.8);
|
|
118
118
|
border-color: rgb(var(--indicator-alt-color));
|
|
119
|
-
box-shadow: 0 0
|
|
119
|
+
box-shadow: 0 0 4px 2px rgba(var(--indicator-alt-color), 0.5);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|