mithril-materialized 2.0.0-beta.5 → 2.0.0-beta.6

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.
@@ -0,0 +1,58 @@
1
+ import { FactoryComponent, Attributes, Vnode } from 'mithril';
2
+ export interface WizardStep {
3
+ /** Unique identifier for the step */
4
+ id?: string;
5
+ /** Title of the step */
6
+ title: string;
7
+ /** Optional subtitle or description */
8
+ subtitle?: string;
9
+ /** Icon for the step (material icons) */
10
+ icon?: string;
11
+ /** Whether this step is optional */
12
+ optional?: boolean;
13
+ /** Whether this step is disabled */
14
+ disabled?: boolean;
15
+ /** Custom validation function */
16
+ validate?: () => boolean | Promise<boolean>;
17
+ /** Content to render for this step - function that returns vnode(s) */
18
+ vnode: () => Vnode<any, any> | Vnode<any, any>[];
19
+ }
20
+ export interface WizardAttrs extends Attributes {
21
+ /** Array of wizard steps */
22
+ steps: WizardStep[];
23
+ /** Current active step index */
24
+ currentStep?: number;
25
+ /** Callback when step changes */
26
+ onStepChange?: (stepIndex: number, stepId: string) => void;
27
+ /** Callback when wizard is completed */
28
+ onComplete?: () => void;
29
+ /** Whether to show step numbers */
30
+ showStepNumbers?: boolean;
31
+ /** Whether navigation is linear (cannot skip steps) */
32
+ linear?: boolean;
33
+ /** Custom class for the wizard container */
34
+ className?: string;
35
+ /** Whether to show navigation buttons */
36
+ showNavigation?: boolean;
37
+ /** Custom labels for navigation buttons */
38
+ labels?: {
39
+ next?: string;
40
+ previous?: string;
41
+ complete?: string;
42
+ skip?: string;
43
+ optional?: string;
44
+ };
45
+ /** Orientation of the stepper */
46
+ orientation?: 'horizontal' | 'vertical';
47
+ /** Whether to allow clicking on step headers to navigate */
48
+ allowHeaderNavigation?: boolean;
49
+ }
50
+ /**
51
+ * Wizard/Stepper Component
52
+ * A multi-step interface for guiding users through a process
53
+ */
54
+ export declare const Wizard: FactoryComponent<WizardAttrs>;
55
+ /**
56
+ * Simple linear stepper for forms
57
+ */
58
+ export declare const Stepper: FactoryComponent<Pick<WizardAttrs, 'steps' | 'currentStep' | 'onStepChange' | 'className'>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mithril-materialized",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -20,7 +20,14 @@
20
20
  "./umd": "./dist/index.umd.js",
21
21
  "./index.css": "./dist/index.css",
22
22
  "./index.min.css": "./dist/index.min.css",
23
- "./sass/*": "./sass/*"
23
+ "./core.css": "./dist/core.css",
24
+ "./components.css": "./dist/components.css",
25
+ "./forms.css": "./dist/forms.css",
26
+ "./pickers.css": "./dist/pickers.css",
27
+ "./advanced.css": "./dist/advanced.css",
28
+ "./utilities.css": "./dist/utilities.css",
29
+ "./sass/*": "./sass/*",
30
+ "./src/*": "./src/*"
24
31
  },
25
32
  "sideEffects": false,
26
33
  "files": [
@@ -29,7 +36,8 @@
29
36
  ],
