@origostudio/angular-renderer 0.0.40
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 +424 -0
- package/README.md +11 -0
- package/package.json +25 -0
- package/src/adapters/web/adapter.d.ts +20 -0
- package/src/adapters/web/adapter.js +140 -0
- package/src/adapters/web/adapter.js.map +1 -0
- package/src/adapters/web/experience-adapter.service.d.ts +6 -0
- package/src/adapters/web/experience-adapter.service.js +44 -0
- package/src/adapters/web/experience-adapter.service.js.map +1 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.d.ts +27 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.js +77 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.js.map +1 -0
- package/src/components/primitives/button/button.component.d.ts +26 -0
- package/src/components/primitives/button/button.component.js +74 -0
- package/src/components/primitives/button/button.component.js.map +1 -0
- package/src/components/primitives/card/card.component.d.ts +27 -0
- package/src/components/primitives/card/card.component.js +77 -0
- package/src/components/primitives/card/card.component.js.map +1 -0
- package/src/components/primitives/checkbox/checkbox.component.d.ts +29 -0
- package/src/components/primitives/checkbox/checkbox.component.js +81 -0
- package/src/components/primitives/checkbox/checkbox.component.js.map +1 -0
- package/src/components/primitives/chip/chip.component.d.ts +22 -0
- package/src/components/primitives/chip/chip.component.js +79 -0
- package/src/components/primitives/chip/chip.component.js.map +1 -0
- package/src/components/primitives/data-grid/data-grid.component.d.ts +48 -0
- package/src/components/primitives/data-grid/data-grid.component.js +135 -0
- package/src/components/primitives/data-grid/data-grid.component.js.map +1 -0
- package/src/components/primitives/form-field/form-field.component.d.ts +30 -0
- package/src/components/primitives/form-field/form-field.component.js +81 -0
- package/src/components/primitives/form-field/form-field.component.js.map +1 -0
- package/src/components/primitives/hbox/hbox.component.d.ts +25 -0
- package/src/components/primitives/hbox/hbox.component.js +92 -0
- package/src/components/primitives/hbox/hbox.component.js.map +1 -0
- package/src/components/primitives/label/label.component.d.ts +23 -0
- package/src/components/primitives/label/label.component.js +62 -0
- package/src/components/primitives/label/label.component.js.map +1 -0
- package/src/components/primitives/list/list.component.d.ts +25 -0
- package/src/components/primitives/list/list.component.js +79 -0
- package/src/components/primitives/list/list.component.js.map +1 -0
- package/src/components/primitives/radio-group/radio-group.component.d.ts +35 -0
- package/src/components/primitives/radio-group/radio-group.component.js +86 -0
- package/src/components/primitives/radio-group/radio-group.component.js.map +1 -0
- package/src/components/primitives/select/select.component.d.ts +39 -0
- package/src/components/primitives/select/select.component.js +91 -0
- package/src/components/primitives/select/select.component.js.map +1 -0
- package/src/components/primitives/sidebar/sidebar.component.d.ts +37 -0
- package/src/components/primitives/sidebar/sidebar.component.js +106 -0
- package/src/components/primitives/sidebar/sidebar.component.js.map +1 -0
- package/src/components/primitives/switch/switch.component.d.ts +22 -0
- package/src/components/primitives/switch/switch.component.js +80 -0
- package/src/components/primitives/switch/switch.component.js.map +1 -0
- package/src/components/primitives/tabs/tabs.component.d.ts +34 -0
- package/src/components/primitives/tabs/tabs.component.js +124 -0
- package/src/components/primitives/tabs/tabs.component.js.map +1 -0
- package/src/components/primitives/text-input/text-input.component.d.ts +29 -0
- package/src/components/primitives/text-input/text-input.component.js +81 -0
- package/src/components/primitives/text-input/text-input.component.js.map +1 -0
- package/src/components/primitives/textarea/textarea.component.d.ts +36 -0
- package/src/components/primitives/textarea/textarea.component.js +91 -0
- package/src/components/primitives/textarea/textarea.component.js.map +1 -0
- package/src/components/primitives/vbox/vbox.component.d.ts +25 -0
- package/src/components/primitives/vbox/vbox.component.js +92 -0
- package/src/components/primitives/vbox/vbox.component.js.map +1 -0
- package/src/devtools/devtools-bridge.d.ts +34 -0
- package/src/devtools/devtools-bridge.js +146 -0
- package/src/devtools/devtools-bridge.js.map +1 -0
- package/src/devtools/index.d.ts +1 -0
- package/src/devtools/index.js +5 -0
- package/src/devtools/index.js.map +1 -0
- package/src/index.d.ts +23 -0
- package/src/index.js +27 -0
- package/src/index.js.map +1 -0
- package/src/lib/primitives.provider.d.ts +2 -0
- package/src/lib/primitives.provider.js +54 -0
- package/src/lib/primitives.provider.js.map +1 -0
- package/src/lib/renderer.component.d.ts +12 -0
- package/src/lib/renderer.component.js +114 -0
- package/src/lib/renderer.component.js.map +1 -0
- package/src/lib/renderer.tokens.d.ts +2 -0
- package/src/lib/renderer.tokens.js +10 -0
- package/src/lib/renderer.tokens.js.map +1 -0
- package/src/lib/theme.provider.d.ts +13 -0
- package/src/lib/theme.provider.js +77 -0
- package/src/lib/theme.provider.js.map +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface RadioGroupProps {
|
|
4
|
+
options: Array<{
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}>;
|
|
8
|
+
value?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
'aria-describedby'?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class RadioGroupComponent implements OrigoAdapter<RadioGroupProps> {
|
|
15
|
+
static readonly contractSchema: {
|
|
16
|
+
options: string;
|
|
17
|
+
value: string;
|
|
18
|
+
disabled: string;
|
|
19
|
+
required: string;
|
|
20
|
+
};
|
|
21
|
+
static readonly strictContract = false;
|
|
22
|
+
contract: import("@angular/core").InputSignal<InteractionContract<RadioGroupProps>>;
|
|
23
|
+
value: import("@angular/core").ModelSignal<string>;
|
|
24
|
+
computedOptions: import("@angular/core").Signal<{
|
|
25
|
+
value: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}[]>;
|
|
28
|
+
computedDisabled: import("@angular/core").Signal<boolean>;
|
|
29
|
+
computedRequired: import("@angular/core").Signal<boolean>;
|
|
30
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
31
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
32
|
+
private experienceAdapter;
|
|
33
|
+
constructor();
|
|
34
|
+
onChange(event: Event): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadioGroupComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const experience_adapter_service_1 = require("../../../adapters/web/experience-adapter.service");
|
|
7
|
+
let RadioGroupComponent = (() => {
|
|
8
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
9
|
+
selector: 'origo-radio-group',
|
|
10
|
+
standalone: true,
|
|
11
|
+
templateUrl: './radio-group.component.html',
|
|
12
|
+
styleUrls: ['./radio-group.component.scss'],
|
|
13
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
14
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
15
|
+
host: {
|
|
16
|
+
'[class.origo-radio-group]': 'true',
|
|
17
|
+
'[attr.data-testid]': 'contract().id ?? ""',
|
|
18
|
+
},
|
|
19
|
+
})];
|
|
20
|
+
let _classDescriptor;
|
|
21
|
+
let _classExtraInitializers = [];
|
|
22
|
+
let _classThis;
|
|
23
|
+
var RadioGroupComponent = class {
|
|
24
|
+
static { _classThis = this; }
|
|
25
|
+
static {
|
|
26
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
27
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
28
|
+
RadioGroupComponent = _classThis = _classDescriptor.value;
|
|
29
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
30
|
+
}
|
|
31
|
+
static contractSchema = {
|
|
32
|
+
options: 'array',
|
|
33
|
+
value: 'string',
|
|
34
|
+
disabled: 'boolean',
|
|
35
|
+
required: 'boolean',
|
|
36
|
+
};
|
|
37
|
+
static strictContract = false;
|
|
38
|
+
contract = core_1.input.required();
|
|
39
|
+
value = (0, core_1.model)('');
|
|
40
|
+
computedOptions = (0, core_1.computed)(() => {
|
|
41
|
+
const opts = this.contract().props?.options;
|
|
42
|
+
return Array.isArray(opts) ? opts : [];
|
|
43
|
+
});
|
|
44
|
+
computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
|
|
45
|
+
computedRequired = (0, core_1.computed)(() => !!this.contract().props?.required);
|
|
46
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
47
|
+
const label = this.contract().props?.['aria-label'];
|
|
48
|
+
return label !== undefined && label !== null && String(label).trim() !== ''
|
|
49
|
+
? String(label)
|
|
50
|
+
: undefined;
|
|
51
|
+
});
|
|
52
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
53
|
+
const desc = this.contract().props?.['aria-describedby'];
|
|
54
|
+
return desc !== undefined && desc !== null && String(desc).trim() !== ''
|
|
55
|
+
? String(desc)
|
|
56
|
+
: undefined;
|
|
57
|
+
});
|
|
58
|
+
experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
|
|
59
|
+
constructor() {
|
|
60
|
+
(0, core_1.effect)(() => {
|
|
61
|
+
const contractVal = this.contract().props?.value;
|
|
62
|
+
const parsedVal = contractVal !== undefined && contractVal !== null ? String(contractVal) : '';
|
|
63
|
+
(0, core_1.untracked)(() => {
|
|
64
|
+
if (parsedVal === this.value())
|
|
65
|
+
return;
|
|
66
|
+
this.value.set(parsedVal);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
onChange(event) {
|
|
71
|
+
const target = event.target;
|
|
72
|
+
if (!target || !target.checked || this.computedDisabled())
|
|
73
|
+
return;
|
|
74
|
+
const rawValue = target.value;
|
|
75
|
+
const sanitizedValue = String(rawValue);
|
|
76
|
+
this.value.set(sanitizedValue);
|
|
77
|
+
this.experienceAdapter.updateState(this.contract().id, 'value', sanitizedValue);
|
|
78
|
+
}
|
|
79
|
+
static {
|
|
80
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return RadioGroupComponent = _classThis;
|
|
84
|
+
})();
|
|
85
|
+
exports.RadioGroupComponent = RadioGroupComponent;
|
|
86
|
+
//# sourceMappingURL=radio-group.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/radio-group/radio-group.component.ts"],"names":[],"mappings":";;;;AAAA,wCAUuB;AAGvB,iGAA+F;IAuBlF,mBAAmB;4BAZ/B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,8BAA8B;YAC3C,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,2BAA2B,EAAE,MAAM;gBACnC,oBAAoB,EAAE,qBAAqB;aAC5C;SACF,CAAC;;;;;;;;YACF,qLAuDC;;;;QAtDC,MAAM,CAAU,cAAc,GAAG;YAC/B,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QAAQ,GAAG,YAAK,CAAC,QAAQ,EAAwC,CAAC;QAClE,KAAK,GAAG,IAAA,YAAK,EAAS,EAAE,CAAC,CAAC;QAE1B,eAAe,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,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;gBACV,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;gBACjD,MAAM,SAAS,GACb,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/E,IAAA,gBAAS,EAAC,GAAG,EAAE;oBACb,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE;wBAAE,OAAO;oBACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,KAAY;YACnB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAiC,CAAC;YACvD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAAE,OAAO;YAElE,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YAExC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC/B,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAClF,CAAC;;YAtDU,+DAAmB;;;;;AAAnB,kDAAmB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface SelectProps {
|
|
4
|
+
options: Array<{
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}>;
|
|
8
|
+
value?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
'aria-label'?: string;
|
|
12
|
+
'aria-describedby'?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class SelectComponent implements OrigoAdapter<SelectProps> {
|
|
16
|
+
static readonly contractSchema: {
|
|
17
|
+
options: string;
|
|
18
|
+
value: string;
|
|
19
|
+
disabled: string;
|
|
20
|
+
placeholder: string;
|
|
21
|
+
required: string;
|
|
22
|
+
};
|
|
23
|
+
static readonly strictContract = false;
|
|
24
|
+
contract: import("@angular/core").InputSignal<InteractionContract<SelectProps>>;
|
|
25
|
+
value: import("@angular/core").ModelSignal<string>;
|
|
26
|
+
computedOptions: import("@angular/core").Signal<{
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
}[]>;
|
|
30
|
+
computedPlaceholder: import("@angular/core").Signal<string>;
|
|
31
|
+
computedDisabled: import("@angular/core").Signal<boolean>;
|
|
32
|
+
computedRequired: import("@angular/core").Signal<boolean>;
|
|
33
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
34
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
35
|
+
private experienceAdapter;
|
|
36
|
+
private sanitizer;
|
|
37
|
+
constructor();
|
|
38
|
+
onChange(event: Event): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const platform_browser_1 = require("@angular/platform-browser");
|
|
7
|
+
const experience_adapter_service_1 = require("../../../adapters/web/experience-adapter.service");
|
|
8
|
+
let SelectComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-select',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './select.component.html',
|
|
13
|
+
styleUrls: ['./select.component.scss'],
|
|
14
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
15
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
16
|
+
host: {
|
|
17
|
+
'[class.origo-select]': 'true',
|
|
18
|
+
'[attr.data-testid]': 'contract().id',
|
|
19
|
+
},
|
|
20
|
+
})];
|
|
21
|
+
let _classDescriptor;
|
|
22
|
+
let _classExtraInitializers = [];
|
|
23
|
+
let _classThis;
|
|
24
|
+
var SelectComponent = class {
|
|
25
|
+
static { _classThis = this; }
|
|
26
|
+
static {
|
|
27
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
28
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
29
|
+
SelectComponent = _classThis = _classDescriptor.value;
|
|
30
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
31
|
+
}
|
|
32
|
+
static contractSchema = {
|
|
33
|
+
options: 'array',
|
|
34
|
+
value: 'string',
|
|
35
|
+
disabled: 'boolean',
|
|
36
|
+
placeholder: 'string',
|
|
37
|
+
required: 'boolean',
|
|
38
|
+
};
|
|
39
|
+
static strictContract = false;
|
|
40
|
+
contract = core_1.input.required();
|
|
41
|
+
value = (0, core_1.model)('');
|
|
42
|
+
computedOptions = (0, core_1.computed)(() => {
|
|
43
|
+
const opts = this.contract().props?.options;
|
|
44
|
+
return Array.isArray(opts)
|
|
45
|
+
? opts.filter(o => o != null && o.value != null && o.label != null)
|
|
46
|
+
: [];
|
|
47
|
+
});
|
|
48
|
+
computedPlaceholder = (0, core_1.computed)(() => this.contract().props?.placeholder ?? '');
|
|
49
|
+
computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
|
|
50
|
+
computedRequired = (0, core_1.computed)(() => !!this.contract().props?.required);
|
|
51
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
52
|
+
const label = this.contract().props?.['aria-label'];
|
|
53
|
+
return label !== undefined && label !== null ? String(label) : undefined;
|
|
54
|
+
});
|
|
55
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
56
|
+
const desc = this.contract().props?.['aria-describedby'];
|
|
57
|
+
return desc !== undefined && desc !== null ? String(desc) : undefined;
|
|
58
|
+
});
|
|
59
|
+
experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
|
|
60
|
+
sanitizer = (0, core_1.inject)(platform_browser_1.DomSanitizer);
|
|
61
|
+
constructor() {
|
|
62
|
+
(0, core_1.effect)(() => {
|
|
63
|
+
const contractVal = this.contract().props?.value;
|
|
64
|
+
const parsedVal = contractVal !== undefined && contractVal !== null ? String(contractVal) : '';
|
|
65
|
+
(0, core_1.untracked)(() => {
|
|
66
|
+
if (parsedVal === this.value())
|
|
67
|
+
return;
|
|
68
|
+
this.value.set(parsedVal);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
onChange(event) {
|
|
73
|
+
const target = event.target;
|
|
74
|
+
if (!target || this.computedDisabled())
|
|
75
|
+
return;
|
|
76
|
+
const rawValue = target.value;
|
|
77
|
+
const sanitizedValue = this.sanitizer.sanitize(core_1.SecurityContext.HTML, rawValue) || rawValue || '';
|
|
78
|
+
if (target.value !== sanitizedValue) {
|
|
79
|
+
target.value = sanitizedValue;
|
|
80
|
+
}
|
|
81
|
+
this.value.set(sanitizedValue);
|
|
82
|
+
this.experienceAdapter.updateState(this.contract().id, 'value', sanitizedValue);
|
|
83
|
+
}
|
|
84
|
+
static {
|
|
85
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return SelectComponent = _classThis;
|
|
89
|
+
})();
|
|
90
|
+
exports.SelectComponent = SelectComponent;
|
|
91
|
+
//# sourceMappingURL=select.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/select/select.component.ts"],"names":[],"mappings":";;;;AAAA,wCAWuB;AACvB,gEAAyD;AAGzD,iGAA+F;IAwBlF,eAAe;4BAZ3B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,cAAc;YACxB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,yBAAyB;YACtC,SAAS,EAAE,CAAC,yBAAyB,CAAC;YACtC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,sBAAsB,EAAE,MAAM;gBAC9B,oBAAoB,EAAE,eAAe;aACtC;SACF,CAAC;;;;;;;;YACF,qLA6DC;;;;QA5DC,MAAM,CAAU,cAAc,GAAG;YAC/B,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,SAAS;YACnB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QAAQ,GAAG,YAAK,CAAC,QAAQ,EAAoC,CAAC;QAC9D,KAAK,GAAG,IAAA,YAAK,EAAS,EAAE,CAAC,CAAC;QAE1B,eAAe,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;YAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBACxB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;gBACnE,CAAC,CAAC,EAAE,CAAC;QACT,CAAC,CAAC,CAAC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AM,SAAS,GACb,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/E,IAAA,gBAAS,EAAC,GAAG,EAAE;oBACb,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE;wBAAE,OAAO;oBACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,KAAY;YACnB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAkC,CAAC;YACxD,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAAE,OAAO;YAE/C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;YAC9B,MAAM,cAAc,GAClB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,QAAQ,IAAI,EAAE,CAAC;YAE5E,IAAI,MAAM,CAAC,KAAK,KAAK,cAAc,EAAE,CAAC;gBACpC,MAAM,CAAC,KAAK,GAAG,cAAc,CAAC;YAChC,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC/B,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAClF,CAAC;;YA5DU,+DAAe;;;;;AAAf,0CAAe"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface SidebarItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
outcomeRef: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SidebarProps {
|
|
10
|
+
items?: Array<SidebarItem>;
|
|
11
|
+
activeOutcome?: string;
|
|
12
|
+
collapsed?: boolean;
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
'aria-describedby'?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class SidebarComponent implements OrigoAdapter<SidebarProps> {
|
|
17
|
+
static readonly contractSchema: {
|
|
18
|
+
items: string;
|
|
19
|
+
collapsed: string;
|
|
20
|
+
};
|
|
21
|
+
static readonly strictContract = false;
|
|
22
|
+
contract: import("@angular/core").InputSignal<InteractionContract<SidebarProps>>;
|
|
23
|
+
private experienceAdapter;
|
|
24
|
+
private sanitizer;
|
|
25
|
+
computedCollapsed: import("@angular/core").Signal<boolean>;
|
|
26
|
+
computedAriaLabel: import("@angular/core").Signal<string>;
|
|
27
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
28
|
+
computedItems: import("@angular/core").Signal<{
|
|
29
|
+
key: string;
|
|
30
|
+
label: string;
|
|
31
|
+
icon: string | undefined;
|
|
32
|
+
outcomeRef: string;
|
|
33
|
+
}[]>;
|
|
34
|
+
computedActiveOutcome: import("@angular/core").Signal<string | undefined>;
|
|
35
|
+
onItemClick(item: SidebarItem): void;
|
|
36
|
+
onKeyDown(event: KeyboardEvent, item: SidebarItem, index: number): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SidebarComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const platform_browser_1 = require("@angular/platform-browser");
|
|
7
|
+
const experience_adapter_service_1 = require("../../../adapters/web/experience-adapter.service");
|
|
8
|
+
let SidebarComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-sidebar',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './sidebar.component.html',
|
|
13
|
+
styleUrls: ['./sidebar.component.scss'],
|
|
14
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
15
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
16
|
+
host: {
|
|
17
|
+
'[class.origo-sidebar]': 'true',
|
|
18
|
+
'[class.origo-sidebar--collapsed]': 'computedCollapsed()',
|
|
19
|
+
'[attr.data-testid]': 'contract().id',
|
|
20
|
+
'[attr.aria-label]': 'computedAriaLabel()',
|
|
21
|
+
'[attr.aria-describedby]': 'computedAriaDescribedBy()',
|
|
22
|
+
role: 'navigation',
|
|
23
|
+
},
|
|
24
|
+
})];
|
|
25
|
+
let _classDescriptor;
|
|
26
|
+
let _classExtraInitializers = [];
|
|
27
|
+
let _classThis;
|
|
28
|
+
var SidebarComponent = class {
|
|
29
|
+
static { _classThis = this; }
|
|
30
|
+
static {
|
|
31
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
32
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
33
|
+
SidebarComponent = _classThis = _classDescriptor.value;
|
|
34
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
35
|
+
}
|
|
36
|
+
static contractSchema = {
|
|
37
|
+
items: 'array',
|
|
38
|
+
collapsed: 'boolean',
|
|
39
|
+
};
|
|
40
|
+
static strictContract = false;
|
|
41
|
+
contract = core_1.input.required();
|
|
42
|
+
experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
|
|
43
|
+
sanitizer = (0, core_1.inject)(platform_browser_1.DomSanitizer);
|
|
44
|
+
computedCollapsed = (0, core_1.computed)(() => !!this.contract().props?.collapsed);
|
|
45
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
46
|
+
const label = this.contract().props?.['aria-label'];
|
|
47
|
+
return label !== undefined && label !== null ? String(label) : 'Sidebar';
|
|
48
|
+
});
|
|
49
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
50
|
+
const desc = this.contract().props?.['aria-describedby'];
|
|
51
|
+
return desc !== undefined && desc !== null ? String(desc) : undefined;
|
|
52
|
+
});
|
|
53
|
+
computedItems = (0, core_1.computed)(() => {
|
|
54
|
+
const items = this.contract().props?.items;
|
|
55
|
+
if (!Array.isArray(items))
|
|
56
|
+
return [];
|
|
57
|
+
return items
|
|
58
|
+
.filter(item => item != null && item.key != null && item.label != null && item.outcomeRef != null)
|
|
59
|
+
.map(item => {
|
|
60
|
+
return {
|
|
61
|
+
key: String(item.key),
|
|
62
|
+
label: this.sanitizer.sanitize(core_1.SecurityContext.HTML, String(item.label)) ||
|
|
63
|
+
String(item.label).replace(/[<>]/g, ''),
|
|
64
|
+
icon: item.icon
|
|
65
|
+
? this.sanitizer.sanitize(core_1.SecurityContext.HTML, String(item.icon)) ||
|
|
66
|
+
String(item.icon).replace(/[<>]/g, '')
|
|
67
|
+
: undefined,
|
|
68
|
+
outcomeRef: String(item.outcomeRef),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
computedActiveOutcome = (0, core_1.computed)(() => this.contract().props?.activeOutcome);
|
|
73
|
+
onItemClick(item) {
|
|
74
|
+
if (!item.outcomeRef)
|
|
75
|
+
return;
|
|
76
|
+
this.experienceAdapter.updateState(this.contract().id, 'activeOutcome', item.outcomeRef);
|
|
77
|
+
}
|
|
78
|
+
onKeyDown(event, item, index) {
|
|
79
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
this.onItemClick(item);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const host = event.target;
|
|
85
|
+
const links = Array.from(host.closest('.origo-sidebar__list')?.querySelectorAll('.origo-sidebar__link') || []);
|
|
86
|
+
if (event.key === 'ArrowDown') {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
const next = links[index + 1];
|
|
89
|
+
if (next)
|
|
90
|
+
next.focus();
|
|
91
|
+
}
|
|
92
|
+
else if (event.key === 'ArrowUp') {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
const prev = links[index - 1];
|
|
95
|
+
if (prev)
|
|
96
|
+
prev.focus();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
static {
|
|
100
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return SidebarComponent = _classThis;
|
|
104
|
+
})();
|
|
105
|
+
exports.SidebarComponent = SidebarComponent;
|
|
106
|
+
//# sourceMappingURL=sidebar.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/sidebar/sidebar.component.ts"],"names":[],"mappings":";;;;AAAA,wCAQuB;AACvB,gEAAyD;AAGzD,iGAA+F;IAiClF,gBAAgB;4BAhB5B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,eAAe;YACzB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,0BAA0B;YACvC,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,uBAAuB,EAAE,MAAM;gBAC/B,kCAAkC,EAAE,qBAAqB;gBACzD,oBAAoB,EAAE,eAAe;gBACrC,mBAAmB,EAAE,qBAAqB;gBAC1C,yBAAyB,EAAE,2BAA2B;gBACtD,IAAI,EAAE,YAAY;aACnB;SACF,CAAC;;;;;;;;YACF,qLA4EC;;;;QA3EC,MAAM,CAAU,cAAc,GAAG;YAC/B,KAAK,EAAE,OAAO;YACd,SAAS,EAA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AC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBAC/C,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACvB,OAAO;YACT,CAAC;YAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAqB,CAAC;YACzC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACtB,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,EAAE,CACrF,CAAC;YAEF,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;gBAC9B,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAgB,CAAC;gBAC7C,IAAI,IAAI;oBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC;iBAAM,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;gBACnC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAgB,CAAC;gBAC7C,IAAI,IAAI;oBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;;YA3EU,+DAAgB;;;;;AAAhB,4CAAgB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface SwitchProps {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
'aria-describedby'?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SwitchComponent implements OrigoAdapter<SwitchProps> {
|
|
11
|
+
static readonly contractSchema: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>;
|
|
12
|
+
static readonly strictContract = false;
|
|
13
|
+
contract: import("@angular/core").InputSignal<InteractionContract<SwitchProps>>;
|
|
14
|
+
checked: import("@angular/core").ModelSignal<boolean>;
|
|
15
|
+
computedLabel: import("@angular/core").Signal<string>;
|
|
16
|
+
computedDisabled: import("@angular/core").Signal<boolean>;
|
|
17
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
18
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
19
|
+
private experienceAdapter;
|
|
20
|
+
constructor();
|
|
21
|
+
onChange(event: Event): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwitchComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const adapter_1 = require("../../../adapters/web/adapter");
|
|
7
|
+
const experience_adapter_service_1 = require("../../../adapters/web/experience-adapter.service");
|
|
8
|
+
let SwitchComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-switch',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './switch.component.html',
|
|
13
|
+
styleUrls: ['./switch.component.scss'],
|
|
14
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
15
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
16
|
+
host: {
|
|
17
|
+
'[class.origo-switch]': 'true',
|
|
18
|
+
'[attr.data-testid]': 'contract().id ?? ""',
|
|
19
|
+
},
|
|
20
|
+
})];
|
|
21
|
+
let _classDescriptor;
|
|
22
|
+
let _classExtraInitializers = [];
|
|
23
|
+
let _classThis;
|
|
24
|
+
var SwitchComponent = class {
|
|
25
|
+
static { _classThis = this; }
|
|
26
|
+
static {
|
|
27
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
28
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
29
|
+
SwitchComponent = _classThis = _classDescriptor.value;
|
|
30
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
31
|
+
}
|
|
32
|
+
static contractSchema = {
|
|
33
|
+
checked: 'boolean',
|
|
34
|
+
label: 'string',
|
|
35
|
+
disabled: 'boolean',
|
|
36
|
+
};
|
|
37
|
+
static strictContract = false;
|
|
38
|
+
contract = core_1.input.required();
|
|
39
|
+
checked = (0, core_1.model)(false);
|
|
40
|
+
computedLabel = (0, core_1.computed)(() => this.contract().props?.label ?? '');
|
|
41
|
+
computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
|
|
42
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
43
|
+
const v = this.contract().props?.['aria-label'];
|
|
44
|
+
return v !== undefined && v !== null && String(v).trim() !== '' ? String(v) : undefined;
|
|
45
|
+
});
|
|
46
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
47
|
+
const v = this.contract().props?.['aria-describedby'];
|
|
48
|
+
return v !== undefined && v !== null && String(v).trim() !== '' ? String(v) : undefined;
|
|
49
|
+
});
|
|
50
|
+
experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
|
|
51
|
+
constructor() {
|
|
52
|
+
(0, core_1.effect)(() => {
|
|
53
|
+
const props = this.contract().props;
|
|
54
|
+
const coerced = props
|
|
55
|
+
? (0, adapter_1.coerceContractProps)(props, SwitchComponent.contractSchema)
|
|
56
|
+
: {};
|
|
57
|
+
const contractVal = coerced['checked'] !== undefined ? !!coerced['checked'] : this.checked();
|
|
58
|
+
(0, core_1.untracked)(() => {
|
|
59
|
+
if (contractVal === this.checked())
|
|
60
|
+
return;
|
|
61
|
+
this.checked.set(contractVal);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
onChange(event) {
|
|
66
|
+
const target = event.target;
|
|
67
|
+
if (!(target instanceof HTMLInputElement) || this.computedDisabled() || !this.contract().id)
|
|
68
|
+
return;
|
|
69
|
+
const isChecked = target.checked;
|
|
70
|
+
this.checked.set(isChecked);
|
|
71
|
+
this.experienceAdapter.updateState(this.contract().id, 'checked', isChecked);
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return SwitchComponent = _classThis;
|
|
78
|
+
})();
|
|
79
|
+
exports.SwitchComponent = SwitchComponent;
|
|
80
|
+
//# sourceMappingURL=switch.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/switch/switch.component.ts"],"names":[],"mappings":";;;;AAAA,wCAUuB;AAEvB,2DAAkF;AAClF,iGAA+F;IAsBlF,eAAe;4BAZ3B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,cAAc;YACxB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,yBAAyB;YACtC,SAAS,EAAE,CAAC,yBAAyB,CAAC;YACtC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,sBAAsB,EAAE,MAAM;gBAC9B,oBAAoB,EAAE,qBAAqB;aAC5C;SACF,CAAC;;;;;;;;YACF,qLAkDC;;;;QAjDC,MAAM,CAAU,cAAc,GAG1B;YACF,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QA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K,CAAC;gBACpC,MAAM,OAAO,GAAG,KAAK;oBACnB,CAAC,CAAC,IAAA,6BAAmB,EAA0B,KAAK,EAAE,eAAe,CAAC,cAAc,CAAC;oBACrF,CAAC,CAAC,EAAE,CAAC;gBACP,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC7F,IAAA,gBAAS,EAAC,GAAG,EAAE;oBACb,IAAI,WAAW,KAAK,IAAI,CAAC,OAAO,EAAE;wBAAE,OAAO;oBAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,KAAY;YACnB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC5B,IAAI,CAAC,CAAC,MAAM,YAAY,gBAAgB,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACzF,OAAO;YAET,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC5B,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC/E,CAAC;;YAjDU,+DAAe;;;;;AAAf,0CAAe"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ElementRef, QueryList } from '@angular/core';
|
|
2
|
+
import { InteractionContract } from '@origostudio/core';
|
|
3
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
4
|
+
export interface TabItem {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TabsProps {
|
|
10
|
+
tabs?: Array<TabItem>;
|
|
11
|
+
activeTab?: string;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
'aria-describedby'?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class TabsComponent implements OrigoAdapter<TabsProps> {
|
|
16
|
+
static readonly contractSchema: {
|
|
17
|
+
tabs: string;
|
|
18
|
+
};
|
|
19
|
+
static readonly strictContract = false;
|
|
20
|
+
contract: import("@angular/core").InputSignal<InteractionContract<TabsProps>>;
|
|
21
|
+
private experienceAdapter;
|
|
22
|
+
private sanitizer;
|
|
23
|
+
tabButtons: QueryList<ElementRef<HTMLButtonElement>>;
|
|
24
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
25
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
26
|
+
computedTabs: import("@angular/core").Signal<{
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
}[]>;
|
|
31
|
+
computedActiveTab: import("@angular/core").Signal<string | undefined>;
|
|
32
|
+
onTabClick(tab: TabItem): void;
|
|
33
|
+
onKeyDown(event: KeyboardEvent, index: number): void;
|
|
34
|
+
}
|