ng-primitives 0.19.0 → 0.20.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.
@@ -0,0 +1,3 @@
1
+ # ng-primitives/date-time-luxon
2
+
3
+ Secondary entry point of `ng-primitives`. It can be used by importing from `ng-primitives/date-time-luxon`.
@@ -0,0 +1 @@
1
+ export * from './luxon-date-adapter/luxon-date-adapter';
@@ -0,0 +1,28 @@
1
+ import { DateTime } from 'luxon';
2
+ import { NgpDateAdapter, NgpDateUnits, NgpDuration } from 'ng-primitives/date-time';
3
+ export declare class NgpLuxonDateAdapter implements NgpDateAdapter<DateTime> {
4
+ now(): DateTime<true>;
5
+ set(date: DateTime, values: NgpDateUnits): DateTime<boolean>;
6
+ add(date: DateTime, duration: NgpDuration): DateTime<boolean>;
7
+ subtract(date: DateTime, duration: NgpDuration): DateTime<boolean>;
8
+ compare(a: DateTime, b: DateTime): number;
9
+ isEqual(a: DateTime, b: DateTime): boolean;
10
+ isBefore(a: DateTime, b: DateTime): boolean;
11
+ isAfter(a: DateTime, b: DateTime): boolean;
12
+ isSameDay(a: DateTime, b: DateTime): boolean;
13
+ isSameMonth(a: DateTime, b: DateTime): boolean;
14
+ isSameYear(a: DateTime, b: DateTime): boolean;
15
+ getYear(date: DateTime): number;
16
+ getMonth(date: DateTime): number;
17
+ getDate(date: DateTime): number;
18
+ getDay(date: DateTime): number;
19
+ getHours(date: DateTime): number;
20
+ getMinutes(date: DateTime): number;
21
+ getSeconds(date: DateTime): number;
22
+ getMilliseconds(date: DateTime): number;
23
+ startOfMonth(date: DateTime): DateTime<boolean>;
24
+ endOfMonth(date: DateTime): DateTime<boolean>;
25
+ startOfDay(date: DateTime): DateTime<boolean>;
26
+ endOfDay(date: DateTime): DateTime<boolean>;
27
+ create(values: NgpDateUnits): DateTime<true> | DateTime<false>;
28
+ }
@@ -0,0 +1,91 @@
1
+ import { DateTime } from 'luxon';
2
+
3
+ class NgpLuxonDateAdapter {
4
+ now() {
5
+ return DateTime.now();
6
+ }
7
+ set(date, values) {
8
+ return date.set(values);
9
+ }
10
+ add(date, duration) {
11
+ return date.plus(duration);
12
+ }
13
+ subtract(date, duration) {
14
+ return date.minus(duration);
15
+ }
16
+ compare(a, b) {
17
+ if (a < b) {
18
+ return -1;
19
+ }
20
+ else if (a > b) {
21
+ return 1;
22
+ }
23
+ else {
24
+ return 0;
25
+ }
26
+ }
27
+ isEqual(a, b) {
28
+ return a.equals(b);
29
+ }
30
+ isBefore(a, b) {
31
+ return a < b;
32
+ }
33
+ isAfter(a, b) {
34
+ return a > b;
35
+ }
36
+ isSameDay(a, b) {
37
+ return a.hasSame(b, 'day') && a.hasSame(b, 'month') && a.hasSame(b, 'year');
38
+ }
39
+ isSameMonth(a, b) {
40
+ return a.hasSame(b, 'month') && a.hasSame(b, 'year');
41
+ }
42
+ isSameYear(a, b) {
43
+ return a.hasSame(b, 'year');
44
+ }
45
+ getYear(date) {
46
+ return date.year;
47
+ }
48
+ getMonth(date) {
49
+ return date.month;
50
+ }
51
+ getDate(date) {
52
+ return date.day;
53
+ }
54
+ getDay(date) {
55
+ return date.weekday;
56
+ }
57
+ getHours(date) {
58
+ return date.hour;
59
+ }
60
+ getMinutes(date) {
61
+ return date.minute;
62
+ }
63
+ getSeconds(date) {
64
+ return date.second;
65
+ }
66
+ getMilliseconds(date) {
67
+ return date.millisecond;
68
+ }
69
+ startOfMonth(date) {
70
+ return date.startOf('month');
71
+ }
72
+ endOfMonth(date) {
73
+ return date.endOf('month');
74
+ }
75
+ startOfDay(date) {
76
+ return date.startOf('day');
77
+ }
78
+ endOfDay(date) {
79
+ return date.endOf('day');
80
+ }
81
+ create(values) {
82
+ return DateTime.fromObject(values);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Generated bundle index. Do not edit.
88
+ */
89
+
90
+ export { NgpLuxonDateAdapter };
91
+ //# sourceMappingURL=ng-primitives-date-time-luxon.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-primitives-date-time-luxon.mjs","sources":["../../../../packages/ng-primitives/date-time-luxon/src/luxon-date-adapter/luxon-date-adapter.ts","../../../../packages/ng-primitives/date-time-luxon/src/ng-primitives-date-time-luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport { NgpDateAdapter, NgpDateUnits, NgpDuration } from 'ng-primitives/date-time';\n\nexport class NgpLuxonDateAdapter implements NgpDateAdapter<DateTime> {\n now() {\n return DateTime.now();\n }\n\n set(date: DateTime, values: NgpDateUnits) {\n return date.set(values);\n }\n\n add(date: DateTime, duration: NgpDuration) {\n return date.plus(duration);\n }\n\n subtract(date: DateTime, duration: NgpDuration) {\n return date.minus(duration);\n }\n\n compare(a: DateTime, b: DateTime): number {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else {\n return 0;\n }\n }\n\n isEqual(a: DateTime, b: DateTime): boolean {\n return a.equals(b);\n }\n\n isBefore(a: DateTime, b: DateTime): boolean {\n return a < b;\n }\n\n isAfter(a: DateTime, b: DateTime): boolean {\n return a > b;\n }\n\n isSameDay(a: DateTime, b: DateTime): boolean {\n return a.hasSame(b, 'day') && a.hasSame(b, 'month') && a.hasSame(b, 'year');\n }\n\n isSameMonth(a: DateTime, b: DateTime): boolean {\n return a.hasSame(b, 'month') && a.hasSame(b, 'year');\n }\n\n isSameYear(a: DateTime, b: DateTime): boolean {\n return a.hasSame(b, 'year');\n }\n\n getYear(date: DateTime): number {\n return date.year;\n }\n\n getMonth(date: DateTime): number {\n return date.month;\n }\n\n getDate(date: DateTime): number {\n return date.day;\n }\n\n getDay(date: DateTime): number {\n return date.weekday;\n }\n\n getHours(date: DateTime): number {\n return date.hour;\n }\n\n getMinutes(date: DateTime): number {\n return date.minute;\n }\n\n getSeconds(date: DateTime): number {\n return date.second;\n }\n\n getMilliseconds(date: DateTime): number {\n return date.millisecond;\n }\n\n startOfMonth(date: DateTime) {\n return date.startOf('month');\n }\n\n endOfMonth(date: DateTime) {\n return date.endOf('month');\n }\n\n startOfDay(date: DateTime) {\n return date.startOf('day');\n }\n\n endOfDay(date: DateTime) {\n return date.endOf('day');\n }\n\n create(values: NgpDateUnits) {\n return DateTime.fromObject(values);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAGa,mBAAmB,CAAA;IAC9B,GAAG,GAAA;AACD,QAAA,OAAO,QAAQ,CAAC,GAAG,EAAE;;IAGvB,GAAG,CAAC,IAAc,EAAE,MAAoB,EAAA;AACtC,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;;IAGzB,GAAG,CAAC,IAAc,EAAE,QAAqB,EAAA;AACvC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;;IAG5B,QAAQ,CAAC,IAAc,EAAE,QAAqB,EAAA;AAC5C,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;;IAG7B,OAAO,CAAC,CAAW,EAAE,CAAW,EAAA;AAC9B,QAAA,IAAI,CAAC,GAAG,CAAC,EAAE;YACT,OAAO,CAAC,CAAC;;AACJ,aAAA,IAAI,CAAC,GAAG,CAAC,EAAE;AAChB,YAAA,OAAO,CAAC;;aACH;AACL,YAAA,OAAO,CAAC;;;IAIZ,OAAO,CAAC,CAAW,EAAE,CAAW,EAAA;AAC9B,QAAA,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;;IAGpB,QAAQ,CAAC,CAAW,EAAE,CAAW,EAAA;QAC/B,OAAO,CAAC,GAAG,CAAC;;IAGd,OAAO,CAAC,CAAW,EAAE,CAAW,EAAA;QAC9B,OAAO,CAAC,GAAG,CAAC;;IAGd,SAAS,CAAC,CAAW,EAAE,CAAW,EAAA;QAChC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,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MAAoB,EAAA;AACzB,QAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;;AAErC;;ACzGD;;AAEG;;;;"}
@@ -73,6 +73,12 @@ class NgpFileUpload {
73
73
  this.selected = output({
74
74
  alias: 'ngpFileUploadSelected',
75
75
  });
76
+ /**
77
+ * Emits when the user selects files.
78
+ */
79
+ this.canceled = output({
80
+ alias: 'ngpFileUploadCanceled',
81
+ });
76
82
  /**
77
83
  * Emits when the user drags a file over the file upload.
78
84
  */
@@ -89,6 +95,7 @@ class NgpFileUpload {
89
95
  this.input = document.createElement('input');
90
96
  this.input.type = 'file';
91
97
  this.input.addEventListener('change', () => this.selected.emit(this.input.files));
98
+ this.input.addEventListener('cancel', () => this.canceled.emit());
92
99
  }
93
100
  showFileDialog() {
94
101
  if (this.disabled()) {
@@ -144,7 +151,7 @@ class NgpFileUpload {
144
151
  }
145
152
  }
146
153
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
147
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFileUpload, isStandalone: true, selector: "[ngpFileUpload]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileUploadFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileUploadMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileUploadDirectory", isSignal: true, isRequired: false, transformFunction: null }, dragAndDrop: { classPropertyName: "dragAndDrop", publicName: "ngpFileUploadDragDrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileUploadDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileUploadSelected", dragOver: "ngpFileUploadDragOver" }, host: { listeners: { "click": "showFileDialog()", "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-dragover": "isDragOver() ? \"\" : null" } }, providers: [{ provide: NgpFileUploadToken, useExisting: NgpFileUpload }], exportAs: ["ngpFileUpload"], hostDirectives: [{ directive: i1.NgpHover }, { directive: i1.NgpFocusVisible }, { directive: i1.NgpPress }], ngImport: i0 }); }
154
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFileUpload, isStandalone: true, selector: "[ngpFileUpload]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileUploadFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileUploadMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileUploadDirectory", isSignal: true, isRequired: false, transformFunction: null }, dragAndDrop: { classPropertyName: "dragAndDrop", publicName: "ngpFileUploadDragDrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileUploadDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileUploadSelected", canceled: "ngpFileUploadCanceled", dragOver: "ngpFileUploadDragOver" }, host: { listeners: { "click": "showFileDialog()", "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-dragover": "isDragOver() ? \"\" : null" } }, providers: [{ provide: NgpFileUploadToken, useExisting: NgpFileUpload }], exportAs: ["ngpFileUpload"], hostDirectives: [{ directive: i1.NgpHover }, { directive: i1.NgpFocusVisible }, { directive: i1.NgpPress }], ngImport: i0 }); }
148
155
  }
