@danske/sapphire-angular 2.2.0 → 2.4.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.
Files changed (69) hide show
  1. package/esm2020/lib/checkbox/src/checkbox.component.mjs +20 -4
  2. package/esm2020/lib/checkbox/src/checkbox.module.mjs +4 -3
  3. package/esm2020/lib/field/src/field-control.mjs +1 -1
  4. package/esm2020/lib/field/src/field.component.mjs +24 -9
  5. package/esm2020/lib/listbox/src/listbox.component.mjs +2 -2
  6. package/esm2020/lib/menu/src/menu-trigger.directive.mjs +10 -4
  7. package/esm2020/lib/menu/src/menu.component.mjs +2 -2
  8. package/esm2020/lib/modal/src/dialog/dialog-trigger.directive.mjs +3 -8
  9. package/esm2020/lib/modal/src/modal-trigger.directive.mjs +13 -11
  10. package/esm2020/lib/modal/src/modal.service.mjs +5 -4
  11. package/esm2020/lib/modal/src/panel/panel-trigger.directive.mjs +3 -8
  12. package/esm2020/lib/popover/src/popover-trigger.directive.mjs +11 -11
  13. package/esm2020/lib/popover/src/popover.component.mjs +2 -2
  14. package/esm2020/lib/radio/public_api.mjs +3 -1
  15. package/esm2020/lib/radio/src/radio-group.component.mjs +22 -159
  16. package/esm2020/lib/radio/src/radio.component.mjs +8 -267
  17. package/esm2020/lib/radio/src/radio.module.mjs +40 -6
  18. package/esm2020/lib/radio/src/segmented/segmented-radio-group.component.mjs +130 -0
  19. package/esm2020/lib/radio/src/segmented/segmented-radio.component.mjs +25 -0
  20. package/esm2020/lib/radio/src/shared/radio-base.mjs +276 -0
  21. package/esm2020/lib/radio/src/shared/radio-group-base.mjs +166 -0
  22. package/esm2020/lib/segmented-tabs/src/segmented-tab.component.mjs +2 -2
  23. package/esm2020/lib/segmented-tabs/src/segmented-tabs.component.mjs +19 -12
  24. package/esm2020/lib/select/src/basic-select/basic-select.component.mjs +2 -2
  25. package/esm2020/lib/select/src/select/select.component.mjs +4 -3
  26. package/esm2020/lib/table/public_api.mjs +2 -1
  27. package/esm2020/lib/table/src/cdk-virtual-scroll-viewport-fix.directive.mjs +61 -0
  28. package/esm2020/lib/table/src/table.module.mjs +7 -2
  29. package/esm2020/lib/text-field/src/text-field.component.mjs +4 -3
  30. package/esm2020/lib/theme/public_api.mjs +2 -2
  31. package/esm2020/lib/theme/src/sapphire-overlay.service.mjs +62 -0
  32. package/esm2020/lib/theme/src/theme-base.directive.mjs +6 -46
  33. package/esm2020/lib/theme/src/theme.module.mjs +3 -29
  34. package/esm2020/lib/theme/src/themes.mjs +4 -4
  35. package/esm2020/lib/tooltip/src/tooltip.directive.mjs +4 -4
  36. package/fesm2015/danske-sapphire-angular.mjs +645 -377
  37. package/fesm2015/danske-sapphire-angular.mjs.map +1 -1
  38. package/fesm2020/danske-sapphire-angular.mjs +643 -377
  39. package/fesm2020/danske-sapphire-angular.mjs.map +1 -1
  40. package/lib/checkbox/src/checkbox.component.d.ts +6 -1
  41. package/lib/checkbox/src/checkbox.module.d.ts +4 -3
  42. package/lib/field/src/field-control.d.ts +1 -0
  43. package/lib/field/src/field.component.d.ts +11 -3
  44. package/lib/modal/src/dialog/dialog-trigger.directive.d.ts +0 -3
  45. package/lib/modal/src/modal-trigger.directive.d.ts +3 -2
  46. package/lib/modal/src/modal.service.d.ts +10 -2
  47. package/lib/modal/src/panel/panel-trigger.directive.d.ts +0 -3
  48. package/lib/popover/src/popover-trigger.directive.d.ts +4 -3
  49. package/lib/radio/public_api.d.ts +2 -0
  50. package/lib/radio/src/radio-group.component.d.ts +5 -60
  51. package/lib/radio/src/radio.component.d.ts +4 -96
  52. package/lib/radio/src/radio.module.d.ts +8 -5
  53. package/lib/radio/src/segmented/segmented-radio-group.component.d.ts +40 -0
  54. package/lib/radio/src/segmented/segmented-radio.component.d.ts +8 -0
  55. package/lib/radio/src/shared/radio-base.d.ts +103 -0
  56. package/lib/radio/src/shared/radio-group-base.d.ts +63 -0
  57. package/lib/segmented-tabs/src/segmented-tabs.component.d.ts +3 -2
  58. package/lib/select/src/select/select.component.d.ts +1 -0
  59. package/lib/table/public_api.d.ts +1 -0
  60. package/lib/table/src/cdk-virtual-scroll-viewport-fix.directive.d.ts +25 -0
  61. package/lib/table/src/table-cell.directive.d.ts +1 -1
  62. package/lib/table/src/table.module.d.ts +3 -2
  63. package/lib/text-field/src/text-field.component.d.ts +1 -0
  64. package/lib/theme/public_api.d.ts +1 -1
  65. package/lib/theme/src/sapphire-overlay.service.d.ts +34 -0
  66. package/lib/tooltip/src/tooltip.directive.d.ts +2 -2
  67. package/package.json +3 -3
  68. package/esm2020/lib/theme/src/sapphire-overlay-container.service.mjs +0 -37
  69. package/lib/theme/src/sapphire-overlay-container.service.d.ts +0 -14
