@sonny-ui/core 0.1.0-alpha.12 → 0.1.0-alpha.13
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 +133 -133
- package/fesm2022/sonny-ui-core.mjs +52 -122
- package/fesm2022/sonny-ui-core.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-generate/component/index.js +6 -6
- package/schematics/ng-generate/component/schema.json +32 -32
- package/src/lib/button/button.directive.ts +1 -1
- package/src/lib/calendar/calendar.component.ts +3 -14
- package/src/lib/combobox/combobox.component.ts +2 -15
- package/src/lib/file-input/file-input.component.ts +2 -14
- package/src/lib/rating/rating.component.ts +11 -18
- package/src/lib/select/select.component.ts +2 -15
- package/src/lib/slider/slider.component.ts +13 -19
- package/src/lib/switch/switch.component.ts +8 -15
- package/src/lib/toggle/toggle.directive.ts +4 -15
- package/src/styles/sonny-theme.css +33 -0
- package/types/sonny-ui-core.d.ts +1 -16
|
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
export { cva } from 'class-variance-authority';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { inject, PLATFORM_ID, signal, computed, Injectable, InjectionToken, makeEnvironmentProviders, provideEnvironmentInitializer, input, Directive, ChangeDetectionStrategy, Component, ElementRef, model, viewChild,
|
|
6
|
+
import { inject, PLATFORM_ID, signal, computed, Injectable, InjectionToken, makeEnvironmentProviders, provideEnvironmentInitializer, input, Directive, ChangeDetectionStrategy, Component, ElementRef, model, viewChild, forwardRef, HostListener, Injector, afterNextRender, effect, Renderer2, output, contentChildren } from '@angular/core';
|
|
7
7
|
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
8
8
|
import { Dialog, DialogRef } from '@angular/cdk/dialog';
|
|
9
9
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
@@ -107,7 +107,7 @@ class SnyButtonDirective {
|
|
|
107
107
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
108
108
|
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
109
109
|
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
110
|
-
computedClass = computed(() => cn(buttonVariants({ variant: this.variant(), size: this.size() }), this.loading() && '
|
|
110
|
+
computedClass = computed(() => cn(buttonVariants({ variant: this.variant(), size: this.size() }), this.loading() && 'cursor-wait opacity-70', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
111
111
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
112
112
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: SnyButtonDirective, isStandalone: true, selector: "button[snyBtn], a[snyBtn]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()", "attr.aria-disabled": "disabled() || loading() || null", "attr.disabled": "disabled() || loading() || null", "attr.tabindex": "(disabled() || loading()) ? -1 : null" } }, ngImport: i0 });
|
|
113
113
|
}
|
|
@@ -1079,19 +1079,7 @@ class SnyComboboxComponent {
|
|
|
1079
1079
|
resizeHandler = null;
|
|
1080
1080
|
_onChange = () => { };
|
|
1081
1081
|
onTouched = () => { };
|
|
1082
|
-
_writing = false;
|
|
1083
|
-
constructor() {
|
|
1084
|
-
effect(() => {
|
|
1085
|
-
const val = this.value();
|
|
1086
|
-
if (this._writing) {
|
|
1087
|
-
this._writing = false;
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
this._onChange(val);
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
1082
|
writeValue(val) {
|
|
1094
|
-
this._writing = true;
|
|
1095
1083
|
this.value.set(val ?? '');
|
|
1096
1084
|
}
|
|
1097
1085
|
registerOnChange(fn) {
|
|
@@ -1186,6 +1174,7 @@ class SnyComboboxComponent {
|
|
|
1186
1174
|
}
|
|
1187
1175
|
select(opt) {
|
|
1188
1176
|
this.value.set(opt.value);
|
|
1177
|
+
this._onChange(opt.value);
|
|
1189
1178
|
this.close();
|
|
1190
1179
|
}
|
|
1191
1180
|
onKeydown(event) {
|
|
@@ -1258,7 +1247,7 @@ class SnyComboboxComponent {
|
|
|
1258
1247
|
|
|
1259
1248
|
<!-- Options list -->
|
|
1260
1249
|
@if (filtered().length > 0) {
|
|
1261
|
-
<ul role="listbox" class="max-h-60 overflow-auto p-1">
|
|
1250
|
+
<ul role="listbox" class="max-h-60 overflow-auto p-1 sny-scrollbar">
|
|
1262
1251
|
@for (opt of filtered(); track opt.value; let i = $index) {
|
|
1263
1252
|
<li
|
|
1264
1253
|
role="option"
|
|
@@ -1336,7 +1325,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1336
1325
|
|
|
1337
1326
|
<!-- Options list -->
|
|
1338
1327
|
@if (filtered().length > 0) {
|
|
1339
|
-
<ul role="listbox" class="max-h-60 overflow-auto p-1">
|
|
1328
|
+
<ul role="listbox" class="max-h-60 overflow-auto p-1 sny-scrollbar">
|
|
1340
1329
|
@for (opt of filtered(); track opt.value; let i = $index) {
|
|
1341
1330
|
<li
|
|
1342
1331
|
role="option"
|
|
@@ -1362,7 +1351,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1362
1351
|
}
|
|
1363
1352
|
`,
|
|
1364
1353
|
}]
|
|
1365
|
-
}],
|
|
1354
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], searchRef: [{ type: i0.ViewChild, args: ['searchEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
1366
1355
|
type: HostListener,
|
|
1367
1356
|
args: ['document:click', ['$event']]
|
|
1368
1357
|
}] } });
|
|
@@ -1469,19 +1458,7 @@ class SnySwitchComponent {
|
|
|
1469
1458
|
isDisabled = computed(() => this.disabled() || this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1470
1459
|
_onChange = () => { };
|
|
1471
1460
|
onTouched = () => { };
|
|
1472
|
-
_writing = false;
|
|
1473
|
-
constructor() {
|
|
1474
|
-
effect(() => {
|
|
1475
|
-
const val = this.checked();
|
|
1476
|
-
if (this._writing) {
|
|
1477
|
-
this._writing = false;
|
|
1478
|
-
return;
|
|
1479
|
-
}
|
|
1480
|
-
this._onChange(val);
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
1461
|
writeValue(val) {
|
|
1484
|
-
this._writing = true;
|
|
1485
1462
|
this.checked.set(val ?? false);
|
|
1486
1463
|
}
|
|
1487
1464
|
registerOnChange(fn) {
|
|
@@ -1493,6 +1470,11 @@ class SnySwitchComponent {
|
|
|
1493
1470
|
setDisabledState(isDisabled) {
|
|
1494
1471
|
this._disabledByCva.set(isDisabled);
|
|
1495
1472
|
}
|
|
1473
|
+
toggle() {
|
|
1474
|
+
const newVal = !this.checked();
|
|
1475
|
+
this.checked.set(newVal);
|
|
1476
|
+
this._onChange(newVal);
|
|
1477
|
+
}
|
|
1496
1478
|
trackClass = computed(() => cn(switchTrackVariants({ size: this.size() }), this.checked() ? 'bg-primary' : 'bg-input', this.class()), ...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
|
|
1497
1479
|
thumbClass = computed(() => cn('pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform', switchThumbSize[this.size()], this.checked() ? switchThumbTranslate[this.size()] : 'translate-x-0'), ...(ngDevMode ? [{ debugName: "thumbClass" }] : /* istanbul ignore next */ []));
|
|
1498
1480
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnySwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -1505,7 +1487,7 @@ class SnySwitchComponent {
|
|
|
1505
1487
|
[attr.aria-checked]="checked()"
|
|
1506
1488
|
[disabled]="isDisabled()"
|
|
1507
1489
|
[class]="trackClass()"
|
|
1508
|
-
(click)="
|
|
1490
|
+
(click)="toggle()"
|
|
1509
1491
|
(blur)="onTouched()"
|
|
1510
1492
|
>
|
|
1511
1493
|
<span [class]="thumbClass()"></span>
|
|
@@ -1529,14 +1511,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1529
1511
|
[attr.aria-checked]="checked()"
|
|
1530
1512
|
[disabled]="isDisabled()"
|
|
1531
1513
|
[class]="trackClass()"
|
|
1532
|
-
(click)="
|
|
1514
|
+
(click)="toggle()"
|
|
1533
1515
|
(blur)="onTouched()"
|
|
1534
1516
|
>
|
|
1535
1517
|
<span [class]="thumbClass()"></span>
|
|
1536
1518
|
</button>
|
|
1537
1519
|
`,
|
|
1538
1520
|
}]
|
|
1539
|
-
}],
|
|
1521
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], 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 }] }] } });
|
|
1540
1522
|
|
|
1541
1523
|
const toggleVariants = cva('inline-flex items-center justify-center rounded-sm text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
|
|
1542
1524
|
variants: {
|
|
@@ -1565,19 +1547,7 @@ class SnyToggleDirective {
|
|
|
1565
1547
|
isDisabled = computed(() => this._disabledByCva(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1566
1548
|
_onChange = () => { };
|
|
1567
1549
|
onTouched = () => { };
|
|
1568
|
-
_writing = false;
|
|
1569
|
-
constructor() {
|
|
1570
|
-
effect(() => {
|
|
1571
|
-
const val = this.pressed();
|
|
1572
|
-
if (this._writing) {
|
|
1573
|
-
this._writing = false;
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
this._onChange(val);
|
|
1577
|
-
});
|
|
1578
|
-
}
|
|
1579
1550
|
writeValue(val) {
|
|
1580
|
-
this._writing = true;
|
|
1581
1551
|
this.pressed.set(val ?? false);
|
|
1582
1552
|
}
|
|
1583
1553
|
registerOnChange(fn) {
|
|
@@ -1592,7 +1562,9 @@ class SnyToggleDirective {
|
|
|
1592
1562
|
toggle() {
|
|
1593
1563
|
if (this.isDisabled())
|
|
1594
1564
|
return;
|
|
1595
|
-
|
|
1565
|
+
const newVal = !this.pressed();
|
|
1566
|
+
this.pressed.set(newVal);
|
|
1567
|
+
this._onChange(newVal);
|
|
1596
1568
|
}
|
|
1597
1569
|
computedClass = computed(() => cn(toggleVariants({ variant: this.variant(), size: this.size() }), this.pressed() ? 'bg-accent text-accent-foreground' : '', this.class()), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
1598
1570
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -1616,7 +1588,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1616
1588
|
'(blur)': 'onTouched()',
|
|
1617
1589
|
},
|
|
1618
1590
|
}]
|
|
1619
|
-
}],
|
|
1591
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], pressed: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressed", required: false }] }, { type: i0.Output, args: ["pressedChange"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
1620
1592
|
|
|
1621
1593
|
const sliderTrackVariants = cva('relative w-full rounded-full bg-secondary cursor-pointer', {
|
|
1622
1594
|
variants: {
|
|
@@ -1651,19 +1623,7 @@ class SnySliderComponent {
|
|
|
1651
1623
|
upHandler = null;
|
|
1652
1624
|
_onChange = () => { };
|
|
1653
1625
|
onTouched = () => { };
|
|
1654
|
-
_writing = false;
|
|
1655
|
-
constructor() {
|
|
1656
|
-
effect(() => {
|
|
1657
|
-
const val = this.value();
|
|
1658
|
-
if (this._writing) {
|
|
1659
|
-
this._writing = false;
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
this._onChange(val);
|
|
1663
|
-
});
|
|
1664
|
-
}
|
|
1665
1626
|
writeValue(val) {
|
|
1666
|
-
this._writing = true;
|
|
1667
1627
|
this.value.set(val ?? 0);
|
|
1668
1628
|
}
|
|
1669
1629
|
registerOnChange(fn) {
|
|
@@ -1693,7 +1653,9 @@ class SnySliderComponent {
|
|
|
1693
1653
|
const percent = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
|
|
1694
1654
|
const raw = this.min() + percent * (this.max() - this.min());
|
|
1695
1655
|
const stepped = Math.round(raw / this.step()) * this.step();
|
|
1696
|
-
|
|
1656
|
+
const clamped = Math.max(this.min(), Math.min(this.max(), stepped));
|
|
1657
|
+
this.value.set(clamped);
|
|
1658
|
+
this._onChange(clamped);
|
|
1697
1659
|
}
|
|
1698
1660
|
onTrackMousedown(event) {
|
|
1699
1661
|
if (this.isDisabled())
|
|
@@ -1730,26 +1692,31 @@ class SnySliderComponent {
|
|
|
1730
1692
|
if (this.isDisabled())
|
|
1731
1693
|
return;
|
|
1732
1694
|
const step = this.step();
|
|
1695
|
+
let newVal;
|
|
1733
1696
|
switch (event.key) {
|
|
1734
1697
|
case 'ArrowRight':
|
|
1735
1698
|
case 'ArrowUp':
|
|
1736
1699
|
event.preventDefault();
|
|
1737
|
-
|
|
1700
|
+
newVal = Math.min(this.max(), this.value() + step);
|
|
1738
1701
|
break;
|
|
1739
1702
|
case 'ArrowLeft':
|
|
1740
1703
|
case 'ArrowDown':
|
|
1741
1704
|
event.preventDefault();
|
|
1742
|
-
|
|
1705
|
+
newVal = Math.max(this.min(), this.value() - step);
|
|
1743
1706
|
break;
|
|
1744
1707
|
case 'Home':
|
|
1745
1708
|
event.preventDefault();
|
|
1746
|
-
this.
|
|
1709
|
+
newVal = this.min();
|
|
1747
1710
|
break;
|
|
1748
1711
|
case 'End':
|
|
1749
1712
|
event.preventDefault();
|
|
1750
|
-
this.
|
|
1713
|
+
newVal = this.max();
|
|
1751
1714
|
break;
|
|
1752
1715
|
}
|
|
1716
|
+
if (newVal !== undefined) {
|
|
1717
|
+
this.value.set(newVal);
|
|
1718
|
+
this._onChange(newVal);
|
|
1719
|
+
}
|
|
1753
1720
|
}
|
|
1754
1721
|
removeListeners() {
|
|
1755
1722
|
if (this.moveHandler) {
|
|
@@ -1828,7 +1795,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
1828
1795
|
</div>
|
|
1829
1796
|
`,
|
|
1830
1797
|
}]
|
|
1831
|
-
}],
|
|
1798
|
+
}], 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 }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], trackRef: [{ type: i0.ViewChild, args: ['trackEl', { isSignal: true }] }] } });
|
|
1832
1799
|
|
|
1833
1800
|
const loaderVariants = cva('inline-flex items-center justify-center text-current', {
|
|
1834
1801
|
variants: {
|
|
@@ -2074,19 +2041,7 @@ class SnySelectComponent {
|
|
|
2074
2041
|
resizeHandler = null;
|
|
2075
2042
|
_onChange = () => { };
|
|
2076
2043
|
onTouched = () => { };
|
|
2077
|
-
_writing = false;
|
|
2078
|
-
constructor() {
|
|
2079
|
-
effect(() => {
|
|
2080
|
-
const val = this.value();
|
|
2081
|
-
if (this._writing) {
|
|
2082
|
-
this._writing = false;
|
|
2083
|
-
return;
|
|
2084
|
-
}
|
|
2085
|
-
this._onChange(val);
|
|
2086
|
-
});
|
|
2087
|
-
}
|
|
2088
2044
|
writeValue(val) {
|
|
2089
|
-
this._writing = true;
|
|
2090
2045
|
this.value.set(val ?? '');
|
|
2091
2046
|
}
|
|
2092
2047
|
registerOnChange(fn) {
|
|
@@ -2164,6 +2119,7 @@ class SnySelectComponent {
|
|
|
2164
2119
|
}
|
|
2165
2120
|
select(opt) {
|
|
2166
2121
|
this.value.set(opt.value);
|
|
2122
|
+
this._onChange(opt.value);
|
|
2167
2123
|
this.close();
|
|
2168
2124
|
}
|
|
2169
2125
|
onTriggerKeydown(event) {
|
|
@@ -2228,7 +2184,7 @@ class SnySelectComponent {
|
|
|
2228
2184
|
#dropdownEl
|
|
2229
2185
|
class="fixed z-50 rounded-sm border border-border bg-popover text-popover-foreground shadow-md"
|
|
2230
2186
|
>
|
|
2231
|
-
<ul role="listbox" class="max-h-60 overflow-auto p-1">
|
|
2187
|
+
<ul role="listbox" class="max-h-60 overflow-auto p-1 sny-scrollbar">
|
|
2232
2188
|
@for (opt of options(); track opt.value; let i = $index) {
|
|
2233
2189
|
<li
|
|
2234
2190
|
role="option"
|
|
@@ -2286,7 +2242,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2286
2242
|
#dropdownEl
|
|
2287
2243
|
class="fixed z-50 rounded-sm border border-border bg-popover text-popover-foreground shadow-md"
|
|
2288
2244
|
>
|
|
2289
|
-
<ul role="listbox" class="max-h-60 overflow-auto p-1">
|
|
2245
|
+
<ul role="listbox" class="max-h-60 overflow-auto p-1 sny-scrollbar">
|
|
2290
2246
|
@for (opt of options(); track opt.value; let i = $index) {
|
|
2291
2247
|
<li
|
|
2292
2248
|
role="option"
|
|
@@ -2308,7 +2264,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2308
2264
|
}
|
|
2309
2265
|
`,
|
|
2310
2266
|
}]
|
|
2311
|
-
}],
|
|
2267
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], triggerRef: [{ type: i0.ViewChild, args: ['triggerEl', { isSignal: true }] }], dropdownRef: [{ type: i0.ViewChild, args: ['dropdownEl', { isSignal: true }] }], onDocumentClick: [{
|
|
2312
2268
|
type: HostListener,
|
|
2313
2269
|
args: ['document:click', ['$event']]
|
|
2314
2270
|
}] } });
|
|
@@ -3197,19 +3153,7 @@ class SnyFileInputComponent {
|
|
|
3197
3153
|
isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
|
|
3198
3154
|
_onChange = () => { };
|
|
3199
3155
|
onTouched = () => { };
|
|
3200
|
-
_writing = false;
|
|
3201
|
-
constructor() {
|
|
3202
|
-
effect(() => {
|
|
3203
|
-
const val = this.value();
|
|
3204
|
-
if (this._writing) {
|
|
3205
|
-
this._writing = false;
|
|
3206
|
-
return;
|
|
3207
|
-
}
|
|
3208
|
-
this._onChange(val);
|
|
3209
|
-
});
|
|
3210
|
-
}
|
|
3211
3156
|
writeValue(val) {
|
|
3212
|
-
this._writing = true;
|
|
3213
3157
|
this.value.set(val ?? null);
|
|
3214
3158
|
}
|
|
3215
3159
|
registerOnChange(fn) {
|
|
@@ -3255,6 +3199,7 @@ class SnyFileInputComponent {
|
|
|
3255
3199
|
}
|
|
3256
3200
|
clear() {
|
|
3257
3201
|
this.value.set(null);
|
|
3202
|
+
this._onChange(null);
|
|
3258
3203
|
const inputEl = this.fileInputRef()?.nativeElement;
|
|
3259
3204
|
if (inputEl)
|
|
3260
3205
|
inputEl.value = '';
|
|
@@ -3270,6 +3215,7 @@ class SnyFileInputComponent {
|
|
|
3270
3215
|
}
|
|
3271
3216
|
}
|
|
3272
3217
|
this.value.set(files);
|
|
3218
|
+
this._onChange(files);
|
|
3273
3219
|
this.fileChange.emit(files);
|
|
3274
3220
|
}
|
|
3275
3221
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyFileInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -3333,7 +3279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
3333
3279
|
</label>
|
|
3334
3280
|
`,
|
|
3335
3281
|
}]
|
|
3336
|
-
}],
|
|
3282
|
+
}], propDecorators: { accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], fileChange: [{ type: i0.Output, args: ["fileChange"] }], error: [{ type: i0.Output, args: ["error"] }], fileInputRef: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }] } });
|
|
3337
3283
|
|
|
3338
3284
|
const fieldsetVariants = cva('space-y-4', {
|
|
3339
3285
|
variants: {
|
|
@@ -3426,19 +3372,7 @@ class SnyRatingComponent {
|
|
|
3426
3372
|
hoverValue = signal(null, ...(ngDevMode ? [{ debugName: "hoverValue" }] : /* istanbul ignore next */ []));
|
|
3427
3373
|
_onChange = () => { };
|
|
3428
3374
|
onTouched = () => { };
|
|
3429
|
-
_writing = false;
|
|
3430
|
-
constructor() {
|
|
3431
|
-
effect(() => {
|
|
3432
|
-
const val = this.value();
|
|
3433
|
-
if (this._writing) {
|
|
3434
|
-
this._writing = false;
|
|
3435
|
-
return;
|
|
3436
|
-
}
|
|
3437
|
-
this._onChange(val);
|
|
3438
|
-
});
|
|
3439
|
-
}
|
|
3440
3375
|
writeValue(val) {
|
|
3441
|
-
this._writing = true;
|
|
3442
3376
|
this.value.set(val ?? 0);
|
|
3443
3377
|
}
|
|
3444
3378
|
registerOnChange(fn) {
|
|
@@ -3484,6 +3418,7 @@ class SnyRatingComponent {
|
|
|
3484
3418
|
if (this.isDisabled())
|
|
3485
3419
|
return;
|
|
3486
3420
|
this.value.set(index);
|
|
3421
|
+
this._onChange(index);
|
|
3487
3422
|
}
|
|
3488
3423
|
onStarHover(index) {
|
|
3489
3424
|
if (this.isDisabled())
|
|
@@ -3497,26 +3432,31 @@ class SnyRatingComponent {
|
|
|
3497
3432
|
if (this.isDisabled())
|
|
3498
3433
|
return;
|
|
3499
3434
|
const step = this.half() ? 0.5 : 1;
|
|
3435
|
+
let newVal;
|
|
3500
3436
|
switch (event.key) {
|
|
3501
3437
|
case 'ArrowRight':
|
|
3502
3438
|
case 'ArrowUp':
|
|
3503
3439
|
event.preventDefault();
|
|
3504
|
-
|
|
3440
|
+
newVal = Math.min(this.max(), this.value() + step);
|
|
3505
3441
|
break;
|
|
3506
3442
|
case 'ArrowLeft':
|
|
3507
3443
|
case 'ArrowDown':
|
|
3508
3444
|
event.preventDefault();
|
|
3509
|
-
|
|
3445
|
+
newVal = Math.max(0, this.value() - step);
|
|
3510
3446
|
break;
|
|
3511
3447
|
case 'Home':
|
|
3512
3448
|
event.preventDefault();
|
|
3513
|
-
|
|
3449
|
+
newVal = 0;
|
|
3514
3450
|
break;
|
|
3515
3451
|
case 'End':
|
|
3516
3452
|
event.preventDefault();
|
|
3517
|
-
this.
|
|
3453
|
+
newVal = this.max();
|
|
3518
3454
|
break;
|
|
3519
3455
|
}
|
|
3456
|
+
if (newVal !== undefined) {
|
|
3457
|
+
this.value.set(newVal);
|
|
3458
|
+
this._onChange(newVal);
|
|
3459
|
+
}
|
|
3520
3460
|
}
|
|
3521
3461
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SnyRatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3522
3462
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: SnyRatingComponent, isStandalone: true, selector: "sny-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ratingVariant: { classPropertyName: "ratingVariant", publicName: "ratingVariant", isSignal: true, isRequired: false, transformFunction: null }, half: { classPropertyName: "half", publicName: "half", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "slider", "tabindex": "0" }, listeners: { "keydown": "onKeydown($event)", "mouseleave": "onMouseLeave()", "blur": "onTouched()" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-label": "\"Rating\"", "attr.aria-readonly": "readonly() || null", "class": "computedClass()" } }, providers: [
|
|
@@ -3579,7 +3519,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
3579
3519
|
}
|
|
3580
3520
|
`,
|
|
3581
3521
|
}]
|
|
3582
|
-
}],
|
|
3522
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ratingVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingVariant", required: false }] }], half: [{ type: i0.Input, args: [{ isSignal: true, alias: "half", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
3583
3523
|
|
|
3584
3524
|
class SnyNavbarDirective {
|
|
3585
3525
|
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
@@ -5104,19 +5044,7 @@ class SnyCalendarComponent {
|
|
|
5104
5044
|
weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
5105
5045
|
_onChange = () => { };
|
|
5106
5046
|
onTouched = () => { };
|
|
5107
|
-
_writing = false;
|
|
5108
|
-
constructor() {
|
|
5109
|
-
effect(() => {
|
|
5110
|
-
const val = this.value();
|
|
5111
|
-
if (this._writing) {
|
|
5112
|
-
this._writing = false;
|
|
5113
|
-
return;
|
|
5114
|
-
}
|
|
5115
|
-
this._onChange(val);
|
|
5116
|
-
});
|
|
5117
|
-
}
|
|
5118
5047
|
writeValue(val) {
|
|
5119
|
-
this._writing = true;
|
|
5120
5048
|
this.value.set(val ?? null);
|
|
5121
5049
|
if (val) {
|
|
5122
5050
|
this.viewDate.set(new Date(val.getFullYear(), val.getMonth(), 1));
|
|
@@ -5174,6 +5102,7 @@ class SnyCalendarComponent {
|
|
|
5174
5102
|
}
|
|
5175
5103
|
selectDate(date) {
|
|
5176
5104
|
this.value.set(date);
|
|
5105
|
+
this._onChange(date);
|
|
5177
5106
|
this.onTouched();
|
|
5178
5107
|
}
|
|
5179
5108
|
onKeydown(event) {
|
|
@@ -5205,6 +5134,7 @@ class SnyCalendarComponent {
|
|
|
5205
5134
|
const next = new Date(current);
|
|
5206
5135
|
next.setDate(next.getDate() + offset);
|
|
5207
5136
|
this.value.set(next);
|
|
5137
|
+
this._onChange(next);
|
|
5208
5138
|
this.viewDate.set(new Date(next.getFullYear(), next.getMonth(), 1));
|
|
5209
5139
|
}
|
|
5210
5140
|
createDay(date, isCurrentMonth, today, selected, minDate, maxDate) {
|
|
@@ -5311,7 +5241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
5311
5241
|
</div>
|
|
5312
5242
|
`,
|
|
5313
5243
|
}]
|
|
5314
|
-
}],
|
|
5244
|
+
}], 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 }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
5315
5245
|
|
|
5316
5246
|
class SnyValidatorDirective {
|
|
5317
5247
|
control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|