30
37
  "scripts": {
31
38
  "build": "rollup -c rollup.config.mjs && npm run build:css-min",
32
- "build:css-min": "sass --no-source-map --style=compressed ./src/index.scss ./dist/index.min.css",
39
+ "build:css-min": "sass --no-source-map --style=compressed ./src/index.scss ./dist/index.min.css && npm run build:css-modules",
40
+ "build:css-modules": "sass --no-source-map ./src/core.scss ./dist/core.css && sass --no-source-map ./src/components.scss ./dist/components.css && sass --no-source-map ./src/forms.scss ./dist/forms.css && sass --no-source-map ./src/pickers.scss ./dist/pickers.css && sass --no-source-map ./src/advanced.scss ./dist/advanced.css && sass --no-source-map ./src/utilities.scss ./dist/utilities.css",
33
41
  "dev": "rollup -c rollup.config.mjs -w",
34
42
  "start": "npm run dev",
35
43
  "clean": "rimraf dist node_modules/.cache",
@@ -70,7 +78,6 @@
70
78
  "@testing-library/jest-dom": "^6.6.4",
71
79
  "@testing-library/user-event": "^14.6.1",
72
80
  "@types/jest": "^30.0.0",
73
- "@types/materialize-css": "^1.0.14",
74
81
  "@types/mithril": "^2.2.7",
75
82
  "autoprefixer": "^10.4.21",
76
83
  "express": "^5.1.0",
@@ -78,7 +85,6 @@
78
85
  "jest": "^30.0.5",
79
86
  "jest-environment-jsdom": "^30.0.5",
80
87
  "js-yaml": "^4.1.0",
81
- "materialize-css": "^1.0.0",
82
88
  "rimraf": "^6.0.1",
83
89
  "rollup": "^4.46.2",
84
90
  "rollup-plugin-postcss": "^4.0.2",
@@ -0,0 +1,248 @@
1
+ // Breadcrumb Component Styles
2
+
3
+ .breadcrumb {
4
+ padding: 1rem 0;
5
+ margin-bottom: 1rem;
6
+ background: transparent;
7
+ display: flex;
8
+ align-items: center;
9
+ min-height: 2rem;
10
+
11
+ .breadcrumb-list {
12
+ display: flex;
13
+ align-items: center;
14
+ flex-wrap: wrap;
15
+ list-style: none;
16
+ padding: 0;
17
+ margin: 0;
18
+ gap: 0.5rem;
19
+ width: 100%;
20
+ }
21
+ }
22
+
23
+ .breadcrumb-item {
24
+ display: flex;
25
+ align-items: center;
26
+ font-size: 0.875rem;
27
+ line-height: 1.5;
28
+
29
+ &.active {
30
+ .breadcrumb-text {
31
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
32
+ font-weight: 500;
33
+ }
34
+ }
35
+
36
+ &.disabled {
37
+ .breadcrumb-text {
38
+ color: var(--mm-text-disabled, rgba(0, 0, 0, 0.38));
39
+ cursor: not-allowed;
40
+ }
41
+ }
42
+
43
+ &.breadcrumb-ellipsis {
44
+ .breadcrumb-text {
45
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
46
+ font-weight: 400;
47
+ user-select: none;
48
+ }
49
+ }
50
+ }
51
+
52
+ .breadcrumb-link {
53
+ display: flex;
54
+ align-items: center;
55
+ color: var(--mm-primary-color, #26a69a);
56
+ text-decoration: none;
57
+ transition: color 0.2s ease;
58
+ padding: 0.25rem 0.5rem;
59
+ border-radius: 4px;
60
+
61
+ &:hover {
62
+ color: var(--mm-primary-color-dark, #00695c);
63
+ text-decoration: underline;
64
+ background: var(--mm-primary-color-light, rgba(38, 166, 154, 0.1));
65
+ }
66
+
67
+ &:focus {
68
+ outline: 2px solid var(--mm-primary-color, #26a69a);
69
+ outline-offset: 2px;
70
+ border-radius: 2px;
71
+ }
72
+ }
73
+
74
+ .breadcrumb-text {
75
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
76
+ font-weight: 400;
77
+ line-height: inherit;
78
+ overflow: hidden;
79
+ text-overflow: ellipsis;
80
+ white-space: nowrap;
81
+ max-width: 200px;
82
+ }
83
+
84
+ .breadcrumb-icon {
85
+ font-size: 1.125rem;
86
+ width: 18px;
87
+ height: 18px;
88
+ margin-right: 0.5rem;
89
+ flex-shrink: 0;
90
+ color: inherit;
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ }
95
+
96
+ .breadcrumb-separator {
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
101
+ user-select: none;
102
+ height: 18px;
103
+
104
+ .material-icons {
105
+ font-size: 1.125rem;
106
+ width: 18px;
107
+ height: 18px;
108
+ line-height: 18px;
109
+ }
110
+ }
111
+
112
+ // Variants
113
+ .breadcrumb.compact {
114
+ padding: 0.25rem 0;
115
+ margin-bottom: 0.5rem;
116
+
117
+ .breadcrumb-item {
118
+ font-size: 0.75rem;
119
+ }
120
+
121
+ .breadcrumb-icon {
122
+ font-size: 0.875rem;
123
+ width: 14px;
124
+ height: 14px;
125
+ }
126
+
127
+ .breadcrumb-separator .material-icons {
128
+ font-size: 0.875rem;
129
+ width: 14px;
130
+ height: 14px;
131
+ }
132
+ }
133
+
134
+ .breadcrumb.large {
135
+ padding: 0.75rem 0;
136
+ margin-bottom: 1.5rem;
137
+
138
+ .breadcrumb-item {
139
+ font-size: 1rem;
140
+ }
141
+
142
+ .breadcrumb-icon {
143
+ font-size: 1.125rem;
144
+ width: 18px;
145
+ height: 18px;
146
+ }
147
+
148
+ .breadcrumb-separator .material-icons {
149
+ font-size: 1.125rem;
150
+ width: 18px;
151
+ height: 18px;
152
+ }
153
+ }
154
+
155
+ // Responsive behavior
156
+ @media (max-width: 600px) {
157
+ .breadcrumb {
158
+ .breadcrumb-list {
159
+ gap: 0.125rem;
160
+ }
161
+
162
+ .breadcrumb-item {
163
+ font-size: 0.75rem;
164
+ }
165
+
166
+ .breadcrumb-text {
167
+ max-width: 120px;
168
+ }
169
+
170
+ .breadcrumb-icon {
171
+ font-size: 0.875rem;
172
+ width: 14px;
173
+ height: 14px;
174
+ margin-right: 0.125rem;
175
+ }
176
+
177
+ .breadcrumb-separator .material-icons {
178
+ font-size: 0.875rem;
179
+ width: 14px;
180
+ height: 14px;
181
+ }
182
+ }
183
+ }
184
+
185
+ // Dark theme adjustments
186
+ [data-theme="dark"] {
187
+ .breadcrumb-link {
188
+ color: var(--mm-primary-color, #80cbc4);
189
+
190
+ &:hover {
191
+ color: var(--mm-primary-color-light, #b2dfdb);
192
+ }
193
+ }
194
+ }
195
+
196
+ // Alternative separator styles
197
+ .breadcrumb.slash-separator {
198
+ .breadcrumb-separator {
199
+ font-family: monospace;
200
+ font-size: 0.875rem;
201
+
202
+ .material-icons {
203
+ display: none;
204
+ }
205
+
206
+ &::before {
207
+ content: '/';
208
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
209
+ }
210
+ }
211
+ }
212
+
213
+ .breadcrumb.dot-separator {
214
+ .breadcrumb-separator {
215
+ .material-icons {
216
+ display: none;
217
+ }
218
+
219
+ &::before {
220
+ content: '•';
221
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
222
+ font-size: 1rem;
223
+ }
224
+ }
225
+ }
226
+
227
+ // Accessibility improvements
228
+ .breadcrumb {
229
+ nav[aria-label]:not([aria-label=""]) & {
230
+ // Breadcrumb is already in a nav with aria-label
231
+ }
232
+
233
+ &:not([aria-label]) {
234
+ aria-label: "Breadcrumb navigation";
235
+ }
236
+ }
237
+
238
+ .breadcrumb-link {
239
+ &[aria-current="page"] {
240
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
241
+ text-decoration: none;
242
+ font-weight: 500;
243
+
244
+ &:hover {
245
+ text-decoration: none;
246
+ }
247
+ }
248
+ }
@@ -279,7 +279,7 @@ button.btn-floating {
279
279
  .btn-flat {
280
280
  box-shadow: none;
281
281
  background-color: transparent;
282
- color: variables.$button-flat-color;
282
+ color: var(--mm-button-flat-text, variables.$button-flat-color);
283
283
  cursor: pointer;
284
284
  transition: background-color .2s;
285
285
  &:focus,
@@ -287,12 +287,12 @@ button.btn-floating {
287
287
  box-shadow: none;
288
288
  }
289
289
  &:focus {
290
- background-color: rgba(0, 0, 0, .1);
290
+ background-color: var(--mm-border-color, rgba(0, 0, 0, .1));
291
291
  }
292
292
  &.disabled,
293
293
  &.btn-flat[disabled] {
294
294
  background-color: transparent !important;
295
- color: variables.$button-flat-disabled-color !important;
295
+ color: var(--mm-text-disabled, variables.$button-flat-disabled-color) !important;
296
296
  cursor: default;
297
297
  }
298
298
  }
@@ -2,9 +2,9 @@
2
2
  @use "global";
3
3
 
4
4
  .collapsible {
5
- border-top: 1px solid variables.$collapsible-border-color;
6
- border-right: 1px solid variables.$collapsible-border-color;
7
- border-left: 1px solid variables.$collapsible-border-color;
5
+ border-top: 1px solid var(--mm-border-color, variables.$collapsible-border-color);
6
+ border-right: 1px solid var(--mm-border-color, variables.$collapsible-border-color);
7
+ border-left: 1px solid var(--mm-border-color, variables.$collapsible-border-color);
8
8
  margin: variables.$element-top-margin 0 variables.$element-bottom-margin 0;
9
9
  @extend .z-depth-1 !optional;
10
10
  }
@@ -19,8 +19,7 @@
19
19
  -webkit-tap-highlight-color: transparent;
20
20
  line-height: 1.5;
21
21
  padding: 1rem;
22
- background-color: variables.$collapsible-header-color;
23
- border-bottom: 1px solid variables.$collapsible-border-color;
22
+ border-bottom: 1px solid var(--mm-border-color, variables.$collapsible-border-color);
24
23
 
25
24
  i {
26
25
  width: 2rem;
@@ -31,12 +30,12 @@
31
30
  }
32
31
  }
33
32
  .keyboard-focused .collapsible-header:focus {
34
- background-color: #eee;
33
+ background-color: var(--mm-border-color, rgba(0, 0, 0, 0.05));
35
34
  }
36
35
 
37
36
  .collapsible-body {
38
37
  display: none;
39
- border-bottom: 1px solid variables.$collapsible-border-color;
38
+ border-bottom: 1px solid var(--mm-border-color, variables.$collapsible-border-color);
40
39
  box-sizing: border-box;
41
40
  padding: 2rem;
42
41
  }
@@ -65,7 +64,8 @@
65
64
 
66
65
  .collapsible-body {
67
66
  border: 0;
68
- background-color: variables.$collapsible-header-color;
67
+ background-color: var(--mm-surface-color, variables.$collapsible-header-color);
68
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
69
69
 
70
70
  li a {
71
71
  padding: 0 (7.5px + variables.$sidenav-padding)
@@ -11,6 +11,8 @@
11
11
  flex-direction: column;
12
12
  padding: 0;
13
13
  overflow: visible;
14
+ background-color: var(--mm-surface-color, #ffffff);
15
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
14
16
  }
15
17
 
16
18
  .datepicker-controls {
@@ -47,7 +49,7 @@
47
49
  cursor: pointer;
48
50
  width: 16px;
49
51
  height: 16px;
50
- fill: rgba(0, 0, 0, 0.54);
52
+ fill: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
51
53
  }
52
54
 
53
55
  .dropdown-content {
@@ -55,10 +57,10 @@
55
57
  top: 100%;
56
58
  left: 0;
57
59
  right: 0;
58
- background-color: white;
59
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
60
+ background-color: var(--mm-surface-color, white);
61
+ box-shadow: 0 4px 20px var(--mm-shadow-color, rgba(0, 0, 0, 0.3));
60
62
  z-index: 20000;
61
- border: 1px solid #ddd;
63
+ border: 1px solid var(--mm-border-color, #ddd);
62
64
  border-radius: 2px;
63
65
  display: block;
64
66
  opacity: 1;
@@ -70,11 +72,11 @@
70
72
  transition: background-color 0.2s;
71
73
 
72
74
  &:hover {
73
- background-color: #f5f5f5;
75
+ background-color: var(--mm-border-color, #f5f5f5);
74
76
  }
75
77
 
76
78
  &.selected {
77
- background-color: #f5f5f5;
79
+ background-color: var(--mm-border-color, #f5f5f5);
78
80
  }
79
81
  }
80
82
  }
@@ -160,7 +162,7 @@
160
162
  text-align: center;
161
163
 
162
164
  &.datepicker-week-header {
163
- color: rgba(0, 0, 0, 0.38);
165
+ color: var(--mm-text-hint, rgba(0, 0, 0, 0.38));
164
166
  font-size: 0.8rem;
165
167
  font-weight: 600;
166
168
  width: 30px;
@@ -174,27 +176,27 @@
174
176
 
175
177
  abbr {
176
178
  text-decoration: none;
177
- color: rgba(0, 0, 0, 0.54);
179
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
178
180
  }
179
181
 
180
182
  td {
181
183
  &.is-today {
182
- color: #26a69a;
184
+ color: var(--mm-primary-color, #26a69a);
183
185
  }
184
186
 
185
187
  &.is-selected {
186
- background-color: #26a69a;
187
- color: #fff;
188
+ background-color: var(--mm-primary-color, #26a69a);
189
+ color: var(--mm-button-text, #fff);
188
190
  }
189
191
 
190
192
  &.is-outside-current-month,
191
193
  &.is-disabled {
192
- color: rgba(0, 0, 0, 0.3);
194
+ color: var(--mm-text-disabled, rgba(0, 0, 0, 0.3));
193
195
  pointer-events: none;
194
196
  }
195
197
 
196
198
  &.datepicker-week-number {
197
- color: rgba(0, 0, 0, 0.38);
199
+ color: var(--mm-text-hint, rgba(0, 0, 0, 0.38));
198
200
  font-size: 0.8rem;
199
201
  font-weight: 600;
200
202
  text-align: center;
@@ -202,8 +204,8 @@
202
204
  border-radius: 0;
203
205
  width: 30px;
204
206
  padding: 5px 2px;
205
- background-color: rgba(0, 0, 0, 0.02);
206
- border-right: 1px solid rgba(0, 0, 0, 0.05);
207
+ background-color: var(--mm-border-color, rgba(0, 0, 0, 0.02));
208
+ border-right: 1px solid var(--mm-border-color, rgba(0, 0, 0, 0.05));
207
209
  }
208
210
 
209
211
  border-radius: 50%;