@sonny-ui/core 0.1.0-alpha.16 → 0.1.0-alpha.17
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/README.md +109 -55
- package/fesm2022/sonny-ui-core.mjs +599 -3
- package/fesm2022/sonny-ui-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/avatar-group/avatar-group.component.spec.ts +74 -0
- package/src/lib/avatar-group/avatar-group.component.ts +89 -0
- package/src/lib/avatar-group/index.ts +1 -0
- package/src/lib/number-input/index.ts +2 -0
- package/src/lib/number-input/number-input.component.spec.ts +151 -0
- package/src/lib/number-input/number-input.component.ts +153 -0
- package/src/lib/number-input/number-input.variants.ts +17 -0
- package/src/lib/popover/index.ts +6 -0
- package/src/lib/popover/popover.directives.spec.ts +147 -0
- package/src/lib/popover/popover.directives.ts +155 -0
- package/src/lib/tag-input/index.ts +2 -0
- package/src/lib/tag-input/tag-input.component.spec.ts +190 -0
- package/src/lib/tag-input/tag-input.component.ts +173 -0
- package/src/lib/tag-input/tag-input.variants.ts +31 -0
- package/types/sonny-ui-core.d.ts +147 -2
|
@@ -5606,7 +5606,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
5606
5606
|
}]
|
|
5607
5607
|
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5608
5608
|
|
|
5609
|
-
const sizeMap = { sm: 48, md: 72, lg: 96 };
|
|
5609
|
+
const sizeMap$1 = { sm: 48, md: 72, lg: 96 };
|
|
5610
5610
|
const variantColorMap = {
|
|
5611
5611
|
default: 'stroke-primary',
|
|
5612
5612
|
success: 'stroke-green-600 dark:stroke-green-500',
|
|
@@ -5620,7 +5620,7 @@ class SnyRadialProgressComponent {
|
|
|
5620
5620
|
thickness = input(4, ...(ngDevMode ? [{ debugName: "thickness" }] : /* istanbul ignore next */ []));
|
|
5621
5621
|
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
5622
5622
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
5623
|
-
svgSize = computed(() => sizeMap[this.size()], ...(ngDevMode ? [{ debugName: "svgSize" }] : /* istanbul ignore next */ []));
|
|
5623
|
+
svgSize = computed(() => sizeMap$1[this.size()], ...(ngDevMode ? [{ debugName: "svgSize" }] : /* istanbul ignore next */ []));
|
|
5624
5624
|
radius = computed(() => (this.svgSize() - this.thickness()) / 2, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
5625
5625
|
circumference = computed(() => 2 * Math.PI * this.radius(), ...(ngDevMode ? [{ debugName: "circumference" }] : /* istanbul ignore next */ []));
|
|
5626
5626
|
offset = computed(() => this.circumference() - (this.value() / 100) * this.circumference(), ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
@@ -8237,6 +8237,602 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
8237
8237
|
args: [{ providedIn: 'root' }]
|
|
8238
8238
|
}] });
|
|
8239
8239
|
|
|
8240
|
+
const numberInputVariants = cva('inline-flex items-center border border-border rounded-md bg-background transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2', {
|
|
8241
|
+
variants: {
|
|
8242
|
+
size: {
|
|
8243
|
+
sm: 'h-9 text-xs',
|
|
8244
|
+
md: 'h-10 text-sm',
|
|
8245
|
+
lg: 'h-11 text-base',
|
|
8246
|
+
},
|
|
8247
|
+
},
|
|
8248
|
+
defaultVariants: { size: 'md' },
|
|
8249
|
+
});
|
|
8250
|
+
|
|
8251
|
+
class SnyNumberInputComponent {
|
|
8252
|
+
value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
8253
|
+
min = input(null, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
8254
|
+
max = input(null, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
8255
|
+
step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
8256
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
8257
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
8258
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
8259
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
8260
|
+
inputValue = signal('0', ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
8261
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
8262
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
8263
|
+
atMin = computed(() => this.min() !== null && this.value() <= this.min(), ...(ngDevMode ? [{ debugName: "atMin" }] : /* istanbul ignore next */ []));
|
|
8264
|
+
atMax = computed(() => this.max() !== null && this.value() >= this.max(), ...(ngDevMode ? [{ debugName: "atMax" }] : /* istanbul ignore next */ []));
|
|
8265
|
+
containerClass = computed(() => cn(numberInputVariants({ size: this.size() }), this.isDisabled() && 'opacity-50', this.class()), ...(ngDevMode ? [{ debugName: "containerClass" }] : /* istanbul ignore next */ []));
|
|
8266
|
+
_onChange = () => { };
|
|
8267
|
+
_onTouched = () => { };
|
|
8268
|
+
constructor() {
|
|
8269
|
+
effect(() => {
|
|
8270
|
+
const val = this.value();
|
|
8271
|
+
untracked(() => this.inputValue.set(String(val)));
|
|
8272
|
+
});
|
|
8273
|
+
}
|
|
8274
|
+
writeValue(val) {
|
|
8275
|
+
this.value.set(val ?? 0);
|
|
8276
|
+
}
|
|
8277
|
+
registerOnChange(fn) {
|
|
8278
|
+
this._onChange = fn;
|
|
8279
|
+
}
|
|
8280
|
+
registerOnTouched(fn) {
|
|
8281
|
+
this._onTouched = fn;
|
|
8282
|
+
}
|
|
8283
|
+
setDisabledState(isDisabled) {
|
|
8284
|
+
this._disabledByCva.set(isDisabled);
|
|
8285
|
+
}
|
|
8286
|
+
increment() {
|
|
8287
|
+
this.setValue(this.value() + this.step());
|
|
8288
|
+
}
|
|
8289
|
+
decrement() {
|
|
8290
|
+
this.setValue(this.value() - this.step());
|
|
8291
|
+
}
|
|
8292
|
+
onInput(event) {
|
|
8293
|
+
this.inputValue.set(event.target.value);
|
|
8294
|
+
}
|
|
8295
|
+
commitValue() {
|
|
8296
|
+
const parsed = parseFloat(this.inputValue());
|
|
8297
|
+
if (isNaN(parsed)) {
|
|
8298
|
+
this.inputValue.set(String(this.value()));
|
|
8299
|
+
}
|
|
8300
|
+
else {
|
|
8301
|
+
this.setValue(parsed);
|
|
8302
|
+
}
|
|
8303
|
+
this._onTouched();
|
|
8304
|
+
}
|
|
8305
|
+
onKeydown(event) {
|
|
8306
|
+
switch (event.key) {
|
|
8307
|
+
case 'ArrowUp':
|
|
8308
|
+
event.preventDefault();
|
|
8309
|
+
this.increment();
|
|
8310
|
+
break;
|
|
8311
|
+
case 'ArrowDown':
|
|
8312
|
+
event.preventDefault();
|
|
8313
|
+
this.decrement();
|
|
8314
|
+
break;
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
setValue(raw) {
|
|
8318
|
+
let clamped = raw;
|
|
8319
|
+
if (this.min() !== null)
|
|
8320
|
+
clamped = Math.max(this.min(), clamped);
|
|
8321
|
+
if (this.max() !== null)
|
|
8322
|
+
clamped = Math.min(this.max(), clamped);
|
|
8323
|
+
const rounded = parseFloat(clamped.toFixed(10));
|
|
8324
|
+
this.value.set(rounded);
|
|
8325
|
+
this._onChange(rounded);
|
|
8326
|
+
}
|
|
8327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNumberInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8328
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: SnyNumberInputComponent, isStandalone: true, selector: "sny-number-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
|
|
8329
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyNumberInputComponent), multi: true },
|
|
8330
|
+
], ngImport: i0, template: `
|
|
8331
|
+
<div [class]="containerClass()">
|
|
8332
|
+
<button
|
|
8333
|
+
type="button"
|
|
8334
|
+
class="px-2.5 hover:bg-accent transition-colors border-r border-border disabled:opacity-40 disabled:cursor-not-allowed"
|
|
8335
|
+
[disabled]="isDisabled() || atMin()"
|
|
8336
|
+
(click)="decrement()"
|
|
8337
|
+
aria-label="Decrease"
|
|
8338
|
+
>
|
|
8339
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>
|
|
8340
|
+
</button>
|
|
8341
|
+
<input
|
|
8342
|
+
#inputEl
|
|
8343
|
+
type="text"
|
|
8344
|
+
inputmode="decimal"
|
|
8345
|
+
class="flex-1 w-14 text-center outline-none bg-transparent font-medium"
|
|
8346
|
+
[value]="inputValue()"
|
|
8347
|
+
[disabled]="isDisabled()"
|
|
8348
|
+
[placeholder]="placeholder()"
|
|
8349
|
+
[attr.aria-label]="'Number input'"
|
|
8350
|
+
[attr.aria-valuemin]="min() ?? null"
|
|
8351
|
+
[attr.aria-valuemax]="max() ?? null"
|
|
8352
|
+
[attr.aria-valuenow]="value()"
|
|
8353
|
+
role="spinbutton"
|
|
8354
|
+
(input)="onInput($event)"
|
|
8355
|
+
(blur)="commitValue()"
|
|
8356
|
+
(keydown)="onKeydown($event)"
|
|
8357
|
+
/>
|
|
8358
|
+
<button
|
|
8359
|
+
type="button"
|
|
8360
|
+
class="px-2.5 hover:bg-accent transition-colors border-l border-border disabled:opacity-40 disabled:cursor-not-allowed"
|
|
8361
|
+
[disabled]="isDisabled() || atMax()"
|
|
8362
|
+
(click)="increment()"
|
|
8363
|
+
aria-label="Increase"
|
|
8364
|
+
>
|
|
8365
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
|
|
8366
|
+
</button>
|
|
8367
|
+
</div>
|
|
8368
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8369
|
+
}
|
|
8370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyNumberInputComponent, decorators: [{
|
|
8371
|
+
type: Component,
|
|
8372
|
+
args: [{
|
|
8373
|
+
selector: 'sny-number-input',
|
|
8374
|
+
standalone: true,
|
|
8375
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8376
|
+
providers: [
|
|
8377
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyNumberInputComponent), multi: true },
|
|
8378
|
+
],
|
|
8379
|
+
template: `
|
|
8380
|
+
<div [class]="containerClass()">
|
|
8381
|
+
<button
|
|
8382
|
+
type="button"
|
|
8383
|
+
class="px-2.5 hover:bg-accent transition-colors border-r border-border disabled:opacity-40 disabled:cursor-not-allowed"
|
|
8384
|
+
[disabled]="isDisabled() || atMin()"
|
|
8385
|
+
(click)="decrement()"
|
|
8386
|
+
aria-label="Decrease"
|
|
8387
|
+
>
|
|
8388
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>
|
|
8389
|
+
</button>
|
|
8390
|
+
<input
|
|
8391
|
+
#inputEl
|
|
8392
|
+
type="text"
|
|
8393
|
+
inputmode="decimal"
|
|
8394
|
+
class="flex-1 w-14 text-center outline-none bg-transparent font-medium"
|
|
8395
|
+
[value]="inputValue()"
|
|
8396
|
+
[disabled]="isDisabled()"
|
|
8397
|
+
[placeholder]="placeholder()"
|
|
8398
|
+
[attr.aria-label]="'Number input'"
|
|
8399
|
+
[attr.aria-valuemin]="min() ?? null"
|
|
8400
|
+
[attr.aria-valuemax]="max() ?? null"
|
|
8401
|
+
[attr.aria-valuenow]="value()"
|
|
8402
|
+
role="spinbutton"
|
|
8403
|
+
(input)="onInput($event)"
|
|
8404
|
+
(blur)="commitValue()"
|
|
8405
|
+
(keydown)="onKeydown($event)"
|
|
8406
|
+
/>
|
|
8407
|
+
<button
|
|
8408
|
+
type="button"
|
|
8409
|
+
class="px-2.5 hover:bg-accent transition-colors border-l border-border disabled:opacity-40 disabled:cursor-not-allowed"
|
|
8410
|
+
[disabled]="isDisabled() || atMax()"
|
|
8411
|
+
(click)="increment()"
|
|
8412
|
+
aria-label="Increase"
|
|
8413
|
+
>
|
|
8414
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
|
|
8415
|
+
</button>
|
|
8416
|
+
</div>
|
|
8417
|
+
`,
|
|
8418
|
+
}]
|
|
8419
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
8420
|
+
|
|
8421
|
+
const sizeMap = {
|
|
8422
|
+
sm: { avatar: 'h-7 w-7 text-xs', counter: 'h-7 w-7 text-[10px]' },
|
|
8423
|
+
md: { avatar: 'h-9 w-9 text-sm', counter: 'h-9 w-9 text-xs' },
|
|
8424
|
+
lg: { avatar: 'h-11 w-11 text-base', counter: 'h-11 w-11 text-sm' },
|
|
8425
|
+
};
|
|
8426
|
+
const spacingMap = {
|
|
8427
|
+
tight: '-space-x-3',
|
|
8428
|
+
normal: '-space-x-2',
|
|
8429
|
+
};
|
|
8430
|
+
class SnyAvatarGroupComponent {
|
|
8431
|
+
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
8432
|
+
max = input(3, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
8433
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
8434
|
+
spacing = input('normal', ...(ngDevMode ? [{ debugName: "spacing" }] : /* istanbul ignore next */ []));
|
|
8435
|
+
visibleItems = computed(() => this.items().slice(0, this.max()), ...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
|
|
8436
|
+
overflowCount = computed(() => Math.max(0, this.items().length - this.max()), ...(ngDevMode ? [{ debugName: "overflowCount" }] : /* istanbul ignore next */ []));
|
|
8437
|
+
containerClass = computed(() => cn('flex items-center', spacingMap[this.spacing()]), ...(ngDevMode ? [{ debugName: "containerClass" }] : /* istanbul ignore next */ []));
|
|
8438
|
+
avatarClass = computed(() => cn('inline-block rounded-full object-cover ring-2 ring-background', sizeMap[this.size()].avatar), ...(ngDevMode ? [{ debugName: "avatarClass" }] : /* istanbul ignore next */ []));
|
|
8439
|
+
fallbackClass = computed(() => cn('inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground font-medium ring-2 ring-background', sizeMap[this.size()].avatar), ...(ngDevMode ? [{ debugName: "fallbackClass" }] : /* istanbul ignore next */ []));
|
|
8440
|
+
counterClass = computed(() => cn('inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground font-semibold ring-2 ring-background', sizeMap[this.size()].counter), ...(ngDevMode ? [{ debugName: "counterClass" }] : /* istanbul ignore next */ []));
|
|
8441
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAvatarGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8442
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyAvatarGroupComponent, isStandalone: true, selector: "sny-avatar-group", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, spacing: { classPropertyName: "spacing", publicName: "spacing", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8443
|
+
<div [class]="containerClass()" role="group" [attr.aria-label]="'Group of ' + items().length + ' users'">
|
|
8444
|
+
@for (item of visibleItems(); track $index) {
|
|
8445
|
+
@if (item.src) {
|
|
8446
|
+
<img
|
|
8447
|
+
[src]="item.src"
|
|
8448
|
+
[alt]="item.alt ?? ''"
|
|
8449
|
+
[class]="avatarClass()"
|
|
8450
|
+
/>
|
|
8451
|
+
} @else {
|
|
8452
|
+
<div [class]="fallbackClass()">
|
|
8453
|
+
{{ item.fallback ?? '?' }}
|
|
8454
|
+
</div>
|
|
8455
|
+
}
|
|
8456
|
+
}
|
|
8457
|
+
@if (overflowCount() > 0) {
|
|
8458
|
+
<div [class]="counterClass()" [title]="overflowCount() + ' more'">
|
|
8459
|
+
+{{ overflowCount() }}
|
|
8460
|
+
</div>
|
|
8461
|
+
}
|
|
8462
|
+
</div>
|
|
8463
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8464
|
+
}
|
|
8465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyAvatarGroupComponent, decorators: [{
|
|
8466
|
+
type: Component,
|
|
8467
|
+
args: [{
|
|
8468
|
+
selector: 'sny-avatar-group',
|
|
8469
|
+
standalone: true,
|
|
8470
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8471
|
+
template: `
|
|
8472
|
+
<div [class]="containerClass()" role="group" [attr.aria-label]="'Group of ' + items().length + ' users'">
|
|
8473
|
+
@for (item of visibleItems(); track $index) {
|
|
8474
|
+
@if (item.src) {
|
|
8475
|
+
<img
|
|
8476
|
+
[src]="item.src"
|
|
8477
|
+
[alt]="item.alt ?? ''"
|
|
8478
|
+
[class]="avatarClass()"
|
|
8479
|
+
/>
|
|
8480
|
+
} @else {
|
|
8481
|
+
<div [class]="fallbackClass()">
|
|
8482
|
+
{{ item.fallback ?? '?' }}
|
|
8483
|
+
</div>
|
|
8484
|
+
}
|
|
8485
|
+
}
|
|
8486
|
+
@if (overflowCount() > 0) {
|
|
8487
|
+
<div [class]="counterClass()" [title]="overflowCount() + ' more'">
|
|
8488
|
+
+{{ overflowCount() }}
|
|
8489
|
+
</div>
|
|
8490
|
+
}
|
|
8491
|
+
</div>
|
|
8492
|
+
`,
|
|
8493
|
+
}]
|
|
8494
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], spacing: [{ type: i0.Input, args: [{ isSignal: true, alias: "spacing", required: false }] }] } });
|
|
8495
|
+
|
|
8496
|
+
const tagInputContainerVariants = cva('flex flex-wrap gap-1.5 border border-border rounded-md bg-background px-2 cursor-text transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2', {
|
|
8497
|
+
variants: {
|
|
8498
|
+
size: {
|
|
8499
|
+
sm: 'min-h-[36px] py-1 text-xs',
|
|
8500
|
+
md: 'min-h-[40px] py-1.5 text-sm',
|
|
8501
|
+
lg: 'min-h-[44px] py-2 text-base',
|
|
8502
|
+
},
|
|
8503
|
+
},
|
|
8504
|
+
defaultVariants: { size: 'md' },
|
|
8505
|
+
});
|
|
8506
|
+
const tagVariants = cva('inline-flex items-center gap-1 rounded-md font-medium', {
|
|
8507
|
+
variants: {
|
|
8508
|
+
size: {
|
|
8509
|
+
sm: 'px-1.5 py-0.5 text-xs',
|
|
8510
|
+
md: 'px-2 py-0.5 text-sm',
|
|
8511
|
+
lg: 'px-2.5 py-1 text-sm',
|
|
8512
|
+
},
|
|
8513
|
+
},
|
|
8514
|
+
defaultVariants: { size: 'md' },
|
|
8515
|
+
});
|
|
8516
|
+
|
|
8517
|
+
class SnyTagInputComponent {
|
|
8518
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
8519
|
+
placeholder = input('Add tag...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
8520
|
+
maxTags = input(null, ...(ngDevMode ? [{ debugName: "maxTags" }] : /* istanbul ignore next */ []));
|
|
8521
|
+
allowDuplicates = input(false, ...(ngDevMode ? [{ debugName: "allowDuplicates" }] : /* istanbul ignore next */ []));
|
|
8522
|
+
removable = input(true, ...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
8523
|
+
addOnBlur = input(true, ...(ngDevMode ? [{ debugName: "addOnBlur" }] : /* istanbul ignore next */ []));
|
|
8524
|
+
separators = input(['Enter', ','], ...(ngDevMode ? [{ debugName: "separators" }] : /* istanbul ignore next */ []));
|
|
8525
|
+
validate = input(null, ...(ngDevMode ? [{ debugName: "validate" }] : /* istanbul ignore next */ []));
|
|
8526
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
8527
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
8528
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
8529
|
+
tagAdded = output();
|
|
8530
|
+
tagRemoved = output();
|
|
8531
|
+
inputValue = signal('', ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
8532
|
+
_disabledByCva = signal(false, ...(ngDevMode ? [{ debugName: "_disabledByCva" }] : /* istanbul ignore next */ []));
|
|
8533
|
+
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
8534
|
+
atMax = computed(() => this.maxTags() !== null && this.value().length >= this.maxTags(), ...(ngDevMode ? [{ debugName: "atMax" }] : /* istanbul ignore next */ []));
|
|
8535
|
+
containerClass = computed(() => cn(tagInputContainerVariants({ size: this.size() }), this.isDisabled() && 'opacity-50 cursor-not-allowed', this.class()), ...(ngDevMode ? [{ debugName: "containerClass" }] : /* istanbul ignore next */ []));
|
|
8536
|
+
tagClass = computed(() => cn(tagVariants({ size: this.size() }), 'bg-secondary text-secondary-foreground'), ...(ngDevMode ? [{ debugName: "tagClass" }] : /* istanbul ignore next */ []));
|
|
8537
|
+
inputRef = viewChild('inputEl', ...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
|
|
8538
|
+
_onChange = () => { };
|
|
8539
|
+
_onTouched = () => { };
|
|
8540
|
+
writeValue(val) {
|
|
8541
|
+
this.value.set(val ?? []);
|
|
8542
|
+
}
|
|
8543
|
+
registerOnChange(fn) {
|
|
8544
|
+
this._onChange = fn;
|
|
8545
|
+
}
|
|
8546
|
+
registerOnTouched(fn) {
|
|
8547
|
+
this._onTouched = fn;
|
|
8548
|
+
}
|
|
8549
|
+
setDisabledState(isDisabled) {
|
|
8550
|
+
this._disabledByCva.set(isDisabled);
|
|
8551
|
+
}
|
|
8552
|
+
focusInput() {
|
|
8553
|
+
this.inputRef()?.nativeElement.focus();
|
|
8554
|
+
}
|
|
8555
|
+
onInput(event) {
|
|
8556
|
+
const val = event.target.value;
|
|
8557
|
+
// Check if separator character was typed (e.g. comma)
|
|
8558
|
+
const seps = this.separators().filter((s) => s.length === 1);
|
|
8559
|
+
for (const sep of seps) {
|
|
8560
|
+
if (val.includes(sep)) {
|
|
8561
|
+
const parts = val.split(sep);
|
|
8562
|
+
for (const part of parts) {
|
|
8563
|
+
this.addTag(part);
|
|
8564
|
+
}
|
|
8565
|
+
this.inputValue.set('');
|
|
8566
|
+
return;
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
this.inputValue.set(val);
|
|
8570
|
+
}
|
|
8571
|
+
onKeydown(event) {
|
|
8572
|
+
if (this.separators().includes(event.key) && event.key !== ',') {
|
|
8573
|
+
event.preventDefault();
|
|
8574
|
+
this.addTag(this.inputValue());
|
|
8575
|
+
this.inputValue.set('');
|
|
8576
|
+
return;
|
|
8577
|
+
}
|
|
8578
|
+
if (event.key === 'Backspace' && this.inputValue() === '') {
|
|
8579
|
+
const tags = this.value();
|
|
8580
|
+
if (tags.length > 0) {
|
|
8581
|
+
this.removeTag(tags.length - 1);
|
|
8582
|
+
}
|
|
8583
|
+
}
|
|
8584
|
+
}
|
|
8585
|
+
onBlur() {
|
|
8586
|
+
if (this.addOnBlur() && this.inputValue().trim()) {
|
|
8587
|
+
this.addTag(this.inputValue());
|
|
8588
|
+
this.inputValue.set('');
|
|
8589
|
+
}
|
|
8590
|
+
this._onTouched();
|
|
8591
|
+
}
|
|
8592
|
+
addTag(raw) {
|
|
8593
|
+
const tag = raw.trim();
|
|
8594
|
+
if (!tag)
|
|
8595
|
+
return;
|
|
8596
|
+
if (this.atMax())
|
|
8597
|
+
return;
|
|
8598
|
+
if (!this.allowDuplicates() && this.value().includes(tag))
|
|
8599
|
+
return;
|
|
8600
|
+
const validateFn = this.validate();
|
|
8601
|
+
if (validateFn && !validateFn(tag))
|
|
8602
|
+
return;
|
|
8603
|
+
this.value.update((tags) => [...tags, tag]);
|
|
8604
|
+
this._onChange(this.value());
|
|
8605
|
+
this.tagAdded.emit(tag);
|
|
8606
|
+
}
|
|
8607
|
+
removeTag(index) {
|
|
8608
|
+
const removed = this.value()[index];
|
|
8609
|
+
this.value.update((tags) => tags.filter((_, i) => i !== index));
|
|
8610
|
+
this._onChange(this.value());
|
|
8611
|
+
this.tagRemoved.emit(removed);
|
|
8612
|
+
}
|
|
8613
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTagInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8614
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyTagInputComponent, isStandalone: true, selector: "sny-tag-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, maxTags: { classPropertyName: "maxTags", publicName: "maxTags", isSignal: true, isRequired: false, transformFunction: null }, allowDuplicates: { classPropertyName: "allowDuplicates", publicName: "allowDuplicates", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, addOnBlur: { classPropertyName: "addOnBlur", publicName: "addOnBlur", isSignal: true, isRequired: false, transformFunction: null }, separators: { classPropertyName: "separators", publicName: "separators", isSignal: true, isRequired: false, transformFunction: null }, validate: { classPropertyName: "validate", publicName: "validate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", tagAdded: "tagAdded", tagRemoved: "tagRemoved" }, providers: [
|
|
8615
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyTagInputComponent), multi: true },
|
|
8616
|
+
], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
8617
|
+
<div [class]="containerClass()" (click)="focusInput()">
|
|
8618
|
+
@for (tag of value(); track tag; let i = $index) {
|
|
8619
|
+
<span [class]="tagClass()">
|
|
8620
|
+
{{ tag }}
|
|
8621
|
+
@if (removable() && !isDisabled()) {
|
|
8622
|
+
<button
|
|
8623
|
+
type="button"
|
|
8624
|
+
class="hover:text-destructive transition-colors leading-none"
|
|
8625
|
+
(click)="removeTag(i); $event.stopPropagation()"
|
|
8626
|
+
[attr.aria-label]="'Remove ' + tag"
|
|
8627
|
+
>
|
|
8628
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
8629
|
+
</button>
|
|
8630
|
+
}
|
|
8631
|
+
</span>
|
|
8632
|
+
}
|
|
8633
|
+
@if (!atMax()) {
|
|
8634
|
+
<input
|
|
8635
|
+
#inputEl
|
|
8636
|
+
type="text"
|
|
8637
|
+
class="flex-1 min-w-[80px] outline-none bg-transparent"
|
|
8638
|
+
[placeholder]="value().length === 0 ? placeholder() : ''"
|
|
8639
|
+
[disabled]="isDisabled()"
|
|
8640
|
+
[value]="inputValue()"
|
|
8641
|
+
(input)="onInput($event)"
|
|
8642
|
+
(keydown)="onKeydown($event)"
|
|
8643
|
+
(blur)="onBlur()"
|
|
8644
|
+
[attr.aria-label]="'Add tag'"
|
|
8645
|
+
/>
|
|
8646
|
+
}
|
|
8647
|
+
</div>
|
|
8648
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8649
|
+
}
|
|
8650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyTagInputComponent, decorators: [{
|
|
8651
|
+
type: Component,
|
|
8652
|
+
args: [{
|
|
8653
|
+
selector: 'sny-tag-input',
|
|
8654
|
+
standalone: true,
|
|
8655
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8656
|
+
providers: [
|
|
8657
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SnyTagInputComponent), multi: true },
|
|
8658
|
+
],
|
|
8659
|
+
template: `
|
|
8660
|
+
<div [class]="containerClass()" (click)="focusInput()">
|
|
8661
|
+
@for (tag of value(); track tag; let i = $index) {
|
|
8662
|
+
<span [class]="tagClass()">
|
|
8663
|
+
{{ tag }}
|
|
8664
|
+
@if (removable() && !isDisabled()) {
|
|
8665
|
+
<button
|
|
8666
|
+
type="button"
|
|
8667
|
+
class="hover:text-destructive transition-colors leading-none"
|
|
8668
|
+
(click)="removeTag(i); $event.stopPropagation()"
|
|
8669
|
+
[attr.aria-label]="'Remove ' + tag"
|
|
8670
|
+
>
|
|
8671
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
8672
|
+
</button>
|
|
8673
|
+
}
|
|
8674
|
+
</span>
|
|
8675
|
+
}
|
|
8676
|
+
@if (!atMax()) {
|
|
8677
|
+
<input
|
|
8678
|
+
#inputEl
|
|
8679
|
+
type="text"
|
|
8680
|
+
class="flex-1 min-w-[80px] outline-none bg-transparent"
|
|
8681
|
+
[placeholder]="value().length === 0 ? placeholder() : ''"
|
|
8682
|
+
[disabled]="isDisabled()"
|
|
8683
|
+
[value]="inputValue()"
|
|
8684
|
+
(input)="onInput($event)"
|
|
8685
|
+
(keydown)="onKeydown($event)"
|
|
8686
|
+
(blur)="onBlur()"
|
|
8687
|
+
[attr.aria-label]="'Add tag'"
|
|
8688
|
+
/>
|
|
8689
|
+
}
|
|
8690
|
+
</div>
|
|
8691
|
+
`,
|
|
8692
|
+
}]
|
|
8693
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], maxTags: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxTags", required: false }] }], allowDuplicates: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDuplicates", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], addOnBlur: [{ type: i0.Input, args: [{ isSignal: true, alias: "addOnBlur", required: false }] }], separators: [{ type: i0.Input, args: [{ isSignal: true, alias: "separators", required: false }] }], validate: [{ type: i0.Input, args: [{ isSignal: true, alias: "validate", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], tagAdded: [{ type: i0.Output, args: ["tagAdded"] }], tagRemoved: [{ type: i0.Output, args: ["tagRemoved"] }], inputRef: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }] } });
|
|
8694
|
+
|
|
8695
|
+
const SNY_POPOVER = new InjectionToken('SnyPopover');
|
|
8696
|
+
class SnyPopoverDirective {
|
|
8697
|
+
elRef = inject(ElementRef);
|
|
8698
|
+
matchWidth = input(false, ...(ngDevMode ? [{ debugName: "matchWidth" }] : /* istanbul ignore next */ []));
|
|
8699
|
+
offset = input(4, ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
8700
|
+
closeOnOutside = input(true, ...(ngDevMode ? [{ debugName: "closeOnOutside" }] : /* istanbul ignore next */ []));
|
|
8701
|
+
closeOnEscape = input(true, ...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
|
|
8702
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
8703
|
+
triggerEl = signal(null, ...(ngDevMode ? [{ debugName: "triggerEl" }] : /* istanbul ignore next */ []));
|
|
8704
|
+
panelEl = signal(null, ...(ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []));
|
|
8705
|
+
scrollHandler = null;
|
|
8706
|
+
resizeHandler = null;
|
|
8707
|
+
toggle() {
|
|
8708
|
+
if (this.isOpen()) {
|
|
8709
|
+
this.close();
|
|
8710
|
+
}
|
|
8711
|
+
else {
|
|
8712
|
+
this.open();
|
|
8713
|
+
}
|
|
8714
|
+
}
|
|
8715
|
+
open() {
|
|
8716
|
+
this.isOpen.set(true);
|
|
8717
|
+
this.addListeners();
|
|
8718
|
+
setTimeout(() => this.updatePosition());
|
|
8719
|
+
}
|
|
8720
|
+
close() {
|
|
8721
|
+
this.isOpen.set(false);
|
|
8722
|
+
this.removeListeners();
|
|
8723
|
+
}
|
|
8724
|
+
updatePosition() {
|
|
8725
|
+
const trigger = this.triggerEl();
|
|
8726
|
+
const panel = this.panelEl();
|
|
8727
|
+
if (!trigger || !panel)
|
|
8728
|
+
return;
|
|
8729
|
+
const rect = trigger.getBoundingClientRect();
|
|
8730
|
+
panel.style.top = `${rect.bottom + this.offset()}px`;
|
|
8731
|
+
panel.style.left = `${rect.left}px`;
|
|
8732
|
+
if (this.matchWidth()) {
|
|
8733
|
+
panel.style.width = `${rect.width}px`;
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
addListeners() {
|
|
8737
|
+
this.removeListeners();
|
|
8738
|
+
this.scrollHandler = () => {
|
|
8739
|
+
requestAnimationFrame(() => this.updatePosition());
|
|
8740
|
+
};
|
|
8741
|
+
this.resizeHandler = () => {
|
|
8742
|
+
requestAnimationFrame(() => this.updatePosition());
|
|
8743
|
+
};
|
|
8744
|
+
document.addEventListener('scroll', this.scrollHandler, { capture: true, passive: true });
|
|
8745
|
+
window.addEventListener('resize', this.resizeHandler, { passive: true });
|
|
8746
|
+
}
|
|
8747
|
+
removeListeners() {
|
|
8748
|
+
if (this.scrollHandler) {
|
|
8749
|
+
document.removeEventListener('scroll', this.scrollHandler, { capture: true });
|
|
8750
|
+
this.scrollHandler = null;
|
|
8751
|
+
}
|
|
8752
|
+
if (this.resizeHandler) {
|
|
8753
|
+
window.removeEventListener('resize', this.resizeHandler);
|
|
8754
|
+
this.resizeHandler = null;
|
|
8755
|
+
}
|
|
8756
|
+
}
|
|
8757
|
+
onDocumentClick(event) {
|
|
8758
|
+
if (this.closeOnOutside() && this.isOpen() && !this.elRef.nativeElement.contains(event.target)) {
|
|
8759
|
+
this.close();
|
|
8760
|
+
}
|
|
8761
|
+
}
|
|
8762
|
+
onEscape() {
|
|
8763
|
+
if (this.closeOnEscape() && this.isOpen()) {
|
|
8764
|
+
this.close();
|
|
8765
|
+
}
|
|
8766
|
+
}
|
|
8767
|
+
ngOnDestroy() {
|
|
8768
|
+
this.removeListeners();
|
|
8769
|
+
}
|
|
8770
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8771
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyPopoverDirective, isStandalone: true, selector: "[snyPopover]", inputs: { matchWidth: { classPropertyName: "matchWidth", publicName: "matchWidth", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutside: { classPropertyName: "closeOnOutside", publicName: "closeOnOutside", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onDocumentClick($event)", "keydown.escape": "onEscape()" }, properties: { "class": "\"relative inline-block\"" } }, providers: [{ provide: SNY_POPOVER, useExisting: SnyPopoverDirective }], exportAs: ["snyPopover"], ngImport: i0 });
|
|
8772
|
+
}
|
|
8773
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverDirective, decorators: [{
|
|
8774
|
+
type: Directive,
|
|
8775
|
+
args: [{
|
|
8776
|
+
selector: '[snyPopover]',
|
|
8777
|
+
standalone: true,
|
|
8778
|
+
exportAs: 'snyPopover',
|
|
8779
|
+
providers: [{ provide: SNY_POPOVER, useExisting: SnyPopoverDirective }],
|
|
8780
|
+
host: {
|
|
8781
|
+
'[class]': '"relative inline-block"',
|
|
8782
|
+
},
|
|
8783
|
+
}]
|
|
8784
|
+
}], propDecorators: { matchWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchWidth", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], closeOnOutside: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnOutside", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], onDocumentClick: [{
|
|
8785
|
+
type: HostListener,
|
|
8786
|
+
args: ['document:click', ['$event']]
|
|
8787
|
+
}], onEscape: [{
|
|
8788
|
+
type: HostListener,
|
|
8789
|
+
args: ['keydown.escape']
|
|
8790
|
+
}] } });
|
|
8791
|
+
class SnyPopoverTriggerDirective {
|
|
8792
|
+
popover = inject(SNY_POPOVER);
|
|
8793
|
+
elRef = inject(ElementRef);
|
|
8794
|
+
constructor() {
|
|
8795
|
+
this.popover.triggerEl.set(this.elRef.nativeElement);
|
|
8796
|
+
}
|
|
8797
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8798
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: SnyPopoverTriggerDirective, isStandalone: true, selector: "[snyPopoverTrigger]", host: { attributes: { "aria-haspopup": "dialog" }, listeners: { "click": "popover.toggle()" }, properties: { "attr.aria-expanded": "popover.isOpen()" } }, ngImport: i0 });
|
|
8799
|
+
}
|
|
8800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverTriggerDirective, decorators: [{
|
|
8801
|
+
type: Directive,
|
|
8802
|
+
args: [{
|
|
8803
|
+
selector: '[snyPopoverTrigger]',
|
|
8804
|
+
standalone: true,
|
|
8805
|
+
host: {
|
|
8806
|
+
'(click)': 'popover.toggle()',
|
|
8807
|
+
'[attr.aria-expanded]': 'popover.isOpen()',
|
|
8808
|
+
'aria-haspopup': 'dialog',
|
|
8809
|
+
},
|
|
8810
|
+
}]
|
|
8811
|
+
}], ctorParameters: () => [] });
|
|
8812
|
+
class SnyPopoverContentDirective {
|
|
8813
|
+
popover = inject(SNY_POPOVER);
|
|
8814
|
+
elRef = inject(ElementRef);
|
|
8815
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
8816
|
+
computedClass = computed(() => cn('fixed z-50 rounded-md border border-border bg-popover text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
8817
|
+
constructor() {
|
|
8818
|
+
this.popover.panelEl.set(this.elRef.nativeElement);
|
|
8819
|
+
}
|
|
8820
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8821
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyPopoverContentDirective, isStandalone: true, selector: "[snyPopoverContent]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "dialog" }, properties: { "style.display": "popover.isOpen() ? \"\" : \"none\"", "class": "computedClass()" } }, ngImport: i0 });
|
|
8822
|
+
}
|
|
8823
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyPopoverContentDirective, decorators: [{
|
|
8824
|
+
type: Directive,
|
|
8825
|
+
args: [{
|
|
8826
|
+
selector: '[snyPopoverContent]',
|
|
8827
|
+
standalone: true,
|
|
8828
|
+
host: {
|
|
8829
|
+
'role': 'dialog',
|
|
8830
|
+
'[style.display]': 'popover.isOpen() ? "" : "none"',
|
|
8831
|
+
'[class]': 'computedClass()',
|
|
8832
|
+
},
|
|
8833
|
+
}]
|
|
8834
|
+
}], ctorParameters: () => [], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
8835
|
+
|
|
8240
8836
|
class SnyValidatorDirective {
|
|
8241
8837
|
control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
8242
8838
|
state = input('default', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
@@ -8296,5 +8892,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
8296
8892
|
* Generated bundle index. Do not edit.
|
|
8297
8893
|
*/
|
|
8298
8894
|
|
|
8299
|
-
export { SNY_ACCORDION, SNY_ACCORDION_ITEM, SNY_CAROUSEL, SNY_CHAT_BUBBLE, SNY_CONFIG, SNY_DIALOG_DATA, SNY_DRAWER, SNY_DROPDOWN, SNY_FAB, SNY_SHEET_DATA, SNY_STEPS, SNY_TABLE, SNY_TABS, SNY_TIMELINE, SnyAccordionContentDirective, SnyAccordionDirective, SnyAccordionItemDirective, SnyAccordionTriggerDirective, SnyAlertDescriptionDirective, SnyAlertDirective, SnyAlertTitleDirective, SnyAvatarComponent, SnyBadgeDirective, SnyBreadcrumbDirective, SnyBreadcrumbItemDirective, SnyBreadcrumbLinkDirective, SnyBreadcrumbListDirective, SnyBreadcrumbPageDirective, SnyBreadcrumbSeparatorDirective, SnyBulkActionsDefDirective, SnyButtonDirective, SnyButtonGroupDirective, SnyCalendarComponent, SnyCardContentDirective, SnyCardDescriptionDirective, SnyCardDirective, SnyCardFooterDirective, SnyCardHeaderDirective, SnyCardTitleDirective, SnyCarouselContentDirective, SnyCarouselDirective, SnyCarouselItemDirective, SnyCarouselNextDirective, SnyCarouselPrevDirective, SnyCellDefDirective, SnyChatBubbleAvatarDirective, SnyChatBubbleBodyDirective, SnyChatBubbleContentDirective, SnyChatBubbleDirective, SnyChatBubbleFooterDirective, SnyChatBubbleHeaderDirective, SnyCheckboxDirective, SnyColorPickerComponent, SnyComboboxComponent, SnyCommandPaletteComponent, SnyCommandPaletteService, SnyDataTableComponent, SnyDatePickerComponent, SnyDateRangePickerComponent, SnyDialogCloseDirective, SnyDialogContentDirective, SnyDialogDescriptionDirective, SnyDialogFooterDirective, SnyDialogHeaderDirective, SnyDialogRef, SnyDialogService, SnyDialogTitleDirective, SnyDiffComponent, SnyDividerComponent, SnyDockDirective, SnyDockItemDirective, SnyDrawerContentDirective, SnyDrawerLayoutComponent, SnyDrawerLayoutDirective, SnyDrawerSideDirective, SnyDropdownContentDirective, SnyDropdownDirective, SnyDropdownTriggerDirective, SnyFabActionDirective, SnyFabDirective, SnyFabTriggerDirective, SnyFieldsetContentDirective, SnyFieldsetDirective, SnyFieldsetLegendDirective, SnyFileInputComponent, SnyHeaderCellDefDirective, SnyIndicatorBadgeDirective, SnyIndicatorDirective, SnyInputDirective, SnyKbdDirective, SnyLabelDirective, SnyLinkDirective, SnyListDirective, SnyListItemActionDirective, SnyListItemContentDirective, SnyListItemDirective, SnyListItemIconDirective, SnyLoaderComponent, SnyMenuContentDirective, SnyMenuItemDirective, SnyMenuLabelDirective, SnyMenuSeparatorDirective, SnyNavbarBrandDirective, SnyNavbarContentDirective, SnyNavbarDirective, SnyNavbarEndDirective, SnyOtpInputComponent, SnyPaginationComponent, SnyProgressComponent, SnyRadialProgressComponent, SnyRadioDirective, SnyRatingComponent, SnyRowExpandDefDirective, SnySelectComponent, SnySheetCloseDirective, SnySheetContentDirective, SnySheetDescriptionDirective, SnySheetHeaderDirective, SnySheetRef, SnySheetService, SnySheetTitleDirective, SnySkeletonDirective, SnySliderComponent, SnyStatDescriptionDirective, SnyStatDirective, SnyStatFigureDirective, SnyStatTitleDirective, SnyStatValueDirective, SnyStatusDirective, SnyStepDirective, SnyStepsDirective, SnySwitchComponent, SnyTableBodyDirective, SnyTableCaptionDirective, SnyTableCellDirective, SnyTableDirective, SnyTableFooterDirective, SnyTableHeadDirective, SnyTableHeaderDirective, SnyTableRowDirective, SnyTabsContentDirective, SnyTabsDirective, SnyTabsListDirective, SnyTabsTriggerDirective, SnyTextareaDirective, SnyTimelineDirective, SnyTimelineEndDirective, SnyTimelineItemDirective, SnyTimelineMiddleDirective, SnyTimelineStartDirective, SnyToastService, SnyToasterComponent, SnyToggleDirective, SnyTooltipDirective, SnyValidatorDirective, SnyValidatorHintDirective, ThemeService, alertVariants, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxVariants, cn, colorPickerTriggerVariants, comboboxTriggerVariants, datePickerTriggerVariants, dividerVariants, dropdownContentVariants, dropdownItemVariants, fieldsetVariants, fileInputVariants, formatColor, hexToRgb, hslToRgb, hsvToRgb, inputVariants, isValidColor, kbdVariants, labelVariants, linkVariants, loaderVariants, otpCellVariants, paginationItemVariants, parseColor, progressBarVariants, progressTrackVariants, provideSonnyUI, radioVariants, ratingVariants, rgbToHex, rgbToHsl, rgbToHsv, selectTriggerVariants, skeletonVariants, sliderTrackVariants, statusVariants, switchTrackVariants, tableCellVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, toastVariants, toggleVariants, tooltipVariants };
|
|
8895
|
+
export { SNY_ACCORDION, SNY_ACCORDION_ITEM, SNY_CAROUSEL, SNY_CHAT_BUBBLE, SNY_CONFIG, SNY_DIALOG_DATA, SNY_DRAWER, SNY_DROPDOWN, SNY_FAB, SNY_POPOVER, SNY_SHEET_DATA, SNY_STEPS, SNY_TABLE, SNY_TABS, SNY_TIMELINE, SnyAccordionContentDirective, SnyAccordionDirective, SnyAccordionItemDirective, SnyAccordionTriggerDirective, SnyAlertDescriptionDirective, SnyAlertDirective, SnyAlertTitleDirective, SnyAvatarComponent, SnyAvatarGroupComponent, SnyBadgeDirective, SnyBreadcrumbDirective, SnyBreadcrumbItemDirective, SnyBreadcrumbLinkDirective, SnyBreadcrumbListDirective, SnyBreadcrumbPageDirective, SnyBreadcrumbSeparatorDirective, SnyBulkActionsDefDirective, SnyButtonDirective, SnyButtonGroupDirective, SnyCalendarComponent, SnyCardContentDirective, SnyCardDescriptionDirective, SnyCardDirective, SnyCardFooterDirective, SnyCardHeaderDirective, SnyCardTitleDirective, SnyCarouselContentDirective, SnyCarouselDirective, SnyCarouselItemDirective, SnyCarouselNextDirective, SnyCarouselPrevDirective, SnyCellDefDirective, SnyChatBubbleAvatarDirective, SnyChatBubbleBodyDirective, SnyChatBubbleContentDirective, SnyChatBubbleDirective, SnyChatBubbleFooterDirective, SnyChatBubbleHeaderDirective, SnyCheckboxDirective, SnyColorPickerComponent, SnyComboboxComponent, SnyCommandPaletteComponent, SnyCommandPaletteService, SnyDataTableComponent, SnyDatePickerComponent, SnyDateRangePickerComponent, SnyDialogCloseDirective, SnyDialogContentDirective, SnyDialogDescriptionDirective, SnyDialogFooterDirective, SnyDialogHeaderDirective, SnyDialogRef, SnyDialogService, SnyDialogTitleDirective, SnyDiffComponent, SnyDividerComponent, SnyDockDirective, SnyDockItemDirective, SnyDrawerContentDirective, SnyDrawerLayoutComponent, SnyDrawerLayoutDirective, SnyDrawerSideDirective, SnyDropdownContentDirective, SnyDropdownDirective, SnyDropdownTriggerDirective, SnyFabActionDirective, SnyFabDirective, SnyFabTriggerDirective, SnyFieldsetContentDirective, SnyFieldsetDirective, SnyFieldsetLegendDirective, SnyFileInputComponent, SnyHeaderCellDefDirective, SnyIndicatorBadgeDirective, SnyIndicatorDirective, SnyInputDirective, SnyKbdDirective, SnyLabelDirective, SnyLinkDirective, SnyListDirective, SnyListItemActionDirective, SnyListItemContentDirective, SnyListItemDirective, SnyListItemIconDirective, SnyLoaderComponent, SnyMenuContentDirective, SnyMenuItemDirective, SnyMenuLabelDirective, SnyMenuSeparatorDirective, SnyNavbarBrandDirective, SnyNavbarContentDirective, SnyNavbarDirective, SnyNavbarEndDirective, SnyNumberInputComponent, SnyOtpInputComponent, SnyPaginationComponent, SnyPopoverContentDirective, SnyPopoverDirective, SnyPopoverTriggerDirective, SnyProgressComponent, SnyRadialProgressComponent, SnyRadioDirective, SnyRatingComponent, SnyRowExpandDefDirective, SnySelectComponent, SnySheetCloseDirective, SnySheetContentDirective, SnySheetDescriptionDirective, SnySheetHeaderDirective, SnySheetRef, SnySheetService, SnySheetTitleDirective, SnySkeletonDirective, SnySliderComponent, SnyStatDescriptionDirective, SnyStatDirective, SnyStatFigureDirective, SnyStatTitleDirective, SnyStatValueDirective, SnyStatusDirective, SnyStepDirective, SnyStepsDirective, SnySwitchComponent, SnyTableBodyDirective, SnyTableCaptionDirective, SnyTableCellDirective, SnyTableDirective, SnyTableFooterDirective, SnyTableHeadDirective, SnyTableHeaderDirective, SnyTableRowDirective, SnyTabsContentDirective, SnyTabsDirective, SnyTabsListDirective, SnyTabsTriggerDirective, SnyTagInputComponent, SnyTextareaDirective, SnyTimelineDirective, SnyTimelineEndDirective, SnyTimelineItemDirective, SnyTimelineMiddleDirective, SnyTimelineStartDirective, SnyToastService, SnyToasterComponent, SnyToggleDirective, SnyTooltipDirective, SnyValidatorDirective, SnyValidatorHintDirective, ThemeService, alertVariants, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxVariants, cn, colorPickerTriggerVariants, comboboxTriggerVariants, datePickerTriggerVariants, dividerVariants, dropdownContentVariants, dropdownItemVariants, fieldsetVariants, fileInputVariants, formatColor, hexToRgb, hslToRgb, hsvToRgb, inputVariants, isValidColor, kbdVariants, labelVariants, linkVariants, loaderVariants, numberInputVariants, otpCellVariants, paginationItemVariants, parseColor, progressBarVariants, progressTrackVariants, provideSonnyUI, radioVariants, ratingVariants, rgbToHex, rgbToHsl, rgbToHsv, selectTriggerVariants, skeletonVariants, sliderTrackVariants, statusVariants, switchTrackVariants, tableCellVariants, tableVariants, tabsListVariants, tabsTriggerVariants, tagInputContainerVariants, tagVariants, textareaVariants, toastVariants, toggleVariants, tooltipVariants };
|
|
8300
8896
|
//# sourceMappingURL=sonny-ui-core.mjs.map
|