@sixbell-telco/sdk 0.1.4 → 0.1.5
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/CHANGELOG.md +128 -4
- package/README.md +13 -6
- package/components/accordion/accordion-item/accordion-item.component.d.ts +9 -6
- package/components/avatar/src/avatar.component.d.ts +17 -12
- package/components/button/src/button.component.d.ts +29 -28
- package/components/card/src/card.component.d.ts +18 -12
- package/components/dropdown/src/dropdown.component.d.ts +29 -27
- package/components/dual-list/src/dual-list.component.d.ts +47 -37
- package/components/file-upload/file-uploader/src/file-uploader.component.d.ts +20 -11
- package/components/forms/checkbox/src/checkbox.component.d.ts +7 -3
- package/components/forms/combobox/src/combobox.component.d.ts +17 -16
- package/components/forms/input/src/input.component.d.ts +20 -15
- package/components/forms/radio/src/radio.component.d.ts +14 -1
- package/components/forms/range/src/range.component.d.ts +11 -11
- package/components/forms/select/src/select.component.d.ts +17 -15
- package/components/forms/switch/src/switch.component.d.ts +11 -11
- package/components/forms/textarea/src/textarea.component.d.ts +20 -16
- package/components/forms/toggle/src/toggle.component.d.ts +12 -7
- package/components/icon/src/icon.component.d.ts +12 -7
- package/components/link/src/link.component.d.ts +27 -16
- package/components/modal/src/modal.component.d.ts +18 -7
- package/components/notification/src/notification.component.d.ts +15 -7
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +18 -7
- package/components/product-card/src/product-card.component.d.ts +42 -17
- package/components/progress/src/progress.component.d.ts +9 -7
- package/components/tab/directives/tab-content/tab-content.directive.d.ts +8 -10
- package/components/tab/directives/tab-header/tab-header.directive.d.ts +9 -12
- package/components/tab/src/tab.component.d.ts +14 -9
- package/components/table/src/table.component.d.ts +28 -17
- package/components/toast/toast-message/toast-message.component.d.ts +9 -7
- package/components/tooltip/src/tooltip.component.d.ts +12 -7
- package/components/wizard/wizard-content/wizard-content.component.d.ts +3 -3
- package/directives/typography/src/typography.directive.d.ts +13 -12
- package/esm2022/components/accordion/accordion-item/accordion-item.component.mjs +7 -7
- package/esm2022/components/accordion/src/accordion.component.mjs +3 -3
- package/esm2022/components/avatar/src/avatar.component.mjs +7 -7
- package/esm2022/components/button/src/button.component.mjs +13 -11
- package/esm2022/components/card/src/card.component.mjs +7 -7
- package/esm2022/components/dropdown/src/dropdown.component.mjs +15 -11
- package/esm2022/components/dual-list/src/dual-list.component.mjs +53 -33
- package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.component.mjs +3 -4
- package/esm2022/components/file-upload/file-uploader/src/file-uploader.component.mjs +28 -22
- package/esm2022/components/forms/checkbox/src/checkbox.component.mjs +9 -9
- package/esm2022/components/forms/combobox/src/combobox.component.mjs +31 -28
- package/esm2022/components/forms/datepicker/src/datepicker.component.mjs +3 -3
- package/esm2022/components/forms/form-error/src/form-error.component.mjs +3 -3
- package/esm2022/components/forms/input/src/input.component.mjs +34 -34
- package/esm2022/components/forms/radio/src/radio.component.mjs +53 -4
- package/esm2022/components/forms/range/src/range.component.mjs +14 -13
- package/esm2022/components/forms/select/src/select.component.mjs +30 -28
- package/esm2022/components/forms/switch/src/switch.component.mjs +15 -14
- package/esm2022/components/forms/textarea/src/textarea.component.mjs +35 -36
- package/esm2022/components/forms/toggle/src/toggle.component.mjs +113 -90
- package/esm2022/components/icon/src/icon.component.mjs +9 -8
- package/esm2022/components/link/src/link.component.mjs +26 -20
- package/esm2022/components/modal/src/modal.component.mjs +17 -13
- package/esm2022/components/notification/src/notification.component.mjs +10 -8
- package/esm2022/components/paginator/components/pagination-item/pagination-item.component.mjs +18 -15
- package/esm2022/components/paginator/src/paginator.component.mjs +3 -3
- package/esm2022/components/product-card/src/product-card.component.mjs +52 -46
- package/esm2022/components/progress/src/progress.component.mjs +11 -11
- package/esm2022/components/tab/directives/tab-content/tab-content.directive.mjs +14 -13
- package/esm2022/components/tab/directives/tab-header/tab-header.directive.mjs +17 -15
- package/esm2022/components/tab/src/tab.component.mjs +17 -15
- package/esm2022/components/table/src/table.component.mjs +32 -23
- package/esm2022/components/table/table-header-checkbox/table-header-checkbox.component.mjs +1 -1
- package/esm2022/components/table/table-row-checkbox/table-row-checkbox.component.mjs +1 -1
- package/esm2022/components/toast/toast-message/toast-message.component.mjs +22 -17
- package/esm2022/components/toast/toasts-container/toasts-container.component.mjs +2 -2
- package/esm2022/components/tooltip/src/tooltip.component.mjs +12 -10
- package/esm2022/components/wizard/wizard-content/wizard-content.component.mjs +6 -6
- package/esm2022/components/wizard/wizard-marker/wizard-marker.component.mjs +3 -3
- package/esm2022/components/wizard/wizard-step/wizard-step.component.mjs +3 -4
- package/esm2022/components/wizard/wizard-wrapper/wizard-wrapper.component.mjs +3 -11
- package/esm2022/directives/typography/src/typography.directive.mjs +9 -6
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +9 -9
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +7 -7
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +13 -11
- package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-card.mjs +7 -7
- package/fesm2022/sixbell-telco-sdk-components-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +15 -11
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +51 -31
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +2 -3
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +27 -21
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +8 -8
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +30 -27
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +33 -33
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +52 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +13 -12
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +29 -27
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +14 -13
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +34 -35
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +113 -90
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs +9 -8
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-link.mjs +26 -20
- package/fesm2022/sixbell-telco-sdk-components-link.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +17 -13
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs +10 -8
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +20 -17
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +52 -46
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs +11 -11
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs +46 -41
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +35 -25
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +23 -18
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs +12 -10
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +11 -19
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs +8 -5
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs.map +1 -1
- package/package.json +14 -8
|
@@ -2,10 +2,50 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, model, output, Component, ChangeDetectionStrategy } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
4
4
|
import { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';
|
|
5
|
+
import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
5
7
|
|
|
6
8
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
const radioComponent = cva(['radio'], {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
primary: ['radio-primary'],
|
|
13
|
+
secondary: ['radio-secondary'],
|
|
14
|
+
accent: ['radio-accent'],
|
|
15
|
+
success: ['radio-success'],
|
|
16
|
+
warning: ['radio-warning'],
|
|
17
|
+
info: ['radio-info'],
|
|
18
|
+
error: ['radio-error'],
|
|
19
|
+
},
|
|
20
|
+
borderVariant: {
|
|
21
|
+
primary: ['border-primary'],
|
|
22
|
+
secondary: ['border-secondary'],
|
|
23
|
+
accent: ['border-accent'],
|
|
24
|
+
success: ['border-success'],
|
|
25
|
+
warning: ['border-warning'],
|
|
26
|
+
info: ['border-info'],
|
|
27
|
+
error: ['border-error'],
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
xs: ['radio-xs'],
|
|
31
|
+
sm: ['radio-sm'],
|
|
32
|
+
md: ['radio-md'],
|
|
33
|
+
lg: ['radio-lg'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
compoundVariants: [],
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: 'primary',
|
|
39
|
+
borderVariant: 'secondary',
|
|
40
|
+
size: 'md',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
7
43
|
class RadioComponent {
|
|
8
44
|
// Base radio properties
|
|
45
|
+
variant = input();
|
|
46
|
+
borderVariant = input();
|
|
47
|
+
size = input();
|
|
48
|
+
classes = input('');
|
|
9
49
|
label = input('');
|
|
10
50
|
name = input(null);
|
|
11
51
|
// Radio value model
|
|
@@ -39,14 +79,23 @@ class RadioComponent {
|
|
|
39
79
|
handleBlur() {
|
|
40
80
|
this.onControlTouch();
|
|
41
81
|
}
|
|
82
|
+
// classes
|
|
83
|
+
get componentClass() {
|
|
84
|
+
return cn(radioComponent({
|
|
85
|
+
variant: this.variant(),
|
|
86
|
+
borderVariant: this.borderVariant(),
|
|
87
|
+
size: this.size(),
|
|
88
|
+
class: this.classes(),
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
42
91
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.8", type: RadioComponent, isStandalone: true, selector: "app-radio", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", disabled: "disabledChange", onChange: "onChange" }, providers: [
|
|
92
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.8", type: RadioComponent, isStandalone: true, selector: "app-radio", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, borderVariant: { classPropertyName: "borderVariant", publicName: "borderVariant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", disabled: "disabledChange", onChange: "onChange" }, providers: [
|
|
44
93
|
{
|
|
45
94
|
provide: NG_VALUE_ACCESSOR,
|
|
46
95
|
useExisting: RadioComponent,
|
|
47
96
|
multi: true,
|
|
48
97
|
},
|
|
49
|
-
], ngImport: i0, template: "<label class=\"cursor-pointer
|
|
98
|
+
], ngImport: i0, template: "<label class=\"mb-2 flex cursor-pointer items-center justify-start gap-4\">\n\t<input\n\t\ttype=\"radio\"\n\t\t[class]=\"componentClass\"\n\t\t[value]=\"value()\"\n\t\t[checked]=\"selected() === value()\"\n\t\t[disabled]=\"disabled()\"\n\t\t[attr.name]=\"name()\"\n\t\t(change)=\"handleChange()\"\n\t\t(blur)=\"handleBlur()\"\n\t/>\n\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\">{{ label() }}</span>\n</label>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["typographyVariant", "typographyColor", "typographyFontWeight", "classes"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
50
99
|
}
|
|
51
100
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RadioComponent, decorators: [{
|
|
52
101
|
type: Component,
|
|
@@ -56,7 +105,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
|
56
105
|
useExisting: RadioComponent,
|
|
57
106
|
multi: true,
|
|
58
107
|
},
|
|
59
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"cursor-pointer
|
|
108
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"mb-2 flex cursor-pointer items-center justify-start gap-4\">\n\t<input\n\t\ttype=\"radio\"\n\t\t[class]=\"componentClass\"\n\t\t[value]=\"value()\"\n\t\t[checked]=\"selected() === value()\"\n\t\t[disabled]=\"disabled()\"\n\t\t[attr.name]=\"name()\"\n\t\t(change)=\"handleChange()\"\n\t\t(blur)=\"handleBlur()\"\n\t/>\n\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\">{{ label() }}</span>\n</label>\n" }]
|
|
60
109
|
}] });
|
|
61
110
|
|
|
62
111
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sixbell-telco-sdk-components-forms-radio.mjs","sources":["../../../projects/sdk/components/forms/radio/src/radio.component.ts","../../../projects/sdk/components/forms/radio/src/radio.component.html","../../../projects/sdk/components/forms/radio/sixbell-telco-sdk-components-forms-radio.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\n\n@Component({\n\tselector: 'app-radio',\n\tstandalone: true,\n\timports: [FormsModule, TypographyDirective],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RadioComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\ttemplateUrl: './radio.component.html',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RadioComponent implements ControlValueAccessor {\n\t// Base radio properties\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\n\t// Radio value model\n\tvalue = input.required();\n\tselected = model();\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.selected.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState?(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Change handler\n\tonChange = output<any>();\n\thandleChange(): void {\n\t\tthis.onControlChange(this.value());\n\t\tthis.onChange.emit(this.value());\n\t\tthis.selected.set(this.value());\n\t}\n\n\t// Blur handler\n\thandleBlur() {\n\t\tthis.onControlTouch();\n\t}\n}\n","<label class=\"cursor-pointer
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-components-forms-radio.mjs","sources":["../../../projects/sdk/components/forms/radio/src/radio.component.ts","../../../projects/sdk/components/forms/radio/src/radio.component.html","../../../projects/sdk/components/forms/radio/sixbell-telco-sdk-components-forms-radio.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\nimport { cn } from '@sixbell-telco/sdk/utils/cn';\nimport { cva } from 'class-variance-authority';\n\nconst radioComponent = cva(['radio'], {\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: ['radio-primary'],\n\t\t\tsecondary: ['radio-secondary'],\n\t\t\taccent: ['radio-accent'],\n\t\t\tsuccess: ['radio-success'],\n\t\t\twarning: ['radio-warning'],\n\t\t\tinfo: ['radio-info'],\n\t\t\terror: ['radio-error'],\n\t\t},\n\t\tborderVariant: {\n\t\t\tprimary: ['border-primary'],\n\t\t\tsecondary: ['border-secondary'],\n\t\t\taccent: ['border-accent'],\n\t\t\tsuccess: ['border-success'],\n\t\t\twarning: ['border-warning'],\n\t\t\tinfo: ['border-info'],\n\t\t\terror: ['border-error'],\n\t\t},\n\t\tsize: {\n\t\t\txs: ['radio-xs'],\n\t\t\tsm: ['radio-sm'],\n\t\t\tmd: ['radio-md'],\n\t\t\tlg: ['radio-lg'],\n\t\t},\n\t},\n\tcompoundVariants: [],\n\tdefaultVariants: {\n\t\tvariant: 'primary',\n\t\tborderVariant: 'secondary',\n\t\tsize: 'md',\n\t},\n});\n\nexport type RadioVariantProps = 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'error' | null | undefined;\nexport type RadioBorderVariantProps = 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'error' | null | undefined;\nexport type RadioSizeProps = 'xs' | 'sm' | 'md' | 'lg' | null | undefined;\n\nexport type RadioProps = {\n\tvariant?: RadioVariantProps;\n\tborderVariant?: RadioBorderVariantProps;\n\tsize?: RadioSizeProps;\n};\n\n@Component({\n\tselector: 'app-radio',\n\tstandalone: true,\n\timports: [FormsModule, TypographyDirective],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RadioComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\ttemplateUrl: './radio.component.html',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RadioComponent implements ControlValueAccessor {\n\t// Base radio properties\n\tvariant = input<RadioVariantProps>();\n\tborderVariant = input<RadioBorderVariantProps>();\n\tsize = input<RadioSizeProps>();\n\tclasses = input<string>('');\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\n\t// Radio value model\n\tvalue = input.required();\n\tselected = model();\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.selected.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState?(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Change handler\n\tonChange = output<any>();\n\thandleChange(): void {\n\t\tthis.onControlChange(this.value());\n\t\tthis.onChange.emit(this.value());\n\t\tthis.selected.set(this.value());\n\t}\n\n\t// Blur handler\n\thandleBlur() {\n\t\tthis.onControlTouch();\n\t}\n\n\t// classes\n\tget componentClass() {\n\t\treturn cn(\n\t\t\tradioComponent({\n\t\t\t\tvariant: this.variant(),\n\t\t\t\tborderVariant: this.borderVariant(),\n\t\t\t\tsize: this.size(),\n\t\t\t\tclass: this.classes(),\n\t\t\t}),\n\t\t);\n\t}\n}\n","<label class=\"mb-2 flex cursor-pointer items-center justify-start gap-4\">\n\t<input\n\t\ttype=\"radio\"\n\t\t[class]=\"componentClass\"\n\t\t[value]=\"value()\"\n\t\t[checked]=\"selected() === value()\"\n\t\t[disabled]=\"disabled()\"\n\t\t[attr.name]=\"name()\"\n\t\t(change)=\"handleChange()\"\n\t\t(blur)=\"handleBlur()\"\n\t/>\n\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\">{{ label() }}</span>\n</label>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;AAOA,MAAM,cAAc,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE;AACrC,IAAA,QAAQ,EAAE;AACT,QAAA,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,SAAS,EAAE,CAAC,iBAAiB,CAAC;YAC9B,MAAM,EAAE,CAAC,cAAc,CAAC;YACxB,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,IAAI,EAAE,CAAC,YAAY,CAAC;YACpB,KAAK,EAAE,CAAC,aAAa,CAAC;AACtB,SAAA;AACD,QAAA,aAAa,EAAE;YACd,OAAO,EAAE,CAAC,gBAAgB,CAAC;YAC3B,SAAS,EAAE,CAAC,kBAAkB,CAAC;YAC/B,MAAM,EAAE,CAAC,eAAe,CAAC;YACzB,OAAO,EAAE,CAAC,gBAAgB,CAAC;YAC3B,OAAO,EAAE,CAAC,gBAAgB,CAAC;YAC3B,IAAI,EAAE,CAAC,aAAa,CAAC;YACrB,KAAK,EAAE,CAAC,cAAc,CAAC;AACvB,SAAA;AACD,Q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,YAAA;AACC,gBAAA,OAAO,EAAE,iBAAiB;AAC1B,gBAAA,WAAW,EAAE,cAAc;AAC3B,gBAAA,KAAK,EAAE,IAAI;AACX,aAAA;AACD,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EC9DF,+bAaA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,ED0CW,WAAW,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,mBAAmB,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,mBAAA,EAAA,iBAAA,EAAA,sBAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAW9B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAd1B,SAAS;+BACC,WAAW,EAAA,UAAA,EACT,IAAI,EACP,OAAA,EAAA,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAChC,SAAA,EAAA;AACV,wBAAA;AACC,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAgB,cAAA;AAC3B,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;qBACD,EAEgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,+bAAA,EAAA,CAAA;;;AEhEhD;;AAEG;;;;"}
|
|
@@ -7,7 +7,7 @@ import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
-
const
|
|
10
|
+
const rangeComponent = cva(['range'], {
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
13
|
primary: ['range-primary'],
|
|
@@ -32,8 +32,9 @@ const range = cva(['range'], {
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
class RangeComponent {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
variant = input();
|
|
36
|
+
size = input();
|
|
37
|
+
classes = input('');
|
|
37
38
|
label = input('');
|
|
38
39
|
name = input(null);
|
|
39
40
|
min = input(0);
|
|
@@ -74,21 +75,21 @@ class RangeComponent {
|
|
|
74
75
|
this.onControlChange(this.value());
|
|
75
76
|
this.onChange.emit(this.value());
|
|
76
77
|
}
|
|
77
|
-
get
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
78
|
+
get componentClass() {
|
|
79
|
+
return cn(rangeComponent({
|
|
80
|
+
variant: this.variant(),
|
|
81
|
+
size: this.size(),
|
|
82
|
+
class: this.classes(),
|
|
83
|
+
}));
|
|
83
84
|
}
|
|
84
85
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: RangeComponent, isStandalone: true, selector: "app-range", inputs: {
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: RangeComponent, isStandalone: true, selector: "app-range", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, showRange: { classPropertyName: "showRange", publicName: "showRange", isSignal: true, isRequired: false, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", disabled: "disabledChange", onChange: "onChange" }, providers: [
|
|
86
87
|
{
|
|
87
88
|
provide: NG_VALUE_ACCESSOR,
|
|
88
89
|
useExisting: RangeComponent,
|
|
89
90
|
multi: true,
|
|
90
91
|
},
|
|
91
|
-
], ngImport: i0, template: "@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span [
|
|
92
|
+
], ngImport: i0, template: "@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span>\n\t</label>\n}\n\n@if (showRange()) {\n\t<div class=\"flex justify-between\">\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ min() }}</span>\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ max() }}</span>\n\t</div>\n}\n\n<input\n\t[class]=\"componentClass\"\n\t[attr.name]=\"name()\"\n\ttype=\"range\"\n\t[min]=\"min()\"\n\t[max]=\"max()\"\n\t[step]=\"jumpSize()\"\n\t[value]=\"value()\"\n\t[(ngModel)]=\"value\"\n\t[disabled]=\"disabled()\"\n\t(ngModelChange)=\"handleChange()\"\n/>\n\n@if (steps() > 0) {\n\t<div class=\"flex w-full justify-between px-2 text-xs\">\n\t\t@for (step of stepsQuantity(); track $index) {\n\t\t\t<span>|</span>\n\t\t}\n\t</div>\n}\n", dependencies: [{ kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["typographyVariant", "typographyColor", "typographyFontWeight", "classes"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
92
93
|
}
|
|
93
94
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RangeComponent, decorators: [{
|
|
94
95
|
type: Component,
|
|
@@ -98,7 +99,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
|
98
99
|
useExisting: RangeComponent,
|
|
99
100
|
multi: true,
|
|
100
101
|
},
|
|
101
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span [
|
|
102
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span>\n\t</label>\n}\n\n@if (showRange()) {\n\t<div class=\"flex justify-between\">\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ min() }}</span>\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ max() }}</span>\n\t</div>\n}\n\n<input\n\t[class]=\"componentClass\"\n\t[attr.name]=\"name()\"\n\ttype=\"range\"\n\t[min]=\"min()\"\n\t[max]=\"max()\"\n\t[step]=\"jumpSize()\"\n\t[value]=\"value()\"\n\t[(ngModel)]=\"value\"\n\t[disabled]=\"disabled()\"\n\t(ngModelChange)=\"handleChange()\"\n/>\n\n@if (steps() > 0) {\n\t<div class=\"flex w-full justify-between px-2 text-xs\">\n\t\t@for (step of stepsQuantity(); track $index) {\n\t\t\t<span>|</span>\n\t\t}\n\t</div>\n}\n" }]
|
|
102
103
|
}] });
|
|
103
104
|
|
|
104
105
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sixbell-telco-sdk-components-forms-range.mjs","sources":["../../../projects/sdk/components/forms/range/src/range.component.ts","../../../projects/sdk/components/forms/range/src/range.component.html","../../../projects/sdk/components/forms/range/sixbell-telco-sdk-components-forms-range.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ChangeDetectionStrategy, Component, computed, input, model, output } from '@angular/core';\nimport { ControlValueAccessor, FormControl, FormGroup, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\nimport { cn } from '@sixbell-telco/sdk/utils/cn';\nimport { cva, VariantProps } from 'class-variance-authority';\n\nconst range = cva(['range'], {\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: ['range-primary'],\n\t\t\tsecondary: ['range-secondary'],\n\t\t\tsuccess: ['range-success'],\n\t\t\tinfo: ['range-info'],\n\t\t\terror: ['range-error'],\n\t\t\twarning: ['range-warning'],\n\t\t\taccent: ['range-accent'],\n\t\t},\n\t\tsize: {\n\t\t\txs: ['range-xs'],\n\t\t\tsm: ['range-sm'],\n\t\t\tmd: ['range-md'],\n\t\t\tlg: ['range-mlg'],\n\t\t},\n\t},\n\tcompoundVariants: [],\n\tdefaultVariants: {\n\t\tvariant: 'primary',\n\t\tsize: 'xs',\n\t},\n});\n\nexport type RangeVariantProps = VariantProps<typeof range>;\n\n@Component({\n\tselector: 'app-range',\n\ttemplateUrl: './range.component.html',\n\tstandalone: true,\n\timports: [TypographyDirective, FormsModule],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RangeComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RangeComponent implements ControlValueAccessor {\n\tvariants = input<RangeVariantProps>();\n\tclass = input<string>('');\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\tmin = input<number>(0);\n\tmax = input<number>(100);\n\tshowRange = input<boolean>(true);\n\n\tsteps = input<number>(0);\n\tstepsQuantity = computed(() => Array.from({ length: this.steps() + 1 }));\n\tjumpSize = computed(() => (this.max() - this.min()) / this.steps());\n\n\tvalue = model<number>(0);\n\n\t// Form control properties\n\tparentForm = input<FormGroup | null>(null);\n\tformControlName = input<string>('');\n\n\tget formField(): FormControl | null {\n\t\tif (!this.parentForm()) return null;\n\t\treturn this.parentForm()?.get(this.formControlName()) as FormControl;\n\t}\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.value.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Change handler\n\tonChange = output<number>();\n\thandleChange() {\n\t\tthis.onControlChange(this.value());\n\t\tthis.onChange.emit(this.value());\n\t}\n\n\tget classes() {\n\t\tconst variants = this.variants();\n\t\treturn cn(\n\t\t\trange({\n\t\t\t\tvariant: variants?.variant,\n\t\t\t\tsize: variants?.size,\n\t\t\t}),\n\t\t\tthis.class(),\n\t\t);\n\t}\n}\n","@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span [typography]=\"{ variant: 'body', color: 'black', fontWeight: 'normal' }\">{{ label() }}</span>\n\t</label>\n}\n\n@if (showRange()) {\n\t<div class=\"flex justify-between\">\n\t\t<span [typography]=\"{ variant: 'body-sm' }\">{{ min() }}</span>\n\t\t<span [typography]=\"{ variant: 'body-sm' }\">{{ max() }}</span>\n\t</div>\n}\n\n<input\n\t[class]=\"classes\"\n\t[attr.name]=\"name()\"\n\ttype=\"range\"\n\t[min]=\"min()\"\n\t[max]=\"max()\"\n\t[step]=\"jumpSize()\"\n\t[value]=\"value()\"\n\t[(ngModel)]=\"value\"\n\t[disabled]=\"disabled()\"\n\t(ngModelChange)=\"handleChange()\"\n/>\n\n@if (steps() > 0) {\n\t<div class=\"flex w-full justify-between px-2 text-xs\">\n\t\t@for (step of stepsQuantity(); track $index) {\n\t\t\t<span>|</span>\n\t\t}\n\t</div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AAOA,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE;AAC5B,IAAA,QAAQ,EAAE;AACT,QAAA,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,SAAS,EAAE,CAAC,iBAAiB,CAAC;YAC9B,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,IAAI,EAAE,CAAC,YAAY,CAAC;YACpB,KAAK,EAAE,CAAC,aAAa,CAAC;YACtB,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,MAAM,EAAE,CAAC,cAAc,CAAC;AACxB,SAAA;AACD,QAAA,IAAI,EAAE;YACL,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,WAAW,CAAC;AACjB,SAAA;AACD,KAAA;AACD,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,eAAe,EAAE;AACh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AA,IAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,QAAA,EAAA,8FAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,qDAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAU9B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAd1B,SAAS;+BACC,WAAW,EAAA,UAAA,EAET,IAAI,EACP,OAAA,EAAA,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAChC,SAAA,EAAA;AACV,wBAAA;AACC,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAgB,cAAA;AAC3B,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;qBACD,EACgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,0zBAAA,EAAA,CAAA;;;AE9ChD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-components-forms-range.mjs","sources":["../../../projects/sdk/components/forms/range/src/range.component.ts","../../../projects/sdk/components/forms/range/src/range.component.html","../../../projects/sdk/components/forms/range/sixbell-telco-sdk-components-forms-range.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ChangeDetectionStrategy, Component, computed, input, model, output } from '@angular/core';\nimport { ControlValueAccessor, FormControl, FormGroup, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\nimport { cn } from '@sixbell-telco/sdk/utils/cn';\nimport { cva } from 'class-variance-authority';\n\nconst rangeComponent = cva(['range'], {\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: ['range-primary'],\n\t\t\tsecondary: ['range-secondary'],\n\t\t\tsuccess: ['range-success'],\n\t\t\tinfo: ['range-info'],\n\t\t\terror: ['range-error'],\n\t\t\twarning: ['range-warning'],\n\t\t\taccent: ['range-accent'],\n\t\t},\n\t\tsize: {\n\t\t\txs: ['range-xs'],\n\t\t\tsm: ['range-sm'],\n\t\t\tmd: ['range-md'],\n\t\t\tlg: ['range-mlg'],\n\t\t},\n\t},\n\tcompoundVariants: [],\n\tdefaultVariants: {\n\t\tvariant: 'primary',\n\t\tsize: 'xs',\n\t},\n});\n\nexport type RangeVariantProps = 'primary' | 'secondary' | 'success' | 'info' | 'error' | 'warning' | 'accent' | null | undefined;\nexport type RangeSizeProps = 'xs' | 'sm' | 'md' | 'lg' | null | undefined;\n\nexport type RangeProps = {\n\tvariant?: RangeVariantProps;\n\tsize?: RangeSizeProps;\n};\n\n@Component({\n\tselector: 'app-range',\n\ttemplateUrl: './range.component.html',\n\tstandalone: true,\n\timports: [TypographyDirective, FormsModule],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RangeComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RangeComponent implements ControlValueAccessor {\n\tvariant = input<RangeVariantProps>();\n\tsize = input<RangeSizeProps>();\n\tclasses = input<string>('');\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\tmin = input<number>(0);\n\tmax = input<number>(100);\n\tshowRange = input<boolean>(true);\n\n\tsteps = input<number>(0);\n\tstepsQuantity = computed(() => Array.from({ length: this.steps() + 1 }));\n\tjumpSize = computed(() => (this.max() - this.min()) / this.steps());\n\n\tvalue = model<number>(0);\n\n\t// Form control properties\n\tparentForm = input<FormGroup | null>(null);\n\tformControlName = input<string>('');\n\n\tget formField(): FormControl | null {\n\t\tif (!this.parentForm()) return null;\n\t\treturn this.parentForm()?.get(this.formControlName()) as FormControl;\n\t}\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.value.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Change handler\n\tonChange = output<number>();\n\thandleChange() {\n\t\tthis.onControlChange(this.value());\n\t\tthis.onChange.emit(this.value());\n\t}\n\n\tget componentClass() {\n\t\treturn cn(\n\t\t\trangeComponent({\n\t\t\t\tvariant: this.variant(),\n\t\t\t\tsize: this.size(),\n\t\t\t\tclass: this.classes(),\n\t\t\t}),\n\t\t);\n\t}\n}\n","@if (label()) {\n\t<label [for]=\"this.name()\">\n\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span>\n\t</label>\n}\n\n@if (showRange()) {\n\t<div class=\"flex justify-between\">\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ min() }}</span>\n\t\t<span typography [typographyVariant]=\"'body-sm'\">{{ max() }}</span>\n\t</div>\n}\n\n<input\n\t[class]=\"componentClass\"\n\t[attr.name]=\"name()\"\n\ttype=\"range\"\n\t[min]=\"min()\"\n\t[max]=\"max()\"\n\t[step]=\"jumpSize()\"\n\t[value]=\"value()\"\n\t[(ngModel)]=\"value\"\n\t[disabled]=\"disabled()\"\n\t(ngModelChange)=\"handleChange()\"\n/>\n\n@if (steps() > 0) {\n\t<div class=\"flex w-full justify-between px-2 text-xs\">\n\t\t@for (step of stepsQuantity(); track $index) {\n\t\t\t<span>|</span>\n\t\t}\n\t</div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AAOA,MAAM,cAAc,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE;AACrC,IAAA,QAAQ,EAAE;AACT,QAAA,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,SAAS,EAAE,CAAC,iBAAiB,CAAC;YAC9B,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,IAAI,EAAE,CAAC,YAAY,CAAC;YACpB,KAAK,EAAE,CAAC,aAAa,CAAC;YACtB,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,MAAM,EAAE,CAAC,cAAc,CAAC;AACxB,SAAA;AACD,QAAA,IAAI,EAAE;YACL,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,UAAU,CAAC;YAChB,EAAE,EAAE,CAAC,WAAW,CAAC;AACjB,SAAA;AACD,KAAA;AACD,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,eAAe,EAAE;AAChB,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,IAAI,EAAE,IAAI;AACV,KAAA;AACD,CAAA,CAAC,CAAC;MAwBU,cAAc,CAAA;IAC1B,OAAO,GAAG,KAAK,EAAqB,CAAC;IACrC,IAAI,GAAG,KAAK,EAAkB,CAAC;AAC/B,IAAA,OAAO,GAAG,KAAK,CAAS,EAAE,CAAC,CAAC;AAC5B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC,CAAC;AAC1B,IAAA,IAAI,GAAG,KAAK,CAAgB,IAAI,CAAC,CAAC;AAClC,IAAA,GAAG,GAAG,KAAK,CAAS,CAAC,CAAC,CAAC;AACvB,IAAA,GAAG,GAAG,KAAK,CAAS,GAAG,CAAC,CAAC;AACzB,IAAA,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EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAU9B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAd1B,SAAS;+BACC,WAAW,EAAA,UAAA,EAET,IAAI,EACP,OAAA,EAAA,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAChC,SAAA,EAAA;AACV,wBAAA;AACC,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAgB,cAAA;AAC3B,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;qBACD,EACgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,42BAAA,EAAA,CAAA;;;AEpDhD;;AAEG;;;;"}
|
|
@@ -7,7 +7,7 @@ import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
-
const
|
|
10
|
+
const selectComponent = cva(['w-full', 'font-body'], {
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
13
|
primary: ['select', 'select-bordered', 'select-primary'],
|
|
@@ -38,8 +38,10 @@ const nativeSelect = cva(['w-full', 'font-body'], {
|
|
|
38
38
|
});
|
|
39
39
|
class SelectComponent {
|
|
40
40
|
// Base input properties
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
variant = input('secondary');
|
|
42
|
+
shape = input('round-sm');
|
|
43
|
+
height = input('md');
|
|
44
|
+
classes = input('');
|
|
43
45
|
label = input('');
|
|
44
46
|
name = input(null);
|
|
45
47
|
placeholder = input('');
|
|
@@ -89,51 +91,51 @@ class SelectComponent {
|
|
|
89
91
|
optionsEffect = effect(() => {
|
|
90
92
|
this.simpleOption = this.options().every((option) => typeof option !== 'object');
|
|
91
93
|
});
|
|
92
|
-
get
|
|
93
|
-
return cn(
|
|
94
|
-
variant: this.
|
|
95
|
-
shape: this.
|
|
96
|
-
height: this.
|
|
97
|
-
class: this.
|
|
94
|
+
get componentClass() {
|
|
95
|
+
return cn(selectComponent({
|
|
96
|
+
variant: this.variant(),
|
|
97
|
+
shape: this.shape(),
|
|
98
|
+
height: this.height(),
|
|
99
|
+
class: this.classes(),
|
|
98
100
|
}));
|
|
99
101
|
}
|
|
100
|
-
get
|
|
101
|
-
return cn(
|
|
102
|
+
get errorClass() {
|
|
103
|
+
return cn(selectComponent({
|
|
102
104
|
variant: 'error',
|
|
103
|
-
shape: this.
|
|
104
|
-
height: this.
|
|
105
|
-
class: this.
|
|
105
|
+
shape: this.shape(),
|
|
106
|
+
height: this.height(),
|
|
107
|
+
class: this.classes(),
|
|
106
108
|
}));
|
|
107
109
|
}
|
|
108
|
-
get
|
|
109
|
-
return cn(
|
|
110
|
+
get successClass() {
|
|
111
|
+
return cn(selectComponent({
|
|
110
112
|
variant: 'success',
|
|
111
|
-
shape: this.
|
|
112
|
-
height: this.
|
|
113
|
-
class: this.
|
|
113
|
+
shape: this.shape(),
|
|
114
|
+
height: this.height(),
|
|
115
|
+
class: this.classes(),
|
|
114
116
|
}));
|
|
115
117
|
}
|
|
116
|
-
get
|
|
118
|
+
get validationClass() {
|
|
117
119
|
if (!this.formField)
|
|
118
|
-
return this.
|
|
120
|
+
return this.componentClass;
|
|
119
121
|
if (this.formField.dirty || this.formField.touched) {
|
|
120
122
|
if (this.formField.invalid) {
|
|
121
|
-
return this.
|
|
123
|
+
return this.errorClass;
|
|
122
124
|
}
|
|
123
125
|
else if (this.formField.valid) {
|
|
124
|
-
return this.
|
|
126
|
+
return this.successClass;
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
return this.
|
|
129
|
+
return this.componentClass;
|
|
128
130
|
}
|
|
129
131
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: SelectComponent, isStandalone: true, selector: "app-select", inputs: {
|
|
132
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: SelectComponent, isStandalone: true, selector: "app-select", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, emptyOptionText: { classPropertyName: "emptyOptionText", publicName: "emptyOptionText", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", disabled: "disabledChange", onChange: "onChange" }, providers: [
|
|
131
133
|
{
|
|
132
134
|
provide: NG_VALUE_ACCESSOR,
|
|
133
135
|
useExisting: SelectComponent,
|
|
134
136
|
multi: true,
|
|
135
137
|
},
|
|
136
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span [
|
|
138
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<select\n\t\t[class]=\"validationClass\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(ngModelChange)=\"handleSelect()\"\n\t\t(blur)=\"handleBlur()\"\n\t>\n\t\t@if (emptyOptionText()) {\n\t\t\t<option value=\"\">\n\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ emptyOptionText() }}</span>\n\t\t\t</option>\n\t\t}\n\n\t\t@if (simpleOption) {\n\t\t\t@for (option of options(); track option) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t} @else {\n\t\t\t@for (option of options(); track option[trackBy()]) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option[key()] }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t}\n\t</select>\n\n\t<ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["typographyVariant", "typographyColor", "typographyFontWeight", "classes"] }] });
|
|
137
139
|
}
|
|
138
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SelectComponent, decorators: [{
|
|
139
141
|
type: Component,
|
|
@@ -143,7 +145,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
|
143
145
|
useExisting: SelectComponent,
|
|
144
146
|
multi: true,
|
|
145
147
|
},
|
|
146
|
-
], template: "<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span [
|
|
148
|
+
], template: "<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<select\n\t\t[class]=\"validationClass\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(ngModelChange)=\"handleSelect()\"\n\t\t(blur)=\"handleBlur()\"\n\t>\n\t\t@if (emptyOptionText()) {\n\t\t\t<option value=\"\">\n\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ emptyOptionText() }}</span>\n\t\t\t</option>\n\t\t}\n\n\t\t@if (simpleOption) {\n\t\t\t@for (option of options(); track option) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t} @else {\n\t\t\t@for (option of options(); track option[trackBy()]) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option[key()] }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t}\n\t</select>\n\n\t<ng-content></ng-content>\n</div>\n" }]
|
|
147
149
|
}] });
|
|
148
150
|
|
|
149
151
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sixbell-telco-sdk-components-forms-select.mjs","sources":["../../../projects/sdk/components/forms/select/src/select.component.ts","../../../projects/sdk/components/forms/select/src/select.component.html","../../../projects/sdk/components/forms/select/sixbell-telco-sdk-components-forms-select.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Component, effect, input, model, output } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\nimport { cn } from '@sixbell-telco/sdk/utils/cn';\nimport { VariantProps, cva } from 'class-variance-authority';\n\nconst nativeSelect = cva(['w-full', 'font-body'], {\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: ['select', 'select-bordered', 'select-primary'],\n\t\t\tsecondary: ['select', 'select-bordered', 'select-secondary'],\n\t\t\tsuccess: ['select', 'select-bordered', 'select-success'],\n\t\t\terror: ['select', 'select-bordered', 'select-error'],\n\t\t\twarning: ['select', 'select-bordered', 'select-warning'],\n\t\t},\n\t\tshape: {\n\t\t\t'round-none': ['rounded-none'],\n\t\t\t'round-sm': ['rounded-btn-sm'],\n\t\t\t'round-md': ['rounded-btn-md'],\n\t\t\t'round-lg': ['rounded-btn-lg'],\n\t\t},\n\t\theight: {\n\t\t\tfit: ['h-fit', 'min-h-fit'],\n\t\t\tsm: ['h-[1.875rem]', 'min-h-[1.875rem]'],\n\t\t\tmd: ['h-11', 'min-h-10'],\n\t\t\tlg: ['h-12', 'min-h-10'],\n\t\t},\n\t},\n\tcompoundVariants: [],\n\tdefaultVariants: {\n\t\tvariant: 'secondary',\n\t\tshape: 'round-sm',\n\t\theight: 'md',\n\t},\n});\n\nexport type NativeSelectVariantProps = VariantProps<typeof nativeSelect>;\n\n@Component({\n\tselector: 'app-select',\n\tstandalone: true,\n\timports: [FormsModule, TypographyDirective],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: SelectComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\ttemplateUrl: './select.component.html',\n\t// changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SelectComponent {\n\t// Base input properties\n\tvariants = input<NativeSelectVariantProps>({ variant: 'secondary', shape: 'round-sm', height: 'md' });\n\tclass = input<string>('');\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\tplaceholder = input<string>('');\n\tvalue = model();\n\toptions = input<any[]>([]);\n\temptyOptionText = input<string>('');\n\n\t// Options properties\n\ttrackBy = input<string>('id');\n\tkey = input<string>('name');\n\n\t// Form control properties\n\tparentForm = input<FormGroup | null>(null);\n\tformControlName = input<string>('');\n\n\tget formField(): FormControl | null {\n\t\tif (!this.parentForm()) return null;\n\t\treturn this.parentForm()?.get(this.formControlName()) as FormControl;\n\t}\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.value.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState?(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Select handler\n\tonChange = output<any>();\n\thandleSelect() {\n\t\tthis.onChange.emit(this.value());\n\t\tthis.onControlChange(this.value());\n\t}\n\n\t// Blur handler\n\thandleBlur() {\n\t\tthis.onControlTouch();\n\t}\n\n\t// Checks if options are primitives or not\n\tsimpleOption = false;\n\toptionsEffect = effect(() => {\n\t\tthis.simpleOption = this.options().every((option) => typeof option !== 'object');\n\t});\n\n\tget classes() {\n\t\treturn cn(\n\t\t\tnativeSelect({\n\t\t\t\tvariant: this.variants()?.variant,\n\t\t\t\tshape: this.variants()?.shape,\n\t\t\t\theight: this.variants()?.height,\n\t\t\t\tclass: this.class(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget errorClasses() {\n\t\treturn cn(\n\t\t\tnativeSelect({\n\t\t\t\tvariant: 'error',\n\t\t\t\tshape: this.variants()?.shape,\n\t\t\t\theight: this.variants()?.height,\n\t\t\t\tclass: this.class(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget successClasses() {\n\t\treturn cn(\n\t\t\tnativeSelect({\n\t\t\t\tvariant: 'success',\n\t\t\t\tshape: this.variants()?.shape,\n\t\t\t\theight: this.variants()?.height,\n\t\t\t\tclass: this.class(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget validationClasses() {\n\t\tif (!this.formField) return this.classes;\n\n\t\tif (this.formField.dirty || this.formField.touched) {\n\t\t\tif (this.formField.invalid) {\n\t\t\t\treturn this.errorClasses;\n\t\t\t} else if (this.formField.valid) {\n\t\t\t\treturn this.successClasses;\n\t\t\t}\n\t\t}\n\n\t\treturn this.classes;\n\t}\n}\n","<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span [typography]=\"{ variant: 'body', color: 'black', fontWeight: 'normal' }\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<select\n\t\t[class]=\"validationClasses\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(ngModelChange)=\"handleSelect()\"\n\t\t(blur)=\"handleBlur()\"\n\t>\n\t\t@if (emptyOptionText()) {\n\t\t\t<option value=\"\">\n\t\t\t\t<span [typography]=\"{ variant: 'body', color: 'black', fontWeight: 'normal' }\">{{ emptyOptionText() }}</span>\n\t\t\t</option>\n\t\t}\n\n\t\t@if (simpleOption) {\n\t\t\t@for (option of options(); track option) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span [typography]=\"{ variant: 'body', color: 'black', fontWeight: 'normal' }\">{{ option }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t} @else {\n\t\t\t@for (option of options(); track option[trackBy()]) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span [typography]=\"{ variant: 'body', color: 'black', fontWeight: 'normal' }\">{{ option[key()] }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t}\n\t</select>\n\n\t<ng-content></ng-content>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AAOA,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE;AACjD,IAAA,QAAQ,EAAE;AACT,QAAA,OAAO,EAAE;AACR,YAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,CAAC;AACxD,YAAA,SAAS,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;AAC5D,YAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,CAAC;AACxD,YAAA,KAAK,EAAE,CAA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AAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,mBAAmB,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,YAAA,EAAA,OAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAW9B,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;+BACC,YAAY,EAAA,UAAA,EACV,IAAI,EACP,OAAA,EAAA,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAChC,SAAA,EAAA;AACV,wBAAA;AACC,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAiB,eAAA;AAC5B,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;AACD,qBAAA,EAAA,QAAA,EAAA,0sCAAA,EAAA,CAAA;;;AEjDF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-components-forms-select.mjs","sources":["../../../projects/sdk/components/forms/select/src/select.component.ts","../../../projects/sdk/components/forms/select/src/select.component.html","../../../projects/sdk/components/forms/select/sixbell-telco-sdk-components-forms-select.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Component, effect, input, model, output } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';\nimport { cn } from '@sixbell-telco/sdk/utils/cn';\nimport { cva } from 'class-variance-authority';\n\nconst selectComponent = cva(['w-full', 'font-body'], {\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: ['select', 'select-bordered', 'select-primary'],\n\t\t\tsecondary: ['select', 'select-bordered', 'select-secondary'],\n\t\t\tsuccess: ['select', 'select-bordered', 'select-success'],\n\t\t\terror: ['select', 'select-bordered', 'select-error'],\n\t\t\twarning: ['select', 'select-bordered', 'select-warning'],\n\t\t},\n\t\tshape: {\n\t\t\t'round-none': ['rounded-none'],\n\t\t\t'round-sm': ['rounded-btn-sm'],\n\t\t\t'round-md': ['rounded-btn-md'],\n\t\t\t'round-lg': ['rounded-btn-lg'],\n\t\t},\n\t\theight: {\n\t\t\tfit: ['h-fit', 'min-h-fit'],\n\t\t\tsm: ['h-[1.875rem]', 'min-h-[1.875rem]'],\n\t\t\tmd: ['h-11', 'min-h-10'],\n\t\t\tlg: ['h-12', 'min-h-10'],\n\t\t},\n\t},\n\tcompoundVariants: [],\n\tdefaultVariants: {\n\t\tvariant: 'secondary',\n\t\tshape: 'round-sm',\n\t\theight: 'md',\n\t},\n});\n\nexport type SelectVariantProps = 'primary' | 'secondary' | 'success' | 'error' | 'warning' | null | undefined;\nexport type SelectShapeProps = 'round-none' | 'round-sm' | 'round-md' | 'round-lg' | null | undefined;\nexport type SelectHeightProps = 'fit' | 'sm' | 'md' | 'lg' | null | undefined;\n\nexport type SelectProps = {\n\tvariant?: SelectVariantProps;\n\tshape?: SelectShapeProps;\n\theight?: SelectHeightProps;\n};\n\n@Component({\n\tselector: 'app-select',\n\tstandalone: true,\n\timports: [FormsModule, TypographyDirective],\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: SelectComponent,\n\t\t\tmulti: true,\n\t\t},\n\t],\n\ttemplateUrl: './select.component.html',\n\t// changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SelectComponent {\n\t// Base input properties\n\tvariant = input<SelectVariantProps>('secondary');\n\tshape = input<SelectShapeProps>('round-sm');\n\theight = input<SelectHeightProps>('md');\n\tclasses = input<string>('');\n\tlabel = input<string>('');\n\tname = input<string | null>(null);\n\tplaceholder = input<string>('');\n\tvalue = model();\n\toptions = input<any[]>([]);\n\temptyOptionText = input<string>('');\n\n\t// Options properties\n\ttrackBy = input<string>('id');\n\tkey = input<string>('name');\n\n\t// Form control properties\n\tparentForm = input<FormGroup | null>(null);\n\tformControlName = input<string>('');\n\n\tget formField(): FormControl | null {\n\t\tif (!this.parentForm()) return null;\n\t\treturn this.parentForm()?.get(this.formControlName()) as FormControl;\n\t}\n\n\t// ControlValueAccessor attributes\n\tprivate onControlChange: any = () => {};\n\tprivate onControlTouch: any = () => {};\n\tdisabled = model<boolean>(false);\n\n\t// ControlValueAccessor methods\n\twriteValue(obj: any): void {\n\t\tthis.value.set(obj);\n\t}\n\n\tregisterOnChange(fn: any): void {\n\t\tthis.onControlChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any): void {\n\t\tthis.onControlTouch = fn;\n\t}\n\n\tsetDisabledState?(isDisabled: boolean): void {\n\t\tthis.disabled.set(isDisabled);\n\t}\n\n\t// Select handler\n\tonChange = output<any>();\n\thandleSelect() {\n\t\tthis.onChange.emit(this.value());\n\t\tthis.onControlChange(this.value());\n\t}\n\n\t// Blur handler\n\thandleBlur() {\n\t\tthis.onControlTouch();\n\t}\n\n\t// Checks if options are primitives or not\n\tsimpleOption = false;\n\toptionsEffect = effect(() => {\n\t\tthis.simpleOption = this.options().every((option) => typeof option !== 'object');\n\t});\n\n\tget componentClass() {\n\t\treturn cn(\n\t\t\tselectComponent({\n\t\t\t\tvariant: this.variant(),\n\t\t\t\tshape: this.shape(),\n\t\t\t\theight: this.height(),\n\t\t\t\tclass: this.classes(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget errorClass() {\n\t\treturn cn(\n\t\t\tselectComponent({\n\t\t\t\tvariant: 'error',\n\t\t\t\tshape: this.shape(),\n\t\t\t\theight: this.height(),\n\t\t\t\tclass: this.classes(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget successClass() {\n\t\treturn cn(\n\t\t\tselectComponent({\n\t\t\t\tvariant: 'success',\n\t\t\t\tshape: this.shape(),\n\t\t\t\theight: this.height(),\n\t\t\t\tclass: this.classes(),\n\t\t\t}),\n\t\t);\n\t}\n\n\tget validationClass() {\n\t\tif (!this.formField) return this.componentClass;\n\n\t\tif (this.formField.dirty || this.formField.touched) {\n\t\t\tif (this.formField.invalid) {\n\t\t\t\treturn this.errorClass;\n\t\t\t} else if (this.formField.valid) {\n\t\t\t\treturn this.successClass;\n\t\t\t}\n\t\t}\n\n\t\treturn this.componentClass;\n\t}\n}\n","<div class=\"flex flex-col gap-1\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\" class=\"block\"\n\t\t\t><span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<select\n\t\t[class]=\"validationClass\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(ngModelChange)=\"handleSelect()\"\n\t\t(blur)=\"handleBlur()\"\n\t>\n\t\t@if (emptyOptionText()) {\n\t\t\t<option value=\"\">\n\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ emptyOptionText() }}</span>\n\t\t\t</option>\n\t\t}\n\n\t\t@if (simpleOption) {\n\t\t\t@for (option of options(); track option) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t} @else {\n\t\t\t@for (option of options(); track option[trackBy()]) {\n\t\t\t\t<option [ngValue]=\"option\">\n\t\t\t\t\t<span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\" [typographyFontWeight]=\"'normal'\">{{ option[key()] }}</span>\n\t\t\t\t</option>\n\t\t\t}\n\t\t}\n\t</select>\n\n\t<ng-content></ng-content>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AAOA,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,QAAQ,EA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ular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
2
|
import { input, model, output, Component, ChangeDetectionStrategy } from '@angular/core';
|
|
4
3
|
import * as i1 from '@angular/forms';
|
|
@@ -8,7 +7,7 @@ import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
9
8
|
|
|
10
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
|
-
const
|
|
10
|
+
const switchComponent = cva(['toggle', 'border-transparent checked:border-transparent bg-base-100 [--tglbg:var(--fallback-b1,oklch(var(--s)/1))] hover:bg-base-100'], {
|
|
12
11
|
variants: {
|
|
13
12
|
variant: {
|
|
14
13
|
primary: [
|
|
@@ -48,8 +47,9 @@ const nativeSwitchBase = cva(['toggle', 'border-transparent checked:border-trans
|
|
|
48
47
|
});
|
|
49
48
|
class SwitchComponent {
|
|
50
49
|
// Base switch properties
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
variant = input('primary');
|
|
51
|
+
size = input('md');
|
|
52
|
+
classes = input('');
|
|
53
53
|
label = input('');
|
|
54
54
|
name = input(null);
|
|
55
55
|
value = model(false);
|
|
@@ -72,11 +72,12 @@ class SwitchComponent {
|
|
|
72
72
|
}
|
|
73
73
|
// Change handler
|
|
74
74
|
onChange = output();
|
|
75
|
-
get
|
|
76
|
-
return cn(
|
|
77
|
-
variant: this.
|
|
78
|
-
size: this.
|
|
79
|
-
|
|
75
|
+
get componentClass() {
|
|
76
|
+
return cn(switchComponent({
|
|
77
|
+
variant: this.variant(),
|
|
78
|
+
size: this.size(),
|
|
79
|
+
class: this.classes(),
|
|
80
|
+
}));
|
|
80
81
|
}
|
|
81
82
|
handleChange() {
|
|
82
83
|
this.onControlChange(this.value());
|
|
@@ -87,23 +88,23 @@ class SwitchComponent {
|
|
|
87
88
|
this.onControlTouch();
|
|
88
89
|
}
|
|
89
90
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
90
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: SwitchComponent, isStandalone: true, selector: "app-switch", inputs: {
|
|
91
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: SwitchComponent, isStandalone: true, selector: "app-switch", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", disabled: "disabledChange", onChange: "onChange" }, providers: [
|
|
91
92
|
{
|
|
92
93
|
provide: NG_VALUE_ACCESSOR,
|
|
93
94
|
useExisting: SwitchComponent,
|
|
94
95
|
multi: true,
|
|
95
96
|
},
|
|
96
|
-
], ngImport: i0, template: "<div class=\"mb-2 flex items-center gap-4\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\"\n\t\t\t><span [
|
|
97
|
+
], ngImport: i0, template: "<div class=\"mb-2 flex items-center gap-4\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\"\n\t\t\t><span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<input\n\t\ttype=\"checkbox\"\n\t\t[class]=\"componentClass\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(change)=\"handleChange()\"\n\t\t(blur)=\"handleBlur()\"\n\t/>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["typographyVariant", "typographyColor", "typographyFontWeight", "classes"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
97
98
|
}
|
|
98
99
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
99
100
|
type: Component,
|
|
100
|
-
args: [{ selector: 'app-switch', standalone: true, imports: [FormsModule,
|
|
101
|
+
args: [{ selector: 'app-switch', standalone: true, imports: [FormsModule, TypographyDirective], providers: [
|
|
101
102
|
{
|
|
102
103
|
provide: NG_VALUE_ACCESSOR,
|
|
103
104
|
useExisting: SwitchComponent,
|
|
104
105
|
multi: true,
|
|
105
106
|
},
|
|
106
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mb-2 flex items-center gap-4\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\"\n\t\t\t><span [
|
|
107
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mb-2 flex items-center gap-4\">\n\t@if (label()) {\n\t\t<label [for]=\"this.name()\"\n\t\t\t><span typography [typographyVariant]=\"'body'\" [typographyColor]=\"'black'\">{{ label() }}</span></label\n\t\t>\n\t}\n\n\t<input\n\t\ttype=\"checkbox\"\n\t\t[class]=\"componentClass\"\n\t\t[attr.name]=\"name()\"\n\t\t[(ngModel)]=\"value\"\n\t\t[disabled]=\"disabled()\"\n\t\t(change)=\"handleChange()\"\n\t\t(blur)=\"handleBlur()\"\n\t/>\n</div>\n" }]
|
|
107
108
|
}] });
|
|
108
109
|
|
|
109
110
|
/**
|