@materializecss/materialize 2.0.3-alpha → 2.0.3-beta

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.
@@ -78,7 +78,6 @@ a {
78
78
 
79
79
  .hoverable {
80
80
  transition: box-shadow .25s;
81
-
82
81
  &:hover {
83
82
  box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
84
83
  }
@@ -91,7 +90,6 @@ a {
91
90
  background-color: $divider-color;
92
91
  }
93
92
 
94
-
95
93
  // Blockquote
96
94
  blockquote {
97
95
  margin: 20px 0;
@@ -102,29 +100,24 @@ blockquote {
102
100
  // Icon Styles
103
101
  i {
104
102
  line-height: inherit;
105
-
106
103
  &.left {
107
104
  float: left;
108
- margin-right: 15px;
105
+ margin-left: -8px;
106
+ // margin-right: 15px;
109
107
  }
110
-
111
108
  &.right {
112
109
  float: right;
113
- margin-left: 15px;
110
+ // margin-left: 15px;
114
111
  }
115
-
116
112
  &.tiny {
117
113
  font-size: 1rem;
118
114
  }
119
-
120
115
  &.small {
121
116
  font-size: 2rem;
122
117
  }
123
-
124
118
  &.medium {
125
119
  font-size: 4rem;
126
120
  }
127
-
128
121
  &.large {
129
122
  font-size: 6rem;
130
123
  }
@@ -525,10 +518,8 @@ td, th {
525
518
  border-right: 1px solid $table-border-color;
526
519
  }
527
520
  }
528
-
529
521
  }
530
522
 
531
-
532
523
  // Responsive Videos
533
524
  .video-container {
534
525
  position: relative;
@@ -545,88 +536,6 @@ td, th {
545
536
  }
546
537
  }
547
538
 
548
- // Progress Bar
549
- .progress {
550
- position: relative;
551
- height: 4px;
552
- display: block;
553
- width: 100%;
554
- background-color: $progress-bar-track-color;
555
- border-radius: 2px;
556
- margin: $element-top-margin 0 $element-bottom-margin 0;
557
- overflow: hidden;
558
-
559
- .determinate {
560
- position: absolute;
561
- top: 0;
562
- left: 0;
563
- bottom: 0;
564
- background-color: $progress-bar-color;
565
- transition: width .3s linear;
566
- }
567
-
568
- .indeterminate {
569
- background-color: $progress-bar-color;
570
-
571
- &:before {
572
- content: '';
573
- position: absolute;
574
- background-color: inherit;
575
- top: 0;
576
- left: 0;
577
- bottom: 0;
578
- will-change: left, right;
579
- // Custom bezier
580
- animation: indeterminate 2.1s cubic-bezier(0.650, 0.815, 0.735, 0.395) infinite;
581
-
582
- }
583
-
584
- &:after {
585
- content: '';
586
- position: absolute;
587
- background-color: inherit;
588
- top: 0;
589
- left: 0;
590
- bottom: 0;
591
- will-change: left, right;
592
- // Custom bezier
593
- animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.840, 0.440, 1.000) infinite;
594
- animation-delay: 1.15s;
595
- }
596
- }
597
- }
598
-
599
- @keyframes indeterminate {
600
- 0% {
601
- left: -35%;
602
- right: 100%;
603
- }
604
- 60% {
605
- left: 100%;
606
- right: -90%;
607
- }
608
- 100% {
609
- left: 100%;
610
- right: -90%;
611
- }
612
- }
613
-
614
- @keyframes indeterminate-short {
615
- 0% {
616
- left: -200%;
617
- right: 100%;
618
- }
619
- 60% {
620
- left: 107%;
621
- right: -8%;
622
- }
623
- 100% {
624
- left: 107%;
625
- right: -8%;
626
- }
627
- }
628
-
629
-
630
539
  /*******************
631
540
  Utility Classes
632
541
  *******************/
@@ -644,12 +553,15 @@ td, th {
644
553
  .center, .center-align {
645
554
  text-align: center;
646
555
  }
556
+
557
+ // TODO: Remove this
647
558
  .left {
648
559
  float: left !important;
649
560
  }
650
561
  .right {
651
562
  float: right !important;
652
563
  }
564
+
653
565
  // No Text Select
654
566
  .no-select {
655
567
  user-select: none;
@@ -1,3 +1,88 @@
1
+ // Progress Bar
2
+ .progress {
3
+ position: relative;
4
+ height: 4px;
5
+ display: block;
6
+ width: 100%;
7
+
8
+ @extend .surface-variant;
9
+
10
+ border-radius: 2px;
11
+ margin: $element-top-margin 0 $element-bottom-margin 0;
12
+ overflow: hidden;
13
+
14
+ .determinate {
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ bottom: 0;
19
+ background-color: $progress-bar-color;
20
+ transition: width .3s linear;
21
+ }
22
+
23
+ .indeterminate {
24
+ background-color: $progress-bar-color;
25
+
26
+ &:before {
27
+ content: '';
28
+ position: absolute;
29
+ background-color: inherit;
30
+ top: 0;
31
+ left: 0;
32
+ bottom: 0;
33
+ will-change: left, right;
34
+ // Custom bezier
35
+ animation: indeterminate 2.1s cubic-bezier(0.650, 0.815, 0.735, 0.395) infinite;
36
+
37
+ }
38
+
39
+ &:after {
40
+ content: '';
41
+ position: absolute;
42
+ background-color: inherit;
43
+ top: 0;
44
+ left: 0;
45
+ bottom: 0;
46
+ will-change: left, right;
47
+ // Custom bezier
48
+ animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.840, 0.440, 1.000) infinite;
49
+ animation-delay: 1.15s;
50
+ }
51
+ }
52
+ }
53
+
54
+ @keyframes indeterminate {
55
+ 0% {
56
+ left: -35%;
57
+ right: 100%;
58
+ }
59
+ 60% {
60
+ left: 100%;
61
+ right: -90%;
62
+ }
63
+ 100% {
64
+ left: 100%;
65
+ right: -90%;
66
+ }
67
+ }
68
+
69
+ @keyframes indeterminate-short {
70
+ 0% {
71
+ left: -200%;
72
+ right: 100%;
73
+ }
74
+ 60% {
75
+ left: 107%;
76
+ right: -8%;
77
+ }
78
+ 100% {
79
+ left: 107%;
80
+ right: -8%;
81
+ }
82
+ }
83
+
84
+
85
+
1
86
  /*
2
87
  @license
3
88
  Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -97,7 +97,7 @@ $button-raised-color: $font-on-primary-color-main !default;
97
97
  $button-border: none !default;
98
98
  $button-background-focus: $button-raised-background-focus !default;
99
99
  $button-font-size: 14px !default;
100
- $button-icon-font-size: 1.3rem !default;
100
+ $button-icon-font-size: 18px !default;
101
101
  $button-height: 40px !default;
102
102
  $button-padding: 0 16px !default;
103
103
  $button-radius: 4px !default;
@@ -116,6 +116,7 @@ $button-floating-large-size: 56px !default;
116
116
  $button-small-font-size: 13px !default;
117
117
  $button-small-icon-font-size: 1.2rem !default;
118
118
  $button-small-height: $button-height * .75 !default;
119
+ $button-small-padding: 0 8px !default;
119
120
  $button-floating-small-size: $button-height * .75 !default;
120
121
 
121
122
  // Flat buttons
@@ -130,7 +131,7 @@ $button-floating-background-hover: $secondary-color-when-hovered-solid !default;
130
131
  $button-floating-background-focus: $secondary-color-when-focused-solid !default;
131
132
  $button-floating-color: $font-on-secondary-color-main !default;
132
133
  $button-floating-size: 40px !default;
133
- $button-floating-radius: 50% !default;
134
+ $button-floating-radius: 16px !default;
134
135
 
135
136
 
136
137
  // 4. Cards
@@ -63,7 +63,7 @@ input[type=range] + .thumb {
63
63
  // Shared
64
64
  @mixin range-track {
65
65
  height: $track-height;
66
- background: $range-track-color;
66
+ @extend .surface-variant;
67
67
  border: none;
68
68
  }
69
69
 
@@ -1,6 +1,17 @@
1
1
  /* Switch
2
2
  ========================================================================== */
3
3
 
4
+ .switch {
5
+ --track-height: 32px;
6
+ --track-width: 52px;
7
+ --border-width: 2px;
8
+ --size-off: 16px;
9
+ --size-on: 24px;
10
+ --icon-size: 16px;
11
+ --gap-on: calc(((var(--track-height) - var(--size-on)) / 2) - var(--border-width));
12
+ --gap-off: calc(((var(--track-height) - var(--size-off)) / 2) - var(--border-width));
13
+ }
14
+
4
15
  .switch,
5
16
  .switch * {
6
17
  -webkit-tap-highlight-color: transparent;
@@ -16,17 +27,22 @@
16
27
  width: 0;
17
28
  height: 0;
18
29
 
30
+ // CHECKED
31
+ // Track
19
32
  &:checked + .lever{
20
- background-color: $switch-track-checked-bg;
33
+ background-color: var(--primary-color);
34
+ border-color: var(--primary-color);
21
35
  }
22
-
36
+ // Dot
23
37
  &:checked + .lever {
24
38
  &:before, &:after {
25
- left: 18px;
39
+ top: var(--gap-on);
40
+ left: calc(var(--track-width) - var(--size-on) - var(--gap-on) - 2 * var(--border-width));
41
+ width: var(--size-on);
42
+ height: var(--size-on);
26
43
  }
27
-
28
44
  &:after {
29
- background-color: $switch-thumb-checked-color;
45
+ @extend .surface;
30
46
  }
31
47
  }
32
48
  }
@@ -35,30 +51,44 @@
35
51
  content: "";
36
52
  display: inline-block;
37
53
  position: relative;
38
- width: 36px;
39
- height: 14px;
40
- background-color: $switch-track-unchecked-bg;
54
+ width: var(--track-width);
55
+ height: var(--track-height);
56
+ border-style: solid;
57
+ border-width: 2px;
58
+ border-color: var(--md-sys-color-outline);
59
+
60
+ //background-color: $switch-track-unchecked-bg;
61
+ @extend .surface-variant;
62
+
41
63
  border-radius: $switch-radius;
42
64
  margin-right: 10px;
43
65
  transition: background 0.3s ease;
44
66
  vertical-align: middle;
45
67
  margin: 0 16px;
46
68
 
69
+ // DOT
47
70
  &:before, &:after {
48
71
  content: "";
49
72
  position: absolute;
50
73
  display: inline-block;
51
- width: 20px;
52
- height: 20px;
74
+ width: var(--size-off);
75
+ height: var(--size-off);
53
76
  border-radius: 50%;
54
- left: 0;
55
- top: -3px;
77
+
78
+ left: var(--gap-off);
79
+ top: var(--gap-off);
80
+
56
81
  transition: left 0.3s ease, background .3s ease, box-shadow 0.1s ease, transform .1s ease;
57
82
  }
58
83
 
84
+ // NOT CHECKED [DOT]
59
85
  &:after {
60
- background-color: $switch-thumb-unchecked-color;
61
- box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
86
+ @extend .outline;
87
+ height: var(--size-off);
88
+ width: var(--size-off);
89
+
90
+ //@extend .surface-variant;
91
+ //box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
62
92
  }
63
93
  }
64
94
 
package/src/datepicker.ts CHANGED
@@ -134,7 +134,7 @@ export interface DatepickerOptions extends BaseOptions {
134
134
  * @default null
135
135
  */
136
136
  onDraw: (() => void) | null;
137
-
137
+
138
138
  /** Field used for internal calculations DO NOT CHANGE IT */
139
139
  minYear?: any;
140
140
  /** Field used for internal calculations DO NOT CHANGE IT */
@@ -261,7 +261,7 @@ export class Datepicker extends Component<DatepickerOptions> {
261
261
  constructor(el: HTMLInputElement, options: Partial<DatepickerOptions>) {
262
262
  super(el, options, Datepicker);
263
263
  (this.el as any).M_Datepicker = this;
264
-
264
+
265
265
  this.options = {
266
266
  ...Datepicker.defaults,
267
267
  ...options
@@ -847,8 +847,8 @@ export class Datepicker extends Component<DatepickerOptions> {
847
847
  });
848
848
 
849
849
  // Add change handlers for select
850
- yearSelect.addEventListener('change', () => this._handleYearChange);
851
- monthSelect.addEventListener('change', () => this._handleMonthChange);
850
+ yearSelect.addEventListener('change', this._handleYearChange);
851
+ monthSelect.addEventListener('change', this._handleMonthChange);
852
852
 
853
853
  if (typeof this.options.onDraw === 'function') {
854
854
  this.options.onDraw.call(this);
package/src/global.ts CHANGED
@@ -26,7 +26,7 @@ import { Range } from './range';
26
26
  import { Utils } from './utils';
27
27
 
28
28
  export class M {
29
- static version = '2.0.3-alpha';
29
+ static version = '2.0.3-beta';
30
30
 
31
31
  static Autocomplete: typeof Autocomplete = Autocomplete;
32
32
  static Tabs: typeof Tabs = Tabs;
package/src/tooltip.ts CHANGED
@@ -4,6 +4,8 @@ import { Utils } from "./utils";
4
4
  import { Bounding } from "./bounding";
5
5
  import { Component, BaseOptions, InitElements, MElement } from "./component";
6
6
 
7
+ export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
8
+
7
9
  export interface TooltipOptions extends BaseOptions {
8
10
  /**
9
11
  * Delay time before tooltip disappears.
@@ -15,6 +17,11 @@ export interface TooltipOptions extends BaseOptions {
15
17
  * @default 0
16
18
  */
17
19
  enterDelay: number;
20
+ /**
21
+ * Element Id for the tooltip.
22
+ * @default ""
23
+ */
24
+ tooltipId?: string;
18
25
  /**
19
26
  * Text string for the tooltip.
20
27
  * @default ""
@@ -45,7 +52,7 @@ export interface TooltipOptions extends BaseOptions {
45
52
  * Set the direction of the tooltip.
46
53
  * @default 'bottom'
47
54
  */
48
- position: 'top' | 'right' | 'bottom' | 'left';
55
+ position: TooltipPosition;
49
56
  /**
50
57
  * Amount in px that the tooltip moves during its transition.
51
58
  * @default 10
@@ -60,7 +67,7 @@ const _defaults: TooltipOptions = {
60
67
  margin: 5,
61
68
  inDuration: 250,
62
69
  outDuration: 200,
63
- position: 'bottom',
70
+ position: 'bottom' as TooltipPosition,
64
71
  transitionMovement: 10,
65
72
  opacity: 1
66
73
  };
@@ -90,6 +97,7 @@ export class Tooltip extends Component<TooltipOptions> {
90
97
 
91
98
  this.options = {
92
99
  ...Tooltip.defaults,
100
+ ...this._getAttributeOptions(),
93
101
  ...options
94
102
  };
95
103
 
@@ -139,7 +147,12 @@ export class Tooltip extends Component<TooltipOptions> {
139
147
  this.tooltipEl = document.createElement('div');
140
148
  this.tooltipEl.classList.add('material-tooltip');
141
149
 
142
- const tooltipContentEl = document.createElement('div');
150
+ const tooltipContentEl = this.options.tooltipId
151
+ ? document.getElementById(this.options.tooltipId)
152
+ : document.createElement('div');
153
+ this.tooltipEl.append( tooltipContentEl);
154
+ tooltipContentEl.style.display = "";
155
+
143
156
  tooltipContentEl.classList.add('tooltip-content');
144
157
  this._setTooltipContent(tooltipContentEl);
145
158
  this.tooltipEl.appendChild(tooltipContentEl);
@@ -147,7 +160,9 @@ export class Tooltip extends Component<TooltipOptions> {
147
160
  }
148
161
 
149
162
  _setTooltipContent(tooltipContentEl: HTMLElement) {
150
- tooltipContentEl.innerText = this.options.text;
163
+ if (this.options.tooltipId)
164
+ return;
165
+ tooltipContentEl.innerText = this.options.text;
151
166
  }
152
167
 
153
168
  _updateTooltipContent() {
@@ -331,16 +346,21 @@ export class Tooltip extends Component<TooltipOptions> {
331
346
  this.close();
332
347
  }
333
348
 
334
- _getAttributeOptions() {
335
- const attributeOptions = {};
349
+ _getAttributeOptions(): Partial<TooltipOptions> {
350
+ let attributeOptions: Partial<TooltipOptions> = { };
336
351
  const tooltipTextOption = this.el.getAttribute('data-tooltip');
352
+ const tooltipId = this.el.getAttribute('data-tooltip-id');
337
353
  const positionOption = this.el.getAttribute('data-position');
338
354
  if (tooltipTextOption) {
339
- (attributeOptions as any).text = tooltipTextOption;
355
+ attributeOptions.text = tooltipTextOption;
340
356
  }
341
357
  if (positionOption) {
342
- (attributeOptions as any).position = positionOption;
358
+ attributeOptions.position = positionOption as TooltipPosition;
359
+ }
360
+ if (tooltipId) {
361
+ attributeOptions.tooltipId = tooltipId;
343
362
  }
363
+
344
364
  return attributeOptions;
345
365
  }
346
366
  }