@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.
Files changed (84) hide show
  1. package/CHANGELOG.md +424 -0
  2. package/README.md +11 -0
  3. package/package.json +25 -0
  4. package/src/adapters/web/adapter.d.ts +20 -0
  5. package/src/adapters/web/adapter.js +140 -0
  6. package/src/adapters/web/adapter.js.map +1 -0
  7. package/src/adapters/web/experience-adapter.service.d.ts +6 -0
  8. package/src/adapters/web/experience-adapter.service.js +44 -0
  9. package/src/adapters/web/experience-adapter.service.js.map +1 -0
  10. package/src/components/primitives/breadcrumbs/breadcrumbs.component.d.ts +27 -0
  11. package/src/components/primitives/breadcrumbs/breadcrumbs.component.js +77 -0
  12. package/src/components/primitives/breadcrumbs/breadcrumbs.component.js.map +1 -0
  13. package/src/components/primitives/button/button.component.d.ts +26 -0
  14. package/src/components/primitives/button/button.component.js +74 -0
  15. package/src/components/primitives/button/button.component.js.map +1 -0
  16. package/src/components/primitives/card/card.component.d.ts +27 -0
  17. package/src/components/primitives/card/card.component.js +77 -0
  18. package/src/components/primitives/card/card.component.js.map +1 -0
  19. package/src/components/primitives/checkbox/checkbox.component.d.ts +29 -0
  20. package/src/components/primitives/checkbox/checkbox.component.js +81 -0
  21. package/src/components/primitives/checkbox/checkbox.component.js.map +1 -0
  22. package/src/components/primitives/chip/chip.component.d.ts +22 -0
  23. package/src/components/primitives/chip/chip.component.js +79 -0
  24. package/src/components/primitives/chip/chip.component.js.map +1 -0
  25. package/src/components/primitives/data-grid/data-grid.component.d.ts +48 -0
  26. package/src/components/primitives/data-grid/data-grid.component.js +135 -0
  27. package/src/components/primitives/data-grid/data-grid.component.js.map +1 -0
  28. package/src/components/primitives/form-field/form-field.component.d.ts +30 -0
  29. package/src/components/primitives/form-field/form-field.component.js +81 -0
  30. package/src/components/primitives/form-field/form-field.component.js.map +1 -0
  31. package/src/components/primitives/hbox/hbox.component.d.ts +25 -0
  32. package/src/components/primitives/hbox/hbox.component.js +92 -0
  33. package/src/components/primitives/hbox/hbox.component.js.map +1 -0
  34. package/src/components/primitives/label/label.component.d.ts +23 -0
  35. package/src/components/primitives/label/label.component.js +62 -0
  36. package/src/components/primitives/label/label.component.js.map +1 -0
  37. package/src/components/primitives/list/list.component.d.ts +25 -0
  38. package/src/components/primitives/list/list.component.js +79 -0
  39. package/src/components/primitives/list/list.component.js.map +1 -0
  40. package/src/components/primitives/radio-group/radio-group.component.d.ts +35 -0
  41. package/src/components/primitives/radio-group/radio-group.component.js +86 -0
  42. package/src/components/primitives/radio-group/radio-group.component.js.map +1 -0
  43. package/src/components/primitives/select/select.component.d.ts +39 -0
  44. package/src/components/primitives/select/select.component.js +91 -0
  45. package/src/components/primitives/select/select.component.js.map +1 -0
  46. package/src/components/primitives/sidebar/sidebar.component.d.ts +37 -0
  47. package/src/components/primitives/sidebar/sidebar.component.js +106 -0
  48. package/src/components/primitives/sidebar/sidebar.component.js.map +1 -0
  49. package/src/components/primitives/switch/switch.component.d.ts +22 -0
  50. package/src/components/primitives/switch/switch.component.js +80 -0
  51. package/src/components/primitives/switch/switch.component.js.map +1 -0
  52. package/src/components/primitives/tabs/tabs.component.d.ts +34 -0
  53. package/src/components/primitives/tabs/tabs.component.js +124 -0
  54. package/src/components/primitives/tabs/tabs.component.js.map +1 -0
  55. package/src/components/primitives/text-input/text-input.component.d.ts +29 -0
  56. package/src/components/primitives/text-input/text-input.component.js +81 -0
  57. package/src/components/primitives/text-input/text-input.component.js.map +1 -0
  58. package/src/components/primitives/textarea/textarea.component.d.ts +36 -0
  59. package/src/components/primitives/textarea/textarea.component.js +91 -0
  60. package/src/components/primitives/textarea/textarea.component.js.map +1 -0
  61. package/src/components/primitives/vbox/vbox.component.d.ts +25 -0
  62. package/src/components/primitives/vbox/vbox.component.js +92 -0
  63. package/src/components/primitives/vbox/vbox.component.js.map +1 -0
  64. package/src/devtools/devtools-bridge.d.ts +34 -0
  65. package/src/devtools/devtools-bridge.js +146 -0
  66. package/src/devtools/devtools-bridge.js.map +1 -0
  67. package/src/devtools/index.d.ts +1 -0
  68. package/src/devtools/index.js +5 -0
  69. package/src/devtools/index.js.map +1 -0
  70. package/src/index.d.ts +23 -0
  71. package/src/index.js +27 -0
  72. package/src/index.js.map +1 -0
  73. package/src/lib/primitives.provider.d.ts +2 -0
  74. package/src/lib/primitives.provider.js +54 -0
  75. package/src/lib/primitives.provider.js.map +1 -0
  76. package/src/lib/renderer.component.d.ts +12 -0
  77. package/src/lib/renderer.component.js +114 -0
  78. package/src/lib/renderer.component.js.map +1 -0
  79. package/src/lib/renderer.tokens.d.ts +2 -0
  80. package/src/lib/renderer.tokens.js +10 -0
  81. package/src/lib/renderer.tokens.js.map +1 -0
  82. package/src/lib/theme.provider.d.ts +13 -0
  83. package/src/lib/theme.provider.js +77 -0
  84. package/src/lib/theme.provider.js.map +1 -0
