mithril-materialized 3.13.0 → 3.14.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/button.d.ts +9 -0
- package/dist/index.esm.js +130 -78
- package/dist/index.js +130 -77
- package/dist/index.umd.js +130 -77
- package/dist/material-icon.d.ts +2 -1
- package/package.json +1 -1
package/dist/button.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import m, { FactoryComponent, Attributes } from 'mithril';
|
|
2
|
+
import { IconName } from './material-icon';
|
|
2
3
|
import { MaterialPosition, IconClass, ButtonVariant } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* HTML attributes that can be passed to button elements
|
|
@@ -86,3 +87,11 @@ export declare const FlatButton: m.FactoryComponent<ButtonAttrs>;
|
|
|
86
87
|
export declare const IconButton: m.FactoryComponent<ButtonAttrs>;
|
|
87
88
|
export declare const RoundIconButton: m.FactoryComponent<ButtonAttrs>;
|
|
88
89
|
export declare const SubmitButton: m.FactoryComponent<ButtonAttrs>;
|
|
90
|
+
export interface ConfirmButtonAttrs extends ButtonAttrs {
|
|
91
|
+
confirmIconName?: IconName;
|
|
92
|
+
confirmColor?: string;
|
|
93
|
+
timeout?: number;
|
|
94
|
+
clickDelay?: number;
|
|
95
|
+
onFirstClick?: () => void;
|
|
96
|
+
}
|
|
97
|
+
export declare const ConfirmButton: FactoryComponent<ConfirmButtonAttrs>;
|
package/dist/index.esm.js
CHANGED
|
@@ -618,6 +618,85 @@ const Icon = () => ({
|
|
|
618
618
|
},
|
|
619
619
|
});
|
|
620
620
|
|
|
621
|
+
const iconPaths = {
|
|
622
|
+
caret: [
|
|
623
|
+
'M7 10l5 5 5-5z', // arrow
|
|
624
|
+
'M0 0h24v24H0z', // background
|
|
625
|
+
],
|
|
626
|
+
close: [
|
|
627
|
+
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
628
|
+
'M0 0h24v24H0z',
|
|
629
|
+
],
|
|
630
|
+
chevron: [
|
|
631
|
+
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
632
|
+
'M0 0h24v24H0z', // background
|
|
633
|
+
],
|
|
634
|
+
chevron_left: [
|
|
635
|
+
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
636
|
+
'M0 0h24v24H0z', // background
|
|
637
|
+
],
|
|
638
|
+
chevron_right: [
|
|
639
|
+
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
640
|
+
'M0 0h24v24H0z', // background
|
|
641
|
+
],
|
|
642
|
+
menu: [
|
|
643
|
+
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
644
|
+
'M0 0h24v24H0z', // background
|
|
645
|
+
],
|
|
646
|
+
expand: [
|
|
647
|
+
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
648
|
+
'M0 0h24v24H0z', // background
|
|
649
|
+
],
|
|
650
|
+
collapse: [
|
|
651
|
+
'M19 13H5v-2h14v2z', // minus
|
|
652
|
+
'M0 0h24v24H0z', // background
|
|
653
|
+
],
|
|
654
|
+
check: [
|
|
655
|
+
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
656
|
+
'M0 0h24v24H0z', // background
|
|
657
|
+
],
|
|
658
|
+
radio_checked: [
|
|
659
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
660
|
+
'M0 0h24v24H0z', // background
|
|
661
|
+
],
|
|
662
|
+
radio_unchecked: [
|
|
663
|
+
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
664
|
+
'M0 0h24v24H0z', // background
|
|
665
|
+
],
|
|
666
|
+
light_mode: [
|
|
667
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
668
|
+
'M0 0h24v24H0z', // background
|
|
669
|
+
],
|
|
670
|
+
dark_mode: [
|
|
671
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
672
|
+
'M0 0h24v24H0z', // background
|
|
673
|
+
],
|
|
674
|
+
delete: [
|
|
675
|
+
'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z',
|
|
676
|
+
'M0 0h24v24H0z', // background
|
|
677
|
+
],
|
|
678
|
+
};
|
|
679
|
+
const MaterialIcon = () => {
|
|
680
|
+
return {
|
|
681
|
+
view: ({ attrs }) => {
|
|
682
|
+
var _a;
|
|
683
|
+
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
684
|
+
const rotationMap = {
|
|
685
|
+
down: 0,
|
|
686
|
+
up: 180,
|
|
687
|
+
left: 90,
|
|
688
|
+
right: -90,
|
|
689
|
+
};
|
|
690
|
+
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
691
|
+
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
692
|
+
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
693
|
+
d,
|
|
694
|
+
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
695
|
+
})));
|
|
696
|
+
},
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
|
|
621
700
|
/*!
|
|
622
701
|
* Waves Effect for Mithril Materialized
|
|
623
702
|
* Based on Waves v0.6.4 by Alfiana E. Sibuea
|
|
@@ -723,7 +802,7 @@ WavesEffect.onTouchEnd = (e) => {
|
|
|
723
802
|
const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
724
803
|
return () => {
|
|
725
804
|
return {
|
|
726
|
-
view: ({ attrs }) => {
|
|
805
|
+
view: ({ attrs, children }) => {
|
|
727
806
|
const { tooltip, tooltipPosition, tooltipPostion, // Keep for backwards compatibility
|
|
728
807
|
iconName, iconClass, label, className, variant } = attrs, params = __rest(attrs, ["tooltip", "tooltipPosition", "tooltipPostion", "iconName", "iconClass", "label", "className", "variant"]);
|
|
729
808
|
// Use variant or fallback to factory type
|
|
@@ -739,7 +818,7 @@ const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
|
739
818
|
ontouchstart: WavesEffect.onTouchStart,
|
|
740
819
|
ontouchend: WavesEffect.onTouchEnd
|
|
741
820
|
} : {};
|
|
742
|
-
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined);
|
|
821
|
+
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined, children);
|
|
743
822
|
},
|
|
744
823
|
};
|
|
745
824
|
};
|
|
@@ -751,6 +830,54 @@ const FlatButton = ButtonFactory('a', 'waves-effect waves-teal btn-flat', 'butto
|
|
|
751
830
|
const IconButton = ButtonFactory('button', 'btn-flat btn-icon waves-effect waves-teal', 'button');
|
|
752
831
|
const RoundIconButton = ButtonFactory('button', 'btn-floating btn-large waves-effect waves-light', 'button');
|
|
753
832
|
const SubmitButton = ButtonFactory('button', 'btn waves-effect waves-light', 'submit');
|
|
833
|
+
const RaisedIconButton = ButtonFactory('button', 'btn waves-effect waves-light', 'button');
|
|
834
|
+
const ConfirmButton = () => {
|
|
835
|
+
let isConfirming = false;
|
|
836
|
+
let isBlocked = false;
|
|
837
|
+
let timeoutId;
|
|
838
|
+
let blockTimeoutId;
|
|
839
|
+
const reset = () => {
|
|
840
|
+
isConfirming = false;
|
|
841
|
+
isBlocked = false;
|
|
842
|
+
m.redraw();
|
|
843
|
+
};
|
|
844
|
+
const unblock = () => {
|
|
845
|
+
isBlocked = false;
|
|
846
|
+
};
|
|
847
|
+
return {
|
|
848
|
+
onremove: () => {
|
|
849
|
+
window.clearTimeout(timeoutId);
|
|
850
|
+
window.clearTimeout(blockTimeoutId);
|
|
851
|
+
},
|
|
852
|
+
view: ({ attrs }) => {
|
|
853
|
+
const { iconName = 'delete', confirmIconName = 'check', confirmColor = 'red', timeout = 3000, clickDelay = 500, onFirstClick, onclick } = attrs, props = __rest(attrs, ["iconName", "confirmIconName", "confirmColor", "timeout", "clickDelay", "onFirstClick", "onclick"]);
|
|
854
|
+
const handleClick = (e) => {
|
|
855
|
+
e.preventDefault();
|
|
856
|
+
if (isBlocked)
|
|
857
|
+
return;
|
|
858
|
+
if (isConfirming) {
|
|
859
|
+
window.clearTimeout(timeoutId);
|
|
860
|
+
window.clearTimeout(blockTimeoutId); // Clean up safety
|
|
861
|
+
isConfirming = false;
|
|
862
|
+
onclick === null || onclick === void 0 ? void 0 : onclick(e);
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
isConfirming = true;
|
|
866
|
+
isBlocked = true;
|
|
867
|
+
onFirstClick === null || onFirstClick === void 0 ? void 0 : onFirstClick();
|
|
868
|
+
timeoutId = window.setTimeout(reset, timeout);
|
|
869
|
+
blockTimeoutId = window.setTimeout(unblock, clickDelay);
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
const cn = isConfirming ? confirmColor : 'red-text';
|
|
873
|
+
const commonProps = Object.assign(Object.assign({}, props), { className: `${props.className || ''} ${cn}`, style: Object.assign(Object.assign(Object.assign({}, props.style), { display: 'flex', alignItems: 'center', justifyContent: 'center' }), (isConfirming ? { padding: '0 8px', width: 'auto', minWidth: 'auto' } : {})), onclick: handleClick });
|
|
874
|
+
if (isConfirming) {
|
|
875
|
+
return m(RaisedIconButton, commonProps, m(MaterialIcon, { name: confirmIconName }));
|
|
876
|
+
}
|
|
877
|
+
return m(IconButton, commonProps, m(MaterialIcon, { name: iconName }));
|
|
878
|
+
},
|
|
879
|
+
};
|
|
880
|
+
};
|
|
754
881
|
|
|
755
882
|
/**
|
|
756
883
|
* Materialize CSS Carousel component with dynamic positioning
|
|
@@ -1142,81 +1269,6 @@ const Carousel = () => {
|
|
|
1142
1269
|
};
|
|
1143
1270
|
};
|
|
1144
1271
|
|
|
1145
|
-
const iconPaths = {
|
|
1146
|
-
caret: [
|
|
1147
|
-
'M7 10l5 5 5-5z', // arrow
|
|
1148
|
-
'M0 0h24v24H0z', // background
|
|
1149
|
-
],
|
|
1150
|
-
close: [
|
|
1151
|
-
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
1152
|
-
'M0 0h24v24H0z',
|
|
1153
|
-
],
|
|
1154
|
-
chevron: [
|
|
1155
|
-
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
1156
|
-
'M0 0h24v24H0z', // background
|
|
1157
|
-
],
|
|
1158
|
-
chevron_left: [
|
|
1159
|
-
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
1160
|
-
'M0 0h24v24H0z', // background
|
|
1161
|
-
],
|
|
1162
|
-
chevron_right: [
|
|
1163
|
-
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
1164
|
-
'M0 0h24v24H0z', // background
|
|
1165
|
-
],
|
|
1166
|
-
menu: [
|
|
1167
|
-
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
1168
|
-
'M0 0h24v24H0z', // background
|
|
1169
|
-
],
|
|
1170
|
-
expand: [
|
|
1171
|
-
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
1172
|
-
'M0 0h24v24H0z', // background
|
|
1173
|
-
],
|
|
1174
|
-
collapse: [
|
|
1175
|
-
'M19 13H5v-2h14v2z', // minus
|
|
1176
|
-
'M0 0h24v24H0z', // background
|
|
1177
|
-
],
|
|
1178
|
-
check: [
|
|
1179
|
-
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
1180
|
-
'M0 0h24v24H0z', // background
|
|
1181
|
-
],
|
|
1182
|
-
radio_checked: [
|
|
1183
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
1184
|
-
'M0 0h24v24H0z', // background
|
|
1185
|
-
],
|
|
1186
|
-
radio_unchecked: [
|
|
1187
|
-
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
1188
|
-
'M0 0h24v24H0z', // background
|
|
1189
|
-
],
|
|
1190
|
-
light_mode: [
|
|
1191
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
1192
|
-
'M0 0h24v24H0z', // background
|
|
1193
|
-
],
|
|
1194
|
-
dark_mode: [
|
|
1195
|
-
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
1196
|
-
'M0 0h24v24H0z', // background
|
|
1197
|
-
],
|
|
1198
|
-
};
|
|
1199
|
-
const MaterialIcon = () => {
|
|
1200
|
-
return {
|
|
1201
|
-
view: ({ attrs }) => {
|
|
1202
|
-
var _a;
|
|
1203
|
-
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
1204
|
-
const rotationMap = {
|
|
1205
|
-
down: 0,
|
|
1206
|
-
up: 180,
|
|
1207
|
-
left: 90,
|
|
1208
|
-
right: -90,
|
|
1209
|
-
};
|
|
1210
|
-
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
1211
|
-
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
1212
|
-
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
1213
|
-
d,
|
|
1214
|
-
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
1215
|
-
})));
|
|
1216
|
-
},
|
|
1217
|
-
};
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
1272
|
const Chips = () => {
|
|
1221
1273
|
const state = {
|
|
1222
1274
|
chipsData: [],
|
|
@@ -11434,4 +11486,4 @@ const isValidationError = (result) => !isValidationSuccess(result);
|
|
|
11434
11486
|
// ============================================================================
|
|
11435
11487
|
// All types are already exported via individual export declarations above
|
|
11436
11488
|
|
|
11437
|
-
export { AnalogClock, AnchorItem, Autocomplete, Badge, Breadcrumb, BreadcrumbManager, Button, ButtonFactory, Carousel, CharacterCounter, Chips, CircularProgress, CodeBlock, Collapsible, CollapsibleItem, Collection, CollectionMode, ColorInput, DataTable, DatePicker, DigitalClock, DoubleRangeSlider, Dropdown, EmailInput, FileInput, FileUpload, FlatButton, FloatingActionButton, HelperText, Icon, IconButton, ImageList, InputCheckbox, Label, LargeButton, LikertScale, LinearProgress, ListItem, Mandatory, Masonry, MaterialBox, MaterialIcon, ModalPanel, NumberInput, Options, OptionsList, Pagination, PaginationControls, Parallax, PasswordInput, Pushpin, PushpinComponent, RadioButton, RadioButtons, RangeInput, Rating, RoundIconButton, SearchSelect, SecondaryContent, Select, Sidenav, SidenavItem, SidenavManager, SingleRangeSlider, SmallButton, Stepper, SubmitButton, Switch, Tabs, TextArea, TextInput, ThemeManager, ThemeSwitcher, ThemeToggle, TimePicker, TimeRangePicker, Timeline, Toast, ToastComponent, ToggleGroup, Tooltip, TooltipComponent, TreeView, UrlInput, Wizard, addLeadingZero, clearPortal, createBreadcrumb, formatTime, generateHourOptions, generateMinuteOptions, getDropdownStyles, getPortalContainer, initPushpins, initTooltips, isNumeric, isTimeDisabled, isValidationError, isValidationSuccess, padLeft, parseTime, range, releasePortalContainer, renderToPortal, scrollToValue, snapToNearestItem, sortOptions, timeToMinutes, toast, uniqueId, uuid4 };
|
|
11489
|
+
export { AnalogClock, AnchorItem, Autocomplete, Badge, Breadcrumb, BreadcrumbManager, Button, ButtonFactory, Carousel, CharacterCounter, Chips, CircularProgress, CodeBlock, Collapsible, CollapsibleItem, Collection, CollectionMode, ColorInput, ConfirmButton, DataTable, DatePicker, DigitalClock, DoubleRangeSlider, Dropdown, EmailInput, FileInput, FileUpload, FlatButton, FloatingActionButton, HelperText, Icon, IconButton, ImageList, InputCheckbox, Label, LargeButton, LikertScale, LinearProgress, ListItem, Mandatory, Masonry, MaterialBox, MaterialIcon, ModalPanel, NumberInput, Options, OptionsList, Pagination, PaginationControls, Parallax, PasswordInput, Pushpin, PushpinComponent, RadioButton, RadioButtons, RangeInput, Rating, RoundIconButton, SearchSelect, SecondaryContent, Select, Sidenav, SidenavItem, SidenavManager, SingleRangeSlider, SmallButton, Stepper, SubmitButton, Switch, Tabs, TextArea, TextInput, ThemeManager, ThemeSwitcher, ThemeToggle, TimePicker, TimeRangePicker, Timeline, Toast, ToastComponent, ToggleGroup, Tooltip, TooltipComponent, TreeView, UrlInput, Wizard, addLeadingZero, clearPortal, createBreadcrumb, formatTime, generateHourOptions, generateMinuteOptions, getDropdownStyles, getPortalContainer, initPushpins, initTooltips, isNumeric, isTimeDisabled, isValidationError, isValidationSuccess, padLeft, parseTime, range, releasePortalContainer, renderToPortal, scrollToValue, snapToNearestItem, sortOptions, timeToMinutes, toast, uniqueId, uuid4 };
|
package/dist/index.js
CHANGED
|
@@ -620,6 +620,85 @@ const Icon = () => ({
|
|
|
620
620
|
},
|
|
621
621
|
});
|
|
622
622
|
|
|
623
|
+
const iconPaths = {
|
|
624
|
+
caret: [
|
|
625
|
+
'M7 10l5 5 5-5z', // arrow
|
|
626
|
+
'M0 0h24v24H0z', // background
|
|
627
|
+
],
|
|
628
|
+
close: [
|
|
629
|
+
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
630
|
+
'M0 0h24v24H0z',
|
|
631
|
+
],
|
|
632
|
+
chevron: [
|
|
633
|
+
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
634
|
+
'M0 0h24v24H0z', // background
|
|
635
|
+
],
|
|
636
|
+
chevron_left: [
|
|
637
|
+
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
638
|
+
'M0 0h24v24H0z', // background
|
|
639
|
+
],
|
|
640
|
+
chevron_right: [
|
|
641
|
+
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
642
|
+
'M0 0h24v24H0z', // background
|
|
643
|
+
],
|
|
644
|
+
menu: [
|
|
645
|
+
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
646
|
+
'M0 0h24v24H0z', // background
|
|
647
|
+
],
|
|
648
|
+
expand: [
|
|
649
|
+
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
650
|
+
'M0 0h24v24H0z', // background
|
|
651
|
+
],
|
|
652
|
+
collapse: [
|
|
653
|
+
'M19 13H5v-2h14v2z', // minus
|
|
654
|
+
'M0 0h24v24H0z', // background
|
|
655
|
+
],
|
|
656
|
+
check: [
|
|
657
|
+
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
658
|
+
'M0 0h24v24H0z', // background
|
|
659
|
+
],
|
|
660
|
+
radio_checked: [
|
|
661
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
662
|
+
'M0 0h24v24H0z', // background
|
|
663
|
+
],
|
|
664
|
+
radio_unchecked: [
|
|
665
|
+
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
666
|
+
'M0 0h24v24H0z', // background
|
|
667
|
+
],
|
|
668
|
+
light_mode: [
|
|
669
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
670
|
+
'M0 0h24v24H0z', // background
|
|
671
|
+
],
|
|
672
|
+
dark_mode: [
|
|
673
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
674
|
+
'M0 0h24v24H0z', // background
|
|
675
|
+
],
|
|
676
|
+
delete: [
|
|
677
|
+
'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z',
|
|
678
|
+
'M0 0h24v24H0z', // background
|
|
679
|
+
],
|
|
680
|
+
};
|
|
681
|
+
const MaterialIcon = () => {
|
|
682
|
+
return {
|
|
683
|
+
view: ({ attrs }) => {
|
|
684
|
+
var _a;
|
|
685
|
+
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
686
|
+
const rotationMap = {
|
|
687
|
+
down: 0,
|
|
688
|
+
up: 180,
|
|
689
|
+
left: 90,
|
|
690
|
+
right: -90,
|
|
691
|
+
};
|
|
692
|
+
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
693
|
+
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
694
|
+
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
695
|
+
d,
|
|
696
|
+
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
697
|
+
})));
|
|
698
|
+
},
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
|
|
623
702
|
/*!
|
|
624
703
|
* Waves Effect for Mithril Materialized
|
|
625
704
|
* Based on Waves v0.6.4 by Alfiana E. Sibuea
|
|
@@ -725,7 +804,7 @@ WavesEffect.onTouchEnd = (e) => {
|
|
|
725
804
|
const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
726
805
|
return () => {
|
|
727
806
|
return {
|
|
728
|
-
view: ({ attrs }) => {
|
|
807
|
+
view: ({ attrs, children }) => {
|
|
729
808
|
const { tooltip, tooltipPosition, tooltipPostion, // Keep for backwards compatibility
|
|
730
809
|
iconName, iconClass, label, className, variant } = attrs, params = __rest(attrs, ["tooltip", "tooltipPosition", "tooltipPostion", "iconName", "iconClass", "label", "className", "variant"]);
|
|
731
810
|
// Use variant or fallback to factory type
|
|
@@ -741,7 +820,7 @@ const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
|
741
820
|
ontouchstart: WavesEffect.onTouchStart,
|
|
742
821
|
ontouchend: WavesEffect.onTouchEnd
|
|
743
822
|
} : {};
|
|
744
|
-
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined);
|
|
823
|
+
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined, children);
|
|
745
824
|
},
|
|
746
825
|
};
|
|
747
826
|
};
|
|
@@ -753,6 +832,54 @@ const FlatButton = ButtonFactory('a', 'waves-effect waves-teal btn-flat', 'butto
|
|
|
753
832
|
const IconButton = ButtonFactory('button', 'btn-flat btn-icon waves-effect waves-teal', 'button');
|
|
754
833
|
const RoundIconButton = ButtonFactory('button', 'btn-floating btn-large waves-effect waves-light', 'button');
|
|
755
834
|
const SubmitButton = ButtonFactory('button', 'btn waves-effect waves-light', 'submit');
|
|
835
|
+
const RaisedIconButton = ButtonFactory('button', 'btn waves-effect waves-light', 'button');
|
|
836
|
+
const ConfirmButton = () => {
|
|
837
|
+
let isConfirming = false;
|
|
838
|
+
let isBlocked = false;
|
|
839
|
+
let timeoutId;
|
|
840
|
+
let blockTimeoutId;
|
|
841
|
+
const reset = () => {
|
|
842
|
+
isConfirming = false;
|
|
843
|
+
isBlocked = false;
|
|
844
|
+
m.redraw();
|
|
845
|
+
};
|
|
846
|
+
const unblock = () => {
|
|
847
|
+
isBlocked = false;
|
|
848
|
+
};
|
|
849
|
+
return {
|
|
850
|
+
onremove: () => {
|
|
851
|
+
window.clearTimeout(timeoutId);
|
|
852
|
+
window.clearTimeout(blockTimeoutId);
|
|
853
|
+
},
|
|
854
|
+
view: ({ attrs }) => {
|
|
855
|
+
const { iconName = 'delete', confirmIconName = 'check', confirmColor = 'red', timeout = 3000, clickDelay = 500, onFirstClick, onclick } = attrs, props = __rest(attrs, ["iconName", "confirmIconName", "confirmColor", "timeout", "clickDelay", "onFirstClick", "onclick"]);
|
|
856
|
+
const handleClick = (e) => {
|
|
857
|
+
e.preventDefault();
|
|
858
|
+
if (isBlocked)
|
|
859
|
+
return;
|
|
860
|
+
if (isConfirming) {
|
|
861
|
+
window.clearTimeout(timeoutId);
|
|
862
|
+
window.clearTimeout(blockTimeoutId); // Clean up safety
|
|
863
|
+
isConfirming = false;
|
|
864
|
+
onclick === null || onclick === void 0 ? void 0 : onclick(e);
|
|
865
|
+
}
|
|
866
|
+
else {
|
|
867
|
+
isConfirming = true;
|
|
868
|
+
isBlocked = true;
|
|
869
|
+
onFirstClick === null || onFirstClick === void 0 ? void 0 : onFirstClick();
|
|
870
|
+
timeoutId = window.setTimeout(reset, timeout);
|
|
871
|
+
blockTimeoutId = window.setTimeout(unblock, clickDelay);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
const cn = isConfirming ? confirmColor : 'red-text';
|
|
875
|
+
const commonProps = Object.assign(Object.assign({}, props), { className: `${props.className || ''} ${cn}`, style: Object.assign(Object.assign(Object.assign({}, props.style), { display: 'flex', alignItems: 'center', justifyContent: 'center' }), (isConfirming ? { padding: '0 8px', width: 'auto', minWidth: 'auto' } : {})), onclick: handleClick });
|
|
876
|
+
if (isConfirming) {
|
|
877
|
+
return m(RaisedIconButton, commonProps, m(MaterialIcon, { name: confirmIconName }));
|
|
878
|
+
}
|
|
879
|
+
return m(IconButton, commonProps, m(MaterialIcon, { name: iconName }));
|
|
880
|
+
},
|
|
881
|
+
};
|
|
882
|
+
};
|
|
756
883
|
|
|
757
884
|
/**
|
|
758
885
|
* Materialize CSS Carousel component with dynamic positioning
|
|
@@ -1144,81 +1271,6 @@ const Carousel = () => {
|
|
|
1144
1271
|
};
|
|
1145
1272
|
};
|
|
1146
1273
|
|
|
1147
|
-
const iconPaths = {
|
|
1148
|
-
caret: [
|
|
1149
|
-
'M7 10l5 5 5-5z', // arrow
|
|
1150
|
-
'M0 0h24v24H0z', // background
|
|
1151
|
-
],
|
|
1152
|
-
close: [
|
|
1153
|
-
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
1154
|
-
'M0 0h24v24H0z',
|
|
1155
|
-
],
|
|
1156
|
-
chevron: [
|
|
1157
|
-
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
1158
|
-
'M0 0h24v24H0z', // background
|
|
1159
|
-
],
|
|
1160
|
-
chevron_left: [
|
|
1161
|
-
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
1162
|
-
'M0 0h24v24H0z', // background
|
|
1163
|
-
],
|
|
1164
|
-
chevron_right: [
|
|
1165
|
-
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
1166
|
-
'M0 0h24v24H0z', // background
|
|
1167
|
-
],
|
|
1168
|
-
menu: [
|
|
1169
|
-
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
1170
|
-
'M0 0h24v24H0z', // background
|
|
1171
|
-
],
|
|
1172
|
-
expand: [
|
|
1173
|
-
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
1174
|
-
'M0 0h24v24H0z', // background
|
|
1175
|
-
],
|
|
1176
|
-
collapse: [
|
|
1177
|
-
'M19 13H5v-2h14v2z', // minus
|
|
1178
|
-
'M0 0h24v24H0z', // background
|
|
1179
|
-
],
|
|
1180
|
-
check: [
|
|
1181
|
-
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
1182
|
-
'M0 0h24v24H0z', // background
|
|
1183
|
-
],
|
|
1184
|
-
radio_checked: [
|
|
1185
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
1186
|
-
'M0 0h24v24H0z', // background
|
|
1187
|
-
],
|
|
1188
|
-
radio_unchecked: [
|
|
1189
|
-
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
1190
|
-
'M0 0h24v24H0z', // background
|
|
1191
|
-
],
|
|
1192
|
-
light_mode: [
|
|
1193
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
1194
|
-
'M0 0h24v24H0z', // background
|
|
1195
|
-
],
|
|
1196
|
-
dark_mode: [
|
|
1197
|
-
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
1198
|
-
'M0 0h24v24H0z', // background
|
|
1199
|
-
],
|
|
1200
|
-
};
|
|
1201
|
-
const MaterialIcon = () => {
|
|
1202
|
-
return {
|
|
1203
|
-
view: ({ attrs }) => {
|
|
1204
|
-
var _a;
|
|
1205
|
-
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
1206
|
-
const rotationMap = {
|
|
1207
|
-
down: 0,
|
|
1208
|
-
up: 180,
|
|
1209
|
-
left: 90,
|
|
1210
|
-
right: -90,
|
|
1211
|
-
};
|
|
1212
|
-
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
1213
|
-
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
1214
|
-
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
1215
|
-
d,
|
|
1216
|
-
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
1217
|
-
})));
|
|
1218
|
-
},
|
|
1219
|
-
};
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
1274
|
const Chips = () => {
|
|
1223
1275
|
const state = {
|
|
1224
1276
|
chipsData: [],
|
|
@@ -11453,6 +11505,7 @@ exports.Collapsible = Collapsible;
|
|
|
11453
11505
|
exports.CollapsibleItem = CollapsibleItem;
|
|
11454
11506
|
exports.Collection = Collection;
|
|
11455
11507
|
exports.ColorInput = ColorInput;
|
|
11508
|
+
exports.ConfirmButton = ConfirmButton;
|
|
11456
11509
|
exports.DataTable = DataTable;
|
|
11457
11510
|
exports.DatePicker = DatePicker;
|
|
11458
11511
|
exports.DigitalClock = DigitalClock;
|
package/dist/index.umd.js
CHANGED
|
@@ -622,6 +622,85 @@
|
|
|
622
622
|
},
|
|
623
623
|
});
|
|
624
624
|
|
|
625
|
+
const iconPaths = {
|
|
626
|
+
caret: [
|
|
627
|
+
'M7 10l5 5 5-5z', // arrow
|
|
628
|
+
'M0 0h24v24H0z', // background
|
|
629
|
+
],
|
|
630
|
+
close: [
|
|
631
|
+
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
632
|
+
'M0 0h24v24H0z',
|
|
633
|
+
],
|
|
634
|
+
chevron: [
|
|
635
|
+
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
636
|
+
'M0 0h24v24H0z', // background
|
|
637
|
+
],
|
|
638
|
+
chevron_left: [
|
|
639
|
+
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
640
|
+
'M0 0h24v24H0z', // background
|
|
641
|
+
],
|
|
642
|
+
chevron_right: [
|
|
643
|
+
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
644
|
+
'M0 0h24v24H0z', // background
|
|
645
|
+
],
|
|
646
|
+
menu: [
|
|
647
|
+
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
648
|
+
'M0 0h24v24H0z', // background
|
|
649
|
+
],
|
|
650
|
+
expand: [
|
|
651
|
+
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
652
|
+
'M0 0h24v24H0z', // background
|
|
653
|
+
],
|
|
654
|
+
collapse: [
|
|
655
|
+
'M19 13H5v-2h14v2z', // minus
|
|
656
|
+
'M0 0h24v24H0z', // background
|
|
657
|
+
],
|
|
658
|
+
check: [
|
|
659
|
+
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
660
|
+
'M0 0h24v24H0z', // background
|
|
661
|
+
],
|
|
662
|
+
radio_checked: [
|
|
663
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
664
|
+
'M0 0h24v24H0z', // background
|
|
665
|
+
],
|
|
666
|
+
radio_unchecked: [
|
|
667
|
+
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
668
|
+
'M0 0h24v24H0z', // background
|
|
669
|
+
],
|
|
670
|
+
light_mode: [
|
|
671
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
672
|
+
'M0 0h24v24H0z', // background
|
|
673
|
+
],
|
|
674
|
+
dark_mode: [
|
|
675
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
676
|
+
'M0 0h24v24H0z', // background
|
|
677
|
+
],
|
|
678
|
+
delete: [
|
|
679
|
+
'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z',
|
|
680
|
+
'M0 0h24v24H0z', // background
|
|
681
|
+
],
|
|
682
|
+
};
|
|
683
|
+
const MaterialIcon = () => {
|
|
684
|
+
return {
|
|
685
|
+
view: ({ attrs }) => {
|
|
686
|
+
var _a;
|
|
687
|
+
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
688
|
+
const rotationMap = {
|
|
689
|
+
down: 0,
|
|
690
|
+
up: 180,
|
|
691
|
+
left: 90,
|
|
692
|
+
right: -90,
|
|
693
|
+
};
|
|
694
|
+
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
695
|
+
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
696
|
+
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
697
|
+
d,
|
|
698
|
+
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
699
|
+
})));
|
|
700
|
+
},
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
|
|
625
704
|
/*!
|
|
626
705
|
* Waves Effect for Mithril Materialized
|
|
627
706
|
* Based on Waves v0.6.4 by Alfiana E. Sibuea
|
|
@@ -727,7 +806,7 @@
|
|
|
727
806
|
const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
728
807
|
return () => {
|
|
729
808
|
return {
|
|
730
|
-
view: ({ attrs }) => {
|
|
809
|
+
view: ({ attrs, children }) => {
|
|
731
810
|
const { tooltip, tooltipPosition, tooltipPostion, // Keep for backwards compatibility
|
|
732
811
|
iconName, iconClass, label, className, variant } = attrs, params = __rest(attrs, ["tooltip", "tooltipPosition", "tooltipPostion", "iconName", "iconClass", "label", "className", "variant"]);
|
|
733
812
|
// Use variant or fallback to factory type
|
|
@@ -743,7 +822,7 @@
|
|
|
743
822
|
ontouchstart: WavesEffect.onTouchStart,
|
|
744
823
|
ontouchend: WavesEffect.onTouchEnd
|
|
745
824
|
} : {};
|
|
746
|
-
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined);
|
|
825
|
+
return m(element, Object.assign(Object.assign(Object.assign({}, params), wavesHandlers), { className: cn, 'data-position': tooltip ? position : undefined, 'data-tooltip': tooltip || undefined, type: buttonType }), iconName ? m(Icon, { iconName, className: iconClass || 'left' }) : undefined, label ? label : undefined, children);
|
|
747
826
|
},
|
|
748
827
|
};
|
|
749
828
|
};
|
|
@@ -755,6 +834,54 @@
|
|
|
755
834
|
const IconButton = ButtonFactory('button', 'btn-flat btn-icon waves-effect waves-teal', 'button');
|
|
756
835
|
const RoundIconButton = ButtonFactory('button', 'btn-floating btn-large waves-effect waves-light', 'button');
|
|
757
836
|
const SubmitButton = ButtonFactory('button', 'btn waves-effect waves-light', 'submit');
|
|
837
|
+
const RaisedIconButton = ButtonFactory('button', 'btn waves-effect waves-light', 'button');
|
|
838
|
+
const ConfirmButton = () => {
|
|
839
|
+
let isConfirming = false;
|
|
840
|
+
let isBlocked = false;
|
|
841
|
+
let timeoutId;
|
|
842
|
+
let blockTimeoutId;
|
|
843
|
+
const reset = () => {
|
|
844
|
+
isConfirming = false;
|
|
845
|
+
isBlocked = false;
|
|
846
|
+
m.redraw();
|
|
847
|
+
};
|
|
848
|
+
const unblock = () => {
|
|
849
|
+
isBlocked = false;
|
|
850
|
+
};
|
|
851
|
+
return {
|
|
852
|
+
onremove: () => {
|
|
853
|
+
window.clearTimeout(timeoutId);
|
|
854
|
+
window.clearTimeout(blockTimeoutId);
|
|
855
|
+
},
|
|
856
|
+
view: ({ attrs }) => {
|
|
857
|
+
const { iconName = 'delete', confirmIconName = 'check', confirmColor = 'red', timeout = 3000, clickDelay = 500, onFirstClick, onclick } = attrs, props = __rest(attrs, ["iconName", "confirmIconName", "confirmColor", "timeout", "clickDelay", "onFirstClick", "onclick"]);
|
|
858
|
+
const handleClick = (e) => {
|
|
859
|
+
e.preventDefault();
|
|
860
|
+
if (isBlocked)
|
|
861
|
+
return;
|
|
862
|
+
if (isConfirming) {
|
|
863
|
+
window.clearTimeout(timeoutId);
|
|
864
|
+
window.clearTimeout(blockTimeoutId); // Clean up safety
|
|
865
|
+
isConfirming = false;
|
|
866
|
+
onclick === null || onclick === void 0 ? void 0 : onclick(e);
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
isConfirming = true;
|
|
870
|
+
isBlocked = true;
|
|
871
|
+
onFirstClick === null || onFirstClick === void 0 ? void 0 : onFirstClick();
|
|
872
|
+
timeoutId = window.setTimeout(reset, timeout);
|
|
873
|
+
blockTimeoutId = window.setTimeout(unblock, clickDelay);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const cn = isConfirming ? confirmColor : 'red-text';
|
|
877
|
+
const commonProps = Object.assign(Object.assign({}, props), { className: `${props.className || ''} ${cn}`, style: Object.assign(Object.assign(Object.assign({}, props.style), { display: 'flex', alignItems: 'center', justifyContent: 'center' }), (isConfirming ? { padding: '0 8px', width: 'auto', minWidth: 'auto' } : {})), onclick: handleClick });
|
|
878
|
+
if (isConfirming) {
|
|
879
|
+
return m(RaisedIconButton, commonProps, m(MaterialIcon, { name: confirmIconName }));
|
|
880
|
+
}
|
|
881
|
+
return m(IconButton, commonProps, m(MaterialIcon, { name: iconName }));
|
|
882
|
+
},
|
|
883
|
+
};
|
|
884
|
+
};
|
|
758
885
|
|
|
759
886
|
/**
|
|
760
887
|
* Materialize CSS Carousel component with dynamic positioning
|
|
@@ -1146,81 +1273,6 @@
|
|
|
1146
1273
|
};
|
|
1147
1274
|
};
|
|
1148
1275
|
|
|
1149
|
-
const iconPaths = {
|
|
1150
|
-
caret: [
|
|
1151
|
-
'M7 10l5 5 5-5z', // arrow
|
|
1152
|
-
'M0 0h24v24H0z', // background
|
|
1153
|
-
],
|
|
1154
|
-
close: [
|
|
1155
|
-
'M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z',
|
|
1156
|
-
'M0 0h24v24H0z',
|
|
1157
|
-
],
|
|
1158
|
-
chevron: [
|
|
1159
|
-
'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z', // chevron down
|
|
1160
|
-
'M0 0h24v24H0z', // background
|
|
1161
|
-
],
|
|
1162
|
-
chevron_left: [
|
|
1163
|
-
'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', // chevron left
|
|
1164
|
-
'M0 0h24v24H0z', // background
|
|
1165
|
-
],
|
|
1166
|
-
chevron_right: [
|
|
1167
|
-
'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', // chevron right
|
|
1168
|
-
'M0 0h24v24H0z', // background
|
|
1169
|
-
],
|
|
1170
|
-
menu: [
|
|
1171
|
-
'M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z', // hamburger menu
|
|
1172
|
-
'M0 0h24v24H0z', // background
|
|
1173
|
-
],
|
|
1174
|
-
expand: [
|
|
1175
|
-
'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', // plus
|
|
1176
|
-
'M0 0h24v24H0z', // background
|
|
1177
|
-
],
|
|
1178
|
-
collapse: [
|
|
1179
|
-
'M19 13H5v-2h14v2z', // minus
|
|
1180
|
-
'M0 0h24v24H0z', // background
|
|
1181
|
-
],
|
|
1182
|
-
check: [
|
|
1183
|
-
'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', // checkmark
|
|
1184
|
-
'M0 0h24v24H0z', // background
|
|
1185
|
-
],
|
|
1186
|
-
radio_checked: [
|
|
1187
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button checked
|
|
1188
|
-
'M0 0h24v24H0z', // background
|
|
1189
|
-
],
|
|
1190
|
-
radio_unchecked: [
|
|
1191
|
-
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z', // radio button unchecked
|
|
1192
|
-
'M0 0h24v24H0z', // background
|
|
1193
|
-
],
|
|
1194
|
-
light_mode: [
|
|
1195
|
-
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
1196
|
-
'M0 0h24v24H0z', // background
|
|
1197
|
-
],
|
|
1198
|
-
dark_mode: [
|
|
1199
|
-
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
1200
|
-
'M0 0h24v24H0z', // background
|
|
1201
|
-
],
|
|
1202
|
-
};
|
|
1203
|
-
const MaterialIcon = () => {
|
|
1204
|
-
return {
|
|
1205
|
-
view: ({ attrs }) => {
|
|
1206
|
-
var _a;
|
|
1207
|
-
const { name, direction = 'down', style } = attrs, props = __rest(attrs, ["name", "direction", "style"]);
|
|
1208
|
-
const rotationMap = {
|
|
1209
|
-
down: 0,
|
|
1210
|
-
up: 180,
|
|
1211
|
-
left: 90,
|
|
1212
|
-
right: -90,
|
|
1213
|
-
};
|
|
1214
|
-
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
1215
|
-
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
1216
|
-
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '24px', width: '24px', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' }), iconPaths[name].map((d) => m('path', {
|
|
1217
|
-
d,
|
|
1218
|
-
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
1219
|
-
})));
|
|
1220
|
-
},
|
|
1221
|
-
};
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
1276
|
const Chips = () => {
|
|
1225
1277
|
const state = {
|
|
1226
1278
|
chipsData: [],
|
|
@@ -11455,6 +11507,7 @@
|
|
|
11455
11507
|
exports.CollapsibleItem = CollapsibleItem;
|
|
11456
11508
|
exports.Collection = Collection;
|
|
11457
11509
|
exports.ColorInput = ColorInput;
|
|
11510
|
+
exports.ConfirmButton = ConfirmButton;
|
|
11458
11511
|
exports.DataTable = DataTable;
|
|
11459
11512
|
exports.DatePicker = DatePicker;
|
|
11460
11513
|
exports.DigitalClock = DigitalClock;
|
package/dist/material-icon.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ declare const iconPaths: {
|
|
|
13
13
|
readonly radio_unchecked: readonly ["M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z", "M0 0h24v24H0z"];
|
|
14
14
|
readonly light_mode: readonly ["M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z", "M0 0h24v24H0z"];
|
|
15
15
|
readonly dark_mode: readonly ["M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z", "M0 0h24v24H0z"];
|
|
16
|
+
readonly delete: readonly ["M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", "M0 0h24v24H0z"];
|
|
16
17
|
};
|
|
17
|
-
type IconName = keyof typeof iconPaths;
|
|
18
|
+
export type IconName = keyof typeof iconPaths;
|
|
18
19
|
export interface MaterialIconAttrs extends Attributes {
|
|
19
20
|
name: IconName;
|
|
20
21
|
direction?: 'up' | 'down' | 'left' | 'right';
|