mithril-materialized 3.2.2 → 3.3.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Mithril.js component library inspired by [materialize-css](https://materializecss.com) design principles, [available on npm](https://www.npmjs.com/package/mithril-materialized). This library provides you with ready-to-use Mithril components that follow Material Design guidelines, with **no external JavaScript dependencies**.
4
4
 
5
- ## 🚀 v3.0.0 - Latest Release
5
+ ## 🚀 v3.2.2 - Latest Release
6
6
 
7
7
  The current stable release that provides a complete Mithril.js Material Design component library with no external JavaScript dependencies.
8
8
 
@@ -10,11 +10,12 @@ The current stable release that provides a complete Mithril.js Material Design c
10
10
 
11
11
  - **🔥 Zero External JS Dependencies**: No longer requires `materialize-css` JavaScript or `material-icons` fonts
12
12
  - **📦 Smaller Bundle Size**: Reduced package size by eliminating external dependencies
13
- - **🎨 Custom SVG Icons**: Built-in MaterialIcon component with custom SVG icons (caret, close)
14
13
  - **⚡ Better Performance**: Direct implementations without jQuery or other heavy dependencies
15
- - **🛠️ Enhanced Components**: Improved DatePicker and TimePicker with custom implementations
14
+ - **🛠️ Enhanced Components**: Improved DatePicker with date ranges, week numbers, and TimePicker with configurable AM/PM/24h or inline style
15
+ - **🛠️ New Components**: DataTable, TreeView, Timeline, Masonry, RatingControl, ImageList, Wizard/Stepper, Breadcrumb
16
16
  - **📱 Modern Architecture**: Factory components with proper TypeScript support
17
17
  - **🎯 CSS-Only Styling**: Uses only CSS for styling - no JavaScript initialization needed
18
+ - **🎨 Custom SVG Icons**: Built-in MaterialIcon component with custom SVG icons (caret, close)
18
19
 
19
20
  ### ✨ Key Features
20
21
 
@@ -23,9 +24,9 @@ The current stable release that provides a complete Mithril.js Material Design c
23
24
  - **🎨 Custom SVG Icons**: Built-in MaterialIcon component with custom SVG icons
24
25
  - **⚡ Better Performance**: Direct implementations without jQuery or other heavy dependencies
25
26
  - **🛠️ Enhanced Components**: Comprehensive component library with modern features
26
- - **📱 Modern Architecture**: Factory components with proper TypeScript support
27
- - **🎯 CSS-Only Styling**: Uses only CSS for styling - no JavaScript initialization needed
28
27
  - **🌗 Dark Theme Support**: Built-in light/dark theme system with CSS custom properties
28
+ - **📱 Modern Architecture**: Factory components with proper TypeScript support, and clear separation between [controlled and uncontrolled](CONTROLLED_COMPONENTS.md) component state
29
+ - **🎯 CSS-Only Styling**: Uses only CSS for styling - no JavaScript initialization needed
29
30
 
30
31
  ### 📦 Installation
31
32
 
@@ -35,6 +36,8 @@ npm install mithril mithril-materialized
35
36
 
36
37
  ## Supported Components
37
38
 
39
+ Components marked with an * are not included in the original materialize-css library.
40
+
38
41
  - [Buttons](https://erikvullings.github.io/mithril-materialized/#!/buttons)
39
42
  - Button
40
43
  - FlatButton
@@ -48,13 +51,14 @@ npm install mithril mithril-materialized
48
51
  - EmailInput
49
52
  - NumberInput
50
53
  - ColorInput
51
- - RangeInput (with vertical, double-thumb support, and smart tooltip display)
54
+ - RangeInput* (with vertical, double-thumb support, and smart tooltip display)
52
55
  - Chips
53
56
  - [Pickers](https://erikvullings.github.io/mithril-materialized/#!/pickers)
54
- - DatePicker (with optional week numbers and date range selection)
55
- - TimePicker
57
+ - DatePicker (with optional week numbers and date range selection)*
58
+ - TimePicker (with inline mode and switchable AM/PM/24h)*
56
59
  - [Selections](https://erikvullings.github.io/mithril-materialized/#!/selections)
57
60
  - Select
61
+ - SearchSelect*, a searchable select dropdown
58
62
  - Options
59
63
  - RadioButtons
60
64
  - Switch
@@ -63,32 +67,33 @@ npm install mithril mithril-materialized
63
67
  - Basic, Link and Avatar Collections
64
68
  - Collapsible or accordion
65
69
  - [Theme & Upload](https://erikvullings.github.io/mithril-materialized/#!/theme)
66
- - ThemeSwitcher (light/dark/auto theme switching)
67
- - ThemeToggle (simple light/dark toggle)
68
- - FileUpload (drag-and-drop with validation and preview)
70
+ - ThemeSwitcher* (light/dark/auto theme switching)
71
+ - ThemeToggle* (simple light/dark toggle)
72
+ - FileUpload* (drag-and-drop with validation and preview)
69
73
  - [Navigation](https://erikvullings.github.io/mithril-materialized/#!/navigation)
70
74
  - Sidenav (responsive navigation drawer)
71
- - Breadcrumb (navigation path indicator)
72
- - Wizard/Stepper (multi-step process guidance)
75
+ - Breadcrumb* (navigation path indicator)
76
+ - Wizard/Stepper* (multi-step process guidance)
73
77
  - [Others](https://erikvullings.github.io/mithril-materialized/#!/modals)
74
78
  - ModalPanel
75
79
  - MaterialBox
76
80
  - Carousel
77
81
  - Pagination
78
- - PaginationControls
82
+ - PaginationControls*
79
83
  - Parallax
80
- - [Layout & Display](https://erikvullings.github.io/mithril-materialized/#!/layout)
81
- - Masonry (Pinterest-style responsive grid layout)
82
- - ImageList (responsive image galleries with various layouts)
83
- - Timeline (vertical timeline with events and milestones)
84
- - Data & Tables
85
- - DataTable (sorting, filtering, pagination, selection)
86
- - TreeView (hierarchical data with expand/collapse, selection, and customizable icons)
84
+ - Layout & Display
85
+ - [Masonry](https://erikvullings.github.io/mithril-materialized/#!/masonry)* (Pinterest-style responsive grid layout)
86
+ - [ImageList](https://erikvullings.github.io/mithril-materialized/#!/image-list)* (responsive image galleries with various layouts)
87
+ - [Timeline](https://erikvullings.github.io/mithril-materialized/#!/timeline)* (vertical timeline with events and milestones)
88
+ - [Rating](https://erikvullings.github.io/mithril-materialized/#!/rating)*
89
+ - RatingControl (Horizontal control, configurable range and step size, optionally with custom icons)
90
+ - [Data & Tables](https://erikvullings.github.io/mithril-materialized/#!/datatable)
91
+ - DataTable* (sorting, filtering, pagination, selection)
92
+ - TreeView* (hierarchical data with expand/collapse, selection, and customizable icons)
87
93
  - Additional
88
94
  - Label
89
95
  - HelperText
90
96
  - CodeBlock
91
- - SearchSelect, a searchable select dropdown
92
97
  - Icon, a simple wrapper for creating icons using material-icons font
93
98
  - MaterialIcon, for creating the close/clear and caret as SVG
94
99
 
@@ -308,8 +313,11 @@ See the [live documentation](https://erikvullings.github.io/mithril-materialized
308
313
  - ✅ Breadcrumb navigation component
309
314
  - ✅ Wizard/Stepper component for multi-step forms
310
315
 
311
- **✅ Recently Completed:**
316
+ **✅ Recently Completed (v3.2.x):**
312
317
 
318
+ - ✅ **TextArea Height Alignment**: Fixed single-line `textarea` height to match TextInput components perfectly
319
+ - ✅ **Improved AutoResize Logic**: TextArea now only sets custom height for multi-line content, matching Materialize CSS reference behavior
320
+ - ✅ **Better Mithril Integration**: Hidden div for height measurement now properly managed within Mithril's render cycle
313
321
  - ✅ DataTable component with sorting, filtering, and pagination
314
322
  - ✅ TreeView component for hierarchical data with expand/collapse, selection, and VSCode-style connectors
315
323
  - ✅ Enhanced TypeScript definitions with better JSDoc comments
@@ -317,6 +325,7 @@ See the [live documentation](https://erikvullings.github.io/mithril-materialized
317
325
  - ✅ Enhanced RangeInput with vertical orientation, double-thumb range selection, and smart tooltip display
318
326
  - ✅ Advanced DatePicker with date range selection, constraints, and format support
319
327
  - ✅ Layout components: Masonry (Pinterest-style grid), Timeline (vertical event display), ImageList (responsive galleries)
328
+ - ✅ RatingControl with configurable icons, min/max, tooltip/helpers, readonly and disabled mode
320
329
  - ✅ Improved RangeInput components converted to proper Mithril components with better lifecycle management
321
330
  - ✅ Enhanced accessibility with individual thumb slider elements and PageUp/PageDown keyboard support
322
331
 
@@ -357,10 +366,11 @@ See the [live documentation](https://erikvullings.github.io/mithril-materialized
357
366
 
358
367
  ### 📊 Bundle Size Targets
359
368
 
360
- **Current Status (v3.0.0):**
369
+ **Current Status (v3.2.2):**
361
370
 
362
- - Total: 70KB gzipped (44KB JS + 26KB CSS)
371
+ - Total: ~65KB gzipped (42KB JS + 23KB CSS)
363
372
  - Modular CSS can reduce bundle by 30-50%
373
+ - Optimized component implementations reduce overhead
364
374
 
365
375
  **Phase 1 Targets:**
366
376
 
@@ -388,7 +398,7 @@ See our [contributing guide](CONTRIBUTING.md) for detailed information.
388
398
 
389
399
  **Bundle Size Comparison:**
390
400
 
391
- - mithril-materialized v3.0: 64KB gzipped
401
+ - mithril-materialized v3.2.2: ~65KB gzipped
392
402
  - Material-UI: ~350KB gzipped
393
403
  - Materialize CSS + jQuery: ~180KB gzipped
394
404
  - Vuetify: ~250KB gzipped
@@ -398,6 +408,7 @@ See our [contributing guide](CONTRIBUTING.md) for detailed information.
398
408
  - Component initialization: <5ms average
399
409
  - Theme switching: <10ms for full page
400
410
  - File upload processing: Real-time without blocking
411
+ - TextArea auto-resize: <1ms per keystroke
401
412
 
402
413
  ## Build instructions
403
414
 
@@ -583,5 +594,4 @@ input[type='color']:not(.browser-default) {
583
594
  .codeblock > label {
584
595
  display: inline-block;
585
596
  }
586
-
587
597
  ```
package/dist/advanced.css CHANGED
@@ -430,7 +430,7 @@ table.striped tr {
430
430
  border-bottom: none;
431
431
  }
432
432
  table.striped > tbody > tr:nth-child(odd) {
433
- background-color: rgba(242, 242, 242, 0.5);
433
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
434
434
  }
435
435
  table.striped > tbody > tr > td {
436
436
  border-radius: 0;
@@ -439,7 +439,7 @@ table.highlight > tbody > tr {
439
439
  transition: background-color 0.25s ease;
440
440
  }
441
441
  table.highlight > tbody > tr:hover {
442
- background-color: rgba(242, 242, 242, 0.5);
442
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
443
443
  }
444
444
  table.centered thead tr th, table.centered tbody tr td {
445
445
  text-align: center;
@@ -353,7 +353,7 @@ table.striped tr {
353
353
  border-bottom: none;
354
354
  }
355
355
  table.striped > tbody > tr:nth-child(odd) {
356
- background-color: rgba(242, 242, 242, 0.5);
356
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
357
357
  }
358
358
  table.striped > tbody > tr > td {
359
359
  border-radius: 0;
@@ -362,7 +362,7 @@ table.highlight > tbody > tr {
362
362
  transition: background-color 0.25s ease;
363
363
  }
364
364
  table.highlight > tbody > tr:hover {
365
- background-color: rgba(242, 242, 242, 0.5);
365
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
366
366
  }
367
367
  table.centered thead tr th, table.centered tbody tr td {
368
368
  text-align: center;
@@ -2601,7 +2601,7 @@ body.keyboard-focused .dropdown-content li:focus {
2601
2601
  }
2602
2602
  :root:not([data-theme]) .datatable-container .datatable.striped tbody tr:nth-child(odd),
2603
2603
  [data-theme=dark] .datatable-container .datatable.striped tbody tr:nth-child(odd) {
2604
- background-color: rgba(255, 255, 255, 0.05);
2604
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
2605
2605
  }
2606
2606
  :root:not([data-theme]) .datatable-container .datatable.fixed-header thead th,
2607
2607
  [data-theme=dark] .datatable-container .datatable.fixed-header thead th {
@@ -2949,6 +2949,7 @@ body.dark {
2949
2949
  --mm-switch-unchecked-thumb: #f5f5f5;
2950
2950
  --mm-switch-disabled-track: rgba(0, 0, 0, 0.12);
2951
2951
  --mm-switch-disabled-thumb: #bdbdbd;
2952
+ --mm-table-striped-color: rgba(0, 0, 0, 0.05);
2952
2953
  }
2953
2954
 
2954
2955
  body {
@@ -3004,6 +3005,7 @@ body {
3004
3005
  --mm-switch-unchecked-thumb: #616161;
3005
3006
  --mm-switch-disabled-track: rgba(255, 255, 255, 0.12);
3006
3007
  --mm-switch-disabled-thumb: #424242;
3008
+ --mm-table-striped-color: rgba(255, 255, 255, 0.05);
3007
3009
  }
3008
3010
 
3009
3011
  @media (prefers-color-scheme: dark) {
@@ -3045,6 +3047,7 @@ body {
3045
3047
  --mm-switch-unchecked-thumb: #616161;
3046
3048
  --mm-switch-disabled-track: rgba(255, 255, 255, 0.12);
3047
3049
  --mm-switch-disabled-thumb: #424242;
3050
+ --mm-table-striped-color: rgba(255, 255, 255, 0.05);
3048
3051
  }
3049
3052
  }
3050
3053
  .timeline {
@@ -3979,3 +3982,238 @@ body {
3979
3982
  color: black;
3980
3983
  }
3981
3984
  }
3985
+ /* Rating Component
3986
+ ========================================================================== */
3987
+ .rating {
3988
+ position: relative;
3989
+ display: inline-flex;
3990
+ align-items: center;
3991
+ outline: none;
3992
+ cursor: pointer;
3993
+ transition: all 0.2s ease;
3994
+ }
3995
+ .rating:focus-visible {
3996
+ outline: 2px solid var(--mm-primary-color, #ee6e73);
3997
+ outline-offset: 2px;
3998
+ border-radius: 4px;
3999
+ }
4000
+ .rating--read-only {
4001
+ cursor: default;
4002
+ }
4003
+ .rating--read-only .rating__item {
4004
+ cursor: default;
4005
+ }
4006
+ .rating--disabled {
4007
+ cursor: not-allowed;
4008
+ opacity: 0.6;
4009
+ }
4010
+ .rating--disabled .rating__item {
4011
+ cursor: not-allowed;
4012
+ }
4013
+ .rating--focused:not(.rating--read-only):not(.rating--disabled) .rating__items {
4014
+ transform: scale(1.05);
4015
+ }
4016
+
4017
+ .rating__items {
4018
+ display: flex !important;
4019
+ flex-direction: row !important;
4020
+ align-items: center;
4021
+ transition: transform 0.15s ease;
4022
+ }
4023
+
4024
+ .rating__item {
4025
+ display: flex;
4026
+ flex-direction: row;
4027
+ align-items: center;
4028
+ }
4029
+ .rating__item > .rating__item {
4030
+ display: flex;
4031
+ }
4032
+ .rating__item:hover:not(.rating__item--disabled) {
4033
+ transform: scale(1.1);
4034
+ }
4035
+ .rating__item--filled .rating__icon--filled {
4036
+ color: var(--mm-primary-color, #ee6e73);
4037
+ }
4038
+ .rating__item--active .rating__icon--filled {
4039
+ color: var(--mm-primary-color, #ee6e73);
4040
+ }
4041
+ .rating__item--preview .rating__icon--filled {
4042
+ color: var(--mm-secondary-color, #26a69a);
4043
+ }
4044
+ .rating__item--half .rating__icon--filled {
4045
+ color: var(--mm-primary-color, #ee6e73);
4046
+ }
4047
+ .rating__item--disabled {
4048
+ cursor: not-allowed;
4049
+ opacity: 0.6;
4050
+ }
4051
+ .rating__item--disabled .rating__icon--empty {
4052
+ color: var(--mm-text-disabled, rgba(0, 0, 0, 0.38));
4053
+ }
4054
+ .rating__item--disabled.rating__item--filled .rating__icon--filled, .rating__item--disabled.rating__item--active .rating__icon--filled {
4055
+ color: var(--mm-primary-color, #ee6e73);
4056
+ opacity: 0.7;
4057
+ }
4058
+
4059
+ .rating__icon {
4060
+ position: relative;
4061
+ display: flex;
4062
+ align-items: center;
4063
+ justify-content: center;
4064
+ transition: color 0.15s ease;
4065
+ line-height: 1;
4066
+ width: 24px;
4067
+ height: 24px;
4068
+ font-size: 24px;
4069
+ }
4070
+ .rating__icon--empty {
4071
+ color: var(--mm-text-hint, #9e9e9e);
4072
+ }
4073
+ .rating__icon--filled {
4074
+ position: absolute;
4075
+ top: 0;
4076
+ width: 100%;
4077
+ height: 100%;
4078
+ display: flex;
4079
+ align-items: center;
4080
+ justify-content: center;
4081
+ color: transparent;
4082
+ overflow: hidden;
4083
+ transition: color 0.15s ease;
4084
+ }
4085
+
4086
+ .rating--small .rating__icon {
4087
+ width: 16px;
4088
+ height: 16px;
4089
+ font-size: 16px;
4090
+ }
4091
+
4092
+ .rating--medium .rating__icon {
4093
+ width: 24px;
4094
+ height: 24px;
4095
+ font-size: 24px;
4096
+ }
4097
+
4098
+ .rating--large .rating__icon {
4099
+ width: 32px;
4100
+ height: 32px;
4101
+ font-size: 32px;
4102
+ }
4103
+
4104
+ .rating--compact .rating__items {
4105
+ gap: 2px;
4106
+ }
4107
+
4108
+ .rating--standard .rating__items {
4109
+ gap: 4px;
4110
+ }
4111
+
4112
+ .rating--comfortable .rating__items {
4113
+ gap: 8px;
4114
+ }
4115
+
4116
+ .rating__tooltip {
4117
+ position: absolute;
4118
+ bottom: calc(100% + 8px);
4119
+ left: 50%;
4120
+ transform: translateX(-50%);
4121
+ padding: 4px 8px;
4122
+ background: rgba(0, 0, 0, 0.8);
4123
+ color: white;
4124
+ font-size: 12px;
4125
+ border-radius: 4px;
4126
+ white-space: nowrap;
4127
+ opacity: 0;
4128
+ pointer-events: none;
4129
+ transition: opacity 0.2s ease;
4130
+ z-index: 1000;
4131
+ }
4132
+ .rating__tooltip::after {
4133
+ content: "";
4134
+ position: absolute;
4135
+ top: 100%;
4136
+ left: 50%;
4137
+ transform: translateX(-50%);
4138
+ border: 4px solid transparent;
4139
+ border-top-color: rgba(0, 0, 0, 0.8);
4140
+ }
4141
+
4142
+ .rating__item:hover .rating__tooltip {
4143
+ opacity: 1;
4144
+ }
4145
+
4146
+ .rating__sr-only {
4147
+ position: absolute;
4148
+ width: 1px;
4149
+ height: 1px;
4150
+ padding: 0;
4151
+ margin: -1px;
4152
+ overflow: hidden;
4153
+ clip: rect(0, 0, 0, 0);
4154
+ white-space: nowrap;
4155
+ border: 0;
4156
+ }
4157
+
4158
+ @media (pointer: coarse) {
4159
+ .rating__item {
4160
+ min-width: 48px;
4161
+ min-height: 48px;
4162
+ }
4163
+ }
4164
+ [dir=rtl] .rating__tooltip::after {
4165
+ transform: translateX(50%);
4166
+ }
4167
+ [dir=rtl] .rating__item--half .rating__icon--filled {
4168
+ clip-path: inset(0 0 0 50%) !important;
4169
+ }
4170
+
4171
+ @media (prefers-contrast: high) {
4172
+ .rating__icon--empty {
4173
+ color: currentColor;
4174
+ }
4175
+ .rating__item--active .rating__icon--filled {
4176
+ color: currentColor;
4177
+ }
4178
+ }
4179
+ [data-theme=dark] .rating__tooltip {
4180
+ background: rgba(255, 255, 255, 0.9);
4181
+ color: rgba(0, 0, 0, 0.87);
4182
+ }
4183
+ [data-theme=dark] .rating__tooltip::after {
4184
+ border-top-color: rgba(255, 255, 255, 0.9);
4185
+ }
4186
+
4187
+ @keyframes rating-fill {
4188
+ 0% {
4189
+ transform: scale(0.8);
4190
+ opacity: 0.5;
4191
+ }
4192
+ 50% {
4193
+ transform: scale(1.2);
4194
+ }
4195
+ 100% {
4196
+ transform: scale(1);
4197
+ opacity: 1;
4198
+ }
4199
+ }
4200
+ .rating__item--filled .rating__icon--filled {
4201
+ animation: rating-fill 0.2s ease-out;
4202
+ }
4203
+
4204
+ @media (prefers-reduced-motion: reduce) {
4205
+ .rating,
4206
+ .rating__item,
4207
+ .rating__icon,
4208
+ .rating__tooltip,
4209
+ .rating__items {
4210
+ transition: none !important;
4211
+ animation: none !important;
4212
+ }
4213
+ .rating__item:hover:not(.rating__item--disabled) {
4214
+ transform: none;
4215
+ }
4216
+ .rating--focused:not(.rating--read-only):not(.rating--disabled) .rating__items {
4217
+ transform: none;
4218
+ }
4219
+ }
package/dist/core.css CHANGED
@@ -750,7 +750,7 @@ table.striped tr {
750
750
  border-bottom: none;
751
751
  }
752
752
  table.striped > tbody > tr:nth-child(odd) {
753
- background-color: rgba(242, 242, 242, 0.5);
753
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
754
754
  }
755
755
  table.striped > tbody > tr > td {
756
756
  border-radius: 0;
@@ -759,7 +759,7 @@ table.highlight > tbody > tr {
759
759
  transition: background-color 0.25s ease;
760
760
  }
761
761
  table.highlight > tbody > tr:hover {
762
- background-color: rgba(242, 242, 242, 0.5);
762
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
763
763
  }
764
764
  table.centered thead tr th, table.centered tbody tr td {
765
765
  text-align: center;
package/dist/forms.css CHANGED
@@ -353,7 +353,7 @@ table.striped tr {
353
353
  border-bottom: none;
354
354
  }
355
355
  table.striped > tbody > tr:nth-child(odd) {
356
- background-color: rgba(242, 242, 242, 0.5);
356
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
357
357
  }
358
358
  table.striped > tbody > tr > td {
359
359
  border-radius: 0;
@@ -362,7 +362,7 @@ table.highlight > tbody > tr {
362
362
  transition: background-color 0.25s ease;
363
363
  }
364
364
  table.highlight > tbody > tr:hover {
365
- background-color: rgba(242, 242, 242, 0.5);
365
+ background-color: var(--mm-table-striped-color, rgba(55, 55, 55, 0.5));
366
366
  }
367
367
  table.centered thead tr th, table.centered tbody tr td {
368
368
  text-align: center;