aeb-ui-kit 9.0.0-preview.1054 → 9.0.0-preview.1056

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.
@@ -5735,6 +5735,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
5735
5735
  }]
5736
5736
  }] });
5737
5737
 
5738
+ class AebSwitchComponent {
5739
+ get ariaChecked() {
5740
+ return this.checked;
5741
+ }
5742
+ get isWarningOrInvalid() {
5743
+ console.log(this.ngControl?.status);
5744
+ return this.warning || this.ngControl?.status === 'INVALID';
5745
+ }
5746
+ constructor(renderer, cdr, injector) {
5747
+ this.renderer = renderer;
5748
+ this.cdr = cdr;
5749
+ this.injector = injector;
5750
+ this.id = `aeb-switch-${Math.random().toString(36).substring(2, 9)}`;
5751
+ this.warning = false;
5752
+ this.label = '';
5753
+ this.changed = new EventEmitter();
5754
+ this.hostClass = true;
5755
+ this.role = 'switch';
5756
+ this.pressed = false;
5757
+ this.checked = false;
5758
+ this.disabled = false;
5759
+ this._onChange = () => { };
5760
+ this._onTouched = () => { };
5761
+ }
5762
+ toggle(event) {
5763
+ event.preventDefault();
5764
+ if (this.disabled) {
5765
+ return;
5766
+ }
5767
+ this.checked = !this.checked;
5768
+ this._writeInputState();
5769
+ this._onChange(this.checked);
5770
+ this._onTouched();
5771
+ this.changed.emit(this.checked);
5772
+ this.cdr.markForCheck();
5773
+ }
5774
+ onSpace(event) {
5775
+ event.preventDefault();
5776
+ this.toggle(event);
5777
+ }
5778
+ onPressStart() {
5779
+ this.pressed = true;
5780
+ }
5781
+ onPressEndMouseUp() {
5782
+ this.pressed = false;
5783
+ }
5784
+ onPressEndMouseOut() {
5785
+ this.pressed = false;
5786
+ }
5787
+ ngOnInit() {
5788
+ this.ngControl = this.injector.get(NgControl, null);
5789
+ if (this.ngControl) {
5790
+ this.ngControl.valueAccessor = this;
5791
+ this.ngControl.statusChanges?.subscribe(() => this.cdr.markForCheck());
5792
+ this.ngControl.valueChanges?.subscribe(() => this.cdr.markForCheck());
5793
+ }
5794
+ }
5795
+ writeValue(value) {
5796
+ this.checked = !!value;
5797
+ this._writeInputState();
5798
+ this.cdr.markForCheck();
5799
+ }
5800
+ registerOnChange(fn) {
5801
+ this._onChange = fn;
5802
+ }
5803
+ registerOnTouched(fn) {
5804
+ this._onTouched = fn;
5805
+ }
5806
+ setDisabledState(isDisabled) {
5807
+ this.disabled = isDisabled;
5808
+ this.renderer.setProperty(this.switchInput.nativeElement, 'disabled', isDisabled);
5809
+ }
5810
+ _writeInputState() {
5811
+ const el = this.switchInput.nativeElement;
5812
+ this.renderer.setProperty(el, 'checked', this.checked);
5813
+ this.renderer.setAttribute(el, 'aria-checked', String(this.checked));
5814
+ }
5815
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
5816
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: AebSwitchComponent, isStandalone: false, selector: "aeb-switch", inputs: { id: "id", name: "name", warning: "warning", label: "label" }, outputs: { changed: "changed" }, host: { listeners: { "click": "toggle($event)", "keydown.space": "onSpace($event)", "mousedown": "onPressStart()", "mouseup": "onPressEndMouseUp()", "mouseout": "onPressEndMouseOut()" }, properties: { "class.switch": "this.hostClass", "attr.role": "this.role", "attr.aria-checked": "this.ariaChecked", "class.switch--warning": "this.isWarningOrInvalid" } }, providers: [
5817
+ {
5818
+ provide: NG_VALUE_ACCESSOR,
5819
+ useExisting: forwardRef(() => AebSwitchComponent),
5820
+ multi: true
5821
+ }
5822
+ ], viewQueries: [{ propertyName: "switchInput", first: true, predicate: ["switchInput"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"switch-wrapper\">\n <label class=\"switch\" [class.switch--checked]=\"checked\"\n [class.switch--warning]=\"warning || ngControl?.status === 'INVALID'\" [class.switch--disabled]=\"disabled\"\n [class.switch--pressed]=\"pressed\" tabindex=\"0\">\n <input #switchInput type=\"checkbox\" [id]=\"id\" [name]=\"name\" class=\"visually-hidden\" [disabled]=\"disabled\"\n [checked]=\"checked\" />\n\n <span class=\"switch-slider\"></span>\n </label>\n <span *ngIf=\"label\" class=\"switch-label\">{{ label }}</span>\n</div>", styles: [".switch-wrapper{display:flex;align-items:center;gap:12px}.switch{outline:none;position:relative;display:inline-block;width:40px;height:24px;cursor:pointer}.switch:hover .switch-slider{filter:brightness(110%)}.switch--disabled{cursor:not-allowed}.switch--disabled:hover .switch-slider{filter:none!important}.switch--disabled .switch-slider{opacity:.5}.switch .visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;outline:none}.switch .switch-slider{position:absolute;inset:0;background-color:var(--color-mono-100);border-radius:12px;transition:background-color .3s,filter .3s}.switch .switch-slider:before{content:\"\";position:absolute;width:18px;height:18px;top:3px;left:3px;background-color:var(--color-mono-0);border-radius:50%;transition:transform .3s}.switch--checked .switch-slider{background-color:var(--color-blue-500)}.switch--checked .switch-slider:before{transform:translate(16px)}.switch--warning .switch-slider{background-color:var(--color-red-100)}.switch--checked.switch--warning .switch-slider{background-color:var(--color-red-500)}.switch--checked.switch--warning .switch-slider:before{transform:translate(16px)}.switch--pressed .switch-slider{background-color:var(--color-mono-200)}.switch--pressed.switch--warning .switch-slider{background-color:var(--color-red-200)}.switch--pressed.switch--checked .switch-slider{background-color:var(--color-blue-600);filter:none}.switch--pressed.switch--checked .switch-slider:before{transform:translate(16px)}.switch--pressed.switch--checked.switch--warning .switch-slider{background-color:var(--color-red-600);filter:none}.switch--pressed.switch--checked.switch--warning .switch-slider:before{transform:translate(16px)}.switch-label{cursor:pointer;-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5823
+ }
5824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchComponent, decorators: [{
5825
+ type: Component,
5826
+ args: [{ selector: 'aeb-switch', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
5827
+ {
5828
+ provide: NG_VALUE_ACCESSOR,
5829
+ useExisting: forwardRef(() => AebSwitchComponent),
5830
+ multi: true
5831
+ }
5832
+ ], standalone: false, template: "<div class=\"switch-wrapper\">\n <label class=\"switch\" [class.switch--checked]=\"checked\"\n [class.switch--warning]=\"warning || ngControl?.status === 'INVALID'\" [class.switch--disabled]=\"disabled\"\n [class.switch--pressed]=\"pressed\" tabindex=\"0\">\n <input #switchInput type=\"checkbox\" [id]=\"id\" [name]=\"name\" class=\"visually-hidden\" [disabled]=\"disabled\"\n [checked]=\"checked\" />\n\n <span class=\"switch-slider\"></span>\n </label>\n <span *ngIf=\"label\" class=\"switch-label\">{{ label }}</span>\n</div>", styles: [".switch-wrapper{display:flex;align-items:center;gap:12px}.switch{outline:none;position:relative;display:inline-block;width:40px;height:24px;cursor:pointer}.switch:hover .switch-slider{filter:brightness(110%)}.switch--disabled{cursor:not-allowed}.switch--disabled:hover .switch-slider{filter:none!important}.switch--disabled .switch-slider{opacity:.5}.switch .visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;outline:none}.switch .switch-slider{position:absolute;inset:0;background-color:var(--color-mono-100);border-radius:12px;transition:background-color .3s,filter .3s}.switch .switch-slider:before{content:\"\";position:absolute;width:18px;height:18px;top:3px;left:3px;background-color:var(--color-mono-0);border-radius:50%;transition:transform .3s}.switch--checked .switch-slider{background-color:var(--color-blue-500)}.switch--checked .switch-slider:before{transform:translate(16px)}.switch--warning .switch-slider{background-color:var(--color-red-100)}.switch--checked.switch--warning .switch-slider{background-color:var(--color-red-500)}.switch--checked.switch--warning .switch-slider:before{transform:translate(16px)}.switch--pressed .switch-slider{background-color:var(--color-mono-200)}.switch--pressed.switch--warning .switch-slider{background-color:var(--color-red-200)}.switch--pressed.switch--checked .switch-slider{background-color:var(--color-blue-600);filter:none}.switch--pressed.switch--checked .switch-slider:before{transform:translate(16px)}.switch--pressed.switch--checked.switch--warning .switch-slider{background-color:var(--color-red-600);filter:none}.switch--pressed.switch--checked.switch--warning .switch-slider:before{transform:translate(16px)}.switch-label{cursor:pointer;-webkit-user-select:none;user-select:none}\n"] }]
5833
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }], propDecorators: { switchInput: [{
5834
+ type: ViewChild,
5835
+ args: ['switchInput', { static: true }]
5836
+ }], id: [{
5837
+ type: Input
5838
+ }], name: [{
5839
+ type: Input
5840
+ }], warning: [{
5841
+ type: Input
5842
+ }], label: [{
5843
+ type: Input
5844
+ }], changed: [{
5845
+ type: Output
5846
+ }], hostClass: [{
5847
+ type: HostBinding,
5848
+ args: ['class.switch']
5849
+ }], role: [{
5850
+ type: HostBinding,
5851
+ args: ['attr.role']
5852
+ }], ariaChecked: [{
5853
+ type: HostBinding,
5854
+ args: ['attr.aria-checked']
5855
+ }], isWarningOrInvalid: [{
5856
+ type: HostBinding,
5857
+ args: ['class.switch--warning']
5858
+ }], toggle: [{
5859
+ type: HostListener,
5860
+ args: ['click', ['$event']]
5861
+ }], onSpace: [{
5862
+ type: HostListener,
5863
+ args: ['keydown.space', ['$event']]
5864
+ }], onPressStart: [{
5865
+ type: HostListener,
5866
+ args: ['mousedown']
5867
+ }], onPressEndMouseUp: [{
5868
+ type: HostListener,
5869
+ args: ['mouseup']
5870
+ }], onPressEndMouseOut: [{
5871
+ type: HostListener,
5872
+ args: ['mouseout']
5873
+ }] } });
5874
+
5875
+ class AebSwitchModule {
5876
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
5877
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchModule, declarations: [AebSwitchComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule], exports: [AebSwitchComponent] }); }
5878
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchModule, imports: [CommonModule, FormsModule, ReactiveFormsModule] }); }
5879
+ }
5880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AebSwitchModule, decorators: [{
5881
+ type: NgModule,
5882
+ args: [{
5883
+ declarations: [AebSwitchComponent],
5884
+ imports: [CommonModule, FormsModule, ReactiveFormsModule],
5885
+ exports: [AebSwitchComponent]
5886
+ }]
5887
+ }] });
5888
+
5738
5889
  /*
5739
5890
  * Public API Surface of aeb-ui-kit
5740
5891
  */
