mithril-materialized 2.0.0-beta.1 → 2.0.0-beta.11
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 +287 -308
- package/dist/advanced.css +1888 -0
- package/dist/autocomplete.d.ts +3 -3
- package/dist/breadcrumb.d.ts +53 -0
- package/dist/button.d.ts +66 -21
- package/dist/carousel.d.ts +2 -2
- package/dist/chip.d.ts +2 -2
- package/dist/code-block.d.ts +2 -2
- package/dist/collapsible.d.ts +2 -2
- package/dist/collection.d.ts +2 -2
- package/dist/components.css +2310 -0
- package/dist/core.css +3402 -0
- package/dist/datatable.d.ts +291 -0
- package/dist/datepicker.d.ts +66 -0
- package/dist/dropdown.d.ts +2 -2
- package/dist/file-upload.d.ts +34 -0
- package/dist/floating-action-button.d.ts +2 -2
- package/dist/forms.css +2284 -0
- package/dist/index.css +1825 -184
- package/dist/index.d.ts +14 -1
- package/dist/index.esm.js +4752 -2143
- package/dist/index.js +4776 -2142
- package/dist/index.min.css +8 -0
- package/dist/index.umd.js +4776 -2142
- package/dist/input-options.d.ts +1 -1
- package/dist/input.d.ts +9 -10
- package/dist/label.d.ts +4 -2
- package/dist/material-box.d.ts +2 -2
- package/dist/modal.d.ts +2 -2
- package/dist/option.d.ts +4 -4
- package/dist/pagination.d.ts +2 -2
- package/dist/parallax.d.ts +2 -2
- package/dist/pickers.css +487 -0
- package/dist/pushpin.d.ts +32 -0
- package/dist/radio.d.ts +4 -4
- package/dist/search-select.d.ts +2 -2
- package/dist/select.d.ts +2 -2
- package/dist/sidenav.d.ts +76 -0
- package/dist/switch.d.ts +2 -2
- package/dist/tabs.d.ts +2 -4
- package/dist/theme-switcher.d.ts +49 -0
- package/dist/timepicker.d.ts +42 -0
- package/dist/toast.d.ts +45 -0
- package/dist/tooltip.d.ts +59 -0
- package/dist/types.d.ts +226 -0
- package/dist/utilities.css +3204 -0
- package/dist/wizard.d.ts +58 -0
- package/package.json +20 -9
- package/sass/components/_breadcrumb.scss +248 -0
- package/sass/components/_buttons.scss +3 -3
- package/sass/components/_cards.scss +10 -3
- package/sass/components/_chips.scss +8 -8
- package/sass/components/_collapsible.scss +8 -8
- package/sass/components/_datatable.scss +417 -0
- package/sass/components/_datepicker.scss +45 -14
- package/sass/components/_dropdown.scss +5 -5
- package/sass/components/_file-upload.scss +228 -0
- package/sass/components/_global.scss +13 -11
- package/sass/components/_modal.scss +5 -2
- package/sass/components/_navbar.scss +13 -5
- package/sass/components/_sidenav.scss +164 -7
- package/sass/components/_tabs.scss +5 -4
- package/sass/components/_theme-switcher.scss +120 -0
- package/sass/components/_theme-variables.scss +205 -0
- package/sass/components/_timepicker.scss +179 -87
- package/sass/components/_wizard.scss +416 -0
- package/sass/components/forms/_input-fields.scss +34 -12
- package/sass/components/forms/_radio-buttons.scss +10 -10
- package/sass/components/forms/_range.scss +5 -5
- package/sass/components/forms/_select.scss +9 -9
- package/sass/components/forms/_switches.scss +6 -6
- package/sass/materialize.scss +8 -0
- package/dist/pickers.d.ts +0 -130
package/README.md
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
1
|
# mithril-materialized
|
|
2
2
|
|
|
3
|
-
A [materialize-css](https://materializecss.com)
|
|
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
|
-
|
|
5
|
+
## 🚀 v2.0.0 Beta - Major Release
|
|
6
|
+
|
|
7
|
+
This is a **major breaking release** that removes all external JavaScript dependencies, making the library completely self-contained and significantly reducing bundle sizes.
|
|
8
|
+
|
|
9
|
+
### ✨ What's New
|
|
10
|
+
|
|
11
|
+
- **🔥 Zero External JS Dependencies**: No longer requires `materialize-css` JavaScript or `material-icons` fonts
|
|
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
|
+
- **⚡ Better Performance**: Direct implementations without jQuery or other heavy dependencies
|
|
15
|
+
- **🛠️ Enhanced Components**: Improved DatePicker and TimePicker with custom implementations
|
|
16
|
+
- **📱 Modern Architecture**: Factory components with proper TypeScript support
|
|
17
|
+
- **🎯 CSS-Only Styling**: Uses only CSS for styling - no JavaScript initialization needed
|
|
18
|
+
|
|
19
|
+
### 💥 Breaking Changes from v1.x
|
|
20
|
+
|
|
21
|
+
- **Removed dependencies**: No longer requires `materialize-css` or `material-icons` packages
|
|
22
|
+
- **Component updates**: DatePicker and TimePicker now have custom implementations
|
|
23
|
+
- **Icon changes**: Library uses custom SVG icons. Material Icons font is supported too, but not required.
|
|
24
|
+
- **Installation**: Simpler installation process with fewer dependencies
|
|
25
|
+
|
|
26
|
+
### 📈 Migration from v1.x
|
|
27
|
+
|
|
28
|
+
**Old installation (v1.x):**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install materialize-css material-icons mithril mithril-materialized
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**New installation (v2.x):**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install mithril mithril-materialized
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Your CSS imports can remain the same, but you no longer need the materialize-css JavaScript.
|
|
41
|
+
|
|
42
|
+
## Supported Components
|
|
6
43
|
|
|
7
44
|
- [Buttons](https://erikvullings.github.io/mithril-materialized/#!/buttons)
|
|
8
45
|
- Button
|
|
9
46
|
- FlatButton
|
|
10
47
|
- RoundButton
|
|
11
48
|
- SubmitButton
|
|
12
|
-
- FloatingActionButton
|
|
13
49
|
- [Inputs](https://erikvullings.github.io/mithril-materialized/#!/inputs)
|
|
14
50
|
- TextInput
|
|
15
51
|
- TextArea
|
|
@@ -21,7 +57,7 @@ Supported components:
|
|
|
21
57
|
- RangeInput
|
|
22
58
|
- Chips
|
|
23
59
|
- [Pickers](https://erikvullings.github.io/mithril-materialized/#!/pickers)
|
|
24
|
-
- DatePicker
|
|
60
|
+
- DatePicker (with optional week numbers)
|
|
25
61
|
- TimePicker
|
|
26
62
|
- [Selections](https://erikvullings.github.io/mithril-materialized/#!/selections)
|
|
27
63
|
- Select
|
|
@@ -32,396 +68,339 @@ Supported components:
|
|
|
32
68
|
- [Collections](https://erikvullings.github.io/mithril-materialized/#!/collections)
|
|
33
69
|
- Basic, Link and Avatar Collections
|
|
34
70
|
- Collapsible or accordion
|
|
35
|
-
- [
|
|
71
|
+
- [Theme & Upload](https://erikvullings.github.io/mithril-materialized/#!/theme)
|
|
72
|
+
- ThemeSwitcher (light/dark/auto theme switching)
|
|
73
|
+
- ThemeToggle (simple light/dark toggle)
|
|
74
|
+
- FileUpload (drag-and-drop with validation and preview)
|
|
75
|
+
- [Navigation](https://erikvullings.github.io/mithril-materialized/#!/navigation)
|
|
76
|
+
- Sidenav (responsive navigation drawer)
|
|
77
|
+
- Breadcrumb (navigation path indicator)
|
|
78
|
+
- Wizard/Stepper (multi-step process guidance)
|
|
79
|
+
- [Others](https://erikvullings.github.io/mithril-materialized/#!/modals)
|
|
36
80
|
- ModalPanel
|
|
37
|
-
- [Miscellaneous](https://erikvullings.github.io/mithril-materialized/#!/misc)
|
|
38
|
-
- Tabs
|
|
39
81
|
- MaterialBox
|
|
40
82
|
- Carousel
|
|
41
83
|
- Pagination
|
|
84
|
+
- PaginationControls
|
|
42
85
|
- Parallax
|
|
86
|
+
- Data & Tables
|
|
87
|
+
- DataTable (sorting, filtering, pagination, selection)
|
|
43
88
|
- Additional
|
|
44
89
|
- Label
|
|
45
90
|
- HelperText
|
|
46
|
-
- Not from Materialize-CSS
|
|
47
91
|
- CodeBlock
|
|
48
92
|
- SearchSelect, a searchable select dropdown
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
- NEW: `PasswordInput` component to enter passwords.
|
|
122
|
-
|
|
123
|
-
v0.14.8
|
|
124
|
-
|
|
125
|
-
- FIX: `Tabs` component selection did not work in Edge due to the way the `select` function was implemented in materialize-css.
|
|
126
|
-
|
|
127
|
-
v0.14.7
|
|
128
|
-
|
|
129
|
-
- FIX: `Select` when using `multiple` keeps the dropdown open, `dropdownOptions` and `classes` are passed on creation.
|
|
130
|
-
- `Select`, `Options`, `Radios` use `initialValue` instead of `checkedId` (which is deprecated but still working). The rationale is that the checked values are only read initially, when the component is created.
|
|
131
|
-
|
|
132
|
-
v0.14.5
|
|
133
|
-
|
|
134
|
-
- FIX: `Options` and `Radios` no longer use `h6` element for labels, so they behave more like other labels.
|
|
135
|
-
|
|
136
|
-
v0.14.4
|
|
137
|
-
|
|
138
|
-
- FIX: `Options` and `RadioButtons` did not listen to the `disabled` property.
|
|
139
|
-
|
|
140
|
-
v0.14.3
|
|
93
|
+
- Icon, a simple wrapper for creating icons using material-icons font
|
|
94
|
+
- MaterialIcon, for creating the close/clear and caret as SVG
|
|
95
|
+
|
|
96
|
+
## 📖 Usage Instructions
|
|
97
|
+
|
|
98
|
+
### Quick Start
|
|
99
|
+
|
|
100
|
+
1. **Install the package**:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install mithril mithril-materialized
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
2. **Import the CSS** (optional, for Material Design styling):
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import 'mithril-materialized/index.css';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
3. **Use components in your app**:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
import m from 'mithril';
|
|
116
|
+
import {
|
|
117
|
+
TextInput,
|
|
118
|
+
Button,
|
|
119
|
+
DatePicker,
|
|
120
|
+
DataTable,
|
|
121
|
+
ThemeToggle,
|
|
122
|
+
FileUpload,
|
|
123
|
+
Sidenav,
|
|
124
|
+
Breadcrumb,
|
|
125
|
+
Wizard
|
|
126
|
+
} from 'mithril-materialized';
|
|
127
|
+
|
|
128
|
+
const MyComponent = () => ({
|
|
129
|
+
view: () => m('.container', [
|
|
130
|
+
// Theme toggle in header
|
|
131
|
+
m('nav', [
|
|
132
|
+
m('.nav-wrapper', [
|
|
133
|
+
m('.right', m(ThemeToggle))
|
|
134
|
+
])
|
|
135
|
+
]),
|
|
136
|
+
|
|
137
|
+
// Breadcrumb navigation
|
|
138
|
+
m(Breadcrumb, {
|
|
139
|
+
items: [
|
|
140
|
+
{ text: 'Home', href: '/' },
|
|
141
|
+
{ text: 'Products', href: '/products' },
|
|
142
|
+
{ text: 'Details', active: true }
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
|
|
146
|
+
// Form inputs
|
|
147
|
+
m(TextInput, {
|
|
148
|
+
label: 'Your name',
|
|
149
|
+
onchange: (value) => console.log(value)
|
|
150
|
+
}),
|
|
151
|
+
m(Button, {
|
|
152
|
+
label: 'Submit',
|
|
153
|
+
onclick: () => alert('Hello!')
|
|
154
|
+
}),
|
|
155
|
+
|
|
156
|
+
// File upload
|
|
157
|
+
m(FileUpload, {
|
|
158
|
+
accept: 'image/*',
|
|
159
|
+
multiple: true,
|
|
160
|
+
onFilesSelected: (files) => console.log(files)
|
|
161
|
+
})
|
|
162
|
+
])
|
|
163
|
+
});
|
|
164
|
+
```
|
|
141
165
|
|
|
142
|
-
|
|
166
|
+
### Integration with Build Tools
|
|
143
167
|
|
|
144
|
-
|
|
168
|
+
**Webpack/Vite/Parcel**: The library works out-of-the-box with modern bundlers.
|
|
145
169
|
|
|
146
|
-
|
|
170
|
+
**CSS Framework Integration**: You can use the components with any CSS framework. The included CSS provides Material Design styling, but you can override it with your own styles.
|
|
147
171
|
|
|
148
|
-
|
|
172
|
+
**TypeScript**: Full TypeScript support with comprehensive type definitions included.
|
|
149
173
|
|
|
150
|
-
|
|
151
|
-
- When `Collection` items have an `id` property, the `id` property is used as key (e.g. for sorting the collection). You should not include a `key` property directly in your item's data, as explained [here](https://mithril.js.org/keys.html#avoid-passing-model-data-directly-to-components-if-the-model-uses-key-as-a-data-property).
|
|
174
|
+
See the [live documentation](https://erikvullings.github.io/mithril-materialized/index.html) for examples and component APIs.
|
|
152
175
|
|
|
153
|
-
|
|
176
|
+
## 🗺️ Roadmap & Planned Improvements
|
|
154
177
|
|
|
155
|
-
|
|
156
|
-
- `Pickers` now trigger `onchange` when closing.
|
|
157
|
-
- Replace all links `oncreate: m.route.link` with `m.route.Link`.
|
|
178
|
+
### 🚀 Phase 1: Core Optimizations & New Components (In Progress)
|
|
158
179
|
|
|
159
|
-
|
|
180
|
+
**✅ Completed:**
|
|
160
181
|
|
|
161
|
-
-
|
|
162
|
-
-
|
|
182
|
+
- ✅ Modular CSS architecture with tree-shaking support
|
|
183
|
+
- ✅ Dark theme system with CSS custom properties
|
|
184
|
+
- ✅ File upload component with drag-and-drop
|
|
185
|
+
- ✅ Theme switching components (ThemeSwitcher, ThemeToggle)
|
|
186
|
+
- ✅ Sidenav component with responsive behavior
|
|
187
|
+
- ✅ Breadcrumb navigation component
|
|
188
|
+
- ✅ Wizard/Stepper component for multi-step forms
|
|
163
189
|
|
|
164
|
-
|
|
190
|
+
**✅ Recently Completed:**
|
|
165
191
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
192
|
+
- ✅ DataTable component with sorting, filtering, and pagination
|
|
193
|
+
- ✅ Enhanced TypeScript definitions with better JSDoc comments
|
|
194
|
+
- ✅ Performance optimizations and bundle size improvements
|
|
169
195
|
|
|
170
|
-
|
|
196
|
+
### 🎯 Phase 2: Advanced Components & Features
|
|
171
197
|
|
|
172
|
-
|
|
198
|
+
**Data Display:**
|
|
173
199
|
|
|
174
|
-
|
|
200
|
+
- TreeView component for hierarchical data
|
|
201
|
+
- Card layouts with enhanced Material Design 3.0 styling
|
|
175
202
|
|
|
176
|
-
|
|
203
|
+
**Input & Forms:**
|
|
177
204
|
|
|
178
|
-
|
|
205
|
+
- Advanced date range picker
|
|
206
|
+
- Autocomplete with async data loading
|
|
179
207
|
|
|
180
|
-
|
|
208
|
+
**Navigation & Layout:**
|
|
181
209
|
|
|
182
|
-
|
|
210
|
+
- AppBar/Toolbar component with responsive behavior
|
|
211
|
+
- Bottom navigation component for mobile apps
|
|
212
|
+
- Drawer/Sidebar component with overlay and push modes
|
|
213
|
+
- Grid system enhancements with CSS Grid support
|
|
183
214
|
|
|
184
|
-
|
|
185
|
-
- Refactoring the code slightly
|
|
186
|
-
- `Chips` now has a default `className: col s12`
|
|
215
|
+
### 🔮 Phase 3: Modern Features & Integration
|
|
187
216
|
|
|
188
|
-
|
|
217
|
+
**Developer Experience:**
|
|
189
218
|
|
|
190
|
-
-
|
|
191
|
-
-
|
|
219
|
+
- Storybook integration for component documentation
|
|
220
|
+
- Figma design system integration
|
|
221
|
+
- CLI tools for component generation
|
|
222
|
+
- Better accessibility (ARIA) support throughout
|
|
192
223
|
|
|
193
|
-
|
|
224
|
+
**Performance & Optimization:**
|
|
194
225
|
|
|
195
|
-
-
|
|
226
|
+
- Virtual scrolling for large lists
|
|
227
|
+
- Lazy loading component utilities
|
|
228
|
+
- Bundle analyzer and optimization tools
|
|
229
|
+
- CSS-in-JS runtime support option
|
|
196
230
|
|
|
197
|
-
|
|
231
|
+
**Ecosystem Integration:**
|
|
198
232
|
|
|
199
|
-
-
|
|
233
|
+
- React compatibility layer
|
|
234
|
+
- Vue.js compatibility layer
|
|
235
|
+
- Web Components export option
|
|
236
|
+
- PWA-friendly components
|
|
200
237
|
|
|
201
|
-
|
|
238
|
+
### 📊 Bundle Size Targets
|
|
202
239
|
|
|
203
|
-
|
|
204
|
-
- `Kanban` uses type information. New property, `editableIds`, which makes some properties also editable in the list view.
|
|
240
|
+
**Current Status (v2.0.0-beta.5):**
|
|
205
241
|
|
|
206
|
-
|
|
242
|
+
- Total: 70KB gzipped (44KB JS + 26KB CSS)
|
|
243
|
+
- Modular CSS can reduce bundle by 30-50%
|
|
207
244
|
|
|
208
|
-
|
|
209
|
-
- `Select`, `Options`, `Dropdown` and `RadioButtons` are no longer of the generic type, since IDs can only be strings or numbers.
|
|
210
|
-
- `ISelectOption` is removed, and is replaced by `IInputOption`, making it easier to switch between a radios, select and options.
|
|
211
|
-
- `Options` has a property `checkedId`, similar to `RadioButtons` and `Select`, to specify the checked/selected IDs. This replaces the `IInputOption.isChecked` property, which has been removed.
|
|
245
|
+
**Phase 1 Targets:**
|
|
212
246
|
|
|
213
|
-
|
|
247
|
+
- Core bundle: <40KB gzipped
|
|
248
|
+
- Modular approach: <25KB for typical apps
|
|
249
|
+
- Tree-shaking effectiveness: 60%+
|
|
214
250
|
|
|
215
|
-
-
|
|
216
|
-
- `InputCheckbox`: label is optional
|
|
217
|
-
- `Options` and `RadioButtons` are more consistent with respect to look and feel.
|
|
218
|
-
- `Options` and `RadioButtons` support an `inline` property to align them horizontally.
|
|
219
|
-
- `Select`, `Options`, and `RadioButtons` all use `IInputOption` to specify their options. An item can be disabled now.
|
|
251
|
+
**Long-term Goals:**
|
|
220
252
|
|
|
221
|
-
|
|
253
|
+
- Individual components: <2KB each
|
|
254
|
+
- Micro-bundle support for single components
|
|
255
|
+
- Zero-runtime CSS option for static sites
|
|
222
256
|
|
|
223
|
-
|
|
257
|
+
### 🤝 Contributing
|
|
224
258
|
|
|
225
|
-
|
|
259
|
+
We welcome contributions! Priority areas for community involvement:
|
|
226
260
|
|
|
227
|
-
|
|
261
|
+
1. **High Impact**: New components (DataTable, Sidenav, Breadcrumb)
|
|
262
|
+
2. **Medium Impact**: Accessibility improvements, performance optimizations
|
|
263
|
+
3. **Documentation**: Examples, guides, API documentation
|
|
264
|
+
4. **Testing**: Unit tests, visual regression tests, browser compatibility
|
|
228
265
|
|
|
229
|
-
|
|
266
|
+
See our [contributing guide](CONTRIBUTING.md) for detailed information.
|
|
230
267
|
|
|
231
|
-
|
|
268
|
+
### 📈 Performance Benchmarks
|
|
232
269
|
|
|
233
|
-
|
|
270
|
+
**Bundle Size Comparison:**
|
|
234
271
|
|
|
235
|
-
-
|
|
272
|
+
- mithril-materialized v2.0: 64KB gzipped
|
|
273
|
+
- Material-UI: ~350KB gzipped
|
|
274
|
+
- Materialize CSS + jQuery: ~180KB gzipped
|
|
275
|
+
- Vuetify: ~250KB gzipped
|
|
236
276
|
|
|
237
|
-
|
|
277
|
+
**Runtime Performance:**
|
|
238
278
|
|
|
239
|
-
-
|
|
240
|
-
-
|
|
279
|
+
- Component initialization: <5ms average
|
|
280
|
+
- Theme switching: <10ms for full page
|
|
281
|
+
- File upload processing: Real-time without blocking
|
|
241
282
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
- `Collection onclick` event was not registered properly.
|
|
245
|
-
|
|
246
|
-
v0.11.7 No breaking changes
|
|
247
|
-
|
|
248
|
-
- `Timeline` title can now be a Vnode too.
|
|
249
|
-
|
|
250
|
-
v0.11.6 No breaking changes
|
|
251
|
-
|
|
252
|
-
- `Select` control can now be disabled by adding the property `disabled: true` to the control's properties.
|
|
253
|
-
|
|
254
|
-
v0.11.5 No breaking changes
|
|
255
|
-
|
|
256
|
-
- `MapEditor` has an `onchange` callback to notify changes to the properties collection.
|
|
257
|
-
- `MapEditor` allows you to set the column width (`keyClass`) for the key and value column (`keyValue`).
|
|
258
|
-
|
|
259
|
-
v0.11.4 No breaking changes
|
|
260
|
-
|
|
261
|
-
- FIX `CodeBlock` missed importing of `css`.
|
|
262
|
-
|
|
263
|
-
v0.11.3 No breaking changes
|
|
264
|
-
|
|
265
|
-
- FIX `Timeline`: Default date formatter did not add 1 to the months. See [here](https://www.w3schools.com/js/js_dates.asp).
|
|
266
|
-
- FIX `MapEditor` when dealing with number inputs and the number was 0, it did not work properly.
|
|
267
|
-
- FIX `NumberInput` when the number was 0, the label was not active (and overlaying the number).
|
|
268
|
-
|
|
269
|
-
v0.11.2 No breaking changes
|
|
270
|
-
|
|
271
|
-
- FIX Issue with `SecondaryContent` in `Collection` component: when no `href` was provided, it still created a `href=#!undefined` link.
|
|
272
|
-
|
|
273
|
-
v0.11.1 No breaking changes
|
|
274
|
-
|
|
275
|
-
- Improved generics of `Select` and `Dropdown` component
|
|
276
|
-
- FIX Issue with `placeholder` in `Select` component: when no item was selected, it would not show the placeholder text.
|
|
277
|
-
|
|
278
|
-
v0.11.0 New component, `Timeline`
|
|
279
|
-
|
|
280
|
-
- Added a `Timeline` component to render vertical timelines.
|
|
281
|
-
- `Collection` now accepts other parameters, e.g. styles.
|
|
282
|
-
- All `css` styles are extracted into separate `css` files, and imported in the component. This implies that you don't need to add the required CSS in your own application anymore (except for `materialisecss`, of course).
|
|
283
|
-
- Added documentation using `Typedoc`. It can be found [here](https://erikvullings.github.io/mithril-materialized/typedoc/index.html).
|
|
284
|
-
|
|
285
|
-
v0.10.0 New component, `MapEditor`
|
|
286
|
-
|
|
287
|
-
- Added a new component, `MapEditor`, to edit a map of key-value pairs.
|
|
288
|
-
- `InputCheckbox` can now be disabled.
|
|
289
|
-
- Attributes are better dealt with and no longer end up as unused attributes of elements.
|
|
290
|
-
- Fixed a bug for `TextInput`, where sometimes the `active` class was not added even if the `input` element had a value.
|
|
291
|
-
|
|
292
|
-
v0.9.10 Breaking changes
|
|
293
|
-
|
|
294
|
-
- Deprecated the use of all `contentClass` properties in favour of the mithril convention `className`.
|
|
295
|
-
|
|
296
|
-
v0.9.9 Breaking changes
|
|
297
|
-
|
|
298
|
-
- `ModalPanel`: it's description (i.e. the main content area of the modal) can be a `Vnode`.
|
|
299
|
-
- `Select` does not use `contentClass` anymore, but instead uses the regular mithril `className` (but not `class`, since this is a reserved keyword in TypeScript).
|
|
300
|
-
|
|
301
|
-
v0.9.6 No breaking changes
|
|
302
|
-
|
|
303
|
-
- For a `Collection` with secondary content, do not create a SPA route (with a #!) but leave the URL as is.
|
|
304
|
-
|
|
305
|
-
v0.9.5 No breaking changes
|
|
306
|
-
|
|
307
|
-
- FIX `Select` bug when numeric option IDs were used and ID === 0, option was never selected.
|
|
308
|
-
|
|
309
|
-
v0.9.4 No breaking changes
|
|
310
|
-
|
|
311
|
-
- FIX `Collection` without headers did no longer render.
|
|
312
|
-
|
|
313
|
-
v0.9.3 No breaking changes
|
|
314
|
-
|
|
315
|
-
- `Collection` with links can now also contain a header.
|
|
316
|
-
- `Collection` with no items and only a header will now just render the header
|
|
317
|
-
|
|
318
|
-
v0.9.0 Breaking changes
|
|
319
|
-
|
|
320
|
-
- `Collapsible` is now correctly spelled (used to be `Collabsible`, oops).
|
|
321
|
-
- Added `Collection`, to create a collection of items: supports basic, link and avatar collections.
|
|
322
|
-
|
|
323
|
-
v0.8.3 No breaking changes
|
|
324
|
-
|
|
325
|
-
- `FileInput` component can be disabled, and accepts file types.
|
|
326
|
-
|
|
327
|
-
v0.8.1 No breaking changes
|
|
328
|
-
|
|
329
|
-
- Closes issue #1: Select issue with id === 0
|
|
330
|
-
- MaterialBox can set height, passes attributes to wrapped image element
|
|
331
|
-
|
|
332
|
-
v0.8.0 No breaking changes
|
|
333
|
-
|
|
334
|
-
- `FileInput` component can specify `class` property on the `div` wrapper (default `col s12`) and `contentClass` property on the file input element.
|
|
335
|
-
|
|
336
|
-
v0.7.0 Breaking changes for Dropdown component.
|
|
337
|
-
|
|
338
|
-
- New `FileInput` component to upload one or more files.
|
|
339
|
-
- `Dropdown` uses similar items as `Select`, and uses `checkedId` to select the item.
|
|
340
|
-
- `Dropdown` items can now use an icon and dividers.
|
|
341
|
-
- `Dropdown` can now have a helper text option and an icon prefix.
|
|
283
|
+
## Build instructions
|
|
342
284
|
|
|
343
|
-
|
|
285
|
+
This repository consists of two packages, combined using `lerna`: the `lib` package that is published to `npm`, as well as an `example` project which uses this library to display the Mithril components that it contains.
|
|
344
286
|
|
|
345
|
-
- `
|
|
287
|
+
To install the dependencies, you can use `npm i`, or, alternatively, use `pnpm m i` (assuming you have installed `pnpm` as alternative package manager using `npm i -g pnpm`) to perform a multi-repository install. Next, build everything using `npm start` and visit the documentation page on [http://localhost:1234](http://localhost:1234) in case port 1234 is not occupied already.
|
|
346
288
|
|
|
347
|
-
|
|
289
|
+
## 🎨 Styling & CSS
|
|
348
290
|
|
|
349
|
-
|
|
291
|
+
### CSS Usage
|
|
350
292
|
|
|
351
|
-
|
|
293
|
+
The library includes carefully crafted CSS that provides Material Design styling without external dependencies. You can import the ready-to-use CSS:
|
|
352
294
|
|
|
353
|
-
|
|
295
|
+
```typescript
|
|
296
|
+
import 'mithril-materialized/index.css';
|
|
297
|
+
```
|
|
354
298
|
|
|
355
|
-
|
|
299
|
+
**Important**: The CSS styling is **completely independent** of the original materialize-css. This means:
|
|
356
300
|
|
|
357
|
-
-
|
|
358
|
-
-
|
|
301
|
+
- ✅ No conflicting styles from materialize-css
|
|
302
|
+
- ✅ Smaller CSS bundle size
|
|
303
|
+
- ✅ Custom optimizations for better performance
|
|
304
|
+
- ✅ No external font dependencies
|
|
359
305
|
|
|
360
|
-
|
|
306
|
+
### 🔥 NEW: Modular CSS Architecture
|
|
361
307
|
|
|
362
|
-
-
|
|
363
|
-
- Additionally, they can use `readOnly`, `pattern` and `autocomplete` (does not always seem to work).
|
|
308
|
+
**Tree-shakable CSS modules** for optimal bundle sizes! Import only the CSS you need:
|
|
364
309
|
|
|
365
|
-
|
|
310
|
+
```typescript
|
|
311
|
+
// Option 1: Import everything (64KB total)
|
|
312
|
+
import 'mithril-materialized/index.css';
|
|
366
313
|
|
|
367
|
-
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
-
|
|
314
|
+
// Option 2: Import only what you need (modular approach)
|
|
315
|
+
import 'mithril-materialized/core.css'; // Essential styles (18KB)
|
|
316
|
+
import 'mithril-materialized/forms.css'; // Form components only
|
|
317
|
+
import 'mithril-materialized/components.css'; // Interactive components
|
|
371
318
|
|
|
372
|
-
|
|
319
|
+
// Option 3: Advanced components only when needed
|
|
320
|
+
import 'mithril-materialized/pickers.css'; // Date/Time pickers
|
|
321
|
+
import 'mithril-materialized/advanced.css'; // Carousel, sidenav, etc.
|
|
322
|
+
import 'mithril-materialized/utilities.css'; // Badges, icons, cards
|
|
323
|
+
```
|
|
373
324
|
|
|
374
|
-
|
|
325
|
+
**CSS Modules Available:**
|
|
375
326
|
|
|
376
|
-
|
|
327
|
+
- `core.css` (18KB) - Essential foundation (normalize, grid, typography, variables)
|
|
328
|
+
- `components.css` - Interactive components (buttons, dropdowns, modals, tabs)
|
|
329
|
+
- `forms.css` - All form components (inputs, selects, switches, file upload)
|
|
330
|
+
- `pickers.css` - Date and time picker components
|
|
331
|
+
- `advanced.css` - Specialized components (carousel, sidenav, navbar, preloader)
|
|
332
|
+
- `utilities.css` - Visual utilities (badges, cards, icons, toast, chips)
|
|
377
333
|
|
|
378
|
-
|
|
379
|
-
- Removed a few left-over `console.log` statements.
|
|
334
|
+
**Bundle Size Optimization:**
|
|
380
335
|
|
|
381
|
-
|
|
336
|
+
- Full bundle: 64KB gzipped (44KB JS + 20KB CSS)
|
|
337
|
+
- Modular approach can reduce CSS by 30-50%
|
|
338
|
+
- Use only `core.css` + specific modules for your use case
|
|
382
339
|
|
|
383
|
-
|
|
340
|
+
### 🌓 Dark Theme Support
|
|
384
341
|
|
|
385
|
-
|
|
342
|
+
Built-in dark theme support with CSS custom properties:
|
|
386
343
|
|
|
387
|
-
|
|
344
|
+
```typescript
|
|
345
|
+
import { ThemeManager, ThemeSwitcher } from 'mithril-materialized';
|
|
388
346
|
|
|
389
|
-
|
|
347
|
+
// Programmatic theme control
|
|
348
|
+
ThemeManager.setTheme('dark'); // 'light' | 'dark' | 'auto'
|
|
349
|
+
ThemeManager.toggle(); // Toggle between light/dark
|
|
350
|
+
ThemeManager.getTheme(); // Get current theme
|
|
390
351
|
|
|
391
|
-
|
|
352
|
+
// UI Components
|
|
353
|
+
m(ThemeSwitcher, {
|
|
354
|
+
onThemeChange: (theme) => console.log('Theme:', theme)
|
|
355
|
+
});
|
|
392
356
|
|
|
393
|
-
|
|
357
|
+
m(ThemeToggle); // Simple toggle button
|
|
358
|
+
```
|
|
394
359
|
|
|
395
|
-
|
|
396
|
-
- `contentClass` has been removed in favour of the default mithril `class` or `className` attribute.
|
|
397
|
-
- The Icon function has been replaced by the `Icon` component. The `SmallIcon` and `PrefixedIcon` have been removed, as they can easily be created using the `Icon` component.
|
|
398
|
-
- The `autofocus` attribute for inputs now also works on updates (by calling the element.focus() method).
|
|
399
|
-
- The code has been split over multiple files, so it is easier to only import the components that you need.
|
|
360
|
+
**CSS Custom Properties**: All colors use CSS variables for runtime theme switching:
|
|
400
361
|
|
|
401
|
-
|
|
362
|
+
```css
|
|
363
|
+
:root {
|
|
364
|
+
--mm-primary-color: #26a69a;
|
|
365
|
+
--mm-background-color: #ffffff;
|
|
366
|
+
--mm-text-primary: rgba(0, 0, 0, 0.87);
|
|
367
|
+
}
|
|
402
368
|
|
|
403
|
-
-
|
|
369
|
+
[data-theme="dark"] {
|
|
370
|
+
--mm-primary-color: #80cbc4;
|
|
371
|
+
--mm-background-color: #121212;
|
|
372
|
+
--mm-text-primary: rgba(255, 255, 255, 0.87);
|
|
373
|
+
}
|
|
374
|
+
```
|
|
404
375
|
|
|
405
|
-
|
|
376
|
+
### SASS Usage
|
|
406
377
|
|
|
407
|
-
|
|
408
|
-
- Added autofocus function|property to input fields.
|
|
409
|
-
- Added custom validation using the validate function|property to add valid/invalid label to an input.
|
|
410
|
-
- Removed dependency on materialize-css (it is expected that it is imported via the main app).
|
|
378
|
+
For advanced customization, you can use the SASS source files directly:
|
|
411
379
|
|
|
412
|
-
|
|
380
|
+
```css
|
|
381
|
+
// Import all SASS components
|
|
382
|
+
@import 'mithril-materialized/sass/materialize.scss';
|
|
413
383
|
|
|
414
|
-
|
|
384
|
+
// Or import individual components
|
|
385
|
+
@import 'mithril-materialized/sass/components/buttons';
|
|
386
|
+
@import 'mithril-materialized/sass/components/forms';
|
|
387
|
+
@import 'mithril-materialized/sass/components/grid';
|
|
388
|
+
```
|
|
415
389
|
|
|
416
|
-
|
|
390
|
+
**SASS Variables**: You can customize colors, spacing, and other design tokens by overriding SASS variables before importing:
|
|
417
391
|
|
|
418
|
-
|
|
392
|
+
```css
|
|
393
|
+
// Customize Material Design variables
|
|
394
|
+
$primary-color: #2196F3;
|
|
395
|
+
$secondary-color: #FF9800;
|
|
419
396
|
|
|
420
|
-
|
|
397
|
+
// Then import the library
|
|
398
|
+
@import 'mithril-materialized/sass/materialize.scss';
|
|
399
|
+
```
|
|
421
400
|
|
|
422
|
-
|
|
401
|
+
### Custom Styles
|
|
423
402
|
|
|
424
|
-
|
|
403
|
+
The library includes these additional styles for enhanced functionality:
|
|
425
404
|
|
|
426
405
|
```css
|
|
427
406
|
/* For the switch */
|
|
@@ -429,7 +408,7 @@ Although I've tried to limit the CSS adaptations to a minimum, I needed to tweak
|
|
|
429
408
|
.clear-10,
|
|
430
409
|
.clear-15 {
|
|
431
410
|
clear: both;
|
|
432
|
-
/* overflow: hidden;
|
|
411
|
+
/* overflow: hidden; Precaution pour IE 7 */
|
|
433
412
|
}
|
|
434
413
|
.clear-10 {
|
|
435
414
|
margin-bottom: 10px;
|