@basis-ng/primitives 0.0.1-alpha.8 → 0.0.1-alpha.9
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/core/components/select/{options-list.component.d.ts → select-options.component.d.ts} +5 -5
- package/core/components/select/select.component.d.ts +2 -2
- package/fesm2022/basis-ng-primitives.mjs +64 -290
- package/fesm2022/basis-ng-primitives.mjs.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -5
- package/shared/components/{label/label.component.d.ts → label.component.d.ts} +1 -1
- package/core/components/search/search.component.d.ts +0 -121
- package/shared/components/option/option.component.d.ts +0 -10
- package/shared/services/utils.service.d.ts +0 -16
- /package/{core/components/select → shared/components}/option.component.d.ts +0 -0
package/core/components/select/{options-list.component.d.ts → select-options.component.d.ts}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CdkListbox } from '@angular/cdk/listbox';
|
|
2
2
|
import { ElementRef } from '@angular/core';
|
|
3
|
-
import { OptionComponent } from '
|
|
3
|
+
import { OptionComponent } from '../../../shared/components/option.component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
import * as i1 from "@angular/cdk/listbox";
|
|
6
6
|
/**
|
|
7
|
-
* Component representing the list of options in a select
|
|
7
|
+
* Component representing the list of options in a select.
|
|
8
8
|
* This component integrates with Angular CDK Listbox to manage options and their selection.
|
|
9
9
|
*/
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class SelectOptionsComponent {
|
|
11
11
|
/**
|
|
12
12
|
* Signal representing the selected values in the listbox.
|
|
13
13
|
* This is an array of strings corresponding to the selected option values.
|
|
@@ -46,6 +46,6 @@ export declare class OptionsListComponent {
|
|
|
46
46
|
* @param value - The new array of selected values.
|
|
47
47
|
*/
|
|
48
48
|
handleValueChange(value: string[]): void;
|
|
49
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
50
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SelectOptionsComponent, never>;
|
|
50
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SelectOptionsComponent, "ul[b-select-options]", never, { "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; }, { "closeEmitter": "closeEmitter"; }, ["options"], ["*"], true, [{ directive: typeof i1.CdkListbox; inputs: { "cdkListboxValue": "cdkListboxValue"; }; outputs: { "cdkListboxValueChange": "cdkListboxValueChange"; }; }]>;
|
|
51
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CdkConnectedOverlay } from '@angular/cdk/overlay';
|
|
2
2
|
import { OnInit } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { SelectOptionsComponent } from './select-options.component';
|
|
4
4
|
import { Button } from '../button/button.component';
|
|
5
5
|
import { ControlValueAccessor } from '@angular/forms';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
@@ -27,7 +27,7 @@ export declare class SelectComponent implements OnInit, ControlValueAccessor {
|
|
|
27
27
|
* Reference to the content component of the dropdown.
|
|
28
28
|
* This contains the list of selectable options.
|
|
29
29
|
*/
|
|
30
|
-
readonly optionsList: import("@angular/core").Signal<
|
|
30
|
+
readonly optionsList: import("@angular/core").Signal<SelectOptionsComponent | undefined>;
|
|
31
31
|
/**
|
|
32
32
|
* Computed signal representing the selected values from the dropdown.
|
|
33
33
|
* This is linked to the value of the `OptionsListComponent`.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, inject, RendererFactory2, Injectable, input, Component, ElementRef, TemplateRef, Directive,
|
|
2
|
+
import { signal, inject, RendererFactory2, Injectable, input, Component, ElementRef, TemplateRef, Directive, model, computed, output, contentChildren, viewChild, contentChild, linkedSignal, forwardRef, effect, HostListener, afterNextRender, afterRenderEffect } from '@angular/core';
|
|
3
3
|
import { NgStyle, NgClass, CommonModule } from '@angular/common';
|
|
4
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
5
|
-
import { icons, createElement } from 'lucide';
|
|
6
4
|
import { NgModel, NG_VALUE_ACCESSOR, ControlContainer } from '@angular/forms';
|
|
7
5
|
import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
8
6
|
import * as i1 from '@angular/cdk/listbox';
|
|
9
7
|
import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
|
|
8
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
9
|
+
import { icons, createElement } from 'lucide';
|
|
10
10
|
import * as i1$1 from '@angular/cdk/drag-drop';
|
|
11
11
|
import { CdkDrag, CdkDragHandle, CdkDropList, CdkDropListGroup } from '@angular/cdk/drag-drop';
|
|
12
12
|
import * as i1$2 from '@angular/cdk/menu';
|
|
@@ -152,268 +152,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
152
152
|
}]
|
|
153
153
|
}] });
|
|
154
154
|
|
|
155
|
-
class Icon {
|
|
156
|
-
/**
|
|
157
|
-
* The sanitizer service.
|
|
158
|
-
*/
|
|
159
|
-
sanitizer = inject(DomSanitizer);
|
|
160
|
-
/**
|
|
161
|
-
* The icon of the text field.
|
|
162
|
-
*/
|
|
163
|
-
icon = input.required();
|
|
164
|
-
/**
|
|
165
|
-
* The size of the icon.
|
|
166
|
-
*/
|
|
167
|
-
size = input(24);
|
|
168
|
-
/**
|
|
169
|
-
* The stroke of the icon.
|
|
170
|
-
*/
|
|
171
|
-
strokeWidth = input(1.8);
|
|
172
|
-
/**
|
|
173
|
-
* The color of the icon.
|
|
174
|
-
*/
|
|
175
|
-
color = input('var(--foreground, #798194)');
|
|
176
|
-
/**
|
|
177
|
-
* The svg of the icon.
|
|
178
|
-
*/
|
|
179
|
-
iconSvg = computed(() => {
|
|
180
|
-
if (!icons[this.icon()]) {
|
|
181
|
-
console.error(`Icon '${this.icon()}' not found in Lucide icons.`);
|
|
182
|
-
return this.sanitizer.bypassSecurityTrustHtml('');
|
|
183
|
-
}
|
|
184
|
-
const iconSvg = createElement(icons[this.icon()], {
|
|
185
|
-
width: this.size(),
|
|
186
|
-
height: this.size(),
|
|
187
|
-
stroke: this.color(),
|
|
188
|
-
'stroke-width': this.strokeWidth(),
|
|
189
|
-
});
|
|
190
|
-
return this.sanitizer.bypassSecurityTrustHtml(iconSvg.outerHTML);
|
|
191
|
-
});
|
|
192
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
193
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Icon, isStandalone: true, selector: "i[b-icon]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "innerHTML": "iconSvg()" } }, ngImport: i0, template: ``, isInline: true });
|
|
194
|
-
}
|
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, decorators: [{
|
|
196
|
-
type: Component,
|
|
197
|
-
args: [{
|
|
198
|
-
selector: 'i[b-icon]',
|
|
199
|
-
imports: [],
|
|
200
|
-
template: ``,
|
|
201
|
-
host: {
|
|
202
|
-
'[innerHTML]': 'iconSvg()',
|
|
203
|
-
},
|
|
204
|
-
}]
|
|
205
|
-
}] });
|
|
206
|
-
|
|
207
|
-
class UtilsService {
|
|
208
|
-
debounceTimer;
|
|
209
|
-
/**
|
|
210
|
-
* Debounce with optional delay
|
|
211
|
-
* @param {any} func - The function to debounce
|
|
212
|
-
* @param {any} delay - The delay in milliseconds
|
|
213
|
-
*/
|
|
214
|
-
debounce(func, delay) {
|
|
215
|
-
clearTimeout(this.debounceTimer);
|
|
216
|
-
this.debounceTimer = setTimeout(func, delay);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Stop debounce
|
|
220
|
-
*/
|
|
221
|
-
stopDebounce() {
|
|
222
|
-
clearTimeout(this.debounceTimer);
|
|
223
|
-
}
|
|
224
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
225
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
|
226
|
-
}
|
|
227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, decorators: [{
|
|
228
|
-
type: Injectable,
|
|
229
|
-
args: [{
|
|
230
|
-
providedIn: 'root',
|
|
231
|
-
}]
|
|
232
|
-
}] });
|
|
233
|
-
|
|
234
|
-
class Search {
|
|
235
|
-
/**
|
|
236
|
-
* The label associated with the search component.
|
|
237
|
-
*/
|
|
238
|
-
label = input();
|
|
239
|
-
/**
|
|
240
|
-
* The maximum width of the search component.
|
|
241
|
-
*/
|
|
242
|
-
maxWidth = input('');
|
|
243
|
-
/**
|
|
244
|
-
* The placeholder of the text field.
|
|
245
|
-
*/
|
|
246
|
-
placeholder = input('');
|
|
247
|
-
/**
|
|
248
|
-
* Indicates whether the search component is searching.
|
|
249
|
-
*/
|
|
250
|
-
searching = model(false);
|
|
251
|
-
/**
|
|
252
|
-
* Indicates whether the search component is in an invalid state.
|
|
253
|
-
*/
|
|
254
|
-
invalid = model(false);
|
|
255
|
-
/**
|
|
256
|
-
* Indicates whether the search component is disabled.
|
|
257
|
-
*/
|
|
258
|
-
disabled = model(false);
|
|
259
|
-
/**
|
|
260
|
-
* The value of the selected option.
|
|
261
|
-
*/
|
|
262
|
-
selectedValue = model(null);
|
|
263
|
-
/**
|
|
264
|
-
* The search value.
|
|
265
|
-
*/
|
|
266
|
-
searchValue = model('');
|
|
267
|
-
/**
|
|
268
|
-
* Emits the value of the search component when the value changes.
|
|
269
|
-
*/
|
|
270
|
-
searchChange = output();
|
|
271
|
-
/**
|
|
272
|
-
* Emits when the search component is focused.
|
|
273
|
-
*/
|
|
274
|
-
focused = signal(false);
|
|
275
|
-
/**
|
|
276
|
-
* Indicates whether the options dropdown is open.
|
|
277
|
-
*/
|
|
278
|
-
isOpen = signal(false);
|
|
279
|
-
/**
|
|
280
|
-
* The options available for selection.
|
|
281
|
-
*/
|
|
282
|
-
options = contentChildren(Option);
|
|
283
|
-
/**
|
|
284
|
-
* Indicates whether the search component has no options.
|
|
285
|
-
*/
|
|
286
|
-
noOptions = computed(() => !this.options() || this.options().length === 0);
|
|
287
|
-
/**
|
|
288
|
-
* Reference to the select element within the component
|
|
289
|
-
* @private
|
|
290
|
-
*/
|
|
291
|
-
select = viewChild('select');
|
|
292
|
-
/**
|
|
293
|
-
* Reference to the renderer
|
|
294
|
-
* @private
|
|
295
|
-
*/
|
|
296
|
-
renderer = inject(Renderer2);
|
|
297
|
-
/**
|
|
298
|
-
* The icon name to display.
|
|
299
|
-
*/
|
|
300
|
-
selectIconName = computed(() => {
|
|
301
|
-
return this.searching()
|
|
302
|
-
? 'LoaderCircle'
|
|
303
|
-
: this.selectedValue()
|
|
304
|
-
? 'X'
|
|
305
|
-
: 'ChevronDown';
|
|
306
|
-
});
|
|
307
|
-
/**
|
|
308
|
-
* The icon size to display.
|
|
309
|
-
*/
|
|
310
|
-
selectIconSize = computed(() => {
|
|
311
|
-
return this.searching() ? 17 : this.selectedValue() ? 18 : 20;
|
|
312
|
-
});
|
|
313
|
-
/**
|
|
314
|
-
* The debounce time for the search input.
|
|
315
|
-
*/
|
|
316
|
-
debounceTime = input(300);
|
|
317
|
-
/**
|
|
318
|
-
* Reference to the UtilsService
|
|
319
|
-
* @private
|
|
320
|
-
*/
|
|
321
|
-
utilsService = inject(UtilsService);
|
|
322
|
-
/**
|
|
323
|
-
* Initializes the search component.
|
|
324
|
-
*/
|
|
325
|
-
constructor() {
|
|
326
|
-
effect(() => this.renderOptions());
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Renders the options within the select element.
|
|
330
|
-
* @private
|
|
331
|
-
*/
|
|
332
|
-
renderOptions() {
|
|
333
|
-
const select = this.select()?.nativeElement;
|
|
334
|
-
const options = this.options();
|
|
335
|
-
if (!select || !options || options.length === 0) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
// Clear the existing options
|
|
339
|
-
select.innerHTML = '';
|
|
340
|
-
// Append the options to the select
|
|
341
|
-
options.forEach(option => {
|
|
342
|
-
this.renderer.appendChild(select, option.el.nativeElement);
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Handles the change event of the input text.
|
|
347
|
-
*/
|
|
348
|
-
onInputValueChange(event) {
|
|
349
|
-
this.searching.set(true);
|
|
350
|
-
const value = event.target.value;
|
|
351
|
-
this.searchValue.set(value);
|
|
352
|
-
// Use the debounce method from UtilsService
|
|
353
|
-
this.utilsService.debounce(() => {
|
|
354
|
-
this.searchChange.emit(value);
|
|
355
|
-
}, this.debounceTime());
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Resets the search component.
|
|
359
|
-
*/
|
|
360
|
-
reset() {
|
|
361
|
-
this.selectedValue.set(null);
|
|
362
|
-
this.searchValue.set('');
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Handles the selection change event from the native select element.
|
|
366
|
-
* @param event The selection change event.
|
|
367
|
-
*/
|
|
368
|
-
onSelectValueChange(event) {
|
|
369
|
-
const select = event.target;
|
|
370
|
-
const value = select.value === 'null' ? null : select.value;
|
|
371
|
-
this.selectedValue.set(value);
|
|
372
|
-
this.isOpen.set(false);
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Handles click events outside the select component to close the options dropdown.
|
|
376
|
-
* @param event The mouse click event.
|
|
377
|
-
*/
|
|
378
|
-
onOutsideClick(event) {
|
|
379
|
-
if (!this.select().nativeElement.contains(event.target)) {
|
|
380
|
-
this.isOpen.set(false);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Handles keyboard events to open or close the options dropdown.
|
|
385
|
-
* @param event The keyboard event.
|
|
386
|
-
*/
|
|
387
|
-
onKeyDown(event) {
|
|
388
|
-
if (event.key === 'Escape') {
|
|
389
|
-
this.isOpen.set(false);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Handles the icon click event.
|
|
394
|
-
*/
|
|
395
|
-
handleIconClick() {
|
|
396
|
-
if (this.selectedValue()) {
|
|
397
|
-
this.reset();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Search, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: Search, isStandalone: true, selector: "b-search", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searching: { classPropertyName: "searching", publicName: "searching", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, searchValue: { classPropertyName: "searchValue", publicName: "searchValue", isSignal: true, isRequired: false, transformFunction: null }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { searching: "searchingChange", invalid: "invalidChange", disabled: "disabledChange", selectedValue: "selectedValueChange", searchValue: "searchValueChange", searchChange: "searchChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "document:click": "onOutsideClick($event)" }, properties: { "style.max-width": "maxWidth()", "class.invalid": "invalid()", "class.disabled": "disabled()", "class.label-up": "(searchValue() || selectedValue() || placeholder() || focused()) && label()" } }, queries: [{ propertyName: "options", predicate: Option, isSignal: true }], viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Label -->\r\n@if (label()) {\r\n <label>\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n@if (!selectedValue()) {\r\n <section [class.large]=\"noOptions() && !searching()\">\r\n <!-- Input -->\r\n <input\r\n #input\r\n [value]=\"searchValue()\"\r\n [placeholder]=\"placeholder() || ''\"\r\n [disabled]=\"disabled()\"\r\n (focus)=\"focused.set(true)\"\r\n (blur)=\"focused.set(false)\"\r\n (input)=\"onInputValueChange($event)\" />\r\n\r\n <!-- Clear Button -->\r\n @if (searchValue() || selectedValue()) {\r\n <i\r\n b-icon\r\n icon=\"X\"\r\n [size]=\"18\"\r\n tabindex=\"0\"\r\n (click)=\"searchValue.set('')\"\r\n (keydown.enter)=\"searchValue.set('')\"\r\n (keydown.space)=\"searchValue.set('')\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n }\r\n </section>\r\n}\r\n\r\n<!-- Select -->\r\n<select\r\n #select\r\n [value]=\"selectedValue()\"\r\n (change)=\"onSelectValueChange($event)\"\r\n [class.no-options]=\"noOptions()\"\r\n (mousedown)=\"isOpen.set(true)\"\r\n [disabled]=\"disabled()\"></select>\r\n\r\nnooptions: {{ noOptions() }} searching: {{ searching() }}\r\n\r\n@if (!noOptions() || searching()) {\r\n <!-- Icon -->\r\n <div class=\"icon-wrapper\">\r\n <i\r\n b-icon\r\n [icon]=\"selectIconName()\"\r\n [class.open]=\"isOpen()\"\r\n [class.select-has-value]=\"selectedValue()\"\r\n (click)=\"handleIconClick()\"\r\n (keydown.enter)=\"handleIconClick()\"\r\n (keydown.space)=\"handleIconClick()\"\r\n tabindex=\"0\"\r\n [class.searching]=\"searching()\"\r\n [size]=\"selectIconSize()\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n </div>\r\n}\r\n\r\n<!-- Projected Options -->\r\n<ng-content />\r\n", dependencies: [{ kind: "component", type: Icon, selector: "i[b-icon]", inputs: ["icon", "size", "strokeWidth", "color"] }] });
|
|
402
|
-
}
|
|
403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Search, decorators: [{
|
|
404
|
-
type: Component,
|
|
405
|
-
args: [{ selector: 'b-search', imports: [Icon], host: {
|
|
406
|
-
'[style.max-width]': 'maxWidth()',
|
|
407
|
-
'[class.invalid]': 'invalid()',
|
|
408
|
-
'[class.disabled]': 'disabled()',
|
|
409
|
-
'[class.label-up]': '(searchValue() || selectedValue() || placeholder() || focused()) && label()',
|
|
410
|
-
'(keydown)': 'onKeyDown($event)',
|
|
411
|
-
}, template: "<!-- Label -->\r\n@if (label()) {\r\n <label>\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n@if (!selectedValue()) {\r\n <section [class.large]=\"noOptions() && !searching()\">\r\n <!-- Input -->\r\n <input\r\n #input\r\n [value]=\"searchValue()\"\r\n [placeholder]=\"placeholder() || ''\"\r\n [disabled]=\"disabled()\"\r\n (focus)=\"focused.set(true)\"\r\n (blur)=\"focused.set(false)\"\r\n (input)=\"onInputValueChange($event)\" />\r\n\r\n <!-- Clear Button -->\r\n @if (searchValue() || selectedValue()) {\r\n <i\r\n b-icon\r\n icon=\"X\"\r\n [size]=\"18\"\r\n tabindex=\"0\"\r\n (click)=\"searchValue.set('')\"\r\n (keydown.enter)=\"searchValue.set('')\"\r\n (keydown.space)=\"searchValue.set('')\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n }\r\n </section>\r\n}\r\n\r\n<!-- Select -->\r\n<select\r\n #select\r\n [value]=\"selectedValue()\"\r\n (change)=\"onSelectValueChange($event)\"\r\n [class.no-options]=\"noOptions()\"\r\n (mousedown)=\"isOpen.set(true)\"\r\n [disabled]=\"disabled()\"></select>\r\n\r\nnooptions: {{ noOptions() }} searching: {{ searching() }}\r\n\r\n@if (!noOptions() || searching()) {\r\n <!-- Icon -->\r\n <div class=\"icon-wrapper\">\r\n <i\r\n b-icon\r\n [icon]=\"selectIconName()\"\r\n [class.open]=\"isOpen()\"\r\n [class.select-has-value]=\"selectedValue()\"\r\n (click)=\"handleIconClick()\"\r\n (keydown.enter)=\"handleIconClick()\"\r\n (keydown.space)=\"handleIconClick()\"\r\n tabindex=\"0\"\r\n [class.searching]=\"searching()\"\r\n [size]=\"selectIconSize()\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n </div>\r\n}\r\n\r\n<!-- Projected Options -->\r\n<ng-content />\r\n" }]
|
|
412
|
-
}], ctorParameters: () => [], propDecorators: { onOutsideClick: [{
|
|
413
|
-
type: HostListener,
|
|
414
|
-
args: ['document:click', ['$event']]
|
|
415
|
-
}] } });
|
|
416
|
-
|
|
417
155
|
class Input {
|
|
418
156
|
/**
|
|
419
157
|
* The type of the input.
|
|
@@ -571,10 +309,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
571
309
|
}] });
|
|
572
310
|
|
|
573
311
|
/**
|
|
574
|
-
* Component representing the list of options in a select
|
|
312
|
+
* Component representing the list of options in a select.
|
|
575
313
|
* This component integrates with Angular CDK Listbox to manage options and their selection.
|
|
576
314
|
*/
|
|
577
|
-
class
|
|
315
|
+
class SelectOptionsComponent {
|
|
578
316
|
/**
|
|
579
317
|
* Signal representing the selected values in the listbox.
|
|
580
318
|
* This is an array of strings corresponding to the selected option values.
|
|
@@ -616,13 +354,13 @@ class OptionsListComponent {
|
|
|
616
354
|
this.value.set(value);
|
|
617
355
|
this.closeEmitter.emit();
|
|
618
356
|
}
|
|
619
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type:
|
|
620
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type:
|
|
357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SelectOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
358
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: SelectOptionsComponent, isStandalone: true, selector: "ul[b-select-options]", inputs: { maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeEmitter: "closeEmitter" }, host: { listeners: { "cdkListboxValueChange": "handleValueChange($event.value)" }, properties: { "cdkListboxValue": "value()", "style.max-height": "maxHeight()" } }, queries: [{ propertyName: "options", predicate: OptionComponent, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox, inputs: ["cdkListboxValue", "cdkListboxValue"], outputs: ["cdkListboxValueChange", "cdkListboxValueChange"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
621
359
|
}
|
|
622
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type:
|
|
360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SelectOptionsComponent, decorators: [{
|
|
623
361
|
type: Component,
|
|
624
362
|
args: [{
|
|
625
|
-
selector: 'ul[b-options
|
|
363
|
+
selector: 'ul[b-select-options]',
|
|
626
364
|
imports: [],
|
|
627
365
|
template: `<ng-content />`,
|
|
628
366
|
hostDirectives: [
|
|
@@ -640,6 +378,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
640
378
|
}]
|
|
641
379
|
}] });
|
|
642
380
|
|
|
381
|
+
class Icon {
|
|
382
|
+
/**
|
|
383
|
+
* The sanitizer service.
|
|
384
|
+
*/
|
|
385
|
+
sanitizer = inject(DomSanitizer);
|
|
386
|
+
/**
|
|
387
|
+
* The icon of the text field.
|
|
388
|
+
*/
|
|
389
|
+
icon = input.required();
|
|
390
|
+
/**
|
|
391
|
+
* The size of the icon.
|
|
392
|
+
*/
|
|
393
|
+
size = input(24);
|
|
394
|
+
/**
|
|
395
|
+
* The stroke of the icon.
|
|
396
|
+
*/
|
|
397
|
+
strokeWidth = input(1.8);
|
|
398
|
+
/**
|
|
399
|
+
* The color of the icon.
|
|
400
|
+
*/
|
|
401
|
+
color = input('var(--foreground, #798194)');
|
|
402
|
+
/**
|
|
403
|
+
* The svg of the icon.
|
|
404
|
+
*/
|
|
405
|
+
iconSvg = computed(() => {
|
|
406
|
+
if (!icons[this.icon()]) {
|
|
407
|
+
console.error(`Icon '${this.icon()}' not found in Lucide icons.`);
|
|
408
|
+
return this.sanitizer.bypassSecurityTrustHtml('');
|
|
409
|
+
}
|
|
410
|
+
const iconSvg = createElement(icons[this.icon()], {
|
|
411
|
+
width: this.size(),
|
|
412
|
+
height: this.size(),
|
|
413
|
+
stroke: this.color(),
|
|
414
|
+
'stroke-width': this.strokeWidth(),
|
|
415
|
+
});
|
|
416
|
+
return this.sanitizer.bypassSecurityTrustHtml(iconSvg.outerHTML);
|
|
417
|
+
});
|
|
418
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
419
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Icon, isStandalone: true, selector: "i[b-icon]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "innerHTML": "iconSvg()" } }, ngImport: i0, template: ``, isInline: true });
|
|
420
|
+
}
|
|
421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, decorators: [{
|
|
422
|
+
type: Component,
|
|
423
|
+
args: [{
|
|
424
|
+
selector: 'i[b-icon]',
|
|
425
|
+
imports: [],
|
|
426
|
+
template: ``,
|
|
427
|
+
host: {
|
|
428
|
+
'[innerHTML]': 'iconSvg()',
|
|
429
|
+
},
|
|
430
|
+
}]
|
|
431
|
+
}] });
|
|
432
|
+
|
|
643
433
|
/**
|
|
644
434
|
* Component representing a custom select dropdown.
|
|
645
435
|
* This component provides a button to toggle the dropdown and displays the selected option(s).
|
|
@@ -663,7 +453,7 @@ class SelectComponent {
|
|
|
663
453
|
* Reference to the content component of the dropdown.
|
|
664
454
|
* This contains the list of selectable options.
|
|
665
455
|
*/
|
|
666
|
-
optionsList = contentChild(
|
|
456
|
+
optionsList = contentChild(SelectOptionsComponent);
|
|
667
457
|
/**
|
|
668
458
|
* Computed signal representing the selected values from the dropdown.
|
|
669
459
|
* This is linked to the value of the `OptionsListComponent`.
|
|
@@ -812,7 +602,7 @@ class SelectComponent {
|
|
|
812
602
|
useExisting: forwardRef(() => SelectComponent),
|
|
813
603
|
multi: true,
|
|
814
604
|
},
|
|
815
|
-
], queries: [{ propertyName: "optionsList", first: true, predicate:
|
|
605
|
+
], queries: [{ propertyName: "optionsList", first: true, predicate: SelectOptionsComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "button", first: true, predicate: Button, descendants: true, isSignal: true }, { propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], ngImport: i0, template: ` <button
|
|
816
606
|
b-button
|
|
817
607
|
variant="outlined"
|
|
818
608
|
(click)="isOpen() ? close() : open()"
|
|
@@ -910,22 +700,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
910
700
|
}]
|
|
911
701
|
}] });
|
|
912
702
|
|
|
913
|
-
class Option {
|
|
914
|
-
/**
|
|
915
|
-
* Reference to the host element.
|
|
916
|
-
*/
|
|
917
|
-
el = inject(ElementRef);
|
|
918
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Option, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
919
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: Option, isStandalone: true, selector: "option[b-option]", ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
920
|
-
}
|
|
921
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Option, decorators: [{
|
|
922
|
-
type: Component,
|
|
923
|
-
args: [{
|
|
924
|
-
selector: 'option[b-option]',
|
|
925
|
-
template: `<ng-content />`,
|
|
926
|
-
}]
|
|
927
|
-
}] });
|
|
928
|
-
|
|
929
703
|
class Switch {
|
|
930
704
|
/**
|
|
931
705
|
* Value of the switch.
|
|
@@ -2713,5 +2487,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
2713
2487
|
* Generated bundle index. Do not edit.
|
|
2714
2488
|
*/
|
|
2715
2489
|
|
|
2716
|
-
export { Alert, AttachedBox, Badge, BottomSheet, Button, ButtonGroup, Checkbox, ColorPicker, Icon, InViewportDirective, InViewportService, Input, InputGroup, Label, LazyContentDirective, Menu, MenuItemCheckboxComponent, MenuItemComponent, MenuItemRadioComponent, MenuLabel, MenuTrigger,
|
|
2490
|
+
export { Alert, AttachedBox, Badge, BottomSheet, Button, ButtonGroup, Checkbox, ColorPicker, Icon, InViewportDirective, InViewportService, Input, InputGroup, Label, LazyContentDirective, Menu, MenuItemCheckboxComponent, MenuItemComponent, MenuItemRadioComponent, MenuLabel, MenuTrigger, OptionComponent, Range, ResponsiveService, Row, RowItem, SelectComponent, SelectOptionsComponent, SideSheet, Spinner, Switch, Tab, Table, Tabs, Textarea, ThemeService, TooltipComponent, Tree, TreeNode };
|
|
2717
2491
|
//# sourceMappingURL=basis-ng-primitives.mjs.map
|