snice 1.14.3 → 2.1.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 (185) hide show
  1. package/bin/templates/base/tsconfig.json +5 -4
  2. package/components/accordion/demo.html +403 -0
  3. package/components/accordion/snice-accordion-item.css +85 -0
  4. package/components/accordion/snice-accordion-item.ts +226 -0
  5. package/components/accordion/snice-accordion.css +31 -0
  6. package/components/accordion/snice-accordion.ts +182 -0
  7. package/components/accordion/snice-accordion.types.ts +32 -0
  8. package/components/alert/demo.html +445 -0
  9. package/components/alert/snice-alert.css +195 -0
  10. package/components/alert/snice-alert.ts +141 -0
  11. package/components/alert/snice-alert.types.ts +12 -0
  12. package/components/avatar/demo.html +598 -0
  13. package/components/avatar/snice-avatar.css +131 -0
  14. package/components/avatar/snice-avatar.ts +136 -0
  15. package/components/avatar/snice-avatar.types.ts +13 -0
  16. package/components/badge/demo.html +523 -0
  17. package/components/badge/snice-badge.css +161 -0
  18. package/components/badge/snice-badge.ts +117 -0
  19. package/components/badge/snice-badge.types.ts +16 -0
  20. package/components/breadcrumbs/demo.html +404 -0
  21. package/components/breadcrumbs/snice-breadcrumbs.css +133 -0
  22. package/components/breadcrumbs/snice-breadcrumbs.ts +191 -0
  23. package/components/breadcrumbs/snice-breadcrumbs.types.ts +26 -0
  24. package/components/breadcrumbs/snice-crumb.ts +26 -0
  25. package/components/button/demo.html +42 -0
  26. package/components/button/snice-button.css +230 -0
  27. package/components/button/snice-button.ts +169 -0
  28. package/components/button/snice-button.types.ts +25 -0
  29. package/components/card/demo.html +525 -0
  30. package/components/card/snice-card.css +140 -0
  31. package/components/card/snice-card.ts +102 -0
  32. package/components/card/snice-card.types.ts +10 -0
  33. package/components/checkbox/demo.html +253 -0
  34. package/components/checkbox/snice-checkbox.css +164 -0
  35. package/components/checkbox/snice-checkbox.ts +223 -0
  36. package/components/checkbox/snice-checkbox.types.ts +22 -0
  37. package/components/chip/demo.html +383 -0
  38. package/components/chip/snice-chip.css +195 -0
  39. package/components/chip/snice-chip.ts +139 -0
  40. package/components/chip/snice-chip.types.ts +15 -0
  41. package/components/date-picker/README.md +233 -0
  42. package/components/date-picker/demo.html +191 -0
  43. package/components/date-picker/snice-date-picker.css +330 -0
  44. package/components/date-picker/snice-date-picker.ts +777 -0
  45. package/components/date-picker/snice-date-picker.types.ts +83 -0
  46. package/components/divider/demo.html +233 -0
  47. package/components/divider/snice-divider.css +155 -0
  48. package/components/divider/snice-divider.ts +69 -0
  49. package/components/divider/snice-divider.types.ts +15 -0
  50. package/components/drawer/demo.html +328 -0
  51. package/components/drawer/snice-drawer.css +476 -0
  52. package/components/drawer/snice-drawer.ts +287 -0
  53. package/components/drawer/snice-drawer.types.ts +17 -0
  54. package/components/global.d.ts +14 -0
  55. package/components/input/demo.html +303 -0
  56. package/components/input/snice-input.css +257 -0
  57. package/components/input/snice-input.ts +442 -0
  58. package/components/input/snice-input.types.ts +59 -0
  59. package/components/input/test.html +77 -0
  60. package/components/layout/README.md +260 -0
  61. package/components/layout/demo.html +538 -0
  62. package/components/layout/snice-layout-blog.css +129 -0
  63. package/components/layout/snice-layout-blog.ts +48 -0
  64. package/components/layout/snice-layout-card.css +104 -0
  65. package/components/layout/snice-layout-card.ts +35 -0
  66. package/components/layout/snice-layout-centered.css +51 -0
  67. package/components/layout/snice-layout-centered.ts +22 -0
  68. package/components/layout/snice-layout-dashboard.css +98 -0
  69. package/components/layout/snice-layout-dashboard.ts +45 -0
  70. package/components/layout/snice-layout-fullscreen.css +72 -0
  71. package/components/layout/snice-layout-fullscreen.ts +34 -0
  72. package/components/layout/snice-layout-landing.css +92 -0
  73. package/components/layout/snice-layout-landing.ts +47 -0
  74. package/components/layout/snice-layout-minimal.css +16 -0
  75. package/components/layout/snice-layout-minimal.ts +19 -0
  76. package/components/layout/snice-layout-sidebar.css +117 -0
  77. package/components/layout/snice-layout-sidebar.ts +48 -0
  78. package/components/layout/snice-layout-split.css +103 -0
  79. package/components/layout/snice-layout-split.ts +29 -0
  80. package/components/layout/snice-layout.css +72 -0
  81. package/components/layout/snice-layout.ts +35 -0
  82. package/components/layout/snice-layout.types.ts +5 -0
  83. package/components/login/demo-auth-controller.ts +185 -0
  84. package/components/login/demo.html +470 -0
  85. package/components/login/snice-login.css +204 -0
  86. package/components/login/snice-login.ts +337 -0
  87. package/components/login/snice-login.types.ts +34 -0
  88. package/components/modal/demo.html +291 -0
  89. package/components/modal/snice-modal.css +203 -0
  90. package/components/modal/snice-modal.ts +233 -0
  91. package/components/modal/snice-modal.types.ts +21 -0
  92. package/components/pagination/demo.html +395 -0
  93. package/components/pagination/snice-pagination.ts +333 -0
  94. package/components/pagination/snice-pagination.types.ts +21 -0
  95. package/components/progress/demo.html +510 -0
  96. package/components/progress/snice-progress.css +267 -0
  97. package/components/progress/snice-progress.ts +247 -0
  98. package/components/progress/snice-progress.types.ts +19 -0
  99. package/components/radio/demo.html +287 -0
  100. package/components/radio/snice-radio.css +171 -0
  101. package/components/radio/snice-radio.ts +218 -0
  102. package/components/radio/snice-radio.types.ts +21 -0
  103. package/components/select/demo.html +511 -0
  104. package/components/select/snice-option.ts +52 -0
  105. package/components/select/snice-option.types.ts +14 -0
  106. package/components/select/snice-select.css +392 -0
  107. package/components/select/snice-select.ts +796 -0
  108. package/components/select/snice-select.types.ts +55 -0
  109. package/components/skeleton/demo.html +514 -0
  110. package/components/skeleton/snice-skeleton.css +109 -0
  111. package/components/skeleton/snice-skeleton.ts +126 -0
  112. package/components/skeleton/snice-skeleton.types.ts +11 -0
  113. package/components/switch/demo.html +284 -0
  114. package/components/switch/snice-switch.css +221 -0
  115. package/components/switch/snice-switch.ts +229 -0
  116. package/components/switch/snice-switch.types.ts +23 -0
  117. package/components/symbols.ts +23 -0
  118. package/components/table/demo-table-controller.ts +100 -0
  119. package/components/table/demo.html +480 -0
  120. package/components/table/snice-cell-boolean.ts +112 -0
  121. package/components/table/snice-cell-date.ts +210 -0
  122. package/components/table/snice-cell-duration.ts +91 -0
  123. package/components/table/snice-cell-filesize.ts +90 -0
  124. package/components/table/snice-cell-number.ts +165 -0
  125. package/components/table/snice-cell-progress.ts +83 -0
  126. package/components/table/snice-cell-rating.ts +82 -0
  127. package/components/table/snice-cell-sparkline.ts +253 -0
  128. package/components/table/snice-cell-text.ts +125 -0
  129. package/components/table/snice-cell.css +296 -0
  130. package/components/table/snice-cell.ts +473 -0
  131. package/components/table/snice-column.ts +353 -0
  132. package/components/table/snice-header.css +243 -0
  133. package/components/table/snice-header.ts +261 -0
  134. package/components/table/snice-progress.ts +66 -0
  135. package/components/table/snice-rating.ts +45 -0
  136. package/components/table/snice-row.css +255 -0
  137. package/components/table/snice-row.ts +331 -0
  138. package/components/table/snice-table.css +241 -0
  139. package/components/table/snice-table.ts +737 -0
  140. package/components/table/snice-table.types.ts +158 -0
  141. package/components/tabs/demo.html +487 -0
  142. package/components/tabs/snice-tab-panel.css +264 -0
  143. package/components/tabs/snice-tab-panel.ts +47 -0
  144. package/components/tabs/snice-tab.css +96 -0
  145. package/components/tabs/snice-tab.ts +65 -0
  146. package/components/tabs/snice-tabs.css +189 -0
  147. package/components/tabs/snice-tabs.ts +332 -0
  148. package/components/tabs/snice-tabs.types.ts +28 -0
  149. package/components/theme/theme.css +234 -0
  150. package/components/toast/demo.html +329 -0
  151. package/components/toast/snice-toast-container.ts +256 -0
  152. package/components/toast/snice-toast.css +213 -0
  153. package/components/toast/snice-toast.ts +276 -0
  154. package/components/toast/snice-toast.types.ts +35 -0
  155. package/components/tooltip/demo.html +350 -0
  156. package/components/tooltip/snice-tooltip-portal.css +79 -0
  157. package/components/tooltip/snice-tooltip.css +117 -0
  158. package/components/tooltip/snice-tooltip.ts +612 -0
  159. package/components/tooltip/snice-tooltip.types.ts +32 -0
  160. package/components/transitions.ts +94 -0
  161. package/components/tsconfig.json +18 -0
  162. package/dist/index.cjs +441 -329
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.cjs.min.map +1 -1
  165. package/dist/index.esm.js +441 -329
  166. package/dist/index.esm.js.map +1 -1
  167. package/dist/index.esm.min.js +3 -3
  168. package/dist/index.esm.min.js.map +1 -1
  169. package/dist/index.iife.js +441 -329
  170. package/dist/index.iife.js.map +1 -1
  171. package/dist/index.iife.min.js +3 -3
  172. package/dist/index.iife.min.js.map +1 -1
  173. package/dist/symbols.esm.js +1 -1
  174. package/dist/transitions.esm.js +1 -1
  175. package/dist/types/controller.d.ts +1 -1
  176. package/dist/types/element.d.ts +10 -10
  177. package/dist/types/events.d.ts +2 -2
  178. package/dist/types/index.d.ts +1 -1
  179. package/dist/types/observe.d.ts +1 -1
  180. package/dist/types/request-response.d.ts +2 -3
  181. package/dist/types/router.d.ts +1 -1
  182. package/package.json +9 -3
  183. package/dist/index.cjs.min +0 -15
  184. package/dist/symbols.cjs +0 -103
  185. package/dist/transitions.cjs +0 -219