@@ -45,6 +45,10 @@ export declare class CheckboxComponent extends _CheckboxMixinBase implements Aft
45
45
  get _inputId(): string;
46
46
  /** Whether the checkbox is required. */
47
47
  required: BooleanInput;
48
+ /**
49
+ * Whether the necessity indicator should be visible.
50
+ */
51
+ necessityIndicator?: BooleanInput;
48
52
  /**
49
53
  * Whether the checkbox is readonly.
50
54
  */
@@ -89,6 +93,7 @@ export declare class CheckboxComponent extends _CheckboxMixinBase implements Aft
89
93
  get indeterminate(): boolean;
90
94
  set indeterminate(value: BooleanInput);
91
95
  private _indeterminate;
96
+ get labelNecessityIndicator(): 'optional' | 'required' | undefined;
92
97
  writeValue(value: any): void;
93
98
  registerOnChange(fn: (value: any) => void): void;
94
99
  registerOnTouched(fn: any): void;
@@ -111,6 +116,6 @@ export declare class CheckboxComponent extends _CheckboxMixinBase implements Aft
111
116
  */
112
117
  private syncIndeterminate;
113
118
  static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxComponent, [{ optional: true; }, null, null, { attribute: "tabindex"; }]>;
114
- static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxComponent, "sp-checkbox", ["spCheckbox"], { "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "id": "id"; "required": "required"; "readonly": "readonly"; "name": "name"; "size": "size"; "value": "value"; "selected": "selected"; "disabled": "disabled"; "indeterminate": "indeterminate"; }, { "change": "change"; }, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
119
+ static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxComponent, "sp-checkbox", ["spCheckbox"], { "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "id": "id"; "required": "required"; "necessityIndicator": "necessityIndicator"; "readonly": "readonly"; "name": "name"; "size": "size"; "value": "value"; "selected": "selected"; "disabled": "disabled"; "indeterminate": "indeterminate"; }, { "change": "change"; }, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
115
120
  }
116
121
  export {};
@@ -3,10 +3,11 @@ import * as i1 from "./checkbox.component";
3
3
  import * as i2 from "./checkbox-required-validator";
4
4
  import * as i3 from "./checkbox-group.component";
5
5
  import * as i4 from "@angular/common";
6
- import * as i5 from "@angular/forms";
7
- import * as i6 from "@angular/cdk/a11y";
6
+ import * as i5 from "../../common/translate.pipe";
7
+ import * as i6 from "@angular/forms";
8
+ import * as i7 from "@angular/cdk/a11y";
8
9
  export declare class SapphireCheckboxModule {
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<SapphireCheckboxModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<SapphireCheckboxModule, [typeof i1.CheckboxComponent, typeof i2.SapphireCheckboxRequiredValidator, typeof i3.CheckboxGroupComponent], [typeof i4.CommonModule, typeof i5.FormsModule, typeof i6.A11yModule], [typeof i1.CheckboxComponent, typeof i2.SapphireCheckboxRequiredValidator, typeof i3.CheckboxGroupComponent]>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SapphireCheckboxModule, [typeof i1.CheckboxComponent, typeof i2.SapphireCheckboxRequiredValidator, typeof i3.CheckboxGroupComponent], [typeof i4.CommonModule, typeof i5.TranslatePipe, typeof i6.FormsModule, typeof i7.A11yModule], [typeof i1.CheckboxComponent, typeof i2.SapphireCheckboxRequiredValidator, typeof i3.CheckboxGroupComponent]>;
11
12
  static ɵinj: i0.ɵɵInjectorDeclaration<SapphireCheckboxModule>;
12
13
  }
@@ -12,5 +12,6 @@ export declare abstract class FieldControl {
12
12
  * element.
13
13
  */
14
14
  getId?(): string | undefined;
15
+ hasDefaultWidth?: boolean;
15
16
  abstract isDisabled(): boolean;
16
17
  }
@@ -43,13 +43,16 @@ export declare class FieldComponent implements AfterContentInit, AfterViewChecke
43
43
  * @default "above"
44
44
  */
45
45
  labelPlacement?: 'side' | 'above';
46
+ /**
47
+ * Avoid the default width
48
+ */
49
+ noDefaultWidth?: BooleanInput;
46
50
  /**
47
51
  * @default "lg"
48
52
  */
49
53
  size?: 'lg' | 'md';
50
54
  note?: FieldNoteDirective;
51
55
  error?: FieldErrorDirective;
52
- radioGroup?: RadioGroupComponent;
53
56
  label?: LabelComponent;
54
57
  _fieldLabel?: FieldLabelDirective;
55
58
  /**
@@ -57,6 +60,7 @@ export declare class FieldComponent implements AfterContentInit, AfterViewChecke
57
60
  * that are meant to rendered inside sp-field, provide FieldControl.
58
61
  */
59
62
  controls?: QueryList<FieldControl>;
63
+ radioGroup?: RadioGroupComponent;
60
64
  private requiredValidator?;
61
65
  /**
62
66
  * Is set via field-note-affix directive. ContentChild query can't be used since we need
@@ -76,6 +80,10 @@ export declare class FieldComponent implements AfterContentInit, AfterViewChecke
76
80
  * If there are multiple controls, the field is only disabled when all of them are disabled
77
81
  */
78
82
  isDisabled(): boolean;
83
+ /**
84
+ * If any of the controls should be constrained by the field's default widht
85
+ */
86
+ controlHasDefaultWidth(): boolean;
79
87
  /**
80
88
  * Only support features like `for` or `labelClick` if the field has one control.
81
89
  */
@@ -84,9 +92,9 @@ export declare class FieldComponent implements AfterContentInit, AfterViewChecke
84
92
  /**
85
93
  * Whether the field control is radio group (sp-radio-group).
86
94
  */
87
- hasFieldGroupChild(): boolean;
95
+ hasRadioGroupChild(): boolean;
88
96
  get labelNecessityIndicator(): LabelComponent['necessityIndicator'];
89
97
  _setSuffixPortal(portal: DomPortal<HTMLElement> | null): void;
90
98
  static ɵfac: i0.ɵɵFactoryDeclaration<FieldComponent, never>;
91
- static ɵcmp: i0.ɵɵComponentDeclaration<FieldComponent, "sp-field", never, { "necessityIndicator": "necessityIndicator"; "labelPlacement": "labelPlacement"; "size": "size"; }, {}, ["note", "error", "radioGroup", "_fieldLabel", "requiredValidator", "controls"], ["sp-field-label", "sp-help-button", "*", "sp-field-error", "sp-field-note"], false, [{ directive: typeof i1.UseComponentStylesOnHost; inputs: {}; outputs: {}; }]>;
99
+ static ɵcmp: i0.ɵɵComponentDeclaration<FieldComponent, "sp-field", never, { "necessityIndicator": "necessityIndicator"; "labelPlacement": "labelPlacement"; "noDefaultWidth": "noDefaultWidth"; "size": "size"; }, {}, ["note", "error", "_fieldLabel", "radioGroup", "requiredValidator", "controls"], ["sp-field-label", "sp-help-button", "*", "sp-field-error", "sp-field-note"], false, [{ directive: typeof i1.UseComponentStylesOnHost; inputs: {}; outputs: {}; }]>;
92
100
  }
