mithril-materialized 1.4.2 → 2.0.0-beta.10

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.
Files changed (103) hide show
  1. package/README.md +286 -306
  2. package/dist/advanced.css +1888 -0
  3. package/dist/autocomplete.d.ts +12 -4
  4. package/dist/breadcrumb.d.ts +53 -0
  5. package/dist/button.d.ts +10 -10
  6. package/dist/carousel.d.ts +26 -7
  7. package/dist/chip.d.ts +2 -2
  8. package/dist/code-block.d.ts +2 -3
  9. package/dist/collapsible.d.ts +12 -7
  10. package/dist/collection.d.ts +8 -8
  11. package/dist/components.css +2310 -0
  12. package/dist/core.css +3402 -0
  13. package/dist/datepicker.d.ts +66 -0
  14. package/dist/dropdown.d.ts +5 -5
  15. package/dist/file-upload.d.ts +34 -0
  16. package/dist/floating-action-button.d.ts +9 -5
  17. package/dist/forms.css +2284 -0
  18. package/dist/icon.d.ts +2 -2
  19. package/dist/index.css +9284 -2
  20. package/dist/index.d.ts +13 -3
  21. package/dist/index.esm.js +6188 -2
  22. package/dist/index.js +6263 -2
  23. package/dist/index.min.css +8 -0
  24. package/dist/index.umd.js +6267 -2
  25. package/dist/input-options.d.ts +3 -1
  26. package/dist/input.d.ts +17 -12
  27. package/dist/label.d.ts +6 -5
  28. package/dist/material-box.d.ts +22 -4
  29. package/dist/material-icon.d.ts +14 -0
  30. package/dist/modal.d.ts +23 -7
  31. package/dist/option.d.ts +12 -11
  32. package/dist/pagination.d.ts +5 -9
  33. package/dist/parallax.d.ts +8 -6
  34. package/dist/pickers.css +487 -0
  35. package/dist/pushpin.d.ts +32 -0
  36. package/dist/radio.d.ts +10 -6
  37. package/dist/select.d.ts +5 -5
  38. package/dist/sidenav.d.ts +76 -0
  39. package/dist/switch.d.ts +4 -5
  40. package/dist/tabs.d.ts +18 -7
  41. package/dist/theme-switcher.d.ts +49 -0
  42. package/dist/timepicker.d.ts +42 -0
  43. package/dist/toast.d.ts +45 -0
  44. package/dist/tooltip.d.ts +59 -0
  45. package/dist/utilities.css +3197 -0
  46. package/dist/utils.d.ts +17 -0
  47. package/dist/wizard.d.ts +58 -0
  48. package/package.json +47 -14
  49. package/sass/components/_badges.scss +59 -0
  50. package/sass/components/_breadcrumb.scss +248 -0
  51. package/sass/components/_buttons.scss +327 -0
  52. package/sass/components/_cards.scss +197 -0
  53. package/sass/components/_carousel.scss +92 -0
  54. package/sass/components/_chips.scss +92 -0
  55. package/sass/components/_collapsible.scss +94 -0
  56. package/sass/components/_color-classes.scss +34 -0
  57. package/sass/components/_color-variables.scss +371 -0
  58. package/sass/components/_datepicker.scss +282 -0
  59. package/sass/components/_dropdown.scss +90 -0
  60. package/sass/components/_file-upload.scss +228 -0
  61. package/sass/components/_global.scss +777 -0
  62. package/sass/components/_grid.scss +160 -0
  63. package/sass/components/_icons-material-design.scss +5 -0
  64. package/sass/components/_materialbox.scss +43 -0
  65. package/sass/components/_modal.scss +100 -0
  66. package/sass/components/_navbar.scss +219 -0
  67. package/sass/components/_normalize.scss +447 -0
  68. package/sass/components/_preloader.scss +336 -0
  69. package/sass/components/_pulse.scss +34 -0
  70. package/sass/components/_sidenav.scss +370 -0
  71. package/sass/components/_slider.scss +94 -0
  72. package/sass/components/_table_of_contents.scss +36 -0
  73. package/sass/components/_tabs.scss +103 -0
  74. package/sass/components/_tapTarget.scss +105 -0
  75. package/sass/components/_theme-switcher.scss +120 -0
  76. package/sass/components/_theme-variables.scss +205 -0
  77. package/sass/components/_timepicker.scss +262 -0
  78. package/sass/components/_toast.scss +61 -0
  79. package/sass/components/_tooltip.scss +32 -0
  80. package/sass/components/_transitions.scss +13 -0
  81. package/sass/components/_typography.scss +61 -0
  82. package/sass/components/_variables.scss +352 -0
  83. package/sass/components/_waves.scss +114 -0
  84. package/sass/components/_wizard.scss +416 -0
  85. package/sass/components/forms/_checkboxes.scss +203 -0
  86. package/sass/components/forms/_file-input.scss +50 -0
  87. package/sass/components/forms/_form-groups.scss +28 -0
  88. package/sass/components/forms/_forms.scss +24 -0
  89. package/sass/components/forms/_input-fields.scss +383 -0
  90. package/sass/components/forms/_radio-buttons.scss +118 -0
  91. package/sass/components/forms/_range.scss +164 -0
  92. package/sass/components/forms/_select.scss +193 -0
  93. package/sass/components/forms/_switches.scss +92 -0
  94. package/sass/materialize.scss +48 -0
  95. package/dist/index.css.map +0 -1
  96. package/dist/index.esm.js.map +0 -1
  97. package/dist/index.js.map +0 -1
  98. package/dist/index.modern.js +0 -2
  99. package/dist/index.modern.js.map +0 -1
  100. package/dist/index.umd.js.map +0 -1
  101. package/dist/map-editor.d.ts +0 -63
  102. package/dist/pickers.d.ts +0 -6
  103. package/dist/timeline.d.ts +0 -24
