mithril-materialized 3.5.4 → 3.5.5
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 +66 -42
- package/dist/index.js +66 -42
- package/dist/index.min.css +1 -1
- package/dist/index.umd.js +66 -42
- package/package.json +1 -1
- package/sass/components/_sidenav.scss +7 -0
package/dist/index.umd.js
CHANGED
|
@@ -7816,9 +7816,19 @@
|
|
|
7816
7816
|
|
|
7817
7817
|
// List of MaterialIcon SVG icons that are available
|
|
7818
7818
|
const materialIconSvgNames = [
|
|
7819
|
-
'caret',
|
|
7820
|
-
'
|
|
7821
|
-
'
|
|
7819
|
+
'caret',
|
|
7820
|
+
'close',
|
|
7821
|
+
'chevron',
|
|
7822
|
+
'chevron_left',
|
|
7823
|
+
'chevron_right',
|
|
7824
|
+
'menu',
|
|
7825
|
+
'expand',
|
|
7826
|
+
'collapse',
|
|
7827
|
+
'check',
|
|
7828
|
+
'radio_checked',
|
|
7829
|
+
'radio_unchecked',
|
|
7830
|
+
'light_mode',
|
|
7831
|
+
'dark_mode',
|
|
7822
7832
|
];
|
|
7823
7833
|
/**
|
|
7824
7834
|
* Helper function to render icons based on IconDefinition type
|
|
@@ -7848,31 +7858,42 @@
|
|
|
7848
7858
|
return null;
|
|
7849
7859
|
};
|
|
7850
7860
|
/**
|
|
7851
|
-
*
|
|
7861
|
+
* Sidenav Header/Footer Item Component
|
|
7852
7862
|
*/
|
|
7853
|
-
const
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7863
|
+
const SidenavHeaderFooterItem = () => {
|
|
7864
|
+
return {
|
|
7865
|
+
view: ({ attrs }) => {
|
|
7866
|
+
const { text, icon, onclick, href, className = '', _isExpanded = true, _position = 'left' } = attrs;
|
|
7867
|
+
const isRightAligned = _position === 'right';
|
|
7868
|
+
const handleClick = (e) => {
|
|
7869
|
+
if (onclick) {
|
|
7870
|
+
e.preventDefault();
|
|
7871
|
+
onclick(e);
|
|
7872
|
+
}
|
|
7873
|
+
};
|
|
7874
|
+
const content = isRightAligned
|
|
7875
|
+
? [
|
|
7876
|
+
_isExpanded &&
|
|
7877
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text),
|
|
7878
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7879
|
+
]
|
|
7880
|
+
: [
|
|
7881
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
7882
|
+
_isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text),
|
|
7883
|
+
];
|
|
7884
|
+
const linkStyle = {
|
|
7885
|
+
display: 'flex',
|
|
7886
|
+
'align-items': 'center',
|
|
7887
|
+
padding: _isExpanded ? '12px 16px' : '12px 18px',
|
|
7888
|
+
'justify-content': _isExpanded ? (isRightAligned ? 'flex-end' : 'flex-start') : 'center',
|
|
7889
|
+
};
|
|
7890
|
+
return m('li', { class: className }, m('a', {
|
|
7891
|
+
href: href || '#!',
|
|
7892
|
+
onclick: handleClick,
|
|
7893
|
+
style: linkStyle,
|
|
7894
|
+
}, content));
|
|
7895
|
+
},
|
|
7896
|
+
};
|
|
7876
7897
|
};
|
|
7877
7898
|
/**
|
|
7878
7899
|
* Sidenav Component
|
|
@@ -7997,7 +8018,8 @@
|
|
|
7997
8018
|
style: { width: '24px', height: '24px' },
|
|
7998
8019
|
})),
|
|
7999
8020
|
// Header item (if provided, appears before expand/collapse toggle)
|
|
8000
|
-
attrs.header &&
|
|
8021
|
+
attrs.header &&
|
|
8022
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.header), { _isExpanded: isExpanded, _position: position })),
|
|
8001
8023
|
// Expand/collapse toggle button (if expandable, right below hamburger)
|
|
8002
8024
|
expandable &&
|
|
8003
8025
|
m('li.sidenav-expand-toggle', {
|
|
@@ -8012,8 +8034,12 @@
|
|
|
8012
8034
|
onclick: () => toggleExpanded(attrs),
|
|
8013
8035
|
}, m(MaterialIcon, {
|
|
8014
8036
|
name: position === 'right'
|
|
8015
|
-
?
|
|
8016
|
-
|
|
8037
|
+
? isExpanded
|
|
8038
|
+
? 'chevron_right'
|
|
8039
|
+
: 'chevron_left'
|
|
8040
|
+
: isExpanded
|
|
8041
|
+
? 'chevron_left'
|
|
8042
|
+
: 'chevron_right',
|
|
8017
8043
|
style: { width: '24px', height: '24px' },
|
|
8018
8044
|
})),
|
|
8019
8045
|
// Children (menu items) - inject internal props
|
|
@@ -8027,7 +8053,8 @@
|
|
|
8027
8053
|
})
|
|
8028
8054
|
: children,
|
|
8029
8055
|
// Footer item (if provided, appears at the bottom)
|
|
8030
|
-
attrs.footer &&
|
|
8056
|
+
attrs.footer &&
|
|
8057
|
+
m(SidenavHeaderFooterItem, Object.assign(Object.assign({}, attrs.footer), { _isExpanded: isExpanded, _position: position, className: 'sidenav-footer-item' })),
|
|
8031
8058
|
]),
|
|
8032
8059
|
];
|
|
8033
8060
|
},
|
|
@@ -8060,7 +8087,7 @@
|
|
|
8060
8087
|
const submenuContent = isRightAligned
|
|
8061
8088
|
? [
|
|
8062
8089
|
// Right-aligned: text on left, icons on right
|
|
8063
|
-
isExpanded && m('span', { style: {
|
|
8090
|
+
isExpanded && m('span', { style: { flex: '1', 'text-align': 'left' } }, text),
|
|
8064
8091
|
icon && isExpanded && renderIcon(icon, { 'font-size': '18px' }),
|
|
8065
8092
|
indicatorIcon,
|
|
8066
8093
|
]
|
|
@@ -8104,12 +8131,7 @@
|
|
|
8104
8131
|
return m('li.subheader', text || children);
|
|
8105
8132
|
}
|
|
8106
8133
|
const hasSubmenu = submenu && submenu.length > 0;
|
|
8107
|
-
const itemClasses = [
|
|
8108
|
-
active ? 'active' : '',
|
|
8109
|
-
disabled ? 'disabled' : '',
|
|
8110
|
-
hasSubmenu ? 'has-submenu' : '',
|
|
8111
|
-
className,
|
|
8112
|
-
]
|
|
8134
|
+
const itemClasses = [active ? 'active' : '', disabled ? 'disabled' : '', hasSubmenu ? 'has-submenu' : '', className]
|
|
8113
8135
|
.filter(Boolean)
|
|
8114
8136
|
.join(' ') || undefined;
|
|
8115
8137
|
const handleMainClick = (e) => {
|
|
@@ -8118,6 +8140,7 @@
|
|
|
8118
8140
|
isSubmenuOpen = active ? !isSubmenuOpen : true;
|
|
8119
8141
|
}
|
|
8120
8142
|
if (onclick && !disabled) {
|
|
8143
|
+
e.preventDefault();
|
|
8121
8144
|
onclick(e);
|
|
8122
8145
|
}
|
|
8123
8146
|
};
|
|
@@ -8130,13 +8153,14 @@
|
|
|
8130
8153
|
const content = isRightAligned
|
|
8131
8154
|
? [
|
|
8132
8155
|
// Right-aligned: text on left, icon on right
|
|
8133
|
-
isExpanded &&
|
|
8134
|
-
|
|
8156
|
+
isExpanded &&
|
|
8157
|
+
m('span.sidenav-item-text', { style: { flex: '1', 'text-align': 'left', 'margin-right': '8px' } }, text || children),
|
|
8158
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8135
8159
|
]
|
|
8136
8160
|
: [
|
|
8137
8161
|
// Left-aligned: icon on left, text on right
|
|
8138
|
-
renderIcon(icon, { 'min-width': '24px',
|
|
8139
|
-
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px',
|
|
8162
|
+
renderIcon(icon, { 'min-width': '24px', width: '24px' }),
|
|
8163
|
+
isExpanded && m('span.sidenav-item-text', { style: { 'margin-left': '8px', flex: '1' } }, text || children),
|
|
8140
8164
|
];
|
|
8141
8165
|
const linkStyle = {
|
|
8142
8166
|
display: 'flex',
|
package/package.json
CHANGED
|
@@ -130,6 +130,8 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
130
130
|
backface-visibility: hidden;
|
|
131
131
|
transform: translateX(-105%);
|
|
132
132
|
transition: transform 0.3s ease, left 0.3s ease, right 0.3s ease;
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
133
135
|
|
|
134
136
|
@extend .z-depth-1 !optional;
|
|
135
137
|
|
|
@@ -590,6 +592,11 @@ ul.sidenav.right-aligned li > a:not(.btn):not(.btn-large):not(.btn-flat):not(.bt
|
|
|
590
592
|
}
|
|
591
593
|
}
|
|
592
594
|
|
|
595
|
+
// Footer item positioning
|
|
596
|
+
.sidenav-footer-item {
|
|
597
|
+
margin-top: auto;
|
|
598
|
+
}
|
|
599
|
+
|
|
593
600
|
// Animation for smooth width transitions
|
|
594
601
|
.sidenav {
|
|
595
602
|
transition: transform 0.3s ease, width 0.3s ease;
|