@@ -1,12 +1,9 @@
1
1
  import { ModalTriggerDirective } from '../modal-trigger.directive';
2
- import { ModalService } from '../modal.service';
3
2
  import * as i0 from "@angular/core";
4
3
  /**
5
4
  * Makes a clickable element a trigger for a dialog.
6
5
  */
7
6
  export declare class DialogTriggerDirective extends ModalTriggerDirective {
8
- protected modalService: ModalService;
9
- constructor(modalService: ModalService);
10
7
  open(): void;
11
8
  static ɵfac: i0.ɵɵFactoryDeclaration<DialogTriggerDirective, never>;
12
9
  static ɵdir: i0.ɵɵDirectiveDeclaration<DialogTriggerDirective, "[spDialogTriggerFor]", ["spDialogTrigger"], { "dismissable": "spDialogDismissable"; "keyboardDismissDisabled": "spDialogDisableKeyboardDismissable"; "templateRef": "spDialogTriggerFor"; }, {}, never, never, false, never>;
@@ -2,12 +2,12 @@ import { TemplateRef } from '@angular/core';
2
2
  import { DialogRef } from '@angular/cdk/dialog';
3
3
  import { BooleanInput } from '@angular/cdk/coercion';
4
4
  import { ModalOptions, ModalService } from './modal.service';
5
+ import { ThemeBaseDirective } from '../../theme/public_api';
5
6
  import * as i0 from "@angular/core";
6
7
  /**
7
8
  * Makes a clickable element a trigger for a modal
8
9
  */
9
10
  export declare abstract class ModalTriggerDirective implements ModalOptions {
10
- protected modalService: ModalService;
11
11
  protected templateRef: TemplateRef<unknown> | null;
12
12
  protected dialogRef?: DialogRef;
13
13
  get dismissable(): boolean;
@@ -16,7 +16,8 @@ export declare abstract class ModalTriggerDirective implements ModalOptions {
16
16
  get keyboardDismissDisabled(): boolean;
17
17
  set keyboardDismissDisabled(value: BooleanInput);
18
18
  private _keyboardDismissDisabled;
19
- constructor(modalService: ModalService);
19
+ protected modalService: ModalService;
20
+ readonly theme: ThemeBaseDirective;
20
21
  abstract open(): void;
21
22
  close(): void;
22
23
  static ɵfac: i0.ɵɵFactoryDeclaration<ModalTriggerDirective, never>;
@@ -1,6 +1,8 @@
1
1
  import { Dialog, DialogRef } from '@angular/cdk/dialog';
2
- import { ComponentType, Overlay } from '@angular/cdk/overlay';
2
+ import { ComponentType } from '@angular/cdk/overlay';
3
3
  import { TemplateRef } from '@angular/core';
4
+ import { SapphireOverlay } from '../../theme/src/sapphire-overlay.service';
5
+ import { ThemeBaseDirective } from '../../theme/src/theme-base.directive';
4
6
  import * as i0 from "@angular/core";
5
7
  export interface ModalOptions {
6
8
  /**
@@ -13,11 +15,17 @@ export interface ModalOptions {
13
15
  * @default false
14
16
  */
15
17
  keyboardDismissDisabled?: boolean;
18
+ /**
19
+ * The theme to apply on the opened modal. It allows for injecting and
20
+ * passing along the "current" theme, when `ModalService` is used in a
21
+ * trigger component.
22
+ */
23
+ theme?: ThemeBaseDirective;
16
24
  }
17
25
  export declare class ModalService {
18
26
  private cdkDialog;
19
27
  private overlay;
20
- constructor(cdkDialog: Dialog, overlay: Overlay);
28
+ constructor(cdkDialog: Dialog, overlay: SapphireOverlay);
21
29
  private open;
22
30
  openDialog<C = unknown>(componentOrTemplateRef: ComponentType<C> | TemplateRef<C>, options?: ModalOptions): DialogRef<unknown, C>;
23
31
  openPanel<C = unknown>(componentOrTemplateRef: ComponentType<C> | TemplateRef<C>, options?: ModalOptions): DialogRef<unknown, C>;
@@ -1,12 +1,9 @@
1
1
  import { ModalTriggerDirective } from '../modal-trigger.directive';
2
- import { ModalService } from '../modal.service';
3
2
  import * as i0 from "@angular/core";
4
3
  /**
5
4
  * Makes a clickable element a trigger for a panel.
6
5
  */
7
6
  export declare class PanelTriggerDirective extends ModalTriggerDirective {
8
- protected modalService: ModalService;
9
- constructor(modalService: ModalService);
10
7
  open(): void;
11
8
  static ɵfac: i0.ɵɵFactoryDeclaration<PanelTriggerDirective, never>;
12
9
  static ɵdir: i0.ɵɵDirectiveDeclaration<PanelTriggerDirective, "[spPanelTriggerFor]", ["spPanelTrigger"], { "dismissable": "spPanelDismissable"; "keyboardDismissDisabled": "spPanelDisableKeyboardDismissable"; "templateRef": "spPanelTriggerFor"; }, {}, never, never, false, never>;
@@ -1,8 +1,9 @@
1
- import { Overlay, OverlayRef } from '@angular/cdk/overlay';
1
+ import { OverlayRef } from '@angular/cdk/overlay';
2
2
  import { ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, Injector, TemplateRef, ViewContainerRef } from '@angular/core';
3
3
  import { Subject } from 'rxjs';
4
4
  import { Placement } from '../../common/placement';
5
5
  import { BooleanInput } from '@angular/cdk/coercion';
6
+ import { SapphireOverlay } from '../../theme/src/sapphire-overlay.service';
6
7
  import * as i0 from "@angular/core";
7
8
  export interface PopoverTrigger {
8
9
  toggle(): void;
@@ -13,7 +14,7 @@ export interface PopoverTrigger {
13
14
  export declare const POPOVER_TRIGGER: InjectionToken<PopoverTrigger>;
14
15
  export declare class PopoverTriggerDirective implements PopoverTrigger {
15
16
  private changeDetectorRef;
16
- private cdkOverlay;
17
+ private overlay;
17
18
  private viewContainerRef;
18
19
  elementRef: ElementRef<HTMLElement>;
19
20
  private injector;
@@ -52,7 +53,7 @@ export declare class PopoverTriggerDirective implements PopoverTrigger {
52
53
  protected overlayRef: OverlayRef | null;
53
54
  private isBeingPressed;
54
55
  get getPopoverId(): string | undefined;
55
- constructor(changeDetectorRef: ChangeDetectorRef, cdkOverlay: Overlay, viewContainerRef: ViewContainerRef, elementRef: ElementRef<HTMLElement>, injector: Injector);
56
+ constructor(changeDetectorRef: ChangeDetectorRef, overlay: SapphireOverlay, viewContainerRef: ViewContainerRef, elementRef: ElementRef<HTMLElement>, injector: Injector);
56
57
  ngOnDestroy(): void;
57
58
  /** Toggle the attached popover. */
58
59
  toggle(): void;
@@ -1,3 +1,5 @@
1
1
  export * from './src/radio.component';
2
2
  export * from './src/radio-group.component';
3
3
  export * from './src/radio.module';
4
+ export * from './src/segmented/segmented-radio.component';
5
+ export * from './src/segmented/segmented-radio-group.component';
@@ -1,65 +1,10 @@
1
- import { ChangeDetectorRef, EventEmitter } from '@angular/core';
2
- import { RadioComponent, SapphireRadioChange } from './radio.component';
3
- import { ControlValueAccessor } from '@angular/forms';
4
- import { BooleanInput } from '@angular/cdk/coercion';
1
+ import { RadioGroupBase } from './shared/radio-group-base';
5
2
  import { FocusOrigin } from '@angular/cdk/a11y';
6
- import { FieldControl } from '../../field/src/field-control';
7
- import { FieldComponent } from '../../field/src/field.component';
8
3
  import * as i0 from "@angular/core";
9
4
  import * as i1 from "../../theme/src/theme-check.directive";
10
- export declare class RadioGroupComponent implements ControlValueAccessor, FieldControl {
11
- private changeDetectorRef;
12
- _field: FieldComponent;
13
- uniqueId: string;
5
+ export declare class RadioGroupComponent extends RadioGroupBase {
14
6
  orientation: 'vertical' | 'horizontal';
15
- /** Name of the radio button group. All radio buttons inside this group will use this name. */
16
- get name(): string;
17
- set name(value: string);
18
- private _name;
19
- /**
20
- * Event emitted when the group value changes.
21
- * Change events are only emitted when the value changes due to user interaction with
22
- * the radio button (the same behavior as `<input type-"radio">`).
23
- */
24
- readonly change: EventEmitter<SapphireRadioChange>;
25
- get value(): any;
26
- set value(newValue: any);
27
- private _value;
28
- /**
29
- * The currently selected radio button. If set to a new radio button, the radio group value
30
- * will be updated to match the new selected button. */
31
- get selected(): RadioComponent | null;
32
- set selected(selected: RadioComponent | null);
33
- private _selected;
34
- /** Whether the radio group is disabled */
35
- get disabled(): boolean;
36
- set disabled(value: BooleanInput);
37
- private _disabled;
38
- /** Whether the radio group is readonly */
39
- get readonly(): boolean;
40
- set readonly(value: BooleanInput);
41
- private _readonly;
42
- /** Whether the radio group is required */
43
- get required(): boolean;
44
- set required(value: BooleanInput);
45
- private _required;
46
- /** Child radio buttons. */
47
- private radios;
48
- private onTouched;
49
- _controlValueAccessorChangeFn: (value: any) => void;
50
- constructor(changeDetectorRef: ChangeDetectorRef, _field: FieldComponent);
51
- _checkSelectedRadioButton(): void;
52
- /** Dispatch change event with current selection and group value. */
53
- _emitChangeEvent(): void;
54
- writeValue(value: any): void;
55
- registerOnChange(fn: (value: any) => void): void;
56
- registerOnTouched(fn: any): void;
57
- setDisabledState(disabled: boolean): void;
58
- isDisabled(): boolean;
59
- _contentFocusChanged(focusOrigin: FocusOrigin): void;
60
- /** Updates the `selected` radio button from the internal _value state. */
61
- private updateSelectedRadioFromValue;
62
- private updateRadioButtonNames;
63
- static ɵfac: i0.ɵɵFactoryDeclaration<RadioGroupComponent, [null, { optional: true; }]>;
64
- static ɵcmp: i0.ɵɵComponentDeclaration<RadioGroupComponent, "sp-radio-group", never, { "orientation": "orientation"; "name": "name"; "value": "value"; "selected": "selected"; "disabled": "disabled"; "readonly": "readonly"; "required": "required"; }, { "change": "change"; }, ["radios"], ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
7
+ _onFocusChange(focusOrigin: FocusOrigin): void;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<RadioGroupComponent, never>;
9
+ static ɵcmp: i0.ɵɵComponentDeclaration<RadioGroupComponent, "sp-radio-group", never, { "orientation": "orientation"; }, {}, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
65
10
  }
@@ -1,99 +1,7 @@
1
- import { AfterViewInit, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
- import { BooleanInput } from '@angular/cdk/coercion';
3
- import { CanDisable } from '../../common/disabled';
4
- import { HasTabIndex } from '../../common/tabindex';
5
- import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
6
- import { RadioGroupComponent } from './radio-group.component';
7
- import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
1
+ import { RadioBase } from './shared/radio-base';
8
2
  import * as i0 from "@angular/core";
9
3
  import * as i1 from "../../theme/src/theme-check.directive";
10
- /** Change event object emitted by radio. */
11
- export declare class SapphireRadioChange {
12
- /** The new `checked` value of the radio. */
13
- readonly source: RadioComponent;
14
- /** The source radio of the event. */
15
- readonly value: any;
16
- constructor(
17
- /** The new `checked` value of the radio. */
18
- source: RadioComponent,
19
- /** The source radio of the event. */
20
- value: any);
4
+ export declare class RadioComponent extends RadioBase {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<RadioComponent, never>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<RadioComponent, "sp-radio", never, { "tabIndex": "tabIndex"; }, {}, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
21
7
  }
22
- declare const _RadioMixinBase: import("../../common/constructor").Constructor<HasTabIndex> & import("../../common/constructor").AbstractConstructor<HasTabIndex> & import("../../common/constructor").Constructor<CanDisable> & import("../../common/constructor").AbstractConstructor<CanDisable> & {
23
- new (_elementRef: ElementRef): {
24
- _elementRef: ElementRef;
25
- };
26
- };
27
- export declare class RadioComponent extends _RadioMixinBase implements OnInit, AfterViewInit, DoCheck, OnDestroy, CanDisable, HasTabIndex {
28
- readonly radioGroup: RadioGroupComponent;
29
- private _focusMonitor;
30
- private _radioDispatcher;
31
- /**
32
- * Attached to the aria-label attribute of the host element. In most cases,
33
- * aria-labelledby will take precedence so this may be omitted.
34
- */
35
- ariaLabel: string;
36
- /**
37
- * Users can specify the `aria-labelledby` attribute which will be forwarded
38
- * to the input element
39
- */
40
- ariaLabelledby: string | null;
41
- /** The 'aria-describedby' attribute is read after the element's label and field type. */
42
- ariaDescribedby: string;
43
- /** Analog to HTML 'name' attribute used to group radios for unique selection. */
44
- name: string;
45
- /** Analog to HTML 'name' attribute used to group radios for unique selection. */
46
- autofocus: boolean;
47
- _getAriaChecked(): 'true' | 'false';
48
- /** A unique id for the radio input. If none is supplied, it will be auto-generated. */
49
- id: string;
50
- /** Returns the unique id for the visual hidden input. */
51
- get inputId(): string;
52
- /** Previous value of the input's tabindex. */
53
- private previousTabIndex;
54
- /** Unregister function for _radioDispatcher */
55
- private removeUniqueSelectionListener;
56
- /** The native `<input type="radio">` element */
57
- _inputElement: ElementRef<HTMLInputElement>;
58
- /** The value of this radio button. */
59
- get value(): any;
60
- set value(value: any);
61
- private _value;
62
- /** Whether this radio button is checked. */
63
- get checked(): boolean;
64
- set checked(value: BooleanInput);
65
- private _checked;
66
- /** Whether the radio button is disabled. */
67
- get disabled(): boolean;
68
- set disabled(value: BooleanInput);
69
- private _disabled;
70
- /** Whether the radio button is readonly. */
71
- get readonly(): boolean;
72
- set readonly(value: BooleanInput);
73
- private _readonly;
74
- /** Whether the radio button is required. */
75
- get required(): boolean;
76
- set required(value: BooleanInput);
77
- private _required;
78
- /**
79
- * Event emitted when the checked state of this radio button changes.
80
- * Change events are only emitted when the value changes due to user interaction with
81
- * the radio button (the same behavior as `<input type-"radio">`).
82
- */
83
- readonly change: EventEmitter<SapphireRadioChange>;
84
- constructor(radioGroup: RadioGroupComponent, elementRef: ElementRef, tabIndex: string, _focusMonitor: FocusMonitor, _radioDispatcher: UniqueSelectionDispatcher);
85
- ngDoCheck(): void;
86
- ngOnInit(): void;
87
- ngAfterViewInit(): void;
88
- ngOnDestroy(): void;
89
- /** Focuses the radio button. */
90
- focus(options?: FocusOptions, origin?: FocusOrigin): void;
91
- /** Gets the tabindex for the underlying input element. */
92
- private updateTabIndex;
93
- private emitChangeEvent;
94
- /** Triggered when the radio button receives an interaction from the user. */
95
- _onInputInteraction(event: Event): void;
96
- static ɵfac: i0.ɵɵFactoryDeclaration<RadioComponent, [{ optional: true; }, null, { attribute: "tabindex"; }, null, null]>;
97
- static ɵcmp: i0.ɵɵComponentDeclaration<RadioComponent, "sp-radio", never, { "tabIndex": "tabIndex"; "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "name": "name"; "autofocus": "autofocus"; "id": "id"; "value": "value"; "checked": "checked"; "disabled": "disabled"; "readonly": "readonly"; "required": "required"; }, { "change": "change"; }, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
98
- }
99
- export {};
@@ -1,12 +1,15 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./radio.component";
3
3
  import * as i2 from "./radio-group.component";
4
- import * as i3 from "@angular/common";
5
- import * as i4 from "../../label/src/label.component";
6
- import * as i5 from "@angular/cdk/a11y";
7
- import * as i6 from "../../field/src/field.module";
4
+ import * as i3 from "./segmented/segmented-radio.component";
5
+ import * as i4 from "./segmented/segmented-radio-group.component";
6
+ import * as i5 from "@angular/common";
7
+ import * as i6 from "../../label/src/label.component";
8
+ import * as i7 from "@angular/cdk/a11y";
9
+ import * as i8 from "../../field/src/field.module";
10
+ import * as i9 from "../../common/sapphire-view-encapsulation";
8
11
  export declare class SapphireRadioModule {
9
12
  static ɵfac: i0.ɵɵFactoryDeclaration<SapphireRadioModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<SapphireRadioModule, [typeof i1.RadioComponent, typeof i2.RadioGroupComponent], [typeof i3.CommonModule, typeof i4.LabelComponent, typeof i5.A11yModule, typeof i6.SapphireFieldModule], [typeof i1.RadioComponent, typeof i2.RadioGroupComponent, typeof i6.SapphireFieldModule]>;
13
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SapphireRadioModule, [typeof i1.RadioComponent, typeof i2.RadioGroupComponent, typeof i3.SegmentedRadioComponent, typeof i4.SegmentedRadioGroupComponent], [typeof i5.CommonModule, typeof i6.LabelComponent, typeof i7.A11yModule, typeof i8.SapphireFieldModule, typeof i9.UseComponentStyles], [typeof i1.RadioComponent, typeof i2.RadioGroupComponent, typeof i3.SegmentedRadioComponent, typeof i4.SegmentedRadioGroupComponent, typeof i8.SapphireFieldModule]>;
11
14
  static ɵinj: i0.ɵɵInjectorDeclaration<SapphireRadioModule>;
12
15
  }
@@ -0,0 +1,40 @@
1
+ import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, ElementRef, NgZone, OnDestroy } from '@angular/core';
2
+ import { RadioGroupBase } from '../shared/radio-group-base';
3
+ import { FocusOrigin } from '@angular/cdk/a11y';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "../../../theme/src/theme-check.directive";
6
+ export declare class SegmentedRadioGroupComponent extends RadioGroupBase implements AfterViewInit, OnDestroy, AfterViewChecked {
7
+ private zone;
8
+ private changeDetector;
9
+ segmentedControl: ElementRef;
10
+ /**
11
+ * Label (not shown on the screen).
12
+ * Required for accessibility reasons.
13
+ **/
14
+ ariaLabel: string;
15
+ /** Size of tabs */
16
+ size: 'sm' | 'md' | 'lg';
17
+ /**
18
+ * Alignment of tabs' buttons group.
19
+ * @default 'left'
20
+ */
21
+ align?: 'left' | 'center' | 'right' | 'stretch';
22
+ private resizeObserver;
23
+ _gliderStyles: {
24
+ left: string;
25
+ width: string;
26
+ };
27
+ _animationEnabled: boolean;
28
+ _focusVisible: boolean;
29
+ constructor(zone: NgZone, changeDetector: ChangeDetectorRef);
30
+ private skipAnimationFrame;
31
+ private setGliderStyles;
32
+ private getSelectedTabPosition;
33
+ private shouldUpdateGliderStyles;
34
+ ngAfterViewInit(): void;
35
+ ngAfterViewChecked(): void;
36
+ ngOnDestroy(): void;
37
+ _onFocusChange(focusOrigin: FocusOrigin): void;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<SegmentedRadioGroupComponent, never>;
39
+ static ɵcmp: i0.ɵɵComponentDeclaration<SegmentedRadioGroupComponent, "sp-segmented-radio-group", never, { "ariaLabel": "aria-label"; "size": "size"; "align": "align"; }, {}, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }]>;
40
+ }
@@ -0,0 +1,8 @@
1
+ import { RadioBase } from '../shared/radio-base';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "../../../theme/src/theme-check.directive";
4
+ import * as i2 from "../../../common/sapphire-view-encapsulation";
5
+ export declare class SegmentedRadioComponent extends RadioBase {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<SegmentedRadioComponent, never>;
7
+ static ɵcmp: i0.ɵɵComponentDeclaration<SegmentedRadioComponent, "sp-segmented-radio", never, { "tabIndex": "tabIndex"; }, {}, never, ["*"], false, [{ directive: typeof i1.ThemeCheckDirective; inputs: {}; outputs: {}; }, { directive: typeof i2.UseComponentStyles; inputs: {}; outputs: {}; }]>;
8
+ }
@@ -0,0 +1,103 @@
1
+ import { AfterViewInit, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { BooleanInput } from '@angular/cdk/coercion';
3
+ import { CanDisable } from '../../../common/disabled';
4
+ import { HasTabIndex } from '../../../common/tabindex';
5
+ import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
6
+ import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
7
+ import { RadioGroupBase } from './radio-group-base';
8
+ import * as i0 from "@angular/core";
9
+ /** Change event object emitted by radio. */
10
+ export declare class SapphireRadioChange {
11
+ /** The new `checked` value of the radio. */
12
+ readonly source: RadioBase;
13
+ /** The source radio of the event. */
14
+ readonly value: any;
15
+ constructor(
16
+ /** The new `checked` value of the radio. */
17
+ source: RadioBase,
18
+ /** The source radio of the event. */
19
+ value: any);
20
+ }
21
+ declare const _RadioMixinBase: import("../../../common/constructor").Constructor<HasTabIndex> & import("../../../common/constructor").AbstractConstructor<HasTabIndex> & import("../../../common/constructor").Constructor<CanDisable> & import("../../../common/constructor").AbstractConstructor<CanDisable> & {
22
+ new (_elementRef: ElementRef): {
23
+ _elementRef: ElementRef;
24
+ };
25
+ };
26
+ /**
27
+ * @Directive decorator is just to be able to have a constructor with DI.
28
+ * This class is being extended by other components.
29
+ **/
30
+ export declare class RadioBase extends _RadioMixinBase implements OnInit, AfterViewInit, DoCheck, OnDestroy, CanDisable, HasTabIndex {
31
+ readonly radioGroup: RadioGroupBase;
32
+ elementRef: ElementRef<HTMLLIElement>;
33
+ private _focusMonitor;
34
+ private _radioDispatcher;
35
+ /**
36
+ * Attached to the aria-label attribute of the host element. In most cases,
37
+ * aria-labelledby will take precedence so this may be omitted.
38
+ */
39
+ ariaLabel: string;
40
+ /**
41
+ * Users can specify the `aria-labelledby` attribute which will be forwarded
42
+ * to the input element
43
+ */
44
+ ariaLabelledby: string | null;
45
+ /** The 'aria-describedby' attribute is read after the element's label and field type. */
46
+ ariaDescribedby: string;
47
+ /** Analog to HTML 'name' attribute used to group radios for unique selection. */
48
+ name: string;
49
+ /** Analog to HTML 'name' attribute used to group radios for unique selection. */
50
+ autofocus: boolean;
51
+ _getAriaChecked(): 'true' | 'false';
52
+ /** A unique id for the radio input. If none is supplied, it will be auto-generated. */
53
+ id: string;
54
+ /** Returns the unique id for the visual hidden input. */
55
+ get inputId(): string;
56
+ /** Previous value of the input's tabindex. */
57
+ private previousTabIndex;
58
+ /** Unregister function for _radioDispatcher */
59
+ private removeUniqueSelectionListener;
60
+ /** The native `<input type="radio">` element */
61
+ _inputElement: ElementRef<HTMLInputElement>;
62
+ /** The value of this radio button. */
63
+ get value(): any;
64
+ set value(value: any);
65
+ private _value;
66
+ /** Whether this radio button is checked. */
67
+ get checked(): boolean;
68
+ set checked(value: BooleanInput);
69
+ private _checked;
70
+ /** Whether the radio button is disabled. */
71
+ get disabled(): boolean;
72
+ set disabled(value: BooleanInput);
73
+ private _disabled;
74
+ /** Whether the radio button is readonly. */
75
+ get readonly(): boolean;
76
+ set readonly(value: BooleanInput);
77
+ private _readonly;
78
+ /** Whether the radio button is required. */
79
+ get required(): boolean;
80
+ set required(value: BooleanInput);
81
+ private _required;
82
+ /**
83
+ * Event emitted when the checked state of this radio button changes.
84
+ * Change events are only emitted when the value changes due to user interaction with
85
+ * the radio button (the same behavior as `<input type-"radio">`).
86
+ */
87
+ readonly change: EventEmitter<SapphireRadioChange>;
88
+ constructor(radioGroup: RadioGroupBase, elementRef: ElementRef<HTMLLIElement>, tabIndex: string, _focusMonitor: FocusMonitor, _radioDispatcher: UniqueSelectionDispatcher);
89
+ ngDoCheck(): void;
90
+ ngOnInit(): void;
91
+ ngAfterViewInit(): void;
92
+ ngOnDestroy(): void;
93
+ /** Focuses the radio button. */
94
+ focus(options?: FocusOptions, origin?: FocusOrigin): void;
95
+ /** Gets the tabindex for the underlying input element. */
96
+ private updateTabIndex;
97
+ private emitChangeEvent;
98
+ /** Triggered when the radio button receives an interaction from the user. */
99
+ _onInputInteraction(event: Event): void;
100
+ static ɵfac: i0.ɵɵFactoryDeclaration<RadioBase, [{ optional: true; }, null, { attribute: "tabindex"; }, null, null]>;
101
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RadioBase, never, never, { "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "name": "name"; "autofocus": "autofocus"; "id": "id"; "value": "value"; "checked": "checked"; "disabled": "disabled"; "readonly": "readonly"; "required": "required"; }, { "change": "change"; }, never, never, false, never>;
102
+ }
103
+ export {};
@@ -0,0 +1,63 @@
1
+ import { ChangeDetectorRef, EventEmitter } from '@angular/core';
2
+ import { RadioComponent } from '../radio.component';
3
+ import { ControlValueAccessor } from '@angular/forms';
4
+ import { BooleanInput } from '@angular/cdk/coercion';
5
+ import { FieldControl } from '../../../field/src/field-control';
6
+ import { SapphireRadioChange } from './radio-base';
7
+ import { FieldComponent } from '../../../field/src/field.component';
8
+ import * as i0 from "@angular/core";
9
+ export declare abstract class RadioGroupBase implements ControlValueAccessor, FieldControl {
10
+ private changeDetectorRef;
11
+ _field: FieldComponent;
12
+ uniqueId: string;
13
+ orientation: 'vertical' | 'horizontal';
14
+ /** Name of the radio button group. All radio buttons inside this group will use this name. */
15
+ get name(): string;
16
+ set name(value: string);
17
+ private _name;
18
+ /**
19
+ * Event emitted when the group value changes.
20
+ * Change events are only emitted when the value changes due to user interaction with
21
+ * the radio button (the same behavior as `<input type-"radio">`).
22
+ */
23
+ readonly change: EventEmitter<SapphireRadioChange>;
24
+ get value(): any;
25
+ set value(newValue: any);
26
+ private _value;
27
+ /**
28
+ * The currently selected radio button. If set to a new radio button, the radio group value
29
+ * will be updated to match the new selected button. */
30
+ get selected(): RadioComponent | null;
31
+ set selected(selected: RadioComponent | null);
32
+ private _selected;
33
+ /** Whether the radio group is disabled */
34
+ get disabled(): boolean;
35
+ set disabled(value: BooleanInput);
36
+ private _disabled;
37
+ /** Whether the radio group is readonly */
38
+ get readonly(): boolean;
39
+ set readonly(value: BooleanInput);
40
+ private _readonly;
41
+ /** Whether the radio group is required */
42
+ get required(): boolean;
43
+ set required(value: BooleanInput);
44
+ private _required;
45
+ /** Child radio buttons. */
46
+ private radios;
47
+ onTouched: () => any;
48
+ _controlValueAccessorChangeFn: (value: any) => void;
49
+ constructor(changeDetectorRef: ChangeDetectorRef, _field: FieldComponent);
50
+ _checkSelectedRadioButton(): void;
51
+ /** Dispatch change event with current selection and group value. */
52
+ _emitChangeEvent(): void;
53
+ writeValue(value: any): void;
54
+ registerOnChange(fn: (value: any) => void): void;
55
+ registerOnTouched(fn: any): void;
56
+ setDisabledState(disabled: boolean): void;
57
+ isDisabled(): boolean;
58
+ /** Updates the `selected` radio button from the internal _value state. */
59
+ private updateSelectedRadioFromValue;
60
+ private updateRadioButtonNames;
61
+ static ɵfac: i0.ɵɵFactoryDeclaration<RadioGroupBase, [null, { optional: true; }]>;
62
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RadioGroupBase, never, never, { "orientation": "orientation"; "name": "name"; "value": "value"; "selected": "selected"; "disabled": "disabled"; "readonly": "readonly"; "required": "required"; }, { "change": "change"; }, ["radios"], never, true, never>;
63
+ }