@dhutaryan/ngx-mat-timepicker 0.0.1

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 (56) hide show
  1. package/README.md +100 -0
  2. package/_index.scss +1 -0
  3. package/_timepicker-theme.scss +109 -0
  4. package/bundles/dhutaryan-ngx-mat-timepicker.umd.js +2476 -0
  5. package/bundles/dhutaryan-ngx-mat-timepicker.umd.js.map +1 -0
  6. package/dhutaryan-ngx-mat-timepicker.d.ts +5 -0
  7. package/esm2015/dhutaryan-ngx-mat-timepicker.js +5 -0
  8. package/esm2015/lib/adapter/index.js +26 -0
  9. package/esm2015/lib/adapter/native-date-time-adapter.js +130 -0
  10. package/esm2015/lib/adapter/time-adapter.js +62 -0
  11. package/esm2015/lib/clock-dials.js +59 -0
  12. package/esm2015/lib/hours-clock-dial.js +159 -0
  13. package/esm2015/lib/minutes-clock-dial.js +124 -0
  14. package/esm2015/lib/time-face-base.js +75 -0
  15. package/esm2015/lib/time-inputs.js +140 -0
  16. package/esm2015/lib/time-period.js +55 -0
  17. package/esm2015/lib/time-selection-model.js +76 -0
  18. package/esm2015/lib/timepicker-actions-default.js +3 -0
  19. package/esm2015/lib/timepicker-actions.js +125 -0
  20. package/esm2015/lib/timepicker-animations.js +22 -0
  21. package/esm2015/lib/timepicker-base.js +335 -0
  22. package/esm2015/lib/timepicker-content-layout.js +23 -0
  23. package/esm2015/lib/timepicker-content.js +104 -0
  24. package/esm2015/lib/timepicker-input-base.js +203 -0
  25. package/esm2015/lib/timepicker-input.js +92 -0
  26. package/esm2015/lib/timepicker-scroll-strategy.js +15 -0
  27. package/esm2015/lib/timepicker-toggle.js +71 -0
  28. package/esm2015/lib/timepicker.js +26 -0
  29. package/esm2015/lib/timepicker.module.js +144 -0
  30. package/esm2015/public-api.js +19 -0
  31. package/fesm2015/dhutaryan-ngx-mat-timepicker.js +1967 -0
  32. package/fesm2015/dhutaryan-ngx-mat-timepicker.js.map +1 -0
  33. package/lib/adapter/index.d.ts +9 -0
  34. package/lib/adapter/native-date-time-adapter.d.ts +43 -0
  35. package/lib/adapter/time-adapter.d.ts +120 -0
  36. package/lib/clock-dials.d.ts +21 -0
  37. package/lib/hours-clock-dial.d.ts +41 -0
  38. package/lib/minutes-clock-dial.d.ts +27 -0
  39. package/lib/time-face-base.d.ts +30 -0
  40. package/lib/time-inputs.d.ts +37 -0
  41. package/lib/time-period.d.ts +19 -0
  42. package/lib/time-selection-model.d.ts +62 -0
  43. package/lib/timepicker-actions-default.d.ts +3 -0
  44. package/lib/timepicker-actions.d.ts +41 -0
  45. package/lib/timepicker-animations.d.ts +6 -0
  46. package/lib/timepicker-base.d.ts +121 -0
  47. package/lib/timepicker-content-layout.d.ts +7 -0
  48. package/lib/timepicker-content.d.ts +50 -0
  49. package/lib/timepicker-input-base.d.ts +94 -0
  50. package/lib/timepicker-input.d.ts +33 -0
  51. package/lib/timepicker-scroll-strategy.d.ts +12 -0
  52. package/lib/timepicker-toggle.d.ts +26 -0
  53. package/lib/timepicker.d.ts +6 -0
  54. package/lib/timepicker.module.d.ts +28 -0
  55. package/package.json +36 -0
  56. package/public-api.d.ts +15 -0
package/README.md ADDED
@@ -0,0 +1,100 @@
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-timepicker)](https://www.codefactor.io/repository/github/dgutoryan/ngx-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
+ ## License
99
+
100
+ MIT
package/_index.scss ADDED
@@ -0,0 +1 @@
1
+ @forward "./timepicker-theme" as timepicker-* show timepicker-theme;
@@ -0,0 +1,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($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
+ }