mithril-materialized 2.0.0-beta.7 → 2.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.css +5 -5
- package/dist/core.css +8 -8
- package/dist/forms.css +8 -8
- package/dist/index.css +31 -21
- package/dist/index.esm.js +27 -22
- package/dist/index.js +27 -22
- package/dist/index.min.css +2 -2
- package/dist/index.umd.js +27 -22
- package/dist/label.d.ts +2 -0
- package/dist/utilities.css +8 -8
- package/package.json +1 -1
- package/sass/components/_chips.scss +8 -8
- package/sass/components/_dropdown.scss +5 -5
- package/sass/components/_theme-variables.scss +18 -0
- package/sass/components/_timepicker.scss +1 -1
- package/sass/components/forms/_select.scss +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -170,9 +170,14 @@
|
|
|
170
170
|
const Label = () => {
|
|
171
171
|
return {
|
|
172
172
|
view: (_a) => {
|
|
173
|
-
var _b = _a.attrs, { label, id, isMandatory, isActive, className } = _b, params = __rest(_b, ["label", "id", "isMandatory", "isActive", "className"]);
|
|
173
|
+
var _b = _a.attrs, { label, id, isMandatory, isActive, className, initialValue } = _b, params = __rest(_b, ["label", "id", "isMandatory", "isActive", "className", "initialValue"]);
|
|
174
174
|
return label
|
|
175
|
-
? m('label', Object.assign(Object.assign({}, params), { className: [className, isActive ? 'active' : ''].filter(Boolean).join(' ').trim() || undefined, for: id
|
|
175
|
+
? m('label', Object.assign(Object.assign({}, params), { className: [className, isActive ? 'active' : ''].filter(Boolean).join(' ').trim() || undefined, for: id, oncreate: ({ dom }) => {
|
|
176
|
+
if (!initialValue)
|
|
177
|
+
return;
|
|
178
|
+
const labelEl = dom;
|
|
179
|
+
labelEl.classList.add('active');
|
|
180
|
+
} }), [m.trust(label), isMandatory ? m(Mandatory) : undefined])
|
|
176
181
|
: undefined;
|
|
177
182
|
},
|
|
178
183
|
};
|
|
@@ -1094,8 +1099,8 @@
|
|
|
1094
1099
|
maxHeight: '200px',
|
|
1095
1100
|
overflow: 'auto',
|
|
1096
1101
|
zIndex: 1000,
|
|
1097
|
-
backgroundColor: '#fff',
|
|
1098
|
-
boxShadow: '0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)',
|
|
1102
|
+
backgroundColor: 'var(--mm-surface-color, #fff)',
|
|
1103
|
+
boxShadow: '0 2px 2px 0 var(--mm-shadow-penumbra, rgba(0,0,0,0.14)), 0 3px 1px -2px var(--mm-shadow-umbra, rgba(0,0,0,0.12)), 0 1px 5px 0 var(--mm-shadow-ambient, rgba(0,0,0,0.2))',
|
|
1099
1104
|
},
|
|
1100
1105
|
}, state.autocompleteItems.map((item, index) => m('li.autocomplete-item', {
|
|
1101
1106
|
key: item.tag,
|
|
@@ -1103,7 +1108,8 @@
|
|
|
1103
1108
|
style: {
|
|
1104
1109
|
padding: '12px 16px',
|
|
1105
1110
|
cursor: 'pointer',
|
|
1106
|
-
backgroundColor: state.selectedAutocompleteIndex === index ? '#eee' : 'transparent',
|
|
1111
|
+
backgroundColor: state.selectedAutocompleteIndex === index ? 'var(--mm-border-color, #eee)' : 'transparent',
|
|
1112
|
+
color: 'var(--mm-text-primary, inherit)',
|
|
1107
1113
|
},
|
|
1108
1114
|
onmousedown: (e) => {
|
|
1109
1115
|
e.preventDefault();
|
|
@@ -2324,7 +2330,7 @@
|
|
|
2324
2330
|
}, oncreate: ({ dom }) => {
|
|
2325
2331
|
const textarea = (state.textarea = dom);
|
|
2326
2332
|
// Set initial value and height if provided
|
|
2327
|
-
if (initialValue
|
|
2333
|
+
if (initialValue) {
|
|
2328
2334
|
textarea.value = String(initialValue);
|
|
2329
2335
|
updateHeight(textarea);
|
|
2330
2336
|
// } else {
|
|
@@ -2367,7 +2373,7 @@
|
|
|
2367
2373
|
if (onchange && state.textarea) {
|
|
2368
2374
|
onchange(state.textarea.value);
|
|
2369
2375
|
}
|
|
2370
|
-
},
|
|
2376
|
+
}, onkeyup: onkeyup
|
|
2371
2377
|
? (ev) => {
|
|
2372
2378
|
onkeyup(ev, ev.target.value);
|
|
2373
2379
|
}
|
|
@@ -2384,7 +2390,8 @@
|
|
|
2384
2390
|
label,
|
|
2385
2391
|
id,
|
|
2386
2392
|
isMandatory,
|
|
2387
|
-
isActive: ((_a = state.textarea) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
2393
|
+
isActive: ((_a = state.textarea) === null || _a === void 0 ? void 0 : _a.value) || placeholder || state.active,
|
|
2394
|
+
initialValue: initialValue !== undefined,
|
|
2388
2395
|
}),
|
|
2389
2396
|
m(HelperText, {
|
|
2390
2397
|
helperText,
|
|
@@ -2442,6 +2449,9 @@
|
|
|
2442
2449
|
const { className = 'col s12', dataError, dataSuccess, helperText, iconName, id = state.id, initialValue, placeholder, isMandatory, label, maxLength, newRow, oninput, onchange, onkeydown, onkeypress, onkeyup, style, validate } = attrs, params = __rest(attrs, ["className", "dataError", "dataSuccess", "helperText", "iconName", "id", "initialValue", "placeholder", "isMandatory", "label", "maxLength", "newRow", "oninput", "onchange", "onkeydown", "onkeypress", "onkeyup", "style", "validate"]);
|
|
2443
2450
|
// const attributes = toAttrs(params);
|
|
2444
2451
|
const cn = [newRow ? 'clear' : '', defaultClass, className].filter(Boolean).join(' ').trim();
|
|
2452
|
+
const isActive = state.active || ((_a = state.inputElement) === null || _a === void 0 ? void 0 : _a.value) || placeholder || type === 'color' || type === 'range'
|
|
2453
|
+
? true
|
|
2454
|
+
: false;
|
|
2445
2455
|
return m('.input-field', { className: cn, style }, [
|
|
2446
2456
|
iconName ? m('i.material-icons.prefix', iconName) : undefined,
|
|
2447
2457
|
m('input.validate', Object.assign(Object.assign({}, params), { type, tabindex: 0, id,
|
|
@@ -2452,7 +2462,7 @@
|
|
|
2452
2462
|
input.focus();
|
|
2453
2463
|
}
|
|
2454
2464
|
// Set initial value if provided
|
|
2455
|
-
if (initialValue
|
|
2465
|
+
if (initialValue) {
|
|
2456
2466
|
input.value = String(initialValue);
|
|
2457
2467
|
}
|
|
2458
2468
|
// Update character count state for counter component
|
|
@@ -2556,20 +2566,13 @@
|
|
|
2556
2566
|
if (onchange && state.inputElement) {
|
|
2557
2567
|
onchange(getValue(state.inputElement));
|
|
2558
2568
|
}
|
|
2559
|
-
}
|
|
2569
|
+
} })),
|
|
2560
2570
|
m(Label, {
|
|
2561
2571
|
label,
|
|
2562
2572
|
id,
|
|
2563
2573
|
isMandatory,
|
|
2564
|
-
isActive
|
|
2565
|
-
|
|
2566
|
-
initialValue ||
|
|
2567
|
-
placeholder ||
|
|
2568
|
-
type === 'number' ||
|
|
2569
|
-
type === 'color' ||
|
|
2570
|
-
type === 'range'
|
|
2571
|
-
? true
|
|
2572
|
-
: false,
|
|
2574
|
+
isActive,
|
|
2575
|
+
initialValue: initialValue !== undefined,
|
|
2573
2576
|
}),
|
|
2574
2577
|
m(HelperText, {
|
|
2575
2578
|
helperText,
|
|
@@ -2642,7 +2645,7 @@
|
|
|
2642
2645
|
i.value = initialValue;
|
|
2643
2646
|
},
|
|
2644
2647
|
})),
|
|
2645
|
-
(canClear ||
|
|
2648
|
+
(canClear || (i === null || i === void 0 ? void 0 : i.value)) &&
|
|
2646
2649
|
m('a.waves-effect.waves-teal.btn-flat', {
|
|
2647
2650
|
style: {
|
|
2648
2651
|
float: 'right',
|
|
@@ -4718,7 +4721,7 @@
|
|
|
4718
4721
|
placeholder &&
|
|
4719
4722
|
m('span.placeholder', {
|
|
4720
4723
|
style: {
|
|
4721
|
-
color: '#9e9e9e',
|
|
4724
|
+
color: 'var(--mm-text-hint, #9e9e9e)',
|
|
4722
4725
|
flexGrow: 1,
|
|
4723
4726
|
padding: '8px 0',
|
|
4724
4727
|
},
|
|
@@ -4780,7 +4783,9 @@
|
|
|
4780
4783
|
fontSize: '0.875rem',
|
|
4781
4784
|
border: 'none',
|
|
4782
4785
|
padding: '8px 0',
|
|
4783
|
-
borderBottom: '1px solid #9e9e9e',
|
|
4786
|
+
borderBottom: '1px solid var(--mm-input-border, #9e9e9e)',
|
|
4787
|
+
backgroundColor: 'transparent',
|
|
4788
|
+
color: 'var(--mm-text-primary, inherit)',
|
|
4784
4789
|
},
|
|
4785
4790
|
}),
|
|
4786
4791
|
]),
|
package/dist/label.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface LabelAttrs extends Attributes {
|
|
|
9
9
|
isMandatory?: boolean;
|
|
10
10
|
/** Add the active class to the label */
|
|
11
11
|
isActive?: boolean | string;
|
|
12
|
+
/** Determines the initial value of its active state, only used during oncreate */
|
|
13
|
+
initialValue?: boolean;
|
|
12
14
|
}
|
|
13
15
|
/** Simple label element, used for most components. */
|
|
14
16
|
export declare const Label: FactoryComponent<LabelAttrs>;
|
package/dist/utilities.css
CHANGED
|
@@ -2199,18 +2199,18 @@ table span.badge {
|
|
|
2199
2199
|
height: 32px;
|
|
2200
2200
|
font-size: 13px;
|
|
2201
2201
|
font-weight: 500;
|
|
2202
|
-
color: rgba(0, 0, 0, 0.6);
|
|
2202
|
+
color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
|
|
2203
2203
|
line-height: 32px;
|
|
2204
2204
|
padding: 0 12px;
|
|
2205
2205
|
border-radius: 16px;
|
|
2206
|
-
background-color: #e4e4e4;
|
|
2206
|
+
background-color: var(--mm-chip-bg, #e4e4e4);
|
|
2207
2207
|
margin-bottom: 5px;
|
|
2208
2208
|
margin-right: 5px;
|
|
2209
2209
|
}
|
|
2210
2210
|
.chip:focus {
|
|
2211
2211
|
outline: none;
|
|
2212
|
-
background-color: #26a69a;
|
|
2213
|
-
color: #fff;
|
|
2212
|
+
background-color: var(--mm-primary-color, #26a69a);
|
|
2213
|
+
color: var(--mm-button-text, #fff);
|
|
2214
2214
|
}
|
|
2215
2215
|
.chip > img {
|
|
2216
2216
|
float: left;
|
|
@@ -2229,7 +2229,7 @@ table span.badge {
|
|
|
2229
2229
|
|
|
2230
2230
|
.chips {
|
|
2231
2231
|
border: none;
|
|
2232
|
-
border-bottom: 1px solid #9e9e9e;
|
|
2232
|
+
border-bottom: 1px solid var(--mm-input-border, #9e9e9e);
|
|
2233
2233
|
box-shadow: none;
|
|
2234
2234
|
margin: 0 0 8px 0;
|
|
2235
2235
|
min-height: 45px;
|
|
@@ -2237,8 +2237,8 @@ table span.badge {
|
|
|
2237
2237
|
transition: all 0.3s;
|
|
2238
2238
|
}
|
|
2239
2239
|
.chips.focus {
|
|
2240
|
-
border-bottom: 1px solid #26a69a;
|
|
2241
|
-
box-shadow: 0 1px 0 0 #26a69a;
|
|
2240
|
+
border-bottom: 1px solid var(--mm-primary-color, #26a69a);
|
|
2241
|
+
box-shadow: 0 1px 0 0 var(--mm-primary-color, #26a69a);
|
|
2242
2242
|
}
|
|
2243
2243
|
.chips:hover {
|
|
2244
2244
|
cursor: text;
|
|
@@ -2246,7 +2246,7 @@ table span.badge {
|
|
|
2246
2246
|
.chips .input {
|
|
2247
2247
|
background: none;
|
|
2248
2248
|
border: 0;
|
|
2249
|
-
color: rgba(0, 0, 0, 0.6);
|
|
2249
|
+
color: var(--mm-text-primary, rgba(0, 0, 0, 0.6));
|
|
2250
2250
|
display: inline-block;
|
|
2251
2251
|
font-size: 16px;
|
|
2252
2252
|
height: 3rem;
|
package/package.json
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
.chip {
|
|
4
4
|
&:focus {
|
|
5
5
|
outline: none;
|
|
6
|
-
background-color: variables.$chip-selected-color;
|
|
7
|
-
color: #fff;
|
|
6
|
+
background-color: var(--mm-primary-color, variables.$chip-selected-color);
|
|
7
|
+
color: var(--mm-button-text, #fff);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
display: inline-block;
|
|
11
11
|
height: 32px;
|
|
12
12
|
font-size: 13px;
|
|
13
13
|
font-weight: 500;
|
|
14
|
-
color: rgba(0,0,0,.6);
|
|
14
|
+
color: var(--mm-text-secondary, rgba(0,0,0,.6));
|
|
15
15
|
line-height: 32px;
|
|
16
16
|
padding: 0 12px;
|
|
17
17
|
border-radius: 16px;
|
|
18
|
-
background-color: variables.$chip-bg-color;
|
|
18
|
+
background-color: var(--mm-chip-bg, variables.$chip-bg-color);
|
|
19
19
|
margin-bottom: variables.$chip-margin;
|
|
20
20
|
margin-right: variables.$chip-margin;
|
|
21
21
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
.chips {
|
|
40
40
|
border: none;
|
|
41
|
-
border-bottom: 1px solid variables.$chip-border-color;
|
|
41
|
+
border-bottom: 1px solid var(--mm-input-border, variables.$chip-border-color);
|
|
42
42
|
box-shadow: none;
|
|
43
43
|
margin: variables.$input-margin;
|
|
44
44
|
min-height: 45px;
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
transition: all .3s;
|
|
47
47
|
|
|
48
48
|
&.focus {
|
|
49
|
-
border-bottom: 1px solid variables.$chip-selected-color;
|
|
50
|
-
box-shadow: 0 1px 0 0 variables.$chip-selected-color;
|
|
49
|
+
border-bottom: 1px solid var(--mm-primary-color, variables.$chip-selected-color);
|
|
50
|
+
box-shadow: 0 1px 0 0 var(--mm-primary-color, variables.$chip-selected-color);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&:hover {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
.input {
|
|
58
58
|
background: none;
|
|
59
59
|
border: 0;
|
|
60
|
-
color: rgba(0,0,0,.6);
|
|
60
|
+
color: var(--mm-text-primary, rgba(0,0,0,.6));
|
|
61
61
|
display: inline-block;
|
|
62
62
|
font-size: variables.$input-font-size;
|
|
63
63
|
height: variables.$input-height;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@extend .z-depth-1 !optional;
|
|
13
|
-
background-color: variables.$dropdown-bg-color;
|
|
13
|
+
background-color: var(--mm-surface-color, variables.$dropdown-bg-color);
|
|
14
14
|
margin: 0;
|
|
15
15
|
display: none;
|
|
16
16
|
min-width: 100px;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
li {
|
|
27
27
|
&:hover, &.active {
|
|
28
|
-
background-color: variables.$dropdown-hover-bg-color;
|
|
28
|
+
background-color: var(--mm-dropdown-hover, variables.$dropdown-hover-bg-color);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
&:focus {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
& > a, & > span {
|
|
41
41
|
font-size: 16px;
|
|
42
|
-
color: variables.$dropdown-color;
|
|
42
|
+
color: var(--mm-text-primary, variables.$dropdown-color);
|
|
43
43
|
display: block;
|
|
44
44
|
line-height: 22px;
|
|
45
45
|
padding: math.div((variables.$dropdown-item-height - 22px), 2) 16px;
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
clear: both;
|
|
65
|
-
color: variables.$off-black;
|
|
65
|
+
color: var(--mm-text-primary, variables.$off-black);
|
|
66
66
|
cursor: pointer;
|
|
67
67
|
min-height: variables.$dropdown-item-height;
|
|
68
68
|
line-height: 1.5rem;
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
body.keyboard-focused {
|
|
75
75
|
.dropdown-content li:focus {
|
|
76
|
-
background-color: color.adjust(variables.$dropdown-hover-bg-color, $lightness: -8%);
|
|
76
|
+
background-color: var(--mm-dropdown-focus, color.adjust(variables.$dropdown-hover-bg-color, $lightness: -8%));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -48,6 +48,15 @@
|
|
|
48
48
|
|
|
49
49
|
// Shadow colors
|
|
50
50
|
--mm-shadow-color: rgba(0, 0, 0, 0.16);
|
|
51
|
+
|
|
52
|
+
// Chip colors
|
|
53
|
+
--mm-chip-bg: #e4e4e4;
|
|
54
|
+
--mm-chip-text: var(--mm-text-secondary);
|
|
55
|
+
|
|
56
|
+
// Dropdown colors
|
|
57
|
+
--mm-dropdown-hover: #eee;
|
|
58
|
+
--mm-dropdown-focus: #ddd;
|
|
59
|
+
--mm-dropdown-selected: #e3f2fd;
|
|
51
60
|
--mm-shadow-umbra: rgba(0, 0, 0, 0.2);
|
|
52
61
|
--mm-shadow-penumbra: rgba(0, 0, 0, 0.14);
|
|
53
62
|
--mm-shadow-ambient: rgba(0, 0, 0, 0.12);
|
|
@@ -123,6 +132,15 @@ body {
|
|
|
123
132
|
--mm-shadow-penumbra: rgba(0, 0, 0, 0.36);
|
|
124
133
|
--mm-shadow-ambient: rgba(0, 0, 0, 0.3);
|
|
125
134
|
|
|
135
|
+
// Chip colors
|
|
136
|
+
--mm-chip-bg: #424242;
|
|
137
|
+
--mm-chip-text: var(--mm-text-secondary);
|
|
138
|
+
|
|
139
|
+
// Dropdown colors
|
|
140
|
+
--mm-dropdown-hover: #444;
|
|
141
|
+
--mm-dropdown-focus: #555;
|
|
142
|
+
--mm-dropdown-selected: #1e3a8a;
|
|
143
|
+
|
|
126
144
|
// Switch colors (dark theme)
|
|
127
145
|
--mm-switch-checked-track: rgba(128, 203, 196, 0.3);
|
|
128
146
|
--mm-switch-checked-thumb: #80cbc4;
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
|
|
180
180
|
.timepicker-tick.active,
|
|
181
181
|
.timepicker-tick:hover {
|
|
182
|
-
background-color:
|
|
182
|
+
background-color: color.scale(variables.$secondary-color, $alpha: -75%);
|
|
183
183
|
}
|
|
184
184
|
.timepicker-dial {
|
|
185
185
|
transition: transform 350ms, opacity 350ms;
|
|
@@ -86,7 +86,7 @@ select {
|
|
|
86
86
|
bottom: 0;
|
|
87
87
|
margin: auto 0;
|
|
88
88
|
z-index: 0;
|
|
89
|
-
fill: rgba(0,0,0,.87);
|
|
89
|
+
fill: var(--mm-text-primary, rgba(0,0,0,.87));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
& + label {
|
|
@@ -134,24 +134,24 @@ select:disabled {
|
|
|
134
134
|
.select-dropdown li.disabled,
|
|
135
135
|
.select-dropdown li.disabled > span,
|
|
136
136
|
.select-dropdown li.optgroup {
|
|
137
|
-
color: variables.$select-disabled-color;
|
|
137
|
+
color: var(--mm-text-disabled, variables.$select-disabled-color);
|
|
138
138
|
background-color: transparent;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
body.keyboard-focused {
|
|
142
142
|
.select-dropdown.dropdown-content li:focus {
|
|
143
|
-
background-color: variables.$select-option-focus;
|
|
143
|
+
background-color: var(--mm-dropdown-focus, variables.$select-option-focus);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
.select-dropdown.dropdown-content {
|
|
148
148
|
li {
|
|
149
149
|
&:hover {
|
|
150
|
-
background-color: variables.$select-option-hover;
|
|
150
|
+
background-color: var(--mm-dropdown-hover, variables.$select-option-hover);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
&.selected {
|
|
154
|
-
background-color: variables.$select-option-selected;
|
|
154
|
+
background-color: var(--mm-dropdown-selected, variables.$select-option-selected);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -177,14 +177,14 @@ body.keyboard-focused {
|
|
|
177
177
|
|
|
178
178
|
// Optgroup styles
|
|
179
179
|
.select-dropdown li.optgroup {
|
|
180
|
-
border-top: 1px solid variables.$dropdown-hover-bg-color;
|
|
180
|
+
border-top: 1px solid var(--mm-border-color, variables.$dropdown-hover-bg-color);
|
|
181
181
|
|
|
182
182
|
&.selected > span {
|
|
183
|
-
color: rgba(0, 0, 0, .7);
|
|
183
|
+
color: var(--mm-text-secondary, rgba(0, 0, 0, .7));
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
& > span {
|
|
187
|
-
color: rgba(0, 0, 0, .4);
|
|
187
|
+
color: var(--mm-text-hint, rgba(0, 0, 0, .4));
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
& ~ li.optgroup-option {
|