@ktjs/mui 0.19.0 → 0.20.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.
- package/dist/index.d.ts +130 -131
- package/dist/index.iife.js +131 -130
- package/dist/index.mjs +132 -130
- package/package.json +3 -3
package/dist/index.iife.js
CHANGED
|
@@ -11,6 +11,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// DOM manipulation utilities
|
|
14
|
+
// # dom natives
|
|
14
15
|
/**
|
|
15
16
|
* & Remove `bind` because it is shockingly slower than wrapper
|
|
16
17
|
* & `window.document` is safe because it is not configurable and its setter is undefined
|
|
@@ -46,10 +47,11 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
46
47
|
$appendChild.call(this, fragment);
|
|
47
48
|
}
|
|
48
49
|
};
|
|
50
|
+
const { get: $buttonDisabledGetter$2, set: $buttonDisabledSetter$2 } = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled');
|
|
49
51
|
|
|
50
52
|
// Shared utilities and cached native methods for kt.js framework
|
|
51
53
|
// Re-export all utilities
|
|
52
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
54
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.0' });
|
|
53
55
|
|
|
54
56
|
const booleanHandler = (element, key, value) => {
|
|
55
57
|
if (key in element) {
|
|
@@ -203,7 +205,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
203
205
|
* ## About
|
|
204
206
|
* @package @ktjs/core
|
|
205
207
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
206
|
-
* @version 0.
|
|
208
|
+
* @version 0.20.0 (Last Update: 2026.02.01 00:47:09.995)
|
|
207
209
|
* @license MIT
|
|
208
210
|
* @link https://github.com/baendlorel/kt.js
|
|
209
211
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -234,18 +236,10 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
234
236
|
function jsx(tag, props = {}) {
|
|
235
237
|
const ref = props.ref?.isKT ? props.ref : dummyRef;
|
|
236
238
|
let el;
|
|
237
|
-
const redraw = (newProps) => {
|
|
238
|
-
props = newProps ? { ...props, ...newProps } : props;
|
|
239
|
-
el = jsx(tag, props);
|
|
240
|
-
if (ref !== dummyRef) {
|
|
241
|
-
ref.value = el; // & ref setter automatically replaces old element in DOM
|
|
242
|
-
}
|
|
243
|
-
return el;
|
|
244
|
-
};
|
|
245
239
|
if ('k-if' in props && !props['k-if']) {
|
|
240
|
+
// & make comment placeholder in case that ref might be redrawn later
|
|
246
241
|
el = document.createComment('k-if');
|
|
247
|
-
ref.value = el;
|
|
248
|
-
el.redraw = redraw;
|
|
242
|
+
ref.value = el;
|
|
249
243
|
return el;
|
|
250
244
|
}
|
|
251
245
|
// Handle function components
|
|
@@ -255,7 +249,6 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
255
249
|
else {
|
|
256
250
|
el = h(tag, props, props.children);
|
|
257
251
|
}
|
|
258
|
-
el.redraw ??= redraw;
|
|
259
252
|
ref.value = el;
|
|
260
253
|
return el;
|
|
261
254
|
}
|
|
@@ -265,57 +258,16 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
265
258
|
*/
|
|
266
259
|
const jsxs = jsx;
|
|
267
260
|
|
|
268
|
-
/**s
|
|
269
|
-
* Alert component - mimics MUI Alert appearance and behavior
|
|
270
|
-
*/
|
|
271
|
-
function Alert(props) {
|
|
272
|
-
const { children, style = '', severity = 'info', variant = 'standard', icon, 'kt:close': onClose } = props;
|
|
273
|
-
const classes = `mui-alert mui-alert-${severity} mui-alert-${variant} ${props.class ? props.class : ''}`;
|
|
274
|
-
// Convert sx object to style string
|
|
275
|
-
let styleString = typeof style === 'string' ? style : '';
|
|
276
|
-
if (style && typeof style === 'object') {
|
|
277
|
-
const sxStyles = Object.entries(style)
|
|
278
|
-
.map(([key, value]) => {
|
|
279
|
-
// Convert camelCase to kebab-case
|
|
280
|
-
const cssKey = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
281
|
-
return `${cssKey}: ${value}`;
|
|
282
|
-
})
|
|
283
|
-
.join('; ');
|
|
284
|
-
styleString = styleString ? `${styleString}; ${sxStyles}` : sxStyles;
|
|
285
|
-
}
|
|
286
|
-
// Icon SVG paths for different severities
|
|
287
|
-
const getIcon = () => {
|
|
288
|
-
if (icon === false)
|
|
289
|
-
return null;
|
|
290
|
-
if (icon)
|
|
291
|
-
return icon;
|
|
292
|
-
const iconSize = '22px';
|
|
293
|
-
const iconClass = 'mui-alert-icon';
|
|
294
|
-
switch (severity) {
|
|
295
|
-
case 'success':
|
|
296
|
-
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }));
|
|
297
|
-
case 'error':
|
|
298
|
-
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }));
|
|
299
|
-
case 'warning':
|
|
300
|
-
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }));
|
|
301
|
-
case 'info':
|
|
302
|
-
default:
|
|
303
|
-
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }));
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
const alertIcon = getIcon();
|
|
307
|
-
const alert = (jsxs("div", { class: classes, style: styleString, role: "alert", children: [alertIcon && jsx("div", { class: "mui-alert-icon-wrapper", children: alertIcon }), jsx("div", { class: "mui-alert-message", children: children }), onClose && (jsx("button", { class: "mui-alert-close", "on:click": onClose, "aria-label": "Close", children: jsx("svg", { viewBox: "0 0 24 24", width: "18px", height: "18px", children: jsx("path", { fill: "currentColor", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }))] }));
|
|
308
|
-
return alert;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
261
|
// Cached native methods for performance optimization
|
|
262
|
+
const $defines = Object.defineProperties;
|
|
312
263
|
|
|
313
264
|
// String manipulation utilities
|
|
314
265
|
/**
|
|
315
266
|
* Default empty function
|
|
316
267
|
*/
|
|
317
268
|
const $emptyFn = (() => true);
|
|
318
|
-
|
|
269
|
+
const { get: $buttonDisabledGetter$1, set: $buttonDisabledSetter$1 } = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled');
|
|
270
|
+
// # DOM utilities
|
|
319
271
|
const parseStyle = (style) => {
|
|
320
272
|
if (typeof style === 'string') {
|
|
321
273
|
return style;
|
|
@@ -344,25 +296,54 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
344
296
|
|
|
345
297
|
// Shared utilities and cached native methods for kt.js framework
|
|
346
298
|
// Re-export all utilities
|
|
347
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
299
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.0' });
|
|
300
|
+
|
|
301
|
+
function Alert(props) {
|
|
302
|
+
const { children, severity = 'info', variant = 'standard', icon, 'kt:close': onClose } = props;
|
|
303
|
+
const classes = `mui-alert mui-alert-${severity} mui-alert-${variant} ${props.class ? props.class : ''}`;
|
|
304
|
+
// Icon SVG paths for different severities
|
|
305
|
+
const getIcon = () => {
|
|
306
|
+
if (icon === false) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
if (icon) {
|
|
310
|
+
return icon;
|
|
311
|
+
}
|
|
312
|
+
const iconSize = '22px';
|
|
313
|
+
const iconClass = 'mui-alert-icon';
|
|
314
|
+
switch (severity) {
|
|
315
|
+
case 'success':
|
|
316
|
+
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }));
|
|
317
|
+
case 'error':
|
|
318
|
+
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }));
|
|
319
|
+
case 'warning':
|
|
320
|
+
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }));
|
|
321
|
+
case 'info':
|
|
322
|
+
default:
|
|
323
|
+
return (jsx("svg", { class: iconClass, viewBox: "0 0 24 24", width: iconSize, height: iconSize, children: jsx("path", { fill: "currentColor", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }));
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
const alertIcon = getIcon();
|
|
327
|
+
const alert = (jsxs("div", { class: classes, style: parseStyle(props.style), role: "alert", children: [alertIcon && jsx("div", { class: "mui-alert-icon-wrapper", children: alertIcon }), jsx("div", { class: "mui-alert-message", children: children }), onClose && (jsx("button", { class: "mui-alert-close", "on:click": onClose, "aria-label": "Close", children: jsx("svg", { viewBox: "0 0 24 24", width: "18px", height: "18px", children: jsx("path", { fill: "currentColor", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }))] }));
|
|
328
|
+
return alert;
|
|
329
|
+
}
|
|
348
330
|
|
|
349
331
|
/**
|
|
350
332
|
* Button component - mimics MUI Button appearance and behavior
|
|
351
333
|
*/
|
|
352
334
|
function Button(props) {
|
|
353
|
-
|
|
335
|
+
let { children, variant = 'text', color = 'primary', size = 'medium', disabled = false, fullWidth = false, iconOnly = false, startIcon, endIcon, type = 'button', 'on:click': onClick = $emptyFn, } = props;
|
|
354
336
|
const classes = [
|
|
355
337
|
'mui-button',
|
|
356
338
|
`mui-button-${variant}`,
|
|
357
339
|
`mui-button-${variant}-${color}`,
|
|
358
340
|
`mui-button-size-${size}`,
|
|
359
|
-
fullWidth
|
|
360
|
-
iconOnly
|
|
361
|
-
disabled
|
|
341
|
+
fullWidth ? 'mui-button-fullwidth' : '',
|
|
342
|
+
iconOnly ? 'mui-button-icon-only' : '',
|
|
343
|
+
disabled ? 'mui-button-disabled' : '',
|
|
362
344
|
props.class ? props.class : '',
|
|
363
|
-
]
|
|
364
|
-
|
|
365
|
-
.join(' ');
|
|
345
|
+
].join(' ');
|
|
346
|
+
const rippleContainer = jsx("span", { class: "mui-button-ripple" });
|
|
366
347
|
const handleClick = (e) => {
|
|
367
348
|
if (disabled) {
|
|
368
349
|
e.preventDefault();
|
|
@@ -370,7 +351,6 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
370
351
|
}
|
|
371
352
|
// Create ripple effect
|
|
372
353
|
const button = e.currentTarget;
|
|
373
|
-
const rippleContainer = button.querySelector('.mui-button-ripple');
|
|
374
354
|
if (rippleContainer) {
|
|
375
355
|
const rect = button.getBoundingClientRect();
|
|
376
356
|
const size = Math.max(rect.width, rect.height);
|
|
@@ -383,13 +363,21 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
383
363
|
ripple.classList.add('mui-button-ripple-effect');
|
|
384
364
|
rippleContainer.appendChild(ripple);
|
|
385
365
|
// Remove ripple after animation
|
|
386
|
-
setTimeout(() =>
|
|
387
|
-
ripple.remove();
|
|
388
|
-
}, 600);
|
|
366
|
+
setTimeout(() => ripple.remove(), 600);
|
|
389
367
|
}
|
|
390
368
|
onClick(e);
|
|
391
369
|
};
|
|
392
|
-
|
|
370
|
+
const container = (jsxs("button", { class: classes, style: parseStyle(props.style), type: type, disabled: disabled, "on:click": handleClick, children: [startIcon && jsx("span", { class: "mui-button-start-icon", children: startIcon }), jsx("span", { class: "mui-button-label", children: children }), endIcon && jsx("span", { class: "mui-button-end-icon", children: endIcon }), rippleContainer] }));
|
|
371
|
+
$defines(container, {
|
|
372
|
+
disabled: {
|
|
373
|
+
get: $buttonDisabledGetter$1,
|
|
374
|
+
set: function (value) {
|
|
375
|
+
$buttonDisabledSetter$1.call(this, value);
|
|
376
|
+
this.classList.toggle('mui-button-disabled', value);
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
return container;
|
|
393
381
|
}
|
|
394
382
|
|
|
395
383
|
/**
|
|
@@ -430,7 +418,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
430
418
|
// Initialize icon state
|
|
431
419
|
toggleIcon(checked, indeterminate);
|
|
432
420
|
const container = (jsxs("label", { class: `mui-checkbox-wrapper mui-checkbox-size-${size} ${disabled ? 'mui-checkbox-disabled' : ''} mui-checkbox-color-${color}`, children: [inputEl, jsxs("span", { class: "mui-checkbox-icon", children: [uncheckedIcon, checkedIcon, indeterminateIcon] }), jsx("span", { "k-if": label, class: "mui-checkbox-label", children: label })] }));
|
|
433
|
-
|
|
421
|
+
$defines(container, {
|
|
434
422
|
checked: {
|
|
435
423
|
get() {
|
|
436
424
|
return checked;
|
|
@@ -496,7 +484,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
496
484
|
return Checkbox(o);
|
|
497
485
|
});
|
|
498
486
|
const container = (jsx("div", { class: `mui-checkbox-group ${row ? 'mui-checkbox-group-row' : ''} ${props.class ? props.class : ''}`, style: props.style ? props.style : '', role: "group", children: checkboxes }));
|
|
499
|
-
|
|
487
|
+
$defines(container, {
|
|
500
488
|
value: {
|
|
501
489
|
get() {
|
|
502
490
|
return Array.from(selectedValues);
|
|
@@ -567,26 +555,28 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
567
555
|
}
|
|
568
556
|
return originalRemove.call(container);
|
|
569
557
|
};
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
558
|
+
$defines(container, {
|
|
559
|
+
open: {
|
|
560
|
+
get: () => open,
|
|
561
|
+
set: (isOpen) => {
|
|
562
|
+
if (isOpen === open) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
open = isOpen;
|
|
566
|
+
if (isOpen) {
|
|
567
|
+
// Opening: set display first, then add class with double RAF for animation
|
|
568
|
+
container.style.display = 'flex';
|
|
569
|
+
setTimeout(() => container.classList.add('kt-dialog-backdrop-open'), 50);
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
container.classList.remove('kt-dialog-backdrop-open');
|
|
573
|
+
setTimeout(() => {
|
|
574
|
+
if (!open) {
|
|
575
|
+
container.style.display = 'none';
|
|
576
|
+
}
|
|
577
|
+
}, 225);
|
|
578
|
+
}
|
|
579
|
+
},
|
|
590
580
|
},
|
|
591
581
|
});
|
|
592
582
|
return container;
|
|
@@ -617,10 +607,11 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
617
607
|
}
|
|
618
608
|
|
|
619
609
|
// Cached native methods for performance optimization
|
|
610
|
+
const { get: $buttonDisabledGetter, set: $buttonDisabledSetter } = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, 'disabled');
|
|
620
611
|
|
|
621
612
|
// Shared utilities and cached native methods for kt.js framework
|
|
622
613
|
// Re-export all utilities
|
|
623
|
-
Object.defineProperty(window, '@ktjs/shared', { value: '0.
|
|
614
|
+
Object.defineProperty(window, '@ktjs/shared', { value: '0.20.0' });
|
|
624
615
|
|
|
625
616
|
document.createElement('div');
|
|
626
617
|
|
|
@@ -695,13 +686,12 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
695
686
|
*/
|
|
696
687
|
function createRedrawable(creator) {
|
|
697
688
|
const elRef = ref();
|
|
698
|
-
elRef.value = creator();
|
|
699
689
|
const redraw = () => {
|
|
700
690
|
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
701
|
-
elRef.
|
|
691
|
+
elRef.redraw = redraw;
|
|
702
692
|
return elRef.value;
|
|
703
693
|
};
|
|
704
|
-
|
|
694
|
+
redraw();
|
|
705
695
|
return elRef;
|
|
706
696
|
}
|
|
707
697
|
|
|
@@ -721,15 +711,17 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
721
711
|
let progressValue = Math.min(Math.max(value, 0), 100);
|
|
722
712
|
const barRef = ref();
|
|
723
713
|
const container = (jsx("div", { class: classes, style: styleString, role: "progressbar", "aria-valuenow": progressValue, children: jsx("div", { ref: barRef, class: "mui-linear-progress-bar", style: variant === 'determinate' ? `width: ${progressValue}%` : '' }) }));
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
714
|
+
$defines(container, {
|
|
715
|
+
progress: {
|
|
716
|
+
get() {
|
|
717
|
+
return progressValue;
|
|
718
|
+
},
|
|
719
|
+
set(newValue) {
|
|
720
|
+
progressValue = Math.min(Math.max(newValue, 0), 100);
|
|
721
|
+
if (variant === 'determinate') {
|
|
722
|
+
barRef.value.style.width = `${progressValue}%`;
|
|
723
|
+
}
|
|
724
|
+
},
|
|
733
725
|
},
|
|
734
726
|
});
|
|
735
727
|
return container;
|
|
@@ -802,7 +794,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
802
794
|
const container = (jsxs("div", { class: 'mui-textfield-root ' + (props.class ? props.class : ''), style: parseStyle(props.style), children: [wrapperRef, helperTextEl] }));
|
|
803
795
|
// Initialize classes
|
|
804
796
|
setTimeout(() => updateContainerClass(), 0);
|
|
805
|
-
|
|
797
|
+
$defines(container, {
|
|
806
798
|
value: {
|
|
807
799
|
get() {
|
|
808
800
|
return inputEl.value;
|
|
@@ -818,7 +810,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
818
810
|
},
|
|
819
811
|
set(newLabel) {
|
|
820
812
|
label = newLabel;
|
|
821
|
-
wrapperRef.
|
|
813
|
+
wrapperRef.redraw(); // label takes too much and should be redrawn
|
|
822
814
|
updateContainerClass();
|
|
823
815
|
},
|
|
824
816
|
},
|
|
@@ -906,7 +898,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
906
898
|
// initialize icon state
|
|
907
899
|
toggleIcon(checked);
|
|
908
900
|
const container = (jsxs("label", { class: `mui-radio-wrapper ${props.class ?? ''} mui-radio-size-${size} ${disabled ? 'mui-radio-disabled' : ''} mui-radio-color-${color}`, style: parseStyle(props.style), children: [input, jsxs("span", { class: "mui-radio-icon", children: [uncheckedIcon, checkedIcon] }), jsx("span", { class: "mui-radio-label", children: text })] }));
|
|
909
|
-
|
|
901
|
+
$defines(container, {
|
|
910
902
|
value: {
|
|
911
903
|
get() {
|
|
912
904
|
return value;
|
|
@@ -953,7 +945,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
953
945
|
return Radio(o);
|
|
954
946
|
});
|
|
955
947
|
const container = (jsx("div", { class: `mui-radio-group ${row ? 'mui-radio-group-row' : ''} ${props.class ?? ''}`, style: parseStyle(props.style), role: "radiogroup", children: radios }));
|
|
956
|
-
|
|
948
|
+
$defines(container, {
|
|
957
949
|
value: {
|
|
958
950
|
get() {
|
|
959
951
|
return value;
|
|
@@ -976,6 +968,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
976
968
|
let isOpen = false;
|
|
977
969
|
let isFocused = false;
|
|
978
970
|
const selectRef = ref();
|
|
971
|
+
const selectLabelRef = ref();
|
|
979
972
|
// Toggle dropdown
|
|
980
973
|
const toggleMenu = () => {
|
|
981
974
|
if (disabled) {
|
|
@@ -988,12 +981,9 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
988
981
|
const updateMenu = () => {
|
|
989
982
|
if (isOpen) {
|
|
990
983
|
menu.value.style.display = 'block';
|
|
991
|
-
// Trigger reflow to enable animation
|
|
992
|
-
void menu.value.offsetHeight;
|
|
993
|
-
menu.value.classList.add('mui-select-menu-open');
|
|
984
|
+
void menu.value.offsetHeight; // & Trigger reflow to enable animation
|
|
994
985
|
}
|
|
995
986
|
else {
|
|
996
|
-
menu.value.classList.remove('mui-select-menu-open');
|
|
997
987
|
// Hide after animation completes
|
|
998
988
|
setTimeout(() => {
|
|
999
989
|
if (!isOpen) {
|
|
@@ -1001,6 +991,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
1001
991
|
}
|
|
1002
992
|
}, 200);
|
|
1003
993
|
}
|
|
994
|
+
menu.value.classList.toggle('mui-select-menu-open', isOpen);
|
|
1004
995
|
selectRef.value.classList.toggle('mui-select-open', isOpen);
|
|
1005
996
|
};
|
|
1006
997
|
// Handle option click
|
|
@@ -1010,11 +1001,8 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
1010
1001
|
onChange(value);
|
|
1011
1002
|
updateMenu();
|
|
1012
1003
|
updateLabelState();
|
|
1013
|
-
valueDisplay.
|
|
1014
|
-
setTimeout(() =>
|
|
1015
|
-
// Trigger redraw of parent if needed
|
|
1016
|
-
menu.value.redraw();
|
|
1017
|
-
}, 200);
|
|
1004
|
+
valueDisplay.redraw();
|
|
1005
|
+
setTimeout(() => menu.redraw(), 200);
|
|
1018
1006
|
};
|
|
1019
1007
|
// Close menu when clicking outside
|
|
1020
1008
|
const handleClickOutside = (e) => {
|
|
@@ -1034,15 +1022,7 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
1034
1022
|
};
|
|
1035
1023
|
// Update label focused state
|
|
1036
1024
|
const updateLabelState = () => {
|
|
1037
|
-
|
|
1038
|
-
if (labelElement) {
|
|
1039
|
-
if (isFocused || value) {
|
|
1040
|
-
labelElement.classList.add('focused');
|
|
1041
|
-
}
|
|
1042
|
-
else {
|
|
1043
|
-
labelElement.classList.remove('focused');
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1025
|
+
selectLabelRef.value.classList?.toggle('focused', isFocused || !!value);
|
|
1046
1026
|
};
|
|
1047
1027
|
const valueDisplay = createRedrawable(() => {
|
|
1048
1028
|
const o = options.find((opt) => opt.value === value);
|
|
@@ -1056,10 +1036,32 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
1056
1036
|
return jsx("div", { class: "mui-select-display", children: inner });
|
|
1057
1037
|
});
|
|
1058
1038
|
const menu = createRedrawable(() => {
|
|
1059
|
-
return (jsx("div", { class: "mui-select-menu", style:
|
|
1039
|
+
return (jsx("div", { class: "mui-select-menu", style: "display: none;", children: options.map((option) => (jsx("div", { class: `mui-select-option ${option.value === value ? 'selected' : ''}`, "on:click": () => handleOptionClick(option.value), children: option.label }))) }));
|
|
1060
1040
|
});
|
|
1061
1041
|
// Create container
|
|
1062
|
-
const container = (jsxs("div", { ref: selectRef, class: `mui-select-wrapper mui-select-size-${size} ${props.class ?? ''} ${fullWidth ? 'mui-select-fullWidth' : ''} ${disabled ? 'mui-select-disabled' : ''}`, style: parseStyle(props.style), children: [
|
|
1042
|
+
const container = (jsxs("div", { ref: selectRef, class: `mui-select-wrapper mui-select-size-${size} ${props.class ?? ''} ${fullWidth ? 'mui-select-fullWidth' : ''} ${disabled ? 'mui-select-disabled' : ''}`, style: parseStyle(props.style), children: [jsx("label", { "k-if": label, ref: selectLabelRef, class: `mui-select-label ${value || isFocused ? 'focused' : ''}`, children: label }), jsxs("div", { class: "mui-select-control mui-select-outlined", "on:click": toggleMenu, "on:focus": handleFocus, "on:blur": handleBlur, tabIndex: disabled ? -1 : 0, children: [valueDisplay, jsx("input", { type: "hidden", value: value }), jsx("fieldset", { class: "mui-select-fieldset", children: jsx("legend", { children: jsx("span", { children: label }) }) }), jsx("svg", { class: "mui-select-icon", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", width: "24", height: "24", children: jsx("path", { d: "M7 10l5 5 5-5Z", fill: "currentColor" }) })] }), menu] }));
|
|
1043
|
+
$defines(container, {
|
|
1044
|
+
value: {
|
|
1045
|
+
get: () => value,
|
|
1046
|
+
set: (newValue) => {
|
|
1047
|
+
value = newValue;
|
|
1048
|
+
updateLabelState();
|
|
1049
|
+
valueDisplay.redraw();
|
|
1050
|
+
menu.redraw();
|
|
1051
|
+
},
|
|
1052
|
+
},
|
|
1053
|
+
disabled: {
|
|
1054
|
+
get: () => disabled,
|
|
1055
|
+
set: (newDisabled) => {
|
|
1056
|
+
disabled = newDisabled;
|
|
1057
|
+
if (disabled) {
|
|
1058
|
+
isOpen = false;
|
|
1059
|
+
updateMenu();
|
|
1060
|
+
}
|
|
1061
|
+
container.classList.toggle('mui-select-disabled', disabled);
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
});
|
|
1063
1065
|
// Add global click listener
|
|
1064
1066
|
setTimeout(() => {
|
|
1065
1067
|
document.removeEventListener('click', handleClickOutside);
|
|
@@ -1169,7 +1171,6 @@ var __ktjs_mui__ = (function (exports) {
|
|
|
1169
1171
|
exports.Dialog = Dialog;
|
|
1170
1172
|
exports.DownloadIcon = DownloadIcon;
|
|
1171
1173
|
exports.ExpandMoreIcon = ExpandMoreIcon;
|
|
1172
|
-
exports.FileOpen = FileOpenIcon;
|
|
1173
1174
|
exports.FileOpenIcon = FileOpenIcon;
|
|
1174
1175
|
exports.FolderOpenIcon = FolderOpenIcon;
|
|
1175
1176
|
exports.FormLabel = FormLabel;
|