@dhutaryan/ngx-mat-timepicker 0.0.2 → 12.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 (60) hide show
  1. package/README.md +120 -116
  2. package/_index.scss +1 -1
  3. package/_timepicker-theme.scss +148 -109
  4. package/bundles/dhutaryan-ngx-mat-timepicker.umd.js +2914 -2383
  5. package/bundles/dhutaryan-ngx-mat-timepicker.umd.js.map +1 -1
  6. package/dhutaryan-ngx-mat-timepicker.d.ts +5 -5
  7. package/esm2015/dhutaryan-ngx-mat-timepicker.js +4 -4
  8. package/esm2015/lib/adapter/index.js +26 -26
  9. package/esm2015/lib/adapter/native-date-time-adapter.js +130 -130
  10. package/esm2015/lib/adapter/time-adapter.js +79 -62
  11. package/esm2015/lib/clock-dials.js +64 -61
  12. package/esm2015/lib/hours-clock-dial.js +221 -159
  13. package/esm2015/lib/minutes-clock-dial.js +157 -124
  14. package/esm2015/lib/time-face-base.js +224 -75
  15. package/esm2015/lib/time-input-base.js +86 -0
  16. package/esm2015/lib/time-inputs.js +140 -142
  17. package/esm2015/lib/time-period.js +69 -55
  18. package/esm2015/lib/time-selection-model.js +76 -76
  19. package/esm2015/lib/timepicker-actions-default.js +3 -3
  20. package/esm2015/lib/timepicker-actions.js +139 -125
  21. package/esm2015/lib/timepicker-animations.js +22 -22
  22. package/esm2015/lib/timepicker-base.js +362 -335
  23. package/esm2015/lib/timepicker-content-layout.js +23 -23
  24. package/esm2015/lib/timepicker-content.js +100 -104
  25. package/esm2015/lib/timepicker-input-base.js +223 -203
  26. package/esm2015/lib/timepicker-input.js +126 -92
  27. package/esm2015/lib/timepicker-intl.js +21 -21
  28. package/esm2015/lib/timepicker-scroll-strategy.js +15 -15
  29. package/esm2015/lib/timepicker-toggle.js +71 -71
  30. package/esm2015/lib/timepicker.js +32 -26
  31. package/esm2015/lib/timepicker.module.js +151 -147
  32. package/esm2015/public-api.js +20 -20
  33. package/fesm2015/dhutaryan-ngx-mat-timepicker.js +2369 -1911
  34. package/fesm2015/dhutaryan-ngx-mat-timepicker.js.map +1 -1
  35. package/lib/adapter/index.d.ts +9 -9
  36. package/lib/adapter/native-date-time-adapter.d.ts +43 -43
  37. package/lib/adapter/time-adapter.d.ts +129 -120
  38. package/lib/clock-dials.d.ts +23 -23
  39. package/lib/hours-clock-dial.d.ts +61 -41
  40. package/lib/minutes-clock-dial.d.ts +38 -27
  41. package/lib/time-face-base.d.ts +61 -30
  42. package/lib/time-input-base.d.ts +30 -0
  43. package/lib/time-inputs.d.ts +32 -39
  44. package/lib/time-period.d.ts +21 -19
  45. package/lib/time-selection-model.d.ts +62 -62
  46. package/lib/timepicker-actions-default.d.ts +3 -3
  47. package/lib/timepicker-actions.d.ts +50 -41
  48. package/lib/timepicker-animations.d.ts +6 -6
  49. package/lib/timepicker-base.d.ts +147 -121
  50. package/lib/timepicker-content-layout.d.ts +7 -7
  51. package/lib/timepicker-content.d.ts +50 -50
  52. package/lib/timepicker-input-base.d.ts +102 -94
  53. package/lib/timepicker-input.d.ts +45 -33
  54. package/lib/timepicker-intl.d.ts +13 -13
  55. package/lib/timepicker-scroll-strategy.d.ts +12 -12
  56. package/lib/timepicker-toggle.d.ts +26 -26
  57. package/lib/timepicker.d.ts +6 -6
  58. package/lib/timepicker.module.d.ts +28 -28
  59. package/package.json +8 -1
  60. package/public-api.d.ts +16 -16
