mithril-materialized 3.3.8 → 3.4.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 +1 -0
- package/dist/components.css +22 -0
- package/dist/forms.css +8 -0
- package/dist/index.css +22 -0
- package/dist/index.esm.js +122 -9
- package/dist/index.js +122 -8
- package/dist/index.min.css +2 -2
- package/dist/index.umd.js +122 -8
- package/dist/waves.d.ts +16 -0
- package/package.json +1 -1
- package/sass/components/_buttons.scss +21 -0
- package/sass/components/_theme-switcher.scss +10 -0
package/dist/button.d.ts
CHANGED
|
@@ -83,5 +83,6 @@ export declare const Button: m.FactoryComponent<ButtonAttrs>;
|
|
|
83
83
|
export declare const LargeButton: m.FactoryComponent<ButtonAttrs>;
|
|
84
84
|
export declare const SmallButton: m.FactoryComponent<ButtonAttrs>;
|
|
85
85
|
export declare const FlatButton: m.FactoryComponent<ButtonAttrs>;
|
|
86
|
+
export declare const IconButton: m.FactoryComponent<ButtonAttrs>;
|
|
86
87
|
export declare const RoundIconButton: m.FactoryComponent<ButtonAttrs>;
|
|
87
88
|
export declare const SubmitButton: m.FactoryComponent<ButtonAttrs>;
|
package/dist/components.css
CHANGED
|
@@ -977,6 +977,20 @@ button.btn-floating {
|
|
|
977
977
|
display: block;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
|
+
.btn-flat.btn-icon {
|
|
981
|
+
min-width: auto;
|
|
982
|
+
padding: 0 8px;
|
|
983
|
+
width: auto;
|
|
984
|
+
line-height: 36px;
|
|
985
|
+
background-color: transparent !important;
|
|
986
|
+
}
|
|
987
|
+
.btn-flat.btn-icon i {
|
|
988
|
+
margin: 0;
|
|
989
|
+
}
|
|
990
|
+
.btn-flat.btn-icon:hover, .btn-flat.btn-icon:focus, .btn-flat.btn-icon:active, .btn-flat.btn-icon.active {
|
|
991
|
+
background-color: transparent !important;
|
|
992
|
+
}
|
|
993
|
+
|
|
980
994
|
.modal:focus {
|
|
981
995
|
outline: none;
|
|
982
996
|
}
|
|
@@ -4245,6 +4259,11 @@ body {
|
|
|
4245
4259
|
.theme-switcher .theme-switcher-buttons .btn-flat .material-icons {
|
|
4246
4260
|
font-size: 1rem;
|
|
4247
4261
|
}
|
|
4262
|
+
.theme-switcher .theme-switcher-buttons .btn-flat svg {
|
|
4263
|
+
width: 1rem !important;
|
|
4264
|
+
height: 1rem !important;
|
|
4265
|
+
flex-shrink: 0;
|
|
4266
|
+
}
|
|
4248
4267
|
.theme-switcher .theme-switcher-buttons .btn-flat span {
|
|
4249
4268
|
font-size: 0.75rem;
|
|
4250
4269
|
font-weight: 500;
|
|
@@ -4271,6 +4290,9 @@ body {
|
|
|
4271
4290
|
.theme-toggle .material-icons {
|
|
4272
4291
|
font-size: 1.25rem;
|
|
4273
4292
|
}
|
|
4293
|
+
.theme-toggle svg {
|
|
4294
|
+
flex-shrink: 0;
|
|
4295
|
+
}
|
|
4274
4296
|
|
|
4275
4297
|
nav .theme-toggle {
|
|
4276
4298
|
background: transparent;
|
package/dist/forms.css
CHANGED
|
@@ -2722,6 +2722,11 @@ input[type=range]::-ms-thumb {
|
|
|
2722
2722
|
.theme-switcher .theme-switcher-buttons .btn-flat .material-icons {
|
|
2723
2723
|
font-size: 1rem;
|
|
2724
2724
|
}
|
|
2725
|
+
.theme-switcher .theme-switcher-buttons .btn-flat svg {
|
|
2726
|
+
width: 1rem !important;
|
|
2727
|
+
height: 1rem !important;
|
|
2728
|
+
flex-shrink: 0;
|
|
2729
|
+
}
|
|
2725
2730
|
.theme-switcher .theme-switcher-buttons .btn-flat span {
|
|
2726
2731
|
font-size: 0.75rem;
|
|
2727
2732
|
font-weight: 500;
|
|
@@ -2748,6 +2753,9 @@ input[type=range]::-ms-thumb {
|
|
|
2748
2753
|
.theme-toggle .material-icons {
|
|
2749
2754
|
font-size: 1.25rem;
|
|
2750
2755
|
}
|
|
2756
|
+
.theme-toggle svg {
|
|
2757
|
+
flex-shrink: 0;
|
|
2758
|
+
}
|
|
2751
2759
|
|
|
2752
2760
|
nav .theme-toggle {
|
|
2753
2761
|
background: transparent;
|
package/dist/index.css
CHANGED
|
@@ -5234,6 +5234,20 @@ button.btn-floating {
|
|
|
5234
5234
|
display: block;
|
|
5235
5235
|
}
|
|
5236
5236
|
|
|
5237
|
+
.btn-flat.btn-icon {
|
|
5238
|
+
min-width: auto;
|
|
5239
|
+
padding: 0 8px;
|
|
5240
|
+
width: auto;
|
|
5241
|
+
line-height: 36px;
|
|
5242
|
+
background-color: transparent !important;
|
|
5243
|
+
}
|
|
5244
|
+
.btn-flat.btn-icon i {
|
|
5245
|
+
margin: 0;
|
|
5246
|
+
}
|
|
5247
|
+
.btn-flat.btn-icon:hover, .btn-flat.btn-icon:focus, .btn-flat.btn-icon:active, .btn-flat.btn-icon.active {
|
|
5248
|
+
background-color: transparent !important;
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5237
5251
|
.dropdown-content:focus {
|
|
5238
5252
|
outline: 0;
|
|
5239
5253
|
}
|
|
@@ -9060,6 +9074,11 @@ input[type=range]::-ms-thumb {
|
|
|
9060
9074
|
.theme-switcher .theme-switcher-buttons .btn-flat .material-icons {
|
|
9061
9075
|
font-size: 1rem;
|
|
9062
9076
|
}
|
|
9077
|
+
.theme-switcher .theme-switcher-buttons .btn-flat svg {
|
|
9078
|
+
width: 1rem !important;
|
|
9079
|
+
height: 1rem !important;
|
|
9080
|
+
flex-shrink: 0;
|
|
9081
|
+
}
|
|
9063
9082
|
.theme-switcher .theme-switcher-buttons .btn-flat span {
|
|
9064
9083
|
font-size: 0.75rem;
|
|
9065
9084
|
font-weight: 500;
|
|
@@ -9086,6 +9105,9 @@ input[type=range]::-ms-thumb {
|
|
|
9086
9105
|
.theme-toggle .material-icons {
|
|
9087
9106
|
font-size: 1.25rem;
|
|
9088
9107
|
}
|
|
9108
|
+
.theme-toggle svg {
|
|
9109
|
+
flex-shrink: 0;
|
|
9110
|
+
}
|
|
9089
9111
|
|
|
9090
9112
|
nav .theme-toggle {
|
|
9091
9113
|
background: transparent;
|
package/dist/index.esm.js
CHANGED
|
@@ -432,6 +432,103 @@ const Icon = () => ({
|
|
|
432
432
|
},
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
+
/*!
|
|
436
|
+
* Waves Effect for Mithril Materialized
|
|
437
|
+
* Based on Waves v0.6.4 by Alfiana E. Sibuea
|
|
438
|
+
* Adapted for TypeScript and Mithril integration
|
|
439
|
+
*/
|
|
440
|
+
class WavesEffect {
|
|
441
|
+
static offset(elem) {
|
|
442
|
+
const rect = elem.getBoundingClientRect();
|
|
443
|
+
return {
|
|
444
|
+
top: rect.top + window.pageYOffset,
|
|
445
|
+
left: rect.left + window.pageXOffset
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
static createRipple(e, element) {
|
|
449
|
+
// Disable right click
|
|
450
|
+
if (e.button === 2) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
// Create ripple element
|
|
454
|
+
const ripple = document.createElement('div');
|
|
455
|
+
ripple.className = 'waves-ripple';
|
|
456
|
+
// Get click position relative to element
|
|
457
|
+
const pos = this.offset(element);
|
|
458
|
+
const relativeY = e.pageY - pos.top;
|
|
459
|
+
const relativeX = e.pageX - pos.left;
|
|
460
|
+
// Calculate scale based on element size
|
|
461
|
+
const scale = (element.clientWidth / 100) * 10;
|
|
462
|
+
// Set initial ripple position and style
|
|
463
|
+
ripple.style.cssText = `
|
|
464
|
+
top: ${relativeY}px;
|
|
465
|
+
left: ${relativeX}px;
|
|
466
|
+
transform: scale(0);
|
|
467
|
+
opacity: 1;
|
|
468
|
+
`;
|
|
469
|
+
// Add ripple to element
|
|
470
|
+
element.appendChild(ripple);
|
|
471
|
+
// Force reflow and animate
|
|
472
|
+
ripple.offsetHeight;
|
|
473
|
+
ripple.style.transform = `scale(${scale})`;
|
|
474
|
+
ripple.style.opacity = '1';
|
|
475
|
+
// Store reference for cleanup
|
|
476
|
+
ripple.setAttribute('data-created', Date.now().toString());
|
|
477
|
+
}
|
|
478
|
+
static removeRipples(element) {
|
|
479
|
+
const ripples = element.querySelectorAll('.waves-ripple');
|
|
480
|
+
ripples.forEach((ripple) => {
|
|
481
|
+
const created = parseInt(ripple.getAttribute('data-created') || '0');
|
|
482
|
+
const age = Date.now() - created;
|
|
483
|
+
const fadeOut = () => {
|
|
484
|
+
ripple.style.opacity = '0';
|
|
485
|
+
setTimeout(() => {
|
|
486
|
+
if (ripple.parentNode) {
|
|
487
|
+
ripple.parentNode.removeChild(ripple);
|
|
488
|
+
}
|
|
489
|
+
}, this.duration);
|
|
490
|
+
};
|
|
491
|
+
if (age >= 350) {
|
|
492
|
+
fadeOut();
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
setTimeout(fadeOut, 350 - age);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
WavesEffect.duration = 750;
|
|
501
|
+
WavesEffect.onMouseDown = (e) => {
|
|
502
|
+
const element = e.currentTarget;
|
|
503
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
504
|
+
WavesEffect.createRipple(e, element);
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
WavesEffect.onMouseUp = (e) => {
|
|
508
|
+
const element = e.currentTarget;
|
|
509
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
510
|
+
WavesEffect.removeRipples(element);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
WavesEffect.onMouseLeave = (e) => {
|
|
514
|
+
const element = e.currentTarget;
|
|
515
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
516
|
+
WavesEffect.removeRipples(element);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
WavesEffect.onTouchStart = (e) => {
|
|
520
|
+
const element = e.currentTarget;
|
|
521
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
522
|
+
WavesEffect.createRipple(e, element);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
WavesEffect.onTouchEnd = (e) => {
|
|
526
|
+
const element = e.currentTarget;
|
|
527
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
528
|
+
WavesEffect.removeRipples(element);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
|
|
435
532
|
/**
|
|
436
533
|
* A factory to create new buttons.
|
|
437
534
|
*
|
|
@@ -445,13 +542,18 @@ const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
|
445
542
|
iconName, iconClass, label, className, variant } = attrs, params = __rest(attrs, ["tooltip", "tooltipPosition", "tooltipPostion", "iconName", "iconClass", "label", "className", "variant"]);
|
|
446
543
|
// Use variant or fallback to factory type
|
|
447
544
|
const buttonType = variant || type || 'button';
|
|
448
|
-
const cn = [tooltip ? 'tooltipped' : '', defaultClassNames, className]
|
|
449
|
-
.filter(Boolean)
|
|
450
|
-
.join(' ')
|
|
451
|
-
.trim();
|
|
545
|
+
const cn = [tooltip ? 'tooltipped' : '', defaultClassNames, className].filter(Boolean).join(' ').trim();
|
|
452
546
|
// Use tooltipPosition if available, fallback to legacy tooltipPostion
|
|
453
547
|
const position = tooltipPosition || tooltipPostion || 'top';
|
|
454
|
-
|
|
548
|
+
// Add waves effect event handlers if waves-effect class is present
|
|
549
|
+
const wavesHandlers = cn.includes('waves-effect') ? {
|
|
550
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
551
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
552
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
553
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
554
|
+
ontouchend: WavesEffect.onTouchEnd
|
|
555
|
+
} : {};
|
|
556
|
+
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);
|
|
455
557
|
},
|
|
456
558
|
};
|
|
457
559
|
};
|
|
@@ -460,6 +562,7 @@ const Button = ButtonFactory('a', 'waves-effect waves-light btn', 'button');
|
|
|
460
562
|
const LargeButton = ButtonFactory('a', 'waves-effect waves-light btn-large', 'button');
|
|
461
563
|
const SmallButton = ButtonFactory('a', 'waves-effect waves-light btn-small', 'button');
|
|
462
564
|
const FlatButton = ButtonFactory('a', 'waves-effect waves-teal btn-flat', 'button');
|
|
565
|
+
const IconButton = ButtonFactory('button', 'btn-flat btn-icon waves-effect waves-teal', 'button');
|
|
463
566
|
const RoundIconButton = ButtonFactory('button', 'btn-floating btn-large waves-effect waves-light', 'button');
|
|
464
567
|
const SubmitButton = ButtonFactory('button', 'btn waves-effect waves-light', 'submit');
|
|
465
568
|
|
|
@@ -896,7 +999,7 @@ const MaterialIcon = () => {
|
|
|
896
999
|
};
|
|
897
1000
|
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
898
1001
|
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
899
|
-
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '
|
|
1002
|
+
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', {
|
|
900
1003
|
d,
|
|
901
1004
|
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
902
1005
|
})));
|
|
@@ -4344,12 +4447,17 @@ const FloatingActionButton = () => {
|
|
|
4344
4447
|
}
|
|
4345
4448
|
: undefined,
|
|
4346
4449
|
}, [
|
|
4347
|
-
m('a.btn-floating.btn-large', {
|
|
4450
|
+
m('a.btn-floating.btn-large.waves-effect.waves-light', {
|
|
4348
4451
|
className,
|
|
4452
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
4453
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
4454
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
4455
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
4456
|
+
ontouchend: WavesEffect.onTouchEnd,
|
|
4349
4457
|
}, m('i.material-icons', { className: iconClass }, iconName)),
|
|
4350
4458
|
buttons &&
|
|
4351
4459
|
buttons.length > 0 &&
|
|
4352
|
-
m('ul', buttons.map((button, index) => m('li', m(`a.btn-floating.${button.className || 'red'}`, {
|
|
4460
|
+
m('ul', buttons.map((button, index) => m('li', m(`a.btn-floating.waves-effect.waves-light.${button.className || 'red'}`, {
|
|
4353
4461
|
style: {
|
|
4354
4462
|
opacity: state.isOpen ? '1' : '0',
|
|
4355
4463
|
transform: state.isOpen ? 'scale(1)' : 'scale(0.4)',
|
|
@@ -4360,6 +4468,11 @@ const FloatingActionButton = () => {
|
|
|
4360
4468
|
if (button.onclick)
|
|
4361
4469
|
button.onclick(e);
|
|
4362
4470
|
},
|
|
4471
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
4472
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
4473
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
4474
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
4475
|
+
ontouchend: WavesEffect.onTouchEnd,
|
|
4363
4476
|
}, m('i.material-icons', { className: button.iconClass }, button.iconName))))),
|
|
4364
4477
|
]));
|
|
4365
4478
|
},
|
|
@@ -8988,4 +9101,4 @@ const isValidationError = (result) => !isValidationSuccess(result);
|
|
|
8988
9101
|
// ============================================================================
|
|
8989
9102
|
// All types are already exported via individual export declarations above
|
|
8990
9103
|
|
|
8991
|
-
export { AnchorItem, Autocomplete, Breadcrumb, BreadcrumbManager, Button, ButtonFactory, Carousel, CharacterCounter, Chips, CodeBlock, Collapsible, CollapsibleItem, Collection, CollectionMode, ColorInput, DataTable, DatePicker, DoubleRangeSlider, Dropdown, EmailInput, FileInput, FileUpload, FlatButton, FloatingActionButton, HelperText, Icon, ImageList, InputCheckbox, Label, LargeButton, 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, Timeline, Toast, ToastComponent, Tooltip, TooltipComponent, TreeView, UrlInput, Wizard, createBreadcrumb, getDropdownStyles, initPushpins, initTooltips, isNumeric, isValidationError, isValidationSuccess, padLeft, range, toast, uniqueId, uuid4 };
|
|
9104
|
+
export { AnchorItem, Autocomplete, Breadcrumb, BreadcrumbManager, Button, ButtonFactory, Carousel, CharacterCounter, Chips, CodeBlock, Collapsible, CollapsibleItem, Collection, CollectionMode, ColorInput, DataTable, DatePicker, DoubleRangeSlider, Dropdown, EmailInput, FileInput, FileUpload, FlatButton, FloatingActionButton, HelperText, Icon, IconButton, ImageList, InputCheckbox, Label, LargeButton, 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, Timeline, Toast, ToastComponent, Tooltip, TooltipComponent, TreeView, UrlInput, Wizard, createBreadcrumb, getDropdownStyles, initPushpins, initTooltips, isNumeric, isValidationError, isValidationSuccess, padLeft, range, toast, uniqueId, uuid4 };
|
package/dist/index.js
CHANGED
|
@@ -434,6 +434,103 @@ const Icon = () => ({
|
|
|
434
434
|
},
|
|
435
435
|
});
|
|
436
436
|
|
|
437
|
+
/*!
|
|
438
|
+
* Waves Effect for Mithril Materialized
|
|
439
|
+
* Based on Waves v0.6.4 by Alfiana E. Sibuea
|
|
440
|
+
* Adapted for TypeScript and Mithril integration
|
|
441
|
+
*/
|
|
442
|
+
class WavesEffect {
|
|
443
|
+
static offset(elem) {
|
|
444
|
+
const rect = elem.getBoundingClientRect();
|
|
445
|
+
return {
|
|
446
|
+
top: rect.top + window.pageYOffset,
|
|
447
|
+
left: rect.left + window.pageXOffset
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
static createRipple(e, element) {
|
|
451
|
+
// Disable right click
|
|
452
|
+
if (e.button === 2) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
// Create ripple element
|
|
456
|
+
const ripple = document.createElement('div');
|
|
457
|
+
ripple.className = 'waves-ripple';
|
|
458
|
+
// Get click position relative to element
|
|
459
|
+
const pos = this.offset(element);
|
|
460
|
+
const relativeY = e.pageY - pos.top;
|
|
461
|
+
const relativeX = e.pageX - pos.left;
|
|
462
|
+
// Calculate scale based on element size
|
|
463
|
+
const scale = (element.clientWidth / 100) * 10;
|
|
464
|
+
// Set initial ripple position and style
|
|
465
|
+
ripple.style.cssText = `
|
|
466
|
+
top: ${relativeY}px;
|
|
467
|
+
left: ${relativeX}px;
|
|
468
|
+
transform: scale(0);
|
|
469
|
+
opacity: 1;
|
|
470
|
+
`;
|
|
471
|
+
// Add ripple to element
|
|
472
|
+
element.appendChild(ripple);
|
|
473
|
+
// Force reflow and animate
|
|
474
|
+
ripple.offsetHeight;
|
|
475
|
+
ripple.style.transform = `scale(${scale})`;
|
|
476
|
+
ripple.style.opacity = '1';
|
|
477
|
+
// Store reference for cleanup
|
|
478
|
+
ripple.setAttribute('data-created', Date.now().toString());
|
|
479
|
+
}
|
|
480
|
+
static removeRipples(element) {
|
|
481
|
+
const ripples = element.querySelectorAll('.waves-ripple');
|
|
482
|
+
ripples.forEach((ripple) => {
|
|
483
|
+
const created = parseInt(ripple.getAttribute('data-created') || '0');
|
|
484
|
+
const age = Date.now() - created;
|
|
485
|
+
const fadeOut = () => {
|
|
486
|
+
ripple.style.opacity = '0';
|
|
487
|
+
setTimeout(() => {
|
|
488
|
+
if (ripple.parentNode) {
|
|
489
|
+
ripple.parentNode.removeChild(ripple);
|
|
490
|
+
}
|
|
491
|
+
}, this.duration);
|
|
492
|
+
};
|
|
493
|
+
if (age >= 350) {
|
|
494
|
+
fadeOut();
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
setTimeout(fadeOut, 350 - age);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
WavesEffect.duration = 750;
|
|
503
|
+
WavesEffect.onMouseDown = (e) => {
|
|
504
|
+
const element = e.currentTarget;
|
|
505
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
506
|
+
WavesEffect.createRipple(e, element);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
WavesEffect.onMouseUp = (e) => {
|
|
510
|
+
const element = e.currentTarget;
|
|
511
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
512
|
+
WavesEffect.removeRipples(element);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
WavesEffect.onMouseLeave = (e) => {
|
|
516
|
+
const element = e.currentTarget;
|
|
517
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
518
|
+
WavesEffect.removeRipples(element);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
WavesEffect.onTouchStart = (e) => {
|
|
522
|
+
const element = e.currentTarget;
|
|
523
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
524
|
+
WavesEffect.createRipple(e, element);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
WavesEffect.onTouchEnd = (e) => {
|
|
528
|
+
const element = e.currentTarget;
|
|
529
|
+
if (element && element.classList.contains('waves-effect')) {
|
|
530
|
+
WavesEffect.removeRipples(element);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
|
|
437
534
|
/**
|
|
438
535
|
* A factory to create new buttons.
|
|
439
536
|
*
|
|
@@ -447,13 +544,18 @@ const ButtonFactory = (element, defaultClassNames, type = '') => {
|
|
|
447
544
|
iconName, iconClass, label, className, variant } = attrs, params = __rest(attrs, ["tooltip", "tooltipPosition", "tooltipPostion", "iconName", "iconClass", "label", "className", "variant"]);
|
|
448
545
|
// Use variant or fallback to factory type
|
|
449
546
|
const buttonType = variant || type || 'button';
|
|
450
|
-
const cn = [tooltip ? 'tooltipped' : '', defaultClassNames, className]
|
|
451
|
-
.filter(Boolean)
|
|
452
|
-
.join(' ')
|
|
453
|
-
.trim();
|
|
547
|
+
const cn = [tooltip ? 'tooltipped' : '', defaultClassNames, className].filter(Boolean).join(' ').trim();
|
|
454
548
|
// Use tooltipPosition if available, fallback to legacy tooltipPostion
|
|
455
549
|
const position = tooltipPosition || tooltipPostion || 'top';
|
|
456
|
-
|
|
550
|
+
// Add waves effect event handlers if waves-effect class is present
|
|
551
|
+
const wavesHandlers = cn.includes('waves-effect') ? {
|
|
552
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
553
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
554
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
555
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
556
|
+
ontouchend: WavesEffect.onTouchEnd
|
|
557
|
+
} : {};
|
|
558
|
+
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);
|
|
457
559
|
},
|
|
458
560
|
};
|
|
459
561
|
};
|
|
@@ -462,6 +564,7 @@ const Button = ButtonFactory('a', 'waves-effect waves-light btn', 'button');
|
|
|
462
564
|
const LargeButton = ButtonFactory('a', 'waves-effect waves-light btn-large', 'button');
|
|
463
565
|
const SmallButton = ButtonFactory('a', 'waves-effect waves-light btn-small', 'button');
|
|
464
566
|
const FlatButton = ButtonFactory('a', 'waves-effect waves-teal btn-flat', 'button');
|
|
567
|
+
const IconButton = ButtonFactory('button', 'btn-flat btn-icon waves-effect waves-teal', 'button');
|
|
465
568
|
const RoundIconButton = ButtonFactory('button', 'btn-floating btn-large waves-effect waves-light', 'button');
|
|
466
569
|
const SubmitButton = ButtonFactory('button', 'btn waves-effect waves-light', 'submit');
|
|
467
570
|
|
|
@@ -898,7 +1001,7 @@ const MaterialIcon = () => {
|
|
|
898
1001
|
};
|
|
899
1002
|
const rotation = (_a = rotationMap[direction]) !== null && _a !== void 0 ? _a : 0;
|
|
900
1003
|
const transform = rotation ? `rotate(${rotation}deg)` : undefined;
|
|
901
|
-
return m('svg', Object.assign(Object.assign({}, props), { style: Object.assign({ transform }, style), height: '
|
|
1004
|
+
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', {
|
|
902
1005
|
d,
|
|
903
1006
|
fill: d.includes('M0 0h24v24H0z') ? 'none' : 'currentColor',
|
|
904
1007
|
})));
|
|
@@ -4346,12 +4449,17 @@ const FloatingActionButton = () => {
|
|
|
4346
4449
|
}
|
|
4347
4450
|
: undefined,
|
|
4348
4451
|
}, [
|
|
4349
|
-
m('a.btn-floating.btn-large', {
|
|
4452
|
+
m('a.btn-floating.btn-large.waves-effect.waves-light', {
|
|
4350
4453
|
className,
|
|
4454
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
4455
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
4456
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
4457
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
4458
|
+
ontouchend: WavesEffect.onTouchEnd,
|
|
4351
4459
|
}, m('i.material-icons', { className: iconClass }, iconName)),
|
|
4352
4460
|
buttons &&
|
|
4353
4461
|
buttons.length > 0 &&
|
|
4354
|
-
m('ul', buttons.map((button, index) => m('li', m(`a.btn-floating.${button.className || 'red'}`, {
|
|
4462
|
+
m('ul', buttons.map((button, index) => m('li', m(`a.btn-floating.waves-effect.waves-light.${button.className || 'red'}`, {
|
|
4355
4463
|
style: {
|
|
4356
4464
|
opacity: state.isOpen ? '1' : '0',
|
|
4357
4465
|
transform: state.isOpen ? 'scale(1)' : 'scale(0.4)',
|
|
@@ -4362,6 +4470,11 @@ const FloatingActionButton = () => {
|
|
|
4362
4470
|
if (button.onclick)
|
|
4363
4471
|
button.onclick(e);
|
|
4364
4472
|
},
|
|
4473
|
+
onmousedown: WavesEffect.onMouseDown,
|
|
4474
|
+
onmouseup: WavesEffect.onMouseUp,
|
|
4475
|
+
onmouseleave: WavesEffect.onMouseLeave,
|
|
4476
|
+
ontouchstart: WavesEffect.onTouchStart,
|
|
4477
|
+
ontouchend: WavesEffect.onTouchEnd,
|
|
4365
4478
|
}, m('i.material-icons', { className: button.iconClass }, button.iconName))))),
|
|
4366
4479
|
]));
|
|
4367
4480
|
},
|
|
@@ -9015,6 +9128,7 @@ exports.FlatButton = FlatButton;
|
|
|
9015
9128
|
exports.FloatingActionButton = FloatingActionButton;
|
|
9016
9129
|
exports.HelperText = HelperText;
|
|
9017
9130
|
exports.Icon = Icon;
|
|
9131
|
+
exports.IconButton = IconButton;
|
|
9018
9132
|
exports.ImageList = ImageList;
|
|
9019
9133
|
exports.InputCheckbox = InputCheckbox;
|
|
9020
9134
|
exports.Label = Label;
|