ngx-strata 0.5.2 → 0.6.1
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/assets/icons/calendar.svg +1 -0
- package/assets/icons/camera.svg +1 -0
- package/assets/icons/clock.svg +1 -0
- package/assets/icons/image.svg +1 -0
- package/assets/icons/upload.svg +1 -0
- package/assets/styles/components/modal.scss +13 -3
- package/assets/styles/public-api.scss +0 -2
- package/dist/strata/strata.css +1 -1
- package/fesm2022/ngx-strata.mjs +1838 -105
- package/fesm2022/ngx-strata.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/ngx-strata/SKILL.md +8 -1
- package/skills/ngx-strata/components/action-menu.md +35 -2
- package/skills/ngx-strata/components/calendar.md +86 -0
- package/skills/ngx-strata/components/date-range-picker.md +53 -0
- package/skills/ngx-strata/components/datepicker.md +66 -0
- package/skills/ngx-strata/components/file-upload.md +5 -1
- package/skills/ngx-strata/components/icon.md +1 -1
- package/skills/ngx-strata/components/time-stepper.md +46 -0
- package/skills/ngx-strata/components/timepicker.md +60 -0
- package/types/ngx-strata.d.ts +388 -27
- package/assets/styles/components/file-upload.scss +0 -168
- package/assets/styles/components/segmented-control.scss +0 -193
package/fesm2022/ngx-strata.mjs
CHANGED
|
@@ -96,6 +96,26 @@ const baseIconConfigs = [
|
|
|
96
96
|
name: 'check',
|
|
97
97
|
url: 'assets/icons/check.svg'
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
name: 'calendar',
|
|
101
|
+
url: 'assets/icons/calendar.svg'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'clock',
|
|
105
|
+
url: 'assets/icons/clock.svg'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'upload',
|
|
109
|
+
url: 'assets/icons/upload.svg'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'camera',
|
|
113
|
+
url: 'assets/icons/camera.svg'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'image',
|
|
117
|
+
url: 'assets/icons/image.svg'
|
|
118
|
+
}
|
|
99
119
|
];
|
|
100
120
|
|
|
101
121
|
const provideBaseIcons = () => {
|
|
@@ -1216,6 +1236,8 @@ class StrataOverlayDirective {
|
|
|
1216
1236
|
...(ngDevMode ? [{ debugName: "overlayOffset" }] : /* istanbul ignore next */ []));
|
|
1217
1237
|
overlayFitViewport = input(true, /* @ts-ignore */
|
|
1218
1238
|
...(ngDevMode ? [{ debugName: "overlayFitViewport" }] : /* istanbul ignore next */ []));
|
|
1239
|
+
overlayTarget = input(null, /* @ts-ignore */
|
|
1240
|
+
...(ngDevMode ? [{ debugName: "overlayTarget" }] : /* istanbul ignore next */ []));
|
|
1219
1241
|
element = inject(ElementRef);
|
|
1220
1242
|
viewContainerRef = inject(ViewContainerRef);
|
|
1221
1243
|
config = inject(STRATA_CONFIG, { optional: true });
|
|
@@ -1224,12 +1246,25 @@ class StrataOverlayDirective {
|
|
|
1224
1246
|
viewRef;
|
|
1225
1247
|
ngOnChanges() {
|
|
1226
1248
|
if (this.overlayOpen()) {
|
|
1227
|
-
this.
|
|
1249
|
+
if (!this.overlayEl) {
|
|
1250
|
+
this.create();
|
|
1251
|
+
}
|
|
1252
|
+
else {
|
|
1253
|
+
if (this.cleanup) {
|
|
1254
|
+
this.cleanup();
|
|
1255
|
+
}
|
|
1256
|
+
const target = this.getTarget();
|
|
1257
|
+
this.cleanup = autoUpdate(target, this.overlayEl, () => this.updatePosition());
|
|
1258
|
+
this.updatePosition();
|
|
1259
|
+
}
|
|
1228
1260
|
}
|
|
1229
1261
|
else {
|
|
1230
1262
|
this.destroy();
|
|
1231
1263
|
}
|
|
1232
1264
|
}
|
|
1265
|
+
getTarget() {
|
|
1266
|
+
return this.overlayTarget() ?? this.element.nativeElement;
|
|
1267
|
+
}
|
|
1233
1268
|
async create() {
|
|
1234
1269
|
if (this.overlayEl)
|
|
1235
1270
|
return;
|
|
@@ -1237,7 +1272,8 @@ class StrataOverlayDirective {
|
|
|
1237
1272
|
this.viewRef.detectChanges();
|
|
1238
1273
|
this.overlayEl = this.viewRef.rootNodes[0];
|
|
1239
1274
|
document.body.appendChild(this.overlayEl);
|
|
1240
|
-
|
|
1275
|
+
const target = this.getTarget();
|
|
1276
|
+
this.cleanup = autoUpdate(target, this.overlayEl, () => this.updatePosition());
|
|
1241
1277
|
}
|
|
1242
1278
|
async updatePosition() {
|
|
1243
1279
|
if (!this.overlayEl)
|
|
@@ -1260,14 +1296,15 @@ class StrataOverlayDirective {
|
|
|
1260
1296
|
else {
|
|
1261
1297
|
this.overlayEl.style.maxHeight = '';
|
|
1262
1298
|
}
|
|
1263
|
-
const
|
|
1299
|
+
const target = this.getTarget();
|
|
1300
|
+
const { x, y } = await computePosition(target, this.overlayEl, {
|
|
1264
1301
|
placement: this.overlayPlacement(),
|
|
1265
1302
|
strategy: 'fixed',
|
|
1266
1303
|
middleware
|
|
1267
1304
|
});
|
|
1268
1305
|
if (!this.overlayEl)
|
|
1269
1306
|
return;
|
|
1270
|
-
const
|
|
1307
|
+
const width = 'getBoundingClientRect' in target ? target.getBoundingClientRect().width : 0;
|
|
1271
1308
|
Object.assign(this.overlayEl.style, {
|
|
1272
1309
|
position: 'fixed',
|
|
1273
1310
|
left: `${x}px`,
|
|
@@ -1294,14 +1331,14 @@ class StrataOverlayDirective {
|
|
|
1294
1331
|
this.destroy();
|
|
1295
1332
|
}
|
|
1296
1333
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataOverlayDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1297
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.1", type: StrataOverlayDirective, isStandalone: true, selector: "[stOverlay]", inputs: { stOverlay: { classPropertyName: "stOverlay", publicName: "stOverlay", isSignal: true, isRequired: true, transformFunction: null }, overlayOpen: { classPropertyName: "overlayOpen", publicName: "overlayOpen", isSignal: true, isRequired: false, transformFunction: null }, overlayPlacement: { classPropertyName: "overlayPlacement", publicName: "overlayPlacement", isSignal: true, isRequired: false, transformFunction: null }, overlayOffset: { classPropertyName: "overlayOffset", publicName: "overlayOffset", isSignal: true, isRequired: false, transformFunction: null }, overlayFitViewport: { classPropertyName: "overlayFitViewport", publicName: "overlayFitViewport", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { overlayOpen: "overlayOpenChange" }, usesOnChanges: true, ngImport: i0 });
|
|
1334
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.1", type: StrataOverlayDirective, isStandalone: true, selector: "[stOverlay]", inputs: { stOverlay: { classPropertyName: "stOverlay", publicName: "stOverlay", isSignal: true, isRequired: true, transformFunction: null }, overlayOpen: { classPropertyName: "overlayOpen", publicName: "overlayOpen", isSignal: true, isRequired: false, transformFunction: null }, overlayPlacement: { classPropertyName: "overlayPlacement", publicName: "overlayPlacement", isSignal: true, isRequired: false, transformFunction: null }, overlayOffset: { classPropertyName: "overlayOffset", publicName: "overlayOffset", isSignal: true, isRequired: false, transformFunction: null }, overlayFitViewport: { classPropertyName: "overlayFitViewport", publicName: "overlayFitViewport", isSignal: true, isRequired: false, transformFunction: null }, overlayTarget: { classPropertyName: "overlayTarget", publicName: "overlayTarget", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { overlayOpen: "overlayOpenChange" }, usesOnChanges: true, ngImport: i0 });
|
|
1298
1335
|
}
|
|
1299
1336
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataOverlayDirective, decorators: [{
|
|
1300
1337
|
type: Directive,
|
|
1301
1338
|
args: [{
|
|
1302
1339
|
selector: '[stOverlay]'
|
|
1303
1340
|
}]
|
|
1304
|
-
}], propDecorators: { stOverlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "stOverlay", required: true }] }], overlayOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayOpen", required: false }] }, { type: i0.Output, args: ["overlayOpenChange"] }], overlayPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayPlacement", required: false }] }], overlayOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayOffset", required: false }] }], overlayFitViewport: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayFitViewport", required: false }] }] } });
|
|
1341
|
+
}], propDecorators: { stOverlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "stOverlay", required: true }] }], overlayOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayOpen", required: false }] }, { type: i0.Output, args: ["overlayOpenChange"] }], overlayPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayPlacement", required: false }] }], overlayOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayOffset", required: false }] }], overlayFitViewport: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayFitViewport", required: false }] }], overlayTarget: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayTarget", required: false }] }] } });
|
|
1305
1342
|
|
|
1306
1343
|
class StrataActionMenuComponent {
|
|
1307
1344
|
projectedButton = contentChild(StrataButtonDirective, { ...(ngDevMode ? { debugName: "projectedButton" } : /* istanbul ignore next */ {}), descendants: true,
|
|
@@ -1313,20 +1350,32 @@ class StrataActionMenuComponent {
|
|
|
1313
1350
|
...(ngDevMode ? [{ debugName: "actionMenuItems" }] : /* istanbul ignore next */ []));
|
|
1314
1351
|
placement = input('bottom-end', /* @ts-ignore */
|
|
1315
1352
|
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1353
|
+
buttonSize = input('md', /* @ts-ignore */
|
|
1354
|
+
...(ngDevMode ? [{ debugName: "buttonSize" }] : /* istanbul ignore next */ []));
|
|
1316
1355
|
closeOnOutsideClick = input(true, /* @ts-ignore */
|
|
1317
1356
|
...(ngDevMode ? [{ debugName: "closeOnOutsideClick" }] : /* istanbul ignore next */ []));
|
|
1357
|
+
trigger = input(true, /* @ts-ignore */
|
|
1358
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
1318
1359
|
elementRef = inject(ElementRef);
|
|
1319
1360
|
renderer = inject(Renderer2);
|
|
1320
1361
|
menuOpen = signal(false, /* @ts-ignore */
|
|
1321
1362
|
...(ngDevMode ? [{ debugName: "menuOpen" }] : /* istanbul ignore next */ []));
|
|
1363
|
+
customTarget = signal(null, /* @ts-ignore */
|
|
1364
|
+
...(ngDevMode ? [{ debugName: "customTarget" }] : /* istanbul ignore next */ []));
|
|
1365
|
+
contextMenuPlacement = signal(null, /* @ts-ignore */
|
|
1366
|
+
...(ngDevMode ? [{ debugName: "contextMenuPlacement" }] : /* istanbul ignore next */ []));
|
|
1367
|
+
effectivePlacement = computed(() => {
|
|
1368
|
+
return this.contextMenuPlacement() ?? this.placement();
|
|
1369
|
+
}, /* @ts-ignore */
|
|
1370
|
+
...(ngDevMode ? [{ debugName: "effectivePlacement" }] : /* istanbul ignore next */ []));
|
|
1322
1371
|
constructor() {
|
|
1323
1372
|
effect((onCleanup) => {
|
|
1324
1373
|
const button = this.projectedButton() ?? this.defaultButton();
|
|
1325
|
-
if (!button) {
|
|
1374
|
+
if (!button || !this.trigger()) {
|
|
1326
1375
|
return;
|
|
1327
1376
|
}
|
|
1328
1377
|
const unlisten = this.renderer.listen(button.nativeElement, 'click', () => {
|
|
1329
|
-
this.
|
|
1378
|
+
this.toggle();
|
|
1330
1379
|
});
|
|
1331
1380
|
onCleanup(() => {
|
|
1332
1381
|
unlisten();
|
|
@@ -1346,7 +1395,20 @@ class StrataActionMenuComponent {
|
|
|
1346
1395
|
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
1347
1396
|
return;
|
|
1348
1397
|
}
|
|
1349
|
-
this.
|
|
1398
|
+
this.close();
|
|
1399
|
+
});
|
|
1400
|
+
onCleanup(() => {
|
|
1401
|
+
unlisten();
|
|
1402
|
+
});
|
|
1403
|
+
});
|
|
1404
|
+
effect((onCleanup) => {
|
|
1405
|
+
if (!this.menuOpen()) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
const unlisten = this.renderer.listen('document', 'keydown', (event) => {
|
|
1409
|
+
if (event.key === 'Escape') {
|
|
1410
|
+
this.close();
|
|
1411
|
+
}
|
|
1350
1412
|
});
|
|
1351
1413
|
onCleanup(() => {
|
|
1352
1414
|
unlisten();
|
|
@@ -1355,7 +1417,7 @@ class StrataActionMenuComponent {
|
|
|
1355
1417
|
effect((onCleanup) => {
|
|
1356
1418
|
const subs = this.actionMenuItems().map((item) => item.menuItemClicked.subscribe((shouldClose) => {
|
|
1357
1419
|
if (shouldClose) {
|
|
1358
|
-
this.
|
|
1420
|
+
this.close();
|
|
1359
1421
|
}
|
|
1360
1422
|
}));
|
|
1361
1423
|
onCleanup(() => {
|
|
@@ -1363,18 +1425,95 @@ class StrataActionMenuComponent {
|
|
|
1363
1425
|
});
|
|
1364
1426
|
});
|
|
1365
1427
|
}
|
|
1428
|
+
open() {
|
|
1429
|
+
this.customTarget.set(null);
|
|
1430
|
+
this.contextMenuPlacement.set(null);
|
|
1431
|
+
this.menuOpen.set(true);
|
|
1432
|
+
}
|
|
1433
|
+
close() {
|
|
1434
|
+
this.menuOpen.set(false);
|
|
1435
|
+
this.customTarget.set(null);
|
|
1436
|
+
this.contextMenuPlacement.set(null);
|
|
1437
|
+
}
|
|
1438
|
+
toggle() {
|
|
1439
|
+
if (this.menuOpen()) {
|
|
1440
|
+
this.close();
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
this.open();
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
openAt(position, placement = 'bottom-start') {
|
|
1447
|
+
const clientX = 'clientX' in position ? position.clientX : position.x;
|
|
1448
|
+
const clientY = 'clientY' in position ? position.clientY : position.y;
|
|
1449
|
+
const virtualElement = {
|
|
1450
|
+
getBoundingClientRect() {
|
|
1451
|
+
return {
|
|
1452
|
+
x: clientX,
|
|
1453
|
+
y: clientY,
|
|
1454
|
+
top: clientY,
|
|
1455
|
+
left: clientX,
|
|
1456
|
+
bottom: clientY,
|
|
1457
|
+
right: clientX,
|
|
1458
|
+
width: 0,
|
|
1459
|
+
height: 0
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
this.customTarget.set(virtualElement);
|
|
1464
|
+
this.contextMenuPlacement.set(placement);
|
|
1465
|
+
this.menuOpen.set(true);
|
|
1466
|
+
}
|
|
1366
1467
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataActionMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1367
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataActionMenuComponent, isStandalone: true, selector: "st-action-menu", inputs: { placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "closeOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "actionMenuItems", predicate: StrataActionMenuItemComponent, isSignal: true }], viewQueries: [{ propertyName: "defaultButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div
|
|
1468
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataActionMenuComponent, isStandalone: true, selector: "st-action-menu", inputs: { placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, buttonSize: { classPropertyName: "buttonSize", publicName: "buttonSize", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "closeOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "projectedButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "actionMenuItems", predicate: StrataActionMenuItemComponent, isSignal: true }], viewQueries: [{ propertyName: "defaultButton", first: true, predicate: StrataButtonDirective, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div\n [stOverlay]=\"menu\"\n [overlayOpen]=\"menuOpen()\"\n [overlayPlacement]=\"effectivePlacement()\"\n [overlayTarget]=\"customTarget()\">\n @if (trigger()) {\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton [size]=\"buttonSize()\"><st-icon name=\"more\"></st-icon></button>\n }\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"], dependencies: [{ kind: "component", type: StrataCardComponent, selector: "st-card", inputs: ["elevated", "selectable", "padding", "variant"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport", "overlayTarget"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
1368
1469
|
}
|
|
1369
1470
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataActionMenuComponent, decorators: [{
|
|
1370
1471
|
type: Component,
|
|
1371
|
-
args: [{ selector: 'st-action-menu', imports: [StrataCardComponent, StrataOverlayDirective, StrataIconComponent, StrataButtonDirective], template: "<div
|
|
1472
|
+
args: [{ selector: 'st-action-menu', imports: [StrataCardComponent, StrataOverlayDirective, StrataIconComponent, StrataButtonDirective], template: "<div\n [stOverlay]=\"menu\"\n [overlayOpen]=\"menuOpen()\"\n [overlayPlacement]=\"effectivePlacement()\"\n [overlayTarget]=\"customTarget()\">\n @if (trigger()) {\n <ng-content select=\"button[stButton]\"></ng-content>\n @if (!projectedButton()) {\n <button stButton [size]=\"buttonSize()\"><st-icon name=\"more\"></st-icon></button>\n }\n }\n</div>\n\n<ng-template #menu>\n <st-card [padding]=\"false\" class=\"action-menu-card\"><ng-content select=\"st-action-menu-item\"></ng-content></st-card>\n</ng-template>\n", styles: ["st-card{width:fit-content}\n"] }]
|
|
1372
1473
|
}], ctorParameters: () => [], propDecorators: { projectedButton: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StrataButtonDirective), { ...{
|
|
1373
1474
|
descendants: true,
|
|
1374
1475
|
read: ElementRef
|
|
1375
1476
|
}, isSignal: true }] }], defaultButton: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataButtonDirective), { ...{
|
|
1376
1477
|
read: ElementRef
|
|
1377
|
-
}, isSignal: true }] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }], actionMenuItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataActionMenuItemComponent), { isSignal: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], closeOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnOutsideClick", required: false }] }] } });
|
|
1478
|
+
}, isSignal: true }] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }], actionMenuItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataActionMenuItemComponent), { isSignal: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], buttonSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSize", required: false }] }], closeOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnOutsideClick", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }] } });
|
|
1479
|
+
|
|
1480
|
+
class StrataContextMenuDirective {
|
|
1481
|
+
stContextMenu = input.required(/* @ts-ignore */
|
|
1482
|
+
...(ngDevMode ? [{ debugName: "stContextMenu" }] : /* istanbul ignore next */ []));
|
|
1483
|
+
stContextMenuDisabled = input(false, /* @ts-ignore */
|
|
1484
|
+
...(ngDevMode ? [{ debugName: "stContextMenuDisabled" }] : /* istanbul ignore next */ []));
|
|
1485
|
+
stContextMenuPlacement = input('bottom-start', /* @ts-ignore */
|
|
1486
|
+
...(ngDevMode ? [{ debugName: "stContextMenuPlacement" }] : /* istanbul ignore next */ []));
|
|
1487
|
+
contextMenuOpened = output();
|
|
1488
|
+
elementRef = inject(ElementRef);
|
|
1489
|
+
renderer = inject(Renderer2);
|
|
1490
|
+
unlisten;
|
|
1491
|
+
ngOnInit() {
|
|
1492
|
+
this.unlisten = this.renderer.listen(this.elementRef.nativeElement, 'contextmenu', (event) => {
|
|
1493
|
+
const menu = this.stContextMenu();
|
|
1494
|
+
if (this.stContextMenuDisabled() || !menu) {
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
event.preventDefault();
|
|
1498
|
+
event.stopPropagation();
|
|
1499
|
+
this.contextMenuOpened.emit(event);
|
|
1500
|
+
menu.openAt(event, this.stContextMenuPlacement());
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
ngOnDestroy() {
|
|
1504
|
+
if (this.unlisten) {
|
|
1505
|
+
this.unlisten();
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataContextMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1509
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.1", type: StrataContextMenuDirective, isStandalone: true, selector: "[stContextMenu]", inputs: { stContextMenu: { classPropertyName: "stContextMenu", publicName: "stContextMenu", isSignal: true, isRequired: true, transformFunction: null }, stContextMenuDisabled: { classPropertyName: "stContextMenuDisabled", publicName: "stContextMenuDisabled", isSignal: true, isRequired: false, transformFunction: null }, stContextMenuPlacement: { classPropertyName: "stContextMenuPlacement", publicName: "stContextMenuPlacement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contextMenuOpened: "contextMenuOpened" }, ngImport: i0 });
|
|
1510
|
+
}
|
|
1511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataContextMenuDirective, decorators: [{
|
|
1512
|
+
type: Directive,
|
|
1513
|
+
args: [{
|
|
1514
|
+
selector: '[stContextMenu]'
|
|
1515
|
+
}]
|
|
1516
|
+
}], propDecorators: { stContextMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "stContextMenu", required: true }] }], stContextMenuDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "stContextMenuDisabled", required: false }] }], stContextMenuPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "stContextMenuPlacement", required: false }] }], contextMenuOpened: [{ type: i0.Output, args: ["contextMenuOpened"] }] } });
|
|
1378
1517
|
|
|
1379
1518
|
class StrataTextStackComponent {
|
|
1380
1519
|
overflow = input('truncate', /* @ts-ignore */
|
|
@@ -1646,44 +1785,241 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
1646
1785
|
}, template: "<ng-content select=\"[stButton], st-divider\" #buttons></ng-content>\n" }]
|
|
1647
1786
|
}], propDecorators: { justification: [{ type: i0.Input, args: [{ isSignal: true, alias: "justification", required: false }] }] } });
|
|
1648
1787
|
|
|
1649
|
-
class
|
|
1650
|
-
|
|
1651
|
-
...(ngDevMode ? [
|
|
1652
|
-
|
|
1653
|
-
...(ngDevMode ? [{ debugName: "
|
|
1654
|
-
|
|
1655
|
-
...(ngDevMode ? [{ debugName: "
|
|
1656
|
-
|
|
1657
|
-
|
|
1788
|
+
class StrataTimeStepperComponent {
|
|
1789
|
+
format = input('24h', /* @ts-ignore */
|
|
1790
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
1791
|
+
showSeconds = input(false, /* @ts-ignore */
|
|
1792
|
+
...(ngDevMode ? [{ debugName: "showSeconds" }] : /* istanbul ignore next */ []));
|
|
1793
|
+
minuteStep = input(1, /* @ts-ignore */
|
|
1794
|
+
...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
1795
|
+
disabled = input(false, /* @ts-ignore */
|
|
1796
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1797
|
+
value = model(null, /* @ts-ignore */
|
|
1798
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1799
|
+
hours = signal(0, /* @ts-ignore */
|
|
1800
|
+
...(ngDevMode ? [{ debugName: "hours" }] : /* istanbul ignore next */ []));
|
|
1801
|
+
minutes = signal(0, /* @ts-ignore */
|
|
1802
|
+
...(ngDevMode ? [{ debugName: "minutes" }] : /* istanbul ignore next */ []));
|
|
1803
|
+
seconds = signal(0, /* @ts-ignore */
|
|
1804
|
+
...(ngDevMode ? [{ debugName: "seconds" }] : /* istanbul ignore next */ []));
|
|
1805
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
1806
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
1807
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
1808
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
1809
|
+
onChange = () => undefined;
|
|
1810
|
+
onTouched = () => undefined;
|
|
1811
|
+
is12h = computed(() => this.format() === '12h', /* @ts-ignore */
|
|
1812
|
+
...(ngDevMode ? [{ debugName: "is12h" }] : /* istanbul ignore next */ []));
|
|
1813
|
+
isPM = computed(() => this.hours() >= 12, /* @ts-ignore */
|
|
1814
|
+
...(ngDevMode ? [{ debugName: "isPM" }] : /* istanbul ignore next */ []));
|
|
1815
|
+
meridiem = computed(() => (this.isPM() ? 'PM' : 'AM'), /* @ts-ignore */
|
|
1816
|
+
...(ngDevMode ? [{ debugName: "meridiem" }] : /* istanbul ignore next */ []));
|
|
1817
|
+
displayHours = computed(() => {
|
|
1818
|
+
const h = this.hours();
|
|
1819
|
+
if (!this.is12h()) {
|
|
1820
|
+
return h.toString().padStart(2, '0');
|
|
1821
|
+
}
|
|
1822
|
+
const h12 = h % 12 || 12;
|
|
1823
|
+
return h12.toString().padStart(2, '0');
|
|
1824
|
+
}, /* @ts-ignore */
|
|
1825
|
+
...(ngDevMode ? [{ debugName: "displayHours" }] : /* istanbul ignore next */ []));
|
|
1826
|
+
displayMinutes = computed(() => {
|
|
1827
|
+
return this.minutes().toString().padStart(2, '0');
|
|
1828
|
+
}, /* @ts-ignore */
|
|
1829
|
+
...(ngDevMode ? [{ debugName: "displayMinutes" }] : /* istanbul ignore next */ []));
|
|
1830
|
+
displaySeconds = computed(() => {
|
|
1831
|
+
return this.seconds().toString().padStart(2, '0');
|
|
1832
|
+
}, /* @ts-ignore */
|
|
1833
|
+
...(ngDevMode ? [{ debugName: "displaySeconds" }] : /* istanbul ignore next */ []));
|
|
1834
|
+
constructor() {
|
|
1835
|
+
effect(() => {
|
|
1836
|
+
const val = this.value();
|
|
1837
|
+
this.syncFromValue(val);
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
syncFromValue(val) {
|
|
1841
|
+
if (!val) {
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
if (val instanceof Date) {
|
|
1845
|
+
this.hours.set(val.getHours());
|
|
1846
|
+
this.minutes.set(val.getMinutes());
|
|
1847
|
+
this.seconds.set(val.getSeconds());
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
if (typeof val === 'string') {
|
|
1851
|
+
const parts = val.trim().split(':');
|
|
1852
|
+
if (parts.length >= 2) {
|
|
1853
|
+
const h = parseInt(parts[0], 10) || 0;
|
|
1854
|
+
const m = parseInt(parts[1], 10) || 0;
|
|
1855
|
+
const s = parts[2] ? parseInt(parts[2], 10) || 0 : 0;
|
|
1856
|
+
this.hours.set(Math.min(23, Math.max(0, h)));
|
|
1857
|
+
this.minutes.set(Math.min(59, Math.max(0, m)));
|
|
1858
|
+
this.seconds.set(Math.min(59, Math.max(0, s)));
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
incrementHours() {
|
|
1863
|
+
if (this.effectiveDisabled())
|
|
1864
|
+
return;
|
|
1865
|
+
const current = this.hours();
|
|
1866
|
+
this.setHours((current + 1) % 24);
|
|
1867
|
+
}
|
|
1868
|
+
decrementHours() {
|
|
1869
|
+
if (this.effectiveDisabled())
|
|
1870
|
+
return;
|
|
1871
|
+
const current = this.hours();
|
|
1872
|
+
this.setHours((current - 1 + 24) % 24);
|
|
1873
|
+
}
|
|
1874
|
+
incrementMinutes() {
|
|
1875
|
+
if (this.effectiveDisabled())
|
|
1876
|
+
return;
|
|
1877
|
+
const step = Math.max(1, this.minuteStep());
|
|
1878
|
+
const current = this.minutes();
|
|
1879
|
+
const next = (Math.floor(current / step) * step + step) % 60;
|
|
1880
|
+
this.setMinutes(next);
|
|
1881
|
+
}
|
|
1882
|
+
decrementMinutes() {
|
|
1883
|
+
if (this.effectiveDisabled())
|
|
1884
|
+
return;
|
|
1885
|
+
const step = Math.max(1, this.minuteStep());
|
|
1886
|
+
const current = this.minutes();
|
|
1887
|
+
const next = (Math.ceil(current / step) * step - step + 60) % 60;
|
|
1888
|
+
this.setMinutes(next);
|
|
1889
|
+
}
|
|
1890
|
+
incrementSeconds() {
|
|
1891
|
+
if (this.effectiveDisabled())
|
|
1892
|
+
return;
|
|
1893
|
+
const current = this.seconds();
|
|
1894
|
+
this.setSeconds((current + 1) % 60);
|
|
1895
|
+
}
|
|
1896
|
+
decrementSeconds() {
|
|
1897
|
+
if (this.effectiveDisabled())
|
|
1898
|
+
return;
|
|
1899
|
+
const current = this.seconds();
|
|
1900
|
+
this.setSeconds((current - 1 + 60) % 60);
|
|
1901
|
+
}
|
|
1902
|
+
toggleMeridiem() {
|
|
1903
|
+
if (this.effectiveDisabled() || !this.is12h())
|
|
1904
|
+
return;
|
|
1905
|
+
const current = this.hours();
|
|
1906
|
+
if (current >= 12) {
|
|
1907
|
+
this.setHours(current - 12);
|
|
1908
|
+
}
|
|
1909
|
+
else {
|
|
1910
|
+
this.setHours(current + 12);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
setHours(h) {
|
|
1914
|
+
this.hours.set(h);
|
|
1915
|
+
this.emitChange();
|
|
1916
|
+
}
|
|
1917
|
+
setMinutes(m) {
|
|
1918
|
+
this.minutes.set(m);
|
|
1919
|
+
this.emitChange();
|
|
1920
|
+
}
|
|
1921
|
+
setSeconds(s) {
|
|
1922
|
+
this.seconds.set(s);
|
|
1923
|
+
this.emitChange();
|
|
1924
|
+
}
|
|
1925
|
+
emitChange() {
|
|
1926
|
+
const currentVal = this.value();
|
|
1927
|
+
let updated;
|
|
1928
|
+
if (currentVal instanceof Date) {
|
|
1929
|
+
const d = new Date(currentVal);
|
|
1930
|
+
d.setHours(this.hours(), this.minutes(), this.seconds());
|
|
1931
|
+
updated = d;
|
|
1932
|
+
}
|
|
1933
|
+
else {
|
|
1934
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
1935
|
+
updated = this.showSeconds()
|
|
1936
|
+
? `${pad(this.hours())}:${pad(this.minutes())}:${pad(this.seconds())}`
|
|
1937
|
+
: `${pad(this.hours())}:${pad(this.minutes())}`;
|
|
1938
|
+
}
|
|
1939
|
+
this.value.set(updated);
|
|
1940
|
+
this.onChange(updated);
|
|
1941
|
+
this.onTouched();
|
|
1942
|
+
}
|
|
1943
|
+
writeValue(val) {
|
|
1944
|
+
this.value.set(val);
|
|
1945
|
+
this.syncFromValue(val);
|
|
1946
|
+
}
|
|
1947
|
+
registerOnChange(fn) {
|
|
1948
|
+
this.onChange = fn;
|
|
1949
|
+
}
|
|
1950
|
+
registerOnTouched(fn) {
|
|
1951
|
+
this.onTouched = fn;
|
|
1952
|
+
}
|
|
1953
|
+
setDisabledState(isDisabled) {
|
|
1954
|
+
this.cvaDisabled.set(isDisabled);
|
|
1955
|
+
}
|
|
1956
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimeStepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1957
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataTimeStepperComponent, isStandalone: true, selector: "st-time-stepper", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class.st-time-stepper": "true", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null" } }, providers: [
|
|
1958
|
+
{
|
|
1959
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1960
|
+
useExisting: forwardRef(() => StrataTimeStepperComponent),
|
|
1961
|
+
multi: true
|
|
1962
|
+
}
|
|
1963
|
+
], ngImport: i0, template: "<div class=\"st-time-stepper-inner\">\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementHours()\"\n aria-label=\"Increment hours\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementHours()\" (keydown.arrowdown)=\"decrementHours()\">\n {{ displayHours() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementHours()\"\n aria-label=\"Decrement hours\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementMinutes()\"\n aria-label=\"Increment minutes\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementMinutes()\" (keydown.arrowdown)=\"decrementMinutes()\">\n {{ displayMinutes() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementMinutes()\"\n aria-label=\"Decrement minutes\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n @if (showSeconds()) {\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementSeconds()\"\n aria-label=\"Increment seconds\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementSeconds()\" (keydown.arrowdown)=\"decrementSeconds()\">\n {{ displaySeconds() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementSeconds()\"\n aria-label=\"Decrement seconds\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n }\n\n @if (is12h()) {\n <div class=\"st-time-col st-meridiem-col\">\n <button\n type=\"button\"\n class=\"st-meridiem-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleMeridiem()\"\n aria-label=\"Toggle AM PM\"\n >\n {{ meridiem() }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:inline-flex;align-items:center;box-sizing:border-box}:host.st-disabled{opacity:.55;pointer-events:none}.st-time-stepper-inner{display:inline-flex;align-items:center;gap:var(--st-space-1);padding:0;background:transparent;border:none;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-time-col{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-1)}.st-time-arrow-btn{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);width:44px;height:24px;border-radius:var(--st-border-radius-sm);transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-time-arrow-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-time-arrow-btn:disabled{opacity:.4;cursor:not-allowed}.st-time-val{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:42px;font-family:var(--st-font-mono);font-size:var(--st-font-lg);font-weight:var(--st-font-weight-semibold);background:transparent;border:1px solid var(--st-border);border-radius:var(--st-border-radius-md);color:var(--st-color-text-primary);outline:none;cursor:default;transition:border-color var(--st-transition-fast)}.st-time-val:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}.st-time-sep{font-weight:var(--st-font-weight-bold);color:var(--st-color-text-secondary);font-size:var(--st-font-xl);margin:0 4px}.st-meridiem-col{margin-left:var(--st-space-1)}.st-meridiem-btn{background:transparent;border:1px solid var(--st-border);color:var(--st-color-text-primary);border-radius:var(--st-border-radius-md);height:42px;font-size:var(--st-font-sm);font-weight:var(--st-font-weight-semibold);padding:0 var(--st-space-3);cursor:pointer;transition:background var(--st-transition-fast),border-color var(--st-transition-fast)}.st-meridiem-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));border-color:var(--st-color-border-strong)}.st-meridiem-btn:disabled{opacity:.4;cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }] });
|
|
1658
1964
|
}
|
|
1659
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type:
|
|
1965
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimeStepperComponent, decorators: [{
|
|
1660
1966
|
type: Component,
|
|
1661
|
-
args: [{ selector: 'st-
|
|
1662
|
-
|
|
1967
|
+
args: [{ selector: 'st-time-stepper', imports: [CommonModule, StrataIconComponent], providers: [
|
|
1968
|
+
{
|
|
1969
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1970
|
+
useExisting: forwardRef(() => StrataTimeStepperComponent),
|
|
1971
|
+
multi: true
|
|
1972
|
+
}
|
|
1973
|
+
], host: {
|
|
1974
|
+
'[class.st-time-stepper]': 'true',
|
|
1975
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
1976
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null'
|
|
1977
|
+
}, template: "<div class=\"st-time-stepper-inner\">\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementHours()\"\n aria-label=\"Increment hours\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementHours()\" (keydown.arrowdown)=\"decrementHours()\">\n {{ displayHours() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementHours()\"\n aria-label=\"Decrement hours\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementMinutes()\"\n aria-label=\"Increment minutes\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementMinutes()\" (keydown.arrowdown)=\"decrementMinutes()\">\n {{ displayMinutes() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementMinutes()\"\n aria-label=\"Decrement minutes\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n\n @if (showSeconds()) {\n <span class=\"st-time-sep\">:</span>\n\n <div class=\"st-time-col\">\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"incrementSeconds()\"\n aria-label=\"Increment seconds\"\n >\n <st-icon name=\"arrow-up\" size=\"xs\"></st-icon>\n </button>\n <span class=\"st-time-val\" tabindex=\"0\" (keydown.arrowup)=\"incrementSeconds()\" (keydown.arrowdown)=\"decrementSeconds()\">\n {{ displaySeconds() }}\n </span>\n <button\n type=\"button\"\n class=\"st-time-arrow-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"decrementSeconds()\"\n aria-label=\"Decrement seconds\"\n >\n <st-icon name=\"arrow-down\" size=\"xs\"></st-icon>\n </button>\n </div>\n }\n\n @if (is12h()) {\n <div class=\"st-time-col st-meridiem-col\">\n <button\n type=\"button\"\n class=\"st-meridiem-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleMeridiem()\"\n aria-label=\"Toggle AM PM\"\n >\n {{ meridiem() }}\n </button>\n </div>\n }\n</div>\n", styles: [":host{display:inline-flex;align-items:center;box-sizing:border-box}:host.st-disabled{opacity:.55;pointer-events:none}.st-time-stepper-inner{display:inline-flex;align-items:center;gap:var(--st-space-1);padding:0;background:transparent;border:none;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-time-col{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-1)}.st-time-arrow-btn{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);width:44px;height:24px;border-radius:var(--st-border-radius-sm);transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-time-arrow-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-time-arrow-btn:disabled{opacity:.4;cursor:not-allowed}.st-time-val{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:42px;font-family:var(--st-font-mono);font-size:var(--st-font-lg);font-weight:var(--st-font-weight-semibold);background:transparent;border:1px solid var(--st-border);border-radius:var(--st-border-radius-md);color:var(--st-color-text-primary);outline:none;cursor:default;transition:border-color var(--st-transition-fast)}.st-time-val:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}.st-time-sep{font-weight:var(--st-font-weight-bold);color:var(--st-color-text-secondary);font-size:var(--st-font-xl);margin:0 4px}.st-meridiem-col{margin-left:var(--st-space-1)}.st-meridiem-btn{background:transparent;border:1px solid var(--st-border);color:var(--st-color-text-primary);border-radius:var(--st-border-radius-md);height:42px;font-size:var(--st-font-sm);font-weight:var(--st-font-weight-semibold);padding:0 var(--st-space-3);cursor:pointer;transition:background var(--st-transition-fast),border-color var(--st-transition-fast)}.st-meridiem-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));border-color:var(--st-color-border-strong)}.st-meridiem-btn:disabled{opacity:.4;cursor:not-allowed}\n"] }]
|
|
1978
|
+
}], ctorParameters: () => [], propDecorators: { format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1663
1979
|
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
|
|
1669
|
-
multiple = input(false, /* @ts-ignore */
|
|
1670
|
-
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
1671
|
-
maxFileSize = input(undefined, /* @ts-ignore */
|
|
1672
|
-
...(ngDevMode ? [{ debugName: "maxFileSize" }] : /* istanbul ignore next */ []));
|
|
1673
|
-
disabled = input(false, /* @ts-ignore */
|
|
1674
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1675
|
-
label = input('Choose a file or drag & drop it here', /* @ts-ignore */
|
|
1980
|
+
let nextUniqueTimepickerId = 0;
|
|
1981
|
+
class StrataTimepickerComponent {
|
|
1982
|
+
defaultId = `st-timepicker-${nextUniqueTimepickerId++}`;
|
|
1983
|
+
label = input(undefined, /* @ts-ignore */
|
|
1676
1984
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1677
|
-
|
|
1678
|
-
...(ngDevMode ? [{ debugName: "
|
|
1985
|
+
id = input(undefined, /* @ts-ignore */
|
|
1986
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1987
|
+
name = input(undefined, /* @ts-ignore */
|
|
1988
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
1989
|
+
placeholder = input('Select time', /* @ts-ignore */
|
|
1990
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1991
|
+
size = input('md', /* @ts-ignore */
|
|
1992
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1993
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
1994
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1995
|
+
format = input('24h', /* @ts-ignore */
|
|
1996
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
1997
|
+
showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1998
|
+
minuteStep = input(1, /* @ts-ignore */
|
|
1999
|
+
...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
2000
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2001
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2002
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2003
|
+
fullWidth = input(false, { ...(ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1679
2004
|
state = input(undefined, /* @ts-ignore */
|
|
1680
2005
|
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
1681
2006
|
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1682
2007
|
message = input(undefined, /* @ts-ignore */
|
|
1683
2008
|
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
1684
2009
|
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1685
|
-
|
|
1686
|
-
...(ngDevMode ? [{ debugName: "
|
|
2010
|
+
value = model(null, /* @ts-ignore */
|
|
2011
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2012
|
+
timeSelected = output();
|
|
2013
|
+
open = signal(false, /* @ts-ignore */
|
|
2014
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
2015
|
+
textInputValue = signal('', /* @ts-ignore */
|
|
2016
|
+
...(ngDevMode ? [{ debugName: "textInputValue" }] : /* istanbul ignore next */ []));
|
|
2017
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2018
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2019
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2020
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2021
|
+
effectiveId = computed(() => this.id() ?? this.name() ?? this.defaultId, /* @ts-ignore */
|
|
2022
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
1687
2023
|
effectiveState = computed(() => {
|
|
1688
2024
|
if (this.error()) {
|
|
1689
2025
|
return 'error';
|
|
@@ -1697,86 +2033,1478 @@ class StrataFileUploadComponent {
|
|
|
1697
2033
|
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
1698
2034
|
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
1699
2035
|
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
}
|
|
1723
|
-
hostRole = 'button';
|
|
1724
|
-
get hostTabIndex() {
|
|
1725
|
-
return this.disabled() ? -1 : 0;
|
|
2036
|
+
onChange = () => undefined;
|
|
2037
|
+
onTouched = () => undefined;
|
|
2038
|
+
overlayDirective = viewChild(StrataOverlayDirective, /* @ts-ignore */
|
|
2039
|
+
...(ngDevMode ? [{ debugName: "overlayDirective" }] : /* istanbul ignore next */ []));
|
|
2040
|
+
elementRef = inject(ElementRef);
|
|
2041
|
+
renderer = inject(Renderer2);
|
|
2042
|
+
destroyRef = inject(DestroyRef);
|
|
2043
|
+
constructor() {
|
|
2044
|
+
const unlisten = this.renderer.listen('document', 'pointerdown', (event) => {
|
|
2045
|
+
if (!this.open())
|
|
2046
|
+
return;
|
|
2047
|
+
const target = event.target;
|
|
2048
|
+
if (!target)
|
|
2049
|
+
return;
|
|
2050
|
+
const hostEl = this.elementRef.nativeElement;
|
|
2051
|
+
const overlayEl = this.overlayDirective()?.getOverlayElement();
|
|
2052
|
+
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
this.open.set(false);
|
|
2056
|
+
});
|
|
2057
|
+
this.destroyRef.onDestroy(() => unlisten());
|
|
1726
2058
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
if (target === this.fileInput()?.nativeElement) {
|
|
2059
|
+
toggle(event) {
|
|
2060
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
1730
2061
|
return;
|
|
2062
|
+
if (event) {
|
|
2063
|
+
event.preventDefault();
|
|
2064
|
+
event.stopPropagation();
|
|
1731
2065
|
}
|
|
1732
|
-
this.
|
|
1733
|
-
}
|
|
1734
|
-
onKeydown(event) {
|
|
1735
|
-
event.preventDefault();
|
|
1736
|
-
this.browse();
|
|
2066
|
+
this.open.set(!this.open());
|
|
1737
2067
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
2068
|
+
onInputTextChange(value) {
|
|
2069
|
+
this.textInputValue.set(value);
|
|
2070
|
+
if (!value.trim()) {
|
|
2071
|
+
this.updateTimeValue(null);
|
|
1740
2072
|
return;
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
2073
|
+
}
|
|
2074
|
+
const parsed = this.parseTimeString(value);
|
|
2075
|
+
if (parsed) {
|
|
2076
|
+
this.updateTimeValue(parsed);
|
|
2077
|
+
}
|
|
1744
2078
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2079
|
+
onInputBlur() {
|
|
2080
|
+
this.onTouched();
|
|
2081
|
+
const val = this.value();
|
|
2082
|
+
if (val) {
|
|
2083
|
+
this.textInputValue.set(this.formatTimeValue(val));
|
|
2084
|
+
}
|
|
2085
|
+
else {
|
|
2086
|
+
this.textInputValue.set('');
|
|
2087
|
+
}
|
|
1751
2088
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
2089
|
+
onStepperTimeSelected(val) {
|
|
2090
|
+
this.updateTimeValue(val);
|
|
2091
|
+
}
|
|
2092
|
+
clear(event) {
|
|
1756
2093
|
event.stopPropagation();
|
|
1757
|
-
this.
|
|
1758
|
-
const droppedFiles = event.dataTransfer?.files;
|
|
1759
|
-
if (!droppedFiles || droppedFiles.length === 0)
|
|
2094
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
1760
2095
|
return;
|
|
1761
|
-
this.
|
|
2096
|
+
this.updateTimeValue(null);
|
|
1762
2097
|
}
|
|
1763
|
-
|
|
2098
|
+
formatTimeValue(val) {
|
|
2099
|
+
if (!val)
|
|
2100
|
+
return '';
|
|
2101
|
+
let hours = 0;
|
|
2102
|
+
let minutes = 0;
|
|
2103
|
+
let seconds = 0;
|
|
2104
|
+
if (val instanceof Date) {
|
|
2105
|
+
hours = val.getHours();
|
|
2106
|
+
minutes = val.getMinutes();
|
|
2107
|
+
seconds = val.getSeconds();
|
|
2108
|
+
}
|
|
2109
|
+
else if (typeof val === 'string') {
|
|
2110
|
+
const parts = val.trim().split(':');
|
|
2111
|
+
hours = parseInt(parts[0], 10) || 0;
|
|
2112
|
+
minutes = parseInt(parts[1], 10) || 0;
|
|
2113
|
+
seconds = parts[2] ? parseInt(parts[2], 10) || 0 : 0;
|
|
2114
|
+
}
|
|
2115
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
2116
|
+
if (this.format() === '12h') {
|
|
2117
|
+
const isPM = hours >= 12;
|
|
2118
|
+
const h12 = hours % 12 || 12;
|
|
2119
|
+
const meridiem = isPM ? 'PM' : 'AM';
|
|
2120
|
+
return this.showSeconds()
|
|
2121
|
+
? `${pad(h12)}:${pad(minutes)}:${pad(seconds)} ${meridiem}`
|
|
2122
|
+
: `${pad(h12)}:${pad(minutes)} ${meridiem}`;
|
|
2123
|
+
}
|
|
2124
|
+
return this.showSeconds()
|
|
2125
|
+
? `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`
|
|
2126
|
+
: `${pad(hours)}:${pad(minutes)}`;
|
|
2127
|
+
}
|
|
2128
|
+
parseTimeString(input) {
|
|
2129
|
+
const trimmed = input.trim();
|
|
2130
|
+
if (!trimmed)
|
|
2131
|
+
return null;
|
|
2132
|
+
const is12hInput = /am|pm/i.test(trimmed);
|
|
2133
|
+
const cleanTime = trimmed.replace(/\s*(am|pm)/i, '').trim();
|
|
2134
|
+
const parts = cleanTime.split(':').map((p) => parseInt(p, 10));
|
|
2135
|
+
if (parts.some((n) => isNaN(n)))
|
|
2136
|
+
return null;
|
|
2137
|
+
let [h, m, s] = parts;
|
|
2138
|
+
m = m ?? 0;
|
|
2139
|
+
s = s ?? 0;
|
|
2140
|
+
if (is12hInput || this.format() === '12h') {
|
|
2141
|
+
const isPM = /pm/i.test(trimmed);
|
|
2142
|
+
if (h < 1 || h > 12 || m < 0 || m > 59 || s < 0 || s > 59)
|
|
2143
|
+
return null;
|
|
2144
|
+
if (isPM && h < 12)
|
|
2145
|
+
h += 12;
|
|
2146
|
+
if (!isPM && h === 12)
|
|
2147
|
+
h = 0;
|
|
2148
|
+
}
|
|
2149
|
+
else {
|
|
2150
|
+
if (h < 0 || h > 23 || m < 0 || m > 59 || s < 0 || s > 59)
|
|
2151
|
+
return null;
|
|
2152
|
+
}
|
|
2153
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
2154
|
+
return this.showSeconds() ? `${pad(h)}:${pad(m)}:${pad(s)}` : `${pad(h)}:${pad(m)}`;
|
|
2155
|
+
}
|
|
2156
|
+
updateTimeValue(val) {
|
|
2157
|
+
this.value.set(val);
|
|
2158
|
+
this.textInputValue.set(this.formatTimeValue(val));
|
|
2159
|
+
this.timeSelected.emit(val);
|
|
2160
|
+
this.onChange(val);
|
|
2161
|
+
this.onTouched();
|
|
2162
|
+
}
|
|
2163
|
+
writeValue(val) {
|
|
2164
|
+
this.value.set(val);
|
|
2165
|
+
this.textInputValue.set(this.formatTimeValue(val));
|
|
2166
|
+
}
|
|
2167
|
+
registerOnChange(fn) {
|
|
2168
|
+
this.onChange = fn;
|
|
2169
|
+
}
|
|
2170
|
+
registerOnTouched(fn) {
|
|
2171
|
+
this.onTouched = fn;
|
|
2172
|
+
}
|
|
2173
|
+
setDisabledState(isDisabled) {
|
|
2174
|
+
this.cvaDisabled.set(isDisabled);
|
|
2175
|
+
}
|
|
2176
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2177
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataTimepickerComponent, isStandalone: true, selector: "st-timepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", timeSelected: "timeSelected" }, host: { properties: { "class.st-timepicker": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null", "class.st-state-error": "effectiveState() === \"error\"", "class.st-state-success": "effectiveState() === \"success\"", "class.st-state-warning": "effectiveState() === \"warning\"", "class.st-error": "effectiveState() === \"error\"", "attr.aria-invalid": "effectiveState() === \"error\" ? \"true\" : null" } }, providers: [
|
|
2178
|
+
{
|
|
2179
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2180
|
+
useExisting: forwardRef(() => StrataTimepickerComponent),
|
|
2181
|
+
multi: true
|
|
2182
|
+
}
|
|
2183
|
+
], viewQueries: [{ propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"timeOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear time\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"clock\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #timeOverlay>\n <div class=\"st-timepicker-dropdown\">\n <st-time-stepper\n [value]=\"value()\"\n [format]=\"format()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onStepperTimeSelected($event)\"\n ></st-time-stepper>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-timepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out;display:flex;align-items:center;justify-content:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport", "overlayTarget"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataTimeStepperComponent, selector: "st-time-stepper", inputs: ["format", "showSeconds", "minuteStep", "disabled", "value"], outputs: ["valueChange"] }] });
|
|
2184
|
+
}
|
|
2185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataTimepickerComponent, decorators: [{
|
|
2186
|
+
type: Component,
|
|
2187
|
+
args: [{ selector: 'st-timepicker', imports: [
|
|
2188
|
+
CommonModule,
|
|
2189
|
+
FormsModule,
|
|
2190
|
+
StrataIconComponent,
|
|
2191
|
+
StrataOverlayDirective,
|
|
2192
|
+
StrataTimeStepperComponent
|
|
2193
|
+
], providers: [
|
|
2194
|
+
{
|
|
2195
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2196
|
+
useExisting: forwardRef(() => StrataTimepickerComponent),
|
|
2197
|
+
multi: true
|
|
2198
|
+
}
|
|
2199
|
+
], host: {
|
|
2200
|
+
'[class.st-timepicker]': 'true',
|
|
2201
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
2202
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
2203
|
+
'[class.st-size-lg]': 'size() === "lg"',
|
|
2204
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2205
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
2206
|
+
'[class.st-state-error]': 'effectiveState() === "error"',
|
|
2207
|
+
'[class.st-state-success]': 'effectiveState() === "success"',
|
|
2208
|
+
'[class.st-state-warning]': 'effectiveState() === "warning"',
|
|
2209
|
+
'[class.st-error]': 'effectiveState() === "error"',
|
|
2210
|
+
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null'
|
|
2211
|
+
}, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"timeOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear time\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"clock\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #timeOverlay>\n <div class=\"st-timepicker-dropdown\">\n <st-time-stepper\n [value]=\"value()\"\n [format]=\"format()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onStepperTimeSelected($event)\"\n ></st-time-stepper>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-timepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out;display:flex;align-items:center;justify-content:center}\n"] }]
|
|
2212
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], timeSelected: [{ type: i0.Output, args: ["timeSelected"] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }] } });
|
|
2213
|
+
|
|
2214
|
+
function isSameDay(a, b) {
|
|
2215
|
+
if (!a || !b)
|
|
2216
|
+
return false;
|
|
2217
|
+
return (a.getFullYear() === b.getFullYear() &&
|
|
2218
|
+
a.getMonth() === b.getMonth() &&
|
|
2219
|
+
a.getDate() === b.getDate());
|
|
2220
|
+
}
|
|
2221
|
+
function isSameMonth(a, b) {
|
|
2222
|
+
if (!a || !b)
|
|
2223
|
+
return false;
|
|
2224
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
2225
|
+
}
|
|
2226
|
+
function isSameYear(a, b) {
|
|
2227
|
+
if (!a || !b)
|
|
2228
|
+
return false;
|
|
2229
|
+
return a.getFullYear() === b.getFullYear();
|
|
2230
|
+
}
|
|
2231
|
+
function isBeforeDay(a, b) {
|
|
2232
|
+
const aDate = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
|
|
2233
|
+
const bDate = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
|
|
2234
|
+
return aDate < bDate;
|
|
2235
|
+
}
|
|
2236
|
+
function isAfterDay(a, b) {
|
|
2237
|
+
const aDate = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
|
|
2238
|
+
const bDate = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
|
|
2239
|
+
return aDate > bDate;
|
|
2240
|
+
}
|
|
2241
|
+
function isWithinDayRange(date, start, end) {
|
|
2242
|
+
if (!start || !end)
|
|
2243
|
+
return false;
|
|
2244
|
+
const target = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
2245
|
+
const s = new Date(start.getFullYear(), start.getMonth(), start.getDate()).getTime();
|
|
2246
|
+
const e = new Date(end.getFullYear(), end.getMonth(), end.getDate()).getTime();
|
|
2247
|
+
const min = Math.min(s, e);
|
|
2248
|
+
const max = Math.max(s, e);
|
|
2249
|
+
return target >= min && target <= max;
|
|
2250
|
+
}
|
|
2251
|
+
function startOfDay(date) {
|
|
2252
|
+
const result = new Date(date);
|
|
2253
|
+
result.setHours(0, 0, 0, 0);
|
|
2254
|
+
return result;
|
|
2255
|
+
}
|
|
2256
|
+
function endOfDay(date) {
|
|
2257
|
+
const result = new Date(date);
|
|
2258
|
+
result.setHours(23, 59, 59, 999);
|
|
2259
|
+
return result;
|
|
2260
|
+
}
|
|
2261
|
+
function startOfMonth(date) {
|
|
2262
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
2263
|
+
}
|
|
2264
|
+
function endOfMonth(date) {
|
|
2265
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
2266
|
+
}
|
|
2267
|
+
function addDays(date, amount) {
|
|
2268
|
+
const result = new Date(date);
|
|
2269
|
+
result.setDate(result.getDate() + amount);
|
|
2270
|
+
return result;
|
|
2271
|
+
}
|
|
2272
|
+
function addMonths(date, amount) {
|
|
2273
|
+
const result = new Date(date);
|
|
2274
|
+
const targetMonth = result.getMonth() + amount;
|
|
2275
|
+
result.setMonth(targetMonth);
|
|
2276
|
+
return result;
|
|
2277
|
+
}
|
|
2278
|
+
function addYears(date, amount) {
|
|
2279
|
+
const result = new Date(date);
|
|
2280
|
+
result.setFullYear(result.getFullYear() + amount);
|
|
2281
|
+
return result;
|
|
2282
|
+
}
|
|
2283
|
+
function getDayOfWeek(date) {
|
|
2284
|
+
return (date.getDay() + 6) % 7;
|
|
2285
|
+
}
|
|
2286
|
+
function isWeekend(date) {
|
|
2287
|
+
const day = getDayOfWeek(date);
|
|
2288
|
+
return day === 5 || day === 6;
|
|
2289
|
+
}
|
|
2290
|
+
function disableWeekends(date) {
|
|
2291
|
+
return isWeekend(date);
|
|
2292
|
+
}
|
|
2293
|
+
function disablePastDates(date) {
|
|
2294
|
+
const today = startOfDay(new Date());
|
|
2295
|
+
return isBeforeDay(date, today);
|
|
2296
|
+
}
|
|
2297
|
+
function disableFutureDates(date) {
|
|
2298
|
+
const today = endOfDay(new Date());
|
|
2299
|
+
return isAfterDay(date, today);
|
|
2300
|
+
}
|
|
2301
|
+
function disableDaysOfWeek(days) {
|
|
2302
|
+
return (date) => days.includes(getDayOfWeek(date));
|
|
2303
|
+
}
|
|
2304
|
+
function disableDateRange(startDate, endDate) {
|
|
2305
|
+
return (date) => isWithinDayRange(date, startDate, endDate);
|
|
2306
|
+
}
|
|
2307
|
+
function getDaysInMonth(year, month) {
|
|
2308
|
+
return new Date(year, month + 1, 0).getDate();
|
|
2309
|
+
}
|
|
2310
|
+
function getLocaleDefaultDateFormat(locale) {
|
|
2311
|
+
try {
|
|
2312
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, {
|
|
2313
|
+
year: 'numeric',
|
|
2314
|
+
month: '2-digit',
|
|
2315
|
+
day: '2-digit'
|
|
2316
|
+
});
|
|
2317
|
+
const parts = formatter.formatToParts(new Date(2024, 11, 31));
|
|
2318
|
+
const order = parts
|
|
2319
|
+
.filter((p) => p.type === 'year' || p.type === 'month' || p.type === 'day')
|
|
2320
|
+
.map((p) => p.type);
|
|
2321
|
+
const sep = (parts.find((p) => p.type === 'literal' && p.value.trim() !== '') || { value: '/' }).value;
|
|
2322
|
+
const tokens = { year: 'YYYY', month: 'MM', day: 'DD' };
|
|
2323
|
+
return order.map((t) => tokens[t]).join(sep);
|
|
2324
|
+
}
|
|
2325
|
+
catch {
|
|
2326
|
+
return 'YYYY-MM-DD';
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
function formatMonthTitle(date, locale) {
|
|
2330
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { month: 'long' });
|
|
2331
|
+
const str = formatter.format(date);
|
|
2332
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2333
|
+
}
|
|
2334
|
+
function getMonthNames(locale, format = 'short') {
|
|
2335
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { month: format });
|
|
2336
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
2337
|
+
const date = new Date(2024, i, 1);
|
|
2338
|
+
const name = formatter.format(date);
|
|
2339
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
function getWeekdayNames(locale, firstDayOfWeek = 0, format = 'short') {
|
|
2343
|
+
const formatter = new Intl.DateTimeFormat(locale || undefined, { weekday: format });
|
|
2344
|
+
const daysFromMonday = Array.from({ length: 7 }, (_, i) => {
|
|
2345
|
+
const date = new Date(2024, 0, 1 + i);
|
|
2346
|
+
const name = formatter.format(date);
|
|
2347
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
2348
|
+
});
|
|
2349
|
+
const offset = ((firstDayOfWeek % 7) + 7) % 7;
|
|
2350
|
+
return [...daysFromMonday.slice(offset), ...daysFromMonday.slice(0, offset)];
|
|
2351
|
+
}
|
|
2352
|
+
function createCalendarGrid(viewDate, firstDayOfWeek = 0) {
|
|
2353
|
+
const year = viewDate.getFullYear();
|
|
2354
|
+
const month = viewDate.getMonth();
|
|
2355
|
+
const firstDayOfMonth = new Date(year, month, 1);
|
|
2356
|
+
const startingDay = (getDayOfWeek(firstDayOfMonth) - (firstDayOfWeek % 7) + 7) % 7;
|
|
2357
|
+
const startDate = new Date(year, month, 1 - startingDay);
|
|
2358
|
+
const days = [];
|
|
2359
|
+
for (let i = 0; i < 42; i++) {
|
|
2360
|
+
const current = new Date(startDate);
|
|
2361
|
+
current.setDate(startDate.getDate() + i);
|
|
2362
|
+
days.push(current);
|
|
2363
|
+
}
|
|
2364
|
+
return days;
|
|
2365
|
+
}
|
|
2366
|
+
function formatDate(date, formatStr = 'YYYY-MM-DD') {
|
|
2367
|
+
if (!date || isNaN(date.getTime()))
|
|
2368
|
+
return '';
|
|
2369
|
+
const year = date.getFullYear();
|
|
2370
|
+
const month = date.getMonth() + 1;
|
|
2371
|
+
const day = date.getDate();
|
|
2372
|
+
const hours24 = date.getHours();
|
|
2373
|
+
const hours12 = hours24 % 12 || 12;
|
|
2374
|
+
const minutes = date.getMinutes();
|
|
2375
|
+
const seconds = date.getSeconds();
|
|
2376
|
+
const isPM = hours24 >= 12;
|
|
2377
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
2378
|
+
return formatStr
|
|
2379
|
+
.replace(/YYYY/g, year.toString())
|
|
2380
|
+
.replace(/YY/g, (year % 100).toString().padStart(2, '0'))
|
|
2381
|
+
.replace(/MM/g, pad(month))
|
|
2382
|
+
.replace(/\bM\b/g, month.toString())
|
|
2383
|
+
.replace(/DD/g, pad(day))
|
|
2384
|
+
.replace(/\bD\b/g, day.toString())
|
|
2385
|
+
.replace(/HH/g, pad(hours24))
|
|
2386
|
+
.replace(/\bH\b/g, hours24.toString())
|
|
2387
|
+
.replace(/hh/g, pad(hours12))
|
|
2388
|
+
.replace(/\bh\b/g, hours12.toString())
|
|
2389
|
+
.replace(/mm/g, pad(minutes))
|
|
2390
|
+
.replace(/\bm\b/g, minutes.toString())
|
|
2391
|
+
.replace(/ss/g, pad(seconds))
|
|
2392
|
+
.replace(/\bs\b/g, seconds.toString())
|
|
2393
|
+
.replace(/A/g, isPM ? 'PM' : 'AM')
|
|
2394
|
+
.replace(/a/g, isPM ? 'pm' : 'am');
|
|
2395
|
+
}
|
|
2396
|
+
function parseDate(str, formatStr = 'YYYY-MM-DD') {
|
|
2397
|
+
if (!str || !str.trim())
|
|
2398
|
+
return null;
|
|
2399
|
+
const trimmed = str.trim();
|
|
2400
|
+
const tokenMap = {
|
|
2401
|
+
YYYY: '(?<year>\\d{4})',
|
|
2402
|
+
YY: '(?<shortYear>\\d{2})',
|
|
2403
|
+
MM: '(?<month>\\d{1,2})',
|
|
2404
|
+
M: '(?<month>\\d{1,2})',
|
|
2405
|
+
DD: '(?<day>\\d{1,2})',
|
|
2406
|
+
D: '(?<day>\\d{1,2})',
|
|
2407
|
+
HH: '(?<hours24>\\d{1,2})',
|
|
2408
|
+
H: '(?<hours24>\\d{1,2})',
|
|
2409
|
+
hh: '(?<hours12>\\d{1,2})',
|
|
2410
|
+
h: '(?<hours12>\\d{1,2})',
|
|
2411
|
+
mm: '(?<minutes>\\d{1,2})',
|
|
2412
|
+
m: '(?<minutes>\\d{1,2})',
|
|
2413
|
+
ss: '(?<seconds>\\d{1,2})',
|
|
2414
|
+
s: '(?<seconds>\\d{1,2})',
|
|
2415
|
+
A: '(?<meridiem>AM|PM|am|pm)',
|
|
2416
|
+
a: '(?<meridiem>AM|PM|am|pm)'
|
|
2417
|
+
};
|
|
2418
|
+
const tokenPattern = /YYYY|YY|MM|\bM\b|DD|\bD\b|HH|\bH\b|hh|\bh\b|mm|\bm\b|ss|\bs\b|A|a/g;
|
|
2419
|
+
let lastIndex = 0;
|
|
2420
|
+
let regexSource = '^';
|
|
2421
|
+
let match;
|
|
2422
|
+
while ((match = tokenPattern.exec(formatStr)) !== null) {
|
|
2423
|
+
const literal = formatStr.slice(lastIndex, match.index);
|
|
2424
|
+
regexSource += literal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2425
|
+
const token = match[0];
|
|
2426
|
+
regexSource += tokenMap[token] || token;
|
|
2427
|
+
lastIndex = tokenPattern.lastIndex;
|
|
2428
|
+
}
|
|
2429
|
+
const trailingLiteral = formatStr.slice(lastIndex);
|
|
2430
|
+
regexSource += trailingLiteral.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '$';
|
|
2431
|
+
const reg = new RegExp(regexSource, 'i');
|
|
2432
|
+
const resultMatch = reg.exec(trimmed);
|
|
2433
|
+
if (!resultMatch || !resultMatch.groups) {
|
|
2434
|
+
const fallback = new Date(trimmed);
|
|
2435
|
+
return isNaN(fallback.getTime()) ? null : fallback;
|
|
2436
|
+
}
|
|
2437
|
+
const groups = resultMatch.groups;
|
|
2438
|
+
const year = groups['year']
|
|
2439
|
+
? parseInt(groups['year'], 10)
|
|
2440
|
+
: groups['shortYear']
|
|
2441
|
+
? 2000 + parseInt(groups['shortYear'], 10)
|
|
2442
|
+
: new Date().getFullYear();
|
|
2443
|
+
const month = groups['month'] ? parseInt(groups['month'], 10) - 1 : 0;
|
|
2444
|
+
const day = groups['day'] ? parseInt(groups['day'], 10) : 1;
|
|
2445
|
+
let hours = 0;
|
|
2446
|
+
if (groups['hours24']) {
|
|
2447
|
+
hours = parseInt(groups['hours24'], 10);
|
|
2448
|
+
}
|
|
2449
|
+
else if (groups['hours12']) {
|
|
2450
|
+
hours = parseInt(groups['hours12'], 10);
|
|
2451
|
+
const meridiem = (groups['meridiem'] || '').toUpperCase();
|
|
2452
|
+
if (meridiem === 'PM' && hours < 12)
|
|
2453
|
+
hours += 12;
|
|
2454
|
+
if (meridiem === 'AM' && hours === 12)
|
|
2455
|
+
hours = 0;
|
|
2456
|
+
}
|
|
2457
|
+
const minutes = groups['minutes'] ? parseInt(groups['minutes'], 10) : 0;
|
|
2458
|
+
const seconds = groups['seconds'] ? parseInt(groups['seconds'], 10) : 0;
|
|
2459
|
+
const result = new Date(year, month, day, hours, minutes, seconds);
|
|
2460
|
+
if (result.getFullYear() !== year ||
|
|
2461
|
+
result.getMonth() !== month ||
|
|
2462
|
+
result.getDate() !== day) {
|
|
2463
|
+
return null;
|
|
2464
|
+
}
|
|
2465
|
+
return result;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
class StrataCalendarComponent {
|
|
2469
|
+
mode = input('single', /* @ts-ignore */
|
|
2470
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
2471
|
+
size = input('md', /* @ts-ignore */
|
|
2472
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2473
|
+
locale = input(undefined, /* @ts-ignore */
|
|
2474
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2475
|
+
value = model(null, /* @ts-ignore */
|
|
2476
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2477
|
+
rangeValue = model(null, /* @ts-ignore */
|
|
2478
|
+
...(ngDevMode ? [{ debugName: "rangeValue" }] : /* istanbul ignore next */ []));
|
|
2479
|
+
viewDate = model(new Date(), /* @ts-ignore */
|
|
2480
|
+
...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
2481
|
+
minDate = input(null, /* @ts-ignore */
|
|
2482
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
2483
|
+
maxDate = input(null, /* @ts-ignore */
|
|
2484
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
2485
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
2486
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
2487
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
2488
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
2489
|
+
showAdjacentMonths = input(true, /* @ts-ignore */
|
|
2490
|
+
...(ngDevMode ? [{ debugName: "showAdjacentMonths" }] : /* istanbul ignore next */ []));
|
|
2491
|
+
disabled = input(false, /* @ts-ignore */
|
|
2492
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2493
|
+
dateSelected = output();
|
|
2494
|
+
rangeSelected = output();
|
|
2495
|
+
view = signal('days', /* @ts-ignore */
|
|
2496
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
2497
|
+
hoverDate = signal(null, /* @ts-ignore */
|
|
2498
|
+
...(ngDevMode ? [{ debugName: "hoverDate" }] : /* istanbul ignore next */ []));
|
|
2499
|
+
focusedDate = signal(new Date(), /* @ts-ignore */
|
|
2500
|
+
...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
|
|
2501
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2502
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2503
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2504
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2505
|
+
onChange = () => undefined;
|
|
2506
|
+
onTouched = () => undefined;
|
|
2507
|
+
ngOnInit() {
|
|
2508
|
+
if (this.mode() === 'single') {
|
|
2509
|
+
const v = this.value();
|
|
2510
|
+
if (v && !isNaN(v.getTime())) {
|
|
2511
|
+
this.viewDate.set(new Date(v));
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
weekdays = computed(() => {
|
|
2516
|
+
return getWeekdayNames(this.locale(), this.firstDayOfWeek(), 'short');
|
|
2517
|
+
}, /* @ts-ignore */
|
|
2518
|
+
...(ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []));
|
|
2519
|
+
currentMonthName = computed(() => {
|
|
2520
|
+
return formatMonthTitle(this.viewDate(), this.locale());
|
|
2521
|
+
}, /* @ts-ignore */
|
|
2522
|
+
...(ngDevMode ? [{ debugName: "currentMonthName" }] : /* istanbul ignore next */ []));
|
|
2523
|
+
currentYear = computed(() => {
|
|
2524
|
+
return this.viewDate().getFullYear();
|
|
2525
|
+
}, /* @ts-ignore */
|
|
2526
|
+
...(ngDevMode ? [{ debugName: "currentYear" }] : /* istanbul ignore next */ []));
|
|
2527
|
+
yearRangeStart = computed(() => {
|
|
2528
|
+
const y = this.viewDate().getFullYear();
|
|
2529
|
+
return Math.floor(y / 12) * 12;
|
|
2530
|
+
}, /* @ts-ignore */
|
|
2531
|
+
...(ngDevMode ? [{ debugName: "yearRangeStart" }] : /* istanbul ignore next */ []));
|
|
2532
|
+
yearsList = computed(() => {
|
|
2533
|
+
const start = this.yearRangeStart();
|
|
2534
|
+
const list = [];
|
|
2535
|
+
for (let i = 0; i < 12; i++) {
|
|
2536
|
+
list.push(start + i);
|
|
2537
|
+
}
|
|
2538
|
+
return list;
|
|
2539
|
+
}, /* @ts-ignore */
|
|
2540
|
+
...(ngDevMode ? [{ debugName: "yearsList" }] : /* istanbul ignore next */ []));
|
|
2541
|
+
monthsList = computed(() => {
|
|
2542
|
+
return getMonthNames(this.locale(), 'short');
|
|
2543
|
+
}, /* @ts-ignore */
|
|
2544
|
+
...(ngDevMode ? [{ debugName: "monthsList" }] : /* istanbul ignore next */ []));
|
|
2545
|
+
calendarGrid = computed(() => {
|
|
2546
|
+
const vDate = this.viewDate();
|
|
2547
|
+
const rawGrid = createCalendarGrid(vDate, this.firstDayOfWeek());
|
|
2548
|
+
const today = new Date();
|
|
2549
|
+
const min = this.minDate();
|
|
2550
|
+
const max = this.maxDate();
|
|
2551
|
+
const disabledProp = this.disabledDates();
|
|
2552
|
+
const selectedVal = this.value();
|
|
2553
|
+
const range = this.rangeValue();
|
|
2554
|
+
const hover = this.hoverDate();
|
|
2555
|
+
const isRangeMode = this.mode() === 'range';
|
|
2556
|
+
return rawGrid.map((d) => {
|
|
2557
|
+
const isCurrentMonth = isSameMonth(d, vDate);
|
|
2558
|
+
const isToday = isSameDay(d, today);
|
|
2559
|
+
let isDisabled = false;
|
|
2560
|
+
if (min && isBeforeDay(d, min)) {
|
|
2561
|
+
isDisabled = true;
|
|
2562
|
+
}
|
|
2563
|
+
if (max && isAfterDay(d, max)) {
|
|
2564
|
+
isDisabled = true;
|
|
2565
|
+
}
|
|
2566
|
+
if (disabledProp) {
|
|
2567
|
+
if (typeof disabledProp === 'function') {
|
|
2568
|
+
isDisabled = isDisabled || disabledProp(d);
|
|
2569
|
+
}
|
|
2570
|
+
else if (Array.isArray(disabledProp)) {
|
|
2571
|
+
isDisabled = isDisabled || disabledProp.some((disabledD) => isSameDay(disabledD, d));
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
let isSelected = false;
|
|
2575
|
+
let isRangeStart = false;
|
|
2576
|
+
let isRangeEnd = false;
|
|
2577
|
+
let isInRange = false;
|
|
2578
|
+
let isRangeHover = false;
|
|
2579
|
+
if (!isRangeMode) {
|
|
2580
|
+
isSelected = isSameDay(d, selectedVal);
|
|
2581
|
+
}
|
|
2582
|
+
else {
|
|
2583
|
+
const rStart = range?.start;
|
|
2584
|
+
const rEnd = range?.end;
|
|
2585
|
+
if (rStart && rEnd) {
|
|
2586
|
+
isRangeStart = isSameDay(d, rStart);
|
|
2587
|
+
isRangeEnd = isSameDay(d, rEnd);
|
|
2588
|
+
isInRange = isWithinDayRange(d, rStart, rEnd) && !isRangeStart && !isRangeEnd;
|
|
2589
|
+
isSelected = isRangeStart || isRangeEnd;
|
|
2590
|
+
}
|
|
2591
|
+
else if (rStart && !rEnd) {
|
|
2592
|
+
if (!hover || isSameDay(rStart, hover)) {
|
|
2593
|
+
isRangeStart = isSameDay(d, rStart);
|
|
2594
|
+
isRangeEnd = isSameDay(d, rStart);
|
|
2595
|
+
isSelected = isRangeStart;
|
|
2596
|
+
}
|
|
2597
|
+
else {
|
|
2598
|
+
const isHoverBefore = isBeforeDay(hover, rStart);
|
|
2599
|
+
const actualStart = isHoverBefore ? hover : rStart;
|
|
2600
|
+
const actualEnd = isHoverBefore ? rStart : hover;
|
|
2601
|
+
isRangeStart = isSameDay(d, actualStart);
|
|
2602
|
+
isRangeEnd = isSameDay(d, actualEnd);
|
|
2603
|
+
isInRange = isWithinDayRange(d, actualStart, actualEnd) && !isRangeStart && !isRangeEnd;
|
|
2604
|
+
isRangeHover = isInRange;
|
|
2605
|
+
isSelected = isRangeStart || isRangeEnd;
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
return {
|
|
2610
|
+
date: d,
|
|
2611
|
+
dayNumber: d.getDate(),
|
|
2612
|
+
isCurrentMonth,
|
|
2613
|
+
isToday,
|
|
2614
|
+
isSelected,
|
|
2615
|
+
isDisabled,
|
|
2616
|
+
isRangeStart,
|
|
2617
|
+
isRangeEnd,
|
|
2618
|
+
isInRange,
|
|
2619
|
+
isRangeHover
|
|
2620
|
+
};
|
|
2621
|
+
});
|
|
2622
|
+
}, /* @ts-ignore */
|
|
2623
|
+
...(ngDevMode ? [{ debugName: "calendarGrid" }] : /* istanbul ignore next */ []));
|
|
2624
|
+
onPrevClick() {
|
|
2625
|
+
if (this.effectiveDisabled())
|
|
2626
|
+
return;
|
|
2627
|
+
const current = this.viewDate();
|
|
2628
|
+
const v = this.view();
|
|
2629
|
+
if (v === 'days') {
|
|
2630
|
+
this.viewDate.set(addMonths(current, -1));
|
|
2631
|
+
}
|
|
2632
|
+
else if (v === 'months') {
|
|
2633
|
+
this.viewDate.set(addYears(current, -1));
|
|
2634
|
+
}
|
|
2635
|
+
else if (v === 'years') {
|
|
2636
|
+
this.viewDate.set(addYears(current, -12));
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
onNextClick() {
|
|
2640
|
+
if (this.effectiveDisabled())
|
|
2641
|
+
return;
|
|
2642
|
+
const current = this.viewDate();
|
|
2643
|
+
const v = this.view();
|
|
2644
|
+
if (v === 'days') {
|
|
2645
|
+
this.viewDate.set(addMonths(current, 1));
|
|
2646
|
+
}
|
|
2647
|
+
else if (v === 'months') {
|
|
2648
|
+
this.viewDate.set(addYears(current, 1));
|
|
2649
|
+
}
|
|
2650
|
+
else if (v === 'years') {
|
|
2651
|
+
this.viewDate.set(addYears(current, 12));
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
toggleView() {
|
|
2655
|
+
if (this.effectiveDisabled())
|
|
2656
|
+
return;
|
|
2657
|
+
const v = this.view();
|
|
2658
|
+
if (v === 'days') {
|
|
2659
|
+
this.view.set('months');
|
|
2660
|
+
}
|
|
2661
|
+
else if (v === 'months') {
|
|
2662
|
+
this.view.set('years');
|
|
2663
|
+
}
|
|
2664
|
+
else {
|
|
2665
|
+
this.view.set('days');
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
selectMonth(monthIndex) {
|
|
2669
|
+
if (this.effectiveDisabled())
|
|
2670
|
+
return;
|
|
2671
|
+
const current = this.viewDate();
|
|
2672
|
+
const next = new Date(current.getFullYear(), monthIndex, 1);
|
|
2673
|
+
this.viewDate.set(next);
|
|
2674
|
+
this.view.set('days');
|
|
2675
|
+
}
|
|
2676
|
+
selectYear(year) {
|
|
2677
|
+
if (this.effectiveDisabled())
|
|
2678
|
+
return;
|
|
2679
|
+
const current = this.viewDate();
|
|
2680
|
+
const next = new Date(year, current.getMonth(), 1);
|
|
2681
|
+
this.viewDate.set(next);
|
|
2682
|
+
this.view.set('months');
|
|
2683
|
+
}
|
|
2684
|
+
onDayClick(cell) {
|
|
2685
|
+
if (this.effectiveDisabled() || cell.isDisabled)
|
|
2686
|
+
return;
|
|
2687
|
+
if (!cell.isCurrentMonth) {
|
|
2688
|
+
this.viewDate.set(cell.date);
|
|
2689
|
+
}
|
|
2690
|
+
if (this.mode() === 'single') {
|
|
2691
|
+
const selected = new Date(cell.date);
|
|
2692
|
+
this.value.set(selected);
|
|
2693
|
+
this.dateSelected.emit(selected);
|
|
2694
|
+
this.onChange(selected);
|
|
2695
|
+
this.onTouched();
|
|
2696
|
+
}
|
|
2697
|
+
else {
|
|
2698
|
+
const currentRange = this.rangeValue();
|
|
2699
|
+
if (!currentRange || !currentRange.start || (currentRange.start && currentRange.end)) {
|
|
2700
|
+
const nextRange = { start: new Date(cell.date), end: null };
|
|
2701
|
+
this.rangeValue.set(nextRange);
|
|
2702
|
+
this.rangeSelected.emit(nextRange);
|
|
2703
|
+
this.onChange(nextRange);
|
|
2704
|
+
}
|
|
2705
|
+
else {
|
|
2706
|
+
let start = currentRange.start;
|
|
2707
|
+
let end = new Date(cell.date);
|
|
2708
|
+
if (isBeforeDay(end, start)) {
|
|
2709
|
+
const temp = start;
|
|
2710
|
+
start = end;
|
|
2711
|
+
end = temp;
|
|
2712
|
+
}
|
|
2713
|
+
const nextRange = { start, end };
|
|
2714
|
+
this.rangeValue.set(nextRange);
|
|
2715
|
+
this.rangeSelected.emit(nextRange);
|
|
2716
|
+
this.onChange(nextRange);
|
|
2717
|
+
this.onTouched();
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
onDayHover(cell) {
|
|
2722
|
+
if (this.mode() === 'range' && this.rangeValue()?.start && !this.rangeValue()?.end) {
|
|
2723
|
+
this.hoverDate.set(cell.date);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
onDayKeyDown(event, cell) {
|
|
2727
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
2728
|
+
event.preventDefault();
|
|
2729
|
+
this.onDayClick(cell);
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
writeValue(val) {
|
|
2733
|
+
if (this.mode() === 'single') {
|
|
2734
|
+
const d = val instanceof Date ? val : null;
|
|
2735
|
+
this.value.set(d);
|
|
2736
|
+
if (d) {
|
|
2737
|
+
this.viewDate.set(new Date(d));
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
else {
|
|
2741
|
+
const range = val && typeof val === 'object' && 'start' in val ? val : null;
|
|
2742
|
+
this.rangeValue.set(range);
|
|
2743
|
+
if (range?.start) {
|
|
2744
|
+
this.viewDate.set(new Date(range.start));
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
registerOnChange(fn) {
|
|
2749
|
+
this.onChange = fn;
|
|
2750
|
+
}
|
|
2751
|
+
registerOnTouched(fn) {
|
|
2752
|
+
this.onTouched = fn;
|
|
2753
|
+
}
|
|
2754
|
+
setDisabledState(isDisabled) {
|
|
2755
|
+
this.cvaDisabled.set(isDisabled);
|
|
2756
|
+
}
|
|
2757
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2758
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataCalendarComponent, isStandalone: true, selector: "st-calendar", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rangeValue: { classPropertyName: "rangeValue", publicName: "rangeValue", isSignal: true, isRequired: false, transformFunction: null }, viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, showAdjacentMonths: { classPropertyName: "showAdjacentMonths", publicName: "showAdjacentMonths", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rangeValue: "rangeValueChange", viewDate: "viewDateChange", dateSelected: "dateSelected", rangeSelected: "rangeSelected" }, host: { properties: { "class.st-calendar": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null" } }, providers: [
|
|
2759
|
+
{
|
|
2760
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2761
|
+
useExisting: forwardRef(() => StrataCalendarComponent),
|
|
2762
|
+
multi: true
|
|
2763
|
+
}
|
|
2764
|
+
], ngImport: i0, template: "<div class=\"st-calendar-container\">\n <div class=\"st-calendar-header\">\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onPrevClick()\"\n aria-label=\"Previous\"\n >\n <st-icon name=\"arrow-left\" size=\"sm\"></st-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-title-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleView()\"\n >\n @if (view() === 'days') {\n {{ currentMonthName() }} {{ currentYear() }}\n } @else if (view() === 'months') {\n {{ currentYear() }}\n } @else {\n {{ yearRangeStart() }} - {{ yearRangeStart() + 11 }}\n }\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNextClick()\"\n aria-label=\"Next\"\n >\n <st-icon name=\"arrow-right\" size=\"sm\"></st-icon>\n </button>\n </div>\n\n <div class=\"st-calendar-body\">\n @if (view() === 'days') {\n <div class=\"st-calendar-weekdays\" role=\"row\">\n @for (day of weekdays(); track day) {\n <span class=\"st-calendar-weekday\" role=\"columnheader\">{{ day }}</span>\n }\n </div>\n\n <div class=\"st-calendar-days-grid\" role=\"grid\">\n @for (cell of calendarGrid(); track cell.date.toISOString()) {\n <button\n type=\"button\"\n class=\"st-calendar-day\"\n [class.st-adjacent]=\"!cell.isCurrentMonth\"\n [class.st-today]=\"cell.isToday\"\n [class.st-selected]=\"cell.isSelected\"\n [class.st-range-start]=\"cell.isRangeStart\"\n [class.st-range-end]=\"cell.isRangeEnd\"\n [class.st-in-range]=\"cell.isInRange\"\n [class.st-range-hover]=\"cell.isRangeHover\"\n [disabled]=\"cell.isDisabled || effectiveDisabled()\"\n [attr.aria-selected]=\"cell.isSelected\"\n [attr.aria-disabled]=\"cell.isDisabled\"\n (click)=\"onDayClick(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n (keydown)=\"onDayKeyDown($event, cell)\"\n >\n <span class=\"st-day-content\">{{ cell.dayNumber }}</span>\n </button>\n }\n </div>\n } @else if (view() === 'months') {\n <div class=\"st-calendar-grid-months\">\n @for (m of monthsList(); track m; let i = $index) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getMonth() === i\"\n (click)=\"selectMonth(i)\"\n >\n {{ m }}\n </button>\n }\n </div>\n } @else {\n <div class=\"st-calendar-grid-years\">\n @for (y of yearsList(); track y) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getFullYear() === y\"\n (click)=\"selectYear(y)\"\n >\n {{ y }}\n </button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--st-cal-size: 36px;display:inline-block;box-sizing:border-box}:host.st-size-sm{--st-cal-size: 30px}:host.st-size-lg{--st-cal-size: 42px}:host.st-disabled{opacity:.55;pointer-events:none}.st-calendar-container{display:flex;flex-direction:column;background:transparent;width:calc(var(--st-cal-size) * 7);box-sizing:border-box;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-calendar-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--st-space-2)}.st-cal-title-btn{background:transparent;border:none;font:inherit;font-weight:var(--st-font-weight-semibold);font-size:var(--st-font-md);color:var(--st-color-text-primary);padding:var(--st-space-1) var(--st-space-2);border-radius:var(--st-border-radius-sm);cursor:pointer;transition:background var(--st-transition-fast)}.st-cal-title-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-cal-title-btn:disabled{opacity:.5;cursor:not-allowed}.st-cal-nav-btn{background:transparent;border:none;width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--st-border-radius-sm);color:var(--st-color-text-secondary);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-cal-nav-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-cal-nav-btn:disabled{opacity:.3;cursor:not-allowed}.st-calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;margin-bottom:var(--st-space-1)}.st-calendar-weekday{font-size:.75rem;font-weight:var(--st-font-weight-semibold);text-transform:uppercase;letter-spacing:.05em;color:var(--st-color-text-tertiary);height:24px;display:flex;align-items:center;justify-content:center}.st-calendar-days-grid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}.st-calendar-day{appearance:none;background:transparent;border:none;border-radius:var(--st-border-radius-md);height:var(--st-cal-size);width:100%;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;outline:none;padding:0;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-day:hover:not(:disabled):not(.st-selected):not(.st-range-start):not(.st-range-end){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-day:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);z-index:2}.st-calendar-day.st-adjacent{color:var(--st-color-text-tertiary);opacity:.45}.st-calendar-day.st-today:after{content:\"\";position:absolute;bottom:3px;width:4px;height:4px;border-radius:var(--st-border-radius-full);background:var(--st-color-accent-default)}.st-calendar-day.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md)}.st-calendar-day.st-range-start{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md) 0 0 var(--st-border-radius-md)}.st-calendar-day.st-range-end{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:0 var(--st-border-radius-md) var(--st-border-radius-md) 0}.st-calendar-day.st-range-start.st-range-end{border-radius:var(--st-border-radius-md)}.st-calendar-day.st-in-range,.st-calendar-day.st-range-hover{background:var(--st-color-accent-subtle);color:var(--st-color-accent-text, var(--st-color-text-primary));border-radius:0}.st-calendar-day:disabled{opacity:.3;cursor:not-allowed}.st-calendar-grid-months,.st-calendar-grid-years{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--st-space-2);padding:var(--st-space-2) 0}.st-calendar-choice-btn{background:transparent;border:none;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);height:40px;border-radius:var(--st-border-radius-md);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-choice-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-choice-btn.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }] });
|
|
2765
|
+
}
|
|
2766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataCalendarComponent, decorators: [{
|
|
2767
|
+
type: Component,
|
|
2768
|
+
args: [{ selector: 'st-calendar', imports: [
|
|
2769
|
+
CommonModule,
|
|
2770
|
+
StrataIconComponent
|
|
2771
|
+
], providers: [
|
|
2772
|
+
{
|
|
2773
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2774
|
+
useExisting: forwardRef(() => StrataCalendarComponent),
|
|
2775
|
+
multi: true
|
|
2776
|
+
}
|
|
2777
|
+
], host: {
|
|
2778
|
+
'[class.st-calendar]': 'true',
|
|
2779
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
2780
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
2781
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
2782
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null'
|
|
2783
|
+
}, template: "<div class=\"st-calendar-container\">\n <div class=\"st-calendar-header\">\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onPrevClick()\"\n aria-label=\"Previous\"\n >\n <st-icon name=\"arrow-left\" size=\"sm\"></st-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-title-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"toggleView()\"\n >\n @if (view() === 'days') {\n {{ currentMonthName() }} {{ currentYear() }}\n } @else if (view() === 'months') {\n {{ currentYear() }}\n } @else {\n {{ yearRangeStart() }} - {{ yearRangeStart() + 11 }}\n }\n </button>\n\n <button\n type=\"button\"\n class=\"st-cal-nav-btn\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNextClick()\"\n aria-label=\"Next\"\n >\n <st-icon name=\"arrow-right\" size=\"sm\"></st-icon>\n </button>\n </div>\n\n <div class=\"st-calendar-body\">\n @if (view() === 'days') {\n <div class=\"st-calendar-weekdays\" role=\"row\">\n @for (day of weekdays(); track day) {\n <span class=\"st-calendar-weekday\" role=\"columnheader\">{{ day }}</span>\n }\n </div>\n\n <div class=\"st-calendar-days-grid\" role=\"grid\">\n @for (cell of calendarGrid(); track cell.date.toISOString()) {\n <button\n type=\"button\"\n class=\"st-calendar-day\"\n [class.st-adjacent]=\"!cell.isCurrentMonth\"\n [class.st-today]=\"cell.isToday\"\n [class.st-selected]=\"cell.isSelected\"\n [class.st-range-start]=\"cell.isRangeStart\"\n [class.st-range-end]=\"cell.isRangeEnd\"\n [class.st-in-range]=\"cell.isInRange\"\n [class.st-range-hover]=\"cell.isRangeHover\"\n [disabled]=\"cell.isDisabled || effectiveDisabled()\"\n [attr.aria-selected]=\"cell.isSelected\"\n [attr.aria-disabled]=\"cell.isDisabled\"\n (click)=\"onDayClick(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n (keydown)=\"onDayKeyDown($event, cell)\"\n >\n <span class=\"st-day-content\">{{ cell.dayNumber }}</span>\n </button>\n }\n </div>\n } @else if (view() === 'months') {\n <div class=\"st-calendar-grid-months\">\n @for (m of monthsList(); track m; let i = $index) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getMonth() === i\"\n (click)=\"selectMonth(i)\"\n >\n {{ m }}\n </button>\n }\n </div>\n } @else {\n <div class=\"st-calendar-grid-years\">\n @for (y of yearsList(); track y) {\n <button\n type=\"button\"\n class=\"st-calendar-choice-btn\"\n [class.st-selected]=\"viewDate().getFullYear() === y\"\n (click)=\"selectYear(y)\"\n >\n {{ y }}\n </button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--st-cal-size: 36px;display:inline-block;box-sizing:border-box}:host.st-size-sm{--st-cal-size: 30px}:host.st-size-lg{--st-cal-size: 42px}:host.st-disabled{opacity:.55;pointer-events:none}.st-calendar-container{display:flex;flex-direction:column;background:transparent;width:calc(var(--st-cal-size) * 7);box-sizing:border-box;color:var(--st-color-text-primary);-webkit-user-select:none;user-select:none}.st-calendar-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--st-space-2)}.st-cal-title-btn{background:transparent;border:none;font:inherit;font-weight:var(--st-font-weight-semibold);font-size:var(--st-font-md);color:var(--st-color-text-primary);padding:var(--st-space-1) var(--st-space-2);border-radius:var(--st-border-radius-sm);cursor:pointer;transition:background var(--st-transition-fast)}.st-cal-title-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-cal-title-btn:disabled{opacity:.5;cursor:not-allowed}.st-cal-nav-btn{background:transparent;border:none;width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--st-border-radius-sm);color:var(--st-color-text-secondary);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-cal-nav-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-cal-nav-btn:disabled{opacity:.3;cursor:not-allowed}.st-calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;margin-bottom:var(--st-space-1)}.st-calendar-weekday{font-size:.75rem;font-weight:var(--st-font-weight-semibold);text-transform:uppercase;letter-spacing:.05em;color:var(--st-color-text-tertiary);height:24px;display:flex;align-items:center;justify-content:center}.st-calendar-days-grid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}.st-calendar-day{appearance:none;background:transparent;border:none;border-radius:var(--st-border-radius-md);height:var(--st-cal-size);width:100%;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;outline:none;padding:0;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-day:hover:not(:disabled):not(.st-selected):not(.st-range-start):not(.st-range-end){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-day:focus-visible{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);z-index:2}.st-calendar-day.st-adjacent{color:var(--st-color-text-tertiary);opacity:.45}.st-calendar-day.st-today:after{content:\"\";position:absolute;bottom:3px;width:4px;height:4px;border-radius:var(--st-border-radius-full);background:var(--st-color-accent-default)}.st-calendar-day.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md)}.st-calendar-day.st-range-start{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:var(--st-border-radius-md) 0 0 var(--st-border-radius-md)}.st-calendar-day.st-range-end{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold);border-radius:0 var(--st-border-radius-md) var(--st-border-radius-md) 0}.st-calendar-day.st-range-start.st-range-end{border-radius:var(--st-border-radius-md)}.st-calendar-day.st-in-range,.st-calendar-day.st-range-hover{background:var(--st-color-accent-subtle);color:var(--st-color-accent-text, var(--st-color-text-primary));border-radius:0}.st-calendar-day:disabled{opacity:.3;cursor:not-allowed}.st-calendar-grid-months,.st-calendar-grid-years{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--st-space-2);padding:var(--st-space-2) 0}.st-calendar-choice-btn{background:transparent;border:none;font:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-primary);height:40px;border-radius:var(--st-border-radius-md);cursor:pointer;transition:background var(--st-transition-fast),color var(--st-transition-fast)}.st-calendar-choice-btn:hover:not(:disabled){background:var(--st-color-control-bg-hover, var(--st-color-bg-default))}.st-calendar-choice-btn.st-selected{background:var(--st-color-accent-default);color:var(--st-color-text-on-accent, #fff);font-weight:var(--st-font-weight-semibold)}\n"] }]
|
|
2784
|
+
}], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], rangeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeValue", required: false }] }, { type: i0.Output, args: ["rangeValueChange"] }], viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: false }] }, { type: i0.Output, args: ["viewDateChange"] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], showAdjacentMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAdjacentMonths", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dateSelected: [{ type: i0.Output, args: ["dateSelected"] }], rangeSelected: [{ type: i0.Output, args: ["rangeSelected"] }] } });
|
|
2785
|
+
|
|
2786
|
+
let nextUniqueDatePickerId = 0;
|
|
2787
|
+
class StrataDatePickerComponent {
|
|
2788
|
+
defaultId = `st-datepicker-${nextUniqueDatePickerId++}`;
|
|
2789
|
+
label = input(undefined, /* @ts-ignore */
|
|
2790
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2791
|
+
id = input(undefined, /* @ts-ignore */
|
|
2792
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2793
|
+
name = input(undefined, /* @ts-ignore */
|
|
2794
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2795
|
+
placeholder = input('Select date', /* @ts-ignore */
|
|
2796
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2797
|
+
format = input(undefined, /* @ts-ignore */
|
|
2798
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
2799
|
+
size = input('md', /* @ts-ignore */
|
|
2800
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2801
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
2802
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
2803
|
+
locale = input(undefined, /* @ts-ignore */
|
|
2804
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2805
|
+
calendarSize = computed(() => (this.size() === 'sm' ? 'sm' : 'md'), /* @ts-ignore */
|
|
2806
|
+
...(ngDevMode ? [{ debugName: "calendarSize" }] : /* istanbul ignore next */ []));
|
|
2807
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2808
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2809
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2810
|
+
fullWidth = input(false, { ...(ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2811
|
+
showTime = input(false, { ...(ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2812
|
+
timeFormat = input('24h', /* @ts-ignore */
|
|
2813
|
+
...(ngDevMode ? [{ debugName: "timeFormat" }] : /* istanbul ignore next */ []));
|
|
2814
|
+
showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2815
|
+
minuteStep = input(1, /* @ts-ignore */
|
|
2816
|
+
...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
2817
|
+
state = input(undefined, /* @ts-ignore */
|
|
2818
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2819
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2820
|
+
message = input(undefined, /* @ts-ignore */
|
|
2821
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
2822
|
+
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2823
|
+
minDate = input(null, /* @ts-ignore */
|
|
2824
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
2825
|
+
maxDate = input(null, /* @ts-ignore */
|
|
2826
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
2827
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
2828
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
2829
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
2830
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
2831
|
+
value = model(null, /* @ts-ignore */
|
|
2832
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2833
|
+
dateSelected = output();
|
|
2834
|
+
open = signal(false, /* @ts-ignore */
|
|
2835
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
2836
|
+
textInputValue = signal('', /* @ts-ignore */
|
|
2837
|
+
...(ngDevMode ? [{ debugName: "textInputValue" }] : /* istanbul ignore next */ []));
|
|
2838
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
2839
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
2840
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
2841
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
2842
|
+
effectiveId = computed(() => this.id() ?? this.name() ?? this.defaultId, /* @ts-ignore */
|
|
2843
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
2844
|
+
effectiveState = computed(() => {
|
|
2845
|
+
if (this.error()) {
|
|
2846
|
+
return 'error';
|
|
2847
|
+
}
|
|
2848
|
+
return this.state() ?? 'default';
|
|
2849
|
+
}, /* @ts-ignore */
|
|
2850
|
+
...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
|
|
2851
|
+
isMessageError = computed(() => this.effectiveState() === 'error' && this.colorMessage(), /* @ts-ignore */
|
|
2852
|
+
...(ngDevMode ? [{ debugName: "isMessageError" }] : /* istanbul ignore next */ []));
|
|
2853
|
+
isMessageSuccess = computed(() => this.effectiveState() === 'success' && this.colorMessage(), /* @ts-ignore */
|
|
2854
|
+
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
2855
|
+
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
2856
|
+
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
2857
|
+
onChange = () => undefined;
|
|
2858
|
+
onTouched = () => undefined;
|
|
2859
|
+
overlayDirective = viewChild(StrataOverlayDirective, /* @ts-ignore */
|
|
2860
|
+
...(ngDevMode ? [{ debugName: "overlayDirective" }] : /* istanbul ignore next */ []));
|
|
2861
|
+
elementRef = inject(ElementRef);
|
|
2862
|
+
renderer = inject(Renderer2);
|
|
2863
|
+
destroyRef = inject(DestroyRef);
|
|
2864
|
+
constructor() {
|
|
2865
|
+
const unlisten = this.renderer.listen('document', 'pointerdown', (event) => {
|
|
2866
|
+
if (!this.open())
|
|
2867
|
+
return;
|
|
2868
|
+
const target = event.target;
|
|
2869
|
+
if (!target)
|
|
2870
|
+
return;
|
|
2871
|
+
const hostEl = this.elementRef.nativeElement;
|
|
2872
|
+
const overlayEl = this.overlayDirective()?.getOverlayElement();
|
|
2873
|
+
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
2874
|
+
return;
|
|
2875
|
+
}
|
|
2876
|
+
this.open.set(false);
|
|
2877
|
+
});
|
|
2878
|
+
this.destroyRef.onDestroy(() => unlisten());
|
|
2879
|
+
}
|
|
2880
|
+
toggle(event) {
|
|
2881
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2882
|
+
return;
|
|
2883
|
+
if (event) {
|
|
2884
|
+
event.preventDefault();
|
|
2885
|
+
event.stopPropagation();
|
|
2886
|
+
}
|
|
2887
|
+
this.open.set(!this.open());
|
|
2888
|
+
}
|
|
2889
|
+
onInputTextChange(value) {
|
|
2890
|
+
this.textInputValue.set(value);
|
|
2891
|
+
if (!value.trim()) {
|
|
2892
|
+
this.updateDateValue(null);
|
|
2893
|
+
return;
|
|
2894
|
+
}
|
|
2895
|
+
const parsed = parseDate(value, this.effectiveFormat());
|
|
2896
|
+
if (parsed) {
|
|
2897
|
+
this.updateDateValue(parsed);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
onInputBlur() {
|
|
2901
|
+
this.onTouched();
|
|
2902
|
+
const val = this.value();
|
|
2903
|
+
if (val) {
|
|
2904
|
+
this.textInputValue.set(formatDate(val, this.effectiveFormat()));
|
|
2905
|
+
}
|
|
2906
|
+
else {
|
|
2907
|
+
this.textInputValue.set('');
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
onCalendarDateSelected(date) {
|
|
2911
|
+
const prev = this.value();
|
|
2912
|
+
if (prev && this.showTime()) {
|
|
2913
|
+
date.setHours(prev.getHours(), prev.getMinutes(), prev.getSeconds());
|
|
2914
|
+
}
|
|
2915
|
+
this.updateDateValue(date);
|
|
2916
|
+
if (!this.showTime()) {
|
|
2917
|
+
this.open.set(false);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
onTimeSelected(val) {
|
|
2921
|
+
if (!val)
|
|
2922
|
+
return;
|
|
2923
|
+
const current = this.value() || new Date();
|
|
2924
|
+
const nextDate = new Date(current);
|
|
2925
|
+
if (val instanceof Date) {
|
|
2926
|
+
nextDate.setHours(val.getHours(), val.getMinutes(), val.getSeconds());
|
|
2927
|
+
}
|
|
2928
|
+
else {
|
|
2929
|
+
const parts = val.split(':');
|
|
2930
|
+
nextDate.setHours(parseInt(parts[0], 10) || 0);
|
|
2931
|
+
nextDate.setMinutes(parseInt(parts[1], 10) || 0);
|
|
2932
|
+
if (parts[2]) {
|
|
2933
|
+
nextDate.setSeconds(parseInt(parts[2], 10) || 0);
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
this.updateDateValue(nextDate);
|
|
2937
|
+
}
|
|
2938
|
+
clear(event) {
|
|
2939
|
+
event.stopPropagation();
|
|
2940
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
2941
|
+
return;
|
|
2942
|
+
this.updateDateValue(null);
|
|
2943
|
+
}
|
|
2944
|
+
effectiveFormat() {
|
|
2945
|
+
const explicit = this.format();
|
|
2946
|
+
const base = explicit || getLocaleDefaultDateFormat(this.locale());
|
|
2947
|
+
if (this.showTime()) {
|
|
2948
|
+
return this.timeFormat() === '12h'
|
|
2949
|
+
? this.showSeconds()
|
|
2950
|
+
? `${base} hh:mm:ss A`
|
|
2951
|
+
: `${base} hh:mm A`
|
|
2952
|
+
: this.showSeconds()
|
|
2953
|
+
? `${base} HH:mm:ss`
|
|
2954
|
+
: `${base} HH:mm`;
|
|
2955
|
+
}
|
|
2956
|
+
return base;
|
|
2957
|
+
}
|
|
2958
|
+
updateDateValue(date) {
|
|
2959
|
+
this.value.set(date);
|
|
2960
|
+
this.textInputValue.set(formatDate(date, this.effectiveFormat()));
|
|
2961
|
+
this.dateSelected.emit(date);
|
|
2962
|
+
this.onChange(date);
|
|
2963
|
+
this.onTouched();
|
|
2964
|
+
}
|
|
2965
|
+
writeValue(val) {
|
|
2966
|
+
let d = null;
|
|
2967
|
+
if (val instanceof Date) {
|
|
2968
|
+
d = val;
|
|
2969
|
+
}
|
|
2970
|
+
else if (typeof val === 'string') {
|
|
2971
|
+
d = parseDate(val, this.effectiveFormat());
|
|
2972
|
+
}
|
|
2973
|
+
this.value.set(d);
|
|
2974
|
+
this.textInputValue.set(formatDate(d, this.effectiveFormat()));
|
|
2975
|
+
}
|
|
2976
|
+
registerOnChange(fn) {
|
|
2977
|
+
this.onChange = fn;
|
|
2978
|
+
}
|
|
2979
|
+
registerOnTouched(fn) {
|
|
2980
|
+
this.onTouched = fn;
|
|
2981
|
+
}
|
|
2982
|
+
setDisabledState(isDisabled) {
|
|
2983
|
+
this.cvaDisabled.set(isDisabled);
|
|
2984
|
+
}
|
|
2985
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2986
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataDatePickerComponent, isStandalone: true, selector: "st-datepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", dateSelected: "dateSelected" }, host: { properties: { "class.st-datepicker": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null", "class.st-state-error": "effectiveState() === \"error\"", "class.st-state-success": "effectiveState() === \"success\"", "class.st-state-warning": "effectiveState() === \"warning\"", "class.st-error": "effectiveState() === \"error\"", "attr.aria-invalid": "effectiveState() === \"error\" ? \"true\" : null" } }, providers: [
|
|
2987
|
+
{
|
|
2988
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2989
|
+
useExisting: forwardRef(() => StrataDatePickerComponent),
|
|
2990
|
+
multi: true
|
|
2991
|
+
}
|
|
2992
|
+
], viewQueries: [{ propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"calendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #calendarOverlay>\n <div class=\"st-datepicker-dropdown\" [class.st-datepicker-with-time]=\"showTime()\">\n <st-calendar\n mode=\"single\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [value]=\"value()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (dateSelected)=\"onCalendarDateSelected($event)\"\n ></st-calendar>\n @if (showTime()) {\n <div class=\"st-datepicker-time-side\">\n <st-time-stepper\n [value]=\"value()\"\n [format]=\"timeFormat()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onTimeSelected($event)\"\n ></st-time-stepper>\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-datepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-datepicker-dropdown.st-datepicker-with-time{display:flex;align-items:stretch;gap:0;padding:0}.st-datepicker-dropdown.st-datepicker-with-time>st-calendar{padding:var(--st-space-3)}.st-datepicker-time-side{display:flex;align-items:center;justify-content:center;padding:var(--st-space-3) var(--st-space-4);border-left:1px solid var(--st-border-subtle)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport", "overlayTarget"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataCalendarComponent, selector: "st-calendar", inputs: ["mode", "size", "locale", "value", "rangeValue", "viewDate", "minDate", "maxDate", "disabledDates", "firstDayOfWeek", "showAdjacentMonths", "disabled"], outputs: ["valueChange", "rangeValueChange", "viewDateChange", "dateSelected", "rangeSelected"] }, { kind: "component", type: StrataTimeStepperComponent, selector: "st-time-stepper", inputs: ["format", "showSeconds", "minuteStep", "disabled", "value"], outputs: ["valueChange"] }] });
|
|
2993
|
+
}
|
|
2994
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDatePickerComponent, decorators: [{
|
|
2995
|
+
type: Component,
|
|
2996
|
+
args: [{ selector: 'st-datepicker', imports: [
|
|
2997
|
+
CommonModule,
|
|
2998
|
+
FormsModule,
|
|
2999
|
+
StrataIconComponent,
|
|
3000
|
+
StrataOverlayDirective,
|
|
3001
|
+
StrataCalendarComponent,
|
|
3002
|
+
StrataTimeStepperComponent
|
|
3003
|
+
], providers: [
|
|
3004
|
+
{
|
|
3005
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3006
|
+
useExisting: forwardRef(() => StrataDatePickerComponent),
|
|
3007
|
+
multi: true
|
|
3008
|
+
}
|
|
3009
|
+
], host: {
|
|
3010
|
+
'[class.st-datepicker]': 'true',
|
|
3011
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
3012
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
3013
|
+
'[class.st-size-lg]': 'size() === "lg"',
|
|
3014
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
3015
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
3016
|
+
'[class.st-state-error]': 'effectiveState() === "error"',
|
|
3017
|
+
'[class.st-state-success]': 'effectiveState() === "success"',
|
|
3018
|
+
'[class.st-state-warning]': 'effectiveState() === "warning"',
|
|
3019
|
+
'[class.st-error]': 'effectiveState() === "error"',
|
|
3020
|
+
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null'
|
|
3021
|
+
}, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"calendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #calendarOverlay>\n <div class=\"st-datepicker-dropdown\" [class.st-datepicker-with-time]=\"showTime()\">\n <st-calendar\n mode=\"single\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [value]=\"value()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (dateSelected)=\"onCalendarDateSelected($event)\"\n ></st-calendar>\n @if (showTime()) {\n <div class=\"st-datepicker-time-side\">\n <st-time-stepper\n [value]=\"value()\"\n [format]=\"timeFormat()\"\n [showSeconds]=\"showSeconds()\"\n [minuteStep]=\"minuteStep()\"\n [disabled]=\"effectiveDisabled()\"\n (valueChange)=\"onTimeSelected($event)\"\n ></st-time-stepper>\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-datepicker-dropdown{border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);background-color:var(--st-color-bg-raised);box-shadow:var(--st-shadow-2);padding:var(--st-space-3);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-datepicker-dropdown.st-datepicker-with-time{display:flex;align-items:stretch;gap:0;padding:0}.st-datepicker-dropdown.st-datepicker-with-time>st-calendar{padding:var(--st-space-3)}.st-datepicker-time-side{display:flex;align-items:center;justify-content:center;padding:var(--st-space-3) var(--st-space-4);border-left:1px solid var(--st-border-subtle)}\n"] }]
|
|
3022
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], dateSelected: [{ type: i0.Output, args: ["dateSelected"] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }] } });
|
|
3023
|
+
|
|
3024
|
+
let nextUniqueDateRangePickerId = 0;
|
|
3025
|
+
const DEFAULT_DATE_RANGE_PRESETS = [
|
|
3026
|
+
{
|
|
3027
|
+
label: 'Today',
|
|
3028
|
+
getRange: () => {
|
|
3029
|
+
const now = new Date();
|
|
3030
|
+
return { start: now, end: now };
|
|
3031
|
+
}
|
|
3032
|
+
},
|
|
3033
|
+
{
|
|
3034
|
+
label: 'Yesterday',
|
|
3035
|
+
getRange: () => {
|
|
3036
|
+
const yesterday = addDays(new Date(), -1);
|
|
3037
|
+
return { start: yesterday, end: yesterday };
|
|
3038
|
+
}
|
|
3039
|
+
},
|
|
3040
|
+
{
|
|
3041
|
+
label: 'Last 7 Days',
|
|
3042
|
+
getRange: () => {
|
|
3043
|
+
const now = new Date();
|
|
3044
|
+
return { start: addDays(now, -6), end: now };
|
|
3045
|
+
}
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
label: 'Last 30 Days',
|
|
3049
|
+
getRange: () => {
|
|
3050
|
+
const now = new Date();
|
|
3051
|
+
return { start: addDays(now, -29), end: now };
|
|
3052
|
+
}
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
label: 'This Month',
|
|
3056
|
+
getRange: () => {
|
|
3057
|
+
const now = new Date();
|
|
3058
|
+
return { start: startOfMonth(now), end: endOfMonth(now) };
|
|
3059
|
+
}
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
label: 'Last Month',
|
|
3063
|
+
getRange: () => {
|
|
3064
|
+
const prevMonth = addMonths(new Date(), -1);
|
|
3065
|
+
return { start: startOfMonth(prevMonth), end: endOfMonth(prevMonth) };
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
];
|
|
3069
|
+
class StrataDateRangePickerComponent {
|
|
3070
|
+
defaultId = `st-daterange-${nextUniqueDateRangePickerId++}`;
|
|
3071
|
+
label = input(undefined, /* @ts-ignore */
|
|
3072
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3073
|
+
id = input(undefined, /* @ts-ignore */
|
|
3074
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
3075
|
+
name = input(undefined, /* @ts-ignore */
|
|
3076
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
3077
|
+
placeholder = input('Start date – End date', /* @ts-ignore */
|
|
3078
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
3079
|
+
separator = input(' – ', /* @ts-ignore */
|
|
3080
|
+
...(ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []));
|
|
3081
|
+
format = input(undefined, /* @ts-ignore */
|
|
3082
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
3083
|
+
size = input('md', /* @ts-ignore */
|
|
3084
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3085
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
3086
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
3087
|
+
locale = input(undefined, /* @ts-ignore */
|
|
3088
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
3089
|
+
calendarSize = computed(() => (this.size() === 'sm' ? 'sm' : 'md'), /* @ts-ignore */
|
|
3090
|
+
...(ngDevMode ? [{ debugName: "calendarSize" }] : /* istanbul ignore next */ []));
|
|
3091
|
+
numberOfMonths = input(2, /* @ts-ignore */
|
|
3092
|
+
...(ngDevMode ? [{ debugName: "numberOfMonths" }] : /* istanbul ignore next */ []));
|
|
3093
|
+
showPresets = input(true, { ...(ngDevMode ? { debugName: "showPresets" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3094
|
+
presets = input(DEFAULT_DATE_RANGE_PRESETS, /* @ts-ignore */
|
|
3095
|
+
...(ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []));
|
|
3096
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3097
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3098
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3099
|
+
fullWidth = input(false, { ...(ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3100
|
+
state = input(undefined, /* @ts-ignore */
|
|
3101
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
3102
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3103
|
+
message = input(undefined, /* @ts-ignore */
|
|
3104
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
3105
|
+
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3106
|
+
minDate = input(null, /* @ts-ignore */
|
|
3107
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
3108
|
+
maxDate = input(null, /* @ts-ignore */
|
|
3109
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
3110
|
+
disabledDates = input(null, /* @ts-ignore */
|
|
3111
|
+
...(ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
3112
|
+
firstDayOfWeek = input(0, /* @ts-ignore */
|
|
3113
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
3114
|
+
initialViewDate = input(null, /* @ts-ignore */
|
|
3115
|
+
...(ngDevMode ? [{ debugName: "initialViewDate" }] : /* istanbul ignore next */ []));
|
|
3116
|
+
value = model(null, /* @ts-ignore */
|
|
3117
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3118
|
+
rangeSelected = output();
|
|
3119
|
+
open = signal(false, /* @ts-ignore */
|
|
3120
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
3121
|
+
textInputValue = signal('', /* @ts-ignore */
|
|
3122
|
+
...(ngDevMode ? [{ debugName: "textInputValue" }] : /* istanbul ignore next */ []));
|
|
3123
|
+
calendarViewDate = signal(new Date(), /* @ts-ignore */
|
|
3124
|
+
...(ngDevMode ? [{ debugName: "calendarViewDate" }] : /* istanbul ignore next */ []));
|
|
3125
|
+
secondCalendarViewDate = computed(() => {
|
|
3126
|
+
return addMonths(this.calendarViewDate(), 1);
|
|
3127
|
+
}, /* @ts-ignore */
|
|
3128
|
+
...(ngDevMode ? [{ debugName: "secondCalendarViewDate" }] : /* istanbul ignore next */ []));
|
|
3129
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
3130
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
3131
|
+
effectiveDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
3132
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
3133
|
+
effectiveId = computed(() => this.id() ?? this.name() ?? this.defaultId, /* @ts-ignore */
|
|
3134
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
3135
|
+
effectiveState = computed(() => {
|
|
3136
|
+
if (this.error()) {
|
|
3137
|
+
return 'error';
|
|
3138
|
+
}
|
|
3139
|
+
return this.state() ?? 'default';
|
|
3140
|
+
}, /* @ts-ignore */
|
|
3141
|
+
...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
|
|
3142
|
+
isMessageError = computed(() => this.effectiveState() === 'error' && this.colorMessage(), /* @ts-ignore */
|
|
3143
|
+
...(ngDevMode ? [{ debugName: "isMessageError" }] : /* istanbul ignore next */ []));
|
|
3144
|
+
isMessageSuccess = computed(() => this.effectiveState() === 'success' && this.colorMessage(), /* @ts-ignore */
|
|
3145
|
+
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
3146
|
+
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
3147
|
+
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
3148
|
+
onChange = () => undefined;
|
|
3149
|
+
onTouched = () => undefined;
|
|
3150
|
+
overlayDirective = viewChild(StrataOverlayDirective, /* @ts-ignore */
|
|
3151
|
+
...(ngDevMode ? [{ debugName: "overlayDirective" }] : /* istanbul ignore next */ []));
|
|
3152
|
+
elementRef = inject(ElementRef);
|
|
3153
|
+
renderer = inject(Renderer2);
|
|
3154
|
+
destroyRef = inject(DestroyRef);
|
|
3155
|
+
get effectiveFormat() {
|
|
3156
|
+
return this.format() || getLocaleDefaultDateFormat(this.locale());
|
|
3157
|
+
}
|
|
3158
|
+
constructor() {
|
|
3159
|
+
const unlisten = this.renderer.listen('document', 'pointerdown', (event) => {
|
|
3160
|
+
if (!this.open())
|
|
3161
|
+
return;
|
|
3162
|
+
const target = event.target;
|
|
3163
|
+
if (!target)
|
|
3164
|
+
return;
|
|
3165
|
+
const hostEl = this.elementRef.nativeElement;
|
|
3166
|
+
const overlayEl = this.overlayDirective()?.getOverlayElement();
|
|
3167
|
+
if (hostEl.contains(target) || (overlayEl && overlayEl.contains(target))) {
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
this.open.set(false);
|
|
3171
|
+
});
|
|
3172
|
+
this.destroyRef.onDestroy(() => unlisten());
|
|
3173
|
+
effect(() => {
|
|
3174
|
+
const val = this.value();
|
|
3175
|
+
if (val && val.start && val.end) {
|
|
3176
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
3177
|
+
this.calendarViewDate.set(new Date(val.start));
|
|
3178
|
+
}
|
|
3179
|
+
else {
|
|
3180
|
+
this.textInputValue.set('');
|
|
3181
|
+
}
|
|
3182
|
+
});
|
|
3183
|
+
}
|
|
3184
|
+
toggle(event) {
|
|
3185
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
3186
|
+
return;
|
|
3187
|
+
if (event) {
|
|
3188
|
+
event.preventDefault();
|
|
3189
|
+
event.stopPropagation();
|
|
3190
|
+
}
|
|
3191
|
+
const opening = !this.open();
|
|
3192
|
+
if (opening) {
|
|
3193
|
+
const range = this.value();
|
|
3194
|
+
const viewDate = range?.start ?? this.initialViewDate() ?? new Date();
|
|
3195
|
+
this.calendarViewDate.set(new Date(viewDate));
|
|
3196
|
+
}
|
|
3197
|
+
this.open.set(opening);
|
|
3198
|
+
}
|
|
3199
|
+
onInputTextChange(value) {
|
|
3200
|
+
this.textInputValue.set(value);
|
|
3201
|
+
if (!value.trim()) {
|
|
3202
|
+
this.updateRangeValue(null);
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
const parts = value.split(this.separator());
|
|
3206
|
+
if (parts.length === 2) {
|
|
3207
|
+
const s = parseDate(parts[0], this.effectiveFormat);
|
|
3208
|
+
const e = parseDate(parts[1], this.effectiveFormat);
|
|
3209
|
+
if (s && e) {
|
|
3210
|
+
this.updateRangeValue({ start: s, end: e });
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
onInputBlur() {
|
|
3215
|
+
this.onTouched();
|
|
3216
|
+
const val = this.value();
|
|
3217
|
+
if (val && val.start && val.end) {
|
|
3218
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
3219
|
+
}
|
|
3220
|
+
else {
|
|
3221
|
+
this.textInputValue.set('');
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
onCalendarRangeSelected(range) {
|
|
3225
|
+
this.value.set(range);
|
|
3226
|
+
if (range.start && range.end) {
|
|
3227
|
+
this.textInputValue.set(`${formatDate(range.start, this.effectiveFormat)}${this.separator()}${formatDate(range.end, this.effectiveFormat)}`);
|
|
3228
|
+
this.rangeSelected.emit(range);
|
|
3229
|
+
this.onChange(range);
|
|
3230
|
+
this.onTouched();
|
|
3231
|
+
this.open.set(false);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
onSecondCalendarViewDateChange(date) {
|
|
3235
|
+
this.calendarViewDate.set(addMonths(date, -1));
|
|
3236
|
+
}
|
|
3237
|
+
applyPreset(preset) {
|
|
3238
|
+
const range = preset.getRange();
|
|
3239
|
+
this.updateRangeValue(range);
|
|
3240
|
+
this.open.set(false);
|
|
3241
|
+
}
|
|
3242
|
+
clear(event) {
|
|
3243
|
+
event.stopPropagation();
|
|
3244
|
+
if (this.effectiveDisabled() || this.readonly())
|
|
3245
|
+
return;
|
|
3246
|
+
this.updateRangeValue(null);
|
|
3247
|
+
}
|
|
3248
|
+
updateRangeValue(range) {
|
|
3249
|
+
this.value.set(range);
|
|
3250
|
+
if (range && range.start && range.end) {
|
|
3251
|
+
this.textInputValue.set(`${formatDate(range.start, this.effectiveFormat)}${this.separator()}${formatDate(range.end, this.effectiveFormat)}`);
|
|
3252
|
+
}
|
|
3253
|
+
else {
|
|
3254
|
+
this.textInputValue.set('');
|
|
3255
|
+
}
|
|
3256
|
+
this.rangeSelected.emit(range);
|
|
3257
|
+
this.onChange(range);
|
|
3258
|
+
this.onTouched();
|
|
3259
|
+
}
|
|
3260
|
+
writeValue(val) {
|
|
3261
|
+
this.value.set(val);
|
|
3262
|
+
if (val && val.start && val.end) {
|
|
3263
|
+
this.textInputValue.set(`${formatDate(val.start, this.effectiveFormat)}${this.separator()}${formatDate(val.end, this.effectiveFormat)}`);
|
|
3264
|
+
this.calendarViewDate.set(new Date(val.start));
|
|
3265
|
+
}
|
|
3266
|
+
else {
|
|
3267
|
+
this.textInputValue.set('');
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
registerOnChange(fn) {
|
|
3271
|
+
this.onChange = fn;
|
|
3272
|
+
}
|
|
3273
|
+
registerOnTouched(fn) {
|
|
3274
|
+
this.onTouched = fn;
|
|
3275
|
+
}
|
|
3276
|
+
setDisabledState(isDisabled) {
|
|
3277
|
+
this.cvaDisabled.set(isDisabled);
|
|
3278
|
+
}
|
|
3279
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3280
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataDateRangePickerComponent, isStandalone: true, selector: "st-date-range-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, numberOfMonths: { classPropertyName: "numberOfMonths", publicName: "numberOfMonths", isSignal: true, isRequired: false, transformFunction: null }, showPresets: { classPropertyName: "showPresets", publicName: "showPresets", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, initialViewDate: { classPropertyName: "initialViewDate", publicName: "initialViewDate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rangeSelected: "rangeSelected" }, host: { properties: { "class.st-date-range-picker": "true", "class.st-size-sm": "size() === \"sm\"", "class.st-size-md": "size() === \"md\"", "class.st-size-lg": "size() === \"lg\"", "class.st-disabled": "effectiveDisabled()", "attr.aria-disabled": "effectiveDisabled() ? \"true\" : null", "class.st-state-error": "effectiveState() === \"error\"", "class.st-state-success": "effectiveState() === \"success\"", "class.st-state-warning": "effectiveState() === \"warning\"", "class.st-error": "effectiveState() === \"error\"", "attr.aria-invalid": "effectiveState() === \"error\" ? \"true\" : null" } }, providers: [
|
|
3281
|
+
{
|
|
3282
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3283
|
+
useExisting: forwardRef(() => StrataDateRangePickerComponent),
|
|
3284
|
+
multi: true
|
|
3285
|
+
}
|
|
3286
|
+
], viewQueries: [{ propertyName: "overlayDirective", first: true, predicate: StrataOverlayDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"rangeCalendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date range\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #rangeCalendarOverlay>\n <div class=\"st-date-range-dropdown\">\n @if (showPresets() && presets().length > 0) {\n <div class=\"st-date-range-presets\">\n <div class=\"st-presets-title\">Presets</div>\n @for (preset of presets(); track preset.label) {\n <button\n type=\"button\"\n class=\"st-preset-btn\"\n (click)=\"applyPreset(preset)\"\n >\n {{ preset.label }}\n </button>\n }\n </div>\n }\n\n <div class=\"st-date-range-calendars\">\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"calendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"calendarViewDate.set($event)\"\n ></st-calendar>\n\n @if (numberOfMonths() >= 2) {\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"secondCalendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"onSecondCalendarViewDateChange($event)\"\n ></st-calendar>\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-date-range-dropdown{display:flex;background-color:var(--st-color-bg-raised);border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);box-shadow:var(--st-shadow-2);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-date-range-presets{display:flex;flex-direction:column;padding:var(--st-space-2);border-right:1px solid var(--st-border-subtle);min-width:130px;gap:2px}.st-presets-title{font-size:.75rem;font-weight:var(--st-font-weight-semibold);color:var(--st-color-text-tertiary);padding:4px 8px;text-transform:uppercase;letter-spacing:.05em}.st-preset-btn{background:transparent;border:none;font-family:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-secondary);padding:6px 8px;border-radius:var(--st-border-radius-sm);text-align:left;cursor:pointer;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}.st-preset-btn:hover{background-color:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-date-range-calendars{display:flex;gap:var(--st-space-4);padding:var(--st-space-3)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport", "overlayTarget"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataCalendarComponent, selector: "st-calendar", inputs: ["mode", "size", "locale", "value", "rangeValue", "viewDate", "minDate", "maxDate", "disabledDates", "firstDayOfWeek", "showAdjacentMonths", "disabled"], outputs: ["valueChange", "rangeValueChange", "viewDateChange", "dateSelected", "rangeSelected"] }] });
|
|
3287
|
+
}
|
|
3288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDateRangePickerComponent, decorators: [{
|
|
3289
|
+
type: Component,
|
|
3290
|
+
args: [{ selector: 'st-date-range-picker', imports: [
|
|
3291
|
+
CommonModule,
|
|
3292
|
+
StrataIconComponent,
|
|
3293
|
+
StrataOverlayDirective,
|
|
3294
|
+
StrataCalendarComponent
|
|
3295
|
+
], providers: [
|
|
3296
|
+
{
|
|
3297
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3298
|
+
useExisting: forwardRef(() => StrataDateRangePickerComponent),
|
|
3299
|
+
multi: true
|
|
3300
|
+
}
|
|
3301
|
+
], host: {
|
|
3302
|
+
'[class.st-date-range-picker]': 'true',
|
|
3303
|
+
'[class.st-size-sm]': 'size() === "sm"',
|
|
3304
|
+
'[class.st-size-md]': 'size() === "md"',
|
|
3305
|
+
'[class.st-size-lg]': 'size() === "lg"',
|
|
3306
|
+
'[class.st-disabled]': 'effectiveDisabled()',
|
|
3307
|
+
'[attr.aria-disabled]': 'effectiveDisabled() ? "true" : null',
|
|
3308
|
+
'[class.st-state-error]': 'effectiveState() === "error"',
|
|
3309
|
+
'[class.st-state-success]': 'effectiveState() === "success"',
|
|
3310
|
+
'[class.st-state-warning]': 'effectiveState() === "warning"',
|
|
3311
|
+
'[class.st-error]': 'effectiveState() === "error"',
|
|
3312
|
+
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null'
|
|
3313
|
+
}, template: "@if (label()) {\n <label class=\"st-label\" [for]=\"effectiveId()\">{{ label() }}</label>\n}\n\n<div\n class=\"st-input-wrapper\"\n [class.full-width]=\"fullWidth()\"\n [class.disabled]=\"effectiveDisabled()\"\n [class.open]=\"open()\"\n [stOverlay]=\"rangeCalendarOverlay\"\n [overlayOpen]=\"open()\"\n [overlayPlacement]=\"placement()\"\n>\n <input\n type=\"text\"\n [id]=\"effectiveId()\"\n [placeholder]=\"placeholder()\"\n [value]=\"textInputValue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInputTextChange($any($event.target).value)\"\n (blur)=\"onInputBlur()\"\n (click)=\"toggle($event)\"\n (keydown.enter)=\"toggle($event)\"\n (keydown.escape)=\"open.set(false)\"\n />\n\n <div class=\"affix\">\n @if (clearable() && value() && !effectiveDisabled() && !readonly()) {\n <button\n type=\"button\"\n class=\"st-icon-btn\"\n (click)=\"clear($event)\"\n aria-label=\"Clear date range\"\n >\n <st-icon name=\"close\" size=\"xs\"></st-icon>\n </button>\n }\n\n <span class=\"st-trigger-icon\" (click)=\"toggle($event)\">\n <st-icon name=\"calendar\" size=\"xs\"></st-icon>\n </span>\n </div>\n</div>\n\n@if (message()) {\n <div class=\"st-input-field-footer\">\n <span\n class=\"st-input-field-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </span>\n </div>\n}\n\n<ng-template #rangeCalendarOverlay>\n <div class=\"st-date-range-dropdown\">\n @if (showPresets() && presets().length > 0) {\n <div class=\"st-date-range-presets\">\n <div class=\"st-presets-title\">Presets</div>\n @for (preset of presets(); track preset.label) {\n <button\n type=\"button\"\n class=\"st-preset-btn\"\n (click)=\"applyPreset(preset)\"\n >\n {{ preset.label }}\n </button>\n }\n </div>\n }\n\n <div class=\"st-date-range-calendars\">\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"calendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"calendarViewDate.set($event)\"\n ></st-calendar>\n\n @if (numberOfMonths() >= 2) {\n <st-calendar\n mode=\"range\"\n [size]=\"calendarSize()\"\n [locale]=\"locale()\"\n [rangeValue]=\"value()\"\n [viewDate]=\"secondCalendarViewDate()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (rangeSelected)=\"onCalendarRangeSelected($event)\"\n (viewDateChange)=\"onSecondCalendarViewDateChange($event)\"\n ></st-calendar>\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%}:host label{margin-bottom:var(--st-space-2)}.st-input-wrapper{display:flex;align-items:center;box-sizing:border-box;height:var(--st-interactive-element-height-md);background-color:var(--st-color-bg-raised);border:1px solid var(--st-border-muted);border-radius:var(--st-border-radius-md);overflow:hidden;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast)}.st-input-wrapper:hover{background-color:var(--st-color-input-hover);border-color:var(--st-color-border-strong)}.st-input-wrapper:focus-within,.st-input-wrapper.open{outline:var(--st-focus-ring-width) var(--st-focus-ring-style) var(--st-focus-ring-color);outline-offset:var(--st-focus-ring-offset);border-color:var(--st-color-border-strong)}:host(.st-size-sm) .st-input-wrapper{height:var(--st-interactive-element-height-sm);border-radius:var(--st-border-radius-sm)}:host(.st-size-sm) input{padding:0 var(--st-size-xxs);font-size:var(--st-font-sm)}:host(.st-size-sm) .affix{padding-right:var(--st-size-xxs)}:host(.st-size-lg) .st-input-wrapper{height:var(--st-interactive-element-height-lg)}:host(.st-state-error) .st-input-wrapper,:host(.st-error) .st-input-wrapper{border-color:var(--st-color-feedback-error-default);outline-color:var(--st-color-feedback-error-default)}:host(.st-state-success) .st-input-wrapper{border-color:var(--st-color-feedback-success-default);outline-color:var(--st-color-feedback-success-default)}:host(.st-state-warning) .st-input-wrapper{border-color:var(--st-color-feedback-warning-default);outline-color:var(--st-color-feedback-warning-default)}:host(.st-disabled){opacity:.55;pointer-events:none;cursor:not-allowed}input{border:none;background:none;width:100%;padding:0 var(--st-size-xs);color:var(--st-color-text-primary);font-size:var(--st-font-md);font-family:inherit;height:100%;cursor:pointer;outline:none}input::placeholder{color:var(--st-color-text-tertiary)}.affix{display:flex;align-items:center;padding-right:var(--st-size-xs);gap:var(--st-space-1);color:var(--st-color-text-tertiary)}.st-icon-btn,.st-trigger-icon{background:transparent;border:none;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;color:var(--st-color-text-tertiary);transition:color var(--st-transition-fast)}.st-icon-btn:hover,.st-trigger-icon:hover{color:var(--st-color-text-primary)}.st-input-field-footer{display:flex;margin-top:var(--st-space-1);line-height:1.25}.st-input-field-message{font-size:var(--st-font-sm);color:var(--st-color-text-secondary)}.st-input-field-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-input-field-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-input-field-message.st-message-warning{color:var(--st-color-feedback-warning-text)}.st-date-range-dropdown{display:flex;background-color:var(--st-color-bg-raised);border:1px solid var(--st-border);border-radius:var(--st-border-radius-lg);box-shadow:var(--st-shadow-2);overflow:hidden;animation:st-popover-in var(--st-transition-fast) ease-out}.st-date-range-presets{display:flex;flex-direction:column;padding:var(--st-space-2);border-right:1px solid var(--st-border-subtle);min-width:130px;gap:2px}.st-presets-title{font-size:.75rem;font-weight:var(--st-font-weight-semibold);color:var(--st-color-text-tertiary);padding:4px 8px;text-transform:uppercase;letter-spacing:.05em}.st-preset-btn{background:transparent;border:none;font-family:inherit;font-size:var(--st-font-sm);color:var(--st-color-text-secondary);padding:6px 8px;border-radius:var(--st-border-radius-sm);text-align:left;cursor:pointer;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}.st-preset-btn:hover{background-color:var(--st-color-control-bg-hover, var(--st-color-bg-default));color:var(--st-color-text-primary)}.st-date-range-calendars{display:flex;gap:var(--st-space-4);padding:var(--st-space-3)}\n"] }]
|
|
3314
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], numberOfMonths: [{ type: i0.Input, args: [{ isSignal: true, alias: "numberOfMonths", required: false }] }], showPresets: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPresets", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], initialViewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialViewDate", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], rangeSelected: [{ type: i0.Output, args: ["rangeSelected"] }], overlayDirective: [{ type: i0.ViewChild, args: [i0.forwardRef(() => StrataOverlayDirective), { isSignal: true }] }] } });
|
|
3315
|
+
|
|
3316
|
+
class StrataDividerComponent {
|
|
3317
|
+
label = input(/* @ts-ignore */
|
|
3318
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3319
|
+
margin = input(true, /* @ts-ignore */
|
|
3320
|
+
...(ngDevMode ? [{ debugName: "margin" }] : /* istanbul ignore next */ []));
|
|
3321
|
+
vertical = input(false, /* @ts-ignore */
|
|
3322
|
+
...(ngDevMode ? [{ debugName: "vertical" }] : /* istanbul ignore next */ []));
|
|
3323
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3324
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataDividerComponent, isStandalone: true, selector: "st-divider", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, vertical: { classPropertyName: "vertical", publicName: "vertical", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (!label() || vertical()) {\n <div class=\"divider-line\" [class.divider-margin]=\"margin()\" [class.vertical]=\"vertical()\"></div>\n} @else {\n <div class=\"divider-line-with-text\" [class.divider-margin]=\"margin()\">\n <div class=\"divider-line\"></div>\n <span>{{ label() }}</span>\n <div class=\"divider-line\"></div>\n </div>\n}\n" });
|
|
3325
|
+
}
|
|
3326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataDividerComponent, decorators: [{
|
|
3327
|
+
type: Component,
|
|
3328
|
+
args: [{ selector: 'st-divider', imports: [], template: "@if (!label() || vertical()) {\n <div class=\"divider-line\" [class.divider-margin]=\"margin()\" [class.vertical]=\"vertical()\"></div>\n} @else {\n <div class=\"divider-line-with-text\" [class.divider-margin]=\"margin()\">\n <div class=\"divider-line\"></div>\n <span>{{ label() }}</span>\n <div class=\"divider-line\"></div>\n </div>\n}\n" }]
|
|
3329
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], vertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "vertical", required: false }] }] } });
|
|
3330
|
+
|
|
3331
|
+
class StrataFileUploadComponent {
|
|
3332
|
+
fileInput = viewChild('fileInput', /* @ts-ignore */
|
|
3333
|
+
...(ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []));
|
|
3334
|
+
cameraInput = viewChild('cameraInput', /* @ts-ignore */
|
|
3335
|
+
...(ngDevMode ? [{ debugName: "cameraInput" }] : /* istanbul ignore next */ []));
|
|
3336
|
+
accept = input('*', /* @ts-ignore */
|
|
3337
|
+
...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
|
|
3338
|
+
multiple = input(false, /* @ts-ignore */
|
|
3339
|
+
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
3340
|
+
maxFileSize = input(undefined, /* @ts-ignore */
|
|
3341
|
+
...(ngDevMode ? [{ debugName: "maxFileSize" }] : /* istanbul ignore next */ []));
|
|
3342
|
+
disabled = input(false, /* @ts-ignore */
|
|
3343
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
3344
|
+
label = input('Choose a file or drag & drop it here', /* @ts-ignore */
|
|
3345
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
3346
|
+
hint = input(undefined, /* @ts-ignore */
|
|
3347
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
3348
|
+
camera = input(undefined, { ...(ngDevMode ? { debugName: "camera" } : /* istanbul ignore next */ {}), transform: (val) => {
|
|
3349
|
+
if (val === undefined || val === null) {
|
|
3350
|
+
return undefined;
|
|
3351
|
+
}
|
|
3352
|
+
if (typeof val === 'string') {
|
|
3353
|
+
if (val === '' || val === 'true') {
|
|
3354
|
+
return true;
|
|
3355
|
+
}
|
|
3356
|
+
if (val === 'false') {
|
|
3357
|
+
return false;
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
return Boolean(val);
|
|
3361
|
+
} });
|
|
3362
|
+
choosePhotoLabel = input('Choose Photo', /* @ts-ignore */
|
|
3363
|
+
...(ngDevMode ? [{ debugName: "choosePhotoLabel" }] : /* istanbul ignore next */ []));
|
|
3364
|
+
takePhotoLabel = input('Take Photo', /* @ts-ignore */
|
|
3365
|
+
...(ngDevMode ? [{ debugName: "takePhotoLabel" }] : /* istanbul ignore next */ []));
|
|
3366
|
+
state = input(undefined, /* @ts-ignore */
|
|
3367
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
3368
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3369
|
+
message = input(undefined, /* @ts-ignore */
|
|
3370
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
3371
|
+
colorMessage = input(true, { ...(ngDevMode ? { debugName: "colorMessage" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3372
|
+
displayMessage = computed(() => this.message() ?? this.hint(), /* @ts-ignore */
|
|
3373
|
+
...(ngDevMode ? [{ debugName: "displayMessage" }] : /* istanbul ignore next */ []));
|
|
3374
|
+
effectiveState = computed(() => {
|
|
3375
|
+
if (this.error()) {
|
|
3376
|
+
return 'error';
|
|
3377
|
+
}
|
|
3378
|
+
return this.state() ?? 'default';
|
|
3379
|
+
}, /* @ts-ignore */
|
|
3380
|
+
...(ngDevMode ? [{ debugName: "effectiveState" }] : /* istanbul ignore next */ []));
|
|
3381
|
+
isMessageError = computed(() => this.effectiveState() === 'error' && this.colorMessage(), /* @ts-ignore */
|
|
3382
|
+
...(ngDevMode ? [{ debugName: "isMessageError" }] : /* istanbul ignore next */ []));
|
|
3383
|
+
isMessageSuccess = computed(() => this.effectiveState() === 'success' && this.colorMessage(), /* @ts-ignore */
|
|
3384
|
+
...(ngDevMode ? [{ debugName: "isMessageSuccess" }] : /* istanbul ignore next */ []));
|
|
3385
|
+
isMessageWarning = computed(() => this.effectiveState() === 'warning' && this.colorMessage(), /* @ts-ignore */
|
|
3386
|
+
...(ngDevMode ? [{ debugName: "isMessageWarning" }] : /* istanbul ignore next */ []));
|
|
3387
|
+
isImageAccept = computed(() => {
|
|
3388
|
+
const acc = this.accept().toLowerCase();
|
|
3389
|
+
if (!acc || acc === '*' || acc === '*/*') {
|
|
3390
|
+
return false;
|
|
3391
|
+
}
|
|
3392
|
+
const rules = acc.split(',').map((r) => r.trim());
|
|
3393
|
+
return rules.some((rule) => {
|
|
3394
|
+
return (rule.startsWith('image/') ||
|
|
3395
|
+
['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.heic', '.heif', '.svg'].some((ext) => rule.endsWith(ext)));
|
|
3396
|
+
});
|
|
3397
|
+
}, /* @ts-ignore */
|
|
3398
|
+
...(ngDevMode ? [{ debugName: "isImageAccept" }] : /* istanbul ignore next */ []));
|
|
3399
|
+
showCamera = computed(() => {
|
|
3400
|
+
const cam = this.camera();
|
|
3401
|
+
if (cam === false) {
|
|
3402
|
+
return false;
|
|
3403
|
+
}
|
|
3404
|
+
if (cam === true) {
|
|
3405
|
+
return true;
|
|
3406
|
+
}
|
|
3407
|
+
return this.isImageAccept();
|
|
3408
|
+
}, /* @ts-ignore */
|
|
3409
|
+
...(ngDevMode ? [{ debugName: "showCamera" }] : /* istanbul ignore next */ []));
|
|
3410
|
+
fileSelect = output();
|
|
3411
|
+
filesSelect = output();
|
|
3412
|
+
fileRejected = output();
|
|
3413
|
+
isDragOver = signal(false, /* @ts-ignore */
|
|
3414
|
+
...(ngDevMode ? [{ debugName: "isDragOver" }] : /* istanbul ignore next */ []));
|
|
3415
|
+
get hostDisabled() {
|
|
3416
|
+
return this.disabled();
|
|
3417
|
+
}
|
|
3418
|
+
get hostError() {
|
|
3419
|
+
return this.effectiveState() === 'error';
|
|
3420
|
+
}
|
|
3421
|
+
get hostSuccess() {
|
|
3422
|
+
return this.effectiveState() === 'success';
|
|
3423
|
+
}
|
|
3424
|
+
get hostWarning() {
|
|
3425
|
+
return this.effectiveState() === 'warning';
|
|
3426
|
+
}
|
|
3427
|
+
get hostAriaInvalid() {
|
|
3428
|
+
return this.effectiveState() === 'error' ? 'true' : null;
|
|
3429
|
+
}
|
|
3430
|
+
get hostDragOver() {
|
|
3431
|
+
return this.isDragOver();
|
|
3432
|
+
}
|
|
3433
|
+
hostRole = 'button';
|
|
3434
|
+
get hostTabIndex() {
|
|
3435
|
+
return this.disabled() ? -1 : 0;
|
|
3436
|
+
}
|
|
3437
|
+
onClick(event) {
|
|
3438
|
+
const target = event.target;
|
|
3439
|
+
if (target === this.fileInput()?.nativeElement || target === this.cameraInput()?.nativeElement) {
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
if (target.closest('.st-file-upload-actions')) {
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
this.browse();
|
|
3446
|
+
}
|
|
3447
|
+
onKeydown(event) {
|
|
3448
|
+
const target = event.target;
|
|
3449
|
+
if (target.closest('.st-file-upload-actions')) {
|
|
3450
|
+
return;
|
|
3451
|
+
}
|
|
3452
|
+
event.preventDefault();
|
|
3453
|
+
this.browse();
|
|
3454
|
+
}
|
|
3455
|
+
onDragOver(event) {
|
|
3456
|
+
if (this.disabled())
|
|
3457
|
+
return;
|
|
3458
|
+
event.preventDefault();
|
|
3459
|
+
event.stopPropagation();
|
|
3460
|
+
this.isDragOver.set(true);
|
|
3461
|
+
}
|
|
3462
|
+
onDragLeave(event) {
|
|
3463
|
+
if (this.disabled())
|
|
3464
|
+
return;
|
|
3465
|
+
event.preventDefault();
|
|
3466
|
+
event.stopPropagation();
|
|
3467
|
+
this.isDragOver.set(false);
|
|
3468
|
+
}
|
|
3469
|
+
onDrop(event) {
|
|
3470
|
+
if (this.disabled())
|
|
3471
|
+
return;
|
|
3472
|
+
event.preventDefault();
|
|
3473
|
+
event.stopPropagation();
|
|
3474
|
+
this.isDragOver.set(false);
|
|
3475
|
+
const droppedFiles = event.dataTransfer?.files;
|
|
3476
|
+
if (!droppedFiles || droppedFiles.length === 0)
|
|
3477
|
+
return;
|
|
3478
|
+
this.processFiles(Array.from(droppedFiles));
|
|
3479
|
+
}
|
|
3480
|
+
onFileChange(event) {
|
|
1764
3481
|
const inputEl = event.target;
|
|
1765
3482
|
if (!inputEl.files || inputEl.files.length === 0)
|
|
1766
3483
|
return;
|
|
1767
3484
|
this.processFiles(Array.from(inputEl.files));
|
|
1768
3485
|
inputEl.value = '';
|
|
1769
3486
|
}
|
|
1770
|
-
browse() {
|
|
3487
|
+
browse(event) {
|
|
3488
|
+
event?.stopPropagation();
|
|
1771
3489
|
if (this.disabled())
|
|
1772
3490
|
return;
|
|
1773
3491
|
this.fileInput()?.nativeElement.click();
|
|
1774
3492
|
}
|
|
3493
|
+
browseCamera(event) {
|
|
3494
|
+
event?.stopPropagation();
|
|
3495
|
+
if (this.disabled())
|
|
3496
|
+
return;
|
|
3497
|
+
this.cameraInput()?.nativeElement.click();
|
|
3498
|
+
}
|
|
1775
3499
|
clear() {
|
|
1776
3500
|
const inputEl = this.fileInput()?.nativeElement;
|
|
1777
3501
|
if (inputEl) {
|
|
1778
3502
|
inputEl.value = '';
|
|
1779
3503
|
}
|
|
3504
|
+
const cameraEl = this.cameraInput()?.nativeElement;
|
|
3505
|
+
if (cameraEl) {
|
|
3506
|
+
cameraEl.value = '';
|
|
3507
|
+
}
|
|
1780
3508
|
}
|
|
1781
3509
|
processFiles(files) {
|
|
1782
3510
|
const acceptedFiles = [];
|
|
@@ -1819,12 +3547,17 @@ class StrataFileUploadComponent {
|
|
|
1819
3547
|
});
|
|
1820
3548
|
}
|
|
1821
3549
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1822
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataFileUploadComponent, isStandalone: true, selector: "st-file-upload", inputs: { accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileSelect: "fileSelect", filesSelect: "filesSelect", fileRejected: "fileRejected" }, host: { listeners: { "click": "onClick($event)", "keydown.enter": "onKeydown($event)", "keydown.space": "onKeydown($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "class.st-disabled": "this.hostDisabled", "class.st-state-error": "this.hostError", "class.st-error": "this.hostError", "class.st-state-success": "this.hostSuccess", "class.st-state-warning": "this.hostWarning", "attr.aria-invalid": "this.hostAriaInvalid", "class.st-drag-over": "this.hostDragOver", "attr.role": "this.hostRole", "attr.tabindex": "this.hostTabIndex" } }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<input\n #fileInput\n type=\"file\"\n class=\"st-file-upload-input\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFileChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n/>\n\n
|
|
3550
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataFileUploadComponent, isStandalone: true, selector: "st-file-upload", inputs: { accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, camera: { classPropertyName: "camera", publicName: "camera", isSignal: true, isRequired: false, transformFunction: null }, choosePhotoLabel: { classPropertyName: "choosePhotoLabel", publicName: "choosePhotoLabel", isSignal: true, isRequired: false, transformFunction: null }, takePhotoLabel: { classPropertyName: "takePhotoLabel", publicName: "takePhotoLabel", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, colorMessage: { classPropertyName: "colorMessage", publicName: "colorMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileSelect: "fileSelect", filesSelect: "filesSelect", fileRejected: "fileRejected" }, host: { listeners: { "click": "onClick($event)", "keydown.enter": "onKeydown($event)", "keydown.space": "onKeydown($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "class.st-disabled": "this.hostDisabled", "class.st-state-error": "this.hostError", "class.st-error": "this.hostError", "class.st-state-success": "this.hostSuccess", "class.st-state-warning": "this.hostWarning", "attr.aria-invalid": "this.hostAriaInvalid", "class.st-drag-over": "this.hostDragOver", "attr.role": "this.hostRole", "attr.tabindex": "this.hostTabIndex" } }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }, { propertyName: "cameraInput", first: true, predicate: ["cameraInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<input\n #fileInput\n type=\"file\"\n class=\"st-file-upload-input\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFileChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n/>\n\n@if (showCamera()) {\n <input\n #cameraInput\n type=\"file\"\n class=\"st-file-upload-input\"\n accept=\"image/*\"\n capture=\"environment\"\n [disabled]=\"disabled()\"\n (change)=\"onFileChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n />\n}\n\n<div class=\"st-file-upload-content\">\n <ng-content select=\"[uploadIcon]\">\n <st-avatar size=\"md\" variant=\"rounded\" class=\"st-file-upload-avatar\">\n <st-icon name=\"upload\"></st-icon>\n </st-avatar>\n </ng-content>\n\n <div class=\"st-file-upload-text\">\n <span class=\"st-file-upload-label\">{{ label() }}</span>\n @if (displayMessage()) {\n <span\n class=\"st-file-upload-hint\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >{{ displayMessage() }}</span>\n }\n </div>\n\n @if (showCamera()) {\n <st-button-group justification=\"center\" class=\"st-file-upload-actions\">\n <button\n stButton\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n [disabled]=\"disabled()\"\n (click)=\"browse($event)\"\n >\n <st-icon name=\"image\" size=\"sm\"></st-icon>\n <span>{{ choosePhotoLabel() }}</span>\n </button>\n\n <button\n stButton\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n class=\"st-file-upload-action-camera\"\n [disabled]=\"disabled()\"\n (click)=\"browseCamera($event)\"\n >\n <st-icon name=\"camera\" size=\"sm\"></st-icon>\n <span>{{ takePhotoLabel() }}</span>\n </button>\n </st-button-group>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [":host{--st-file-upload-bg: var(--st-color-bg-default);--st-file-upload-border: var(--st-color-border-default);--st-file-upload-text: var(--st-color-text-primary);--st-file-upload-hint: var(--st-color-text-secondary);--st-file-upload-hover-bg: var(--st-color-bg-raised);--st-file-upload-hover-border: var(--st-color-accent-default);--st-file-upload-active-border: var(--st-color-accent-default);--st-file-upload-active-bg: var(--st-color-accent-subtle, var(--st-color-bg-raised));--st-file-upload-radius: var(--st-border-radius-xl);display:block;position:relative;box-sizing:border-box;background-color:var(--st-file-upload-bg);border:2px dashed var(--st-file-upload-border);border-radius:var(--st-file-upload-radius);padding:var(--st-space-6) var(--st-space-4);text-align:center;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast),transform var(--st-transition-fast);-webkit-user-select:none;user-select:none;outline:none}:host st-avatar{transition:transform .2s ease}:host:hover:not(.st-disabled){background-color:var(--st-file-upload-hover-bg);border-color:var(--st-file-upload-hover-border)}:host:hover:not(.st-disabled) st-avatar{transform:translateY(-2px)}:host:focus-visible:not(.st-disabled){outline:2px solid var(--st-color-accent-default);outline-offset:2px}:host.st-drag-over{background-color:var(--st-file-upload-active-bg);border-color:var(--st-file-upload-active-border);border-style:solid;transform:scale(1.01)}:host.st-drag-over st-avatar{transform:translateY(-4px) scale(1.05)}:host.st-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}:host .st-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}:host .st-file-upload-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-3)}:host .st-file-upload-text{display:flex;flex-direction:column;gap:var(--st-space-1)}:host .st-file-upload-label{font-size:.95rem;font-weight:500;color:var(--st-file-upload-text)}:host.st-state-error,:host.st-error{--st-file-upload-border: var(--st-color-feedback-error-default);--st-file-upload-hover-border: var(--st-color-feedback-error-hover, var(--st-color-feedback-error-default))}:host.st-state-error:focus-visible:not(.st-disabled),:host.st-error:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-error-default)}:host.st-state-success{--st-file-upload-border: var(--st-color-feedback-success-default);--st-file-upload-hover-border: var(--st-color-feedback-success-hover, var(--st-color-feedback-success-default))}:host.st-state-success:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-success-default)}:host.st-state-warning{--st-file-upload-border: var(--st-color-feedback-warning-default);--st-file-upload-hover-border: var(--st-color-feedback-warning-hover, var(--st-color-feedback-warning-default))}:host.st-state-warning:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-warning-default)}:host .st-file-upload-hint{font-size:.8rem;color:var(--st-file-upload-hint)}:host .st-file-upload-hint.st-message-error{color:var(--st-color-feedback-error-text)}:host .st-file-upload-hint.st-message-success{color:var(--st-color-feedback-success-text)}:host .st-file-upload-hint.st-message-warning{color:var(--st-color-feedback-warning-text)}:host .st-file-upload-actions{margin-top:var(--st-space-2)}\n"], dependencies: [{ kind: "component", type: StrataAvatarComponent, selector: "st-avatar", inputs: ["src", "alt", "text", "size", "variant"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }, { kind: "component", type: StrataButtonGroupComponent, selector: "st-button-group", inputs: ["justification"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }] });
|
|
1823
3551
|
}
|
|
1824
3552
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataFileUploadComponent, decorators: [{
|
|
1825
3553
|
type: Component,
|
|
1826
|
-
args: [{ selector: 'st-file-upload', imports: [
|
|
1827
|
-
|
|
3554
|
+
args: [{ selector: 'st-file-upload', imports: [
|
|
3555
|
+
StrataAvatarComponent,
|
|
3556
|
+
StrataButtonDirective,
|
|
3557
|
+
StrataButtonGroupComponent,
|
|
3558
|
+
StrataIconComponent
|
|
3559
|
+
], template: "<input\n #fileInput\n type=\"file\"\n class=\"st-file-upload-input\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFileChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n/>\n\n@if (showCamera()) {\n <input\n #cameraInput\n type=\"file\"\n class=\"st-file-upload-input\"\n accept=\"image/*\"\n capture=\"environment\"\n [disabled]=\"disabled()\"\n (change)=\"onFileChange($event)\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n />\n}\n\n<div class=\"st-file-upload-content\">\n <ng-content select=\"[uploadIcon]\">\n <st-avatar size=\"md\" variant=\"rounded\" class=\"st-file-upload-avatar\">\n <st-icon name=\"upload\"></st-icon>\n </st-avatar>\n </ng-content>\n\n <div class=\"st-file-upload-text\">\n <span class=\"st-file-upload-label\">{{ label() }}</span>\n @if (displayMessage()) {\n <span\n class=\"st-file-upload-hint\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >{{ displayMessage() }}</span>\n }\n </div>\n\n @if (showCamera()) {\n <st-button-group justification=\"center\" class=\"st-file-upload-actions\">\n <button\n stButton\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n [disabled]=\"disabled()\"\n (click)=\"browse($event)\"\n >\n <st-icon name=\"image\" size=\"sm\"></st-icon>\n <span>{{ choosePhotoLabel() }}</span>\n </button>\n\n <button\n stButton\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n class=\"st-file-upload-action-camera\"\n [disabled]=\"disabled()\"\n (click)=\"browseCamera($event)\"\n >\n <st-icon name=\"camera\" size=\"sm\"></st-icon>\n <span>{{ takePhotoLabel() }}</span>\n </button>\n </st-button-group>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [":host{--st-file-upload-bg: var(--st-color-bg-default);--st-file-upload-border: var(--st-color-border-default);--st-file-upload-text: var(--st-color-text-primary);--st-file-upload-hint: var(--st-color-text-secondary);--st-file-upload-hover-bg: var(--st-color-bg-raised);--st-file-upload-hover-border: var(--st-color-accent-default);--st-file-upload-active-border: var(--st-color-accent-default);--st-file-upload-active-bg: var(--st-color-accent-subtle, var(--st-color-bg-raised));--st-file-upload-radius: var(--st-border-radius-xl);display:block;position:relative;box-sizing:border-box;background-color:var(--st-file-upload-bg);border:2px dashed var(--st-file-upload-border);border-radius:var(--st-file-upload-radius);padding:var(--st-space-6) var(--st-space-4);text-align:center;cursor:pointer;transition:border-color var(--st-transition-fast),background-color var(--st-transition-fast),transform var(--st-transition-fast);-webkit-user-select:none;user-select:none;outline:none}:host st-avatar{transition:transform .2s ease}:host:hover:not(.st-disabled){background-color:var(--st-file-upload-hover-bg);border-color:var(--st-file-upload-hover-border)}:host:hover:not(.st-disabled) st-avatar{transform:translateY(-2px)}:host:focus-visible:not(.st-disabled){outline:2px solid var(--st-color-accent-default);outline-offset:2px}:host.st-drag-over{background-color:var(--st-file-upload-active-bg);border-color:var(--st-file-upload-active-border);border-style:solid;transform:scale(1.01)}:host.st-drag-over st-avatar{transform:translateY(-4px) scale(1.05)}:host.st-disabled{opacity:.5;cursor:not-allowed;pointer-events:none}:host .st-file-upload-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}:host .st-file-upload-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--st-space-3)}:host .st-file-upload-text{display:flex;flex-direction:column;gap:var(--st-space-1)}:host .st-file-upload-label{font-size:.95rem;font-weight:500;color:var(--st-file-upload-text)}:host.st-state-error,:host.st-error{--st-file-upload-border: var(--st-color-feedback-error-default);--st-file-upload-hover-border: var(--st-color-feedback-error-hover, var(--st-color-feedback-error-default))}:host.st-state-error:focus-visible:not(.st-disabled),:host.st-error:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-error-default)}:host.st-state-success{--st-file-upload-border: var(--st-color-feedback-success-default);--st-file-upload-hover-border: var(--st-color-feedback-success-hover, var(--st-color-feedback-success-default))}:host.st-state-success:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-success-default)}:host.st-state-warning{--st-file-upload-border: var(--st-color-feedback-warning-default);--st-file-upload-hover-border: var(--st-color-feedback-warning-hover, var(--st-color-feedback-warning-default))}:host.st-state-warning:focus-visible:not(.st-disabled){outline-color:var(--st-color-feedback-warning-default)}:host .st-file-upload-hint{font-size:.8rem;color:var(--st-file-upload-hint)}:host .st-file-upload-hint.st-message-error{color:var(--st-color-feedback-error-text)}:host .st-file-upload-hint.st-message-success{color:var(--st-color-feedback-success-text)}:host .st-file-upload-hint.st-message-warning{color:var(--st-color-feedback-warning-text)}:host .st-file-upload-actions{margin-top:var(--st-space-2)}\n"] }]
|
|
3560
|
+
}], propDecorators: { fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], cameraInput: [{ type: i0.ViewChild, args: ['cameraInput', { isSignal: true }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], camera: [{ type: i0.Input, args: [{ isSignal: true, alias: "camera", required: false }] }], choosePhotoLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "choosePhotoLabel", required: false }] }], takePhotoLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "takePhotoLabel", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], fileSelect: [{ type: i0.Output, args: ["fileSelect"] }], filesSelect: [{ type: i0.Output, args: ["filesSelect"] }], fileRejected: [{ type: i0.Output, args: ["fileRejected"] }], hostDisabled: [{
|
|
1828
3561
|
type: HostBinding,
|
|
1829
3562
|
args: ['class.st-disabled']
|
|
1830
3563
|
}], hostError: [{
|
|
@@ -4302,7 +6035,7 @@ class StrataSegmentedControlItemComponent {
|
|
|
4302
6035
|
this.onClick();
|
|
4303
6036
|
}
|
|
4304
6037
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataSegmentedControlItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4305
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataSegmentedControlItemComponent, isStandalone: true, selector: "st-segmented-control-item", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, badgeVariant: { classPropertyName: "badgeVariant", publicName: "badgeVariant", isSignal: true, isRequired: false, transformFunction: null }, badgeSize: { classPropertyName: "badgeSize", publicName: "badgeSize", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", selectionChanged: "selectionChanged" }, host: { attributes: { "role": "tab" }, listeners: { "click": "onClick()", "keydown.space": "onKeydown($event)", "keydown.enter": "onKeydown($event)" }, properties: { "attr.aria-selected": "selected()", "attr.aria-disabled": "effectiveDisabled()", "class.st-disabled": "effectiveDisabled()", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.disabledAttribute" } }, ngImport: i0, template: "<span>{{ text() }}</span>\n@if (badge() !== undefined) {\n <st-badge [value]=\"badge()\" [variant]=\"badgeVariant()\" [size]=\"badgeSize()\"></st-badge>\n}\n<ng-content select=\"st-badge\"></ng-content>\n", styles: [""], dependencies: [{ kind: "component", type: StrataBadgeComponent, selector: "st-badge", inputs: ["value", "icon", "max", "variant", "size", "placement", "visible", "showZero", "ariaLabel"] }] });
|
|
6038
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: StrataSegmentedControlItemComponent, isStandalone: true, selector: "st-segmented-control-item", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, badgeVariant: { classPropertyName: "badgeVariant", publicName: "badgeVariant", isSignal: true, isRequired: false, transformFunction: null }, badgeSize: { classPropertyName: "badgeSize", publicName: "badgeSize", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", selectionChanged: "selectionChanged" }, host: { attributes: { "role": "tab" }, listeners: { "click": "onClick()", "keydown.space": "onKeydown($event)", "keydown.enter": "onKeydown($event)" }, properties: { "attr.aria-selected": "selected()", "attr.aria-disabled": "effectiveDisabled()", "class.st-disabled": "effectiveDisabled()", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.disabledAttribute" } }, ngImport: i0, template: "<span>{{ text() }}</span>\n@if (badge() !== undefined) {\n <st-badge [value]=\"badge()\" [variant]=\"badgeVariant()\" [size]=\"badgeSize()\"></st-badge>\n}\n<ng-content select=\"st-badge\"></ng-content>\n", styles: [":host{display:flex;align-items:center;justify-content:center;gap:var(--st-space-2, 8px);height:var(--st-segmented-control-item-height);padding:0 var(--st-segmented-control-padding-x);border-radius:calc(var(--st-segmented-control-border-radius) - 2px);font-size:var(--st-segmented-control-font-size);font-weight:500;-webkit-user-select:none;user-select:none;transition:background-color var(--st-transition-fast),color var(--st-transition-fast);border:none;color:var(--st-color-text-primary);flex-shrink:0;text-wrap:nowrap;background-color:transparent;position:relative;z-index:1;box-sizing:border-box}:host:hover:not([disabled]):not(.st-disabled):not([aria-selected=true]){cursor:pointer;background-color:var(--st-color-control-bg-hover);color:var(--st-color-text-primary)}:host[aria-selected=true]{color:var(--st-color-control-primary-text);cursor:default}:host[disabled],:host.st-disabled{pointer-events:none;color:var(--st-color-text-tertiary);cursor:unset}:host st-badge{flex-shrink:0}:host-context(.st-segmented-control-full-width){flex:1}\n"], dependencies: [{ kind: "component", type: StrataBadgeComponent, selector: "st-badge", inputs: ["value", "icon", "max", "variant", "size", "placement", "visible", "showZero", "ariaLabel"] }] });
|
|
4306
6039
|
}
|
|
4307
6040
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataSegmentedControlItemComponent, decorators: [{
|
|
4308
6041
|
type: Component,
|
|
@@ -4314,7 +6047,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
4314
6047
|
'(click)': 'onClick()',
|
|
4315
6048
|
'(keydown.space)': 'onKeydown($event)',
|
|
4316
6049
|
'(keydown.enter)': 'onKeydown($event)'
|
|
4317
|
-
}, template: "<span>{{ text() }}</span>\n@if (badge() !== undefined) {\n <st-badge [value]=\"badge()\" [variant]=\"badgeVariant()\" [size]=\"badgeSize()\"></st-badge>\n}\n<ng-content select=\"st-badge\"></ng-content>\n" }]
|
|
6050
|
+
}, template: "<span>{{ text() }}</span>\n@if (badge() !== undefined) {\n <st-badge [value]=\"badge()\" [variant]=\"badgeVariant()\" [size]=\"badgeSize()\"></st-badge>\n}\n<ng-content select=\"st-badge\"></ng-content>\n", styles: [":host{display:flex;align-items:center;justify-content:center;gap:var(--st-space-2, 8px);height:var(--st-segmented-control-item-height);padding:0 var(--st-segmented-control-padding-x);border-radius:calc(var(--st-segmented-control-border-radius) - 2px);font-size:var(--st-segmented-control-font-size);font-weight:500;-webkit-user-select:none;user-select:none;transition:background-color var(--st-transition-fast),color var(--st-transition-fast);border:none;color:var(--st-color-text-primary);flex-shrink:0;text-wrap:nowrap;background-color:transparent;position:relative;z-index:1;box-sizing:border-box}:host:hover:not([disabled]):not(.st-disabled):not([aria-selected=true]){cursor:pointer;background-color:var(--st-color-control-bg-hover);color:var(--st-color-text-primary)}:host[aria-selected=true]{color:var(--st-color-control-primary-text);cursor:default}:host[disabled],:host.st-disabled{pointer-events:none;color:var(--st-color-text-tertiary);cursor:unset}:host st-badge{flex-shrink:0}:host-context(.st-segmented-control-full-width){flex:1}\n"] }]
|
|
4318
6051
|
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }], badgeVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "badgeVariant", required: false }] }], badgeSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "badgeSize", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], selectionChanged: [{ type: i0.Output, args: ["selectionChanged"] }], tabIndex: [{
|
|
4319
6052
|
type: HostBinding,
|
|
4320
6053
|
args: ['attr.tabindex']
|
|
@@ -4484,7 +6217,7 @@ class StrataSegmentedControlComponent {
|
|
|
4484
6217
|
useExisting: forwardRef(() => StrataSegmentedControlComponent),
|
|
4485
6218
|
multi: true
|
|
4486
6219
|
}
|
|
4487
|
-
], queries: [{ propertyName: "segmentItems", predicate: StrataSegmentedControlItemComponent, isSignal: true }, { propertyName: "segmentItemsRefs", predicate: StrataSegmentedControlItemComponent, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"st-segmented-control-track\">\n <ng-content select=\"st-segmented-control-item\"></ng-content>\n <div class=\"selection-item\" id=\"selection-indicator\" \n [style.left]=\"this.offset() + 'px'\"\n [style.top]=\"this.indicatorTop() + 'px'\"\n [style.width]=\"this.indicatorWidth() + 'px'\"\n [style.height]=\"this.indicatorHeight() + 'px'\"></div>\n</div>\n@if (message()) {\n <div\n class=\"st-segmented-control-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n" });
|
|
6220
|
+
], queries: [{ propertyName: "segmentItems", predicate: StrataSegmentedControlItemComponent, isSignal: true }, { propertyName: "segmentItemsRefs", predicate: StrataSegmentedControlItemComponent, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"st-segmented-control-track\">\n <ng-content select=\"st-segmented-control-item\"></ng-content>\n <div class=\"selection-item\" id=\"selection-indicator\" \n [style.left]=\"this.offset() + 'px'\"\n [style.top]=\"this.indicatorTop() + 'px'\"\n [style.width]=\"this.indicatorWidth() + 'px'\"\n [style.height]=\"this.indicatorHeight() + 'px'\"></div>\n</div>\n@if (message()) {\n <div\n class=\"st-segmented-control-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n", styles: [":host{--st-segmented-control-height: var(--st-interactive-element-height-md);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 14px;--st-segmented-control-padding-x: var(--st-size-xxs);--st-segmented-control-border-radius: var(--st-border-radius-md);--st-segmented-control-border-color: transparent;--st-segmented-control-error-border: var(--st-color-feedback-error-default);--st-segmented-control-success-border: var(--st-color-feedback-success-default);--st-segmented-control-warning-border: var(--st-color-feedback-warning-default);display:inline-flex;flex-direction:column;width:fit-content;max-width:100%;box-sizing:border-box}:host.st-size-sm{--st-segmented-control-height: var(--st-interactive-element-height-sm);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 4px);--st-segmented-control-font-size: 12px;--st-segmented-control-padding-x: var(--st-size-xxxs)}:host.st-size-sm .st-segmented-control-track{padding:2px;gap:2px}:host.st-size-md{--st-segmented-control-height: var(--st-interactive-element-height-md);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 14px;--st-segmented-control-padding-x: var(--st-size-xxs)}:host.st-size-md .st-segmented-control-track{padding:4px;gap:4px}:host.st-size-lg{--st-segmented-control-height: var(--st-interactive-element-height-lg);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 16px;--st-segmented-control-padding-x: var(--st-size-xs)}:host.st-size-lg .st-segmented-control-track{padding:4px;gap:4px}:host.st-state-error{--st-segmented-control-border-color: var(--st-segmented-control-error-border)}:host.st-state-success{--st-segmented-control-border-color: var(--st-segmented-control-success-border)}:host.st-state-warning{--st-segmented-control-border-color: var(--st-segmented-control-warning-border)}:host.st-segmented-control-full-width{width:100%}:host.st-segmented-control-full-width .st-segmented-control-track{display:flex;width:100%}.st-segmented-control-track{display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;width:fit-content;max-width:100%;min-width:0;position:relative;border-radius:var(--st-segmented-control-border-radius);border:1px solid var(--st-segmented-control-border-color);box-sizing:border-box;background-color:var(--st-color-bg-raised);height:var(--st-segmented-control-height);padding:4px;gap:4px;transition:border-color var(--st-transition-fast);-ms-overflow-style:none;scrollbar-width:none}.st-segmented-control-track::-webkit-scrollbar{display:none}.selection-item{display:flex;align-items:center;justify-content:center;gap:var(--st-space-2, 8px);height:var(--st-segmented-control-item-height);padding:0 var(--st-segmented-control-padding-x);border-radius:calc(var(--st-segmented-control-border-radius) - 2px);font-size:var(--st-segmented-control-font-size);font-weight:500;-webkit-user-select:none;user-select:none;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}#selection-indicator{cursor:default;position:absolute;top:0;left:0;z-index:0;pointer-events:none;border-radius:calc(var(--st-segmented-control-border-radius) - 2px);background-color:var(--st-color-control-primary-bg);color:var(--st-color-control-primary-text);text-wrap:nowrap;box-shadow:var(--st-shadow-1);transition:left var(--st-transition-fast),width var(--st-transition-fast)}.st-segmented-control-message{margin-top:var(--st-space-1);font-size:var(--st-font-size-sm, 12px);color:var(--st-color-text-secondary)}.st-segmented-control-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-segmented-control-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-segmented-control-message.st-message-warning{color:var(--st-color-feedback-warning-text)}\n"] });
|
|
4488
6221
|
}
|
|
4489
6222
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataSegmentedControlComponent, decorators: [{
|
|
4490
6223
|
type: Component,
|
|
@@ -4507,7 +6240,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
4507
6240
|
'[attr.aria-invalid]': 'effectiveState() === "error" ? "true" : null',
|
|
4508
6241
|
'[class.st-disabled]': 'effectiveDisabled()',
|
|
4509
6242
|
'[attr.aria-disabled]': 'effectiveDisabled()'
|
|
4510
|
-
}, template: "<div class=\"st-segmented-control-track\">\n <ng-content select=\"st-segmented-control-item\"></ng-content>\n <div class=\"selection-item\" id=\"selection-indicator\" \n [style.left]=\"this.offset() + 'px'\"\n [style.top]=\"this.indicatorTop() + 'px'\"\n [style.width]=\"this.indicatorWidth() + 'px'\"\n [style.height]=\"this.indicatorHeight() + 'px'\"></div>\n</div>\n@if (message()) {\n <div\n class=\"st-segmented-control-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n" }]
|
|
6243
|
+
}, template: "<div class=\"st-segmented-control-track\">\n <ng-content select=\"st-segmented-control-item\"></ng-content>\n <div class=\"selection-item\" id=\"selection-indicator\" \n [style.left]=\"this.offset() + 'px'\"\n [style.top]=\"this.indicatorTop() + 'px'\"\n [style.width]=\"this.indicatorWidth() + 'px'\"\n [style.height]=\"this.indicatorHeight() + 'px'\"></div>\n</div>\n@if (message()) {\n <div\n class=\"st-segmented-control-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n", styles: [":host{--st-segmented-control-height: var(--st-interactive-element-height-md);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 14px;--st-segmented-control-padding-x: var(--st-size-xxs);--st-segmented-control-border-radius: var(--st-border-radius-md);--st-segmented-control-border-color: transparent;--st-segmented-control-error-border: var(--st-color-feedback-error-default);--st-segmented-control-success-border: var(--st-color-feedback-success-default);--st-segmented-control-warning-border: var(--st-color-feedback-warning-default);display:inline-flex;flex-direction:column;width:fit-content;max-width:100%;box-sizing:border-box}:host.st-size-sm{--st-segmented-control-height: var(--st-interactive-element-height-sm);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 4px);--st-segmented-control-font-size: 12px;--st-segmented-control-padding-x: var(--st-size-xxxs)}:host.st-size-sm .st-segmented-control-track{padding:2px;gap:2px}:host.st-size-md{--st-segmented-control-height: var(--st-interactive-element-height-md);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 14px;--st-segmented-control-padding-x: var(--st-size-xxs)}:host.st-size-md .st-segmented-control-track{padding:4px;gap:4px}:host.st-size-lg{--st-segmented-control-height: var(--st-interactive-element-height-lg);--st-segmented-control-item-height: calc(var(--st-segmented-control-height) - 8px);--st-segmented-control-font-size: 16px;--st-segmented-control-padding-x: var(--st-size-xs)}:host.st-size-lg .st-segmented-control-track{padding:4px;gap:4px}:host.st-state-error{--st-segmented-control-border-color: var(--st-segmented-control-error-border)}:host.st-state-success{--st-segmented-control-border-color: var(--st-segmented-control-success-border)}:host.st-state-warning{--st-segmented-control-border-color: var(--st-segmented-control-warning-border)}:host.st-segmented-control-full-width{width:100%}:host.st-segmented-control-full-width .st-segmented-control-track{display:flex;width:100%}.st-segmented-control-track{display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;width:fit-content;max-width:100%;min-width:0;position:relative;border-radius:var(--st-segmented-control-border-radius);border:1px solid var(--st-segmented-control-border-color);box-sizing:border-box;background-color:var(--st-color-bg-raised);height:var(--st-segmented-control-height);padding:4px;gap:4px;transition:border-color var(--st-transition-fast);-ms-overflow-style:none;scrollbar-width:none}.st-segmented-control-track::-webkit-scrollbar{display:none}.selection-item{display:flex;align-items:center;justify-content:center;gap:var(--st-space-2, 8px);height:var(--st-segmented-control-item-height);padding:0 var(--st-segmented-control-padding-x);border-radius:calc(var(--st-segmented-control-border-radius) - 2px);font-size:var(--st-segmented-control-font-size);font-weight:500;-webkit-user-select:none;user-select:none;transition:background-color var(--st-transition-fast),color var(--st-transition-fast)}#selection-indicator{cursor:default;position:absolute;top:0;left:0;z-index:0;pointer-events:none;border-radius:calc(var(--st-segmented-control-border-radius) - 2px);background-color:var(--st-color-control-primary-bg);color:var(--st-color-control-primary-text);text-wrap:nowrap;box-shadow:var(--st-shadow-1);transition:left var(--st-transition-fast),width var(--st-transition-fast)}.st-segmented-control-message{margin-top:var(--st-space-1);font-size:var(--st-font-size-sm, 12px);color:var(--st-color-text-secondary)}.st-segmented-control-message.st-message-error{color:var(--st-color-feedback-error-text)}.st-segmented-control-message.st-message-success{color:var(--st-color-feedback-success-text)}.st-segmented-control-message.st-message-warning{color:var(--st-color-feedback-warning-text)}\n"] }]
|
|
4511
6244
|
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], colorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorMessage", required: false }] }], segmentItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataSegmentedControlItemComponent), { isSignal: true }] }], segmentItemsRefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StrataSegmentedControlItemComponent), { ...{
|
|
4512
6245
|
read: ElementRef
|
|
4513
6246
|
}, isSignal: true }] }] } });
|
|
@@ -4884,7 +6617,7 @@ class StrataSingleSelectComponent {
|
|
|
4884
6617
|
useExisting: forwardRef(() => StrataSingleSelectComponent),
|
|
4885
6618
|
multi: true
|
|
4886
6619
|
}
|
|
4887
|
-
], queries: [{ propertyName: "selectItems", predicate: StrataSelectItemComponent, isSignal: true }, { propertyName: "triggerTemplate", first: true, predicate: StrataSelectTriggerDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputField", first: true, predicate: StrataInputFieldComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n<label class=\"st-label\" [for]=\"name()\"> {{ label() }}</label>\n}\n<div class=\"single-select-input\" [class.disabled]=\"effectiveDisabled()\" [id]=\"name()\" #singleSelectInput (click)=\"toggle($event)\" (keydown.space)=\"toggle($event)\" (keydown.enter)=\"toggle($event)\" (keydown.escape)=\"open.set(false)\" [attr.data-open]=\"open()\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\" [stOverlay]=\"selector\" [overlayOpen]=\"open()\" [overlayPlacement]=\"placement()\">\n @if (selectedItem()) {\n @if (triggerTemplate()) {\n <ng-container *ngTemplateOutlet=\"triggerTemplate()!\"></ng-container>\n } @else {\n {{ selectedItem()!.text() }}\n }\n } @else {\n <span class=\"placeholder-text\">{{ placeholder() }}</span>\n }\n\n <st-icon name=\"expand-up-down\"></st-icon>\n</div>\n@if (message()) {\n <div\n class=\"st-select-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n<ng-template #selector>\n <div class=\"single-select-selector\" #singleSelectSelector [class.full-width]=\"fullWidth()\">\n @if (searchable()) {\n <st-input-field>\n <input stInput #searchField type=\"text\" [value]=\"searchQuery() || ''\" (input)=\"searchQuery.set($any($event.target).value); onSearchChange(searchQuery())\" [placeholder]=\"searchPlaceholder()\" />\n <button stButton variant=\"ghost\" [class.visible]=\"searchQuery() !== undefined && searchQuery()!.length > 0\" suffix\n size=\"sm\" (click)=\"searchQuery.set(undefined); onSearchChange(undefined)\">\n x\n </button>\n </st-input-field>\n }\n <div class=\"single-select-items-container\">\n <ng-content select=\"st-select-item\"></ng-content>\n </div>\n </div>\n</ng-template>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataInputFieldComponent, selector: "st-input-field", inputs: ["size", "label", "id", "name", "state", "error", "message", "colorMessage", "disabled", "maxLength", "showCharacterCounter", "characterCounterFormatter"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: StrataNativeInputRefDirective, selector: "input[stInput], textarea[stInput]" }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
6620
|
+
], queries: [{ propertyName: "selectItems", predicate: StrataSelectItemComponent, isSignal: true }, { propertyName: "triggerTemplate", first: true, predicate: StrataSelectTriggerDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputField", first: true, predicate: StrataInputFieldComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\n<label class=\"st-label\" [for]=\"name()\"> {{ label() }}</label>\n}\n<div class=\"single-select-input\" [class.disabled]=\"effectiveDisabled()\" [id]=\"name()\" #singleSelectInput (click)=\"toggle($event)\" (keydown.space)=\"toggle($event)\" (keydown.enter)=\"toggle($event)\" (keydown.escape)=\"open.set(false)\" [attr.data-open]=\"open()\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\" [stOverlay]=\"selector\" [overlayOpen]=\"open()\" [overlayPlacement]=\"placement()\">\n @if (selectedItem()) {\n @if (triggerTemplate()) {\n <ng-container *ngTemplateOutlet=\"triggerTemplate()!\"></ng-container>\n } @else {\n {{ selectedItem()!.text() }}\n }\n } @else {\n <span class=\"placeholder-text\">{{ placeholder() }}</span>\n }\n\n <st-icon name=\"expand-up-down\"></st-icon>\n</div>\n@if (message()) {\n <div\n class=\"st-select-message\"\n [class.st-message-error]=\"isMessageError()\"\n [class.st-message-success]=\"isMessageSuccess()\"\n [class.st-message-warning]=\"isMessageWarning()\"\n [attr.role]=\"isMessageError() ? 'alert' : null\"\n >\n {{ message() }}\n </div>\n}\n\n<ng-template #selector>\n <div class=\"single-select-selector\" #singleSelectSelector [class.full-width]=\"fullWidth()\">\n @if (searchable()) {\n <st-input-field>\n <input stInput #searchField type=\"text\" [value]=\"searchQuery() || ''\" (input)=\"searchQuery.set($any($event.target).value); onSearchChange(searchQuery())\" [placeholder]=\"searchPlaceholder()\" />\n <button stButton variant=\"ghost\" [class.visible]=\"searchQuery() !== undefined && searchQuery()!.length > 0\" suffix\n size=\"sm\" (click)=\"searchQuery.set(undefined); onSearchChange(undefined)\">\n x\n </button>\n </st-input-field>\n }\n <div class=\"single-select-items-container\">\n <ng-content select=\"st-select-item\"></ng-content>\n </div>\n </div>\n</ng-template>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StrataIconComponent, selector: "st-icon", inputs: ["name", "size", "ariaLabel"], outputs: ["sizeChange"] }, { kind: "directive", type: StrataOverlayDirective, selector: "[stOverlay]", inputs: ["stOverlay", "overlayOpen", "overlayPlacement", "overlayOffset", "overlayFitViewport", "overlayTarget"], outputs: ["overlayOpenChange"] }, { kind: "component", type: StrataInputFieldComponent, selector: "st-input-field", inputs: ["size", "label", "id", "name", "state", "error", "message", "colorMessage", "disabled", "maxLength", "showCharacterCounter", "characterCounterFormatter"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: StrataNativeInputRefDirective, selector: "input[stInput], textarea[stInput]" }, { kind: "directive", type: StrataButtonDirective, selector: "[stButton]", inputs: ["variant", "size", "fullWidth"] }] });
|
|
4888
6621
|
}
|
|
4889
6622
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: StrataSingleSelectComponent, decorators: [{
|
|
4890
6623
|
type: Component,
|
|
@@ -5345,5 +7078,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
|
|
|
5345
7078
|
* Generated bundle index. Do not edit.
|
|
5346
7079
|
*/
|
|
5347
7080
|
|
|
5348
|
-
export { BreakpointService, CapitalizePipe, DEFAULT_DURATION, DEFAULT_THEME, DarkmodeService, DeviceService, HotkeyService, HttpIconLoader, IconLoader, IconRegistry, IconRegistryService, ModalService, NotificationService, STRATA_CONFIG, StrataAccordionGroupComponent, StrataAccordionItemComponent, StrataActionMenuComponent, StrataActionMenuItemComponent, StrataActivatableDirective, StrataAlertComponent, StrataAlertContentComponent, StrataAutoResizeDirective, StrataAvatarComponent, StrataAvatarStackComponent, StrataBadgeComponent, StrataBreadcrumbComponent, StrataBreadcrumbItemComponent, StrataButtonDirective, StrataButtonGroupComponent, StrataCardComponent, StrataCheckboxComponent, StrataDividerComponent, StrataFileUploadComponent, StrataIconComponent, StrataImageCropperComponent, StrataInputFieldComponent, StrataItemComponent, StrataItemListComponent, StrataKbdComponent, StrataMessageStateComponent, StrataModalBodyComponent, StrataModalComponent, StrataModalContainerComponent, StrataModalFooterComponent, StrataModalHeaderComponent, StrataModalRef, StrataNativeInputRefDirective, StrataNotificationComponent, StrataNotificationContainerComponent, StrataNumberDisplayComponent, StrataNumberStepperComponent, StrataOtpComponent, StrataOverlayDirective, StrataPaginationComponent, StrataProgressLinearComponent, StrataProgressRadialComponent, StrataRadioComponent, StrataRadioGroupComponent, StrataSegmentedControlComponent, StrataSegmentedControlItemComponent, StrataSelectItemComponent, StrataSelectTriggerDirective, StrataShellComponent, StrataSidemenuComponent, StrataSidemenuItemDirective, StrataSidemenuItemGroupComponent, StrataSidemenuSectionComponent, StrataSingleSelectComponent, StrataSkeletonComponent, StrataSliderComponent, StrataSpinnerComponent, StrataStepComponent, StrataStepperComponent, StrataTabItemComponent, StrataTabsComponent, StrataTagComponent, StrataTextStackComponent, StrataThemeDirective, StrataToggleComponent, StrataTooltipDirective, getDefaultShortcutLabels, isApplePlatform, provideBaseIcons, provideIcons, provideStrata, resolveIsApple };
|
|
7081
|
+
export { BreakpointService, CapitalizePipe, DEFAULT_DATE_RANGE_PRESETS, DEFAULT_DURATION, DEFAULT_THEME, DarkmodeService, DeviceService, HotkeyService, HttpIconLoader, IconLoader, IconRegistry, IconRegistryService, ModalService, NotificationService, STRATA_CONFIG, StrataAccordionGroupComponent, StrataAccordionItemComponent, StrataActionMenuComponent, StrataActionMenuItemComponent, StrataActivatableDirective, StrataAlertComponent, StrataAlertContentComponent, StrataAutoResizeDirective, StrataAvatarComponent, StrataAvatarStackComponent, StrataBadgeComponent, StrataBreadcrumbComponent, StrataBreadcrumbItemComponent, StrataButtonDirective, StrataButtonGroupComponent, StrataCalendarComponent, StrataCardComponent, StrataCheckboxComponent, StrataContextMenuDirective, StrataDatePickerComponent, StrataDateRangePickerComponent, StrataDividerComponent, StrataFileUploadComponent, StrataIconComponent, StrataImageCropperComponent, StrataInputFieldComponent, StrataItemComponent, StrataItemListComponent, StrataKbdComponent, StrataMessageStateComponent, StrataModalBodyComponent, StrataModalComponent, StrataModalContainerComponent, StrataModalFooterComponent, StrataModalHeaderComponent, StrataModalRef, StrataNativeInputRefDirective, StrataNotificationComponent, StrataNotificationContainerComponent, StrataNumberDisplayComponent, StrataNumberStepperComponent, StrataOtpComponent, StrataOverlayDirective, StrataPaginationComponent, StrataProgressLinearComponent, StrataProgressRadialComponent, StrataRadioComponent, StrataRadioGroupComponent, StrataSegmentedControlComponent, StrataSegmentedControlItemComponent, StrataSelectItemComponent, StrataSelectTriggerDirective, StrataShellComponent, StrataSidemenuComponent, StrataSidemenuItemDirective, StrataSidemenuItemGroupComponent, StrataSidemenuSectionComponent, StrataSingleSelectComponent, StrataSkeletonComponent, StrataSliderComponent, StrataSpinnerComponent, StrataStepComponent, StrataStepperComponent, StrataTabItemComponent, StrataTabsComponent, StrataTagComponent, StrataTextStackComponent, StrataThemeDirective, StrataTimeStepperComponent, StrataTimepickerComponent, StrataToggleComponent, StrataTooltipDirective, addDays, addMonths, addYears, createCalendarGrid, disableDateRange, disableDaysOfWeek, disableFutureDates, disablePastDates, disableWeekends, endOfDay, endOfMonth, formatDate, formatMonthTitle, getDayOfWeek, getDaysInMonth, getDefaultShortcutLabels, getLocaleDefaultDateFormat, getMonthNames, getWeekdayNames, isAfterDay, isApplePlatform, isBeforeDay, isSameDay, isSameMonth, isSameYear, isWeekend, isWithinDayRange, parseDate, provideBaseIcons, provideIcons, provideStrata, resolveIsApple, startOfDay, startOfMonth };
|
|
5349
7082
|
//# sourceMappingURL=ngx-strata.mjs.map
|