dasar-ui 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -43
- package/fesm2022/dasar-ui.mjs +1921 -2
- package/fesm2022/dasar-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/dasar-ui.d.ts +1050 -224
package/fesm2022/dasar-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, DOCUMENT, DestroyRef, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Injectable, InjectionToken, Input, NgZone, Output, PLATFORM_ID, TemplateRef, ViewChild, ViewEncapsulation, booleanAttribute, contentChildren, effect, forwardRef, inject, signal } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, DOCUMENT, DestroyRef, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Injectable, InjectionToken, Input, NgZone, Output, PLATFORM_ID, TemplateRef, ViewChild, ViewEncapsulation, booleanAttribute, computed, contentChildren, effect, forwardRef, inject, signal, untracked } from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/common";
|
|
4
4
|
import { CommonModule, DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
|
|
5
5
|
import { BehaviorSubject } from "rxjs";
|
|
@@ -414,6 +414,78 @@ const dividerMap = {
|
|
|
414
414
|
labelOffset: "--divider-label-offset",
|
|
415
415
|
verticalMinHeight: "--divider-vertical-min-height"
|
|
416
416
|
};
|
|
417
|
+
const alertMap = {
|
|
418
|
+
padding: "--alert-padding",
|
|
419
|
+
gap: "--alert-gap",
|
|
420
|
+
radius: "--alert-radius",
|
|
421
|
+
borderWidth: "--alert-border-width",
|
|
422
|
+
fontSize: "--alert-font-size",
|
|
423
|
+
titleFontSize: "--alert-title-font-size",
|
|
424
|
+
titleFontWeight: "--alert-title-font-weight",
|
|
425
|
+
titleGap: "--alert-title-gap",
|
|
426
|
+
closePadding: "--alert-close-padding",
|
|
427
|
+
closeHoverBg: "--alert-close-hover-bg",
|
|
428
|
+
leaveDuration: "--alert-leave-duration",
|
|
429
|
+
primaryBg: "--alert-primary-bg",
|
|
430
|
+
primaryColor: "--alert-primary-color",
|
|
431
|
+
primaryBorder: "--alert-primary-border",
|
|
432
|
+
primaryIconColor: "--alert-primary-icon-color",
|
|
433
|
+
secondaryBg: "--alert-secondary-bg",
|
|
434
|
+
secondaryColor: "--alert-secondary-color",
|
|
435
|
+
secondaryBorder: "--alert-secondary-border",
|
|
436
|
+
secondaryIconColor: "--alert-secondary-icon-color",
|
|
437
|
+
successBg: "--alert-success-bg",
|
|
438
|
+
successColor: "--alert-success-color",
|
|
439
|
+
successBorder: "--alert-success-border",
|
|
440
|
+
successIconColor: "--alert-success-icon-color",
|
|
441
|
+
warningBg: "--alert-warning-bg",
|
|
442
|
+
warningColor: "--alert-warning-color",
|
|
443
|
+
warningBorder: "--alert-warning-border",
|
|
444
|
+
warningIconColor: "--alert-warning-icon-color",
|
|
445
|
+
dangerBg: "--alert-danger-bg",
|
|
446
|
+
dangerColor: "--alert-danger-color",
|
|
447
|
+
dangerBorder: "--alert-danger-border",
|
|
448
|
+
dangerIconColor: "--alert-danger-icon-color"
|
|
449
|
+
};
|
|
450
|
+
const checkboxMap = {
|
|
451
|
+
gap: "--checkbox-gap",
|
|
452
|
+
hintGap: "--checkbox-hint-gap",
|
|
453
|
+
sizeSm: "--checkbox-size-sm",
|
|
454
|
+
sizeMd: "--checkbox-size-md",
|
|
455
|
+
sizeLg: "--checkbox-size-lg",
|
|
456
|
+
radius: "--checkbox-radius",
|
|
457
|
+
borderWidth: "--checkbox-border-width",
|
|
458
|
+
borderColor: "--checkbox-border-color",
|
|
459
|
+
bg: "--checkbox-bg",
|
|
460
|
+
checkedBg: "--checkbox-checked-bg",
|
|
461
|
+
checkColor: "--checkbox-check-color",
|
|
462
|
+
focusColor: "--checkbox-focus-color",
|
|
463
|
+
errorColor: "--checkbox-error-color",
|
|
464
|
+
disabledOpacity: "--checkbox-disabled-opacity",
|
|
465
|
+
labelColor: "--checkbox-label-color",
|
|
466
|
+
hintColor: "--checkbox-hint-color",
|
|
467
|
+
hintFontSize: "--checkbox-hint-font-size",
|
|
468
|
+
groupGap: "--checkbox-group-gap"
|
|
469
|
+
};
|
|
470
|
+
const radioMap = {
|
|
471
|
+
gap: "--radio-gap",
|
|
472
|
+
hintGap: "--radio-hint-gap",
|
|
473
|
+
sizeSm: "--radio-size-sm",
|
|
474
|
+
sizeMd: "--radio-size-md",
|
|
475
|
+
sizeLg: "--radio-size-lg",
|
|
476
|
+
dotSize: "--radio-dot-size",
|
|
477
|
+
borderWidth: "--radio-border-width",
|
|
478
|
+
borderColor: "--radio-border-color",
|
|
479
|
+
bg: "--radio-bg",
|
|
480
|
+
checkedColor: "--radio-checked-color",
|
|
481
|
+
focusColor: "--radio-focus-color",
|
|
482
|
+
errorColor: "--radio-error-color",
|
|
483
|
+
disabledOpacity: "--radio-disabled-opacity",
|
|
484
|
+
labelColor: "--radio-label-color",
|
|
485
|
+
hintColor: "--radio-hint-color",
|
|
486
|
+
hintFontSize: "--radio-hint-font-size",
|
|
487
|
+
groupGap: "--radio-group-gap"
|
|
488
|
+
};
|
|
417
489
|
const selectMap = {
|
|
418
490
|
wrapperGap: "--select-wrapper-gap",
|
|
419
491
|
labelFontsize: "--select-label-font-size",
|
|
@@ -752,6 +824,9 @@ var DasarThemeService = class DasarThemeService {
|
|
|
752
824
|
if (config.tokens?.[config.mode]?.datepicker) this.injectMappedTokens(root, config.tokens?.[config.mode]?.datepicker, datepickerMap);
|
|
753
825
|
if (config.tokens?.[config.mode]?.chip) this.injectMappedTokens(root, config.tokens?.[config.mode]?.chip, chipMap);
|
|
754
826
|
if (config.tokens?.[config.mode]?.divider) this.injectMappedTokens(root, config.tokens?.[config.mode]?.divider, dividerMap);
|
|
827
|
+
if (config.tokens?.[config.mode]?.alert) this.injectMappedTokens(root, config.tokens?.[config.mode]?.alert, alertMap);
|
|
828
|
+
if (config.tokens?.[config.mode]?.checkbox) this.injectMappedTokens(root, config.tokens?.[config.mode]?.checkbox, checkboxMap);
|
|
829
|
+
if (config.tokens?.[config.mode]?.radio) this.injectMappedTokens(root, config.tokens?.[config.mode]?.radio, radioMap);
|
|
755
830
|
if (config.tokens?.[config.mode]?.select) this.injectMappedTokens(root, config.tokens?.[config.mode]?.select, selectMap);
|
|
756
831
|
if (config.tokens?.[config.mode]?.card) this.injectMappedTokens(root, config.tokens?.[config.mode]?.card, cardMap);
|
|
757
832
|
if (config.tokens?.[config.mode]?.menu) this.injectMappedTokens(root, config.tokens?.[config.mode]?.menu, menuMap);
|
|
@@ -944,6 +1019,24 @@ var DasarThemeProviderComponent = class DasarThemeProviderComponent {
|
|
|
944
1019
|
payload: dividerTokens,
|
|
945
1020
|
dictionary: dividerMap
|
|
946
1021
|
});
|
|
1022
|
+
const alertTokens = this.tokenConfig?.[currentMode]?.alert || this.tokenConfig?.light?.alert;
|
|
1023
|
+
if (alertTokens) this.injectMappedTokens({
|
|
1024
|
+
element: hostElement,
|
|
1025
|
+
payload: alertTokens,
|
|
1026
|
+
dictionary: alertMap
|
|
1027
|
+
});
|
|
1028
|
+
const checkboxTokens = this.tokenConfig?.[currentMode]?.checkbox || this.tokenConfig?.light?.checkbox;
|
|
1029
|
+
if (checkboxTokens) this.injectMappedTokens({
|
|
1030
|
+
element: hostElement,
|
|
1031
|
+
payload: checkboxTokens,
|
|
1032
|
+
dictionary: checkboxMap
|
|
1033
|
+
});
|
|
1034
|
+
const radioTokens = this.tokenConfig?.[currentMode]?.radio || this.tokenConfig?.light?.radio;
|
|
1035
|
+
if (radioTokens) this.injectMappedTokens({
|
|
1036
|
+
element: hostElement,
|
|
1037
|
+
payload: radioTokens,
|
|
1038
|
+
dictionary: radioMap
|
|
1039
|
+
});
|
|
947
1040
|
const selectTokens = this.tokenConfig?.[currentMode]?.select || this.tokenConfig?.light?.select;
|
|
948
1041
|
if (selectTokens) this.injectMappedTokens({
|
|
949
1042
|
element: hostElement,
|
|
@@ -35988,6 +36081,1832 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
35988
36081
|
}
|
|
35989
36082
|
});
|
|
35990
36083
|
const DasarDividerComponent = [DasarDivider, DasarDividerLabelTemplate];
|
|
36084
|
+
var DasarAlertHeaderSlot = class DasarAlertHeaderSlot {
|
|
36085
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36086
|
+
minVersion: "12.0.0",
|
|
36087
|
+
version: "22.2.2",
|
|
36088
|
+
ngImport: i0,
|
|
36089
|
+
type: DasarAlertHeaderSlot,
|
|
36090
|
+
deps: [],
|
|
36091
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
36092
|
+
});
|
|
36093
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
36094
|
+
minVersion: "14.0.0",
|
|
36095
|
+
version: "22.2.2",
|
|
36096
|
+
type: DasarAlertHeaderSlot,
|
|
36097
|
+
isStandalone: true,
|
|
36098
|
+
selector: "[header-slot]",
|
|
36099
|
+
ngImport: i0
|
|
36100
|
+
});
|
|
36101
|
+
};
|
|
36102
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36103
|
+
minVersion: "12.0.0",
|
|
36104
|
+
version: "22.2.2",
|
|
36105
|
+
ngImport: i0,
|
|
36106
|
+
type: DasarAlertHeaderSlot,
|
|
36107
|
+
decorators: [{
|
|
36108
|
+
type: Directive,
|
|
36109
|
+
args: [{
|
|
36110
|
+
selector: "[header-slot]",
|
|
36111
|
+
standalone: true
|
|
36112
|
+
}]
|
|
36113
|
+
}]
|
|
36114
|
+
});
|
|
36115
|
+
var DasarAlertIconSlot = class DasarAlertIconSlot {
|
|
36116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36117
|
+
minVersion: "12.0.0",
|
|
36118
|
+
version: "22.2.2",
|
|
36119
|
+
ngImport: i0,
|
|
36120
|
+
type: DasarAlertIconSlot,
|
|
36121
|
+
deps: [],
|
|
36122
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
36123
|
+
});
|
|
36124
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
36125
|
+
minVersion: "14.0.0",
|
|
36126
|
+
version: "22.2.2",
|
|
36127
|
+
type: DasarAlertIconSlot,
|
|
36128
|
+
isStandalone: true,
|
|
36129
|
+
selector: "[icon-slot]",
|
|
36130
|
+
ngImport: i0
|
|
36131
|
+
});
|
|
36132
|
+
};
|
|
36133
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36134
|
+
minVersion: "12.0.0",
|
|
36135
|
+
version: "22.2.2",
|
|
36136
|
+
ngImport: i0,
|
|
36137
|
+
type: DasarAlertIconSlot,
|
|
36138
|
+
decorators: [{
|
|
36139
|
+
type: Directive,
|
|
36140
|
+
args: [{
|
|
36141
|
+
selector: "[icon-slot]",
|
|
36142
|
+
standalone: true
|
|
36143
|
+
}]
|
|
36144
|
+
}]
|
|
36145
|
+
});
|
|
36146
|
+
var DasarAlert = class DasarAlert {
|
|
36147
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
36148
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
36149
|
+
leaveTimer = null;
|
|
36150
|
+
shown = signal(true, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
36151
|
+
leaving = signal(false, ...ngDevMode ? [{ debugName: "leaving" }] : /* istanbul ignore next */ []);
|
|
36152
|
+
variant = resolveThemeDefault("alert", "variant", "primary", this.themeProvider, this.themeService);
|
|
36153
|
+
bordered = resolveThemeDefault("alert", "bordered", true, this.themeProvider, this.themeService);
|
|
36154
|
+
closeable = resolveThemeDefault("alert", "closeable", false, this.themeProvider, this.themeService);
|
|
36155
|
+
title = null;
|
|
36156
|
+
iconName = resolveThemeDefault("alert", "iconName", null, this.themeProvider, this.themeService);
|
|
36157
|
+
closeIconName = resolveThemeDefault("alert", "closeIconName", "x", this.themeProvider, this.themeService);
|
|
36158
|
+
containerClass = resolveThemeDefault("alert", "containerClass", null, this.themeProvider, this.themeService);
|
|
36159
|
+
containerStyle = resolveThemeDefault("alert", "containerStyle", null, this.themeProvider, this.themeService);
|
|
36160
|
+
titleClass = resolveThemeDefault("alert", "titleClass", null, this.themeProvider, this.themeService);
|
|
36161
|
+
titleStyle = resolveThemeDefault("alert", "titleStyle", null, this.themeProvider, this.themeService);
|
|
36162
|
+
contentClass = resolveThemeDefault("alert", "contentClass", null, this.themeProvider, this.themeService);
|
|
36163
|
+
contentStyle = resolveThemeDefault("alert", "contentStyle", null, this.themeProvider, this.themeService);
|
|
36164
|
+
set visible(value) {
|
|
36165
|
+
this.clearLeaveTimer();
|
|
36166
|
+
this.leaving.set(false);
|
|
36167
|
+
this.shown.set(value);
|
|
36168
|
+
}
|
|
36169
|
+
get visible() {
|
|
36170
|
+
return this.shown();
|
|
36171
|
+
}
|
|
36172
|
+
visibleChange = new EventEmitter();
|
|
36173
|
+
onClose = new EventEmitter();
|
|
36174
|
+
onAfterLeave = new EventEmitter();
|
|
36175
|
+
headerSlot;
|
|
36176
|
+
iconSlot;
|
|
36177
|
+
get hostClasses() {
|
|
36178
|
+
return this.shown() ? "dasar-alert" : "dasar-alert hidden";
|
|
36179
|
+
}
|
|
36180
|
+
get role() {
|
|
36181
|
+
return this.variant === "danger" || this.variant === "warning" ? "alert" : "status";
|
|
36182
|
+
}
|
|
36183
|
+
get hasIcon() {
|
|
36184
|
+
return !!this.iconSlot || !!this.iconName;
|
|
36185
|
+
}
|
|
36186
|
+
get hasHeader() {
|
|
36187
|
+
return !!this.headerSlot || !!this.title;
|
|
36188
|
+
}
|
|
36189
|
+
get containerClasses() {
|
|
36190
|
+
const overrideClass = parseClassesToArray(this.containerClass);
|
|
36191
|
+
const baseClass = {
|
|
36192
|
+
[this.variant]: true,
|
|
36193
|
+
bordered: this.bordered,
|
|
36194
|
+
closeable: this.closeable,
|
|
36195
|
+
"with-icon": this.hasIcon,
|
|
36196
|
+
"with-header": this.hasHeader,
|
|
36197
|
+
leaving: this.leaving()
|
|
36198
|
+
};
|
|
36199
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36200
|
+
...baseClass,
|
|
36201
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36202
|
+
};
|
|
36203
|
+
return baseClass;
|
|
36204
|
+
}
|
|
36205
|
+
get titleClasses() {
|
|
36206
|
+
const overrideClass = parseClassesToArray(this.titleClass);
|
|
36207
|
+
const baseClass = { "dasar-alert-title": true };
|
|
36208
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36209
|
+
...baseClass,
|
|
36210
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36211
|
+
};
|
|
36212
|
+
return baseClass;
|
|
36213
|
+
}
|
|
36214
|
+
get contentClasses() {
|
|
36215
|
+
const overrideClass = parseClassesToArray(this.contentClass);
|
|
36216
|
+
const baseClass = { "dasar-alert-content": true };
|
|
36217
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36218
|
+
...baseClass,
|
|
36219
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36220
|
+
};
|
|
36221
|
+
return baseClass;
|
|
36222
|
+
}
|
|
36223
|
+
close(event) {
|
|
36224
|
+
if (this.leaving() || !this.shown()) return;
|
|
36225
|
+
this.onClose.emit(event);
|
|
36226
|
+
this.leaving.set(true);
|
|
36227
|
+
this.leaveTimer = setTimeout(() => this.finishLeave(), 400);
|
|
36228
|
+
}
|
|
36229
|
+
onAnimationEnd(event) {
|
|
36230
|
+
if (event.target !== event.currentTarget || !this.leaving()) return;
|
|
36231
|
+
this.finishLeave();
|
|
36232
|
+
}
|
|
36233
|
+
finishLeave() {
|
|
36234
|
+
if (!this.leaving()) return;
|
|
36235
|
+
this.clearLeaveTimer();
|
|
36236
|
+
this.leaving.set(false);
|
|
36237
|
+
this.shown.set(false);
|
|
36238
|
+
this.visibleChange.emit(false);
|
|
36239
|
+
this.onAfterLeave.emit();
|
|
36240
|
+
}
|
|
36241
|
+
clearLeaveTimer() {
|
|
36242
|
+
if (this.leaveTimer) clearTimeout(this.leaveTimer);
|
|
36243
|
+
this.leaveTimer = null;
|
|
36244
|
+
}
|
|
36245
|
+
ngOnDestroy() {
|
|
36246
|
+
this.clearLeaveTimer();
|
|
36247
|
+
}
|
|
36248
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36249
|
+
minVersion: "12.0.0",
|
|
36250
|
+
version: "22.2.2",
|
|
36251
|
+
ngImport: i0,
|
|
36252
|
+
type: DasarAlert,
|
|
36253
|
+
deps: [],
|
|
36254
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
36255
|
+
});
|
|
36256
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
36257
|
+
minVersion: "17.0.0",
|
|
36258
|
+
version: "22.2.2",
|
|
36259
|
+
type: DasarAlert,
|
|
36260
|
+
isStandalone: true,
|
|
36261
|
+
selector: "dasar-alert",
|
|
36262
|
+
inputs: {
|
|
36263
|
+
variant: "variant",
|
|
36264
|
+
bordered: [
|
|
36265
|
+
"bordered",
|
|
36266
|
+
"bordered",
|
|
36267
|
+
booleanAttribute
|
|
36268
|
+
],
|
|
36269
|
+
closeable: [
|
|
36270
|
+
"closeable",
|
|
36271
|
+
"closeable",
|
|
36272
|
+
booleanAttribute
|
|
36273
|
+
],
|
|
36274
|
+
title: "title",
|
|
36275
|
+
iconName: ["icon-name", "iconName"],
|
|
36276
|
+
closeIconName: ["close-icon-name", "closeIconName"],
|
|
36277
|
+
containerClass: ["container-class", "containerClass"],
|
|
36278
|
+
containerStyle: ["container-style", "containerStyle"],
|
|
36279
|
+
titleClass: ["title-class", "titleClass"],
|
|
36280
|
+
titleStyle: ["title-style", "titleStyle"],
|
|
36281
|
+
contentClass: ["content-class", "contentClass"],
|
|
36282
|
+
contentStyle: ["content-style", "contentStyle"],
|
|
36283
|
+
visible: [
|
|
36284
|
+
"visible",
|
|
36285
|
+
"visible",
|
|
36286
|
+
booleanAttribute
|
|
36287
|
+
]
|
|
36288
|
+
},
|
|
36289
|
+
outputs: {
|
|
36290
|
+
visibleChange: "visibleChange",
|
|
36291
|
+
onClose: "onClose",
|
|
36292
|
+
onAfterLeave: "onAfterLeave"
|
|
36293
|
+
},
|
|
36294
|
+
host: { properties: {
|
|
36295
|
+
"class": "this.hostClasses",
|
|
36296
|
+
"attr.role": "this.role"
|
|
36297
|
+
} },
|
|
36298
|
+
queries: [{
|
|
36299
|
+
propertyName: "headerSlot",
|
|
36300
|
+
first: true,
|
|
36301
|
+
predicate: DasarAlertHeaderSlot,
|
|
36302
|
+
descendants: true
|
|
36303
|
+
}, {
|
|
36304
|
+
propertyName: "iconSlot",
|
|
36305
|
+
first: true,
|
|
36306
|
+
predicate: DasarAlertIconSlot,
|
|
36307
|
+
descendants: true
|
|
36308
|
+
}],
|
|
36309
|
+
ngImport: i0,
|
|
36310
|
+
template: "@if (shown()) {\n <div\n class=\"dasar-alert-container\"\n [ngClass]=\"containerClasses\"\n [ngStyle]=\"containerStyle\"\n (animationend)=\"onAnimationEnd($event)\"\n >\n @if (hasIcon) {\n <span class=\"dasar-alert-icon\">\n <ng-content select=\"[icon-slot]\"></ng-content>\n @if (!iconSlot && iconName) {\n <dasar-icon [name]=\"iconName\" size=\"sm\" />\n }\n </span>\n }\n <div class=\"dasar-alert-body\">\n @if (hasHeader) {\n <div [ngClass]=\"titleClasses\" [ngStyle]=\"titleStyle\">\n <ng-content select=\"[header-slot]\"></ng-content>\n @if (!headerSlot && title) {\n {{ title }}\n }\n </div>\n }\n <div [ngClass]=\"contentClasses\" [ngStyle]=\"contentStyle\">\n <ng-content></ng-content>\n </div>\n </div>\n @if (closeable) {\n <button type=\"button\" class=\"dasar-alert-close\" aria-label=\"Close\" (click)=\"close($event)\">\n <dasar-icon [name]=\"closeIconName\" size=\"sm\" />\n </button>\n }\n </div>\n}\n",
|
|
36311
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-alert{display:block}.dasar-alert.hidden{display:none}.dasar-alert-container{--alert-bg-local: var(--alert-primary-bg, var(--dasar-primary-50));--alert-color-local: var(--alert-primary-color, var(--dasar-primary-800));--alert-border-local: var(--alert-primary-border, var(--dasar-primary-200));--alert-icon-local: var(--alert-primary-icon-color, var(--dasar-primary-base));display:flex;align-items:flex-start;gap:var(--alert-gap, var(--space-3));box-sizing:border-box;width:100%;padding:var(--alert-padding, var(--space-3));border-radius:var(--alert-radius, var(--radius-md));border:var(--alert-border-width, 1px) solid transparent;background:var(--alert-bg-local);color:var(--alert-color-local);font-size:var(--alert-font-size, var(--font-size-sm))}.dasar-alert-container.bordered{border-color:var(--alert-border-local)}.dasar-alert-container.leaving{animation:dasar-alert-leave var(--alert-leave-duration, .2s) ease forwards}.dasar-alert-container.secondary{--alert-bg-local: var(--alert-secondary-bg, var(--dasar-neutral-100));--alert-color-local: var(--alert-secondary-color, var(--dasar-neutral-800));--alert-border-local: var(--alert-secondary-border, var(--dasar-neutral-300));--alert-icon-local: var(--alert-secondary-icon-color, var(--dasar-neutral-500))}.dasar-alert-container.success{--alert-bg-local: var(--alert-success-bg, var(--dasar-success-50));--alert-color-local: var(--alert-success-color, var(--dasar-success-800));--alert-border-local: var(--alert-success-border, var(--dasar-success-200));--alert-icon-local: var(--alert-success-icon-color, var(--dasar-success-base))}.dasar-alert-container.warning{--alert-bg-local: var(--alert-warning-bg, var(--dasar-warning-50));--alert-color-local: var(--alert-warning-color, var(--dasar-warning-800));--alert-border-local: var(--alert-warning-border, var(--dasar-warning-200));--alert-icon-local: var(--alert-warning-icon-color, var(--dasar-warning-base))}.dasar-alert-container.danger{--alert-bg-local: var(--alert-danger-bg, var(--dasar-danger-50));--alert-color-local: var(--alert-danger-color, var(--dasar-danger-800));--alert-border-local: var(--alert-danger-border, var(--dasar-danger-200));--alert-icon-local: var(--alert-danger-icon-color, var(--dasar-danger-base))}.dasar-alert-icon{display:inline-flex;flex:none;color:var(--alert-icon-local);padding-top:1px}.dasar-alert-body{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:var(--alert-title-gap, 2px)}.dasar-alert-title{font-weight:var(--alert-title-font-weight, var(--font-weight-semibold));font-size:var(--alert-title-font-size, var(--font-size-base))}.dasar-alert-close{flex:none;display:inline-flex;align-items:center;justify-content:center;padding:var(--alert-close-padding, 2px);margin:0;border:0;border-radius:var(--radius-md);background:transparent;color:inherit;cursor:pointer}.dasar-alert-close:hover{background:var(--alert-close-hover-bg, var(--theme-bg-hover-color))}.dasar-alert-close:focus-visible{outline:2px solid var(--alert-icon-local);outline-offset:1px}@keyframes dasar-alert-leave{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@media(prefers-reduced-motion:reduce){.dasar-alert-container.leaving{animation-duration:1ms}}\n"],
|
|
36312
|
+
dependencies: [
|
|
36313
|
+
{
|
|
36314
|
+
kind: "ngmodule",
|
|
36315
|
+
type: CommonModule
|
|
36316
|
+
},
|
|
36317
|
+
{
|
|
36318
|
+
kind: "directive",
|
|
36319
|
+
type: i1.NgClass,
|
|
36320
|
+
selector: "[ngClass]",
|
|
36321
|
+
inputs: ["class", "ngClass"]
|
|
36322
|
+
},
|
|
36323
|
+
{
|
|
36324
|
+
kind: "directive",
|
|
36325
|
+
type: i1.NgStyle,
|
|
36326
|
+
selector: "[ngStyle]",
|
|
36327
|
+
inputs: ["ngStyle"]
|
|
36328
|
+
},
|
|
36329
|
+
{
|
|
36330
|
+
kind: "component",
|
|
36331
|
+
type: DasarIcon,
|
|
36332
|
+
selector: "dasar-icon",
|
|
36333
|
+
inputs: [
|
|
36334
|
+
"fluid",
|
|
36335
|
+
"size",
|
|
36336
|
+
"color",
|
|
36337
|
+
"stroke",
|
|
36338
|
+
"name"
|
|
36339
|
+
]
|
|
36340
|
+
}
|
|
36341
|
+
],
|
|
36342
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
36343
|
+
});
|
|
36344
|
+
};
|
|
36345
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36346
|
+
minVersion: "12.0.0",
|
|
36347
|
+
version: "22.2.2",
|
|
36348
|
+
ngImport: i0,
|
|
36349
|
+
type: DasarAlert,
|
|
36350
|
+
decorators: [{
|
|
36351
|
+
type: Component,
|
|
36352
|
+
args: [{
|
|
36353
|
+
encapsulation: ViewEncapsulation.None,
|
|
36354
|
+
selector: "dasar-alert",
|
|
36355
|
+
imports: [CommonModule, DasarIcon],
|
|
36356
|
+
template: "@if (shown()) {\n <div\n class=\"dasar-alert-container\"\n [ngClass]=\"containerClasses\"\n [ngStyle]=\"containerStyle\"\n (animationend)=\"onAnimationEnd($event)\"\n >\n @if (hasIcon) {\n <span class=\"dasar-alert-icon\">\n <ng-content select=\"[icon-slot]\"></ng-content>\n @if (!iconSlot && iconName) {\n <dasar-icon [name]=\"iconName\" size=\"sm\" />\n }\n </span>\n }\n <div class=\"dasar-alert-body\">\n @if (hasHeader) {\n <div [ngClass]=\"titleClasses\" [ngStyle]=\"titleStyle\">\n <ng-content select=\"[header-slot]\"></ng-content>\n @if (!headerSlot && title) {\n {{ title }}\n }\n </div>\n }\n <div [ngClass]=\"contentClasses\" [ngStyle]=\"contentStyle\">\n <ng-content></ng-content>\n </div>\n </div>\n @if (closeable) {\n <button type=\"button\" class=\"dasar-alert-close\" aria-label=\"Close\" (click)=\"close($event)\">\n <dasar-icon [name]=\"closeIconName\" size=\"sm\" />\n </button>\n }\n </div>\n}\n",
|
|
36357
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-alert{display:block}.dasar-alert.hidden{display:none}.dasar-alert-container{--alert-bg-local: var(--alert-primary-bg, var(--dasar-primary-50));--alert-color-local: var(--alert-primary-color, var(--dasar-primary-800));--alert-border-local: var(--alert-primary-border, var(--dasar-primary-200));--alert-icon-local: var(--alert-primary-icon-color, var(--dasar-primary-base));display:flex;align-items:flex-start;gap:var(--alert-gap, var(--space-3));box-sizing:border-box;width:100%;padding:var(--alert-padding, var(--space-3));border-radius:var(--alert-radius, var(--radius-md));border:var(--alert-border-width, 1px) solid transparent;background:var(--alert-bg-local);color:var(--alert-color-local);font-size:var(--alert-font-size, var(--font-size-sm))}.dasar-alert-container.bordered{border-color:var(--alert-border-local)}.dasar-alert-container.leaving{animation:dasar-alert-leave var(--alert-leave-duration, .2s) ease forwards}.dasar-alert-container.secondary{--alert-bg-local: var(--alert-secondary-bg, var(--dasar-neutral-100));--alert-color-local: var(--alert-secondary-color, var(--dasar-neutral-800));--alert-border-local: var(--alert-secondary-border, var(--dasar-neutral-300));--alert-icon-local: var(--alert-secondary-icon-color, var(--dasar-neutral-500))}.dasar-alert-container.success{--alert-bg-local: var(--alert-success-bg, var(--dasar-success-50));--alert-color-local: var(--alert-success-color, var(--dasar-success-800));--alert-border-local: var(--alert-success-border, var(--dasar-success-200));--alert-icon-local: var(--alert-success-icon-color, var(--dasar-success-base))}.dasar-alert-container.warning{--alert-bg-local: var(--alert-warning-bg, var(--dasar-warning-50));--alert-color-local: var(--alert-warning-color, var(--dasar-warning-800));--alert-border-local: var(--alert-warning-border, var(--dasar-warning-200));--alert-icon-local: var(--alert-warning-icon-color, var(--dasar-warning-base))}.dasar-alert-container.danger{--alert-bg-local: var(--alert-danger-bg, var(--dasar-danger-50));--alert-color-local: var(--alert-danger-color, var(--dasar-danger-800));--alert-border-local: var(--alert-danger-border, var(--dasar-danger-200));--alert-icon-local: var(--alert-danger-icon-color, var(--dasar-danger-base))}.dasar-alert-icon{display:inline-flex;flex:none;color:var(--alert-icon-local);padding-top:1px}.dasar-alert-body{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:var(--alert-title-gap, 2px)}.dasar-alert-title{font-weight:var(--alert-title-font-weight, var(--font-weight-semibold));font-size:var(--alert-title-font-size, var(--font-size-base))}.dasar-alert-close{flex:none;display:inline-flex;align-items:center;justify-content:center;padding:var(--alert-close-padding, 2px);margin:0;border:0;border-radius:var(--radius-md);background:transparent;color:inherit;cursor:pointer}.dasar-alert-close:hover{background:var(--alert-close-hover-bg, var(--theme-bg-hover-color))}.dasar-alert-close:focus-visible{outline:2px solid var(--alert-icon-local);outline-offset:1px}@keyframes dasar-alert-leave{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@media(prefers-reduced-motion:reduce){.dasar-alert-container.leaving{animation-duration:1ms}}\n"]
|
|
36358
|
+
}]
|
|
36359
|
+
}],
|
|
36360
|
+
propDecorators: {
|
|
36361
|
+
variant: [{ type: Input }],
|
|
36362
|
+
bordered: [{
|
|
36363
|
+
type: Input,
|
|
36364
|
+
args: [{ transform: booleanAttribute }]
|
|
36365
|
+
}],
|
|
36366
|
+
closeable: [{
|
|
36367
|
+
type: Input,
|
|
36368
|
+
args: [{ transform: booleanAttribute }]
|
|
36369
|
+
}],
|
|
36370
|
+
title: [{ type: Input }],
|
|
36371
|
+
iconName: [{
|
|
36372
|
+
type: Input,
|
|
36373
|
+
args: [{ alias: "icon-name" }]
|
|
36374
|
+
}],
|
|
36375
|
+
closeIconName: [{
|
|
36376
|
+
type: Input,
|
|
36377
|
+
args: [{ alias: "close-icon-name" }]
|
|
36378
|
+
}],
|
|
36379
|
+
containerClass: [{
|
|
36380
|
+
type: Input,
|
|
36381
|
+
args: [{ alias: "container-class" }]
|
|
36382
|
+
}],
|
|
36383
|
+
containerStyle: [{
|
|
36384
|
+
type: Input,
|
|
36385
|
+
args: [{ alias: "container-style" }]
|
|
36386
|
+
}],
|
|
36387
|
+
titleClass: [{
|
|
36388
|
+
type: Input,
|
|
36389
|
+
args: [{ alias: "title-class" }]
|
|
36390
|
+
}],
|
|
36391
|
+
titleStyle: [{
|
|
36392
|
+
type: Input,
|
|
36393
|
+
args: [{ alias: "title-style" }]
|
|
36394
|
+
}],
|
|
36395
|
+
contentClass: [{
|
|
36396
|
+
type: Input,
|
|
36397
|
+
args: [{ alias: "content-class" }]
|
|
36398
|
+
}],
|
|
36399
|
+
contentStyle: [{
|
|
36400
|
+
type: Input,
|
|
36401
|
+
args: [{ alias: "content-style" }]
|
|
36402
|
+
}],
|
|
36403
|
+
visible: [{
|
|
36404
|
+
type: Input,
|
|
36405
|
+
args: [{ transform: booleanAttribute }]
|
|
36406
|
+
}],
|
|
36407
|
+
visibleChange: [{ type: Output }],
|
|
36408
|
+
onClose: [{ type: Output }],
|
|
36409
|
+
onAfterLeave: [{ type: Output }],
|
|
36410
|
+
headerSlot: [{
|
|
36411
|
+
type: ContentChild,
|
|
36412
|
+
args: [DasarAlertHeaderSlot]
|
|
36413
|
+
}],
|
|
36414
|
+
iconSlot: [{
|
|
36415
|
+
type: ContentChild,
|
|
36416
|
+
args: [DasarAlertIconSlot]
|
|
36417
|
+
}],
|
|
36418
|
+
hostClasses: [{
|
|
36419
|
+
type: HostBinding,
|
|
36420
|
+
args: ["class"]
|
|
36421
|
+
}],
|
|
36422
|
+
role: [{
|
|
36423
|
+
type: HostBinding,
|
|
36424
|
+
args: ["attr.role"]
|
|
36425
|
+
}]
|
|
36426
|
+
}
|
|
36427
|
+
});
|
|
36428
|
+
const DasarAlertComponent = [
|
|
36429
|
+
DasarAlert,
|
|
36430
|
+
DasarAlertHeaderSlot,
|
|
36431
|
+
DasarAlertIconSlot
|
|
36432
|
+
];
|
|
36433
|
+
const isEqualValue = (first, second) => {
|
|
36434
|
+
if (first === second) return true;
|
|
36435
|
+
if (first !== null && second !== null && typeof first === "object" && typeof second === "object") try {
|
|
36436
|
+
return JSON.stringify(first) === JSON.stringify(second);
|
|
36437
|
+
} catch {
|
|
36438
|
+
return false;
|
|
36439
|
+
}
|
|
36440
|
+
return false;
|
|
36441
|
+
};
|
|
36442
|
+
var DasarCheckbox = class DasarCheckbox {
|
|
36443
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
36444
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
36445
|
+
groupToggleFn = null;
|
|
36446
|
+
ownValue = signal(false, ...ngDevMode ? [{ debugName: "ownValue" }] : /* istanbul ignore next */ []);
|
|
36447
|
+
ownDisabled = signal(resolveThemeDefault("checkbox", "disabled", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownDisabled" }] : /* istanbul ignore next */ []);
|
|
36448
|
+
groupState = signal(null, ...ngDevMode ? [{ debugName: "groupState" }] : /* istanbul ignore next */ []);
|
|
36449
|
+
onTouched = () => {};
|
|
36450
|
+
onChange = () => {};
|
|
36451
|
+
size = resolveThemeDefault("checkbox", "size", "md", this.themeProvider, this.themeService);
|
|
36452
|
+
label = resolveThemeDefault("checkbox", "label", "", this.themeProvider, this.themeService);
|
|
36453
|
+
hint = resolveThemeDefault("checkbox", "hint", "", this.themeProvider, this.themeService);
|
|
36454
|
+
error = resolveThemeDefault("checkbox", "error", false, this.themeProvider, this.themeService);
|
|
36455
|
+
set disabled(value) {
|
|
36456
|
+
this.ownDisabled.set(value);
|
|
36457
|
+
}
|
|
36458
|
+
get disabled() {
|
|
36459
|
+
return this.ownDisabled();
|
|
36460
|
+
}
|
|
36461
|
+
checkedValue = resolveThemeDefault("checkbox", "checkedValue", true, this.themeProvider, this.themeService);
|
|
36462
|
+
uncheckedValue = resolveThemeDefault("checkbox", "uncheckedValue", false, this.themeProvider, this.themeService);
|
|
36463
|
+
set value(val) {
|
|
36464
|
+
if (!isEqualValue(this.ownValue(), val)) this.ownValue.set(val);
|
|
36465
|
+
}
|
|
36466
|
+
get value() {
|
|
36467
|
+
return this.ownValue();
|
|
36468
|
+
}
|
|
36469
|
+
containerClass = resolveThemeDefault("checkbox", "containerClass", null, this.themeProvider, this.themeService);
|
|
36470
|
+
containerStyle = resolveThemeDefault("checkbox", "containerStyle", null, this.themeProvider, this.themeService);
|
|
36471
|
+
boxClass = resolveThemeDefault("checkbox", "boxClass", null, this.themeProvider, this.themeService);
|
|
36472
|
+
boxStyle = resolveThemeDefault("checkbox", "boxStyle", null, this.themeProvider, this.themeService);
|
|
36473
|
+
labelClass = resolveThemeDefault("checkbox", "labelClass", null, this.themeProvider, this.themeService);
|
|
36474
|
+
labelStyle = resolveThemeDefault("checkbox", "labelStyle", null, this.themeProvider, this.themeService);
|
|
36475
|
+
hintClass = resolveThemeDefault("checkbox", "hintClass", null, this.themeProvider, this.themeService);
|
|
36476
|
+
hintStyle = resolveThemeDefault("checkbox", "hintStyle", null, this.themeProvider, this.themeService);
|
|
36477
|
+
valueChange = new EventEmitter();
|
|
36478
|
+
onUpdate = new EventEmitter();
|
|
36479
|
+
get hostClasses() {
|
|
36480
|
+
const classes = ["dasar-checkbox", this.currentSize];
|
|
36481
|
+
if (this.isDisabled) classes.push("disabled");
|
|
36482
|
+
if (this.hasError) classes.push("error");
|
|
36483
|
+
return classes.join(" ");
|
|
36484
|
+
}
|
|
36485
|
+
get currentSize() {
|
|
36486
|
+
return this.groupState()?.size ?? this.size;
|
|
36487
|
+
}
|
|
36488
|
+
get hasError() {
|
|
36489
|
+
return this.error || (this.groupState()?.error ?? false);
|
|
36490
|
+
}
|
|
36491
|
+
get isDisabled() {
|
|
36492
|
+
return (this.groupState()?.disabled ?? false) || this.ownDisabled();
|
|
36493
|
+
}
|
|
36494
|
+
get isChecked() {
|
|
36495
|
+
const group = this.groupState();
|
|
36496
|
+
if (group) return group.checked;
|
|
36497
|
+
return isEqualValue(this.ownValue(), this.checkedValue);
|
|
36498
|
+
}
|
|
36499
|
+
get containerClasses() {
|
|
36500
|
+
const overrideClass = parseClassesToArray(this.containerClass);
|
|
36501
|
+
const baseClass = {
|
|
36502
|
+
"dasar-checkbox-container": true,
|
|
36503
|
+
checked: this.isChecked,
|
|
36504
|
+
disabled: this.isDisabled
|
|
36505
|
+
};
|
|
36506
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36507
|
+
...baseClass,
|
|
36508
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36509
|
+
};
|
|
36510
|
+
return baseClass;
|
|
36511
|
+
}
|
|
36512
|
+
get boxClasses() {
|
|
36513
|
+
const overrideClass = parseClassesToArray(this.boxClass);
|
|
36514
|
+
const baseClass = {
|
|
36515
|
+
"dasar-checkbox-box": true,
|
|
36516
|
+
checked: this.isChecked
|
|
36517
|
+
};
|
|
36518
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36519
|
+
...baseClass,
|
|
36520
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36521
|
+
};
|
|
36522
|
+
return baseClass;
|
|
36523
|
+
}
|
|
36524
|
+
get labelClasses() {
|
|
36525
|
+
const overrideClass = parseClassesToArray(this.labelClass);
|
|
36526
|
+
const baseClass = { "dasar-checkbox-label": true };
|
|
36527
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36528
|
+
...baseClass,
|
|
36529
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36530
|
+
};
|
|
36531
|
+
return baseClass;
|
|
36532
|
+
}
|
|
36533
|
+
get hintClasses() {
|
|
36534
|
+
const overrideClass = parseClassesToArray(this.hintClass);
|
|
36535
|
+
const baseClass = {
|
|
36536
|
+
"dasar-checkbox-hint": true,
|
|
36537
|
+
error: this.hasError,
|
|
36538
|
+
disabled: this.isDisabled
|
|
36539
|
+
};
|
|
36540
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36541
|
+
...baseClass,
|
|
36542
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36543
|
+
};
|
|
36544
|
+
return baseClass;
|
|
36545
|
+
}
|
|
36546
|
+
applyGroupState(state, toggle) {
|
|
36547
|
+
this.groupState.set(state);
|
|
36548
|
+
this.groupToggleFn = toggle;
|
|
36549
|
+
}
|
|
36550
|
+
toggle(event) {
|
|
36551
|
+
if (this.isDisabled) {
|
|
36552
|
+
if (event) event.target.checked = this.isChecked;
|
|
36553
|
+
return;
|
|
36554
|
+
}
|
|
36555
|
+
this.onTouched();
|
|
36556
|
+
if (this.groupToggleFn) {
|
|
36557
|
+
this.groupToggleFn(this);
|
|
36558
|
+
if (event) event.target.checked = this.isChecked;
|
|
36559
|
+
return;
|
|
36560
|
+
}
|
|
36561
|
+
const next = this.isChecked ? this.uncheckedValue : this.checkedValue;
|
|
36562
|
+
this.ownValue.set(next);
|
|
36563
|
+
this.onChange(next);
|
|
36564
|
+
this.valueChange.emit(next);
|
|
36565
|
+
this.onUpdate.emit(next);
|
|
36566
|
+
if (event) event.target.checked = this.isChecked;
|
|
36567
|
+
}
|
|
36568
|
+
writeValue(value) {
|
|
36569
|
+
if (!isEqualValue(this.ownValue(), value)) this.ownValue.set(value ?? this.uncheckedValue);
|
|
36570
|
+
}
|
|
36571
|
+
registerOnChange(fn) {
|
|
36572
|
+
this.onChange = fn;
|
|
36573
|
+
}
|
|
36574
|
+
registerOnTouched(fn) {
|
|
36575
|
+
this.onTouched = fn;
|
|
36576
|
+
}
|
|
36577
|
+
setDisabledState(isDisabled) {
|
|
36578
|
+
this.ownDisabled.set(isDisabled);
|
|
36579
|
+
}
|
|
36580
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36581
|
+
minVersion: "12.0.0",
|
|
36582
|
+
version: "22.2.2",
|
|
36583
|
+
ngImport: i0,
|
|
36584
|
+
type: DasarCheckbox,
|
|
36585
|
+
deps: [],
|
|
36586
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
36587
|
+
});
|
|
36588
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
36589
|
+
minVersion: "17.0.0",
|
|
36590
|
+
version: "22.2.2",
|
|
36591
|
+
type: DasarCheckbox,
|
|
36592
|
+
isStandalone: true,
|
|
36593
|
+
selector: "dasar-checkbox",
|
|
36594
|
+
inputs: {
|
|
36595
|
+
size: "size",
|
|
36596
|
+
label: "label",
|
|
36597
|
+
hint: "hint",
|
|
36598
|
+
error: [
|
|
36599
|
+
"error",
|
|
36600
|
+
"error",
|
|
36601
|
+
booleanAttribute
|
|
36602
|
+
],
|
|
36603
|
+
disabled: [
|
|
36604
|
+
"disabled",
|
|
36605
|
+
"disabled",
|
|
36606
|
+
booleanAttribute
|
|
36607
|
+
],
|
|
36608
|
+
checkedValue: ["checked-value", "checkedValue"],
|
|
36609
|
+
uncheckedValue: ["unchecked-value", "uncheckedValue"],
|
|
36610
|
+
value: "value",
|
|
36611
|
+
containerClass: ["container-class", "containerClass"],
|
|
36612
|
+
containerStyle: ["container-style", "containerStyle"],
|
|
36613
|
+
boxClass: ["box-class", "boxClass"],
|
|
36614
|
+
boxStyle: ["box-style", "boxStyle"],
|
|
36615
|
+
labelClass: ["label-class", "labelClass"],
|
|
36616
|
+
labelStyle: ["label-style", "labelStyle"],
|
|
36617
|
+
hintClass: ["hint-class", "hintClass"],
|
|
36618
|
+
hintStyle: ["hint-style", "hintStyle"]
|
|
36619
|
+
},
|
|
36620
|
+
outputs: {
|
|
36621
|
+
valueChange: "valueChange",
|
|
36622
|
+
onUpdate: "onUpdate"
|
|
36623
|
+
},
|
|
36624
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
36625
|
+
providers: [{
|
|
36626
|
+
provide: NG_VALUE_ACCESSOR,
|
|
36627
|
+
useExisting: forwardRef(() => DasarCheckbox),
|
|
36628
|
+
multi: true
|
|
36629
|
+
}],
|
|
36630
|
+
ngImport: i0,
|
|
36631
|
+
template: "<label [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <input\n type=\"checkbox\"\n class=\"dasar-checkbox-native\"\n [checked]=\"isChecked\"\n [disabled]=\"isDisabled\"\n [attr.aria-invalid]=\"hasError || null\"\n (change)=\"toggle($event)\"\n (blur)=\"onTouched()\"\n />\n <span [ngClass]=\"boxClasses\" [ngStyle]=\"boxStyle\" aria-hidden=\"true\">\n @if (isChecked) {\n <dasar-icon name=\"check\" size=\"sm\" />\n }\n </span>\n @if (label) {\n <span [ngClass]=\"labelClasses\" [ngStyle]=\"labelStyle\">{{ label }}</span>\n }\n <ng-content></ng-content>\n</label>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
36632
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-checkbox{display:inline-flex;flex-direction:column;gap:var(--checkbox-hint-gap, 4px)}.dasar-checkbox.disabled{opacity:var(--checkbox-disabled-opacity, .5)}.dasar-checkbox-container{position:relative;display:inline-flex;align-items:center;gap:var(--checkbox-gap, var(--space-base));cursor:pointer}.dasar-checkbox-container.disabled{cursor:not-allowed}.dasar-checkbox-native{position:absolute;top:0;left:0;width:1px;height:1px;margin:0;padding:0;opacity:0;overflow:hidden;clip-path:inset(50%);pointer-events:none}.dasar-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--checkbox-size-md, 18px);height:var(--checkbox-size-md, 18px);box-sizing:border-box;border:var(--checkbox-border-width, 1px) solid var(--checkbox-border-color, var(--theme-border-subtle-color));border-radius:var(--checkbox-radius, 4px);background:var(--checkbox-bg, transparent);color:var(--checkbox-check-color, #fff);transition:background .15s ease,border-color .15s ease}.dasar-checkbox-native:checked+.dasar-checkbox-box,.dasar-checkbox-box.checked{background:var(--checkbox-checked-bg, var(--dasar-primary-base));border-color:var(--checkbox-checked-bg, var(--dasar-primary-base))}.dasar-checkbox-native:focus-visible+.dasar-checkbox-box{outline:2px solid var(--checkbox-focus-color, var(--dasar-primary-200));outline-offset:1px}.dasar-checkbox.sm .dasar-checkbox-box{width:var(--checkbox-size-sm, 14px);height:var(--checkbox-size-sm, 14px)}.dasar-checkbox.lg .dasar-checkbox-box{width:var(--checkbox-size-lg, 22px);height:var(--checkbox-size-lg, 22px)}.dasar-checkbox-label{font-size:var(--font-size-sm);color:var(--checkbox-label-color, inherit)}.dasar-checkbox.lg .dasar-checkbox-label{font-size:var(--font-size-base)}.dasar-checkbox.error .dasar-checkbox-box{border-color:var(--checkbox-error-color, var(--dasar-danger-base))}.dasar-checkbox-hint{font-size:var(--checkbox-hint-font-size, 12px);color:var(--checkbox-hint-color, var(--theme-text-secondary-color))}.dasar-checkbox-hint.error{color:var(--checkbox-error-color, var(--dasar-danger-base))}\n"],
|
|
36633
|
+
dependencies: [
|
|
36634
|
+
{
|
|
36635
|
+
kind: "ngmodule",
|
|
36636
|
+
type: CommonModule
|
|
36637
|
+
},
|
|
36638
|
+
{
|
|
36639
|
+
kind: "directive",
|
|
36640
|
+
type: i1.NgClass,
|
|
36641
|
+
selector: "[ngClass]",
|
|
36642
|
+
inputs: ["class", "ngClass"]
|
|
36643
|
+
},
|
|
36644
|
+
{
|
|
36645
|
+
kind: "directive",
|
|
36646
|
+
type: i1.NgStyle,
|
|
36647
|
+
selector: "[ngStyle]",
|
|
36648
|
+
inputs: ["ngStyle"]
|
|
36649
|
+
},
|
|
36650
|
+
{
|
|
36651
|
+
kind: "component",
|
|
36652
|
+
type: DasarIcon,
|
|
36653
|
+
selector: "dasar-icon",
|
|
36654
|
+
inputs: [
|
|
36655
|
+
"fluid",
|
|
36656
|
+
"size",
|
|
36657
|
+
"color",
|
|
36658
|
+
"stroke",
|
|
36659
|
+
"name"
|
|
36660
|
+
]
|
|
36661
|
+
}
|
|
36662
|
+
],
|
|
36663
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
36664
|
+
});
|
|
36665
|
+
};
|
|
36666
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36667
|
+
minVersion: "12.0.0",
|
|
36668
|
+
version: "22.2.2",
|
|
36669
|
+
ngImport: i0,
|
|
36670
|
+
type: DasarCheckbox,
|
|
36671
|
+
decorators: [{
|
|
36672
|
+
type: Component,
|
|
36673
|
+
args: [{
|
|
36674
|
+
providers: [{
|
|
36675
|
+
provide: NG_VALUE_ACCESSOR,
|
|
36676
|
+
useExisting: forwardRef(() => DasarCheckbox),
|
|
36677
|
+
multi: true
|
|
36678
|
+
}],
|
|
36679
|
+
encapsulation: ViewEncapsulation.None,
|
|
36680
|
+
selector: "dasar-checkbox",
|
|
36681
|
+
imports: [CommonModule, DasarIcon],
|
|
36682
|
+
standalone: true,
|
|
36683
|
+
template: "<label [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <input\n type=\"checkbox\"\n class=\"dasar-checkbox-native\"\n [checked]=\"isChecked\"\n [disabled]=\"isDisabled\"\n [attr.aria-invalid]=\"hasError || null\"\n (change)=\"toggle($event)\"\n (blur)=\"onTouched()\"\n />\n <span [ngClass]=\"boxClasses\" [ngStyle]=\"boxStyle\" aria-hidden=\"true\">\n @if (isChecked) {\n <dasar-icon name=\"check\" size=\"sm\" />\n }\n </span>\n @if (label) {\n <span [ngClass]=\"labelClasses\" [ngStyle]=\"labelStyle\">{{ label }}</span>\n }\n <ng-content></ng-content>\n</label>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
36684
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-checkbox{display:inline-flex;flex-direction:column;gap:var(--checkbox-hint-gap, 4px)}.dasar-checkbox.disabled{opacity:var(--checkbox-disabled-opacity, .5)}.dasar-checkbox-container{position:relative;display:inline-flex;align-items:center;gap:var(--checkbox-gap, var(--space-base));cursor:pointer}.dasar-checkbox-container.disabled{cursor:not-allowed}.dasar-checkbox-native{position:absolute;top:0;left:0;width:1px;height:1px;margin:0;padding:0;opacity:0;overflow:hidden;clip-path:inset(50%);pointer-events:none}.dasar-checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--checkbox-size-md, 18px);height:var(--checkbox-size-md, 18px);box-sizing:border-box;border:var(--checkbox-border-width, 1px) solid var(--checkbox-border-color, var(--theme-border-subtle-color));border-radius:var(--checkbox-radius, 4px);background:var(--checkbox-bg, transparent);color:var(--checkbox-check-color, #fff);transition:background .15s ease,border-color .15s ease}.dasar-checkbox-native:checked+.dasar-checkbox-box,.dasar-checkbox-box.checked{background:var(--checkbox-checked-bg, var(--dasar-primary-base));border-color:var(--checkbox-checked-bg, var(--dasar-primary-base))}.dasar-checkbox-native:focus-visible+.dasar-checkbox-box{outline:2px solid var(--checkbox-focus-color, var(--dasar-primary-200));outline-offset:1px}.dasar-checkbox.sm .dasar-checkbox-box{width:var(--checkbox-size-sm, 14px);height:var(--checkbox-size-sm, 14px)}.dasar-checkbox.lg .dasar-checkbox-box{width:var(--checkbox-size-lg, 22px);height:var(--checkbox-size-lg, 22px)}.dasar-checkbox-label{font-size:var(--font-size-sm);color:var(--checkbox-label-color, inherit)}.dasar-checkbox.lg .dasar-checkbox-label{font-size:var(--font-size-base)}.dasar-checkbox.error .dasar-checkbox-box{border-color:var(--checkbox-error-color, var(--dasar-danger-base))}.dasar-checkbox-hint{font-size:var(--checkbox-hint-font-size, 12px);color:var(--checkbox-hint-color, var(--theme-text-secondary-color))}.dasar-checkbox-hint.error{color:var(--checkbox-error-color, var(--dasar-danger-base))}\n"]
|
|
36685
|
+
}]
|
|
36686
|
+
}],
|
|
36687
|
+
propDecorators: {
|
|
36688
|
+
size: [{ type: Input }],
|
|
36689
|
+
label: [{ type: Input }],
|
|
36690
|
+
hint: [{ type: Input }],
|
|
36691
|
+
error: [{
|
|
36692
|
+
type: Input,
|
|
36693
|
+
args: [{ transform: booleanAttribute }]
|
|
36694
|
+
}],
|
|
36695
|
+
disabled: [{
|
|
36696
|
+
type: Input,
|
|
36697
|
+
args: [{ transform: booleanAttribute }]
|
|
36698
|
+
}],
|
|
36699
|
+
checkedValue: [{
|
|
36700
|
+
type: Input,
|
|
36701
|
+
args: [{ alias: "checked-value" }]
|
|
36702
|
+
}],
|
|
36703
|
+
uncheckedValue: [{
|
|
36704
|
+
type: Input,
|
|
36705
|
+
args: [{ alias: "unchecked-value" }]
|
|
36706
|
+
}],
|
|
36707
|
+
value: [{ type: Input }],
|
|
36708
|
+
containerClass: [{
|
|
36709
|
+
type: Input,
|
|
36710
|
+
args: [{ alias: "container-class" }]
|
|
36711
|
+
}],
|
|
36712
|
+
containerStyle: [{
|
|
36713
|
+
type: Input,
|
|
36714
|
+
args: [{ alias: "container-style" }]
|
|
36715
|
+
}],
|
|
36716
|
+
boxClass: [{
|
|
36717
|
+
type: Input,
|
|
36718
|
+
args: [{ alias: "box-class" }]
|
|
36719
|
+
}],
|
|
36720
|
+
boxStyle: [{
|
|
36721
|
+
type: Input,
|
|
36722
|
+
args: [{ alias: "box-style" }]
|
|
36723
|
+
}],
|
|
36724
|
+
labelClass: [{
|
|
36725
|
+
type: Input,
|
|
36726
|
+
args: [{ alias: "label-class" }]
|
|
36727
|
+
}],
|
|
36728
|
+
labelStyle: [{
|
|
36729
|
+
type: Input,
|
|
36730
|
+
args: [{ alias: "label-style" }]
|
|
36731
|
+
}],
|
|
36732
|
+
hintClass: [{
|
|
36733
|
+
type: Input,
|
|
36734
|
+
args: [{ alias: "hint-class" }]
|
|
36735
|
+
}],
|
|
36736
|
+
hintStyle: [{
|
|
36737
|
+
type: Input,
|
|
36738
|
+
args: [{ alias: "hint-style" }]
|
|
36739
|
+
}],
|
|
36740
|
+
valueChange: [{ type: Output }],
|
|
36741
|
+
onUpdate: [{ type: Output }],
|
|
36742
|
+
hostClasses: [{
|
|
36743
|
+
type: HostBinding,
|
|
36744
|
+
args: ["class"]
|
|
36745
|
+
}]
|
|
36746
|
+
}
|
|
36747
|
+
});
|
|
36748
|
+
const DasarCheckboxComponent = [DasarCheckbox];
|
|
36749
|
+
const keyOf$1 = (value, valueField) => {
|
|
36750
|
+
if (valueField && value !== null && value !== void 0 && typeof value === "object") return value[valueField];
|
|
36751
|
+
return value;
|
|
36752
|
+
};
|
|
36753
|
+
var DasarCheckboxGroup = class DasarCheckboxGroup {
|
|
36754
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
36755
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
36756
|
+
checkboxes = contentChildren(DasarCheckbox, {
|
|
36757
|
+
...ngDevMode ? { debugName: "checkboxes" } : /* istanbul ignore next */ {},
|
|
36758
|
+
descendants: true
|
|
36759
|
+
});
|
|
36760
|
+
ownDisabled = signal(resolveThemeDefault("checkboxGroup", "disabled", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownDisabled" }] : /* istanbul ignore next */ []);
|
|
36761
|
+
ownError = signal(resolveThemeDefault("checkboxGroup", "error", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownError" }] : /* istanbul ignore next */ []);
|
|
36762
|
+
ownSize = signal(resolveThemeDefault("checkboxGroup", "size", null, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownSize" }] : /* istanbul ignore next */ []);
|
|
36763
|
+
values = signal([], ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
|
|
36764
|
+
onTouched = () => {};
|
|
36765
|
+
onChange = () => {};
|
|
36766
|
+
constructor() {
|
|
36767
|
+
effect(() => {
|
|
36768
|
+
const children = this.checkboxes();
|
|
36769
|
+
const current = this.values();
|
|
36770
|
+
const disabled = this.ownDisabled();
|
|
36771
|
+
const size = this.ownSize();
|
|
36772
|
+
const error = this.ownError();
|
|
36773
|
+
const valueField = this.valueField;
|
|
36774
|
+
for (const child of children) {
|
|
36775
|
+
const checked = current.some((v) => keyOf$1(v, valueField) === keyOf$1(child.checkedValue, valueField));
|
|
36776
|
+
child.applyGroupState({
|
|
36777
|
+
checked,
|
|
36778
|
+
disabled: disabled || child.disabled,
|
|
36779
|
+
error,
|
|
36780
|
+
size
|
|
36781
|
+
}, this.toggleChild);
|
|
36782
|
+
}
|
|
36783
|
+
});
|
|
36784
|
+
}
|
|
36785
|
+
direction = resolveThemeDefault("checkboxGroup", "direction", "vertical", this.themeProvider, this.themeService);
|
|
36786
|
+
set size(value) {
|
|
36787
|
+
this.ownSize.set(value);
|
|
36788
|
+
}
|
|
36789
|
+
get size() {
|
|
36790
|
+
return this.ownSize();
|
|
36791
|
+
}
|
|
36792
|
+
set disabled(value) {
|
|
36793
|
+
this.ownDisabled.set(value);
|
|
36794
|
+
}
|
|
36795
|
+
get disabled() {
|
|
36796
|
+
return this.ownDisabled();
|
|
36797
|
+
}
|
|
36798
|
+
set error(value) {
|
|
36799
|
+
this.ownError.set(value);
|
|
36800
|
+
}
|
|
36801
|
+
get error() {
|
|
36802
|
+
return this.ownError();
|
|
36803
|
+
}
|
|
36804
|
+
hint = resolveThemeDefault("checkboxGroup", "hint", "", this.themeProvider, this.themeService);
|
|
36805
|
+
valueField = resolveThemeDefault("checkboxGroup", "valueField", null, this.themeProvider, this.themeService);
|
|
36806
|
+
set value(val) {
|
|
36807
|
+
const next = Array.isArray(val) ? val : val === null || val === void 0 ? [] : [val];
|
|
36808
|
+
this.values.set(next);
|
|
36809
|
+
}
|
|
36810
|
+
get value() {
|
|
36811
|
+
return this.values();
|
|
36812
|
+
}
|
|
36813
|
+
containerClass = resolveThemeDefault("checkboxGroup", "containerClass", null, this.themeProvider, this.themeService);
|
|
36814
|
+
containerStyle = resolveThemeDefault("checkboxGroup", "containerStyle", null, this.themeProvider, this.themeService);
|
|
36815
|
+
hintClass = resolveThemeDefault("checkboxGroup", "hintClass", null, this.themeProvider, this.themeService);
|
|
36816
|
+
hintStyle = resolveThemeDefault("checkboxGroup", "hintStyle", null, this.themeProvider, this.themeService);
|
|
36817
|
+
valueChange = new EventEmitter();
|
|
36818
|
+
onUpdate = new EventEmitter();
|
|
36819
|
+
get hostClasses() {
|
|
36820
|
+
const classes = ["dasar-checkbox-group", this.direction];
|
|
36821
|
+
if (this.ownDisabled()) classes.push("disabled");
|
|
36822
|
+
if (this.error) classes.push("error");
|
|
36823
|
+
return classes.join(" ");
|
|
36824
|
+
}
|
|
36825
|
+
get role() {
|
|
36826
|
+
return "group";
|
|
36827
|
+
}
|
|
36828
|
+
onFocusOut() {
|
|
36829
|
+
this.onTouched();
|
|
36830
|
+
}
|
|
36831
|
+
get containerClasses() {
|
|
36832
|
+
const overrideClass = parseClassesToArray(this.containerClass);
|
|
36833
|
+
const baseClass = {
|
|
36834
|
+
"dasar-checkbox-group-container": true,
|
|
36835
|
+
[this.direction]: true
|
|
36836
|
+
};
|
|
36837
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36838
|
+
...baseClass,
|
|
36839
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36840
|
+
};
|
|
36841
|
+
return baseClass;
|
|
36842
|
+
}
|
|
36843
|
+
get hintClasses() {
|
|
36844
|
+
const overrideClass = parseClassesToArray(this.hintClass);
|
|
36845
|
+
const baseClass = {
|
|
36846
|
+
"dasar-checkbox-group-hint": true,
|
|
36847
|
+
error: this.error
|
|
36848
|
+
};
|
|
36849
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
36850
|
+
...baseClass,
|
|
36851
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
36852
|
+
};
|
|
36853
|
+
return baseClass;
|
|
36854
|
+
}
|
|
36855
|
+
toggleChild = (checkbox) => {
|
|
36856
|
+
this.onTouched();
|
|
36857
|
+
const field = this.valueField;
|
|
36858
|
+
const target = keyOf$1(checkbox.checkedValue, field);
|
|
36859
|
+
const current = this.values();
|
|
36860
|
+
const next = current.some((v) => keyOf$1(v, field) === target) ? current.filter((v) => keyOf$1(v, field) !== target) : [...current, checkbox.checkedValue];
|
|
36861
|
+
this.values.set(next);
|
|
36862
|
+
this.onChange(next);
|
|
36863
|
+
this.valueChange.emit(next);
|
|
36864
|
+
this.onUpdate.emit(next);
|
|
36865
|
+
};
|
|
36866
|
+
writeValue(value) {
|
|
36867
|
+
const next = Array.isArray(value) ? value : value === null || value === void 0 ? [] : [value];
|
|
36868
|
+
this.values.set(next);
|
|
36869
|
+
}
|
|
36870
|
+
registerOnChange(fn) {
|
|
36871
|
+
this.onChange = fn;
|
|
36872
|
+
}
|
|
36873
|
+
registerOnTouched(fn) {
|
|
36874
|
+
this.onTouched = fn;
|
|
36875
|
+
}
|
|
36876
|
+
setDisabledState(isDisabled) {
|
|
36877
|
+
this.ownDisabled.set(isDisabled);
|
|
36878
|
+
}
|
|
36879
|
+
ngOnDestroy() {
|
|
36880
|
+
for (const child of this.checkboxes()) child.applyGroupState(null, null);
|
|
36881
|
+
}
|
|
36882
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36883
|
+
minVersion: "12.0.0",
|
|
36884
|
+
version: "22.2.2",
|
|
36885
|
+
ngImport: i0,
|
|
36886
|
+
type: DasarCheckboxGroup,
|
|
36887
|
+
deps: [],
|
|
36888
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
36889
|
+
});
|
|
36890
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
36891
|
+
minVersion: "17.0.0",
|
|
36892
|
+
version: "22.2.2",
|
|
36893
|
+
type: DasarCheckboxGroup,
|
|
36894
|
+
isStandalone: true,
|
|
36895
|
+
selector: "dasar-checkbox-group",
|
|
36896
|
+
inputs: {
|
|
36897
|
+
direction: "direction",
|
|
36898
|
+
size: "size",
|
|
36899
|
+
disabled: [
|
|
36900
|
+
"disabled",
|
|
36901
|
+
"disabled",
|
|
36902
|
+
booleanAttribute
|
|
36903
|
+
],
|
|
36904
|
+
error: [
|
|
36905
|
+
"error",
|
|
36906
|
+
"error",
|
|
36907
|
+
booleanAttribute
|
|
36908
|
+
],
|
|
36909
|
+
hint: "hint",
|
|
36910
|
+
valueField: ["value-field", "valueField"],
|
|
36911
|
+
value: "value",
|
|
36912
|
+
containerClass: ["container-class", "containerClass"],
|
|
36913
|
+
containerStyle: ["container-style", "containerStyle"],
|
|
36914
|
+
hintClass: ["hint-class", "hintClass"],
|
|
36915
|
+
hintStyle: ["hint-style", "hintStyle"]
|
|
36916
|
+
},
|
|
36917
|
+
outputs: {
|
|
36918
|
+
valueChange: "valueChange",
|
|
36919
|
+
onUpdate: "onUpdate"
|
|
36920
|
+
},
|
|
36921
|
+
host: {
|
|
36922
|
+
listeners: { "focusout": "onFocusOut()" },
|
|
36923
|
+
properties: {
|
|
36924
|
+
"class": "this.hostClasses",
|
|
36925
|
+
"attr.role": "this.role"
|
|
36926
|
+
}
|
|
36927
|
+
},
|
|
36928
|
+
providers: [{
|
|
36929
|
+
provide: NG_VALUE_ACCESSOR,
|
|
36930
|
+
useExisting: forwardRef(() => DasarCheckboxGroup),
|
|
36931
|
+
multi: true
|
|
36932
|
+
}],
|
|
36933
|
+
queries: [{
|
|
36934
|
+
propertyName: "checkboxes",
|
|
36935
|
+
predicate: DasarCheckbox,
|
|
36936
|
+
descendants: true,
|
|
36937
|
+
isSignal: true
|
|
36938
|
+
}],
|
|
36939
|
+
ngImport: i0,
|
|
36940
|
+
template: "<div [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <ng-content></ng-content>\n</div>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
36941
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-checkbox-group{display:block}.dasar-checkbox-group-container{display:flex}.dasar-checkbox-group-container.vertical{flex-direction:column;gap:var(--checkbox-group-gap, var(--space-3))}.dasar-checkbox-group-container.horizontal{flex-direction:row;flex-wrap:wrap;gap:var(--checkbox-group-gap, var(--space-3))}.dasar-checkbox-group-hint{margin-top:var(--checkbox-hint-gap, 4px);font-size:var(--checkbox-hint-font-size, 12px);color:var(--checkbox-hint-color, var(--theme-text-secondary-color))}.dasar-checkbox-group-hint.error{color:var(--checkbox-error-color, var(--dasar-danger-base))}\n"],
|
|
36942
|
+
dependencies: [
|
|
36943
|
+
{
|
|
36944
|
+
kind: "ngmodule",
|
|
36945
|
+
type: CommonModule
|
|
36946
|
+
},
|
|
36947
|
+
{
|
|
36948
|
+
kind: "directive",
|
|
36949
|
+
type: i1.NgClass,
|
|
36950
|
+
selector: "[ngClass]",
|
|
36951
|
+
inputs: ["class", "ngClass"]
|
|
36952
|
+
},
|
|
36953
|
+
{
|
|
36954
|
+
kind: "directive",
|
|
36955
|
+
type: i1.NgStyle,
|
|
36956
|
+
selector: "[ngStyle]",
|
|
36957
|
+
inputs: ["ngStyle"]
|
|
36958
|
+
}
|
|
36959
|
+
],
|
|
36960
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
36961
|
+
});
|
|
36962
|
+
};
|
|
36963
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
36964
|
+
minVersion: "12.0.0",
|
|
36965
|
+
version: "22.2.2",
|
|
36966
|
+
ngImport: i0,
|
|
36967
|
+
type: DasarCheckboxGroup,
|
|
36968
|
+
decorators: [{
|
|
36969
|
+
type: Component,
|
|
36970
|
+
args: [{
|
|
36971
|
+
providers: [{
|
|
36972
|
+
provide: NG_VALUE_ACCESSOR,
|
|
36973
|
+
useExisting: forwardRef(() => DasarCheckboxGroup),
|
|
36974
|
+
multi: true
|
|
36975
|
+
}],
|
|
36976
|
+
encapsulation: ViewEncapsulation.None,
|
|
36977
|
+
selector: "dasar-checkbox-group",
|
|
36978
|
+
imports: [CommonModule],
|
|
36979
|
+
standalone: true,
|
|
36980
|
+
template: "<div [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <ng-content></ng-content>\n</div>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
36981
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-checkbox-group{display:block}.dasar-checkbox-group-container{display:flex}.dasar-checkbox-group-container.vertical{flex-direction:column;gap:var(--checkbox-group-gap, var(--space-3))}.dasar-checkbox-group-container.horizontal{flex-direction:row;flex-wrap:wrap;gap:var(--checkbox-group-gap, var(--space-3))}.dasar-checkbox-group-hint{margin-top:var(--checkbox-hint-gap, 4px);font-size:var(--checkbox-hint-font-size, 12px);color:var(--checkbox-hint-color, var(--theme-text-secondary-color))}.dasar-checkbox-group-hint.error{color:var(--checkbox-error-color, var(--dasar-danger-base))}\n"]
|
|
36982
|
+
}]
|
|
36983
|
+
}],
|
|
36984
|
+
ctorParameters: () => [],
|
|
36985
|
+
propDecorators: {
|
|
36986
|
+
checkboxes: [{
|
|
36987
|
+
type: i0.ContentChildren,
|
|
36988
|
+
args: [i0.forwardRef(() => DasarCheckbox), {
|
|
36989
|
+
descendants: true,
|
|
36990
|
+
isSignal: true
|
|
36991
|
+
}]
|
|
36992
|
+
}],
|
|
36993
|
+
direction: [{ type: Input }],
|
|
36994
|
+
size: [{ type: Input }],
|
|
36995
|
+
disabled: [{
|
|
36996
|
+
type: Input,
|
|
36997
|
+
args: [{ transform: booleanAttribute }]
|
|
36998
|
+
}],
|
|
36999
|
+
error: [{
|
|
37000
|
+
type: Input,
|
|
37001
|
+
args: [{ transform: booleanAttribute }]
|
|
37002
|
+
}],
|
|
37003
|
+
hint: [{ type: Input }],
|
|
37004
|
+
valueField: [{
|
|
37005
|
+
type: Input,
|
|
37006
|
+
args: [{ alias: "value-field" }]
|
|
37007
|
+
}],
|
|
37008
|
+
value: [{ type: Input }],
|
|
37009
|
+
containerClass: [{
|
|
37010
|
+
type: Input,
|
|
37011
|
+
args: [{ alias: "container-class" }]
|
|
37012
|
+
}],
|
|
37013
|
+
containerStyle: [{
|
|
37014
|
+
type: Input,
|
|
37015
|
+
args: [{ alias: "container-style" }]
|
|
37016
|
+
}],
|
|
37017
|
+
hintClass: [{
|
|
37018
|
+
type: Input,
|
|
37019
|
+
args: [{ alias: "hint-class" }]
|
|
37020
|
+
}],
|
|
37021
|
+
hintStyle: [{
|
|
37022
|
+
type: Input,
|
|
37023
|
+
args: [{ alias: "hint-style" }]
|
|
37024
|
+
}],
|
|
37025
|
+
valueChange: [{ type: Output }],
|
|
37026
|
+
onUpdate: [{ type: Output }],
|
|
37027
|
+
hostClasses: [{
|
|
37028
|
+
type: HostBinding,
|
|
37029
|
+
args: ["class"]
|
|
37030
|
+
}],
|
|
37031
|
+
role: [{
|
|
37032
|
+
type: HostBinding,
|
|
37033
|
+
args: ["attr.role"]
|
|
37034
|
+
}],
|
|
37035
|
+
onFocusOut: [{
|
|
37036
|
+
type: HostListener,
|
|
37037
|
+
args: ["focusout"]
|
|
37038
|
+
}]
|
|
37039
|
+
}
|
|
37040
|
+
});
|
|
37041
|
+
const DasarCheckboxGroupComponent = [DasarCheckboxGroup];
|
|
37042
|
+
var DasarRadio = class DasarRadio {
|
|
37043
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
37044
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
37045
|
+
groupSelectFn = null;
|
|
37046
|
+
ownValue = signal(null, ...ngDevMode ? [{ debugName: "ownValue" }] : /* istanbul ignore next */ []);
|
|
37047
|
+
ownDisabled = signal(resolveThemeDefault("radio", "disabled", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownDisabled" }] : /* istanbul ignore next */ []);
|
|
37048
|
+
groupState = signal(null, ...ngDevMode ? [{ debugName: "groupState" }] : /* istanbul ignore next */ []);
|
|
37049
|
+
onTouched = () => {};
|
|
37050
|
+
onChange = () => {};
|
|
37051
|
+
size = resolveThemeDefault("radio", "size", "md", this.themeProvider, this.themeService);
|
|
37052
|
+
label = resolveThemeDefault("radio", "label", "", this.themeProvider, this.themeService);
|
|
37053
|
+
hint = resolveThemeDefault("radio", "hint", "", this.themeProvider, this.themeService);
|
|
37054
|
+
name = null;
|
|
37055
|
+
error = resolveThemeDefault("radio", "error", false, this.themeProvider, this.themeService);
|
|
37056
|
+
set disabled(value) {
|
|
37057
|
+
this.ownDisabled.set(value);
|
|
37058
|
+
}
|
|
37059
|
+
get disabled() {
|
|
37060
|
+
return this.ownDisabled();
|
|
37061
|
+
}
|
|
37062
|
+
checkedValue = true;
|
|
37063
|
+
set value(val) {
|
|
37064
|
+
if (!isEqualValue(this.ownValue(), val)) this.ownValue.set(val);
|
|
37065
|
+
}
|
|
37066
|
+
get value() {
|
|
37067
|
+
return this.ownValue();
|
|
37068
|
+
}
|
|
37069
|
+
containerClass = resolveThemeDefault("radio", "containerClass", null, this.themeProvider, this.themeService);
|
|
37070
|
+
containerStyle = resolveThemeDefault("radio", "containerStyle", null, this.themeProvider, this.themeService);
|
|
37071
|
+
circleClass = resolveThemeDefault("radio", "circleClass", null, this.themeProvider, this.themeService);
|
|
37072
|
+
circleStyle = resolveThemeDefault("radio", "circleStyle", null, this.themeProvider, this.themeService);
|
|
37073
|
+
labelClass = resolveThemeDefault("radio", "labelClass", null, this.themeProvider, this.themeService);
|
|
37074
|
+
labelStyle = resolveThemeDefault("radio", "labelStyle", null, this.themeProvider, this.themeService);
|
|
37075
|
+
hintClass = resolveThemeDefault("radio", "hintClass", null, this.themeProvider, this.themeService);
|
|
37076
|
+
hintStyle = resolveThemeDefault("radio", "hintStyle", null, this.themeProvider, this.themeService);
|
|
37077
|
+
valueChange = new EventEmitter();
|
|
37078
|
+
onUpdate = new EventEmitter();
|
|
37079
|
+
get hostClasses() {
|
|
37080
|
+
const classes = ["dasar-radio", this.currentSize];
|
|
37081
|
+
if (this.isDisabled) classes.push("disabled");
|
|
37082
|
+
if (this.hasError) classes.push("error");
|
|
37083
|
+
return classes.join(" ");
|
|
37084
|
+
}
|
|
37085
|
+
get currentSize() {
|
|
37086
|
+
return this.groupState()?.size ?? this.size;
|
|
37087
|
+
}
|
|
37088
|
+
get currentName() {
|
|
37089
|
+
return this.groupState()?.name ?? this.name;
|
|
37090
|
+
}
|
|
37091
|
+
get isDisabled() {
|
|
37092
|
+
return (this.groupState()?.disabled ?? false) || this.ownDisabled();
|
|
37093
|
+
}
|
|
37094
|
+
get hasError() {
|
|
37095
|
+
return this.error || (this.groupState()?.error ?? false);
|
|
37096
|
+
}
|
|
37097
|
+
get isChecked() {
|
|
37098
|
+
const group = this.groupState();
|
|
37099
|
+
if (group) return group.checked;
|
|
37100
|
+
return isEqualValue(this.ownValue(), this.checkedValue);
|
|
37101
|
+
}
|
|
37102
|
+
get containerClasses() {
|
|
37103
|
+
const overrideClass = parseClassesToArray(this.containerClass);
|
|
37104
|
+
const baseClass = {
|
|
37105
|
+
"dasar-radio-container": true,
|
|
37106
|
+
checked: this.isChecked,
|
|
37107
|
+
disabled: this.isDisabled
|
|
37108
|
+
};
|
|
37109
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37110
|
+
...baseClass,
|
|
37111
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37112
|
+
};
|
|
37113
|
+
return baseClass;
|
|
37114
|
+
}
|
|
37115
|
+
get circleClasses() {
|
|
37116
|
+
const overrideClass = parseClassesToArray(this.circleClass);
|
|
37117
|
+
const baseClass = {
|
|
37118
|
+
"dasar-radio-circle": true,
|
|
37119
|
+
checked: this.isChecked
|
|
37120
|
+
};
|
|
37121
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37122
|
+
...baseClass,
|
|
37123
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37124
|
+
};
|
|
37125
|
+
return baseClass;
|
|
37126
|
+
}
|
|
37127
|
+
get labelClasses() {
|
|
37128
|
+
const overrideClass = parseClassesToArray(this.labelClass);
|
|
37129
|
+
const baseClass = { "dasar-radio-label": true };
|
|
37130
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37131
|
+
...baseClass,
|
|
37132
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37133
|
+
};
|
|
37134
|
+
return baseClass;
|
|
37135
|
+
}
|
|
37136
|
+
get hintClasses() {
|
|
37137
|
+
const overrideClass = parseClassesToArray(this.hintClass);
|
|
37138
|
+
const baseClass = {
|
|
37139
|
+
"dasar-radio-hint": true,
|
|
37140
|
+
error: this.hasError,
|
|
37141
|
+
disabled: this.isDisabled
|
|
37142
|
+
};
|
|
37143
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37144
|
+
...baseClass,
|
|
37145
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37146
|
+
};
|
|
37147
|
+
return baseClass;
|
|
37148
|
+
}
|
|
37149
|
+
applyGroupState(state, select) {
|
|
37150
|
+
this.groupState.set(state);
|
|
37151
|
+
this.groupSelectFn = select;
|
|
37152
|
+
}
|
|
37153
|
+
select(event) {
|
|
37154
|
+
if (this.isDisabled) {
|
|
37155
|
+
if (event) event.target.checked = this.isChecked;
|
|
37156
|
+
return;
|
|
37157
|
+
}
|
|
37158
|
+
if (this.isChecked) return;
|
|
37159
|
+
this.onTouched();
|
|
37160
|
+
if (this.groupSelectFn) {
|
|
37161
|
+
this.groupSelectFn(this);
|
|
37162
|
+
if (event) event.target.checked = this.isChecked;
|
|
37163
|
+
return;
|
|
37164
|
+
}
|
|
37165
|
+
this.ownValue.set(this.checkedValue);
|
|
37166
|
+
this.onChange(this.checkedValue);
|
|
37167
|
+
this.valueChange.emit(this.checkedValue);
|
|
37168
|
+
this.onUpdate.emit(this.checkedValue);
|
|
37169
|
+
if (event) event.target.checked = this.isChecked;
|
|
37170
|
+
}
|
|
37171
|
+
writeValue(value) {
|
|
37172
|
+
if (!isEqualValue(this.ownValue(), value)) this.ownValue.set(value);
|
|
37173
|
+
}
|
|
37174
|
+
registerOnChange(fn) {
|
|
37175
|
+
this.onChange = fn;
|
|
37176
|
+
}
|
|
37177
|
+
registerOnTouched(fn) {
|
|
37178
|
+
this.onTouched = fn;
|
|
37179
|
+
}
|
|
37180
|
+
setDisabledState(isDisabled) {
|
|
37181
|
+
this.ownDisabled.set(isDisabled);
|
|
37182
|
+
}
|
|
37183
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
37184
|
+
minVersion: "12.0.0",
|
|
37185
|
+
version: "22.2.2",
|
|
37186
|
+
ngImport: i0,
|
|
37187
|
+
type: DasarRadio,
|
|
37188
|
+
deps: [],
|
|
37189
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
37190
|
+
});
|
|
37191
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
37192
|
+
minVersion: "17.0.0",
|
|
37193
|
+
version: "22.2.2",
|
|
37194
|
+
type: DasarRadio,
|
|
37195
|
+
isStandalone: true,
|
|
37196
|
+
selector: "dasar-radio",
|
|
37197
|
+
inputs: {
|
|
37198
|
+
size: "size",
|
|
37199
|
+
label: "label",
|
|
37200
|
+
hint: "hint",
|
|
37201
|
+
name: "name",
|
|
37202
|
+
error: [
|
|
37203
|
+
"error",
|
|
37204
|
+
"error",
|
|
37205
|
+
booleanAttribute
|
|
37206
|
+
],
|
|
37207
|
+
disabled: [
|
|
37208
|
+
"disabled",
|
|
37209
|
+
"disabled",
|
|
37210
|
+
booleanAttribute
|
|
37211
|
+
],
|
|
37212
|
+
checkedValue: ["checked-value", "checkedValue"],
|
|
37213
|
+
value: "value",
|
|
37214
|
+
containerClass: ["container-class", "containerClass"],
|
|
37215
|
+
containerStyle: ["container-style", "containerStyle"],
|
|
37216
|
+
circleClass: ["circle-class", "circleClass"],
|
|
37217
|
+
circleStyle: ["circle-style", "circleStyle"],
|
|
37218
|
+
labelClass: ["label-class", "labelClass"],
|
|
37219
|
+
labelStyle: ["label-style", "labelStyle"],
|
|
37220
|
+
hintClass: ["hint-class", "hintClass"],
|
|
37221
|
+
hintStyle: ["hint-style", "hintStyle"]
|
|
37222
|
+
},
|
|
37223
|
+
outputs: {
|
|
37224
|
+
valueChange: "valueChange",
|
|
37225
|
+
onUpdate: "onUpdate"
|
|
37226
|
+
},
|
|
37227
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
37228
|
+
providers: [{
|
|
37229
|
+
provide: NG_VALUE_ACCESSOR,
|
|
37230
|
+
useExisting: forwardRef(() => DasarRadio),
|
|
37231
|
+
multi: true
|
|
37232
|
+
}],
|
|
37233
|
+
ngImport: i0,
|
|
37234
|
+
template: "<label [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <input\n type=\"radio\"\n class=\"dasar-radio-native\"\n [attr.name]=\"currentName\"\n [checked]=\"isChecked\"\n [disabled]=\"isDisabled\"\n [attr.aria-invalid]=\"hasError || null\"\n (change)=\"select($event)\"\n (blur)=\"onTouched()\"\n />\n <span [ngClass]=\"circleClasses\" [ngStyle]=\"circleStyle\" aria-hidden=\"true\"></span>\n @if (label) {\n <span [ngClass]=\"labelClasses\" [ngStyle]=\"labelStyle\">{{ label }}</span>\n }\n <ng-content></ng-content>\n</label>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
37235
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-radio{display:inline-flex;flex-direction:column;gap:var(--radio-hint-gap, 4px)}.dasar-radio.disabled{opacity:var(--radio-disabled-opacity, .5)}.dasar-radio-container{position:relative;display:inline-flex;align-items:center;gap:var(--radio-gap, var(--space-base));cursor:pointer}.dasar-radio-container.disabled{cursor:not-allowed}.dasar-radio-native{position:absolute;top:0;left:0;width:1px;height:1px;margin:0;padding:0;opacity:0;overflow:hidden;clip-path:inset(50%);pointer-events:none}.dasar-radio-circle{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--radio-size-md, 18px);height:var(--radio-size-md, 18px);box-sizing:border-box;border:var(--radio-border-width, 1px) solid var(--radio-border-color, var(--theme-border-subtle-color));border-radius:50%;background:var(--radio-bg, transparent);transition:border-color .15s ease}.dasar-radio-native:checked+.dasar-radio-circle,.dasar-radio-circle.checked{border-color:var(--radio-checked-color, var(--dasar-primary-base))}.dasar-radio-native:checked+.dasar-radio-circle:after,.dasar-radio-circle.checked:after{content:\"\";width:var(--radio-dot-size, 50%);height:var(--radio-dot-size, 50%);border-radius:50%;background:var(--radio-checked-color, var(--dasar-primary-base))}.dasar-radio-native:focus-visible+.dasar-radio-circle{outline:2px solid var(--radio-focus-color, var(--dasar-primary-200));outline-offset:1px}.dasar-radio.sm .dasar-radio-circle{width:var(--radio-size-sm, 14px);height:var(--radio-size-sm, 14px)}.dasar-radio.lg .dasar-radio-circle{width:var(--radio-size-lg, 22px);height:var(--radio-size-lg, 22px)}.dasar-radio-label{font-size:var(--font-size-sm);color:var(--radio-label-color, inherit)}.dasar-radio.lg .dasar-radio-label{font-size:var(--font-size-base)}.dasar-radio.error .dasar-radio-circle{border-color:var(--radio-error-color, var(--dasar-danger-base))}.dasar-radio-hint{font-size:var(--radio-hint-font-size, 12px);color:var(--radio-hint-color, var(--theme-text-secondary-color))}.dasar-radio-hint.error{color:var(--radio-error-color, var(--dasar-danger-base))}\n"],
|
|
37236
|
+
dependencies: [
|
|
37237
|
+
{
|
|
37238
|
+
kind: "ngmodule",
|
|
37239
|
+
type: CommonModule
|
|
37240
|
+
},
|
|
37241
|
+
{
|
|
37242
|
+
kind: "directive",
|
|
37243
|
+
type: i1.NgClass,
|
|
37244
|
+
selector: "[ngClass]",
|
|
37245
|
+
inputs: ["class", "ngClass"]
|
|
37246
|
+
},
|
|
37247
|
+
{
|
|
37248
|
+
kind: "directive",
|
|
37249
|
+
type: i1.NgStyle,
|
|
37250
|
+
selector: "[ngStyle]",
|
|
37251
|
+
inputs: ["ngStyle"]
|
|
37252
|
+
}
|
|
37253
|
+
],
|
|
37254
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
37255
|
+
});
|
|
37256
|
+
};
|
|
37257
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
37258
|
+
minVersion: "12.0.0",
|
|
37259
|
+
version: "22.2.2",
|
|
37260
|
+
ngImport: i0,
|
|
37261
|
+
type: DasarRadio,
|
|
37262
|
+
decorators: [{
|
|
37263
|
+
type: Component,
|
|
37264
|
+
args: [{
|
|
37265
|
+
providers: [{
|
|
37266
|
+
provide: NG_VALUE_ACCESSOR,
|
|
37267
|
+
useExisting: forwardRef(() => DasarRadio),
|
|
37268
|
+
multi: true
|
|
37269
|
+
}],
|
|
37270
|
+
encapsulation: ViewEncapsulation.None,
|
|
37271
|
+
selector: "dasar-radio",
|
|
37272
|
+
imports: [CommonModule],
|
|
37273
|
+
standalone: true,
|
|
37274
|
+
template: "<label [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <input\n type=\"radio\"\n class=\"dasar-radio-native\"\n [attr.name]=\"currentName\"\n [checked]=\"isChecked\"\n [disabled]=\"isDisabled\"\n [attr.aria-invalid]=\"hasError || null\"\n (change)=\"select($event)\"\n (blur)=\"onTouched()\"\n />\n <span [ngClass]=\"circleClasses\" [ngStyle]=\"circleStyle\" aria-hidden=\"true\"></span>\n @if (label) {\n <span [ngClass]=\"labelClasses\" [ngStyle]=\"labelStyle\">{{ label }}</span>\n }\n <ng-content></ng-content>\n</label>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
37275
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-radio{display:inline-flex;flex-direction:column;gap:var(--radio-hint-gap, 4px)}.dasar-radio.disabled{opacity:var(--radio-disabled-opacity, .5)}.dasar-radio-container{position:relative;display:inline-flex;align-items:center;gap:var(--radio-gap, var(--space-base));cursor:pointer}.dasar-radio-container.disabled{cursor:not-allowed}.dasar-radio-native{position:absolute;top:0;left:0;width:1px;height:1px;margin:0;padding:0;opacity:0;overflow:hidden;clip-path:inset(50%);pointer-events:none}.dasar-radio-circle{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--radio-size-md, 18px);height:var(--radio-size-md, 18px);box-sizing:border-box;border:var(--radio-border-width, 1px) solid var(--radio-border-color, var(--theme-border-subtle-color));border-radius:50%;background:var(--radio-bg, transparent);transition:border-color .15s ease}.dasar-radio-native:checked+.dasar-radio-circle,.dasar-radio-circle.checked{border-color:var(--radio-checked-color, var(--dasar-primary-base))}.dasar-radio-native:checked+.dasar-radio-circle:after,.dasar-radio-circle.checked:after{content:\"\";width:var(--radio-dot-size, 50%);height:var(--radio-dot-size, 50%);border-radius:50%;background:var(--radio-checked-color, var(--dasar-primary-base))}.dasar-radio-native:focus-visible+.dasar-radio-circle{outline:2px solid var(--radio-focus-color, var(--dasar-primary-200));outline-offset:1px}.dasar-radio.sm .dasar-radio-circle{width:var(--radio-size-sm, 14px);height:var(--radio-size-sm, 14px)}.dasar-radio.lg .dasar-radio-circle{width:var(--radio-size-lg, 22px);height:var(--radio-size-lg, 22px)}.dasar-radio-label{font-size:var(--font-size-sm);color:var(--radio-label-color, inherit)}.dasar-radio.lg .dasar-radio-label{font-size:var(--font-size-base)}.dasar-radio.error .dasar-radio-circle{border-color:var(--radio-error-color, var(--dasar-danger-base))}.dasar-radio-hint{font-size:var(--radio-hint-font-size, 12px);color:var(--radio-hint-color, var(--theme-text-secondary-color))}.dasar-radio-hint.error{color:var(--radio-error-color, var(--dasar-danger-base))}\n"]
|
|
37276
|
+
}]
|
|
37277
|
+
}],
|
|
37278
|
+
propDecorators: {
|
|
37279
|
+
size: [{ type: Input }],
|
|
37280
|
+
label: [{ type: Input }],
|
|
37281
|
+
hint: [{ type: Input }],
|
|
37282
|
+
name: [{ type: Input }],
|
|
37283
|
+
error: [{
|
|
37284
|
+
type: Input,
|
|
37285
|
+
args: [{ transform: booleanAttribute }]
|
|
37286
|
+
}],
|
|
37287
|
+
disabled: [{
|
|
37288
|
+
type: Input,
|
|
37289
|
+
args: [{ transform: booleanAttribute }]
|
|
37290
|
+
}],
|
|
37291
|
+
checkedValue: [{
|
|
37292
|
+
type: Input,
|
|
37293
|
+
args: [{ alias: "checked-value" }]
|
|
37294
|
+
}],
|
|
37295
|
+
value: [{ type: Input }],
|
|
37296
|
+
containerClass: [{
|
|
37297
|
+
type: Input,
|
|
37298
|
+
args: [{ alias: "container-class" }]
|
|
37299
|
+
}],
|
|
37300
|
+
containerStyle: [{
|
|
37301
|
+
type: Input,
|
|
37302
|
+
args: [{ alias: "container-style" }]
|
|
37303
|
+
}],
|
|
37304
|
+
circleClass: [{
|
|
37305
|
+
type: Input,
|
|
37306
|
+
args: [{ alias: "circle-class" }]
|
|
37307
|
+
}],
|
|
37308
|
+
circleStyle: [{
|
|
37309
|
+
type: Input,
|
|
37310
|
+
args: [{ alias: "circle-style" }]
|
|
37311
|
+
}],
|
|
37312
|
+
labelClass: [{
|
|
37313
|
+
type: Input,
|
|
37314
|
+
args: [{ alias: "label-class" }]
|
|
37315
|
+
}],
|
|
37316
|
+
labelStyle: [{
|
|
37317
|
+
type: Input,
|
|
37318
|
+
args: [{ alias: "label-style" }]
|
|
37319
|
+
}],
|
|
37320
|
+
hintClass: [{
|
|
37321
|
+
type: Input,
|
|
37322
|
+
args: [{ alias: "hint-class" }]
|
|
37323
|
+
}],
|
|
37324
|
+
hintStyle: [{
|
|
37325
|
+
type: Input,
|
|
37326
|
+
args: [{ alias: "hint-style" }]
|
|
37327
|
+
}],
|
|
37328
|
+
valueChange: [{ type: Output }],
|
|
37329
|
+
onUpdate: [{ type: Output }],
|
|
37330
|
+
hostClasses: [{
|
|
37331
|
+
type: HostBinding,
|
|
37332
|
+
args: ["class"]
|
|
37333
|
+
}]
|
|
37334
|
+
}
|
|
37335
|
+
});
|
|
37336
|
+
const DasarRadioComponent = [DasarRadio];
|
|
37337
|
+
let nextRadioGroupId = 0;
|
|
37338
|
+
const keyOf = (value, valueField) => {
|
|
37339
|
+
if (valueField && value !== null && value !== void 0 && typeof value === "object") return value[valueField];
|
|
37340
|
+
return value;
|
|
37341
|
+
};
|
|
37342
|
+
var DasarRadioGroup = class DasarRadioGroup {
|
|
37343
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
37344
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
37345
|
+
radios = contentChildren(DasarRadio, {
|
|
37346
|
+
...ngDevMode ? { debugName: "radios" } : /* istanbul ignore next */ {},
|
|
37347
|
+
descendants: true
|
|
37348
|
+
});
|
|
37349
|
+
ownDisabled = signal(resolveThemeDefault("radioGroup", "disabled", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownDisabled" }] : /* istanbul ignore next */ []);
|
|
37350
|
+
ownError = signal(resolveThemeDefault("radioGroup", "error", false, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownError" }] : /* istanbul ignore next */ []);
|
|
37351
|
+
ownSize = signal(resolveThemeDefault("radioGroup", "size", null, this.themeProvider, this.themeService), ...ngDevMode ? [{ debugName: "ownSize" }] : /* istanbul ignore next */ []);
|
|
37352
|
+
ownName = signal(null, ...ngDevMode ? [{ debugName: "ownName" }] : /* istanbul ignore next */ []);
|
|
37353
|
+
selected = signal(null, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
37354
|
+
groupName = `dasar-radio-group-${++nextRadioGroupId}`;
|
|
37355
|
+
onTouched = () => {};
|
|
37356
|
+
onChange = () => {};
|
|
37357
|
+
constructor() {
|
|
37358
|
+
effect(() => {
|
|
37359
|
+
const children = this.radios();
|
|
37360
|
+
const current = this.selected();
|
|
37361
|
+
const disabled = this.ownDisabled();
|
|
37362
|
+
const error = this.ownError();
|
|
37363
|
+
const size = this.ownSize();
|
|
37364
|
+
const valueField = this.valueField;
|
|
37365
|
+
const name = this.ownName() ?? this.groupName;
|
|
37366
|
+
for (const child of children) {
|
|
37367
|
+
const checked = current !== null && current !== void 0 && keyOf(current, valueField) === keyOf(child.checkedValue, valueField);
|
|
37368
|
+
child.applyGroupState({
|
|
37369
|
+
checked,
|
|
37370
|
+
disabled: disabled || child.disabled,
|
|
37371
|
+
error,
|
|
37372
|
+
size,
|
|
37373
|
+
name
|
|
37374
|
+
}, this.selectChild);
|
|
37375
|
+
}
|
|
37376
|
+
});
|
|
37377
|
+
}
|
|
37378
|
+
direction = resolveThemeDefault("radioGroup", "direction", "vertical", this.themeProvider, this.themeService);
|
|
37379
|
+
set size(value) {
|
|
37380
|
+
this.ownSize.set(value);
|
|
37381
|
+
}
|
|
37382
|
+
get size() {
|
|
37383
|
+
return this.ownSize();
|
|
37384
|
+
}
|
|
37385
|
+
set disabled(value) {
|
|
37386
|
+
this.ownDisabled.set(value);
|
|
37387
|
+
}
|
|
37388
|
+
get disabled() {
|
|
37389
|
+
return this.ownDisabled();
|
|
37390
|
+
}
|
|
37391
|
+
set error(value) {
|
|
37392
|
+
this.ownError.set(value);
|
|
37393
|
+
}
|
|
37394
|
+
get error() {
|
|
37395
|
+
return this.ownError();
|
|
37396
|
+
}
|
|
37397
|
+
set name(value) {
|
|
37398
|
+
this.ownName.set(value);
|
|
37399
|
+
}
|
|
37400
|
+
get name() {
|
|
37401
|
+
return this.ownName();
|
|
37402
|
+
}
|
|
37403
|
+
hint = resolveThemeDefault("radioGroup", "hint", "", this.themeProvider, this.themeService);
|
|
37404
|
+
valueField = resolveThemeDefault("radioGroup", "valueField", null, this.themeProvider, this.themeService);
|
|
37405
|
+
set value(val) {
|
|
37406
|
+
this.selected.set(val ?? null);
|
|
37407
|
+
}
|
|
37408
|
+
get value() {
|
|
37409
|
+
return this.selected();
|
|
37410
|
+
}
|
|
37411
|
+
containerClass = resolveThemeDefault("radioGroup", "containerClass", null, this.themeProvider, this.themeService);
|
|
37412
|
+
containerStyle = resolveThemeDefault("radioGroup", "containerStyle", null, this.themeProvider, this.themeService);
|
|
37413
|
+
hintClass = resolveThemeDefault("radioGroup", "hintClass", null, this.themeProvider, this.themeService);
|
|
37414
|
+
hintStyle = resolveThemeDefault("radioGroup", "hintStyle", null, this.themeProvider, this.themeService);
|
|
37415
|
+
valueChange = new EventEmitter();
|
|
37416
|
+
onUpdate = new EventEmitter();
|
|
37417
|
+
get hostClasses() {
|
|
37418
|
+
const classes = ["dasar-radio-group", this.direction];
|
|
37419
|
+
if (this.ownDisabled()) classes.push("disabled");
|
|
37420
|
+
if (this.ownError()) classes.push("error");
|
|
37421
|
+
return classes.join(" ");
|
|
37422
|
+
}
|
|
37423
|
+
get role() {
|
|
37424
|
+
return "radiogroup";
|
|
37425
|
+
}
|
|
37426
|
+
onFocusOut() {
|
|
37427
|
+
this.onTouched();
|
|
37428
|
+
}
|
|
37429
|
+
get containerClasses() {
|
|
37430
|
+
const overrideClass = parseClassesToArray(this.containerClass);
|
|
37431
|
+
const baseClass = {
|
|
37432
|
+
"dasar-radio-group-container": true,
|
|
37433
|
+
[this.direction]: true
|
|
37434
|
+
};
|
|
37435
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37436
|
+
...baseClass,
|
|
37437
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37438
|
+
};
|
|
37439
|
+
return baseClass;
|
|
37440
|
+
}
|
|
37441
|
+
get hintClasses() {
|
|
37442
|
+
const overrideClass = parseClassesToArray(this.hintClass);
|
|
37443
|
+
const baseClass = {
|
|
37444
|
+
"dasar-radio-group-hint": true,
|
|
37445
|
+
error: this.ownError()
|
|
37446
|
+
};
|
|
37447
|
+
if (overrideClass && overrideClass?.length > 0) return {
|
|
37448
|
+
...baseClass,
|
|
37449
|
+
...Object.fromEntries(overrideClass.map((name) => [name, true]))
|
|
37450
|
+
};
|
|
37451
|
+
return baseClass;
|
|
37452
|
+
}
|
|
37453
|
+
selectChild = (radio) => {
|
|
37454
|
+
const field = this.valueField;
|
|
37455
|
+
const target = keyOf(radio.checkedValue, field);
|
|
37456
|
+
const current = this.selected();
|
|
37457
|
+
if (current !== null && current !== void 0 && keyOf(current, field) === target) return;
|
|
37458
|
+
this.onTouched();
|
|
37459
|
+
const next = radio.checkedValue;
|
|
37460
|
+
this.selected.set(next);
|
|
37461
|
+
this.onChange(next);
|
|
37462
|
+
this.valueChange.emit(next);
|
|
37463
|
+
this.onUpdate.emit(next);
|
|
37464
|
+
};
|
|
37465
|
+
writeValue(value) {
|
|
37466
|
+
this.selected.set(value ?? null);
|
|
37467
|
+
}
|
|
37468
|
+
registerOnChange(fn) {
|
|
37469
|
+
this.onChange = fn;
|
|
37470
|
+
}
|
|
37471
|
+
registerOnTouched(fn) {
|
|
37472
|
+
this.onTouched = fn;
|
|
37473
|
+
}
|
|
37474
|
+
setDisabledState(isDisabled) {
|
|
37475
|
+
this.ownDisabled.set(isDisabled);
|
|
37476
|
+
}
|
|
37477
|
+
ngOnDestroy() {
|
|
37478
|
+
for (const child of this.radios()) child.applyGroupState(null, null);
|
|
37479
|
+
}
|
|
37480
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
37481
|
+
minVersion: "12.0.0",
|
|
37482
|
+
version: "22.2.2",
|
|
37483
|
+
ngImport: i0,
|
|
37484
|
+
type: DasarRadioGroup,
|
|
37485
|
+
deps: [],
|
|
37486
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
37487
|
+
});
|
|
37488
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
37489
|
+
minVersion: "17.0.0",
|
|
37490
|
+
version: "22.2.2",
|
|
37491
|
+
type: DasarRadioGroup,
|
|
37492
|
+
isStandalone: true,
|
|
37493
|
+
selector: "dasar-radio-group",
|
|
37494
|
+
inputs: {
|
|
37495
|
+
direction: "direction",
|
|
37496
|
+
size: "size",
|
|
37497
|
+
disabled: [
|
|
37498
|
+
"disabled",
|
|
37499
|
+
"disabled",
|
|
37500
|
+
booleanAttribute
|
|
37501
|
+
],
|
|
37502
|
+
error: [
|
|
37503
|
+
"error",
|
|
37504
|
+
"error",
|
|
37505
|
+
booleanAttribute
|
|
37506
|
+
],
|
|
37507
|
+
name: "name",
|
|
37508
|
+
hint: "hint",
|
|
37509
|
+
valueField: ["value-field", "valueField"],
|
|
37510
|
+
value: "value",
|
|
37511
|
+
containerClass: ["container-class", "containerClass"],
|
|
37512
|
+
containerStyle: ["container-style", "containerStyle"],
|
|
37513
|
+
hintClass: ["hint-class", "hintClass"],
|
|
37514
|
+
hintStyle: ["hint-style", "hintStyle"]
|
|
37515
|
+
},
|
|
37516
|
+
outputs: {
|
|
37517
|
+
valueChange: "valueChange",
|
|
37518
|
+
onUpdate: "onUpdate"
|
|
37519
|
+
},
|
|
37520
|
+
host: {
|
|
37521
|
+
listeners: { "focusout": "onFocusOut()" },
|
|
37522
|
+
properties: {
|
|
37523
|
+
"class": "this.hostClasses",
|
|
37524
|
+
"attr.role": "this.role"
|
|
37525
|
+
}
|
|
37526
|
+
},
|
|
37527
|
+
providers: [{
|
|
37528
|
+
provide: NG_VALUE_ACCESSOR,
|
|
37529
|
+
useExisting: forwardRef(() => DasarRadioGroup),
|
|
37530
|
+
multi: true
|
|
37531
|
+
}],
|
|
37532
|
+
queries: [{
|
|
37533
|
+
propertyName: "radios",
|
|
37534
|
+
predicate: DasarRadio,
|
|
37535
|
+
descendants: true,
|
|
37536
|
+
isSignal: true
|
|
37537
|
+
}],
|
|
37538
|
+
ngImport: i0,
|
|
37539
|
+
template: "<div [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <ng-content></ng-content>\n</div>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
37540
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-radio-group{display:block}.dasar-radio-group-container{display:flex}.dasar-radio-group-container.vertical{flex-direction:column;gap:var(--radio-group-gap, var(--space-3))}.dasar-radio-group-container.horizontal{flex-direction:row;flex-wrap:wrap;gap:var(--radio-group-gap, var(--space-3))}.dasar-radio-group-hint{margin-top:var(--radio-hint-gap, 4px);font-size:var(--radio-hint-font-size, 12px);color:var(--radio-hint-color, var(--theme-text-secondary-color))}.dasar-radio-group-hint.error{color:var(--radio-error-color, var(--dasar-danger-base))}\n"],
|
|
37541
|
+
dependencies: [
|
|
37542
|
+
{
|
|
37543
|
+
kind: "ngmodule",
|
|
37544
|
+
type: CommonModule
|
|
37545
|
+
},
|
|
37546
|
+
{
|
|
37547
|
+
kind: "directive",
|
|
37548
|
+
type: i1.NgClass,
|
|
37549
|
+
selector: "[ngClass]",
|
|
37550
|
+
inputs: ["class", "ngClass"]
|
|
37551
|
+
},
|
|
37552
|
+
{
|
|
37553
|
+
kind: "directive",
|
|
37554
|
+
type: i1.NgStyle,
|
|
37555
|
+
selector: "[ngStyle]",
|
|
37556
|
+
inputs: ["ngStyle"]
|
|
37557
|
+
}
|
|
37558
|
+
],
|
|
37559
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
37560
|
+
});
|
|
37561
|
+
};
|
|
37562
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
37563
|
+
minVersion: "12.0.0",
|
|
37564
|
+
version: "22.2.2",
|
|
37565
|
+
ngImport: i0,
|
|
37566
|
+
type: DasarRadioGroup,
|
|
37567
|
+
decorators: [{
|
|
37568
|
+
type: Component,
|
|
37569
|
+
args: [{
|
|
37570
|
+
providers: [{
|
|
37571
|
+
provide: NG_VALUE_ACCESSOR,
|
|
37572
|
+
useExisting: forwardRef(() => DasarRadioGroup),
|
|
37573
|
+
multi: true
|
|
37574
|
+
}],
|
|
37575
|
+
encapsulation: ViewEncapsulation.None,
|
|
37576
|
+
selector: "dasar-radio-group",
|
|
37577
|
+
imports: [CommonModule],
|
|
37578
|
+
standalone: true,
|
|
37579
|
+
template: "<div [ngClass]=\"containerClasses\" [ngStyle]=\"containerStyle\">\n <ng-content></ng-content>\n</div>\n@if (hint) {\n <div [ngClass]=\"hintClasses\" [ngStyle]=\"hintStyle\">\n {{ hint }}\n </div>\n}\n",
|
|
37580
|
+
styles: [":root{--dasar-primary-900: #071727;--dasar-primary-800: #0d253f;--dasar-primary-700: #12345a;--dasar-primary-base: #1b4d8e;--dasar-primary-500: #2563eb;--dasar-primary-300: #60a5fa;--dasar-primary-200: #a2cafa;--dasar-primary-100: #bfdbfe;--dasar-primary-50: #eff6ff;--dasar-neutral-900: #111827;--dasar-neutral-800: #1f2937;--dasar-neutral-700: #374151;--dasar-neutral-base: #4b5563;--dasar-neutral-500: #6b7280;--dasar-neutral-400: #9ca3af;--dasar-neutral-300: #d1d5db;--dasar-neutral-200: #eaecf0;--dasar-neutral-100: #f3f4f6;--dasar-neutral-50: #ffffff;--dasar-success-50: #ecfdf5;--dasar-success-200: #a7f3d0;--dasar-success-500: #10b981;--dasar-success-base: #059669;--dasar-success-800: #065f46;--dasar-danger-50: #fef2f2;--dasar-danger-200: #fecaca;--dasar-danger-500: #ef4444;--dasar-danger-base: #dc2626;--dasar-danger-800: #991b1b;--dasar-warning-50: #fffbeb;--dasar-warning-200: #fde68a;--dasar-warning-500: #f59e0b;--dasar-warning-base: #d97706;--dasar-warning-800: #92400e;--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;--font-hero: Space Grotesk, sans-serif;--font-weight-regular: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--font-size-xss: .5rem;--font-size-xs: .625rem;--font-size-sm: .75rem;--font-size-base: .875rem;--font-size-lg: 1rem;--font-size-xl: 1.125rem;--line-height-normal: 1.5;--line-height-tight: 1.25;--radius-none: 0;--radius-xxs: .125em;--radius-xs: .25em;--radius-sm: .375em;--radius-md: .5em;--radius-lg: .625em;--radius-xl: .75em;--radius-2xl: 1em;--radius-3xl: 1.25em;--radius-4xl: 1.5em;--radius-full: 9999px;--space-0: 0;--space-0-5: .125em;--space-1: .25em;--space-base: .5em;--space-3: .75em;--space-4: 1em;--space-5: 1.25em;--space-6: 1.5em;--space-8: 2em;--space-10: 2.5em;--space-12: 3em;--space-16: 4em;--space-18: 5em;--space-24: 6em;--space-32: 8em;--space-40: 10em;--space-48: 12em;--space-56: 14em;--space-64: 16em;--space-80: 20em;--space-96: 24em;--space-120: 30em;--text-white-color: #ffffff;--text-black-color: #111827;--theme-bg-window-color: #ffffff;--theme-bg-default-color: #ffffff;--theme-bg-surface-color: #ffffff;--theme-bg-hover-color: #f3f4f6;--theme-text-color: #111827;--theme-text-primary-color: #111827;--theme-text-secondary-color: #6b7280;--theme-text-disabled-color: #9ca3af;--theme-text-inverse-color: #ffffff;--theme-border-subtle-color: #eaecf0;--theme-border-strong-color: #d1d5db;--theme-primary-color: #1b4d8e;--theme-primary-hover-color: #12345a;--theme-primary-active-color: #0d253f;--theme-primary-surface-color: #eff6ff;--theme-success-color: #059669;--theme-success-surface-color: #ecfdf5;--theme-danger-color: #dc2626;--theme-danger-surface-color: #fef2f2;--theme-warning-color: #d97706;--theme-warning-surface-color: #fffbeb}[data-theme=dark]{--theme-bg-window-color: #111827;--theme-bg-default-color: #111827;--theme-bg-surface-color: #1f2937;--theme-bg-hover-color: #374151;--theme-text-color: #ffffff;--theme-text-primary-color: #ffffff;--theme-text-secondary-color: #d1d5db;--theme-text-disabled-color: #6b7280;--theme-text-inverse-color: #111827;--theme-border-subtle-color: #374151;--theme-border-strong-color: #374151;--theme-primary-color: #60a5fa;--theme-primary-hover-color: #a2cafa;--theme-primary-active-color: #bfdbfe;--theme-primary-surface-color: rgba(96, 165, 250, .1);--theme-success-color: #059669;--theme-success-surface-color: rgba(52, 211, 153, .1);--theme-danger-color: #dc2626;--theme-danger-surface-color: rgba(248, 113, 113, .1);--theme-warning-color: #d97706;--theme-warning-surface-color: rgba(251, 191, 36, .1)}.dasar-radio-group{display:block}.dasar-radio-group-container{display:flex}.dasar-radio-group-container.vertical{flex-direction:column;gap:var(--radio-group-gap, var(--space-3))}.dasar-radio-group-container.horizontal{flex-direction:row;flex-wrap:wrap;gap:var(--radio-group-gap, var(--space-3))}.dasar-radio-group-hint{margin-top:var(--radio-hint-gap, 4px);font-size:var(--radio-hint-font-size, 12px);color:var(--radio-hint-color, var(--theme-text-secondary-color))}.dasar-radio-group-hint.error{color:var(--radio-error-color, var(--dasar-danger-base))}\n"]
|
|
37581
|
+
}]
|
|
37582
|
+
}],
|
|
37583
|
+
ctorParameters: () => [],
|
|
37584
|
+
propDecorators: {
|
|
37585
|
+
radios: [{
|
|
37586
|
+
type: i0.ContentChildren,
|
|
37587
|
+
args: [i0.forwardRef(() => DasarRadio), {
|
|
37588
|
+
descendants: true,
|
|
37589
|
+
isSignal: true
|
|
37590
|
+
}]
|
|
37591
|
+
}],
|
|
37592
|
+
direction: [{ type: Input }],
|
|
37593
|
+
size: [{ type: Input }],
|
|
37594
|
+
disabled: [{
|
|
37595
|
+
type: Input,
|
|
37596
|
+
args: [{ transform: booleanAttribute }]
|
|
37597
|
+
}],
|
|
37598
|
+
error: [{
|
|
37599
|
+
type: Input,
|
|
37600
|
+
args: [{ transform: booleanAttribute }]
|
|
37601
|
+
}],
|
|
37602
|
+
name: [{ type: Input }],
|
|
37603
|
+
hint: [{ type: Input }],
|
|
37604
|
+
valueField: [{
|
|
37605
|
+
type: Input,
|
|
37606
|
+
args: [{ alias: "value-field" }]
|
|
37607
|
+
}],
|
|
37608
|
+
value: [{ type: Input }],
|
|
37609
|
+
containerClass: [{
|
|
37610
|
+
type: Input,
|
|
37611
|
+
args: [{ alias: "container-class" }]
|
|
37612
|
+
}],
|
|
37613
|
+
containerStyle: [{
|
|
37614
|
+
type: Input,
|
|
37615
|
+
args: [{ alias: "container-style" }]
|
|
37616
|
+
}],
|
|
37617
|
+
hintClass: [{
|
|
37618
|
+
type: Input,
|
|
37619
|
+
args: [{ alias: "hint-class" }]
|
|
37620
|
+
}],
|
|
37621
|
+
hintStyle: [{
|
|
37622
|
+
type: Input,
|
|
37623
|
+
args: [{ alias: "hint-style" }]
|
|
37624
|
+
}],
|
|
37625
|
+
valueChange: [{ type: Output }],
|
|
37626
|
+
onUpdate: [{ type: Output }],
|
|
37627
|
+
hostClasses: [{
|
|
37628
|
+
type: HostBinding,
|
|
37629
|
+
args: ["class"]
|
|
37630
|
+
}],
|
|
37631
|
+
role: [{
|
|
37632
|
+
type: HostBinding,
|
|
37633
|
+
args: ["attr.role"]
|
|
37634
|
+
}],
|
|
37635
|
+
onFocusOut: [{
|
|
37636
|
+
type: HostListener,
|
|
37637
|
+
args: ["focusout"]
|
|
37638
|
+
}]
|
|
37639
|
+
}
|
|
37640
|
+
});
|
|
37641
|
+
const DasarRadioGroupComponent = [DasarRadioGroup];
|
|
37642
|
+
const DASAR_DEFAULT_BREAKPOINTS = {
|
|
37643
|
+
sm: 640,
|
|
37644
|
+
md: 768,
|
|
37645
|
+
lg: 1024,
|
|
37646
|
+
xl: 1200
|
|
37647
|
+
};
|
|
37648
|
+
const computeBreakpointState = (width, height, thresholds) => {
|
|
37649
|
+
const name = width >= thresholds.xl ? "xl" : width >= thresholds.lg ? "lg" : width >= thresholds.md ? "md" : width >= thresholds.sm ? "sm" : "xs";
|
|
37650
|
+
return {
|
|
37651
|
+
width,
|
|
37652
|
+
height,
|
|
37653
|
+
name,
|
|
37654
|
+
xs: name === "xs",
|
|
37655
|
+
sm: name === "sm",
|
|
37656
|
+
md: name === "md",
|
|
37657
|
+
lg: name === "lg",
|
|
37658
|
+
xl: name === "xl",
|
|
37659
|
+
smAndDown: width < thresholds.md,
|
|
37660
|
+
mdAndDown: width < thresholds.lg,
|
|
37661
|
+
lgAndDown: width < thresholds.xl,
|
|
37662
|
+
xlAndDown: true,
|
|
37663
|
+
smAndUp: width >= thresholds.sm,
|
|
37664
|
+
mdAndUp: width >= thresholds.md,
|
|
37665
|
+
lgAndUp: width >= thresholds.lg,
|
|
37666
|
+
xlAndUp: width >= thresholds.xl
|
|
37667
|
+
};
|
|
37668
|
+
};
|
|
37669
|
+
const isBreakpointMatch = (name, list) => list.includes(name);
|
|
37670
|
+
var DasarBreakpointService = class DasarBreakpointService {
|
|
37671
|
+
platformId = inject(PLATFORM_ID);
|
|
37672
|
+
destroyRef = inject(DestroyRef);
|
|
37673
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
37674
|
+
isBrowser = isPlatformBrowser(this.platformId);
|
|
37675
|
+
thresholds = signal({
|
|
37676
|
+
...DASAR_DEFAULT_BREAKPOINTS,
|
|
37677
|
+
...this.themeService?.rawThemeVariable()?.breakpoints ?? {}
|
|
37678
|
+
}, ...ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []);
|
|
37679
|
+
rafId = null;
|
|
37680
|
+
onResize = () => {
|
|
37681
|
+
if (this.rafId !== null) return;
|
|
37682
|
+
this.rafId = requestAnimationFrame(() => {
|
|
37683
|
+
this.rafId = null;
|
|
37684
|
+
this.readWindow();
|
|
37685
|
+
});
|
|
37686
|
+
};
|
|
37687
|
+
innerWidth = signal(0, ...ngDevMode ? [{ debugName: "innerWidth" }] : /* istanbul ignore next */ []);
|
|
37688
|
+
innerHeight = signal(0, ...ngDevMode ? [{ debugName: "innerHeight" }] : /* istanbul ignore next */ []);
|
|
37689
|
+
width = this.innerWidth.asReadonly();
|
|
37690
|
+
height = this.innerHeight.asReadonly();
|
|
37691
|
+
state = computed(() => computeBreakpointState(this.innerWidth(), this.innerHeight(), this.thresholds()), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
37692
|
+
name = computed(() => this.state().name, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
37693
|
+
xs = computed(() => this.state().xs, ...ngDevMode ? [{ debugName: "xs" }] : /* istanbul ignore next */ []);
|
|
37694
|
+
sm = computed(() => this.state().sm, ...ngDevMode ? [{ debugName: "sm" }] : /* istanbul ignore next */ []);
|
|
37695
|
+
md = computed(() => this.state().md, ...ngDevMode ? [{ debugName: "md" }] : /* istanbul ignore next */ []);
|
|
37696
|
+
lg = computed(() => this.state().lg, ...ngDevMode ? [{ debugName: "lg" }] : /* istanbul ignore next */ []);
|
|
37697
|
+
xl = computed(() => this.state().xl, ...ngDevMode ? [{ debugName: "xl" }] : /* istanbul ignore next */ []);
|
|
37698
|
+
smAndDown = computed(() => this.state().smAndDown, ...ngDevMode ? [{ debugName: "smAndDown" }] : /* istanbul ignore next */ []);
|
|
37699
|
+
mdAndDown = computed(() => this.state().mdAndDown, ...ngDevMode ? [{ debugName: "mdAndDown" }] : /* istanbul ignore next */ []);
|
|
37700
|
+
lgAndDown = computed(() => this.state().lgAndDown, ...ngDevMode ? [{ debugName: "lgAndDown" }] : /* istanbul ignore next */ []);
|
|
37701
|
+
xlAndDown = computed(() => this.state().xlAndDown, ...ngDevMode ? [{ debugName: "xlAndDown" }] : /* istanbul ignore next */ []);
|
|
37702
|
+
smAndUp = computed(() => this.state().smAndUp, ...ngDevMode ? [{ debugName: "smAndUp" }] : /* istanbul ignore next */ []);
|
|
37703
|
+
mdAndUp = computed(() => this.state().mdAndUp, ...ngDevMode ? [{ debugName: "mdAndUp" }] : /* istanbul ignore next */ []);
|
|
37704
|
+
lgAndUp = computed(() => this.state().lgAndUp, ...ngDevMode ? [{ debugName: "lgAndUp" }] : /* istanbul ignore next */ []);
|
|
37705
|
+
xlAndUp = computed(() => this.state().xlAndUp, ...ngDevMode ? [{ debugName: "xlAndUp" }] : /* istanbul ignore next */ []);
|
|
37706
|
+
constructor() {
|
|
37707
|
+
const sub = this.themeService?.theme$.subscribe((config) => {
|
|
37708
|
+
if (config?.breakpoints) this.setBreakpoints(config.breakpoints);
|
|
37709
|
+
});
|
|
37710
|
+
if (sub) this.destroyRef.onDestroy(() => sub.unsubscribe());
|
|
37711
|
+
if (!this.isBrowser) return;
|
|
37712
|
+
this.readWindow();
|
|
37713
|
+
window.addEventListener("resize", this.onResize);
|
|
37714
|
+
this.destroyRef.onDestroy(() => {
|
|
37715
|
+
window.removeEventListener("resize", this.onResize);
|
|
37716
|
+
if (this.rafId !== null) cancelAnimationFrame(this.rafId);
|
|
37717
|
+
});
|
|
37718
|
+
}
|
|
37719
|
+
setBreakpoints(partial) {
|
|
37720
|
+
this.thresholds.update((current) => ({
|
|
37721
|
+
...current,
|
|
37722
|
+
...partial
|
|
37723
|
+
}));
|
|
37724
|
+
}
|
|
37725
|
+
readWindow() {
|
|
37726
|
+
this.innerWidth.set(window.innerWidth);
|
|
37727
|
+
this.innerHeight.set(window.innerHeight);
|
|
37728
|
+
}
|
|
37729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
37730
|
+
minVersion: "12.0.0",
|
|
37731
|
+
version: "22.2.2",
|
|
37732
|
+
ngImport: i0,
|
|
37733
|
+
type: DasarBreakpointService,
|
|
37734
|
+
deps: [],
|
|
37735
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
37736
|
+
});
|
|
37737
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
37738
|
+
minVersion: "12.0.0",
|
|
37739
|
+
version: "22.2.2",
|
|
37740
|
+
ngImport: i0,
|
|
37741
|
+
type: DasarBreakpointService,
|
|
37742
|
+
providedIn: "root"
|
|
37743
|
+
});
|
|
37744
|
+
};
|
|
37745
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
37746
|
+
minVersion: "12.0.0",
|
|
37747
|
+
version: "22.2.2",
|
|
37748
|
+
ngImport: i0,
|
|
37749
|
+
type: DasarBreakpointService,
|
|
37750
|
+
decorators: [{
|
|
37751
|
+
type: Injectable,
|
|
37752
|
+
args: [{ providedIn: "root" }]
|
|
37753
|
+
}],
|
|
37754
|
+
ctorParameters: () => []
|
|
37755
|
+
});
|
|
37756
|
+
const normalizeBreakpointList = (value) => {
|
|
37757
|
+
if (!value) return [];
|
|
37758
|
+
const names = [
|
|
37759
|
+
"xs",
|
|
37760
|
+
"sm",
|
|
37761
|
+
"md",
|
|
37762
|
+
"lg",
|
|
37763
|
+
"xl"
|
|
37764
|
+
];
|
|
37765
|
+
return (Array.isArray(value) ? value : String(value).split(/[\s,]+/)).map((part) => String(part).trim().toLowerCase()).filter((part) => names.includes(part));
|
|
37766
|
+
};
|
|
37767
|
+
var DasarBreakpoint = class DasarBreakpoint {
|
|
37768
|
+
themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
37769
|
+
themeService = inject(DasarThemeService, { optional: true });
|
|
37770
|
+
breakpoint = inject(DasarBreakpointService);
|
|
37771
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
37772
|
+
hiddenList = signal(resolveThemeDefault("breakpoint", "hiddenAt", null, this.themeProvider, this.themeService) ?? [], ...ngDevMode ? [{ debugName: "hiddenList" }] : /* istanbul ignore next */ []);
|
|
37773
|
+
showList = signal(resolveThemeDefault("breakpoint", "showAt", null, this.themeProvider, this.themeService) ?? [], ...ngDevMode ? [{ debugName: "showList" }] : /* istanbul ignore next */ []);
|
|
37774
|
+
lastName = null;
|
|
37775
|
+
lastVisible = null;
|
|
37776
|
+
visible = computed(() => {
|
|
37777
|
+
const show = this.showList();
|
|
37778
|
+
const hidden = this.hiddenList();
|
|
37779
|
+
const name = this.breakpoint.name();
|
|
37780
|
+
if (show.length > 0) return show.includes(name);
|
|
37781
|
+
if (hidden.length > 0) return !hidden.includes(name);
|
|
37782
|
+
return true;
|
|
37783
|
+
}, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
37784
|
+
constructor() {
|
|
37785
|
+
effect(() => {
|
|
37786
|
+
const state = this.breakpoint.state();
|
|
37787
|
+
const visible = this.visible();
|
|
37788
|
+
if (this.lastName === null) {
|
|
37789
|
+
this.lastName = state.name;
|
|
37790
|
+
this.lastVisible = visible;
|
|
37791
|
+
if (this.isBrowser) untracked(() => this.onMediaUpdate.emit(state));
|
|
37792
|
+
return;
|
|
37793
|
+
}
|
|
37794
|
+
if (state.name !== this.lastName) {
|
|
37795
|
+
this.lastName = state.name;
|
|
37796
|
+
untracked(() => this.onMediaUpdate.emit(state));
|
|
37797
|
+
}
|
|
37798
|
+
if (visible !== this.lastVisible) {
|
|
37799
|
+
this.lastVisible = visible;
|
|
37800
|
+
untracked(() => {
|
|
37801
|
+
if (visible) this.onShow.emit(state);
|
|
37802
|
+
else this.onHidden.emit(state);
|
|
37803
|
+
});
|
|
37804
|
+
}
|
|
37805
|
+
});
|
|
37806
|
+
}
|
|
37807
|
+
set hiddenAt(value) {
|
|
37808
|
+
this.hiddenList.set(normalizeBreakpointList(value));
|
|
37809
|
+
this.warnOnConflict();
|
|
37810
|
+
}
|
|
37811
|
+
get hiddenAt() {
|
|
37812
|
+
return this.hiddenList();
|
|
37813
|
+
}
|
|
37814
|
+
set showAt(value) {
|
|
37815
|
+
this.showList.set(normalizeBreakpointList(value));
|
|
37816
|
+
this.warnOnConflict();
|
|
37817
|
+
}
|
|
37818
|
+
get showAt() {
|
|
37819
|
+
return this.showList();
|
|
37820
|
+
}
|
|
37821
|
+
onMediaUpdate = new EventEmitter();
|
|
37822
|
+
onHidden = new EventEmitter();
|
|
37823
|
+
onShow = new EventEmitter();
|
|
37824
|
+
get hostClasses() {
|
|
37825
|
+
return `dasar-breakpoint ${this.breakpoint.name()}`;
|
|
37826
|
+
}
|
|
37827
|
+
get hiddenAttr() {
|
|
37828
|
+
return this.visible() ? null : "";
|
|
37829
|
+
}
|
|
37830
|
+
warnOnConflict() {
|
|
37831
|
+
if (this.hiddenList().length > 0 && this.showList().length > 0) console.warn("dasar-breakpoint: show-at wins when both hidden-at and show-at are set.");
|
|
37832
|
+
}
|
|
37833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
37834
|
+
minVersion: "12.0.0",
|
|
37835
|
+
version: "22.2.2",
|
|
37836
|
+
ngImport: i0,
|
|
37837
|
+
type: DasarBreakpoint,
|
|
37838
|
+
deps: [],
|
|
37839
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
37840
|
+
});
|
|
37841
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
37842
|
+
minVersion: "17.0.0",
|
|
37843
|
+
version: "22.2.2",
|
|
37844
|
+
type: DasarBreakpoint,
|
|
37845
|
+
isStandalone: true,
|
|
37846
|
+
selector: "dasar-breakpoint",
|
|
37847
|
+
inputs: {
|
|
37848
|
+
hiddenAt: ["hidden-at", "hiddenAt"],
|
|
37849
|
+
showAt: ["show-at", "showAt"]
|
|
37850
|
+
},
|
|
37851
|
+
outputs: {
|
|
37852
|
+
onMediaUpdate: "onMediaUpdate",
|
|
37853
|
+
onHidden: "onHidden",
|
|
37854
|
+
onShow: "onShow"
|
|
37855
|
+
},
|
|
37856
|
+
host: { properties: {
|
|
37857
|
+
"class": "this.hostClasses",
|
|
37858
|
+
"attr.hidden": "this.hiddenAttr"
|
|
37859
|
+
} },
|
|
37860
|
+
ngImport: i0,
|
|
37861
|
+
template: "@if (visible()) {\n <ng-content />\n}\n",
|
|
37862
|
+
styles: [".dasar-breakpoint{display:contents}\n"],
|
|
37863
|
+
dependencies: [{
|
|
37864
|
+
kind: "ngmodule",
|
|
37865
|
+
type: CommonModule
|
|
37866
|
+
}],
|
|
37867
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
37868
|
+
});
|
|
37869
|
+
};
|
|
37870
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
37871
|
+
minVersion: "12.0.0",
|
|
37872
|
+
version: "22.2.2",
|
|
37873
|
+
ngImport: i0,
|
|
37874
|
+
type: DasarBreakpoint,
|
|
37875
|
+
decorators: [{
|
|
37876
|
+
type: Component,
|
|
37877
|
+
args: [{
|
|
37878
|
+
encapsulation: ViewEncapsulation.None,
|
|
37879
|
+
selector: "dasar-breakpoint",
|
|
37880
|
+
imports: [CommonModule],
|
|
37881
|
+
standalone: true,
|
|
37882
|
+
template: "@if (visible()) {\n <ng-content />\n}\n",
|
|
37883
|
+
styles: [".dasar-breakpoint{display:contents}\n"]
|
|
37884
|
+
}]
|
|
37885
|
+
}],
|
|
37886
|
+
ctorParameters: () => [],
|
|
37887
|
+
propDecorators: {
|
|
37888
|
+
hiddenAt: [{
|
|
37889
|
+
type: Input,
|
|
37890
|
+
args: [{ alias: "hidden-at" }]
|
|
37891
|
+
}],
|
|
37892
|
+
showAt: [{
|
|
37893
|
+
type: Input,
|
|
37894
|
+
args: [{ alias: "show-at" }]
|
|
37895
|
+
}],
|
|
37896
|
+
onMediaUpdate: [{ type: Output }],
|
|
37897
|
+
onHidden: [{ type: Output }],
|
|
37898
|
+
onShow: [{ type: Output }],
|
|
37899
|
+
hostClasses: [{
|
|
37900
|
+
type: HostBinding,
|
|
37901
|
+
args: ["class"]
|
|
37902
|
+
}],
|
|
37903
|
+
hiddenAttr: [{
|
|
37904
|
+
type: HostBinding,
|
|
37905
|
+
args: ["attr.hidden"]
|
|
37906
|
+
}]
|
|
37907
|
+
}
|
|
37908
|
+
});
|
|
37909
|
+
const DasarBreakpointComponent = [DasarBreakpoint];
|
|
35991
37910
|
var DasarInputExtraLabelSlot = class DasarInputExtraLabelSlot {
|
|
35992
37911
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
35993
37912
|
minVersion: "12.0.0",
|
|
@@ -36999,6 +38918,6 @@ const DasarModalComponent = [
|
|
|
36999
38918
|
DasarModalActionSlot,
|
|
37000
38919
|
DasarModal
|
|
37001
38920
|
];
|
|
37002
|
-
export { DASAR_THEME_PROVIDER, DasarButton, DasarButtonComponent, DasarButtonGroup, DasarButtonGroupComponent, DasarCalendar, DasarCalendarComponent, DasarCalendarFooterSlot, DasarCalendarHeaderTemplate, DasarCalendarNextMonthTemplate, DasarCalendarNextYearTemplate, DasarCalendarPrevMonthTemplate, DasarCalendarPrevYearTemplate, DasarCalendarTodayTemplate, DasarCard, DasarCardActionSlot, DasarCardCaptionSlot, DasarCardComponent, DasarCardExtraHeaderSlot, DasarCardHeaderSlot, DasarChip, DasarChipCloseSlot, DasarChipComponent, DasarChipLabelSlot, DasarDatepicker, DasarDatepickerComponent, DasarDatepickerExtraFooterSlot, DasarDatepickerExtraHeaderSlot, DasarDatepickerExtraLabelSlot, DasarDatepickerHintSlot, DasarDatepickerLabelSlot, DasarDatepickerPrefixSlot, DasarDivider, DasarDividerComponent, DasarDividerLabelTemplate, DasarIcon, DasarIconComponent, DasarInput, DasarInputComponent, DasarInputExtraLabelSlot, DasarInputPrefixSlot, DasarInputSuffixSlot, DasarList, DasarListComponent, DasarListFooterSlot, DasarListHeaderSlot, DasarListItem, DasarListItemPrefixSlot, DasarListItemSuffixSlot, DasarMenu, DasarMenuComponent, DasarMenuItemTemplate, DasarMenuLabelSlot, DasarMenuPrefixSlot, DasarMenuSuffixSlot, DasarModal, DasarModalActionSlot, DasarModalCloseSlot, DasarModalComponent, DasarModalHeaderSlot, DasarNumberInput, DasarNumberInputComponent, DasarNumberInputDecrementSlot, DasarNumberInputExtraLabelSlot, DasarNumberInputIncrementSlot, DasarNumberInputPrefixSlot, DasarOverlay, DasarOverlayComponent, DasarPagination, DasarPaginationComponent, DasarPivotCellTemplate, DasarPivotColHeaderTemplate, DasarPivotRowHeaderTemplate, DasarPivotTable, DasarPivotTableBodySlot, DasarPivotTableComponent, DasarPivotTableEmptySlot, DasarPivotTableExpandedSlot, DasarPivotTableHeaderSlot, DasarPivotTablePaginationSlot, DasarSelect, DasarSelectChipTemplate, DasarSelectComponent, DasarSelectExtraLabelSlot, DasarSelectLabelSlot, DasarSelectOptionEmptySlot, DasarSelectOptionLoadingSlot, DasarSelectOptionTemplate, DasarSelectPrefixSlot, DasarSelectSuffixSlot, DasarTabItemSlotDirective, DasarTable, DasarTableBodySlot, DasarTableCellDirective, DasarTableComponent, DasarTableEmptySlot, DasarTableExpandedSlot, DasarTableHeaderSlot, DasarTablePaginationSlot, DasarTabs, DasarTabsComponent, DasarTabsScrollLeftSlotDirective, DasarTabsScrollRightSlotDirective, DasarTextarea, DasarTextareaComponent, DasarTextareaExtraLabelSlot, DasarTextareaLabelSlot, DasarThemeProviderComponent, DasarThemeService, buttonGroupMap, buttonMap, calendarMap, cardMap, chipMap, commonMap, computeSmartPlacement, datepickerMap, defaultDarkCommonTokens, defaultLightCommonTokens, dividerMap, fieldIconSize, inputMap, listMap, menuMap, modalMap, overlayMap, selectMap, tableMap, tabsMap };
|
|
38921
|
+
export { DASAR_DEFAULT_BREAKPOINTS, DASAR_THEME_PROVIDER, DasarAlert, DasarAlertComponent, DasarAlertHeaderSlot, DasarAlertIconSlot, DasarBreakpoint, DasarBreakpointComponent, DasarBreakpointService, DasarButton, DasarButtonComponent, DasarButtonGroup, DasarButtonGroupComponent, DasarCalendar, DasarCalendarComponent, DasarCalendarFooterSlot, DasarCalendarHeaderTemplate, DasarCalendarNextMonthTemplate, DasarCalendarNextYearTemplate, DasarCalendarPrevMonthTemplate, DasarCalendarPrevYearTemplate, DasarCalendarTodayTemplate, DasarCard, DasarCardActionSlot, DasarCardCaptionSlot, DasarCardComponent, DasarCardExtraHeaderSlot, DasarCardHeaderSlot, DasarCheckbox, DasarCheckboxComponent, DasarCheckboxGroup, DasarCheckboxGroupComponent, DasarChip, DasarChipCloseSlot, DasarChipComponent, DasarChipLabelSlot, DasarDatepicker, DasarDatepickerComponent, DasarDatepickerExtraFooterSlot, DasarDatepickerExtraHeaderSlot, DasarDatepickerExtraLabelSlot, DasarDatepickerHintSlot, DasarDatepickerLabelSlot, DasarDatepickerPrefixSlot, DasarDivider, DasarDividerComponent, DasarDividerLabelTemplate, DasarIcon, DasarIconComponent, DasarInput, DasarInputComponent, DasarInputExtraLabelSlot, DasarInputPrefixSlot, DasarInputSuffixSlot, DasarList, DasarListComponent, DasarListFooterSlot, DasarListHeaderSlot, DasarListItem, DasarListItemPrefixSlot, DasarListItemSuffixSlot, DasarMenu, DasarMenuComponent, DasarMenuItemTemplate, DasarMenuLabelSlot, DasarMenuPrefixSlot, DasarMenuSuffixSlot, DasarModal, DasarModalActionSlot, DasarModalCloseSlot, DasarModalComponent, DasarModalHeaderSlot, DasarNumberInput, DasarNumberInputComponent, DasarNumberInputDecrementSlot, DasarNumberInputExtraLabelSlot, DasarNumberInputIncrementSlot, DasarNumberInputPrefixSlot, DasarOverlay, DasarOverlayComponent, DasarPagination, DasarPaginationComponent, DasarPivotCellTemplate, DasarPivotColHeaderTemplate, DasarPivotRowHeaderTemplate, DasarPivotTable, DasarPivotTableBodySlot, DasarPivotTableComponent, DasarPivotTableEmptySlot, DasarPivotTableExpandedSlot, DasarPivotTableHeaderSlot, DasarPivotTablePaginationSlot, DasarRadio, DasarRadioComponent, DasarRadioGroup, DasarRadioGroupComponent, DasarSelect, DasarSelectChipTemplate, DasarSelectComponent, DasarSelectExtraLabelSlot, DasarSelectLabelSlot, DasarSelectOptionEmptySlot, DasarSelectOptionLoadingSlot, DasarSelectOptionTemplate, DasarSelectPrefixSlot, DasarSelectSuffixSlot, DasarTabItemSlotDirective, DasarTable, DasarTableBodySlot, DasarTableCellDirective, DasarTableComponent, DasarTableEmptySlot, DasarTableExpandedSlot, DasarTableHeaderSlot, DasarTablePaginationSlot, DasarTabs, DasarTabsComponent, DasarTabsScrollLeftSlotDirective, DasarTabsScrollRightSlotDirective, DasarTextarea, DasarTextareaComponent, DasarTextareaExtraLabelSlot, DasarTextareaLabelSlot, DasarThemeProviderComponent, DasarThemeService, alertMap, buttonGroupMap, buttonMap, calendarMap, cardMap, checkboxMap, chipMap, commonMap, computeBreakpointState, computeSmartPlacement, datepickerMap, defaultDarkCommonTokens, defaultLightCommonTokens, dividerMap, fieldIconSize, inputMap, isBreakpointMatch, isEqualValue, listMap, menuMap, modalMap, normalizeBreakpointList, overlayMap, radioMap, selectMap, tableMap, tabsMap };
|
|
37003
38922
|
|
|
37004
38923
|
//# sourceMappingURL=dasar-ui.mjs.map
|