ng-blatui 1.18.0 → 1.20.0
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/fesm2022/ng-blatui.mjs +470 -1
- package/fesm2022/ng-blatui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ng-blatui.d.ts +81 -2
package/fesm2022/ng-blatui.mjs
CHANGED
|
@@ -5204,6 +5204,475 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
5204
5204
|
}]
|
|
5205
5205
|
}], propDecorators: { tiers: [{ type: i0.Input, args: [{ isSignal: true, alias: "tiers", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], highlight: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlight", required: false }] }], featureLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "featureLabel", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5206
5206
|
|
|
5207
|
+
/**
|
|
5208
|
+
* A card that flips to reveal its back. Default content is the front; project the back
|
|
5209
|
+
* with `[buiFlipBack]`. `trigger="hover"` (default) or `"click"` (keyboard-accessible).
|
|
5210
|
+
*/
|
|
5211
|
+
class BuiFlipCard {
|
|
5212
|
+
trigger = input('hover', /* @ts-ignore */
|
|
5213
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
5214
|
+
height = input('16rem', /* @ts-ignore */
|
|
5215
|
+
...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
5216
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
5217
|
+
flipped = signal(false, /* @ts-ignore */
|
|
5218
|
+
...(ngDevMode ? [{ debugName: "flipped" }] : /* istanbul ignore next */ []));
|
|
5219
|
+
computedClass = computed(() => cn('relative block w-full', this.userClass()), /* @ts-ignore */
|
|
5220
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5221
|
+
onHover(shouldFlip) {
|
|
5222
|
+
if (this.trigger() === 'hover') {
|
|
5223
|
+
this.flipped.set(shouldFlip);
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
onClick() {
|
|
5227
|
+
if (this.trigger() === 'click') {
|
|
5228
|
+
this.flipped.update((value) => !value);
|
|
5229
|
+
}
|
|
5230
|
+
}
|
|
5231
|
+
onKeydown(event) {
|
|
5232
|
+
if (!(this.trigger() === 'click' && (event.key === 'Enter' || event.key === ' '))) {
|
|
5233
|
+
return;
|
|
5234
|
+
}
|
|
5235
|
+
event.preventDefault();
|
|
5236
|
+
this.flipped.update((value) => !value);
|
|
5237
|
+
}
|
|
5238
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiFlipCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5239
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiFlipCard, isStandalone: true, selector: "bui-flip-card", inputs: { trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "flip-card" }, listeners: { "mouseenter": "onHover(true)", "mouseleave": "onHover(false)", "focusin": "onHover(true)", "focusout": "onHover(false)", "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "class": "computedClass()", "style.perspective": "'1000px'", "style.height": "height()", "attr.role": "trigger() === 'click' ? 'button' : null", "attr.tabindex": "trigger() === 'click' ? 0 : null", "attr.aria-pressed": "trigger() === 'click' ? flipped() : null" } }, ngImport: i0, template: `
|
|
5240
|
+
<div
|
|
5241
|
+
data-slot="flip-card-flipper"
|
|
5242
|
+
class="relative block size-full rounded-xl transition-transform duration-500 [transform-style:preserve-3d]"
|
|
5243
|
+
[class]="flipped() ? '[transform:rotateY(180deg)]' : ''"
|
|
5244
|
+
>
|
|
5245
|
+
<div
|
|
5246
|
+
data-slot="flip-card-front"
|
|
5247
|
+
class="absolute inset-0 flex flex-col overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm [backface-visibility:hidden]"
|
|
5248
|
+
[attr.aria-hidden]="flipped()"
|
|
5249
|
+
>
|
|
5250
|
+
<ng-content />
|
|
5251
|
+
</div>
|
|
5252
|
+
<div
|
|
5253
|
+
data-slot="flip-card-back"
|
|
5254
|
+
class="absolute inset-0 flex [transform:rotateY(180deg)] flex-col overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm [backface-visibility:hidden]"
|
|
5255
|
+
[attr.aria-hidden]="!flipped()"
|
|
5256
|
+
>
|
|
5257
|
+
<ng-content select="[buiFlipBack]" />
|
|
5258
|
+
</div>
|
|
5259
|
+
</div>
|
|
5260
|
+
`, isInline: true });
|
|
5261
|
+
}
|
|
5262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiFlipCard, decorators: [{
|
|
5263
|
+
type: Component,
|
|
5264
|
+
args: [{
|
|
5265
|
+
selector: 'bui-flip-card',
|
|
5266
|
+
host: {
|
|
5267
|
+
'data-slot': 'flip-card',
|
|
5268
|
+
'[class]': 'computedClass()',
|
|
5269
|
+
'[style.perspective]': "'1000px'",
|
|
5270
|
+
'[style.height]': 'height()',
|
|
5271
|
+
'[attr.role]': "trigger() === 'click' ? 'button' : null",
|
|
5272
|
+
'[attr.tabindex]': "trigger() === 'click' ? 0 : null",
|
|
5273
|
+
'[attr.aria-pressed]': "trigger() === 'click' ? flipped() : null",
|
|
5274
|
+
'(mouseenter)': 'onHover(true)',
|
|
5275
|
+
'(mouseleave)': 'onHover(false)',
|
|
5276
|
+
'(focusin)': 'onHover(true)',
|
|
5277
|
+
'(focusout)': 'onHover(false)',
|
|
5278
|
+
'(click)': 'onClick()',
|
|
5279
|
+
'(keydown)': 'onKeydown($event)',
|
|
5280
|
+
},
|
|
5281
|
+
template: `
|
|
5282
|
+
<div
|
|
5283
|
+
data-slot="flip-card-flipper"
|
|
5284
|
+
class="relative block size-full rounded-xl transition-transform duration-500 [transform-style:preserve-3d]"
|
|
5285
|
+
[class]="flipped() ? '[transform:rotateY(180deg)]' : ''"
|
|
5286
|
+
>
|
|
5287
|
+
<div
|
|
5288
|
+
data-slot="flip-card-front"
|
|
5289
|
+
class="absolute inset-0 flex flex-col overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm [backface-visibility:hidden]"
|
|
5290
|
+
[attr.aria-hidden]="flipped()"
|
|
5291
|
+
>
|
|
5292
|
+
<ng-content />
|
|
5293
|
+
</div>
|
|
5294
|
+
<div
|
|
5295
|
+
data-slot="flip-card-back"
|
|
5296
|
+
class="absolute inset-0 flex [transform:rotateY(180deg)] flex-col overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm [backface-visibility:hidden]"
|
|
5297
|
+
[attr.aria-hidden]="!flipped()"
|
|
5298
|
+
>
|
|
5299
|
+
<ng-content select="[buiFlipBack]" />
|
|
5300
|
+
</div>
|
|
5301
|
+
</div>
|
|
5302
|
+
`,
|
|
5303
|
+
}]
|
|
5304
|
+
}], propDecorators: { trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5305
|
+
|
|
5306
|
+
/** A card with a radial spotlight glow that follows the cursor on hover. */
|
|
5307
|
+
class BuiSpotlightCard {
|
|
5308
|
+
color = input(null, /* @ts-ignore */
|
|
5309
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
5310
|
+
size = input(350, /* @ts-ignore */
|
|
5311
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
5312
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
5313
|
+
host = inject(ElementRef);
|
|
5314
|
+
hover = signal(false, /* @ts-ignore */
|
|
5315
|
+
...(ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []));
|
|
5316
|
+
glowStyle = computed(() => {
|
|
5317
|
+
const glow = this.color() ?? 'color-mix(in oklab, var(--foreground) 14%, transparent)';
|
|
5318
|
+
return `radial-gradient(circle ${this.size()}px at var(--x, 50%) var(--y, 50%), ${glow}, transparent 80%)`;
|
|
5319
|
+
}, /* @ts-ignore */
|
|
5320
|
+
...(ngDevMode ? [{ debugName: "glowStyle" }] : /* istanbul ignore next */ []));
|
|
5321
|
+
computedClass = computed(() => cn('relative overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm', this.userClass()), /* @ts-ignore */
|
|
5322
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5323
|
+
track(event) {
|
|
5324
|
+
const element = this.host.nativeElement;
|
|
5325
|
+
const rect = element.getBoundingClientRect();
|
|
5326
|
+
element.style.setProperty('--x', `${event.clientX - rect.left}px`);
|
|
5327
|
+
element.style.setProperty('--y', `${event.clientY - rect.top}px`);
|
|
5328
|
+
}
|
|
5329
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSpotlightCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5330
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiSpotlightCard, isStandalone: true, selector: "bui-spotlight-card", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "spotlight-card" }, listeners: { "mousemove": "track($event)", "mouseenter": "hover.set(true)", "mouseleave": "hover.set(false)" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
5331
|
+
<div
|
|
5332
|
+
aria-hidden="true"
|
|
5333
|
+
class="pointer-events-none absolute inset-0 rounded-[inherit] transition-opacity duration-300"
|
|
5334
|
+
[style.opacity]="hover() ? 1 : 0"
|
|
5335
|
+
[style.background]="glowStyle()"
|
|
5336
|
+
></div>
|
|
5337
|
+
<div class="relative z-10"><ng-content /></div>
|
|
5338
|
+
`, isInline: true });
|
|
5339
|
+
}
|
|
5340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSpotlightCard, decorators: [{
|
|
5341
|
+
type: Component,
|
|
5342
|
+
args: [{
|
|
5343
|
+
selector: 'bui-spotlight-card',
|
|
5344
|
+
host: {
|
|
5345
|
+
'data-slot': 'spotlight-card',
|
|
5346
|
+
'[class]': 'computedClass()',
|
|
5347
|
+
'(mousemove)': 'track($event)',
|
|
5348
|
+
'(mouseenter)': 'hover.set(true)',
|
|
5349
|
+
'(mouseleave)': 'hover.set(false)',
|
|
5350
|
+
},
|
|
5351
|
+
template: `
|
|
5352
|
+
<div
|
|
5353
|
+
aria-hidden="true"
|
|
5354
|
+
class="pointer-events-none absolute inset-0 rounded-[inherit] transition-opacity duration-300"
|
|
5355
|
+
[style.opacity]="hover() ? 1 : 0"
|
|
5356
|
+
[style.background]="glowStyle()"
|
|
5357
|
+
></div>
|
|
5358
|
+
<div class="relative z-10"><ng-content /></div>
|
|
5359
|
+
`,
|
|
5360
|
+
}]
|
|
5361
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5362
|
+
|
|
5363
|
+
/** A card that tilts in 3D toward the cursor. SSR-safe (geometry read on mousemove). */
|
|
5364
|
+
class BuiTiltCard {
|
|
5365
|
+
max = input(10, /* @ts-ignore */
|
|
5366
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
5367
|
+
scaleTo = input(1.05, /* @ts-ignore */
|
|
5368
|
+
...(ngDevMode ? [{ debugName: "scaleTo" }] : /* istanbul ignore next */ []));
|
|
5369
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
5370
|
+
active = signal(false, /* @ts-ignore */
|
|
5371
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
5372
|
+
rx = signal(0, /* @ts-ignore */
|
|
5373
|
+
...(ngDevMode ? [{ debugName: "rx" }] : /* istanbul ignore next */ []));
|
|
5374
|
+
ry = signal(0, /* @ts-ignore */
|
|
5375
|
+
...(ngDevMode ? [{ debugName: "ry" }] : /* istanbul ignore next */ []));
|
|
5376
|
+
cardTransform = computed(() => {
|
|
5377
|
+
const scale = this.active() ? this.scaleTo() : 1;
|
|
5378
|
+
return `rotateX(${this.rx()}deg) rotateY(${this.ry()}deg) scale(${scale})`;
|
|
5379
|
+
}, /* @ts-ignore */
|
|
5380
|
+
...(ngDevMode ? [{ debugName: "cardTransform" }] : /* istanbul ignore next */ []));
|
|
5381
|
+
computedClass = computed(() => cn('block [perspective:1000px]', this.userClass()), /* @ts-ignore */
|
|
5382
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5383
|
+
move(event) {
|
|
5384
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
5385
|
+
const px = (event.clientX - rect.left) / rect.width;
|
|
5386
|
+
const py = (event.clientY - rect.top) / rect.height;
|
|
5387
|
+
this.active.set(true);
|
|
5388
|
+
this.ry.set((px - 0.5) * 2 * this.max());
|
|
5389
|
+
this.rx.set(-(py - 0.5) * 2 * this.max());
|
|
5390
|
+
}
|
|
5391
|
+
leave() {
|
|
5392
|
+
this.active.set(false);
|
|
5393
|
+
this.rx.set(0);
|
|
5394
|
+
this.ry.set(0);
|
|
5395
|
+
}
|
|
5396
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTiltCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5397
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: BuiTiltCard, isStandalone: true, selector: "bui-tilt-card", inputs: { max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, scaleTo: { classPropertyName: "scaleTo", publicName: "scaleTo", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "tilt-card" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
5398
|
+
<div
|
|
5399
|
+
class="relative block overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm [transform-style:preserve-3d]"
|
|
5400
|
+
[class]="active() ? 'transition-none' : 'transition-transform duration-500 ease-out'"
|
|
5401
|
+
[style.transform]="cardTransform()"
|
|
5402
|
+
(mousemove)="move($event)"
|
|
5403
|
+
(mouseleave)="leave()"
|
|
5404
|
+
>
|
|
5405
|
+
<ng-content />
|
|
5406
|
+
</div>
|
|
5407
|
+
`, isInline: true });
|
|
5408
|
+
}
|
|
5409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiTiltCard, decorators: [{
|
|
5410
|
+
type: Component,
|
|
5411
|
+
args: [{
|
|
5412
|
+
selector: 'bui-tilt-card',
|
|
5413
|
+
host: { 'data-slot': 'tilt-card', '[class]': 'computedClass()' },
|
|
5414
|
+
template: `
|
|
5415
|
+
<div
|
|
5416
|
+
class="relative block overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm [transform-style:preserve-3d]"
|
|
5417
|
+
[class]="active() ? 'transition-none' : 'transition-transform duration-500 ease-out'"
|
|
5418
|
+
[style.transform]="cardTransform()"
|
|
5419
|
+
(mousemove)="move($event)"
|
|
5420
|
+
(mouseleave)="leave()"
|
|
5421
|
+
>
|
|
5422
|
+
<ng-content />
|
|
5423
|
+
</div>
|
|
5424
|
+
`,
|
|
5425
|
+
}]
|
|
5426
|
+
}], propDecorators: { max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], scaleTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "scaleTo", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5427
|
+
|
|
5428
|
+
/**
|
|
5429
|
+
* An accessible select (combobox + listbox) using the `aria-activedescendant` pattern:
|
|
5430
|
+
* focus stays on the trigger while arrows move the active option. Full keyboard support
|
|
5431
|
+
* (arrows, Home/End, Enter, Escape) and outside-click close. SSR-safe.
|
|
5432
|
+
*/
|
|
5433
|
+
class BuiSelect {
|
|
5434
|
+
value = model('', /* @ts-ignore */
|
|
5435
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
5436
|
+
options = input([], /* @ts-ignore */
|
|
5437
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
5438
|
+
placeholder = input('Select…', /* @ts-ignore */
|
|
5439
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
5440
|
+
disabled = input(false, /* @ts-ignore */
|
|
5441
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
5442
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
5443
|
+
listId = inject(_IdGenerator).getId('bui-select-');
|
|
5444
|
+
host = inject(ElementRef);
|
|
5445
|
+
open = signal(false, /* @ts-ignore */
|
|
5446
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
5447
|
+
active = signal(0, /* @ts-ignore */
|
|
5448
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
5449
|
+
selectedLabel = computed(() => this.options().find((option) => option.value === this.value())?.label ?? '', /* @ts-ignore */
|
|
5450
|
+
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
5451
|
+
computedClass = computed(() => cn('relative block', this.userClass()), /* @ts-ignore */
|
|
5452
|
+
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
5453
|
+
toggle() {
|
|
5454
|
+
if (this.open()) {
|
|
5455
|
+
this.close();
|
|
5456
|
+
}
|
|
5457
|
+
else {
|
|
5458
|
+
this.openList();
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
select(option) {
|
|
5462
|
+
if (option.disabled) {
|
|
5463
|
+
return;
|
|
5464
|
+
}
|
|
5465
|
+
this.value.set(option.value);
|
|
5466
|
+
this.close();
|
|
5467
|
+
}
|
|
5468
|
+
onKeydown(event) {
|
|
5469
|
+
if (this.disabled()) {
|
|
5470
|
+
return;
|
|
5471
|
+
}
|
|
5472
|
+
if (!this.open()) {
|
|
5473
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {
|
|
5474
|
+
event.preventDefault();
|
|
5475
|
+
this.openList();
|
|
5476
|
+
}
|
|
5477
|
+
return;
|
|
5478
|
+
}
|
|
5479
|
+
const options = this.options();
|
|
5480
|
+
switch (event.key) {
|
|
5481
|
+
case 'ArrowDown': {
|
|
5482
|
+
event.preventDefault();
|
|
5483
|
+
this.active.set(Math.min(options.length - 1, this.active() + 1));
|
|
5484
|
+
break;
|
|
5485
|
+
}
|
|
5486
|
+
case 'ArrowUp': {
|
|
5487
|
+
event.preventDefault();
|
|
5488
|
+
this.active.set(Math.max(0, this.active() - 1));
|
|
5489
|
+
break;
|
|
5490
|
+
}
|
|
5491
|
+
case 'Home': {
|
|
5492
|
+
event.preventDefault();
|
|
5493
|
+
this.active.set(0);
|
|
5494
|
+
break;
|
|
5495
|
+
}
|
|
5496
|
+
case 'End': {
|
|
5497
|
+
event.preventDefault();
|
|
5498
|
+
this.active.set(options.length - 1);
|
|
5499
|
+
break;
|
|
5500
|
+
}
|
|
5501
|
+
case 'Enter':
|
|
5502
|
+
case ' ': {
|
|
5503
|
+
event.preventDefault();
|
|
5504
|
+
if (options.length > 0) {
|
|
5505
|
+
this.select(options[this.active()]);
|
|
5506
|
+
}
|
|
5507
|
+
break;
|
|
5508
|
+
}
|
|
5509
|
+
case 'Escape': {
|
|
5510
|
+
event.preventDefault();
|
|
5511
|
+
this.close();
|
|
5512
|
+
break;
|
|
5513
|
+
}
|
|
5514
|
+
default: {
|
|
5515
|
+
break;
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
onDocumentClick(event) {
|
|
5520
|
+
if (this.open() && !this.host.nativeElement.contains(event.target)) {
|
|
5521
|
+
this.close();
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
openList() {
|
|
5525
|
+
const current = this.options().findIndex((option) => option.value === this.value());
|
|
5526
|
+
this.active.set(current === -1 ? 0 : current);
|
|
5527
|
+
this.open.set(true);
|
|
5528
|
+
}
|
|
5529
|
+
close() {
|
|
5530
|
+
this.open.set(false);
|
|
5531
|
+
}
|
|
5532
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5533
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: BuiSelect, isStandalone: true, selector: "bui-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "data-slot": "select" }, listeners: { "document:click": "onDocumentClick($event)" }, properties: { "class": "computedClass()" } }, ngImport: i0, template: `
|
|
5534
|
+
<button
|
|
5535
|
+
type="button"
|
|
5536
|
+
role="combobox"
|
|
5537
|
+
[attr.aria-expanded]="open()"
|
|
5538
|
+
aria-haspopup="listbox"
|
|
5539
|
+
[attr.aria-controls]="listId"
|
|
5540
|
+
[attr.aria-activedescendant]="open() ? listId + '-' + active() : null"
|
|
5541
|
+
[attr.data-placeholder]="selectedLabel() ? null : ''"
|
|
5542
|
+
[disabled]="disabled()"
|
|
5543
|
+
class="flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground"
|
|
5544
|
+
(click)="toggle()"
|
|
5545
|
+
(keydown)="onKeydown($event)"
|
|
5546
|
+
>
|
|
5547
|
+
<span class="truncate">{{ selectedLabel() || placeholder() }}</span>
|
|
5548
|
+
<svg
|
|
5549
|
+
viewBox="0 0 24 24"
|
|
5550
|
+
fill="none"
|
|
5551
|
+
stroke="currentColor"
|
|
5552
|
+
stroke-width="2"
|
|
5553
|
+
stroke-linecap="round"
|
|
5554
|
+
stroke-linejoin="round"
|
|
5555
|
+
aria-hidden="true"
|
|
5556
|
+
class="size-4 opacity-50"
|
|
5557
|
+
>
|
|
5558
|
+
<path d="m6 9 6 6 6-6" />
|
|
5559
|
+
</svg>
|
|
5560
|
+
</button>
|
|
5561
|
+
@if (open()) {
|
|
5562
|
+
<ul
|
|
5563
|
+
[id]="listId"
|
|
5564
|
+
role="listbox"
|
|
5565
|
+
class="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md"
|
|
5566
|
+
>
|
|
5567
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
5568
|
+
<li
|
|
5569
|
+
[id]="listId + '-' + i"
|
|
5570
|
+
role="option"
|
|
5571
|
+
[attr.aria-selected]="option.value === value()"
|
|
5572
|
+
[attr.aria-disabled]="option.disabled ? true : null"
|
|
5573
|
+
class="relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none"
|
|
5574
|
+
[class]="i === active() ? 'bg-accent text-accent-foreground' : ''"
|
|
5575
|
+
(click)="select(option)"
|
|
5576
|
+
(mouseenter)="active.set(i)"
|
|
5577
|
+
>
|
|
5578
|
+
<span class="truncate">{{ option.label }}</span>
|
|
5579
|
+
@if (option.value === value()) {
|
|
5580
|
+
<svg
|
|
5581
|
+
viewBox="0 0 24 24"
|
|
5582
|
+
fill="none"
|
|
5583
|
+
stroke="currentColor"
|
|
5584
|
+
stroke-width="2"
|
|
5585
|
+
stroke-linecap="round"
|
|
5586
|
+
stroke-linejoin="round"
|
|
5587
|
+
aria-hidden="true"
|
|
5588
|
+
class="size-4"
|
|
5589
|
+
>
|
|
5590
|
+
<path d="M20 6 9 17l-5-5" />
|
|
5591
|
+
</svg>
|
|
5592
|
+
}
|
|
5593
|
+
</li>
|
|
5594
|
+
}
|
|
5595
|
+
</ul>
|
|
5596
|
+
}
|
|
5597
|
+
`, isInline: true });
|
|
5598
|
+
}
|
|
5599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: BuiSelect, decorators: [{
|
|
5600
|
+
type: Component,
|
|
5601
|
+
args: [{
|
|
5602
|
+
selector: 'bui-select',
|
|
5603
|
+
host: {
|
|
5604
|
+
'data-slot': 'select',
|
|
5605
|
+
'[class]': 'computedClass()',
|
|
5606
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
5607
|
+
},
|
|
5608
|
+
template: `
|
|
5609
|
+
<button
|
|
5610
|
+
type="button"
|
|
5611
|
+
role="combobox"
|
|
5612
|
+
[attr.aria-expanded]="open()"
|
|
5613
|
+
aria-haspopup="listbox"
|
|
5614
|
+
[attr.aria-controls]="listId"
|
|
5615
|
+
[attr.aria-activedescendant]="open() ? listId + '-' + active() : null"
|
|
5616
|
+
[attr.data-placeholder]="selectedLabel() ? null : ''"
|
|
5617
|
+
[disabled]="disabled()"
|
|
5618
|
+
class="flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground"
|
|
5619
|
+
(click)="toggle()"
|
|
5620
|
+
(keydown)="onKeydown($event)"
|
|
5621
|
+
>
|
|
5622
|
+
<span class="truncate">{{ selectedLabel() || placeholder() }}</span>
|
|
5623
|
+
<svg
|
|
5624
|
+
viewBox="0 0 24 24"
|
|
5625
|
+
fill="none"
|
|
5626
|
+
stroke="currentColor"
|
|
5627
|
+
stroke-width="2"
|
|
5628
|
+
stroke-linecap="round"
|
|
5629
|
+
stroke-linejoin="round"
|
|
5630
|
+
aria-hidden="true"
|
|
5631
|
+
class="size-4 opacity-50"
|
|
5632
|
+
>
|
|
5633
|
+
<path d="m6 9 6 6 6-6" />
|
|
5634
|
+
</svg>
|
|
5635
|
+
</button>
|
|
5636
|
+
@if (open()) {
|
|
5637
|
+
<ul
|
|
5638
|
+
[id]="listId"
|
|
5639
|
+
role="listbox"
|
|
5640
|
+
class="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md"
|
|
5641
|
+
>
|
|
5642
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
5643
|
+
<li
|
|
5644
|
+
[id]="listId + '-' + i"
|
|
5645
|
+
role="option"
|
|
5646
|
+
[attr.aria-selected]="option.value === value()"
|
|
5647
|
+
[attr.aria-disabled]="option.disabled ? true : null"
|
|
5648
|
+
class="relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none"
|
|
5649
|
+
[class]="i === active() ? 'bg-accent text-accent-foreground' : ''"
|
|
5650
|
+
(click)="select(option)"
|
|
5651
|
+
(mouseenter)="active.set(i)"
|
|
5652
|
+
>
|
|
5653
|
+
<span class="truncate">{{ option.label }}</span>
|
|
5654
|
+
@if (option.value === value()) {
|
|
5655
|
+
<svg
|
|
5656
|
+
viewBox="0 0 24 24"
|
|
5657
|
+
fill="none"
|
|
5658
|
+
stroke="currentColor"
|
|
5659
|
+
stroke-width="2"
|
|
5660
|
+
stroke-linecap="round"
|
|
5661
|
+
stroke-linejoin="round"
|
|
5662
|
+
aria-hidden="true"
|
|
5663
|
+
class="size-4"
|
|
5664
|
+
>
|
|
5665
|
+
<path d="M20 6 9 17l-5-5" />
|
|
5666
|
+
</svg>
|
|
5667
|
+
}
|
|
5668
|
+
</li>
|
|
5669
|
+
}
|
|
5670
|
+
</ul>
|
|
5671
|
+
}
|
|
5672
|
+
`,
|
|
5673
|
+
}]
|
|
5674
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5675
|
+
|
|
5207
5676
|
/*
|
|
5208
5677
|
* Public API Surface of ng-blatui
|
|
5209
5678
|
*/
|
|
@@ -5212,5 +5681,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
5212
5681
|
* Generated bundle index. Do not edit.
|
|
5213
5682
|
*/
|
|
5214
5683
|
|
|
5215
|
-
export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertDialogAction, BuiAlertDialogCancel, BuiAlertDialogContent, BuiAlertDialogDescription, BuiAlertDialogFooter, BuiAlertDialogHeader, BuiAlertDialogTitle, BuiAlertTitle, BuiAspectRatio, BuiAutosizeTextarea, BuiAvatar, BuiAvatarGroup, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCodeBlock, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiComparisonTable, BuiContainer, BuiCopyButton, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiDotPattern, BuiDropdownMenu, BuiDropdownMenuItem, BuiDropdownMenuLabel, BuiDropdownMenuSeparator, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiGridPattern, BuiHoverCard, BuiHoverCardContent, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMenubar, BuiMenubarTrigger, BuiMeter, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiQuantitySelector, BuiRadioGroup, BuiRadioGroupItem, BuiRating, BuiScrollArea, BuiSegmentedControl, BuiSeparator, BuiSkeleton, BuiSlider, BuiSpinner, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTerminal, BuiTextarea, BuiThemeCustomizer, BuiToggle, BuiTooltip, BuiTooltipContent, BuiTypography, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
|
|
5684
|
+
export { BuiAccordion, BuiAccordionContent, BuiAccordionItem, BuiAccordionTrigger, BuiAlert, BuiAlertDescription, BuiAlertDialogAction, BuiAlertDialogCancel, BuiAlertDialogContent, BuiAlertDialogDescription, BuiAlertDialogFooter, BuiAlertDialogHeader, BuiAlertDialogTitle, BuiAlertTitle, BuiAspectRatio, BuiAutosizeTextarea, BuiAvatar, BuiAvatarGroup, BuiBadge, BuiBanner, BuiBreadcrumb, BuiBreadcrumbEllipsis, BuiBreadcrumbItem, BuiBreadcrumbLink, BuiBreadcrumbList, BuiBreadcrumbPage, BuiBreadcrumbSeparator, BuiButton, BuiButtonGroup, BuiButtonGroupText, BuiCard, BuiCardAction, BuiCardContent, BuiCardDescription, BuiCardFooter, BuiCardHeader, BuiCardTitle, BuiCheckbox, BuiCodeBlock, BuiCollapsible, BuiCollapsibleContent, BuiCollapsibleTrigger, BuiComparisonTable, BuiContainer, BuiCopyButton, BuiDialogContent, BuiDialogDescription, BuiDialogFooter, BuiDialogHeader, BuiDialogTitle, BuiDotPattern, BuiDropdownMenu, BuiDropdownMenuItem, BuiDropdownMenuLabel, BuiDropdownMenuSeparator, BuiEmpty, BuiEmptyContent, BuiEmptyDescription, BuiEmptyHeader, BuiEmptyMedia, BuiEmptyTitle, BuiField, BuiFieldContent, BuiFieldDescription, BuiFieldError, BuiFieldGroup, BuiFieldLabel, BuiFieldLegend, BuiFieldSeparator, BuiFieldSet, BuiFieldTitle, BuiFlipCard, BuiGridPattern, BuiHoverCard, BuiHoverCardContent, BuiInput, BuiInputGroup, BuiInputGroupAddon, BuiInputGroupButton, BuiInputGroupInput, BuiInputGroupText, BuiItem, BuiItemActions, BuiItemContent, BuiItemDescription, BuiItemGroup, BuiItemMedia, BuiItemTitle, BuiKbd, BuiLabel, BuiMenubar, BuiMenubarTrigger, BuiMeter, BuiPagination, BuiPaginationContent, BuiPaginationEllipsis, BuiPaginationItem, BuiPaginationLink, BuiPopover, BuiPopoverContent, BuiProgress, BuiQuantitySelector, BuiRadioGroup, BuiRadioGroupItem, BuiRating, BuiScrollArea, BuiSegmentedControl, BuiSelect, BuiSeparator, BuiSkeleton, BuiSlider, BuiSpinner, BuiSpotlightCard, BuiStat, BuiSwitch, BuiTabList, BuiTabPanel, BuiTabTrigger, BuiTable, BuiTableBody, BuiTableCaption, BuiTableCell, BuiTableContainer, BuiTableFooter, BuiTableHead, BuiTableHeader, BuiTableRow, BuiTabs, BuiTerminal, BuiTextarea, BuiThemeCustomizer, BuiTiltCard, BuiToggle, BuiTooltip, BuiTooltipContent, BuiTypography, BuiVisuallyHidden, THEME_TOKENS, ThemeStore, buttonVariants, cn, toggleVariants };
|
|
5216
5685
|
//# sourceMappingURL=ng-blatui.mjs.map
|