kmaterialize 2.0.0 → 2.3.3-1.0.0
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/LICENSE +21 -21
- package/README.md +55 -91
- package/components/appbar/_navbar.old.scss +223 -0
- package/components/appbar/appbar.css +235 -0
- package/components/appbar/appbar.mjs +54 -0
- package/components/appbar/appbar.test.mjs +9 -0
- package/components/atomic/atomic.mjs +19 -0
- package/components/atomic/component.mjs +67 -0
- package/components/badge/_badges.scss +75 -0
- package/components/badge/badge.mjs +11 -0
- package/components/breadcrumb/_breadcrumb.scss +27 -0
- package/components/button/_buttons.scss +352 -0
- package/components/button/button.mjs +11 -0
- package/components/button/buttons.stories.ts +150 -0
- package/components/button/buttons.ts +282 -0
- package/components/button/examples.iso.js +18 -0
- package/components/button/fabSpec.js +65 -0
- package/components/button/test-button.mjs +16 -0
- package/components/card/_cards.scss +229 -0
- package/components/card/card.mjs +10 -0
- package/components/card/cards.ts +185 -0
- package/components/card/cardsSpec.js +269 -0
- package/components/carousel/_carousel.scss +93 -0
- package/components/carousel/_slider.scss +119 -0
- package/components/carousel/carousel.ts +693 -0
- package/components/carousel/carouselSpec.js +61 -0
- package/components/carousel/slider.ts +431 -0
- package/components/carousel/sliderSpec.js +99 -0
- package/components/checkbox/_checkboxes.scss +281 -0
- package/components/checkbox/checkbox.mdx +24 -0
- package/components/checkbox/checkbox.stories.ts +120 -0
- package/components/chip/chip.mjs +37 -0
- package/components/chip/chip.test.mjs +10 -0
- package/components/chip/chips.css +126 -0
- package/components/chip/chips.mdx +33 -0
- package/components/chip/chips.ts +440 -0
- package/components/chip/chipsSpec.js +165 -0
- package/components/chip/readme.md +323 -0
- package/components/collapsible/_collapsible.scss +82 -0
- package/components/collapsible/collapsible.ts +230 -0
- package/components/collapsible/collapsibleSpec.js +240 -0
- package/components/datepicker/_datepicker.scss +268 -0
- package/components/datepicker/datepicker.ts +1450 -0
- package/components/datepicker/datepickerSpec.js +162 -0
- package/components/dialog/_materialbox.scss +42 -0
- package/components/dialog/_modal.scss +79 -0
- package/components/dialog/materialbox.ts +446 -0
- package/components/dialog/materialboxSpec.js +37 -0
- package/components/dialog/modal.ts +111 -0
- package/components/dialog/modalSpec.js +83 -0
- package/components/dialog/readme.md +5 -0
- package/components/divider/readme.md +15 -0
- package/components/dropdown/_dropdown.scss +83 -0
- package/components/dropdown/dropdown.ts +653 -0
- package/components/dropdown/dropdownSpec.js +108 -0
- package/components/list/_collection.scss +114 -0
- package/components/list/_list.scss +6 -0
- package/components/list/list.mjs +58 -0
- package/components/list/list.test.mjs +16 -0
- package/components/loading/loading.mjs +26 -0
- package/components/loading/loading.test.mjs +10 -0
- package/components/navigation-bar/_old +582 -0
- package/components/navigation-bar/navigation-bar.mdx +20 -0
- package/components/navigation-bar/navigation-bar.stories.ts +39 -0
- package/components/navigation-drawer/_sidenav.scss +247 -0
- package/components/navigation-drawer/sidenav.ts +546 -0
- package/components/navigation-drawer/sidenavSpec.js +124 -0
- package/components/pagination/_pagination.scss +47 -0
- package/components/progress/_preloader.scss +416 -0
- package/components/radio-button/_radio-buttons.scss +112 -0
- package/components/radio-button/radio-buttons.mdx +28 -0
- package/components/radio-button/radio-buttons.stories.ts +51 -0
- package/components/search/autocomplete.ts +620 -0
- package/components/search/autocompleteSpec.js +321 -0
- package/components/slider/_range.scss +157 -0
- package/components/slider/range.ts +216 -0
- package/components/snackbar/_toast.scss +68 -0
- package/components/snackbar/toastSpec.js +132 -0
- package/components/snackbar/toasts.ts +312 -0
- package/components/switch/_switches.scss +121 -0
- package/components/tabs/_tabs.scss +171 -0
- package/components/tabs/tabs.mjs +31 -0
- package/components/tabs/tabs.ts +358 -0
- package/components/tabs/tabsSpec.js +180 -0
- package/components/textfield/_file-input.scss +41 -0
- package/components/textfield/_input-fields.scss +368 -0
- package/components/textfield/_select.scss +104 -0
- package/components/textfield/formfields.css +311 -0
- package/components/textfield/forms.ts +182 -0
- package/components/textfield/formsSpec.js +142 -0
- package/components/textfield/select.ts +472 -0
- package/components/textfield/selectSpec.js +390 -0
- package/components/textfield/textfield.mjs +29 -0
- package/components/textfield/textfield.test.mjs +10 -0
- package/components/timepicker/_timepicker.scss +362 -0
- package/components/timepicker/timepicker.ts +905 -0
- package/components/tooltip/_tooltip.scss +40 -0
- package/components/tooltip/tooltip.ts +380 -0
- package/components/tooltip/tooltipSpec.js +145 -0
- package/dist/css/materialize.colors.min.css +6 -0
- package/dist/css/materialize.css +7578 -6326
- package/dist/css/materialize.min.css +6 -13
- package/dist/css/materialize.min.css.map +1 -0
- package/dist/js/materialize.cjs.js +8410 -0
- package/dist/js/materialize.d.ts +2625 -0
- package/dist/js/materialize.js +8415 -12374
- package/dist/js/materialize.min.js +6 -6
- package/dist/js/materialize.mjs +8382 -0
- package/package.json +82 -47
- package/sass/_colors.scss +417 -0
- package/sass/_global.scss +490 -0
- package/sass/_grid.scss +172 -0
- package/sass/_table_of_contents.scss +28 -0
- package/sass/_tapTarget.scss +102 -0
- package/sass/_typography.scss +58 -0
- package/sass/_variables.scss +56 -0
- package/sass/materialize.scss +51 -0
- package/sass/mixins.module.scss +168 -0
- package/extras/noUiSlider/nouislider.css +0 -406
- package/extras/noUiSlider/nouislider.js +0 -2147
- package/extras/noUiSlider/nouislider.min.js +0 -1
- package/js/anime.min.js +0 -34
- package/js/autocomplete.js +0 -448
- package/js/buttons.js +0 -354
- package/js/cards.js +0 -40
- package/js/carousel.js +0 -717
- package/js/cash.js +0 -960
- package/js/characterCounter.js +0 -136
- package/js/chips.js +0 -481
- package/js/collapsible.js +0 -275
- package/js/component.js +0 -44
- package/js/datepicker.js +0 -975
- package/js/dropdown.js +0 -635
- package/js/forms.js +0 -275
- package/js/global.js +0 -444
- package/js/materialbox.js +0 -453
- package/js/modal.js +0 -382
- package/js/parallax.js +0 -138
- package/js/pushpin.js +0 -148
- package/js/range.js +0 -263
- package/js/scrollspy.js +0 -295
- package/js/select.js +0 -450
- package/js/sidenav.js +0 -580
- package/js/slider.js +0 -359
- package/js/tabs.js +0 -402
- package/js/tapTarget.js +0 -314
- package/js/timepicker.js +0 -647
- package/js/toasts.js +0 -310
- package/js/tooltip.js +0 -303
- package/js/waves.js +0 -335
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
describe('Tabs Plugin', () => {
|
|
2
|
+
const fixture = `<div class="row">
|
|
3
|
+
<div class="col s12">
|
|
4
|
+
<ul class="tabs normal">
|
|
5
|
+
<li class="tab col s3"><a href="#test1">Test 1</a></li>
|
|
6
|
+
<li class="tab col s3"><a class="active" href="#test2">Test 2</a></li>
|
|
7
|
+
<li class="tab col s3 disabled"><a href="#test3">Disabled Tab</a></li>
|
|
8
|
+
<li class="tab col s3"><a href="#test4">Test 4</a></li>
|
|
9
|
+
<li class="tab col s3"><a href="#test5">Test 4</a></li>
|
|
10
|
+
<li class="tab col s3"><a href="#test6">Test 4</a></li>
|
|
11
|
+
<li class="tab col s3"><a href="#test7">Test 4</a></li>
|
|
12
|
+
<li class="tab col s3"><a href="#test8">Test 4</a></li>
|
|
13
|
+
</ul>
|
|
14
|
+
</div>
|
|
15
|
+
<div id="test1" class="col s12">Test 1</div>
|
|
16
|
+
<div id="test2" class="col s12">Test 2</div>
|
|
17
|
+
<div id="test3" class="col s12">Test 3</div>
|
|
18
|
+
<div id="test4" class="col s12">Test 4</div>
|
|
19
|
+
<div id="test5" class="col s12">Test 1</div>
|
|
20
|
+
<div id="test6" class="col s12">Test 2</div>
|
|
21
|
+
<div id="test7" class="col s12">Test 3</div>
|
|
22
|
+
<div id="test8" class="col s12">Test 4</div>
|
|
23
|
+
</div>`;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
XloadHtml(fixture);
|
|
27
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
28
|
+
M.Tabs.init(normalTabs, { duration: 0 });
|
|
29
|
+
window.location.hash = '';
|
|
30
|
+
//HACK the tabs init function not fully initializing. it restores state even after element has been removed from DOM, even after using tabInstance.destroy()
|
|
31
|
+
M.Tabs.getInstance(normalTabs).select('test2');
|
|
32
|
+
});
|
|
33
|
+
afterEach(() => XunloadFixtures());
|
|
34
|
+
|
|
35
|
+
describe('Tabs', () => {
|
|
36
|
+
it('should open to active tab', () => {
|
|
37
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
38
|
+
const activeTab = normalTabs.querySelector('.active');
|
|
39
|
+
const activeTabHash = activeTab.getAttribute('href');
|
|
40
|
+
const tabLinks = normalTabs.querySelectorAll('.tab a');
|
|
41
|
+
for (let i = 0; i < tabLinks.length; i++) {
|
|
42
|
+
const tabHash = tabLinks[i].getAttribute('href');
|
|
43
|
+
if (tabHash === activeTabHash) {
|
|
44
|
+
expect(document.querySelector(tabHash)).toBeVisible(
|
|
45
|
+
'active tab content should be visible by default'
|
|
46
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
47
|
+
} else {
|
|
48
|
+
expect(document.querySelector(tabHash)).toBeHidden(
|
|
49
|
+
'Tab content should be hidden by default'
|
|
50
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const indicator = normalTabs.querySelector('.indicator');
|
|
54
|
+
expect(indicator).toExist('Indicator should be generated');
|
|
55
|
+
// expect(Math.abs(indicator.offset().left - activeTab.offset().left)).toBeLessThan(1, 'Indicator should be at active tab by default.');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should switch to clicked tab', (done) => {
|
|
59
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
60
|
+
const activeTab = normalTabs.querySelector('.active');
|
|
61
|
+
const activeTabHash = activeTab.getAttribute('href');
|
|
62
|
+
const disabledTab = normalTabs.querySelector('.disabled a');
|
|
63
|
+
const disabledTabHash = disabledTab.getAttribute('href');
|
|
64
|
+
const firstTab = normalTabs.querySelector('.tab a');
|
|
65
|
+
const firstTabHash = firstTab.getAttribute('href');
|
|
66
|
+
const indicator = normalTabs.querySelector('.indicator');
|
|
67
|
+
expect(indicator).toExist('Indicator should be generated');
|
|
68
|
+
// expect(Math.abs(indicator.offset().left - activeTab.offset().left)).toBeLessThan(1, 'Indicator should be at active tab by default.');
|
|
69
|
+
click(disabledTab);
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
expect(document.querySelector(activeTabHash)).toBeVisible(
|
|
72
|
+
'Clicking disabled should not change tabs.'
|
|
73
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
74
|
+
expect(document.querySelector(disabledTabHash)).toBeHidden(
|
|
75
|
+
'Clicking disabled should not change tabs.'
|
|
76
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
77
|
+
|
|
78
|
+
click(firstTab);
|
|
79
|
+
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
expect(document.querySelector(activeTabHash)).toBeHidden(
|
|
82
|
+
'Clicking tab should switch to that tab.'
|
|
83
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
84
|
+
expect(document.querySelector(firstTabHash)).toBeVisible(
|
|
85
|
+
'Clicking tab should switch to that tab.'
|
|
86
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
87
|
+
expect(indicator.offsetLeft).toEqual(
|
|
88
|
+
firstTab.offsetLeft,
|
|
89
|
+
'Indicator should move to clicked tab.'
|
|
90
|
+
);
|
|
91
|
+
done();
|
|
92
|
+
}, 10); // 400
|
|
93
|
+
}, 10); // 400
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("shouldn't hide active tab if clicked while active", (done) => {
|
|
97
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
98
|
+
const activeTab = normalTabs.querySelector('.active');
|
|
99
|
+
const activeTabHash = activeTab.getAttribute('href');
|
|
100
|
+
const indicator = normalTabs.querySelector('.indicator');
|
|
101
|
+
expect(indicator).toExist('Indicator should be generated');
|
|
102
|
+
click(activeTab);
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
expect(document.querySelector(activeTabHash)).toBeVisible(
|
|
105
|
+
'Clicking active tab while active should not hide it.'
|
|
106
|
+
);
|
|
107
|
+
done();
|
|
108
|
+
}, 5); // 400
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('should horizontally scroll when too many tabs', (done) => {
|
|
112
|
+
let tabsScrollWidth = 0;
|
|
113
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
114
|
+
normalTabs.style.width = '400px';
|
|
115
|
+
const tabs = normalTabs.querySelectorAll('.tab');
|
|
116
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
tabsScrollWidth += tabs[i].offsetWidth;
|
|
119
|
+
}, 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
expect(tabsScrollWidth).toBeGreaterThan(
|
|
124
|
+
normalTabs.offsetWidth,
|
|
125
|
+
'Scroll width should exceed tabs width'
|
|
126
|
+
);
|
|
127
|
+
done();
|
|
128
|
+
}, 5); // 400
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should programmatically switch tabs', (done) => {
|
|
132
|
+
const normalTabs = document.querySelector('.tabs.normal');
|
|
133
|
+
const activeTab = normalTabs.querySelector('.active');
|
|
134
|
+
const activeTabHash = activeTab.getAttribute('href');
|
|
135
|
+
const firstTab = normalTabs.querySelector('li a');
|
|
136
|
+
const firstTabHash = firstTab.getAttribute('href');
|
|
137
|
+
const indicator = normalTabs.querySelector('.indicator');
|
|
138
|
+
const tabs = normalTabs.querySelectorAll('.tab a');
|
|
139
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
140
|
+
const tabHash = tabs[i].getAttribute('href');
|
|
141
|
+
if (tabHash === activeTabHash) {
|
|
142
|
+
expect(document.querySelector(tabHash)).toBeVisible(
|
|
143
|
+
'active tab content should be visible by default'
|
|
144
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
145
|
+
} else {
|
|
146
|
+
expect(document.querySelector(tabHash)).toBeHidden(
|
|
147
|
+
'Tab content should be hidden by default'
|
|
148
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
M.Tabs.getInstance(normalTabs).select('test1');
|
|
153
|
+
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
expect(document.querySelector(activeTabHash)).toBeHidden(
|
|
156
|
+
'Clicking tab should switch to that tab.'
|
|
157
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
158
|
+
expect(document.querySelector(firstTabHash)).toBeVisible(
|
|
159
|
+
'Clicking tab should switch to that tab.'
|
|
160
|
+
); //TODO replace with alternative for deprecated jasmine-jquery
|
|
161
|
+
expect(indicator.offsetLeft).toEqual(
|
|
162
|
+
firstTab.offsetLeft,
|
|
163
|
+
'Indicator should move to clicked tab.'
|
|
164
|
+
);
|
|
165
|
+
done();
|
|
166
|
+
}, 5); // 400
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("shouldn't error if tab has no associated content", (done) => {
|
|
170
|
+
document.querySelector('#test8').remove();
|
|
171
|
+
const tabNoContent = document.querySelector('[href="#test8"]');
|
|
172
|
+
expect(tabNoContent).toNotHaveClass('active', 'Tab should not be selected');
|
|
173
|
+
click(tabNoContent);
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
expect(tabNoContent).toHaveClass('active', 'Tab should be selected even with no content');
|
|
176
|
+
done();
|
|
177
|
+
}, 10); // 400
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.file-field {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: min-content auto;
|
|
4
|
+
gap: 10px;
|
|
5
|
+
//position: relative;
|
|
6
|
+
|
|
7
|
+
.file-path-wrapper {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
input.file-path { width: 100%; }
|
|
12
|
+
|
|
13
|
+
.btn {
|
|
14
|
+
height: 3rem;
|
|
15
|
+
line-height: 3rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
span {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
input[type=file] {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
width: 100%;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
opacity: 0;
|
|
33
|
+
font-size: 20px;
|
|
34
|
+
filter: alpha(opacity=0);
|
|
35
|
+
|
|
36
|
+
// Needed to override webkit button
|
|
37
|
+
&::-webkit-file-upload-button {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
@use '../../sass/variables' as *;
|
|
2
|
+
|
|
3
|
+
/* Style Placeholders */
|
|
4
|
+
::placeholder {
|
|
5
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Text inputs */
|
|
9
|
+
input:not([type]):not(.browser-default),
|
|
10
|
+
input[type=text]:not(.browser-default),
|
|
11
|
+
input[type=password]:not(.browser-default),
|
|
12
|
+
input[type=email]:not(.browser-default),
|
|
13
|
+
input[type=url]:not(.browser-default),
|
|
14
|
+
input[type=time]:not(.browser-default),
|
|
15
|
+
input[type=date]:not(.browser-default),
|
|
16
|
+
input[type=datetime]:not(.browser-default),
|
|
17
|
+
input[type=datetime-local]:not(.browser-default),
|
|
18
|
+
input[type=month]:not(.browser-default),
|
|
19
|
+
input[type=tel]:not(.browser-default),
|
|
20
|
+
input[type=number]:not(.browser-default),
|
|
21
|
+
input[type=search]:not(.browser-default),
|
|
22
|
+
textarea.materialize-textarea {
|
|
23
|
+
outline: none;
|
|
24
|
+
color: var(--md-sys-color-on-background);
|
|
25
|
+
width: 100%;
|
|
26
|
+
font-size: $md_sys_typescale_body-large_size; //16px; // => 16 dp
|
|
27
|
+
height: 56px; // 56dp
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
%invalid-input-style {
|
|
32
|
+
border-bottom: 2px solid var(--md-sys-color-error);
|
|
33
|
+
box-shadow: 0 1px 0 0 var(--md-sys-color-error);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
%hidden-text > span {
|
|
37
|
+
display: none
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
%custom-error-message {
|
|
41
|
+
content: attr(data-error);
|
|
42
|
+
color: var(--md-sys-color-error);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.input-field {
|
|
46
|
+
--input-color: var(--md-sys-color-primary);
|
|
47
|
+
|
|
48
|
+
position: relative;
|
|
49
|
+
clear: both;
|
|
50
|
+
|
|
51
|
+
// Default
|
|
52
|
+
|
|
53
|
+
input, textarea {
|
|
54
|
+
box-sizing: border-box; /* https://stackoverflow.com/questions/1377719/padding-within-inputs-breaks-width-100*/
|
|
55
|
+
padding: 0 16px;
|
|
56
|
+
padding-top: 20px;
|
|
57
|
+
//background-color: transparent; //background-color: var(--md-sys-color-surface);
|
|
58
|
+
border: none; // reset
|
|
59
|
+
border-radius: 4px; // md.sys.shape.corner.extra-small.top
|
|
60
|
+
border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
|
|
61
|
+
border-bottom-left-radius: 0;
|
|
62
|
+
border-bottom-right-radius: 0;
|
|
63
|
+
|
|
64
|
+
&:focus:not([readonly]) {
|
|
65
|
+
border-bottom: 2px solid var(--input-color);
|
|
66
|
+
padding-top: 20px + 1px; // add border-width
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:disabled, &[readonly="readonly"] {
|
|
70
|
+
color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 38%);
|
|
71
|
+
border-color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 12%);
|
|
72
|
+
background-color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 4%);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Label
|
|
76
|
+
&:focus:not([readonly]) + label {
|
|
77
|
+
color: var(--input-color);
|
|
78
|
+
}
|
|
79
|
+
&:focus:not([readonly]) + label,
|
|
80
|
+
&:not([placeholder=' ']) + label,
|
|
81
|
+
&:not(:placeholder-shown) + label {
|
|
82
|
+
//font-size: 12px; // md.sys.typescale.body-small.size
|
|
83
|
+
// https://stackoverflow.com/questions/34717492/css-transition-font-size-avoid-jittering-wiggling
|
|
84
|
+
transform: scale(calc(12 / 16));
|
|
85
|
+
top: 8px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:disabled + label, &[readonly="readonly"] + label {
|
|
89
|
+
color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 38%);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Hide helper text on data message
|
|
93
|
+
&.invalid ~ .supporting-text[data-error] {
|
|
94
|
+
@extend %hidden-text;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Invalid Input Style
|
|
98
|
+
&.invalid {
|
|
99
|
+
@extend %invalid-input-style;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Custom Error message
|
|
103
|
+
&.invalid ~ .supporting-text:after {
|
|
104
|
+
@extend %custom-error-message;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.invalid ~ label,
|
|
108
|
+
&:focus.invalid ~ label {
|
|
109
|
+
color: var(--md-sys-color-error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
input::placeholder {
|
|
114
|
+
user-select: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
& > label {
|
|
118
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
119
|
+
user-select: none;
|
|
120
|
+
font-size: 16px;
|
|
121
|
+
position: absolute;
|
|
122
|
+
left: 16px;
|
|
123
|
+
top: 16px;
|
|
124
|
+
cursor: text;
|
|
125
|
+
transform-origin: top left;
|
|
126
|
+
transition:
|
|
127
|
+
left 0.2s ease-out,
|
|
128
|
+
top 0.2s ease-out,
|
|
129
|
+
transform 0.2s ease-out
|
|
130
|
+
;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Sub-Infos
|
|
134
|
+
|
|
135
|
+
.supporting-text {
|
|
136
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
padding: 0 16px;
|
|
139
|
+
margin-top: 4px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.character-counter {
|
|
143
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
float: right;
|
|
146
|
+
padding: 0 16px;
|
|
147
|
+
margin-top: 4px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.prefix {
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 12px;
|
|
153
|
+
top: 16px;
|
|
154
|
+
user-select: none;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-self: center;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.suffix {
|
|
160
|
+
position: absolute;
|
|
161
|
+
right: 12px;
|
|
162
|
+
top: 16px;
|
|
163
|
+
user-select: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.prefix ~ input, .prefix ~ textarea {
|
|
167
|
+
padding-left: calc(12px + 24px + 16px);
|
|
168
|
+
}
|
|
169
|
+
.suffix ~ input, .suffix ~ textarea {
|
|
170
|
+
padding-right: calc(12px + 24px + 16px);
|
|
171
|
+
}
|
|
172
|
+
.prefix ~ label {
|
|
173
|
+
left: calc(12px + 24px + 16px);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Outlined
|
|
177
|
+
|
|
178
|
+
// todo: use this approach for floating labels with outline
|
|
179
|
+
// https://dev.to/icyjoseph/use-more-html-elements-floating-from-field-37o9
|
|
180
|
+
|
|
181
|
+
&.outlined {
|
|
182
|
+
|
|
183
|
+
input, textarea {
|
|
184
|
+
padding-top: 0;
|
|
185
|
+
background-color: transparent; //(--md-sys-color-background);
|
|
186
|
+
border: 1px solid var(--md-sys-color-on-surface-variant);
|
|
187
|
+
border-radius: 4px; // md.sys.shape.corner.extra-small
|
|
188
|
+
|
|
189
|
+
&:focus:not([readonly]) {
|
|
190
|
+
border: 2px solid var(--input-color);
|
|
191
|
+
padding-top: 0;
|
|
192
|
+
margin-left: -1px; // subtract border-width
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Label
|
|
197
|
+
&:focus:not([readonly]) + label {
|
|
198
|
+
color: var(--input-color);
|
|
199
|
+
}
|
|
200
|
+
&:focus:not([readonly]) + label,
|
|
201
|
+
&:not([placeholder=' ']) + label,
|
|
202
|
+
&:not(:placeholder-shown) + label {
|
|
203
|
+
top: -8px;
|
|
204
|
+
left: 16px;
|
|
205
|
+
margin-left: -4px;
|
|
206
|
+
padding: 0 4px;
|
|
207
|
+
// A solid chip behind the label masks the border line running
|
|
208
|
+
// through the text, giving the classic outlined-field notch cut.
|
|
209
|
+
// Transparent (the old value) let the border show straight through.
|
|
210
|
+
background-color: var(--md-sys-color-surface);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&:disabled, &[readonly="readonly"] {
|
|
214
|
+
color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 38%);
|
|
215
|
+
border-color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 12%);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Error
|
|
221
|
+
&.error {
|
|
222
|
+
// ".error" alone is also the MD3 color-token utility class (a solid
|
|
223
|
+
// error-colored background). Reset it here so a "error" state modifier
|
|
224
|
+
// on an .input-field doesn't paint the whole container red - only the
|
|
225
|
+
// border/label/text below should pick up the error color.
|
|
226
|
+
background-color: transparent;
|
|
227
|
+
|
|
228
|
+
input, textarea {
|
|
229
|
+
border-color: var(--md-sys-color-error);
|
|
230
|
+
}
|
|
231
|
+
input:focus:not([readonly]), textarea:focus:not([readonly]) {
|
|
232
|
+
border-color: var(--md-sys-color-error);
|
|
233
|
+
}
|
|
234
|
+
input:focus:not([readonly]) + label, textarea:focus:not([readonly]) + label {
|
|
235
|
+
color: var(--md-sys-color-error);
|
|
236
|
+
}
|
|
237
|
+
label {
|
|
238
|
+
color: var(--md-sys-color-error);
|
|
239
|
+
}
|
|
240
|
+
.supporting-text {
|
|
241
|
+
color: var(--md-sys-color-error);
|
|
242
|
+
}
|
|
243
|
+
.suffix {
|
|
244
|
+
color: var(--md-sys-color-error);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Inline */
|
|
250
|
+
.inline {
|
|
251
|
+
display: inline-block;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Search Field */
|
|
255
|
+
.searchbar {
|
|
256
|
+
.prefix {
|
|
257
|
+
position: absolute;
|
|
258
|
+
padding-left: 1rem;
|
|
259
|
+
top: 0;
|
|
260
|
+
user-select: none;
|
|
261
|
+
display: flex;
|
|
262
|
+
align-self: center;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
& > input {
|
|
266
|
+
border-width: 0;
|
|
267
|
+
background-color: transparent;
|
|
268
|
+
padding-left: 3rem;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
.searchbar.has-sidebar {
|
|
272
|
+
margin-left: 0;
|
|
273
|
+
@media #{$large-and-up} {
|
|
274
|
+
margin-left: 300px;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
.input-field input[type=search] {
|
|
280
|
+
display: block;
|
|
281
|
+
line-height: inherit;
|
|
282
|
+
|
|
283
|
+
.nav-wrapper & {
|
|
284
|
+
height: inherit;
|
|
285
|
+
padding-left: 4rem;
|
|
286
|
+
width: calc(100% - 4rem);
|
|
287
|
+
border: 0;
|
|
288
|
+
box-shadow: none;
|
|
289
|
+
}
|
|
290
|
+
&:focus:not(.browser-default) {
|
|
291
|
+
border: 0;
|
|
292
|
+
box-shadow: none;
|
|
293
|
+
}
|
|
294
|
+
& + .label-icon {
|
|
295
|
+
transform: none;
|
|
296
|
+
left: 1rem;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
/* Textarea */
|
|
302
|
+
// Default textarea
|
|
303
|
+
textarea {
|
|
304
|
+
width: 100%;
|
|
305
|
+
height: 3rem;
|
|
306
|
+
background-color: transparent;
|
|
307
|
+
|
|
308
|
+
&.materialize-textarea {
|
|
309
|
+
padding-top: 26px !important;
|
|
310
|
+
padding-bottom: 4px !important;
|
|
311
|
+
line-height: normal;
|
|
312
|
+
overflow-y: hidden; /* prevents scroll bar flash */
|
|
313
|
+
resize: none;
|
|
314
|
+
min-height: 3rem;
|
|
315
|
+
box-sizing: border-box;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// For textarea autoresize
|
|
320
|
+
.hiddendiv {
|
|
321
|
+
visibility: hidden;
|
|
322
|
+
white-space: pre-wrap;
|
|
323
|
+
word-wrap: break-word;
|
|
324
|
+
overflow-wrap: break-word; /* future version of deprecated 'word-wrap' */
|
|
325
|
+
padding-top: 1.2rem; /* prevents text jump on Enter keypress */
|
|
326
|
+
// Reduces repaints
|
|
327
|
+
position: absolute;
|
|
328
|
+
top: 0;
|
|
329
|
+
z-index: -1;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* Autocomplete Items */
|
|
333
|
+
.autocomplete-content {
|
|
334
|
+
li {
|
|
335
|
+
.highlight {
|
|
336
|
+
color: var(--md-sys-color-on-background);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
img {
|
|
340
|
+
height: $dropdown-item-height - 10;
|
|
341
|
+
width: $dropdown-item-height - 10;
|
|
342
|
+
margin: 5px 15px;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Datepicker date input fields */
|
|
348
|
+
.datepicker-date-input {
|
|
349
|
+
position: relative;
|
|
350
|
+
text-indent: -9999px;
|
|
351
|
+
|
|
352
|
+
&::after {
|
|
353
|
+
display: block;
|
|
354
|
+
position: absolute;
|
|
355
|
+
top: 1.10rem;
|
|
356
|
+
content: attr(data-date);
|
|
357
|
+
color: var(--input-color);
|
|
358
|
+
text-indent: 0;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
&:focus-visible {
|
|
362
|
+
text-indent: 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
&:focus-visible:after {
|
|
366
|
+
text-indent: -9999px;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
@use '../../sass/variables' as *;
|
|
2
|
+
|
|
3
|
+
select.browser-default {
|
|
4
|
+
opacity: 1;
|
|
5
|
+
color: var(--md-sys-color-on-background);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// TODO: Change to ".select" and not use tag name directly
|
|
9
|
+
// Keep selects useable without javascript
|
|
10
|
+
|
|
11
|
+
select {
|
|
12
|
+
background-color: var(--md-sys-color-surface);
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding: 5px;
|
|
15
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
16
|
+
border-radius: 2px;
|
|
17
|
+
height: 3rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.select-wrapper:focus-within {
|
|
21
|
+
outline: 2px solid var(--md-sys-color-primary);
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.select-wrapper {
|
|
26
|
+
position: relative;
|
|
27
|
+
|
|
28
|
+
.caret {
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: 0;
|
|
31
|
+
top: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
margin: auto 0;
|
|
34
|
+
z-index: 0;
|
|
35
|
+
fill: var(--md-sys-color-on-background);
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Hide select with overflow hidden instead of using display none
|
|
40
|
+
// (this prevents form validation errors with hidden form elements)
|
|
41
|
+
.hide-select {
|
|
42
|
+
width: 0;
|
|
43
|
+
height: 0;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
z-index: -1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
select:disabled {
|
|
52
|
+
color: var(--md-sys-color-on-surface);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.select-wrapper.disabled {
|
|
56
|
+
+ label {
|
|
57
|
+
color: var(--md-sys-color-on-surface);
|
|
58
|
+
}
|
|
59
|
+
.caret {
|
|
60
|
+
fill: var(--md-sys-color-on-surface);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.select-wrapper input.select-dropdown:disabled {
|
|
65
|
+
color: var(--md-sys-color-on-surface);
|
|
66
|
+
cursor: default;
|
|
67
|
+
user-select: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.select-wrapper i {
|
|
71
|
+
color: var(--md-sys-color-on-surface);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.select-dropdown li.disabled,
|
|
75
|
+
.select-dropdown li.disabled > span,
|
|
76
|
+
.select-dropdown li.optgroup {
|
|
77
|
+
color: var(--md-sys-color-on-surface);
|
|
78
|
+
//background-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Icons
|
|
82
|
+
.select-dropdown li {
|
|
83
|
+
img {
|
|
84
|
+
height: $dropdown-item-height - 10;
|
|
85
|
+
width: $dropdown-item-height - 10;
|
|
86
|
+
margin: 5px 15px;
|
|
87
|
+
object-fit: cover;
|
|
88
|
+
float: right;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Optgroup styles
|
|
93
|
+
.select-dropdown li.optgroup {
|
|
94
|
+
border-top: 1px solid rgba(0, 0, 0, 0.04);
|
|
95
|
+
&.selected > span {
|
|
96
|
+
color: var(--md-sys-color-on-background);
|
|
97
|
+
}
|
|
98
|
+
& > span {
|
|
99
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
100
|
+
}
|
|
101
|
+
& ~ li.optgroup-option {
|
|
102
|
+
padding-left: 1rem;
|
|
103
|
+
}
|
|
104
|
+
}
|