@deepfuture/dui-templates 1.0.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.
Files changed (50) hide show
  1. package/README.md +214 -0
  2. package/all.d.ts +10 -0
  3. package/all.js +20 -0
  4. package/content/briefing-block.d.ts +36 -0
  5. package/content/briefing-block.js +281 -0
  6. package/content/empty-state.d.ts +24 -0
  7. package/content/empty-state.js +187 -0
  8. package/content/index.d.ts +5 -0
  9. package/content/index.js +5 -0
  10. package/content/numbered-insight.d.ts +30 -0
  11. package/content/numbered-insight.js +242 -0
  12. package/dashboard/index.d.ts +5 -0
  13. package/dashboard/index.js +5 -0
  14. package/dashboard/page-header.d.ts +29 -0
  15. package/dashboard/page-header.js +218 -0
  16. package/dashboard/section-panel.d.ts +41 -0
  17. package/dashboard/section-panel.js +393 -0
  18. package/data/index.d.ts +5 -0
  19. package/data/index.js +4 -0
  20. package/data/key-value.d.ts +27 -0
  21. package/data/key-value.js +165 -0
  22. package/data/market-table.d.ts +40 -0
  23. package/data/market-table.js +270 -0
  24. package/feed/activity-item.d.ts +35 -0
  25. package/feed/activity-item.js +278 -0
  26. package/feed/feed-item.d.ts +32 -0
  27. package/feed/feed-item.js +260 -0
  28. package/feed/headline-item.d.ts +27 -0
  29. package/feed/headline-item.js +187 -0
  30. package/feed/index.d.ts +6 -0
  31. package/feed/index.js +6 -0
  32. package/feed/social-post.d.ts +31 -0
  33. package/feed/social-post.js +268 -0
  34. package/media/avatar-row.d.ts +31 -0
  35. package/media/avatar-row.js +164 -0
  36. package/media/index.d.ts +7 -0
  37. package/media/index.js +5 -0
  38. package/media/media-grid.d.ts +32 -0
  39. package/media/media-grid.js +199 -0
  40. package/metrics/index.d.ts +6 -0
  41. package/metrics/index.js +6 -0
  42. package/metrics/progress-bar.d.ts +31 -0
  43. package/metrics/progress-bar.js +212 -0
  44. package/metrics/risk-gauge.d.ts +31 -0
  45. package/metrics/risk-gauge.js +289 -0
  46. package/metrics/score-item.d.ts +33 -0
  47. package/metrics/score-item.js +253 -0
  48. package/metrics/stat-card.d.ts +29 -0
  49. package/metrics/stat-card.js +230 -0
  50. package/package.json +61 -0
