mithril-materialized 2.0.0-beta.1 → 2.0.0-beta.2
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 +112 -351
- package/package.json +1 -1
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**: Uses custom SVG icons instead of Material Icons font
|
|
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
|
|
@@ -32,10 +68,8 @@ 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
|
+
- [Others](https://erikvullings.github.io/mithril-materialized/#!/modals)
|
|
36
72
|
- ModalPanel
|
|
37
|
-
- [Miscellaneous](https://erikvullings.github.io/mithril-materialized/#!/misc)
|
|
38
|
-
- Tabs
|
|
39
73
|
- MaterialBox
|
|
40
74
|
- Carousel
|
|
41
75
|
- Pagination
|
|
@@ -43,385 +77,112 @@ Supported components:
|
|
|
43
77
|
- Additional
|
|
44
78
|
- Label
|
|
45
79
|
- HelperText
|
|
46
|
-
- Not from Materialize-CSS
|
|
47
80
|
- CodeBlock
|
|
48
81
|
- SearchSelect, a searchable select dropdown
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
## Version history
|
|
53
|
-
|
|
54
|
-
v1.2.0: Added Search select, a searchable select dropdown
|
|
55
|
-
|
|
56
|
-
v1.1.7: Added option to add style to InputCheckbox and Options
|
|
57
|
-
|
|
58
|
-
v0.17.1: bug fix
|
|
59
|
-
|
|
60
|
-
- `Select` component also reacts when the `checkedId` property becomes undefined (previously, it would ignore it).
|
|
61
|
-
|
|
62
|
-
v0.17.0
|
|
63
|
-
|
|
64
|
-
- Breaking change: `Options` and `RadioButtons` used the `inline` property to put items horizontally. This is actually not needed, and it has been removed. Instead, use the `checkboxClass` to set the grid size of each cell.
|
|
65
|
-
|
|
66
|
-
v0.16.3
|
|
67
|
-
|
|
68
|
-
- `NumberInput` adds support for the `step` attribute, so you can use the number up/down to represent floats too.
|
|
69
|
-
|
|
70
|
-
v0.16.2
|
|
71
|
-
|
|
72
|
-
- Updated dependencies, fixed library vulnerabilities
|
|
73
|
-
|
|
74
|
-
v0.16.1
|
|
75
|
-
|
|
76
|
-
- `Select`, `Options`, and `RadioButtons`: The `checkedId` property can be used to change the selection in `onupdate` dynamically. Otherwise, it is treated the same as `initialValue` (which is only processed in `oninit`). This allows you to dynamically update the selections without recreating the component.
|
|
77
|
-
|
|
78
|
-
v0.16.0
|
|
79
|
-
|
|
80
|
-
- `Select` `disabled` status is computed dynamically in the view, not only in `oninit`.
|
|
81
|
-
- `Select`, `Option`, `Radio`, `Kanban`: `onchange` is computed dynamically in the view, not only in `oninit`. As the `onchange` created a closure, new attributes were not always updated as expected.
|
|
82
|
-
|
|
83
|
-
v0.15.4
|
|
84
|
-
|
|
85
|
-
- `Pagination` component simplified implementation.
|
|
86
|
-
|
|
87
|
-
v0.15.3
|
|
88
|
-
|
|
89
|
-
- FIX: `Pickers` destroy them `onremove`.
|
|
90
|
-
|
|
91
|
-
v0.15.2
|
|
92
|
-
|
|
93
|
-
- FIX: `Pagination` did not properly compute the go forward disabled/enabled state.
|
|
94
|
-
|
|
95
|
-
v0.15.1
|
|
96
|
-
|
|
97
|
-
- FIX: `Pagination` did not highlight current item when item index exceeded size limit. Also updated example with actual routes.
|
|
98
|
-
|
|
99
|
-
v0.15.0
|
|
100
|
-
|
|
101
|
-
- NEW: `FloatingActionButton` created.
|
|
102
|
-
|
|
103
|
-
v0.14.14
|
|
104
|
-
|
|
105
|
-
- FIX: `Kanban` triggering too many `onchange` messages.
|
|
106
|
-
|
|
107
|
-
v0.14.12
|
|
108
|
-
|
|
109
|
-
- FIX: `Select` when using `multiple` keeps the dropdown open, but re-initialize select when the options change.
|
|
110
|
-
|
|
111
|
-
v0.14.11
|
|
112
|
-
|
|
113
|
-
- FIX: `Kanban` did not trigger `onChange` when disabled, but with editable properties.
|
|
114
|
-
|
|
115
|
-
v0.14.10
|
|
116
|
-
|
|
117
|
-
- FIX: `Chips` did not initialize properly when `onChange` was not specified (e.g. when disabled).
|
|
118
|
-
|
|
119
|
-
v0.14.9
|
|
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
|
|
141
|
-
|
|
142
|
-
- When using a placeholder in an `input` field, the label should be active.
|
|
143
|
-
|
|
144
|
-
v0.14.2
|
|
145
|
-
|
|
146
|
-
- `LinksCollection` sometimes created unwanted `href` attribute in links.
|
|
147
|
-
|
|
148
|
-
v0.14.1 Using Mithril v2
|
|
149
|
-
|
|
150
|
-
- Migrated backwards from Mithril v2.0.3 to v2.0.1 due to bugs in the released version.
|
|
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).
|
|
152
|
-
|
|
153
|
-
v0.14.0 Using Mithril v2
|
|
154
|
-
|
|
155
|
-
- Upgrading all dependencies
|
|
156
|
-
- `Pickers` now trigger `onchange` when closing.
|
|
157
|
-
- Replace all links `oncreate: m.route.link` with `m.route.Link`.
|
|
158
|
-
|
|
159
|
-
v0.13.15 Patch
|
|
160
|
-
|
|
161
|
-
- `Select` removed `console.warn` in library.
|
|
162
|
-
- Updated `npm` scripts.
|
|
163
|
-
|
|
164
|
-
v0.13.14 Enhancements
|
|
165
|
-
|
|
166
|
-
- `Dropdown`: displayed text is truncated, so it doesn't overflow the button.
|
|
167
|
-
- `Select` can receive options, e.g. `dropdownOptions: { container: document.body }` to display it properly in a `Modal`.
|
|
168
|
-
- `Modal` examples added with `Select` and `Dropdown` components.
|
|
169
|
-
|
|
170
|
-
v0.13.13 Bug fix related to mithril RC7
|
|
171
|
-
|
|
172
|
-
- FIX `Kanban` key usage and drag-n-drop behaviour
|
|
173
|
-
|
|
174
|
-
v0.13.12 Bug fix
|
|
175
|
-
|
|
176
|
-
- `Options` `checkboxClass` was not applied, so you could not align items properly.
|
|
177
|
-
|
|
178
|
-
v0.13.11 Enhancements
|
|
179
|
-
|
|
180
|
-
- `Chips` component can now have an optional `label` (title) and `helperText` (under the input). Also the alignment has been fixed (the input used to be slightly wider than a regular input).
|
|
181
|
-
|
|
182
|
-
v0.13.10 Enhancement
|
|
183
|
-
|
|
184
|
-
- Added IIFE and ESM output builds
|
|
185
|
-
- Refactoring the code slightly
|
|
186
|
-
- `Chips` now has a default `className: col s12`
|
|
82
|
+
- Icon, a simple wrapper for creating icons using material-icons font
|
|
83
|
+
- MaterialIcon, for creating the close/clear and caret as SVG
|
|
187
84
|
|
|
188
|
-
|
|
85
|
+
## 📖 Usage Instructions
|
|
189
86
|
|
|
190
|
-
|
|
191
|
-
- `ModalPanel` has a new handler, `onCreate` which can be used to receive the modal instance, so you can control it programmatically.
|
|
87
|
+
### Quick Start
|
|
192
88
|
|
|
193
|
-
|
|
89
|
+
1. **Install the package**:
|
|
194
90
|
|
|
195
|
-
|
|
91
|
+
```bash
|
|
92
|
+
npm install mithril mithril-materialized
|
|
93
|
+
```
|
|
196
94
|
|
|
197
|
-
|
|
95
|
+
2. **Import the CSS** (optional, for Material Design styling):
|
|
198
96
|
|
|
199
|
-
|
|
97
|
+
```typescript
|
|
98
|
+
import 'mithril-materialized/index.css';
|
|
99
|
+
```
|
|
200
100
|
|
|
201
|
-
|
|
101
|
+
3. **Use components in your app**:
|
|
202
102
|
|
|
203
|
-
|
|
204
|
-
|
|
103
|
+
```typescript
|
|
104
|
+
import m from 'mithril';
|
|
105
|
+
import { TextInput, Button, DatePicker } from 'mithril-materialized';
|
|
205
106
|
|
|
206
|
-
|
|
107
|
+
const MyComponent = () => ({
|
|
108
|
+
view: () => m('.container', [
|
|
109
|
+
m(TextInput, {
|
|
110
|
+
label: 'Your name',
|
|
111
|
+
onchange: (value) => console.log(value)
|
|
112
|
+
}),
|
|
113
|
+
m(Button, {
|
|
114
|
+
label: 'Submit',
|
|
115
|
+
onclick: () => alert('Hello!')
|
|
116
|
+
}),
|
|
117
|
+
m(DatePicker, {
|
|
118
|
+
label: 'Select date',
|
|
119
|
+
onchange: (date) => console.log(date)
|
|
120
|
+
})
|
|
121
|
+
])
|
|
122
|
+
});
|
|
123
|
+
```
|
|
207
124
|
|
|
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.
|
|
125
|
+
### Integration with Build Tools
|
|
212
126
|
|
|
213
|
-
|
|
127
|
+
**Webpack/Vite/Parcel**: The library works out-of-the-box with modern bundlers.
|
|
214
128
|
|
|
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.
|
|
129
|
+
**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.
|
|
220
130
|
|
|
221
|
-
|
|
131
|
+
**TypeScript**: Full TypeScript support with comprehensive type definitions included.
|
|
222
132
|
|
|
223
|
-
|
|
133
|
+
See the [live documentation](https://erikvullings.github.io/mithril-materialized/index.html) for examples and component APIs.
|
|
224
134
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
- `Tabs`: added `contentClass` to add a class to the content.
|
|
228
|
-
|
|
229
|
-
v0.12.1 No breaking changes
|
|
230
|
-
|
|
231
|
-
- Simplified bundling after issues in `webpack`.
|
|
232
|
-
|
|
233
|
-
v0.12.0 No breaking changes
|
|
234
|
-
|
|
235
|
-
- `Tabs` component added, to show [tabs](https://erikvullings.github.io/mithril-materialized/#!/misc).
|
|
236
|
-
|
|
237
|
-
v0.11.11 No breaking changes
|
|
238
|
-
|
|
239
|
-
- Bug fix: `TextArea` did not invoke `onchange` when the input was cleared.
|
|
240
|
-
- Using Rollup as bundler, generating two bundles (ESM, regular JS).
|
|
241
|
-
|
|
242
|
-
v0.11.8 No breaking changes
|
|
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.
|
|
342
|
-
|
|
343
|
-
v0.6.4 Breaking changes, bug fix.
|
|
344
|
-
|
|
345
|
-
- `Select` did not always return the proper id on selection changes with multiple elements.
|
|
346
|
-
|
|
347
|
-
v0.6.3 No breaking changes, bug fix.
|
|
348
|
-
|
|
349
|
-
- `Select` did not update dynamically when checkedId changed.
|
|
350
|
-
|
|
351
|
-
v0.6.2 No breaking changes
|
|
352
|
-
|
|
353
|
-
- `Select` can use `M.FormSelectOptions`.
|
|
354
|
-
|
|
355
|
-
v0.6.1 No breaking changes
|
|
356
|
-
|
|
357
|
-
- `Select` can have `disabled` options, and `id` is optional (in which case the label is used).
|
|
358
|
-
- `Select` can use a prefix icon.
|
|
359
|
-
|
|
360
|
-
v0.6.0 No breaking changes
|
|
361
|
-
|
|
362
|
-
- `Inputs` can now use `onkeyup`, `onkeydown`, and `onkeypress` events. They also return the value.
|
|
363
|
-
- Additionally, they can use `readOnly`, `pattern` and `autocomplete` (does not always seem to work).
|
|
364
|
-
|
|
365
|
-
v0.5.0 No breaking changes
|
|
366
|
-
|
|
367
|
-
- NEW: Pagination control
|
|
368
|
-
- BUG FIX: `Input.onchange` would not fire if the input was cleared.
|
|
369
|
-
- All options now derives from mithril's `Attributes`.
|
|
370
|
-
- Using `FactoryComponent` type
|
|
371
|
-
|
|
372
|
-
v0.4.4 No breaking changes
|
|
373
|
-
|
|
374
|
-
- Do not pass attributes through, e.g. if you had a `m(FlatButton, { onupdate })`, the `onupdate` was passed through to the `HelperText` too.
|
|
375
|
-
|
|
376
|
-
v0.4.3 No breaking changes
|
|
377
|
-
|
|
378
|
-
- The validate method for inputs now also accepts the HTMLInputElement
|
|
379
|
-
- Removed a few left-over `console.log` statements.
|
|
380
|
-
|
|
381
|
-
v0.4.2 No breaking changes
|
|
382
|
-
|
|
383
|
-
- Added `required` and `aria-required="true"` attributes when the `required` or `isMandatory` property are set.
|
|
135
|
+
## Build instructions
|
|
384
136
|
|
|
385
|
-
|
|
137
|
+
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.
|
|
386
138
|
|
|
387
|
-
|
|
139
|
+
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.
|
|
388
140
|
|
|
389
|
-
|
|
141
|
+
## 🎨 Styling & CSS
|
|
390
142
|
|
|
391
|
-
|
|
143
|
+
### CSS Usage
|
|
392
144
|
|
|
393
|
-
|
|
145
|
+
The library includes carefully crafted CSS that provides Material Design styling without external dependencies. You can import the ready-to-use CSS:
|
|
394
146
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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.
|
|
147
|
+
```typescript
|
|
148
|
+
import 'mithril-materialized/index.css';
|
|
149
|
+
```
|
|
400
150
|
|
|
401
|
-
|
|
151
|
+
**Important**: The CSS styling is **completely independent** of the original materialize-css. This means:
|
|
402
152
|
|
|
403
|
-
-
|
|
153
|
+
- ✅ No conflicting styles from materialize-css
|
|
154
|
+
- ✅ Smaller CSS bundle size
|
|
155
|
+
- ✅ Custom optimizations for better performance
|
|
156
|
+
- ✅ No external font dependencies
|
|
404
157
|
|
|
405
|
-
|
|
158
|
+
### SASS Usage
|
|
406
159
|
|
|
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).
|
|
160
|
+
For advanced customization, you can use the SASS source files directly:
|
|
411
161
|
|
|
412
|
-
|
|
162
|
+
```scss
|
|
163
|
+
// Import all SASS components
|
|
164
|
+
@import 'mithril-materialized/sass/materialize.scss';
|
|
413
165
|
|
|
414
|
-
|
|
166
|
+
// Or import individual components
|
|
167
|
+
@import 'mithril-materialized/sass/components/buttons';
|
|
168
|
+
@import 'mithril-materialized/sass/components/forms';
|
|
169
|
+
@import 'mithril-materialized/sass/components/grid';
|
|
170
|
+
```
|
|
415
171
|
|
|
416
|
-
|
|
172
|
+
**SASS Variables**: You can customize colors, spacing, and other design tokens by overriding SASS variables before importing:
|
|
417
173
|
|
|
418
|
-
|
|
174
|
+
```scss
|
|
175
|
+
// Customize Material Design variables
|
|
176
|
+
$primary-color: #2196F3;
|
|
177
|
+
$secondary-color: #FF9800;
|
|
419
178
|
|
|
420
|
-
|
|
179
|
+
// Then import the library
|
|
180
|
+
@import 'mithril-materialized/sass/materialize.scss';
|
|
181
|
+
```
|
|
421
182
|
|
|
422
|
-
|
|
183
|
+
### Custom Styles
|
|
423
184
|
|
|
424
|
-
|
|
185
|
+
The library includes these additional styles for enhanced functionality:
|
|
425
186
|
|
|
426
187
|
```css
|
|
427
188
|
/* For the switch */
|