@origostudio/origo-design 0.0.49 → 0.0.50
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 +4 -4
- package/dist/packages/angular-renderer/CHANGELOG.md +10 -0
- package/dist/packages/angular-renderer/package.json +3 -3
- package/dist/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.d.ts +99 -0
- package/dist/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.js +306 -0
- package/dist/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.js.map +1 -0
- package/dist/packages/angular-renderer/src/components/primitives/combobox/combobox.component.d.ts +69 -0
- package/dist/packages/angular-renderer/src/components/primitives/combobox/combobox.component.js +276 -0
- package/dist/packages/angular-renderer/src/components/primitives/combobox/combobox.component.js.map +1 -0
- package/dist/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.d.ts +110 -0
- package/dist/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.js +323 -0
- package/dist/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.js.map +1 -0
- package/dist/packages/angular-renderer/src/components/primitives/select/select.component.d.ts +80 -19
- package/dist/packages/angular-renderer/src/components/primitives/select/select.component.js +201 -24
- package/dist/packages/angular-renderer/src/components/primitives/select/select.component.js.map +1 -1
- package/dist/packages/angular-renderer/src/components/primitives/select/selection-utils.d.ts +9 -0
- package/dist/packages/angular-renderer/src/components/primitives/select/selection-utils.js +69 -0
- package/dist/packages/angular-renderer/src/components/primitives/select/selection-utils.js.map +1 -0
- package/dist/packages/angular-renderer/src/index.d.ts +3 -0
- package/dist/packages/angular-renderer/src/index.js +3 -0
- package/dist/packages/angular-renderer/src/index.js.map +1 -1
- package/dist/packages/angular-renderer/src/lib/primitives.provider.js +6 -0
- package/dist/packages/angular-renderer/src/lib/primitives.provider.js.map +1 -1
- package/dist/packages/cli/CHANGELOG.md +4 -0
- package/dist/packages/cli/package.json +2 -2
- package/dist/packages/cli/package.json.bak +2 -2
- package/dist/packages/core/CHANGELOG.md +4 -0
- package/dist/packages/core/package.json +1 -1
- package/dist/packages/core/package.json.bak +1 -1
- package/dist/packages/design-tokens/CHANGELOG.md +4 -0
- package/dist/packages/design-tokens/package.json +1 -1
- package/dist/packages/playground/browser/{chunk-DgLZ-dIi.js → chunk--xdAQ9AM.js} +1 -1
- package/dist/packages/playground/browser/{chunk-CpaI4VGh.js → chunk-BDvJAz2Z.js} +1 -1
- package/dist/packages/playground/browser/{chunk-Cb2ALrKC.js → chunk-BfTgubd-.js} +1 -1
- package/dist/packages/playground/browser/{chunk-BlCRDoSd.js → chunk-C9TW72xp.js} +1 -1
- package/dist/packages/playground/browser/{chunk-CCE_vAje.js → chunk-CCN2KoWz.js} +1 -1
- package/dist/packages/playground/browser/{chunk-r4-UbXQJ.js → chunk-COiPNsUk.js} +1 -1
- package/dist/packages/playground/browser/{chunk-DoYDPF2-.js → chunk-CR9pdAu4.js} +1 -1
- package/dist/packages/playground/browser/{chunk-B_swdRuc.js → chunk-CW1H0x80.js} +1 -1
- package/dist/packages/playground/browser/{chunk-XTbjIUbx.js → chunk-CcRAf-SI.js} +1 -1
- package/dist/packages/playground/browser/{chunk-BbeNQQ9Z.js → chunk-CeWsvybE.js} +1 -1
- package/dist/packages/playground/browser/{chunk-C8l8Pst_.js → chunk-DB3lTZW4.js} +1 -1
- package/dist/packages/playground/browser/{chunk-lFsGUZ3A.js → chunk-DBaAs95p.js} +1 -1
- package/dist/packages/playground/browser/{chunk-B8mwHWgW.js → chunk-UVpCaxmD.js} +1 -1
- package/dist/packages/playground/browser/{chunk-DkxgAarv.js → chunk-rUmdxUDA.js} +1 -1
- package/dist/packages/playground/browser/{chunk-G1sQXMvG.js → chunk-wSEtHeaq.js} +1 -1
- package/dist/packages/playground/browser/index.html +1 -1
- package/dist/packages/playground/browser/main-QKXZMSV7.js +737 -0
- package/package.json +1 -1
- package/packages/angular-renderer/CHANGELOG.md +10 -0
- package/packages/angular-renderer/package.json +3 -3
- package/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.html +83 -0
- package/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.scss +161 -0
- package/packages/angular-renderer/src/components/primitives/autocomplete/autocomplete.component.ts +338 -0
- package/packages/angular-renderer/src/components/primitives/combobox/combobox.component.html +90 -0
- package/packages/angular-renderer/src/components/primitives/combobox/combobox.component.scss +189 -0
- package/packages/angular-renderer/src/components/primitives/combobox/combobox.component.ts +281 -0
- package/packages/angular-renderer/src/components/primitives/icon-button/icon-button.component.html +1 -1
- package/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.html +150 -0
- package/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.scss +240 -0
- package/packages/angular-renderer/src/components/primitives/multi-select/multi-select.component.ts +362 -0
- package/packages/angular-renderer/src/components/primitives/select/select.component.html +92 -14
- package/packages/angular-renderer/src/components/primitives/select/select.component.scss +188 -13
- package/packages/angular-renderer/src/components/primitives/select/select.component.ts +242 -34
- package/packages/angular-renderer/src/components/primitives/select/selection-utils.ts +92 -0
- package/packages/angular-renderer/src/index.ts +3 -0
- package/packages/angular-renderer/src/lib/primitives.provider.ts +6 -0
- package/packages/cli/CHANGELOG.md +4 -0
- package/packages/cli/package.json +2 -2
- package/packages/core/CHANGELOG.md +4 -0
- package/packages/core/package.json +1 -1
- package/packages/design-tokens/CHANGELOG.md +4 -0
- package/packages/design-tokens/package.json +1 -1
- package/packages/devtools/CHANGELOG.md +10 -0
- package/packages/devtools/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/packages/devtools/package.json +3 -3
- package/packages/playground/CHANGELOG.md +4 -0
- package/packages/playground/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/packages/playground/package.json +3 -3
- package/dist/packages/playground/browser/main-D2PNGI4C.js +0 -734
|
@@ -8,24 +8,51 @@ import {
|
|
|
8
8
|
inject,
|
|
9
9
|
effect,
|
|
10
10
|
untracked,
|
|
11
|
-
|
|
11
|
+
signal,
|
|
12
|
+
PLATFORM_ID,
|
|
13
|
+
HostListener,
|
|
14
|
+
ElementRef,
|
|
12
15
|
} from '@angular/core';
|
|
13
|
-
import {
|
|
16
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
14
17
|
import { InteractionContract } from '@origostudio/core';
|
|
15
18
|
import { OrigoAdapter } from '../../../adapters/web/adapter';
|
|
16
19
|
import { WebExperienceAdapterService } from '../../../adapters/web/experience-adapter.service';
|
|
20
|
+
import { type NormalizedOption, normalizeOptions, filterOptions } from './selection-utils';
|
|
21
|
+
|
|
22
|
+
export type { NormalizedOption };
|
|
17
23
|
|
|
18
24
|
export interface SelectProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
id?: string;
|
|
26
|
+
value?: unknown;
|
|
27
|
+
options: Array<unknown>;
|
|
28
|
+
optionLabel?: string;
|
|
29
|
+
optionValue?: string;
|
|
30
|
+
optionGroupLabel?: string;
|
|
31
|
+
optionGroupChildren?: string;
|
|
25
32
|
placeholder?: string;
|
|
33
|
+
filter?: boolean;
|
|
34
|
+
filterBy?: string;
|
|
35
|
+
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith';
|
|
36
|
+
filterPlaceholder?: string;
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
clearable?: boolean;
|
|
39
|
+
appendTo?: string;
|
|
40
|
+
virtualScroll?: boolean;
|
|
41
|
+
itemSize?: number;
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
readonly?: boolean;
|
|
45
|
+
required?: boolean;
|
|
46
|
+
invalid?: boolean;
|
|
47
|
+
errorText?: string;
|
|
48
|
+
helpText?: string;
|
|
49
|
+
variant?: 'outlined' | 'filled';
|
|
50
|
+
fluid?: boolean;
|
|
26
51
|
'aria-label'?: string;
|
|
27
52
|
'aria-describedby'?: string;
|
|
28
|
-
|
|
53
|
+
permissions?: Record<string, string>;
|
|
54
|
+
rules?: Record<string, unknown>;
|
|
55
|
+
metadata?: Record<string, unknown>;
|
|
29
56
|
}
|
|
30
57
|
|
|
31
58
|
@Component({
|
|
@@ -37,7 +64,13 @@ export interface SelectProps {
|
|
|
37
64
|
encapsulation: ViewEncapsulation.ShadowDom,
|
|
38
65
|
host: {
|
|
39
66
|
'[class.origo-select]': 'true',
|
|
40
|
-
'[attr.data-testid]': 'contract().id',
|
|
67
|
+
'[attr.data-testid]': 'contract().id ?? ""',
|
|
68
|
+
'[class.origo-select--fluid]': 'computedFluid()',
|
|
69
|
+
'[class.origo-select--outlined]': 'computedVariant() === "outlined"',
|
|
70
|
+
'[class.origo-select--filled]': 'computedVariant() === "filled"',
|
|
71
|
+
'[class.origo-select--invalid]': 'computedInvalid()',
|
|
72
|
+
'[class.origo-select--disabled]': 'computedDisabled()',
|
|
73
|
+
'[class.origo-select--readonly]': 'computedReadonly()',
|
|
41
74
|
},
|
|
42
75
|
})
|
|
43
76
|
export class SelectComponent implements OrigoAdapter<SelectProps> {
|
|
@@ -47,61 +80,236 @@ export class SelectComponent implements OrigoAdapter<SelectProps> {
|
|
|
47
80
|
metadata: 'object',
|
|
48
81
|
options: 'array',
|
|
49
82
|
value: 'string',
|
|
50
|
-
|
|
83
|
+
optionLabel: 'string',
|
|
84
|
+
optionValue: 'string',
|
|
85
|
+
optionGroupLabel: 'string',
|
|
86
|
+
optionGroupChildren: 'string',
|
|
51
87
|
placeholder: 'string',
|
|
88
|
+
filter: 'boolean',
|
|
89
|
+
filterBy: 'string',
|
|
90
|
+
filterMatchMode: 'string',
|
|
91
|
+
filterPlaceholder: 'string',
|
|
92
|
+
editable: 'boolean',
|
|
93
|
+
clearable: 'boolean',
|
|
94
|
+
appendTo: 'string',
|
|
95
|
+
virtualScroll: 'boolean',
|
|
96
|
+
itemSize: 'number',
|
|
97
|
+
loading: 'boolean',
|
|
98
|
+
disabled: 'boolean',
|
|
99
|
+
readonly: 'boolean',
|
|
52
100
|
required: 'boolean',
|
|
101
|
+
invalid: 'boolean',
|
|
102
|
+
errorText: 'string',
|
|
103
|
+
helpText: 'string',
|
|
104
|
+
variant: 'string',
|
|
105
|
+
fluid: 'boolean',
|
|
106
|
+
'aria-label': 'string',
|
|
107
|
+
'aria-describedby': 'string',
|
|
53
108
|
};
|
|
54
109
|
static readonly strictContract = false;
|
|
55
110
|
|
|
56
111
|
contract = input.required<InteractionContract<SelectProps>>();
|
|
57
|
-
value = model<
|
|
112
|
+
value = model<unknown>('');
|
|
58
113
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
114
|
+
isOpen = signal<boolean>(false);
|
|
115
|
+
filterQuery = signal<string>('');
|
|
116
|
+
activeIndex = signal<number>(-1);
|
|
117
|
+
|
|
118
|
+
computedNormalizedOptions = computed(() => {
|
|
119
|
+
const props = this.contract().props;
|
|
120
|
+
return normalizeOptions(
|
|
121
|
+
props?.options,
|
|
122
|
+
props?.optionLabel,
|
|
123
|
+
props?.optionValue,
|
|
124
|
+
props?.optionGroupLabel,
|
|
125
|
+
props?.optionGroupChildren
|
|
126
|
+
);
|
|
64
127
|
});
|
|
128
|
+
|
|
129
|
+
computedOptions = this.computedNormalizedOptions;
|
|
130
|
+
|
|
131
|
+
filteredOptions = computed(() => {
|
|
132
|
+
const opts = this.computedNormalizedOptions();
|
|
133
|
+
if (!this.computedFilter() && !this.filterQuery()) {
|
|
134
|
+
return opts;
|
|
135
|
+
}
|
|
136
|
+
const mode = this.contract().props?.filterMatchMode ?? 'contains';
|
|
137
|
+
return filterOptions(opts, this.filterQuery(), mode);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
selectedOption = computed(() => {
|
|
141
|
+
const val = this.value();
|
|
142
|
+
return this.computedNormalizedOptions().find(opt => opt.value === val);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
selectedLabel = computed(() => {
|
|
146
|
+
const opt = this.selectedOption();
|
|
147
|
+
if (opt) return opt.label;
|
|
148
|
+
const val = this.value();
|
|
149
|
+
return val !== undefined && val !== null && val !== '' ? String(val) : '';
|
|
150
|
+
});
|
|
151
|
+
|
|
65
152
|
computedPlaceholder = computed(() => this.contract().props?.placeholder ?? '');
|
|
66
153
|
computedDisabled = computed(() => !!this.contract().props?.disabled);
|
|
154
|
+
computedReadonly = computed(() => !!this.contract().props?.readonly);
|
|
67
155
|
computedRequired = computed(() => !!this.contract().props?.required);
|
|
156
|
+
computedInvalid = computed(() => !!this.contract().props?.invalid);
|
|
157
|
+
computedFilter = computed(() => !!this.contract().props?.filter);
|
|
158
|
+
computedFilterPlaceholder = computed(
|
|
159
|
+
() => this.contract().props?.filterPlaceholder ?? 'Search...'
|
|
160
|
+
);
|
|
161
|
+
computedClearable = computed(() => !!this.contract().props?.clearable);
|
|
162
|
+
computedVariant = computed(() => this.contract().props?.variant ?? 'outlined');
|
|
163
|
+
computedFluid = computed(() => !!this.contract().props?.fluid);
|
|
164
|
+
computedErrorText = computed(() => this.contract().props?.errorText ?? '');
|
|
165
|
+
computedHelpText = computed(() => this.contract().props?.helpText ?? '');
|
|
166
|
+
|
|
68
167
|
computedAriaLabel = computed(() => {
|
|
69
168
|
const label = this.contract().props?.['aria-label'];
|
|
70
|
-
|
|
169
|
+
if (label !== undefined && label !== null && String(label).trim() !== '') {
|
|
170
|
+
return String(label);
|
|
171
|
+
}
|
|
172
|
+
return this.computedPlaceholder() || 'Select';
|
|
71
173
|
});
|
|
174
|
+
|
|
72
175
|
computedAriaDescribedBy = computed(() => {
|
|
176
|
+
const parts: string[] = [];
|
|
73
177
|
const desc = this.contract().props?.['aria-describedby'];
|
|
74
|
-
|
|
178
|
+
if (desc) parts.push(String(desc));
|
|
179
|
+
if (this.computedErrorText()) parts.push(`${this.contract().id}-error`);
|
|
180
|
+
if (this.computedHelpText()) parts.push(`${this.contract().id}-help`);
|
|
181
|
+
return parts.length > 0 ? parts.join(' ') : undefined;
|
|
75
182
|
});
|
|
76
183
|
|
|
77
184
|
private experienceAdapter = inject(WebExperienceAdapterService);
|
|
78
|
-
private
|
|
185
|
+
private platformId = inject(PLATFORM_ID);
|
|
186
|
+
private elementRef = inject(ElementRef);
|
|
79
187
|
|
|
80
188
|
constructor() {
|
|
81
189
|
effect(() => {
|
|
82
190
|
const contractVal = this.contract().props?.value;
|
|
83
|
-
const parsedVal =
|
|
84
|
-
contractVal !== undefined && contractVal !== null ? String(contractVal) : '';
|
|
85
191
|
untracked(() => {
|
|
86
|
-
if (
|
|
87
|
-
|
|
192
|
+
if (contractVal !== undefined && contractVal !== this.value()) {
|
|
193
|
+
this.value.set(contractVal);
|
|
194
|
+
}
|
|
88
195
|
});
|
|
89
196
|
});
|
|
90
197
|
}
|
|
91
198
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
199
|
+
toggleOpen() {
|
|
200
|
+
if (this.computedDisabled() || this.computedReadonly()) return;
|
|
201
|
+
const next = !this.isOpen();
|
|
202
|
+
this.isOpen.set(next);
|
|
203
|
+
if (next) {
|
|
204
|
+
this.filterQuery.set('');
|
|
205
|
+
const currentVal = this.value();
|
|
206
|
+
const currentIdx = this.filteredOptions().findIndex(o => o.value === currentVal);
|
|
207
|
+
this.activeIndex.set(currentIdx >= 0 ? currentIdx : 0);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
selectOption(optionValue: unknown) {
|
|
212
|
+
if (this.computedDisabled() || this.computedReadonly()) return;
|
|
213
|
+
this.value.set(optionValue);
|
|
214
|
+
this.isOpen.set(false);
|
|
215
|
+
this.experienceAdapter.updateState(this.contract().id, 'value', optionValue);
|
|
216
|
+
}
|
|
95
217
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
218
|
+
clear(event?: Event) {
|
|
219
|
+
if (this.computedDisabled() || this.computedReadonly()) return;
|
|
220
|
+
event?.stopPropagation();
|
|
221
|
+
this.value.set('');
|
|
222
|
+
this.experienceAdapter.updateState(this.contract().id, 'value', '');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
onFilterInput(event: Event) {
|
|
226
|
+
const target = event.target as HTMLInputElement;
|
|
227
|
+
this.filterQuery.set(target.value);
|
|
228
|
+
this.activeIndex.set(0);
|
|
229
|
+
}
|
|
99
230
|
|
|
100
|
-
|
|
101
|
-
|
|
231
|
+
onKeydown(event: KeyboardEvent) {
|
|
232
|
+
if (this.computedDisabled() || this.computedReadonly()) return;
|
|
233
|
+
|
|
234
|
+
const opts = this.filteredOptions();
|
|
235
|
+
const count = opts.length;
|
|
236
|
+
|
|
237
|
+
switch (event.key) {
|
|
238
|
+
case 'ArrowDown': {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
if (!this.isOpen()) {
|
|
241
|
+
this.isOpen.set(true);
|
|
242
|
+
this.activeIndex.set(0);
|
|
243
|
+
} else if (count > 0) {
|
|
244
|
+
const next = (this.activeIndex() + 1) % count;
|
|
245
|
+
this.activeIndex.set(next);
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'ArrowUp': {
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
if (!this.isOpen()) {
|
|
252
|
+
this.isOpen.set(true);
|
|
253
|
+
this.activeIndex.set(count - 1);
|
|
254
|
+
} else if (count > 0) {
|
|
255
|
+
const prev = (this.activeIndex() - 1 + count) % count;
|
|
256
|
+
this.activeIndex.set(prev);
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case 'Enter':
|
|
261
|
+
case ' ': {
|
|
262
|
+
const target = event.target as HTMLElement;
|
|
263
|
+
if (event.key === ' ' && target && target.tagName === 'INPUT') {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
if (this.isOpen()) {
|
|
268
|
+
const idx = this.activeIndex();
|
|
269
|
+
if (idx >= 0 && idx < count && !opts[idx].disabled) {
|
|
270
|
+
this.selectOption(opts[idx].value);
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
this.isOpen.set(true);
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
case 'Escape': {
|
|
278
|
+
if (this.isOpen()) {
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
this.isOpen.set(false);
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
case 'Tab': {
|
|
285
|
+
if (this.isOpen()) {
|
|
286
|
+
this.isOpen.set(false);
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case 'Home': {
|
|
291
|
+
if (this.isOpen() && count > 0) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
this.activeIndex.set(0);
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case 'End': {
|
|
298
|
+
if (this.isOpen() && count > 0) {
|
|
299
|
+
event.preventDefault();
|
|
300
|
+
this.activeIndex.set(count - 1);
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
102
304
|
}
|
|
305
|
+
}
|
|
103
306
|
|
|
104
|
-
|
|
105
|
-
|
|
307
|
+
@HostListener('document:click', ['$event'])
|
|
308
|
+
onDocumentClick(event: MouseEvent) {
|
|
309
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
310
|
+
const clickedInside = this.elementRef.nativeElement.contains(event.target as Node);
|
|
311
|
+
if (!clickedInside && this.isOpen()) {
|
|
312
|
+
this.isOpen.set(false);
|
|
313
|
+
}
|
|
106
314
|
}
|
|
107
315
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface NormalizedOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: unknown;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
group?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function resolveOption(
|
|
9
|
+
item: unknown,
|
|
10
|
+
labelKey?: string,
|
|
11
|
+
valueKey?: string
|
|
12
|
+
): NormalizedOption {
|
|
13
|
+
if (item === null || item === undefined) {
|
|
14
|
+
return { label: '', value: '', disabled: false };
|
|
15
|
+
}
|
|
16
|
+
if (typeof item !== 'object') {
|
|
17
|
+
return { label: String(item), value: item, disabled: false };
|
|
18
|
+
}
|
|
19
|
+
const obj = item as Record<string, unknown>;
|
|
20
|
+
const label =
|
|
21
|
+
labelKey && obj[labelKey] !== undefined
|
|
22
|
+
? String(obj[labelKey])
|
|
23
|
+
: obj['label'] !== undefined
|
|
24
|
+
? String(obj['label'])
|
|
25
|
+
: String(item);
|
|
26
|
+
|
|
27
|
+
const value =
|
|
28
|
+
valueKey && obj[valueKey] !== undefined
|
|
29
|
+
? obj[valueKey]
|
|
30
|
+
: obj['value'] !== undefined
|
|
31
|
+
? obj['value']
|
|
32
|
+
: item;
|
|
33
|
+
|
|
34
|
+
return { label, value, disabled: !!obj['disabled'] };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function normalizeOptions(
|
|
38
|
+
items: unknown[] | null | undefined,
|
|
39
|
+
labelKey?: string,
|
|
40
|
+
valueKey?: string,
|
|
41
|
+
groupLabelKey?: string,
|
|
42
|
+
groupChildrenKey?: string
|
|
43
|
+
): NormalizedOption[] {
|
|
44
|
+
if (!Array.isArray(items)) return [];
|
|
45
|
+
const result: NormalizedOption[] = [];
|
|
46
|
+
|
|
47
|
+
for (const item of items) {
|
|
48
|
+
if (item === null || item === undefined) continue;
|
|
49
|
+
|
|
50
|
+
if (typeof item === 'object') {
|
|
51
|
+
const obj = item as Record<string, unknown>;
|
|
52
|
+
const children =
|
|
53
|
+
(groupChildrenKey && obj[groupChildrenKey]) || obj['items'] || obj['children'];
|
|
54
|
+
|
|
55
|
+
if (Array.isArray(children)) {
|
|
56
|
+
const groupTitle =
|
|
57
|
+
groupLabelKey && obj[groupLabelKey] !== undefined
|
|
58
|
+
? String(obj[groupLabelKey])
|
|
59
|
+
: obj['label'] !== undefined
|
|
60
|
+
? String(obj['label'])
|
|
61
|
+
: '';
|
|
62
|
+
|
|
63
|
+
for (const child of children) {
|
|
64
|
+
if (child === null || child === undefined) continue;
|
|
65
|
+
const opt = resolveOption(child, labelKey, valueKey);
|
|
66
|
+
opt.group = groupTitle;
|
|
67
|
+
result.push(opt);
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
result.push(resolveOption(item, labelKey, valueKey));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function filterOptions(
|
|
80
|
+
options: NormalizedOption[],
|
|
81
|
+
query: string,
|
|
82
|
+
matchMode: 'contains' | 'startsWith' | 'endsWith' = 'contains'
|
|
83
|
+
): NormalizedOption[] {
|
|
84
|
+
if (!query || !query.trim()) return options;
|
|
85
|
+
const q = query.toLowerCase().trim();
|
|
86
|
+
return options.filter(opt => {
|
|
87
|
+
const l = opt.label.toLowerCase();
|
|
88
|
+
if (matchMode === 'startsWith') return l.startsWith(q);
|
|
89
|
+
if (matchMode === 'endsWith') return l.endsWith(q);
|
|
90
|
+
return l.includes(q);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
@@ -10,6 +10,9 @@ export * from './components/primitives/button-group/button-group.component';
|
|
|
10
10
|
export * from './components/primitives/floating-action-button/floating-action-button.component';
|
|
11
11
|
export * from './devtools';
|
|
12
12
|
export * from './components/primitives/select/select.component';
|
|
13
|
+
export * from './components/primitives/multi-select/multi-select.component';
|
|
14
|
+
export * from './components/primitives/autocomplete/autocomplete.component';
|
|
15
|
+
export * from './components/primitives/combobox/combobox.component';
|
|
13
16
|
export * from './components/primitives/checkbox/checkbox.component';
|
|
14
17
|
export * from './components/primitives/radio-group/radio-group.component';
|
|
15
18
|
export * from './components/primitives/textarea/textarea.component';
|
|
@@ -4,6 +4,9 @@ import { IconButtonComponent } from '../components/primitives/icon-button/icon-b
|
|
|
4
4
|
import { ButtonGroupComponent } from '../components/primitives/button-group/button-group.component';
|
|
5
5
|
import { FloatingActionButtonComponent } from '../components/primitives/floating-action-button/floating-action-button.component';
|
|
6
6
|
import { SelectComponent } from '../components/primitives/select/select.component';
|
|
7
|
+
import { MultiSelectComponent } from '../components/primitives/multi-select/multi-select.component';
|
|
8
|
+
import { AutocompleteComponent } from '../components/primitives/autocomplete/autocomplete.component';
|
|
9
|
+
import { ComboboxComponent } from '../components/primitives/combobox/combobox.component';
|
|
7
10
|
import { CheckboxComponent } from '../components/primitives/checkbox/checkbox.component';
|
|
8
11
|
import { RadioGroupComponent } from '../components/primitives/radio-group/radio-group.component';
|
|
9
12
|
import { TextareaComponent } from '../components/primitives/textarea/textarea.component';
|
|
@@ -29,6 +32,9 @@ export function provideOrigo9Primitives(): EnvironmentProviders {
|
|
|
29
32
|
['ButtonGroup', ButtonGroupComponent],
|
|
30
33
|
['FloatingActionButton', FloatingActionButtonComponent],
|
|
31
34
|
['Select', SelectComponent],
|
|
35
|
+
['MultiSelect', MultiSelectComponent],
|
|
36
|
+
['Autocomplete', AutocompleteComponent],
|
|
37
|
+
['Combobox', ComboboxComponent],
|
|
32
38
|
['Checkbox', CheckboxComponent],
|
|
33
39
|
['RadioGroup', RadioGroupComponent],
|
|
34
40
|
['Textarea', TextareaComponent],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origostudio/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"origo": "./src/main.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@origostudio/core": "0.0.
|
|
12
|
+
"@origostudio/core": "0.0.50",
|
|
13
13
|
"commander": "^15.0.0",
|
|
14
14
|
"tslib": "^2.3.0"
|
|
15
15
|
},
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.0.50 (2026-10-08)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for design-tokens to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
1
5
|
## 0.0.49 (2026-10-08)
|
|
2
6
|
|
|
3
7
|
This was a version bump only for design-tokens to align it with other projects, there were no code changes.
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.0.50 (2026-10-08)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- add core selection control primitives including select, multi-select, combobox, and autocomplete components ([3866703](https://github.com/OrigoStudio/origo-design/commit/3866703))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Hardik Patel @hardikpatelse
|
|
10
|
+
|
|
1
11
|
## 0.0.49 (2026-10-08)
|
|
2
12
|
|
|
3
13
|
This was a version bump only for devtools to align it with other projects, there were no code changes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"4.1.11","results":[[":src/devtools-panel/app.component.spec.ts",{"duration":
|
|
1
|
+
{"version":"4.1.11","results":[[":src/devtools-panel/app.component.spec.ts",{"duration":180.44159500000023,"failed":false}]]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origostudio/devtools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@origostudio/core": "0.0.
|
|
7
|
-
"@origostudio/cli": "0.0.
|
|
6
|
+
"@origostudio/core": "0.0.50",
|
|
7
|
+
"@origostudio/cli": "0.0.50",
|
|
8
8
|
"@angular/core": "18.1.0",
|
|
9
9
|
"@angular/common": "18.1.0"
|
|
10
10
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"4.1.11","results":[[":src/
|
|
1
|
+
{"version":"4.1.11","results":[[":src/workers/compiler.worker.spec.ts",{"duration":5319.368552,"failed":false}],[":src/editor/badl-editor.component.spec.ts",{"duration":547.4748609999988,"failed":false}],[":src/preview/preview-root.component.spec.ts",{"duration":369.1087829999997,"failed":false}],[":src/editor/schema-registry.spec.ts",{"duration":50.87500999999975,"failed":false}],[":src/preview/preview.service.spec.ts",{"duration":145.60159399999975,"failed":false}],[":src/app/app.component.spec.ts",{"duration":415.8329359999989,"failed":false}],[":src/preview/preview-pane.component.spec.ts",{"duration":307.30098,"failed":false}]]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origostudio/playground",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"private": true,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@origostudio/core": "0.0.
|
|
7
|
-
"@origostudio/cli": "0.0.
|
|
6
|
+
"@origostudio/core": "0.0.50",
|
|
7
|
+
"@origostudio/cli": "0.0.50"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"@angular/common": "^18.0.0",
|