@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.
- package/README.md +214 -0
- package/all.d.ts +10 -0
- package/all.js +20 -0
- package/content/briefing-block.d.ts +36 -0
- package/content/briefing-block.js +281 -0
- package/content/empty-state.d.ts +24 -0
- package/content/empty-state.js +187 -0
- package/content/index.d.ts +5 -0
- package/content/index.js +5 -0
- package/content/numbered-insight.d.ts +30 -0
- package/content/numbered-insight.js +242 -0
- package/dashboard/index.d.ts +5 -0
- package/dashboard/index.js +5 -0
- package/dashboard/page-header.d.ts +29 -0
- package/dashboard/page-header.js +218 -0
- package/dashboard/section-panel.d.ts +41 -0
- package/dashboard/section-panel.js +393 -0
- package/data/index.d.ts +5 -0
- package/data/index.js +4 -0
- package/data/key-value.d.ts +27 -0
- package/data/key-value.js +165 -0
- package/data/market-table.d.ts +40 -0
- package/data/market-table.js +270 -0
- package/feed/activity-item.d.ts +35 -0
- package/feed/activity-item.js +278 -0
- package/feed/feed-item.d.ts +32 -0
- package/feed/feed-item.js +260 -0
- package/feed/headline-item.d.ts +27 -0
- package/feed/headline-item.js +187 -0
- package/feed/index.d.ts +6 -0
- package/feed/index.js +6 -0
- package/feed/social-post.d.ts +31 -0
- package/feed/social-post.js +268 -0
- package/media/avatar-row.d.ts +31 -0
- package/media/avatar-row.js +164 -0
- package/media/index.d.ts +7 -0
- package/media/index.js +5 -0
- package/media/media-grid.d.ts +32 -0
- package/media/media-grid.js +199 -0
- package/metrics/index.d.ts +6 -0
- package/metrics/index.js +6 -0
- package/metrics/progress-bar.d.ts +31 -0
- package/metrics/progress-bar.js +212 -0
- package/metrics/risk-gauge.d.ts +31 -0
- package/metrics/risk-gauge.js +289 -0
- package/metrics/score-item.d.ts +33 -0
- package/metrics/score-item.js +253 -0
- package/metrics/stat-card.d.ts +29 -0
- package/metrics/stat-card.js +230 -0
- package/package.json +61 -0
|
@@ -0,0 +1,230 @@
|
|
|
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/icon";
|
|
39
|
+
/** Map trend direction to color tokens and arrow SVG paths. */
|
|
40
|
+
const TREND_CONFIG = {
|
|
41
|
+
up: {
|
|
42
|
+
color: "var(--accent-text)",
|
|
43
|
+
path: "M12 19V5M5 12l7-7 7 7",
|
|
44
|
+
},
|
|
45
|
+
down: {
|
|
46
|
+
color: "var(--destructive-text)",
|
|
47
|
+
path: "M12 5v14M19 12l-7 7-7-7",
|
|
48
|
+
},
|
|
49
|
+
stable: {
|
|
50
|
+
color: "var(--text-3)",
|
|
51
|
+
path: "M5 12h14",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const styles = css `
|
|
55
|
+
:host {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
article {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: none;
|
|
63
|
+
padding: var(--space-3);
|
|
64
|
+
border: var(--border-width-thin) solid var(--border);
|
|
65
|
+
border-radius: var(--radius-md);
|
|
66
|
+
background: var(--surface-1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.label {
|
|
70
|
+
font-family: var(--font-sans);
|
|
71
|
+
font-size: var(--text-xs);
|
|
72
|
+
font-weight: var(--font-weight-medium);
|
|
73
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
74
|
+
line-height: var(--line-height-normal);
|
|
75
|
+
color: var(--text-2);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.value-row {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.value {
|
|
85
|
+
font-family: var(--font-sans);
|
|
86
|
+
font-size: var(--text-2xl);
|
|
87
|
+
font-weight: var(--font-weight-semibold);
|
|
88
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
89
|
+
line-height: var(--line-height-tight);
|
|
90
|
+
color: var(--foreground);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.trend {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--space-0_5);
|
|
97
|
+
font-family: var(--font-sans);
|
|
98
|
+
font-size: var(--text-xs);
|
|
99
|
+
font-weight: var(--font-weight-medium);
|
|
100
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
101
|
+
line-height: var(--line-height-normal);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.description {
|
|
105
|
+
font-family: var(--font-sans);
|
|
106
|
+
font-size: var(--text-xs);
|
|
107
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
108
|
+
line-height: var(--line-height-normal);
|
|
109
|
+
color: var(--text-3);
|
|
110
|
+
margin: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.actions {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: var(--space-2);
|
|
117
|
+
padding-top: var(--space-2);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.actions[hidden] {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
/**
|
|
125
|
+
* `<dui-stat-card>` — A single metric card displaying a label, prominent value,
|
|
126
|
+
* optional trend indicator, and description text.
|
|
127
|
+
*
|
|
128
|
+
* @slot actions - Optional action buttons or links.
|
|
129
|
+
* @csspart article - The outer container.
|
|
130
|
+
* @csspart label - The metric label.
|
|
131
|
+
* @csspart value - The metric value.
|
|
132
|
+
* @csspart trend - The trend indicator.
|
|
133
|
+
* @csspart description - The description text.
|
|
134
|
+
*/
|
|
135
|
+
let DuiStatCard = (() => {
|
|
136
|
+
let _classSuper = LitElement;
|
|
137
|
+
let _label_decorators;
|
|
138
|
+
let _label_initializers = [];
|
|
139
|
+
let _label_extraInitializers = [];
|
|
140
|
+
let _value_decorators;
|
|
141
|
+
let _value_initializers = [];
|
|
142
|
+
let _value_extraInitializers = [];
|
|
143
|
+
let _trend_decorators;
|
|
144
|
+
let _trend_initializers = [];
|
|
145
|
+
let _trend_extraInitializers = [];
|
|
146
|
+
let _trendDirection_decorators;
|
|
147
|
+
let _trendDirection_initializers = [];
|
|
148
|
+
let _trendDirection_extraInitializers = [];
|
|
149
|
+
let _description_decorators;
|
|
150
|
+
let _description_initializers = [];
|
|
151
|
+
let _description_extraInitializers = [];
|
|
152
|
+
return class DuiStatCard extends _classSuper {
|
|
153
|
+
static {
|
|
154
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
155
|
+
_label_decorators = [property()];
|
|
156
|
+
_value_decorators = [property()];
|
|
157
|
+
_trend_decorators = [property()];
|
|
158
|
+
_trendDirection_decorators = [property({ attribute: "trend-direction" })];
|
|
159
|
+
_description_decorators = [property()];
|
|
160
|
+
__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);
|
|
161
|
+
__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);
|
|
162
|
+
__esDecorate(this, null, _trend_decorators, { kind: "accessor", name: "trend", static: false, private: false, access: { has: obj => "trend" in obj, get: obj => obj.trend, set: (obj, value) => { obj.trend = value; } }, metadata: _metadata }, _trend_initializers, _trend_extraInitializers);
|
|
163
|
+
__esDecorate(this, null, _trendDirection_decorators, { kind: "accessor", name: "trendDirection", static: false, private: false, access: { has: obj => "trendDirection" in obj, get: obj => obj.trendDirection, set: (obj, value) => { obj.trendDirection = value; } }, metadata: _metadata }, _trendDirection_initializers, _trendDirection_extraInitializers);
|
|
164
|
+
__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);
|
|
165
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
166
|
+
}
|
|
167
|
+
static tagName = "dui-stat-card";
|
|
168
|
+
static styles = [base, styles];
|
|
169
|
+
#label_accessor_storage = __runInitializers(this, _label_initializers, "");
|
|
170
|
+
/** Metric label (e.g. "Total Events", "Response Time"). */
|
|
171
|
+
get label() { return this.#label_accessor_storage; }
|
|
172
|
+
set label(value) { this.#label_accessor_storage = value; }
|
|
173
|
+
#value_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _value_initializers, ""));
|
|
174
|
+
/** Primary metric value (e.g. "1,284", "$42.5K", "99.9%"). */
|
|
175
|
+
get value() { return this.#value_accessor_storage; }
|
|
176
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
177
|
+
#trend_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _trend_initializers, ""));
|
|
178
|
+
/** Trend text (e.g. "+12%", "-3.2%", "0%"). */
|
|
179
|
+
get trend() { return this.#trend_accessor_storage; }
|
|
180
|
+
set trend(value) { this.#trend_accessor_storage = value; }
|
|
181
|
+
#trendDirection_accessor_storage = (__runInitializers(this, _trend_extraInitializers), __runInitializers(this, _trendDirection_initializers, ""));
|
|
182
|
+
/** Trend direction — determines arrow and color (up | down | stable). */
|
|
183
|
+
get trendDirection() { return this.#trendDirection_accessor_storage; }
|
|
184
|
+
set trendDirection(value) { this.#trendDirection_accessor_storage = value; }
|
|
185
|
+
#description_accessor_storage = (__runInitializers(this, _trendDirection_extraInitializers), __runInitializers(this, _description_initializers, ""));
|
|
186
|
+
/** Supporting context text. */
|
|
187
|
+
get description() { return this.#description_accessor_storage; }
|
|
188
|
+
set description(value) { this.#description_accessor_storage = value; }
|
|
189
|
+
#onSlotChange(e) {
|
|
190
|
+
const slot = e.target;
|
|
191
|
+
slot.parentElement.hidden = slot.assignedElements().length === 0;
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
194
|
+
const cfg = TREND_CONFIG[this.trendDirection.toLowerCase()];
|
|
195
|
+
return html `
|
|
196
|
+
<article part="article">
|
|
197
|
+
${this.label
|
|
198
|
+
? html `<span class="label" part="label">${this.label}</span>`
|
|
199
|
+
: nothing}
|
|
200
|
+
|
|
201
|
+
<div class="value-row">
|
|
202
|
+
<span class="value" part="value">${this.value}</span>
|
|
203
|
+
${this.trend && cfg
|
|
204
|
+
? html `<span class="trend" part="trend" style="color: ${cfg.color}">
|
|
205
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|
|
206
|
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round"
|
|
207
|
+
stroke-linejoin="round"><path d="${cfg.path}"/></svg>
|
|
208
|
+
${this.trend}
|
|
209
|
+
</span>`
|
|
210
|
+
: nothing}
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
${this.description
|
|
214
|
+
? html `<p class="description" part="description">${this.description}</p>`
|
|
215
|
+
: nothing}
|
|
216
|
+
|
|
217
|
+
<div class="actions" hidden>
|
|
218
|
+
<slot name="actions" @slotchange=${this.#onSlotChange}></slot>
|
|
219
|
+
</div>
|
|
220
|
+
</article>
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
constructor() {
|
|
224
|
+
super(...arguments);
|
|
225
|
+
__runInitializers(this, _description_extraInitializers);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
})();
|
|
229
|
+
export { DuiStatCard };
|
|
230
|
+
customElements.define(DuiStatCard.tagName, DuiStatCard);
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepfuture/dui-templates",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "DUI templates — pre-composed UI patterns built from DUI components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/deepfuturenow/dui.git",
|
|
10
|
+
"directory": "packages/templates"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./feed": {
|
|
14
|
+
"import": "./feed/index.js",
|
|
15
|
+
"types": "./feed/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./dashboard": {
|
|
18
|
+
"import": "./dashboard/index.js",
|
|
19
|
+
"types": "./dashboard/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./metrics": {
|
|
22
|
+
"import": "./metrics/index.js",
|
|
23
|
+
"types": "./metrics/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./data": {
|
|
26
|
+
"import": "./data/index.js",
|
|
27
|
+
"types": "./data/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./content": {
|
|
30
|
+
"import": "./content/index.js",
|
|
31
|
+
"types": "./content/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./media": {
|
|
34
|
+
"import": "./media/index.js",
|
|
35
|
+
"types": "./media/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./all": {
|
|
38
|
+
"import": "./all.js",
|
|
39
|
+
"types": "./all.d.ts"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"**/*.js",
|
|
44
|
+
"**/*.d.ts",
|
|
45
|
+
"**/*.css",
|
|
46
|
+
"README.md"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@deepfuture/dui-core": "1.0.0",
|
|
50
|
+
"@deepfuture/dui-components": "1.0.0",
|
|
51
|
+
"lit": "^3.3.2"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"web-components",
|
|
55
|
+
"lit",
|
|
56
|
+
"unstyled",
|
|
57
|
+
"components",
|
|
58
|
+
"dui",
|
|
59
|
+
"theme"
|
|
60
|
+
]
|
|
61
|
+
}
|