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.
Files changed (150) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +55 -91
  3. package/components/appbar/_navbar.old.scss +223 -0
  4. package/components/appbar/appbar.css +235 -0
  5. package/components/appbar/appbar.mjs +54 -0
  6. package/components/appbar/appbar.test.mjs +9 -0
  7. package/components/atomic/atomic.mjs +19 -0
  8. package/components/atomic/component.mjs +67 -0
  9. package/components/badge/_badges.scss +75 -0
  10. package/components/badge/badge.mjs +11 -0
  11. package/components/breadcrumb/_breadcrumb.scss +27 -0
  12. package/components/button/_buttons.scss +352 -0
  13. package/components/button/button.mjs +11 -0
  14. package/components/button/buttons.stories.ts +150 -0
  15. package/components/button/buttons.ts +282 -0
  16. package/components/button/examples.iso.js +18 -0
  17. package/components/button/fabSpec.js +65 -0
  18. package/components/button/test-button.mjs +16 -0
  19. package/components/card/_cards.scss +229 -0
  20. package/components/card/card.mjs +10 -0
  21. package/components/card/cards.ts +185 -0
  22. package/components/card/cardsSpec.js +269 -0
  23. package/components/carousel/_carousel.scss +93 -0
  24. package/components/carousel/_slider.scss +119 -0
  25. package/components/carousel/carousel.ts +693 -0
  26. package/components/carousel/carouselSpec.js +61 -0
  27. package/components/carousel/slider.ts +431 -0
  28. package/components/carousel/sliderSpec.js +99 -0
  29. package/components/checkbox/_checkboxes.scss +281 -0
  30. package/components/checkbox/checkbox.mdx +24 -0
  31. package/components/checkbox/checkbox.stories.ts +120 -0
  32. package/components/chip/chip.mjs +37 -0
  33. package/components/chip/chip.test.mjs +10 -0
  34. package/components/chip/chips.css +126 -0
  35. package/components/chip/chips.mdx +33 -0
  36. package/components/chip/chips.ts +440 -0
  37. package/components/chip/chipsSpec.js +165 -0
  38. package/components/chip/readme.md +323 -0
  39. package/components/collapsible/_collapsible.scss +82 -0
  40. package/components/collapsible/collapsible.ts +230 -0
  41. package/components/collapsible/collapsibleSpec.js +240 -0
  42. package/components/datepicker/_datepicker.scss +268 -0
  43. package/components/datepicker/datepicker.ts +1450 -0
  44. package/components/datepicker/datepickerSpec.js +162 -0
  45. package/components/dialog/_materialbox.scss +42 -0
  46. package/components/dialog/_modal.scss +79 -0
  47. package/components/dialog/materialbox.ts +446 -0
  48. package/components/dialog/materialboxSpec.js +37 -0
  49. package/components/dialog/modal.ts +111 -0
  50. package/components/dialog/modalSpec.js +83 -0
  51. package/components/dialog/readme.md +5 -0
  52. package/components/divider/readme.md +15 -0
  53. package/components/dropdown/_dropdown.scss +83 -0
  54. package/components/dropdown/dropdown.ts +653 -0
  55. package/components/dropdown/dropdownSpec.js +108 -0
  56. package/components/list/_collection.scss +114 -0
  57. package/components/list/_list.scss +6 -0
  58. package/components/list/list.mjs +58 -0
  59. package/components/list/list.test.mjs +16 -0
  60. package/components/loading/loading.mjs +26 -0
  61. package/components/loading/loading.test.mjs +10 -0
  62. package/components/navigation-bar/_old +582 -0
  63. package/components/navigation-bar/navigation-bar.mdx +20 -0
  64. package/components/navigation-bar/navigation-bar.stories.ts +39 -0
  65. package/components/navigation-drawer/_sidenav.scss +247 -0
  66. package/components/navigation-drawer/sidenav.ts +546 -0
  67. package/components/navigation-drawer/sidenavSpec.js +124 -0
  68. package/components/pagination/_pagination.scss +47 -0
  69. package/components/progress/_preloader.scss +416 -0
  70. package/components/radio-button/_radio-buttons.scss +112 -0
  71. package/components/radio-button/radio-buttons.mdx +28 -0
  72. package/components/radio-button/radio-buttons.stories.ts +51 -0
  73. package/components/search/autocomplete.ts +620 -0
  74. package/components/search/autocompleteSpec.js +321 -0
  75. package/components/slider/_range.scss +157 -0
  76. package/components/slider/range.ts +216 -0
  77. package/components/snackbar/_toast.scss +68 -0
  78. package/components/snackbar/toastSpec.js +132 -0
  79. package/components/snackbar/toasts.ts +312 -0
  80. package/components/switch/_switches.scss +121 -0
  81. package/components/tabs/_tabs.scss +171 -0
  82. package/components/tabs/tabs.mjs +31 -0
  83. package/components/tabs/tabs.ts +358 -0
  84. package/components/tabs/tabsSpec.js +180 -0
  85. package/components/textfield/_file-input.scss +41 -0
  86. package/components/textfield/_input-fields.scss +368 -0
  87. package/components/textfield/_select.scss +104 -0
  88. package/components/textfield/formfields.css +311 -0
  89. package/components/textfield/forms.ts +182 -0
  90. package/components/textfield/formsSpec.js +142 -0
  91. package/components/textfield/select.ts +472 -0
  92. package/components/textfield/selectSpec.js +390 -0
  93. package/components/textfield/textfield.mjs +29 -0
  94. package/components/textfield/textfield.test.mjs +10 -0
  95. package/components/timepicker/_timepicker.scss +362 -0
  96. package/components/timepicker/timepicker.ts +905 -0
  97. package/components/tooltip/_tooltip.scss +40 -0
  98. package/components/tooltip/tooltip.ts +380 -0
  99. package/components/tooltip/tooltipSpec.js +145 -0
  100. package/dist/css/materialize.colors.min.css +6 -0
  101. package/dist/css/materialize.css +7578 -6326
  102. package/dist/css/materialize.min.css +6 -13
  103. package/dist/css/materialize.min.css.map +1 -0
  104. package/dist/js/materialize.cjs.js +8410 -0
  105. package/dist/js/materialize.d.ts +2625 -0
  106. package/dist/js/materialize.js +8415 -12374
  107. package/dist/js/materialize.min.js +6 -6
  108. package/dist/js/materialize.mjs +8382 -0
  109. package/package.json +82 -47
  110. package/sass/_colors.scss +417 -0
  111. package/sass/_global.scss +490 -0
  112. package/sass/_grid.scss +172 -0
  113. package/sass/_table_of_contents.scss +28 -0
  114. package/sass/_tapTarget.scss +102 -0
  115. package/sass/_typography.scss +58 -0
  116. package/sass/_variables.scss +56 -0
  117. package/sass/materialize.scss +51 -0
  118. package/sass/mixins.module.scss +168 -0
  119. package/extras/noUiSlider/nouislider.css +0 -406
  120. package/extras/noUiSlider/nouislider.js +0 -2147
  121. package/extras/noUiSlider/nouislider.min.js +0 -1
  122. package/js/anime.min.js +0 -34
  123. package/js/autocomplete.js +0 -448
  124. package/js/buttons.js +0 -354
  125. package/js/cards.js +0 -40
  126. package/js/carousel.js +0 -717
  127. package/js/cash.js +0 -960
  128. package/js/characterCounter.js +0 -136
  129. package/js/chips.js +0 -481
  130. package/js/collapsible.js +0 -275
  131. package/js/component.js +0 -44
  132. package/js/datepicker.js +0 -975
  133. package/js/dropdown.js +0 -635
  134. package/js/forms.js +0 -275
  135. package/js/global.js +0 -444
  136. package/js/materialbox.js +0 -453
  137. package/js/modal.js +0 -382
  138. package/js/parallax.js +0 -138
  139. package/js/pushpin.js +0 -148
  140. package/js/range.js +0 -263
  141. package/js/scrollspy.js +0 -295
  142. package/js/select.js +0 -450
  143. package/js/sidenav.js +0 -580
  144. package/js/slider.js +0 -359
  145. package/js/tabs.js +0 -402
  146. package/js/tapTarget.js +0 -314
  147. package/js/timepicker.js +0 -647
  148. package/js/toasts.js +0 -310
  149. package/js/tooltip.js +0 -303
  150. package/js/waves.js +0 -335
