@i-cell/ids-angular 0.1.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/README.md +24 -0
- package/accordion/accordion-animations.d.ts +1 -0
- package/accordion/accordion-defaults.d.ts +18 -0
- package/accordion/accordion-item/accordion-item.component.d.ts +27 -0
- package/accordion/accordion.component.d.ts +29 -0
- package/accordion/index.d.ts +5 -0
- package/accordion/public-api.d.ts +5 -0
- package/accordion/types/accordion-appearance.type.d.ts +5 -0
- package/avatar/avatar-defaults.d.ts +12 -0
- package/avatar/avatar-image.directive.d.ts +5 -0
- package/avatar/avatar.component.d.ts +28 -0
- package/avatar/index.d.ts +5 -0
- package/avatar/public-api.d.ts +6 -0
- package/avatar/tokens/avatar-parent.d.ts +6 -0
- package/avatar/types/avatar-type.type.d.ts +6 -0
- package/avatar/types/avatar-variant.type.d.ts +8 -0
- package/button/button-defaults.d.ts +11 -0
- package/button/button-group-defaults.d.ts +7 -0
- package/button/button-group.component.d.ts +11 -0
- package/button/button.component.d.ts +23 -0
- package/button/index.d.ts +5 -0
- package/button/public-api.d.ts +7 -0
- package/button/tokens/button-parent.d.ts +6 -0
- package/button/types/button-appearance.type.d.ts +6 -0
- package/button/types/button-variant.type.d.ts +14 -0
- package/card/card-body.directive.d.ts +6 -0
- package/card/card-defaults.d.ts +12 -0
- package/card/card-footer.directive.d.ts +6 -0
- package/card/card-header.component.d.ts +6 -0
- package/card/card-media.directive.d.ts +7 -0
- package/card/card-section-base.directive.d.ts +9 -0
- package/card/card-subtitle.directive.d.ts +5 -0
- package/card/card-title.directive.d.ts +5 -0
- package/card/card.component.d.ts +21 -0
- package/card/index.d.ts +5 -0
- package/card/public-api.d.ts +10 -0
- package/card/types/card-appearances.type.d.ts +6 -0
- package/card/types/card-variant.type.d.ts +13 -0
- package/checkbox/checkbox-defaults.d.ts +9 -0
- package/checkbox/checkbox-group-defaults.d.ts +9 -0
- package/checkbox/checkbox-group.component.d.ts +28 -0
- package/checkbox/checkbox.component.d.ts +68 -0
- package/checkbox/index.d.ts +5 -0
- package/checkbox/public-api.d.ts +7 -0
- package/checkbox/types/checkbox-events.class.d.ts +6 -0
- package/checkbox/types/checkbox-group-child.d.ts +7 -0
- package/checkbox/types/checkbox-parent.d.ts +8 -0
- package/checkbox/types/checkbox-state.type.d.ts +6 -0
- package/checkbox/types/checkbox-variant.type.d.ts +6 -0
- package/chip/chip-defaults.d.ts +12 -0
- package/chip/chip-group-defaults.d.ts +9 -0
- package/chip/chip-group.component.d.ts +14 -0
- package/chip/chip.component.d.ts +35 -0
- package/chip/index.d.ts +5 -0
- package/chip/public-api.d.ts +7 -0
- package/chip/types/chip-appearance.type.d.ts +5 -0
- package/chip/types/chip-events.type.d.ts +4 -0
- package/chip/types/chip-variant.type.d.ts +8 -0
- package/core/base-classes/component-base.d.ts +13 -0
- package/core/base-classes/directive-base.d.ts +16 -0
- package/core/directives/detect-scrollable.directive.d.ts +11 -0
- package/core/index.d.ts +5 -0
- package/core/pipes/sentence-case.pipe.d.ts +7 -0
- package/core/public-api.d.ts +17 -0
- package/core/services/resize-observer.service.d.ts +13 -0
- package/core/types/orientation.type.d.ts +5 -0
- package/core/types/position.type.d.ts +39 -0
- package/core/types/size-collection.type.d.ts +5 -0
- package/core/types/size.type.d.ts +7 -0
- package/core/utils/class-prefix.d.ts +2 -0
- package/core/utils/class.d.ts +2 -0
- package/core/utils/coercion.d.ts +6 -0
- package/core/utils/compare.d.ts +1 -0
- package/core/utils/date.d.ts +1 -0
- package/core/utils/even-odd.d.ts +2 -0
- package/core/utils/fallback-value.d.ts +1 -0
- package/core/utils/string.d.ts +1 -0
- package/dialog/custom-dialog-base.d.ts +15 -0
- package/dialog/dialog-defaults.d.ts +9 -0
- package/dialog/dialog-header.directive.d.ts +7 -0
- package/dialog/dialog.component.d.ts +22 -0
- package/dialog/dialog.service.d.ts +17 -0
- package/dialog/index.d.ts +5 -0
- package/dialog/public-api.d.ts +5 -0
- package/divider/divider-defaults.d.ts +12 -0
- package/divider/divider.component.d.ts +18 -0
- package/divider/index.d.ts +5 -0
- package/divider/public-api.d.ts +3 -0
- package/divider/types/divider-variant.type.d.ts +13 -0
- package/fesm2022/i-cell-ids-angular-accordion.mjs +223 -0
- package/fesm2022/i-cell-ids-angular-accordion.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-avatar.mjs +125 -0
- package/fesm2022/i-cell-ids-angular-avatar.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-button.mjs +117 -0
- package/fesm2022/i-cell-ids-angular-button.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-card.mjs +222 -0
- package/fesm2022/i-cell-ids-angular-card.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-checkbox.mjs +346 -0
- package/fesm2022/i-cell-ids-angular-checkbox.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-chip.mjs +166 -0
- package/fesm2022/i-cell-ids-angular-chip.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-core.mjs +266 -0
- package/fesm2022/i-cell-ids-angular-core.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-dialog.mjs +157 -0
- package/fesm2022/i-cell-ids-angular-dialog.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-divider.mjs +76 -0
- package/fesm2022/i-cell-ids-angular-divider.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-forms.mjs +871 -0
- package/fesm2022/i-cell-ids-angular-forms.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-icon-button.mjs +81 -0
- package/fesm2022/i-cell-ids-angular-icon-button.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-icon.mjs +149 -0
- package/fesm2022/i-cell-ids-angular-icon.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-menu.mjs +108 -0
- package/fesm2022/i-cell-ids-angular-menu.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-notification.mjs +167 -0
- package/fesm2022/i-cell-ids-angular-notification.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-overlay-panel.mjs +72 -0
- package/fesm2022/i-cell-ids-angular-overlay-panel.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-paginator.mjs +319 -0
- package/fesm2022/i-cell-ids-angular-paginator.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-radio.mjs +312 -0
- package/fesm2022/i-cell-ids-angular-radio.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs +264 -0
- package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-segmented-control.mjs +283 -0
- package/fesm2022/i-cell-ids-angular-segmented-control.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-select.mjs +550 -0
- package/fesm2022/i-cell-ids-angular-select.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-snackbar.mjs +440 -0
- package/fesm2022/i-cell-ids-angular-snackbar.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-switch.mjs +181 -0
- package/fesm2022/i-cell-ids-angular-switch.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-tab.mjs +141 -0
- package/fesm2022/i-cell-ids-angular-tab.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-table.mjs +663 -0
- package/fesm2022/i-cell-ids-angular-table.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-tag.mjs +116 -0
- package/fesm2022/i-cell-ids-angular-tag.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular-tooltip.mjs +587 -0
- package/fesm2022/i-cell-ids-angular-tooltip.mjs.map +1 -0
- package/fesm2022/i-cell-ids-angular.mjs +9 -0
- package/fesm2022/i-cell-ids-angular.mjs.map +1 -0
- package/forms/common/error/error-state.d.ts +23 -0
- package/forms/common/success/success-state.d.ts +23 -0
- package/forms/components/fieldset/fieldset-defaults.d.ts +9 -0
- package/forms/components/fieldset/fieldset-message.directive.d.ts +5 -0
- package/forms/components/fieldset/fieldset-row/fieldset-row.component.d.ts +8 -0
- package/forms/components/fieldset/fieldset.component.d.ts +16 -0
- package/forms/components/form-field/form-field-control.d.ts +21 -0
- package/forms/components/form-field/form-field-defaults.d.ts +9 -0
- package/forms/components/form-field/form-field.component.d.ts +41 -0
- package/forms/components/form-field/tokens/form-field-control.d.ts +3 -0
- package/forms/components/form-field/types/form-field-variant.type.d.ts +5 -0
- package/forms/components/input/input-defaults.d.ts +9 -0
- package/forms/components/input/input.directive.d.ts +55 -0
- package/forms/components/input/types/input.type.d.ts +1 -0
- package/forms/components/message/error-message/error-message.component.d.ts +15 -0
- package/forms/components/message/hint-message/hint-message.component.d.ts +10 -0
- package/forms/components/message/message-defaults.d.ts +9 -0
- package/forms/components/message/success-message/success-message.component.d.ts +11 -0
- package/forms/components/message/types/message-parent-form-field.d.ts +9 -0
- package/forms/components/message/types/message-variant.type.d.ts +6 -0
- package/forms/components/message/types/message.type.d.ts +6 -0
- package/forms/components/option/option-group.component.d.ts +13 -0
- package/forms/components/option/option.component.d.ts +47 -0
- package/forms/components/option/tokens/option-group.d.ts +3 -0
- package/forms/components/option/tokens/option-parent.d.ts +11 -0
- package/forms/components/option/types/option-events.class.d.ts +7 -0
- package/forms/components/pseudo-checkbox/pseudo-checkbox.component.d.ts +14 -0
- package/forms/components/pseudo-checkbox/tokens/pseudo-checkbox-parent.d.ts +7 -0
- package/forms/components/pseudo-checkbox/types/pseudo-checkbox-state.type.d.ts +6 -0
- package/forms/directives/form-field-action.directive.d.ts +5 -0
- package/forms/directives/label.directive.d.ts +5 -0
- package/forms/directives/message-prefix.directive.d.ts +5 -0
- package/forms/directives/message-suffix.directive.d.ts +5 -0
- package/forms/directives/message.directive.d.ts +17 -0
- package/forms/directives/prefix.directive.d.ts +7 -0
- package/forms/directives/suffix.directive.d.ts +7 -0
- package/forms/index.d.ts +5 -0
- package/forms/public-api.d.ts +35 -0
- package/forms/validators.d.ts +9 -0
- package/icon/icon-defaults.d.ts +11 -0
- package/icon/icon.component.d.ts +32 -0
- package/icon/index.d.ts +5 -0
- package/icon/public-api.d.ts +5 -0
- package/icon/tokens/icon-parent.d.ts +6 -0
- package/icon/types/icon-source.type.d.ts +5 -0
- package/icon/types/icon-variant.type.d.ts +12 -0
- package/icon-button/icon-button-defaults.d.ts +11 -0
- package/icon-button/icon-button.component.d.ts +22 -0
- package/icon-button/index.d.ts +5 -0
- package/icon-button/public-api.d.ts +5 -0
- package/icon-button/tokens/icon-button-parent.d.ts +9 -0
- package/icon-button/types/icon-button-appearance.type.d.ts +6 -0
- package/icon-button/types/icon-button-variant.type.d.ts +13 -0
- package/index.d.ts +5 -0
- package/menu/action-menu/action-menu-trigger.directive.d.ts +12 -0
- package/menu/index.d.ts +5 -0
- package/menu/menu-item/menu-item-defaults.d.ts +11 -0
- package/menu/menu-item/menu-item.component.d.ts +23 -0
- package/menu/menu-item/types/menu-item-appearance.type.d.ts +5 -0
- package/menu/menu-item/types/menu-item-variant.type.d.ts +4 -0
- package/menu/public-api.d.ts +5 -0
- package/notification/index.d.ts +5 -0
- package/notification/notification-action-button.directive.d.ts +5 -0
- package/notification/notification-defaults.d.ts +15 -0
- package/notification/notification.component.d.ts +34 -0
- package/notification/public-api.d.ts +5 -0
- package/notification/types/notification-appearance.type.d.ts +5 -0
- package/notification/types/notification-variant.type.d.ts +10 -0
- package/overlay-panel/index.d.ts +5 -0
- package/overlay-panel/overlay-panel-defaults.d.ts +11 -0
- package/overlay-panel/overlay-panel.component.d.ts +18 -0
- package/overlay-panel/public-api.d.ts +4 -0
- package/overlay-panel/types/overlay-panel-appearance.type.d.ts +6 -0
- package/overlay-panel/types/overlay-panel-variant.type.d.ts +5 -0
- package/package.json +153 -0
- package/paginator/index.d.ts +5 -0
- package/paginator/paginator-defaults.d.ts +22 -0
- package/paginator/paginator-intl.d.ts +24 -0
- package/paginator/paginator.component.d.ts +67 -0
- package/paginator/public-api.d.ts +5 -0
- package/paginator/types/paginator-appearance.type.d.ts +4 -0
- package/paginator/types/paginator-events.class.d.ts +6 -0
- package/paginator/types/paginator-variant.type.d.ts +7 -0
- package/public-api.d.ts +2 -0
- package/radio/index.d.ts +5 -0
- package/radio/public-api.d.ts +5 -0
- package/radio/radio-defaults.d.ts +11 -0
- package/radio/radio-group.directive.d.ts +46 -0
- package/radio/radio.component.d.ts +30 -0
- package/radio/types/radio-events.class.d.ts +6 -0
- package/radio/types/radio-variant.type.d.ts +6 -0
- package/segmented-control/index.d.ts +5 -0
- package/segmented-control/public-api.d.ts +6 -0
- package/segmented-control/segmented-control-defaults.d.ts +11 -0
- package/segmented-control/segmented-control-item.component.d.ts +33 -0
- package/segmented-control/segmented-control.directive.d.ts +42 -0
- package/segmented-control/types/segmented-control-appearance.type.d.ts +4 -0
- package/segmented-control/types/segmented-control-item-change.class.d.ts +7 -0
- package/segmented-control/types/segmented-control-variant.type.d.ts +6 -0
- package/segmented-control-toggle/index.d.ts +5 -0
- package/segmented-control-toggle/public-api.d.ts +6 -0
- package/segmented-control-toggle/segmented-control-toggle-defaults.d.ts +12 -0
- package/segmented-control-toggle/segmented-control-toggle-item.component.d.ts +32 -0
- package/segmented-control-toggle/segmented-control-toggle.directive.d.ts +43 -0
- package/segmented-control-toggle/types/segmented-control-toggle-appearance.type.d.ts +5 -0
- package/segmented-control-toggle/types/segmented-control-toggle-item-change.class.d.ts +6 -0
- package/segmented-control-toggle/types/segmented-control-toggle-variant.type.d.ts +11 -0
- package/select/index.d.ts +5 -0
- package/select/public-api.d.ts +3 -0
- package/select/select-defaults.d.ts +9 -0
- package/select/select-positions.d.ts +2 -0
- package/select/select-trigger.directive.d.ts +5 -0
- package/select/select.component.d.ts +102 -0
- package/snackbar/animations.d.ts +2 -0
- package/snackbar/index.d.ts +5 -0
- package/snackbar/public-api.d.ts +7 -0
- package/snackbar/services/snackbar.service.d.ts +28 -0
- package/snackbar/snackbar-defaults.d.ts +16 -0
- package/snackbar/snackbar-group.component.d.ts +25 -0
- package/snackbar/snackbar-position-strategies.d.ts +4 -0
- package/snackbar/snackbar.component.d.ts +51 -0
- package/snackbar/types/snackbar-data.type.d.ts +15 -0
- package/snackbar/types/snackbar-inner-data.type.d.ts +4 -0
- package/snackbar/types/snackbar-position.type.d.ts +9 -0
- package/snackbar/types/snackbar-variant.type.d.ts +8 -0
- package/switch/index.d.ts +5 -0
- package/switch/public-api.d.ts +5 -0
- package/switch/switch-animations.d.ts +2 -0
- package/switch/switch-defaults.d.ts +13 -0
- package/switch/switch-group.component.d.ts +14 -0
- package/switch/switch.component.d.ts +45 -0
- package/switch/types/switch-positions.type.d.ts +10 -0
- package/switch/types/switch-variant.type.d.ts +6 -0
- package/tab/index.d.ts +5 -0
- package/tab/public-api.d.ts +6 -0
- package/tab/tab-group-defaults.d.ts +15 -0
- package/tab/tab-group.component.d.ts +29 -0
- package/tab/tab.component.d.ts +18 -0
- package/tab/types/tab-group-position.type.d.ts +6 -0
- package/tab/types/tab-group-variant.type.d.ts +6 -0
- package/tab/types/tab-indicator-position.type.d.ts +7 -0
- package/table/components/cell-content/cell-content.component.d.ts +25 -0
- package/table/datasource/server-side-datasource.d.ts +37 -0
- package/table/directives/cell-renderer.d.ts +13 -0
- package/table/directives/cell-template.d.ts +8 -0
- package/table/directives/row-info-holder.d.ts +9 -0
- package/table/index.d.ts +5 -0
- package/table/public-api.d.ts +18 -0
- package/table/table-defaults.d.ts +22 -0
- package/table/table-intl.d.ts +25 -0
- package/table/table.component.d.ts +142 -0
- package/table/types/pagination-params.d.ts +9 -0
- package/table/types/request-factory.d.ts +5 -0
- package/table/types/request-pagination-data.d.ts +6 -0
- package/table/types/response-data.d.ts +5 -0
- package/table/types/table-appearance.type.d.ts +6 -0
- package/table/types/table-cell-click-event.d.ts +6 -0
- package/table/types/table-column-def.d.ts +97 -0
- package/table/types/table-row-click-event.d.ts +4 -0
- package/table/types/table-row-keydown-event.d.ts +4 -0
- package/table/types/table-sort-direction.d.ts +6 -0
- package/table/types/table-sort-info.d.ts +6 -0
- package/table/types/table-variant.type.d.ts +6 -0
- package/tag/index.d.ts +5 -0
- package/tag/public-api.d.ts +6 -0
- package/tag/tag-defaults.d.ts +11 -0
- package/tag/tag-group-defaults.d.ts +9 -0
- package/tag/tag-group.component.d.ts +13 -0
- package/tag/tag.component.d.ts +23 -0
- package/tag/types/tag-appearance.type.d.ts +5 -0
- package/tag/types/tag-variant.type.d.ts +13 -0
- package/tooltip/index.d.ts +5 -0
- package/tooltip/public-api.d.ts +5 -0
- package/tooltip/tooltip-defaults.d.ts +18 -0
- package/tooltip/tooltip-position-strategies.d.ts +3 -0
- package/tooltip/tooltip.component.d.ts +31 -0
- package/tooltip/tooltip.directive.d.ts +60 -0
- package/tooltip/types/tooltip-position.type.d.ts +11 -0
- package/tooltip/types/tooltip-variant.type.d.ts +5 -0
- package/tooltip/types/tooltip.type.d.ts +2 -0
- package/tooltip/utils/tooltip-converters.d.ts +3 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, signal, input, computed, viewChild, output, Component, ViewEncapsulation, ChangeDetectionStrategy, contentChildren, isDevMode, forwardRef, Directive, Input } from '@angular/core';
|
|
3
|
+
import { IdsSize, IdsOrientation, IdsPosition, ComponentBase, coerceNumberAttribute, ComponentBaseWithDefaults, coerceBooleanAttribute, IdsVerticalPosition } from '@i-cell/ids-angular/core';
|
|
4
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
5
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
+
|
|
7
|
+
const IdsRadioVariant = {
|
|
8
|
+
SURFACE: 'surface',
|
|
9
|
+
LIGHT: 'light',
|
|
10
|
+
DARK: 'dark',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
class IdsRadioChangeEvent {
|
|
14
|
+
constructor(source, value) {
|
|
15
|
+
this.source = source;
|
|
16
|
+
this.value = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const IDS_RADIO_DEFAULT_CONFIG = new InjectionToken('IDS_RADIO_DEFAULT_CONFIG', {
|
|
21
|
+
providedIn: 'root',
|
|
22
|
+
factory: IDS_RADIO_DEFAULT_CONFIG_FACTORY,
|
|
23
|
+
});
|
|
24
|
+
function IDS_RADIO_DEFAULT_CONFIG_FACTORY() {
|
|
25
|
+
return {
|
|
26
|
+
size: IdsSize.COMPACT,
|
|
27
|
+
variant: IdsRadioVariant.SURFACE,
|
|
28
|
+
orientation: IdsOrientation.VERTICAL,
|
|
29
|
+
labelPosition: IdsPosition.RIGHT,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class IdsRadioComponent extends ComponentBase {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this._group = inject(IdsRadioGroupDirective, { optional: true, skipSelf: true });
|
|
37
|
+
this.selected = signal(false);
|
|
38
|
+
this.inputId = input(this._uniqueId);
|
|
39
|
+
this.value = input.required();
|
|
40
|
+
this.ariaLabel = input('', { alias: 'aria-label' });
|
|
41
|
+
this.ariaLabelledBy = input('', { alias: 'aria-labelledby' });
|
|
42
|
+
this.ariaDescribedBy = input('', { alias: 'aria-describedby' });
|
|
43
|
+
this.tabIndex = input(0, { transform: coerceNumberAttribute });
|
|
44
|
+
this.disabled = input(false);
|
|
45
|
+
this.isDisabled = computed(() => this.disabled() || this._group?.isDisabled());
|
|
46
|
+
this.name = computed(() => this._group?.name());
|
|
47
|
+
this.required = computed(() => this._group?.required());
|
|
48
|
+
this.ariaChecked = computed(() => this.selected());
|
|
49
|
+
this._hostClasses = computed(() => this._getHostClasses([
|
|
50
|
+
this._group?.variant() ?? null,
|
|
51
|
+
this._group?.labelPosition() ?? null,
|
|
52
|
+
this.isDisabled() ? 'disabled' : null,
|
|
53
|
+
]));
|
|
54
|
+
this._inputElement = viewChild.required('input');
|
|
55
|
+
this.changes = output();
|
|
56
|
+
}
|
|
57
|
+
get _hostName() {
|
|
58
|
+
return 'radio';
|
|
59
|
+
}
|
|
60
|
+
ngOnInit() {
|
|
61
|
+
if (!this._group) {
|
|
62
|
+
throw this._createHostError('component must be direct child of a radio group');
|
|
63
|
+
}
|
|
64
|
+
if (this._group.isItemPreSelectedByValue(this.value())) {
|
|
65
|
+
this.selected.set(true);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
onChange() {
|
|
69
|
+
this.changes.emit(new IdsRadioChangeEvent(this, this.value()));
|
|
70
|
+
}
|
|
71
|
+
touchTargetClick() {
|
|
72
|
+
if (!this.selected() && !this.isDisabled()) {
|
|
73
|
+
this._inputElement().nativeElement.focus();
|
|
74
|
+
this.onChange();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
innerCircleClick() {
|
|
78
|
+
if (!this.selected() && !this.isDisabled()) {
|
|
79
|
+
this._inputElement().nativeElement.focus();
|
|
80
|
+
this.onChange();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
focus(options) {
|
|
84
|
+
this._inputElement().nativeElement.focus(options);
|
|
85
|
+
}
|
|
86
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
87
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.2", type: IdsRadioComponent, isStandalone: true, selector: "ids-radio", inputs: { inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changes: "changes" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ids-radio__input-wrapper\">\n <div class=\"ids-radio__touch-target\" (click)=\"touchTargetClick()\"></div>\n <input\n #input\n class=\"ids-radio__native-control\"\n type=\"radio\"\n [id]=\"inputId()\"\n [checked]=\"selected()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.value]=\"value()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n (change)=\"onChange()\"\n />\n <div class=\"ids-radio__inner-circle\" (click)=\"innerCircleClick()\"></div>\n</div>\n<label class=\"ids-radio__label\" [for]=\"inputId()\">\n <ng-content />\n</label>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
88
|
+
}
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsRadioComponent, decorators: [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{ selector: 'ids-radio', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ids-radio__input-wrapper\">\n <div class=\"ids-radio__touch-target\" (click)=\"touchTargetClick()\"></div>\n <input\n #input\n class=\"ids-radio__native-control\"\n type=\"radio\"\n [id]=\"inputId()\"\n [checked]=\"selected()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.value]=\"value()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n (change)=\"onChange()\"\n />\n <div class=\"ids-radio__inner-circle\" (click)=\"innerCircleClick()\"></div>\n</div>\n<label class=\"ids-radio__label\" [for]=\"inputId()\">\n <ng-content />\n</label>\n" }]
|
|
92
|
+
}] });
|
|
93
|
+
|
|
94
|
+
const defaultConfig = IDS_RADIO_DEFAULT_CONFIG_FACTORY();
|
|
95
|
+
class IdsRadioGroupDirective extends ComponentBaseWithDefaults {
|
|
96
|
+
constructor() {
|
|
97
|
+
super(...arguments);
|
|
98
|
+
this._defaultConfig = this._getDefaultConfig(defaultConfig, IDS_RADIO_DEFAULT_CONFIG);
|
|
99
|
+
this._items = contentChildren(IdsRadioComponent);
|
|
100
|
+
this.name = input.required();
|
|
101
|
+
this.required = input(false, { transform: coerceBooleanAttribute });
|
|
102
|
+
this.size = input(this._defaultConfig.size);
|
|
103
|
+
this.variant = input(this._defaultConfig.variant);
|
|
104
|
+
this.orientation = input(this._defaultConfig.orientation);
|
|
105
|
+
this.labelPosition = input(this._defaultConfig.labelPosition);
|
|
106
|
+
this.isDisabled = signal(false);
|
|
107
|
+
this._hostClasses = computed(() => this._getHostClasses([
|
|
108
|
+
this.size(),
|
|
109
|
+
this.orientation(),
|
|
110
|
+
this.labelPosition(),
|
|
111
|
+
]));
|
|
112
|
+
this._onChange = () => { };
|
|
113
|
+
this._onTouched = () => { };
|
|
114
|
+
this.itemChanges = output();
|
|
115
|
+
}
|
|
116
|
+
get _hostName() {
|
|
117
|
+
return 'radio-group';
|
|
118
|
+
}
|
|
119
|
+
set disabled(value) {
|
|
120
|
+
if (value !== this.disabled) {
|
|
121
|
+
this.isDisabled.set(value);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
_handleKeyDown(event) {
|
|
125
|
+
const navigationKeys = {
|
|
126
|
+
// eslint-disable-next-line @stylistic/js/array-bracket-newline, @stylistic/js/array-element-newline
|
|
127
|
+
horizontal: new Set(['ArrowLeft', 'ArrowRight', 'Enter', ' ']),
|
|
128
|
+
// eslint-disable-next-line @stylistic/js/array-bracket-newline, @stylistic/js/array-element-newline
|
|
129
|
+
vertical: new Set(['ArrowUp', 'ArrowDown', 'Enter', ' ']),
|
|
130
|
+
};
|
|
131
|
+
const orientation = this.orientation();
|
|
132
|
+
if (navigationKeys.horizontal.has(event.key) || navigationKeys.vertical.has(event.key)) {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
}
|
|
135
|
+
if (!navigationKeys[orientation].has(event.key)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const items = this._items();
|
|
139
|
+
const target = event.target;
|
|
140
|
+
const inputId = target.id;
|
|
141
|
+
const index = items.findIndex((item) => item.inputId() === inputId);
|
|
142
|
+
switch (event.key) {
|
|
143
|
+
case 'ArrowUp': {
|
|
144
|
+
if (orientation === IdsOrientation.HORIZONTAL) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (index === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const prevItem = items[index - 1];
|
|
151
|
+
prevItem.focus();
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case 'ArrowLeft': {
|
|
155
|
+
if (orientation === IdsOrientation.VERTICAL) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (index === 0) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const prevItem = items[index - 1];
|
|
162
|
+
prevItem.focus();
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case 'ArrowDown': {
|
|
166
|
+
if (orientation === IdsOrientation.HORIZONTAL) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (index === (items.length - 1)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const nextItem = items[index + 1];
|
|
173
|
+
nextItem.focus();
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
case 'ArrowRight': {
|
|
177
|
+
if (orientation === IdsOrientation.VERTICAL) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (index === (items.length - 1)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const nextItem = items[index + 1];
|
|
184
|
+
nextItem.focus();
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 'Enter':
|
|
188
|
+
case ' ': {
|
|
189
|
+
items[index].onChange();
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
default:
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
ngOnInit() {
|
|
197
|
+
this._selectionModel = new SelectionModel(false, undefined, false, this.valueCompareFn);
|
|
198
|
+
if (this._hasInvalidLabelPosition()) {
|
|
199
|
+
throw this._createHostError('invalid `orientation` + `labelPosition` combination.');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
ngAfterContentInit() {
|
|
203
|
+
const items = this._items();
|
|
204
|
+
const minItemCount = 2;
|
|
205
|
+
if (isDevMode() && (items.length < minItemCount)) {
|
|
206
|
+
throw this._createHostError('invalid count of radio items. Minimum item count is 2.');
|
|
207
|
+
}
|
|
208
|
+
this._selectionModel?.select(...this._items().filter((item) => item.selected()));
|
|
209
|
+
this._subscribeItemChanges();
|
|
210
|
+
}
|
|
211
|
+
writeValue(value) {
|
|
212
|
+
this._setSelectionByValue(value);
|
|
213
|
+
}
|
|
214
|
+
registerOnChange(fn) {
|
|
215
|
+
this._onChange = fn;
|
|
216
|
+
}
|
|
217
|
+
registerOnTouched(fn) {
|
|
218
|
+
this._onTouched = fn;
|
|
219
|
+
}
|
|
220
|
+
setDisabledState(isDisabled) {
|
|
221
|
+
this.isDisabled.set(isDisabled);
|
|
222
|
+
}
|
|
223
|
+
_subscribeItemChanges() {
|
|
224
|
+
this._items().forEach((item) => {
|
|
225
|
+
item.changes.subscribe((change) => {
|
|
226
|
+
this._handleItemChanges(change);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
_handleItemChanges(change) {
|
|
231
|
+
const { source } = change;
|
|
232
|
+
this._clearSelection();
|
|
233
|
+
source.selected.set(true);
|
|
234
|
+
this._selectionModel?.select(source);
|
|
235
|
+
this.itemChanges.emit(change);
|
|
236
|
+
this._handleChange();
|
|
237
|
+
this._onTouched();
|
|
238
|
+
}
|
|
239
|
+
_setSelectionByValue(value) {
|
|
240
|
+
this._rawValue = value;
|
|
241
|
+
if (this._items().length === 0) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this._clearSelection();
|
|
245
|
+
this._selectValue(value);
|
|
246
|
+
}
|
|
247
|
+
_selectValue(value) {
|
|
248
|
+
const correspondingItem = this._items().find((item) => item.value() != null && item.value() === value);
|
|
249
|
+
if (correspondingItem) {
|
|
250
|
+
correspondingItem.selected.set(true);
|
|
251
|
+
this._selectionModel?.select(correspondingItem);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
_clearSelection() {
|
|
255
|
+
this._selectionModel?.clear();
|
|
256
|
+
this._items().forEach((item) => {
|
|
257
|
+
item.selected.set(false);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
_handleChange() {
|
|
261
|
+
const selectionModelValues = this._selectionModel?.selected?.map((item) => item.value());
|
|
262
|
+
this._onChange(selectionModelValues?.[0]);
|
|
263
|
+
}
|
|
264
|
+
isItemPreSelectedByValue(itemValue) {
|
|
265
|
+
if (this._rawValue === undefined) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return itemValue === this._rawValue;
|
|
269
|
+
}
|
|
270
|
+
_hasInvalidLabelPosition() {
|
|
271
|
+
const orientation = this.orientation();
|
|
272
|
+
const labelPosition = this.labelPosition();
|
|
273
|
+
return (orientation === IdsOrientation.VERTICAL && Object.values(IdsVerticalPosition).some((pos) => pos === labelPosition));
|
|
274
|
+
}
|
|
275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsRadioGroupDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
276
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.1.2", type: IdsRadioGroupDirective, isStandalone: true, selector: "ids-radio-group", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, valueCompareFn: { classPropertyName: "valueCompareFn", publicName: "valueCompareFn", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: coerceBooleanAttribute } }, outputs: { itemChanges: "itemChanges" }, host: { listeners: { "keydown": "_handleKeyDown($event)" } }, providers: [
|
|
277
|
+
{
|
|
278
|
+
provide: NG_VALUE_ACCESSOR,
|
|
279
|
+
useExisting: forwardRef(() => IdsRadioGroupDirective),
|
|
280
|
+
multi: true,
|
|
281
|
+
},
|
|
282
|
+
], queries: [{ propertyName: "_items", predicate: IdsRadioComponent, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
|
|
283
|
+
}
|
|
284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsRadioGroupDirective, decorators: [{
|
|
285
|
+
type: Directive,
|
|
286
|
+
args: [{
|
|
287
|
+
selector: 'ids-radio-group',
|
|
288
|
+
standalone: true,
|
|
289
|
+
providers: [
|
|
290
|
+
{
|
|
291
|
+
provide: NG_VALUE_ACCESSOR,
|
|
292
|
+
useExisting: forwardRef(() => IdsRadioGroupDirective),
|
|
293
|
+
multi: true,
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
host: {
|
|
297
|
+
'(keydown)': '_handleKeyDown($event)',
|
|
298
|
+
},
|
|
299
|
+
}]
|
|
300
|
+
}], propDecorators: { valueCompareFn: [{
|
|
301
|
+
type: Input
|
|
302
|
+
}], disabled: [{
|
|
303
|
+
type: Input,
|
|
304
|
+
args: [{ transform: coerceBooleanAttribute }]
|
|
305
|
+
}] } });
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Generated bundle index. Do not edit.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
export { IDS_RADIO_DEFAULT_CONFIG, IDS_RADIO_DEFAULT_CONFIG_FACTORY, IdsRadioChangeEvent, IdsRadioComponent, IdsRadioGroupDirective, IdsRadioVariant };
|
|
312
|
+
//# sourceMappingURL=i-cell-ids-angular-radio.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-cell-ids-angular-radio.mjs","sources":["../../../projects/widgets/radio/types/radio-variant.type.ts","../../../projects/widgets/radio/types/radio-events.class.ts","../../../projects/widgets/radio/radio-defaults.ts","../../../projects/widgets/radio/radio.component.ts","../../../projects/widgets/radio/radio.component.html","../../../projects/widgets/radio/radio-group.directive.ts","../../../projects/widgets/radio/i-cell-ids-angular-radio.ts"],"sourcesContent":["export const IdsRadioVariant = {\n SURFACE: 'surface',\n LIGHT: 'light',\n DARK: 'dark',\n} as const;\n\nexport type IdsRadioVariantType = (typeof IdsRadioVariant)[keyof typeof IdsRadioVariant];\n","import { IdsRadioComponent } from '../radio.component';\n\nexport class IdsRadioChangeEvent {\n constructor(\n public source: IdsRadioComponent,\n public value: unknown,\n ) {}\n}\n","import { IdsRadioVariant, IdsRadioVariantType } from './types/radio-variant.type';\n\nimport { InjectionToken } from '@angular/core';\nimport { IdsOrientation, IdsOrientationType, IdsPosition, IdsPositionType, IdsSize, IdsSizeType } from '@i-cell/ids-angular/core';\n\nexport interface IdsRadioDefaultConfig {\n size?: IdsSizeType\n variant?: IdsRadioVariantType\n orientation?: IdsOrientationType\n labelPosition?: IdsPositionType\n}\n\nexport const IDS_RADIO_DEFAULT_CONFIG = new InjectionToken<IdsRadioDefaultConfig>(\n 'IDS_RADIO_DEFAULT_CONFIG',\n {\n providedIn: 'root',\n factory: IDS_RADIO_DEFAULT_CONFIG_FACTORY,\n },\n);\n\nexport function IDS_RADIO_DEFAULT_CONFIG_FACTORY(): Required<IdsRadioDefaultConfig> {\n return {\n size: IdsSize.COMPACT,\n variant: IdsRadioVariant.SURFACE,\n orientation: IdsOrientation.VERTICAL,\n labelPosition: IdsPosition.RIGHT,\n };\n}\n","import { IdsRadioGroupDirective } from './radio-group.directive';\nimport { IdsRadioChangeEvent } from './types/radio-events.class';\n\nimport { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, OnInit, output, signal, viewChild, ViewEncapsulation } from '@angular/core';\nimport { coerceNumberAttribute, ComponentBase } from '@i-cell/ids-angular/core';\n\n@Component({\n selector: 'ids-radio',\n imports: [],\n templateUrl: './radio.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IdsRadioComponent extends ComponentBase implements OnInit {\n protected override get _hostName(): string {\n return 'radio';\n }\n\n private _group = inject(IdsRadioGroupDirective, { optional: true, skipSelf: true });\n\n public selected = signal<boolean>(false);\n\n public inputId = input<string>(this._uniqueId);\n public value = input.required<unknown>();\n public ariaLabel = input<string>('', { alias: 'aria-label' });\n public ariaLabelledBy = input<string>('', { alias: 'aria-labelledby' });\n public ariaDescribedBy = input<string>('', { alias: 'aria-describedby' });\n public tabIndex = input<number, unknown>(0, { transform: coerceNumberAttribute });\n public disabled = input<boolean>(false);\n\n public isDisabled = computed(() => this.disabled() || this._group?.isDisabled());\n public name = computed(() => this._group?.name());\n public required = computed(() => this._group?.required());\n public ariaChecked = computed(() => this.selected());\n protected _hostClasses = computed(() => this._getHostClasses([\n this._group?.variant() ?? null,\n this._group?.labelPosition() ?? null,\n this.isDisabled() ? 'disabled' : null,\n ]));\n\n private _inputElement = viewChild.required<ElementRef<HTMLButtonElement>>('input');\n\n public readonly changes = output<IdsRadioChangeEvent>();\n\n public ngOnInit(): void {\n if (!this._group) {\n throw this._createHostError('component must be direct child of a radio group');\n }\n if (this._group.isItemPreSelectedByValue(this.value())) {\n this.selected.set(true);\n }\n }\n\n public onChange(): void {\n this.changes.emit(new IdsRadioChangeEvent(this, this.value()));\n }\n\n public touchTargetClick(): void {\n if (!this.selected() && !this.isDisabled()) {\n this._inputElement().nativeElement.focus();\n this.onChange();\n }\n }\n\n public innerCircleClick(): void {\n if (!this.selected() && !this.isDisabled()) {\n this._inputElement().nativeElement.focus();\n this.onChange();\n }\n }\n\n public focus(options?: FocusOptions): void {\n this._inputElement().nativeElement.focus(options);\n }\n}\n","<div class=\"ids-radio__input-wrapper\">\n <div class=\"ids-radio__touch-target\" (click)=\"touchTargetClick()\"></div>\n <input\n #input\n class=\"ids-radio__native-control\"\n type=\"radio\"\n [id]=\"inputId()\"\n [checked]=\"selected()\"\n [disabled]=\"isDisabled()\"\n [attr.name]=\"name()\"\n [attr.value]=\"value()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n (change)=\"onChange()\"\n />\n <div class=\"ids-radio__inner-circle\" (click)=\"innerCircleClick()\"></div>\n</div>\n<label class=\"ids-radio__label\" [for]=\"inputId()\">\n <ng-content />\n</label>\n","import { IDS_RADIO_DEFAULT_CONFIG, IDS_RADIO_DEFAULT_CONFIG_FACTORY, IdsRadioDefaultConfig } from './radio-defaults';\nimport { IdsRadioComponent } from './radio.component';\nimport { IdsRadioChangeEvent } from './types/radio-events.class';\nimport { IdsRadioVariantType } from './types/radio-variant.type';\n\nimport { SelectionModel } from '@angular/cdk/collections';\nimport { AfterContentInit, computed, contentChildren, Directive, forwardRef, Input, input, isDevMode, OnInit, output, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { coerceBooleanAttribute, IdsOrientation, IdsOrientationType, IdsPositionType, IdsSizeType, IdsVerticalPosition, ComponentBaseWithDefaults } from '@i-cell/ids-angular/core';\n\nconst defaultConfig = IDS_RADIO_DEFAULT_CONFIG_FACTORY();\n\n@Directive({\n selector: 'ids-radio-group',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => IdsRadioGroupDirective),\n multi: true,\n },\n ],\n host: {\n '(keydown)': '_handleKeyDown($event)',\n },\n})\nexport class IdsRadioGroupDirective\n extends ComponentBaseWithDefaults<IdsRadioDefaultConfig>\n implements OnInit, AfterContentInit, ControlValueAccessor {\n protected override get _hostName(): string {\n return 'radio-group';\n }\n\n protected readonly _defaultConfig = this._getDefaultConfig(defaultConfig, IDS_RADIO_DEFAULT_CONFIG);\n\n private _selectionModel?: SelectionModel<IdsRadioComponent>;\n private _rawValue: unknown;\n private _items = contentChildren<IdsRadioComponent>(IdsRadioComponent);\n\n public name = input.required<string>();\n public required = input<boolean, unknown>(false, { transform: coerceBooleanAttribute });\n public size = input<IdsSizeType>(this._defaultConfig.size);\n public variant = input<IdsRadioVariantType>(this._defaultConfig.variant);\n public orientation = input<IdsOrientationType>(this._defaultConfig.orientation);\n public labelPosition = input<IdsPositionType>(this._defaultConfig.labelPosition);\n public isDisabled = signal<boolean>(false);\n\n protected _hostClasses = computed(() => this._getHostClasses([\n this.size(),\n this.orientation(),\n this.labelPosition(),\n ]));\n\n private _onChange: (value: unknown) => void = () => {};\n private _onTouched: () => unknown = () => {};\n\n @Input() public valueCompareFn?: (o1: IdsRadioComponent, o2: IdsRadioComponent) => boolean;\n @Input({ transform: coerceBooleanAttribute })\n set disabled(value: boolean) {\n if (value !== this.disabled) {\n this.isDisabled.set(value);\n }\n }\n\n public readonly itemChanges = output<IdsRadioChangeEvent>();\n\n private _handleKeyDown(event: KeyboardEvent): void {\n const navigationKeys: Record<IdsOrientationType, Set<string>> = {\n // eslint-disable-next-line @stylistic/js/array-bracket-newline, @stylistic/js/array-element-newline\n horizontal: new Set(['ArrowLeft', 'ArrowRight', 'Enter', ' ']),\n // eslint-disable-next-line @stylistic/js/array-bracket-newline, @stylistic/js/array-element-newline\n vertical: new Set(['ArrowUp', 'ArrowDown', 'Enter', ' ']),\n };\n\n const orientation = this.orientation();\n\n if (navigationKeys.horizontal.has(event.key) || navigationKeys.vertical.has(event.key)) {\n event.preventDefault();\n }\n if (!navigationKeys[orientation].has(event.key)) {\n return;\n }\n\n const items = this._items();\n const target = event.target as HTMLButtonElement;\n const inputId = target.id;\n const index = items.findIndex((item) => item.inputId() === inputId);\n\n switch (event.key) {\n case 'ArrowUp': {\n if (orientation === IdsOrientation.HORIZONTAL) {\n return;\n }\n if (index === 0) {\n return;\n }\n const prevItem = items[index - 1];\n prevItem.focus();\n break;\n }\n case 'ArrowLeft': {\n if (orientation === IdsOrientation.VERTICAL) {\n return;\n }\n if (index === 0) {\n return;\n }\n const prevItem = items[index - 1];\n prevItem.focus();\n break;\n }\n case 'ArrowDown': {\n if (orientation === IdsOrientation.HORIZONTAL) {\n return;\n }\n if (index === (items.length - 1)) {\n return;\n }\n const nextItem = items[index + 1];\n nextItem.focus();\n break;\n }\n case 'ArrowRight': {\n if (orientation === IdsOrientation.VERTICAL) {\n return;\n }\n if (index === (items.length - 1)) {\n return;\n }\n const nextItem = items[index + 1];\n nextItem.focus();\n break;\n }\n case 'Enter':\n case ' ': {\n items[index].onChange();\n break;\n }\n default:\n return;\n }\n }\n\n public ngOnInit(): void {\n this._selectionModel = new SelectionModel<IdsRadioComponent>(false, undefined, false, this.valueCompareFn);\n\n if (this._hasInvalidLabelPosition()) {\n throw this._createHostError('invalid `orientation` + `labelPosition` combination.');\n }\n }\n\n public ngAfterContentInit(): void {\n const items = this._items();\n const minItemCount = 2;\n\n if (isDevMode() && (items.length < minItemCount)) {\n throw this._createHostError('invalid count of radio items. Minimum item count is 2.');\n }\n\n this._selectionModel?.select(...this._items().filter((item) => item.selected()));\n this._subscribeItemChanges();\n }\n\n public writeValue(value: unknown | unknown[]): void {\n this._setSelectionByValue(value);\n }\n\n public registerOnChange(fn: () => void): void {\n this._onChange = fn;\n }\n\n public registerOnTouched(fn: () => unknown): void {\n this._onTouched = fn;\n }\n\n public setDisabledState?(isDisabled: boolean): void {\n this.isDisabled.set(isDisabled);\n }\n\n private _subscribeItemChanges(): void {\n this._items().forEach((item) => {\n item.changes.subscribe(\n (change) => {\n this._handleItemChanges(change);\n },\n );\n });\n }\n\n private _handleItemChanges(change: IdsRadioChangeEvent): void {\n const { source } = change;\n this._clearSelection();\n source.selected.set(true);\n this._selectionModel?.select(source);\n this.itemChanges.emit(change);\n this._handleChange();\n this._onTouched();\n }\n\n private _setSelectionByValue(value: unknown | unknown[]): void {\n this._rawValue = value;\n\n if (this._items().length === 0) {\n return;\n }\n\n this._clearSelection();\n this._selectValue(value);\n }\n\n private _selectValue(value: unknown): void {\n const correspondingItem = this._items().find((item) => item.value() != null && item.value() === value);\n if (correspondingItem) {\n correspondingItem.selected.set(true);\n this._selectionModel?.select(correspondingItem);\n }\n }\n\n private _clearSelection(): void {\n this._selectionModel?.clear();\n this._items().forEach((item) => {\n item.selected.set(false);\n });\n }\n\n private _handleChange(): void {\n const selectionModelValues = this._selectionModel?.selected?.map((item) => item.value());\n this._onChange(selectionModelValues?.[0]);\n }\n\n public isItemPreSelectedByValue(itemValue: unknown): boolean {\n if (this._rawValue === undefined) {\n return false;\n }\n\n return itemValue === this._rawValue;\n }\n\n private _hasInvalidLabelPosition(): boolean {\n const orientation = this.orientation();\n const labelPosition = this.labelPosition();\n\n return (orientation === IdsOrientation.VERTICAL && Object.values(IdsVerticalPosition).some((pos) => pos === labelPosition));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAa,MAAA,eAAe,GA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,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,4BAA4B,CAAC;AACrD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,wBAAwB;AACtC,qBAAA;AACF,iBAAA;8BA+BiB,cAAc,EAAA,CAAA;sBAA7B;gBAEG,QAAQ,EAAA,CAAA;sBADX,KAAK;uBAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE;;;ACzD9C;;AAEG;;;;"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, contentChildren, input, signal, computed, output, isDevMode, forwardRef, Directive, Input, inject, viewChild, Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { IdsSize, ComponentBaseWithDefaults, ComponentBase, coerceNumberAttribute, addClassPrefix } from '@i-cell/ids-angular/core';
|
|
4
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
5
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
+
import { IdsIconComponent } from '@i-cell/ids-angular/icon';
|
|
7
|
+
|
|
8
|
+
const IdsSegmentedControlToggleAppearance = {
|
|
9
|
+
FILLED: 'filled',
|
|
10
|
+
OUTLINED: 'outlined',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
class IdsSegmentedControlToggleItemChange {
|
|
14
|
+
constructor(source, value) {
|
|
15
|
+
this.source = source;
|
|
16
|
+
this.value = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const IdsSegmentedControlToggleVariant = {
|
|
21
|
+
SURFACE: 'surface',
|
|
22
|
+
LIGHT: 'light',
|
|
23
|
+
};
|
|
24
|
+
const IdsSegmentedControlToggleButtonVariant = {
|
|
25
|
+
PRIMARY: 'primary',
|
|
26
|
+
SURFACE: 'surface',
|
|
27
|
+
LIGHT: 'light',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG = new InjectionToken('IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG', {
|
|
31
|
+
providedIn: 'root',
|
|
32
|
+
factory: IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG_FACTORY,
|
|
33
|
+
});
|
|
34
|
+
// eslint-disable-next-line id-length
|
|
35
|
+
function IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG_FACTORY() {
|
|
36
|
+
return {
|
|
37
|
+
appearance: IdsSegmentedControlToggleAppearance.FILLED,
|
|
38
|
+
size: IdsSize.COMPACT,
|
|
39
|
+
variant: IdsSegmentedControlToggleVariant.SURFACE,
|
|
40
|
+
buttonVariant: IdsSegmentedControlToggleButtonVariant.SURFACE,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const defaultConfig = IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG_FACTORY();
|
|
45
|
+
class IdsSegmentedControlToggleDirective extends ComponentBaseWithDefaults {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
this._defaultConfig = this._getDefaultConfig(defaultConfig, IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG);
|
|
49
|
+
this._items = contentChildren(IdsSegmentedControlToggleItemComponent);
|
|
50
|
+
this.name = input();
|
|
51
|
+
this.size = input(this._defaultConfig.size);
|
|
52
|
+
this.variant = input(this._defaultConfig.variant);
|
|
53
|
+
this.buttonVariant = input(this._defaultConfig.buttonVariant);
|
|
54
|
+
this.appearance = input(this._defaultConfig.appearance);
|
|
55
|
+
this.disabled = signal(false);
|
|
56
|
+
this._hostClasses = computed(() => this._getHostClasses([
|
|
57
|
+
this.size(),
|
|
58
|
+
this.variant(),
|
|
59
|
+
this.appearance(),
|
|
60
|
+
this.disabled() ? 'disabled' : null,
|
|
61
|
+
]));
|
|
62
|
+
this._onChange = () => { };
|
|
63
|
+
this._onTouched = () => { };
|
|
64
|
+
this.itemChanges = output();
|
|
65
|
+
}
|
|
66
|
+
get _hostName() {
|
|
67
|
+
return 'segmented-control-toggle';
|
|
68
|
+
}
|
|
69
|
+
_handleKeyDown(event) {
|
|
70
|
+
// eslint-disable-next-line @stylistic/js/array-bracket-newline, @stylistic/js/array-element-newline
|
|
71
|
+
const navigationKeys = ['ArrowLeft', 'ArrowRight', 'Enter', ' '];
|
|
72
|
+
if (!navigationKeys.includes(event.key)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
const items = this._items();
|
|
77
|
+
const target = event.target;
|
|
78
|
+
const buttonId = target.id;
|
|
79
|
+
const index = items.findIndex((item) => item.id() === buttonId);
|
|
80
|
+
switch (event.key) {
|
|
81
|
+
case 'ArrowLeft': {
|
|
82
|
+
if (index === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const prevItem = items[index - 1];
|
|
86
|
+
prevItem.focus();
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case 'ArrowRight': {
|
|
90
|
+
if (index === (items.length - 1)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const nextItem = items[index + 1];
|
|
94
|
+
nextItem.focus();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'Enter':
|
|
98
|
+
case ' ': {
|
|
99
|
+
items[index].onClick();
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
default:
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ngOnInit() {
|
|
107
|
+
this._selectionModel = new SelectionModel(false, undefined, false, this.valueCompareFn);
|
|
108
|
+
}
|
|
109
|
+
ngAfterContentInit() {
|
|
110
|
+
const items = this._items();
|
|
111
|
+
const minItemCount = 2;
|
|
112
|
+
if (isDevMode() && (items.length < minItemCount)) {
|
|
113
|
+
throw this._createHostError('invalid count of segmented control items. Minimum item count is 2.');
|
|
114
|
+
}
|
|
115
|
+
this._selectionModel?.select(...this._items().filter((item) => item.selected()));
|
|
116
|
+
this._subscribeItemChanges();
|
|
117
|
+
}
|
|
118
|
+
writeValue(value) {
|
|
119
|
+
this._setSelectionByValue(value);
|
|
120
|
+
}
|
|
121
|
+
registerOnChange(fn) {
|
|
122
|
+
this._onChange = fn;
|
|
123
|
+
}
|
|
124
|
+
registerOnTouched(fn) {
|
|
125
|
+
this._onTouched = fn;
|
|
126
|
+
}
|
|
127
|
+
setDisabledState(isDisabled) {
|
|
128
|
+
this.disabled.set(isDisabled);
|
|
129
|
+
}
|
|
130
|
+
_subscribeItemChanges() {
|
|
131
|
+
this._items().forEach((item) => {
|
|
132
|
+
item.changes.subscribe((change) => {
|
|
133
|
+
this._handleItemChanges(change);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
_handleItemChanges(change) {
|
|
138
|
+
const { source } = change;
|
|
139
|
+
this._clearSelection();
|
|
140
|
+
source.selected.set(true);
|
|
141
|
+
this._selectionModel?.select(source);
|
|
142
|
+
this.itemChanges.emit(change);
|
|
143
|
+
this._handleChange();
|
|
144
|
+
this._onTouched();
|
|
145
|
+
}
|
|
146
|
+
_setSelectionByValue(value) {
|
|
147
|
+
this._rawValue = value;
|
|
148
|
+
if (this._items().length === 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this._clearSelection();
|
|
152
|
+
this._selectValue(value);
|
|
153
|
+
}
|
|
154
|
+
_selectValue(value) {
|
|
155
|
+
const correspondingItem = this._items().find((item) => item.value() != null && item.value() === value);
|
|
156
|
+
if (correspondingItem) {
|
|
157
|
+
correspondingItem.selected.set(true);
|
|
158
|
+
this._selectionModel?.select(correspondingItem);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_clearSelection() {
|
|
162
|
+
this._selectionModel?.clear();
|
|
163
|
+
this._items().forEach((item) => {
|
|
164
|
+
item.selected.set(false);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
_handleChange() {
|
|
168
|
+
const selectionModelValues = this._selectionModel?.selected?.map((item) => item.value());
|
|
169
|
+
this._onChange(selectionModelValues?.[0]);
|
|
170
|
+
}
|
|
171
|
+
isItemPreSelectedByValue(itemValue) {
|
|
172
|
+
if (this._rawValue === undefined) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
return itemValue === this._rawValue;
|
|
176
|
+
}
|
|
177
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsSegmentedControlToggleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
178
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.1.2", type: IdsSegmentedControlToggleDirective, isStandalone: true, selector: "ids-segmented-control-toggle[ngModel]:not([formControl]):not([formControlName]),\n ids-segmented-control-toggle[formControl]:not([ngModel]):not([formControlName]),\n ids-segmented-control-toggle[formControlName]:not([ngModel]):not([formControl])", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, buttonVariant: { classPropertyName: "buttonVariant", publicName: "buttonVariant", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueCompareFn: { classPropertyName: "valueCompareFn", publicName: "valueCompareFn", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { itemChanges: "itemChanges" }, host: { listeners: { "keydown": "_handleKeyDown($event)" }, properties: { "attr.role": "radiogroup" } }, providers: [
|
|
179
|
+
{
|
|
180
|
+
provide: NG_VALUE_ACCESSOR,
|
|
181
|
+
useExisting: forwardRef(() => IdsSegmentedControlToggleDirective),
|
|
182
|
+
multi: true,
|
|
183
|
+
},
|
|
184
|
+
], queries: [{ propertyName: "_items", predicate: IdsSegmentedControlToggleItemComponent, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
|
|
185
|
+
}
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsSegmentedControlToggleDirective, decorators: [{
|
|
187
|
+
type: Directive,
|
|
188
|
+
args: [{
|
|
189
|
+
selector: `ids-segmented-control-toggle[ngModel]:not([formControl]):not([formControlName]),
|
|
190
|
+
ids-segmented-control-toggle[formControl]:not([ngModel]):not([formControlName]),
|
|
191
|
+
ids-segmented-control-toggle[formControlName]:not([ngModel]):not([formControl])`,
|
|
192
|
+
standalone: true,
|
|
193
|
+
providers: [
|
|
194
|
+
{
|
|
195
|
+
provide: NG_VALUE_ACCESSOR,
|
|
196
|
+
useExisting: forwardRef(() => IdsSegmentedControlToggleDirective),
|
|
197
|
+
multi: true,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
host: {
|
|
201
|
+
'[attr.role]': 'radiogroup',
|
|
202
|
+
'(keydown)': '_handleKeyDown($event)',
|
|
203
|
+
},
|
|
204
|
+
}]
|
|
205
|
+
}], propDecorators: { valueCompareFn: [{
|
|
206
|
+
type: Input
|
|
207
|
+
}] } });
|
|
208
|
+
|
|
209
|
+
class IdsSegmentedControlToggleItemComponent extends ComponentBase {
|
|
210
|
+
constructor() {
|
|
211
|
+
super(...arguments);
|
|
212
|
+
this._group = inject(IdsSegmentedControlToggleDirective, { optional: true, skipSelf: true });
|
|
213
|
+
this._buttonElement = viewChild.required('button');
|
|
214
|
+
this.selected = signal(false);
|
|
215
|
+
this.name = input();
|
|
216
|
+
this.value = input.required();
|
|
217
|
+
this.label = input();
|
|
218
|
+
this.ariaLabel = input('', { alias: 'aria-label' });
|
|
219
|
+
this.ariaLabelledBy = input('', { alias: 'aria-labeledby' });
|
|
220
|
+
this.tabIndex = input(0, { transform: coerceNumberAttribute });
|
|
221
|
+
this.disabled = input(false);
|
|
222
|
+
this._buttonId = computed(() => `${this.id()}-button`);
|
|
223
|
+
this._parentOrSelfDisabled = computed(() => this.disabled() || this._group?.disabled());
|
|
224
|
+
this._ariaPressed = signal(null); // it is signal because of the common template
|
|
225
|
+
this._ariaChecked = computed(() => this.selected());
|
|
226
|
+
this._role = signal('radio'); // it is signal because of the common template
|
|
227
|
+
this._buttonName = computed(() => this._group?.name());
|
|
228
|
+
this._buttonClasses = computed(() => addClassPrefix(this._hostClassName, this.selected() ? 'selected' : null));
|
|
229
|
+
this._hostClasses = computed(() => this._getHostClasses([this._group?.buttonVariant()]));
|
|
230
|
+
this.changes = output();
|
|
231
|
+
}
|
|
232
|
+
get _hostName() {
|
|
233
|
+
return 'segmented-control-toggle-item';
|
|
234
|
+
}
|
|
235
|
+
ngOnInit() {
|
|
236
|
+
if (!this._group) {
|
|
237
|
+
throw this._createHostError('component must be direct child of a segmented control toggle');
|
|
238
|
+
}
|
|
239
|
+
if (this._group.isItemPreSelectedByValue(this.value())) {
|
|
240
|
+
this.selected.set(true);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
onClick() {
|
|
244
|
+
if (!this.selected()) {
|
|
245
|
+
this.changes.emit(new IdsSegmentedControlToggleItemChange(this, this.value()));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
focus(options) {
|
|
249
|
+
this._buttonElement().nativeElement.focus(options);
|
|
250
|
+
}
|
|
251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsSegmentedControlToggleItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.2", type: IdsSegmentedControlToggleItemComponent, isStandalone: true, selector: "ids-segmented-control-toggle-item", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labeledby", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changes: "changes" }, viewQueries: [{ propertyName: "_buttonElement", first: true, predicate: ["button"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<button\n #button\n type=\"button\"\n [id]=\"_buttonId()\"\n [attr.role]=\"_role()\"\n [attr.tabindex]=\"_parentOrSelfDisabled() ? -1 : tabIndex()\"\n [attr.aria-pressed]=\"_ariaPressed()\"\n [attr.aria-checked]=\"_ariaChecked()\"\n [disabled]=\"_parentOrSelfDisabled() || null\"\n [attr.name]=\"_buttonName()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [class]=\"_buttonClasses()\"\n (click)=\"onClick()\"\n>\n @if (selected()) {\n <ids-icon aria-hidden=\"true\" fontIcon=\"check\" />\n }\n @if (!selected() || !label()) {\n <ng-content select=\"ids-icon\" />\n }\n\n {{ label() }}\n\n <ng-content select=\"[suffixContent]\" />\n</button>\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
253
|
+
}
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: IdsSegmentedControlToggleItemComponent, decorators: [{
|
|
255
|
+
type: Component,
|
|
256
|
+
args: [{ selector: 'ids-segmented-control-toggle-item', imports: [IdsIconComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n #button\n type=\"button\"\n [id]=\"_buttonId()\"\n [attr.role]=\"_role()\"\n [attr.tabindex]=\"_parentOrSelfDisabled() ? -1 : tabIndex()\"\n [attr.aria-pressed]=\"_ariaPressed()\"\n [attr.aria-checked]=\"_ariaChecked()\"\n [disabled]=\"_parentOrSelfDisabled() || null\"\n [attr.name]=\"_buttonName()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n [class]=\"_buttonClasses()\"\n (click)=\"onClick()\"\n>\n @if (selected()) {\n <ids-icon aria-hidden=\"true\" fontIcon=\"check\" />\n }\n @if (!selected() || !label()) {\n <ng-content select=\"ids-icon\" />\n }\n\n {{ label() }}\n\n <ng-content select=\"[suffixContent]\" />\n</button>\n" }]
|
|
257
|
+
}] });
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Generated bundle index. Do not edit.
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
export { IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG, IDS_SEGMENTED_CONTROL_TOGGLE_DEFAULT_CONFIG_FACTORY, IdsSegmentedControlToggleAppearance, IdsSegmentedControlToggleButtonVariant, IdsSegmentedControlToggleDirective, IdsSegmentedControlToggleItemChange, IdsSegmentedControlToggleItemComponent, IdsSegmentedControlToggleVariant };
|
|
264
|
+
//# sourceMappingURL=i-cell-ids-angular-segmented-control-toggle.mjs.map
|