@@ -5743,5 +5894,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
5743
5894
  * Generated bundle index. Do not edit.
5744
5895
  */
5745
5896
 
5746
- export { AccordionComponent, AccordionModule, ActionBarComponent, ActionBarModule, AebUiKitModule, AutofocusDirective, BreadcrumpsComponent, ButtonComponent, ButtonLeftIconDirective, ButtonModule, ButtonRightIconDirective, CheckboxComponent, CheckboxGroupOldComponent, CheckboxModule, CheckboxOldComponent, CheckboxOldModule, ClickOutsideDirective, CodeInputComponent, CodeInputModule, CommentComponent, CommentModule, CreditItemCardComponent, CreditItemCardModule, DatepickerComponent, DatepickerCoreComponent, DatepickerModule, DatepickerMonthComponent, DatepickerTilesComponent, DragAndDropDirective, DropdownComponent, DropdownModule, ErrorMessageDirective, FileAttachComponent, FileAttachModule, FilterTagComponent, FilterTagsComponent, FilterTagsModule, FooterBottomComponent, FooterComponent, FooterMenuComponent, FooterModule, FooterTopComponent, FormFieldComponent, FormFieldDirective, FormFieldModule, HeaderComponent, HeaderModule, HeadingComponent, HeadingModule, IconDirective, LabelComponent, LabelDirective, LabelModule, LogoComponent, ModalComponent, ModalModule, NewsCardComponent, NewsCardModule, NotificationComponent, NotificationsComponent, NotificationsModule, OldButtonComponent, OldButtonModule, PaginationComponent, PaginationModule, PopUpComponent, PopUpDirective, PopUpModule, ProductTitleComponent, RadioButtonsComponent, RadioButtonsModule, RadioButtonsOldComponent, RadioButtonsOldModule, ResponseComponent, ResponseModule, SearchComponent, SearchModule, SelectComponent, SelectModule, SidebarComponent, SidebarModule, SliderComponent, SliderModule, SpanSubtitleDirective, SpanTitleDirective, SpinnerComponent, SpinnerModule, StepperComponent, StepperModule, StepperStepComponent, TabDirective, TableComponent, TableModule, TabsComponent, TabsModule, TagTabComponent, TagTabModule, TooltipComponent, TooltipDirective, TooltipModule, VisaComponent, VisaItemComponent, VisaModule };
5897
+ export { AccordionComponent, AccordionModule, ActionBarComponent, ActionBarModule, AebSwitchComponent, AebSwitchModule, AebUiKitModule, AutofocusDirective, BreadcrumpsComponent, ButtonComponent, ButtonLeftIconDirective, ButtonModule, ButtonRightIconDirective, CheckboxComponent, CheckboxGroupOldComponent, CheckboxModule, CheckboxOldComponent, CheckboxOldModule, ClickOutsideDirective, CodeInputComponent, CodeInputModule, CommentComponent, CommentModule, CreditItemCardComponent, CreditItemCardModule, DatepickerComponent, DatepickerCoreComponent, DatepickerModule, DatepickerMonthComponent, DatepickerTilesComponent, DragAndDropDirective, DropdownComponent, DropdownModule, ErrorMessageDirective, FileAttachComponent, FileAttachModule, FilterTagComponent, FilterTagsComponent, FilterTagsModule, FooterBottomComponent, FooterComponent, FooterMenuComponent, FooterModule, FooterTopComponent, FormFieldComponent, FormFieldDirective, FormFieldModule, HeaderComponent, HeaderModule, HeadingComponent, HeadingModule, IconDirective, LabelComponent, LabelDirective, LabelModule, LogoComponent, ModalComponent, ModalModule, NewsCardComponent, NewsCardModule, NotificationComponent, NotificationsComponent, NotificationsModule, OldButtonComponent, OldButtonModule, PaginationComponent, PaginationModule, PopUpComponent, PopUpDirective, PopUpModule, ProductTitleComponent, RadioButtonsComponent, RadioButtonsModule, RadioButtonsOldComponent, RadioButtonsOldModule, ResponseComponent, ResponseModule, SearchComponent, SearchModule, SelectComponent, SelectModule, SidebarComponent, SidebarModule, SliderComponent, SliderModule, SpanSubtitleDirective, SpanTitleDirective, SpinnerComponent, SpinnerModule, StepperComponent, StepperModule, StepperStepComponent, TabDirective, TableComponent, TableModule, TabsComponent, TabsModule, TagTabComponent, TagTabModule, TooltipComponent, TooltipDirective, TooltipModule, VisaComponent, VisaItemComponent, VisaModule };
5747
5898
  //# sourceMappingURL=aeb-ui-kit.mjs.map