@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.
@@ -0,0 +1,260 @@
1
+ var r = Object.defineProperty;
2
+ var h = (i, o, n) => o in i ? r(i, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[o] = n;
3
+ var s = (i, o, n) => h(i, typeof o != "symbol" ? o + "" : o, n);
4
+ import { B as c, d as t, e as a } from "./index-DiYekJaQ.js";
5
+ const d = `<div class="demo-container">
6
+ <h1>Toast Component Demo</h1>
7
+ <p>Elegant notification system with smooth animations and glassmorphic design.</p>
8
+
9
+ <div class="demo-section">
10
+ <h2>With Descriptions</h2>
11
+ <div class="demo-controls">
12
+ <ui-button id="showSuccessDesc" variant="primary">
13
+ Success with Details
14
+ </ui-button>
15
+ <ui-button id="showErrorDesc" variant="danger">
16
+ Error with Details
17
+ </ui-button>
18
+ <ui-button id="showWarningDesc" variant="secondary">
19
+ Warning with Details
20
+ </ui-button>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="demo-section">
25
+ <h2>Duration Options</h2>
26
+ <div class="demo-controls">
27
+ <ui-button id="showQuick" variant="ghost">
28
+ Quick (2s)
29
+ </ui-button>
30
+ <ui-button id="showNormal" variant="ghost">
31
+ Normal (5s)
32
+ </ui-button>
33
+ <ui-button id="showLong" variant="ghost">
34
+ Long (10s)
35
+ </ui-button>
36
+ <ui-button id="showPersistent" variant="ghost">
37
+ Persistent (No auto-dismiss)
38
+ </ui-button>
39
+ </div>
40
+ </div>
41
+
42
+ <div class="demo-section">
43
+ <h2>Position Control</h2>
44
+ <p class="demo-hint">Change toast container position</p>
45
+ <div class="demo-controls position-grid">
46
+ <ui-button id="posTopLeft" variant="ghost" size="sm">
47
+ Top Left
48
+ </ui-button>
49
+ <ui-button id="posTopCenter" variant="ghost" size="sm">
50
+ Top Center
51
+ </ui-button>
52
+ <ui-button id="posTopRight" variant="ghost" size="sm">
53
+ Top Right
54
+ </ui-button>
55
+ <ui-button id="posBottomLeft" variant="ghost" size="sm">
56
+ Bottom Left
57
+ </ui-button>
58
+ <ui-button id="posBottomCenter" variant="ghost" size="sm">
59
+ Bottom Center
60
+ </ui-button>
61
+ <ui-button id="posBottomRight" variant="ghost" size="sm">
62
+ Bottom Right
63
+ </ui-button>
64
+ </div>
65
+ </div>
66
+
67
+ <div class="demo-section">
68
+ <h2>Multiple Toasts</h2>
69
+ <div class="demo-controls">
70
+ <ui-button id="showMultiple" variant="primary" icon="layers">
71
+ Show Multiple Toasts
72
+ </ui-button>
73
+ <ui-button id="dismissAll" variant="danger" icon="x">
74
+ Dismiss All
75
+ </ui-button>
76
+ </div>
77
+ </div>
78
+
79
+
80
+
81
+ <div class="current-position">
82
+ Current position: <strong id="currentPosition">top-right</strong>
83
+ </div>
84
+ </div>
85
+
86
+ <!-- Toast Container -->
87
+ <ui-toast id="toastContainer"></ui-toast>
88
+ `, u = `.demo-container {
89
+ max-width: 1000px;
90
+ margin: 0 auto;
91
+ padding: 2rem;
92
+ }
93
+
94
+ h1 {
95
+ font-size: 2rem;
96
+ font-weight: 700;
97
+ color: var(--color-ink);
98
+ margin: 0 0 0.5rem 0;
99
+ }
100
+
101
+ h1 + p {
102
+ color: #64748b;
103
+ margin: 0 0 2rem 0;
104
+ font-size: 1.05rem;
105
+ }
106
+
107
+ .demo-section {
108
+ background: var(--color-muted);
109
+ border-radius: 12px;
110
+ padding: 1.5rem;
111
+ margin-bottom: 1.5rem;
112
+ }
113
+
114
+ .demo-section h2 {
115
+ font-size: 1.25rem;
116
+ font-weight: 600;
117
+ color: var(--color-ink);
118
+ margin: 0 0 0.75rem 0;
119
+ }
120
+
121
+ .demo-hint {
122
+ color: #64748b;
123
+ font-size: 0.9rem;
124
+ margin: 0 0 0.75rem 0;
125
+ }
126
+
127
+ .demo-controls {
128
+ display: flex;
129
+ flex-wrap: wrap;
130
+ gap: 0.75rem;
131
+ align-items: center;
132
+ }
133
+
134
+ .position-grid {
135
+ display: grid;
136
+ grid-template-columns: repeat(3, 1fr);
137
+ gap: 0.5rem;
138
+ }
139
+
140
+ .current-position {
141
+ display: inline-block;
142
+ background: var(--color-primary);
143
+ color: white;
144
+ padding: 0.75rem 1.25rem;
145
+ border-radius: 8px;
146
+ font-size: 0.95rem;
147
+ margin-top: 1rem;
148
+ }
149
+
150
+ .current-position strong {
151
+ font-weight: 700;
152
+ }
153
+
154
+ @media (max-width: 768px) {
155
+ .demo-container {
156
+ padding: 1rem;
157
+ }
158
+
159
+ h1 {
160
+ font-size: 1.5rem;
161
+ }
162
+
163
+ .demo-section {
164
+ padding: 1rem;
165
+ }
166
+
167
+ .position-grid {
168
+ grid-template-columns: repeat(2, 1fr);
169
+ }
170
+ }
171
+ `;
172
+ class l extends c {
173
+ constructor() {
174
+ super(...arguments);
175
+ s(this, "toastContainer", null);
176
+ s(this, "isReady", !1);
177
+ s(this, "currentPosition", this.useSignal("top-right"));
178
+ }
179
+ async connectedCallback() {
180
+ super.connectedCallback(), await Promise.all([
181
+ customElements.whenDefined("ui-toast"),
182
+ customElements.whenDefined("ui-button")
183
+ ]), await new Promise((n) => setTimeout(n, 10)), this.isReady = !0, this.render();
184
+ }
185
+ showSucessToast() {
186
+ this.toastContainer && this.toastContainer.success("Success!", "This is a success toast message.", 5e3);
187
+ }
188
+ setupEventListeners() {
189
+ if (!this.toastContainer) return;
190
+ t(this.shadowRoot, "showError", "click", () => {
191
+ this.toastContainer.error("Error occurred!", void 0, 5e3);
192
+ }), t(this.shadowRoot, "showWarning", "click", () => {
193
+ this.toastContainer.warning("Warning message", void 0, 5e3);
194
+ }), t(this.shadowRoot, "showInfo", "click", () => {
195
+ this.toastContainer.info("Information", void 0, 5e3);
196
+ }), t(this.shadowRoot, "showSuccessDesc", "click", () => {
197
+ this.toastContainer.success(
198
+ "Changes saved!",
199
+ "Your document has been successfully saved to the cloud.",
200
+ 5e3
201
+ );
202
+ }), t(this.shadowRoot, "showErrorDesc", "click", () => {
203
+ this.toastContainer.error(
204
+ "Failed to connect",
205
+ "Unable to reach the server. Please check your internet connection.",
206
+ 5e3
207
+ );
208
+ }), t(this.shadowRoot, "showWarningDesc", "click", () => {
209
+ this.toastContainer.warning(
210
+ "Storage almost full",
211
+ "You have used 95% of your available storage space.",
212
+ 5e3
213
+ );
214
+ }), t(this.shadowRoot, "showQuick", "click", () => {
215
+ this.toastContainer.info("Quick notification", "This will disappear in 2 seconds", 2e3);
216
+ }), t(this.shadowRoot, "showNormal", "click", () => {
217
+ this.toastContainer.info("Normal duration", "This will disappear in 5 seconds", 5e3);
218
+ }), t(this.shadowRoot, "showLong", "click", () => {
219
+ this.toastContainer.info("Long duration", "This will disappear in 10 seconds", 1e4);
220
+ }), t(this.shadowRoot, "showPersistent", "click", () => {
221
+ this.toastContainer.info(
222
+ "Persistent notification",
223
+ "This will stay until you close it manually",
224
+ 0
225
+ );
226
+ });
227
+ const n = (e) => {
228
+ this.currentPosition.set(e), this.toastContainer.info("Position changed", `Toast position is now ${e}`, 3e3);
229
+ };
230
+ t(this.shadowRoot, "posTopLeft", "click", () => {
231
+ n("top-left");
232
+ }), t(this.shadowRoot, "posTopCenter", "click", () => {
233
+ n("top-center");
234
+ }), t(this.shadowRoot, "posTopRight", "click", () => {
235
+ n("top-right");
236
+ }), t(this.shadowRoot, "posBottomLeft", "click", () => {
237
+ n("bottom-left");
238
+ }), t(this.shadowRoot, "posBottomCenter", "click", () => {
239
+ n("bottom-center");
240
+ }), t(this.shadowRoot, "posBottomRight", "click", () => {
241
+ n("bottom-right");
242
+ }), t(this.shadowRoot, "showMultiple", "click", () => {
243
+ setTimeout(() => this.toastContainer.success("First notification", "This is the first toast"), 0), setTimeout(() => this.toastContainer.info("Second notification", "This is the second toast"), 200), setTimeout(() => this.toastContainer.warning("Third notification", "This is the third toast"), 400), setTimeout(() => this.toastContainer.error("Fourth notification", "This is the fourth toast"), 600);
244
+ }), t(this.shadowRoot, "dismissAll", "click", () => {
245
+ this.toastContainer.dismissAll();
246
+ });
247
+ }
248
+ getToastContainer() {
249
+ return a(this.shadowRoot, "toastContainer");
250
+ }
251
+ render() {
252
+ this.shadowRoot.innerHTML = `
253
+ <style>${u}</style>
254
+ ${d}
255
+ `;
256
+ const n = a(this.shadowRoot, "currentPosition");
257
+ n && (n.textContent = this.currentPosition.get()), this.toastContainer = this.getToastContainer(), this.toastContainer && this.toastContainer.setAttribute("position", this.currentPosition.get()), this.isReady && this.setupEventListeners();
258
+ }
259
+ }
260
+ customElements.define("toast-demo-page", l);