@@ -0,0 +1,213 @@
1
+ /* Toast Container */
2
+ :host {
3
+ position: fixed;
4
+ z-index: var(--snice-z-index-tooltip);
5
+ pointer-events: none;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--snice-spacing-sm);
9
+ padding: var(--snice-spacing-md);
10
+ }
11
+
12
+ /* Position variants */
13
+ :host([position="top-left"]) {
14
+ top: 0;
15
+ left: 0;
16
+ align-items: flex-start;
17
+ }
18
+
19
+ :host([position="top-center"]) {
20
+ top: 0;
21
+ left: 50%;
22
+ transform: translateX(-50%);
23
+ align-items: center;
24
+ }
25
+
26
+ :host([position="top-right"]) {
27
+ top: 0;
28
+ right: 0;
29
+ align-items: flex-end;
30
+ }
31
+
32
+ :host([position="bottom-left"]) {
33
+ bottom: 0;
34
+ left: 0;
35
+ align-items: flex-start;
36
+ }
37
+
38
+ :host([position="bottom-center"]) {
39
+ bottom: 0;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ align-items: center;
43
+ }
44
+
45
+ :host([position="bottom-right"]) {
46
+ bottom: 0;
47
+ right: 0;
48
+ align-items: flex-end;
49
+ }
50
+
51
+ /* Toast Item */
52
+ .toast {
53
+ pointer-events: auto;
54
+ display: flex;
55
+ align-items: center;
56
+ gap: var(--snice-spacing-sm);
57
+ min-width: 12.5rem; /* 200px */
58
+ max-width: 20rem; /* 320px */
59
+ padding: var(--snice-spacing-sm) var(--snice-spacing-md);
60
+ border-radius: var(--snice-border-radius-lg);
61
+ box-shadow: var(--snice-shadow-lg);
62
+ font-family: var(--snice-font-family);
63
+ font-size: var(--snice-font-size-sm);
64
+ line-height: var(--snice-line-height-normal);
65
+ animation: slideIn var(--snice-transition-medium) ease-out;
66
+ transition: all var(--snice-transition-medium) ease;
67
+ }
68
+
69
+ [hidden] {
70
+ display: none !important;
71
+ }
72
+
73
+ .toast.toast--hiding {
74
+ animation: slideOut 0.3s ease-out;
75
+ opacity: 0;
76
+ transform: translateY(100%);
77
+ }
78
+
79
+ /* Type variants */
80
+ .toast--success {
81
+ background-color: var(--snice-color-success);
82
+ color: var(--snice-color-text-inverse);
83
+ }
84
+
85
+ .toast--error {
86
+ background-color: var(--snice-color-danger);
87
+ color: var(--snice-color-text-inverse);
88
+ }
89
+
90
+ .toast--warning {
91
+ background-color: var(--snice-color-warning);
92
+ color: var(--snice-color-text-inverse);
93
+ }
94
+
95
+ .toast--info {
96
+ background-color: var(--snice-color-primary);
97
+ color: var(--snice-color-text-inverse);
98
+ }
99
+
100
+ /* Toast icon */
101
+ .toast-icon {
102
+ flex-shrink: 0;
103
+ width: 1.25rem; /* 20px */
104
+ height: 1.25rem; /* 20px */
105
+ display: flex;
106
+ align-items: center;
107
+ justify-content: center;
108
+ }
109
+
110
+ .toast-icon svg {
111
+ width: 100%;
112
+ height: 100%;
113
+ fill: currentColor;
114
+ }
115
+
116
+ /* Toast content */
117
+ .toast-content {
118
+ flex: 1;
119
+ word-wrap: break-word;
120
+ }
121
+
122
+ /* Close button */
123
+ .toast-close {
124
+ flex-shrink: 0;
125
+ width: 1.25rem; /* 20px */
126
+ height: 1.25rem; /* 20px */
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ cursor: pointer;
131
+ opacity: 0.7;
132
+ transition: opacity var(--snice-transition-fast);
133
+ background: none;
134
+ border: none;
135
+ color: inherit;
136
+ padding: 0;
137
+ }
138
+
139
+ .toast-close:hover {
140
+ opacity: 1;
141
+ }
142
+
143
+ .toast-close svg {
144
+ width: 0.875rem; /* 14px */
145
+ height: 0.875rem; /* 14px */
146
+ fill: currentColor;
147
+ }
148
+
149
+ /* Animations - Pop up like toast */
150
+ @keyframes slideIn {
151
+ from {
152
+ opacity: 0;
153
+ transform: translateY(100%);
154
+ }
155
+ to {
156
+ opacity: 1;
157
+ transform: translateY(0);
158
+ }
159
+ }
160
+
161
+ @keyframes slideOut {
162
+ from {
163
+ opacity: 1;
164
+ transform: translateY(0);
165
+ }
166
+ to {
167
+ opacity: 0;
168
+ transform: translateY(100%);
169
+ }
170
+ }
171
+
172
+ /* For top-positioned toasts - slide down */
173
+ :host([position^="top"]) .toast {
174
+ animation: slideInTop var(--snice-transition-medium) ease-out;
175
+ }
176
+
177
+ :host([position^="top"]) .toast.toast--hiding {
178
+ animation: slideOutTop var(--snice-transition-medium) ease-out;
179
+ transform: translateY(-100%);
180
+ }
181
+
182
+ @keyframes slideInTop {
183
+ from {
184
+ opacity: 0;
185
+ transform: translateY(-100%);
186
+ }
187
+ to {
188
+ opacity: 1;
189
+ transform: translateY(0);
190
+ }
191
+ }
192
+
193
+ @keyframes slideOutTop {
194
+ from {
195
+ opacity: 1;
196
+ transform: translateY(0);
197
+ }
198
+ to {
199
+ opacity: 0;
200
+ transform: translateY(-100%);
201
+ }
202
+ }
203
+
204
+ /* Progress bar for auto-dismiss */
205
+ .toast-progress {
206
+ position: absolute;
207
+ bottom: 0;
208
+ left: 0;
209
+ height: 0.1875rem; /* 3px */
210
+ background-color: rgba(255, 255, 255, 0.3);
211
+ border-radius: 0 0 var(--snice-toast-border-radius) var(--snice-toast-border-radius);
212
+ transition: width linear;
213
+ }
@@ -0,0 +1,276 @@
1
+ import { element, property, query, on, watch, dispatch } from 'snice';
2
+ import type { ToastType, SniceToastElement } from './snice-toast.types';
3
+
4
+ @element('snice-toast')
5
+ export class SniceToast extends HTMLElement implements SniceToastElement {
6
+ @property({ reflect: true })
7
+ type: ToastType = 'info';
8
+
9
+ @property({ reflect: true })
10
+ message: string = '';
11
+
12
+ @property({ type: Boolean, reflect: true })
13
+ closable: boolean = true;
14
+
15
+ @property({ type: Boolean, reflect: true })
16
+ icon: boolean = true;
17
+
18
+ @query('.toast')
19
+ toastElement?: HTMLElement;
20
+
21
+ @query('.toast-icon')
22
+ iconElement?: HTMLElement;
23
+
24
+ @query('.toast-content')
25
+ contentElement?: HTMLElement;
26
+
27
+ @query('.toast-close')
28
+ closeButton?: HTMLElement;
29
+
30
+ html() {
31
+ return /*html*/`
32
+ <div class="toast toast--${this.type}" role="alert" aria-live="polite">
33
+ <span class="toast-icon">${this.getIcon(this.type)}</span>
34
+ <span class="toast-content">${this.message}</span>
35
+ <button class="toast-close" aria-label="Close">
36
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
37
+ <path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"/>
38
+ </svg>
39
+ </button>
40
+ </div>
41
+ `;
42
+ }
43
+
44
+ css() {
45
+ return /*css*/`
46
+ :host {
47
+ pointer-events: auto;
48
+ display: block;
49
+ animation: slideIn 0.3s ease-out;
50
+ }
51
+
52
+ .toast {
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 12px;
56
+ min-width: 200px;
57
+ max-width: 320px;
58
+ padding: 12px 16px;
59
+ border-radius: 8px;
60
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
61
+ font-family: system-ui, -apple-system, sans-serif;
62
+ font-size: 14px;
63
+ line-height: 1.5;
64
+ transition: all 0.3s ease;
65
+ }
66
+
67
+ .toast--success {
68
+ background-color: #10b981;
69
+ color: white;
70
+ }
71
+
72
+ .toast--error {
73
+ background-color: #ef4444;
74
+ color: white;
75
+ }
76
+
77
+ .toast--warning {
78
+ background-color: #f59e0b;
79
+ color: white;
80
+ }
81
+
82
+ .toast--info {
83
+ background-color: #3b82f6;
84
+ color: white;
85
+ }
86
+
87
+ .toast-icon {
88
+ flex-shrink: 0;
89
+ width: 20px;
90
+ height: 20px;
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ }
95
+
96
+ .toast-icon[hidden] {
97
+ display: none;
98
+ }
99
+
100
+ .toast-icon svg {
101
+ width: 100%;
102
+ height: 100%;
103
+ fill: currentColor;
104
+ }
105
+
106
+ .toast-content {
107
+ flex: 1;
108
+ word-wrap: break-word;
109
+ }
110
+
111
+ .toast-close {
112
+ flex-shrink: 0;
113
+ width: 20px;
114
+ height: 20px;
115
+ display: flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ cursor: pointer;
119
+ opacity: 0.7;
120
+ transition: opacity 0.2s;
121
+ background: none;
122
+ border: none;
123
+ color: inherit;
124
+ padding: 0;
125
+ }
126
+
127
+ .toast-close[hidden] {
128
+ display: none;
129
+ }
130
+
131
+ .toast-close:hover {
132
+ opacity: 1;
133
+ }
134
+
135
+ /* Animations */
136
+ @keyframes slideIn {
137
+ from {
138
+ opacity: 0;
139
+ transform: translateY(100%);
140
+ }
141
+ to {
142
+ opacity: 1;
143
+ transform: translateY(0);
144
+ }
145
+ }
146
+
147
+ :host(.hiding) {
148
+ animation: slideOut 0.3s ease-out;
149
+ }
150
+
151
+ @keyframes slideOut {
152
+ from {
153
+ opacity: 1;
154
+ transform: translateY(0);
155
+ }
156
+ to {
157
+ opacity: 0;
158
+ transform: translateY(100%);
159
+ }
160
+ }
161
+
162
+ /* For top-positioned container - slide down */
163
+ :host-context(snice-toast-container[position^="top"]) {
164
+ animation: slideInTop 0.3s ease-out;
165
+ }
166
+
167
+ :host-context(snice-toast-container[position^="top"]):host(.hiding) {
168
+ animation: slideOutTop 0.3s ease-out;
169
+ }
170
+
171
+ @keyframes slideInTop {
172
+ from {
173
+ opacity: 0;
174
+ transform: translateY(-100%);
175
+ }
176
+ to {
177
+ opacity: 1;
178
+ transform: translateY(0);
179
+ }
180
+ }
181
+
182
+ @keyframes slideOutTop {
183
+ from {
184
+ opacity: 1;
185
+ transform: translateY(0);
186
+ }
187
+ to {
188
+ opacity: 0;
189
+ transform: translateY(-100%);
190
+ }
191
+ }
192
+
193
+ [hidden] {
194
+ display: none !important;
195
+ }
196
+ `;
197
+ }
198
+
199
+ // Helper function to hide/show elements
200
+ private setHidden(selector: string, hide: boolean): void {
201
+ const element = this.shadowRoot?.querySelector(selector) as HTMLElement;
202
+ if (element) {
203
+ if (hide) {
204
+ element.setAttribute('hidden', '');
205
+ } else {
206
+ element.removeAttribute('hidden');
207
+ }
208
+ }
209
+ }
210
+
211
+ @watch('type')
212
+ updateType() {
213
+ if (this.toastElement) {
214
+ // Remove old type class
215
+ this.toastElement.className = this.toastElement.className.replace(/toast--\w+/, '');
216
+ // Add new type class
217
+ this.toastElement.classList.add(`toast--${this.type}`);
218
+ }
219
+ // Update icon
220
+ if (this.iconElement) {
221
+ this.iconElement.innerHTML = this.getIcon(this.type);
222
+ }
223
+ }
224
+
225
+ @watch('message')
226
+ updateMessage() {
227
+ if (this.contentElement) {
228
+ this.contentElement.textContent = this.message;
229
+ }
230
+ }
231
+
232
+ @watch('closable')
233
+ updateClosable() {
234
+ this.setHidden('.toast-close', !this.closable);
235
+ }
236
+
237
+ @watch('icon')
238
+ updateIcon() {
239
+ this.setHidden('.toast-icon', !this.icon);
240
+ }
241
+
242
+ @on('click', '.toast-close')
243
+ @dispatch('close-toast')
244
+ handleClose() {
245
+ return { id: this.getAttribute('toast-id') };
246
+ }
247
+
248
+ hide() {
249
+ this.classList.add('hiding');
250
+ }
251
+
252
+ private getIcon(type: ToastType): string {
253
+ switch (type) {
254
+ case 'success':
255
+ return `<svg viewBox="0 0 20 20" fill="currentColor">
256
+ <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
257
+ </svg>`;
258
+
259
+ case 'error':
260
+ return `<svg viewBox="0 0 20 20" fill="currentColor">
261
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zM10 7a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1zm0 8a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
262
+ </svg>`;
263
+
264
+ case 'warning':
265
+ return `<svg viewBox="0 0 20 20" fill="currentColor">
266
+ <path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
267
+ </svg>`;
268
+
269
+ case 'info':
270
+ default:
271
+ return `<svg viewBox="0 0 20 20" fill="currentColor">
272
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
273
+ </svg>`;
274
+ }
275
+ }
276
+ }
@@ -0,0 +1,35 @@
1
+ export type ToastType = 'success' | 'error' | 'warning' | 'info';
2
+ export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
3
+
4
+ export interface ToastOptions {
5
+ type?: ToastType;
6
+ duration?: number; // ms, 0 for no auto-dismiss
7
+ position?: ToastPosition;
8
+ closable?: boolean;
9
+ icon?: boolean;
10
+ id?: string;
11
+ }
12
+
13
+ export interface SniceToastElement extends HTMLElement {
14
+ type: ToastType;
15
+ message: string;
16
+ closable: boolean;
17
+ icon: boolean;
18
+ hide(): void;
19
+ }
20
+
21
+ export interface SniceToastContainerElement extends HTMLElement {
22
+ position: ToastPosition;
23
+ show(message: string, options?: ToastOptions): string;
24
+ hide(id: string): void;
25
+ clear(): void;
26
+ }
27
+
28
+ export interface ToastEventDetail {
29
+ message: string;
30
+ options?: ToastOptions;
31
+ }
32
+
33
+ export interface ToastResponseEventDetail {
34
+ toastId: string;
35
+ }