@@ -0,0 +1,164 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { css, html, LitElement } from "lit";
36
+ import { property } from "lit/decorators.js";
37
+ import { base } from "@deepfuture/dui-core/base";
38
+ import "@deepfuture/dui-components/avatar";
39
+ import "@deepfuture/dui-components/scroll-area";
40
+ const styles = css `
41
+ :host {
42
+ display: block;
43
+ }
44
+
45
+ .row {
46
+ display: flex;
47
+ gap: var(--space-4);
48
+ padding: var(--space-1) var(--space-0_5);
49
+ }
50
+
51
+ .item {
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ gap: var(--space-1_5);
56
+ flex-shrink: 0;
57
+ min-width: 0;
58
+ }
59
+
60
+ .item dui-avatar {
61
+ --avatar-size: var(--avatar-row-size, 3rem);
62
+ }
63
+
64
+ .label {
65
+ font-family: var(--font-sans);
66
+ font-size: var(--text-xs);
67
+ font-weight: var(--font-weight-medium);
68
+ letter-spacing: var(--letter-spacing-wide);
69
+ line-height: var(--line-height-none);
70
+ color: var(--text-2);
71
+ text-align: center;
72
+ max-width: calc(var(--avatar-row-size, 3rem) + var(--space-4));
73
+ overflow: hidden;
74
+ text-overflow: ellipsis;
75
+ white-space: nowrap;
76
+ }
77
+
78
+ .empty {
79
+ padding: var(--space-4);
80
+ text-align: center;
81
+ color: var(--text-3);
82
+ font-family: var(--font-sans);
83
+ font-size: var(--text-sm);
84
+ }
85
+ `;
86
+ /**
87
+ * `<dui-avatar-row>` — A horizontal scrollable row of circular avatars with labels.
88
+ *
89
+ * Ideal for displaying teams, participants, agents, or any list of people/entities
90
+ * in a compact horizontal strip. Scrolls horizontally when items overflow.
91
+ *
92
+ * @slot actions - Optional trailing action (e.g. an "Add" button).
93
+ * @csspart row - The flex container holding avatar items.
94
+ */
95
+ let DuiAvatarRow = (() => {
96
+ let _classSuper = LitElement;
97
+ let _data_decorators;
98
+ let _data_initializers = [];
99
+ let _data_extraInitializers = [];
100
+ let _emptyText_decorators;
101
+ let _emptyText_initializers = [];
102
+ let _emptyText_extraInitializers = [];
103
+ return class DuiAvatarRow extends _classSuper {
104
+ static {
105
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
106
+ _data_decorators = [property({ type: Array })];
107
+ _emptyText_decorators = [property({ attribute: "empty-text" })];
108
+ __esDecorate(this, null, _data_decorators, { kind: "accessor", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
109
+ __esDecorate(this, null, _emptyText_decorators, { kind: "accessor", name: "emptyText", static: false, private: false, access: { has: obj => "emptyText" in obj, get: obj => obj.emptyText, set: (obj, value) => { obj.emptyText = value; } }, metadata: _metadata }, _emptyText_initializers, _emptyText_extraInitializers);
110
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
111
+ }
112
+ static tagName = "dui-avatar-row";
113
+ static styles = [base, styles];
114
+ #data_accessor_storage = __runInitializers(this, _data_initializers, []);
115
+ /** Array of avatar items to display. */
116
+ get data() { return this.#data_accessor_storage; }
117
+ set data(value) { this.#data_accessor_storage = value; }
118
+ #emptyText_accessor_storage = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _emptyText_initializers, "No items"));
119
+ /** Text shown when data is empty. */
120
+ get emptyText() { return this.#emptyText_accessor_storage; }
121
+ set emptyText(value) { this.#emptyText_accessor_storage = value; }
122
+ /** Extract 1–2 character initials from a name. */
123
+ #initials(name) {
124
+ const parts = name.trim().split(/\s+/);
125
+ if (parts.length === 1)
126
+ return parts[0].charAt(0).toUpperCase();
127
+ return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
128
+ }
129
+ /** Toggle hidden on slot wrapper when slotted content changes. */
130
+ #onSlotChange(e) {
131
+ const slot = e.target;
132
+ slot.parentElement.hidden = slot.assignedElements().length === 0;
133
+ }
134
+ render() {
135
+ if (this.data.length === 0) {
136
+ return html `<div class="empty">${this.emptyText}</div>`;
137
+ }
138
+ return html `
139
+ <dui-scroll-area orientation="horizontal">
140
+ <div class="row" part="row">
141
+ ${this.data.map((item) => html `
142
+ <div class="item">
143
+ <dui-avatar
144
+ .src=${item.src ?? undefined}
145
+ alt=${item.name}
146
+ >${this.#initials(item.name)}</dui-avatar>
147
+ <span class="label">${item.label ?? item.name}</span>
148
+ </div>
149
+ `)}
150
+ <div hidden>
151
+ <slot name="actions" @slotchange=${this.#onSlotChange}></slot>
152
+ </div>
153
+ </div>
154
+ </dui-scroll-area>
155
+ `;
156
+ }
157
+ constructor() {
158
+ super(...arguments);
159
+ __runInitializers(this, _emptyText_extraInitializers);
160
+ }
161
+ };
162
+ })();
163
+ export { DuiAvatarRow };
164
+ customElements.define(DuiAvatarRow.tagName, DuiAvatarRow);
@@ -0,0 +1,7 @@
1
+ import { DuiAvatarRow } from "./avatar-row.js";
2
+ import { DuiMediaGrid } from "./media-grid.js";
3
+ export { DuiAvatarRow } from "./avatar-row.js";
4
+ export { DuiMediaGrid } from "./media-grid.js";
5
+ export type { AvatarItem } from "./avatar-row.js";
6
+ export type { MediaItem } from "./media-grid.js";
7
+ export declare const mediaFamily: (typeof DuiAvatarRow | typeof DuiMediaGrid)[];
package/media/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { DuiAvatarRow } from "./avatar-row.js";
2
+ import { DuiMediaGrid } from "./media-grid.js";
3
+ export { DuiAvatarRow } from "./avatar-row.js";
4
+ export { DuiMediaGrid } from "./media-grid.js";
5
+ export const mediaFamily = [DuiAvatarRow, DuiMediaGrid];
@@ -0,0 +1,32 @@
1
+ import { LitElement, type TemplateResult } from "lit";
2
+ import "@deepfuture/dui-components/badge";
3
+ /** A single media item in the grid. */
4
+ export interface MediaItem {
5
+ /** Image or video thumbnail URL. */
6
+ src: string;
7
+ /** Alt text for accessibility. */
8
+ alt?: string;
9
+ /** Optional label overlay (e.g. location name, camera ID). */
10
+ label?: string;
11
+ /** Optional timestamp overlay (e.g. "2 min ago", "14:23 UTC"). */
12
+ timestamp?: string;
13
+ }
14
+ /**
15
+ * `<dui-media-grid>` — A responsive grid of image/video thumbnails with label overlays.
16
+ *
17
+ * Ideal for camera feeds, location galleries, media libraries, or any visual monitoring
18
+ * grid. Each cell shows a thumbnail image with an optional label and timestamp overlay.
19
+ *
20
+ * @slot actions - Optional action buttons below the grid.
21
+ * @csspart grid - The CSS grid container.
22
+ */
23
+ export declare class DuiMediaGrid extends LitElement {
24
+ #private;
25
+ static tagName: "dui-media-grid";
26
+ static styles: import("lit").CSSResult[];
27
+ /** Array of media items to display. */
28
+ accessor data: MediaItem[];
29
+ /** Text shown when data is empty. */
30
+ accessor emptyText: string;
31
+ render(): TemplateResult;
32
+ }
@@ -0,0 +1,199 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { css, html, LitElement, nothing } from "lit";
36
+ import { property } from "lit/decorators.js";
37
+ import { base } from "@deepfuture/dui-core/base";
38
+ import "@deepfuture/dui-components/badge";
39
+ const styles = css `
40
+ :host {
41
+ display: block;
42
+ }
43
+
44
+ .grid {
45
+ display: grid;
46
+ grid-template-columns: repeat(
47
+ auto-fill,
48
+ minmax(var(--media-grid-min-width, 10rem), 1fr)
49
+ );
50
+ gap: var(--space-3);
51
+ }
52
+
53
+ .cell {
54
+ position: relative;
55
+ border-radius: var(--radius-md);
56
+ overflow: hidden;
57
+ background: var(--sunken-2);
58
+ aspect-ratio: 16 / 10;
59
+ }
60
+
61
+ .cell img {
62
+ display: block;
63
+ width: 100%;
64
+ height: 100%;
65
+ object-fit: cover;
66
+ transition: transform var(--duration-normal) ease;
67
+ }
68
+
69
+ .cell:hover img {
70
+ transform: scale(1.03);
71
+ }
72
+
73
+ .overlay {
74
+ position: absolute;
75
+ inset: auto 0 0 0;
76
+ display: flex;
77
+ align-items: flex-end;
78
+ justify-content: space-between;
79
+ gap: var(--space-1_5);
80
+ padding: var(--space-2) var(--space-2_5);
81
+ background: linear-gradient(to top, oklch(0 0 0 / 0.55), transparent);
82
+ pointer-events: none;
83
+ }
84
+
85
+ .overlay-label {
86
+ font-family: var(--font-sans);
87
+ font-size: var(--text-xs);
88
+ font-weight: var(--font-weight-medium);
89
+ letter-spacing: var(--letter-spacing-wide);
90
+ line-height: var(--line-height-none);
91
+ color: white;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ min-width: 0;
96
+ }
97
+
98
+ .overlay-timestamp {
99
+ font-family: var(--font-sans);
100
+ font-size: var(--text-2xs);
101
+ color: oklch(1 0 0 / 0.7);
102
+ white-space: nowrap;
103
+ flex-shrink: 0;
104
+ }
105
+
106
+ .empty {
107
+ padding: var(--space-6) var(--space-4);
108
+ text-align: center;
109
+ color: var(--text-3);
110
+ font-family: var(--font-sans);
111
+ font-size: var(--text-sm);
112
+ }
113
+
114
+ .actions[hidden] {
115
+ display: none;
116
+ }
117
+ `;
118
+ /**
119
+ * `<dui-media-grid>` — A responsive grid of image/video thumbnails with label overlays.
120
+ *
121
+ * Ideal for camera feeds, location galleries, media libraries, or any visual monitoring
122
+ * grid. Each cell shows a thumbnail image with an optional label and timestamp overlay.
123
+ *
124
+ * @slot actions - Optional action buttons below the grid.
125
+ * @csspart grid - The CSS grid container.
126
+ */
127
+ let DuiMediaGrid = (() => {
128
+ let _classSuper = LitElement;
129
+ let _data_decorators;
130
+ let _data_initializers = [];
131
+ let _data_extraInitializers = [];
132
+ let _emptyText_decorators;
133
+ let _emptyText_initializers = [];
134
+ let _emptyText_extraInitializers = [];
135
+ return class DuiMediaGrid extends _classSuper {
136
+ static {
137
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
138
+ _data_decorators = [property({ type: Array })];
139
+ _emptyText_decorators = [property({ attribute: "empty-text" })];
140
+ __esDecorate(this, null, _data_decorators, { kind: "accessor", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
141
+ __esDecorate(this, null, _emptyText_decorators, { kind: "accessor", name: "emptyText", static: false, private: false, access: { has: obj => "emptyText" in obj, get: obj => obj.emptyText, set: (obj, value) => { obj.emptyText = value; } }, metadata: _metadata }, _emptyText_initializers, _emptyText_extraInitializers);
142
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
143
+ }
144
+ static tagName = "dui-media-grid";
145
+ static styles = [base, styles];
146
+ #data_accessor_storage = __runInitializers(this, _data_initializers, []);
147
+ /** Array of media items to display. */
148
+ get data() { return this.#data_accessor_storage; }
149
+ set data(value) { this.#data_accessor_storage = value; }
150
+ #emptyText_accessor_storage = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _emptyText_initializers, "No media"));
151
+ /** Text shown when data is empty. */
152
+ get emptyText() { return this.#emptyText_accessor_storage; }
153
+ set emptyText(value) { this.#emptyText_accessor_storage = value; }
154
+ /** Toggle hidden on slot wrapper when slotted content changes. */
155
+ #onSlotChange(e) {
156
+ const slot = e.target;
157
+ slot.parentElement.hidden = slot.assignedElements().length === 0;
158
+ }
159
+ render() {
160
+ if (this.data.length === 0) {
161
+ return html `<div class="empty">${this.emptyText}</div>`;
162
+ }
163
+ return html `
164
+ <div class="grid" part="grid">
165
+ ${this.data.map((item) => html `
166
+ <div class="cell">
167
+ <img
168
+ src=${item.src}
169
+ alt=${item.alt ?? item.label ?? ""}
170
+ loading="lazy"
171
+ />
172
+ ${item.label || item.timestamp
173
+ ? html `
174
+ <div class="overlay">
175
+ ${item.label
176
+ ? html `<span class="overlay-label">${item.label}</span>`
177
+ : nothing}
178
+ ${item.timestamp
179
+ ? html `<time class="overlay-timestamp">${item.timestamp}</time>`
180
+ : nothing}
181
+ </div>
182
+ `
183
+ : nothing}
184
+ </div>
185
+ `)}
186
+ </div>
187
+ <div class="actions" hidden>
188
+ <slot name="actions" @slotchange=${this.#onSlotChange}></slot>
189
+ </div>
190
+ `;
191
+ }
192
+ constructor() {
193
+ super(...arguments);
194
+ __runInitializers(this, _emptyText_extraInitializers);
195
+ }
196
+ };
197
+ })();
198
+ export { DuiMediaGrid };
199
+ customElements.define(DuiMediaGrid.tagName, DuiMediaGrid);
@@ -0,0 +1,6 @@
1
+ import { DuiStatCard } from "./stat-card.js";
2
+ import { DuiScoreItem } from "./score-item.js";
3
+ import { DuiRiskGauge } from "./risk-gauge.js";
4
+ import { DuiProgressBar } from "./progress-bar.js";
5
+ export { DuiStatCard, DuiScoreItem, DuiRiskGauge, DuiProgressBar };
6
+ export declare const metricsFamily: (typeof DuiStatCard | typeof DuiScoreItem | typeof DuiRiskGauge | typeof DuiProgressBar)[];
@@ -0,0 +1,6 @@
1
+ import { DuiStatCard } from "./stat-card.js";
2
+ import { DuiScoreItem } from "./score-item.js";
3
+ import { DuiRiskGauge } from "./risk-gauge.js";
4
+ import { DuiProgressBar } from "./progress-bar.js";
5
+ export { DuiStatCard, DuiScoreItem, DuiRiskGauge, DuiProgressBar };
6
+ export const metricsFamily = [DuiStatCard, DuiScoreItem, DuiRiskGauge, DuiProgressBar];
@@ -0,0 +1,31 @@
1
+ import { LitElement, type TemplateResult } from "lit";
2
+ import "@deepfuture/dui-components/progress";
3
+ /**
4
+ * `<dui-progress-bar>` — A labeled capacity/completion indicator with a progress bar.
5
+ *
6
+ * Wraps `<dui-progress>` with a label row showing the metric name and value.
7
+ * Supports a description for extra context.
8
+ *
9
+ * @slot actions - Optional action buttons or links.
10
+ * @csspart article - The outer container.
11
+ * @csspart label - The metric label.
12
+ * @csspart value - The value/percentage text.
13
+ * @csspart progress - The progress bar element.
14
+ * @csspart description - The description text.
15
+ */
16
+ export declare class DuiProgressBar extends LitElement {
17
+ #private;
18
+ static tagName: "dui-progress-bar";
19
+ static styles: import("lit").CSSResult[];
20
+ /** Metric label (e.g. "CPU Usage", "Storage", "Quota"). */
21
+ accessor label: string;
22
+ /** Current value (0–max). */
23
+ accessor value: number;
24
+ /** Maximum value. */
25
+ accessor max: number;
26
+ /** Custom display text (e.g. "12.4 GB / 50 GB"). Overrides auto percentage. */
27
+ accessor valueText: string;
28
+ /** Supporting description text. */
29
+ accessor description: string;
30
+ render(): TemplateResult;
31
+ }
@@ -0,0 +1,212 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { css, html, LitElement, nothing } from "lit";
36
+ import { property } from "lit/decorators.js";
37
+ import { base } from "@deepfuture/dui-core/base";
38
+ import "@deepfuture/dui-components/progress";
39
+ const styles = css `
40
+ :host {
41
+ display: block;
42
+ }
43
+
44
+ article {
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: var(--space-1_5);
48
+ padding: var(--space-3);
49
+ border: var(--border-width-thin) solid var(--border);
50
+ border-radius: var(--radius-md);
51
+ background: var(--surface-1);
52
+ }
53
+
54
+ /* ── Top row: label + value ── */
55
+ .top {
56
+ display: flex;
57
+ align-items: baseline;
58
+ justify-content: space-between;
59
+ gap: var(--space-1_5);
60
+ }
61
+
62
+ .label {
63
+ font-family: var(--font-sans);
64
+ font-size: var(--text-sm);
65
+ font-weight: var(--font-weight-medium);
66
+ letter-spacing: var(--letter-spacing-wide);
67
+ line-height: var(--line-height-snug);
68
+ color: var(--foreground);
69
+ min-width: 0;
70
+ white-space: nowrap;
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ }
74
+
75
+ .value-text {
76
+ font-size: var(--text-sm);
77
+ font-weight: var(--font-weight-semibold);
78
+ letter-spacing: var(--letter-spacing-normal);
79
+ line-height: var(--line-height-snug);
80
+ color: var(--text-2);
81
+ flex-shrink: 0;
82
+ }
83
+
84
+ /* ── Description ── */
85
+ .description {
86
+ font-family: var(--font-sans);
87
+ font-size: var(--text-xs);
88
+ letter-spacing: var(--letter-spacing-wide);
89
+ line-height: var(--line-height-normal);
90
+ color: var(--text-2);
91
+ margin: 0;
92
+ }
93
+
94
+ /* ── Actions ── */
95
+ .actions {
96
+ display: flex;
97
+ align-items: center;
98
+ gap: var(--space-2);
99
+ padding-top: var(--space-1);
100
+ }
101
+
102
+ .actions[hidden] {
103
+ display: none;
104
+ }
105
+ `;
106
+ /**
107
+ * `<dui-progress-bar>` — A labeled capacity/completion indicator with a progress bar.
108
+ *
109
+ * Wraps `<dui-progress>` with a label row showing the metric name and value.
110
+ * Supports a description for extra context.
111
+ *
112
+ * @slot actions - Optional action buttons or links.
113
+ * @csspart article - The outer container.
114
+ * @csspart label - The metric label.
115
+ * @csspart value - The value/percentage text.
116
+ * @csspart progress - The progress bar element.
117
+ * @csspart description - The description text.
118
+ */
119
+ let DuiProgressBar = (() => {
120
+ let _classSuper = LitElement;
121
+ let _label_decorators;
122
+ let _label_initializers = [];
123
+ let _label_extraInitializers = [];
124
+ let _value_decorators;
125
+ let _value_initializers = [];
126
+ let _value_extraInitializers = [];
127
+ let _max_decorators;
128
+ let _max_initializers = [];
129
+ let _max_extraInitializers = [];
130
+ let _valueText_decorators;
131
+ let _valueText_initializers = [];
132
+ let _valueText_extraInitializers = [];
133
+ let _description_decorators;
134
+ let _description_initializers = [];
135
+ let _description_extraInitializers = [];
136
+ return class DuiProgressBar extends _classSuper {
137
+ static {
138
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
139
+ _label_decorators = [property()];
140
+ _value_decorators = [property({ type: Number })];
141
+ _max_decorators = [property({ type: Number })];
142
+ _valueText_decorators = [property({ attribute: "value-text" })];
143
+ _description_decorators = [property()];
144
+ __esDecorate(this, null, _label_decorators, { kind: "accessor", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
145
+ __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
146
+ __esDecorate(this, null, _max_decorators, { kind: "accessor", name: "max", static: false, private: false, access: { has: obj => "max" in obj, get: obj => obj.max, set: (obj, value) => { obj.max = value; } }, metadata: _metadata }, _max_initializers, _max_extraInitializers);
147
+ __esDecorate(this, null, _valueText_decorators, { kind: "accessor", name: "valueText", static: false, private: false, access: { has: obj => "valueText" in obj, get: obj => obj.valueText, set: (obj, value) => { obj.valueText = value; } }, metadata: _metadata }, _valueText_initializers, _valueText_extraInitializers);
148
+ __esDecorate(this, null, _description_decorators, { kind: "accessor", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
149
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
150
+ }
151
+ static tagName = "dui-progress-bar";
152
+ static styles = [base, styles];
153
+ #label_accessor_storage = __runInitializers(this, _label_initializers, "");
154
+ /** Metric label (e.g. "CPU Usage", "Storage", "Quota"). */
155
+ get label() { return this.#label_accessor_storage; }
156
+ set label(value) { this.#label_accessor_storage = value; }
157
+ #value_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _value_initializers, 0));
158
+ /** Current value (0–max). */
159
+ get value() { return this.#value_accessor_storage; }
160
+ set value(value) { this.#value_accessor_storage = value; }
161
+ #max_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _max_initializers, 100));
162
+ /** Maximum value. */
163
+ get max() { return this.#max_accessor_storage; }
164
+ set max(value) { this.#max_accessor_storage = value; }
165
+ #valueText_accessor_storage = (__runInitializers(this, _max_extraInitializers), __runInitializers(this, _valueText_initializers, ""));
166
+ /** Custom display text (e.g. "12.4 GB / 50 GB"). Overrides auto percentage. */
167
+ get valueText() { return this.#valueText_accessor_storage; }
168
+ set valueText(value) { this.#valueText_accessor_storage = value; }
169
+ #description_accessor_storage = (__runInitializers(this, _valueText_extraInitializers), __runInitializers(this, _description_initializers, ""));
170
+ /** Supporting description text. */
171
+ get description() { return this.#description_accessor_storage; }
172
+ set description(value) { this.#description_accessor_storage = value; }
173
+ #onSlotChange(e) {
174
+ const slot = e.target;
175
+ slot.parentElement.hidden = slot.assignedElements().length === 0;
176
+ }
177
+ render() {
178
+ const pct = this.max > 0 ? Math.round((this.value / this.max) * 100) : 0;
179
+ const displayText = this.valueText || `${pct}%`;
180
+ return html `
181
+ <article part="article">
182
+ <div class="top">
183
+ ${this.label
184
+ ? html `<span class="label" part="label">${this.label}</span>`
185
+ : nothing}
186
+ <span class="value-text" part="value">${displayText}</span>
187
+ </div>
188
+
189
+ <dui-progress
190
+ part="progress"
191
+ .value=${this.value}
192
+ .max=${this.max}
193
+ ></dui-progress>
194
+
195
+ ${this.description
196
+ ? html `<p class="description" part="description">${this.description}</p>`
197
+ : nothing}
198
+
199
+ <div class="actions" hidden>
200
+ <slot name="actions" @slotchange=${this.#onSlotChange}></slot>
201
+ </div>
202
+ </article>
203
+ `;
204
+ }
205
+ constructor() {
206
+ super(...arguments);
207
+ __runInitializers(this, _description_extraInitializers);
208
+ }
209
+ };
210
+ })();
211
+ export { DuiProgressBar };
212
+ customElements.define(DuiProgressBar.tagName, DuiProgressBar);