@@ -0,0 +1,48 @@
1
+ import { InteractionContract } from '@origostudio/core';
2
+ import { OrigoAdapter } from '../../../adapters/web/adapter';
3
+ export interface DataGridProps {
4
+ columns?: Array<{
5
+ key: string;
6
+ label: string;
7
+ sortable?: boolean;
8
+ }>;
9
+ rows?: Array<Record<string, unknown>>;
10
+ pageSize?: number;
11
+ currentPage?: number;
12
+ totalRows?: number;
13
+ disabled?: boolean;
14
+ 'aria-label'?: string;
15
+ 'aria-describedby'?: string;
16
+ }
17
+ export declare class DataGridComponent implements OrigoAdapter<DataGridProps> {
18
+ static readonly contractSchema: {
19
+ columns: string;
20
+ rows: string;
21
+ pageSize: string;
22
+ currentPage: string;
23
+ totalRows: string;
24
+ disabled: string;
25
+ };
26
+ static readonly strictContract = false;
27
+ contract: import("@angular/core").InputSignal<InteractionContract<DataGridProps>>;
28
+ private experienceAdapter;
29
+ private sanitizer;
30
+ sortDir: import("@angular/core").WritableSignal<"desc" | "asc">;
31
+ currentSortKey: import("@angular/core").WritableSignal<string | null>;
32
+ computedColumns: import("@angular/core").Signal<{
33
+ key: string;
34
+ label: string;
35
+ sortable?: boolean;
36
+ }[]>;
37
+ computedRows: import("@angular/core").Signal<Record<string, unknown>[]>;
38
+ computedTotalRows: import("@angular/core").Signal<number>;
39
+ computedCurrentPage: import("@angular/core").Signal<number>;
40
+ computedTotalPages: import("@angular/core").Signal<number>;
41
+ computedDisabled: import("@angular/core").Signal<boolean>;
42
+ computedAriaLabel: import("@angular/core").Signal<string | undefined>;
43
+ computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
44
+ onSort(key: string): void;
45
+ onPageChange(page: number): void;
46
+ onRowSelect(rowId: unknown): void;
47
+ isObject(val: unknown): boolean;
48
+ }
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataGridComponent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ const common_1 = require("@angular/common");
7
+ const platform_browser_1 = require("@angular/platform-browser");
8
+ const experience_adapter_service_1 = require("../../../adapters/web/experience-adapter.service");
9
+ let DataGridComponent = (() => {
10
+ let _classDecorators = [(0, core_1.Component)({
11
+ selector: 'origo-data-grid',
12
+ standalone: true,
13
+ imports: [common_1.JsonPipe],
14
+ templateUrl: './data-grid.component.html',
15
+ styleUrls: ['./data-grid.component.scss'],
16
+ changeDetection: core_1.ChangeDetectionStrategy.OnPush,
17
+ encapsulation: core_1.ViewEncapsulation.ShadowDom,
18
+ host: {
19
+ '[class.origo-data-grid]': 'true',
20
+ '[attr.data-testid]': 'contract().id',
21
+ '[attr.aria-label]': 'computedAriaLabel()',
22
+ '[attr.aria-describedby]': 'computedAriaDescribedBy()',
23
+ },
24
+ })];
25
+ let _classDescriptor;
26
+ let _classExtraInitializers = [];
27
+ let _classThis;
28
+ var DataGridComponent = 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
+ DataGridComponent = _classThis = _classDescriptor.value;
34
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
35
+ }
36
+ static contractSchema = {
37
+ columns: 'array',
38
+ rows: 'array',
39
+ pageSize: 'number',
40
+ currentPage: 'number',
41
+ totalRows: 'number',
42
+ disabled: 'boolean',
43
+ };
44
+ static strictContract = false;
45
+ contract = core_1.input.required();
46
+ experienceAdapter = (0, core_1.inject)(experience_adapter_service_1.WebExperienceAdapterService);
47
+ sanitizer = (0, core_1.inject)(platform_browser_1.DomSanitizer);
48
+ // Track sort direction locally for toggling
49
+ sortDir = (0, core_1.signal)('asc');
50
+ currentSortKey = (0, core_1.signal)(null);
51
+ computedColumns = (0, core_1.computed)(() => {
52
+ const cols = this.contract().props?.columns;
53
+ return Array.isArray(cols)
54
+ ? cols.filter(c => c != null && c.key != null && c.label != null)
55
+ : [];
56
+ });
57
+ computedRows = (0, core_1.computed)(() => {
58
+ const rows = this.contract().props?.rows;
59
+ if (!Array.isArray(rows))
60
+ return [];
61
+ const validRows = rows.filter(r => r != null);
62
+ const pageSize = this.contract().props?.pageSize;
63
+ let currentPage = this.contract().props?.currentPage;
64
+ if (typeof pageSize !== 'number' || pageSize <= 0) {
65
+ return validRows.slice(0, 100); // no pagination cap if pageSize is invalid, but cap at 100 to prevent huge rendering
66
+ }
67
+ if (typeof currentPage !== 'number' || currentPage < 1) {
68
+ currentPage = 1;
69
+ }
70
+ const startIndex = (currentPage - 1) * pageSize;
71
+ return validRows.slice(startIndex, startIndex + pageSize);
72
+ });
73
+ computedTotalRows = (0, core_1.computed)(() => {
74
+ const totalRows = this.contract().props?.totalRows;
75
+ if (typeof totalRows === 'number' && totalRows >= 0)
76
+ return totalRows;
77
+ const rows = this.contract().props?.rows;
78
+ return Array.isArray(rows) ? rows.length : 0;
79
+ });
80
+ computedCurrentPage = (0, core_1.computed)(() => {
81
+ const cp = this.contract().props?.currentPage;
82
+ return typeof cp === 'number' && cp >= 1 ? cp : 1;
83
+ });
84
+ computedTotalPages = (0, core_1.computed)(() => {
85
+ const pageSize = this.contract().props?.pageSize;
86
+ if (typeof pageSize !== 'number' || pageSize <= 0)
87
+ return 1;
88
+ return Math.max(1, Math.ceil(this.computedTotalRows() / pageSize));
89
+ });
90
+ computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
91
+ computedAriaLabel = (0, core_1.computed)(() => {
92
+ const label = this.contract().props?.['aria-label'];
93
+ return label !== undefined && label !== null ? String(label) : undefined;
94
+ });
95
+ computedAriaDescribedBy = (0, core_1.computed)(() => {
96
+ const desc = this.contract().props?.['aria-describedby'];
97
+ return desc !== undefined && desc !== null ? String(desc) : undefined;
98
+ });
99
+ onSort(key) {
100
+ if (this.computedDisabled())
101
+ return;
102
+ if (this.currentSortKey() === key) {
103
+ this.sortDir.update(d => (d === 'asc' ? 'desc' : 'asc'));
104
+ }
105
+ else {
106
+ this.currentSortKey.set(key);
107
+ this.sortDir.set('desc');
108
+ }
109
+ this.experienceAdapter.updateState(this.contract().id, 'sortKey', key);
110
+ this.experienceAdapter.updateState(this.contract().id, 'sortDir', this.sortDir());
111
+ }
112
+ onPageChange(page) {
113
+ if (this.computedDisabled() || !Number.isInteger(page) || page < 1)
114
+ return;
115
+ this.experienceAdapter.updateState(this.contract().id, 'currentPage', page);
116
+ }
117
+ onRowSelect(rowId) {
118
+ if (this.computedDisabled() || rowId == null)
119
+ return;
120
+ const rawValue = String(rowId);
121
+ const sanitized = this.sanitizer.sanitize(core_1.SecurityContext.HTML, rawValue);
122
+ const sanitizedValue = sanitized != null && sanitized !== '' ? sanitized : rawValue.replace(/[<>]/g, '');
123
+ this.experienceAdapter.updateState(this.contract().id, 'selectedRow', sanitizedValue);
124
+ }
125
+ isObject(val) {
126
+ return typeof val === 'object' && val !== null;
127
+ }
128
+ static {
129
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
130
+ }
131
+ };
132
+ return DataGridComponent = _classThis;
133
+ })();
134
+ exports.DataGridComponent = DataGridComponent;
135
+ //# sourceMappingURL=data-grid.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/data-grid/data-grid.component.ts"],"names":[],"mappings":";;;;AAAA,wCASuB;AACvB,4CAA2C;AAC3C,gEAAyD;AAGzD,iGAA+F;IA4BlF,iBAAiB;4BAf7B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,CAAC,iBAAQ,CAAC;YACnB,WAAW,EAAE,4BAA4B;YACzC,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,wBAAiB,CAAC,SAAS;YAC1C,IAAI,EAAE;gBACJ,yBAAyB,EAAE,MAAM;gBACjC,oBAAoB,EAAE,eAAe;gBACrC,mBAAmB,EAAE,qBAAqB;gBAC1C,yBAAyB,EAAE,2BAA2B;aACvD;SACF,CAAC;;;;;;;;YACF,qLA8GC;;;;QA7GC,MAAM,CAAU,cAAc,GAAG;YAC/B,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,QAAQ;YACrB,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QAAQ,GAAG,YAAK,CAAC,QAAQ,EAAsC,CAAC;QAExD,iBAAiB,GAAG,IAAA,aAAM,EAAC,wDAA2B,CAAC,CAAC;QACxD,SAAS,GAAG,IAAA,aAAM,EAAC,+BAAY,CAAC,CAAC;QAEzC,4CAA4C;QAC5C,OAAO,GAAG,IAAA,aAAM,EAAiB,KAAK,CAAC,CAAC;QACxC,cAAc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'@angular/core';
2
+ import { InteractionContract } from '@origostudio/core';
3
+ import { OrigoAdapter, ContainerComponent } from '../../../adapters/web/adapter';
4
+ import { LabelProps } from '../label/label.component';
5
+ export interface FormFieldProps {
6
+ label?: string;
7
+ error?: string;
8
+ hint?: string;
9
+ required?: boolean;
10
+ 'aria-label'?: string;
11
+ 'aria-describedby'?: string;
12
+ }
13
+ export declare class FormFieldComponent implements OrigoAdapter<FormFieldProps>, ContainerComponent {
14
+ static readonly contractSchema: {
15
+ label: string;
16
+ error: string;
17
+ hint: string;
18
+ required: string;
19
+ };
20
+ static readonly strictContract = false;
21
+ contract: import("@angular/core").InputSignal<InteractionContract<FormFieldProps>>;
22
+ vc: import("@angular/core").Signal<ViewContainerRef>;
23
+ computedLabel: import("@angular/core").Signal<string | undefined>;
24
+ computedError: import("@angular/core").Signal<string | undefined>;
25
+ computedHint: import("@angular/core").Signal<string | undefined>;
26
+ computedRequired: import("@angular/core").Signal<boolean>;
27
+ computedAriaLabel: import("@angular/core").Signal<string | undefined>;
28
+ computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
29
+ labelContract: import("@angular/core").Signal<InteractionContract<LabelProps>>;
30
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFieldComponent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ const label_component_1 = require("../label/label.component");
7
+ let FormFieldComponent = (() => {
8
+ let _classDecorators = [(0, core_1.Component)({
9
+ selector: 'origo-form-field',
10
+ standalone: true,
11
+ imports: [label_component_1.LabelComponent],
12
+ templateUrl: './form-field.component.html',
13
+ styleUrls: ['./form-field.component.scss'],
14
+ changeDetection: core_1.ChangeDetectionStrategy.OnPush,
15
+ encapsulation: core_1.ViewEncapsulation.ShadowDom,
16
+ host: {
17
+ '[class.origo-form-field]': 'true',
18
+ '[class.has-error]': '!!computedError()',
19
+ '[attr.data-testid]': 'contract().id ?? ""',
20
+ '[attr.role]': 'computedAriaLabel() ? "group" : null',
21
+ '[attr.aria-label]': 'computedAriaLabel()',
22
+ '[attr.aria-describedby]': 'computedAriaDescribedBy()',
23
+ },
24
+ })];
25
+ let _classDescriptor;
26
+ let _classExtraInitializers = [];
27
+ let _classThis;
28
+ var FormFieldComponent = 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
+ FormFieldComponent = _classThis = _classDescriptor.value;
34
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
35
+ }
36
+ static contractSchema = {
37
+ label: 'string',
38
+ error: 'string',
39
+ hint: 'string',
40
+ required: 'boolean',
41
+ };
42
+ static strictContract = false;
43
+ contract = core_1.input.required();
44
+ vc = core_1.viewChild.required('vc', { read: core_1.ViewContainerRef });
45
+ computedLabel = (0, core_1.computed)(() => this.contract().props?.label);
46
+ computedError = (0, core_1.computed)(() => this.contract().props?.error);
47
+ computedHint = (0, core_1.computed)(() => this.contract().props?.hint);
48
+ computedRequired = (0, core_1.computed)(() => !!this.contract().props?.required);
49
+ computedAriaLabel = (0, core_1.computed)(() => {
50
+ const label = this.contract().props?.['aria-label'];
51
+ return label !== undefined && label !== null && String(label).trim() !== ''
52
+ ? String(label)
53
+ : undefined;
54
+ });
55
+ computedAriaDescribedBy = (0, core_1.computed)(() => {
56
+ const desc = this.contract().props?.['aria-describedby'];
57
+ return desc !== undefined && desc !== null && String(desc).trim() !== ''
58
+ ? String(desc)
59
+ : undefined;
60
+ });
61
+ labelContract = (0, core_1.computed)(() => {
62
+ const parentId = this.contract().id;
63
+ const childId = this.contract().children?.[0]?.id;
64
+ return {
65
+ id: `${parentId}-label`,
66
+ type: 'Label',
67
+ props: {
68
+ text: this.computedLabel(),
69
+ required: this.computedRequired(),
70
+ for: childId,
71
+ },
72
+ };
73
+ });
74
+ static {
75
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
76
+ }
77
+ };
78
+ return FormFieldComponent = _classThis;
79
+ })();
80
+ exports.FormFieldComponent = FormFieldComponent;
81
+ //# sourceMappingURL=form-field.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/form-field/form-field.component.ts"],"names":[],"mappings":";;;;AAAA,wCAQuB;AAGvB,8DAAsE;IA4BzD,kBAAkB;4BAjB9B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,CAAC,gCAAc,CAAC;YACzB,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,mBAAmB,EAAE,mBAAmB;gBACxC,oBAAoB,EAAE,qBAAqB;gBAC3C,aAAa,EAAE,sCAAsC;gBACrD,mBAAmB,EAAE,qBAAqB;gBAC1C,yBAAyB,EAAE,2BAA2B;aACvD;SACF,CAAC;;;;;;;;YACF,qLA2CC;;;;QA1CC,MAAM,CAAU,cAAc,GAAG;YAC/B,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;SACpB,CAAC;QACF,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;QAEvC,QAAQ,GAAG,YAAK,CAAC,QAAQ,EAAuC,CAAC;QAEjE,EAAE,GAAG,gBAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAgB,EAAE,CAAC,CAAC;QAE1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GAAG,EAAE;YAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAClD,OAAO;gBACL,EAAE,EAAE,GAAG,QAAQ,QAAQ;gBACvB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE;oBAC1B,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE;oBACjC,GAAG,EAAE,OAAO;iBACb;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;;YA1CQ,+DAAkB;;;;;AAAlB,gDAAkB"}
@@ -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 HBoxProps {
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 HBoxComponent implements OrigoAdapter<HBoxProps>, 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<HBoxProps>>;
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.HBoxComponent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ let HBoxComponent = (() => {
7
+ let _classDecorators = [(0, core_1.Component)({
8
+ selector: 'origo-hbox',
9
+ standalone: true,
10
+ templateUrl: './hbox.component.html',
11
+ styleUrls: ['./hbox.component.scss'],
12
+ changeDetection: core_1.ChangeDetectionStrategy.OnPush,
13
+ encapsulation: core_1.ViewEncapsulation.ShadowDom,
14
+ host: {
15
+ '[class.origo-hbox]': '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 HBoxComponent = 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
+ HBoxComponent = _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 HBoxComponent = _classThis;
90
+ })();
91
+ exports.HBoxComponent = HBoxComponent;
92
+ //# sourceMappingURL=hbox.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hbox.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/hbox/hbox.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;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AAC,IAAI,CAAC;gBACd,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC,CAAC,CAAC;;YArDQ,+DAAa;;;;;AAAb,sCAAa"}
@@ -0,0 +1,23 @@
1
+ import { InteractionContract } from '@origostudio/core';
2
+ import { OrigoAdapter } from '../../../adapters/web/adapter';
3
+ export interface LabelProps {
4
+ text?: string;
5
+ for?: string;
6
+ required?: boolean;
7
+ 'aria-label'?: string;
8
+ 'aria-describedby'?: string;
9
+ }
10
+ export declare class LabelComponent implements OrigoAdapter<LabelProps> {
11
+ static readonly contractSchema: {
12
+ text: string;
13
+ for: string;
14
+ required: string;
15
+ };
16
+ static readonly strictContract = false;
17
+ contract: import("@angular/core").InputSignal<InteractionContract<LabelProps>>;
18
+ computedText: import("@angular/core").Signal<string>;
19
+ computedFor: import("@angular/core").Signal<string | undefined>;
20
+ computedRequired: import("@angular/core").Signal<boolean>;
21
+ computedAriaLabel: import("@angular/core").Signal<string | undefined>;
22
+ computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
23
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LabelComponent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ let LabelComponent = (() => {
7
+ let _classDecorators = [(0, core_1.Component)({
8
+ selector: 'origo-label',
9
+ standalone: true,
10
+ templateUrl: './label.component.html',
11
+ styleUrls: ['./label.component.scss'],
12
+ changeDetection: core_1.ChangeDetectionStrategy.OnPush,
13
+ encapsulation: core_1.ViewEncapsulation.ShadowDom,
14
+ host: {
15
+ '[class.origo-label]': 'true',
16
+ '[attr.data-testid]': 'contract().id ?? ""',
17
+ },
18
+ })];
19
+ let _classDescriptor;
20
+ let _classExtraInitializers = [];
21
+ let _classThis;
22
+ var LabelComponent = class {
23
+ static { _classThis = this; }
24
+ static {
25
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
26
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
27
+ LabelComponent = _classThis = _classDescriptor.value;
28
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
29
+ }
30
+ static contractSchema = {
31
+ text: 'string',
32
+ for: 'string',
33
+ required: 'boolean',
34
+ };
35
+ static strictContract = false;
36
+ contract = core_1.input.required();
37
+ computedText = (0, core_1.computed)(() => this.contract().props?.text ?? '');
38
+ computedFor = (0, core_1.computed)(() => {
39
+ const f = this.contract().props?.for;
40
+ return f !== undefined && f !== null ? String(f) : undefined;
41
+ });
42
+ computedRequired = (0, core_1.computed)(() => !!this.contract().props?.required);
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
+ static {
56
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
57
+ }
58
+ };
59
+ return LabelComponent = _classThis;
60
+ })();
61
+ exports.LabelComponent = LabelComponent;
62
+ //# sourceMappingURL=label.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/label/label.component.ts"],"names":[],"mappings":";;;;AAAA,wCAMuB;IAwBV,cAAc;4BAZ1B,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,aAAa;YACvB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,wBAAwB;YACrC,SAAS,EAAE,CAAC,wBAAwB,CAAC;YACrC,eAAe,EAAE,8BAAuB,CAAC,MAAM;YAC/C,aAAa,E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QAChB,CAAC,CAAC,CAAC;QACH,uBAAuB,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE;YACtC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,kBAAkB,CAAC,CAAC;YACzD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;gBACtE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC,CAAC,CAAC;;YA3BQ,+DAAc;;;;;AAAd,wCAAc"}
@@ -0,0 +1,25 @@
1
+ import { InteractionContract } from '@origostudio/core';
2
+ import { OrigoAdapter } from '../../../adapters/web/adapter';
3
+ export interface ListProps {
4
+ items?: Array<Record<string, unknown>>;
5
+ maxItems?: number;
6
+ disabled?: boolean;
7
+ 'aria-label'?: string;
8
+ 'aria-describedby'?: string;
9
+ }
10
+ export declare class ListComponent implements OrigoAdapter<ListProps> {
11
+ static readonly contractSchema: {
12
+ items: string;
13
+ maxItems: string;
14
+ disabled: string;
15
+ };
16
+ static readonly strictContract = false;
17
+ contract: import("@angular/core").InputSignal<InteractionContract<ListProps>>;
18
+ private experienceAdapter;
19
+ private sanitizer;
20
+ computedItems: import("@angular/core").Signal<Record<string, unknown>[]>;
21
+ computedDisabled: import("@angular/core").Signal<boolean>;
22
+ computedAriaLabel: import("@angular/core").Signal<string | undefined>;
23
+ computedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
24
+ onItemSelect(itemId: unknown): void;
25
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListComponent = 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 ListComponent = (() => {
9
+ let _classDecorators = [(0, core_1.Component)({
10
+ selector: 'origo-list',
11
+ standalone: true,
12
+ templateUrl: './list.component.html',
13
+ styleUrls: ['./list.component.scss'],
14
+ changeDetection: core_1.ChangeDetectionStrategy.OnPush,
15
+ encapsulation: core_1.ViewEncapsulation.ShadowDom,
16
+ host: {
17
+ '[class.origo-list]': 'true',
18
+ '[attr.data-testid]': 'contract().id',
19
+ '[attr.role]': '"list"',
20
+ '[attr.aria-label]': 'computedAriaLabel()',
21
+ '[attr.aria-describedby]': 'computedAriaDescribedBy()',
22
+ },
23
+ })];
24
+ let _classDescriptor;
25
+ let _classExtraInitializers = [];
26
+ let _classThis;
27
+ var ListComponent = class {
28
+ static { _classThis = this; }
29
+ static {
30
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
31
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
32
+ ListComponent = _classThis = _classDescriptor.value;
33
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
34
+ }
35
+ static contractSchema = {
36
+ items: 'array',
37
+ maxItems: 'number',
38
+ disabled: '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
+ computedItems = (0, core_1.computed)(() => {
45
+ const items = this.contract().props?.items;
46
+ if (!Array.isArray(items))
47
+ return [];
48
+ const validItems = items.filter(i => i != null);
49
+ let max = this.contract().props?.maxItems;
50
+ if (typeof max !== 'number' || isNaN(max) || max <= 0) {
51
+ max = 100;
52
+ }
53
+ return validItems.slice(0, max);
54
+ });
55
+ computedDisabled = (0, core_1.computed)(() => !!this.contract().props?.disabled);
56
+ computedAriaLabel = (0, core_1.computed)(() => {
57
+ const label = this.contract().props?.['aria-label'];
58
+ return label !== undefined && label !== null ? String(label) : undefined;
59
+ });
60
+ computedAriaDescribedBy = (0, core_1.computed)(() => {
61
+ const desc = this.contract().props?.['aria-describedby'];
62
+ return desc !== undefined && desc !== null ? String(desc) : undefined;
63
+ });
64
+ onItemSelect(itemId) {
65
+ if (this.computedDisabled() || itemId == null)
66
+ return;
67
+ const rawValue = String(itemId);
68
+ const sanitized = this.sanitizer.sanitize(core_1.SecurityContext.HTML, rawValue);
69
+ const sanitizedValue = sanitized != null && sanitized !== '' ? sanitized : rawValue.replace(/[<>]/g, '');
70
+ this.experienceAdapter.updateState(this.contract().id, 'selectedItem', sanitizedValue);
71
+ }
72
+ static {
73
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
74
+ }
75
+ };
76
+ return ListComponent = _classThis;
77
+ })();
78
+ exports.ListComponent = ListComponent;
79
+ //# sourceMappingURL=list.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.component.js","sourceRoot":"","sources":["../../../../../../../packages/angular-renderer/src/components/primitives/list/list.component.ts"],"names":[],"mappings":";;;;AAAA,wCAQuB;AACvB,gEAAyD;AAGzD,iGAA+F;IAyBlF,aAAa;4BAfzB,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;gBACrC,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,qBAAqB;gBAC1C,yBAAyB,EAAE,2BAA2B;aACvD;SACF,CAAC;;;;;;;;YACF,qLAiDC;;;;QAhDC,MAAM,CAAU,cAAc,GAAG;YAC/B,KAAK,EAAE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