material-inspired-component-library 3.0.0 → 3.0.2
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 +2 -2
- package/components/appbar/index.scss +2 -2
- package/components/badge/index.scss +22 -7
- package/components/button/index.scss +2 -2
- package/components/card/README.md +9 -5
- package/components/card/index.scss +49 -22
- package/components/checkbox/README.md +9 -0
- package/components/dialog/index.scss +3 -3
- package/components/divider/README.md +3 -3
- package/components/divider/index.scss +20 -29
- package/components/iconbutton/index.scss +2 -2
- package/components/list/README.md +4 -4
- package/components/list/index.scss +5 -5
- package/components/navigationrail/index.scss +5 -3
- package/components/radio/README.md +13 -4
- package/components/radio/index.scss +6 -4
- package/components/select/README.md +28 -6
- package/components/select/index.scss +60 -11
- package/components/slider/index.scss +4 -4
- package/components/stepper/index.scss +85 -0
- package/components/stepper/index.ts +163 -0
- package/components/switch/README.md +26 -4
- package/components/switch/index.scss +24 -23
- package/components/textfield/index.scss +4 -9
- package/components/textfield/index.ts +71 -30
- package/dist/appbar.css +1 -1
- package/dist/badge.css +1 -1
- package/dist/bottomsheet.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/components/stepper/index.d.ts +5 -0
- package/dist/components/textfield/index.d.ts +3 -2
- package/dist/dialog.css +1 -1
- package/dist/divider.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/layout.css +1 -0
- package/dist/layout.js +1 -0
- package/dist/list.css +1 -1
- package/dist/menu.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/radio.css +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/stepper.css +1 -0
- package/dist/stepper.js +1 -0
- package/dist/switch.css +1 -1
- package/dist/textfield.css +1 -1
- package/docs/card.html +25 -7
- package/docs/checkbox.html +12 -16
- package/docs/divider.html +7 -1
- package/docs/index.html +14 -15
- package/docs/list.html +6 -6
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/navigationrail.html +2 -3
- package/docs/radio.html +13 -17
- package/docs/select.html +46 -6
- package/docs/switch.html +41 -26
- package/layout/index.scss +37 -29
- package/micl.ts +23 -27
- package/package.json +5 -1
- package/styles/shapes.scss +0 -2
- package/styles.scss +1 -0
- package/webpack.config.js +1 -1
package/micl.ts
CHANGED
|
@@ -25,17 +25,20 @@ import _list, { listSelector } from './components/list';
|
|
|
25
25
|
import _menu, { menuSelector } from './components/menu';
|
|
26
26
|
import _navigationrail, { navigationrailSelector } from './components/navigationrail';
|
|
27
27
|
import _slider, { sliderSelector } from './components/slider';
|
|
28
|
-
import
|
|
28
|
+
import _stepper, { stepperSelector } from './components/stepper';
|
|
29
|
+
import _textfield, { textfieldSelector, textareaSelector, selectSelector } from './components/textfield';
|
|
29
30
|
|
|
30
31
|
interface ComponentEntry<T extends HTMLElement> {
|
|
31
32
|
component: {
|
|
32
33
|
initialize?: (element: T) => void,
|
|
33
34
|
input? : (event: Event) => void,
|
|
35
|
+
invalid? : (event: Event) => void,
|
|
34
36
|
keydown? : (event: Event) => void,
|
|
35
37
|
cleanup? : (element: T) => void
|
|
36
38
|
};
|
|
37
39
|
type: new () => T;
|
|
38
40
|
}
|
|
41
|
+
type ComponentKey = keyof ComponentEntry<any>['component'];
|
|
39
42
|
|
|
40
43
|
export default (() =>
|
|
41
44
|
{
|
|
@@ -47,6 +50,7 @@ export default (() =>
|
|
|
47
50
|
[navigationrailSelector]: { component: _navigationrail, type: HTMLLabelElement },
|
|
48
51
|
[selectSelector] : { component: _textfield, type: HTMLSelectElement },
|
|
49
52
|
[sliderSelector] : { component: _slider, type: HTMLInputElement },
|
|
53
|
+
[stepperSelector] : { component: _stepper, type: HTMLElement },
|
|
50
54
|
[textareaSelector] : { component: _textfield, type: HTMLTextAreaElement },
|
|
51
55
|
[textfieldSelector] : { component: _textfield, type: HTMLInputElement }
|
|
52
56
|
};
|
|
@@ -108,6 +112,21 @@ export default (() =>
|
|
|
108
112
|
parent.querySelectorAll<HTMLElement>(selector).forEach(cleanupComponent);
|
|
109
113
|
};
|
|
110
114
|
|
|
115
|
+
const handleEvent = (event: Event): void =>
|
|
116
|
+
{
|
|
117
|
+
for (const [selector, { component, type }] of Object.entries(componentMap)) {
|
|
118
|
+
if (
|
|
119
|
+
(event.target as Element).matches(selector)
|
|
120
|
+
&& event.target instanceof type
|
|
121
|
+
&& ['input', 'invalid', 'keydown'].includes(event.type)
|
|
122
|
+
&& typeof component[event.type as ComponentKey] === 'function'
|
|
123
|
+
) {
|
|
124
|
+
component[event.type as ComponentKey]?.(event);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
111
130
|
const activate = () =>
|
|
112
131
|
{
|
|
113
132
|
const observer = new MutationObserver(mutations =>
|
|
@@ -142,32 +161,9 @@ export default (() =>
|
|
|
142
161
|
initializeComponents(document);
|
|
143
162
|
|
|
144
163
|
// Delegated Event Handlers
|
|
145
|
-
document.addEventListener('input',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
(event.target as Element).matches(selector)
|
|
150
|
-
&& event.target instanceof type
|
|
151
|
-
&& typeof component.input === 'function'
|
|
152
|
-
) {
|
|
153
|
-
component.input(event);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
document.addEventListener('keydown', event =>
|
|
159
|
-
{
|
|
160
|
-
for (const [selector, { component, type }] of Object.entries(componentMap)) {
|
|
161
|
-
if (
|
|
162
|
-
(event.target as Element).matches(selector)
|
|
163
|
-
&& event.target instanceof type
|
|
164
|
-
&& typeof component.keydown === 'function'
|
|
165
|
-
) {
|
|
166
|
-
component.keydown(event);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
164
|
+
document.addEventListener('input', handleEvent);
|
|
165
|
+
document.addEventListener('keydown', handleEvent);
|
|
166
|
+
document.addEventListener('invalid', handleEvent, true);
|
|
171
167
|
};
|
|
172
168
|
|
|
173
169
|
const loaded = () =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "material-inspired-component-library",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "The Material-Inspired Component Library (MICL) offers a collection of beautifully crafted components leveraging native HTML markup, designed to align with the Material Design 3 guidelines.",
|
|
5
5
|
"author": "MICL Hermana <micl.hermana@proton.me> (https://github.com/henkpb/micl)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"UI",
|
|
13
13
|
"UX",
|
|
14
14
|
"CSS",
|
|
15
|
+
"HTML",
|
|
15
16
|
"accordion",
|
|
17
|
+
"app bar",
|
|
16
18
|
"badge",
|
|
17
19
|
"bottomsheet",
|
|
18
20
|
"button",
|
|
@@ -21,10 +23,12 @@
|
|
|
21
23
|
"dialog",
|
|
22
24
|
"divider",
|
|
23
25
|
"iconbutton",
|
|
26
|
+
"layout",
|
|
24
27
|
"list",
|
|
25
28
|
"menu",
|
|
26
29
|
"navigation rail",
|
|
27
30
|
"radio button",
|
|
31
|
+
"select",
|
|
28
32
|
"sidesheet",
|
|
29
33
|
"slider",
|
|
30
34
|
"switch",
|
package/styles/shapes.scss
CHANGED
|
@@ -31,8 +31,6 @@ $md-sys-shape-corner-extra-extra-large: 48px;
|
|
|
31
31
|
$md-sys-shape-corner-full: 50%;
|
|
32
32
|
|
|
33
33
|
:root {
|
|
34
|
-
--md-sys-target-size: 48px;
|
|
35
|
-
|
|
36
34
|
--md-sys-shape-corner-none: #{$md-sys-shape-corner-none};
|
|
37
35
|
--md-sys-shape-corner-extra-small: #{$md-sys-shape-corner-extra-small};
|
|
38
36
|
--md-sys-shape-corner-small: #{$md-sys-shape-corner-small};
|
package/styles.scss
CHANGED
package/webpack.config.js
CHANGED
|
@@ -5,7 +5,7 @@ const miniCss = require('mini-css-extract-plugin');
|
|
|
5
5
|
const distDir = path.resolve(__dirname, 'dist');
|
|
6
6
|
const docsDir = path.resolve(__dirname, 'docs');
|
|
7
7
|
|
|
8
|
-
const scssFiles = glob.sync('./components/**/*.scss');
|
|
8
|
+
const scssFiles = glob.sync('{./layout/*.scss,./components/**/*.scss}');
|
|
9
9
|
const scssEntries = scssFiles.reduce((entries, filePath) => {
|
|
10
10
|
const componentName = path.dirname(filePath).split('\\').pop();
|
|
11
11
|
entries[componentName] = './' + filePath;
|