@diniz/webcomponents 1.1.5 → 1.1.7
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 +563 -750
- package/dist/README.md +563 -750
- package/dist/button-demo-BcfxxPSq.js +227 -0
- package/dist/card-demo-Cxp-wRGW.js +230 -0
- package/dist/date-picker-demo-B8y3zapN.js +143 -0
- package/dist/form-demo-page-F1iLCgfh.js +351 -0
- package/dist/home-page-XUM8cHP7.js +468 -0
- package/dist/index-DiYekJaQ.js +2424 -0
- package/dist/layout-demo-CJsZ6DI5.js +289 -0
- package/dist/modal-demo-page-YN2KgJ31.js +195 -0
- package/dist/stepper-demo-page-BkcpKk_F.js +312 -0
- package/dist/table-demo-x2ZD8cFh.js +137 -0
- package/dist/tabs-demo-BQBtZzw9.js +76 -0
- package/dist/toast-demo-page-DLVacHXA.js +260 -0
- package/dist/webcomponents.es.js +31 -1883
- package/dist/webcomponents.umd.js +2537 -113
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var g = (n, r, e) => r in n ? m(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
|
|
3
|
+
var c = (n, r, e) => g(n, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { B as h } from "./index-DiYekJaQ.js";
|
|
5
|
+
const u = `
|
|
6
|
+
<section class="stepper-hero">
|
|
7
|
+
<div>
|
|
8
|
+
<p class="eyebrow">Flow control</p>
|
|
9
|
+
<h1>Stepper</h1>
|
|
10
|
+
<p class="hero-subtitle">
|
|
11
|
+
Guide users across multi-step journeys with clear progress, states, and actions.
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
</section>
|
|
15
|
+
|
|
16
|
+
<section class="stepper-section">
|
|
17
|
+
<div class="section-head">
|
|
18
|
+
<h2>Interactive progress</h2>
|
|
19
|
+
<p>Move between steps to preview states and content density.</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="stepper-card">
|
|
22
|
+
<ui-stepper id="interactiveStepper" size="md"></ui-stepper>
|
|
23
|
+
<div class="stepper-preview" id="interactiveContent"></div>
|
|
24
|
+
<div class="stepper-controls">
|
|
25
|
+
<div class="status-pill" id="interactiveStatus">Step 2 of 5</div>
|
|
26
|
+
<div class="actions">
|
|
27
|
+
<ui-button id="prevStep" variant="secondary" size="sm">Previous</ui-button>
|
|
28
|
+
<ui-button id="nextStep" variant="primary" size="sm">Next</ui-button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
33
|
+
|
|
34
|
+
<section class="stepper-section grid">
|
|
35
|
+
<div class="stepper-card">
|
|
36
|
+
<div class="section-head">
|
|
37
|
+
<h2>Compact workflow</h2>
|
|
38
|
+
<p>Small size for tight layouts or onboarding drawers.</p>
|
|
39
|
+
</div>
|
|
40
|
+
<ui-stepper id="compactStepper" size="sm"></ui-stepper>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="stepper-card">
|
|
43
|
+
<div class="section-head">
|
|
44
|
+
<h2>Vertical journey</h2>
|
|
45
|
+
<p>Perfect for forms, checklists, and long content.</p>
|
|
46
|
+
</div>
|
|
47
|
+
<ui-stepper id="verticalStepper" orientation="vertical" size="lg"></ui-stepper>
|
|
48
|
+
</div>
|
|
49
|
+
</section>
|
|
50
|
+
|
|
51
|
+
<section class="stepper-section">
|
|
52
|
+
<div class="section-head">
|
|
53
|
+
<h2>Status flavors</h2>
|
|
54
|
+
<p>Explicit states like warning and error bring clarity to complex flows.</p>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="stepper-card">
|
|
57
|
+
<ui-stepper id="statusStepper" size="md"></ui-stepper>
|
|
58
|
+
</div>
|
|
59
|
+
</section>
|
|
60
|
+
`, f = `
|
|
61
|
+
:host {
|
|
62
|
+
display: block;
|
|
63
|
+
color: var(--color-ink);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.stepper-hero {
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
align-items: center;
|
|
70
|
+
padding: 2rem;
|
|
71
|
+
border-radius: 20px;
|
|
72
|
+
background: radial-gradient(circle at top left, rgba(36, 236, 113, 0.2), transparent 45%),
|
|
73
|
+
linear-gradient(135deg, rgba(52, 168, 235, 0.12), rgba(255, 255, 255, 0.9));
|
|
74
|
+
border: 1px solid rgba(52, 168, 235, 0.2);
|
|
75
|
+
margin-bottom: 2rem;
|
|
76
|
+
gap: 1.5rem;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.eyebrow {
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
letter-spacing: 0.2em;
|
|
83
|
+
font-size: 0.7rem;
|
|
84
|
+
color: rgba(15, 23, 42, 0.55);
|
|
85
|
+
margin: 0 0 0.75rem;
|
|
86
|
+
font-weight: 700;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
h1 {
|
|
90
|
+
font-size: 2.4rem;
|
|
91
|
+
margin: 0 0 0.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.hero-subtitle {
|
|
95
|
+
max-width: 520px;
|
|
96
|
+
margin: 0;
|
|
97
|
+
color: rgba(15, 23, 42, 0.65);
|
|
98
|
+
font-size: 1rem;
|
|
99
|
+
line-height: 1.6;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.hero-badge {
|
|
103
|
+
padding: 0.4rem 0.9rem;
|
|
104
|
+
border-radius: 999px;
|
|
105
|
+
font-size: 0.75rem;
|
|
106
|
+
font-weight: 700;
|
|
107
|
+
text-transform: uppercase;
|
|
108
|
+
letter-spacing: 0.14em;
|
|
109
|
+
background: #0f172a;
|
|
110
|
+
color: #ffffff;
|
|
111
|
+
box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stepper-section {
|
|
115
|
+
margin-bottom: 2rem;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: 1.5rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.stepper-section.grid {
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
124
|
+
gap: 1.5rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.section-head h2 {
|
|
128
|
+
margin: 0 0 0.35rem;
|
|
129
|
+
font-size: 1.4rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.section-head p {
|
|
133
|
+
margin: 0;
|
|
134
|
+
color: rgba(15, 23, 42, 0.6);
|
|
135
|
+
font-size: 0.95rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.stepper-card {
|
|
139
|
+
padding: 1.5rem;
|
|
140
|
+
border-radius: 16px;
|
|
141
|
+
border: 1px solid rgba(148, 163, 184, 0.3);
|
|
142
|
+
background: #ffffff;
|
|
143
|
+
box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: 1.5rem;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.stepper-controls {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: space-between;
|
|
153
|
+
gap: 1rem;
|
|
154
|
+
flex-wrap: wrap;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.stepper-preview {
|
|
158
|
+
border-radius: 14px;
|
|
159
|
+
padding: 1.25rem;
|
|
160
|
+
background: linear-gradient(135deg, rgba(36, 236, 113, 0.12), rgba(255, 255, 255, 0.9));
|
|
161
|
+
border: 1px solid rgba(36, 236, 113, 0.25);
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
gap: 0.65rem;
|
|
165
|
+
min-height: 140px;
|
|
166
|
+
animation: fadeSlide 0.25s ease;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.stepper-preview h3 {
|
|
170
|
+
margin: 0;
|
|
171
|
+
font-size: 1.1rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.stepper-preview p {
|
|
175
|
+
margin: 0;
|
|
176
|
+
color: rgba(15, 23, 42, 0.65);
|
|
177
|
+
font-size: 0.95rem;
|
|
178
|
+
line-height: 1.5;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.stepper-preview ul {
|
|
182
|
+
margin: 0;
|
|
183
|
+
padding-left: 1.2rem;
|
|
184
|
+
color: rgba(15, 23, 42, 0.65);
|
|
185
|
+
font-size: 0.9rem;
|
|
186
|
+
display: grid;
|
|
187
|
+
gap: 0.35rem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.actions {
|
|
191
|
+
display: flex;
|
|
192
|
+
gap: 0.75rem;
|
|
193
|
+
align-items: center;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.status-pill {
|
|
197
|
+
padding: 0.35rem 0.9rem;
|
|
198
|
+
background: rgba(36, 236, 113, 0.15);
|
|
199
|
+
border-radius: 999px;
|
|
200
|
+
font-size: 0.85rem;
|
|
201
|
+
font-weight: 600;
|
|
202
|
+
color: #166534;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes fadeSlide {
|
|
206
|
+
from {
|
|
207
|
+
opacity: 0;
|
|
208
|
+
transform: translateY(6px);
|
|
209
|
+
}
|
|
210
|
+
to {
|
|
211
|
+
opacity: 1;
|
|
212
|
+
transform: translateY(0);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@media (max-width: 720px) {
|
|
217
|
+
.stepper-hero {
|
|
218
|
+
padding: 1.5rem;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
h1 {
|
|
222
|
+
font-size: 2rem;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`, d = [
|
|
226
|
+
{ title: "Project setup", description: "Name, team, and scope" },
|
|
227
|
+
{ title: "Permissions", description: "Invite collaborators" },
|
|
228
|
+
{ title: "Brand kit", description: "Logo and colors" },
|
|
229
|
+
{ title: "Integrations", description: "Connect tools" },
|
|
230
|
+
{ title: "Launch", description: "Review and publish" }
|
|
231
|
+
], b = [
|
|
232
|
+
{ title: "Connect" },
|
|
233
|
+
{ title: "Customize" },
|
|
234
|
+
{ title: "Publish" }
|
|
235
|
+
], v = [
|
|
236
|
+
{ title: "Account details", description: "Personal information" },
|
|
237
|
+
{ title: "Billing", description: "Plan and payment method" },
|
|
238
|
+
{ title: "Security", description: "Password and MFA" },
|
|
239
|
+
{ title: "Preferences", description: "Notifications and access" }
|
|
240
|
+
], y = [
|
|
241
|
+
{ title: "Collect data", description: "Import the latest dataset", state: "complete" },
|
|
242
|
+
{ title: "Validate", description: "Spot missing fields", state: "warning" },
|
|
243
|
+
{ title: "Resolve issues", description: "Fix invalid entries", state: "error" },
|
|
244
|
+
{ title: "Publish", description: "Share with the team", state: "upcoming" }
|
|
245
|
+
], x = [
|
|
246
|
+
{
|
|
247
|
+
title: "Project setup",
|
|
248
|
+
copy: "Create the workspace, define the team, and lock in the scope.",
|
|
249
|
+
bullets: ["Workspace name + region", "Invite core collaborators", "Set the delivery timeline"]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
title: "Permissions",
|
|
253
|
+
copy: "Assign roles and access boundaries for internal and external teams.",
|
|
254
|
+
bullets: ["Owner and editor roles", "Approval workflows", "Audit logging enabled"]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
title: "Brand kit",
|
|
258
|
+
copy: "Upload logo assets and align the design system palette.",
|
|
259
|
+
bullets: ["Primary + accent colors", "Typography presets", "Asset library sync"]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
title: "Integrations",
|
|
263
|
+
copy: "Connect your analytics, CRM, and deployment pipelines.",
|
|
264
|
+
bullets: ["Analytics provider", "CRM webhooks", "CI/CD automation"]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
title: "Launch",
|
|
268
|
+
copy: "Finalize content and publish to production.",
|
|
269
|
+
bullets: ["Final review checklist", "Stakeholder sign-off", "Go-live switch"]
|
|
270
|
+
}
|
|
271
|
+
];
|
|
272
|
+
class w extends h {
|
|
273
|
+
constructor() {
|
|
274
|
+
super(...arguments);
|
|
275
|
+
c(this, "activeIndex", 2);
|
|
276
|
+
}
|
|
277
|
+
async connectedCallback() {
|
|
278
|
+
super.connectedCallback(), await customElements.whenDefined("ui-stepper"), this.render(), this.setupSteppers(), this.setupControls();
|
|
279
|
+
}
|
|
280
|
+
setupSteppers() {
|
|
281
|
+
const e = this.shadowRoot.getElementById("interactiveStepper"), s = this.shadowRoot.getElementById("compactStepper"), t = this.shadowRoot.getElementById("verticalStepper"), i = this.shadowRoot.getElementById("statusStepper");
|
|
282
|
+
e == null || e.setAttribute("steps", JSON.stringify(d)), e == null || e.setAttribute("active", String(this.activeIndex)), s == null || s.setAttribute("steps", JSON.stringify(b)), s == null || s.setAttribute("active", "2"), t == null || t.setAttribute("steps", JSON.stringify(v)), t == null || t.setAttribute("active", "3"), i == null || i.setAttribute("steps", JSON.stringify(y)), i == null || i.setAttribute("active", "2");
|
|
283
|
+
}
|
|
284
|
+
setupControls() {
|
|
285
|
+
const e = this.shadowRoot.getElementById("prevStep"), s = this.shadowRoot.getElementById("nextStep"), t = this.shadowRoot.getElementById("interactiveStepper"), i = () => {
|
|
286
|
+
const a = this.shadowRoot.getElementById("interactiveStatus"), o = this.shadowRoot.getElementById("interactiveContent");
|
|
287
|
+
if (a && (a.textContent = `Step ${this.activeIndex} of ${d.length}`), t && t.setAttribute("active", String(this.activeIndex)), o) {
|
|
288
|
+
const p = x[this.activeIndex - 1];
|
|
289
|
+
o.innerHTML = `
|
|
290
|
+
<h3>${p.title}</h3>
|
|
291
|
+
<p>${p.copy}</p>
|
|
292
|
+
<ul>${p.bullets.map((l) => `<li>${l}</li>`).join("")}</ul>
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
e == null || e.addEventListener("click", () => {
|
|
297
|
+
this.activeIndex = Math.max(1, this.activeIndex - 1), i();
|
|
298
|
+
}), s == null || s.addEventListener("click", () => {
|
|
299
|
+
this.activeIndex = Math.min(d.length, this.activeIndex + 1), i();
|
|
300
|
+
}), t == null || t.addEventListener("step-change", (a) => {
|
|
301
|
+
const o = a.detail;
|
|
302
|
+
o != null && o.index && (this.activeIndex = o.index, i());
|
|
303
|
+
}), i();
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
this.shadowRoot.innerHTML = `
|
|
307
|
+
<style>${f}</style>
|
|
308
|
+
${u}
|
|
309
|
+
`;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
customElements.define("stepper-demo-page", w);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var p = (d, i, e) => i in d ? u(d, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[i] = e;
|
|
3
|
+
var r = (d, i, e) => p(d, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { B as b, h as f, q as y, a as k, b as w } from "./index-DiYekJaQ.js";
|
|
5
|
+
const v = `<h1>Table Demo</h1>
|
|
6
|
+
<p class="intro">Example of loading JSON data and rendering a table.</p>
|
|
7
|
+
|
|
8
|
+
<div class="demo-section">
|
|
9
|
+
<div class="section-header">
|
|
10
|
+
<h2>Data Source</h2>
|
|
11
|
+
<span class="status" id="data-status">Loading...</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="code-block">
|
|
14
|
+
<code>fetch('https://dummyjson.com/products')</code>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="demo-section">
|
|
19
|
+
<h2>Table</h2>
|
|
20
|
+
<div class="action-message" id="action-message" style="display: none;"></div>
|
|
21
|
+
<ui-table id="demo-table"></ui-table>
|
|
22
|
+
<div class="meta" id="data-meta"></div>
|
|
23
|
+
<ui-pagination></ui-pagination>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<ui-modal id="confirmModal" title="Confirm Delete" size="sm">
|
|
28
|
+
<p>Are you sure you want to delete this item?</p>
|
|
29
|
+
<p style="color: #ef4444; font-size: 0.875rem;">This action cannot be undone.</p>
|
|
30
|
+
<div slot="footer">
|
|
31
|
+
<ui-button id="confirmCancel" variant="ghost">Cancel</ui-button>
|
|
32
|
+
<ui-button id="confirmDelete" variant="danger" icon="trash-2">Confirm</ui-button>
|
|
33
|
+
</div>
|
|
34
|
+
</ui-modal>`, E = ":host{display:block;padding:2rem;max-width:1200px;margin:0 auto}.intro{color:var(--color-ink, #0f172a);opacity:.8;margin-bottom:1.5rem}h1{font-size:2rem;margin-bottom:.5rem;color:var(--color-ink, #0f172a)}h2{font-size:1.4rem;margin-top:0;margin-bottom:.75rem;color:var(--color-ink, #0f172a)}.demo-section{margin-bottom:2rem;padding:1.5rem;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.section-header{display:flex;align-items:center;justify-content:space-between;gap:1rem}.status{font-size:.85rem;font-weight:600;padding:.25rem .6rem;border-radius:999px;background:#e2e8f0;color:#334155}.status.loading{background:#fde68a;color:#92400e}.status.success{background:#bbf7d0;color:#166534}.status.error{background:#fecaca;color:#b91c1c}.code-block{background:#f1f5f9;padding:1rem;border-radius:8px;overflow-x:auto}code{font-family:Courier New,monospace;font-size:.9rem;color:#334155}.meta{margin-top:.75rem;margin-bottom:.75rem;font-size:.85rem;color:#64748b}ui-pagination{margin-top:1rem}.json-output{margin:0;background:#0f172a;color:#e2e8f0;padding:1rem;border-radius:8px;overflow-x:auto;font-size:.85rem}";
|
|
35
|
+
class x extends b {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
r(this, "hasLoaded", !1);
|
|
39
|
+
r(this, "loading", !1);
|
|
40
|
+
r(this, "error", null);
|
|
41
|
+
r(this, "data", null);
|
|
42
|
+
r(this, "currentPage", 1);
|
|
43
|
+
r(this, "pageSize", 10);
|
|
44
|
+
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
super.connectedCallback(), this.hasLoaded || (this.hasLoaded = !0, this.loadData());
|
|
47
|
+
}
|
|
48
|
+
async loadData() {
|
|
49
|
+
this.loading = !0, this.error = null, this.render();
|
|
50
|
+
try {
|
|
51
|
+
const e = (this.currentPage - 1) * this.pageSize, t = await f.get(
|
|
52
|
+
`https://dummyjson.com/products?limit=${this.pageSize}&skip=${e}`
|
|
53
|
+
), s = [
|
|
54
|
+
{ key: "id", label: "ID", align: "right", visible: !1 },
|
|
55
|
+
{ key: "title", label: "Title" },
|
|
56
|
+
{ key: "brand", label: "Brand" },
|
|
57
|
+
{ key: "category", label: "Category" },
|
|
58
|
+
{ key: "price", label: "Price", align: "right" },
|
|
59
|
+
{ key: "rating", label: "Rating", align: "right" },
|
|
60
|
+
{ key: "stock", label: "Stock", align: "right" },
|
|
61
|
+
{
|
|
62
|
+
key: "actions",
|
|
63
|
+
label: "Actions",
|
|
64
|
+
align: "center",
|
|
65
|
+
actions: {
|
|
66
|
+
edit: !0,
|
|
67
|
+
delete: !0
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
], c = t.products.map((a) => ({
|
|
71
|
+
id: a.id,
|
|
72
|
+
title: a.title,
|
|
73
|
+
brand: a.brand,
|
|
74
|
+
category: a.category,
|
|
75
|
+
price: `$${a.price.toFixed(2)}`,
|
|
76
|
+
rating: a.rating.toFixed(1),
|
|
77
|
+
stock: a.stock
|
|
78
|
+
}));
|
|
79
|
+
this.data = {
|
|
80
|
+
columns: s,
|
|
81
|
+
rows: c,
|
|
82
|
+
meta: {
|
|
83
|
+
total: t.total,
|
|
84
|
+
limit: t.limit,
|
|
85
|
+
skip: t.skip
|
|
86
|
+
}
|
|
87
|
+
}, this.loading = !1, this.render();
|
|
88
|
+
} catch (e) {
|
|
89
|
+
this.loading = !1, this.error = e instanceof Error ? e.message : "Unknown error", this.render();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
showActionMessage(e) {
|
|
93
|
+
const t = this.shadowRoot.querySelector("#action-message");
|
|
94
|
+
t && (t.textContent = e, t.style.display = "block", setTimeout(() => {
|
|
95
|
+
const s = this.shadowRoot.querySelector("#action-message");
|
|
96
|
+
s && (s.style.display = "none");
|
|
97
|
+
}, 5e3));
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
var g, h;
|
|
101
|
+
this.shadowRoot.innerHTML = `
|
|
102
|
+
<style>${E}</style>
|
|
103
|
+
${v}
|
|
104
|
+
`;
|
|
105
|
+
const e = this.shadowRoot.querySelector("#data-status"), t = y(this.shadowRoot, "#confirmModal"), s = this.shadowRoot.getElementById("confirmDelete"), c = this.shadowRoot.getElementById("confirmCancel");
|
|
106
|
+
c == null || c.addEventListener("click", () => {
|
|
107
|
+
t == null || t.close();
|
|
108
|
+
}), e && (e.textContent = this.loading ? "Loading..." : this.error ? "Error" : "Loaded", e.className = `status ${this.loading ? "loading" : this.error ? "error" : "success"}`);
|
|
109
|
+
const a = k(this.shadowRoot, "#demo-table");
|
|
110
|
+
a && this.data && (a.data = {
|
|
111
|
+
columns: this.data.columns,
|
|
112
|
+
rows: this.data.rows
|
|
113
|
+
});
|
|
114
|
+
const n = w(this.shadowRoot, "ui-pagination");
|
|
115
|
+
if (n && ((g = this.data) != null && g.meta)) {
|
|
116
|
+
n.total = this.data.meta.total, n.currentPage = this.currentPage, n.pageSize = this.pageSize;
|
|
117
|
+
const l = n.cloneNode(!0);
|
|
118
|
+
(h = n.parentNode) == null || h.replaceChild(l, n), l.addEventListener("page-change", (o) => {
|
|
119
|
+
this.currentPage = o.detail.page, this.loadData();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const m = this.shadowRoot.querySelector("#demo-table");
|
|
123
|
+
m && (m.addEventListener("edit-action", (l) => {
|
|
124
|
+
const { row: o } = l.detail;
|
|
125
|
+
this.showActionMessage(`EDIT clicked for "${o.id}: ${o.title}"`);
|
|
126
|
+
}), m.addEventListener("delete-action", (l) => {
|
|
127
|
+
const { row: o } = l.detail;
|
|
128
|
+
console.log(`DELETE clicked for "${o.id}: ${o.title}"`), t == null || t.open(), s == null || s.addEventListener("click", () => {
|
|
129
|
+
t == null || t.close(), this.showActionMessage(`DELETE confirmed for "${o.id}: ${o.title}"`);
|
|
130
|
+
});
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
customElements.define("table-demo", x);
|
|
135
|
+
export {
|
|
136
|
+
x as TableDemo
|
|
137
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { B as i } from "./index-DiYekJaQ.js";
|
|
2
|
+
const d = `<h1>Tabs Demo</h1>
|
|
3
|
+
<p class="intro">A simple tabs component with slotted tabs and panels.</p>
|
|
4
|
+
|
|
5
|
+
<div class="demo-section">
|
|
6
|
+
<h2>Basic Tabs</h2>
|
|
7
|
+
<ui-tabs id="basicTabs" active="overview">
|
|
8
|
+
<button slot="tab" data-tab="overview">Overview</button>
|
|
9
|
+
<button slot="tab" data-tab="usage">Usage</button>
|
|
10
|
+
<button slot="tab" data-tab="api">API</button>
|
|
11
|
+
|
|
12
|
+
<div slot="panel" data-tab="overview">
|
|
13
|
+
<p>Use tabs to group related content without navigating away.</p>
|
|
14
|
+
<ul>
|
|
15
|
+
<li>Accessible roles and ARIA labels</li>
|
|
16
|
+
<li>Slotted tabs and panels</li>
|
|
17
|
+
<li>Simple active state</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</div>
|
|
20
|
+
<div slot="panel" data-tab="usage">
|
|
21
|
+
<p>Set the active tab by using the <code>active</code> attribute.</p>
|
|
22
|
+
<pre><code><ui-tabs active="overview">...</ui-tabs></code></pre>
|
|
23
|
+
</div>
|
|
24
|
+
<div slot="panel" data-tab="api">
|
|
25
|
+
<p>Listen for <code>tab-change</code> events to react to changes.</p>
|
|
26
|
+
</div>
|
|
27
|
+
</ui-tabs>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="demo-section">
|
|
31
|
+
<h2>Product Tabs</h2>
|
|
32
|
+
<ui-tabs id="productTabs">
|
|
33
|
+
<button slot="tab" data-tab="details">Details</button>
|
|
34
|
+
<button slot="tab" data-tab="specs">Specs</button>
|
|
35
|
+
<button slot="tab" data-tab="shipping">Shipping</button>
|
|
36
|
+
|
|
37
|
+
<div slot="panel" data-tab="details">
|
|
38
|
+
<p><strong>Storm Speaker</strong> is built for portable, punchy sound.</p>
|
|
39
|
+
</div>
|
|
40
|
+
<div slot="panel" data-tab="specs">
|
|
41
|
+
<ul>
|
|
42
|
+
<li>Battery: 18 hours</li>
|
|
43
|
+
<li>Water resistance: IPX5</li>
|
|
44
|
+
<li>Bluetooth: 5.3</li>
|
|
45
|
+
</ul>
|
|
46
|
+
</div>
|
|
47
|
+
<div slot="panel" data-tab="shipping">
|
|
48
|
+
<p>Ships in 1-2 business days. Free returns within 30 days.</p>
|
|
49
|
+
</div>
|
|
50
|
+
</ui-tabs>
|
|
51
|
+
<div class="result" id="tab-result" style="display: none;">
|
|
52
|
+
Active tab: <span id="tab-value"></span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
`, r = ":host{display:block;padding:2rem;max-width:1100px;margin:0 auto}.intro{color:var(--color-ink, #0f172a);opacity:.8;margin-bottom:1.5rem}h1{font-size:2rem;margin-bottom:.5rem;color:var(--color-ink, #0f172a)}h2{font-size:1.4rem;margin-top:0;margin-bottom:.75rem;color:var(--color-ink, #0f172a)}.demo-section{margin-bottom:2rem;padding:1.5rem;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.result{margin-top:1rem;padding:.75rem 1rem;border-radius:10px;background:#f1f5f9;color:#1e293b;font-weight:600}pre{background:#0f172a;color:#e2e8f0;padding:.75rem 1rem;border-radius:10px;overflow-x:auto}code{font-family:Courier New,monospace;font-size:.9rem}";
|
|
56
|
+
class l extends i {
|
|
57
|
+
render() {
|
|
58
|
+
var e;
|
|
59
|
+
this.shadowRoot.innerHTML = `
|
|
60
|
+
<style>${r}</style>
|
|
61
|
+
${d}
|
|
62
|
+
`;
|
|
63
|
+
const t = this.shadowRoot.querySelector("#productTabs");
|
|
64
|
+
if (t) {
|
|
65
|
+
const a = t.cloneNode(!0);
|
|
66
|
+
(e = t.parentNode) == null || e.replaceChild(a, t), a.addEventListener("tab-change", (s) => {
|
|
67
|
+
const n = this.shadowRoot.getElementById("tab-result"), o = this.shadowRoot.getElementById("tab-value");
|
|
68
|
+
n && o && (n.style.display = "block", o.textContent = s.detail.id);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
customElements.define("tabs-demo", l);
|
|
74
|
+
export {
|
|
75
|
+
l as TabsDemo
|
|
76
|
+
};
|