package/README.md CHANGED
@@ -1,116 +1,120 @@
1
- **It's a beta version. Don't use it in production till major version release.**
2
-
3
- # ngx-mat-timepicker
4
-
5
- [![npm](https://img.shields.io/npm/v/@dhutaryan/ngx-mat-timepicker.svg)](https://www.npmjs.com/package/@dhutaryan/ngx-mat-timepicker)
6
- [![code factor](https://img.shields.io/codefactor/grade/github/dgutoryan/ngx-mat-timepicker)](https://www.codefactor.io/repository/github/dgutoryan/ngx-mat-timepicker)
7
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dgutoryan/ngx-timepicker/blob/master/LICENSE)
8
-
9
- The timepicker module using Angular material.
10
-
11
- ## Installation
12
-
13
- You have to install the Angular Material and set it up. [Learn more about the setup](https://material.angular.io/guide/getting-started).
14
-
15
- Install the library:
16
-
17
- ```bash
18
- $ npm install --save @dhutaryan/ngx-mat-timepicker
19
- ```
20
-
21
- or
22
-
23
- ```bash
24
- $ yarn add @dhutaryan/ngx-mat-timepicker
25
- ```
26
-
27
- ## Getting started
28
-
29
- Import `MatTimepickerModule` to your project.
30
-
31
- ```typescript
32
- import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
33
-
34
- @NgModule({
35
- imports: [
36
- // ...
37
- MatTimepickerModule,
38
- // ...
39
- ],
40
- })
41
- export class MyModule {}
42
- ```
43
-
44
- ## Adapter
45
-
46
- Add a timepicker adapter.
47
-
48
- ```typescript
49
- import { MatNativeDateTimeModule, MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
50
-
51
- @NgModule({
52
- imports: [
53
- // ...
54
- MatTimepickerModule,
55
- MatNativeDateTimeModule,
56
- // ...
57
- ],
58
- })
59
- export class MyModule {}
60
- ```
61
-
62
- or create your own
63
-
64
- ```typescript
65
- import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
66
-
67
- @NgModule({
68
- imports: [
69
- // ...
70
- MatTimepickerModule,
71
- // ...
72
- ],
73
- providers: [{ provide: TimeAdapter, useClass: MyTimeAdapter }],
74
- })
75
- export class MyModule {}
76
- ```
77
-
78
- ## Theming
79
-
80
- Then you have to define a theme. [More details about theming](https://material.angular.io/guide/theming).
81
-
82
- ```scss
83
- @use "@dhutaryan/ngx-mat-timepicker" as mat-timepicker;
84
-
85
- @include mat-timepicker.timepicker-theme($theme);
86
- ```
87
-
88
- ## Usage
89
-
90
- ```html
91
- <mat-form-field>
92
- <input type="text" matInput [matTimepicker]="timepicker" />
93
- <mat-timepicker-toggle matSuffix [for]="timepicker"></mat-timepicker-toggle>
94
- <mat-timepicker #timepicker></mat-timepicker>
95
- </mat-form-field>
96
- ```
97
-
98
- ## Locale
99
-
100
- Default locale is `en-US`. You can set your locale as:
101
-
102
- ```typescript
103
- import { MAT_TIME_LOCALE } from "@dhutaryan/ngx-mat-timepicker";
104
-
105
- @NgModule({
106
- imports: [
107
- // ...
108
- ],
109
- providers: [{ provide: MAT_TIME_LOCALE, useValue: "en-GB" }],
110
- })
111
- export class MyModule {}
112
- ```
113
-
114
- ## License
115
-
116
- MIT
1
+ # ngx-mat-timepicker
2
+
3
+ [![npm](https://img.shields.io/npm/v/@dhutaryan/ngx-mat-timepicker.svg)](https://www.npmjs.com/package/@dhutaryan/ngx-mat-timepicker)
4
+ [![code factor](https://img.shields.io/codefactor/grade/github/dgutoryan/ngx-mat-timepicker)](https://www.codefactor.io/repository/github/dgutoryan/ngx-mat-timepicker)
5
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dgutoryan/ngx-timepicker/blob/master/LICENSE)
6
+
7
+ The timepicker module using Angular material.
8
+
9
+ ### Versions
10
+
11
+ | mat-timepicker | Angular |
12
+ | -------------- | ------------------- |
13
+ | 12.x.x | >=12.0.0 && <15.0.0 |
14
+
15
+ ## Installation
16
+
17
+ You have to install the Angular Material and set it up. [Learn more about the setup](https://material.angular.io/guide/getting-started).
18
+
19
+ Install the library:
20
+
21
+ ```bash
22
+ $ npm install --save @dhutaryan/ngx-mat-timepicker
23
+ ```
24
+
25
+ or
26
+
27
+ ```bash
28
+ $ yarn add @dhutaryan/ngx-mat-timepicker
29
+ ```
30
+
31
+ ## Getting started
32
+
33
+ Import `MatTimepickerModule` to your project.
34
+
35
+ ```typescript
36
+ import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
37
+
38
+ @NgModule({
39
+ imports: [
40
+ // ...
41
+ MatTimepickerModule,
42
+ // ...
43
+ ],
44
+ })
45
+ export class MyModule {}
46
+ ```
47
+
48
+ ## Adapter
49
+
50
+ Add a timepicker adapter.
51
+
52
+ ```typescript
53
+ import { MatNativeDateTimeModule, MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
54
+
55
+ @NgModule({
56
+ imports: [
57
+ // ...
58
+ MatTimepickerModule,
59
+ MatNativeDateTimeModule,
60
+ // ...
61
+ ],
62
+ })
63
+ export class MyModule {}
64
+ ```
65
+
66
+ or create your own
67
+
68
+ ```typescript
69
+ import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
70
+
71
+ @NgModule({
72
+ imports: [
73
+ // ...
74
+ MatTimepickerModule,
75
+ // ...
76
+ ],
77
+ providers: [{ provide: TimeAdapter, useClass: MyTimeAdapter }],
78
+ })
79
+ export class MyModule {}
80
+ ```
81
+
82
+ ## Theming
83
+
84
+ Then you have to define a theme. [More details about theming](https://material.angular.io/guide/theming).
85
+
86
+ ```scss
87
+ @use "@dhutaryan/ngx-mat-timepicker" as mat-timepicker;
88
+
89
+ @include mat-timepicker.timepicker-theme($theme);
90
+ ```
91
+
92
+ ## Usage
93
+
94
+ ```html
95
+ <mat-form-field>
96
+ <input type="text" matInput [matTimepicker]="timepicker" />
97
+ <mat-timepicker-toggle matSuffix [for]="timepicker"></mat-timepicker-toggle>
98
+ <mat-timepicker #timepicker></mat-timepicker>
99
+ </mat-form-field>
100
+ ```
101
+
102
+ ## Locale
103
+
104
+ Default locale is `en-US`. You can set your locale as:
105
+
106
+ ```typescript
107
+ import { MAT_TIME_LOCALE } from "@dhutaryan/ngx-mat-timepicker";
108
+
109
+ @NgModule({
110
+ imports: [
111
+ // ...
112
+ ],
113
+ providers: [{ provide: MAT_TIME_LOCALE, useValue: "en-GB" }],
114
+ })
115
+ export class MyModule {}
116
+ ```
117
+
118
+ ## License
119
+
120
+ MIT
package/_index.scss CHANGED
@@ -1 +1 @@
1
- @forward "./timepicker-theme" as timepicker-* show timepicker-theme;
1
+ @forward "./timepicker-theme" as timepicker-* show timepicker-theme;
@@ -1,109 +1,148 @@
1
- @use "sass:color";
2
- @use "sass:map";
3
- @use "@angular/material" as mat;
4
-
5
- $timepicker-content-title-font-size: 10px !default;
6
- $input-font-size: 2rem !default;
7
- $inputs-separator-font-size: 3rem !default;
8
- $inputs-separator-line-height: 1.25rem;
9
- $primary-opacity: 0.15;
10
-
11
- @mixin color($config-or-theme) {
12
- $config: mat.get-color-config($config-or-theme);
13
- $is-dark-theme: map.get($config, is-dark);
14
- $primary: map.get($config, primary);
15
- $foreground: map.get($config, foreground);
16
- $background: map.get($config, background);
17
-
18
- .mat-timepicker-content {
19
- @include mat.elevation(4);
20
- background-color: mat.get-color-from-palette($background, card);
21
- color: mat.get-color-from-palette($foreground, text);
22
- }
23
-
24
- .mat-timepicker-content-layout-title {
25
- color: mat.get-color-from-palette($foreground, secondary-text);
26
- }
27
-
28
- .mat-time-toggle-mode-button svg {
29
- fill: mat.get-color-from-palette($foreground, secondary-text);
30
- }
31
-
32
- .mat-time-period {
33
- border-color: mat.get-color-from-palette($foreground, divider);
34
- }
35
-
36
- .mat-time-period-item-active,
37
- .mat-clock-dial-value.mat-clock-dial-value-active {
38
- color: mat.get-color-from-palette($primary);
39
- background-color: mat.get-color-from-palette($primary, $primary-opacity);
40
- }
41
-
42
- .mat-clock-dial-value,
43
- .mat-clock-dial {
44
- background-color: mat.get-color-from-palette($background, background);
45
- }
46
-
47
- .mat-clock-dial::before {
48
- background-color: mat.get-color-from-palette($primary);
49
- }
50
-
51
- .mat-clock-dial-hand {
52
- background-color: mat.get-color-from-palette($primary);
53
-
54
- &::before {
55
- background-color: mat.get-color-from-palette($primary);
56
- }
57
- }
58
-
59
- [mat-mini-fab]:not(.mat-primary):not(.mat-accent):not(.mat-warn) {
60
- background: transparent;
61
-
62
- &:hover {
63
- background-color: mat.get-color-from-palette($background, hover);
64
- }
65
- }
66
- }
67
-
68
- @mixin typography($config-or-theme) {
69
- $config: mat.get-typography-config($config-or-theme);
70
-
71
- h6.mat-timepicker-content-layout-title {
72
- font: {
73
- size: $timepicker-content-title-font-size;
74
- weight: mat.font-weight($config, body-2);
75
- }
76
- }
77
-
78
- .mat-time-inputs-field {
79
- input.mat-input-element {
80
- font-size: $input-font-size;
81
- line-height: normal;
82
- }
83
- }
84
-
85
- .mat-timepicker-content-layout-separator {
86
- font-size: $inputs-separator-font-size;
87
- line-height: $inputs-separator-line-height;
88
- }
89
-
90
- .mat-clock-dial-value {
91
- font-size: $input-font-size;
92
- }
93
- }
94
-
95
- @mixin theme($theme-or-color-config) {
96
- $color: mat.get-color-config($theme-or-color-config);
97
- $typography: mat.get-typography-config($theme-or-color-config);
98
-
99
- @if $color != null {
100
- @include color($color);
101
- }
102
-
103
- @if $typography != null {
104
- @include typography($typography);
105
- } @else {
106
- $typography: mat.define-typography-config();
107
- @include typography($typography);
108
- }
109
- }
1
+ @use "sass:color";
2
+ @use "sass:map";
3
+ @use "@angular/material" as mat;
4
+
5
+ $timepicker-content-title-font-size: 10px !default;
6
+ $input-font-size: 2rem !default;
7
+ $inputs-separator-font-size: 3rem !default;
8
+ $inputs-separator-line-height: 1.25rem;
9
+ $primary-opacity: 0.15;
10
+
11
+ @mixin _color($palette) {
12
+ .mat-time-period-item-active,
13
+ .mat-clock-dial-value.mat-clock-dial-value-active {
14
+ color: mat.get-color-from-palette($palette);
15
+ background-color: mat.get-color-from-palette($palette, $primary-opacity);
16
+ }
17
+
18
+ .mat-clock-dial::before {
19
+ background-color: mat.get-color-from-palette($palette);
20
+ }
21
+
22
+ .mat-clock-dial-hand {
23
+ background-color: mat.get-color-from-palette($palette);
24
+
25
+ &::before {
26
+ background-color: mat.get-color-from-palette($palette);
27
+ }
28
+ }
29
+
30
+ .mat-clock-dial-hand.mat-clock-dial-hand-disabled {
31
+ &::before {
32
+ background-color: color.adjust(
33
+ mat.get-color-from-palette($palette),
34
+ $alpha: -0.6
35
+ );
36
+ }
37
+ }
38
+
39
+ [mat-mini-fab].mat-clock-dial-cell.mat-button-disabled {
40
+ background-color: color.adjust(
41
+ mat.get-color-from-palette($palette),
42
+ $alpha: -0.6
43
+ );
44
+ }
45
+ }
46
+
47
+ @mixin color($config-or-theme) {
48
+ $config: mat.get-color-config($config-or-theme);
49
+ $is-dark-theme: map.get($config, is-dark);
50
+ $primary: map.get($config, primary);
51
+ $accent: map.get($config, accent);
52
+ $warn: map.get($config, warn);
53
+ $foreground: map.get($config, foreground);
54
+ $background: map.get($config, background);
55
+
56
+ @include _color(map.get($config, primary));
57
+
58
+ .mat-timepicker-content {
59
+ @include mat.elevation(4);
60
+ background-color: mat.get-color-from-palette($background, card);
61
+ color: mat.get-color-from-palette($foreground, text);
62
+
63
+ &.mat-accent {
64
+ @include _color(map.get($config, accent));
65
+ }
66
+
67
+ &.mat-warn {
68
+ @include _color(map.get($config, warn));
69
+ }
70
+ }
71
+
72
+ .mat-timepicker-content-layout-title {
73
+ color: mat.get-color-from-palette($foreground, secondary-text);
74
+ }
75
+
76
+ .mat-time-toggle-mode-button svg {
77
+ fill: mat.get-color-from-palette($foreground, secondary-text);
78
+ }
79
+
80
+ .mat-time-period {
81
+ border-color: mat.get-color-from-palette($foreground, divider);
82
+ }
83
+
84
+ .mat-time-period-item-disabled {
85
+ color: mat.get-color-from-palette($foreground, disabled-button);
86
+ background-color: mat.get-color-from-palette($background, disabled-button);
87
+ }
88
+
89
+ .mat-clock-dial-value,
90
+ .mat-clock-dial {
91
+ background-color: mat.get-color-from-palette($background, background);
92
+ }
93
+
94
+ .mat-clock-dial-hand.mat-clock-dial-hand-disabled {
95
+ background-color: transparent;
96
+ }
97
+
98
+ [mat-mini-fab]:not(.mat-primary):not(.mat-accent):not(.mat-warn) {
99
+ background: transparent;
100
+
101
+ &:hover {
102
+ background-color: mat.get-color-from-palette($background, hover);
103
+ }
104
+ }
105
+ }
106
+
107
+ @mixin typography($config-or-theme) {
108
+ $config: mat.get-typography-config($config-or-theme);
109
+
110
+ h6.mat-timepicker-content-layout-title {
111
+ font: {
112
+ size: $timepicker-content-title-font-size;
113
+ weight: mat.font-weight($config, body-2);
114
+ }
115
+ }
116
+
117
+ .mat-time-inputs-field {
118
+ input.mat-input-element {
119
+ font-size: $input-font-size;
120
+ line-height: normal;
121
+ }
122
+ }
123
+
124
+ .mat-timepicker-content-layout-separator {
125
+ font-size: $inputs-separator-font-size;
126
+ line-height: $inputs-separator-line-height;
127
+ }
128
+
129
+ .mat-clock-dial-value {
130
+ font-size: $input-font-size;
131
+ }
132
+ }
133
+
134
+ @mixin theme($theme-or-color-config) {
135
+ $color: mat.get-color-config($theme-or-color-config);
136
+ $typography: mat.get-typography-config($theme-or-color-config);
137
+
138
+ @if $color != null {
139
+ @include color($color);
140
+ }
141
+
142
+ @if $typography != null {
143
+ @include typography($typography);
144
+ } @else {
145
+ $typography: mat.define-typography-config();
146
+ @include typography($typography);
147
+ }
148
+ }