package/dist/utils.d.ts CHANGED
@@ -24,3 +24,20 @@ export declare const isNumeric: (n: string | number) => boolean;
24
24
  * @returns
25
25
  */
26
26
  export declare const padLeft: (n: string | number, width?: number, z?: string) => string;
27
+ export declare const getDropdownStyles: (inputRef?: HTMLElement | null, overlap?: boolean, options?: {
28
+ /** ID property of the selected item */
29
+ id?: string | number;
30
+ /** Label to show in the dropdown */
31
+ label?: string;
32
+ /** Optional group */
33
+ group?: string;
34
+ /** Can we select the item */
35
+ disabled?: boolean;
36
+ /** Add a divider */
37
+ divider?: boolean;
38
+ }[], isDropDown?: boolean) => any;
39
+ /**
40
+ * Generate a range of numbers from a to and including b, i.e. [a, b]
41
+ * @example: console.log(range(5, 10)); // [5, 6, 7, 8, 9, 10]
42
+ */
43
+ export declare const range: (a: number, b: number) => number[];
@@ -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": "1.4.2",
3
+ "version": "2.0.0-beta.10",
4
4
  "description": "A materialize library for mithril.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -11,28 +11,49 @@
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.modern.js",
14
+ "import": "./dist/index.esm.js",
15
15
  "require": "./dist/index.js",
16
- "default": "./dist/index.modern.js"
16
+ "default": "./dist/index.esm.js"
17
17
  },
18
- "./modern": "./dist/index.modern.js",
18
+ "./modern": "./dist/index.esm.js",
19
19
  "./esm": "./dist/index.esm.js",
20
20
  "./umd": "./dist/index.umd.js",
