mithril-materialized 3.5.8 → 3.5.10
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/collapsible.d.ts +2 -0
- package/dist/components.css +82 -45
- package/dist/core.css +11 -4
- package/dist/forms.css +11 -4
- package/dist/index.css +103 -49
- package/dist/index.esm.js +76 -81
- package/dist/index.js +76 -81
- package/dist/index.min.css +2 -2
- package/dist/index.umd.js +76 -81
- package/dist/material-box.d.ts +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/pickers.css +10 -0
- package/dist/timepicker.d.ts +0 -4
- package/package.json +2 -3
- package/sass/components/_collapsible.scss +70 -17
- package/sass/components/_datatable.scss +7 -19
- package/sass/components/_materialbox.scss +23 -14
- package/sass/components/_theme-variables.scss +7 -0
- package/sass/components/_timepicker.scss +10 -0
- package/sass/components/forms/_input-fields.scss +10 -5
- package/sass/components/forms/_select.scss +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1409,19 +1409,18 @@ const CollapsibleItem = () => {
|
|
|
1409
1409
|
onclick: onToggle,
|
|
1410
1410
|
}, [
|
|
1411
1411
|
iconName ? m('i.material-icons', iconName) : undefined,
|
|
1412
|
-
header
|
|
1412
|
+
header
|
|
1413
|
+
? typeof header === 'string'
|
|
1414
|
+
? m('span.collapsible-header-text', header)
|
|
1415
|
+
: m('.collapsible-header-content', header)
|
|
1416
|
+
: undefined,
|
|
1413
1417
|
])
|
|
1414
1418
|
: undefined,
|
|
1415
1419
|
m('.collapsible-body', {
|
|
1416
1420
|
style: {
|
|
1417
1421
|
display: isActive ? 'block' : 'none',
|
|
1418
|
-
transition: 'display 0.3s ease',
|
|
1419
1422
|
},
|
|
1420
|
-
},
|
|
1421
|
-
m('.collapsible-body-content', {
|
|
1422
|
-
style: { padding: '2rem' },
|
|
1423
|
-
}, body ? (typeof body === 'string' ? m('div', { innerHTML: body }) : body) : undefined),
|
|
1424
|
-
]),
|
|
1423
|
+
}, body ? (typeof body === 'string' ? m('div', { innerHTML: body }) : body) : undefined),
|
|
1425
1424
|
]);
|
|
1426
1425
|
},
|
|
1427
1426
|
};
|
|
@@ -1444,7 +1443,7 @@ const Collapsible = () => {
|
|
|
1444
1443
|
});
|
|
1445
1444
|
},
|
|
1446
1445
|
view: ({ attrs }) => {
|
|
1447
|
-
const { items, accordion = true, class: c, className, style, id } = attrs;
|
|
1446
|
+
const { items, header, accordion = true, class: c, className, style, id } = attrs;
|
|
1448
1447
|
const toggleItem = (index) => {
|
|
1449
1448
|
if (accordion) {
|
|
1450
1449
|
// Accordion mode: only one item can be active
|
|
@@ -1466,12 +1465,22 @@ const Collapsible = () => {
|
|
|
1466
1465
|
}
|
|
1467
1466
|
}
|
|
1468
1467
|
};
|
|
1468
|
+
const collapsibleItems = items.map((item, index) => m(CollapsibleItem, Object.assign(Object.assign({}, item), { key: index, isActive: state.activeItems.has(index), onToggle: () => toggleItem(index) })));
|
|
1469
1469
|
return items && items.length > 0
|
|
1470
|
-
?
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1470
|
+
? header
|
|
1471
|
+
? m('ul.collapsible.with-header', {
|
|
1472
|
+
class: c || className,
|
|
1473
|
+
style,
|
|
1474
|
+
id,
|
|
1475
|
+
}, [
|
|
1476
|
+
m('li.collapsible-main-header', m('h4', typeof header === 'string' ? header : header)),
|
|
1477
|
+
collapsibleItems,
|
|
1478
|
+
])
|
|
1479
|
+
: m('ul.collapsible', {
|
|
1480
|
+
class: c || className,
|
|
1481
|
+
style,
|
|
1482
|
+
id,
|
|
1483
|
+
}, collapsibleItems)
|
|
1475
1484
|
: undefined;
|
|
1476
1485
|
},
|
|
1477
1486
|
};
|
|
@@ -1575,7 +1584,7 @@ const Collection = () => {
|
|
|
1575
1584
|
};
|
|
1576
1585
|
};
|
|
1577
1586
|
|
|
1578
|
-
const defaultI18n$
|
|
1587
|
+
const defaultI18n$3 = {
|
|
1579
1588
|
cancel: 'Cancel',
|
|
1580
1589
|
clear: 'Clear',
|
|
1581
1590
|
done: 'Ok',
|
|
@@ -1683,9 +1692,9 @@ const DatePicker = () => {
|
|
|
1683
1692
|
else if (attrs.displayFormat) {
|
|
1684
1693
|
finalFormat = attrs.displayFormat;
|
|
1685
1694
|
}
|
|
1686
|
-
const merged = Object.assign({ autoClose: false, format: finalFormat, parse: null, defaultDate: null, setDefaultDate: false, disableWeekends: false, disableDayFn: null, firstDay: 0, minDate: null, maxDate: null, yearRange, showClearBtn: false, showWeekNumbers: false, weekNumbering: 'iso', i18n: defaultI18n$
|
|
1695
|
+
const merged = Object.assign({ autoClose: false, format: finalFormat, parse: null, defaultDate: null, setDefaultDate: false, disableWeekends: false, disableDayFn: null, firstDay: 0, minDate: null, maxDate: null, yearRange, showClearBtn: false, showWeekNumbers: false, weekNumbering: 'iso', i18n: defaultI18n$3, onSelect: null, onOpen: null, onClose: null }, attrs);
|
|
1687
1696
|
// Merge i18n properly
|
|
1688
|
-
merged.i18n = Object.assign(Object.assign({}, defaultI18n$
|
|
1697
|
+
merged.i18n = Object.assign(Object.assign({}, defaultI18n$3), attrs.i18n);
|
|
1689
1698
|
return merged;
|
|
1690
1699
|
};
|
|
1691
1700
|
const toString = (date, format) => {
|
|
@@ -2136,11 +2145,11 @@ const DatePicker = () => {
|
|
|
2136
2145
|
prevMonth();
|
|
2137
2146
|
},
|
|
2138
2147
|
}, m('svg', {
|
|
2139
|
-
fill: '#000000',
|
|
2140
2148
|
height: '24',
|
|
2141
2149
|
viewBox: '0 0 24 24',
|
|
2142
2150
|
width: '24',
|
|
2143
2151
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
2152
|
+
style: 'fill: var(--mm-text-primary, rgba(0, 0, 0, 0.87));',
|
|
2144
2153
|
}, [
|
|
2145
2154
|
m('path', { d: 'M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z' }),
|
|
2146
2155
|
m('path', { d: 'M0-.5h24v24H0z', fill: 'none' }),
|
|
@@ -2202,11 +2211,11 @@ const DatePicker = () => {
|
|
|
2202
2211
|
nextMonth();
|
|
2203
2212
|
},
|
|
2204
2213
|
}, m('svg', {
|
|
2205
|
-
fill: '#000000',
|
|
2206
2214
|
height: '24',
|
|
2207
2215
|
viewBox: '0 0 24 24',
|
|
2208
2216
|
width: '24',
|
|
2209
2217
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
2218
|
+
style: 'fill: var(--mm-text-primary, rgba(0, 0, 0, 0.87));',
|
|
2210
2219
|
}, [
|
|
2211
2220
|
m('path', { d: 'M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z' }),
|
|
2212
2221
|
m('path', { d: 'M0-.25h24v24H0z', fill: 'none' }),
|
|
@@ -3219,19 +3228,29 @@ const TextArea = () => {
|
|
|
3219
3228
|
if (!controlled && attrs.defaultValue !== undefined) {
|
|
3220
3229
|
textarea.value = String(attrs.defaultValue);
|
|
3221
3230
|
}
|
|
3222
|
-
// Height will be calculated by hidden div
|
|
3223
3231
|
// Update character count state for counter component
|
|
3224
3232
|
if (maxLength) {
|
|
3225
3233
|
state.currentLength = textarea.value.length;
|
|
3226
3234
|
}
|
|
3235
|
+
// Calculate initial height after DOM is fully ready
|
|
3236
|
+
// Use requestAnimationFrame to ensure layout is complete
|
|
3237
|
+
if (state.hiddenDiv) {
|
|
3238
|
+
requestAnimationFrame(() => {
|
|
3239
|
+
if (state.hiddenDiv) {
|
|
3240
|
+
updateHeight(textarea, state.hiddenDiv);
|
|
3241
|
+
m.redraw();
|
|
3242
|
+
}
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3227
3245
|
}, onupdate: ({ dom }) => {
|
|
3228
3246
|
const textarea = dom;
|
|
3229
|
-
|
|
3230
|
-
textarea.style.height = state.height;
|
|
3231
|
-
// Trigger height recalculation when value changes programmatically
|
|
3247
|
+
// Recalculate and apply height
|
|
3232
3248
|
if (state.hiddenDiv) {
|
|
3233
3249
|
updateHeight(textarea, state.hiddenDiv);
|
|
3234
3250
|
}
|
|
3251
|
+
if (state.height) {
|
|
3252
|
+
textarea.style.height = state.height;
|
|
3253
|
+
}
|
|
3235
3254
|
}, onfocus: () => {
|
|
3236
3255
|
state.active = true;
|
|
3237
3256
|
}, oninput: (e) => {
|
|
@@ -4772,7 +4791,7 @@ const FloatingActionButton = () => {
|
|
|
4772
4791
|
|
|
4773
4792
|
/**
|
|
4774
4793
|
* Pure TypeScript MaterialBox - creates an image lightbox that fills the screen when clicked
|
|
4775
|
-
*
|
|
4794
|
+
* Uses CSS classes from _materialbox.scss
|
|
4776
4795
|
*/
|
|
4777
4796
|
const MaterialBox = () => {
|
|
4778
4797
|
const state = {
|
|
@@ -4788,21 +4807,11 @@ const MaterialBox = () => {
|
|
|
4788
4807
|
state.originalImage = img;
|
|
4789
4808
|
if (attrs.onOpenStart)
|
|
4790
4809
|
attrs.onOpenStart();
|
|
4810
|
+
const inDuration = attrs.inDuration || 275;
|
|
4791
4811
|
// Create overlay
|
|
4792
4812
|
const overlay = document.createElement('div');
|
|
4793
4813
|
overlay.className = 'materialbox-overlay';
|
|
4794
|
-
overlay.style.
|
|
4795
|
-
position: fixed;
|
|
4796
|
-
top: 0;
|
|
4797
|
-
left: 0;
|
|
4798
|
-
right: 0;
|
|
4799
|
-
bottom: 0;
|
|
4800
|
-
background-color: rgba(0, 0, 0, 0.85);
|
|
4801
|
-
z-index: 1000;
|
|
4802
|
-
opacity: 0;
|
|
4803
|
-
transition: opacity ${attrs.inDuration || 275}ms ease;
|
|
4804
|
-
cursor: zoom-out;
|
|
4805
|
-
`;
|
|
4814
|
+
overlay.style.transition = `opacity ${inDuration}ms ease`;
|
|
4806
4815
|
// Create enlarged image
|
|
4807
4816
|
const enlargedImg = document.createElement('img');
|
|
4808
4817
|
enlargedImg.src = img.src;
|
|
@@ -4823,36 +4832,18 @@ const MaterialBox = () => {
|
|
|
4823
4832
|
finalWidth = maxHeight * aspectRatio;
|
|
4824
4833
|
}
|
|
4825
4834
|
// Set initial position and size (same as original image)
|
|
4826
|
-
enlargedImg.style.
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
height: ${imgRect.height}px;
|
|
4832
|
-
transition: all ${attrs.inDuration || 275}ms ease;
|
|
4833
|
-
cursor: zoom-out;
|
|
4834
|
-
max-width: none;
|
|
4835
|
-
z-index: 1001;
|
|
4836
|
-
`;
|
|
4835
|
+
enlargedImg.style.top = `${imgRect.top}px`;
|
|
4836
|
+
enlargedImg.style.left = `${imgRect.left}px`;
|
|
4837
|
+
enlargedImg.style.width = `${imgRect.width}px`;
|
|
4838
|
+
enlargedImg.style.height = `${imgRect.height}px`;
|
|
4839
|
+
enlargedImg.style.transition = `all ${inDuration}ms ease`;
|
|
4837
4840
|
// Add caption if provided
|
|
4838
4841
|
let caption = null;
|
|
4839
4842
|
if (attrs.caption) {
|
|
4840
4843
|
caption = document.createElement('div');
|
|
4841
4844
|
caption.className = 'materialbox-caption';
|
|
4842
4845
|
caption.textContent = attrs.caption;
|
|
4843
|
-
caption.style.
|
|
4844
|
-
position: fixed;
|
|
4845
|
-
bottom: 20px;
|
|
4846
|
-
left: 50%;
|
|
4847
|
-
transform: translateX(-50%);
|
|
4848
|
-
color: white;
|
|
4849
|
-
font-size: 16px;
|
|
4850
|
-
text-align: center;
|
|
4851
|
-
opacity: 0;
|
|
4852
|
-
transition: opacity ${attrs.inDuration || 275}ms ease ${attrs.inDuration || 275}ms;
|
|
4853
|
-
z-index: 1002;
|
|
4854
|
-
pointer-events: none;
|
|
4855
|
-
`;
|
|
4846
|
+
caption.style.transition = `opacity ${inDuration}ms ease ${inDuration}ms`;
|
|
4856
4847
|
}
|
|
4857
4848
|
// Add to DOM
|
|
4858
4849
|
document.body.appendChild(overlay);
|
|
@@ -4887,7 +4878,7 @@ const MaterialBox = () => {
|
|
|
4887
4878
|
setTimeout(() => {
|
|
4888
4879
|
if (attrs.onOpenEnd)
|
|
4889
4880
|
attrs.onOpenEnd();
|
|
4890
|
-
},
|
|
4881
|
+
}, inDuration);
|
|
4891
4882
|
};
|
|
4892
4883
|
const closeBox = (attrs) => {
|
|
4893
4884
|
if (!state.isOpen || !state.originalImage || !state.overlay || !state.overlayImage)
|
|
@@ -4944,8 +4935,14 @@ const MaterialBox = () => {
|
|
|
4944
4935
|
},
|
|
4945
4936
|
view: ({ attrs }) => {
|
|
4946
4937
|
const { src, alt, width, height, caption, className, style } = attrs, otherAttrs = __rest(attrs, ["src", "alt", "width", "height", "caption", "className", "style"]);
|
|
4938
|
+
// Build style attribute - handle both string and object styles
|
|
4939
|
+
let imgStyle = style || {};
|
|
4940
|
+
if (typeof style !== 'string') {
|
|
4941
|
+
// If style is an object or undefined, add default styles as object
|
|
4942
|
+
imgStyle = Object.assign({ cursor: 'zoom-in', transition: 'opacity 200ms ease' }, (style || {}));
|
|
4943
|
+
}
|
|
4947
4944
|
return m('img.materialboxed', Object.assign(Object.assign({}, otherAttrs), { src, alt: alt || '', width,
|
|
4948
|
-
height, className: ['materialboxed', className].filter(Boolean).join(' ') || undefined, style:
|
|
4945
|
+
height, className: ['materialboxed', className].filter(Boolean).join(' ') || undefined, style: imgStyle, onclick: (e) => {
|
|
4949
4946
|
e.preventDefault();
|
|
4950
4947
|
openBox(e.target, attrs);
|
|
4951
4948
|
} }));
|
|
@@ -5018,7 +5015,7 @@ const ModalPanel = () => {
|
|
|
5018
5015
|
closeModal(attrs);
|
|
5019
5016
|
}
|
|
5020
5017
|
}
|
|
5021
|
-
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick =
|
|
5018
|
+
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = false, } = attrs;
|
|
5022
5019
|
const modalClasses = [
|
|
5023
5020
|
'modal',
|
|
5024
5021
|
className || '',
|
|
@@ -5275,6 +5272,11 @@ const Parallax = () => {
|
|
|
5275
5272
|
};
|
|
5276
5273
|
};
|
|
5277
5274
|
|
|
5275
|
+
const defaultI18n$2 = {
|
|
5276
|
+
cancel: 'Cancel',
|
|
5277
|
+
clear: 'Clear',
|
|
5278
|
+
done: 'Ok',
|
|
5279
|
+
};
|
|
5278
5280
|
const defaultOptions = {
|
|
5279
5281
|
dialRadius: 135,
|
|
5280
5282
|
outerRadius: 105,
|
|
@@ -5285,11 +5287,7 @@ const defaultOptions = {
|
|
|
5285
5287
|
defaultTime: 'now',
|
|
5286
5288
|
fromNow: 0,
|
|
5287
5289
|
showClearBtn: false,
|
|
5288
|
-
i18n:
|
|
5289
|
-
cancel: 'Cancel',
|
|
5290
|
-
clear: 'Clear',
|
|
5291
|
-
done: 'Ok',
|
|
5292
|
-
},
|
|
5290
|
+
i18n: defaultI18n$2,
|
|
5293
5291
|
autoClose: false,
|
|
5294
5292
|
twelveHour: true,
|
|
5295
5293
|
vibrate: true,
|
|
@@ -5439,7 +5437,7 @@ const TimePicker = () => {
|
|
|
5439
5437
|
state.hours = hours;
|
|
5440
5438
|
state.minutes = minutes;
|
|
5441
5439
|
if (state.spanHours) {
|
|
5442
|
-
state.spanHours.innerHTML = state.hours
|
|
5440
|
+
state.spanHours.innerHTML = addLeadingZero(state.hours);
|
|
5443
5441
|
}
|
|
5444
5442
|
if (state.spanMinutes) {
|
|
5445
5443
|
state.spanMinutes.innerHTML = addLeadingZero(state.minutes);
|
|
@@ -5547,7 +5545,7 @@ const TimePicker = () => {
|
|
|
5547
5545
|
}
|
|
5548
5546
|
state[state.currentView] = value;
|
|
5549
5547
|
if (isHours && state.spanHours) {
|
|
5550
|
-
state.spanHours.innerHTML = value
|
|
5548
|
+
state.spanHours.innerHTML = addLeadingZero(value);
|
|
5551
5549
|
}
|
|
5552
5550
|
else if (!isHours && state.spanMinutes) {
|
|
5553
5551
|
state.spanMinutes.innerHTML = addLeadingZero(value);
|
|
@@ -5681,7 +5679,7 @@ const TimePicker = () => {
|
|
|
5681
5679
|
const TimepickerModal = () => {
|
|
5682
5680
|
return {
|
|
5683
5681
|
view: ({ attrs }) => {
|
|
5684
|
-
const {
|
|
5682
|
+
const { i18n, showClearBtn } = attrs;
|
|
5685
5683
|
return [
|
|
5686
5684
|
m('.modal-content.timepicker-container', [
|
|
5687
5685
|
m('.timepicker-digital-display', [
|
|
@@ -5693,7 +5691,7 @@ const TimePicker = () => {
|
|
|
5693
5691
|
oncreate: (vnode) => {
|
|
5694
5692
|
state.spanHours = vnode.dom;
|
|
5695
5693
|
},
|
|
5696
|
-
}, state.hours
|
|
5694
|
+
}, addLeadingZero(state.hours)),
|
|
5697
5695
|
':',
|
|
5698
5696
|
m('span.timepicker-span-minutes', {
|
|
5699
5697
|
class: state.currentView === 'minutes' ? 'text-primary' : '',
|
|
@@ -5773,18 +5771,18 @@ const TimePicker = () => {
|
|
|
5773
5771
|
tabindex: options.twelveHour ? '3' : '1',
|
|
5774
5772
|
style: showClearBtn ? '' : 'visibility: hidden;',
|
|
5775
5773
|
onclick: () => clear(),
|
|
5776
|
-
},
|
|
5774
|
+
}, i18n.clear),
|
|
5777
5775
|
m('.confirmation-btns', [
|
|
5778
5776
|
m('button.btn-flat.timepicker-close.waves-effect', {
|
|
5779
5777
|
type: 'button',
|
|
5780
5778
|
tabindex: options.twelveHour ? '3' : '1',
|
|
5781
5779
|
onclick: () => close(),
|
|
5782
|
-
},
|
|
5780
|
+
}, i18n.cancel),
|
|
5783
5781
|
m('button.btn-flat.timepicker-close.waves-effect', {
|
|
5784
5782
|
type: 'button',
|
|
5785
5783
|
tabindex: options.twelveHour ? '3' : '1',
|
|
5786
5784
|
onclick: () => done(),
|
|
5787
|
-
},
|
|
5785
|
+
}, i18n.done),
|
|
5788
5786
|
]),
|
|
5789
5787
|
]),
|
|
5790
5788
|
]),
|
|
@@ -5801,7 +5799,6 @@ const TimePicker = () => {
|
|
|
5801
5799
|
}
|
|
5802
5800
|
};
|
|
5803
5801
|
const renderPickerToPortal = (attrs) => {
|
|
5804
|
-
const { showClearBtn = false, clearLabel = 'Clear', closeLabel = 'Cancel' } = attrs;
|
|
5805
5802
|
const pickerModal = m('.timepicker-modal-wrapper', {
|
|
5806
5803
|
style: {
|
|
5807
5804
|
position: 'fixed',
|
|
@@ -5844,10 +5841,8 @@ const TimePicker = () => {
|
|
|
5844
5841
|
},
|
|
5845
5842
|
}, [
|
|
5846
5843
|
m(TimepickerModal, {
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
closeLabel,
|
|
5850
|
-
doneLabel: 'OK',
|
|
5844
|
+
i18n: options.i18n,
|
|
5845
|
+
showClearBtn: options.showClearBtn,
|
|
5851
5846
|
}),
|
|
5852
5847
|
]),
|
|
5853
5848
|
]);
|
|
@@ -5907,7 +5902,7 @@ const TimePicker = () => {
|
|
|
5907
5902
|
}
|
|
5908
5903
|
},
|
|
5909
5904
|
view: ({ attrs }) => {
|
|
5910
|
-
const { id = state.id, label, placeholder, disabled, readonly, required, iconName, helperText, onchange, oninput, useModal = true,
|
|
5905
|
+
const { id = state.id, label, placeholder, disabled, readonly, required, iconName, helperText, onchange, oninput, useModal = true, twelveHour, className: cn1, class: cn2, } = attrs;
|
|
5911
5906
|
const className = cn1 || cn2 || 'col s12';
|
|
5912
5907
|
// Format time value for display
|
|
5913
5908
|
const formatTime = (hours, minutes, use12Hour) => {
|
|
@@ -6353,7 +6348,7 @@ const Select = () => {
|
|
|
6353
6348
|
// Render ungrouped options first
|
|
6354
6349
|
attrs.options
|
|
6355
6350
|
.filter((option) => !option.group)
|
|
6356
|
-
.map((option) => m('li', Object.assign({ class: option.disabled ? 'disabled' : state.focusedIndex === attrs.options.indexOf(option) ? 'focused' : '' }, (option.disabled
|
|
6351
|
+
.map((option) => m('li', Object.assign({ class: `${option.disabled ? 'disabled' : ''}${isSelected(option.id, selectedIds) ? ' selected' : ''}${state.focusedIndex === attrs.options.indexOf(option) ? ' focused' : ''}` }, (option.disabled
|
|
6357
6352
|
? {}
|
|
6358
6353
|
: {
|
|
6359
6354
|
onclick: () => {
|