@keenthemes/ktui 1.0.28 → 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/package.json +11 -1
- package/CONTRIBUTING.md +0 -101
- 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,273 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>KTSelect Dynamic Methods Example</title>
|
|
7
|
-
<link href="../../dist/styles.css" rel="stylesheet">
|
|
8
|
-
<script src="../../dist/ktui.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body class="p-8">
|
|
11
|
-
<div class="max-w-4xl mx-auto space-y-8">
|
|
12
|
-
<div>
|
|
13
|
-
<h1 class="text-3xl font-bold mb-4">KTSelect Dynamic Control Methods</h1>
|
|
14
|
-
<p class="text-gray-600 mb-6">
|
|
15
|
-
This example demonstrates the four dynamic control methods:
|
|
16
|
-
<code class="bg-gray-100 px-2 py-1 rounded">enable()</code>,
|
|
17
|
-
<code class="bg-gray-100 px-2 py-1 rounded">disable()</code>,
|
|
18
|
-
<code class="bg-gray-100 px-2 py-1 rounded">update()</code>, and
|
|
19
|
-
<code class="bg-gray-100 px-2 py-1 rounded">refresh()</code>
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<!-- Example 1: Enable/Disable Methods -->
|
|
24
|
-
<div class="border border-gray-200 rounded-lg p-6 space-y-4">
|
|
25
|
-
<h2 class="text-xl font-semibold">1. Enable / Disable Methods</h2>
|
|
26
|
-
<p class="text-sm text-gray-600">
|
|
27
|
-
Programmatically enable or disable the select after initialization.
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
<div>
|
|
31
|
-
<label class="block text-sm font-medium mb-2">Fruit Selection</label>
|
|
32
|
-
<select class="kt-select" id="select1">
|
|
33
|
-
<option value="">Select a fruit</option>
|
|
34
|
-
<option value="apple">Apple</option>
|
|
35
|
-
<option value="banana">Banana</option>
|
|
36
|
-
<option value="cherry">Cherry</option>
|
|
37
|
-
<option value="date">Date</option>
|
|
38
|
-
<option value="elderberry">Elderberry</option>
|
|
39
|
-
</select>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="flex gap-2">
|
|
43
|
-
<button id="enableBtn" class="kt-btn">
|
|
44
|
-
Enable Select
|
|
45
|
-
</button>
|
|
46
|
-
<button id="disableBtn" class="kt-btn kt-btn-secondary">
|
|
47
|
-
Disable Select
|
|
48
|
-
</button>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div id="enableDisableStatus" class="text-sm text-gray-600"></div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<!-- Example 2: Update Method -->
|
|
55
|
-
<div class="border border-gray-200 rounded-lg p-6 space-y-4">
|
|
56
|
-
<h2 class="text-xl font-semibold">2. Update Method</h2>
|
|
57
|
-
<p class="text-sm text-gray-600">
|
|
58
|
-
Sync the dropdown when native select options are modified programmatically.
|
|
59
|
-
</p>
|
|
60
|
-
|
|
61
|
-
<div>
|
|
62
|
-
<label class="block text-sm font-medium mb-2">Programming Languages</label>
|
|
63
|
-
<select class="kt-select" id="select2">
|
|
64
|
-
<option value="">Select a language</option>
|
|
65
|
-
<option value="javascript">JavaScript</option>
|
|
66
|
-
<option value="python">Python</option>
|
|
67
|
-
<option value="java">Java</option>
|
|
68
|
-
</select>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="flex gap-2">
|
|
72
|
-
<button id="addOptionBtn" class="kt-btn">
|
|
73
|
-
Add Option
|
|
74
|
-
</button>
|
|
75
|
-
<button id="removeOptionBtn" class="kt-btn kt-btn-destructive">
|
|
76
|
-
Remove Last Option
|
|
77
|
-
</button>
|
|
78
|
-
<button id="replaceOptionsBtn" class="kt-btn kt-btn-outline">
|
|
79
|
-
Replace All Options
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<div id="updateStatus" class="text-sm text-gray-600"></div>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<!-- Example 3: Refresh Method -->
|
|
87
|
-
<div class="border border-gray-200 rounded-lg p-6 space-y-4">
|
|
88
|
-
<h2 class="text-xl font-semibold">3. Refresh Method</h2>
|
|
89
|
-
<p class="text-sm text-gray-600">
|
|
90
|
-
Refresh the visual display after programmatic selection changes.
|
|
91
|
-
</p>
|
|
92
|
-
|
|
93
|
-
<div>
|
|
94
|
-
<label class="block text-sm font-medium mb-2">Countries (Multiple)</label>
|
|
95
|
-
<select class="kt-select" id="select3" multiple>
|
|
96
|
-
<option value="us">United States</option>
|
|
97
|
-
<option value="uk">United Kingdom</option>
|
|
98
|
-
<option value="ca">Canada</option>
|
|
99
|
-
<option value="au">Australia</option>
|
|
100
|
-
<option value="de">Germany</option>
|
|
101
|
-
</select>
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
<div class="flex gap-2">
|
|
105
|
-
<button id="selectRandomBtn" class="kt-btn">
|
|
106
|
-
Select Random Options
|
|
107
|
-
</button>
|
|
108
|
-
<button id="clearSelectionBtn" class="kt-btn kt-btn-secondary">
|
|
109
|
-
Clear Selection
|
|
110
|
-
</button>
|
|
111
|
-
<button id="refreshBtn" class="kt-btn kt-btn-outline">
|
|
112
|
-
Refresh Display
|
|
113
|
-
</button>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div id="refreshStatus" class="text-sm text-gray-600"></div>
|
|
117
|
-
</div>
|
|
118
|
-
|
|
119
|
-
<!-- Example 4: Event Listeners -->
|
|
120
|
-
<div class="border border-gray-200 rounded-lg p-6 space-y-4">
|
|
121
|
-
<h2 class="text-xl font-semibold">4. Event Listeners</h2>
|
|
122
|
-
<p class="text-sm text-gray-600">
|
|
123
|
-
All dynamic methods dispatch custom events that you can listen to.
|
|
124
|
-
</p>
|
|
125
|
-
|
|
126
|
-
<div class="bg-gray-50 p-4 rounded">
|
|
127
|
-
<h3 class="font-medium mb-2">Event Log:</h3>
|
|
128
|
-
<div id="eventLog" class="text-sm font-mono space-y-1 max-h-48 overflow-y-auto"></div>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<script>
|
|
134
|
-
// Initialize all selects
|
|
135
|
-
const select1 = new KTSelect(document.getElementById('select1'));
|
|
136
|
-
const select2 = new KTSelect(document.getElementById('select2'));
|
|
137
|
-
const select3 = new KTSelect(document.getElementById('select3'), {
|
|
138
|
-
multiple: true,
|
|
139
|
-
enableSelectAll: true
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// Helper to log events
|
|
143
|
-
const eventLog = document.getElementById('eventLog');
|
|
144
|
-
function logEvent(selectId, eventType) {
|
|
145
|
-
const timestamp = new Date().toLocaleTimeString();
|
|
146
|
-
const entry = document.createElement('div');
|
|
147
|
-
entry.className = 'text-gray-700';
|
|
148
|
-
entry.textContent = `[${timestamp}] ${selectId}: ${eventType}`;
|
|
149
|
-
eventLog.prepend(entry);
|
|
150
|
-
|
|
151
|
-
// Keep only last 10 events
|
|
152
|
-
while (eventLog.children.length > 10) {
|
|
153
|
-
eventLog.removeChild(eventLog.lastChild);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Example 1: Enable/Disable Methods
|
|
158
|
-
const enableDisableStatus = document.getElementById('enableDisableStatus');
|
|
159
|
-
|
|
160
|
-
document.getElementById('enableBtn').addEventListener('click', () => {
|
|
161
|
-
select1.enable();
|
|
162
|
-
enableDisableStatus.textContent = '✅ Select enabled';
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
document.getElementById('disableBtn').addEventListener('click', () => {
|
|
166
|
-
select1.disable();
|
|
167
|
-
enableDisableStatus.textContent = '🚫 Select disabled';
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
// Listen to enabled/disabled events
|
|
171
|
-
document.getElementById('select1').addEventListener('enabled', () => {
|
|
172
|
-
logEvent('select1', 'enabled');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
document.getElementById('select1').addEventListener('disabled', () => {
|
|
176
|
-
logEvent('select1', 'disabled');
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// Example 2: Update Method
|
|
180
|
-
const updateStatus = document.getElementById('updateStatus');
|
|
181
|
-
let optionCounter = 1;
|
|
182
|
-
|
|
183
|
-
document.getElementById('addOptionBtn').addEventListener('click', () => {
|
|
184
|
-
const nativeSelect = document.getElementById('select2');
|
|
185
|
-
const newOption = document.createElement('option');
|
|
186
|
-
newOption.value = `lang${optionCounter}`;
|
|
187
|
-
newOption.textContent = `New Language ${optionCounter}`;
|
|
188
|
-
nativeSelect.appendChild(newOption);
|
|
189
|
-
|
|
190
|
-
// Call update to sync the dropdown
|
|
191
|
-
select2.update();
|
|
192
|
-
|
|
193
|
-
updateStatus.textContent = `✅ Added "New Language ${optionCounter}" - dropdown synced`;
|
|
194
|
-
optionCounter++;
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
document.getElementById('removeOptionBtn').addEventListener('click', () => {
|
|
198
|
-
const nativeSelect = document.getElementById('select2');
|
|
199
|
-
const options = nativeSelect.querySelectorAll('option:not([value=""])');
|
|
200
|
-
|
|
201
|
-
if (options.length > 0) {
|
|
202
|
-
options[options.length - 1].remove();
|
|
203
|
-
select2.update();
|
|
204
|
-
updateStatus.textContent = '✅ Removed last option - dropdown synced';
|
|
205
|
-
} else {
|
|
206
|
-
updateStatus.textContent = '⚠️ No options to remove';
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
document.getElementById('replaceOptionsBtn').addEventListener('click', () => {
|
|
211
|
-
// Use update() with newOptions parameter
|
|
212
|
-
select2.update([
|
|
213
|
-
{ value: 'rust', text: 'Rust' },
|
|
214
|
-
{ value: 'go', text: 'Go' },
|
|
215
|
-
{ value: 'typescript', text: 'TypeScript' },
|
|
216
|
-
{ value: 'kotlin', text: 'Kotlin' }
|
|
217
|
-
]);
|
|
218
|
-
|
|
219
|
-
updateStatus.textContent = '✅ Replaced all options with new set';
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// Listen to updated event
|
|
223
|
-
document.getElementById('select2').addEventListener('updated', () => {
|
|
224
|
-
logEvent('select2', 'updated');
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
// Example 3: Refresh Method
|
|
228
|
-
const refreshStatus = document.getElementById('refreshStatus');
|
|
229
|
-
|
|
230
|
-
document.getElementById('selectRandomBtn').addEventListener('click', () => {
|
|
231
|
-
const nativeSelect = document.getElementById('select3');
|
|
232
|
-
const options = Array.from(nativeSelect.options);
|
|
233
|
-
|
|
234
|
-
// Randomly select 2-3 options
|
|
235
|
-
const numToSelect = Math.floor(Math.random() * 2) + 2;
|
|
236
|
-
const shuffled = options.sort(() => 0.5 - Math.random());
|
|
237
|
-
|
|
238
|
-
// Clear all selections first
|
|
239
|
-
options.forEach(opt => opt.selected = false);
|
|
240
|
-
|
|
241
|
-
// Select random options
|
|
242
|
-
shuffled.slice(0, numToSelect).forEach(opt => opt.selected = true);
|
|
243
|
-
|
|
244
|
-
// Refresh to update the display
|
|
245
|
-
select3.refresh();
|
|
246
|
-
|
|
247
|
-
refreshStatus.textContent = `✅ Selected ${numToSelect} random options - display refreshed`;
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
document.getElementById('clearSelectionBtn').addEventListener('click', () => {
|
|
251
|
-
const nativeSelect = document.getElementById('select3');
|
|
252
|
-
Array.from(nativeSelect.options).forEach(opt => opt.selected = false);
|
|
253
|
-
|
|
254
|
-
select3.refresh();
|
|
255
|
-
refreshStatus.textContent = '✅ Cleared all selections - display refreshed';
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
document.getElementById('refreshBtn').addEventListener('click', () => {
|
|
259
|
-
select3.refresh();
|
|
260
|
-
refreshStatus.textContent = '✅ Display refreshed';
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// Listen to refreshed event
|
|
264
|
-
document.getElementById('select3').addEventListener('refreshed', () => {
|
|
265
|
-
logEvent('select3', 'refreshed');
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
// Initial log message
|
|
269
|
-
logEvent('page', 'Examples initialized');
|
|
270
|
-
</script>
|
|
271
|
-
</body>
|
|
272
|
-
</html>
|
|
273
|
-
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Remote Select FormData Test</title>
|
|
7
|
-
<link rel="stylesheet" href="../../dist/styles.css" />
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body class="bg-gray-50 min-h-screen">
|
|
11
|
-
<div class="bg-white rounded-lg shadow p-8 w-full max-w-2xl mt-10 mx-auto">
|
|
12
|
-
<h1 class="text-xl font-semibold text-gray-900 mb-2">
|
|
13
|
-
Remote Select FormData Test
|
|
14
|
-
</h1>
|
|
15
|
-
<p class="text-sm text-gray-600 mb-6">
|
|
16
|
-
Verifies that remote KTSelect fields are included in FormData.
|
|
17
|
-
</p>
|
|
18
|
-
|
|
19
|
-
<form id="testForm" class="flex flex-col gap-6">
|
|
20
|
-
<div>
|
|
21
|
-
<label class="block mb-2 font-medium text-gray-700">
|
|
22
|
-
Regular Input (Control)
|
|
23
|
-
</label>
|
|
24
|
-
<input
|
|
25
|
-
type="text"
|
|
26
|
-
name="regularField"
|
|
27
|
-
value="test value"
|
|
28
|
-
class="w-full px-3 py-2 border border-gray-300 rounded"
|
|
29
|
-
placeholder="Regular input field" />
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div>
|
|
33
|
-
<label class="block mb-2 font-medium text-gray-700">
|
|
34
|
-
Local KTSelect (Control)
|
|
35
|
-
</label>
|
|
36
|
-
<select
|
|
37
|
-
name="localSelect"
|
|
38
|
-
data-kt-select="true"
|
|
39
|
-
class="kt-select">
|
|
40
|
-
<option value="">Select an option...</option>
|
|
41
|
-
<option value="option1">Option 1</option>
|
|
42
|
-
<option value="option2" selected>Option 2</option>
|
|
43
|
-
<option value="option3">Option 3</option>
|
|
44
|
-
</select>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div>
|
|
48
|
-
<label class="block mb-2 font-medium text-gray-700">
|
|
49
|
-
Remote KTSelect (Test Subject)
|
|
50
|
-
</label>
|
|
51
|
-
<select
|
|
52
|
-
name="remoteSelect"
|
|
53
|
-
data-kt-select="true"
|
|
54
|
-
data-kt-select-remote="true"
|
|
55
|
-
data-kt-select-data-url="https://jsonplaceholder.typicode.com/users"
|
|
56
|
-
data-kt-select-data-value-field="id"
|
|
57
|
-
data-kt-select-data-field-text="name"
|
|
58
|
-
data-kt-select-placeholder="Select a user..."
|
|
59
|
-
class="kt-select">
|
|
60
|
-
<option value="">Select a user...</option>
|
|
61
|
-
</select>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="flex gap-3">
|
|
65
|
-
<button
|
|
66
|
-
type="submit"
|
|
67
|
-
class="px-4 py-2 bg-gray-900 text-white text-sm font-medium rounded hover:bg-gray-800">
|
|
68
|
-
Test FormData
|
|
69
|
-
</button>
|
|
70
|
-
<button
|
|
71
|
-
type="button"
|
|
72
|
-
id="checkNativeValue"
|
|
73
|
-
class="px-4 py-2 bg-white border border-gray-300 text-gray-700 text-sm font-medium rounded hover:bg-gray-50">
|
|
74
|
-
Check Native Value
|
|
75
|
-
</button>
|
|
76
|
-
</div>
|
|
77
|
-
</form>
|
|
78
|
-
|
|
79
|
-
<div id="results" class="mt-6 space-y-3 text-sm"></div>
|
|
80
|
-
|
|
81
|
-
<div class="mt-6 p-4 bg-gray-50 border border-gray-200 rounded text-sm">
|
|
82
|
-
<div class="font-medium text-gray-900 mb-2">Test Steps:</div>
|
|
83
|
-
<ol class="list-decimal list-inside space-y-1 text-gray-700">
|
|
84
|
-
<li>Wait for remote data to load</li>
|
|
85
|
-
<li>Select a user from the remote dropdown</li>
|
|
86
|
-
<li>Click "Test FormData"</li>
|
|
87
|
-
<li>Verify remoteSelect field is included</li>
|
|
88
|
-
</ol>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<script src="../../dist/ktui.js"></script>
|
|
93
|
-
<script>
|
|
94
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
95
|
-
// Initialize KTSelect components
|
|
96
|
-
if (typeof KTSelect !== 'undefined') {
|
|
97
|
-
KTSelect.init();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const form = document.getElementById('testForm');
|
|
101
|
-
const resultsDiv = document.getElementById('results');
|
|
102
|
-
const remoteSelectEl = document.querySelector(
|
|
103
|
-
'select[name="remoteSelect"]',
|
|
104
|
-
);
|
|
105
|
-
const checkNativeBtn = document.getElementById('checkNativeValue');
|
|
106
|
-
|
|
107
|
-
checkNativeBtn.addEventListener('click', function () {
|
|
108
|
-
resultsDiv.innerHTML = '';
|
|
109
|
-
const div = document.createElement('div');
|
|
110
|
-
div.className = 'p-3 bg-white border border-gray-200 rounded';
|
|
111
|
-
|
|
112
|
-
const nativeValue = remoteSelectEl.value;
|
|
113
|
-
const selectedOption = remoteSelectEl.querySelector(
|
|
114
|
-
'option[selected]',
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
div.innerHTML = `
|
|
118
|
-
<div class="font-medium text-gray-900 mb-2">Native Select State</div>
|
|
119
|
-
<div class="space-y-1 text-gray-700">
|
|
120
|
-
<div>Value: <code class="bg-gray-100 px-1 rounded text-xs">"${nativeValue}"</code></div>
|
|
121
|
-
<div>Selected Option: ${selectedOption ? `"${selectedOption.value}"` : 'None'}</div>
|
|
122
|
-
</div>
|
|
123
|
-
`;
|
|
124
|
-
resultsDiv.appendChild(div);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
form.addEventListener('submit', function (e) {
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
resultsDiv.innerHTML = '';
|
|
130
|
-
|
|
131
|
-
const formData = new FormData(form);
|
|
132
|
-
const entries = Array.from(formData.entries());
|
|
133
|
-
|
|
134
|
-
const resultDiv = document.createElement('div');
|
|
135
|
-
resultDiv.className = 'p-3 bg-white border border-gray-200 rounded';
|
|
136
|
-
resultDiv.innerHTML = `
|
|
137
|
-
<div class="font-medium text-gray-900 mb-2">FormData Entries (${entries.length})</div>
|
|
138
|
-
<ul class="space-y-1">
|
|
139
|
-
${entries.map(([key, value]) => `<li class="text-xs font-mono text-gray-700"><span class="font-medium">${key}:</span> "${value}"</li>`).join('')}
|
|
140
|
-
</ul>
|
|
141
|
-
`;
|
|
142
|
-
resultsDiv.appendChild(resultDiv);
|
|
143
|
-
|
|
144
|
-
const remoteSelectValue = formData.get('remoteSelect');
|
|
145
|
-
const verdict = document.createElement('div');
|
|
146
|
-
verdict.className = `p-3 mt-3 rounded border ${
|
|
147
|
-
remoteSelectValue
|
|
148
|
-
? 'bg-white border-gray-900'
|
|
149
|
-
: 'bg-gray-100 border-gray-400'
|
|
150
|
-
}`;
|
|
151
|
-
verdict.innerHTML = `
|
|
152
|
-
<div class="font-medium ${remoteSelectValue ? 'text-gray-900' : 'text-gray-700'}">
|
|
153
|
-
${remoteSelectValue ? 'PASS' : 'FAIL'}: Remote Select Field
|
|
154
|
-
</div>
|
|
155
|
-
`;
|
|
156
|
-
resultsDiv.appendChild(verdict);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
</script>
|
|
160
|
-
</body>
|
|
161
|
-
</html>
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>KTSelect Global Config Test</title>
|
|
7
|
-
<link href="../../dist/styles.css" rel="stylesheet">
|
|
8
|
-
<script src="../../dist/ktui.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body class="p-8">
|
|
11
|
-
<div class="max-w-2xl mx-auto space-y-8">
|
|
12
|
-
<div>
|
|
13
|
-
<h1 class="text-3xl font-bold mb-4">KTSelect.config() Test</h1>
|
|
14
|
-
<p class="text-gray-600 mb-6">
|
|
15
|
-
This page demonstrates the <code class="bg-gray-100 px-2 py-1 rounded">KTSelect.config()</code>
|
|
16
|
-
static method for setting global defaults.
|
|
17
|
-
</p>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<div class="space-y-4">
|
|
21
|
-
<h2 class="text-xl font-semibold">Test 1: Global Config Applied</h2>
|
|
22
|
-
<p class="text-sm text-gray-600">
|
|
23
|
-
All selects below should have search enabled and custom placeholder from global config.
|
|
24
|
-
</p>
|
|
25
|
-
|
|
26
|
-
<div>
|
|
27
|
-
<label class="block text-sm font-medium mb-2">Select 1 (inherits global config)</label>
|
|
28
|
-
<select class="kt-select" id="select1">
|
|
29
|
-
<option value="">Select an option</option>
|
|
30
|
-
<option value="1">Option 1</option>
|
|
31
|
-
<option value="2">Option 2</option>
|
|
32
|
-
<option value="3">Option 3</option>
|
|
33
|
-
<option value="4">Option 4</option>
|
|
34
|
-
<option value="5">Option 5</option>
|
|
35
|
-
</select>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div>
|
|
39
|
-
<label class="block text-sm font-medium mb-2">Select 2 (inherits global config)</label>
|
|
40
|
-
<select class="kt-select" id="select2">
|
|
41
|
-
<option value="">Select an option</option>
|
|
42
|
-
<option value="apple">Apple</option>
|
|
43
|
-
<option value="banana">Banana</option>
|
|
44
|
-
<option value="cherry">Cherry</option>
|
|
45
|
-
<option value="date">Date</option>
|
|
46
|
-
<option value="elderberry">Elderberry</option>
|
|
47
|
-
</select>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div>
|
|
51
|
-
<label class="block text-sm font-medium mb-2">Select 3 (overrides global config - no search)</label>
|
|
52
|
-
<select class="kt-select" id="select3">
|
|
53
|
-
<option value="">Select an option</option>
|
|
54
|
-
<option value="red">Red</option>
|
|
55
|
-
<option value="green">Green</option>
|
|
56
|
-
<option value="blue">Blue</option>
|
|
57
|
-
</select>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<script>
|
|
63
|
-
// Set global defaults once
|
|
64
|
-
KTSelect.config({
|
|
65
|
-
enableSearch: true,
|
|
66
|
-
searchPlaceholder: 'Type to search...',
|
|
67
|
-
dropdownZindex: 9999,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// These selects inherit the global config
|
|
71
|
-
const select1 = new KTSelect(document.getElementById('select1'));
|
|
72
|
-
const select2 = new KTSelect(document.getElementById('select2'));
|
|
73
|
-
|
|
74
|
-
// This select overrides the global config
|
|
75
|
-
const select3 = new KTSelect(document.getElementById('select3'), {
|
|
76
|
-
enableSearch: false
|
|
77
|
-
});
|
|
78
|
-
</script>
|
|
79
|
-
</body>
|
|
80
|
-
</html>
|
|
81
|
-
|
|
@@ -1,50 +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>Icon Multiple</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-sm mt-10 mx-auto">
|
|
13
|
-
<form class="flex flex-col gap-6">
|
|
14
|
-
<div>
|
|
15
|
-
<label class="block mb-2 font-medium text-gray-700" for="select-basic">Icon Multiple</label>
|
|
16
|
-
|
|
17
|
-
<select
|
|
18
|
-
class="kt-select kt-select-lg"
|
|
19
|
-
data-kt-select="true"
|
|
20
|
-
data-kt-select-multiple="true"
|
|
21
|
-
data-kt-select-placeholder="Select an option"
|
|
22
|
-
data-kt-select-config='{
|
|
23
|
-
"displaySeparator": ", ",
|
|
24
|
-
"displayTemplate": "<div class=\"flex items-center gap-2 [&>svg]:size-3.5\">{{icon}}<span class=\"text-foreground\">{{text}}</span></div>",
|
|
25
|
-
"optionTemplate": "<div class=\"flex items-center gap-2\">{{icon}} <span class=\"text-foreground\">{{text}}</span></div><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-3.5 ms-auto hidden text-primary kt-select-option-selected:block\"><path d=\"M20 6 9 17l-5-5\"/></svg></div>"
|
|
26
|
-
}'>
|
|
27
|
-
<option value="hardwere" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><circle cx=\"19\" cy=\"6\" r=\"3\"/><path d=\"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9\/><path d=\"M12 17v4\/><path d=\"M8 21h8\"/></svg>"}'>
|
|
28
|
-
Hardwere
|
|
29
|
-
</option>
|
|
30
|
-
<option value="software" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><path d=\"M10 10.5 8 13l2 2.5\/><path d=\"m14 10.5 2 2.5-2 2.5\/><path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z\"/></svg>"}'>
|
|
31
|
-
Software
|
|
32
|
-
</option>
|
|
33
|
-
<option value="network" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\/><path d=\"M12 12V8\/></svg>"}'>
|
|
34
|
-
Network
|
|
35
|
-
</option>
|
|
36
|
-
<option value="storage" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"/><path d=\"M3 5V19A9 3 0 0 0 21 19V5\/><path d=\"M3 12A9 3 0 0 0 21 12\"/></svg>"}'>
|
|
37
|
-
Storage
|
|
38
|
-
</option>
|
|
39
|
-
<option value="security" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><circle cx=\"12\" cy=\"16\" r=\"1\"/><rect x=\"3\" y=\"10\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M7 10V7a5 5 0 0 1 10 0v3\"/></svg>"}'>
|
|
40
|
-
Security
|
|
41
|
-
</option>
|
|
42
|
-
</select>
|
|
43
|
-
|
|
44
|
-
</div>
|
|
45
|
-
</form>
|
|
46
|
-
</div>
|
|
47
|
-
<script src="../../dist/ktui.js"></script>
|
|
48
|
-
</body>
|
|
49
|
-
|
|
50
|
-
</html>
|
|
@@ -1,48 +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>Icon</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-sm mt-10 mx-auto">
|
|
13
|
-
<form class="flex flex-col gap-6">
|
|
14
|
-
<div>
|
|
15
|
-
<label class="block mb-2 font-medium text-gray-700" for="select-basic">Icon</label>
|
|
16
|
-
|
|
17
|
-
<select
|
|
18
|
-
class="kt-select"
|
|
19
|
-
data-kt-select="true"
|
|
20
|
-
data-kt-select-placeholder="Select an option..."
|
|
21
|
-
data-kt-select-config='{
|
|
22
|
-
"displayTemplate": "<div class=\"flex items-center gap-2\">{{icon}}<span class=\"text-foreground\">{{text}}</span></div>",
|
|
23
|
-
"optionTemplate": "<div class=\"flex items-center gap-2\">{{icon}} <span class=\"text-foreground\">{{text}}</span></div><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-3.5 ms-auto hidden text-primary kt-select-option-selected:block\"><path d=\"M20 6 9 17l-5-5\"/></svg></div>"
|
|
24
|
-
}'>
|
|
25
|
-
<option value="hardwere" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><circle cx=\"19\" cy=\"6\" r=\"3\"/><path d=\"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9\/><path d=\"M12 17v4\/><path d=\"M8 21h8\"/></svg>"}'>
|
|
26
|
-
Hardwere
|
|
27
|
-
</option>
|
|
28
|
-
<option value="software" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><path d=\"M10 10.5 8 13l2 2.5\/><path d=\"m14 10.5 2 2.5-2 2.5\/><path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z\"/></svg>"}'>
|
|
29
|
-
Software
|
|
30
|
-
</option>
|
|
31
|
-
<option value="network" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><rect x=\"16\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"2\" y=\"16\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3\/><path d=\"M12 12V8\/></svg>"}'>
|
|
32
|
-
Network
|
|
33
|
-
</option>
|
|
34
|
-
<option value="storage" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"/><path d=\"M3 5V19A9 3 0 0 0 21 19V5\/><path d=\"M3 12A9 3 0 0 0 21 12\"/></svg>"}'>
|
|
35
|
-
Storage
|
|
36
|
-
</option>
|
|
37
|
-
<option value="security" data-kt-select-option='{"icon": "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"size-4 text-muted-foreground\"><circle cx=\"12\" cy=\"16\" r=\"1\"/><rect x=\"3\" y=\"10\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M7 10V7a5 5 0 0 1 10 0v3\"/></svg>"}'>
|
|
38
|
-
Storage
|
|
39
|
-
</option>
|
|
40
|
-
</select>
|
|
41
|
-
|
|
42
|
-
</div>
|
|
43
|
-
</form>
|
|
44
|
-
</div>
|
|
45
|
-
<script src="../../dist/ktui.js"></script>
|
|
46
|
-
</body>
|
|
47
|
-
|
|
48
|
-
</html>
|
|
@@ -1,38 +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>Max Selection</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-sm mt-10 mx-auto">
|
|
13
|
-
<form class="flex flex-col gap-6">
|
|
14
|
-
<div>
|
|
15
|
-
<label class="block mb-2 font-medium text-gray-700" for="select-basic">Max Selection</label>
|
|
16
|
-
|
|
17
|
-
<select
|
|
18
|
-
class="kt-select"
|
|
19
|
-
data-kt-select="true"
|
|
20
|
-
data-kt-select-multiple="true"
|
|
21
|
-
data-kt-select-max-selections="3"
|
|
22
|
-
data-kt-select-placeholder="Select up to 3 options">
|
|
23
|
-
<option value="react">React</option>
|
|
24
|
-
<option value="nextjs">Next.js</option>
|
|
25
|
-
<option value="angular">Angular</option>
|
|
26
|
-
<option value="vue">Vue</option>
|
|
27
|
-
<option value="svelte">Svelte</option>
|
|
28
|
-
<option value="ember">Ember</option>
|
|
29
|
-
<option value="nuxt">Nuxt.js</option>
|
|
30
|
-
</select>
|
|
31
|
-
|
|
32
|
-
</div>
|
|
33
|
-
</form>
|
|
34
|
-
</div>
|
|
35
|
-
<script src="../../dist/ktui.js"></script>
|
|
36
|
-
</body>
|
|
37
|
-
|
|
38
|
-
</html>
|