@evoke-tech/stencil-ui-kit 0.1.0 → 0.2.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 (125) hide show
  1. package/README.md +120 -20
  2. package/dist/cjs/evoke-alert_20.cjs.entry.js +1047 -0
  3. package/dist/cjs/evoke-ui.cjs.js +2 -2
  4. package/dist/cjs/{index-B8xS0y1i.js → index-BpJ5gu8f.js} +146 -5
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/collection/collection-manifest.json +13 -1
  7. package/dist/collection/components/evoke-alert/evoke-alert.css +17 -6
  8. package/dist/collection/components/evoke-alert/evoke-alert.js +25 -1
  9. package/dist/collection/components/evoke-app-bar/evoke-app-bar.css +13 -0
  10. package/dist/collection/components/evoke-app-bar/evoke-app-bar.js +94 -0
  11. package/dist/collection/components/evoke-badge/evoke-badge.css +13 -0
  12. package/dist/collection/components/evoke-badge/evoke-badge.js +162 -0
  13. package/dist/collection/components/evoke-button/evoke-button.css +16 -2
  14. package/dist/collection/components/evoke-button/evoke-button.js +117 -5
  15. package/dist/collection/components/evoke-card/evoke-card.css +9 -1
  16. package/dist/collection/components/evoke-card/evoke-card.js +75 -1
  17. package/dist/collection/components/evoke-checkbox/evoke-checkbox.css +7 -1
  18. package/dist/collection/components/evoke-checkbox/evoke-checkbox.js +31 -2
  19. package/dist/collection/components/evoke-chip/evoke-chip.css +16 -0
  20. package/dist/collection/components/evoke-chip/evoke-chip.js +149 -0
  21. package/dist/collection/components/evoke-input/evoke-input.css +11 -3
  22. package/dist/collection/components/evoke-input/evoke-input.js +103 -13
  23. package/dist/collection/components/evoke-modal/evoke-modal.css +21 -5
  24. package/dist/collection/components/evoke-modal/evoke-modal.js +129 -4
  25. package/dist/collection/components/evoke-pagination/evoke-pagination.css +12 -0
  26. package/dist/collection/components/evoke-pagination/evoke-pagination.js +156 -0
  27. package/dist/collection/components/evoke-progress/evoke-progress.css +12 -0
  28. package/dist/collection/components/evoke-progress/evoke-progress.js +146 -0
  29. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.css +20 -0
  30. package/dist/collection/components/evoke-quantity-stepper/evoke-quantity-stepper.js +201 -0
  31. package/dist/collection/components/evoke-radio-group/evoke-radio-group.css +14 -1
  32. package/dist/collection/components/evoke-radio-group/evoke-radio-group.js +34 -8
  33. package/dist/collection/components/evoke-select/evoke-select.css +25 -4
  34. package/dist/collection/components/evoke-select/evoke-select.js +245 -15
  35. package/dist/collection/components/evoke-switch/evoke-switch.css +16 -0
  36. package/dist/collection/components/evoke-switch/evoke-switch.js +151 -0
  37. package/dist/collection/components/evoke-table/evoke-table.css +20 -0
  38. package/dist/collection/components/evoke-table/evoke-table.js +222 -0
  39. package/dist/collection/components/evoke-tabs/evoke-tabs.css +20 -0
  40. package/dist/collection/components/evoke-tabs/evoke-tabs.js +179 -0
  41. package/dist/collection/components/evoke-textarea/evoke-textarea.css +19 -0
  42. package/dist/collection/components/evoke-textarea/evoke-textarea.js +328 -0
  43. package/dist/collection/components/evoke-toast/evoke-toast.css +24 -0
  44. package/dist/collection/components/evoke-toast/evoke-toast.js +225 -0
  45. package/dist/collection/components/evoke-tooltip/evoke-tooltip.css +22 -0
  46. package/dist/collection/components/evoke-tooltip/evoke-tooltip.js +119 -0
  47. package/dist/collection/utils/icons.js +29 -0
  48. package/dist/components/evoke-alert.js +1 -1
  49. package/dist/components/evoke-app-bar.d.ts +11 -0
  50. package/dist/components/evoke-app-bar.js +1 -0
  51. package/dist/components/evoke-badge.d.ts +11 -0
  52. package/dist/components/evoke-badge.js +1 -0
  53. package/dist/components/evoke-button.js +1 -1
  54. package/dist/components/evoke-card.js +1 -1
  55. package/dist/components/evoke-checkbox.js +1 -1
  56. package/dist/components/evoke-chip.d.ts +11 -0
  57. package/dist/components/evoke-chip.js +1 -0
  58. package/dist/components/evoke-input.js +1 -1
  59. package/dist/components/evoke-modal.js +1 -1
  60. package/dist/components/evoke-pagination.d.ts +11 -0
  61. package/dist/components/evoke-pagination.js +1 -0
  62. package/dist/components/evoke-progress.d.ts +11 -0
  63. package/dist/components/evoke-progress.js +1 -0
  64. package/dist/components/evoke-quantity-stepper.d.ts +11 -0
  65. package/dist/components/evoke-quantity-stepper.js +1 -0
  66. package/dist/components/evoke-radio-group.js +1 -1
  67. package/dist/components/evoke-select.js +1 -1
  68. package/dist/components/evoke-switch.d.ts +11 -0
  69. package/dist/components/evoke-switch.js +1 -0
  70. package/dist/components/evoke-table.d.ts +11 -0
  71. package/dist/components/evoke-table.js +1 -0
  72. package/dist/components/evoke-tabs.d.ts +11 -0
  73. package/dist/components/evoke-tabs.js +1 -0
  74. package/dist/components/evoke-textarea.d.ts +11 -0
  75. package/dist/components/evoke-textarea.js +1 -0
  76. package/dist/components/evoke-toast.d.ts +11 -0
  77. package/dist/components/evoke-toast.js +1 -0
  78. package/dist/components/evoke-tooltip.d.ts +11 -0
  79. package/dist/components/evoke-tooltip.js +1 -0
  80. package/dist/components/icons.js +1 -0
  81. package/dist/esm/evoke-alert_20.entry.js +1026 -0
  82. package/dist/esm/evoke-ui.js +3 -3
  83. package/dist/esm/{index-BtM1wZ-I.js → index-C-5sEjU8.js} +146 -6
  84. package/dist/esm/loader.js +3 -3
  85. package/dist/evoke-ui/evoke-ui.css +1 -1
  86. package/dist/evoke-ui/evoke-ui.esm.js +1 -1
  87. package/dist/evoke-ui/p-0841be89.entry.js +1 -0
  88. package/dist/evoke-ui/p-C-5sEjU8.js +3 -0
  89. package/dist/themes/bootstrap.css +3 -0
  90. package/dist/themes/material.css +3 -0
  91. package/dist/themes/tailwind.css +3 -0
  92. package/dist/themes/tokens.css +4 -1
  93. package/dist/types/components/evoke-alert/evoke-alert.d.ts +2 -0
  94. package/dist/types/components/evoke-app-bar/evoke-app-bar.d.ts +14 -0
  95. package/dist/types/components/evoke-badge/evoke-badge.d.ts +17 -0
  96. package/dist/types/components/evoke-button/evoke-button.d.ts +12 -2
  97. package/dist/types/components/evoke-card/evoke-card.d.ts +9 -0
  98. package/dist/types/components/evoke-checkbox/evoke-checkbox.d.ts +5 -0
  99. package/dist/types/components/evoke-chip/evoke-chip.d.ts +14 -0
  100. package/dist/types/components/evoke-input/evoke-input.d.ts +9 -1
  101. package/dist/types/components/evoke-modal/evoke-modal.d.ts +19 -1
  102. package/dist/types/components/evoke-pagination/evoke-pagination.d.ts +15 -0
  103. package/dist/types/components/evoke-progress/evoke-progress.d.ts +13 -0
  104. package/dist/types/components/evoke-quantity-stepper/evoke-quantity-stepper.d.ts +18 -0
  105. package/dist/types/components/evoke-radio-group/evoke-radio-group.d.ts +4 -2
  106. package/dist/types/components/evoke-select/evoke-select.d.ts +31 -6
  107. package/dist/types/components/evoke-switch/evoke-switch.d.ts +15 -0
  108. package/dist/types/components/evoke-table/evoke-table.d.ts +29 -0
  109. package/dist/types/components/evoke-tabs/evoke-tabs.d.ts +21 -0
  110. package/dist/types/components/evoke-textarea/evoke-textarea.d.ts +28 -0
  111. package/dist/types/components/evoke-toast/evoke-toast.d.ts +24 -0
  112. package/dist/types/components/evoke-tooltip/evoke-tooltip.d.ts +17 -0
  113. package/dist/types/components.d.ts +1237 -18
  114. package/dist/types/utils/icons.d.ts +25 -0
  115. package/package.json +11 -4
  116. package/dist/cjs/evoke-alert_6.cjs.entry.js +0 -172
  117. package/dist/cjs/evoke-card.cjs.entry.js +0 -20
  118. package/dist/cjs/evoke-modal.cjs.entry.js +0 -34
  119. package/dist/esm/evoke-alert_6.entry.js +0 -165
  120. package/dist/esm/evoke-card.entry.js +0 -18
  121. package/dist/esm/evoke-modal.entry.js +0 -32
  122. package/dist/evoke-ui/p-243075cd.entry.js +0 -1
  123. package/dist/evoke-ui/p-605d4757.entry.js +0 -1
  124. package/dist/evoke-ui/p-9a6eaeb6.entry.js +0 -1
  125. package/dist/evoke-ui/p-BtM1wZ-I.js +0 -3