21
- "./index.css": "./dist/index.css"
21
+ "./index.css": "./dist/index.css",
22
+ "./index.min.css": "./dist/index.min.css",
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/*"
22
31
  },
23
32
  "sideEffects": false,
24
33
  "files": [
25
- "dist"
34
+ "dist",
35
+ "sass"
26
36
  ],
27
37
  "scripts": {
28
- "build": "microbundle build ./src/index.ts --external mithril,materialize-css",
29
- "dev": "microbundle watch ./src/index.ts --external mithril,materialize-css",
38
+ "build": "rollup -c rollup.config.mjs && npm run build:css-min",
39
+ "build:css-min": "sass --no-source-map --style=compressed --no-charset ./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",
41
+ "dev": "rollup -c rollup.config.mjs -w",
30
42
  "start": "npm run dev",
31
43
  "clean": "rimraf dist node_modules/.cache",
44
+ "test": "jest",
45
+ "test:watch": "jest --watch",
46
+ "test:coverage": "jest --coverage",
47
+ "test:ui": "jest --watch --verbose",
48
+ "test:server": "node test-server.js",
49
+ "test:visual": "playwright test",
50
+ "test:visual:ui": "playwright test --ui",
51
+ "test:all": "npm run test && npm run test:visual",
32
52
  "link:old": "pnpm link",
33
53
  "typedoc": "typedoc --out ../../docs/typedoc src",
34
54
  "build:domain": "npm run clean && npm run build && typedoc --out ../../docs/typedoc src",
35
55
  "dry-run": "npm publish --dry-run",
56
+ "sass:watch": "sass --watch ./sass/materialize.scss ./dist/index.css",
36
57
  "patch-release": "npm run clean && npm run build && npm version patch --force -m \"Patch release\" && npm publish && git push --follow-tags",
37
58
  "minor-release": "npm run clean && npm run build && npm version minor --force -m \"Minor release\" && npm publish && git push --follow-tags",
38
59
  "major-release": "npm run clean && npm run build && npm version major --force -m \"Major release\" && npm publish && git push --follow-tags"
@@ -48,17 +69,29 @@
48
69
  "author": "Erik Vullings <erik.vullings@gmail.com> (http://www.tno.nl)",
49
70
  "license": "MIT",
50
71
  "dependencies": {
51
- "materialize-css": "^1.0.0",
52
- "mithril": "^2.3.0"
72
+ "mithril": "^2.3.3"
53
73
  },
54
74
  "devDependencies": {
55
- "@types/materialize-css": "^1.0.14",
75
+ "@playwright/test": "^1.54.2",
76
+ "@rollup/plugin-typescript": "^12.1.4",
77
+ "@testing-library/dom": "^10.4.1",
78
+ "@testing-library/jest-dom": "^6.6.4",
79
+ "@testing-library/user-event": "^14.6.1",
80
+ "@types/jest": "^30.0.0",
56
81
  "@types/mithril": "^2.2.7",
82
+ "autoprefixer": "^10.4.21",
83
+ "express": "^5.1.0",
84
+ "identity-obj-proxy": "^3.0.0",
85
+ "jest": "^30.0.5",
86
+ "jest-environment-jsdom": "^30.0.5",
57
87
  "js-yaml": "^4.1.0",
58
- "microbundle": "^0.15.1",
59
88
  "rimraf": "^6.0.1",
89
+ "rollup": "^4.46.2",
90
+ "rollup-plugin-postcss": "^4.0.2",
91
+ "sass": "^1.90.0",
92
+ "ts-jest": "^29.4.1",
60
93
  "tslib": "^2.8.1",
61
- "typedoc": "^0.28.4",
62
- "typescript": "^5.8.3"
94
+ "typedoc": "^0.28.9",
95
+ "typescript": "^5.9.2"
63
96
  }
64
97
  }
@@ -0,0 +1,59 @@
1
+ @use "color-variables";
2
+ @use 'sass:math';
3
+ @use "variables";
4
+
5
+ // Badges
6
+ span.badge {
7
+ min-width: 3rem;
8
+ padding: 0 6px;
9
+ margin-left: 14px;
10
+ text-align: center;
11
+ font-size: 1rem;
12
+ line-height: variables.$badge-height;
13
+ height: variables.$badge-height;
14
+ color: color-variables.color('grey', 'darken-1');
15
+ float: right;
16
+ box-sizing: border-box;
17
+
18
+ &.new {
19
+ font-weight: 300;
20
+ font-size: 0.8rem;
21
+ color: #fff;
22
+ background-color: variables.$badge-bg-color;
23
+ border-radius: 2px;
24
+ }
25
+ &.new:after {
26
+ content: " new";
27
+ }
28
+
29
+ &[data-badge-caption]::after {
30
+ content: " " attr(data-badge-caption);
31
+ }
32
+ }
33
+
34
+ // Special cases
35
+ nav ul a span.badge {
36
+ display: inline-block;
37
+ float: none;
38
+ margin-left: 4px;
39
+ line-height: variables.$badge-height;
40
+ height: variables.$badge-height;
41
+ -webkit-font-smoothing: auto;
42
+ }
43
+
44
+ // Line height centering
45
+ .collection-item span.badge {
46
+ margin-top: calc(#{math.div(variables.$collection-line-height, 2)} - #{math.div(variables.$badge-height, 2)});
47
+ }
48
+ .collapsible span.badge {
49
+ margin-left: auto;
50
+ }
51
+ .sidenav span.badge {
52
+ margin-top: calc(#{math.div(variables.$sidenav-line-height, 2)} - #{math.div(variables.$badge-height, 2)});
53
+ }
54
+
55
+ table span.badge {
56
+ display: inline-block;
57
+ float: none;
58
+ margin-left: auto;
59
+ }
@@ -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
+ }