@skyux/forms 12.0.0-alpha.0 → 12.0.0-alpha.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.
@@ -6,7 +6,7 @@ import * as i0 from "@angular/core";
6
6
  */
7
7
  export declare class SkyFileAttachmentService {
8
8
  #private;
9
- checkFiles(files: FileList, minFileSize: number, maxFileSize: number, acceptedTypes?: string, validateFn?: SkyFileValidateFn): SkyFileItem[];
9
+ checkFiles(files: SkyFileItem[], minFileSize: number, maxFileSize: number, acceptedTypes?: string, validateFn?: SkyFileValidateFn): SkyFileItem[];
10
10
  /**
11
11
  * Returns `true` if a directory is found in the provided `files` parameter.
12
12
  */
@@ -1,4 +1,5 @@
1
1
  import { ElementRef, EventEmitter, OnDestroy, TemplateRef } from '@angular/core';
2
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
2
3
  import { SkyFileItem } from '../shared/file-item';
3
4
  import { SkyFileValidateFn } from '../shared/file-validate-function';
4
5
  import { SkyFileDropChange } from './file-drop-change';
@@ -14,7 +15,7 @@ import * as i0 from "@angular/core";
14
15
  * outside of the file drop component, you can place the `sky-file-drop-target` CSS class
15
16
  * on the element that receives drop events to exempt it from the drop exclusion rule.
16
17
  */
17
- export declare class SkyFileDropComponent implements OnDestroy {
18
+ export declare class SkyFileDropComponent implements OnDestroy, ControlValueAccessor {
18
19
  #private;
19
20
  /**
20
21
  * Fires when users add or remove files.
@@ -135,8 +136,13 @@ export declare class SkyFileDropComponent implements OnDestroy {
135
136
  acceptedOver: boolean;
136
137
  linkUrl: string | undefined;
137
138
  protected errorId: string;
139
+ protected ngControl: NgControl | null;
138
140
  protected rejectedFiles: SkyFileItem[];
141
+ constructor();
139
142
  ngOnDestroy(): void;
143
+ writeValue(value: unknown): void;
144
+ registerOnChange(fn: any): void;
145
+ registerOnTouched(fn: () => void): void;
140
146
  dropClicked(): void;
141
147
  fileChangeEvent(fileChangeEvent: Event): void;
142
148
  fileDragEnter(dragEnterEvent: DragEvent): void;
@@ -145,9 +151,11 @@ export declare class SkyFileDropComponent implements OnDestroy {
145
151
  fileDragLeave(dragLeaveEvent: any): void;
146
152
  addLinkEnter(event: KeyboardEvent): void;
147
153
  addLink(event: Event): void;
154
+ protected uploadLink(file: SkyFileLink): void;
148
155
  onLinkBlur(): void;
156
+ protected get isRequired(): boolean;
149
157
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyFileDropComponent, never>;
150
- static ɵcmp: i0.ɵɵComponentDeclaration<SkyFileDropComponent, "sky-file-drop", never, { "fileUploadAriaLabel": { "alias": "fileUploadAriaLabel"; "required": false; }; "linkUploadAriaLabel": { "alias": "linkUploadAriaLabel"; "required": false; }; "linkUploadHintText": { "alias": "linkUploadHintText"; "required": false; }; "minFileSize": { "alias": "minFileSize"; "required": false; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "validateFn": { "alias": "validateFn"; "required": false; }; "acceptedTypes": { "alias": "acceptedTypes"; "required": false; }; "acceptedTypesErrorMessage": { "alias": "acceptedTypesErrorMessage"; "required": false; }; "noClick": { "alias": "noClick"; "required": false; }; "allowLinks": { "alias": "allowLinks"; "required": false; }; "labelText": { "alias": "labelText"; "required": false; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "hintText": { "alias": "hintText"; "required": false; }; "required": { "alias": "required"; "required": false; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; }; "stacked": { "alias": "stacked"; "required": false; }; "helpKey": { "alias": "helpKey"; "required": false; }; }, { "filesChanged": "filesChanged"; "linkInputBlur": "linkInputBlur"; "linkChanged": "linkChanged"; }, never, ["*"], true, never>;
158
+ static ɵcmp: i0.ɵɵComponentDeclaration<SkyFileDropComponent, "sky-file-drop", never, { "fileUploadAriaLabel": { "alias": "fileUploadAriaLabel"; "required": false; }; "linkUploadAriaLabel": { "alias": "linkUploadAriaLabel"; "required": false; }; "linkUploadHintText": { "alias": "linkUploadHintText"; "required": false; }; "minFileSize": { "alias": "minFileSize"; "required": false; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "validateFn": { "alias": "validateFn"; "required": false; }; "acceptedTypes": { "alias": "acceptedTypes"; "required": false; }; "acceptedTypesErrorMessage": { "alias": "acceptedTypesErrorMessage"; "required": false; }; "noClick": { "alias": "noClick"; "required": false; }; "allowLinks": { "alias": "allowLinks"; "required": false; }; "labelText": { "alias": "labelText"; "required": false; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "hintText": { "alias": "hintText"; "required": false; }; "required": { "alias": "required"; "required": false; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; }; "stacked": { "alias": "stacked"; "required": false; }; "helpKey": { "alias": "helpKey"; "required": false; }; }, { "filesChanged": "filesChanged"; "linkInputBlur": "linkInputBlur"; "linkChanged": "linkChanged"; }, never, ["*", "sky-form-error"], true, never>;
151
159
  static ngAcceptInputType_labelHidden: unknown;
152
160
  static ngAcceptInputType_required: unknown;
153
161
  static ngAcceptInputType_stacked: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux/forms",
3
- "version": "12.0.0-alpha.0",
3
+ "version": "12.0.0-alpha.1",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "keywords": [
6
6
  "blackbaud",
@@ -37,14 +37,14 @@
37
37
  "@angular/core": "^19.0.5",
38
38
  "@angular/forms": "^19.0.5",
39
39
  "@angular/platform-browser": "^19.0.5",
40
- "@skyux-sdk/testing": "12.0.0-alpha.0",
41
- "@skyux/core": "12.0.0-alpha.0",
42
- "@skyux/help-inline": "12.0.0-alpha.0",
43
- "@skyux/i18n": "12.0.0-alpha.0",
44
- "@skyux/icon": "12.0.0-alpha.0",
45
- "@skyux/indicators": "12.0.0-alpha.0",
46
- "@skyux/popovers": "12.0.0-alpha.0",
47
- "@skyux/theme": "12.0.0-alpha.0"
40
+ "@skyux-sdk/testing": "12.0.0-alpha.1",
41
+ "@skyux/core": "12.0.0-alpha.1",
42
+ "@skyux/help-inline": "12.0.0-alpha.1",
43
+ "@skyux/i18n": "12.0.0-alpha.1",
44
+ "@skyux/icon": "12.0.0-alpha.1",
45
+ "@skyux/indicators": "12.0.0-alpha.1",
46
+ "@skyux/popovers": "12.0.0-alpha.1",
47
+ "@skyux/theme": "12.0.0-alpha.1"
48
48
  },
49
49
  "dependencies": {
50
50
  "tslib": "^2.8.1"
@@ -3,7 +3,6 @@ import { SkyComponentHarness } from '@skyux/core/testing';
3
3
  import { SkyFileDropHarnessFilters } from './file-drop-harness-filters';
4
4
  /**
5
5
  * Harness for interacting with a file drop component in tests.
6
- * @internal
7
6
  */
8
7
  export declare class SkyFileDropHarness extends SkyComponentHarness {
9
8
  #private;
@@ -17,7 +16,95 @@ export declare class SkyFileDropHarness extends SkyComponentHarness {
17
16
  */
18
17
  static with(filters: SkyFileDropHarnessFilters): HarnessPredicate<SkyFileDropHarness>;
19
18
  /**
20
- * Drops a file onto the component's drop target.
19
+ * Clicks the file drop target.
21
20
  */
22
- dropFile(file: File): Promise<void>;
21
+ clickFileDropTarget(): Promise<void>;
22
+ /**
23
+ * Clicks the help inline button.
24
+ */
25
+ clickHelpInline(): Promise<void>;
26
+ /**
27
+ * Clicks the link upload `Done` button'.
28
+ */
29
+ clickLinkUploadDoneButton(): Promise<void>;
30
+ /**
31
+ * Enters text into the link upload input.
32
+ */
33
+ enterLinkUploadText(link: string): Promise<void>;
34
+ /**
35
+ * Gets the accepted file types.
36
+ */
37
+ getAcceptedTypes(): Promise<string | null>;
38
+ /**
39
+ * Gets the aria-label for the file upload button.
40
+ */
41
+ getFileUploadAriaLabel(): Promise<string | null>;
42
+ /**
43
+ * Gets the help inline popover content.
44
+ */
45
+ getHelpPopoverContent(): Promise<string | undefined>;
46
+ /**
47
+ * Gets the help inline popover title.
48
+ */
49
+ getHelpPopoverTitle(): Promise<string | undefined>;
50
+ /**
51
+ * Gets the hint text.
52
+ */
53
+ getHintText(): Promise<string>;
54
+ /**
55
+ * Gets the label text.
56
+ */
57
+ getLabelText(): Promise<string>;
58
+ /**
59
+ * Gets the link upload aria-label.
60
+ */
61
+ getLinkUploadAriaLabel(): Promise<string | null>;
62
+ /**
63
+ * Gets the link upload hint text.
64
+ */
65
+ getLinkUploadHintText(): Promise<string | undefined>;
66
+ /**
67
+ * Whether a custom form error has fired.
68
+ */
69
+ hasCustomError(errorName: string): Promise<boolean>;
70
+ /**
71
+ * Whether the file type error has fired.
72
+ */
73
+ hasFileTypeError(): Promise<boolean>;
74
+ /**
75
+ * Whether the max file size error has fired.
76
+ */
77
+ hasMaxFileSizeError(): Promise<boolean>;
78
+ /**
79
+ * Whether the min file size error has fired.
80
+ */
81
+ hasMinFileSizeError(): Promise<boolean>;
82
+ /**
83
+ * Whether the required error has fired.
84
+ */
85
+ hasRequiredError(): Promise<boolean>;
86
+ /**
87
+ * Whether the validate error from the customer validation has fired.
88
+ */
89
+ hasValidateFnError(): Promise<boolean>;
90
+ /**
91
+ * Whether label text is hidden.
92
+ */
93
+ isLabelHidden(): Promise<boolean>;
94
+ /**
95
+ * Whether file drop is required.
96
+ */
97
+ isRequired(): Promise<boolean>;
98
+ /**
99
+ * Whether file drop has stacked enabled.
100
+ */
101
+ isStacked(): Promise<boolean>;
102
+ /**
103
+ * Loads a single file.
104
+ */
105
+ loadFile(file: File): Promise<void>;
106
+ /**
107
+ * Loads multiple files.
108
+ */
109
+ loadFiles(files: File[] | null): Promise<void>;
23
110
  }
@@ -0,0 +1,28 @@
1
+ import { SkyComponentHarness } from '@skyux/core/testing';
2
+ /**
3
+ * Harness for interacting with file drop component's link upload feature in tests.
4
+ * @internal
5
+ */
6
+ export declare class SkyFileDropLinkUploadHarness extends SkyComponentHarness {
7
+ #private;
8
+ /**
9
+ * @internal
10
+ */
11
+ static hostSelector: string;
12
+ /**
13
+ * Clicks the `Done` button
14
+ */
15
+ clickDoneButton(): Promise<void>;
16
+ /**
17
+ * Enters text into the link upload input.
18
+ */
19
+ enterText(link: string): Promise<void>;
20
+ /**
21
+ * Gets the link upload aria-label.
22
+ */
23
+ getAriaLabel(): Promise<string | null>;
24
+ /**
25
+ * Gets the hint text.
26
+ */
27
+ getHintText(): Promise<string | undefined>;
28
+ }
@@ -0,0 +1,14 @@
1
+ import { SkyInputHarness } from '@skyux/core/testing';
2
+ /**
3
+ * Harness to interact with the file drop link upload input harness.
4
+ */
5
+ export declare class SkyFileDropLinkUploadInputHarness extends SkyInputHarness {
6
+ /**
7
+ * @internal
8
+ */
9
+ static hostSelector: string;
10
+ /**
11
+ * Gets the input aria-label
12
+ */
13
+ getAriaLabel(): Promise<string | null>;
14
+ }
@@ -0,0 +1,10 @@
1
+ import { SkyHarnessFilters } from '@skyux/core/testing';
2
+ /**
3
+ * A set of criteria that can be used to filter a list of `SkyFileItemHarness` instances.
4
+ */
5
+ export interface SkyFileItemHarnessFilters extends SkyHarnessFilters {
6
+ /**
7
+ * Finds files whose file name matches this value.
8
+ */
9
+ fileName: string;
10
+ }
@@ -0,0 +1,28 @@
1
+ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
2
+ import { SkyFileItemHarnessFilters } from './file-item-harness-filters';
3
+ /**
4
+ * Harness for interacting with a file item component in tests.
5
+ */
6
+ export declare class SkyFileItemHarness extends ComponentHarness {
7
+ /**
8
+ * @internal
9
+ */
10
+ static hostSelector: string;
11
+ /**
12
+ * Gets a `HarnessPredicate` that can be used to search for a
13
+ * `SkyFileItemHarness` that meets certain criteria.
14
+ */
15
+ static with(filters: SkyFileItemHarnessFilters): HarnessPredicate<SkyFileItemHarness>;
16
+ /**
17
+ * Clicks the delete button.
18
+ */
19
+ clickDeleteButton(): Promise<void>;
20
+ /**
21
+ * Gets the file name.
22
+ */
23
+ getFileName(): Promise<string>;
24
+ /**
25
+ * Gets the file size.
26
+ */
27
+ getFileSize(): Promise<string>;
28
+ }
@@ -13,6 +13,8 @@ export { SkyFileAttachmentHarnessFilters } from './modules/file-attachment/file-
13
13
  export { SkyFileDropHarness } from './modules/file-attachment/file-drop/file-drop-harness';
14
14
  export { SkyFileDropHarnessFilters } from './modules/file-attachment/file-drop/file-drop-harness-filters';
15
15
  export { provideSkyFileAttachmentTesting } from './modules/file-attachment/shared/provide-file-attachment-testing';
16
+ export { SkyFileItemHarness } from './modules/file-attachment/file-drop/file-item-harness';
17
+ export { SkyFileItemHarnessFilters } from './modules/file-attachment/file-drop/file-item-harness-filters';
16
18
  export { SkyFormErrorsHarness } from './modules/form-error/form-errors-harness';
17
19
  export { SkyFormErrorsHarnessFilters } from './modules/form-error/form-errors-harness.filters';
18
20
  export { SkyFormErrorHarness } from './modules/form-error/form-error-harness';