mithril-materialized 2.0.0-beta.7 → 2.0.0-beta.8

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/index.umd.js CHANGED
@@ -1094,8 +1094,8 @@
1094
1094
  maxHeight: '200px',
1095
1095
  overflow: 'auto',
1096
1096
  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)',
1097
+ backgroundColor: 'var(--mm-surface-color, #fff)',
1098
+ 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
1099
  },
1100
1100
  }, state.autocompleteItems.map((item, index) => m('li.autocomplete-item', {
1101
1101
  key: item.tag,
@@ -1103,7 +1103,8 @@
1103
1103
  style: {
1104
1104
  padding: '12px 16px',
1105
1105
  cursor: 'pointer',
1106
- backgroundColor: state.selectedAutocompleteIndex === index ? '#eee' : 'transparent',
1106
+ backgroundColor: state.selectedAutocompleteIndex === index ? 'var(--mm-border-color, #eee)' : 'transparent',
1107
+ color: 'var(--mm-text-primary, inherit)',
1107
1108
  },
1108
1109
  onmousedown: (e) => {
1109
1110
  e.preventDefault();
@@ -2324,7 +2325,7 @@
2324
2325
  }, oncreate: ({ dom }) => {
2325
2326
  const textarea = (state.textarea = dom);
2326
2327
  // Set initial value and height if provided
2327
- if (initialValue !== undefined) {
2328
+ if (initialValue) {
2328
2329
  textarea.value = String(initialValue);
2329
2330
  updateHeight(textarea);
2330
2331
  // } else {
@@ -2367,7 +2368,7 @@
2367
2368
  if (onchange && state.textarea) {
2368
2369
  onchange(state.textarea.value);
2369
2370
  }
2370
- }, value: initialValue, onkeyup: onkeyup
2371
+ }, onkeyup: onkeyup
2371
2372
  ? (ev) => {
2372
2373
  onkeyup(ev, ev.target.value);
2373
2374
  }
@@ -2384,7 +2385,7 @@
2384
2385
  label,
2385
2386
  id,
2386
2387
  isMandatory,
2387
- isActive: ((_a = state.textarea) === null || _a === void 0 ? void 0 : _a.value) || initialValue || placeholder || state.active,
2388
+ isActive: ((_a = state.textarea) === null || _a === void 0 ? void 0 : _a.value) || placeholder || state.active,
2388
2389
  }),
2389
2390
  m(HelperText, {
2390
2391
  helperText,
@@ -2452,7 +2453,7 @@
2452
2453
  input.focus();
2453
2454
  }
2454
2455
  // Set initial value if provided
2455
- if (initialValue !== undefined) {
2456
+ if (initialValue) {
2456
2457
  input.value = String(initialValue);
2457
2458
  }
2458
2459
  // Update character count state for counter component
@@ -2556,14 +2557,13 @@
2556
2557
  if (onchange && state.inputElement) {
2557
2558
  onchange(getValue(state.inputElement));
2558
2559
  }
2559
- }, value: initialValue })),
2560
+ } })),
2560
2561
  m(Label, {
2561
2562
  label,
2562
2563
  id,
2563
2564
  isMandatory,
2564
2565
  isActive: state.active ||
2565
2566
  ((_a = state.inputElement) === null || _a === void 0 ? void 0 : _a.value) ||
2566
- initialValue ||
2567
2567
  placeholder ||
2568
2568
  type === 'number' ||
2569
2569
  type === 'color' ||
@@ -2642,7 +2642,7 @@
2642
2642
  i.value = initialValue;
2643
2643
  },
2644
2644
  })),
2645
- (canClear || initialValue) &&
2645
+ (canClear || (i === null || i === void 0 ? void 0 : i.value)) &&
2646
2646
  m('a.waves-effect.waves-teal.btn-flat', {
2647
2647
  style: {
2648
2648
  float: 'right',
@@ -4718,7 +4718,7 @@
4718
4718
  placeholder &&
4719
4719
  m('span.placeholder', {
4720
4720
  style: {
4721
- color: '#9e9e9e',
4721
+ color: 'var(--mm-text-hint, #9e9e9e)',
4722
4722
  flexGrow: 1,
4723
4723
  padding: '8px 0',
4724
4724
  },
@@ -4780,7 +4780,9 @@
4780
4780
  fontSize: '0.875rem',
4781
4781
  border: 'none',
4782
4782
  padding: '8px 0',
4783
- borderBottom: '1px solid #9e9e9e',
4783
+ borderBottom: '1px solid var(--mm-input-border, #9e9e9e)',
4784
+ backgroundColor: 'transparent',
4785
+ color: 'var(--mm-text-primary, inherit)',
4784
4786
  },
4785
4787
  }),
4786
4788
  ]),
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mithril-materialized",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.8",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -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: transparentize(variables.$secondary-color, .75);
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 {