@keenthemes/ktui 1.0.27 → 1.0.29
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/dist/ktui.js +13 -1
- package/dist/ktui.min.js +1 -1
- package/dist/ktui.min.js.map +1 -1
- package/dist/styles.css +5 -0
- package/lib/cjs/components/datatable/datatable.js +13 -1
- package/lib/cjs/components/datatable/datatable.js.map +1 -1
- package/lib/esm/components/datatable/datatable.js +13 -1
- package/lib/esm/components/datatable/datatable.js.map +1 -1
- package/package.json +23 -5
- package/src/components/datatable/datatable.ts +13 -3
- package/src/components/table/table.css +7 -0
- package/CONTRIBUTING.md +0 -88
- package/examples/datatable/checkbox-events-test.html +0 -400
- package/examples/datatable/credentials-test.html +0 -423
- package/examples/datatable/remote-checkbox-test.html +0 -365
- package/examples/datatable/sorting-test.html +0 -258
- package/examples/image-input/file-upload-example.html +0 -189
- package/examples/modal/persistent.html +0 -205
- package/examples/modal/remote-select-dropdown.html +0 -166
- package/examples/modal/select-dropdown-container.html +0 -129
- package/examples/select/avatar.html +0 -47
- package/examples/select/basic-usage.html +0 -39
- package/examples/select/country.html +0 -43
- package/examples/select/dark-mode.html +0 -93
- package/examples/select/description.html +0 -53
- package/examples/select/disable-option.html +0 -37
- package/examples/select/disable-select.html +0 -35
- package/examples/select/dropdowncontainer.html +0 -111
- package/examples/select/dynamic-methods.html +0 -273
- package/examples/select/formdata-remote.html +0 -161
- package/examples/select/global-config.html +0 -81
- package/examples/select/icon-multiple.html +0 -50
- package/examples/select/icon.html +0 -48
- package/examples/select/max-selection.html +0 -38
- package/examples/select/modal-container.html +0 -128
- package/examples/select/modal-positioning-test.html +0 -338
- package/examples/select/modal.html +0 -80
- package/examples/select/multiple.html +0 -40
- package/examples/select/native-selected.html +0 -64
- package/examples/select/placeholder.html +0 -40
- package/examples/select/remote-data-preselected.html +0 -283
- package/examples/select/remote-data.html +0 -38
- package/examples/select/search.html +0 -57
- package/examples/select/sizes.html +0 -94
- package/examples/select/tags-enhanced.html +0 -86
- package/examples/select/tags-icons.html +0 -57
- package/examples/select/template-customization.html +0 -61
- package/examples/sticky/README.md +0 -158
- package/examples/sticky/debug-sticky.html +0 -144
- package/examples/sticky/test-runner.html +0 -175
- package/examples/sticky/test-sticky-logic.js +0 -369
- package/examples/sticky/test-sticky-positioning.html +0 -386
- package/examples/toast/example.html +0 -479
- package/prettier.config.js +0 -9
- package/tsconfig.json +0 -17
- package/webpack.config.js +0 -118
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>KTUI Toast Examples</title>
|
|
8
|
-
<link rel="stylesheet" href="../../dist/styles.css">
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body class="bg-gray-50 min-h-screen">
|
|
12
|
-
<div class="bg-white rounded-lg shadow p-8 w-full max-w-md mt-10 mx-auto">
|
|
13
|
-
<h2 class="text-xl font-bold mb-4">KTUI Toast Examples</h2>
|
|
14
|
-
|
|
15
|
-
<!-- Variants -->
|
|
16
|
-
<div class="mb-6">
|
|
17
|
-
<h3 class="font-semibold mb-2">Variants</h3>
|
|
18
|
-
<div class="flex flex-wrap gap-2">
|
|
19
|
-
<button id="toast-variant-info" class="kt-btn">Info</button>
|
|
20
|
-
<button id="toast-variant-success" class="kt-btn">Success</button>
|
|
21
|
-
<button id="toast-variant-error" class="kt-btn">Error</button>
|
|
22
|
-
<button id="toast-variant-warning" class="kt-btn">Warning</button>
|
|
23
|
-
<button id="toast-variant-primary" class="kt-btn">Primary</button>
|
|
24
|
-
<button id="toast-variant-secondary" class="kt-btn">Secondary</button>
|
|
25
|
-
<button id="toast-variant-destructive" class="kt-btn">destructive</button>
|
|
26
|
-
<button id="toast-variant-mono" class="kt-btn">Mono</button>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- Appearances -->
|
|
31
|
-
<div class="mb-6">
|
|
32
|
-
<h3 class="font-semibold mb-2">Appearances</h3>
|
|
33
|
-
<div class="flex flex-wrap gap-2">
|
|
34
|
-
<button id="toast-appearance-solid" class="kt-btn">Solid</button>
|
|
35
|
-
<button id="toast-appearance-outline" class="kt-btn">Outline</button>
|
|
36
|
-
<button id="toast-appearance-light" class="kt-btn">Light</button>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- Sizes -->
|
|
41
|
-
<div class="mb-6">
|
|
42
|
-
<h3 class="font-semibold mb-2">Sizes</h3>
|
|
43
|
-
<div class="flex flex-wrap gap-2">
|
|
44
|
-
<button id="toast-size-sm" class="kt-btn">Small</button>
|
|
45
|
-
<button id="toast-size-md" class="kt-btn">Medium</button>
|
|
46
|
-
<button id="toast-size-lg" class="kt-btn">Large</button>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<!-- Position Examples -->
|
|
51
|
-
<div class="mb-6">
|
|
52
|
-
<h3 class="font-semibold mb-2">Positions</h3>
|
|
53
|
-
<div class="flex flex-wrap gap-2 mb-2">
|
|
54
|
-
<button id="toast-pos-top-end" class="kt-btn">Top End (Right)</button>
|
|
55
|
-
<button id="toast-pos-top-center" class="kt-btn">Top Center</button>
|
|
56
|
-
<button id="toast-pos-top-start" class="kt-btn">Top Start (Left)</button>
|
|
57
|
-
<button id="toast-pos-middle-end" class="kt-btn">Middle End (Right)</button>
|
|
58
|
-
<button id="toast-pos-middle-center" class="kt-btn">Middle Center</button>
|
|
59
|
-
<button id="toast-pos-middle-start" class="kt-btn">Middle Start (Left)</button>
|
|
60
|
-
<button id="toast-pos-bottom-end" class="kt-btn">Bottom End (Right)</button>
|
|
61
|
-
<button id="toast-pos-bottom-center" class="kt-btn">Bottom Center</button>
|
|
62
|
-
<button id="toast-pos-bottom-start" class="kt-btn">Bottom Start (Left)</button>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<!-- RTL Testing -->
|
|
67
|
-
<div class="mb-6">
|
|
68
|
-
<h3 class="font-semibold mb-2">RTL Testing</h3>
|
|
69
|
-
<div class="flex flex-wrap gap-2 mb-2">
|
|
70
|
-
<button id="toast-rtl-toggle" class="kt-btn kt-btn-primary">Toggle RTL Mode</button>
|
|
71
|
-
<button id="toast-rtl-test-center" class="kt-btn">Test RTL Top Center</button>
|
|
72
|
-
<button id="toast-rtl-test-middle-center" class="kt-btn">Test RTL Middle Center</button>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="text-xs text-gray-500">Toggle RTL mode to test centering behavior.</div>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<!-- Global Config Example -->
|
|
78
|
-
<div class="mb-6">
|
|
79
|
-
<h3 class="font-semibold mb-2">Global Config</h3>
|
|
80
|
-
<div class="flex flex-wrap gap-2 mb-2">
|
|
81
|
-
<button id="toast-set-global-bottom-end" class="kt-btn kt-btn-primary">Set Global: Bottom End</button>
|
|
82
|
-
<button id="toast-set-global-top-center" class="kt-btn">Set Global: Top Center</button>
|
|
83
|
-
<button id="toast-set-global-reset" class="kt-btn">Reset Global Config</button>
|
|
84
|
-
</div>
|
|
85
|
-
<div class="text-xs text-gray-500">Current global position will apply to all new toasts unless overridden.</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<!-- Other and legacy examples -->
|
|
89
|
-
<div class="flex flex-col gap-3">
|
|
90
|
-
<button id="toast-basic" class="kt-btn">Basic Toast</button>
|
|
91
|
-
<button id="toast-custom-headless" class="kt-btn">Custom Headless Toast</button>
|
|
92
|
-
<button id="toast-description" class="kt-btn">With Description</button>
|
|
93
|
-
<button id="toast-action" class="kt-btn">With Action Button</button>
|
|
94
|
-
<button id="toast-cancel" class="kt-btn">With Cancel Button</button>
|
|
95
|
-
<button id="toast-custom-icon" class="kt-btn">With Custom Icon</button>
|
|
96
|
-
<button id="toast-invert" class="kt-btn">Inverted Colors</button>
|
|
97
|
-
<button id="toast-long" class="kt-btn">Long Duration</button>
|
|
98
|
-
<button id="toast-important" class="kt-btn">Important (No Auto Dismiss)</button>
|
|
99
|
-
<button id="toast-progress-off" class="kt-btn">No Progress Bar</button>
|
|
100
|
-
<button id="toast-close-btn-off" class="kt-btn">No Close Button</button>
|
|
101
|
-
<button id="toast-non-dismissible" class="kt-btn">Non-dismissible</button>
|
|
102
|
-
<button id="toast-position-top-left" class="kt-btn">Position: Top Left</button>
|
|
103
|
-
<button id="toast-position-bottom-center" class="kt-btn">Position: Bottom Center</button>
|
|
104
|
-
<button id="toast-custom-class" class="kt-btn">Custom Class</button>
|
|
105
|
-
<button id="toast-aria" class="kt-btn">Custom ARIA Role</button>
|
|
106
|
-
<button id="toast-callbacks" class="kt-btn">With Callbacks</button>
|
|
107
|
-
<button id="toast-clear" class="kt-btn">Clear All Toasts</button>
|
|
108
|
-
<button id="toast-beep" class="kt-btn kt-btn-primary">Show Toast with Beep</button>
|
|
109
|
-
<button id="toast-hover" class="kt-btn kt-btn-primary">Show Toast (Pause on Hover)</button>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<!-- Hidden template for custom headless toast -->
|
|
114
|
-
<div id="custom-toast-template" style="display:none">
|
|
115
|
-
<div style="padding:1rem; background:#fff; color:#222; border-radius:8px; min-width:220px; max-width:400px; box-shadow:0 2px 12px rgba(0,0,0,0.12); display:flex; align-items:center; gap:1rem;">
|
|
116
|
-
<div>
|
|
117
|
-
<strong>🎉 Custom Headless Toast</strong>
|
|
118
|
-
<div style="font-size:0.95em; color:#555;">This toast uses your own markup and logic!</div>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<!-- Scripts should be outside the template -->
|
|
124
|
-
<script src="../../dist/ktui.js"></script>
|
|
125
|
-
<script>
|
|
126
|
-
// --- Position Examples ---
|
|
127
|
-
const posExamples = [
|
|
128
|
-
{ id: 'toast-pos-top-end', position: 'top-end', label: 'Top End (Right)' },
|
|
129
|
-
{ id: 'toast-pos-top-center', position: 'top-center', label: 'Top Center' },
|
|
130
|
-
{ id: 'toast-pos-top-start', position: 'top-start', label: 'Top Start (Left)' },
|
|
131
|
-
{ id: 'toast-pos-middle-end', position: 'middle-end', label: 'Middle End (Right)' },
|
|
132
|
-
{ id: 'toast-pos-middle-center', position: 'middle-center', label: 'Middle Center' },
|
|
133
|
-
{ id: 'toast-pos-middle-start', position: 'middle-start', label: 'Middle Start (Left)' },
|
|
134
|
-
{ id: 'toast-pos-bottom-end', position: 'bottom-end', label: 'Bottom End (Right)' },
|
|
135
|
-
{ id: 'toast-pos-bottom-center', position: 'bottom-center', label: 'Bottom Center' },
|
|
136
|
-
{ id: 'toast-pos-bottom-start', position: 'bottom-start', label: 'Bottom Start (Left)' }
|
|
137
|
-
];
|
|
138
|
-
posExamples.forEach(({ id, position, label }) => {
|
|
139
|
-
const btn = document.getElementById(id);
|
|
140
|
-
if (btn) {
|
|
141
|
-
btn.addEventListener('click', () => {
|
|
142
|
-
KTToast.show({
|
|
143
|
-
message: `Toast at ${label}`,
|
|
144
|
-
position,
|
|
145
|
-
variant: 'info'
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// --- RTL Testing ---
|
|
152
|
-
let isRTL = false;
|
|
153
|
-
const rtlToggleBtn = document.getElementById('toast-rtl-toggle');
|
|
154
|
-
const rtlTestCenterBtn = document.getElementById('toast-rtl-test-center');
|
|
155
|
-
const rtlTestMiddleCenterBtn = document.getElementById('toast-rtl-test-middle-center');
|
|
156
|
-
|
|
157
|
-
if (rtlToggleBtn) {
|
|
158
|
-
rtlToggleBtn.addEventListener('click', () => {
|
|
159
|
-
isRTL = !isRTL;
|
|
160
|
-
document.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
|
|
161
|
-
rtlToggleBtn.textContent = isRTL ? 'Switch to LTR' : 'Switch to RTL';
|
|
162
|
-
rtlToggleBtn.className = isRTL ? 'kt-btn kt-btn-secondary' : 'kt-btn kt-btn-primary';
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (rtlTestCenterBtn) {
|
|
167
|
-
rtlTestCenterBtn.addEventListener('click', () => {
|
|
168
|
-
KTToast.show({
|
|
169
|
-
message: `RTL Test: Top Center (${isRTL ? 'RTL' : 'LTR'} mode)`,
|
|
170
|
-
position: 'top-center',
|
|
171
|
-
variant: 'info'
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (rtlTestMiddleCenterBtn) {
|
|
177
|
-
rtlTestMiddleCenterBtn.addEventListener('click', () => {
|
|
178
|
-
KTToast.show({
|
|
179
|
-
message: `RTL Test: Middle Center (${isRTL ? 'RTL' : 'LTR'} mode)`,
|
|
180
|
-
position: 'middle-center',
|
|
181
|
-
variant: 'success'
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// --- Global Config Example ---
|
|
187
|
-
const defaultGlobalConfig = {
|
|
188
|
-
position: 'top-end',
|
|
189
|
-
duration: 4000,
|
|
190
|
-
maxToasts: 5,
|
|
191
|
-
gap: 10,
|
|
192
|
-
dismiss: true
|
|
193
|
-
};
|
|
194
|
-
KTToast.config({ ...defaultGlobalConfig }); // Ensure default on load
|
|
195
|
-
|
|
196
|
-
const btnGlobalBottomEnd = document.getElementById('toast-set-global-bottom-end');
|
|
197
|
-
const btnGlobalTopCenter = document.getElementById('toast-set-global-top-center');
|
|
198
|
-
const btnGlobalReset = document.getElementById('toast-set-global-reset');
|
|
199
|
-
|
|
200
|
-
if (btnGlobalBottomEnd) {
|
|
201
|
-
btnGlobalBottomEnd.addEventListener('click', () => {
|
|
202
|
-
KTToast.config({ position: 'bottom-end' });
|
|
203
|
-
KTToast.show({ message: 'Global position set to Bottom End (Right)', variant: 'primary' });
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
if (btnGlobalTopCenter) {
|
|
207
|
-
btnGlobalTopCenter.addEventListener('click', () => {
|
|
208
|
-
KTToast.config({ position: 'top-center' });
|
|
209
|
-
KTToast.show({ message: 'Global position set to Top Center', variant: 'primary' });
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
if (btnGlobalReset) {
|
|
213
|
-
btnGlobalReset.addEventListener('click', () => {
|
|
214
|
-
KTToast.config({ ...defaultGlobalConfig });
|
|
215
|
-
KTToast.show({ message: 'Global config reset to default', variant: 'primary' });
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Beep toast demo
|
|
220
|
-
document.getElementById('toast-beep').addEventListener('click', function() {
|
|
221
|
-
KTToast.show({
|
|
222
|
-
message: 'Beep! Toast with sound.',
|
|
223
|
-
variant: 'success',
|
|
224
|
-
beep: true
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// Pause on hover toast demo
|
|
229
|
-
document.getElementById('toast-hover').addEventListener('click', function() {
|
|
230
|
-
KTToast.show({
|
|
231
|
-
message: 'This toast will pause auto-dismiss while hovered!',
|
|
232
|
-
variant: 'info',
|
|
233
|
-
pauseOnHover: true,
|
|
234
|
-
progress: true,
|
|
235
|
-
duration: 4000
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
// --- Variants ---
|
|
239
|
-
const variants = ['info', 'success', 'error', 'warning', 'primary', 'secondary', 'destructive', 'mono'];
|
|
240
|
-
variants.forEach(variant => {
|
|
241
|
-
const btn = document.getElementById(`toast-variant-${variant}`);
|
|
242
|
-
if (btn) {
|
|
243
|
-
btn.addEventListener('click', () => {
|
|
244
|
-
KTToast.show({
|
|
245
|
-
message: `${variant.charAt(0).toUpperCase() + variant.slice(1)} variant`,
|
|
246
|
-
variant
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
// --- Appearances ---
|
|
253
|
-
const appearances = ['solid', 'outline', 'light'];
|
|
254
|
-
appearances.forEach(appearance => {
|
|
255
|
-
const btn = document.getElementById(`toast-appearance-${appearance}`);
|
|
256
|
-
if (btn) {
|
|
257
|
-
btn.addEventListener('click', () => {
|
|
258
|
-
KTToast.show({
|
|
259
|
-
message: `${appearance.charAt(0).toUpperCase() + appearance.slice(1)} appearance`,
|
|
260
|
-
variant: 'info',
|
|
261
|
-
appearance
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// --- Sizes ---
|
|
268
|
-
const sizes = ['sm', 'md', 'lg'];
|
|
269
|
-
sizes.forEach(size => {
|
|
270
|
-
const btn = document.getElementById(`toast-size-${size}`);
|
|
271
|
-
if (btn) {
|
|
272
|
-
btn.addEventListener('click', () => {
|
|
273
|
-
KTToast.show({
|
|
274
|
-
message: `${size.toUpperCase()} size`,
|
|
275
|
-
variant: 'success',
|
|
276
|
-
size
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// --- Legacy/other examples ---
|
|
283
|
-
// Basic toast
|
|
284
|
-
const btnBasic = document.getElementById('toast-basic');
|
|
285
|
-
btnBasic.addEventListener('click', () => {
|
|
286
|
-
KTToast.show({ message: 'This is a basic toast!' });
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
// With description
|
|
290
|
-
const btnDesc = document.getElementById('toast-description');
|
|
291
|
-
btnDesc.addEventListener('click', () => {
|
|
292
|
-
KTToast.show({
|
|
293
|
-
message: 'Saved!',
|
|
294
|
-
description: 'Your changes have been saved successfully.',
|
|
295
|
-
variant: 'success',
|
|
296
|
-
duration: 3500
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
// With action
|
|
301
|
-
const btnAction = document.getElementById('toast-action');
|
|
302
|
-
btnAction.addEventListener('click', () => {
|
|
303
|
-
KTToast.show({
|
|
304
|
-
message: 'File uploaded',
|
|
305
|
-
description: 'Click undo to revert this action.',
|
|
306
|
-
variant: 'info',
|
|
307
|
-
action: {
|
|
308
|
-
label: 'Undo',
|
|
309
|
-
className: 'text-white kt-link kt-link-underlined',
|
|
310
|
-
onClick: (id) => {
|
|
311
|
-
KTToast.show({ message: 'Undo clicked!', variant: 'warning' });
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
// With cancel
|
|
318
|
-
const btnCancel = document.getElementById('toast-cancel');
|
|
319
|
-
btnCancel.addEventListener('click', () => {
|
|
320
|
-
KTToast.show({
|
|
321
|
-
message: 'Are you sure?',
|
|
322
|
-
description: 'You can cancel this operation.',
|
|
323
|
-
variant: 'warning',
|
|
324
|
-
cancel: {
|
|
325
|
-
label: 'Cancel',
|
|
326
|
-
onClick: (id) => {
|
|
327
|
-
KTToast.show({ message: 'Cancelled!', variant: 'info' });
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
// Custom icon
|
|
334
|
-
const btnCustomIcon = document.getElementById('toast-custom-icon');
|
|
335
|
-
btnCustomIcon.addEventListener('click', () => {
|
|
336
|
-
KTToast.show({
|
|
337
|
-
message: 'Custom Icon!',
|
|
338
|
-
icon: '<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 12l2 2 4-4"/></svg>',
|
|
339
|
-
variant: 'success'
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
// Inverted colors
|
|
344
|
-
const btnInvert = document.getElementById('toast-invert');
|
|
345
|
-
btnInvert.addEventListener('click', () => {
|
|
346
|
-
KTToast.show({
|
|
347
|
-
message: 'Inverted colors!',
|
|
348
|
-
invert: true,
|
|
349
|
-
variant: 'info'
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
// Long duration
|
|
354
|
-
const btnLong = document.getElementById('toast-long');
|
|
355
|
-
btnLong.addEventListener('click', () => {
|
|
356
|
-
KTToast.show({
|
|
357
|
-
message: 'This toast will last 10 seconds.',
|
|
358
|
-
duration: 10000,
|
|
359
|
-
variant: 'info'
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
// Important (no auto dismiss)
|
|
364
|
-
const btnImportant = document.getElementById('toast-important');
|
|
365
|
-
btnImportant.addEventListener('click', () => {
|
|
366
|
-
KTToast.show({
|
|
367
|
-
message: 'This toast will not auto-dismiss.',
|
|
368
|
-
important: true,
|
|
369
|
-
variant: 'error'
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// No progress bar
|
|
374
|
-
const btnProgressOff = document.getElementById('toast-progress-off');
|
|
375
|
-
btnProgressOff.addEventListener('click', () => {
|
|
376
|
-
KTToast.show({
|
|
377
|
-
message: 'Progress bar!',
|
|
378
|
-
progress: true,
|
|
379
|
-
variant: 'info'
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
// No close button
|
|
384
|
-
const btnCloseBtnOff = document.getElementById('toast-close-btn-off');
|
|
385
|
-
btnCloseBtnOff.addEventListener('click', () => {
|
|
386
|
-
KTToast.show({
|
|
387
|
-
message: 'No close button!',
|
|
388
|
-
closeButton: false,
|
|
389
|
-
variant: 'warning'
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
// Non-dismissible
|
|
394
|
-
const btnNonDismiss = document.getElementById('toast-non-dismissible');
|
|
395
|
-
btnNonDismiss.addEventListener('click', () => {
|
|
396
|
-
KTToast.show({
|
|
397
|
-
message: 'You cannot dismiss this toast by clicking it.',
|
|
398
|
-
dismissible: false,
|
|
399
|
-
variant: 'info'
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
// Position top left
|
|
404
|
-
const btnTopLeft = document.getElementById('toast-position-top-left');
|
|
405
|
-
btnTopLeft.addEventListener('click', () => {
|
|
406
|
-
KTToast.show({
|
|
407
|
-
message: 'Top left!',
|
|
408
|
-
position: 'top-start',
|
|
409
|
-
variant: 'success'
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
// Position bottom center
|
|
414
|
-
const btnBottomCenter = document.getElementById('toast-position-bottom-center');
|
|
415
|
-
btnBottomCenter.addEventListener('click', () => {
|
|
416
|
-
KTToast.show({
|
|
417
|
-
message: 'Bottom center!',
|
|
418
|
-
position: 'bottom-center',
|
|
419
|
-
variant: 'info'
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
// Custom class
|
|
424
|
-
const btnCustomClass = document.getElementById('toast-custom-class');
|
|
425
|
-
btnCustomClass.addEventListener('click', () => {
|
|
426
|
-
KTToast.show({
|
|
427
|
-
message: 'Custom class!',
|
|
428
|
-
className: 'bg-pink-500 text-white',
|
|
429
|
-
variant: 'info'
|
|
430
|
-
});
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
// Custom ARIA role
|
|
434
|
-
const btnAria = document.getElementById('toast-aria');
|
|
435
|
-
btnAria.addEventListener('click', () => {
|
|
436
|
-
KTToast.show({
|
|
437
|
-
message: 'Custom ARIA role!',
|
|
438
|
-
role: 'alert',
|
|
439
|
-
variant: 'info'
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
// With callbacks
|
|
444
|
-
const btnCallbacks = document.getElementById('toast-callbacks');
|
|
445
|
-
btnCallbacks.addEventListener('click', () => {
|
|
446
|
-
KTToast.show({
|
|
447
|
-
message: 'Watch the console!',
|
|
448
|
-
variant: 'info',
|
|
449
|
-
onAutoClose: (id) => {
|
|
450
|
-
console.log('Toast auto-closed:', id);
|
|
451
|
-
},
|
|
452
|
-
onDismiss: (id) => {
|
|
453
|
-
console.log('Toast dismissed:', id);
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
// Custom headless toast
|
|
459
|
-
const btnCustomHeadless = document.getElementById('toast-custom-headless');
|
|
460
|
-
btnCustomHeadless.addEventListener('click', () => {
|
|
461
|
-
KTToast.show({
|
|
462
|
-
content: `
|
|
463
|
-
<div class="text-white flex items-center gap-2">
|
|
464
|
-
<span>Custom content</span>
|
|
465
|
-
<button data-kt-toast-dismiss="true" class="kt-btn">×</button>
|
|
466
|
-
</div>
|
|
467
|
-
`
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// Clear all toasts
|
|
472
|
-
const btnClear = document.getElementById('toast-clear');
|
|
473
|
-
btnClear.addEventListener('click', () => {
|
|
474
|
-
KTToast.clearAll();
|
|
475
|
-
});
|
|
476
|
-
</script>
|
|
477
|
-
</body>
|
|
478
|
-
|
|
479
|
-
</html>
|
package/prettier.config.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": ["dom", "es2015"],
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./dist/",
|
|
6
|
-
"sourceMap": true,
|
|
7
|
-
"declaration": false,
|
|
8
|
-
"noImplicitAny": true,
|
|
9
|
-
"module": "commonjs",
|
|
10
|
-
"target": "es5",
|
|
11
|
-
"allowJs": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"moduleResolution": "node"
|
|
14
|
-
},
|
|
15
|
-
"include": ["src/components"],
|
|
16
|
-
"exclude": ["node_modules", "dist"]
|
|
17
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
3
|
-
const TerserPlugin = require('terser-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
module.exports = (env) => {
|
|
6
|
-
const baseConfig = {
|
|
7
|
-
mode: env.production ? 'production' : 'development',
|
|
8
|
-
watch: env.production ? false : true,
|
|
9
|
-
entry: {
|
|
10
|
-
ktui: './src/index.ts',
|
|
11
|
-
// '../index': './src/index.ts',
|
|
12
|
-
|
|
13
|
-
// 'ktui.data': './src/helpers/data.ts',
|
|
14
|
-
// 'ktui.dom': './src/helpers/dom.ts',
|
|
15
|
-
// 'ktui.event-handler': './src/helpers/event-handler.ts',
|
|
16
|
-
// 'ktui.utils': './src/helpers/utils.ts',
|
|
17
|
-
|
|
18
|
-
// 'ktui.accordion': './src/components/accordion/index.ts',
|
|
19
|
-
// 'ktui.collapse': './src/components/collapse/index.ts',
|
|
20
|
-
// 'ktui.datatable': './src/components/datatable/index.ts',
|
|
21
|
-
// 'ktui.dismiss': './src/components/dismiss/index.ts',
|
|
22
|
-
// 'ktui.drawer': './src/components/drawer/index.ts',
|
|
23
|
-
// 'ktui.dropdown': './src/components/dropdown/index.ts',
|
|
24
|
-
// 'ktui.image-input': './src/components/image-input/index.ts',
|
|
25
|
-
// 'ktui.menu': './src/components/menu/index.ts',
|
|
26
|
-
// 'ktui.modal': './src/components/modal/index.ts',
|
|
27
|
-
// 'ktui.reparent': './src/components/reparent/index.ts',
|
|
28
|
-
// 'ktui.scrollable': './src/components/scrollable/index.ts',
|
|
29
|
-
// 'ktui.scrollspy': './src/components/scrollspy/index.ts',
|
|
30
|
-
// 'ktui.scrollto': './src/components/scrollto/index.ts',
|
|
31
|
-
// 'ktui.stepper': './src/components/stepper/index.ts',
|
|
32
|
-
// 'ktui.sticky': './src/components/sticky/index.ts',
|
|
33
|
-
// 'ktui.tabs': './src/components/tabs/index.ts',
|
|
34
|
-
// 'ktui.theme': './src/components/theme/index.ts',
|
|
35
|
-
// 'ktui.toggle': './src/components/toggle/index.ts',
|
|
36
|
-
// 'ktui.toggle-password': './src/components/toggle-password/index.ts',
|
|
37
|
-
// 'ktui.tooltip': './src/components/tooltip/index.ts',
|
|
38
|
-
},
|
|
39
|
-
module: {
|
|
40
|
-
rules: [
|
|
41
|
-
{
|
|
42
|
-
test: /\.js$/,
|
|
43
|
-
enforce: 'pre',
|
|
44
|
-
use: ['source-map-loader'],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
test: /\.js$/,
|
|
48
|
-
exclude: /node_modules/,
|
|
49
|
-
use: {
|
|
50
|
-
loader: 'babel-loader',
|
|
51
|
-
options: {
|
|
52
|
-
presets: ['@babel/preset-env'],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
test: /\.ts$/,
|
|
58
|
-
use: [{ loader: 'ts-loader' }],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
resolve: {
|
|
63
|
-
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
|
64
|
-
},
|
|
65
|
-
plugins: [],
|
|
66
|
-
target: ['web', 'es5'],
|
|
67
|
-
optimization: {
|
|
68
|
-
minimize: env.production,
|
|
69
|
-
minimizer: [
|
|
70
|
-
new TerserPlugin({
|
|
71
|
-
terserOptions: {
|
|
72
|
-
format: {
|
|
73
|
-
comments: false,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
extractComments: false,
|
|
77
|
-
}),
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const normalConfig = {
|
|
83
|
-
...baseConfig,
|
|
84
|
-
output: {
|
|
85
|
-
path: path.resolve(__dirname, 'dist'),
|
|
86
|
-
filename: '[name].js',
|
|
87
|
-
library: { type: 'umd' },
|
|
88
|
-
},
|
|
89
|
-
devtool: false, // Disable sourcemaps for normal JS files
|
|
90
|
-
optimization: {
|
|
91
|
-
...baseConfig.optimization,
|
|
92
|
-
minimize: false, // Disable minimization for normal JS files
|
|
93
|
-
},
|
|
94
|
-
plugins: [
|
|
95
|
-
...baseConfig.plugins,
|
|
96
|
-
new CleanWebpackPlugin({
|
|
97
|
-
cleanOnceBeforeBuildPatterns: ['**/*', '!styles.css'],
|
|
98
|
-
}),
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const minifiedConfig = {
|
|
103
|
-
...baseConfig,
|
|
104
|
-
output: {
|
|
105
|
-
path: path.resolve(__dirname, 'dist'),
|
|
106
|
-
filename: '[name].min.js',
|
|
107
|
-
sourceMapFilename: '[name].min.js.map',
|
|
108
|
-
library: { type: 'umd' },
|
|
109
|
-
},
|
|
110
|
-
devtool: 'source-map', // Enable sourcemaps for minified JS files
|
|
111
|
-
optimization: {
|
|
112
|
-
...baseConfig.optimization,
|
|
113
|
-
minimize: true, // Enable minimization for minified JS files
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return [normalConfig, minifiedConfig];
|
|
118
|
-
};
|