@@ -0,0 +1,328 @@
1
+ import { h } from "@stencil/core";
2
+ export class EvokeTextarea {
3
+ constructor() {
4
+ this.label = '';
5
+ this.value = '';
6
+ this.name = '';
7
+ this.placeholder = '';
8
+ /** Visible rows (the minimum height when `auto-grow` is on) */
9
+ this.rows = 4;
10
+ /** Grow with the content instead of scrolling */
11
+ this.autoGrow = false;
12
+ this.disabled = false;
13
+ this.required = false;
14
+ this.error = '';
15
+ this.hint = '';
16
+ /** Extra classes for the inner <textarea> */
17
+ this.textareaClass = '';
18
+ this.uid = Math.random().toString(36).slice(2, 9);
19
+ }
20
+ componentDidRender() {
21
+ this.resize();
22
+ }
23
+ resize() {
24
+ if (!this.autoGrow || !this.el)
25
+ return;
26
+ this.el.style.height = 'auto';
27
+ this.el.style.height = `${this.el.scrollHeight}px`;
28
+ }
29
+ render() {
30
+ var _a;
31
+ const id = `evoke-textarea-${this.uid}`;
32
+ const msgId = `${id}-msg`;
33
+ const len = ((_a = this.value) !== null && _a !== void 0 ? _a : '').length;
34
+ const hasMax = typeof this.maxLength === 'number' && this.maxLength > 0;
35
+ return (h("div", { key: '5d950d88f2b9e191fd4a29e4eada4c5e4d8c779d', class: "evoke-field" }, this.label && h("label", { key: '46fee07268bedd23742d8d91018dfd47c93bd58b', htmlFor: id, class: "evoke-field__label" }, this.label, this.required && h("span", { key: '45af0e76daa25a15e0583777f5217757074c8d78', "aria-hidden": "true" }, " *")), h("textarea", { key: '917c3b5749cd5b75133bb2b71a90e036b3f4eef9', id: id, class: `evoke-field__input evoke-field__textarea ${this.autoGrow ? 'evoke-field__textarea--auto' : ''} ${this.error ? 'evoke-field__input--error' : ''} ${this.textareaClass}`.replace(/\s+/g, ' ').trim(), name: this.name || undefined, rows: this.rows, maxLength: hasMax ? this.maxLength : undefined, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.error || this.hint ? msgId : undefined, ref: (el) => (this.el = el), onInput: (e) => {
36
+ this.value = e.target.value;
37
+ this.resize();
38
+ this.evokeInput.emit(this.value);
39
+ }, onChange: (e) => this.evokeChange.emit(e.target.value) }), h("div", { key: '95530cc625c4500a7042adda05c105f03054d4f9', class: "evoke-field__footer" }, this.error ? (h("span", { id: msgId, class: "evoke-field__error", role: "alert" }, this.error)) : (h("span", { id: msgId, class: "evoke-field__hint" }, this.hint)), hasMax && h("span", { key: '3f3fb731453b76cd7d2b0fa2f6ce334ca0bfd554', class: `evoke-field__counter ${len >= this.maxLength ? 'evoke-field__counter--full' : ''}`.trim(), "aria-live": "polite" }, len, " / ", this.maxLength))));
40
+ }
41
+ static get is() { return "evoke-textarea"; }
42
+ static get originalStyleUrls() {
43
+ return {
44
+ "$": ["evoke-textarea.css"]
45
+ };
46
+ }
47
+ static get styleUrls() {
48
+ return {
49
+ "$": ["evoke-textarea.css"]
50
+ };
51
+ }
52
+ static get properties() {
53
+ return {
54
+ "label": {
55
+ "type": "string",
56
+ "mutable": false,
57
+ "complexType": {
58
+ "original": "string",
59
+ "resolved": "string",
60
+ "references": {}
61
+ },
62
+ "required": false,
63
+ "optional": false,
64
+ "docs": {
65
+ "tags": [],
66
+ "text": ""
67
+ },
68
+ "getter": false,
69
+ "setter": false,
70
+ "reflect": false,
71
+ "attribute": "label",
72
+ "defaultValue": "''"
73
+ },
74
+ "value": {
75
+ "type": "string",
76
+ "mutable": true,
77
+ "complexType": {
78
+ "original": "string",
79
+ "resolved": "string",
80
+ "references": {}
81
+ },
82
+ "required": false,
83
+ "optional": false,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": ""
87
+ },
88
+ "getter": false,
89
+ "setter": false,
90
+ "reflect": false,
91
+ "attribute": "value",
92
+ "defaultValue": "''"
93
+ },
94
+ "name": {
95
+ "type": "string",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "string",
99
+ "resolved": "string",
100
+ "references": {}
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": ""
107
+ },
108
+ "getter": false,
109
+ "setter": false,
110
+ "reflect": false,
111
+ "attribute": "name",
112
+ "defaultValue": "''"
113
+ },
114
+ "placeholder": {
115
+ "type": "string",
116
+ "mutable": false,
117
+ "complexType": {
118
+ "original": "string",
119
+ "resolved": "string",
120
+ "references": {}
121
+ },
122
+ "required": false,
123
+ "optional": false,
124
+ "docs": {
125
+ "tags": [],
126
+ "text": ""
127
+ },
128
+ "getter": false,
129
+ "setter": false,
130
+ "reflect": false,
131
+ "attribute": "placeholder",
132
+ "defaultValue": "''"
133
+ },
134
+ "rows": {
135
+ "type": "number",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "number",
139
+ "resolved": "number",
140
+ "references": {}
141
+ },
142
+ "required": false,
143
+ "optional": false,
144
+ "docs": {
145
+ "tags": [],
146
+ "text": "Visible rows (the minimum height when `auto-grow` is on)"
147
+ },
148
+ "getter": false,
149
+ "setter": false,
150
+ "reflect": false,
151
+ "attribute": "rows",
152
+ "defaultValue": "4"
153
+ },
154
+ "autoGrow": {
155
+ "type": "boolean",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "boolean",
159
+ "resolved": "boolean",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "Grow with the content instead of scrolling"
167
+ },
168
+ "getter": false,
169
+ "setter": false,
170
+ "reflect": false,
171
+ "attribute": "auto-grow",
172
+ "defaultValue": "false"
173
+ },
174
+ "maxLength": {
175
+ "type": "number",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "number",
179
+ "resolved": "number",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": true,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": "Max characters; also shows a live \"n / max\" counter"
187
+ },
188
+ "getter": false,
189
+ "setter": false,
190
+ "reflect": false,
191
+ "attribute": "max-length"
192
+ },
193
+ "disabled": {
194
+ "type": "boolean",
195
+ "mutable": false,
196
+ "complexType": {
197
+ "original": "boolean",
198
+ "resolved": "boolean",
199
+ "references": {}
200
+ },
201
+ "required": false,
202
+ "optional": false,
203
+ "docs": {
204
+ "tags": [],
205
+ "text": ""
206
+ },
207
+ "getter": false,
208
+ "setter": false,
209
+ "reflect": false,
210
+ "attribute": "disabled",
211
+ "defaultValue": "false"
212
+ },
213
+ "required": {
214
+ "type": "boolean",
215
+ "mutable": false,
216
+ "complexType": {
217
+ "original": "boolean",
218
+ "resolved": "boolean",
219
+ "references": {}
220
+ },
221
+ "required": false,
222
+ "optional": false,
223
+ "docs": {
224
+ "tags": [],
225
+ "text": ""
226
+ },
227
+ "getter": false,
228
+ "setter": false,
229
+ "reflect": false,
230
+ "attribute": "required",
231
+ "defaultValue": "false"
232
+ },
233
+ "error": {
234
+ "type": "string",
235
+ "mutable": false,
236
+ "complexType": {
237
+ "original": "string",
238
+ "resolved": "string",
239
+ "references": {}
240
+ },
241
+ "required": false,
242
+ "optional": false,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": ""
246
+ },
247
+ "getter": false,
248
+ "setter": false,
249
+ "reflect": false,
250
+ "attribute": "error",
251
+ "defaultValue": "''"
252
+ },
253
+ "hint": {
254
+ "type": "string",
255
+ "mutable": false,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": ""
266
+ },
267
+ "getter": false,
268
+ "setter": false,
269
+ "reflect": false,
270
+ "attribute": "hint",
271
+ "defaultValue": "''"
272
+ },
273
+ "textareaClass": {
274
+ "type": "string",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "string",
278
+ "resolved": "string",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Extra classes for the inner <textarea>"
286
+ },
287
+ "getter": false,
288
+ "setter": false,
289
+ "reflect": false,
290
+ "attribute": "textarea-class",
291
+ "defaultValue": "''"
292
+ }
293
+ };
294
+ }
295
+ static get events() {
296
+ return [{
297
+ "method": "evokeInput",
298
+ "name": "evokeInput",
299
+ "bubbles": true,
300
+ "cancelable": true,
301
+ "composed": true,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": "Emits the new value on every keystroke"
305
+ },
306
+ "complexType": {
307
+ "original": "string",
308
+ "resolved": "string",
309
+ "references": {}
310
+ }
311
+ }, {
312
+ "method": "evokeChange",
313
+ "name": "evokeChange",
314
+ "bubbles": true,
315
+ "cancelable": true,
316
+ "composed": true,
317
+ "docs": {
318
+ "tags": [],
319
+ "text": "Emits the new value on commit (blur)"
320
+ },
321
+ "complexType": {
322
+ "original": "string",
323
+ "resolved": "string",
324
+ "references": {}
325
+ }
326
+ }];
327
+ }
328
+ }
@@ -0,0 +1,24 @@
1
+ evoke-toast .evoke-toast {
2
+ position: fixed; left: 50%; z-index: 1100; box-sizing: border-box; display: flex; align-items: center; gap: 12px;
3
+ width: max-content; max-width: min(92vw, 480px); padding: 12px 12px 12px 16px;
4
+ border-radius: var(--evoke-radius, 8px); background: var(--evoke-text, #1a1a1a); color: var(--evoke-surface, #ffffff);
5
+ font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); font-size: 0.9375rem; box-shadow: var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12));
6
+ transform: translateX(-50%); animation: evoke-toast-in 0.2s ease-out;
7
+ }
8
+ evoke-toast .evoke-toast--bottom { bottom: 24px; }
9
+ evoke-toast .evoke-toast--top { top: 24px; }
10
+ evoke-toast .evoke-toast--success .evoke-toast__icon { color: #4ade80; }
11
+ evoke-toast .evoke-toast--danger .evoke-toast__icon { color: #f87171; }
12
+ evoke-toast .evoke-toast--warning .evoke-toast__icon { color: #fbbf24; }
13
+ evoke-toast .evoke-toast--info .evoke-toast__icon { color: #67e8f9; }
14
+ evoke-toast .evoke-toast__icon { flex: none; width: 20px; height: 20px; }
15
+ evoke-toast .evoke-toast__message { flex: 1; min-width: 0; }
16
+ evoke-toast .evoke-toast__action { flex: none; padding: 6px 12px; font: inherit; font-weight: 600; background: transparent; color: #ffb199; border: 0; border-radius: var(--evoke-radius-field, 8px); cursor: pointer; }
17
+ evoke-toast .evoke-toast__action:hover { background: rgba(255, 255, 255, 0.12); }
18
+ evoke-toast .evoke-toast__action:active { background: rgba(255, 255, 255, 0.2); }
19
+ evoke-toast .evoke-toast__close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; background: none; border: 0; border-radius: 50%; color: inherit; cursor: pointer; }
20
+ evoke-toast .evoke-toast__close:hover { background: rgba(255, 255, 255, 0.12); }
21
+ evoke-toast .evoke-toast__action:focus-visible, evoke-toast .evoke-toast__close:focus-visible { outline: 2px solid var(--evoke-surface, #ffffff); outline-offset: 1px; }
22
+ evoke-toast .evoke-toast__close .evoke-icon { width: 16px; height: 16px; }
23
+ @keyframes evoke-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
24
+ @media (prefers-reduced-motion: reduce) { evoke-toast .evoke-toast { animation: none; } }
@@ -0,0 +1,225 @@
1
+ import { h } from "@stencil/core";
2
+ import { renderIcon } from "../../utils/icons";
3
+ const TYPE_ICON = { info: 'info', success: 'check', warning: 'alert', danger: 'alert' };
4
+ export class EvokeToast {
5
+ constructor() {
6
+ this.open = false;
7
+ /** Message text (or use the default slot) */
8
+ this.message = '';
9
+ this.type = 'info';
10
+ /** Label of an action button, e.g. "View cart". Leave empty for a simple message. */
11
+ this.action = '';
12
+ /** Auto-dismiss after this many ms; 0 keeps it open until closed */
13
+ this.duration = 4000;
14
+ this.position = 'bottom';
15
+ }
16
+ onOpen(next) {
17
+ this.clearTimer();
18
+ if (next)
19
+ this.startTimer();
20
+ }
21
+ componentDidLoad() {
22
+ if (this.open)
23
+ this.startTimer();
24
+ }
25
+ disconnectedCallback() {
26
+ this.clearTimer();
27
+ }
28
+ startTimer() {
29
+ if (this.duration > 0)
30
+ this.timer = setTimeout(() => this.close(), this.duration);
31
+ }
32
+ clearTimer() {
33
+ if (this.timer)
34
+ clearTimeout(this.timer);
35
+ this.timer = undefined;
36
+ }
37
+ close() {
38
+ this.clearTimer();
39
+ this.open = false;
40
+ this.evokeClose.emit();
41
+ }
42
+ render() {
43
+ if (!this.open)
44
+ return null;
45
+ const urgent = this.type === 'danger' || this.type === 'warning';
46
+ return (h("div", { class: `evoke-toast evoke-toast--${this.position} evoke-toast--${this.type}`, role: urgent ? 'alert' : 'status', "aria-live": urgent ? 'assertive' : 'polite', onMouseEnter: () => this.clearTimer(), onMouseLeave: () => this.open && this.startTimer() }, renderIcon(TYPE_ICON[this.type], 'evoke-toast__icon'), h("span", { class: "evoke-toast__message" }, this.message, h("slot", null)), this.action && (h("button", { type: "button", class: "evoke-toast__action", onClick: () => {
47
+ this.evokeAction.emit();
48
+ this.close();
49
+ } }, this.action)), h("button", { type: "button", class: "evoke-toast__close", "aria-label": "Dismiss", onClick: () => this.close() }, renderIcon('x', 'evoke-icon'))));
50
+ }
51
+ static get is() { return "evoke-toast"; }
52
+ static get originalStyleUrls() {
53
+ return {
54
+ "$": ["evoke-toast.css"]
55
+ };
56
+ }
57
+ static get styleUrls() {
58
+ return {
59
+ "$": ["evoke-toast.css"]
60
+ };
61
+ }
62
+ static get properties() {
63
+ return {
64
+ "open": {
65
+ "type": "boolean",
66
+ "mutable": true,
67
+ "complexType": {
68
+ "original": "boolean",
69
+ "resolved": "boolean",
70
+ "references": {}
71
+ },
72
+ "required": false,
73
+ "optional": false,
74
+ "docs": {
75
+ "tags": [],
76
+ "text": ""
77
+ },
78
+ "getter": false,
79
+ "setter": false,
80
+ "reflect": true,
81
+ "attribute": "open",
82
+ "defaultValue": "false"
83
+ },
84
+ "message": {
85
+ "type": "string",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "string",
89
+ "resolved": "string",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": "Message text (or use the default slot)"
97
+ },
98
+ "getter": false,
99
+ "setter": false,
100
+ "reflect": false,
101
+ "attribute": "message",
102
+ "defaultValue": "''"
103
+ },
104
+ "type": {
105
+ "type": "string",
106
+ "mutable": false,
107
+ "complexType": {
108
+ "original": "'info' | 'success' | 'warning' | 'danger'",
109
+ "resolved": "\"danger\" | \"info\" | \"success\" | \"warning\"",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": ""
117
+ },
118
+ "getter": false,
119
+ "setter": false,
120
+ "reflect": false,
121
+ "attribute": "type",
122
+ "defaultValue": "'info'"
123
+ },
124
+ "action": {
125
+ "type": "string",
126
+ "mutable": false,
127
+ "complexType": {
128
+ "original": "string",
129
+ "resolved": "string",
130
+ "references": {}
131
+ },
132
+ "required": false,
133
+ "optional": false,
134
+ "docs": {
135
+ "tags": [],
136
+ "text": "Label of an action button, e.g. \"View cart\". Leave empty for a simple message."
137
+ },
138
+ "getter": false,
139
+ "setter": false,
140
+ "reflect": false,
141
+ "attribute": "action",
142
+ "defaultValue": "''"
143
+ },
144
+ "duration": {
145
+ "type": "number",
146
+ "mutable": false,
147
+ "complexType": {
148
+ "original": "number",
149
+ "resolved": "number",
150
+ "references": {}
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": "Auto-dismiss after this many ms; 0 keeps it open until closed"
157
+ },
158
+ "getter": false,
159
+ "setter": false,
160
+ "reflect": false,
161
+ "attribute": "duration",
162
+ "defaultValue": "4000"
163
+ },
164
+ "position": {
165
+ "type": "string",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "'bottom' | 'top'",
169
+ "resolved": "\"bottom\" | \"top\"",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": ""
177
+ },
178
+ "getter": false,
179
+ "setter": false,
180
+ "reflect": false,
181
+ "attribute": "position",
182
+ "defaultValue": "'bottom'"
183
+ }
184
+ };
185
+ }
186
+ static get events() {
187
+ return [{
188
+ "method": "evokeAction",
189
+ "name": "evokeAction",
190
+ "bubbles": true,
191
+ "cancelable": true,
192
+ "composed": true,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": "Fired when the action button is clicked"
196
+ },
197
+ "complexType": {
198
+ "original": "void",
199
+ "resolved": "void",
200
+ "references": {}
201
+ }
202
+ }, {
203
+ "method": "evokeClose",
204
+ "name": "evokeClose",
205
+ "bubbles": true,
206
+ "cancelable": true,
207
+ "composed": true,
208
+ "docs": {
209
+ "tags": [],
210
+ "text": "Fired when the toast closes (button, action or timeout)"
211
+ },
212
+ "complexType": {
213
+ "original": "void",
214
+ "resolved": "void",
215
+ "references": {}
216
+ }
217
+ }];
218
+ }
219
+ static get watchers() {
220
+ return [{
221
+ "propName": "open",
222
+ "methodName": "onOpen"
223
+ }];
224
+ }
225
+ }
@@ -0,0 +1,22 @@
1
+ evoke-tooltip { display: inline-block; }
2
+ evoke-tooltip .evoke-tooltip { position: relative; display: inline-flex; }
3
+ evoke-tooltip .evoke-tooltip__bubble {
4
+ --_bg: var(--evoke-text, #1a1a1a); --_fg: var(--evoke-surface, #ffffff);
5
+ position: absolute; z-index: 30; box-sizing: border-box; width: max-content; max-width: 240px; padding: 6px 10px;
6
+ border-radius: calc(var(--evoke-radius-field, 8px) - 2px); background: var(--_bg); color: var(--_fg);
7
+ font-family: var(--evoke-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); font-size: 0.875rem; line-height: 1.4; pointer-events: none;
8
+ opacity: 0; visibility: hidden; transition: opacity 0.12s, visibility 0.12s;
9
+ }
10
+ evoke-tooltip .evoke-tooltip__bubble--visible { opacity: 1; visibility: visible; }
11
+ evoke-tooltip .evoke-tooltip__bubble--light { --_bg: var(--evoke-surface, #ffffff); --_fg: var(--evoke-text, #1a1a1a); border: 1px solid var(--evoke-border, #dedede); box-shadow: var(--evoke-shadow, 0 4px 12px rgba(0, 0, 0, 0.12)); }
12
+ evoke-tooltip .evoke-tooltip__bubble--top { bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
13
+ evoke-tooltip .evoke-tooltip__bubble--bottom { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
14
+ evoke-tooltip .evoke-tooltip__bubble--left { right: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
15
+ evoke-tooltip .evoke-tooltip__bubble--right { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
16
+ /* arrow (light theme only) */
17
+ evoke-tooltip .evoke-tooltip__bubble--light::after { content: ''; position: absolute; width: 8px; height: 8px; background: var(--_bg); border: 1px solid var(--evoke-border, #dedede); transform: rotate(45deg); }
18
+ evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--top::after { bottom: -5px; left: calc(50% - 4px); border-top: 0; border-left: 0; }
19
+ evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--bottom::after { top: -5px; left: calc(50% - 4px); border-bottom: 0; border-right: 0; }
20
+ evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--left::after { right: -5px; top: calc(50% - 4px); border-bottom: 0; border-left: 0; }
21
+ evoke-tooltip .evoke-tooltip__bubble--light.evoke-tooltip__bubble--right::after { left: -5px; top: calc(50% - 4px); border-top: 0; border-right: 0; }
22
+ @media (prefers-reduced-motion: reduce) { evoke-tooltip .evoke-tooltip__bubble { transition: none; } }