@skyux/forms 5.9.4 → 6.0.0-beta.10

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 (168) hide show
  1. package/documentation.json +693 -693
  2. package/esm2020/index.mjs +43 -0
  3. package/esm2020/lib/modules/character-counter/character-counter-indicator.component.mjs +32 -0
  4. package/esm2020/lib/modules/character-counter/character-counter.directive.mjs +84 -0
  5. package/esm2020/lib/modules/character-counter/character-counter.module.mjs +46 -0
  6. package/esm2020/lib/modules/checkbox/checkbox-change.mjs +6 -0
  7. package/esm2020/lib/modules/checkbox/checkbox-label.component.mjs +14 -0
  8. package/esm2020/lib/modules/checkbox/checkbox-required-validator.directive.mjs +30 -0
  9. package/esm2020/lib/modules/checkbox/checkbox.component.mjs +237 -0
  10. package/esm2020/lib/modules/checkbox/checkbox.module.mjs +34 -0
  11. package/esm2020/lib/modules/file-attachment/file-attachment-label.component.mjs +14 -0
  12. package/esm2020/lib/modules/file-attachment/file-attachment.component.mjs +326 -0
  13. package/esm2020/lib/modules/file-attachment/file-attachment.service.mjs +94 -0
  14. package/esm2020/lib/modules/file-attachment/file-attachments.module.mjs +68 -0
  15. package/esm2020/lib/modules/file-attachment/file-drop.component.mjs +216 -0
  16. package/esm2020/lib/modules/file-attachment/file-item-error-type.mjs +2 -0
  17. package/esm2020/lib/modules/file-attachment/file-item.component.mjs +112 -0
  18. package/esm2020/lib/modules/file-attachment/file-item.mjs +2 -0
  19. package/esm2020/lib/modules/file-attachment/file-item.service.mjs +70 -0
  20. package/esm2020/lib/modules/file-attachment/file-link.mjs +2 -0
  21. package/esm2020/lib/modules/file-attachment/file-size.pipe.mjs +58 -0
  22. package/esm2020/lib/modules/file-attachment/types/file-attachment-change.mjs +2 -0
  23. package/esm2020/lib/modules/file-attachment/types/file-attachment-click.mjs +2 -0
  24. package/esm2020/lib/modules/file-attachment/types/file-drop-change.mjs +2 -0
  25. package/esm2020/lib/modules/input-box/input-box-adapter.service.mjs +35 -0
  26. package/esm2020/lib/modules/input-box/input-box-host.service.mjs +19 -0
  27. package/esm2020/lib/modules/input-box/input-box-populate-args.mjs +2 -0
  28. package/esm2020/lib/modules/input-box/input-box.component.mjs +89 -0
  29. package/esm2020/lib/modules/input-box/input-box.module.mjs +19 -0
  30. package/esm2020/lib/modules/radio/radio-group.component.mjs +220 -0
  31. package/esm2020/lib/modules/radio/radio-label.component.mjs +23 -0
  32. package/esm2020/lib/modules/radio/radio.component.mjs +254 -0
  33. package/esm2020/lib/modules/radio/radio.module.mjs +28 -0
  34. package/esm2020/lib/modules/radio/types/radio-change.mjs +2 -0
  35. package/esm2020/lib/modules/selection-box/selection-box-adapter.service.mjs +123 -0
  36. package/esm2020/lib/modules/selection-box/selection-box-description.component.mjs +14 -0
  37. package/esm2020/lib/modules/selection-box/selection-box-grid.component.mjs +128 -0
  38. package/esm2020/lib/modules/selection-box/selection-box-header.component.mjs +14 -0
  39. package/esm2020/lib/modules/selection-box/selection-box.component.mjs +101 -0
  40. package/esm2020/lib/modules/selection-box/selection-box.module.mjs +40 -0
  41. package/esm2020/lib/modules/selection-box/types/selection-box-grid-align-items-type.mjs +2 -0
  42. package/esm2020/lib/modules/selection-box/types/selection-box-grid-align-items.mjs +2 -0
  43. package/esm2020/lib/modules/shared/forms-utility.mjs +26 -0
  44. package/esm2020/lib/modules/shared/sky-forms-resources.module.mjs +89 -0
  45. package/esm2020/lib/modules/toggle-switch/toggle-switch-label.component.mjs +14 -0
  46. package/esm2020/lib/modules/toggle-switch/toggle-switch.component.mjs +151 -0
  47. package/esm2020/lib/modules/toggle-switch/toggle-switch.module.mjs +20 -0
  48. package/esm2020/lib/modules/toggle-switch/types/toggle-switch-change.mjs +2 -0
  49. package/esm2020/skyux-forms.mjs +5 -0
  50. package/esm2020/testing/checkbox-fixture.mjs +88 -0
  51. package/esm2020/testing/public-api.mjs +2 -0
  52. package/esm2020/testing/skyux-forms-testing.mjs +5 -0
  53. package/fesm2015/{skyux-forms-testing.js → skyux-forms-testing.mjs} +1 -1
  54. package/fesm2015/skyux-forms-testing.mjs.map +1 -0
  55. package/fesm2015/skyux-forms.mjs +2684 -0
  56. package/fesm2015/skyux-forms.mjs.map +1 -0
  57. package/{esm2015/testing/checkbox-fixture.js → fesm2020/skyux-forms-testing.mjs} +9 -2
  58. package/fesm2020/skyux-forms-testing.mjs.map +1 -0
  59. package/fesm2020/skyux-forms.mjs +2676 -0
  60. package/fesm2020/skyux-forms.mjs.map +1 -0
  61. package/package.json +39 -15
  62. package/testing/package.json +5 -5
  63. package/bundles/skyux-forms-testing.umd.js +0 -123
  64. package/bundles/skyux-forms.umd.js +0 -3430
  65. package/esm2015/index.js +0 -43
  66. package/esm2015/index.js.map +0 -1
  67. package/esm2015/lib/modules/character-counter/character-counter-indicator.component.js +0 -37
  68. package/esm2015/lib/modules/character-counter/character-counter-indicator.component.js.map +0 -1
  69. package/esm2015/lib/modules/character-counter/character-counter.directive.js +0 -84
  70. package/esm2015/lib/modules/character-counter/character-counter.directive.js.map +0 -1
  71. package/esm2015/lib/modules/character-counter/character-counter.module.js +0 -46
  72. package/esm2015/lib/modules/character-counter/character-counter.module.js.map +0 -1
  73. package/esm2015/lib/modules/checkbox/checkbox-change.js +0 -6
  74. package/esm2015/lib/modules/checkbox/checkbox-change.js.map +0 -1
  75. package/esm2015/lib/modules/checkbox/checkbox-label.component.js +0 -17
  76. package/esm2015/lib/modules/checkbox/checkbox-label.component.js.map +0 -1
  77. package/esm2015/lib/modules/checkbox/checkbox-required-validator.directive.js +0 -32
  78. package/esm2015/lib/modules/checkbox/checkbox-required-validator.directive.js.map +0 -1
  79. package/esm2015/lib/modules/checkbox/checkbox.component.js +0 -241
  80. package/esm2015/lib/modules/checkbox/checkbox.component.js.map +0 -1
  81. package/esm2015/lib/modules/checkbox/checkbox.module.js +0 -34
  82. package/esm2015/lib/modules/checkbox/checkbox.module.js.map +0 -1
  83. package/esm2015/lib/modules/file-attachment/file-attachment-label.component.js +0 -19
  84. package/esm2015/lib/modules/file-attachment/file-attachment-label.component.js.map +0 -1
  85. package/esm2015/lib/modules/file-attachment/file-attachment.component.js +0 -335
  86. package/esm2015/lib/modules/file-attachment/file-attachment.component.js.map +0 -1
  87. package/esm2015/lib/modules/file-attachment/file-attachment.service.js +0 -94
  88. package/esm2015/lib/modules/file-attachment/file-attachment.service.js.map +0 -1
  89. package/esm2015/lib/modules/file-attachment/file-attachments.module.js +0 -68
  90. package/esm2015/lib/modules/file-attachment/file-attachments.module.js.map +0 -1
  91. package/esm2015/lib/modules/file-attachment/file-drop.component.js +0 -222
  92. package/esm2015/lib/modules/file-attachment/file-drop.component.js.map +0 -1
  93. package/esm2015/lib/modules/file-attachment/file-item-error-type.js +0 -2
  94. package/esm2015/lib/modules/file-attachment/file-item-error-type.js.map +0 -1
  95. package/esm2015/lib/modules/file-attachment/file-item.component.js +0 -116
  96. package/esm2015/lib/modules/file-attachment/file-item.component.js.map +0 -1
  97. package/esm2015/lib/modules/file-attachment/file-item.js +0 -2
  98. package/esm2015/lib/modules/file-attachment/file-item.js.map +0 -1
  99. package/esm2015/lib/modules/file-attachment/file-item.service.js +0 -72
  100. package/esm2015/lib/modules/file-attachment/file-item.service.js.map +0 -1
  101. package/esm2015/lib/modules/file-attachment/file-link.js +0 -2
  102. package/esm2015/lib/modules/file-attachment/file-link.js.map +0 -1
  103. package/esm2015/lib/modules/file-attachment/file-size.pipe.js +0 -60
  104. package/esm2015/lib/modules/file-attachment/file-size.pipe.js.map +0 -1
  105. package/esm2015/lib/modules/file-attachment/types/file-attachment-change.js +0 -2
  106. package/esm2015/lib/modules/file-attachment/types/file-attachment-change.js.map +0 -1
  107. package/esm2015/lib/modules/file-attachment/types/file-attachment-click.js +0 -2
  108. package/esm2015/lib/modules/file-attachment/types/file-attachment-click.js.map +0 -1
  109. package/esm2015/lib/modules/file-attachment/types/file-drop-change.js +0 -2
  110. package/esm2015/lib/modules/file-attachment/types/file-drop-change.js.map +0 -1
  111. package/esm2015/lib/modules/input-box/input-box-adapter.service.js +0 -35
  112. package/esm2015/lib/modules/input-box/input-box-adapter.service.js.map +0 -1
  113. package/esm2015/lib/modules/input-box/input-box-host.service.js +0 -19
  114. package/esm2015/lib/modules/input-box/input-box-host.service.js.map +0 -1
  115. package/esm2015/lib/modules/input-box/input-box-populate-args.js +0 -2
  116. package/esm2015/lib/modules/input-box/input-box-populate-args.js.map +0 -1
  117. package/esm2015/lib/modules/input-box/input-box.component.js +0 -97
  118. package/esm2015/lib/modules/input-box/input-box.component.js.map +0 -1
  119. package/esm2015/lib/modules/input-box/input-box.module.js +0 -19
  120. package/esm2015/lib/modules/input-box/input-box.module.js.map +0 -1
  121. package/esm2015/lib/modules/radio/radio-group.component.js +0 -223
  122. package/esm2015/lib/modules/radio/radio-group.component.js.map +0 -1
  123. package/esm2015/lib/modules/radio/radio-label.component.js +0 -26
  124. package/esm2015/lib/modules/radio/radio-label.component.js.map +0 -1
  125. package/esm2015/lib/modules/radio/radio.component.js +0 -262
  126. package/esm2015/lib/modules/radio/radio.component.js.map +0 -1
  127. package/esm2015/lib/modules/radio/radio.module.js +0 -28
  128. package/esm2015/lib/modules/radio/radio.module.js.map +0 -1
  129. package/esm2015/lib/modules/radio/types/radio-change.js +0 -2
  130. package/esm2015/lib/modules/radio/types/radio-change.js.map +0 -1
  131. package/esm2015/lib/modules/selection-box/selection-box-adapter.service.js +0 -124
  132. package/esm2015/lib/modules/selection-box/selection-box-adapter.service.js.map +0 -1
  133. package/esm2015/lib/modules/selection-box/selection-box-description.component.js +0 -17
  134. package/esm2015/lib/modules/selection-box/selection-box-description.component.js.map +0 -1
  135. package/esm2015/lib/modules/selection-box/selection-box-grid.component.js +0 -134
  136. package/esm2015/lib/modules/selection-box/selection-box-grid.component.js.map +0 -1
  137. package/esm2015/lib/modules/selection-box/selection-box-header.component.js +0 -17
  138. package/esm2015/lib/modules/selection-box/selection-box-header.component.js.map +0 -1
  139. package/esm2015/lib/modules/selection-box/selection-box.component.js +0 -107
  140. package/esm2015/lib/modules/selection-box/selection-box.component.js.map +0 -1
  141. package/esm2015/lib/modules/selection-box/selection-box.module.js +0 -40
  142. package/esm2015/lib/modules/selection-box/selection-box.module.js.map +0 -1
  143. package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items-type.js +0 -2
  144. package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items-type.js.map +0 -1
  145. package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items.js +0 -2
  146. package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items.js.map +0 -1
  147. package/esm2015/lib/modules/shared/forms-utility.js +0 -26
  148. package/esm2015/lib/modules/shared/forms-utility.js.map +0 -1
  149. package/esm2015/lib/modules/shared/sky-forms-resources.module.js +0 -89
  150. package/esm2015/lib/modules/shared/sky-forms-resources.module.js.map +0 -1
  151. package/esm2015/lib/modules/toggle-switch/toggle-switch-label.component.js +0 -18
  152. package/esm2015/lib/modules/toggle-switch/toggle-switch-label.component.js.map +0 -1
  153. package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js +0 -159
  154. package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js.map +0 -1
  155. package/esm2015/lib/modules/toggle-switch/toggle-switch.module.js +0 -20
  156. package/esm2015/lib/modules/toggle-switch/toggle-switch.module.js.map +0 -1
  157. package/esm2015/lib/modules/toggle-switch/types/toggle-switch-change.js +0 -2
  158. package/esm2015/lib/modules/toggle-switch/types/toggle-switch-change.js.map +0 -1
  159. package/esm2015/skyux-forms.js +0 -5
  160. package/esm2015/skyux-forms.js.map +0 -1
  161. package/esm2015/testing/checkbox-fixture.js.map +0 -1
  162. package/esm2015/testing/public-api.js +0 -2
  163. package/esm2015/testing/public-api.js.map +0 -1
  164. package/esm2015/testing/skyux-forms-testing.js +0 -5
  165. package/esm2015/testing/skyux-forms-testing.js.map +0 -1
  166. package/fesm2015/skyux-forms-testing.js.map +0 -1
  167. package/fesm2015/skyux-forms.js +0 -2771
  168. package/fesm2015/skyux-forms.js.map +0 -1
