mithril-materialized 0.19.4 → 1.0.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
@@ -1,485 +1,484 @@
1
- # mithril-materialized
2
-
3
- A [materialize-css](https://materializecss.com) library for the Mithril framework (tested with v2.0.0-rc4 and higher, but presumably, it should work with v1.1.6 too), making it easier to use a Materialize theme in your application. The main focus of this library is on creating Mithril components for the more complicated Materialize components.
4
-
5
- Supported components:
6
-
7
- - [Buttons](https://erikvullings.github.io/mithril-materialized/#!/buttons)
8
- - Button
9
- - FlatButton
10
- - RoundButton
11
- - SubmitButton
12
- - FloatingActionButton
13
- - [Inputs](https://erikvullings.github.io/mithril-materialized/#!/inputs)
14
- - TextInput
15
- - TextArea
16
- - AutoComplete
17
- - UrlInput
18
- - EmailInput
19
- - NumberInput
20
- - ColorInput
21
- - RangeInput
22
- - Chips
23
- - [Pickers](https://erikvullings.github.io/mithril-materialized/#!/pickers)
24
- - DatePicker
25
- - TimePicker
26
- - [Selections](https://erikvullings.github.io/mithril-materialized/#!/selections)
27
- - Select
28
- - Options
29
- - RadioButtons
30
- - Switch
31
- - Dropdown
32
- - [Collections](https://erikvullings.github.io/mithril-materialized/#!/collections)
33
- - Basic, Link and Avatar Collections
34
- - Collapsible or accordion
35
- - [Modals](https://erikvullings.github.io/mithril-materialized/#!/modals)
36
- - ModalPanel
37
- - [Miscellaneous](https://erikvullings.github.io/mithril-materialized/#!/misc)
38
- - Tabs
39
- - MaterialBox
40
- - Carousel
41
- - Pagination
42
- - Parallax
43
- - Additional
44
- - Label
45
- - HelperText
46
- - Not from Materialize-CSS
47
- - CodeBlock
48
- - [Kanban](https://erikvullings.github.io/mithril-materialized/#!/kanban)
49
- - [Timeline](https://erikvullings.github.io/mithril-materialized/#!/timeline)
50
- - [MapEditor](https://erikvullings.github.io/mithril-materialized/#!/map_editor)
51
-
52
- ## Version history
53
-
54
- v0.17.1: bug fix
55
-
56
- - `Select` component also reacts when the `checkedId` property becomes undefined (previously, it would ignore it).
57
-
58
- v0.17.0
59
-
60
- - 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.
61
-
62
- v0.16.3
63
-
64
- - `NumberInput` adds support for the `step` attribute, so you can use the number up/down to represent floats too.
65
-
66
- v0.16.2
67
-
68
- - Updated dependencies, fixed library vulnerabilities
69
-
70
- v0.16.1
71
-
72
- - `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.
73
-
74
- v0.16.0
75
-
76
- - `Select` `disabled` status is computed dynamically in the view, not only in `oninit`.
77
- - `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.
78
-
79
- v0.15.4
80
-
81
- - `Pagination` component simplified implementation.
82
-
83
- v0.15.3
84
-
85
- - FIX: `Pickers` destroy them `onremove`.
86
-
87
- v0.15.2
88
-
89
- - FIX: `Pagination` did not properly compute the go forward disabled/enabled state.
90
-
91
- v0.15.1
92
-
93
- - FIX: `Pagination` did not highlight current item when item index exceeded size limit. Also updated example with actual routes.
94
-
95
- v0.15.0
96
-
97
- - NEW: `FloatingActionButton` created.
98
-
99
- v0.14.14
100
-
101
- - FIX: `Kanban` triggering too many `onchange` messages.
102
-
103
- v0.14.12
104
-
105
- - FIX: `Select` when using `multiple` keeps the dropdown open, but re-initialize select when the options change.
106
-
107
- v0.14.11
108
-
109
- - FIX: `Kanban` did not trigger `onChange` when disabled, but with editable properties.
110
-
111
- v0.14.10
112
-
113
- - FIX: `Chips` did not initialize properly when `onChange` was not specified (e.g. when disabled).
114
-
115
- v0.14.9
116
-
117
- - NEW: `PasswordInput` component to enter passwords.
118
-
119
- v0.14.8
120
-
121
- - FIX: `Tabs` component selection did not work in Edge due to the way the `select` function was implemented in materialize-css.
122
-
123
- v0.14.7
124
-
125
- - FIX: `Select` when using `multiple` keeps the dropdown open, `dropdownOptions` and `classes` are passed on creation.
126
- - `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.
127
-
128
- v0.14.5
129
-
130
- - FIX: `Options` and `Radios` no longer use `h6` element for labels, so they behave more like other labels.
131
-
132
- v0.14.4
133
-
134
- - FIX: `Options` and `RadioButtons` did not listen to the `disabled` property.
135
-
136
- v0.14.3
137
-
138
- - When using a placeholder in an `input` field, the label should be active.
139
-
140
- v0.14.2
141
-
142
- - `LinksCollection` sometimes created unwanted `href` attribute in links.
143
-
144
- v0.14.1 Using Mithril v2
145
-
146
- - Migrated backwards from Mithril v2.0.3 to v2.0.1 due to bugs in the released version.
147
- - 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).
148
-
149
- v0.14.0 Using Mithril v2
150
-
151
- - Upgrading all dependencies
152
- - `Pickers` now trigger `onchange` when closing.
153
- - Replace all links `oncreate: m.route.link` with `m.route.Link`.
154
-
155
- v0.13.15 Patch
156
-
157
- - `Select` removed `console.warn` in library.
158
- - Updated `npm` scripts.
159
-
160
- v0.13.14 Enhancements
161
-
162
- - `Dropdown`: displayed text is truncated, so it doesn't overflow the button.
163
- - `Select` can receive options, e.g. `dropdownOptions: { container: document.body }` to display it properly in a `Modal`.
164
- - `Modal` examples added with `Select` and `Dropdown` components.
165
-
166
- v0.13.13 Bug fix related to mithril RC7
167
-
168
- - FIX `Kanban` key usage and drag-n-drop behaviour
169
-
170
- v0.13.12 Bug fix
171
-
172
- - `Options` `checkboxClass` was not applied, so you could not align items properly.
173
-
174
- v0.13.11 Enhancements
175
-
176
- - `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).
177
-
178
- v0.13.10 Enhancement
179
-
180
- - Added IIFE and ESM output builds
181
- - Refactoring the code slightly
182
- - `Chips` now has a default `className: col s12`
183
-
184
- v0.13.9 Enhancement
185
-
186
- - `ModalPanel` buttons' `onclick` handler now also receives the event, so you can prevent mithril from redrawing.
187
- - `ModalPanel` has a new handler, `onCreate` which can be used to receive the modal instance, so you can control it programmatically.
188
-
189
- v0.13.8 Bug fix
190
-
191
- - `Select`, checkedId is evaluated in the view instead of `oninit`.
192
-
193
- v0.13.6 Minor updates
194
-
195
- - `Dropdown`, `Kanban`, `TimePicker`, `DatePicker` can be disabled.
196
-
197
- v0.13.5 Minor updates
198
-
199
- - `Dropdown` id, if not supplied, caused confusion when multiple `Dropdowns` were used on one page.
200
- - `Kanban` uses type information. New property, `editableIds`, which makes some properties also editable in the list view.
201
-
202
- v0.13.0 Breaking changes
203
-
204
- - `Select` component now maintains the checkedIds internally, i.e. they are only processed during `oninit`. This is to create consistent behaviour with the `Options` and `RadioButtons` components.
205
- - `Select`, `Options`, `Dropdown` and `RadioButtons` are no longer of the generic type, since IDs can only be strings or numbers.
206
- - `ISelectOption` is removed, and is replaced by `IInputOption`, making it easier to switch between a radios, select and options.
207
- - `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.
208
-
209
- NEW
210
-
211
- - [Kanban](https://erikvullings.github.io/mithril-materialized/#!/kanban): new component to render an editable list of items. Supports drag-and-drop between lists too, essentially allowing you to create a Kanban list. Hence the name.
212
- - `InputCheckbox`: label is optional
213
- - `Options` and `RadioButtons` are more consistent with respect to look and feel.
214
- - `Options` and `RadioButtons` support an `inline` property to align them horizontally.
215
- - `Select`, `Options`, and `RadioButtons` all use `IInputOption` to specify their options. An item can be disabled now.
216
-
217
- v0.13.0 No breaking changes
218
-
219
- - `FileInput`: added `initialValue` to set the initial value more clearly, and added a clear button to remove the input.
220
-
221
- v0.12.2 No breaking changes
222
-
223
- - `Tabs`: added `contentClass` to add a class to the content.
224
-
225
- v0.12.1 No breaking changes
226
-
227
- - Simplified bundling after issues in `webpack`.
228
-
229
- v0.12.0 No breaking changes
230
-
231
- - `Tabs` component added, to show [tabs](https://erikvullings.github.io/mithril-materialized/#!/misc).
232
-
233
- v0.11.11 No breaking changes
234
-
235
- - Bug fix: `TextArea` did not invoke `onchange` when the input was cleared.
236
- - Using Rollup as bundler, generating two bundles (ESM, regular JS).
237
-
238
- v0.11.8 No breaking changes
239
-
240
- - `Collection onclick` event was not registered properly.
241
-
242
- v0.11.7 No breaking changes
243
-
244
- - `Timeline` title can now be a Vnode too.
245
-
246
- v0.11.6 No breaking changes
247
-
248
- - `Select` control can now be disabled by adding the property `disabled: true` to the control's properties.
249
-
250
- v0.11.5 No breaking changes
251
-
252
- - `MapEditor` has an `onchange` callback to notify changes to the properties collection.
253
- - `MapEditor` allows you to set the column width (`keyClass`) for the key and value column (`keyValue`).
254
-
255
- v0.11.4 No breaking changes
256
-
257
- - FIX `CodeBlock` missed importing of `css`.
258
-
259
- v0.11.3 No breaking changes
260
-
261
- - FIX `Timeline`: Default date formatter did not add 1 to the months. See [here](https://www.w3schools.com/js/js_dates.asp).
262
- - FIX `MapEditor` when dealing with number inputs and the number was 0, it did not work properly.
263
- - FIX `NumberInput` when the number was 0, the label was not active (and overlaying the number).
264
-
265
- v0.11.2 No breaking changes
266
-
267
- - FIX Issue with `SecondaryContent` in `Collection` component: when no `href` was provided, it still created a `href=#!undefined` link.
268
-
269
- v0.11.1 No breaking changes
270
-
271
- - Improved generics of `Select` and `Dropdown` component
272
- - FIX Issue with `placeholder` in `Select` component: when no item was selected, it would not show the placeholder text.
273
-
274
- v0.11.0 New component, `Timeline`
275
-
276
- - Added a `Timeline` component to render vertical timelines.
277
- - `Collection` now accepts other parameters, e.g. styles.
278
- - 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).
279
- - Added documentation using `Typedoc`. It can be found [here](https://erikvullings.github.io/mithril-materialized/typedoc/index.html).
280
-
281
- v0.10.0 New component, `MapEditor`
282
-
283
- - Added a new component, `MapEditor`, to edit a map of key-value pairs.
284
- - `InputCheckbox` can now be disabled.
285
- - Attributes are better dealt with and no longer end up as unused attributes of elements.
286
- - Fixed a bug for `TextInput`, where sometimes the `active` class was not added even if the `input` element had a value.
287
-
288
- v0.9.10 Breaking changes
289
-
290
- - Deprecated the use of all `contentClass` properties in favour of the mithril convention `className`.
291
-
292
- v0.9.9 Breaking changes
293
-
294
- - `ModalPanel`: it's description (i.e. the main content area of the modal) can be a `Vnode`.
295
- - `Select` does not use `contentClass` anymore, but instead uses the regular mithril `className` (but not `class`, since this is a reserved keyword in TypeScript).
296
-
297
- v0.9.6 No breaking changes
298
-
299
- - For a `Collection` with secondary content, do not create a SPA route (with a #!) but leave the URL as is.
300
-
301
- v0.9.5 No breaking changes
302
-
303
- - FIX `Select` bug when numeric option IDs were used and ID === 0, option was never selected.
304
-
305
- v0.9.4 No breaking changes
306
-
307
- - FIX `Collection` without headers did no longer render.
308
-
309
- v0.9.3 No breaking changes
310
-
311
- - `Collection` with links can now also contain a header.
312
- - `Collection` with no items and only a header will now just render the header
313
-
314
- v0.9.0 Breaking changes
315
-
316
- - `Collapsible` is now correctly spelled (used to be `Collabsible`, oops).
317
- - Added `Collection`, to create a collection of items: supports basic, link and avatar collections.
318
-
319
- v0.8.3 No breaking changes
320
-
321
- - `FileInput` component can be disabled, and accepts file types.
322
-
323
- v0.8.1 No breaking changes
324
-
325
- - Closes issue #1: Select issue with id === 0
326
- - MaterialBox can set height, passes attributes to wrapped image element
327
-
328
- v0.8.0 No breaking changes
329
-
330
- - `FileInput` component can specify `class` property on the `div` wrapper (default `col s12`) and `contentClass` property on the file input element.
331
-
332
- v0.7.0 Breaking changes for Dropdown component.
333
-
334
- - New `FileInput` component to upload one or more files.
335
- - `Dropdown` uses similar items as `Select`, and uses `checkedId` to select the item.
336
- - `Dropdown` items can now use an icon and dividers.
337
- - `Dropdown` can now have a helper text option and an icon prefix.
338
-
339
- v0.6.4 Breaking changes, bug fix.
340
-
341
- - `Select` did not always return the proper id on selection changes with multiple elements.
342
-
343
- v0.6.3 No breaking changes, bug fix.
344
-
345
- - `Select` did not update dynamically when checkedId changed.
346
-
347
- v0.6.2 No breaking changes
348
-
349
- - `Select` can use `M.FormSelectOptions`.
350
-
351
- v0.6.1 No breaking changes
352
-
353
- - `Select` can have `disabled` options, and `id` is optional (in which case the label is used).
354
- - `Select` can use a prefix icon.
355
-
356
- v0.6.0 No breaking changes
357
-
358
- - `Inputs` can now use `onkeyup`, `onkeydown`, and `onkeypress` events. They also return the value.
359
- - Additionally, they can use `readOnly`, `pattern` and `autocomplete` (does not always seem to work).
360
-
361
- v0.5.0 No breaking changes
362
-
363
- - NEW: Pagination control
364
- - BUG FIX: `Input.onchange` would not fire if the input was cleared.
365
- - All options now derives from mithril's `Attributes`.
366
- - Using `FactoryComponent` type
367
-
368
- v0.4.4 No breaking changes
369
-
370
- - Do not pass attributes through, e.g. if you had a `m(FlatButton, { onupdate })`, the `onupdate` was passed through to the `HelperText` too.
371
-
372
- v0.4.3 No breaking changes
373
-
374
- - The validate method for inputs now also accepts the HTMLInputElement
375
- - Removed a few left-over `console.log` statements.
376
-
377
- v0.4.2 No breaking changes
378
-
379
- - Added `required` and `aria-required="true"` attributes when the `required` or `isMandatory` property are set.
380
-
381
- v0.4.1 No breaking changes
382
-
383
- - Updated all components to use the mithril `dom` attribute instead of performing a document query. This has two advantages: first of all, performance, since we do not need to query for an element we already have. Second, when implementing custom elements that have an `oncreate` function. Using document.query... will lead to no results.
384
-
385
- v0.4.0 No breaking changes
386
-
387
- - New components: MaterialBox, Collapsible or accordion, and Carousel
388
-
389
- v0.3.0 Breaking changes
390
-
391
- - Buttons no longer use the `ui` class to specify additional properties like `onclick`. Instead, you can leverage the mithril attributes directly. See the example, `button-page`.
392
- - `contentClass` has been removed in favour of the default mithril `class` or `className` attribute.
393
- - 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.
394
- - The `autofocus` attribute for inputs now also works on updates (by calling the element.focus() method).
395
- - The code has been split over multiple files, so it is easier to only import the components that you need.
396
-
397
- v0.2.2
398
-
399
- - Validate function can return a custom validation message. Also, it is called in `onupdate`, so the validation occurs also when you just attach the validate function conditionally.
400
-
401
- v0.2.1
402
-
403
- - Label field is optional for inputs.
404
- - Added autofocus function|property to input fields.
405
- - Added custom validation using the validate function|property to add valid/invalid label to an input.
406
- - Removed dependency on materialize-css (it is expected that it is imported via the main app).
407
-
408
- ## Usage instructions
409
-
410
- See the [documentation](https://erikvullings.github.io/mithril-materialized/index.html) for examples on how to use this library in your own application. Please note that the library does not include mithril, nor the materialize-css JavaScript or CSS, so you have to include them yourself, as documented.
411
-
412
- ## Build instructions
413
-
414
- 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.
415
-
416
- 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.
417
-
418
- ## CSS
419
-
420
- Although I've tried to limit the CSS adaptations to a minimum, I needed to tweak certain parts to make it look better. Here are the styles I've added.
421
-
422
- ```css
423
- /* For the switch */
424
- .clear,
425
- .clear-10,
426
- .clear-15 {
427
- clear: both;
428
- /* overflow: hidden; Précaution pour IE 7 */
429
- }
430
- .clear-10 {
431
- margin-bottom: 10px;
432
- }
433
- .clear-15 {
434
- margin-bottom: 15px;
435
- }
436
-
437
- span.mandatory {
438
- margin-left: 5px;
439
- color: red;
440
- }
441
-
442
- label+.switch {
443
- margin-top: 1rem;
444
- }
445
-
446
- /* For the color input */
447
- input[type='color']:not(.browser-default) {
448
- margin: 0px 0 8px 0;
449
- /** Copied from input[type=number] */
450
- background-color: transparent;
451
- border: none;
452
- border-bottom: 1px solid #9e9e9e;
453
- border-radius: 0;
454
- outline: none;
455
- height: 3rem;
456
- width: 100%;
457
- font-size: 16px;
458
- padding: 0;
459
- -webkit-box-shadow: none;
460
- box-shadow: none;
461
- -webkit-box-sizing: content-box;
462
- box-sizing: content-box;
463
- -webkit-transition: border 0.3s, -webkit-box-shadow 0.3s;
464
- transition: border 0.3s, -webkit-box-shadow 0.3s;
465
- transition: box-shadow 0.3s, border 0.3s;
466
- transition: box-shadow 0.3s, border 0.3s, -webkit-box-shadow 0.3s;
467
- }
468
-
469
- /* For the options' label */
470
- .input-field.options > label {
471
- top: -2.5rem;
472
- }
473
-
474
- /* For the code block */
475
- .codeblock {
476
- margin: 1.5rem 0 2.5rem 0;
477
- }
478
- .codeblock > div {
479
- margin-bottom: 1rem;
480
- }
481
- .codeblock > label {
482
- display: inline-block;
483
- }
484
-
485
- ```
1
+ # mithril-materialized
2
+
3
+ A [materialize-css](https://materializecss.com) library for the Mithril framework (tested with v2.0 and higher, but presumably, it should work with v1.1.6 too), making it easier to use a Materialize theme in your application. The main focus of this library is on creating Mithril components for the more complicated Materialize components.
4
+
5
+ Supported components:
6
+
7
+ - [Buttons](https://erikvullings.github.io/mithril-materialized/#!/buttons)
8
+ - Button
9
+ - FlatButton
10
+ - RoundButton
11
+ - SubmitButton
12
+ - FloatingActionButton
13
+ - [Inputs](https://erikvullings.github.io/mithril-materialized/#!/inputs)
14
+ - TextInput
15
+ - TextArea
16
+ - AutoComplete
17
+ - UrlInput
18
+ - EmailInput
19
+ - NumberInput
20
+ - ColorInput
21
+ - RangeInput
22
+ - Chips
23
+ - [Pickers](https://erikvullings.github.io/mithril-materialized/#!/pickers)
24
+ - DatePicker
25
+ - TimePicker
26
+ - [Selections](https://erikvullings.github.io/mithril-materialized/#!/selections)
27
+ - Select
28
+ - Options
29
+ - RadioButtons
30
+ - Switch
31
+ - Dropdown
32
+ - [Collections](https://erikvullings.github.io/mithril-materialized/#!/collections)
33
+ - Basic, Link and Avatar Collections
34
+ - Collapsible or accordion
35
+ - [Modals](https://erikvullings.github.io/mithril-materialized/#!/modals)
36
+ - ModalPanel
37
+ - [Miscellaneous](https://erikvullings.github.io/mithril-materialized/#!/misc)
38
+ - Tabs
39
+ - MaterialBox
40
+ - Carousel
41
+ - Pagination
42
+ - Parallax
43
+ - Additional
44
+ - Label
45
+ - HelperText
46
+ - Not from Materialize-CSS
47
+ - CodeBlock
48
+ - [Timeline](https://erikvullings.github.io/mithril-materialized/#!/timeline)
49
+ - [MapEditor](https://erikvullings.github.io/mithril-materialized/#!/map_editor)
50
+
51
+ ## Version history
52
+
53
+ v0.17.1: bug fix
54
+
55
+ - `Select` component also reacts when the `checkedId` property becomes undefined (previously, it would ignore it).
56
+
57
+ v0.17.0
58
+
59
+ - 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.
60
+
61
+ v0.16.3
62
+
63
+ - `NumberInput` adds support for the `step` attribute, so you can use the number up/down to represent floats too.
64
+
65
+ v0.16.2
66
+
67
+ - Updated dependencies, fixed library vulnerabilities
68
+
69
+ v0.16.1
70
+
71
+ - `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.
72
+
73
+ v0.16.0
74
+
75
+ - `Select` `disabled` status is computed dynamically in the view, not only in `oninit`.
76
+ - `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.
77
+
78
+ v0.15.4
79
+
80
+ - `Pagination` component simplified implementation.
81
+
82
+ v0.15.3
83
+
84
+ - FIX: `Pickers` destroy them `onremove`.
85
+
86
+ v0.15.2
87
+
88
+ - FIX: `Pagination` did not properly compute the go forward disabled/enabled state.
89
+
90
+ v0.15.1
91
+
92
+ - FIX: `Pagination` did not highlight current item when item index exceeded size limit. Also updated example with actual routes.
93
+
94
+ v0.15.0
95
+
96
+ - NEW: `FloatingActionButton` created.
97
+
98
+ v0.14.14
99
+
100
+ - FIX: `Kanban` triggering too many `onchange` messages.
101
+
102
+ v0.14.12
103
+
104
+ - FIX: `Select` when using `multiple` keeps the dropdown open, but re-initialize select when the options change.
105
+
106
+ v0.14.11
107
+
108
+ - FIX: `Kanban` did not trigger `onChange` when disabled, but with editable properties.
109
+
110
+ v0.14.10
111
+
112
+ - FIX: `Chips` did not initialize properly when `onChange` was not specified (e.g. when disabled).
113
+
114
+ v0.14.9
115
+
116
+ - NEW: `PasswordInput` component to enter passwords.
117
+
118
+ v0.14.8
119
+
120
+ - FIX: `Tabs` component selection did not work in Edge due to the way the `select` function was implemented in materialize-css.
121
+
122
+ v0.14.7
123
+
124
+ - FIX: `Select` when using `multiple` keeps the dropdown open, `dropdownOptions` and `classes` are passed on creation.
125
+ - `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.
126
+
127
+ v0.14.5
128
+
129
+ - FIX: `Options` and `Radios` no longer use `h6` element for labels, so they behave more like other labels.
130
+
131
+ v0.14.4
132
+
133
+ - FIX: `Options` and `RadioButtons` did not listen to the `disabled` property.
134
+
135
+ v0.14.3
136
+
137
+ - When using a placeholder in an `input` field, the label should be active.
138
+
139
+ v0.14.2
140
+
141
+ - `LinksCollection` sometimes created unwanted `href` attribute in links.
142
+
143
+ v0.14.1 Using Mithril v2
144
+
145
+ - Migrated backwards from Mithril v2.0.3 to v2.0.1 due to bugs in the released version.
146
+ - 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).
147
+
148
+ v0.14.0 Using Mithril v2
149
+
150
+ - Upgrading all dependencies
151
+ - `Pickers` now trigger `onchange` when closing.
152
+ - Replace all links `oncreate: m.route.link` with `m.route.Link`.
153
+
154
+ v0.13.15 Patch
155
+
156
+ - `Select` removed `console.warn` in library.
157
+ - Updated `npm` scripts.
158
+
159
+ v0.13.14 Enhancements
160
+
161
+ - `Dropdown`: displayed text is truncated, so it doesn't overflow the button.
162
+ - `Select` can receive options, e.g. `dropdownOptions: { container: document.body }` to display it properly in a `Modal`.
163
+ - `Modal` examples added with `Select` and `Dropdown` components.
164
+
165
+ v0.13.13 Bug fix related to mithril RC7
166
+
167
+ - FIX `Kanban` key usage and drag-n-drop behaviour
168
+
169
+ v0.13.12 Bug fix
170
+
171
+ - `Options` `checkboxClass` was not applied, so you could not align items properly.
172
+
173
+ v0.13.11 Enhancements
174
+
175
+ - `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).
176
+
177
+ v0.13.10 Enhancement
178
+
179
+ - Added IIFE and ESM output builds
180
+ - Refactoring the code slightly
181
+ - `Chips` now has a default `className: col s12`
182
+
183
+ v0.13.9 Enhancement
184
+
185
+ - `ModalPanel` buttons' `onclick` handler now also receives the event, so you can prevent mithril from redrawing.
186
+ - `ModalPanel` has a new handler, `onCreate` which can be used to receive the modal instance, so you can control it programmatically.
187
+
188
+ v0.13.8 Bug fix
189
+
190
+ - `Select`, checkedId is evaluated in the view instead of `oninit`.
191
+
192
+ v0.13.6 Minor updates
193
+
194
+ - `Dropdown`, `Kanban`, `TimePicker`, `DatePicker` can be disabled.
195
+
196
+ v0.13.5 Minor updates
197
+
198
+ - `Dropdown` id, if not supplied, caused confusion when multiple `Dropdowns` were used on one page.
199
+ - `Kanban` uses type information. New property, `editableIds`, which makes some properties also editable in the list view.
200
+
201
+ v0.13.0 Breaking changes
202
+
203
+ - `Select` component now maintains the checkedIds internally, i.e. they are only processed during `oninit`. This is to create consistent behaviour with the `Options` and `RadioButtons` components.
204
+ - `Select`, `Options`, `Dropdown` and `RadioButtons` are no longer of the generic type, since IDs can only be strings or numbers.
205
+ - `ISelectOption` is removed, and is replaced by `IInputOption`, making it easier to switch between a radios, select and options.
206
+ - `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.
207
+
208
+ NEW
209
+
210
+ - [Kanban](https://erikvullings.github.io/mithril-materialized/#!/kanban): new component to render an editable list of items. Supports drag-and-drop between lists too, essentially allowing you to create a Kanban list. Hence the name.
211
+ - `InputCheckbox`: label is optional
212
+ - `Options` and `RadioButtons` are more consistent with respect to look and feel.
213
+ - `Options` and `RadioButtons` support an `inline` property to align them horizontally.
214
+ - `Select`, `Options`, and `RadioButtons` all use `IInputOption` to specify their options. An item can be disabled now.
215
+
216
+ v0.13.0 No breaking changes
217
+
218
+ - `FileInput`: added `initialValue` to set the initial value more clearly, and added a clear button to remove the input.
219
+
220
+ v0.12.2 No breaking changes
221
+
222
+ - `Tabs`: added `contentClass` to add a class to the content.
223
+
224
+ v0.12.1 No breaking changes
225
+
226
+ - Simplified bundling after issues in `webpack`.
227
+
228
+ v0.12.0 No breaking changes
229
+
230
+ - `Tabs` component added, to show [tabs](https://erikvullings.github.io/mithril-materialized/#!/misc).
231
+
232
+ v0.11.11 No breaking changes
233
+
234
+ - Bug fix: `TextArea` did not invoke `onchange` when the input was cleared.
235
+ - Using Rollup as bundler, generating two bundles (ESM, regular JS).
236
+
237
+ v0.11.8 No breaking changes
238
+
239
+ - `Collection onclick` event was not registered properly.
240
+
241
+ v0.11.7 No breaking changes
242
+
243
+ - `Timeline` title can now be a Vnode too.
244
+
245
+ v0.11.6 No breaking changes
246
+
247
+ - `Select` control can now be disabled by adding the property `disabled: true` to the control's properties.
248
+
249
+ v0.11.5 No breaking changes
250
+
251
+ - `MapEditor` has an `onchange` callback to notify changes to the properties collection.
252
+ - `MapEditor` allows you to set the column width (`keyClass`) for the key and value column (`keyValue`).
253
+
254
+ v0.11.4 No breaking changes
255
+
256
+ - FIX `CodeBlock` missed importing of `css`.
257
+
258
+ v0.11.3 No breaking changes
259
+
260
+ - FIX `Timeline`: Default date formatter did not add 1 to the months. See [here](https://www.w3schools.com/js/js_dates.asp).
261
+ - FIX `MapEditor` when dealing with number inputs and the number was 0, it did not work properly.
262
+ - FIX `NumberInput` when the number was 0, the label was not active (and overlaying the number).
263
+
264
+ v0.11.2 No breaking changes
265
+
266
+ - FIX Issue with `SecondaryContent` in `Collection` component: when no `href` was provided, it still created a `href=#!undefined` link.
267
+
268
+ v0.11.1 No breaking changes
269
+
270
+ - Improved generics of `Select` and `Dropdown` component
271
+ - FIX Issue with `placeholder` in `Select` component: when no item was selected, it would not show the placeholder text.
272
+
273
+ v0.11.0 New component, `Timeline`
274
+
275
+ - Added a `Timeline` component to render vertical timelines.
276
+ - `Collection` now accepts other parameters, e.g. styles.
277
+ - 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).
278
+ - Added documentation using `Typedoc`. It can be found [here](https://erikvullings.github.io/mithril-materialized/typedoc/index.html).
279
+
280
+ v0.10.0 New component, `MapEditor`
281
+
282
+ - Added a new component, `MapEditor`, to edit a map of key-value pairs.
283
+ - `InputCheckbox` can now be disabled.
284
+ - Attributes are better dealt with and no longer end up as unused attributes of elements.
285
+ - Fixed a bug for `TextInput`, where sometimes the `active` class was not added even if the `input` element had a value.
286
+
287
+ v0.9.10 Breaking changes
288
+
289
+ - Deprecated the use of all `contentClass` properties in favour of the mithril convention `className`.
290
+
291
+ v0.9.9 Breaking changes
292
+
293
+ - `ModalPanel`: it's description (i.e. the main content area of the modal) can be a `Vnode`.
294
+ - `Select` does not use `contentClass` anymore, but instead uses the regular mithril `className` (but not `class`, since this is a reserved keyword in TypeScript).
295
+
296
+ v0.9.6 No breaking changes
297
+
298
+ - For a `Collection` with secondary content, do not create a SPA route (with a #!) but leave the URL as is.
299
+
300
+ v0.9.5 No breaking changes
301
+
302
+ - FIX `Select` bug when numeric option IDs were used and ID === 0, option was never selected.
303
+
304
+ v0.9.4 No breaking changes
305
+
306
+ - FIX `Collection` without headers did no longer render.
307
+
308
+ v0.9.3 No breaking changes
309
+
310
+ - `Collection` with links can now also contain a header.
311
+ - `Collection` with no items and only a header will now just render the header
312
+
313
+ v0.9.0 Breaking changes
314
+
315
+ - `Collapsible` is now correctly spelled (used to be `Collabsible`, oops).
316
+ - Added `Collection`, to create a collection of items: supports basic, link and avatar collections.
317
+
318
+ v0.8.3 No breaking changes
319
+
320
+ - `FileInput` component can be disabled, and accepts file types.
321
+
322
+ v0.8.1 No breaking changes
323
+
324
+ - Closes issue #1: Select issue with id === 0
325
+ - MaterialBox can set height, passes attributes to wrapped image element
326
+
327
+ v0.8.0 No breaking changes
328
+
329
+ - `FileInput` component can specify `class` property on the `div` wrapper (default `col s12`) and `contentClass` property on the file input element.
330
+
331
+ v0.7.0 Breaking changes for Dropdown component.
332
+
333
+ - New `FileInput` component to upload one or more files.
334
+ - `Dropdown` uses similar items as `Select`, and uses `checkedId` to select the item.
335
+ - `Dropdown` items can now use an icon and dividers.
336
+ - `Dropdown` can now have a helper text option and an icon prefix.
337
+
338
+ v0.6.4 Breaking changes, bug fix.
339
+
340
+ - `Select` did not always return the proper id on selection changes with multiple elements.
341
+
342
+ v0.6.3 No breaking changes, bug fix.
343
+
344
+ - `Select` did not update dynamically when checkedId changed.
345
+
346
+ v0.6.2 No breaking changes
347
+
348
+ - `Select` can use `M.FormSelectOptions`.
349
+
350
+ v0.6.1 No breaking changes
351
+
352
+ - `Select` can have `disabled` options, and `id` is optional (in which case the label is used).
353
+ - `Select` can use a prefix icon.
354
+
355
+ v0.6.0 No breaking changes
356
+
357
+ - `Inputs` can now use `onkeyup`, `onkeydown`, and `onkeypress` events. They also return the value.
358
+ - Additionally, they can use `readOnly`, `pattern` and `autocomplete` (does not always seem to work).
359
+
360
+ v0.5.0 No breaking changes
361
+
362
+ - NEW: Pagination control
363
+ - BUG FIX: `Input.onchange` would not fire if the input was cleared.
364
+ - All options now derives from mithril's `Attributes`.
365
+ - Using `FactoryComponent` type
366
+
367
+ v0.4.4 No breaking changes
368
+
369
+ - Do not pass attributes through, e.g. if you had a `m(FlatButton, { onupdate })`, the `onupdate` was passed through to the `HelperText` too.
370
+
371
+ v0.4.3 No breaking changes
372
+
373
+ - The validate method for inputs now also accepts the HTMLInputElement
374
+ - Removed a few left-over `console.log` statements.
375
+
376
+ v0.4.2 No breaking changes
377
+
378
+ - Added `required` and `aria-required="true"` attributes when the `required` or `isMandatory` property are set.
379
+
380
+ v0.4.1 No breaking changes
381
+
382
+ - Updated all components to use the mithril `dom` attribute instead of performing a document query. This has two advantages: first of all, performance, since we do not need to query for an element we already have. Second, when implementing custom elements that have an `oncreate` function. Using document.query... will lead to no results.
383
+
384
+ v0.4.0 No breaking changes
385
+
386
+ - New components: MaterialBox, Collapsible or accordion, and Carousel
387
+
388
+ v0.3.0 Breaking changes
389
+
390
+ - Buttons no longer use the `ui` class to specify additional properties like `onclick`. Instead, you can leverage the mithril attributes directly. See the example, `button-page`.
391
+ - `contentClass` has been removed in favour of the default mithril `class` or `className` attribute.
392
+ - 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.
393
+ - The `autofocus` attribute for inputs now also works on updates (by calling the element.focus() method).
394
+ - The code has been split over multiple files, so it is easier to only import the components that you need.
395
+
396
+ v0.2.2
397
+
398
+ - Validate function can return a custom validation message. Also, it is called in `onupdate`, so the validation occurs also when you just attach the validate function conditionally.
399
+
400
+ v0.2.1
401
+
402
+ - Label field is optional for inputs.
403
+ - Added autofocus function|property to input fields.
404
+ - Added custom validation using the validate function|property to add valid/invalid label to an input.
405
+ - Removed dependency on materialize-css (it is expected that it is imported via the main app).
406
+
407
+ ## Usage instructions
408
+
409
+ See the [documentation](https://erikvullings.github.io/mithril-materialized/index.html) for examples on how to use this library in your own application. Please note that the library does not include mithril, nor the materialize-css JavaScript or CSS, so you have to include them yourself, as documented.
410
+
411
+ ## Build instructions
412
+
413
+ 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.
414
+
415
+ 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.
416
+
417
+ ## CSS
418
+
419
+ Although I've tried to limit the CSS adaptations to a minimum, I needed to tweak certain parts to make it look better. Here are the styles I've added.
420
+
421
+ ```css
422
+ /* For the switch */
423
+ .clear,
424
+ .clear-10,
425
+ .clear-15 {
426
+ clear: both;
427
+ /* overflow: hidden; Précaution pour IE 7 */
428
+ }
429
+ .clear-10 {
430
+ margin-bottom: 10px;
431
+ }
432
+ .clear-15 {
433
+ margin-bottom: 15px;
434
+ }
435
+
436
+ span.mandatory {
437
+ margin-left: 5px;
438
+ color: red;
439
+ }
440
+
441
+ label+.switch {
442
+ margin-top: 1rem;
443
+ }
444
+
445
+ /* For the color input */
446
+ input[type='color']:not(.browser-default) {
447
+ margin: 0px 0 8px 0;
448
+ /** Copied from input[type=number] */
449
+ background-color: transparent;
450
+ border: none;
451
+ border-bottom: 1px solid #9e9e9e;
452
+ border-radius: 0;
453
+ outline: none;
454
+ height: 3rem;
455
+ width: 100%;
456
+ font-size: 16px;
457
+ padding: 0;
458
+ -webkit-box-shadow: none;
459
+ box-shadow: none;
460
+ -webkit-box-sizing: content-box;
461
+ box-sizing: content-box;
462
+ -webkit-transition: border 0.3s, -webkit-box-shadow 0.3s;
463
+ transition: border 0.3s, -webkit-box-shadow 0.3s;
464
+ transition: box-shadow 0.3s, border 0.3s;
465
+ transition: box-shadow 0.3s, border 0.3s, -webkit-box-shadow 0.3s;
466
+ }
467
+
468
+ /* For the options' label */
469
+ .input-field.options > label {
470
+ top: -2.5rem;
471
+ }
472
+
473
+ /* For the code block */
474
+ .codeblock {
475
+ margin: 1.5rem 0 2.5rem 0;
476
+ }
477
+ .codeblock > div {
478
+ margin-bottom: 1rem;
479
+ }
480
+ .codeblock > label {
481
+ display: inline-block;
482
+ }
483
+
484
+ ```