@kubex/zinc 1.1.97 → 1.1.98
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/chunks/zn.R2EAU6OS.js +1 -0
- package/dist/custom-elements.json +1422 -61
- package/dist/vscode.html-custom-data.json +188 -2
- package/dist/web-types.json +462 -5
- package/dist/zn.d.ts +326 -2
- package/dist/zn.min.js +582 -457
- package/docs/pages/components/button.md +11 -1
- package/docs/pages/components/chart.md +165 -3
- package/docs/pages/components/icon-picker.md +8 -0
- package/docs/pages/components/thumbnail-group.md +216 -0
- package/docs/pages/components/thumbnail.md +349 -0
- package/docs/pages/components/well.md +34 -0
- package/package.json +1 -1
- package/src/components/button/button.component.ts +8 -0
- package/src/components/chart/builders.test.ts +190 -1
- package/src/components/chart/builders.ts +246 -4
- package/src/components/chart/chart.component.ts +33 -1
- package/src/components/chart/chart.test.ts +66 -1
- package/src/components/chart/echarts-loader.ts +10 -0
- package/src/components/collapsible/collapsible.component.ts +49 -4
- package/src/components/collapsible/collapsible.scss +33 -14
- package/src/components/header/header.scss +1 -1
- package/src/components/icon-picker/icon-picker.component.ts +3 -0
- package/src/components/icon-picker/lucide-icons.ts +1756 -0
- package/src/components/page/page.scss +1 -1
- package/src/components/remarkd-editor/remarkd-editor.test.ts +39 -0
- package/src/components/split-pane/split-pane.scss +21 -15
- package/src/components/thumbnail/index.ts +12 -0
- package/src/components/thumbnail/thumbnail.component.ts +460 -0
- package/src/components/thumbnail/thumbnail.scss +360 -0
- package/src/components/thumbnail/thumbnail.test.ts +379 -0
- package/src/components/thumbnail-group/index.ts +12 -0
- package/src/components/thumbnail-group/thumbnail-group.component.ts +268 -0
- package/src/components/thumbnail-group/thumbnail-group.scss +87 -0
- package/src/components/thumbnail-group/thumbnail-group.test.ts +151 -0
- package/src/components/well/well.component.ts +22 -4
- package/src/components/well/well.scss +24 -0
- package/src/components/well/well.test.ts +43 -0
- package/src/zinc.ts +2 -0
|
@@ -117,6 +117,15 @@ Buttons can be used with just an icon and no text by omitting the button label.
|
|
|
117
117
|
<zn-button icon="add" color="info"></zn-button>
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
An icon-only button has no text for assistive technology to read, so give it a name
|
|
121
|
+
with the `label` attribute. A `tooltip` is used as the name when no `label` is set,
|
|
122
|
+
which covers most icon-only buttons without extra markup.
|
|
123
|
+
|
|
124
|
+
```html:preview
|
|
125
|
+
<zn-button icon="settings" label="Settings"></zn-button>
|
|
126
|
+
<zn-button icon="delete" color="error" tooltip="Delete"></zn-button>
|
|
127
|
+
```
|
|
128
|
+
|
|
120
129
|
### Icon Buttons
|
|
121
130
|
|
|
122
131
|
Use `icon-button` to render a chromed icon button: a 40x36 white button with a border, a 6px radius, and a centred 20px icon. Pass `small` for the 36x36 variant or `round` for a 36x36 circle on the tab tint. The icon button style takes precedence over color variants like `secondary` — the `color` attribute only tints the icon.
|
|
@@ -216,7 +225,8 @@ Use `muted-notifications` for a subtle notification style.
|
|
|
216
225
|
|
|
217
226
|
### Tooltip
|
|
218
227
|
|
|
219
|
-
Use the `tooltip` attribute to add a tooltip to the button.
|
|
228
|
+
Use the `tooltip` attribute to add a tooltip to the button. On a button with no text,
|
|
229
|
+
the tooltip also becomes the accessible name — see [Icon-Only Buttons](#icon-only-buttons).
|
|
220
230
|
|
|
221
231
|
```html:preview
|
|
222
232
|
<zn-button icon="info" tooltip="This button provides additional information"></zn-button>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Data Chart
|
|
4
|
-
description: Charts visualize data using
|
|
4
|
+
description: Charts visualize data using line, bar, area, circular, statistical, hierarchical, and flow layouts powered by Apache ECharts.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -281,6 +281,135 @@ Use `type="sankey"` to render a Sankey flow diagram. Each item in the series `da
|
|
|
281
281
|
</zn-chart>
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
+
### Pie Chart
|
|
285
|
+
|
|
286
|
+
Use `type="pie"` for part-to-whole data. The first series supplies the slice values and `categories` supplies their
|
|
287
|
+
names.
|
|
288
|
+
|
|
289
|
+
```html:preview
|
|
290
|
+
<zn-chart
|
|
291
|
+
type="pie"
|
|
292
|
+
categories="["Configuration suggestion","Insecure configuration"]"
|
|
293
|
+
data="[{"name":"Insights","data":[8,1]}]"
|
|
294
|
+
height="300">
|
|
295
|
+
</zn-chart>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Donut Chart
|
|
299
|
+
|
|
300
|
+
Use `type="donut"` for a pie chart with a hollow centre. Adjust the ring with `inner-radius` and `outer-radius`; both
|
|
301
|
+
accept an ECharts pixel value or percentage. Add `show-labels` to render labels beside the slices.
|
|
302
|
+
|
|
303
|
+
```html:preview
|
|
304
|
+
<zn-chart
|
|
305
|
+
type="donut"
|
|
306
|
+
inner-radius="45%"
|
|
307
|
+
outer-radius="75%"
|
|
308
|
+
colors="["#ffe29a","#f78ab3"]"
|
|
309
|
+
categories="["Configuration suggestion","Insecure configuration"]"
|
|
310
|
+
data="[{"name":"Insights","data":[8,1]}]"
|
|
311
|
+
height="300">
|
|
312
|
+
</zn-chart>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Scatter Chart
|
|
316
|
+
|
|
317
|
+
Use `type="scatter"` with `[x, y]` coordinate pairs. `d-size` controls point size, and `xaxis="datetime"` can be used
|
|
318
|
+
for time-based scatter plots.
|
|
319
|
+
|
|
320
|
+
```html:preview
|
|
321
|
+
<zn-chart
|
|
322
|
+
type="scatter"
|
|
323
|
+
d-size="14"
|
|
324
|
+
data="[{"name":"Latency","data":[[12,110],[24,180],[38,140],[52,260],[70,220]]}]"
|
|
325
|
+
height="300">
|
|
326
|
+
</zn-chart>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Radar Chart
|
|
330
|
+
|
|
331
|
+
Use `type="radar"` with an `indicators` array describing each axis. Each normal series becomes one radar shape.
|
|
332
|
+
|
|
333
|
+
```html:preview
|
|
334
|
+
<zn-chart
|
|
335
|
+
type="radar"
|
|
336
|
+
indicators="[{"name":"Security","max":100},{"name":"Performance","max":100},{"name":"Reliability","max":100},{"name":"Usability","max":100}]"
|
|
337
|
+
data="[{"name":"Current","data":[82,71,94,76]},{"name":"Target","data":[95,90,98,90]}]"
|
|
338
|
+
height="320">
|
|
339
|
+
</zn-chart>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Gauge Chart
|
|
343
|
+
|
|
344
|
+
Use `type="gauge"` for a single current value. `min-value`, `max-value`, and `y-axis-append` configure its range and
|
|
345
|
+
displayed unit.
|
|
346
|
+
|
|
347
|
+
```html:preview
|
|
348
|
+
<zn-chart
|
|
349
|
+
type="gauge"
|
|
350
|
+
min-value="0"
|
|
351
|
+
max-value="100"
|
|
352
|
+
y-axis-append="%"
|
|
353
|
+
data="[{"name":"Security score","data":[82]}]"
|
|
354
|
+
height="300">
|
|
355
|
+
</zn-chart>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Funnel Chart
|
|
359
|
+
|
|
360
|
+
Use `type="funnel"` for ordered stages. Numeric values pair with `categories`, using the same compact format as pie
|
|
361
|
+
charts.
|
|
362
|
+
|
|
363
|
+
```html:preview
|
|
364
|
+
<zn-chart
|
|
365
|
+
type="funnel"
|
|
366
|
+
categories="["Visitors","Trials","Customers"]"
|
|
367
|
+
data="[{"name":"Conversion","data":[1000,320,85]}]"
|
|
368
|
+
height="320">
|
|
369
|
+
</zn-chart>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Heatmap Chart
|
|
373
|
+
|
|
374
|
+
Use `type="heatmap"` with x-axis `categories`, `y-categories`, and `[xIndex, yIndex, value]` data points. The visual
|
|
375
|
+
range is derived from the values unless `min-value` or `max-value` is provided.
|
|
376
|
+
|
|
377
|
+
```html:preview
|
|
378
|
+
<zn-chart
|
|
379
|
+
type="heatmap"
|
|
380
|
+
show-labels
|
|
381
|
+
categories="["Mon","Tue","Wed","Thu","Fri"]"
|
|
382
|
+
y-categories="["API","Web","Worker"]"
|
|
383
|
+
data="[{"name":"Requests","data":[[0,0,5],[1,0,12],[2,0,8],[3,0,16],[4,0,11],[0,1,9],[1,1,15],[2,1,12],[3,1,20],[4,1,14],[0,2,3],[1,2,7],[2,2,5],[3,2,10],[4,2,8]]}]"
|
|
384
|
+
height="320">
|
|
385
|
+
</zn-chart>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Treemap Chart
|
|
389
|
+
|
|
390
|
+
Use `type="treemap"` with hierarchical `children` data to compare nested values by area.
|
|
391
|
+
|
|
392
|
+
```html:preview
|
|
393
|
+
<zn-chart
|
|
394
|
+
type="treemap"
|
|
395
|
+
data="[{"name":"Insights","data":[{"name":"Security","children":[{"name":"Configuration","value":8},{"name":"Insecure","value":1}]},{"name":"Performance","value":4}]}]"
|
|
396
|
+
height="320">
|
|
397
|
+
</zn-chart>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Sunburst Chart
|
|
401
|
+
|
|
402
|
+
Use `type="sunburst"` for radial hierarchical data. `inner-radius` and `outer-radius` adjust the occupied area.
|
|
403
|
+
|
|
404
|
+
```html:preview
|
|
405
|
+
<zn-chart
|
|
406
|
+
type="sunburst"
|
|
407
|
+
outer-radius="90%"
|
|
408
|
+
data="[{"name":"Insights","data":[{"name":"Security","children":[{"name":"Configuration","value":8},{"name":"Insecure","value":1}]},{"name":"Performance","children":[{"name":"Latency","value":4}]}]}]"
|
|
409
|
+
height="340">
|
|
410
|
+
</zn-chart>
|
|
411
|
+
```
|
|
412
|
+
|
|
284
413
|
### Cross-Chart Tooltip Sync
|
|
285
414
|
|
|
286
415
|
Use `sync-group="<id>"` on two or more charts to synchronise hover tooltips, zoom, and legend selection across them.
|
|
@@ -439,6 +568,32 @@ When `type="sankey"`, each item in the series `data` array is an edge:
|
|
|
439
568
|
|
|
440
569
|
Nodes are auto-derived from unique source/target values. To customise node appearance or ordering, include an explicit `nodes` key on the series object.
|
|
441
570
|
|
|
571
|
+
### Pie and Donut Data
|
|
572
|
+
|
|
573
|
+
Pie and donut charts use the first series. The standard numeric format pairs each value with the category at the same
|
|
574
|
+
index. You can alternatively pass ECharts-style named slices when each slice needs its own metadata or colour:
|
|
575
|
+
|
|
576
|
+
```json
|
|
577
|
+
[{
|
|
578
|
+
"name": "Insights",
|
|
579
|
+
"data": [
|
|
580
|
+
{"name": "Configuration suggestion", "value": 8, "color": "#ffe29a"},
|
|
581
|
+
{"name": "Insecure configuration", "value": 1, "color": "#f78ab3"}
|
|
582
|
+
]
|
|
583
|
+
}]
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### Specialized Data Formats
|
|
587
|
+
|
|
588
|
+
- Scatter points use `[x, y]` or `{ "x": value, "y": value }`.
|
|
589
|
+
- Radar charts accept an `indicators` array of `{ "name": string, "min"?: number, "max"?: number }`; each series
|
|
590
|
+
contains one value per indicator.
|
|
591
|
+
- Gauge charts use the first value in the first series.
|
|
592
|
+
- Funnel charts accept the same numeric/category or named-value formats as pie charts.
|
|
593
|
+
- Heatmaps use `[xIndex, yIndex, value]` points with `categories` and `y-categories`.
|
|
594
|
+
- Treemaps and sunbursts accept hierarchical nodes containing `name`, optional `value`, and optional recursive
|
|
595
|
+
`children`.
|
|
596
|
+
|
|
442
597
|
### HTML Encoding
|
|
443
598
|
|
|
444
599
|
When using the data attribute in HTML, JSON must be properly encoded. Use `"` for quotes:
|
|
@@ -483,6 +638,15 @@ chart.enableAnimations = true;
|
|
|
483
638
|
- **Line Charts**: Best for showing trends over time or continuous data
|
|
484
639
|
- **Bar Charts**: Ideal for comparing discrete categories or values
|
|
485
640
|
- **Area Charts**: Good for showing cumulative totals or part-to-whole relationships over time
|
|
641
|
+
- **Pie Charts**: Useful for compact part-to-whole comparisons with a small number of slices
|
|
642
|
+
- **Donut Charts**: Useful when a pie chart needs a lighter visual weight or centred annotation space
|
|
643
|
+
- **Scatter Charts**: Show relationships, distributions, and clusters between two numeric dimensions
|
|
644
|
+
- **Radar Charts**: Compare a small number of entities across a shared set of metrics
|
|
645
|
+
- **Gauge Charts**: Display one value against a meaningful bounded range
|
|
646
|
+
- **Funnel Charts**: Show progressive reduction through ordered stages
|
|
647
|
+
- **Heatmaps**: Reveal density and patterns across two categorical dimensions
|
|
648
|
+
- **Treemaps**: Compare hierarchical values by area
|
|
649
|
+
- **Sunburst Charts**: Explore hierarchical proportions across radial levels
|
|
486
650
|
- **Stacked Charts**: Use when showing how categories contribute to a total
|
|
487
651
|
|
|
488
652
|
### Performance Considerations
|
|
@@ -505,5 +669,3 @@ chart.enableAnimations = true;
|
|
|
505
669
|
- Round values appropriately for readability
|
|
506
670
|
- Use `y-axis-append` to add units or symbols to values
|
|
507
671
|
- Format dates consistently when using time series data
|
|
508
|
-
|
|
509
|
-
|
|
@@ -71,6 +71,14 @@ Use the `line` library for Lineicons.
|
|
|
71
71
|
<zn-icon-picker name="line" label="Line Icon" icon="heart" library="line"></zn-icon-picker>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
### Lucide Icons
|
|
75
|
+
|
|
76
|
+
Use the `lucide` library for [Lucide](https://lucide.dev/icons) icons, rendered as inline SVGs. Icon names use kebab-case.
|
|
77
|
+
|
|
78
|
+
```html:preview
|
|
79
|
+
<zn-icon-picker name="lucide" label="Lucide Icon" icon="rocket" library="lucide"></zn-icon-picker>
|
|
80
|
+
```
|
|
81
|
+
|
|
74
82
|
### Gravatar
|
|
75
83
|
|
|
76
84
|
Use the `gravatar` library to display a Gravatar from an email address.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Thumbnail Group
|
|
4
|
+
description: Lays a set of thumbnails out as a single scrollable row, with a Show All toggle that expands them into a wrapping grid.
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
A thumbnail group holds [thumbnails](/components/thumbnail) in one horizontally scrollable row. When they don't all fit,
|
|
9
|
+
a **Show All** toggle appears in the header; expanding drops the single-row restriction and reflows everything into a
|
|
10
|
+
wrapping grid. **Show Less** rolls it back to the row.
|
|
11
|
+
|
|
12
|
+
```html:preview
|
|
13
|
+
<zn-thumbnail-group caption="Landscape">
|
|
14
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day" icon="play_arrow"></zn-thumbnail>
|
|
15
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise" icon="play_arrow"></zn-thumbnail>
|
|
16
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon" icon="play_arrow"></zn-thumbnail>
|
|
17
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&q=60" caption="Goa Beaches" icon="play_arrow"></zn-thumbnail>
|
|
18
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&q=60" caption="Big Sur" icon="play_arrow"></zn-thumbnail>
|
|
19
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=600&q=60" caption="Yosemite Valley" icon="play_arrow"></zn-thumbnail>
|
|
20
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=600&q=60" caption="Hallstatt" icon="play_arrow"></zn-thumbnail>
|
|
21
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=600&q=60" caption="Falls" icon="play_arrow"></zn-thumbnail>
|
|
22
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=600&q=60" caption="Rolling Hills" icon="play_arrow"></zn-thumbnail>
|
|
23
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1444927714506-8492d94b4e3d?w=600&q=60" caption="Coastline" icon="play_arrow"></zn-thumbnail>
|
|
24
|
+
</zn-thumbnail-group>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The toggle is only rendered when it's needed — a group whose thumbnails already fit shows no toggle at all.
|
|
28
|
+
|
|
29
|
+
```html:preview
|
|
30
|
+
<zn-thumbnail-group caption="Fits on one row">
|
|
31
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
32
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
33
|
+
</zn-thumbnail-group>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Thumbnail Size and Shape
|
|
39
|
+
|
|
40
|
+
`thumbnail-width` sets the row's track width and, when expanded, the minimum column width the grid packs against.
|
|
41
|
+
`gap` sets the spacing between thumbnails, and `aspect-ratio` reshapes every thumbnail in the group.
|
|
42
|
+
|
|
43
|
+
```html:preview
|
|
44
|
+
<zn-thumbnail-group caption="Square, compact" thumbnail-width="120px" gap="8px" aspect-ratio="1 / 1">
|
|
45
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
46
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
47
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon"></zn-thumbnail>
|
|
48
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&q=60" caption="Goa Beaches"></zn-thumbnail>
|
|
49
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&q=60" caption="Big Sur"></zn-thumbnail>
|
|
50
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=600&q=60" caption="Yosemite Valley"></zn-thumbnail>
|
|
51
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=600&q=60" caption="Hallstatt"></zn-thumbnail>
|
|
52
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=600&q=60" caption="Falls"></zn-thumbnail>
|
|
53
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=600&q=60" caption="Rolling Hills"></zn-thumbnail>
|
|
54
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1444927714506-8492d94b4e3d?w=600&q=60" caption="Coastline"></zn-thumbnail>
|
|
55
|
+
</zn-thumbnail-group>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Those three attributes are shorthand for `--zn-thumbnail-width`, `--zn-thumbnail-gap` and
|
|
59
|
+
`--zn-thumbnail-aspect-ratio`, which you can set on the group directly instead. Because
|
|
60
|
+
[thumbnail](/components/thumbnail)'s custom properties all inherit, **any** of them — chip colours, corner radii,
|
|
61
|
+
preview sizing — can be set once on the group and will apply to every thumbnail in it.
|
|
62
|
+
|
|
63
|
+
```html:preview
|
|
64
|
+
<zn-thumbnail-group
|
|
65
|
+
caption="Restyled from the group"
|
|
66
|
+
style="--zn-thumbnail-width: 120px;
|
|
67
|
+
--zn-thumbnail-gap: 8px;
|
|
68
|
+
--zn-thumbnail-radius: 16px;
|
|
69
|
+
--zn-thumbnail-chip-background: rgb(var(--zn-primary));
|
|
70
|
+
--zn-thumbnail-selected-color: rgb(var(--zn-color-warning));">
|
|
71
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day" icon="play_arrow" selected></zn-thumbnail>
|
|
72
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise" icon="play_arrow"></zn-thumbnail>
|
|
73
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon" icon="play_arrow"></zn-thumbnail>
|
|
74
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&q=60" caption="Goa Beaches" icon="play_arrow"></zn-thumbnail>
|
|
75
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&q=60" caption="Big Sur" icon="play_arrow"></zn-thumbnail>
|
|
76
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=600&q=60" caption="Yosemite Valley" icon="play_arrow"></zn-thumbnail>
|
|
77
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=600&q=60" caption="Hallstatt" icon="play_arrow"></zn-thumbnail>
|
|
78
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=600&q=60" caption="Falls" icon="play_arrow"></zn-thumbnail>
|
|
79
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=600&q=60" caption="Rolling Hills" icon="play_arrow"></zn-thumbnail>
|
|
80
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1444927714506-8492d94b4e3d?w=600&q=60" caption="Coastline" icon="play_arrow"></zn-thumbnail>
|
|
81
|
+
</zn-thumbnail-group>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Preview
|
|
85
|
+
|
|
86
|
+
Give the thumbnails a `full-uri` and clicking one opens a full-screen preview that grows out of its position in the
|
|
87
|
+
row. The preview opens in the browser's top layer, so it escapes the scrolling row instead of being clipped by it. See
|
|
88
|
+
[thumbnail](/components/thumbnail#preview) for the trigger options.
|
|
89
|
+
|
|
90
|
+
```html:preview
|
|
91
|
+
<zn-thumbnail-group caption="Landscape">
|
|
92
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=400&q=50" full-uri="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=2000&q=80" caption="Tahoe Day" icon="play_arrow"></zn-thumbnail>
|
|
93
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=400&q=50" full-uri="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=2000&q=80" caption="Sequoia Sunrise" icon="play_arrow"></zn-thumbnail>
|
|
94
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=400&q=50" full-uri="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=2000&q=80" caption="Sonoma Horizon" icon="play_arrow"></zn-thumbnail>
|
|
95
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=400&q=50" full-uri="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=2000&q=80" caption="Goa Beaches" icon="play_arrow"></zn-thumbnail>
|
|
96
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&q=50" full-uri="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=2000&q=80" caption="Big Sur" icon="play_arrow"></zn-thumbnail>
|
|
97
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=400&q=50" full-uri="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2000&q=80" caption="Yosemite Valley" icon="play_arrow"></zn-thumbnail>
|
|
98
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=400&q=50" full-uri="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=2000&q=80" caption="Hallstatt" icon="play_arrow"></zn-thumbnail>
|
|
99
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=400&q=50" full-uri="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=2000&q=80" caption="Falls" icon="play_arrow"></zn-thumbnail>
|
|
100
|
+
</zn-thumbnail-group>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Selection
|
|
104
|
+
|
|
105
|
+
Add `selectable` and the group tracks a single selection for you: clicking a thumbnail moves the accent ring, updates
|
|
106
|
+
the group's `value`, and emits `zn-change`. A thumbnail marked `selected` in markup becomes the starting value.
|
|
107
|
+
|
|
108
|
+
```html:preview
|
|
109
|
+
<zn-thumbnail-group caption="Pick a still" selectable>
|
|
110
|
+
<zn-thumbnail value="tahoe" src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day" selected></zn-thumbnail>
|
|
111
|
+
<zn-thumbnail value="sequoia" src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
112
|
+
<zn-thumbnail value="sonoma" src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon"></zn-thumbnail>
|
|
113
|
+
<zn-thumbnail value="goa" src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&q=60" caption="Goa Beaches"></zn-thumbnail>
|
|
114
|
+
</zn-thumbnail-group>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Counting a Larger Set
|
|
118
|
+
|
|
119
|
+
When the row only holds the first page of a much larger set, set `total` so the toggle advertises the real size. The
|
|
120
|
+
toggle appears whenever `total` exceeds the number of slotted thumbnails, even if those all fit. Listen for `zn-expand`
|
|
121
|
+
to fetch and append the rest.
|
|
122
|
+
|
|
123
|
+
```html:preview
|
|
124
|
+
<zn-thumbnail-group caption="Landscape" total="79" id="thumbnail-group-lazy">
|
|
125
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
126
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
127
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon"></zn-thumbnail>
|
|
128
|
+
</zn-thumbnail-group>
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
const group = document.getElementById('thumbnail-group-lazy');
|
|
132
|
+
|
|
133
|
+
group.addEventListener('zn-expand', () => {
|
|
134
|
+
// Load the rest of the set the first time the group is expanded.
|
|
135
|
+
if (group.dataset.loaded) return;
|
|
136
|
+
group.dataset.loaded = 'true';
|
|
137
|
+
|
|
138
|
+
for (let i = 4; i <= group.total; i++) {
|
|
139
|
+
const thumbnail = document.createElement('zn-thumbnail');
|
|
140
|
+
thumbnail.caption = `Landscape ${i}`;
|
|
141
|
+
thumbnail.src = `https://picsum.photos/seed/landscape-${i}/480/270`;
|
|
142
|
+
group.append(thumbnail);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
</script>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Custom Labels
|
|
149
|
+
|
|
150
|
+
Override `show-all-label` and `show-less-label` for wording that suits the content. The count is appended to the
|
|
151
|
+
expand label in brackets.
|
|
152
|
+
|
|
153
|
+
```html:preview
|
|
154
|
+
<zn-thumbnail-group
|
|
155
|
+
caption="Recordings"
|
|
156
|
+
total="24"
|
|
157
|
+
show-all-label="Browse all recordings"
|
|
158
|
+
show-less-label="Collapse">
|
|
159
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
160
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
161
|
+
</zn-thumbnail-group>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Header Actions
|
|
165
|
+
|
|
166
|
+
The `actions` slot sits in the header before the toggle.
|
|
167
|
+
|
|
168
|
+
```html:preview
|
|
169
|
+
<zn-thumbnail-group caption="Cityscape" total="41">
|
|
170
|
+
<zn-button slot="actions" outline icon="upload">Upload</zn-button>
|
|
171
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1512453979798-5ea266f8880c?w=600&q=60" caption="Dubai Skyline" icon="play_arrow"></zn-thumbnail>
|
|
172
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1518684079-3c830dcef090?w=600&q=60" caption="Dubai at Night" icon="play_arrow"></zn-thumbnail>
|
|
173
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1546412414-e1885259563a?w=600&q=60" caption="Dubai Creek" icon="play_arrow"></zn-thumbnail>
|
|
174
|
+
</zn-thumbnail-group>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Always Showing the Toggle
|
|
178
|
+
|
|
179
|
+
`always-toggle` keeps the toggle on screen even when everything already fits — useful when the row is one of several
|
|
180
|
+
sibling groups and you want the headers to line up. `hide-toggle` does the opposite and suppresses it entirely,
|
|
181
|
+
leaving a plain scrolling row.
|
|
182
|
+
|
|
183
|
+
```html:preview
|
|
184
|
+
<zn-thumbnail-group caption="Always" always-toggle>
|
|
185
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
186
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
187
|
+
</zn-thumbnail-group>
|
|
188
|
+
|
|
189
|
+
<zn-thumbnail-group caption="Never" hide-toggle>
|
|
190
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1439066615861-d1af74d74000?w=600&q=60" caption="Tahoe Day"></zn-thumbnail>
|
|
191
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&q=60" caption="Sequoia Sunrise"></zn-thumbnail>
|
|
192
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=60" caption="Sonoma Horizon"></zn-thumbnail>
|
|
193
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&q=60" caption="Goa Beaches"></zn-thumbnail>
|
|
194
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&q=60" caption="Big Sur"></zn-thumbnail>
|
|
195
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=600&q=60" caption="Yosemite Valley"></zn-thumbnail>
|
|
196
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=600&q=60" caption="Hallstatt"></zn-thumbnail>
|
|
197
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1433086966358-54859d0ed716?w=600&q=60" caption="Falls"></zn-thumbnail>
|
|
198
|
+
</zn-thumbnail-group>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Starting Expanded
|
|
202
|
+
|
|
203
|
+
Set `expanded` to open the grid on first paint, or call `show()` / `hide()` to drive it from script.
|
|
204
|
+
|
|
205
|
+
```html:preview
|
|
206
|
+
<zn-thumbnail-group caption="Cityscape" expanded>
|
|
207
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1512453979798-5ea266f8880c?w=600&q=60" caption="Dubai Skyline" icon="play_arrow"></zn-thumbnail>
|
|
208
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1518684079-3c830dcef090?w=600&q=60" caption="Dubai at Night" icon="play_arrow"></zn-thumbnail>
|
|
209
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1546412414-e1885259563a?w=600&q=60" caption="Dubai Creek" icon="play_arrow"></zn-thumbnail>
|
|
210
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1502920917128-1aa500764cbd?w=600&q=60" caption="Dubai from Above" icon="play_arrow"></zn-thumbnail>
|
|
211
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1449824913935-59a10b8d2000?w=600&q=60" caption="Los Angeles Flyover" icon="play_arrow"></zn-thumbnail>
|
|
212
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1534190760961-74e8c1b5c3da?w=600&q=60" caption="Los Angeles Beach" icon="play_arrow"></zn-thumbnail>
|
|
213
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1444723121867-7a241cacace9?w=600&q=60" caption="Los Angeles at Night" icon="play_arrow"></zn-thumbnail>
|
|
214
|
+
<zn-thumbnail src="https://images.unsplash.com/photo-1513635269975-59663e0ac1ad?w=600&q=60" caption="London Evening" icon="play_arrow"></zn-thumbnail>
|
|
215
|
+
</zn-thumbnail-group>
|
|
216
|
+
```
|