integra-ng 21.1.2 → 21.1.3
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/fesm2022/integra-ng.mjs +184 -1
- package/fesm2022/integra-ng.mjs.map +1 -1
- package/package.json +1 -1
- package/types/integra-ng.d.ts +131 -2
package/fesm2022/integra-ng.mjs
CHANGED
|
@@ -6515,6 +6515,189 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
6515
6515
|
args: [ITabPanel]
|
|
6516
6516
|
}] } });
|
|
6517
6517
|
|
|
6518
|
+
/**
|
|
6519
|
+
* Toggle Component
|
|
6520
|
+
*
|
|
6521
|
+
* A form control toggle switch component that switches between true and false.
|
|
6522
|
+
* Supports multiple sizes and states, and is fully compatible with Angular Reactive Forms.
|
|
6523
|
+
*
|
|
6524
|
+
* @example
|
|
6525
|
+
* ```html
|
|
6526
|
+
* <!-- Basic toggle -->
|
|
6527
|
+
* <i-toggle label="Enable notifications"></i-toggle>
|
|
6528
|
+
*
|
|
6529
|
+
* <!-- Toggle with ngModel -->
|
|
6530
|
+
* <i-toggle
|
|
6531
|
+
* label="Dark mode"
|
|
6532
|
+
* [(ngModel)]="darkMode">
|
|
6533
|
+
* </i-toggle>
|
|
6534
|
+
*
|
|
6535
|
+
* <!-- Toggle in reactive form -->
|
|
6536
|
+
* <i-toggle
|
|
6537
|
+
* label="Accept terms"
|
|
6538
|
+
* formControlName="acceptTerms">
|
|
6539
|
+
* </i-toggle>
|
|
6540
|
+
*
|
|
6541
|
+
* <!-- Disabled toggle -->
|
|
6542
|
+
* <i-toggle
|
|
6543
|
+
* label="Disabled option"
|
|
6544
|
+
* [disabled]="true">
|
|
6545
|
+
* </i-toggle>
|
|
6546
|
+
*
|
|
6547
|
+
* <!-- Different sizes -->
|
|
6548
|
+
* <i-toggle label="Small" size="small"></i-toggle>
|
|
6549
|
+
* <i-toggle label="Medium" size="medium"></i-toggle>
|
|
6550
|
+
* <i-toggle label="Large" size="large"></i-toggle>
|
|
6551
|
+
* ```
|
|
6552
|
+
*
|
|
6553
|
+
* @remarks
|
|
6554
|
+
* This component implements ControlValueAccessor for seamless integration with Angular Forms.
|
|
6555
|
+
*/
|
|
6556
|
+
class IToggle {
|
|
6557
|
+
/**
|
|
6558
|
+
* Label text displayed next to the toggle
|
|
6559
|
+
*/
|
|
6560
|
+
label;
|
|
6561
|
+
/**
|
|
6562
|
+
* HTML id attribute for the toggle element
|
|
6563
|
+
*/
|
|
6564
|
+
id;
|
|
6565
|
+
/**
|
|
6566
|
+
* Whether the toggle is disabled
|
|
6567
|
+
* @default false
|
|
6568
|
+
*/
|
|
6569
|
+
disabled = false;
|
|
6570
|
+
/**
|
|
6571
|
+
* Whether the toggle is readonly (cannot be changed by user)
|
|
6572
|
+
* @default false
|
|
6573
|
+
*/
|
|
6574
|
+
readonly = false;
|
|
6575
|
+
/**
|
|
6576
|
+
* Size of the toggle
|
|
6577
|
+
* @default 'medium'
|
|
6578
|
+
*/
|
|
6579
|
+
size = 'medium';
|
|
6580
|
+
/**
|
|
6581
|
+
* Checked (on) state of the toggle
|
|
6582
|
+
*/
|
|
6583
|
+
set checked(value) {
|
|
6584
|
+
this._checked = !!value;
|
|
6585
|
+
}
|
|
6586
|
+
get checked() {
|
|
6587
|
+
return this._checked;
|
|
6588
|
+
}
|
|
6589
|
+
/**
|
|
6590
|
+
* Event emitted when toggle state changes
|
|
6591
|
+
*/
|
|
6592
|
+
onChange = new EventEmitter();
|
|
6593
|
+
/**
|
|
6594
|
+
* Unique component identifier
|
|
6595
|
+
* @internal
|
|
6596
|
+
*/
|
|
6597
|
+
componentId = UniqueComponentId('i-toggle-');
|
|
6598
|
+
/**
|
|
6599
|
+
* Internal checked state
|
|
6600
|
+
* @internal
|
|
6601
|
+
*/
|
|
6602
|
+
_checked = false;
|
|
6603
|
+
/**
|
|
6604
|
+
* Callback for ControlValueAccessor
|
|
6605
|
+
* @internal
|
|
6606
|
+
*/
|
|
6607
|
+
onChangeCallback = () => { };
|
|
6608
|
+
/**
|
|
6609
|
+
* Callback for ControlValueAccessor
|
|
6610
|
+
* @internal
|
|
6611
|
+
*/
|
|
6612
|
+
onTouchedCallback = () => { };
|
|
6613
|
+
/**
|
|
6614
|
+
* Toggles the switch state
|
|
6615
|
+
* @internal
|
|
6616
|
+
*/
|
|
6617
|
+
toggle() {
|
|
6618
|
+
if (this.disabled || this.readonly)
|
|
6619
|
+
return;
|
|
6620
|
+
this._checked = !this._checked;
|
|
6621
|
+
this.onChangeCallback(this._checked);
|
|
6622
|
+
this.onTouchedCallback();
|
|
6623
|
+
// Deferred to allow Angular's change detection cycle to process the new
|
|
6624
|
+
// value before external listeners receive the event (mirrors checkbox pattern)
|
|
6625
|
+
setTimeout(() => {
|
|
6626
|
+
this.onChange.emit(this._checked);
|
|
6627
|
+
}, 0);
|
|
6628
|
+
}
|
|
6629
|
+
/**
|
|
6630
|
+
* Handles keyboard events (Space/Enter) — only prevents default when interactive
|
|
6631
|
+
* @internal
|
|
6632
|
+
*/
|
|
6633
|
+
handleKeydown(event) {
|
|
6634
|
+
if (this.disabled || this.readonly)
|
|
6635
|
+
return;
|
|
6636
|
+
event.preventDefault();
|
|
6637
|
+
this.toggle();
|
|
6638
|
+
}
|
|
6639
|
+
/**
|
|
6640
|
+
* Writes a value to the toggle (ControlValueAccessor)
|
|
6641
|
+
* @internal
|
|
6642
|
+
*/
|
|
6643
|
+
writeValue(value) {
|
|
6644
|
+
this._checked = !!value;
|
|
6645
|
+
}
|
|
6646
|
+
/**
|
|
6647
|
+
* Registers the onChange callback (ControlValueAccessor)
|
|
6648
|
+
* @internal
|
|
6649
|
+
*/
|
|
6650
|
+
registerOnChange(fn) {
|
|
6651
|
+
this.onChangeCallback = fn;
|
|
6652
|
+
}
|
|
6653
|
+
/**
|
|
6654
|
+
* Registers the onTouched callback (ControlValueAccessor)
|
|
6655
|
+
* @internal
|
|
6656
|
+
*/
|
|
6657
|
+
registerOnTouched(fn) {
|
|
6658
|
+
this.onTouchedCallback = fn;
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* Sets the disabled state (ControlValueAccessor)
|
|
6662
|
+
* @internal
|
|
6663
|
+
*/
|
|
6664
|
+
setDisabledState(isDisabled) {
|
|
6665
|
+
this.disabled = isDisabled;
|
|
6666
|
+
}
|
|
6667
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: IToggle, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6668
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: IToggle, isStandalone: true, selector: "i-toggle", inputs: { label: "label", id: "id", disabled: "disabled", readonly: "readonly", size: "size", checked: "checked" }, outputs: { onChange: "onChange" }, providers: [
|
|
6669
|
+
{
|
|
6670
|
+
provide: NG_VALUE_ACCESSOR,
|
|
6671
|
+
useExisting: forwardRef(() => IToggle),
|
|
6672
|
+
multi: true,
|
|
6673
|
+
},
|
|
6674
|
+
], ngImport: i0, template: "<div\n class=\"i-toggle-wrapper\"\n [class.i-toggle--disabled]=\"disabled\"\n [class.i-toggle--readonly]=\"readonly\"\n [class.i-toggle--small]=\"size === 'small'\"\n [class.i-toggle--medium]=\"size === 'medium'\"\n [class.i-toggle--large]=\"size === 'large'\"\n>\n <div\n class=\"i-toggle\"\n [class.i-toggle--checked]=\"checked\"\n (click)=\"toggle()\"\n [attr.id]=\"id || componentId\"\n role=\"switch\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-labelledby]=\"label ? (id || componentId) + '-label' : null\"\n tabindex=\"0\"\n (keydown.space)=\"handleKeydown($event)\"\n (keydown.enter)=\"handleKeydown($event)\"\n >\n <span class=\"i-toggle-thumb\"></span>\n </div>\n @if (label) {\n <label\n [id]=\"(id || componentId) + '-label'\"\n class=\"i-toggle-label\"\n (click)=\"toggle()\"\n >\n {{ label }}\n </label>\n }\n</div>\n", styles: [".i-toggle-wrapper .i-toggle{background-color:var(--surface-border);border:1px solid var(--surface-border)}.i-toggle-wrapper .i-toggle:focus{box-shadow:0 2px 10px #0003}.i-toggle-wrapper .i-toggle:hover:not(.i-toggle--checked){background-color:color-mix(in srgb,var(--surface-border) 80%,var(--color-primary) 20%)}.i-toggle-wrapper .i-toggle.i-toggle--checked{background-color:var(--color-primary);border-color:var(--color-primary)}.i-toggle-wrapper .i-toggle.i-toggle--checked:hover{background-color:color-mix(in srgb,var(--color-primary) 80%,transparent);border-color:color-mix(in srgb,var(--color-primary) 80%,transparent)}.i-toggle-wrapper .i-toggle.i-toggle--checked .i-toggle-thumb,.i-toggle-wrapper .i-toggle .i-toggle-thumb{background-color:var(--color-contrast-inverse)}.i-toggle-wrapper .i-toggle-label{color:var(--color-text-primary)}.i-toggle-wrapper.i-toggle--disabled .i-toggle,.i-toggle-wrapper.i-toggle--disabled .i-toggle.i-toggle--checked{background-color:var(--color-disabled-background);border-color:var(--color-disabled-border)}.i-toggle-wrapper.i-toggle--disabled .i-toggle.i-toggle--checked .i-toggle-thumb,.i-toggle-wrapper.i-toggle--disabled .i-toggle .i-toggle-thumb{background-color:var(--color-text-disabled)}.i-toggle-wrapper.i-toggle--disabled .i-toggle-label{color:var(--color-text-disabled)}.i-toggle-wrapper{display:inline-flex;align-items:center;gap:8px;font-size:1em}.i-toggle-wrapper.i-toggle--disabled{opacity:.6;cursor:not-allowed}.i-toggle-wrapper.i-toggle--disabled .i-toggle,.i-toggle-wrapper.i-toggle--disabled .i-toggle-label{cursor:not-allowed;pointer-events:none}.i-toggle-wrapper.i-toggle--readonly .i-toggle,.i-toggle-wrapper.i-toggle--readonly .i-toggle-label{cursor:default}.i-toggle-wrapper.i-toggle--small{font-size:.9em;gap:6px}.i-toggle-wrapper.i-toggle--small .i-toggle{width:28px;height:16px;border-radius:8px}.i-toggle-wrapper.i-toggle--small .i-toggle .i-toggle-thumb{width:10px;height:10px}.i-toggle-wrapper.i-toggle--small .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(13px)}.i-toggle-wrapper.i-toggle--medium{font-size:1em;gap:8px}.i-toggle-wrapper.i-toggle--medium .i-toggle{width:36px;height:20px;border-radius:10px}.i-toggle-wrapper.i-toggle--medium .i-toggle .i-toggle-thumb{width:14px;height:14px}.i-toggle-wrapper.i-toggle--medium .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(17px)}.i-toggle-wrapper.i-toggle--large{font-size:1.2em;gap:10px}.i-toggle-wrapper.i-toggle--large .i-toggle{width:44px;height:24px;border-radius:12px}.i-toggle-wrapper.i-toggle--large .i-toggle .i-toggle-thumb{width:18px;height:18px}.i-toggle-wrapper.i-toggle--large .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(21px)}.i-toggle-wrapper .i-toggle{position:relative;display:inline-flex;align-items:center;padding:0 2px;transition:background-color .2s ease,border-color .2s ease;cursor:pointer;box-sizing:border-box;flex-shrink:0}.i-toggle-wrapper .i-toggle:focus{outline:none;box-shadow:0 0 0 2px #3b82f64d}.i-toggle-wrapper .i-toggle .i-toggle-thumb{border-radius:50%;transition:transform .2s ease,background-color .2s ease;flex-shrink:0}.i-toggle-wrapper .i-toggle-label{cursor:pointer;-webkit-user-select:none;user-select:none;line-height:1.4}\n"] });
|
|
6675
|
+
}
|
|
6676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: IToggle, decorators: [{
|
|
6677
|
+
type: Component,
|
|
6678
|
+
args: [{ selector: 'i-toggle', standalone: true, imports: [], providers: [
|
|
6679
|
+
{
|
|
6680
|
+
provide: NG_VALUE_ACCESSOR,
|
|
6681
|
+
useExisting: forwardRef(() => IToggle),
|
|
6682
|
+
multi: true,
|
|
6683
|
+
},
|
|
6684
|
+
], template: "<div\n class=\"i-toggle-wrapper\"\n [class.i-toggle--disabled]=\"disabled\"\n [class.i-toggle--readonly]=\"readonly\"\n [class.i-toggle--small]=\"size === 'small'\"\n [class.i-toggle--medium]=\"size === 'medium'\"\n [class.i-toggle--large]=\"size === 'large'\"\n>\n <div\n class=\"i-toggle\"\n [class.i-toggle--checked]=\"checked\"\n (click)=\"toggle()\"\n [attr.id]=\"id || componentId\"\n role=\"switch\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-labelledby]=\"label ? (id || componentId) + '-label' : null\"\n tabindex=\"0\"\n (keydown.space)=\"handleKeydown($event)\"\n (keydown.enter)=\"handleKeydown($event)\"\n >\n <span class=\"i-toggle-thumb\"></span>\n </div>\n @if (label) {\n <label\n [id]=\"(id || componentId) + '-label'\"\n class=\"i-toggle-label\"\n (click)=\"toggle()\"\n >\n {{ label }}\n </label>\n }\n</div>\n", styles: [".i-toggle-wrapper .i-toggle{background-color:var(--surface-border);border:1px solid var(--surface-border)}.i-toggle-wrapper .i-toggle:focus{box-shadow:0 2px 10px #0003}.i-toggle-wrapper .i-toggle:hover:not(.i-toggle--checked){background-color:color-mix(in srgb,var(--surface-border) 80%,var(--color-primary) 20%)}.i-toggle-wrapper .i-toggle.i-toggle--checked{background-color:var(--color-primary);border-color:var(--color-primary)}.i-toggle-wrapper .i-toggle.i-toggle--checked:hover{background-color:color-mix(in srgb,var(--color-primary) 80%,transparent);border-color:color-mix(in srgb,var(--color-primary) 80%,transparent)}.i-toggle-wrapper .i-toggle.i-toggle--checked .i-toggle-thumb,.i-toggle-wrapper .i-toggle .i-toggle-thumb{background-color:var(--color-contrast-inverse)}.i-toggle-wrapper .i-toggle-label{color:var(--color-text-primary)}.i-toggle-wrapper.i-toggle--disabled .i-toggle,.i-toggle-wrapper.i-toggle--disabled .i-toggle.i-toggle--checked{background-color:var(--color-disabled-background);border-color:var(--color-disabled-border)}.i-toggle-wrapper.i-toggle--disabled .i-toggle.i-toggle--checked .i-toggle-thumb,.i-toggle-wrapper.i-toggle--disabled .i-toggle .i-toggle-thumb{background-color:var(--color-text-disabled)}.i-toggle-wrapper.i-toggle--disabled .i-toggle-label{color:var(--color-text-disabled)}.i-toggle-wrapper{display:inline-flex;align-items:center;gap:8px;font-size:1em}.i-toggle-wrapper.i-toggle--disabled{opacity:.6;cursor:not-allowed}.i-toggle-wrapper.i-toggle--disabled .i-toggle,.i-toggle-wrapper.i-toggle--disabled .i-toggle-label{cursor:not-allowed;pointer-events:none}.i-toggle-wrapper.i-toggle--readonly .i-toggle,.i-toggle-wrapper.i-toggle--readonly .i-toggle-label{cursor:default}.i-toggle-wrapper.i-toggle--small{font-size:.9em;gap:6px}.i-toggle-wrapper.i-toggle--small .i-toggle{width:28px;height:16px;border-radius:8px}.i-toggle-wrapper.i-toggle--small .i-toggle .i-toggle-thumb{width:10px;height:10px}.i-toggle-wrapper.i-toggle--small .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(13px)}.i-toggle-wrapper.i-toggle--medium{font-size:1em;gap:8px}.i-toggle-wrapper.i-toggle--medium .i-toggle{width:36px;height:20px;border-radius:10px}.i-toggle-wrapper.i-toggle--medium .i-toggle .i-toggle-thumb{width:14px;height:14px}.i-toggle-wrapper.i-toggle--medium .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(17px)}.i-toggle-wrapper.i-toggle--large{font-size:1.2em;gap:10px}.i-toggle-wrapper.i-toggle--large .i-toggle{width:44px;height:24px;border-radius:12px}.i-toggle-wrapper.i-toggle--large .i-toggle .i-toggle-thumb{width:18px;height:18px}.i-toggle-wrapper.i-toggle--large .i-toggle.i-toggle--checked .i-toggle-thumb{transform:translate(21px)}.i-toggle-wrapper .i-toggle{position:relative;display:inline-flex;align-items:center;padding:0 2px;transition:background-color .2s ease,border-color .2s ease;cursor:pointer;box-sizing:border-box;flex-shrink:0}.i-toggle-wrapper .i-toggle:focus{outline:none;box-shadow:0 0 0 2px #3b82f64d}.i-toggle-wrapper .i-toggle .i-toggle-thumb{border-radius:50%;transition:transform .2s ease,background-color .2s ease;flex-shrink:0}.i-toggle-wrapper .i-toggle-label{cursor:pointer;-webkit-user-select:none;user-select:none;line-height:1.4}\n"] }]
|
|
6685
|
+
}], propDecorators: { label: [{
|
|
6686
|
+
type: Input
|
|
6687
|
+
}], id: [{
|
|
6688
|
+
type: Input
|
|
6689
|
+
}], disabled: [{
|
|
6690
|
+
type: Input
|
|
6691
|
+
}], readonly: [{
|
|
6692
|
+
type: Input
|
|
6693
|
+
}], size: [{
|
|
6694
|
+
type: Input
|
|
6695
|
+
}], checked: [{
|
|
6696
|
+
type: Input
|
|
6697
|
+
}], onChange: [{
|
|
6698
|
+
type: Output
|
|
6699
|
+
}] } });
|
|
6700
|
+
|
|
6518
6701
|
/**
|
|
6519
6702
|
* Tree View Component
|
|
6520
6703
|
*
|
|
@@ -9673,5 +9856,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
9673
9856
|
* Generated bundle index. Do not edit.
|
|
9674
9857
|
*/
|
|
9675
9858
|
|
|
9676
|
-
export { AbstractDialog, CLAIMS_CHECKER, ConfirmationDialogComponent, ConfirmationDialogService, DataUpdateEventService, DialogService, EmptyStateComponent, IAccordion, IAccordionList, IButton, ICalendar, ICard, IChart, ICheckbox, IChip, IChipsComponent, IDialog, IDialogActions, IDialogBase, IInputText, IListbox, IMessage, IMultiSelect, IOverlayPanel, IPanel, IPlaceholder, IProgressSpinner, IRadioButton, ISelect, ITabPanel, ITable, ITabs, ITag, ITextarea, ITreeView, IWhisper, LayoutComponent, LayoutService, LocalStorageColorSchemeKey, MenuComponent, NoContentComponent, SeoService, SidebarComponent, StructuredDataService, TooltipComponent, TooltipDirective, TopbarComponent, UniqueComponentId, WhisperService, ZIndexUtils, lastId, provideMenuClaimsChecker };
|
|
9859
|
+
export { AbstractDialog, CLAIMS_CHECKER, ConfirmationDialogComponent, ConfirmationDialogService, DataUpdateEventService, DialogService, EmptyStateComponent, IAccordion, IAccordionList, IButton, ICalendar, ICard, IChart, ICheckbox, IChip, IChipsComponent, IDialog, IDialogActions, IDialogBase, IInputText, IListbox, IMessage, IMultiSelect, IOverlayPanel, IPanel, IPlaceholder, IProgressSpinner, IRadioButton, ISelect, ITabPanel, ITable, ITabs, ITag, ITextarea, IToggle, ITreeView, IWhisper, LayoutComponent, LayoutService, LocalStorageColorSchemeKey, MenuComponent, NoContentComponent, SeoService, SidebarComponent, StructuredDataService, TooltipComponent, TooltipDirective, TopbarComponent, UniqueComponentId, WhisperService, ZIndexUtils, lastId, provideMenuClaimsChecker };
|
|
9677
9860
|
//# sourceMappingURL=integra-ng.mjs.map
|