149
156
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileUpload, decorators: [{
150
157
  type: Directive,
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.token.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.directive.ts","../../../../packages/ng-primitives/file-upload/src/index.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFileUpload } from './file-upload.directive';\n\nexport const NgpFileUploadToken = new InjectionToken<NgpFileUpload>('NgpFileUploadToken');\n\n/**\n * Inject the FileUpload directive instance\n */\nexport function injectFileUpload(): NgpFileUpload {\n return inject(NgpFileUploadToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n booleanAttribute,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpFileUploadToken } from './file-upload.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [{ provide: NgpFileUploadToken, useExisting: NgpFileUpload }],\n host: {\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n },\n hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpFileUpload {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types.\n */\n readonly fileTypes = input<string[] | undefined, string>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: coerceStringArray,\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n private readonly isDragOver = signal<boolean>(false);\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = document.createElement('input');\n\n constructor() {\n this.input.type = 'file';\n this.input.addEventListener('change', () => this.selected.emit(this.input.files));\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.disabled()) {\n return;\n }\n\n const fileTypes = this.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.multiple();\n this.input.webkitdirectory = this.directory();\n this.input.click();\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n if (event.dataTransfer?.files) {\n this.selected.emit(event.dataTransfer.files);\n }\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nexport { NgpFileUpload } from './file-upload/file-upload.directive';\nexport { NgpFileUploadToken, injectFileUpload } from './file-upload/file-upload.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;MAIU,kBAAkB,GAAG,IAAI,cAAc,CAAgB,oBAAoB;AAExF;;AAEG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC;AACnC;;ACjBA;;;;;;AAMG;MA0BU,aAAa,CAAA;AAsExB,IAAA,WAAA,GAAA;AArEA;;AAEG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;AAEzE;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAA+B,SAAS,EAAE;AAClE,YAAA,KAAK,EAAE,wBAAwB;AAC/B,YAAA,SAAS,EAAE,iBAAiB;AAC7B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAA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ACJ,wBAAA,sBAAsB,EAAE,wBAAwB;AAChD,wBAAA,sBAAsB,EAAE,0BAA0B;AACnD,qBAAA;AACD,oBAAA,cAAc,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,CAAC;AACtD,iBAAA;wDA6EW,cAAc,EAAA,CAAA;sBADvB,YAAY;uBAAC,OAAO;gBAkBX,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAa3B,UAAU,EAAA,CAAA;sBADnB,YAAY;uBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;gBAY1B,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAkB3B,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;ACpKlC;;;;;;AAMG;;ACNH;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.token.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.directive.ts","../../../../packages/ng-primitives/file-upload/src/index.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFileUpload } from './file-upload.directive';\n\nexport const NgpFileUploadToken = new InjectionToken<NgpFileUpload>('NgpFileUploadToken');\n\n/**\n * Inject the FileUpload directive instance\n */\nexport function injectFileUpload(): NgpFileUpload {\n return inject(NgpFileUploadToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n booleanAttribute,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpFileUploadToken } from './file-upload.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [{ provide: NgpFileUploadToken, useExisting: NgpFileUpload }],\n host: {\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n },\n hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpFileUpload {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types.\n */\n readonly fileTypes = input<string[] | undefined, string>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: coerceStringArray,\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n private readonly isDragOver = signal<boolean>(false);\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = document.createElement('input');\n\n constructor() {\n this.input.type = 'file';\n this.input.addEventListener('change', () => this.selected.emit(this.input.files));\n this.input.addEventListener('cancel', () => this.canceled.emit());\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.disabled()) {\n return;\n }\n\n const fileTypes = this.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.multiple();\n this.input.webkitdirectory = this.directory();\n this.input.click();\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.disabled() || !this.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n if (event.dataTransfer?.files) {\n this.selected.emit(event.dataTransfer.files);\n }\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nexport { NgpFileUpload } from './file-upload/file-upload.directive';\nexport { NgpFileUploadToken, injectFileUpload } from './file-upload/file-upload.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;MAIU,kBAAkB,GAAG,IAAI,cAAc,CAAgB,oBAAoB;AAExF;;AAEG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC;AACnC;;ACjBA;;;;;;AAMG;MA0BU,aAAa,CAAA;AA6ExB,IAAA,WAAA,GAAA;AA5EA;;AAEG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;AAEzE;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAA+B,SAAS,EAAE;AAClE,YAAA,KAAK,EAAE,wBAAwB;AAC/B,YAAA,SAAS,EAAE,iBAAiB;AAC7B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,uBAAuB;AAC9B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAwB,KAAK,EAAE;AACvD,YAAA,KAAK,EAAE,wBAAwB;AAC/B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAwB,IAAI,EAAE;AACxD,YAAA,KAAK,EAAE,uBAAuB;AAC9B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,uBAAuB;AAC9B,YAAA,SAAS,EAAE,gBAAgB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,UAAU,EAAE,CAAC,QAAQ,CAAC;gBAY1B,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAkB3B,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;AC5KlC;;;;;;AAMG;;ACNH;;AAEG;;;;"}
@@ -37,6 +37,10 @@ export declare class NgpFileUpload {
37
37
  * Emits when the user selects files.
38
38
  */
39
39
  readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
40
+ /**
41
+ * Emits when the user selects files.
42
+ */
43
+ readonly canceled: import("@angular/core").OutputEmitterRef<void>;
40
44
  /**
41
45
  * Emits when the user drags a file over the file upload.
42
46
  */
@@ -56,5 +60,5 @@ export declare class NgpFileUpload {
56
60
  protected onDragLeave(event: DragEvent): void;
57
61
  protected onDrop(event: DragEvent): void;
58
62
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpFileUpload, never>;
59
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFileUpload, "[ngpFileUpload]", ["ngpFileUpload"], { "fileTypes": { "alias": "ngpFileUploadFileTypes"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpFileUploadMultiple"; "required": false; "isSignal": true; }; "directory": { "alias": "ngpFileUploadDirectory"; "required": false; "isSignal": true; }; "dragAndDrop": { "alias": "ngpFileUploadDragDrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFileUploadDisabled"; "required": false; "isSignal": true; }; }, { "selected": "ngpFileUploadSelected"; "dragOver": "ngpFileUploadDragOver"; }, never, never, true, [{ directive: typeof i1.NgpHover; inputs: {}; outputs: {}; }, { directive: typeof i1.NgpFocusVisible; inputs: {}; outputs: {}; }, { directive: typeof i1.NgpPress; inputs: {}; outputs: {}; }]>;
63
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFileUpload, "[ngpFileUpload]", ["ngpFileUpload"], { "fileTypes": { "alias": "ngpFileUploadFileTypes"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpFileUploadMultiple"; "required": false; "isSignal": true; }; "directory": { "alias": "ngpFileUploadDirectory"; "required": false; "isSignal": true; }; "dragAndDrop": { "alias": "ngpFileUploadDragDrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFileUploadDisabled"; "required": false; "isSignal": true; }; }, { "selected": "ngpFileUploadSelected"; "canceled": "ngpFileUploadCanceled"; "dragOver": "ngpFileUploadDragOver"; }, never, never, true, [{ directive: typeof i1.NgpHover; inputs: {}; outputs: {}; }, { directive: typeof i1.NgpFocusVisible; inputs: {}; outputs: {}; }, { directive: typeof i1.NgpPress; inputs: {}; outputs: {}; }]>;
60
64
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ng-primitives",
3
3
  "license": "Apache-2.0",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "peerDependencies": {
6
6
  "@angular/core": ">=19.0.0",
7
7
  "@angular/cdk": ">=19.0.0",
@@ -15,14 +15,14 @@
15
15
  "nx": "^19.3.1",
16
16
  "tslib": "^2.3.0"
17
17
  },
18
+ "peerDependenciesMeta": {
19
+ "luxon": {
20
+ "optional": true
21
+ }
22
+ },
18
23
  "ng-add": {
19
24
  "save": "dependencies"
20
25
  },
21
- "ng-update": {
22
- "packageGroup": [
23
- "@ng-primitives/luxon-date-adapter"
24
- ]
25
- },
26
26
  "sideEffects": false,
27
27
  "generators": "./generators.json",
28
28
  "schematics": "./generators.json",
@@ -48,6 +48,10 @@
48
48
  "types": "./autofill/index.d.ts",
49
49
  "default": "./fesm2022/ng-primitives-autofill.mjs"
50
50
  },
51
+ "./button": {
52
+ "types": "./button/index.d.ts",
53
+ "default": "./fesm2022/ng-primitives-button.mjs"
54
+ },
51
55
  "./avatar": {
52
56
  "types": "./avatar/index.d.ts",
53
57
  "default": "./fesm2022/ng-primitives-avatar.mjs"
@@ -64,22 +68,22 @@
64
68
  "types": "./date-time/index.d.ts",
65
69
  "default": "./fesm2022/ng-primitives-date-time.mjs"
66
70
  },
67
- "./button": {
68
- "types": "./button/index.d.ts",
69
- "default": "./fesm2022/ng-primitives-button.mjs"
71
+ "./date-time-luxon": {
72
+ "types": "./date-time-luxon/index.d.ts",
73
+ "default": "./fesm2022/ng-primitives-date-time-luxon.mjs"
70
74
  },
71
75
  "./dialog": {
72
76
  "types": "./dialog/index.d.ts",
73
77
  "default": "./fesm2022/ng-primitives-dialog.mjs"
74
78
  },
75
- "./focus-trap": {
76
- "types": "./focus-trap/index.d.ts",
77
- "default": "./fesm2022/ng-primitives-focus-trap.mjs"
78
- },
79
79
  "./file-upload": {
80
80
  "types": "./file-upload/index.d.ts",
81
81
  "default": "./fesm2022/ng-primitives-file-upload.mjs"
82
82
  },
83
+ "./focus-trap": {
84
+ "types": "./focus-trap/index.d.ts",
85
+ "default": "./fesm2022/ng-primitives-focus-trap.mjs"
86
+ },
83
87
  "./form-field": {
84
88
  "types": "./form-field/index.d.ts",
85
89
  "default": "./fesm2022/ng-primitives-form-field.mjs"
@@ -108,14 +112,14 @@
108
112
  "types": "./popover/index.d.ts",
109
113
  "default": "./fesm2022/ng-primitives-popover.mjs"
110
114
  },
111
- "./radio": {
112
- "types": "./radio/index.d.ts",
113
- "default": "./fesm2022/ng-primitives-radio.mjs"
114
- },
115
115
  "./progress": {
116
116
  "types": "./progress/index.d.ts",
117
117
  "default": "./fesm2022/ng-primitives-progress.mjs"
118
118
  },
119
+ "./radio": {
120
+ "types": "./radio/index.d.ts",
121
+ "default": "./fesm2022/ng-primitives-radio.mjs"
122
+ },
119
123
  "./resize": {
120
124
  "types": "./resize/index.d.ts",
121
125
  "default": "./fesm2022/ng-primitives-resize.mjs"
@@ -124,10 +128,6 @@
124
128
  "types": "./roving-focus/index.d.ts",
125
129
  "default": "./fesm2022/ng-primitives-roving-focus.mjs"
126
130
  },
127
- "./search": {
128
- "types": "./search/index.d.ts",
129
- "default": "./fesm2022/ng-primitives-search.mjs"
130
- },
131
131
  "./select": {
132
132
  "types": "./select/index.d.ts",
133
133
  "default": "./fesm2022/ng-primitives-select.mjs"
@@ -136,6 +136,10 @@
136
136
  "types": "./slider/index.d.ts",
137
137
  "default": "./fesm2022/ng-primitives-slider.mjs"
138
138
  },
139
+ "./search": {
140
+ "types": "./search/index.d.ts",
141
+ "default": "./fesm2022/ng-primitives-search.mjs"
142
+ },
139
143
  "./switch": {
140
144
  "types": "./switch/index.d.ts",
141
145
  "default": "./fesm2022/ng-primitives-switch.mjs"
@@ -4,8 +4,8 @@ import { NgpRadioIndicator, NgpRadioItem } from 'ng-primitives/radio';
4
4
  @Component({
5
5
  standalone: true,
6
6
  selector: '<%= selector %>',
7
+ imports: [NgpRadioIndicator],
7
8
  hostDirectives: [
8
- NgpRadioIndicator,
9
9
  {
10
10
  directive: NgpRadioItem,
11
11
  inputs: ['ngpRadioItemValue:value'],
@@ -25,33 +25,32 @@ const radioItemStyles = `
25
25
 
26
26
  :host[data-checked] [ngpRadioIndicator] {}
27
27
  `;
28
- const group = 'group';
29
- const item = 'item';
30
- const radioItemPath = 'radio-item';
31
- const radioGroupPath = 'radio-group';
32
28
  async function radioGenerator(tree, options) {
33
29
  const { fileName } = (0, devkit_1.names)(options.name);
34
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, `files/${radioGroupPath}`), options.directory, {
30
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, `files/radio-group`), options.directory, {
35
31
  ...options,
36
- ...(0, devkit_1.names)(`${options.name}-${group}`),
37
- selector: `${options.prefix}-${fileName}-${group}`,
32
+ ...(0, devkit_1.names)(`${options.name}-group`),
33
+ selector: `${options.prefix}-${fileName}-group`,
38
34
  styles: `:host { }`,
39
35
  template: `<ng-content />`,
40
36
  });
41
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, `files/${radioItemPath}`), options.directory, {
37
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, `files/radio-item`), options.directory, {
42
38
  ...options,
43
- ...(0, devkit_1.names)(`${options.name}-${item}`),
44
- selector: `${options.prefix}-${fileName}-${item}`,
39
+ ...(0, devkit_1.names)(`${options.name}-item`),
40
+ selector: `${options.prefix}-${fileName}-item`,
45
41
  styles: radioItemStyles,
46
- template: `<ng-content />`,
42
+ template: `
43
+ <div ngpRadioIndicator></div>
44
+ <ng-content />
45
+ `,
47
46
  });
48
47
  if (options.inlineStyle) {
49
- tree.delete(path.join(options.directory, `${fileName}-${item}.component.${options.style}`));
50
- tree.delete(path.join(options.directory, `${fileName}-${group}.component.${options.style}`));
48
+ tree.delete(path.join(options.directory, `${fileName}-item.component.${options.style}`));
49
+ tree.delete(path.join(options.directory, `${fileName}-group.component.${options.style}`));
51
50
  }
52
51
  if (options.inlineTemplate) {
53
- tree.delete(path.join(options.directory, `${fileName}-${item}.component.html`));
54
- tree.delete(path.join(options.directory, `${fileName}-${group}.component.html`));
52
+ tree.delete(path.join(options.directory, `${fileName}-item.component.html`));
53
+ tree.delete(path.join(options.directory, `${fileName}-group.component.html`));
55
54
  }
56
55
  await (0, devkit_1.formatFiles)(tree);
57
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../packages/ng-primitives/schematics/radio/generator.ts"],"names":[],"mappings":";;AA8BA,wCA8BC;AA5DD;;;;;;GAMG;AACH,uCAAqE;AACrE,6BAA6B;AAG7B,MAAM,eAAe,GAAG;;;;;;;;;;;;;;CAcvB,CAAC;AACF,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,aAAa,GAAG,YAAY,CAAC;AACnC,MAAM,cAAc,GAAG,aAAa,CAAC;AAC9B,KAAK,UAAU,cAAc,CAAC,IAAU,EAAE,OAA6B;IAC5E,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAA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