carbon-components-angular 5.67.0 → 5.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/checkbox/checkbox-group-host.d.ts +31 -0
- package/checkbox/checkbox-group.component.d.ts +67 -0
- package/checkbox/checkbox.component.d.ts +56 -4
- package/checkbox/checkbox.module.d.ts +5 -3
- package/checkbox/index.d.ts +2 -0
- package/docs/documentation/components/AILabelComponent.html +1 -1
- package/docs/documentation/components/Accordion.html +1 -1
- package/docs/documentation/components/AccordionItem.html +1 -1
- package/docs/documentation/components/ActionableNotification.html +1 -1
- package/docs/documentation/components/AlertModal.html +1 -1
- package/docs/documentation/components/BaseIconButton.html +1 -1
- package/docs/documentation/components/BaseNotification.html +1 -1
- package/docs/documentation/components/BaseTabHeader.html +1 -1
- package/docs/documentation/components/Breadcrumb.html +1 -1
- package/docs/documentation/components/BreadcrumbItemComponent.html +1 -1
- package/docs/documentation/components/ButtonSet.html +1 -1
- package/docs/documentation/components/Checkbox.html +767 -58
- package/docs/documentation/components/CheckboxGroup.html +1401 -0
- package/docs/documentation/components/ClickableTile.html +1 -1
- package/docs/documentation/components/CodeSnippet.html +1 -1
- package/docs/documentation/components/ComboBox.html +1 -1
- package/docs/documentation/components/ComboButtonComponent.html +1 -1
- package/docs/documentation/components/ContainedList.html +1 -1
- package/docs/documentation/components/ContainedListItem.html +1 -1
- package/docs/documentation/components/ContentSwitcher.html +1 -1
- package/docs/documentation/components/ContextMenuComponent.html +1 -1
- package/docs/documentation/components/ContextMenuDividerComponent.html +1 -1
- package/docs/documentation/components/ContextMenuGroupComponent.html +1 -1
- package/docs/documentation/components/ContextMenuItemComponent.html +1 -1
- package/docs/documentation/components/DatePicker.html +1 -1
- package/docs/documentation/components/DatePickerInput.html +1 -1
- package/docs/documentation/components/Dialog.html +1 -1
- package/docs/documentation/components/Documentation.html +1 -1
- package/docs/documentation/components/Dropdown.html +1 -1
- package/docs/documentation/components/DropdownList.html +1 -1
- package/docs/documentation/components/ExpandableTile.html +1 -1
- package/docs/documentation/components/FileComponent.html +1 -1
- package/docs/documentation/components/FileUploader.html +1 -1
- package/docs/documentation/components/Hamburger.html +1 -1
- package/docs/documentation/components/Header.html +1 -1
- package/docs/documentation/components/HeaderAction.html +1 -1
- package/docs/documentation/components/HeaderGlobal.html +1 -1
- package/docs/documentation/components/HeaderItem.html +1 -1
- package/docs/documentation/components/HeaderMenu.html +1 -1
- package/docs/documentation/components/HeaderNavigation.html +1 -1
- package/docs/documentation/components/IconButton.html +1 -1
- package/docs/documentation/components/InlineLoading.html +1 -1
- package/docs/documentation/components/Label.html +1 -1
- package/docs/documentation/components/ListColumn.html +1 -1
- package/docs/documentation/components/ListHeader.html +1 -1
- package/docs/documentation/components/ListRow.html +1 -1
- package/docs/documentation/components/Loading.html +1 -1
- package/docs/documentation/components/MenuButtonComponent.html +1 -1
- package/docs/documentation/components/Modal.html +1 -1
- package/docs/documentation/components/ModalFooter.html +1 -1
- package/docs/documentation/components/ModalHeader.html +1 -1
- package/docs/documentation/components/Notification.html +1 -1
- package/docs/documentation/components/NumberComponent.html +1 -1
- package/docs/documentation/components/OverflowMenu.html +1 -1
- package/docs/documentation/components/OverflowMenuCustomPane.html +1 -1
- package/docs/documentation/components/OverflowMenuOption.html +1 -1
- package/docs/documentation/components/OverflowMenuPane.html +1 -1
- package/docs/documentation/components/Overlay.html +1 -1
- package/docs/documentation/components/Pagination.html +1 -1
- package/docs/documentation/components/PaginationNav.html +1 -1
- package/docs/documentation/components/PaginationNavItem.html +1 -1
- package/docs/documentation/components/PaginationOverflow.html +1 -1
- package/docs/documentation/components/Panel.html +1 -1
- package/docs/documentation/components/PasswordInputLabelComponent.html +1 -1
- package/docs/documentation/components/Placeholder.html +1 -1
- package/docs/documentation/components/PopoverContent.html +1 -1
- package/docs/documentation/components/ProgressBar.html +1 -1
- package/docs/documentation/components/ProgressIndicator.html +1 -1
- package/docs/documentation/components/Radio.html +1 -1
- package/docs/documentation/components/RadioGroup.html +1 -1
- package/docs/documentation/components/Search.html +1 -1
- package/docs/documentation/components/Select.html +1 -1
- package/docs/documentation/components/SelectionTile.html +1 -1
- package/docs/documentation/components/SideNav.html +1 -1
- package/docs/documentation/components/SideNavItem.html +1 -1
- package/docs/documentation/components/SideNavMenu.html +1 -1
- package/docs/documentation/components/SkeletonPlaceholder.html +1 -1
- package/docs/documentation/components/SkeletonText.html +1 -1
- package/docs/documentation/components/Slider.html +1 -1
- package/docs/documentation/components/StructuredList.html +1 -1
- package/docs/documentation/components/SwitcherList.html +1 -1
- package/docs/documentation/components/SwitcherListItem.html +1 -1
- package/docs/documentation/components/Tab.html +1 -1
- package/docs/documentation/components/TabHeaderGroup.html +1 -1
- package/docs/documentation/components/TabHeaders.html +1 -1
- package/docs/documentation/components/TabSkeleton.html +1 -1
- package/docs/documentation/components/Table.html +1 -1
- package/docs/documentation/components/TableBody.html +1 -1
- package/docs/documentation/components/TableCheckbox.html +1 -1
- package/docs/documentation/components/TableContainer.html +1 -1
- package/docs/documentation/components/TableData.html +1 -1
- package/docs/documentation/components/TableExpandButton.html +1 -1
- package/docs/documentation/components/TableExpandedRow.html +1 -1
- package/docs/documentation/components/TableHead.html +1 -1
- package/docs/documentation/components/TableHeadCell.html +1 -1
- package/docs/documentation/components/TableHeadCheckbox.html +1 -1
- package/docs/documentation/components/TableHeadExpand.html +1 -1
- package/docs/documentation/components/TableHeader.html +1 -1
- package/docs/documentation/components/TableHeaderDecorator.html +1 -1
- package/docs/documentation/components/TableRadio.html +1 -1
- package/docs/documentation/components/TableRowComponent.html +1 -1
- package/docs/documentation/components/TableToolbar.html +1 -1
- package/docs/documentation/components/TableToolbarActions.html +1 -1
- package/docs/documentation/components/TableToolbarContent.html +1 -1
- package/docs/documentation/components/TableToolbarSearch.html +1 -1
- package/docs/documentation/components/Tabs.html +1 -1
- package/docs/documentation/components/Tag.html +1 -1
- package/docs/documentation/components/TagFilter.html +1 -1
- package/docs/documentation/components/TagOperationalComponent.html +1 -1
- package/docs/documentation/components/TagSelectableComponent.html +1 -1
- package/docs/documentation/components/TextInputLabelComponent.html +1 -1
- package/docs/documentation/components/TextareaLabelComponent.html +1 -1
- package/docs/documentation/components/Tile.html +1 -1
- package/docs/documentation/components/TileGroup.html +1 -1
- package/docs/documentation/components/TimePicker.html +1 -1
- package/docs/documentation/components/TimePickerSelect.html +1 -1
- package/docs/documentation/components/Toast.html +1 -1
- package/docs/documentation/components/Toggle.html +526 -66
- package/docs/documentation/components/Toggletip.html +1 -1
- package/docs/documentation/components/Tooltip.html +1 -1
- package/docs/documentation/components/TooltipDefinition.html +1 -1
- package/docs/documentation/components/TreeNodeComponent.html +1 -1
- package/docs/documentation/components/TreeViewComponent.html +1 -1
- package/docs/documentation/coverage.html +42 -6
- package/docs/documentation/graph/dependencies.svg +3103 -3057
- package/docs/documentation/interfaces/CheckboxGroupHost.html +417 -0
- package/docs/documentation/js/menu-wc.js +9 -3
- package/docs/documentation/js/menu-wc_es5.js +1 -1
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/miscellaneous/variables.html +26 -0
- package/docs/documentation/modules/CheckboxModule/dependencies.svg +92 -36
- package/docs/documentation/modules/CheckboxModule.html +116 -39
- package/docs/documentation/modules/CodeSnippetModule/dependencies.svg +4 -4
- package/docs/documentation/modules/CodeSnippetModule.html +4 -4
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboBoxModule.html +4 -4
- package/docs/documentation/modules/ComboButtonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboButtonModule.html +4 -4
- package/docs/documentation/modules/ContextMenuModule/dependencies.svg +52 -52
- package/docs/documentation/modules/ContextMenuModule.html +52 -52
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +42 -46
- package/docs/documentation/modules/DatePickerInputModule.html +42 -46
- package/docs/documentation/modules/DatePickerModule/dependencies.svg +54 -58
- package/docs/documentation/modules/DatePickerModule.html +54 -58
- package/docs/documentation/modules/DialogModule/dependencies.svg +34 -34
- package/docs/documentation/modules/DialogModule.html +34 -34
- package/docs/documentation/modules/DropdownModule/dependencies.svg +70 -70
- package/docs/documentation/modules/DropdownModule.html +70 -70
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +62 -62
- package/docs/documentation/modules/FileUploaderModule.html +62 -62
- package/docs/documentation/modules/GridModule/dependencies.svg +7 -7
- package/docs/documentation/modules/GridModule.html +7 -7
- package/docs/documentation/modules/I18nModule/dependencies.svg +4 -4
- package/docs/documentation/modules/I18nModule.html +4 -4
- package/docs/documentation/modules/IconModule/dependencies.svg +4 -4
- package/docs/documentation/modules/IconModule.html +4 -4
- package/docs/documentation/modules/InlineLoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/InlineLoadingModule.html +4 -4
- package/docs/documentation/modules/InputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/InputModule.html +4 -4
- package/docs/documentation/modules/LayerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayerModule.html +4 -4
- package/docs/documentation/modules/LayoutModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayoutModule.html +4 -4
- package/docs/documentation/modules/LoadingModule/dependencies.svg +13 -13
- package/docs/documentation/modules/LoadingModule.html +13 -13
- package/docs/documentation/modules/MenuButtonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/MenuButtonModule.html +4 -4
- package/docs/documentation/modules/ModalModule/dependencies.svg +115 -115
- package/docs/documentation/modules/ModalModule.html +115 -115
- package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NFormsModule.html +4 -4
- package/docs/documentation/modules/NotificationModule/dependencies.svg +37 -37
- package/docs/documentation/modules/NotificationModule.html +37 -37
- package/docs/documentation/modules/NumberModule/dependencies.svg +24 -24
- package/docs/documentation/modules/NumberModule.html +24 -24
- package/docs/documentation/modules/PaginationModule/dependencies.svg +56 -56
- package/docs/documentation/modules/PaginationModule.html +56 -56
- package/docs/documentation/modules/PanelModule/dependencies.svg +36 -36
- package/docs/documentation/modules/PanelModule.html +36 -36
- package/docs/documentation/modules/PopoverModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PopoverModule.html +4 -4
- package/docs/documentation/modules/ProgressBarModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressBarModule.html +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +58 -62
- package/docs/documentation/modules/RadioModule.html +58 -62
- package/docs/documentation/modules/SearchModule/dependencies.svg +30 -30
- package/docs/documentation/modules/SearchModule.html +30 -30
- package/docs/documentation/modules/SelectModule/dependencies.svg +61 -61
- package/docs/documentation/modules/SelectModule.html +61 -61
- package/docs/documentation/modules/SideNavModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SideNavModule.html +4 -4
- package/docs/documentation/modules/SkeletonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SkeletonModule.html +4 -4
- package/docs/documentation/modules/SliderModule/dependencies.svg +42 -46
- package/docs/documentation/modules/SliderModule.html +42 -46
- package/docs/documentation/modules/StructuredListModule/dependencies.svg +4 -4
- package/docs/documentation/modules/StructuredListModule.html +4 -4
- package/docs/documentation/modules/TableModule/dependencies.svg +224 -224
- package/docs/documentation/modules/TableModule.html +224 -224
- package/docs/documentation/modules/TabsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TabsModule.html +4 -4
- package/docs/documentation/modules/TagModule/dependencies.svg +37 -37
- package/docs/documentation/modules/TagModule.html +37 -37
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TilesModule.html +4 -4
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TimePickerSelectModule.html +4 -4
- package/docs/documentation/modules/ToggleModule/dependencies.svg +7 -7
- package/docs/documentation/modules/ToggleModule.html +7 -7
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggletipModule.html +4 -4
- package/docs/documentation/modules/TooltipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TooltipModule.html +4 -4
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +35 -35
- package/docs/documentation/modules/TreeviewModule.html +35 -35
- package/docs/documentation/overview.html +3105 -3059
- package/docs/documentation.json +1002 -127
- package/docs/storybook/9300.537382cc.iframe.bundle.js +1 -0
- package/docs/storybook/955.99b6ac85.iframe.bundle.js +1 -0
- package/docs/storybook/checkbox-checkbox-stories.a40b7a36.iframe.bundle.js +1 -0
- package/docs/storybook/dialog-overflow-menu-overflow-menu-stories.d99d789a.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/index.json +1 -1
- package/docs/storybook/main.4ba3ac58.iframe.bundle.js +1 -0
- package/docs/storybook/modal-modal-stories.02e35bd4.iframe.bundle.js +1 -0
- package/docs/storybook/pagination-pagination-nav-stories.647ce4df.iframe.bundle.js +1 -0
- package/docs/storybook/pagination-pagination-stories.aa18b936.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.018cbdfe.iframe.bundle.js → runtime~main.229d454b.iframe.bundle.js} +1 -1
- package/docs/storybook/stories.json +1 -1
- package/docs/storybook/toggle-toggle-stories.999199e8.iframe.bundle.js +1 -0
- package/esm2020/checkbox/checkbox-group-host.mjs +3 -0
- package/esm2020/checkbox/checkbox-group.component.mjs +201 -0
- package/esm2020/checkbox/checkbox.component.mjs +169 -9
- package/esm2020/checkbox/checkbox.module.mjs +16 -7
- package/esm2020/checkbox/index.mjs +3 -1
- package/esm2020/table/cell/table-checkbox.component.mjs +1 -1
- package/esm2020/table/head/table-head-checkbox.component.mjs +1 -1
- package/esm2020/toggle/toggle.component.mjs +12 -7
- package/fesm2015/carbon-components-angular-checkbox.mjs +385 -15
- package/fesm2015/carbon-components-angular-checkbox.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-table.mjs +2 -2
- package/fesm2015/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-toggle.mjs +13 -6
- package/fesm2015/carbon-components-angular-toggle.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-checkbox.mjs +379 -15
- package/fesm2020/carbon-components-angular-checkbox.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-table.mjs +2 -2
- package/fesm2020/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-toggle.mjs +11 -6
- package/fesm2020/carbon-components-angular-toggle.mjs.map +1 -1
- package/package.json +1 -1
- package/toggle/toggle.component.d.ts +3 -3
- package/docs/storybook/1895.d3fd5755.iframe.bundle.js +0 -1
- package/docs/storybook/955.754a7cf6.iframe.bundle.js +0 -1
- package/docs/storybook/checkbox-checkbox-stories.3aeae19d.iframe.bundle.js +0 -1
- package/docs/storybook/dialog-overflow-menu-overflow-menu-stories.aa916da9.iframe.bundle.js +0 -1
- package/docs/storybook/main.544b1246.iframe.bundle.js +0 -1
- package/docs/storybook/modal-modal-stories.22f92029.iframe.bundle.js +0 -1
- package/docs/storybook/pagination-pagination-nav-stories.9f6e65be.iframe.bundle.js +0 -1
- package/docs/storybook/pagination-pagination-stories.540698c1.iframe.bundle.js +0 -1
- package/docs/storybook/toggle-toggle-stories.7832edbb.iframe.bundle.js +0 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, EventEmitter, TemplateRef, Component, ChangeDetectionStrategy, Optional, Inject, Input, Output, ViewChild, HostListener, HostBinding, ContentChildren, forwardRef, NgModule } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
6
|
+
import * as i2 from 'carbon-components-angular/icon';
|
|
7
|
+
import { IconModule } from 'carbon-components-angular/icon';
|
|
8
|
+
|
|
9
|
+
const CHECKBOX_GROUP_HOST = new InjectionToken("CheckboxGroupHost");
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Defines the set of states for a checkbox component.
|
|
@@ -27,8 +31,9 @@ class Checkbox {
|
|
|
27
31
|
/**
|
|
28
32
|
* Creates an instance of `Checkbox`.
|
|
29
33
|
*/
|
|
30
|
-
constructor(changeDetectorRef) {
|
|
34
|
+
constructor(changeDetectorRef, hostGroup) {
|
|
31
35
|
this.changeDetectorRef = changeDetectorRef;
|
|
36
|
+
this.hostGroup = hostGroup;
|
|
32
37
|
/**
|
|
33
38
|
* Set to `true` for a disabled checkbox.
|
|
34
39
|
*/
|
|
@@ -45,6 +50,10 @@ class Checkbox {
|
|
|
45
50
|
* The unique id for the checkbox component.
|
|
46
51
|
*/
|
|
47
52
|
this.id = `checkbox-${Checkbox.checkboxCount}`;
|
|
53
|
+
/**
|
|
54
|
+
* Optional title for the `<label>` element.
|
|
55
|
+
*/
|
|
56
|
+
this.title = "";
|
|
48
57
|
/**
|
|
49
58
|
* Emits click event.
|
|
50
59
|
*/
|
|
@@ -72,6 +81,7 @@ class Checkbox {
|
|
|
72
81
|
* Keeps a reference to the checkboxes current state, as defined in `CheckboxState`.
|
|
73
82
|
*/
|
|
74
83
|
this.currentCheckboxState = CheckboxState.Init;
|
|
84
|
+
this.helperId = `checkbox-helper-${Checkbox.helperIdCounter++}`;
|
|
75
85
|
/**
|
|
76
86
|
* Called when checkbox is blurred. Needed to properly implement `ControlValueAccessor`.
|
|
77
87
|
*/
|
|
@@ -124,10 +134,31 @@ class Checkbox {
|
|
|
124
134
|
get checked() {
|
|
125
135
|
return this._checked;
|
|
126
136
|
}
|
|
137
|
+
get effectiveReadOnly() {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
const own = this.readOnly;
|
|
140
|
+
const group = (_b = (_a = this.hostGroup) === null || _a === void 0 ? void 0 : _a.readOnly) !== null && _b !== void 0 ? _b : false;
|
|
141
|
+
return !!(own !== undefined ? own : group);
|
|
142
|
+
}
|
|
143
|
+
get effectiveInvalid() {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
const own = this.invalid;
|
|
146
|
+
const group = (_b = (_a = this.hostGroup) === null || _a === void 0 ? void 0 : _a.invalid) !== null && _b !== void 0 ? _b : false;
|
|
147
|
+
return !!(own !== undefined ? own : group);
|
|
148
|
+
}
|
|
149
|
+
get effectiveWarn() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
const own = this.warn;
|
|
152
|
+
const group = (_b = (_a = this.hostGroup) === null || _a === void 0 ? void 0 : _a.warn) !== null && _b !== void 0 ? _b : false;
|
|
153
|
+
return !!(own !== undefined ? own : group);
|
|
154
|
+
}
|
|
127
155
|
/**
|
|
128
156
|
* Toggle the selected state of the checkbox.
|
|
129
157
|
*/
|
|
130
158
|
toggle() {
|
|
159
|
+
if (this.effectiveReadOnly) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
131
162
|
// Flip checked and reset indeterminate
|
|
132
163
|
this.setChecked(!this.checked, true);
|
|
133
164
|
}
|
|
@@ -166,6 +197,13 @@ class Checkbox {
|
|
|
166
197
|
this.disabled = isDisabled;
|
|
167
198
|
this.changeDetectorRef.markForCheck();
|
|
168
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Invoked by `CheckboxGroup` when group `readOnly`, `invalid`, `warn` change so `OnPush`
|
|
202
|
+
* checkboxes still refresh inherited state from `CHECKBOX_GROUP_HOST`.
|
|
203
|
+
*/
|
|
204
|
+
markForCheckFromGroup() {
|
|
205
|
+
this.changeDetectorRef.markForCheck();
|
|
206
|
+
}
|
|
169
207
|
focusOut() {
|
|
170
208
|
this.onTouched();
|
|
171
209
|
}
|
|
@@ -179,6 +217,13 @@ class Checkbox {
|
|
|
179
217
|
* Handles click events on the `Checkbox` and emits changes to other classes.
|
|
180
218
|
*/
|
|
181
219
|
onClick(event) {
|
|
220
|
+
if (this.effectiveReadOnly) {
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
if (this.click.observers.length) {
|
|
223
|
+
this.click.emit();
|
|
224
|
+
}
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
182
227
|
if (this.click.observers.length) {
|
|
183
228
|
// Disable default checkbox activation behavior which flips checked and resets indeterminate.
|
|
184
229
|
// This allows the parent component to control the checked/indeterminate properties.
|
|
@@ -213,6 +258,12 @@ class Checkbox {
|
|
|
213
258
|
this.inputCheckbox.nativeElement.indeterminate = true;
|
|
214
259
|
}
|
|
215
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Returns `true` when the provided value is a `TemplateRef`.
|
|
263
|
+
*/
|
|
264
|
+
isTemplate(value) {
|
|
265
|
+
return value instanceof TemplateRef;
|
|
266
|
+
}
|
|
216
267
|
/**
|
|
217
268
|
* Sets checked state and optionally resets indeterminate state.
|
|
218
269
|
*/
|
|
@@ -235,15 +286,22 @@ class Checkbox {
|
|
|
235
286
|
* Variable used for creating unique ids for checkbox components.
|
|
236
287
|
*/
|
|
237
288
|
Checkbox.checkboxCount = 0;
|
|
238
|
-
Checkbox
|
|
239
|
-
Checkbox.ɵ
|
|
289
|
+
Checkbox.helperIdCounter = 0;
|
|
290
|
+
Checkbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: Checkbox, deps: [{ token: i0.ChangeDetectorRef }, { token: CHECKBOX_GROUP_HOST, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
291
|
+
Checkbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: Checkbox, selector: "cds-checkbox, ibm-checkbox", inputs: { disabled: "disabled", skeleton: "skeleton", hideLabel: "hideLabel", name: "name", id: "id", required: "required", value: "value", ariaLabel: "ariaLabel", ariaLabelledby: "ariaLabelledby", title: "title", helperText: "helperText", invalid: "invalid", invalidText: "invalidText", warn: "warn", warnText: "warnText", readOnly: "readOnly", decorator: "decorator", indeterminate: "indeterminate", checked: "checked" }, outputs: { click: "click", checkedChange: "checkedChange", indeterminateChange: "indeterminateChange" }, host: { listeners: { "focusout": "focusOut()" } }, providers: [
|
|
240
292
|
{
|
|
241
293
|
provide: NG_VALUE_ACCESSOR,
|
|
242
294
|
useExisting: Checkbox,
|
|
243
295
|
multi: true
|
|
244
296
|
}
|
|
245
297
|
], viewQueries: [{ propertyName: "inputCheckbox", first: true, predicate: ["inputCheckbox"], descendants: true }], ngImport: i0, template: `
|
|
246
|
-
<div class="cds--form-item cds--checkbox-wrapper"
|
|
298
|
+
<div class="cds--form-item cds--checkbox-wrapper"
|
|
299
|
+
[ngClass]="{
|
|
300
|
+
'cds--checkbox-wrapper--invalid': !effectiveReadOnly && effectiveInvalid,
|
|
301
|
+
'cds--checkbox-wrapper--warning': !effectiveReadOnly && !effectiveInvalid && effectiveWarn,
|
|
302
|
+
'cds--checkbox-wrapper--readonly': effectiveReadOnly,
|
|
303
|
+
'cds--checkbox-wrapper--decorator': !!decorator
|
|
304
|
+
}">
|
|
247
305
|
<input
|
|
248
306
|
#inputCheckbox
|
|
249
307
|
class="cds--checkbox"
|
|
@@ -254,28 +312,74 @@ Checkbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.
|
|
|
254
312
|
[required]="required"
|
|
255
313
|
[checked]="checked"
|
|
256
314
|
[disabled]="disabled"
|
|
315
|
+
[attr.data-invalid]="(!effectiveReadOnly && effectiveInvalid) ? true : null"
|
|
316
|
+
[attr.aria-readonly]="effectiveReadOnly ? true : null"
|
|
257
317
|
[attr.aria-labelledby]="ariaLabelledby"
|
|
318
|
+
[attr.aria-describedby]="(helperText && !effectiveInvalid && !effectiveWarn) ? helperId : null"
|
|
258
319
|
(change)="onChange($event)"
|
|
259
320
|
(click)="onClick($event)">
|
|
260
321
|
<label
|
|
261
322
|
[for]="id + '_input'"
|
|
262
323
|
[attr.aria-label]="ariaLabel"
|
|
324
|
+
[attr.title]="title || null"
|
|
263
325
|
class="cds--checkbox-label"
|
|
264
326
|
[ngClass]="{
|
|
265
327
|
'cds--skeleton' : skeleton
|
|
266
328
|
}">
|
|
267
329
|
<span [ngClass]="{'cds--visually-hidden' : hideLabel}" class="cds--checkbox-label-text">
|
|
268
330
|
<ng-content></ng-content>
|
|
331
|
+
<ng-container *ngIf="decorator">
|
|
332
|
+
<div class="cds--checkbox-wrapper-inner--decorator">
|
|
333
|
+
<ng-template [ngTemplateOutlet]="decorator"></ng-template>
|
|
334
|
+
</div>
|
|
335
|
+
</ng-container>
|
|
269
336
|
</span>
|
|
270
337
|
</label>
|
|
338
|
+
<div class="cds--checkbox__validation-msg">
|
|
339
|
+
<ng-container *ngIf="!effectiveReadOnly && effectiveInvalid">
|
|
340
|
+
<svg
|
|
341
|
+
cdsIcon="warning--filled"
|
|
342
|
+
size="16"
|
|
343
|
+
class="cds--checkbox__invalid-icon">
|
|
344
|
+
</svg>
|
|
345
|
+
<div class="cds--form-requirement">
|
|
346
|
+
<ng-container *ngIf="!isTemplate(invalidText)">{{invalidText}}</ng-container>
|
|
347
|
+
<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="$any(invalidText)"></ng-template>
|
|
348
|
+
</div>
|
|
349
|
+
</ng-container>
|
|
350
|
+
<ng-container *ngIf="!effectiveReadOnly && !effectiveInvalid && effectiveWarn">
|
|
351
|
+
<svg
|
|
352
|
+
cdsIcon="warning--alt--filled"
|
|
353
|
+
size="16"
|
|
354
|
+
class="cds--checkbox__invalid-icon cds--checkbox__invalid-icon--warning">
|
|
355
|
+
</svg>
|
|
356
|
+
<div class="cds--form-requirement">
|
|
357
|
+
<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>
|
|
358
|
+
<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="$any(warnText)"></ng-template>
|
|
359
|
+
</div>
|
|
360
|
+
</ng-container>
|
|
361
|
+
</div>
|
|
362
|
+
<div
|
|
363
|
+
*ngIf="helperText && !effectiveInvalid && !effectiveWarn"
|
|
364
|
+
class="cds--form__helper-text"
|
|
365
|
+
[id]="helperId">
|
|
366
|
+
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
|
|
367
|
+
<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="$any(helperText)"></ng-template>
|
|
368
|
+
</div>
|
|
271
369
|
</div>
|
|
272
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
370
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
273
371
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: Checkbox, decorators: [{
|
|
274
372
|
type: Component,
|
|
275
373
|
args: [{
|
|
276
374
|
selector: "cds-checkbox, ibm-checkbox",
|
|
277
375
|
template: `
|
|
278
|
-
<div class="cds--form-item cds--checkbox-wrapper"
|
|
376
|
+
<div class="cds--form-item cds--checkbox-wrapper"
|
|
377
|
+
[ngClass]="{
|
|
378
|
+
'cds--checkbox-wrapper--invalid': !effectiveReadOnly && effectiveInvalid,
|
|
379
|
+
'cds--checkbox-wrapper--warning': !effectiveReadOnly && !effectiveInvalid && effectiveWarn,
|
|
380
|
+
'cds--checkbox-wrapper--readonly': effectiveReadOnly,
|
|
381
|
+
'cds--checkbox-wrapper--decorator': !!decorator
|
|
382
|
+
}">
|
|
279
383
|
<input
|
|
280
384
|
#inputCheckbox
|
|
281
385
|
class="cds--checkbox"
|
|
@@ -286,20 +390,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
286
390
|
[required]="required"
|
|
287
391
|
[checked]="checked"
|
|
288
392
|
[disabled]="disabled"
|
|
393
|
+
[attr.data-invalid]="(!effectiveReadOnly && effectiveInvalid) ? true : null"
|
|
394
|
+
[attr.aria-readonly]="effectiveReadOnly ? true : null"
|
|
289
395
|
[attr.aria-labelledby]="ariaLabelledby"
|
|
396
|
+
[attr.aria-describedby]="(helperText && !effectiveInvalid && !effectiveWarn) ? helperId : null"
|
|
290
397
|
(change)="onChange($event)"
|
|
291
398
|
(click)="onClick($event)">
|
|
292
399
|
<label
|
|
293
400
|
[for]="id + '_input'"
|
|
294
401
|
[attr.aria-label]="ariaLabel"
|
|
402
|
+
[attr.title]="title || null"
|
|
295
403
|
class="cds--checkbox-label"
|
|
296
404
|
[ngClass]="{
|
|
297
405
|
'cds--skeleton' : skeleton
|
|
298
406
|
}">
|
|
299
407
|
<span [ngClass]="{'cds--visually-hidden' : hideLabel}" class="cds--checkbox-label-text">
|
|
300
408
|
<ng-content></ng-content>
|
|
409
|
+
<ng-container *ngIf="decorator">
|
|
410
|
+
<div class="cds--checkbox-wrapper-inner--decorator">
|
|
411
|
+
<ng-template [ngTemplateOutlet]="decorator"></ng-template>
|
|
412
|
+
</div>
|
|
413
|
+
</ng-container>
|
|
301
414
|
</span>
|
|
302
415
|
</label>
|
|
416
|
+
<div class="cds--checkbox__validation-msg">
|
|
417
|
+
<ng-container *ngIf="!effectiveReadOnly && effectiveInvalid">
|
|
418
|
+
<svg
|
|
419
|
+
cdsIcon="warning--filled"
|
|
420
|
+
size="16"
|
|
421
|
+
class="cds--checkbox__invalid-icon">
|
|
422
|
+
</svg>
|
|
423
|
+
<div class="cds--form-requirement">
|
|
424
|
+
<ng-container *ngIf="!isTemplate(invalidText)">{{invalidText}}</ng-container>
|
|
425
|
+
<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="$any(invalidText)"></ng-template>
|
|
426
|
+
</div>
|
|
427
|
+
</ng-container>
|
|
428
|
+
<ng-container *ngIf="!effectiveReadOnly && !effectiveInvalid && effectiveWarn">
|
|
429
|
+
<svg
|
|
430
|
+
cdsIcon="warning--alt--filled"
|
|
431
|
+
size="16"
|
|
432
|
+
class="cds--checkbox__invalid-icon cds--checkbox__invalid-icon--warning">
|
|
433
|
+
</svg>
|
|
434
|
+
<div class="cds--form-requirement">
|
|
435
|
+
<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>
|
|
436
|
+
<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="$any(warnText)"></ng-template>
|
|
437
|
+
</div>
|
|
438
|
+
</ng-container>
|
|
439
|
+
</div>
|
|
440
|
+
<div
|
|
441
|
+
*ngIf="helperText && !effectiveInvalid && !effectiveWarn"
|
|
442
|
+
class="cds--form__helper-text"
|
|
443
|
+
[id]="helperId">
|
|
444
|
+
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
|
|
445
|
+
<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="$any(helperText)"></ng-template>
|
|
446
|
+
</div>
|
|
303
447
|
</div>
|
|
304
448
|
`,
|
|
305
449
|
providers: [
|
|
@@ -311,7 +455,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
311
455
|
],
|
|
312
456
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
313
457
|
}]
|
|
314
|
-
}], ctorParameters: function () {
|
|
458
|
+
}], ctorParameters: function () {
|
|
459
|
+
return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
460
|
+
type: Optional
|
|
461
|
+
}, {
|
|
462
|
+
type: Inject,
|
|
463
|
+
args: [CHECKBOX_GROUP_HOST]
|
|
464
|
+
}] }];
|
|
465
|
+
}, propDecorators: { disabled: [{
|
|
315
466
|
type: Input
|
|
316
467
|
}], skeleton: [{
|
|
317
468
|
type: Input
|
|
@@ -329,6 +480,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
329
480
|
type: Input
|
|
330
481
|
}], ariaLabelledby: [{
|
|
331
482
|
type: Input
|
|
483
|
+
}], title: [{
|
|
484
|
+
type: Input
|
|
485
|
+
}], helperText: [{
|
|
486
|
+
type: Input
|
|
487
|
+
}], invalid: [{
|
|
488
|
+
type: Input
|
|
489
|
+
}], invalidText: [{
|
|
490
|
+
type: Input
|
|
491
|
+
}], warn: [{
|
|
492
|
+
type: Input
|
|
493
|
+
}], warnText: [{
|
|
494
|
+
type: Input
|
|
495
|
+
}], readOnly: [{
|
|
496
|
+
type: Input
|
|
497
|
+
}], decorator: [{
|
|
498
|
+
type: Input
|
|
332
499
|
}], indeterminate: [{
|
|
333
500
|
type: Input
|
|
334
501
|
}], checked: [{
|
|
@@ -347,26 +514,229 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
347
514
|
args: ["focusout"]
|
|
348
515
|
}] } });
|
|
349
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Groups related checkboxes with a shared legend, validation, and optional decorator
|
|
519
|
+
* (e.g. AI label).
|
|
520
|
+
*
|
|
521
|
+
* ```html
|
|
522
|
+
* <cds-checkbox-group legend="Group label" [decorator]="decoratorTpl">
|
|
523
|
+
* <cds-checkbox>Option 1</cds-checkbox>
|
|
524
|
+
* </cds-checkbox-group>
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
class CheckboxGroup {
|
|
528
|
+
constructor(changeDetectorRef) {
|
|
529
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
530
|
+
this.hostFormItem = true;
|
|
531
|
+
this.helperTextId = `checkbox-group-helper-${CheckboxGroup.nextHelperId++}`;
|
|
532
|
+
this.orientation = "vertical";
|
|
533
|
+
this.invalid = false;
|
|
534
|
+
this.warn = false;
|
|
535
|
+
this.readOnly = false;
|
|
536
|
+
}
|
|
537
|
+
ngOnChanges(changes) {
|
|
538
|
+
if (changes["readOnly"] || changes["invalid"] || changes["warn"]) {
|
|
539
|
+
this.notifyCheckboxesHostStateChanged();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
ngAfterContentInit() {
|
|
543
|
+
this.checkboxes.changes.subscribe(() => this.notifyCheckboxesHostStateChanged());
|
|
544
|
+
}
|
|
545
|
+
isTemplate(value) {
|
|
546
|
+
return value instanceof TemplateRef;
|
|
547
|
+
}
|
|
548
|
+
notifyCheckboxesHostStateChanged() {
|
|
549
|
+
Promise.resolve().then(() => {
|
|
550
|
+
var _a;
|
|
551
|
+
(_a = this.checkboxes) === null || _a === void 0 ? void 0 : _a.forEach((cb) => cb.markForCheckFromGroup());
|
|
552
|
+
this.changeDetectorRef.markForCheck();
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
CheckboxGroup.nextHelperId = 0;
|
|
557
|
+
CheckboxGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CheckboxGroup, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
558
|
+
CheckboxGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CheckboxGroup, selector: "cds-checkbox-group, ibm-checkbox-group", inputs: { legend: "legend", legendId: "legendId", fieldsetAriaLabelledby: "fieldsetAriaLabelledby", orientation: "orientation", helperText: "helperText", invalid: "invalid", invalidText: "invalidText", warn: "warn", warnText: "warnText", readOnly: "readOnly", decorator: "decorator" }, host: { properties: { "class.cds--form-item": "this.hostFormItem" } }, providers: [
|
|
559
|
+
{ provide: CHECKBOX_GROUP_HOST, useExisting: CheckboxGroup }
|
|
560
|
+
], queries: [{ propertyName: "checkboxes", predicate: i0.forwardRef(function () { return Checkbox; }), descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
561
|
+
<fieldset
|
|
562
|
+
class="cds--checkbox-group"
|
|
563
|
+
[ngClass]="{
|
|
564
|
+
'cds--checkbox-group--horizontal': orientation === 'horizontal',
|
|
565
|
+
'cds--checkbox-group--readonly': readOnly,
|
|
566
|
+
'cds--checkbox-group--invalid': !readOnly && invalid,
|
|
567
|
+
'cds--checkbox-group--warning': !readOnly && !invalid && warn,
|
|
568
|
+
'cds--checkbox-group--decorator': !!decorator
|
|
569
|
+
}"
|
|
570
|
+
[attr.data-invalid]="invalid ? true : null"
|
|
571
|
+
[attr.aria-labelledby]="legendId || fieldsetAriaLabelledby || null"
|
|
572
|
+
[attr.aria-readonly]="readOnly ? true : null"
|
|
573
|
+
[attr.aria-describedby]="(helperText && !invalid && !warn) ? helperTextId : null">
|
|
574
|
+
<legend *ngIf="legend" class="cds--label" [attr.id]="legendId || null">
|
|
575
|
+
<ng-template *ngIf="isTemplate(legend); else legendLabel" [ngTemplateOutlet]="legend"></ng-template>
|
|
576
|
+
<ng-template #legendLabel>{{legend}}</ng-template>
|
|
577
|
+
<ng-container *ngIf="decorator">
|
|
578
|
+
<div class="cds--checkbox-group-inner--decorator">
|
|
579
|
+
<ng-template [ngTemplateOutlet]="decorator"></ng-template>
|
|
580
|
+
</div>
|
|
581
|
+
</ng-container>
|
|
582
|
+
</legend>
|
|
583
|
+
<ng-content></ng-content>
|
|
584
|
+
<div class="cds--checkbox-group__validation-msg">
|
|
585
|
+
<ng-container *ngIf="!readOnly && invalid">
|
|
586
|
+
<svg
|
|
587
|
+
cdsIcon="warning--filled"
|
|
588
|
+
size="16"
|
|
589
|
+
class="cds--checkbox__invalid-icon">
|
|
590
|
+
</svg>
|
|
591
|
+
<div class="cds--form-requirement">
|
|
592
|
+
<ng-container *ngIf="!isTemplate(invalidText)">{{ invalidText }}</ng-container>
|
|
593
|
+
<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="invalidText"></ng-template>
|
|
594
|
+
</div>
|
|
595
|
+
</ng-container>
|
|
596
|
+
<ng-container *ngIf="!readOnly && !invalid && warn">
|
|
597
|
+
<svg
|
|
598
|
+
cdsIcon="warning--alt--filled"
|
|
599
|
+
size="16"
|
|
600
|
+
class="cds--checkbox__invalid-icon cds--checkbox__invalid-icon--warning">
|
|
601
|
+
</svg>
|
|
602
|
+
<div class="cds--form-requirement">
|
|
603
|
+
<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>
|
|
604
|
+
<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="warnText"></ng-template>
|
|
605
|
+
</div>
|
|
606
|
+
</ng-container>
|
|
607
|
+
</div>
|
|
608
|
+
<div
|
|
609
|
+
*ngIf="helperText && !invalid && !warn"
|
|
610
|
+
class="cds--form__helper-text"
|
|
611
|
+
[id]="helperTextId">
|
|
612
|
+
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
|
|
613
|
+
<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="helperText"></ng-template>
|
|
614
|
+
</div>
|
|
615
|
+
</fieldset>
|
|
616
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CheckboxGroup, decorators: [{
|
|
618
|
+
type: Component,
|
|
619
|
+
args: [{
|
|
620
|
+
selector: "cds-checkbox-group, ibm-checkbox-group",
|
|
621
|
+
template: `
|
|
622
|
+
<fieldset
|
|
623
|
+
class="cds--checkbox-group"
|
|
624
|
+
[ngClass]="{
|
|
625
|
+
'cds--checkbox-group--horizontal': orientation === 'horizontal',
|
|
626
|
+
'cds--checkbox-group--readonly': readOnly,
|
|
627
|
+
'cds--checkbox-group--invalid': !readOnly && invalid,
|
|
628
|
+
'cds--checkbox-group--warning': !readOnly && !invalid && warn,
|
|
629
|
+
'cds--checkbox-group--decorator': !!decorator
|
|
630
|
+
}"
|
|
631
|
+
[attr.data-invalid]="invalid ? true : null"
|
|
632
|
+
[attr.aria-labelledby]="legendId || fieldsetAriaLabelledby || null"
|
|
633
|
+
[attr.aria-readonly]="readOnly ? true : null"
|
|
634
|
+
[attr.aria-describedby]="(helperText && !invalid && !warn) ? helperTextId : null">
|
|
635
|
+
<legend *ngIf="legend" class="cds--label" [attr.id]="legendId || null">
|
|
636
|
+
<ng-template *ngIf="isTemplate(legend); else legendLabel" [ngTemplateOutlet]="legend"></ng-template>
|
|
637
|
+
<ng-template #legendLabel>{{legend}}</ng-template>
|
|
638
|
+
<ng-container *ngIf="decorator">
|
|
639
|
+
<div class="cds--checkbox-group-inner--decorator">
|
|
640
|
+
<ng-template [ngTemplateOutlet]="decorator"></ng-template>
|
|
641
|
+
</div>
|
|
642
|
+
</ng-container>
|
|
643
|
+
</legend>
|
|
644
|
+
<ng-content></ng-content>
|
|
645
|
+
<div class="cds--checkbox-group__validation-msg">
|
|
646
|
+
<ng-container *ngIf="!readOnly && invalid">
|
|
647
|
+
<svg
|
|
648
|
+
cdsIcon="warning--filled"
|
|
649
|
+
size="16"
|
|
650
|
+
class="cds--checkbox__invalid-icon">
|
|
651
|
+
</svg>
|
|
652
|
+
<div class="cds--form-requirement">
|
|
653
|
+
<ng-container *ngIf="!isTemplate(invalidText)">{{ invalidText }}</ng-container>
|
|
654
|
+
<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="invalidText"></ng-template>
|
|
655
|
+
</div>
|
|
656
|
+
</ng-container>
|
|
657
|
+
<ng-container *ngIf="!readOnly && !invalid && warn">
|
|
658
|
+
<svg
|
|
659
|
+
cdsIcon="warning--alt--filled"
|
|
660
|
+
size="16"
|
|
661
|
+
class="cds--checkbox__invalid-icon cds--checkbox__invalid-icon--warning">
|
|
662
|
+
</svg>
|
|
663
|
+
<div class="cds--form-requirement">
|
|
664
|
+
<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>
|
|
665
|
+
<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="warnText"></ng-template>
|
|
666
|
+
</div>
|
|
667
|
+
</ng-container>
|
|
668
|
+
</div>
|
|
669
|
+
<div
|
|
670
|
+
*ngIf="helperText && !invalid && !warn"
|
|
671
|
+
class="cds--form__helper-text"
|
|
672
|
+
[id]="helperTextId">
|
|
673
|
+
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
|
|
674
|
+
<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="helperText"></ng-template>
|
|
675
|
+
</div>
|
|
676
|
+
</fieldset>
|
|
677
|
+
`,
|
|
678
|
+
providers: [
|
|
679
|
+
{ provide: CHECKBOX_GROUP_HOST, useExisting: CheckboxGroup }
|
|
680
|
+
],
|
|
681
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
682
|
+
}]
|
|
683
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostFormItem: [{
|
|
684
|
+
type: HostBinding,
|
|
685
|
+
args: ["class.cds--form-item"]
|
|
686
|
+
}], checkboxes: [{
|
|
687
|
+
type: ContentChildren,
|
|
688
|
+
args: [forwardRef(() => Checkbox), { descendants: true }]
|
|
689
|
+
}], legend: [{
|
|
690
|
+
type: Input
|
|
691
|
+
}], legendId: [{
|
|
692
|
+
type: Input
|
|
693
|
+
}], fieldsetAriaLabelledby: [{
|
|
694
|
+
type: Input
|
|
695
|
+
}], orientation: [{
|
|
696
|
+
type: Input
|
|
697
|
+
}], helperText: [{
|
|
698
|
+
type: Input
|
|
699
|
+
}], invalid: [{
|
|
700
|
+
type: Input
|
|
701
|
+
}], invalidText: [{
|
|
702
|
+
type: Input
|
|
703
|
+
}], warn: [{
|
|
704
|
+
type: Input
|
|
705
|
+
}], warnText: [{
|
|
706
|
+
type: Input
|
|
707
|
+
}], readOnly: [{
|
|
708
|
+
type: Input
|
|
709
|
+
}], decorator: [{
|
|
710
|
+
type: Input
|
|
711
|
+
}] } });
|
|
712
|
+
|
|
350
713
|
// modules
|
|
351
714
|
class CheckboxModule {
|
|
352
715
|
}
|
|
353
716
|
CheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
354
|
-
CheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: CheckboxModule, declarations: [Checkbox
|
|
355
|
-
|
|
717
|
+
CheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: CheckboxModule, declarations: [Checkbox,
|
|
718
|
+
CheckboxGroup], imports: [CommonModule,
|
|
719
|
+
FormsModule,
|
|
720
|
+
IconModule], exports: [Checkbox,
|
|
721
|
+
CheckboxGroup] });
|
|
356
722
|
CheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CheckboxModule, imports: [CommonModule,
|
|
357
|
-
FormsModule
|
|
723
|
+
FormsModule,
|
|
724
|
+
IconModule] });
|
|
358
725
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CheckboxModule, decorators: [{
|
|
359
726
|
type: NgModule,
|
|
360
727
|
args: [{
|
|
361
728
|
declarations: [
|
|
362
|
-
Checkbox
|
|
729
|
+
Checkbox,
|
|
730
|
+
CheckboxGroup
|
|
363
731
|
],
|
|
364
732
|
exports: [
|
|
365
|
-
Checkbox
|
|
733
|
+
Checkbox,
|
|
734
|
+
CheckboxGroup
|
|
366
735
|
],
|
|
367
736
|
imports: [
|
|
368
737
|
CommonModule,
|
|
369
|
-
FormsModule
|
|
738
|
+
FormsModule,
|
|
739
|
+
IconModule
|
|
370
740
|
]
|
|
371
741
|
}]
|
|
372
742
|
}] });
|
|
@@ -375,5 +745,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
375
745
|
* Generated bundle index. Do not edit.
|
|
376
746
|
*/
|
|
377
747
|
|
|
378
|
-
export { Checkbox, CheckboxModule, CheckboxState };
|
|
748
|
+
export { CHECKBOX_GROUP_HOST, Checkbox, CheckboxGroup, CheckboxModule, CheckboxState };
|
|
379
749
|
//# sourceMappingURL=carbon-components-angular-checkbox.mjs.map
|