@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,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TabsComponent = 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 TabsComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-tabs',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './tabs.component.html',
|
|
13
|
+
styleUrls: ['./tabs.component.scss'],
|
|
14
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
15
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
16
|
+
host: {
|
|
17
|
+
'[class.origo-tabs]': 'true',
|
|
18
|
+
'[attr.data-testid]': 'contract().id',
|
|
19
|
+
},
|
|
20
|
+
})];
|
|
21
|
+
let _classDescriptor;
|
|
22
|
+
let _classExtraInitializers = [];
|
|
23
|
+
let _classThis;
|
|
24
|
+
let _tabButtons_decorators;
|
|
25
|
+
let _tabButtons_initializers = [];
|
|
26
|
+
let _tabButtons_extraInitializers = [];
|
|
27
|
+
var TabsComponent = class {
|
|
28
|
+
static { _classThis = this; }
|
|
29
|
+
static {
|
|
30
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
31
|
+
_tabButtons_decorators = [(0, core_1.ViewChildren)('tabButton')];
|
|
32
|
+
tslib_1.__esDecorate(null, null, _tabButtons_decorators, { kind: "field", name: "tabButtons", static: false, private: false, access: { has: obj => "tabButtons" in obj, get: obj => obj.tabButtons, set: (obj, value) => { obj.tabButtons = value; } }, metadata: _metadata }, _tabButtons_initializers, _tabButtons_extraInitializers);
|
|
33
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
34
|
+
TabsComponent = _classThis = _classDescriptor.value;
|
|
35
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
36
|
+
}
|
|
37
|
+
static contractSchema = {
|
|
38
|
+
tabs: 'array',
|
|
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
|
+
tabButtons = tslib_1.__runInitializers(this, _tabButtons_initializers, void 0);
|
|
45
|
+
computedAriaLabel = (tslib_1.__runInitializers(this, _tabButtons_extraInitializers), (0, core_1.computed)(() => {
|
|
46
|
+
const label = this.contract().props?.['aria-label'];
|
|
47
|
+
return label !== undefined && label !== null ? String(label) : undefined;
|
|
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
|
+
computedTabs = (0, core_1.computed)(() => {
|
|
54
|
+
const tabs = this.contract().props?.tabs;
|
|
55
|
+
if (!Array.isArray(tabs))
|
|
56
|
+
return [];
|
|
57
|
+
return tabs
|
|
58
|
+
.filter(tab => tab != null && tab.key != null && tab.label != null)
|
|
59
|
+
.map(tab => {
|
|
60
|
+
return {
|
|
61
|
+
key: String(tab.key),
|
|
62
|
+
label: this.sanitizer.sanitize(core_1.SecurityContext.HTML, String(tab.label)) ||
|
|
63
|
+
String(tab.label).replace(/[<>]/g, ''),
|
|
64
|
+
disabled: !!tab.disabled,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
computedActiveTab = (0, core_1.computed)(() => {
|
|
69
|
+
const active = this.contract().props?.activeTab;
|
|
70
|
+
if (active)
|
|
71
|
+
return active;
|
|
72
|
+
const tabs = this.computedTabs();
|
|
73
|
+
return tabs.length > 0 ? tabs[0].key : undefined;
|
|
74
|
+
});
|
|
75
|
+
onTabClick(tab) {
|
|
76
|
+
if (tab.disabled || !tab.key)
|
|
77
|
+
return;
|
|
78
|
+
this.experienceAdapter.updateState(this.contract().id, 'activeTab', tab.key);
|
|
79
|
+
}
|
|
80
|
+
onKeyDown(event, index) {
|
|
81
|
+
const tabs = this.computedTabs();
|
|
82
|
+
if (tabs.length === 0)
|
|
83
|
+
return;
|
|
84
|
+
let nextIndex = index;
|
|
85
|
+
const isRtl = typeof window !== 'undefined' && event.target instanceof Element
|
|
86
|
+
? window.getComputedStyle(event.target).direction === 'rtl'
|
|
87
|
+
: false;
|
|
88
|
+
if (event.key === 'ArrowRight') {
|
|
89
|
+
nextIndex = isRtl ? index - 1 : index + 1;
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
}
|
|
92
|
+
else if (event.key === 'ArrowLeft') {
|
|
93
|
+
nextIndex = isRtl ? index + 1 : index - 1;
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
}
|
|
96
|
+
else if (event.key === 'Home') {
|
|
97
|
+
nextIndex = 0;
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
}
|
|
100
|
+
else if (event.key === 'End') {
|
|
101
|
+
nextIndex = tabs.length - 1;
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
}
|
|
104
|
+
if (nextIndex < 0)
|
|
105
|
+
nextIndex = tabs.length - 1;
|
|
106
|
+
if (nextIndex >= tabs.length)
|
|
107
|
+
nextIndex = 0;
|
|
108
|
+
if (nextIndex !== index) {
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
const buttons = this.tabButtons?.toArray();
|
|
111
|
+
if (buttons && buttons[nextIndex]) {
|
|
112
|
+
buttons[nextIndex].nativeElement.focus();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
static {
|
|
118
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return TabsComponent = _classThis;
|
|
122
|
+
})();
|
|
123
|
+
exports.TabsComponent = TabsComponent;
|
|
124
|
+
//# sourceMappingURL=tabs.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/tabs/tabs.component.ts"],"names":[],"mappings":";;;;AAAA,wCAWuB;AACvB,gEAAyD;AAGzD,iGAA+F;IA2BlF,aAAa;4BAZzB,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,YAAY;YACtB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,uBAAuB;YACpC,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,oBAAoB,EAAE,MAAM;gBAC5B,oBAAoB,EAAE,eAAe;aACtC;SACF,CAAC;;;;;;;;;;;sCAYC,IAAA,mBAAY,EAAC,WAAW,CAAC;YAAC,wLAAA,UAAU,6BAAV,UAAU,+FAA4C;YAXnF,qLAwFC;;;;QAvFC,MAAM,CAAU,cAAc,GAAG;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,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;wBAClC,OAAO,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;oBAC3C,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;;YAvFU,+DAAa;;;;;AAAb,sCAAa"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface TextInputProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
'aria-label'?: string;
|
|
9
|
+
'aria-describedby'?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class TextInputComponent implements OrigoAdapter<TextInputProps> {
|
|
12
|
+
static readonly contractSchema: {
|
|
13
|
+
value: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
disabled: string;
|
|
16
|
+
readonly: string;
|
|
17
|
+
};
|
|
18
|
+
static readonly strictContract = false;
|
|
19
|
+
contract: import("@angular/core").InputSignal<InteractionContract<TextInputProps>>;
|
|
20
|
+
value: import("@angular/core").ModelSignal<string>;
|
|
21
|
+
computedPlaceholder: import("@angular/core").Signal<string>;
|
|
22
|
+
computedDisabled: import("@angular/core").Signal<boolean>;
|
|
23
|
+
computedReadonly: import("@angular/core").Signal<boolean>;
|
|
24
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
25
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
26
|
+
private experienceAdapter;
|
|
27
|
+
constructor();
|
|
28
|
+
onInput(event: Event): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextInputComponent = 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 TextInputComponent = (() => {
|
|
8
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
9
|
+
selector: 'origo-text-input',
|
|
10
|
+
standalone: true,
|
|
11
|
+
templateUrl: './text-input.component.html',
|
|
12
|
+
styleUrls: ['./text-input.component.scss'],
|
|
13
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
14
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
15
|
+
host: {
|
|
16
|
+
'[class.origo-text-input]': 'true',
|
|
17
|
+
'[attr.data-testid]': 'contract().id ?? ""',
|
|
18
|
+
},
|
|
19
|
+
})];
|
|
20
|
+
let _classDescriptor;
|
|
21
|
+
let _classExtraInitializers = [];
|
|
22
|
+
let _classThis;
|
|
23
|
+
var TextInputComponent = 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
|
+
TextInputComponent = _classThis = _classDescriptor.value;
|
|
29
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
30
|
+
}
|
|
31
|
+
static contractSchema = {
|
|
32
|
+
value: 'string',
|
|
33
|
+
placeholder: 'string',
|
|
34
|
+
disabled: 'boolean',
|
|
35
|
+
readonly: 'boolean',
|
|
36
|
+
};
|
|
37
|
+
static strictContract = false;
|
|
38
|
+
contract = core_1.input.required();
|
|
39
|
+
value = (0, core_1.model)('');
|
|
40
|
+
computedPlaceholder = (0, core_1.computed)(() => this.contract().props?.placeholder ?? '');
|
|
41
|
+
computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
|
|
42
|
+
computedReadonly = (0, core_1.computed)(() => !!this.contract().props?.readonly);
|
|
43
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
44
|
+
const label = this.contract().props?.['aria-label'];
|
|
45
|
+
return label !== undefined && label !== null && String(label).trim() !== ''
|
|
46
|
+
? String(label)
|
|
47
|
+
: undefined;
|
|
48
|
+
});
|
|
49
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
50
|
+
const desc = this.contract().props?.['aria-describedby'];
|
|
51
|
+
return desc !== undefined && desc !== null && String(desc).trim() !== ''
|
|
52
|
+
? String(desc)
|
|
53
|
+
: undefined;
|
|
54
|
+
});
|
|
55
|
+
experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
|
|
56
|
+
constructor() {
|
|
57
|
+
(0, core_1.effect)(() => {
|
|
58
|
+
const contractVal = this.contract().props?.value;
|
|
59
|
+
(0, core_1.untracked)(() => this.value.set(contractVal !== undefined && contractVal !== null ? String(contractVal) : ''));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
onInput(event) {
|
|
63
|
+
const target = event.target;
|
|
64
|
+
if (!target)
|
|
65
|
+
return;
|
|
66
|
+
const rawValue = target.value;
|
|
67
|
+
const sanitizedValue = String(rawValue);
|
|
68
|
+
if (target.value !== sanitizedValue) {
|
|
69
|
+
target.value = sanitizedValue;
|
|
70
|
+
}
|
|
71
|
+
this.value.set(sanitizedValue);
|
|
72
|
+
this.experienceAdapter.updateState(this.contract().id, 'value', sanitizedValue);
|
|
73
|
+
}
|
|
74
|
+
static {
|
|
75
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return TextInputComponent = _classThis;
|
|
79
|
+
})();
|
|
80
|
+
exports.TextInputComponent = TextInputComponent;
|
|
81
|
+
//# sourceMappingURL=text-input.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/text-input/text-input.component.ts"],"names":[],"mappings":";;;;AAAA,wCAUuB;AAGvB,iGAA+F;IAuBlF,kBAAkB;4BAZ9B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,6BAA6B;YAC1C,SAAS,EAAE,CAAC,6BAA6B,CAAC;YAC1C,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,0BAA0B,EAAE,MAAM;gBAClC,oBAAoB,EAAE,qBAAqB;aAC5C;SACF,CAAC;;;;;;;;YACF,qLAqDC;;;;QApDC,MAAM,CAAU,cAAc,GAAG;YAC/B,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QAAQ,GAAG,YAAK,CAAC,QAAQ,EAAuC,CAAC;QACjE,KAAK,GAAG,IAAA,YAAK,EAAS,EAAE,CAAC,CAAC;QAE1B,mBAAmB,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;QAC/E,gBAAgB,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACrE,gBAAgB,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACrE,iBAAiB,GAAG,IAAA,eAAQ,EAAC,GA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,CAAC,KAAK,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YAExC,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;;YApDU,+DAAkB;;;;;AAAlB,gDAAkB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InteractionContract } from '@origostudio/core';
|
|
2
|
+
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
3
|
+
export interface TextareaProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
rows?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
'aria-describedby'?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class TextareaComponent implements OrigoAdapter<TextareaProps> {
|
|
14
|
+
static readonly contractSchema: {
|
|
15
|
+
value: string;
|
|
16
|
+
placeholder: string;
|
|
17
|
+
rows: string;
|
|
18
|
+
disabled: string;
|
|
19
|
+
readonly: string;
|
|
20
|
+
required: string;
|
|
21
|
+
};
|
|
22
|
+
static readonly strictContract = false;
|
|
23
|
+
contract: import("@angular/core").InputSignal<InteractionContract<TextareaProps>>;
|
|
24
|
+
value: import("@angular/core").ModelSignal<string>;
|
|
25
|
+
computedPlaceholder: import("@angular/core").Signal<string>;
|
|
26
|
+
computedRows: import("@angular/core").Signal<number>;
|
|
27
|
+
computedDisabled: import("@angular/core").Signal<boolean>;
|
|
28
|
+
computedReadonly: 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
|
+
private sanitizer;
|
|
34
|
+
constructor();
|
|
35
|
+
onInput(event: Event): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextareaComponent = 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 TextareaComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-textarea',
|
|
11
|
+
standalone: true,
|
|
12
|
+
templateUrl: './textarea.component.html',
|
|
13
|
+
styleUrls: ['./textarea.component.scss'],
|
|
14
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
15
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
16
|
+
host: {
|
|
17
|
+
'[class.origo-textarea]': 'true',
|
|
18
|
+
'[attr.data-testid]': 'contract().id',
|
|
19
|
+
},
|
|
20
|
+
})];
|
|
21
|
+
let _classDescriptor;
|
|
22
|
+
let _classExtraInitializers = [];
|
|
23
|
+
let _classThis;
|
|
24
|
+
var TextareaComponent = 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
|
+
TextareaComponent = _classThis = _classDescriptor.value;
|
|
30
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
31
|
+
}
|
|
32
|
+
static contractSchema = {
|
|
33
|
+
value: 'string',
|
|
34
|
+
placeholder: 'string',
|
|
35
|
+
rows: 'number',
|
|
36
|
+
disabled: 'boolean',
|
|
37
|
+
readonly: 'boolean',
|
|
38
|
+
required: 'boolean',
|
|
39
|
+
};
|
|
40
|
+
static strictContract = false;
|
|
41
|
+
contract = core_1.input.required();
|
|
42
|
+
value = (0, core_1.model)('');
|
|
43
|
+
computedPlaceholder = (0, core_1.computed)(() => this.contract().props?.placeholder ?? '');
|
|
44
|
+
computedRows = (0, core_1.computed)(() => {
|
|
45
|
+
const rows = this.contract().props?.rows;
|
|
46
|
+
return typeof rows === 'number' && rows > 0 ? Math.max(1, Math.round(rows)) : 3;
|
|
47
|
+
});
|
|
48
|
+
computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
|
|
49
|
+
computedReadonly = (0, core_1.computed)(() => !!this.contract().props?.readonly);
|
|
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
|
+
onInput(event) {
|
|
73
|
+
const target = event.target;
|
|
74
|
+
if (!target || this.computedDisabled() || this.computedReadonly())
|
|
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 TextareaComponent = _classThis;
|
|
89
|
+
})();
|
|
90
|
+
exports.TextareaComponent = TextareaComponent;
|
|
91
|
+
//# sourceMappingURL=textarea.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/textarea/textarea.component.ts"],"names":[],"mappings":";;;;AAAA,wCAWuB;AACvB,gEAAyD;AAGzD,iGAA+F;IAyBlF,iBAAiB;4BAZ7B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,2BAA2B;YACxC,SAAS,EAAE,CAAC,2BAA2B,CAAC;YACxC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,wBAAwB,EAAE,MAAM;gBACh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QAED,OAAO,CAAC,KAAY;YAClB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAoC,CAAC;YAC1D,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAAE,OAAO;YAE1E,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,+DAAiB;;;;;AAAjB,8CAAiB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { InteractionContract } from '@origostudio/core';
|
|
3
|
+
import { OrigoAdapter, ContainerComponent } from '../../../adapters/web/adapter';
|
|
4
|
+
export interface VBoxProps {
|
|
5
|
+
gap?: number | string;
|
|
6
|
+
alignment?: 'start' | 'center' | 'end' | 'stretch';
|
|
7
|
+
padding?: number | string;
|
|
8
|
+
'aria-label'?: string;
|
|
9
|
+
'aria-describedby'?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class VBoxComponent implements OrigoAdapter<VBoxProps>, ContainerComponent {
|
|
12
|
+
static readonly contractSchema: {
|
|
13
|
+
gap: string;
|
|
14
|
+
alignment: string;
|
|
15
|
+
padding: string;
|
|
16
|
+
};
|
|
17
|
+
static readonly strictContract = false;
|
|
18
|
+
contract: import("@angular/core").InputSignal<InteractionContract<VBoxProps>>;
|
|
19
|
+
vc: import("@angular/core").Signal<ViewContainerRef>;
|
|
20
|
+
computedGap: import("@angular/core").Signal<string | undefined>;
|
|
21
|
+
computedAlignment: import("@angular/core").Signal<"center" | "stretch" | "flex-start" | "flex-end">;
|
|
22
|
+
computedPadding: import("@angular/core").Signal<string | undefined>;
|
|
23
|
+
computedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
24
|
+
computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VBoxComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
let VBoxComponent = (() => {
|
|
7
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
8
|
+
selector: 'origo-vbox',
|
|
9
|
+
standalone: true,
|
|
10
|
+
templateUrl: './vbox.component.html',
|
|
11
|
+
styleUrls: ['./vbox.component.scss'],
|
|
12
|
+
changeDetection: core_1.ChangeDetectionStrategy.OnPush,
|
|
13
|
+
encapsulation: core_1.ViewEncapsulation.ShadowDom,
|
|
14
|
+
host: {
|
|
15
|
+
'[class.origo-vbox]': 'true',
|
|
16
|
+
'[attr.data-testid]': 'contract().id ?? ""',
|
|
17
|
+
'[style.gap]': 'computedGap()',
|
|
18
|
+
'[style.align-items]': 'computedAlignment()',
|
|
19
|
+
'[style.padding-inline]': 'computedPadding()',
|
|
20
|
+
'[style.padding-block]': 'computedPadding()',
|
|
21
|
+
'[attr.aria-label]': 'computedAriaLabel()',
|
|
22
|
+
'[attr.aria-describedby]': 'computedAriaDescribedBy()',
|
|
23
|
+
},
|
|
24
|
+
})];
|
|
25
|
+
let _classDescriptor;
|
|
26
|
+
let _classExtraInitializers = [];
|
|
27
|
+
let _classThis;
|
|
28
|
+
var VBoxComponent = 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
|
+
VBoxComponent = _classThis = _classDescriptor.value;
|
|
34
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
35
|
+
}
|
|
36
|
+
static contractSchema = {
|
|
37
|
+
gap: 'string',
|
|
38
|
+
alignment: 'string',
|
|
39
|
+
padding: 'string',
|
|
40
|
+
};
|
|
41
|
+
static strictContract = false;
|
|
42
|
+
contract = core_1.input.required();
|
|
43
|
+
vc = core_1.viewChild.required('vc', { read: core_1.ViewContainerRef });
|
|
44
|
+
computedGap = (0, core_1.computed)(() => {
|
|
45
|
+
const gap = this.contract().props?.gap;
|
|
46
|
+
if (gap === undefined || gap === null || gap === '')
|
|
47
|
+
return undefined;
|
|
48
|
+
const num = Number(gap);
|
|
49
|
+
return !isNaN(num) ? `${num}px` : String(gap);
|
|
50
|
+
});
|
|
51
|
+
computedAlignment = (0, core_1.computed)(() => {
|
|
52
|
+
const align = this.contract().props?.alignment;
|
|
53
|
+
switch (align) {
|
|
54
|
+
case 'start':
|
|
55
|
+
return 'flex-start';
|
|
56
|
+
case 'end':
|
|
57
|
+
return 'flex-end';
|
|
58
|
+
case 'center':
|
|
59
|
+
return 'center';
|
|
60
|
+
case 'stretch':
|
|
61
|
+
return 'stretch';
|
|
62
|
+
default:
|
|
63
|
+
return 'stretch';
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
computedPadding = (0, core_1.computed)(() => {
|
|
67
|
+
const padding = this.contract().props?.padding;
|
|
68
|
+
if (padding === undefined || padding === null || padding === '')
|
|
69
|
+
return undefined;
|
|
70
|
+
const num = Number(padding);
|
|
71
|
+
return !isNaN(num) ? `${num}px` : String(padding);
|
|
72
|
+
});
|
|
73
|
+
computedAriaLabel = (0, core_1.computed)(() => {
|
|
74
|
+
const label = this.contract().props?.['aria-label'];
|
|
75
|
+
return label !== undefined && label !== null && String(label).trim() !== ''
|
|
76
|
+
? String(label)
|
|
77
|
+
: undefined;
|
|
78
|
+
});
|
|
79
|
+
computedAriaDescribedBy = (0, core_1.computed)(() => {
|
|
80
|
+
const desc = this.contract().props?.['aria-describedby'];
|
|
81
|
+
return desc !== undefined && desc !== null && String(desc).trim() !== ''
|
|
82
|
+
? String(desc)
|
|
83
|
+
: undefined;
|
|
84
|
+
});
|
|
85
|
+
static {
|
|
86
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return VBoxComponent = _classThis;
|
|
90
|
+
})();
|
|
91
|
+
exports.VBoxComponent = VBoxComponent;
|
|
92
|
+
//# sourceMappingURL=vbox.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vbox.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/vbox/vbox.component.ts"],"names":[],"mappings":";;;;AAAA,wCAQuB;IA8BV,aAAa;4BAlBzB,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,YAAY;YACtB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,uBAAuB;YACpC,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,oBAAoB,EAAE,MAAM;gBAC5B,oBAAoB,EAAE,qBAAqB;gBAC3C,aAAa,EAAE,eAAe;gBAC9B,qBAAqB,EAAE,qBAAqB;gBAC5C,wBAAwB,EAAE,mBAAmB;gBAC7C,uBAAuB,EAAE,mBAAmB;gBAC5C,mBAAmB,EAAE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
+
export interface MetadataSource {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ResolutionChain {
|
|
6
|
+
steps: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface RenderingPath {
|
|
9
|
+
name: string;
|
|
10
|
+
badlPath: string;
|
|
11
|
+
children?: RenderingPath[];
|
|
12
|
+
}
|
|
13
|
+
export interface ErrorContext {
|
|
14
|
+
message: string;
|
|
15
|
+
stack: string;
|
|
16
|
+
badlPath: string;
|
|
17
|
+
}
|
|
18
|
+
export interface OrigoDevToolsAPI {
|
|
19
|
+
getActiveState: () => unknown;
|
|
20
|
+
getRenderingPath: (path: string) => RenderingPath | null;
|
|
21
|
+
getMetadataSource: (path: string) => MetadataSource | null;
|
|
22
|
+
getResolutionChain: (path: string) => ResolutionChain | null;
|
|
23
|
+
getErrorTelemetry: () => ErrorContext[];
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface Window {
|
|
27
|
+
__ORIGO_DEVTOOLS__?: OrigoDevToolsAPI;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare function _injectTestState(state: unknown): void;
|
|
31
|
+
export declare function _resetTestState(): void;
|
|
32
|
+
export declare function appendErrorTelemetry(error: ErrorContext): void;
|
|
33
|
+
export declare function getDevToolsAPI(): OrigoDevToolsAPI | null;
|
|
34
|
+
export declare function initDevToolsBridge(): void;
|