@@ -1,2771 +0,0 @@
1
- import * as i1 from '@angular/common';
2
- import { CommonModule, DecimalPipe } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { NgModule, Component, ChangeDetectionStrategy, Directive, Input, forwardRef, EventEmitter, Self, Optional, Output, Injectable, ViewChild, ContentChildren, Pipe, ViewEncapsulation, ContentChild, HostListener, ElementRef } from '@angular/core';
5
- import * as i1$1 from '@angular/forms';
6
- import { NG_VALIDATORS, FormsModule, ReactiveFormsModule, CheckboxRequiredValidator, FormControlDirective, FormControlName, NgModel, NG_VALUE_ACCESSOR } from '@angular/forms';
7
- import * as i2 from '@skyux/i18n';
8
- import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
9
- import * as i2$1 from '@skyux/indicators';
10
- import { SkyIconModule } from '@skyux/indicators';
11
- import { BehaviorSubject, Subject } from 'rxjs';
12
- import * as i3 from '@skyux/theme';
13
- import { SkyThemeModule } from '@skyux/theme';
14
- import { takeUntil } from 'rxjs/operators';
15
- import * as i1$2 from '@skyux/core';
16
- import { SkyMediaBreakpoints } from '@skyux/core';
17
-
18
- /**
19
- * NOTICE: DO NOT MODIFY THIS FILE!
20
- * The contents of this file were automatically generated by
21
- * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-forms' schematic.
22
- * To update this file, simply rerun the command.
23
- */
24
- const RESOURCES = {
25
- 'EN-US': {
26
- skyux_character_count_message: { message: 'characters out of' },
27
- skyux_character_count_over_limit: {
28
- message: 'You are over the character limit.',
29
- },
30
- skyux_file_attachment_button_label_choose_file: { message: 'Choose file' },
31
- skyux_file_attachment_button_label_replace_file: {
32
- message: 'Replace file',
33
- },
34
- skyux_file_attachment_file_item_delete: { message: 'Delete file' },
35
- skyux_file_attachment_file_size_b_plural: { message: '{0} bytes' },
36
- skyux_file_attachment_file_size_b_singular: { message: '{0} byte' },
37
- skyux_file_attachment_file_size_gb: { message: '{0} GB' },
38
- skyux_file_attachment_file_size_kb: { message: '{0} KB' },
39
- skyux_file_attachment_file_size_mb: { message: '{0} MB' },
40
- skyux_file_attachment_file_upload_drag_file_here: {
41
- message: 'Drag a file here',
42
- },
43
- skyux_file_attachment_file_upload_drag_or_click: {
44
- message: 'Drag a file here or click to browse',
45
- },
46
- skyux_file_attachment_file_upload_drop_files_here: {
47
- message: 'Drop files here',
48
- },
49
- skyux_file_attachment_file_upload_image_preview_alt_text: {
50
- message: 'Image preview',
51
- },
52
- skyux_file_attachment_file_upload_invalid_file: {
53
- message: 'This file type is invalid',
54
- },
55
- skyux_file_attachment_file_upload_link_input: {
56
- message: 'Add a link to a file',
57
- },
58
- skyux_file_attachment_file_upload_link_placeholder: {
59
- message: 'http://www.something.com/file',
60
- },
61
- skyux_file_attachment_file_upload_or_click_to_browse: {
62
- message: 'or click to browse',
63
- },
64
- skyux_file_attachment_file_upload_paste_link: {
65
- message: 'Paste a link to a file',
66
- },
67
- skyux_file_attachment_file_upload_paste_link_done: { message: 'Done' },
68
- skyux_file_attachment_label_no_file_chosen: { message: 'No file chosen' },
69
- },
70
- };
71
- class SkyFormsResourcesProvider {
72
- getString(localeInfo, name) {
73
- return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
74
- }
75
- }
76
- /**
77
- * Import into any component library module that needs to use resource strings.
78
- */
79
- class SkyFormsResourcesModule {
80
- }
81
- SkyFormsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFormsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
82
- SkyFormsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFormsResourcesModule, exports: [SkyI18nModule] });
83
- SkyFormsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFormsResourcesModule, providers: [
84
- {
85
- provide: SKY_LIB_RESOURCES_PROVIDERS,
86
- useClass: SkyFormsResourcesProvider,
87
- multi: true,
88
- },
89
- ], imports: [SkyI18nModule] });
90
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFormsResourcesModule, decorators: [{
91
- type: NgModule,
92
- args: [{
93
- exports: [SkyI18nModule],
94
- providers: [
95
- {
96
- provide: SKY_LIB_RESOURCES_PROVIDERS,
97
- useClass: SkyFormsResourcesProvider,
98
- multi: true,
99
- },
100
- ],
101
- }]
102
- }] });
103
-
104
- class SkyCharacterCounterIndicatorComponent {
105
- constructor(changeDetector) {
106
- this.changeDetector = changeDetector;
107
- this.currentCharacterCountLimit = 0;
108
- this.currentCharacterCount = 0;
109
- }
110
- get characterCount() {
111
- return this.currentCharacterCount;
112
- }
113
- set characterCount(count) {
114
- this.currentCharacterCount = count;
115
- this.changeDetector.markForCheck();
116
- }
117
- get characterCountLimit() {
118
- return this.currentCharacterCountLimit;
119
- }
120
- set characterCountLimit(limit) {
121
- this.currentCharacterCountLimit = limit;
122
- this.changeDetector.markForCheck();
123
- }
124
- }
125
- SkyCharacterCounterIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterIndicatorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
126
- SkyCharacterCounterIndicatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyCharacterCounterIndicatorComponent, selector: "sky-character-counter-indicator", ngImport: i0, template: "<span\n class=\"sky-character-count-label sky-deemphasized\"\n [ngClass]=\"{ 'sky-error-label': characterCount > characterCountLimit }\"\n>\n {{ characterCount + '/' + characterCountLimit }}\n</span>\n<span aria-live=\"polite\" class=\"sky-screen-reader-only\">\n {{ characterCount }} {{ 'skyux_character_count_message' | skyLibResources }}\n {{ characterCountLimit }}.\n {{\n characterCount > characterCountLimit\n ? ('skyux_character_count_over_limit' | skyLibResources)\n : ''\n }}\n</span>\n", styles: [":host{flex-shrink:.0001}.sky-character-count-label.sky-error-label{margin:0}.sky-character-count-label.sky-error-label:before{font-style:normal}.sky-screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:none;white-space:nowrap}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
127
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterIndicatorComponent, decorators: [{
128
- type: Component,
129
- args: [{
130
- selector: 'sky-character-counter-indicator',
131
- templateUrl: './character-counter-indicator.component.html',
132
- styleUrls: ['./character-counter-indicator.component.scss'],
133
- changeDetection: ChangeDetectionStrategy.OnPush,
134
- }]
135
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
136
-
137
- /**
138
- * Creates an input field that validates the number of characters. Place this directive on
139
- * an `input` or `textarea` element. If users enter more characters than allowed, then the
140
- * input field is invalid and the component displays an error indicator.
141
- * @required
142
- */
143
- class SkyCharacterCounterInputDirective {
144
- constructor() {
145
- // eslint-disable-next-line @typescript-eslint/no-empty-function
146
- this._validatorChange = () => { };
147
- }
148
- /**
149
- * Specifies the maximum number of characters allowed in the input field. Place this directive
150
- * on an `input` or `textarea` element. This property accepts `number` values.
151
- * @required
152
- */
153
- set skyCharacterCounterLimit(value) {
154
- this._skyCharacterCounterLimit = value;
155
- this.updateIndicatorLimit(this.skyCharacterCounterLimit);
156
- this._validatorChange();
157
- }
158
- get skyCharacterCounterLimit() {
159
- return this._skyCharacterCounterLimit || 0;
160
- }
161
- validate(control) {
162
- const value = control.value;
163
- this.updateIndicatorCount((value && value.length) || 0);
164
- if (!value) {
165
- return;
166
- }
167
- if (value.length > this.skyCharacterCounterLimit) {
168
- // This is needed to apply the appropriate error styles to the input.
169
- control.markAsTouched();
170
- return {
171
- skyCharacterCounter: {
172
- invalid: value,
173
- },
174
- };
175
- }
176
- }
177
- registerOnValidatorChange(fn) {
178
- this._validatorChange = fn;
179
- }
180
- updateIndicatorCount(count) {
181
- if (this.skyCharacterCounterIndicator) {
182
- this.skyCharacterCounterIndicator.characterCount = count;
183
- }
184
- }
185
- updateIndicatorLimit(limit) {
186
- if (this.skyCharacterCounterIndicator) {
187
- this.skyCharacterCounterIndicator.characterCountLimit = limit;
188
- }
189
- }
190
- }
191
- SkyCharacterCounterInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
192
- SkyCharacterCounterInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyCharacterCounterInputDirective, selector: "[skyCharacterCounter]", inputs: { skyCharacterCounterIndicator: "skyCharacterCounterIndicator", skyCharacterCounterLimit: "skyCharacterCounterLimit" }, providers: [
193
- {
194
- provide: NG_VALIDATORS,
195
- useExisting: SkyCharacterCounterInputDirective,
196
- multi: true,
197
- },
198
- ], ngImport: i0 });
199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterInputDirective, decorators: [{
200
- type: Directive,
201
- args: [{
202
- selector: '[skyCharacterCounter]',
203
- providers: [
204
- {
205
- provide: NG_VALIDATORS,
206
- useExisting: SkyCharacterCounterInputDirective,
207
- multi: true,
208
- },
209
- ],
210
- }]
211
- }], propDecorators: { skyCharacterCounterIndicator: [{
212
- type: Input
213
- }], skyCharacterCounterLimit: [{
214
- type: Input
215
- }] } });
216
-
217
- class SkyCharacterCounterModule {
218
- }
219
- SkyCharacterCounterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
220
- SkyCharacterCounterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterModule, declarations: [SkyCharacterCounterInputDirective,
221
- SkyCharacterCounterIndicatorComponent], imports: [CommonModule,
222
- FormsModule,
223
- ReactiveFormsModule,
224
- SkyFormsResourcesModule,
225
- SkyI18nModule], exports: [SkyCharacterCounterInputDirective,
226
- SkyCharacterCounterIndicatorComponent] });
227
- SkyCharacterCounterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterModule, imports: [[
228
- CommonModule,
229
- FormsModule,
230
- ReactiveFormsModule,
231
- SkyFormsResourcesModule,
232
- SkyI18nModule,
233
- ]] });
234
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCharacterCounterModule, decorators: [{
235
- type: NgModule,
236
- args: [{
237
- declarations: [
238
- SkyCharacterCounterInputDirective,
239
- SkyCharacterCounterIndicatorComponent,
240
- ],
241
- imports: [
242
- CommonModule,
243
- FormsModule,
244
- ReactiveFormsModule,
245
- SkyFormsResourcesModule,
246
- SkyI18nModule,
247
- ],
248
- exports: [
249
- SkyCharacterCounterInputDirective,
250
- SkyCharacterCounterIndicatorComponent,
251
- ],
252
- }]
253
- }] });
254
-
255
- /**
256
- * Fires when users select or deselect the checkbox.
257
- */
258
- class SkyCheckboxChange {
259
- }
260
-
261
- /**
262
- * Specifies a label for the checkbox.
263
- */
264
- class SkyCheckboxLabelComponent {
265
- }
266
- SkyCheckboxLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
267
- SkyCheckboxLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyCheckboxLabelComponent, selector: "sky-checkbox-label", ngImport: i0, template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" });
268
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxLabelComponent, decorators: [{
269
- type: Component,
270
- args: [{
271
- selector: 'sky-checkbox-label',
272
- templateUrl: './checkbox-label.component.html',
273
- }]
274
- }] });
275
-
276
- // tslint:disable:no-forward-ref
277
- const SKY_CHECKBOX_REQUIRED_VALIDATOR = {
278
- provide: NG_VALIDATORS,
279
- useExisting: forwardRef(() => SkyCheckboxRequiredValidatorDirective),
280
- multi: true,
281
- };
282
- // tslint:enable
283
- /**
284
- * Validator support for the `required` input on `sky-checkbox`.
285
- * Angular's `CheckboxRequiredValidator` only works with `input type=checkbox`. This directive
286
- * extends the angular validator to work with `sky-checkbox` tags.
287
- * This is based on Angular Material's similar implementation:
288
- * https://github.com/angular/components/blob/a415b52ead2ec202ba37edb7d7866b29dd790394/src/material/checkbox/checkbox-required-validator.ts
289
- * @internal
290
- */
291
- class SkyCheckboxRequiredValidatorDirective extends CheckboxRequiredValidator {
292
- }
293
- SkyCheckboxRequiredValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxRequiredValidatorDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
294
- SkyCheckboxRequiredValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyCheckboxRequiredValidatorDirective, selector: "sky-checkbox[required][formControlName],\n sky-checkbox[required][formControl], sky-checkbox[required][ngModel]", providers: [SKY_CHECKBOX_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });
295
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxRequiredValidatorDirective, decorators: [{
296
- type: Directive,
297
- args: [{
298
- // eslint-disable-next-line @angular-eslint/directive-selector
299
- selector: `sky-checkbox[required][formControlName],
300
- sky-checkbox[required][formControl], sky-checkbox[required][ngModel]`,
301
- providers: [SKY_CHECKBOX_REQUIRED_VALIDATOR],
302
- }]
303
- }] });
304
-
305
- // Need to add the following to classes which contain static methods.
306
- // See: https://github.com/ng-packagr/ng-packagr/issues/641
307
- // @dynamic
308
- class SkyFormsUtility {
309
- /** Coerces a data-bound value (typically a string) to a boolean. */
310
- static coerceBooleanProperty(value) {
311
- return value !== undefined && `${value}` !== 'false';
312
- }
313
- /**
314
- * Gets the required state of the checkbox.
315
- * Currently, Angular doesn't offer a way to get this easily, so we have to create an empty
316
- * control using the current validator to see if it throws a `required` validation error.
317
- * https://github.com/angular/angular/issues/13461#issuecomment-340368046
318
- */
319
- static hasRequiredValidation(ngControl) {
320
- const abstractControl = ngControl.control;
321
- if (abstractControl && abstractControl.validator) {
322
- const validator = abstractControl.validator({});
323
- if (validator && validator.required) {
324
- return true;
325
- }
326
- }
327
- return false;
328
- }
329
- }
330
-
331
- /**
332
- * Monotonically increasing integer used to auto-generate unique ids for checkbox components.
333
- */
334
- let nextId = 0;
335
- /**
336
- * Replaces the HTML input element with `type="checkbox"`. When users select a checkbox, its value
337
- * is driven through an `ngModel` attribute that you specify on the `sky-checkbox` element.
338
- */
339
- class SkyCheckboxComponent {
340
- constructor(ngControl) {
341
- this.ngControl = ngControl;
342
- /**
343
- * Specifies an ID for the checkbox.
344
- * @default a unique, auto-incrementing integer. For example: `sky-checkbox-1`
345
- */
346
- this.id = `sky-checkbox-${++nextId}`;
347
- /**
348
- * Specifies an index for the checkbox. If not defined, the index is set to the position of the
349
- * checkbox on load.
350
- */
351
- this.tabindex = 0;
352
- /**
353
- * Specifies a name for a group of checkboxes.
354
- * @default a unique, auto-incrementing integer. For example: `sky-checkbox-1`
355
- */
356
- this.name = `sky-checkbox-${++nextId}`;
357
- /**
358
- * Fires when the selected value changes.
359
- */
360
- this.change = new EventEmitter();
361
- this.isFirstChange = true;
362
- this._checked = false;
363
- this._checkedChange = new BehaviorSubject(this._checked);
364
- this._disabled = false;
365
- this._disabledChange = new BehaviorSubject(this._disabled);
366
- this._required = false;
367
- /** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
368
- // eslint-disable-next-line @typescript-eslint/no-empty-function
369
- this.onTouched = () => { };
370
- // eslint-disable-next-line @typescript-eslint/no-empty-function
371
- this._controlValueAccessorChangeFn = (value) => { };
372
- if (this.ngControl) {
373
- this.ngControl.valueAccessor = this;
374
- }
375
- }
376
- /**
377
- * Indicates whether to disable the checkbox.
378
- * @default false
379
- */
380
- set disabled(value) {
381
- const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
382
- if (coercedValue !== this.disabled) {
383
- this._disabled = coercedValue;
384
- this._disabledChange.next(this._disabled);
385
- }
386
- }
387
- /**
388
- * Indicates whether the checkbox is disabled.
389
- */
390
- get disabled() {
391
- return this._disabled;
392
- }
393
- /**
394
- * Specifies a type to set the background color after users select a checkbox where the
395
- * `icon` property displays an icon in place of the checkbox. The valid options correspond to
396
- * [the label component's](https://developer.blackbaud.com/skyux/components/label)
397
- * label types. `"info"` creates a blue background, `"success"` creates a green
398
- * background, `"warning"` creates an orange background, and `"danger"` creates a red background.
399
- * @default "info"
400
- */
401
- set checkboxType(value) {
402
- if (value) {
403
- this._checkboxType = value.toLowerCase();
404
- }
405
- }
406
- get checkboxType() {
407
- return this._checkboxType || 'info';
408
- }
409
- get inputId() {
410
- return `input-${this.id}`;
411
- }
412
- /**
413
- * Indicates whether the checkbox is selected.
414
- * @default false
415
- */
416
- set checked(checked) {
417
- if (checked !== this.checked) {
418
- this._checked = checked;
419
- this._controlValueAccessorChangeFn(checked);
420
- this._checkedChange.next(this._checked);
421
- // Do not mark the field as "dirty"
422
- // if the field has been initialized with a value.
423
- if (this.isFirstChange && this.ngControl && this.ngControl.control) {
424
- this.ngControl.control.markAsPristine();
425
- this.isFirstChange = false;
426
- }
427
- }
428
- }
429
- /**
430
- * Indicates whether the checkbox is selected.
431
- */
432
- get checked() {
433
- return this._checked;
434
- }
435
- /**
436
- * Indicates whether the input is required for form validation.
437
- * When you set this property to `true`, the component adds `aria-required` and `required`
438
- * attributes to the input element so that forms display an invalid state until the input element
439
- * is complete.
440
- * @default false
441
- */
442
- set required(value) {
443
- this._required = SkyFormsUtility.coerceBooleanProperty(value);
444
- }
445
- get required() {
446
- return this._required;
447
- }
448
- /**
449
- * Fires when users select or deselect the checkbox.
450
- */
451
- get checkedChange() {
452
- return this._checkedChange;
453
- }
454
- /**
455
- * Fires when the selected value changes.
456
- */
457
- get disabledChange() {
458
- return this._disabledChange;
459
- }
460
- ngOnInit() {
461
- if (this.ngControl) {
462
- // Backwards compatibility support for anyone still using Validators.Required.
463
- this.required =
464
- this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
465
- }
466
- }
467
- /**
468
- * Implemented as part of ControlValueAccessor.
469
- */
470
- writeValue(value) {
471
- this.checked = !!value;
472
- }
473
- /**
474
- * Implemented as part of ControlValueAccessor.
475
- */
476
- registerOnChange(fn) {
477
- this._controlValueAccessorChangeFn = fn;
478
- }
479
- /**
480
- * Implemented as part of ControlValueAccessor.
481
- */
482
- registerOnTouched(fn) {
483
- this.onTouched = fn;
484
- }
485
- /**
486
- * Implemented as part of ControlValueAccessor.
487
- */
488
- setDisabledState(isDisabled) {
489
- this.disabled = isDisabled;
490
- }
491
- /**
492
- * Event handler for checkbox input element.
493
- * Toggles checked state if element is not disabled.
494
- */
495
- onInteractionEvent(event) {
496
- // We always have to stop propagation on the change event.
497
- // Otherwise the change event, from the input element, will bubble up and
498
- // emit its event object to the `change` output.
499
- event.stopPropagation();
500
- if (!this.disabled) {
501
- this._toggle();
502
- this._emitChangeEvent();
503
- }
504
- }
505
- onInputBlur() {
506
- this.onTouched();
507
- }
508
- _emitChangeEvent() {
509
- const event = new SkyCheckboxChange();
510
- event.source = this;
511
- event.checked = this._checked;
512
- this._controlValueAccessorChangeFn(this._checked);
513
- this.change.emit(event);
514
- }
515
- /**
516
- * Toggles the `checked` value between true and false
517
- */
518
- _toggle() {
519
- this.checked = !this.checked;
520
- }
521
- }
522
- SkyCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxComponent, deps: [{ token: i1$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
523
- SkyCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyCheckboxComponent, selector: "sky-checkbox", inputs: { label: "label", labelledBy: "labelledBy", id: "id", disabled: "disabled", tabindex: "tabindex", name: "name", icon: "icon", checkboxType: "checkboxType", checked: "checked", required: "required" }, outputs: { change: "change", checkedChange: "checkedChange", disabledChange: "disabledChange" }, ngImport: i0, template: "<label\n class=\"sky-checkbox-wrapper sky-switch\"\n [ngClass]=\"{\n 'sky-control-label-required': required,\n 'sky-switch-disabled': disabled\n }\"\n>\n <input\n class=\"sky-checkbox-input sky-switch-input\"\n type=\"checkbox\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n (blur)=\"onInputBlur()\"\n (change)=\"onInteractionEvent($event)\"\n />\n <span\n class=\"sky-switch-control sky-rounded-corners\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-switch-control-info': checkboxType === 'info',\n 'sky-switch-control-success': checkboxType === 'success',\n 'sky-switch-control-warning': checkboxType === 'warning',\n 'sky-switch-control-danger': checkboxType === 'danger'\n }\"\n >\n <sky-icon\n *ngIf=\"icon || checked\"\n class=\"sky-checkbox-icon-default\"\n fixedWidth=\"true\"\n [icon]=\"icon || 'check'\"\n >\n </sky-icon>\n <div class=\"sky-checkbox-icon-modern\">\n <sky-icon\n *ngIf=\"icon; else checkedTemplate\"\n fixedWidth=\"true\"\n [icon]=\"icon\"\n >\n </sky-icon>\n <ng-template #checkedTemplate>\n <sky-icon\n *ngIf=\"checked\"\n class=\"sky-checkbox-icon-modern-checked\"\n fixedWidth=\"true\"\n icon=\"check\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </ng-template>\n </div>\n </span>\n <ng-content select=\"sky-checkbox-label\"> </ng-content>\n</label>\n", styles: [".sky-checkbox-icon-modern{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-default{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern{display:inline}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern-checked{color:#1870b8}:host-context(.sky-theme-modern) .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}:host-context(.sky-theme-modern) .sky-switch-control{border-radius:6px}.sky-theme-modern .sky-checkbox-icon-default{display:none}.sky-theme-modern .sky-checkbox-icon-modern{display:inline}.sky-theme-modern .sky-checkbox-icon-modern-checked{color:#1870b8}.sky-theme-modern .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}.sky-theme-modern .sky-switch-control{border-radius:6px}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
524
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxComponent, decorators: [{
525
- type: Component,
526
- args: [{
527
- selector: 'sky-checkbox',
528
- templateUrl: './checkbox.component.html',
529
- styleUrls: ['./checkbox.component.scss'],
530
- }]
531
- }], ctorParameters: function () { return [{ type: i1$1.NgControl, decorators: [{
532
- type: Self
533
- }, {
534
- type: Optional
535
- }] }]; }, propDecorators: { label: [{
536
- type: Input
537
- }], labelledBy: [{
538
- type: Input
539
- }], id: [{
540
- type: Input
541
- }], disabled: [{
542
- type: Input
543
- }], tabindex: [{
544
- type: Input
545
- }], name: [{
546
- type: Input
547
- }], change: [{
548
- type: Output
549
- }], icon: [{
550
- type: Input
551
- }], checkboxType: [{
552
- type: Input
553
- }], checked: [{
554
- type: Input
555
- }], required: [{
556
- type: Input
557
- }], checkedChange: [{
558
- type: Output
559
- }], disabledChange: [{
560
- type: Output
561
- }] } });
562
-
563
- class SkyCheckboxModule {
564
- }
565
- SkyCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
566
- SkyCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxModule, declarations: [SkyCheckboxComponent,
567
- SkyCheckboxLabelComponent,
568
- SkyCheckboxRequiredValidatorDirective], imports: [CommonModule, FormsModule, SkyIconModule], exports: [SkyCheckboxComponent,
569
- SkyCheckboxLabelComponent,
570
- SkyCheckboxRequiredValidatorDirective] });
571
- SkyCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxModule, imports: [[CommonModule, FormsModule, SkyIconModule]] });
572
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyCheckboxModule, decorators: [{
573
- type: NgModule,
574
- args: [{
575
- declarations: [
576
- SkyCheckboxComponent,
577
- SkyCheckboxLabelComponent,
578
- SkyCheckboxRequiredValidatorDirective,
579
- ],
580
- imports: [CommonModule, FormsModule, SkyIconModule],
581
- exports: [
582
- SkyCheckboxComponent,
583
- SkyCheckboxLabelComponent,
584
- SkyCheckboxRequiredValidatorDirective,
585
- ],
586
- }]
587
- }] });
588
-
589
- /**
590
- * Displays a label above the file attachment element.
591
- */
592
- class SkyFileAttachmentLabelComponent {
593
- }
594
- SkyFileAttachmentLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
595
- SkyFileAttachmentLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileAttachmentLabelComponent, selector: "sky-file-attachment-label", ngImport: i0, template: "<span class=\"sky-control-label\">\n <ng-content></ng-content>\n</span>\n", styles: [":host-context(.sky-theme-modern) .sky-control-label{color:#686c73;font-size:13px}.sky-theme-modern .sky-control-label{color:#686c73;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
596
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentLabelComponent, decorators: [{
597
- type: Component,
598
- args: [{
599
- selector: 'sky-file-attachment-label',
600
- templateUrl: './file-attachment-label.component.html',
601
- styleUrls: ['file-attachment-label.component.scss'],
602
- changeDetection: ChangeDetectionStrategy.OnPush,
603
- }]
604
- }] });
605
-
606
- /**
607
- * @internal
608
- */
609
- class SkyFileAttachmentService {
610
- checkFiles(files, minFileSize, maxFileSize, acceptedTypes, validateFn) {
611
- const fileResults = [];
612
- for (let index = 0; index < files.length; index++) {
613
- const fileItem = {
614
- file: files.item(index),
615
- };
616
- if (fileItem.file.size < minFileSize) {
617
- fileItem.errorType = 'minFileSize';
618
- fileItem.errorParam = minFileSize.toString();
619
- fileResults.push(fileItem);
620
- }
621
- else if (fileItem.file.size > maxFileSize) {
622
- fileItem.errorType = 'maxFileSize';
623
- fileItem.errorParam = maxFileSize.toString();
624
- fileResults.push(fileItem);
625
- }
626
- else if (this.fileTypeRejected(fileItem.file.type, acceptedTypes)) {
627
- fileItem.errorType = 'fileType';
628
- fileItem.errorParam = acceptedTypes;
629
- fileResults.push(fileItem);
630
- }
631
- else if (validateFn) {
632
- const errorParam = validateFn(fileItem);
633
- if (errorParam) {
634
- fileItem.errorType = 'validate';
635
- fileItem.errorParam = errorParam;
636
- }
637
- fileResults.push(fileItem);
638
- }
639
- else {
640
- fileResults.push(fileItem);
641
- }
642
- }
643
- return fileResults;
644
- }
645
- /**
646
- * Returns `true` if a directory is found in the provided `files` parameter.
647
- */
648
- hasDirectory(files) {
649
- for (let index = 0; index < files.length; index++) {
650
- const file = files.item(index);
651
- if (file.webkitGetAsEntry &&
652
- file.webkitGetAsEntry() &&
653
- file.webkitGetAsEntry().isDirectory) {
654
- return true;
655
- }
656
- }
657
- return false;
658
- }
659
- fileTypeRejected(fileType, acceptedTypes) {
660
- if (!acceptedTypes) {
661
- return false;
662
- }
663
- if (!fileType) {
664
- return true;
665
- }
666
- const acceptedTypesUpper = acceptedTypes.toUpperCase();
667
- const typeArray = acceptedTypesUpper.split(',');
668
- return !this.fileTypeInArray(typeArray, fileType.toUpperCase());
669
- }
670
- fileTypeInArray(typeArray, fileType) {
671
- if (typeArray.indexOf(fileType) !== -1) {
672
- return true;
673
- }
674
- for (let index = 0; index < typeArray.length; index++) {
675
- const type = typeArray[index];
676
- const validSubtype = this.getMimeSubtype(type);
677
- if (validSubtype === '*') {
678
- if (this.getMimeMainType(type) === this.getMimeMainType(fileType)) {
679
- return true;
680
- }
681
- }
682
- }
683
- return false;
684
- }
685
- getMimeSubtype(type) {
686
- return type.substr(type.indexOf('/') + 1, type.length);
687
- }
688
- getMimeMainType(type) {
689
- return type.substr(0, type.indexOf('/'));
690
- }
691
- }
692
- SkyFileAttachmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
693
- SkyFileAttachmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentService });
694
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentService, decorators: [{
695
- type: Injectable
696
- }] });
697
-
698
- /**
699
- * @internal
700
- */
701
- class SkyFileItemService {
702
- isFile(fileItem) {
703
- const file = fileItem.file;
704
- /* tslint:disable */
705
- return (file &&
706
- file !== undefined &&
707
- file !== null &&
708
- file.size !== undefined &&
709
- file.size !== null);
710
- /* tslint:enable */
711
- }
712
- isImage(fileItem) {
713
- const fileTypeUpper = this.getFileTypeUpper(fileItem);
714
- const slashIndex = fileTypeUpper.indexOf('/');
715
- if (slashIndex >= 0) {
716
- switch (fileTypeUpper.substr(fileTypeUpper.indexOf('/') + 1)) {
717
- case 'BMP':
718
- case 'GIF':
719
- case 'JPEG':
720
- case 'PNG':
721
- return true;
722
- default:
723
- break;
724
- }
725
- }
726
- return false;
727
- }
728
- getFileExtensionUpper(fileItem) {
729
- let extension = '', name;
730
- /* istanbul ignore else */
731
- /* sanity check */
732
- if (fileItem) {
733
- const file = fileItem.file;
734
- if (file) {
735
- /* istanbul ignore next */
736
- name = file.name || '';
737
- /* istanbul ignore next */
738
- extension = name.substr(name.lastIndexOf('.')) || '';
739
- }
740
- else {
741
- extension = '';
742
- }
743
- }
744
- return extension.toUpperCase();
745
- }
746
- getFileTypeUpper(fileItem) {
747
- let fileType = '';
748
- /* istanbul ignore else */
749
- /* sanity check */
750
- if (fileItem) {
751
- const file = fileItem.file;
752
- if (file) {
753
- fileType = file.type || '';
754
- }
755
- else {
756
- fileType = '';
757
- }
758
- }
759
- return fileType.toUpperCase();
760
- }
761
- }
762
- SkyFileItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileItemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
763
- SkyFileItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileItemService });
764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileItemService, decorators: [{
765
- type: Injectable
766
- }] });
767
-
768
- let uniqueId$1 = 0;
769
- /**
770
- * Provides an element to attach a single local file.
771
- */
772
- class SkyFileAttachmentComponent {
773
- constructor(changeDetector, fileAttachmentService, fileItemService, ngControl, themeSvc) {
774
- this.changeDetector = changeDetector;
775
- this.fileAttachmentService = fileAttachmentService;
776
- this.fileItemService = fileItemService;
777
- this.ngControl = ngControl;
778
- this.themeSvc = themeSvc;
779
- /**
780
- * Specifies the maximum size in bytes for valid files.
781
- */
782
- this.maxFileSize = 500000;
783
- /**
784
- * Specifies the minimum size in bytes for valid files.
785
- */
786
- this.minFileSize = 0;
787
- /**
788
- * Fires when users add or remove files.
789
- */
790
- this.fileChange = new EventEmitter();
791
- /**
792
- * Fires when users select the file name link. Make sure to bind the event.
793
- * If you do not, the file name link will be a dead link.
794
- */
795
- this.fileClick = new EventEmitter();
796
- this.acceptedOver = false;
797
- this.rejectedOver = false;
798
- /**
799
- * Indicates whether the input is required for form validation.
800
- * When you set this property to `true`, the component adds `aria-required` and `required`
801
- * attributes to the input element so that forms display an invalid state until the input element
802
- * is complete.
803
- */
804
- this.required = false;
805
- this.fileAttachmentId = uniqueId$1++;
806
- this.ngUnsubscribe = new Subject();
807
- this._disabled = false;
808
- // eslint-disable-next-line @typescript-eslint/no-empty-function
809
- this._onChange = (_) => { };
810
- // eslint-disable-next-line @typescript-eslint/no-empty-function
811
- this._onTouched = () => { };
812
- this.labelElementId = `sky-file-attachment-label-${this.fileAttachmentId}`;
813
- this.fileDropDescriptionElementId = `sky-file-attachment-drop-description-${this.fileAttachmentId}`;
814
- if (this.ngControl) {
815
- this.ngControl.valueAccessor = this;
816
- }
817
- }
818
- /**
819
- * Indicates whether to disable the input.
820
- * @default false
821
- */
822
- set disabled(value) {
823
- const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);
824
- if (this._disabled !== newDisabledState) {
825
- this._disabled = newDisabledState;
826
- }
827
- }
828
- get disabled() {
829
- return this._disabled;
830
- }
831
- get hasLabelComponent() {
832
- return this.labelComponents.length > 0;
833
- }
834
- set value(value) {
835
- // The null check is needed to address a bug in Angular 4.
836
- // writeValue is being called twice, first time with a phantom null value
837
- // See: https://github.com/angular/angular/issues/14988
838
- // tslint:disable-next-line:no-null-keyword
839
- const isNewValue = value !== this.value && value !== null;
840
- if (isNewValue) {
841
- this._value = value;
842
- this._onChange(value);
843
- this.updateFileAttachmentButton();
844
- }
845
- }
846
- get value() {
847
- return this._value;
848
- }
849
- ngOnInit() {
850
- if (this.themeSvc) {
851
- this.themeSvc.settingsChange
852
- .pipe(takeUntil(this.ngUnsubscribe))
853
- .subscribe((themeSettings) => {
854
- this.currentThemeName = themeSettings.currentSettings.theme.name;
855
- this.updateFileAttachmentButton();
856
- });
857
- }
858
- }
859
- ngAfterViewInit() {
860
- // This is needed to address a bug in Angular 7.
861
- // When a control value is set intially, its value is not represented on the view.
862
- // See: https://github.com/angular/angular/issues/13792
863
- // Of note is the parent check which allows us to determine if the form is reactive.
864
- // Without this check there is a changed before checked error
865
- /* istanbul ignore else */
866
- if (this.ngControl) {
867
- setTimeout(() => {
868
- this.ngControl.control.setValue(this.value, {
869
- emitEvent: false,
870
- });
871
- this.changeDetector.markForCheck();
872
- });
873
- // Backwards compatibility support for anyone still using Validators.Required.
874
- this.required =
875
- this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
876
- }
877
- }
878
- ngAfterContentInit() {
879
- // Handles updating classes when label changes
880
- this.labelComponents.changes
881
- .pipe(takeUntil(this.ngUnsubscribe))
882
- .subscribe(() => {
883
- this.changeDetector.detectChanges();
884
- });
885
- }
886
- isImage() {
887
- return this.fileItemService.isImage(this.value);
888
- }
889
- onDropClicked() {
890
- this._onTouched();
891
- this.inputEl.nativeElement.click();
892
- }
893
- fileChangeEvent(fileChangeEvent) {
894
- this.handleFiles(fileChangeEvent.target.files);
895
- }
896
- fileDragEnter(dragEnterEvent) {
897
- // Save this target to know when the drag event leaves
898
- this.enterEventTarget = dragEnterEvent.target;
899
- dragEnterEvent.stopPropagation();
900
- dragEnterEvent.preventDefault();
901
- }
902
- fileDragOver(dragOverEvent) {
903
- const transfer = dragOverEvent.dataTransfer;
904
- dragOverEvent.stopPropagation();
905
- dragOverEvent.preventDefault();
906
- if (transfer) {
907
- if (transfer.items) {
908
- const files = transfer.items;
909
- for (let index = 0; index < files.length; index++) {
910
- const file = files[index];
911
- if (file.type &&
912
- this.fileAttachmentService.fileTypeRejected(file.type, this.acceptedTypes)) {
913
- this.rejectedOver = true;
914
- this.acceptedOver = false;
915
- return;
916
- }
917
- }
918
- if (files.length > 0 && !this.acceptedOver) {
919
- this.rejectedOver = false;
920
- this.acceptedOver = true;
921
- }
922
- }
923
- else if (transfer.files) {
924
- // If the browser does not support DataTransfer.items,
925
- // defer file-type checking to drop handler.
926
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility
927
- this.rejectedOver = false;
928
- this.acceptedOver = true;
929
- }
930
- }
931
- }
932
- fileDrop(dropEvent) {
933
- dropEvent.stopPropagation();
934
- dropEvent.preventDefault();
935
- this.enterEventTarget = undefined;
936
- this.rejectedOver = false;
937
- this.acceptedOver = false;
938
- if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {
939
- if (dropEvent.dataTransfer.files.length > 1) {
940
- return;
941
- }
942
- if (this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files)) {
943
- return;
944
- }
945
- this.handleFiles(dropEvent.dataTransfer.files);
946
- }
947
- }
948
- fileDragLeave(dragLeaveEvent) {
949
- if (this.enterEventTarget === dragLeaveEvent.target) {
950
- this.rejectedOver = false;
951
- this.acceptedOver = false;
952
- }
953
- }
954
- deleteFileAttachment() {
955
- this.value = undefined;
956
- this.changeDetector.markForCheck();
957
- this.emitFileChangeEvent(this.value);
958
- }
959
- getFileName(truncate = true) {
960
- if (this.value) {
961
- // tslint:disable-next-line: max-line-length
962
- const dropName = this.fileItemService.isFile(this.value) && this.value.file.name
963
- ? this.value.file.name
964
- : this.value.url;
965
- if (truncate && dropName.length > 26) {
966
- return dropName.slice(0, 26) + '...';
967
- }
968
- else {
969
- return dropName;
970
- }
971
- }
972
- else {
973
- return undefined;
974
- }
975
- }
976
- ngOnDestroy() {
977
- this.fileChange.complete();
978
- this.ngUnsubscribe.next();
979
- this.ngUnsubscribe.complete();
980
- }
981
- registerOnChange(fn) {
982
- this._onChange = fn;
983
- }
984
- registerOnTouched(fn) {
985
- this._onTouched = fn;
986
- }
987
- writeValue(value) {
988
- this.value = value;
989
- this.changeDetector.markForCheck();
990
- }
991
- /**
992
- * @internal
993
- * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
994
- * @param isDisabled Whether the control should be disabled.
995
- */
996
- setDisabledState(isDisabled) {
997
- this.disabled = isDisabled;
998
- this.changeDetector.markForCheck();
999
- }
1000
- emitClick() {
1001
- this.fileClick.emit({
1002
- file: this.value,
1003
- });
1004
- }
1005
- emitFileChangeEvent(currentFile) {
1006
- if (currentFile && !currentFile.errorType) {
1007
- this.writeValue(currentFile);
1008
- }
1009
- this.fileChange.emit({
1010
- file: currentFile,
1011
- });
1012
- this.inputEl.nativeElement.value = '';
1013
- }
1014
- loadFile(file) {
1015
- const reader = new FileReader();
1016
- reader.addEventListener('load', (event) => {
1017
- file.url = event.target.result;
1018
- this.emitFileChangeEvent(file);
1019
- });
1020
- reader.addEventListener('error', (event) => {
1021
- this.emitFileChangeEvent(file);
1022
- });
1023
- reader.addEventListener('abort', (event) => {
1024
- this.emitFileChangeEvent(file);
1025
- });
1026
- reader.readAsDataURL(file.file);
1027
- }
1028
- handleFiles(files) {
1029
- // tslint:disable-next-line: max-line-length
1030
- const processedFiles = this.fileAttachmentService.checkFiles(files, this.minFileSize, this.maxFileSize, this.acceptedTypes, this.validateFn);
1031
- for (const file of processedFiles) {
1032
- if (file.errorType) {
1033
- this.emitFileChangeEvent(file);
1034
- }
1035
- else {
1036
- this.loadFile(file);
1037
- }
1038
- }
1039
- }
1040
- updateFileAttachmentButton() {
1041
- this.showFileAttachmentButton = !(this.value && this.currentThemeName === 'modern');
1042
- this.changeDetector.markForCheck();
1043
- }
1044
- }
1045
- SkyFileAttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyFileAttachmentService }, { token: SkyFileItemService }, { token: i1$1.NgControl, optional: true, self: true }, { token: i3.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1046
- SkyFileAttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileAttachmentComponent, selector: "sky-file-attachment", inputs: { acceptedTypes: "acceptedTypes", disabled: "disabled", maxFileSize: "maxFileSize", minFileSize: "minFileSize", validateFn: "validateFn", required: "required" }, outputs: { fileChange: "fileChange", fileClick: "fileClick" }, providers: [SkyFileAttachmentService], queries: [{ propertyName: "labelComponents", predicate: SkyFileAttachmentLabelComponent }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"\n sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\n \"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n", styles: [".sky-file-attachment-wrapper{display:inline-block}.sky-file-attachment-upload{padding-right:8px;display:block;border:1px solid transparent}.sky-file-attachment-accept{border-color:#72bf44;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}.sky-file-attachment-reject{border-color:#ef4044;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}:host(.ng-invalid.ng-dirty) .sky-file-attachment-btn{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044}.sky-file-attachment-name{padding:0 5px}.sky-file-attachment-name a{cursor:pointer}.sky-file-attachment-delete{border:none;color:#cdcfd2;cursor:pointer;padding:0}.sky-file-attachment-delete:hover{color:#979ba2;transition:color .15s}.sky-file-attachment-preview-img{max-width:25%;height:auto;box-shadow:0 0 5px #666;margin:10px}.sky-file-attachment-drop-description{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}:host-context(.sky-theme-modern) .sky-file-attachment-none{font-size:13px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}.sky-theme-modern .sky-file-attachment-none{font-size:13px}.sky-theme-modern .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentComponent, decorators: [{
1048
- type: Component,
1049
- args: [{
1050
- selector: 'sky-file-attachment',
1051
- templateUrl: './file-attachment.component.html',
1052
- styleUrls: ['./file-attachment.component.scss'],
1053
- providers: [SkyFileAttachmentService],
1054
- changeDetection: ChangeDetectionStrategy.OnPush,
1055
- }]
1056
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkyFileAttachmentService }, { type: SkyFileItemService }, { type: i1$1.NgControl, decorators: [{
1057
- type: Self
1058
- }, {
1059
- type: Optional
1060
- }] }, { type: i3.SkyThemeService, decorators: [{
1061
- type: Optional
1062
- }] }]; }, propDecorators: { acceptedTypes: [{
1063
- type: Input
1064
- }], disabled: [{
1065
- type: Input
1066
- }], maxFileSize: [{
1067
- type: Input
1068
- }], minFileSize: [{
1069
- type: Input
1070
- }], validateFn: [{
1071
- type: Input
1072
- }], fileChange: [{
1073
- type: Output
1074
- }], fileClick: [{
1075
- type: Output
1076
- }], required: [{
1077
- type: Input
1078
- }], inputEl: [{
1079
- type: ViewChild,
1080
- args: ['fileInput']
1081
- }], labelComponents: [{
1082
- type: ContentChildren,
1083
- args: [SkyFileAttachmentLabelComponent]
1084
- }] } });
1085
-
1086
- /**
1087
- * Provides an element to attach multiple files where users can browse or drag and drop local files
1088
- * or provide hyperlinks to external files. You can leave the contents of the component
1089
- * blank to display the drop zone's default UI, or you can specify custom content to
1090
- * display instead. When the module initializes, it disables the ability to drag and
1091
- * drop files for the entire window to prevent the browser from opening files that are
1092
- * accidentally dropped outside the target zone. If you implement your own file drop functionality
1093
- * outside of the file drop component, you can place the `sky-file-drop-target` CSS class
1094
- * on the element that receives drop events to exempt it from the drop exclusion rule.
1095
- */
1096
- class SkyFileDropComponent {
1097
- constructor(fileAttachmentService) {
1098
- this.fileAttachmentService = fileAttachmentService;
1099
- /**
1100
- * Fires when users add or remove files.
1101
- */
1102
- this.filesChanged = new EventEmitter();
1103
- /**
1104
- * Fires when the link input box triggers a blur event.
1105
- */
1106
- this.linkInputBlur = new EventEmitter();
1107
- /**
1108
- * Fires when users add or remove links.
1109
- */
1110
- this.linkChanged = new EventEmitter();
1111
- /**
1112
- * Specifies the minimum size in bytes for valid files.
1113
- */
1114
- this.minFileSize = 0;
1115
- /**
1116
- * Specifies the maximum size in bytes for valid files.
1117
- */
1118
- this.maxFileSize = 500000;
1119
- /**
1120
- * Indicates whether users can drag and drop multiple files at the same time.
1121
- */
1122
- this.multiple = true;
1123
- /**
1124
- * Indicates whether to disable the option to browse for files to attach.
1125
- */
1126
- this.noClick = false;
1127
- /**
1128
- * Indicates whether to display the option to attach files from URLs rather than from local devices.
1129
- */
1130
- this.allowLinks = false;
1131
- this.rejectedOver = false;
1132
- this.acceptedOver = false;
1133
- }
1134
- ngOnDestroy() {
1135
- this.filesChanged.complete();
1136
- this.linkChanged.complete();
1137
- this.linkInputBlur.complete();
1138
- }
1139
- dropClicked() {
1140
- if (!this.noClick) {
1141
- this.inputEl.nativeElement.click();
1142
- }
1143
- }
1144
- fileChangeEvent(fileChangeEvent) {
1145
- this.handleFiles(fileChangeEvent.target.files);
1146
- }
1147
- fileDragEnter(dragEnterEvent) {
1148
- // Save this target to know when the drag event leaves
1149
- this.enterEventTarget = dragEnterEvent.target;
1150
- dragEnterEvent.stopPropagation();
1151
- dragEnterEvent.preventDefault();
1152
- }
1153
- fileDragOver(dragOverEvent) {
1154
- const transfer = dragOverEvent.dataTransfer;
1155
- dragOverEvent.stopPropagation();
1156
- dragOverEvent.preventDefault();
1157
- if (transfer) {
1158
- if (transfer.items) {
1159
- const files = transfer.items;
1160
- for (let index = 0; index < files.length; index++) {
1161
- const file = files[index];
1162
- if (file.type &&
1163
- this.fileAttachmentService.fileTypeRejected(file.type, this.acceptedTypes)) {
1164
- this.rejectedOver = true;
1165
- this.acceptedOver = false;
1166
- return;
1167
- }
1168
- }
1169
- if (files.length > 0 && !this.acceptedOver) {
1170
- this.rejectedOver = false;
1171
- this.acceptedOver = true;
1172
- }
1173
- } /* istanbul ignore next: untestable */
1174
- else if (transfer.files) {
1175
- // If the browser does not support DataTransfer.items,
1176
- // defer file-type checking to drop handler.
1177
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility
1178
- this.rejectedOver = false;
1179
- this.acceptedOver = true;
1180
- }
1181
- }
1182
- }
1183
- fileDrop(dropEvent) {
1184
- dropEvent.stopPropagation();
1185
- dropEvent.preventDefault();
1186
- this.enterEventTarget = undefined;
1187
- this.rejectedOver = false;
1188
- this.acceptedOver = false;
1189
- if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {
1190
- const hasDirectory = this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files);
1191
- const invalidNumberOfFiles = !this.multiple && dropEvent.dataTransfer.files.length > 1;
1192
- if (hasDirectory || invalidNumberOfFiles) {
1193
- return;
1194
- }
1195
- this.handleFiles(dropEvent.dataTransfer.files);
1196
- }
1197
- }
1198
- fileDragLeave(dragLeaveEvent) {
1199
- if (this.enterEventTarget === dragLeaveEvent.target) {
1200
- this.rejectedOver = false;
1201
- this.acceptedOver = false;
1202
- }
1203
- }
1204
- addLinkEnter(event) {
1205
- if (event.which === 13) {
1206
- this.addLink(event);
1207
- }
1208
- }
1209
- addLink(event) {
1210
- event.preventDefault();
1211
- this.linkChanged.emit({ url: this.linkUrl });
1212
- this.linkUrl = undefined;
1213
- }
1214
- onLinkBlur() {
1215
- this.linkInputBlur.emit();
1216
- }
1217
- emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray) {
1218
- if (totalFiles === rejectedFileArray.length + validFileArray.length) {
1219
- this.filesChanged.emit({
1220
- files: validFileArray,
1221
- rejectedFiles: rejectedFileArray,
1222
- });
1223
- this.inputEl.nativeElement.value = '';
1224
- }
1225
- }
1226
- filesRejected(file, validFileArray, rejectedFileArray, totalFiles) {
1227
- rejectedFileArray.push(file);
1228
- this.emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray);
1229
- }
1230
- loadFile(fileDrop, file, validFileArray, rejectedFileArray, totalFiles) {
1231
- const reader = new FileReader();
1232
- reader.addEventListener('load', (event) => {
1233
- file.url = event.target.result;
1234
- validFileArray.push(file);
1235
- fileDrop.emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray);
1236
- });
1237
- reader.addEventListener('error', (event) => {
1238
- fileDrop.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
1239
- });
1240
- reader.addEventListener('abort', (event) => {
1241
- fileDrop.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
1242
- });
1243
- reader.readAsDataURL(file.file);
1244
- }
1245
- handleFiles(files) {
1246
- const validFileArray = [];
1247
- const rejectedFileArray = [];
1248
- const totalFiles = files.length;
1249
- // tslint:disable-next-line: max-line-length
1250
- const processedFiles = this.fileAttachmentService.checkFiles(files, this.minFileSize, this.maxFileSize, this.acceptedTypes, this.validateFn);
1251
- for (const file of processedFiles) {
1252
- if (file.errorType) {
1253
- this.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
1254
- }
1255
- else {
1256
- this.loadFile(this, file, validFileArray, rejectedFileArray, totalFiles);
1257
- }
1258
- }
1259
- }
1260
- }
1261
- SkyFileDropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileDropComponent, deps: [{ token: SkyFileAttachmentService }], target: i0.ɵɵFactoryTarget.Component });
1262
- SkyFileDropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileDropComponent, selector: "sky-file-drop", inputs: { fileUploadAriaLabel: "fileUploadAriaLabel", linkUploadAriaLabel: "linkUploadAriaLabel", minFileSize: "minFileSize", maxFileSize: "maxFileSize", multiple: "multiple", validateFn: "validateFn", acceptedTypes: "acceptedTypes", noClick: "noClick", allowLinks: "allowLinks" }, outputs: { filesChanged: "filesChanged", linkInputBlur: "linkInputBlur", linkChanged: "linkChanged" }, providers: [SkyFileAttachmentService], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div\n class=\"sky-file-drop-row\"\n [ngClass]=\"{ 'sky-file-drop-allow-links': allowLinks }\"\n>\n <div\n class=\"sky-file-drop-col\"\n [ngClass]=\"{\n 'sky-file-drop-accept': acceptedOver,\n 'sky-file-drop-reject': rejectedOver\n }\"\n >\n <button\n class=\"sky-file-drop sky-file-drop-target\"\n type=\"button\"\n (click)=\"dropClicked()\"\n (dragover)=\"fileDragOver($event)\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n [attr.aria-label]=\"\n fileUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_drag_or_click' | skyLibResources)\n \"\n ></button>\n\n <input\n tabindex=\"-1\"\n aria-hidden=\"true\"\n type=\"file\"\n class=\"sky-file-input-hidden\"\n [attr.multiple]=\"multiple ? multiple : null\"\n [attr.accept]=\"acceptedTypes ? acceptedTypes : null\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n\n <div\n class=\"sky-file-drop-contents sky-padding-even-default\"\n *ngIf=\"customEl.children.length === 0\"\n >\n <div class=\"sky-file-drop-contents-not-over\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drag_file_here' | skyLibResources\n }}\n </div>\n <div class=\"sky-file-drop-text\">\n {{\n 'skyux_file_attachment_file_upload_or_click_to_browse'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"cloud-upload\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is valid -->\n <div class=\"sky-file-drop-contents-accept\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drop_files_here'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"bullseye\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is invalid -->\n <div class=\"sky-file-drop-contents-reject\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_invalid_file' | skyLibResources\n }}\n </div>\n <sky-icon icon=\"times-circle\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n </div>\n\n <div class=\"sky-file-drop-contents-custom\" #customEl>\n <ng-content></ng-content>\n </div>\n </div>\n <div class=\"sky-file-drop-col\" *ngIf=\"allowLinks\">\n <div class=\"sky-file-drop-contents sky-padding-even-default\">\n <div class=\"sky-file-drop-link\">\n <div class=\"sky-file-drop-link-header\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_paste_link' | skyLibResources\n }}\n </div>\n </div>\n <div class=\"sky-form-group\">\n <input\n type=\"text\"\n class=\"sky-form-control\"\n [attr.aria-label]=\"\n linkUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_link_input' | skyLibResources)\n \"\n [attr.placeholder]=\"\n 'skyux_file_attachment_file_upload_link_placeholder'\n | skyLibResources\n \"\n [(ngModel)]=\"linkUrl\"\n (blur)=\"onLinkBlur()\"\n (keyup)=\"addLinkEnter($event)\"\n />\n </div>\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!linkUrl\"\n (click)=\"addLink($event)\"\n >\n {{\n 'skyux_file_attachment_file_upload_paste_link_done'\n | skyLibResources\n }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".sky-file-drop-col{margin-bottom:10px;padding-left:5px;padding-right:5px;position:relative}:host .sky-file-drop-row{display:block}:host .sky-file-drop-col{flex-basis:auto}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-row,:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:block}:host-context(.sky-responsive-container-xs) .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}@media (min-width: 768px){:host .sky-file-drop-row{display:flex}:host .sky-file-drop-col{flex-basis:100%}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}}:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:flex}:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:100%}:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}button.sky-file-drop{height:100%;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1}button.sky-file-drop:hover{cursor:pointer}.sky-file-drop-contents{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;background-color:#eeeeef;color:#212327;cursor:pointer;width:100%;text-align:center;height:100%}.sky-file-drop-contents .sky-file-drop-link-header{margin-bottom:5px}.sky-file-drop-noclick .sky-file-drop-contents{cursor:default}.sky-file-drop-accept .sky-file-drop-contents,.sky-file-drop-reject .sky-file-drop-contents{border-style:dashed;border-width:1px}.sky-file-drop-accept .sky-file-drop-contents-not-over,.sky-file-drop-reject .sky-file-drop-contents-not-over{display:none}.sky-file-drop-accept .sky-file-drop-contents{border-color:#72bf44;color:#212327}.sky-file-drop-accept .sky-file-drop-contents-accept{display:block}.sky-file-drop-reject .sky-file-drop-contents{border-color:#ef4044;color:#212327}.sky-file-drop-reject .sky-file-drop-contents-reject{display:block}.sky-file-drop-contents-accept,.sky-file-drop-contents-reject{display:none}.sky-file-upload-icon{display:block;font-size:40px;max-height:40px;margin-top:10px}.sky-file-drop-link{cursor:default}.sky-file-drop-text-header{margin:0}.sky-file-drop-text{font-size:15px;margin-top:5px;margin-bottom:20px}.sky-file-drop-text,.sky-file-drop-text-header{line-height:1.1;display:block}.sky-file-upload-icon{color:#686c73}.sky-file-drop{background-color:transparent;border:none;display:block;-webkit-appearance:none;width:100%;padding:0}.sky-file-input-hidden{display:none}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe } });
1263
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileDropComponent, decorators: [{
1264
- type: Component,
1265
- args: [{
1266
- selector: 'sky-file-drop',
1267
- templateUrl: './file-drop.component.html',
1268
- styleUrls: ['./file-drop.component.scss'],
1269
- providers: [SkyFileAttachmentService],
1270
- }]
1271
- }], ctorParameters: function () { return [{ type: SkyFileAttachmentService }]; }, propDecorators: { filesChanged: [{
1272
- type: Output
1273
- }], linkInputBlur: [{
1274
- type: Output
1275
- }], linkChanged: [{
1276
- type: Output
1277
- }], fileUploadAriaLabel: [{
1278
- type: Input
1279
- }], linkUploadAriaLabel: [{
1280
- type: Input
1281
- }], minFileSize: [{
1282
- type: Input
1283
- }], maxFileSize: [{
1284
- type: Input
1285
- }], multiple: [{
1286
- type: Input
1287
- }], validateFn: [{
1288
- type: Input
1289
- }], acceptedTypes: [{
1290
- type: Input
1291
- }], noClick: [{
1292
- type: Input
1293
- }], allowLinks: [{
1294
- type: Input
1295
- }], inputEl: [{
1296
- type: ViewChild,
1297
- args: ['fileInput']
1298
- }] } });
1299
-
1300
- /**
1301
- * @internal
1302
- */
1303
- class SkyFileSizePipe {
1304
- constructor(decimalPipe, resourcesService) {
1305
- this.decimalPipe = decimalPipe;
1306
- this.resourcesService = resourcesService;
1307
- }
1308
- transform(input) {
1309
- let decimalPlaces = 0, dividend = 1, template;
1310
- /* tslint:disable */
1311
- if (input === null || input === undefined) {
1312
- return '';
1313
- }
1314
- /* tslint:enable */
1315
- if (Math.abs(input) === 1) {
1316
- template = 'skyux_file_attachment_file_size_b_singular';
1317
- }
1318
- else if (input < 1000) {
1319
- template = 'skyux_file_attachment_file_size_b_plural';
1320
- }
1321
- else if (input < 1e6) {
1322
- template = 'skyux_file_attachment_file_size_kb';
1323
- dividend = 1000;
1324
- }
1325
- else if (input < 1e9) {
1326
- template = 'skyux_file_attachment_file_size_mb';
1327
- dividend = 1e6;
1328
- decimalPlaces = 1;
1329
- }
1330
- else {
1331
- template = 'skyux_file_attachment_file_size_gb';
1332
- dividend = 1e9;
1333
- decimalPlaces = 1;
1334
- }
1335
- const roundedSize = Math.floor(input / (dividend / Math.pow(10, decimalPlaces))) /
1336
- Math.pow(10, decimalPlaces);
1337
- const formattedSize = this.decimalPipe.transform(roundedSize, '.0-3');
1338
- return this.getString(template, formattedSize);
1339
- }
1340
- getString(key, ...args) {
1341
- // TODO: Need to implement the async `getString` method in a breaking change.
1342
- return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key, ...args);
1343
- }
1344
- }
1345
- SkyFileSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileSizePipe, deps: [{ token: i1.DecimalPipe }, { token: i2.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Pipe });
1346
- SkyFileSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileSizePipe, name: "skyFileSize" });
1347
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileSizePipe, decorators: [{
1348
- type: Pipe,
1349
- args: [{
1350
- name: 'skyFileSize',
1351
- }]
1352
- }], ctorParameters: function () { return [{ type: i1.DecimalPipe }, { type: i2.SkyLibResourcesService }]; } });
1353
-
1354
- class SkyFileItemComponent {
1355
- constructor(differs, fileItemService) {
1356
- this.differs = differs;
1357
- this.fileItemService = fileItemService;
1358
- /**
1359
- * Fires when users select the delete button for an item. The deleted item is passed to the
1360
- * function.
1361
- */
1362
- this.deleteFile = new EventEmitter();
1363
- this.differ = this.differs.find({}).create();
1364
- }
1365
- get fileName() {
1366
- return this.fileItem.file.name;
1367
- }
1368
- get fileSize() {
1369
- return this.fileItem.file.size;
1370
- }
1371
- get url() {
1372
- return this.fileItem.url;
1373
- }
1374
- ngDoCheck() {
1375
- const changes = this.differ.diff(this.fileItem);
1376
- if (changes) {
1377
- let cls;
1378
- const extensionUpper = this.fileItemService.getFileExtensionUpper(this.fileItem);
1379
- let fileTypeUpper;
1380
- switch (extensionUpper) {
1381
- case '.PDF':
1382
- cls = 'pdf';
1383
- break;
1384
- case '.GZ':
1385
- case '.RAR':
1386
- case '.TGZ':
1387
- case '.ZIP':
1388
- cls = 'archive';
1389
- break;
1390
- case '.PPT':
1391
- case '.PPTX':
1392
- cls = 'powerpoint';
1393
- break;
1394
- case '.DOC':
1395
- case '.DOCX':
1396
- cls = 'word';
1397
- break;
1398
- case '.XLS':
1399
- case '.XLSX':
1400
- cls = 'excel';
1401
- break;
1402
- case '.TXT':
1403
- cls = 'text';
1404
- break;
1405
- case '.HTM':
1406
- case '.HTML':
1407
- cls = 'code';
1408
- break;
1409
- default:
1410
- break;
1411
- }
1412
- if (!cls) {
1413
- fileTypeUpper = this.fileItemService.getFileTypeUpper(this.fileItem);
1414
- switch (fileTypeUpper.substr(0, fileTypeUpper.indexOf('/'))) {
1415
- case 'AUDIO':
1416
- cls = 'audio';
1417
- break;
1418
- case 'IMAGE':
1419
- // Normally images are displayed as thumbnails, but if an image type is not recognized
1420
- // as being widely supported by modern browsers (e.g. TIFF files) then an icon should
1421
- // be displayed instead.
1422
- cls = 'image';
1423
- break;
1424
- case 'TEXT':
1425
- cls = 'text';
1426
- break;
1427
- case 'VIDEO':
1428
- cls = 'video';
1429
- break;
1430
- default:
1431
- break;
1432
- }
1433
- }
1434
- this.icon = 'file-' + (cls ? cls + '-' : '') + 'o';
1435
- }
1436
- }
1437
- itemDelete() {
1438
- this.deleteFile.emit(this.fileItem);
1439
- }
1440
- isFile() {
1441
- return this.fileItemService.isFile(this.fileItem);
1442
- }
1443
- isImage() {
1444
- return this.fileItemService.isImage(this.fileItem);
1445
- }
1446
- }
1447
- SkyFileItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileItemComponent, deps: [{ token: i0.KeyValueDiffers }, { token: SkyFileItemService }], target: i0.ɵɵFactoryTarget.Component });
1448
- SkyFileItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyFileItemComponent, selector: "sky-file-item", inputs: { fileItem: "fileItem" }, outputs: { deleteFile: "deleteFile" }, ngImport: i0, template: "<div class=\"sky-file-item sky-padding-even-default\">\n <div class=\"sky-file-item-title\">\n <div class=\"sky-file-item-name-container\">\n <div class=\"sky-file-item-name\">\n <strong *ngIf=\"isFile()\">{{ fileName }}</strong>\n <strong *ngIf=\"!isFile()\">{{ url }}</strong>\n </div>\n <div class=\"sky-file-item-size\" *ngIf=\"isFile()\">\n ({{ fileSize | skyFileSize }})\n </div>\n </div>\n <div class=\"sky-file-item-controls\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-file-item-btn-delete\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n (click)=\"itemDelete()\"\n >\n <sky-icon icon=\"trash-o\" size=\"lg\"></sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-file-item-content\">\n <div class=\"sky-file-item-preview\">\n <div *ngIf=\"isImage()\" class=\"sky-file-item-preview-img-container\">\n <img\n class=\"sky-file-item-preview-img\"\n [src]=\"url\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n />\n </div>\n <div *ngIf=\"!isImage()\" class=\"sky-file-item-preview-other\">\n <sky-icon [icon]=\"icon\"></sky-icon>\n </div>\n </div>\n <div class=\"sky-file-item-content-custom\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", styles: [".sky-file-item{border-top:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;border-right:1px solid #e2e3e4;background-color:#eeeeef;margin-bottom:10px}.sky-file-item-name-container{flex:1 1 auto;overflow:hidden}.sky-file-item-controls{flex:0 1 auto;padding-left:15px}.sky-file-item-name{white-space:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis}.sky-file-item-title{margin-bottom:10px;display:flex}.sky-file-item-content{display:flex}.sky-file-item-preview{flex-basis:25%}.sky-file-item-content-custom{flex-basis:75%}.sky-file-item-preview-img-container{text-align:center}.sky-file-item-preview-img{max-width:100%;height:auto;box-shadow:0 0 5px #666}.sky-file-item-preview-other{color:#686c73;font-size:100px;line-height:1;text-align:center;width:100%}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "skyFileSize": SkyFileSizePipe, "skyLibResources": i2.SkyLibResourcesPipe } });
1449
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileItemComponent, decorators: [{
1450
- type: Component,
1451
- args: [{
1452
- selector: 'sky-file-item',
1453
- templateUrl: './file-item.component.html',
1454
- styleUrls: ['./file-item.component.scss'],
1455
- }]
1456
- }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: SkyFileItemService }]; }, propDecorators: { fileItem: [{
1457
- type: Input
1458
- }], deleteFile: [{
1459
- type: Output
1460
- }] } });
1461
-
1462
- class SkyFileAttachmentsModule {
1463
- }
1464
- SkyFileAttachmentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1465
- SkyFileAttachmentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentsModule, declarations: [SkyFileAttachmentComponent,
1466
- SkyFileAttachmentLabelComponent,
1467
- SkyFileDropComponent,
1468
- SkyFileItemComponent,
1469
- SkyFileSizePipe], imports: [CommonModule,
1470
- FormsModule,
1471
- SkyFormsResourcesModule,
1472
- SkyI18nModule,
1473
- SkyIconModule,
1474
- SkyThemeModule], exports: [SkyFileAttachmentComponent,
1475
- SkyFileAttachmentLabelComponent,
1476
- SkyFileDropComponent,
1477
- SkyFileItemComponent,
1478
- SkyFileSizePipe] });
1479
- SkyFileAttachmentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentsModule, providers: [DecimalPipe, SkyFileItemService], imports: [[
1480
- CommonModule,
1481
- FormsModule,
1482
- SkyFormsResourcesModule,
1483
- SkyI18nModule,
1484
- SkyIconModule,
1485
- SkyThemeModule,
1486
- ]] });
1487
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyFileAttachmentsModule, decorators: [{
1488
- type: NgModule,
1489
- args: [{
1490
- declarations: [
1491
- SkyFileAttachmentComponent,
1492
- SkyFileAttachmentLabelComponent,
1493
- SkyFileDropComponent,
1494
- SkyFileItemComponent,
1495
- SkyFileSizePipe,
1496
- ],
1497
- imports: [
1498
- CommonModule,
1499
- FormsModule,
1500
- SkyFormsResourcesModule,
1501
- SkyI18nModule,
1502
- SkyIconModule,
1503
- SkyThemeModule,
1504
- ],
1505
- exports: [
1506
- SkyFileAttachmentComponent,
1507
- SkyFileAttachmentLabelComponent,
1508
- SkyFileDropComponent,
1509
- SkyFileItemComponent,
1510
- SkyFileSizePipe,
1511
- ],
1512
- providers: [DecimalPipe, SkyFileItemService],
1513
- }]
1514
- }] });
1515
-
1516
- /**
1517
- * @internal
1518
- */
1519
- class SkyInputBoxAdapterService {
1520
- focusControl(elRef) {
1521
- const control = elRef.nativeElement.querySelector('.sky-form-control');
1522
- /* istanbul ignore else */
1523
- if (control) {
1524
- control.focus();
1525
- }
1526
- }
1527
- /**
1528
- * Returns the inline help element.
1529
- */
1530
- getInlineHelpElement(elRef) {
1531
- return elRef.nativeElement.querySelector('.sky-control-help');
1532
- }
1533
- /**
1534
- * Returns true if the provided element contains the focused element.
1535
- */
1536
- isFocusInElement(el) {
1537
- if (el) {
1538
- return (el === document.activeElement || el.contains(document.activeElement));
1539
- }
1540
- return false;
1541
- }
1542
- }
1543
- SkyInputBoxAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1544
- SkyInputBoxAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService });
1545
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService, decorators: [{
1546
- type: Injectable
1547
- }] });
1548
-
1549
- /**
1550
- * @internal
1551
- */
1552
- class SkyInputBoxHostService {
1553
- init(host) {
1554
- this.host = host;
1555
- }
1556
- populate(args) {
1557
- this.host.populate(args);
1558
- }
1559
- }
1560
- SkyInputBoxHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1561
- SkyInputBoxHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService });
1562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService, decorators: [{
1563
- type: Injectable
1564
- }] });
1565
-
1566
- /**
1567
- * Creates a wrapper to provide styling for `input` and `label` elements. To render the
1568
- * component correctly, include the `sky-form-control` CSS class on the `input` element
1569
- * and the `sky-control-label` CSS class on the `label` element. To display a help button
1570
- * beside the label, include a help button element in the `sky-input-box` element and a
1571
- * `sky-control-help` CSS class on that element.
1572
- */
1573
- class SkyInputBoxComponent {
1574
- constructor(changeRef, inputBoxHostSvc, adapterService, elementRef) {
1575
- this.changeRef = changeRef;
1576
- this.inputBoxHostSvc = inputBoxHostSvc;
1577
- this.adapterService = adapterService;
1578
- this.elementRef = elementRef;
1579
- }
1580
- get hasErrorsComputed() {
1581
- if (this.hasErrors === undefined) {
1582
- return (this.controlHasErrors(this.formControl) ||
1583
- this.controlHasErrors(this.formControlByName) ||
1584
- this.controlHasErrors(this.ngModel));
1585
- }
1586
- return this.hasErrors;
1587
- }
1588
- ngOnInit() {
1589
- this.inputBoxHostSvc.init(this);
1590
- }
1591
- formControlFocusIn() {
1592
- const inlineHelpEl = this.adapterService.getInlineHelpElement(this.elementRef);
1593
- if (!this.adapterService.isFocusInElement(inlineHelpEl)) {
1594
- this.updateHasFocus(true);
1595
- }
1596
- }
1597
- formControlFocusOut() {
1598
- this.updateHasFocus(false);
1599
- }
1600
- onInsetIconClick() {
1601
- if (!this.disabled) {
1602
- this.adapterService.focusControl(this.elementRef);
1603
- }
1604
- }
1605
- populate(args) {
1606
- this.hostInputTemplate = args.inputTemplate;
1607
- this.hostButtonsTemplate = args.buttonsTemplate;
1608
- this.hostButtonsLeftTemplate = args.buttonsLeftTemplate;
1609
- this.hostButtonsInsetTemplate = args.buttonsInsetTemplate;
1610
- this.hostIconsInsetTemplate = args.iconsInsetTemplate;
1611
- this.hostIconsInsetLeftTemplate = args.iconsInsetLeftTemplate;
1612
- }
1613
- updateHasFocus(hasFocus) {
1614
- // Some components manipulate the focus of elements inside an input box programmatically,
1615
- // which can cause an `ExpressionChangedAfterItHasBeenCheckedError` if focus was set after
1616
- // initial change detection. Using `setTimeout()` here fixes it.
1617
- setTimeout(() => {
1618
- this.formControlHasFocus = hasFocus;
1619
- this.changeRef.markForCheck();
1620
- });
1621
- }
1622
- controlHasErrors(control) {
1623
- return control && control.invalid && (control.dirty || control.touched);
1624
- }
1625
- }
1626
- SkyInputBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyInputBoxHostService }, { token: SkyInputBoxAdapterService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1627
- SkyInputBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyInputBoxComponent, selector: "sky-input-box", inputs: { hasErrors: "hasErrors", disabled: "disabled" }, providers: [SkyInputBoxAdapterService, SkyInputBoxHostService], queries: [{ propertyName: "formControl", first: true, predicate: FormControlDirective, descendants: true }, { propertyName: "formControlByName", first: true, predicate: FormControlName, descendants: true }, { propertyName: "ngModel", first: true, predicate: NgModel, descendants: true }], ngImport: i0, template: "<div\n *skyThemeIf=\"'default'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-form-group\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"characterCountTemplate\"></ng-container>\n </div>\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-input-group-inner\"\n [ngClass]=\"{\n 'sky-field-status-active': formControlHasFocus,\n 'sky-field-status-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n </div>\n</div>\n\n<div\n *skyThemeIf=\"'modern'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-input-box-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-group-form-control\"\n [ngClass]=\"{\n 'sky-input-box-group-form-control-focus': formControlHasFocus,\n 'sky-input-box-group-form-control-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <div class=\"sky-form-group\">\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <div class=\"sky-input-box-form-group-inner\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container\n *ngTemplateOutlet=\"characterCountTemplate\"\n ></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n</div>\n\n<ng-template #labelTemplate>\n <ng-content select=\".sky-control-label\"></ng-content>\n</ng-template>\n\n<ng-template #inlineHelpTemplate>\n <ng-content select=\".sky-control-help\"></ng-content>\n</ng-template>\n\n<ng-template #characterCountTemplate>\n <ng-content select=\"sky-character-counter-indicator\"></ng-content>\n</ng-template>\n\n<ng-template #inputTemplate>\n <ng-content select=\".sky-form-control\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostInputTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsLeftTemplate>\n <ng-content select=\".sky-input-group-btn.sky-input-box-btn-left\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsLeftTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsTemplate>\n <ng-content\n select=\".sky-input-group-btn:not(.sky-input-box-btn-left):not(.sky-input-box-btn-inset)\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsInsetTemplate>\n <ng-content\n select=\".sky-input-group-btn.sky-input-box-btn-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsInsetTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #iconsInsetTemplate>\n <div class=\"sky-input-box-icon-inset-wrapper\" (click)=\"onInsetIconClick()\">\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #iconsInsetLeftTemplate>\n <div\n class=\"sky-input-box-icon-inset-left-wrapper\"\n (click)=\"onInsetIconClick()\"\n >\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset-left\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetLeftTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #errorLabelTemplate>\n <ng-content select=\".sky-error-label\"></ng-content>\n</ng-template>\n", styles: ["sky-input-box{display:block}sky-input-box .sky-input-box-input-container{width:100%}sky-input-box .sky-form-group{display:flex;flex-wrap:wrap}sky-input-box .sky-form-group .sky-control-help{margin:0 0 0 4px}sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;width:100%}sky-input-box .sky-input-box-input-group-inner{display:flex;background-color:#fff;width:100%;z-index:1}sky-input-box .sky-input-box-input-group-inner:not(.sky-field-status-active):not(.sky-field-status-invalid){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-input-box .sky-input-box-btn-inset .sky-btn{background-color:transparent;border:none}sky-input-box .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-icon-inset-left-wrapper{display:flex}sky-input-box .sky-input-box-icon-inset-wrapper .sky-input-group-icon,sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-group-icon{width:33px;display:flex;align-items:center;justify-content:center}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:#cdcfd2}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper .sky-icon,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper .sky-icon{color:#686c73}sky-input-box sky-character-counter-indicator{flex-grow:1;text-align:right;margin-bottom:5px;margin-left:auto}sky-input-box .sky-control-label+sky-character-counter-indicator{flex-grow:0;flex-shrink:.001}sky-input-box .sky-form-control,sky-input-box .sky-form-control:focus{border:none;flex-basis:100%}sky-input-box .sky-form-control:focus,sky-input-box .sky-form-control.ng-invalid.ng-touched,sky-input-box .sky-form-control:focus:focus,sky-input-box .sky-form-control:focus.ng-invalid.ng-touched{border:none;box-shadow:none}sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 10px;width:initial}.sky-theme-modern .sky-input-box .sky-input-box-group{display:flex}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control{flex-grow:1;position:relative}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:first-child .sky-form-group{border-top-left-radius:6px;border-bottom-left-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:last-child .sky-form-group{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-form-group-inner{display:flex;flex-grow:1;flex-wrap:wrap}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn{border-radius:0;color:#686c73;margin:0;padding:0;position:relative;transition:border-color .15s,box-shadow .15s,color .15s;width:55px}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn .sky-icon{font-size:24px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn{border-top-left-radius:6px;border-bottom-left-radius:6px;margin-right:-1px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn:focus{z-index:1}.sky-theme-modern .sky-input-box .sky-input-group-btn:last-child .sky-btn{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-group-icon{width:55px}.sky-theme-modern .sky-input-box .sky-input-group-icon .sky-icon{color:#686c73;font-size:24px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-group-btn:focus-within:not(:last-child){z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control+.sky-input-group-btn .sky-btn{margin-left:-2px}.sky-theme-modern .sky-input-box .sky-input-group-btn+.sky-input-group-btn .sky-btn{margin-left:-1px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box .sky-form-group{background-color:#fff;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;color:#686c73;flex-wrap:nowrap;margin-bottom:0;padding:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;padding:0 15px;width:100%}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-bottom:0;position:relative;z-index:2}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label{padding:6px 0 1px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-character-count-label{font-size:13px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help{margin:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help .sky-help-inline{font-size:16px;padding:3px 10px 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help:last-child .sky-help-inline{padding:3px 0 0 10px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-left:auto;padding:3px 0 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control{background-color:transparent;border:none;border-radius:6px;font-size:16px;height:auto;line-height:18px;margin-top:-23px;padding:26px 15px 10px;position:relative}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:first-line{line-height:19px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:focus,.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control.ng-invalid{box-shadow:none;outline:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-webkit-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-controlinput:-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:-ms-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn{background-color:transparent;border-radius:6px;transition-property:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn:not(:active):not(:focus):not(:hover){box-shadow:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+.sky-form-control,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+* .sky-form-control{margin-top:0;padding-top:10px}@-moz-document url-prefix(){.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{padding-left:10px}}.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{background-position-x:calc(100% - 10px);z-index:3}.sky-theme-modern .sky-input-box .sky-form-group textarea.sky-form-control{resize:vertical}.sky-theme-modern .sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 15px;width:initial}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover .sky-form-group{border:none;box-shadow:inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #d2d2d2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:hover{border:none;box-shadow:inset 0 0 0 1px #1870b8;z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:active,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus{border:none;box-shadow:inset 0 0 0 2px #1870b8;color:#212327;z-index:2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus:not(:active){outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:active .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid:active .sky-form-group{color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group .sky-control-label{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-control,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-control-label,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn{cursor:not-allowed}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-wrapper,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:transparent}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-group{background-color:#ededee}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn .sky-btn{background-color:#ededee;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;opacity:1}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group{background-color:transparent;border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-form-control,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-input-group-btn .sky-btn{background-color:transparent;color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus .sky-form-group,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus.sky-input-box-group-form-control-invalid .sky-form-group{color:#1870b8}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn.sky-btn-default{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn:focus{border-color:#1870b8;color:#fbfcfe}\n"], directives: [{ type: i3.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], encapsulation: i0.ViewEncapsulation.None });
1628
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxComponent, decorators: [{
1629
- type: Component,
1630
- args: [{
1631
- selector: 'sky-input-box',
1632
- templateUrl: './input-box.component.html',
1633
- styleUrls: ['./input-box.component.scss'],
1634
- providers: [SkyInputBoxAdapterService, SkyInputBoxHostService],
1635
- // Note that change detection is not set to OnPush; default change detection allows the
1636
- // invalid CSS class to be added when the content control's invalid/dirty state changes.
1637
- encapsulation: ViewEncapsulation.None,
1638
- }]
1639
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkyInputBoxHostService }, { type: SkyInputBoxAdapterService }, { type: i0.ElementRef }]; }, propDecorators: { hasErrors: [{
1640
- type: Input
1641
- }], disabled: [{
1642
- type: Input
1643
- }], formControl: [{
1644
- type: ContentChild,
1645
- args: [FormControlDirective]
1646
- }], formControlByName: [{
1647
- type: ContentChild,
1648
- args: [FormControlName]
1649
- }], ngModel: [{
1650
- type: ContentChild,
1651
- args: [NgModel]
1652
- }] } });
1653
-
1654
- class SkyInputBoxModule {
1655
- }
1656
- SkyInputBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1657
- SkyInputBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, declarations: [SkyInputBoxComponent], imports: [CommonModule, SkyThemeModule], exports: [SkyInputBoxComponent] });
1658
- SkyInputBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, imports: [[CommonModule, SkyThemeModule]] });
1659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, decorators: [{
1660
- type: NgModule,
1661
- args: [{
1662
- declarations: [SkyInputBoxComponent],
1663
- imports: [CommonModule, SkyThemeModule],
1664
- exports: [SkyInputBoxComponent],
1665
- }]
1666
- }] });
1667
-
1668
- /**
1669
- * Auto-incrementing integer that generates unique IDs for radio components.
1670
- */
1671
- let nextUniqueId$1 = 0;
1672
- /**
1673
- * Provider Expression that allows sky-radio to register as a ControlValueAccessor.
1674
- * This allows it to support [(ngModel)].
1675
- */
1676
- // tslint:disable:no-forward-ref no-use-before-declare
1677
- const SKY_RADIO_CONTROL_VALUE_ACCESSOR = {
1678
- provide: NG_VALUE_ACCESSOR,
1679
- useExisting: forwardRef(() => SkyRadioComponent),
1680
- multi: true,
1681
- };
1682
- // tslint:enable
1683
- /**
1684
- * Renders a SKY UX-themed replacement for an HTML `input` element
1685
- * with `type="radio"`. When users select a radio button, its value is driven through an
1686
- * `ngModel` attribute that you specify on the `sky-radio` element or the parent `sky-radio-group` element.
1687
- */
1688
- class SkyRadioComponent {
1689
- constructor(changeDetector) {
1690
- this.changeDetector = changeDetector;
1691
- /**
1692
- * Fires when users focus off a radio button.
1693
- */
1694
- this.blur = new Subject();
1695
- /**
1696
- * Specifies an ID for the radio button.
1697
- * @default a unique, auto-incrementing integer. For example: `sky-radio-1`
1698
- */
1699
- this.id = `sky-radio-${++nextUniqueId$1}`;
1700
- this._change = new EventEmitter();
1701
- this._checked = false;
1702
- this._checkedChange = new BehaviorSubject(this._checked);
1703
- this._disabled = false;
1704
- this._disabledChange = new BehaviorSubject(this._disabled);
1705
- // eslint-disable-next-line @typescript-eslint/no-empty-function
1706
- this.removeUniqueSelectionListener = () => { };
1707
- // eslint-disable-next-line @typescript-eslint/no-empty-function
1708
- this.onChangeCallback = (value) => { };
1709
- // eslint-disable-next-line @typescript-eslint/no-empty-function
1710
- this.onTouchedCallback = () => { };
1711
- }
1712
- /**
1713
- * Indicates whether the radio button is selected.
1714
- * @default false
1715
- */
1716
- set checked(value) {
1717
- const newCheckedState = !!value;
1718
- if (this._checked !== newCheckedState) {
1719
- this._checked = newCheckedState;
1720
- this._checkedChange.next(this._checked);
1721
- if (newCheckedState) {
1722
- this.selectedValue = this.value;
1723
- }
1724
- }
1725
- this.changeDetector.markForCheck();
1726
- }
1727
- get checked() {
1728
- return this._checked;
1729
- }
1730
- /**
1731
- * Indicates whether to disable the input.
1732
- * @default false
1733
- */
1734
- set disabled(value) {
1735
- const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
1736
- if (coercedValue !== this.disabled) {
1737
- this._disabled = coercedValue;
1738
- this._disabledChange.next(this._disabled);
1739
- this.changeDetector.markForCheck();
1740
- }
1741
- }
1742
- get disabled() {
1743
- return this._disabled;
1744
- }
1745
- /**
1746
- * This property is deprecated in favor of the `name` property on the `sky-radio-group element`.
1747
- * We recommend using the `sky-radio-group` element with all radio buttons, but if you opt not to,
1748
- * then this property specifies a name for a group of radio buttons.
1749
- * @deprecated
1750
- */
1751
- set name(value) {
1752
- this._name = value;
1753
- this.changeDetector.markForCheck();
1754
- }
1755
- get name() {
1756
- return this._name;
1757
- }
1758
- /**
1759
- * This property is deprecated in favor of
1760
- * the `tabIndex` property on the `sky-radio-group` element. It specifies an index for the radio
1761
- * button. If the index is not defined, it is set to the position of the radio button on load.
1762
- * @deprecated
1763
- */
1764
- set tabindex(value) {
1765
- console.warn('The sky-radio `tabindex` property is deprecated. Please use the `tabindex` property on the sky-radio-group component.');
1766
- this._tabindex = value;
1767
- this.changeDetector.markForCheck();
1768
- }
1769
- get tabindex() {
1770
- return this._tabindex || 0;
1771
- }
1772
- // For setting the tabindex from the radio group
1773
- set groupTabIndex(value) {
1774
- this._tabindex = value;
1775
- this.changeDetector.markForCheck();
1776
- }
1777
- /**
1778
- * Specifies and binds a value to the radio button's `value` property. The value usually
1779
- * corresponds to the radio button's label, which you specify with the `sky-radio-label`
1780
- * component.
1781
- * @required
1782
- */
1783
- set value(value) {
1784
- /* istanbul ignore else */
1785
- if (this._value !== value) {
1786
- if (this.selectedValue && this.selectedValue === this._value) {
1787
- this.selectedValue = value;
1788
- this.onChangeCallback(this.selectedValue);
1789
- this.onTouchedCallback();
1790
- }
1791
- this._value = value;
1792
- }
1793
- this.changeDetector.markForCheck();
1794
- }
1795
- get value() {
1796
- return this._value;
1797
- }
1798
- /**
1799
- * Specifies a type to set the background color after users select an icon radio button.
1800
- * The valid options correspond
1801
- * [the label component's](https://developer.blackbaud.com/skyux/components/label)
1802
- * label types. `danger` creates a red background, `info` creates a blue background,
1803
- * `success` creates a green background, and `warning` creates an orange background.
1804
- * @default "info"
1805
- */
1806
- get radioType() {
1807
- return this._radioType || 'info';
1808
- }
1809
- set radioType(value) {
1810
- if (value) {
1811
- this._radioType = value.toLowerCase();
1812
- }
1813
- }
1814
- /**
1815
- * Fires when users select a radio button.
1816
- */
1817
- get change() {
1818
- return this._change;
1819
- }
1820
- /**
1821
- * Fires when the selected value changes.
1822
- */
1823
- get checkedChange() {
1824
- return this._checkedChange;
1825
- }
1826
- /**
1827
- * Fires when the selected value changes.
1828
- */
1829
- get disabledChange() {
1830
- return this._disabledChange;
1831
- }
1832
- get inputId() {
1833
- return `sky-radio-${this.id}-input`;
1834
- }
1835
- set selectedValue(value) {
1836
- if (value !== this._selectedValue) {
1837
- this._selectedValue = value;
1838
- }
1839
- }
1840
- get selectedValue() {
1841
- return this._selectedValue;
1842
- }
1843
- ngOnDestroy() {
1844
- this.removeUniqueSelectionListener();
1845
- }
1846
- writeValue(value) {
1847
- if (value === undefined) {
1848
- return;
1849
- }
1850
- this.selectedValue = value;
1851
- this.checked = this.value === this.selectedValue;
1852
- this.changeDetector.markForCheck();
1853
- }
1854
- /**
1855
- * @internal
1856
- * Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.
1857
- */
1858
- setDisabledState(isDisabled) {
1859
- this.disabled = isDisabled;
1860
- }
1861
- registerOnChange(fn) {
1862
- this.onChangeCallback = fn;
1863
- }
1864
- registerOnTouched(fn) {
1865
- this.onTouchedCallback = fn;
1866
- }
1867
- onInputChange(event) {
1868
- event.stopPropagation();
1869
- if (!this.disabled) {
1870
- this.checked = true;
1871
- this._change.emit({
1872
- source: this,
1873
- value: this._value,
1874
- });
1875
- this.onInputFocusChange(undefined);
1876
- this.onChangeCallback(this.value);
1877
- }
1878
- }
1879
- onInputFocusChange(event) {
1880
- this.onTouchedCallback();
1881
- this.blur.next();
1882
- }
1883
- }
1884
- SkyRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1885
- SkyRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRadioComponent, selector: "sky-radio", inputs: { checked: "checked", disabled: "disabled", id: "id", label: "label", labelledBy: "labelledBy", name: "name", tabindex: "tabindex", value: "value", icon: "icon", radioType: "radioType" }, outputs: { change: "change", checkedChange: "checkedChange", disabledChange: "disabledChange" }, providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<label\n class=\"sky-radio-wrapper sky-switch\"\n [ngClass]=\"{ 'sky-switch-disabled': disabled }\"\n>\n <input\n class=\"sky-radio-input sky-switch-input\"\n type=\"radio\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [id]=\"inputId\"\n [name]=\"name\"\n [tabIndex]=\"tabindex\"\n [value]=\"value\"\n (blur)=\"onInputFocusChange($event)\"\n (change)=\"onInputChange($event)\"\n />\n <span\n class=\"sky-switch-control\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-rounded-corners': icon,\n 'sky-rounded-circle': !icon,\n 'sky-switch-control-info': icon && radioType === 'info',\n 'sky-switch-control-success': icon && radioType === 'success',\n 'sky-switch-control-warning': icon && radioType === 'warning',\n 'sky-switch-control-danger': icon && radioType === 'danger'\n }\"\n >\n <sky-icon *ngIf=\"icon\" fixedWidth=\"true\" [icon]=\"icon\"> </sky-icon>\n </span>\n <ng-content select=\"sky-radio-label\"></ng-content>\n</label>\n", styles: [".sky-switch-control:not(.sky-switch-control-icon) sky-icon{font-size:70%}.sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{content:\"\";display:inline-block;width:10px;height:10px;background:#000000;border-radius:50%}:host-context(.sky-theme-modern) .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}:host-context(.sky-theme-modern) .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}.sky-theme-modern .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}.sky-theme-modern .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1886
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioComponent, decorators: [{
1887
- type: Component,
1888
- args: [{
1889
- selector: 'sky-radio',
1890
- templateUrl: './radio.component.html',
1891
- styleUrls: ['./radio.component.scss'],
1892
- providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR],
1893
- changeDetection: ChangeDetectionStrategy.OnPush,
1894
- }]
1895
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { checked: [{
1896
- type: Input
1897
- }], disabled: [{
1898
- type: Input
1899
- }], id: [{
1900
- type: Input
1901
- }], label: [{
1902
- type: Input
1903
- }], labelledBy: [{
1904
- type: Input
1905
- }], name: [{
1906
- type: Input
1907
- }], tabindex: [{
1908
- type: Input
1909
- }], value: [{
1910
- type: Input
1911
- }], icon: [{
1912
- type: Input
1913
- }], radioType: [{
1914
- type: Input
1915
- }], change: [{
1916
- type: Output
1917
- }], checkedChange: [{
1918
- type: Output
1919
- }], disabledChange: [{
1920
- type: Output
1921
- }] } });
1922
-
1923
- let nextUniqueId = 0;
1924
- /**
1925
- * Organizes radio buttons into a group. It is required for radio
1926
- * buttons on Angular reactive forms, and we recommend using it with all radio buttons.
1927
- * On Angular forms, the component manages the selected values and keeps the forms up-to-date.
1928
- * When users select a radio button, its value is driven through an `ngModel` attribute that you specify on the `sky-radio-group` element.
1929
- */
1930
- class SkyRadioGroupComponent {
1931
- constructor(changeDetector, ngControl) {
1932
- this.changeDetector = changeDetector;
1933
- this.ngControl = ngControl;
1934
- /**
1935
- * Indicates whether the input is required for form validation.
1936
- * When you set this property to `true`, the component adds `aria-required` and `required`
1937
- * attributes to the input element so that forms display an invalid state until the input element
1938
- * is complete.
1939
- * @default false
1940
- */
1941
- this.required = false;
1942
- this.ngUnsubscribe = new Subject();
1943
- this._disabled = false;
1944
- this._name = `sky-radio-group-${nextUniqueId++}`;
1945
- // eslint-disable-next-line @typescript-eslint/no-empty-function
1946
- this.onChange = () => { };
1947
- // eslint-disable-next-line @typescript-eslint/no-empty-function
1948
- this.onTouched = () => { };
1949
- if (this.ngControl) {
1950
- this.ngControl.valueAccessor = this;
1951
- }
1952
- }
1953
- /**
1954
- * Indicates whether to disable the input.
1955
- * @default false
1956
- */
1957
- set disabled(value) {
1958
- const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);
1959
- if (this._disabled !== newDisabledState) {
1960
- this._disabled = newDisabledState;
1961
- this.updateRadioButtonDisabled();
1962
- }
1963
- }
1964
- get disabled() {
1965
- return this._disabled;
1966
- }
1967
- /**
1968
- * Specifies a name for the collection of radio buttons that the component groups together.
1969
- * This property overwrites the deprecated `name` property on individual `sky-radio` elements,
1970
- * and it is required unless the `name` property is set on individual `sky-radio` elements.
1971
- * @required
1972
- */
1973
- set name(value) {
1974
- this._name = value;
1975
- this.updateRadioButtonNames();
1976
- }
1977
- get name() {
1978
- return this._name;
1979
- }
1980
- /**
1981
- * Specifies the value of the radio button to select by default when the group loads.
1982
- * The value corresponds to the `value` property of an individual `sky-radio` element within the
1983
- * group.
1984
- */
1985
- set value(value) {
1986
- const isNewValue = value !== this._value;
1987
- /* istanbul ignore else */
1988
- if (isNewValue) {
1989
- this._value = value;
1990
- this.onChange(this._value);
1991
- this.updateCheckedRadioFromValue();
1992
- }
1993
- }
1994
- get value() {
1995
- return this._value;
1996
- }
1997
- /**
1998
- * Specifies an index for all the radio buttons in the group. If the index is not defined,
1999
- * the indices for individual radio buttons are set to their positions on load.
2000
- * This property supports accessibility by placing focus on the currently selected radio
2001
- * button. If no radio button is selected, it places focus on the first or last button
2002
- * depending on how users navigate to the radio button group.
2003
- */
2004
- set tabIndex(value) {
2005
- if (this._tabIndex !== value) {
2006
- this._tabIndex = value;
2007
- this.updateRadioButtonTabIndexes();
2008
- }
2009
- }
2010
- get tabIndex() {
2011
- return this._tabIndex;
2012
- }
2013
- ngAfterContentInit() {
2014
- // Let child radio components render before updating.
2015
- setTimeout(() => {
2016
- this.resetRadioButtons();
2017
- });
2018
- // Watch for radio selections.
2019
- this.watchForSelections();
2020
- this.radios.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
2021
- // Wait for child radio components to finish any rendering updates.
2022
- setTimeout(() => {
2023
- this.resetRadioButtons();
2024
- });
2025
- // Subscribe to the new radio buttons
2026
- this.watchForSelections();
2027
- });
2028
- }
2029
- ngAfterViewInit() {
2030
- if (this.ngControl) {
2031
- // Backwards compatibility support for anyone still using Validators.Required.
2032
- this.required =
2033
- this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
2034
- // Avoid an ExpressionChangedAfterItHasBeenCheckedError.
2035
- this.changeDetector.detectChanges();
2036
- }
2037
- }
2038
- watchForSelections() {
2039
- this.radios.forEach((radio) => {
2040
- radio.change
2041
- .pipe(takeUntil(this.ngUnsubscribe))
2042
- .subscribe((change) => {
2043
- this.onTouched();
2044
- this.writeValue(change.value);
2045
- });
2046
- radio.blur.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
2047
- this.onTouched();
2048
- this.changeDetector.markForCheck();
2049
- });
2050
- });
2051
- }
2052
- ngOnDestroy() {
2053
- this.ngUnsubscribe.next();
2054
- this.ngUnsubscribe.complete();
2055
- }
2056
- writeValue(value) {
2057
- this.value = value;
2058
- }
2059
- /**
2060
- * @internal
2061
- * Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.
2062
- */
2063
- setDisabledState(isDisabled) {
2064
- this.disabled = isDisabled;
2065
- }
2066
- registerOnChange(fn) {
2067
- this.onChange = fn;
2068
- }
2069
- registerOnTouched(fn) {
2070
- this.onTouched = fn;
2071
- }
2072
- updateRadioButtonDisabled() {
2073
- if (this.radios) {
2074
- this.radios.forEach((radio) => {
2075
- radio.disabled = this.disabled;
2076
- });
2077
- }
2078
- }
2079
- updateRadioButtonNames() {
2080
- if (this.radios) {
2081
- this.radios.forEach((radio) => {
2082
- radio.name = this.name;
2083
- });
2084
- }
2085
- }
2086
- updateRadioButtonTabIndexes() {
2087
- if (this.radios) {
2088
- this.radios.forEach((radio) => {
2089
- radio.groupTabIndex = this.tabIndex;
2090
- });
2091
- }
2092
- }
2093
- updateCheckedRadioFromValue() {
2094
- if (!this.radios) {
2095
- return;
2096
- }
2097
- this.radios.forEach((radio) => {
2098
- radio.checked = this._value === radio.value;
2099
- });
2100
- }
2101
- resetRadioButtons() {
2102
- this.updateCheckedRadioFromValue();
2103
- this.updateRadioButtonNames();
2104
- this.updateRadioButtonTabIndexes();
2105
- }
2106
- }
2107
- SkyRadioGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioGroupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
2108
- SkyRadioGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRadioGroupComponent, selector: "sky-radio-group", inputs: { ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", disabled: "disabled", name: "name", required: "required", value: "value", tabIndex: "tabIndex" }, queries: [{ propertyName: "radios", predicate: SkyRadioComponent, descendants: true }], ngImport: i0, template: "<div\n class=\"sky-radio-group\"\n role=\"radiogroup\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.required]=\"required ? '' : null\"\n>\n <ng-content></ng-content>\n</div>\n" });
2109
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioGroupComponent, decorators: [{
2110
- type: Component,
2111
- args: [{
2112
- selector: 'sky-radio-group',
2113
- templateUrl: './radio-group.component.html',
2114
- }]
2115
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$1.NgControl, decorators: [{
2116
- type: Self
2117
- }, {
2118
- type: Optional
2119
- }] }]; }, propDecorators: { ariaLabelledBy: [{
2120
- type: Input
2121
- }], ariaLabel: [{
2122
- type: Input
2123
- }], disabled: [{
2124
- type: Input
2125
- }], name: [{
2126
- type: Input
2127
- }], required: [{
2128
- type: Input
2129
- }], value: [{
2130
- type: Input
2131
- }], tabIndex: [{
2132
- type: Input
2133
- }], radios: [{
2134
- type: ContentChildren,
2135
- args: [SkyRadioComponent, { descendants: true }]
2136
- }] } });
2137
-
2138
- /**
2139
- * Specifies a label for the radio button.
2140
- */
2141
- class SkyRadioLabelComponent {
2142
- // When clicking on a checkbox label, Angular registers two click events.
2143
- // This handler ignores all events except for those that deal
2144
- // with the checkbox input explicitly.
2145
- onClick(event) {
2146
- event.stopPropagation();
2147
- }
2148
- }
2149
- SkyRadioLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2150
- SkyRadioLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRadioLabelComponent, selector: "sky-radio-label", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0, template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" });
2151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioLabelComponent, decorators: [{
2152
- type: Component,
2153
- args: [{
2154
- selector: 'sky-radio-label',
2155
- templateUrl: './radio-label.component.html',
2156
- }]
2157
- }], propDecorators: { onClick: [{
2158
- type: HostListener,
2159
- args: ['click', ['$event']]
2160
- }] } });
2161
-
2162
- class SkyRadioModule {
2163
- }
2164
- SkyRadioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2165
- SkyRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioModule, declarations: [SkyRadioComponent,
2166
- SkyRadioGroupComponent,
2167
- SkyRadioLabelComponent], imports: [CommonModule, FormsModule, SkyIconModule], exports: [SkyRadioComponent, SkyRadioGroupComponent, SkyRadioLabelComponent] });
2168
- SkyRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioModule, imports: [[CommonModule, FormsModule, SkyIconModule]] });
2169
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioModule, decorators: [{
2170
- type: NgModule,
2171
- args: [{
2172
- declarations: [
2173
- SkyRadioComponent,
2174
- SkyRadioGroupComponent,
2175
- SkyRadioLabelComponent,
2176
- ],
2177
- imports: [CommonModule, FormsModule, SkyIconModule],
2178
- exports: [SkyRadioComponent, SkyRadioGroupComponent, SkyRadioLabelComponent],
2179
- }]
2180
- }] });
2181
-
2182
- const RESPONSIVE_CLASS_XS = 'sky-selection-box-container-xs';
2183
- const RESPONSIVE_CLASS_SM = 'sky-selection-box-container-sm';
2184
- const RESPONSIVE_CLASS_MD = 'sky-selection-box-container-md';
2185
- const RESPONSIVE_CLASS_LG = 'sky-selection-box-container-lg';
2186
- const BREAKPOINT_XS_MAX_PIXELS = 767;
2187
- const BREAKPOINT_SM_MIN_PIXELS = 768;
2188
- const BREAKPOINT_SM_MAX_PIXELS = 991;
2189
- const BREAKPOINT_MD_MIN_PIXELS = 992;
2190
- const BREAKPOINT_MD_MAX_PIXELS = 1439;
2191
- /**
2192
- * @internal
2193
- */
2194
- class SkySelectionBoxAdapterService {
2195
- constructor(coreAdapterService, rendererFactory) {
2196
- this.coreAdapterService = coreAdapterService;
2197
- this.renderer = rendererFactory.createRenderer(undefined, undefined);
2198
- }
2199
- /**
2200
- * Sets focus on the specified element.
2201
- */
2202
- focus(el) {
2203
- el.nativeElement.focus();
2204
- }
2205
- /**
2206
- * Returns a child element with the `.sky-switch` class.
2207
- * Useful for getting SKY UX-themed radio buttons or checkboxes.
2208
- */
2209
- getControl(el) {
2210
- return el.nativeElement.querySelector('.sky-switch');
2211
- }
2212
- /**
2213
- * Returns a breakpoint based on the width.
2214
- * @param width Width of the element in pixels.
2215
- */
2216
- getBreakpointForWidth(width) {
2217
- if (width <= BREAKPOINT_XS_MAX_PIXELS) {
2218
- return SkyMediaBreakpoints.xs;
2219
- }
2220
- else if (width >= BREAKPOINT_SM_MIN_PIXELS &&
2221
- width <= BREAKPOINT_SM_MAX_PIXELS) {
2222
- return SkyMediaBreakpoints.sm;
2223
- }
2224
- else if (width >= BREAKPOINT_MD_MIN_PIXELS &&
2225
- width <= BREAKPOINT_MD_MAX_PIXELS) {
2226
- return SkyMediaBreakpoints.md;
2227
- }
2228
- else {
2229
- return SkyMediaBreakpoints.lg;
2230
- }
2231
- }
2232
- /**
2233
- * Returns the width of the `parentNode` of the provided `element`.
2234
- */
2235
- getParentWidth(element) {
2236
- return element.nativeElement.parentNode.getBoundingClientRect().width;
2237
- }
2238
- /**
2239
- * Returns `true` if the `childEl` is a descendant of the `parentEl`.
2240
- */
2241
- isDescendant(parentEl, childEl) {
2242
- return parentEl.nativeElement.contains(childEl);
2243
- }
2244
- /**
2245
- * Sets the `tabIndex` of all focusable children of the `element` to the provided `tabIndex`.
2246
- */
2247
- setChildrenTabIndex(element, tabIndex) {
2248
- const el = element.nativeElement;
2249
- const focusableElems = this.coreAdapterService.getFocusableChildren(el, {
2250
- ignoreVisibility: true,
2251
- });
2252
- let index = focusableElems.length;
2253
- while (index--) {
2254
- focusableElems[index].tabIndex = tabIndex;
2255
- }
2256
- }
2257
- /**
2258
- * Adds a responsive CSS class on the provided element based on its current width.
2259
- */
2260
- setResponsiveClass(element, breakpoint) {
2261
- const nativeEl = element.nativeElement;
2262
- this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_XS);
2263
- this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_SM);
2264
- this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_MD);
2265
- this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_LG);
2266
- let newClass;
2267
- // tslint:disable-next-line: switch-default
2268
- switch (breakpoint) {
2269
- case SkyMediaBreakpoints.xs: {
2270
- newClass = RESPONSIVE_CLASS_XS;
2271
- break;
2272
- }
2273
- case SkyMediaBreakpoints.sm: {
2274
- newClass = RESPONSIVE_CLASS_SM;
2275
- break;
2276
- }
2277
- case SkyMediaBreakpoints.md: {
2278
- newClass = RESPONSIVE_CLASS_MD;
2279
- break;
2280
- }
2281
- case SkyMediaBreakpoints.lg: {
2282
- newClass = RESPONSIVE_CLASS_LG;
2283
- break;
2284
- }
2285
- }
2286
- this.renderer.addClass(nativeEl, newClass);
2287
- }
2288
- /**
2289
- * Sets the `tabIndex` of the `element` to the provided `tabIndex`.
2290
- */
2291
- setTabIndex(element, tabIndex) {
2292
- const el = element.nativeElement;
2293
- el.tabIndex = tabIndex;
2294
- }
2295
- }
2296
- SkySelectionBoxAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxAdapterService, deps: [{ token: i1$2.SkyCoreAdapterService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
2297
- SkySelectionBoxAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxAdapterService });
2298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxAdapterService, decorators: [{
2299
- type: Injectable
2300
- }], ctorParameters: function () { return [{ type: i1$2.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
2301
-
2302
- /**
2303
- * Specifies the description to display in a selection box.
2304
- */
2305
- class SkySelectionBoxDescriptionComponent {
2306
- }
2307
- SkySelectionBoxDescriptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxDescriptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2308
- SkySelectionBoxDescriptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySelectionBoxDescriptionComponent, selector: "sky-selection-box-description", ngImport: i0, template: "<ng-content></ng-content>\n" });
2309
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxDescriptionComponent, decorators: [{
2310
- type: Component,
2311
- args: [{
2312
- selector: 'sky-selection-box-description',
2313
- templateUrl: './selection-box-description.component.html',
2314
- }]
2315
- }] });
2316
-
2317
- /**
2318
- * Creates a button to present users with a choice or question before proceeding with a one-time process.
2319
- */
2320
- class SkySelectionBoxComponent {
2321
- constructor(changeDetector, selectionBoxAdapterService) {
2322
- this.changeDetector = changeDetector;
2323
- this.selectionBoxAdapterService = selectionBoxAdapterService;
2324
- this.ngUnsubscribe = new Subject();
2325
- }
2326
- set checked(value) {
2327
- this._checked = value;
2328
- this.changeDetector.markForCheck();
2329
- }
2330
- get checked() {
2331
- return this._checked;
2332
- }
2333
- set disabled(value) {
2334
- this.selectionBoxAdapterService.setTabIndex(this.selectionBoxEl, value ? -1 : 0);
2335
- this._disabled = value;
2336
- this.changeDetector.markForCheck();
2337
- }
2338
- get disabled() {
2339
- return this._disabled || false;
2340
- }
2341
- ngAfterViewInit() {
2342
- // Wait for consumer form controls to initialize before setting selected/disabled states.
2343
- setTimeout(() => {
2344
- this.selectionBoxAdapterService.setChildrenTabIndex(this.selectionBoxEl, -1);
2345
- this.updateCheckedOnControlChange();
2346
- this.updateDisabledState();
2347
- });
2348
- }
2349
- ngOnDestroy() {
2350
- this.ngUnsubscribe.next();
2351
- this.ngUnsubscribe.complete();
2352
- }
2353
- /**
2354
- * Since we are programatically firing a click on the control,
2355
- * make sure user is not clicking on the control before firing click logic.
2356
- */
2357
- onClick(event) {
2358
- const isControlClick = this.selectionBoxAdapterService.isDescendant(this.controlEl, event.target);
2359
- if (!isControlClick) {
2360
- this.selectControl();
2361
- }
2362
- }
2363
- onKeydown(event) {
2364
- /* istanbul ignore else */
2365
- if (event.key === ' ') {
2366
- this.selectControl();
2367
- event.preventDefault();
2368
- }
2369
- }
2370
- selectControl() {
2371
- this.selectionBoxAdapterService.getControl(this.controlEl).click();
2372
- this.selectionBoxAdapterService.focus(this.selectionBoxEl);
2373
- }
2374
- updateCheckedOnControlChange() {
2375
- this.control.checkedChange
2376
- .pipe(takeUntil(this.ngUnsubscribe))
2377
- .subscribe((value) => {
2378
- this.checked = value;
2379
- });
2380
- }
2381
- updateDisabledState() {
2382
- this.control.disabledChange
2383
- .pipe(takeUntil(this.ngUnsubscribe))
2384
- .subscribe((value) => {
2385
- this.disabled = value;
2386
- });
2387
- }
2388
- }
2389
- SkySelectionBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkySelectionBoxAdapterService }], target: i0.ɵɵFactoryTarget.Component });
2390
- SkySelectionBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySelectionBoxComponent, selector: "sky-selection-box", inputs: { control: "control" }, viewQueries: [{ propertyName: "controlEl", first: true, predicate: ["control"], descendants: true, read: ElementRef }, { propertyName: "selectionBoxEl", first: true, predicate: ["selectionBox"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"sky-selection-box sky-rounded-corners sky-btn sky-btn-default\"\n role=\"button\"\n tabindex=\"0\"\n [attr.disabled]=\"disabled ? true : null\"\n [ngClass]=\"{\n 'sky-selection-box-selected': checked,\n 'sky-selection-box-disabled': disabled\n }\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-box sky-elevation-1': 'modern'\n }\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n #selectionBox\n>\n <div\n class=\"sky-selection-box-icon\"\n [ngStyle]=\"{\n display: !icon.innerHTML.trim() ? 'none' : ''\n }\"\n #icon\n >\n <ng-content select=\"sky-icon\"> </ng-content>\n </div>\n\n <div class=\"sky-selection-box-content\">\n <div\n class=\"sky-selection-box-header\"\n [ngClass]=\"{\n 'sky-font-heading-2': icon.innerHTML.trim(),\n 'sky-font-heading-3': !icon.innerHTML.trim()\n }\"\n >\n <ng-content select=\"sky-selection-box-header\"></ng-content>\n </div>\n <div\n class=\"sky-selection-box-description\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n <ng-content select=\"sky-selection-box-description\"> </ng-content>\n </div>\n </div>\n\n <div class=\"sky-selection-box-control\" #control>\n <ng-content select=\"sky-radio\"> </ng-content>\n <ng-content select=\"sky-checkbox\"> </ng-content>\n </div>\n</div>\n", styles: [".sky-selection-box{display:flex;flex-flow:row nowrap;padding:15px;text-align:left}.sky-selection-box:hover{background:#ffffff;box-shadow:0 0 5px #0000004d,inset 0 0 0 1px #00b4f1}.sky-selection-box:hover .sky-switch-control{border:solid 1px #00b4f1}.sky-selection-box:focus .sky-switch-control{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}.sky-selection-box.sky-selection-box-selected{background:#f1eef6}.sky-selection-box.sky-selection-box-disabled{background:#eeeeef}.sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{color:#686c73}.sky-selection-box .sky-selection-box-icon{color:#0974a1;margin:0 10px 0 0;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-selection-box .sky-selection-box-icon .sky-icon{font-size:24px!important}.sky-selection-box .sky-selection-box-content{flex:1 1 auto;margin:0 10px 0 0;white-space:initial}.sky-selection-box .sky-selection-box-header{padding-top:3px}.sky-selection-box .sky-selection-box-control{flex:0 0 auto;padding-top:5px}:host-context(.sky-theme-modern) .sky-selection-box{padding:30px}:host-context(.sky-theme-modern) .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-selected,:host-context(.sky-theme-modern) .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-description{margin:3px 0 0}.sky-theme-modern .sky-selection-box{padding:30px}.sky-theme-modern .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}.sky-theme-modern .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}.sky-theme-modern .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-selection-box.sky-selection-box-selected,.sky-theme-modern .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}.sky-theme-modern .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}.sky-theme-modern .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-theme-modern .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}.sky-theme-modern .sky-selection-box .sky-selection-box-description{margin:3px 0 0}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxComponent, decorators: [{
2392
- type: Component,
2393
- args: [{
2394
- selector: 'sky-selection-box',
2395
- styleUrls: ['./selection-box.component.scss'],
2396
- templateUrl: './selection-box.component.html',
2397
- changeDetection: ChangeDetectionStrategy.OnPush,
2398
- encapsulation: ViewEncapsulation.None,
2399
- }]
2400
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkySelectionBoxAdapterService }]; }, propDecorators: { control: [{
2401
- type: Input
2402
- }], controlEl: [{
2403
- type: ViewChild,
2404
- args: ['control', {
2405
- read: ElementRef,
2406
- static: false,
2407
- }]
2408
- }], selectionBoxEl: [{
2409
- type: ViewChild,
2410
- args: ['selectionBox', {
2411
- read: ElementRef,
2412
- static: false,
2413
- }]
2414
- }] } });
2415
-
2416
- const SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';
2417
- /**
2418
- * Creates a grid layout for an array of selection boxes.
2419
- */
2420
- class SkySelectionBoxGridComponent {
2421
- constructor(coreAdapterService, selectionBoxAdapter, hostElRef, mutationObserverSvc, ngZone, themeSvc) {
2422
- this.coreAdapterService = coreAdapterService;
2423
- this.selectionBoxAdapter = selectionBoxAdapter;
2424
- this.hostElRef = hostElRef;
2425
- this.mutationObserverSvc = mutationObserverSvc;
2426
- this.ngZone = ngZone;
2427
- this.themeSvc = themeSvc;
2428
- this.ngUnsubscribe = new Subject();
2429
- }
2430
- /**
2431
- * @internal
2432
- * Specifies how to display the selection boxes in the grid.
2433
- * @default 'center'
2434
- */
2435
- set alignItems(value) {
2436
- this._alignItems = value;
2437
- }
2438
- get alignItems() {
2439
- return this._alignItems || 'center';
2440
- }
2441
- set currentBreakpoint(value) {
2442
- if (value !== this._currentBreakpoint) {
2443
- this._currentBreakpoint = value;
2444
- this.selectionBoxAdapter.setResponsiveClass(this.elementRef, value);
2445
- this.updateChildrenHeights();
2446
- }
2447
- }
2448
- ngOnInit() {
2449
- /* istanbul ignore else */
2450
- if (this.themeSvc) {
2451
- this.themeSvc.settingsChange
2452
- .pipe(takeUntil(this.ngUnsubscribe))
2453
- .subscribe(() => {
2454
- this.updateBreakpointClass();
2455
- this.updateChildrenHeights();
2456
- });
2457
- }
2458
- }
2459
- ngAfterViewInit() {
2460
- this.updateBreakpointClass();
2461
- this.updateChildrenHeights();
2462
- this.initMutationObserver();
2463
- }
2464
- ngOnDestroy() {
2465
- this.ngUnsubscribe.next();
2466
- this.ngUnsubscribe.complete();
2467
- this.destroyMutationObserver();
2468
- }
2469
- onWindowResize() {
2470
- this.updateBreakpointClass();
2471
- }
2472
- initMutationObserver() {
2473
- /* istanbul ignore else */
2474
- if (!this.mutationObserver) {
2475
- const el = this.elementRef.nativeElement;
2476
- // MutationObserver is patched by Zone.js and therefore becomes part of the
2477
- // Angular change detection cycle, but this can lead to infinite loops in some
2478
- // scenarios. This will keep MutationObserver from triggering change detection.
2479
- this.ngZone.runOutsideAngular(() => {
2480
- this.mutationObserver = this.mutationObserverSvc.create(() => {
2481
- this.updateChildrenHeights();
2482
- });
2483
- this.mutationObserver.observe(el, {
2484
- characterData: true,
2485
- subtree: true,
2486
- });
2487
- });
2488
- }
2489
- }
2490
- destroyMutationObserver() {
2491
- /* istanbul ignore else */
2492
- if (this.mutationObserver) {
2493
- this.mutationObserver.disconnect();
2494
- this.mutationObserver = undefined;
2495
- }
2496
- }
2497
- updateBreakpointClass() {
2498
- const parentWidth = this.selectionBoxAdapter.getParentWidth(this.hostElRef);
2499
- this.currentBreakpoint =
2500
- this.selectionBoxAdapter.getBreakpointForWidth(parentWidth);
2501
- }
2502
- updateChildrenHeights() {
2503
- this.coreAdapterService.resetHeight(this.elementRef, SKY_SELECTION_BOX_CLASS_NAME);
2504
- this.coreAdapterService.syncMaxHeight(this.elementRef, SKY_SELECTION_BOX_CLASS_NAME);
2505
- }
2506
- }
2507
- SkySelectionBoxGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxGridComponent, deps: [{ token: i1$2.SkyCoreAdapterService }, { token: SkySelectionBoxAdapterService }, { token: i0.ElementRef }, { token: i1$2.MutationObserverService }, { token: i0.NgZone }, { token: i3.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2508
- SkySelectionBoxGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySelectionBoxGridComponent, selector: "sky-selection-box-grid", inputs: { alignItems: "alignItems" }, host: { listeners: { "window:resize": "onWindowResize()" } }, queries: [{ propertyName: "selectionBoxes", predicate: SkySelectionBoxComponent, read: SkySelectionBoxComponent }], viewQueries: [{ propertyName: "elementRef", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n", styles: [":host{display:block}.sky-selection-box-grid{display:flex;flex-flow:row wrap;padding:0 7.5px;margin:0 auto}.sky-selection-box-grid.sky-selection-box-grid-align-center{justify-content:center}.sky-selection-box-grid.sky-selection-box-grid-align-left{justify-content:flex-start}.sky-selection-box-grid>sky-selection-box{margin:0 7.5px 15px;height:100%}.sky-selection-box-grid.sky-selection-box-container-xs{max-width:374px}.sky-selection-box-grid.sky-selection-box-container-xs>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-sm{max-width:733px}.sky-selection-box-grid.sky-selection-box-container-sm>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-md{max-width:937px}.sky-selection-box-grid.sky-selection-box-container-md>sky-selection-box{flex:0 1 446px}.sky-selection-box-grid.sky-selection-box-container-lg{max-width:1398px}.sky-selection-box-grid.sky-selection-box-container-lg>sky-selection-box{flex:0 1 446px}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2509
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxGridComponent, decorators: [{
2510
- type: Component,
2511
- args: [{
2512
- selector: 'sky-selection-box-grid',
2513
- templateUrl: './selection-box-grid.component.html',
2514
- styleUrls: ['./selection-box-grid.component.scss'],
2515
- changeDetection: ChangeDetectionStrategy.OnPush,
2516
- encapsulation: ViewEncapsulation.None,
2517
- }]
2518
- }], ctorParameters: function () { return [{ type: i1$2.SkyCoreAdapterService }, { type: SkySelectionBoxAdapterService }, { type: i0.ElementRef }, { type: i1$2.MutationObserverService }, { type: i0.NgZone }, { type: i3.SkyThemeService, decorators: [{
2519
- type: Optional
2520
- }] }]; }, propDecorators: { alignItems: [{
2521
- type: Input
2522
- }], selectionBoxes: [{
2523
- type: ContentChildren,
2524
- args: [SkySelectionBoxComponent, {
2525
- read: SkySelectionBoxComponent,
2526
- }]
2527
- }], elementRef: [{
2528
- type: ViewChild,
2529
- args: ['container', {
2530
- read: ElementRef,
2531
- static: true,
2532
- }]
2533
- }], onWindowResize: [{
2534
- type: HostListener,
2535
- args: ['window:resize']
2536
- }] } });
2537
-
2538
- /**
2539
- * Specifies the header to display in a selection box.
2540
- */
2541
- class SkySelectionBoxHeaderComponent {
2542
- }
2543
- SkySelectionBoxHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2544
- SkySelectionBoxHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySelectionBoxHeaderComponent, selector: "sky-selection-box-header", ngImport: i0, template: "<ng-content></ng-content>\n" });
2545
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxHeaderComponent, decorators: [{
2546
- type: Component,
2547
- args: [{
2548
- selector: 'sky-selection-box-header',
2549
- templateUrl: './selection-box-header.component.html',
2550
- }]
2551
- }] });
2552
-
2553
- class SkySelectionBoxModule {
2554
- }
2555
- SkySelectionBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2556
- SkySelectionBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxModule, declarations: [SkySelectionBoxGridComponent,
2557
- SkySelectionBoxComponent,
2558
- SkySelectionBoxDescriptionComponent,
2559
- SkySelectionBoxHeaderComponent], imports: [CommonModule, SkyThemeModule], exports: [SkySelectionBoxGridComponent,
2560
- SkySelectionBoxComponent,
2561
- SkySelectionBoxDescriptionComponent,
2562
- SkySelectionBoxHeaderComponent] });
2563
- SkySelectionBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxModule, providers: [SkySelectionBoxAdapterService], imports: [[CommonModule, SkyThemeModule]] });
2564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySelectionBoxModule, decorators: [{
2565
- type: NgModule,
2566
- args: [{
2567
- declarations: [
2568
- SkySelectionBoxGridComponent,
2569
- SkySelectionBoxComponent,
2570
- SkySelectionBoxDescriptionComponent,
2571
- SkySelectionBoxHeaderComponent,
2572
- ],
2573
- imports: [CommonModule, SkyThemeModule],
2574
- exports: [
2575
- SkySelectionBoxGridComponent,
2576
- SkySelectionBoxComponent,
2577
- SkySelectionBoxDescriptionComponent,
2578
- SkySelectionBoxHeaderComponent,
2579
- ],
2580
- providers: [SkySelectionBoxAdapterService],
2581
- }]
2582
- }] });
2583
-
2584
- /**
2585
- * Specifies the label to display beside the toggle switch.
2586
- */
2587
- class SkyToggleSwitchLabelComponent {
2588
- }
2589
- SkyToggleSwitchLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2590
- SkyToggleSwitchLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyToggleSwitchLabelComponent, selector: "sky-toggle-switch-label", ngImport: i0, template: "<ng-content></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
2591
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchLabelComponent, decorators: [{
2592
- type: Component,
2593
- args: [{
2594
- selector: 'sky-toggle-switch-label',
2595
- templateUrl: './toggle-switch-label.component.html',
2596
- changeDetection: ChangeDetectionStrategy.OnPush,
2597
- }]
2598
- }] });
2599
-
2600
- // tslint:disable:no-forward-ref no-use-before-declare
2601
- const SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR = {
2602
- provide: NG_VALUE_ACCESSOR,
2603
- useExisting: forwardRef(() => SkyToggleSwitchComponent),
2604
- multi: true,
2605
- };
2606
- const SKY_TOGGLE_SWITCH_VALIDATOR = {
2607
- provide: NG_VALIDATORS,
2608
- useExisting: forwardRef(() => SkyToggleSwitchComponent),
2609
- multi: true,
2610
- };
2611
- // tslint:enable
2612
- let uniqueId = 0;
2613
- class SkyToggleSwitchComponent {
2614
- constructor(changeDetector) {
2615
- this.changeDetector = changeDetector;
2616
- /**
2617
- * Indicates whether to disable the toggle switch.
2618
- */
2619
- this.disabled = false;
2620
- /**
2621
- * Specifies a tab index for the toggle switch. If not defined, the index is set to the position
2622
- * of the toggle switch on load.
2623
- */
2624
- this.tabIndex = 0;
2625
- /**
2626
- * Fires when the checked state of a toggle switch changes.
2627
- */
2628
- this.toggleChange = new EventEmitter();
2629
- this.enableIndicatorAnimation = false;
2630
- this.isFirstChange = true;
2631
- this.ngUnsubscribe = new Subject();
2632
- this.toggleSwitchId = uniqueId++;
2633
- this._checked = false;
2634
- // eslint-disable-next-line @typescript-eslint/no-empty-function
2635
- this.onTouched = () => { };
2636
- // eslint-disable-next-line @typescript-eslint/no-empty-function
2637
- this.onChange = () => { };
2638
- }
2639
- /**
2640
- * Indicates whether the toggle switch is selected.
2641
- * @default false
2642
- */
2643
- set checked(checked) {
2644
- if (checked !== this.checked) {
2645
- this._checked = checked;
2646
- this.onChange(checked);
2647
- // Do not mark the field as "dirty"
2648
- // if the field has been initialized with a value.
2649
- if (this.isFirstChange && this.control) {
2650
- this.control.markAsPristine();
2651
- this.isFirstChange = false;
2652
- }
2653
- }
2654
- }
2655
- get checked() {
2656
- return this._checked || false;
2657
- }
2658
- get hasLabelComponent() {
2659
- return this.labelComponents.length > 0;
2660
- }
2661
- get labelElementId() {
2662
- return `sky-toggle-switch-label-${this.toggleSwitchId}`;
2663
- }
2664
- ngAfterContentInit() {
2665
- this.labelComponents.changes
2666
- .pipe(takeUntil(this.ngUnsubscribe))
2667
- .subscribe(() => {
2668
- // Allow the template to reload any ARIA attributes that are relying on the
2669
- // label component existing in the DOM.
2670
- this.changeDetector.markForCheck();
2671
- });
2672
- // Wait for the view to render before applying animation effects.
2673
- // (Some browsers, such as Firefox, apply the animation too early.)
2674
- setTimeout(() => {
2675
- this.enableIndicatorAnimation = true;
2676
- });
2677
- }
2678
- ngOnDestroy() {
2679
- this.ngUnsubscribe.next();
2680
- this.ngUnsubscribe.complete();
2681
- }
2682
- writeValue(value) {
2683
- this.checked = !!value;
2684
- this.changeDetector.markForCheck();
2685
- }
2686
- validate(control) {
2687
- if (!this.control) {
2688
- this.control = control;
2689
- }
2690
- return;
2691
- }
2692
- registerOnChange(fn) {
2693
- this.onChange = fn;
2694
- }
2695
- registerOnTouched(fn) {
2696
- this.onTouched = fn;
2697
- }
2698
- setDisabledState(disabled) {
2699
- this.disabled = disabled;
2700
- this.changeDetector.markForCheck();
2701
- }
2702
- onButtonClick(event) {
2703
- event.stopPropagation();
2704
- this.toggleChecked();
2705
- this.emitChangeEvent();
2706
- }
2707
- onButtonBlur() {
2708
- this.onTouched();
2709
- }
2710
- emitChangeEvent() {
2711
- this.onChange(this._checked);
2712
- this.toggleChange.emit({
2713
- checked: this._checked,
2714
- });
2715
- }
2716
- toggleChecked() {
2717
- this.checked = !this.checked;
2718
- }
2719
- }
2720
- SkyToggleSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2721
- SkyToggleSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyToggleSwitchComponent, selector: "sky-toggle-switch", inputs: { ariaLabel: "ariaLabel", checked: "checked", disabled: "disabled", tabIndex: "tabIndex" }, outputs: { toggleChange: "toggleChange" }, providers: [
2722
- SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,
2723
- SKY_TOGGLE_SWITCH_VALIDATOR,
2724
- ], queries: [{ propertyName: "labelComponents", predicate: SkyToggleSwitchLabelComponent }], ngImport: i0, template: "<span class=\"sky-toggle-switch\">\n <button\n class=\"sky-toggle-switch-button\"\n role=\"switch\"\n type=\"button\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"hasLabelComponent ? labelElementId : null\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'sky-toggle-switch-checked': checked,\n 'sky-toggle-switch-disabled': disabled\n }\"\n [tabIndex]=\"tabIndex\"\n (blur)=\"onButtonBlur()\"\n (click)=\"onButtonClick($event)\"\n >\n <i\n aria-hidden=\"true\"\n class=\"sky-toggle-switch-indicator\"\n [ngClass]=\"{\n 'sky-toggle-switch-transition': enableIndicatorAnimation\n }\"\n role=\"presentation\"\n >&nbsp;</i\n >\n <!-- Non-breaking space needed to align switch to baseline! -->\n </button>\n\n <label\n *ngIf=\"hasLabelComponent\"\n class=\"sky-toggle-switch-label\"\n [attr.id]=\"labelElementId\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"> </ng-container>\n </label>\n</span>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-toggle-switch-label\"></ng-content>\n</ng-template>\n", styles: [".sky-toggle-switch{display:inline-flex;align-items:baseline}.sky-toggle-switch-button{border:1px solid #cdcfd2;background-color:#eeeeef;padding:1px;border-radius:24px;flex:1 0 46px;line-height:1.428571429}.sky-toggle-switch-button:hover:not(.sky-toggle-switch-disabled){border-color:#00b4f1;border-width:2px;padding:0;cursor:pointer}.sky-toggle-switch-button.sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#00b4f1;border-width:2px;padding:0}.sky-toggle-switch-button.sky-toggle-switch-checked .sky-toggle-switch-indicator{left:100%}.sky-toggle-switch-button.sky-toggle-switch-disabled{background-color:#cdcfd2;border-color:transparent}.sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#eeeeef}.sky-toggle-switch-button+.sky-toggle-switch-label{margin-left:10px;flex:1 0 auto}.sky-toggle-switch-indicator{height:22px;width:22px;display:block;position:relative;top:0;left:22px;margin-left:-22px;border-radius:100%;box-shadow:0 1px 2px #000000bf;background-color:#fff}.sky-toggle-switch-indicator.sky-toggle-switch-transition{transition:left .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled,:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}.sky-theme-modern .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled,.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}.sky-theme-modern .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-toggle-switch-button{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-toggle-switch-button{background-color:#121212}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2725
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchComponent, decorators: [{
2726
- type: Component,
2727
- args: [{
2728
- selector: 'sky-toggle-switch',
2729
- templateUrl: './toggle-switch.component.html',
2730
- styleUrls: ['./toggle-switch.component.scss'],
2731
- providers: [
2732
- SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,
2733
- SKY_TOGGLE_SWITCH_VALIDATOR,
2734
- ],
2735
- changeDetection: ChangeDetectionStrategy.OnPush,
2736
- }]
2737
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { ariaLabel: [{
2738
- type: Input
2739
- }], checked: [{
2740
- type: Input
2741
- }], disabled: [{
2742
- type: Input
2743
- }], tabIndex: [{
2744
- type: Input
2745
- }], toggleChange: [{
2746
- type: Output
2747
- }], labelComponents: [{
2748
- type: ContentChildren,
2749
- args: [SkyToggleSwitchLabelComponent]
2750
- }] } });
2751
-
2752
- class SkyToggleSwitchModule {
2753
- }
2754
- SkyToggleSwitchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2755
- SkyToggleSwitchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchModule, declarations: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent], imports: [CommonModule, FormsModule], exports: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent] });
2756
- SkyToggleSwitchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchModule, imports: [[CommonModule, FormsModule]] });
2757
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyToggleSwitchModule, decorators: [{
2758
- type: NgModule,
2759
- args: [{
2760
- declarations: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent],
2761
- imports: [CommonModule, FormsModule],
2762
- exports: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent],
2763
- }]
2764
- }] });
2765
-
2766
- /**
2767
- * Generated bundle index. Do not edit.
2768
- */
2769
-
2770
- export { SkyCharacterCounterModule, SkyCheckboxChange, SkyCheckboxModule, SkyFileAttachmentsModule, SkyFileSizePipe, SkyInputBoxHostService, SkyInputBoxModule, SkyRadioModule, SkySelectionBoxModule, SkyToggleSwitchModule, SkyCharacterCounterIndicatorComponent as λ1, SkyInputBoxComponent as λ10, SkyRadioGroupComponent as λ11, SkyRadioLabelComponent as λ12, SkyRadioComponent as λ13, SkySelectionBoxDescriptionComponent as λ14, SkySelectionBoxGridComponent as λ15, SkySelectionBoxHeaderComponent as λ16, SkySelectionBoxComponent as λ17, SkyToggleSwitchLabelComponent as λ18, SkyToggleSwitchComponent as λ19, SkyCharacterCounterInputDirective as λ2, SkyCheckboxComponent as λ3, SkyCheckboxLabelComponent as λ4, SkyCheckboxRequiredValidatorDirective as λ5, SkyFileAttachmentLabelComponent as λ6, SkyFileAttachmentComponent as λ7, SkyFileDropComponent as λ8, SkyFileItemComponent as λ9 };
2771
- //# sourceMappingURL=skyux-forms.js.map