@@ -0,0 +1,162 @@
1
+ describe('Datepicker Plugin', () => {
2
+ const fixture = `<div class="row">
3
+ <div class="input-field col s12">
4
+ <input type="text" class="datepicker" id="datepickerInput">
5
+ </div>
6
+ </div>`;
7
+
8
+ beforeEach(() => XloadHtml(fixture));
9
+ afterEach(() => XunloadFixtures());
10
+
11
+ describe('Datepicker', () => {
12
+ afterEach(() => {
13
+ M.Datepicker.getInstance(document.querySelector('.datepicker')).destroy();
14
+ });
15
+
16
+ it('can have a string format', (done) => {
17
+ const input = document.querySelector('#datepickerInput');
18
+ const today = new Date();
19
+ M.Datepicker.init(input, { format: 'mm/dd/yyyy', openByDefault: true });
20
+ const datepicker = M.Datepicker.getInstance(input);
21
+ //datepicker.open();
22
+ setTimeout(() => {
23
+ const day1 = document.querySelector('.datepicker-container button[data-day="1"]');
24
+ day1.click();
25
+ // Removed since autoSubmit option
26
+ // document.querySelector('.datepicker-done').click();
27
+ setTimeout(() => {
28
+ const year = today.getFullYear();
29
+ const month = today.getMonth() + 1;
30
+ const value = datepicker.toString();
31
+ expect(value).toEqual(`${month < 10 ? `0${month}` : month}/01/${year}`);
32
+ done();
33
+ }, 400);
34
+ }, 400);
35
+ });
36
+
37
+ it('can have a format function', (done) => {
38
+ const input = document.querySelector('#datepickerInput');
39
+ const today = new Date();
40
+ const formatFn = `${today.getFullYear() - 100}-${today.getMonth() + 1}-99`;
41
+ M.Datepicker.init(input, { format: formatFn, openByDefault: true });
42
+ const datepicker = M.Datepicker.getInstance(input);
43
+ //datepicker.open();
44
+ setTimeout(() => {
45
+ const day1 = document.querySelector('.datepicker-container button[data-day="1"]');
46
+ day1.click();
47
+ // Removed since autoSubmit option
48
+ // document.querySelector('.datepicker-done').click();
49
+ setTimeout(() => {
50
+ const year = today.getFullYear() - 100;
51
+ const month = today.getMonth() + 1;
52
+ expect(datepicker.toString()).toEqual(`${year}-${month}-99`);
53
+ done();
54
+ }, 400);
55
+ }, 400);
56
+ });
57
+
58
+ it('can change the calendar modal selected date by input', (done) => {
59
+ const input = document.querySelector('#datepickerInput');
60
+ M.Datepicker.init(input, { format: 'mm/dd/yyyy', openByDefault: true });
61
+ const today = new Date();
62
+ const month = today.getMonth();
63
+ const year = today.getFullYear() - 44;
64
+ const day = 11;
65
+ input.value = `${month + 1}/${day}/${year}`;
66
+ input.dispatchEvent(new InputEvent('change', { bubbles: true, cancelable: true }));
67
+ input.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, cancelable: true, keyCode: 13 }));
68
+ setTimeout(() => {
69
+ const selectMonthElem = document.querySelector('.datepicker-select.orig-select-month');
70
+ const selectYearElem = document.querySelector('.datepicker-select.orig-select-year');
71
+ const selectedDayElem = document.querySelector(`.datepicker-row td[data-day="${day}"]`);
72
+ expect(selectMonthElem.querySelector('option[selected="selected"]').value)
73
+ .withContext(
74
+ 'selected month does not match'
75
+ ).toBe((month).toString());
76
+ expect(selectYearElem.querySelector('option[selected="selected"]').value)
77
+ .withContext(
78
+ 'selected year does not match'
79
+ ).toBe(year.toString());
80
+ expect(selectedDayElem.classList.contains('is-selected')).withContext(
81
+ 'selected day does not match'
82
+ ).toBe(true);
83
+ done();
84
+ }, 10);
85
+ });
86
+
87
+ it('should have a date range input field if date range option is enabled', (done) => {
88
+ const input = document.querySelector('#datepickerInput');
89
+ M.Datepicker.init(input, { isDateRange: true, openByDefault: true });
90
+ setTimeout(() => {
91
+ expect(document.querySelector('.datepicker-end-date')).toExist(
92
+ 'end date input should exist'
93
+ );
94
+ done();
95
+ }, 10);
96
+ });
97
+
98
+ it('should have multiple input fields if multiple select option is enabled and multiple dates are selected', (done) => {
99
+ const input = document.querySelector('#datepickerInput');
100
+ M.Datepicker.init(input, { isMultipleSelection: true, openByDefault: true });
101
+ const datepicker = M.Datepicker.getInstance(input);
102
+ datepicker.open();
103
+ setTimeout(() => {
104
+ for (let i = 1; i <= 3; i++) {
105
+ setTimeout(() => {
106
+ document.querySelector(`.datepicker-container button[data-day="${i}"]`).click();
107
+ }, i * 10);
108
+ }
109
+ setTimeout(() => {
110
+ // Removed since autoSubmit option
111
+ // document.querySelector('.datepicker-done').click();
112
+ expect(document.querySelectorAll('.datepicker').length === 3).toEqual(true);
113
+ done();
114
+ }, 40);
115
+ }, 10);
116
+ });
117
+
118
+ it('should integrate action util buttons by option', (done) => {
119
+ const input = document.querySelector('#datepickerInput');
120
+ M.Datepicker.init(input, { format: 'mm/dd/yyyy', autoSubmit: false, showClearBtn: true });
121
+ const today = new Date();
122
+ const clearBtn = document.querySelector('.datepicker-clear');
123
+ const cancelBtn = document.querySelector('.btn-cancel');
124
+ const confirmBtn = document.querySelector('.btn-confirm');
125
+ const year = today.getFullYear();
126
+ const month = today.getMonth() + 1;
127
+ const day = today.getDay() <= 26 ? today.getDay() + 2 : today.getDay() - 2;
128
+
129
+ setTimeout(() => {
130
+ expect(clearBtn).toExist('clear button should exist');
131
+ expect(cancelBtn).toExist('cancel should exist');
132
+ expect(confirmBtn).toExist('confirm should exist');
133
+ let dayEl = document.querySelector(`.datepicker-container button[data-day="${day}"]`);
134
+ dayEl.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
135
+ confirmBtn.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
136
+ setTimeout(() => {
137
+ expect(input.value)
138
+ .withContext('value should change with confirm interaction')
139
+ .toEqual(`${month < 10 ? `0${month}` : month}/${day < 10 ? '0' + day : day}/${year}`);
140
+ dayEl = document.querySelector('.datepicker-container button[data-day="1"]');
141
+ dayEl.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
142
+ cancelBtn.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
143
+ setTimeout(() => {
144
+ expect(input.value)
145
+ .withContext('value should not change with cancel interaction')
146
+ .toEqual(`${month < 10 ? `0${month}` : month}/${day < 10 ? '0' + day : day}/${year}`);
147
+ clearBtn.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
148
+ setTimeout(() => {
149
+ expect(input.value.length)
150
+ .withContext('input field should be empty with clear interaction')
151
+ .toEqual(0);
152
+ expect(document.querySelector('.datepicker-container button.is-selected'))
153
+ .withContext('there should be no selected day with clear interaction')
154
+ .toBe(null);
155
+ done();
156
+ }, 10);
157
+ }, 10);
158
+ }, 10);
159
+ }, 10);
160
+ });
161
+ });
162
+ });
@@ -0,0 +1,42 @@
1
+ .materialboxed {
2
+ display: block;
3
+ cursor: zoom-in;
4
+ position: relative;
5
+ transition: opacity .4s;
6
+ -webkit-backface-visibility: hidden;
7
+
8
+ &:hover {
9
+ &:not(.active) {
10
+ opacity: .8;
11
+ }
12
+ }
13
+ &.active {
14
+ cursor: zoom-out;
15
+ }
16
+ }
17
+
18
+ #materialbox-overlay {
19
+ position:fixed;
20
+ top: 0;
21
+ right: 0;
22
+ bottom: 0;
23
+ left: 0;
24
+ background-color: var(--md-sys-color-background);
25
+ z-index: 1000;
26
+ will-change: opacity;
27
+ }
28
+
29
+ .materialbox-caption {
30
+ position: fixed;
31
+ display: none;
32
+ color: var(--md-sys-color-on-background);
33
+ line-height: 50px;
34
+ bottom: 0;
35
+ left: 0;
36
+ width: 100%;
37
+ text-align: center;
38
+ padding: 0% 15%;
39
+ height: 50px;
40
+ z-index: 1000;
41
+ -webkit-font-smoothing: antialiased;
42
+ }
@@ -0,0 +1,79 @@
1
+ @use '../../sass/variables' as *;
2
+ @use '../../sass/global' as *;
3
+
4
+ // use with dialog html element
5
+ .modal {
6
+ --modal-footer-divider-height: 1px;
7
+ --modal-border-radius: 28px;
8
+ --modal-padding: 24px;
9
+ --modal-padding-bottom: 16px;
10
+ --modal-background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-surface-tint) 17%);
11
+
12
+ @extend .z-depth-5;
13
+ border: none;
14
+ outline: none;
15
+ padding: 0;
16
+ max-height: 70%;
17
+ width: 55%;
18
+ border-radius: var(--modal-border-radius);
19
+ will-change: top, opacity;
20
+ background-color: var(--modal-background-color);
21
+
22
+ // Dialog open
23
+ &[open] {
24
+ display: flex;
25
+ flex-direction: column;
26
+ }
27
+
28
+ @media #{$medium-and-down} {
29
+ width: 80%;
30
+ }
31
+
32
+ // custom backdrop blur
33
+ &::backdrop {
34
+ backdrop-filter: blur(1px);
35
+ }
36
+
37
+ .modal-header {
38
+ padding: var(--modal-padding);
39
+ padding-bottom: var(--modal-padding-bottom);
40
+ flex-shrink: 0;
41
+ position: sticky;
42
+ top: 0;
43
+ // disabled since background color inheritance from parent element
44
+ // background-color: var(--modal-background-color);
45
+ }
46
+ .modal-content {
47
+ padding: 0 var(--modal-padding);
48
+ }
49
+ .modal-footer {
50
+ display: flex;
51
+ border-radius: 0 0 var(--modal-border-radius) var(--modal-border-radius);
52
+ padding: var(--modal-padding);
53
+ text-align: right;
54
+ flex-shrink: 0;
55
+ position: sticky;
56
+ bottom: 0;
57
+ // disabled since background color inheritance from parent element
58
+ // background-color: var(--modal-background-color);
59
+ justify-content: space-between;
60
+ }
61
+
62
+ .modal-close {
63
+ cursor: pointer;
64
+ }
65
+
66
+ // todo: remove maybe
67
+ h1,h2,h3,h4,h5,h6 {
68
+ margin: 0;
69
+ }
70
+ }
71
+
72
+ // Modal Bottom Sheet Style
73
+ .modal.bottom-sheet {
74
+ margin-bottom: 0;
75
+ max-height: 45%;
76
+ border-bottom-left-radius: 0;
77
+ border-bottom-right-radius: 0;
78
+ will-change: bottom, opacity;
79
+ }