mithril-materialized 3.5.4 → 3.5.6
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/advanced.css +6 -0
- package/dist/components.css +6 -0
- package/dist/index.css +6 -0
- package/dist/index.esm.js +73 -48
- package/dist/index.js +73 -48
- package/dist/index.min.css +1 -1
- package/dist/index.umd.js +73 -48
- package/dist/modal.d.ts +4 -2
- package/dist/timepicker.d.ts +1 -0
- package/package.json +12 -13
- package/sass/components/_sidenav.scss +7 -0
package/dist/advanced.css
CHANGED
|
@@ -866,6 +866,8 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
866
866
|
backface-visibility: hidden;
|
|
867
867
|
transform: translateX(-105%);
|
|
868
868
|
transition: transform 0.3s ease, left 0.3s ease, right 0.3s ease;
|
|
869
|
+
display: flex;
|
|
870
|
+
flex-direction: column;
|
|
869
871
|
}
|
|
870
872
|
.sidenav.sidenav-left {
|
|
871
873
|
left: 0;
|
|
@@ -1220,6 +1222,10 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
1220
1222
|
color: var(--mm-primary-color, #26a69a);
|
|
1221
1223
|
}
|
|
1222
1224
|
|
|
1225
|
+
.sidenav-footer-item {
|
|
1226
|
+
margin-top: auto;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1223
1229
|
.sidenav {
|
|
1224
1230
|
transition: transform 0.3s ease, width 0.3s ease;
|
|
1225
1231
|
}
|
package/dist/components.css
CHANGED
|
@@ -1619,6 +1619,8 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
1619
1619
|
backface-visibility: hidden;
|
|
1620
1620
|
transform: translateX(-105%);
|
|
1621
1621
|
transition: transform 0.3s ease, left 0.3s ease, right 0.3s ease;
|
|
1622
|
+
display: flex;
|
|
1623
|
+
flex-direction: column;
|
|
1622
1624
|
}
|
|
1623
1625
|
.sidenav.sidenav-left {
|
|
1624
1626
|
left: 0;
|
|
@@ -1973,6 +1975,10 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
1973
1975
|
color: var(--mm-primary-color, #26a69a);
|
|
1974
1976
|
}
|
|
1975
1977
|
|
|
1978
|
+
.sidenav-footer-item {
|
|
1979
|
+
margin-top: auto;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1976
1982
|
.sidenav {
|
|
1977
1983
|
transition: transform 0.3s ease, width 0.3s ease;
|
|
1978
1984
|
}
|
package/dist/index.css
CHANGED
|
@@ -7731,6 +7731,8 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
7731
7731
|
backface-visibility: hidden;
|
|
7732
7732
|
transform: translateX(-105%);
|
|
7733
7733
|
transition: transform 0.3s ease, left 0.3s ease, right 0.3s ease;
|
|
7734
|
+
display: flex;
|
|
7735
|
+
flex-direction: column;
|
|
7734
7736
|
}
|
|
7735
7737
|
.sidenav.sidenav-left {
|
|
7736
7738
|
left: 0;
|
|
@@ -8087,6 +8089,10 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
8087
8089
|
color: var(--mm-primary-color, #26a69a);
|
|
8088
8090
|
}
|
|
8089
8091
|
|
|
8092
|
+
.sidenav-footer-item {
|
|
8093
|
+
margin-top: auto;
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8090
8096
|
.sidenav {
|
|
8091
8097
|
transition: transform 0.3s ease, width 0.3s ease;
|
|
8092
8098
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -3300,8 +3300,8 @@ const InputField = (type, defaultClass = '') => () => {
|
|
|
3300
3300
|
const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
|
|
3301
3301
|
return m('.input-field', { className: cn, style }, [
|
|
3302
3302
|
iconName ? m('i.material-icons.prefix', iconName) : undefined,
|
|
3303
|
-
m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
|
|
3304
|
-
placeholder, value: controlled ? value : undefined,
|
|
3303
|
+
m('input', Object.assign(Object.assign({ class: type === 'range' && attrs.vertical ? 'range-slider vertical' : shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
|
|
3304
|
+
placeholder, value: controlled ? value : undefined, style: type === 'range' && attrs.vertical
|
|
3305
3305
|
? {
|
|
3306
3306
|
height: attrs.height || '200px',
|
|
3307
3307
|
width: '6px',
|
|
@@ -4894,7 +4894,7 @@ const ModalPanel = () => {
|
|
|
4894
4894
|
closeModal(attrs);
|
|
4895
4895
|
}
|
|
4896
4896
|
}
|
|
4897
|
-
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, } = attrs;
|
|
4897
|
+
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = true, } = attrs;
|
|
4898
4898
|
const modalClasses = [
|
|
4899
4899
|
'modal',
|
|
4900
4900
|
className || '',
|
|
@@ -4991,7 +4991,7 @@ const ModalPanel = () => {
|
|
|
4991
4991
|
}, buttons.map((buttonProps) => m(FlatButton, Object.assign(Object.assign({}, buttonProps), { className: `modal-close ${buttonProps.className || ''}`, onclick: (e) => {
|
|
4992
4992
|
if (buttonProps.onclick)
|
|
4993
4993
|
buttonProps.onclick(e);
|
|
4994
|
-
closeModal(attrs);
|
|
4994
|
+
closeOnButtonClick && closeModal(attrs);
|
|
4995
4995
|
} })))),
|
|
4996
4996
|
]),
|
|
4997
4997
|
]);
|
|
@@ -5169,6 +5169,7 @@ const defaultOptions = {
|
|
|
5169
5169
|
autoClose: false,
|
|
5170
5170
|
twelveHour: true,
|
|
5171
5171
|
vibrate: true,
|
|
5172
|
+
roundBy5: false,
|
|
5172
5173
|
onOpen: () => { },
|
|
5173
5174
|
onOpenStart: () => { },
|
|
5174
5175
|
onOpenEnd: () => { },
|
|
@@ -5220,7 +5221,7 @@ const TimePicker = () => {
|
|
|
5220
5221
|
const clickPos = getPos(e);
|
|
5221
5222
|
state.dx = clickPos.x - state.x0;
|
|
5222
5223
|
state.dy = clickPos.y - state.y0;
|
|
5223
|
-
setHand(state.dx, state.dy,
|
|
5224
|
+
setHand(state.dx, state.dy, options.roundBy5);
|
|
5224
5225
|
document.addEventListener('mousemove', handleDocumentClickMove);
|
|
5225
5226
|
document.addEventListener('touchmove', handleDocumentClickMove);
|
|
5226
5227
|
document.addEventListener('mouseup', handleDocumentClickEnd);
|
|
@@ -5232,7 +5233,7 @@ const TimePicker = () => {
|
|
|
5232
5233
|
const x = clickPos.x - state.x0;
|
|
5233
5234
|
const y = clickPos.y - state.y0;
|
|
5234
5235
|
state.moved = true;
|
|
5235
|
-
setHand(x, y,
|
|
5236
|
+
setHand(x, y, options.roundBy5);
|
|
5236
5237
|
m.redraw();
|
|
5237
5238
|
};
|
|
5238
5239
|
const handleDocumentClickEnd = (e) => {
|
|
@@ -7812,9 +7813,19 @@ const FileUpload = () => {
|
|
|
7812
7813
|
|
|
7813
7814
|
// List of MaterialIcon SVG icons that are available
|
|
7814
7815
|
const materialIconSvgNames = [
|
|
7815
|
-
'caret',
|
|
7816
|
-
'
|
|
7817
|
-
'
|
|
7816
|
+
'caret',
|
|
7817
|
+
'close',
|
|
7818
|
+
'chevron',
|
|
7819
|
+
'chevron_left',
|
|
7820
|
+
'chevron_right',
|
|
7821
|
+
'menu',
|
|
7822
|
+
'expand',
|
|
7823
|
+
'collapse',
|
|
7824
|
+
'check',
|
|
7825
|
+
'radio_checked',
|
|
7826
|
+
'radio_unchecked',
|
|
7827
|
+
'light_mode',
|
|
7828
|
+
'dark_mode',
|
|
7818
7829
|
];
|
|
7819
7830
|
/**
|
|
7820
7831
|
* Helper function to render icons based on IconDefinition type
|
|
@@ -7844,31 +7855,42 @@ const renderIcon = (icon, style) => {
|
|
|
7844
7855
|
return null;
|
|
7845
7856
|
};
|
|
7846
7857
|
/**
|
|
7847
|
-
*
|
|
7858
|
+
* Sidenav Header/Footer Item Component
|
|
7848
7859
|
*/
|
|
7849
|
-
const
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7860
|
+
const SidenavHeaderFooterItem = () => {
|
|
7861
|
+
return {
|
|
7862
|
+
view: ({ attrs }) => {
|
|
7863
|
+
const { text, icon, onclick, href, className = '', _isExpanded = true, _position = 'left' } = attrs;
|
|
7864
|
+
const isRightAligned = _position === 'right';
|
|
7865
|
+
const handleClick = (e) => {
|
|
7866
|
+
if (onclick) {
|
|
7867
|
+
e.preventDefault();
|
|
7868
|
+
onclick(e);
|
|
7869
|
+
}
|
|
7870
|
+
};
|
|
7871
|
+
const content = isRightAligned
|
|
7872
|
+
? [
|
|
7873
|
+
_isExpanded &&
|
|
7874
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text),
|
|
7875
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7876
|
+
]
|
|
7877
|
+
: [
|
|
7878
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7879
|
+
_isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text),
|
|
7880
|
+
];
|
|
7881
|
+
const linkStyle = {
|
|
7882
|
+
display: 'flex',
|
|
7883
|
+
'align-items': 'center',
|
|
7884
|
+
padding: _isExpanded ? '12px 16px' : '12px 18px',
|
|
7885
|
+
'justify-content': _isExpanded ? (isRightAligned ? 'flex-end' : 'flex-start') : 'center',
|
|
7886
|
+
};
|
|
7887
|
+
return m('li', { class: className }, m('a', {
|
|
7888
|
+
href: href || '#!',
|
|
7889
|
+
onclick: handleClick,
|
|
7890
|
+
style: linkStyle,
|
|
7891
|
+
}, content));
|
|
7892
|
+
},
|
|
7893
|
+
};
|
|
7872
7894
|
};
|
|
7873
7895
|
/**
|
|
7874
7896
|
* Sidenav Component
|
|
@@ -7993,7 +8015,8 @@ const Sidenav = () => {
|
|
|
7993
8015
|
style: { width: '24px', height: '24px' },
|
|
7994
8016
|
})),
|
|
7995
8017
|
// Header item (if provided, appears before expand/collapse toggle)
|
|
7996
|
-
attrs.header &&
|
|
8018
|
+
attrs.header &&
|
|
8019
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.header), { _isExpanded: isExpanded, _position: position })),
|
|
7997
8020
|
// Expand/collapse toggle button (if expandable, right below hamburger)
|
|
7998
8021
|
expandable &&
|
|
7999
8022
|
m('li.sidenav-expand-toggle', {
|
|
@@ -8008,8 +8031,12 @@ const Sidenav = () => {
|
|
|
8008
8031
|
onclick: () => toggleExpanded(attrs),
|
|
8009
8032
|
}, m(MaterialIcon, {
|
|
8010
8033
|
name: position === 'right'
|
|
8011
|
-
?
|
|
8012
|
-
|
|
8034
|
+
? isExpanded
|
|
8035
|
+
? 'chevron_right'
|
|
8036
|
+
: 'chevron_left'
|
|
8037
|
+
: isExpanded
|
|
8038
|
+
? 'chevron_left'
|
|
8039
|
+
: 'chevron_right',
|
|
8013
8040
|
style: { width: '24px', height: '24px' },
|
|
8014
8041
|
})),
|
|
8015
8042
|
// Children (menu items) - inject internal props
|
|
@@ -8023,7 +8050,8 @@ const Sidenav = () => {
|
|
|
8023
8050
|
})
|
|
8024
8051
|
: children,
|
|
8025
8052
|
// Footer item (if provided, appears at the bottom)
|
|
8026
|
-
attrs.footer &&
|
|
8053
|
+
attrs.footer &&
|
|
8054
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.footer), { _isExpanded: isExpanded, _position: position, className: 'sidenav-footer-item' })),
|
|
8027
8055
|
]),
|
|
8028
8056
|
];
|
|
8029
8057
|
},
|
|
@@ -8056,7 +8084,7 @@ const NavbarSubItem = () => {
|
|
|
8056
8084
|
const submenuContent = isRightAligned
|
|
8057
8085
|
? [
|
|
8058
8086
|
// Right-aligned: text on left, icons on right
|
|
8059
|
-
isExpanded && m('span', { style: {
|
|
8087
|
+
isExpanded && m('span', { style: { flex: '1', 'text-align': 'left' } }, text),
|
|
8060
8088
|
icon && isExpanded && renderIcon(icon, { 'font-size': '18px' }),
|
|
8061
8089
|
indicatorIcon,
|
|
8062
8090
|
]
|
|
@@ -8100,12 +8128,7 @@ const SidenavItem = () => {
|
|
|
8100
8128
|
return m('li.subheader', text || children);
|
|
8101
8129
|
}
|
|
8102
8130
|
const hasSubmenu = submenu && submenu.length > 0;
|
|
8103
|
-
const itemClasses = [
|
|
8104
|
-
active ? 'active' : '',
|
|
8105
|
-
disabled ? 'disabled' : '',
|
|
8106
|
-
hasSubmenu ? 'has-submenu' : '',
|
|
8107
|
-
className,
|
|
8108
|
-
]
|
|
8131
|
+
const itemClasses = [active ? 'active' : '', disabled ? 'disabled' : '', hasSubmenu ? 'has-submenu' : '', className]
|
|
8109
8132
|
.filter(Boolean)
|
|
8110
8133
|
.join(' ') || undefined;
|
|
8111
8134
|
const handleMainClick = (e) => {
|
|
@@ -8114,6 +8137,7 @@ const SidenavItem = () => {
|
|
|
8114
8137
|
isSubmenuOpen = active ? !isSubmenuOpen : true;
|
|
8115
8138
|
}
|
|
8116
8139
|
if (onclick && !disabled) {
|
|
8140
|
+
e.preventDefault();
|
|
8117
8141
|
onclick(e);
|
|
8118
8142
|
}
|
|
8119
8143
|
};
|
|
@@ -8126,13 +8150,14 @@ const SidenavItem = () => {
|
|
|
8126
8150
|
const content = isRightAligned
|
|
8127
8151
|
? [
|
|
8128
8152
|
// Right-aligned: text on left, icon on right
|
|
8129
|
-
isExpanded &&
|
|
8130
|
-
|
|
8153
|
+
isExpanded &&
|
|
8154
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text || children),
|
|
8155
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8131
8156
|
]
|
|
8132
8157
|
: [
|
|
8133
8158
|
// Left-aligned: icon on left, text on right
|
|
8134
|
-
renderIcon(icon, { 'min-width': '24px',
|
|
8135
|
-
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px',
|
|
8159
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8160
|
+
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text || children),
|
|
8136
8161
|
];
|
|
8137
8162
|
const linkStyle = {
|
|
8138
8163
|
display: 'flex',
|
package/dist/index.js
CHANGED
|
@@ -3302,8 +3302,8 @@ const InputField = (type, defaultClass = '') => () => {
|
|
|
3302
3302
|
const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
|
|
3303
3303
|
return m('.input-field', { className: cn, style }, [
|
|
3304
3304
|
iconName ? m('i.material-icons.prefix', iconName) : undefined,
|
|
3305
|
-
m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
|
|
3306
|
-
placeholder, value: controlled ? value : undefined,
|
|
3305
|
+
m('input', Object.assign(Object.assign({ class: type === 'range' && attrs.vertical ? 'range-slider vertical' : shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
|
|
3306
|
+
placeholder, value: controlled ? value : undefined, style: type === 'range' && attrs.vertical
|
|
3307
3307
|
? {
|
|
3308
3308
|
height: attrs.height || '200px',
|
|
3309
3309
|
width: '6px',
|
|
@@ -4896,7 +4896,7 @@ const ModalPanel = () => {
|
|
|
4896
4896
|
closeModal(attrs);
|
|
4897
4897
|
}
|
|
4898
4898
|
}
|
|
4899
|
-
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, } = attrs;
|
|
4899
|
+
const { id, title, description, fixedFooter, bottomSheet, buttons, richContent, className, showCloseButton = true, closeOnBackdropClick = true, closeOnButtonClick = true, } = attrs;
|
|
4900
4900
|
const modalClasses = [
|
|
4901
4901
|
'modal',
|
|
4902
4902
|
className || '',
|
|
@@ -4993,7 +4993,7 @@ const ModalPanel = () => {
|
|
|
4993
4993
|
}, buttons.map((buttonProps) => m(FlatButton, Object.assign(Object.assign({}, buttonProps), { className: `modal-close ${buttonProps.className || ''}`, onclick: (e) => {
|
|
4994
4994
|
if (buttonProps.onclick)
|
|
4995
4995
|
buttonProps.onclick(e);
|
|
4996
|
-
closeModal(attrs);
|
|
4996
|
+
closeOnButtonClick && closeModal(attrs);
|
|
4997
4997
|
} })))),
|
|
4998
4998
|
]),
|
|
4999
4999
|
]);
|
|
@@ -5171,6 +5171,7 @@ const defaultOptions = {
|
|
|
5171
5171
|
autoClose: false,
|
|
5172
5172
|
twelveHour: true,
|
|
5173
5173
|
vibrate: true,
|
|
5174
|
+
roundBy5: false,
|
|
5174
5175
|
onOpen: () => { },
|
|
5175
5176
|
onOpenStart: () => { },
|
|
5176
5177
|
onOpenEnd: () => { },
|
|
@@ -5222,7 +5223,7 @@ const TimePicker = () => {
|
|
|
5222
5223
|
const clickPos = getPos(e);
|
|
5223
5224
|
state.dx = clickPos.x - state.x0;
|
|
5224
5225
|
state.dy = clickPos.y - state.y0;
|
|
5225
|
-
setHand(state.dx, state.dy,
|
|
5226
|
+
setHand(state.dx, state.dy, options.roundBy5);
|
|
5226
5227
|
document.addEventListener('mousemove', handleDocumentClickMove);
|
|
5227
5228
|
document.addEventListener('touchmove', handleDocumentClickMove);
|
|
5228
5229
|
document.addEventListener('mouseup', handleDocumentClickEnd);
|
|
@@ -5234,7 +5235,7 @@ const TimePicker = () => {
|
|
|
5234
5235
|
const x = clickPos.x - state.x0;
|
|
5235
5236
|
const y = clickPos.y - state.y0;
|
|
5236
5237
|
state.moved = true;
|
|
5237
|
-
setHand(x, y,
|
|
5238
|
+
setHand(x, y, options.roundBy5);
|
|
5238
5239
|
m.redraw();
|
|
5239
5240
|
};
|
|
5240
5241
|
const handleDocumentClickEnd = (e) => {
|
|
@@ -7814,9 +7815,19 @@ const FileUpload = () => {
|
|
|
7814
7815
|
|
|
7815
7816
|
// List of MaterialIcon SVG icons that are available
|
|
7816
7817
|
const materialIconSvgNames = [
|
|
7817
|
-
'caret',
|
|
7818
|
-
'
|
|
7819
|
-
'
|
|
7818
|
+
'caret',
|
|
7819
|
+
'close',
|
|
7820
|
+
'chevron',
|
|
7821
|
+
'chevron_left',
|
|
7822
|
+
'chevron_right',
|
|
7823
|
+
'menu',
|
|
7824
|
+
'expand',
|
|
7825
|
+
'collapse',
|
|
7826
|
+
'check',
|
|
7827
|
+
'radio_checked',
|
|
7828
|
+
'radio_unchecked',
|
|
7829
|
+
'light_mode',
|
|
7830
|
+
'dark_mode',
|
|
7820
7831
|
];
|
|
7821
7832
|
/**
|
|
7822
7833
|
* Helper function to render icons based on IconDefinition type
|
|
@@ -7846,31 +7857,42 @@ const renderIcon = (icon, style) => {
|
|
|
7846
7857
|
return null;
|
|
7847
7858
|
};
|
|
7848
7859
|
/**
|
|
7849
|
-
*
|
|
7860
|
+
* Sidenav Header/Footer Item Component
|
|
7850
7861
|
*/
|
|
7851
|
-
const
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7862
|
+
const SidenavHeaderFooterItem = () => {
|
|
7863
|
+
return {
|
|
7864
|
+
view: ({ attrs }) => {
|
|
7865
|
+
const { text, icon, onclick, href, className = '', _isExpanded = true, _position = 'left' } = attrs;
|
|
7866
|
+
const isRightAligned = _position === 'right';
|
|
7867
|
+
const handleClick = (e) => {
|
|
7868
|
+
if (onclick) {
|
|
7869
|
+
e.preventDefault();
|
|
7870
|
+
onclick(e);
|
|
7871
|
+
}
|
|
7872
|
+
};
|
|
7873
|
+
const content = isRightAligned
|
|
7874
|
+
? [
|
|
7875
|
+
_isExpanded &&
|
|
7876
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text),
|
|
7877
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7878
|
+
]
|
|
7879
|
+
: [
|
|
7880
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7881
|
+
_isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text),
|
|
7882
|
+
];
|
|
7883
|
+
const linkStyle = {
|
|
7884
|
+
display: 'flex',
|
|
7885
|
+
'align-items': 'center',
|
|
7886
|
+
padding: _isExpanded ? '12px 16px' : '12px 18px',
|
|
7887
|
+
'justify-content': _isExpanded ? (isRightAligned ? 'flex-end' : 'flex-start') : 'center',
|
|
7888
|
+
};
|
|
7889
|
+
return m('li', { class: className }, m('a', {
|
|
7890
|
+
href: href || '#!',
|
|
7891
|
+
onclick: handleClick,
|
|
7892
|
+
style: linkStyle,
|
|
7893
|
+
}, content));
|
|
7894
|
+
},
|
|
7895
|
+
};
|
|
7874
7896
|
};
|
|
7875
7897
|
/**
|
|
7876
7898
|
* Sidenav Component
|
|
@@ -7995,7 +8017,8 @@ const Sidenav = () => {
|
|
|
7995
8017
|
style: { width: '24px', height: '24px' },
|
|
7996
8018
|
})),
|
|
7997
8019
|
// Header item (if provided, appears before expand/collapse toggle)
|
|
7998
|
-
attrs.header &&
|
|
8020
|
+
attrs.header &&
|
|
8021
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.header), { _isExpanded: isExpanded, _position: position })),
|
|
7999
8022
|
// Expand/collapse toggle button (if expandable, right below hamburger)
|
|
8000
8023
|
expandable &&
|
|
8001
8024
|
m('li.sidenav-expand-toggle', {
|
|
@@ -8010,8 +8033,12 @@ const Sidenav = () => {
|
|
|
8010
8033
|
onclick: () => toggleExpanded(attrs),
|
|
8011
8034
|
}, m(MaterialIcon, {
|
|
8012
8035
|
name: position === 'right'
|
|
8013
|
-
?
|
|
8014
|
-
|
|
8036
|
+
? isExpanded
|
|
8037
|
+
? 'chevron_right'
|
|
8038
|
+
: 'chevron_left'
|
|
8039
|
+
: isExpanded
|
|
8040
|
+
? 'chevron_left'
|
|
8041
|
+
: 'chevron_right',
|
|
8015
8042
|
style: { width: '24px', height: '24px' },
|
|
8016
8043
|
})),
|
|
8017
8044
|
// Children (menu items) - inject internal props
|
|
@@ -8025,7 +8052,8 @@ const Sidenav = () => {
|
|
|
8025
8052
|
})
|
|
8026
8053
|
: children,
|
|
8027
8054
|
// Footer item (if provided, appears at the bottom)
|
|
8028
|
-
attrs.footer &&
|
|
8055
|
+
attrs.footer &&
|
|
8056
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.footer), { _isExpanded: isExpanded, _position: position, className: 'sidenav-footer-item' })),
|
|
8029
8057
|
]),
|
|
8030
8058
|
];
|
|
8031
8059
|
},
|
|
@@ -8058,7 +8086,7 @@ const NavbarSubItem = () => {
|
|
|
8058
8086
|
const submenuContent = isRightAligned
|
|
8059
8087
|
? [
|
|
8060
8088
|
// Right-aligned: text on left, icons on right
|
|
8061
|
-
isExpanded && m('span', { style: {
|
|
8089
|
+
isExpanded && m('span', { style: { flex: '1', 'text-align': 'left' } }, text),
|
|
8062
8090
|
icon && isExpanded && renderIcon(icon, { 'font-size': '18px' }),
|
|
8063
8091
|
indicatorIcon,
|
|
8064
8092
|
]
|
|
@@ -8102,12 +8130,7 @@ const SidenavItem = () => {
|
|
|
8102
8130
|
return m('li.subheader', text || children);
|
|
8103
8131
|
}
|
|
8104
8132
|
const hasSubmenu = submenu && submenu.length > 0;
|
|
8105
|
-
const itemClasses = [
|
|
8106
|
-
active ? 'active' : '',
|
|
8107
|
-
disabled ? 'disabled' : '',
|
|
8108
|
-
hasSubmenu ? 'has-submenu' : '',
|
|
8109
|
-
className,
|
|
8110
|
-
]
|
|
8133
|
+
const itemClasses = [active ? 'active' : '', disabled ? 'disabled' : '', hasSubmenu ? 'has-submenu' : '', className]
|
|
8111
8134
|
.filter(Boolean)
|
|
8112
8135
|
.join(' ') || undefined;
|
|
8113
8136
|
const handleMainClick = (e) => {
|
|
@@ -8116,6 +8139,7 @@ const SidenavItem = () => {
|
|
|
8116
8139
|
isSubmenuOpen = active ? !isSubmenuOpen : true;
|
|
8117
8140
|
}
|
|
8118
8141
|
if (onclick && !disabled) {
|
|
8142
|
+
e.preventDefault();
|
|
8119
8143
|
onclick(e);
|
|
8120
8144
|
}
|
|
8121
8145
|
};
|
|
@@ -8128,13 +8152,14 @@ const SidenavItem = () => {
|
|
|
8128
8152
|
const content = isRightAligned
|
|
8129
8153
|
? [
|
|
8130
8154
|
// Right-aligned: text on left, icon on right
|
|
8131
|
-
isExpanded &&
|
|
8132
|
-
|
|
8155
|
+
isExpanded &&
|
|
8156
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text || children),
|
|
8157
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8133
8158
|
]
|
|
8134
8159
|
: [
|
|
8135
8160
|
// Left-aligned: icon on left, text on right
|
|
8136
|
-
renderIcon(icon, { 'min-width': '24px',
|
|
8137
|
-
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px',
|
|
8161
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8162
|
+
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text || children),
|
|
8138
8163
|
];
|
|
8139
8164
|
const linkStyle = {
|
|
8140
8165
|
display: 'flex',
|