@thalassic/ui 22.17.7 → 22.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thalassic-ui.mjs +351 -226
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +152 -78
|
@@ -2127,157 +2127,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
2127
2127
|
}, template: "<div class=\"tls-activity-heatmap__viewport\">\n <div class=\"tls-activity-heatmap__chart\" [style.--tls-activity-heatmap-weeks]=\"weekCount()\">\n @if (showMonthLabels()) {\n <!-- Month headings repeat the dates already announced on every cell, so they stay decorative. -->\n <div class=\"tls-activity-heatmap__months\" aria-hidden=\"true\">\n @for (month of months(); track month.column) {\n <span\n class=\"tls-activity-heatmap__month\"\n [style.grid-column]=\"month.column + ' / span ' + month.span\"\n >\n {{ month.label }}\n </span>\n }\n </div>\n }\n\n @if (showWeekdayLabels()) {\n <div class=\"tls-activity-heatmap__weekdays\" aria-hidden=\"true\">\n @for (row of rows(); track $index) {\n <span class=\"tls-activity-heatmap__weekday\">{{ row.label }}</span>\n }\n </div>\n }\n\n <!-- One delegated tooltip serves every cell, so a year of days costs a single directive\n and overlay service instead of one per cell. -->\n <div\n ngGrid\n tlsTooltipDelegate\n class=\"tls-activity-heatmap__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [tooltipDisabled]=\"!showTooltip()\"\n [attr.aria-label]=\"gridLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n @for (row of rows(); track $index) {\n <div ngGridRow class=\"tls-activity-heatmap__row\">\n @for (day of row.days; track day.date.getTime()) {\n <!-- Padding days stay navigable so arrow keys never dead-end on the grid's corners;\n they are only unselectable and announce themselves as outside the range. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-activity-heatmap__day\"\n [class.tls-activity-heatmap__day--outside]=\"!day.inRange\"\n [class.tls-activity-heatmap__day--today]=\"day.isToday\"\n [selectable]=\"day.inRange\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(day.level)\"\n [attr.aria-label]=\"day.label\"\n [attr.data-tooltip]=\"day.inRange ? day.label : null\"\n (click)=\"onDaySelect(day)\"\n (keydown.enter)=\"onDaySelect(day)\"\n (keydown.space)=\"onDaySpace($event, day)\"\n ></div>\n }\n </div>\n }\n </div>\n </div>\n</div>\n\n@if (showLegend()) {\n <div class=\"tls-activity-heatmap__legend\">\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendLess }}</span>\n\n <!-- Sample swatches carry no information the \"less \u2026 more\" captions don't already give. -->\n @for (level of legendLevels(); track level) {\n <span\n class=\"tls-activity-heatmap__legend-swatch\"\n aria-hidden=\"true\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(level)\"\n ></span>\n }\n\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendMore }}</span>\n </div>\n}\n" }]
|
|
2128
2128
|
}], propDecorators: { entries: [{ type: i0.Input, args: [{ isSignal: true, alias: "entries", required: false }] }], startDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "startDate", required: false }] }], endDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDate", required: false }] }], levels: [{ type: i0.Input, args: [{ isSignal: true, alias: "levels", required: false }] }], thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], weekdayLabelInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekdayLabelInterval", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showMonthLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMonthLabels", required: false }] }], showWeekdayLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showWeekdayLabels", required: false }] }], showLegend: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLegend", required: false }] }], showTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTooltip", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }] } });
|
|
2129
2129
|
|
|
2130
|
-
const DEFAULT_ALERT_CONFIG = {
|
|
2131
|
-
color: 'primary',
|
|
2132
|
-
label: {
|
|
2133
|
-
primary: '',
|
|
2134
|
-
secondary: '',
|
|
2135
|
-
tertiary: '',
|
|
2136
|
-
success: 'TIP: ',
|
|
2137
|
-
info: 'INFO: ',
|
|
2138
|
-
warning: 'WARNING: ',
|
|
2139
|
-
danger: 'IMPORTANT: ',
|
|
2140
|
-
},
|
|
2141
|
-
hideLabel: false,
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
|
-
const ALERT_CONFIG = new InjectionToken('ALERT_CONFIG', {
|
|
2145
|
-
factory: () => DEFAULT_ALERT_CONFIG,
|
|
2146
|
-
});
|
|
2147
|
-
|
|
2148
|
-
class Alert {
|
|
2149
|
-
_config = inject(ALERT_CONFIG);
|
|
2150
|
-
color = input(this._config.color, /* @ts-ignore */
|
|
2151
|
-
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
2152
|
-
label = input(typeof this._config.label === 'string' ? this._config.label : null, /* @ts-ignore */
|
|
2153
|
-
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2154
|
-
hideLabel = input(this._config.hideLabel, { ...(ngDevMode ? { debugName: "hideLabel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2155
|
-
displayLabel = computed(() => {
|
|
2156
|
-
const label = this.label();
|
|
2157
|
-
if (label)
|
|
2158
|
-
return label;
|
|
2159
|
-
if (typeof this._config.label === 'object') {
|
|
2160
|
-
return this._config.label[this.color()];
|
|
2161
|
-
}
|
|
2162
|
-
return '';
|
|
2163
|
-
}, /* @ts-ignore */
|
|
2164
|
-
...(ngDevMode ? [{ debugName: "displayLabel" }] : /* istanbul ignore next */ []));
|
|
2165
|
-
hostClasses = computed(() => {
|
|
2166
|
-
const className = 'tls-alert';
|
|
2167
|
-
const array = [className];
|
|
2168
|
-
array.push(`${className}--${this.color()}`);
|
|
2169
|
-
return array;
|
|
2170
|
-
}, /* @ts-ignore */
|
|
2171
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2172
|
-
hostRole = computed(() => {
|
|
2173
|
-
const urgent = ['danger', 'warning'];
|
|
2174
|
-
return urgent.includes(this.color()) ? 'alert' : 'note';
|
|
2175
|
-
}, /* @ts-ignore */
|
|
2176
|
-
...(ngDevMode ? [{ debugName: "hostRole" }] : /* istanbul ignore next */ []));
|
|
2177
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Alert, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2178
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Alert, isStandalone: true, selector: "tls-alert", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hideLabel: { classPropertyName: "hideLabel", publicName: "hideLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "hostRole()", "attr.aria-label": "hideLabel() ? displayLabel() : null" } }, ngImport: i0, template: "<div class=\"tls-alert-icon\"></div>\n<div class=\"tls-alert-body\">\n @if (!hideLabel()) {\n <span class=\"tls-alert-body__label\">{{ displayLabel() }}</span>\n }\n <span class=\"tls-alert-body__content\">\n <ng-content></ng-content>\n </span>\n</div>\n" });
|
|
2179
|
-
}
|
|
2180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Alert, decorators: [{
|
|
2181
|
-
type: Component,
|
|
2182
|
-
args: [{ selector: 'tls-alert', imports: [], host: {
|
|
2183
|
-
'[class]': 'hostClasses()',
|
|
2184
|
-
'[attr.role]': 'hostRole()',
|
|
2185
|
-
'[attr.aria-label]': 'hideLabel() ? displayLabel() : null',
|
|
2186
|
-
}, template: "<div class=\"tls-alert-icon\"></div>\n<div class=\"tls-alert-body\">\n @if (!hideLabel()) {\n <span class=\"tls-alert-body__label\">{{ displayLabel() }}</span>\n }\n <span class=\"tls-alert-body__content\">\n <ng-content></ng-content>\n </span>\n</div>\n" }]
|
|
2187
|
-
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hideLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideLabel", required: false }] }] } });
|
|
2188
|
-
|
|
2189
|
-
const DEFAULT_BADGE_CONFIG = {
|
|
2190
|
-
color: 'primary',
|
|
2191
|
-
variant: 'filled',
|
|
2192
|
-
position: 'top-end',
|
|
2193
|
-
size: 'md',
|
|
2194
|
-
max: 99,
|
|
2195
|
-
};
|
|
2196
|
-
|
|
2197
|
-
const BADGE_CONFIG = new InjectionToken('BADGE_CONFIG', {
|
|
2198
|
-
factory: () => DEFAULT_BADGE_CONFIG,
|
|
2199
|
-
});
|
|
2200
|
-
|
|
2201
|
-
class Badge {
|
|
2202
|
-
// Injections
|
|
2203
|
-
_config = inject(BADGE_CONFIG);
|
|
2204
|
-
// Inputs
|
|
2205
|
-
value = input(/* @ts-ignore */
|
|
2206
|
-
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2207
|
-
max = input(this._config.max, /* @ts-ignore */
|
|
2208
|
-
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
2209
|
-
color = input(this._config.color, /* @ts-ignore */
|
|
2210
|
-
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
2211
|
-
variant = input(this._config.variant, /* @ts-ignore */
|
|
2212
|
-
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2213
|
-
position = input(this._config.position, /* @ts-ignore */
|
|
2214
|
-
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
2215
|
-
size = input(this._config.size, /* @ts-ignore */
|
|
2216
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2217
|
-
dot = input(false, { ...(ngDevMode ? { debugName: "dot" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2218
|
-
showZero = input(false, { ...(ngDevMode ? { debugName: "showZero" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2219
|
-
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2220
|
-
inset = input(false, { ...(ngDevMode ? { debugName: "inset" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2221
|
-
bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2222
|
-
ariaLabel = input(undefined, /* @ts-ignore */
|
|
2223
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
2224
|
-
// Computed
|
|
2225
|
-
visible = computed(() => {
|
|
2226
|
-
if (this.hidden())
|
|
2227
|
-
return false;
|
|
2228
|
-
if (this.dot())
|
|
2229
|
-
return true;
|
|
2230
|
-
const value = this.value();
|
|
2231
|
-
if (value === undefined || value === '')
|
|
2232
|
-
return false;
|
|
2233
|
-
if (typeof value === 'number' && value === 0 && !this.showZero())
|
|
2234
|
-
return false;
|
|
2235
|
-
if (value === '0' && !this.showZero())
|
|
2236
|
-
return false;
|
|
2237
|
-
return true;
|
|
2238
|
-
}, /* @ts-ignore */
|
|
2239
|
-
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
2240
|
-
displayValue = computed(() => {
|
|
2241
|
-
if (this.dot())
|
|
2242
|
-
return '';
|
|
2243
|
-
const value = this.value();
|
|
2244
|
-
if (typeof value === 'number' && value > this.max())
|
|
2245
|
-
return `${this.max()}+`;
|
|
2246
|
-
return `${value}`;
|
|
2247
|
-
}, /* @ts-ignore */
|
|
2248
|
-
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
2249
|
-
decorative = computed(() => {
|
|
2250
|
-
if (this.ariaLabel())
|
|
2251
|
-
return false;
|
|
2252
|
-
return this.dot();
|
|
2253
|
-
}, /* @ts-ignore */
|
|
2254
|
-
...(ngDevMode ? [{ debugName: "decorative" }] : /* istanbul ignore next */ []));
|
|
2255
|
-
hostClasses = computed(() => {
|
|
2256
|
-
const className = 'tls-badge';
|
|
2257
|
-
const array = [className];
|
|
2258
|
-
array.push(`${className}--${this.color()}`);
|
|
2259
|
-
array.push(`${className}--${this.variant()}`);
|
|
2260
|
-
array.push(`${className}--${this.position()}`);
|
|
2261
|
-
array.push(`${className}--${this.size()}`);
|
|
2262
|
-
if (this.dot())
|
|
2263
|
-
array.push(`${className}--dot`);
|
|
2264
|
-
if (this.inset())
|
|
2265
|
-
array.push(`${className}--inset`);
|
|
2266
|
-
if (this.bordered())
|
|
2267
|
-
array.push(`${className}--bordered`);
|
|
2268
|
-
return array;
|
|
2269
|
-
}, /* @ts-ignore */
|
|
2270
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2271
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2272
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
2273
|
-
}
|
|
2274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, decorators: [{
|
|
2275
|
-
type: Component,
|
|
2276
|
-
args: [{ selector: 'tls-badge', imports: [], host: {
|
|
2277
|
-
'[class]': 'hostClasses()',
|
|
2278
|
-
}, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" }]
|
|
2279
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
2280
|
-
|
|
2281
2130
|
/**
|
|
2282
2131
|
* Built-in SVG for every {@link systemIcon}. A coherent 24×24 stroked set drawn
|
|
2283
2132
|
* with `currentColor`, no intrinsic width/height so each icon scales to its
|
|
@@ -2542,6 +2391,214 @@ function provideThalassicIcons(icons) {
|
|
|
2542
2391
|
return makeEnvironmentProviders([{ provide: ICON_REGISTRY, useValue: icons }]);
|
|
2543
2392
|
}
|
|
2544
2393
|
|
|
2394
|
+
/**
|
|
2395
|
+
* Marks an element as the alert's leading icon. Projected content wins over the
|
|
2396
|
+
* color-derived built-in glyph, so any visual — an icon, an avatar, a spinner —
|
|
2397
|
+
* can take the icon slot.
|
|
2398
|
+
*/
|
|
2399
|
+
class AlertIcon {
|
|
2400
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AlertIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2401
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: AlertIcon, isStandalone: true, selector: "[tlsAlertIcon]", host: { classAttribute: "tls-alert__icon" }, ngImport: i0 });
|
|
2402
|
+
}
|
|
2403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AlertIcon, decorators: [{
|
|
2404
|
+
type: Directive,
|
|
2405
|
+
args: [{
|
|
2406
|
+
selector: '[tlsAlertIcon]',
|
|
2407
|
+
host: { class: 'tls-alert__icon' },
|
|
2408
|
+
}]
|
|
2409
|
+
}] });
|
|
2410
|
+
|
|
2411
|
+
const DEFAULT_ALERT_CONFIG = {
|
|
2412
|
+
color: 'primary',
|
|
2413
|
+
label: {
|
|
2414
|
+
primary: '',
|
|
2415
|
+
secondary: '',
|
|
2416
|
+
tertiary: '',
|
|
2417
|
+
success: 'TIP: ',
|
|
2418
|
+
info: 'INFO: ',
|
|
2419
|
+
warning: 'WARNING: ',
|
|
2420
|
+
danger: 'IMPORTANT: ',
|
|
2421
|
+
},
|
|
2422
|
+
hideLabel: false,
|
|
2423
|
+
icon: {
|
|
2424
|
+
primary: 'info',
|
|
2425
|
+
secondary: 'info',
|
|
2426
|
+
tertiary: 'info',
|
|
2427
|
+
success: 'success',
|
|
2428
|
+
info: 'info',
|
|
2429
|
+
warning: 'warning',
|
|
2430
|
+
danger: 'error',
|
|
2431
|
+
},
|
|
2432
|
+
hideIcon: false,
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2435
|
+
const ALERT_CONFIG = new InjectionToken('ALERT_CONFIG', {
|
|
2436
|
+
factory: () => DEFAULT_ALERT_CONFIG,
|
|
2437
|
+
});
|
|
2438
|
+
|
|
2439
|
+
class Alert {
|
|
2440
|
+
// Injections
|
|
2441
|
+
_config = inject(ALERT_CONFIG);
|
|
2442
|
+
// Inputs
|
|
2443
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
2444
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
2445
|
+
label = input(typeof this._config.label === 'string' ? this._config.label : null, /* @ts-ignore */
|
|
2446
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2447
|
+
hideLabel = input(this._config.hideLabel, { ...(ngDevMode ? { debugName: "hideLabel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2448
|
+
/** Overrides the color-derived glyph with another icon from the registry. */
|
|
2449
|
+
icon = input(/* @ts-ignore */
|
|
2450
|
+
...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
2451
|
+
/** Renders an arbitrary SVG or image URL as the icon instead of a registry glyph. */
|
|
2452
|
+
iconSrc = input(/* @ts-ignore */
|
|
2453
|
+
...(ngDevMode ? [undefined, { debugName: "iconSrc" }] : /* istanbul ignore next */ []));
|
|
2454
|
+
hideIcon = input(this._config.hideIcon, { ...(ngDevMode ? { debugName: "hideIcon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2455
|
+
// State
|
|
2456
|
+
/** Consumer-provided visual rendered in place of the built-in icon. */
|
|
2457
|
+
projectedIcon = contentChild(AlertIcon, /* @ts-ignore */
|
|
2458
|
+
...(ngDevMode ? [{ debugName: "projectedIcon" }] : /* istanbul ignore next */ []));
|
|
2459
|
+
// Computed
|
|
2460
|
+
displayLabel = computed(() => {
|
|
2461
|
+
const label = this.label();
|
|
2462
|
+
if (label)
|
|
2463
|
+
return label;
|
|
2464
|
+
if (typeof this._config.label === 'object') {
|
|
2465
|
+
return this._config.label[this.color()];
|
|
2466
|
+
}
|
|
2467
|
+
return '';
|
|
2468
|
+
}, /* @ts-ignore */
|
|
2469
|
+
...(ngDevMode ? [{ debugName: "displayLabel" }] : /* istanbul ignore next */ []));
|
|
2470
|
+
/**
|
|
2471
|
+
* Registry glyph for the current color, or undefined when the icon comes from
|
|
2472
|
+
* `iconSrc` — `tls-icon` ignores a source as soon as a name is present.
|
|
2473
|
+
*/
|
|
2474
|
+
displayIcon = computed(() => {
|
|
2475
|
+
if (this.iconSrc())
|
|
2476
|
+
return undefined;
|
|
2477
|
+
const icon = this.icon();
|
|
2478
|
+
if (icon)
|
|
2479
|
+
return icon;
|
|
2480
|
+
const configIcon = this._config.icon;
|
|
2481
|
+
if (typeof configIcon === 'string')
|
|
2482
|
+
return configIcon;
|
|
2483
|
+
return configIcon[this.color()];
|
|
2484
|
+
}, /* @ts-ignore */
|
|
2485
|
+
...(ngDevMode ? [{ debugName: "displayIcon" }] : /* istanbul ignore next */ []));
|
|
2486
|
+
hostClasses = computed(() => {
|
|
2487
|
+
const className = 'tls-alert';
|
|
2488
|
+
const array = [className];
|
|
2489
|
+
array.push(`${className}--${this.color()}`);
|
|
2490
|
+
return array;
|
|
2491
|
+
}, /* @ts-ignore */
|
|
2492
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2493
|
+
hostRole = computed(() => {
|
|
2494
|
+
const urgent = ['danger', 'warning'];
|
|
2495
|
+
return urgent.includes(this.color()) ? 'alert' : 'note';
|
|
2496
|
+
}, /* @ts-ignore */
|
|
2497
|
+
...(ngDevMode ? [{ debugName: "hostRole" }] : /* istanbul ignore next */ []));
|
|
2498
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Alert, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2499
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Alert, isStandalone: true, selector: "tls-alert", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hideLabel: { classPropertyName: "hideLabel", publicName: "hideLabel", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconSrc: { classPropertyName: "iconSrc", publicName: "iconSrc", isSignal: true, isRequired: false, transformFunction: null }, hideIcon: { classPropertyName: "hideIcon", publicName: "hideIcon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "hostRole()", "attr.aria-label": "hideLabel() ? displayLabel() : null" } }, queries: [{ propertyName: "projectedIcon", first: true, predicate: AlertIcon, descendants: true, isSignal: true }], ngImport: i0, template: "@if (!hideIcon()) {\n <ng-content select=\"[tlsAlertIcon]\"></ng-content>\n\n @if (!projectedIcon()) {\n <tls-icon\n class=\"tls-alert__icon\"\n [name]=\"displayIcon()\"\n [iconSrc]=\"iconSrc()\"\n aria-hidden=\"true\"\n />\n }\n}\n\n<div class=\"tls-alert__body\">\n @if (!hideLabel()) {\n <span class=\"tls-alert__label\">{{ displayLabel() }}</span>\n }\n <span class=\"tls-alert__content\">\n <ng-content></ng-content>\n </span>\n</div>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
2500
|
+
}
|
|
2501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Alert, decorators: [{
|
|
2502
|
+
type: Component,
|
|
2503
|
+
args: [{ selector: 'tls-alert', imports: [Icon], host: {
|
|
2504
|
+
'[class]': 'hostClasses()',
|
|
2505
|
+
'[attr.role]': 'hostRole()',
|
|
2506
|
+
'[attr.aria-label]': 'hideLabel() ? displayLabel() : null',
|
|
2507
|
+
}, template: "@if (!hideIcon()) {\n <ng-content select=\"[tlsAlertIcon]\"></ng-content>\n\n @if (!projectedIcon()) {\n <tls-icon\n class=\"tls-alert__icon\"\n [name]=\"displayIcon()\"\n [iconSrc]=\"iconSrc()\"\n aria-hidden=\"true\"\n />\n }\n}\n\n<div class=\"tls-alert__body\">\n @if (!hideLabel()) {\n <span class=\"tls-alert__label\">{{ displayLabel() }}</span>\n }\n <span class=\"tls-alert__content\">\n <ng-content></ng-content>\n </span>\n</div>\n" }]
|
|
2508
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hideLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideLabel", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], iconSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconSrc", required: false }] }], hideIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideIcon", required: false }] }], projectedIcon: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AlertIcon), { isSignal: true }] }] } });
|
|
2509
|
+
|
|
2510
|
+
const DEFAULT_BADGE_CONFIG = {
|
|
2511
|
+
color: 'primary',
|
|
2512
|
+
variant: 'filled',
|
|
2513
|
+
position: 'top-end',
|
|
2514
|
+
size: 'md',
|
|
2515
|
+
max: 99,
|
|
2516
|
+
};
|
|
2517
|
+
|
|
2518
|
+
const BADGE_CONFIG = new InjectionToken('BADGE_CONFIG', {
|
|
2519
|
+
factory: () => DEFAULT_BADGE_CONFIG,
|
|
2520
|
+
});
|
|
2521
|
+
|
|
2522
|
+
class Badge {
|
|
2523
|
+
// Injections
|
|
2524
|
+
_config = inject(BADGE_CONFIG);
|
|
2525
|
+
// Inputs
|
|
2526
|
+
value = input(/* @ts-ignore */
|
|
2527
|
+
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2528
|
+
max = input(this._config.max, /* @ts-ignore */
|
|
2529
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
2530
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
2531
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
2532
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
2533
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
2534
|
+
position = input(this._config.position, /* @ts-ignore */
|
|
2535
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
2536
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
2537
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2538
|
+
dot = input(false, { ...(ngDevMode ? { debugName: "dot" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2539
|
+
showZero = input(false, { ...(ngDevMode ? { debugName: "showZero" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2540
|
+
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2541
|
+
inset = input(false, { ...(ngDevMode ? { debugName: "inset" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2542
|
+
bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2543
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
2544
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
2545
|
+
// Computed
|
|
2546
|
+
visible = computed(() => {
|
|
2547
|
+
if (this.hidden())
|
|
2548
|
+
return false;
|
|
2549
|
+
if (this.dot())
|
|
2550
|
+
return true;
|
|
2551
|
+
const value = this.value();
|
|
2552
|
+
if (value === undefined || value === '')
|
|
2553
|
+
return false;
|
|
2554
|
+
if (typeof value === 'number' && value === 0 && !this.showZero())
|
|
2555
|
+
return false;
|
|
2556
|
+
if (value === '0' && !this.showZero())
|
|
2557
|
+
return false;
|
|
2558
|
+
return true;
|
|
2559
|
+
}, /* @ts-ignore */
|
|
2560
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
2561
|
+
displayValue = computed(() => {
|
|
2562
|
+
if (this.dot())
|
|
2563
|
+
return '';
|
|
2564
|
+
const value = this.value();
|
|
2565
|
+
if (typeof value === 'number' && value > this.max())
|
|
2566
|
+
return `${this.max()}+`;
|
|
2567
|
+
return `${value}`;
|
|
2568
|
+
}, /* @ts-ignore */
|
|
2569
|
+
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
2570
|
+
decorative = computed(() => {
|
|
2571
|
+
if (this.ariaLabel())
|
|
2572
|
+
return false;
|
|
2573
|
+
return this.dot();
|
|
2574
|
+
}, /* @ts-ignore */
|
|
2575
|
+
...(ngDevMode ? [{ debugName: "decorative" }] : /* istanbul ignore next */ []));
|
|
2576
|
+
hostClasses = computed(() => {
|
|
2577
|
+
const className = 'tls-badge';
|
|
2578
|
+
const array = [className];
|
|
2579
|
+
array.push(`${className}--${this.color()}`);
|
|
2580
|
+
array.push(`${className}--${this.variant()}`);
|
|
2581
|
+
array.push(`${className}--${this.position()}`);
|
|
2582
|
+
array.push(`${className}--${this.size()}`);
|
|
2583
|
+
if (this.dot())
|
|
2584
|
+
array.push(`${className}--dot`);
|
|
2585
|
+
if (this.inset())
|
|
2586
|
+
array.push(`${className}--inset`);
|
|
2587
|
+
if (this.bordered())
|
|
2588
|
+
array.push(`${className}--bordered`);
|
|
2589
|
+
return array;
|
|
2590
|
+
}, /* @ts-ignore */
|
|
2591
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
2592
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2593
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
2594
|
+
}
|
|
2595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, decorators: [{
|
|
2596
|
+
type: Component,
|
|
2597
|
+
args: [{ selector: 'tls-badge', imports: [], host: {
|
|
2598
|
+
'[class]': 'hostClasses()',
|
|
2599
|
+
}, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" }]
|
|
2600
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
2601
|
+
|
|
2545
2602
|
const DEFAULT_BREADCRUMBS_CONFIG = {
|
|
2546
2603
|
separatorIcon: 'chevron-right',
|
|
2547
2604
|
};
|
|
@@ -5780,6 +5837,141 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
5780
5837
|
args: [{ selector: 'tls-chip-input', imports: [Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], host: { '[class]': 'classes()' }, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip size=\"sm\" variant=\"filled\" color=\"primary\" [label]=\"chip\">\n <ng-template #endIcon>\n <button\n type=\"button\"\n class=\"tls-chip-input__remove\"\n [attr.aria-label]=\"'Remove ' + chip\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeChip(index)\"\n >\u00D7</button>\n </ng-template>\n </tls-chip>\n}\n<input\n class=\"tls-chip-input__field\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n" }]
|
|
5781
5838
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }] } });
|
|
5782
5839
|
|
|
5840
|
+
/** Joins the parts of an `accept` rule set into the attribute's own format. */
|
|
5841
|
+
function normalizeAccept(value) {
|
|
5842
|
+
return Array.isArray(value) ? value.join(',') : value;
|
|
5843
|
+
}
|
|
5844
|
+
function rulesOf(accept) {
|
|
5845
|
+
return accept
|
|
5846
|
+
.split(',')
|
|
5847
|
+
.map(rule => rule.trim().toLowerCase())
|
|
5848
|
+
.filter(Boolean);
|
|
5849
|
+
}
|
|
5850
|
+
/** Whether a file satisfies the rule set, by extension or by MIME type. */
|
|
5851
|
+
function acceptsFile(file, accept) {
|
|
5852
|
+
const trimmed = accept.trim();
|
|
5853
|
+
if (!trimmed)
|
|
5854
|
+
return true;
|
|
5855
|
+
const fileName = file.name.toLowerCase();
|
|
5856
|
+
const fileType = file.type.toLowerCase();
|
|
5857
|
+
return rulesOf(trimmed).some(rule => {
|
|
5858
|
+
if (rule.startsWith('.'))
|
|
5859
|
+
return fileName.endsWith(rule);
|
|
5860
|
+
if (rule.endsWith('/*'))
|
|
5861
|
+
return fileType.startsWith(rule.slice(0, -1));
|
|
5862
|
+
return fileType === rule;
|
|
5863
|
+
});
|
|
5864
|
+
}
|
|
5865
|
+
/**
|
|
5866
|
+
* Whether a rule set refuses a type outright, judged from what a drag exposes.
|
|
5867
|
+
*
|
|
5868
|
+
* A drag in progress reveals each item's MIME type and nothing else, so a rule
|
|
5869
|
+
* set written in extensions cannot be tested until the file is dropped and
|
|
5870
|
+
* named. Undecidable is not the same as refused: it answers `false` there, and
|
|
5871
|
+
* the drop is filtered afterwards.
|
|
5872
|
+
*/
|
|
5873
|
+
function isTypeRejected(type, accept) {
|
|
5874
|
+
const trimmed = accept.trim();
|
|
5875
|
+
if (!trimmed)
|
|
5876
|
+
return false;
|
|
5877
|
+
const rules = rulesOf(trimmed);
|
|
5878
|
+
if (rules.some(rule => rule.startsWith('.')) || !type)
|
|
5879
|
+
return false;
|
|
5880
|
+
const fileType = type.toLowerCase();
|
|
5881
|
+
return !rules.some(rule => rule.endsWith('/*') ? fileType.startsWith(rule.slice(0, -1)) : fileType === rule);
|
|
5882
|
+
}
|
|
5883
|
+
|
|
5884
|
+
/**
|
|
5885
|
+
* Turns any element into a target files can be dragged onto, and nothing more:
|
|
5886
|
+
* no role, no focus behaviour, no styling of its own. What the target looks
|
|
5887
|
+
* like, and how else a file reaches it, stay with the host — which is what lets
|
|
5888
|
+
* a picture, a card or a whole page accept a drop without first having to look
|
|
5889
|
+
* like a drop zone.
|
|
5890
|
+
*
|
|
5891
|
+
* The drag is reported as it happens through `dragState` (read it via
|
|
5892
|
+
* `exportAs`), and `dropEffect` is set so the cursor answers before the drop.
|
|
5893
|
+
* Only files the `accept` rule set admits are emitted; a drop holding none of
|
|
5894
|
+
* them emits nothing.
|
|
5895
|
+
*
|
|
5896
|
+
* @example
|
|
5897
|
+
* ```html
|
|
5898
|
+
* <div [tlsFileDropTarget]="'image/*'"
|
|
5899
|
+
* (filesDropped)="onFiles($event)"
|
|
5900
|
+
* #drop="tlsFileDropTarget"
|
|
5901
|
+
* [class.is-inviting]="drop.dragState() === 'valid'"></div>
|
|
5902
|
+
* ```
|
|
5903
|
+
*/
|
|
5904
|
+
class FileDropTargetDirective {
|
|
5905
|
+
// Inputs
|
|
5906
|
+
accept = input('', { ...(ngDevMode ? { debugName: "accept" } : /* istanbul ignore next */ {}), alias: 'tlsFileDropTarget', transform: normalizeAccept });
|
|
5907
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5908
|
+
// Outputs
|
|
5909
|
+
/** The dropped files the rule set admits, in the order they were dropped. */
|
|
5910
|
+
filesDropped = output();
|
|
5911
|
+
// State
|
|
5912
|
+
_dragState = signal('idle', /* @ts-ignore */
|
|
5913
|
+
...(ngDevMode ? [{ debugName: "_dragState" }] : /* istanbul ignore next */ []));
|
|
5914
|
+
/** What the drag hovering the host holds, for the host to style itself by. */
|
|
5915
|
+
dragState = this._dragState.asReadonly();
|
|
5916
|
+
/** Nesting depth of the active drag: dragenter/dragleave pairs fired by the host's children. */
|
|
5917
|
+
_dragDepth = 0;
|
|
5918
|
+
// Protected methods
|
|
5919
|
+
onDragEnter() {
|
|
5920
|
+
this._dragDepth++;
|
|
5921
|
+
}
|
|
5922
|
+
onDragOver(event) {
|
|
5923
|
+
// Without this the browser handles the drop itself, navigating to the file.
|
|
5924
|
+
event.preventDefault();
|
|
5925
|
+
if (!event.dataTransfer)
|
|
5926
|
+
return;
|
|
5927
|
+
// A target that takes nothing says so through the cursor, rather than
|
|
5928
|
+
// inviting a drop it would then swallow.
|
|
5929
|
+
if (this.disabled()) {
|
|
5930
|
+
event.dataTransfer.dropEffect = 'none';
|
|
5931
|
+
return;
|
|
5932
|
+
}
|
|
5933
|
+
const accept = this.accept();
|
|
5934
|
+
const draggedFiles = Array.from(event.dataTransfer.items).filter(item => item.kind === 'file');
|
|
5935
|
+
const rejected = draggedFiles.some(item => isTypeRejected(item.type, accept));
|
|
5936
|
+
event.dataTransfer.dropEffect = rejected ? 'none' : 'copy';
|
|
5937
|
+
this._dragState.set(rejected ? 'invalid' : 'valid');
|
|
5938
|
+
}
|
|
5939
|
+
// `dragleave` also fires when the pointer crosses onto a child of the host;
|
|
5940
|
+
// only a leave that balances every enter means the drag actually left.
|
|
5941
|
+
onDragLeave() {
|
|
5942
|
+
this._dragDepth = Math.max(0, this._dragDepth - 1);
|
|
5943
|
+
if (this._dragDepth === 0)
|
|
5944
|
+
this._dragState.set('idle');
|
|
5945
|
+
}
|
|
5946
|
+
onDrop(event) {
|
|
5947
|
+
event.preventDefault();
|
|
5948
|
+
this._dragDepth = 0;
|
|
5949
|
+
this._dragState.set('idle');
|
|
5950
|
+
if (this.disabled() || !event.dataTransfer)
|
|
5951
|
+
return;
|
|
5952
|
+
const accept = this.accept();
|
|
5953
|
+
const accepted = Array.from(event.dataTransfer.files).filter(file => acceptsFile(file, accept));
|
|
5954
|
+
if (!accepted.length)
|
|
5955
|
+
return;
|
|
5956
|
+
this.filesDropped.emit(accepted);
|
|
5957
|
+
}
|
|
5958
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileDropTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5959
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: FileDropTargetDirective, isStandalone: true, selector: "[tlsFileDropTarget]", inputs: { accept: { classPropertyName: "accept", publicName: "tlsFileDropTarget", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filesDropped: "filesDropped" }, host: { listeners: { "dragenter": "onDragEnter()", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)" } }, exportAs: ["tlsFileDropTarget"], ngImport: i0 });
|
|
5960
|
+
}
|
|
5961
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileDropTargetDirective, decorators: [{
|
|
5962
|
+
type: Directive,
|
|
5963
|
+
args: [{
|
|
5964
|
+
selector: '[tlsFileDropTarget]',
|
|
5965
|
+
exportAs: 'tlsFileDropTarget',
|
|
5966
|
+
host: {
|
|
5967
|
+
'(dragenter)': 'onDragEnter()',
|
|
5968
|
+
'(dragover)': 'onDragOver($event)',
|
|
5969
|
+
'(dragleave)': 'onDragLeave()',
|
|
5970
|
+
'(drop)': 'onDrop($event)',
|
|
5971
|
+
},
|
|
5972
|
+
}]
|
|
5973
|
+
}], propDecorators: { accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsFileDropTarget", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filesDropped: [{ type: i0.Output, args: ["filesDropped"] }] } });
|
|
5974
|
+
|
|
5783
5975
|
const DEFAULT_FILE_INPUT_CONFIG = {
|
|
5784
5976
|
variant: 'button',
|
|
5785
5977
|
size: 'md',
|
|
@@ -5797,9 +5989,6 @@ const FILE_INPUT_CONFIG = new InjectionToken('FILE_INPUT_CONFIG', {
|
|
|
5797
5989
|
factory: () => DEFAULT_FILE_INPUT_CONFIG,
|
|
5798
5990
|
});
|
|
5799
5991
|
|
|
5800
|
-
function normalizeAccept(value) {
|
|
5801
|
-
return Array.isArray(value) ? value.join(',') : value;
|
|
5802
|
-
}
|
|
5803
5992
|
class FileInput extends ValueFormControl {
|
|
5804
5993
|
// Injections
|
|
5805
5994
|
_config = inject(FILE_INPUT_CONFIG);
|
|
@@ -5817,10 +6006,6 @@ class FileInput extends ValueFormControl {
|
|
|
5817
6006
|
hideFileList = input(this._config.hideFileList, { ...(ngDevMode ? { debugName: "hideFileList" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5818
6007
|
// State
|
|
5819
6008
|
nativeInput = viewChild.required('nativeInput');
|
|
5820
|
-
dragState = signal('idle', /* @ts-ignore */
|
|
5821
|
-
...(ngDevMode ? [{ debugName: "dragState" }] : /* istanbul ignore next */ []));
|
|
5822
|
-
/** Nesting depth of the active drag: dragenter/dragleave pairs fired by the drop zone's children. */
|
|
5823
|
-
_dragDepth = 0;
|
|
5824
6009
|
dropZoneTemplate = contentChild('dropZone', /* @ts-ignore */
|
|
5825
6010
|
...(ngDevMode ? [{ debugName: "dropZoneTemplate" }] : /* istanbul ignore next */ []));
|
|
5826
6011
|
fileTemplate = contentChild('file', /* @ts-ignore */
|
|
@@ -5866,7 +6051,7 @@ class FileInput extends ValueFormControl {
|
|
|
5866
6051
|
const target = event.target;
|
|
5867
6052
|
if (!target.files)
|
|
5868
6053
|
return;
|
|
5869
|
-
this.
|
|
6054
|
+
this.addFiles(Array.from(target.files));
|
|
5870
6055
|
target.value = '';
|
|
5871
6056
|
}
|
|
5872
6057
|
onDropZoneKeydown(event) {
|
|
@@ -5875,42 +6060,15 @@ class FileInput extends ValueFormControl {
|
|
|
5875
6060
|
event.preventDefault();
|
|
5876
6061
|
this.openFilePicker();
|
|
5877
6062
|
}
|
|
5878
|
-
onDragEnter() {
|
|
5879
|
-
this._dragDepth++;
|
|
5880
|
-
}
|
|
5881
|
-
onDragOver(event) {
|
|
5882
|
-
event.preventDefault();
|
|
5883
|
-
if (this.notInteractive() || !event.dataTransfer)
|
|
5884
|
-
return;
|
|
5885
|
-
const draggedItems = Array.from(event.dataTransfer.items).filter(item => item.kind === 'file');
|
|
5886
|
-
const rejected = draggedItems.some(item => this._isTypeRejected(item.type));
|
|
5887
|
-
event.dataTransfer.dropEffect = rejected ? 'none' : 'copy';
|
|
5888
|
-
this.dragState.set(rejected ? 'invalid' : 'valid');
|
|
5889
|
-
}
|
|
5890
|
-
// `dragleave` also fires when the pointer crosses onto a child of the drop
|
|
5891
|
-
// zone; only a leave that balances every enter means the drag actually left.
|
|
5892
|
-
onDragLeave() {
|
|
5893
|
-
this._dragDepth = Math.max(0, this._dragDepth - 1);
|
|
5894
|
-
if (this._dragDepth === 0)
|
|
5895
|
-
this.dragState.set('idle');
|
|
5896
|
-
}
|
|
5897
|
-
onDrop(event) {
|
|
5898
|
-
event.preventDefault();
|
|
5899
|
-
this._dragDepth = 0;
|
|
5900
|
-
this.dragState.set('idle');
|
|
5901
|
-
if (this.notInteractive() || !event.dataTransfer)
|
|
5902
|
-
return;
|
|
5903
|
-
this._addFiles(Array.from(event.dataTransfer.files));
|
|
5904
|
-
}
|
|
5905
6063
|
// Arrow function so it keeps `this` when passed through a custom file template context.
|
|
5906
6064
|
removeFile = (fileIndex) => {
|
|
5907
6065
|
if (this.notInteractive())
|
|
5908
6066
|
return;
|
|
5909
6067
|
this.value.update(files => files.filter((_file, index) => index !== fileIndex));
|
|
5910
6068
|
};
|
|
5911
|
-
//
|
|
5912
|
-
|
|
5913
|
-
const accepted = incoming.filter(file => this.
|
|
6069
|
+
// Adds what the picker or a drop hands over, keeping only what is accepted.
|
|
6070
|
+
addFiles(incoming) {
|
|
6071
|
+
const accepted = incoming.filter(file => acceptsFile(file, this.accept()));
|
|
5914
6072
|
if (!accepted.length)
|
|
5915
6073
|
return;
|
|
5916
6074
|
this.touched.set(true);
|
|
@@ -5921,23 +6079,7 @@ class FileInput extends ValueFormControl {
|
|
|
5921
6079
|
this.value.set(accepted.slice(0, 1));
|
|
5922
6080
|
}
|
|
5923
6081
|
}
|
|
5924
|
-
|
|
5925
|
-
const accept = this.accept().trim();
|
|
5926
|
-
if (!accept)
|
|
5927
|
-
return true;
|
|
5928
|
-
const fileName = file.name.toLowerCase();
|
|
5929
|
-
const fileType = file.type.toLowerCase();
|
|
5930
|
-
return accept.split(',').some(rule => {
|
|
5931
|
-
const pattern = rule.trim().toLowerCase();
|
|
5932
|
-
if (!pattern)
|
|
5933
|
-
return false;
|
|
5934
|
-
if (pattern.startsWith('.'))
|
|
5935
|
-
return fileName.endsWith(pattern);
|
|
5936
|
-
if (pattern.endsWith('/*'))
|
|
5937
|
-
return fileType.startsWith(pattern.slice(0, -1));
|
|
5938
|
-
return fileType === pattern;
|
|
5939
|
-
});
|
|
5940
|
-
}
|
|
6082
|
+
// Private methods
|
|
5941
6083
|
_formatAcceptRule(rule) {
|
|
5942
6084
|
if (rule.startsWith('.'))
|
|
5943
6085
|
return rule.slice(1).toUpperCase();
|
|
@@ -5955,29 +6097,12 @@ class FileInput extends ValueFormControl {
|
|
|
5955
6097
|
const subtype = rule.includes('/') ? rule.slice(rule.indexOf('/') + 1) : rule;
|
|
5956
6098
|
return subtype.toUpperCase();
|
|
5957
6099
|
}
|
|
5958
|
-
// Drag-time check: only the MIME type is exposed before drop, so reject a
|
|
5959
|
-
// dragged file only when we can be certain it fails purely MIME-based rules.
|
|
5960
|
-
_isTypeRejected(type) {
|
|
5961
|
-
const accept = this.accept().trim();
|
|
5962
|
-
if (!accept)
|
|
5963
|
-
return false;
|
|
5964
|
-
const rules = accept
|
|
5965
|
-
.split(',')
|
|
5966
|
-
.map(rule => rule.trim().toLowerCase())
|
|
5967
|
-
.filter(Boolean);
|
|
5968
|
-
const hasExtensionRule = rules.some(rule => rule.startsWith('.'));
|
|
5969
|
-
if (hasExtensionRule || !type)
|
|
5970
|
-
return false;
|
|
5971
|
-
const fileType = type.toLowerCase();
|
|
5972
|
-
const matches = rules.some(rule => rule.endsWith('/*') ? fileType.startsWith(rule.slice(0, -1)) : fileType === rule);
|
|
5973
|
-
return !matches;
|
|
5974
|
-
}
|
|
5975
6100
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
5976
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FileInput, isStandalone: true, selector: "tls-file-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, hideFileList: { classPropertyName: "hideFileList", publicName: "hideFileList", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nativeInput", first: true, predicate: ["nativeInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (
|
|
6101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FileInput, isStandalone: true, selector: "tls-file-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, hideFileList: { classPropertyName: "hideFileList", publicName: "hideFileList", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nativeInput", first: true, predicate: ["nativeInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n #dropTarget=\"tlsFileDropTarget\"\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [tlsFileDropTarget]=\"accept()\"\n [disabled]=\"notInteractive()\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dropTarget.dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dropTarget.dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (filesDropped)=\"addFiles($event)\"\n >\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dropTarget.dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-input__label\">\n @if (dropTarget.dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n </div>\n}\n@if (value().length && !hideFileList()) {\n <ul class=\"tls-file-input__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-input__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-input__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-input__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "[tlsButton]" }, { kind: "directive", type: FileDropTargetDirective, selector: "[tlsFileDropTarget]", inputs: ["tlsFileDropTarget", "disabled"], outputs: ["filesDropped"], exportAs: ["tlsFileDropTarget"] }] });
|
|
5977
6102
|
}
|
|
5978
6103
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileInput, decorators: [{
|
|
5979
6104
|
type: Component,
|
|
5980
|
-
args: [{ selector: 'tls-file-input', imports: [NgTemplateOutlet, ButtonDirective], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], host: { '[class]': 'classes()' }, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (
|
|
6105
|
+
args: [{ selector: 'tls-file-input', imports: [NgTemplateOutlet, ButtonDirective, FileDropTargetDirective], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], host: { '[class]': 'classes()' }, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n #dropTarget=\"tlsFileDropTarget\"\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [tlsFileDropTarget]=\"accept()\"\n [disabled]=\"notInteractive()\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dropTarget.dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dropTarget.dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (filesDropped)=\"addFiles($event)\"\n >\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dropTarget.dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-input__label\">\n @if (dropTarget.dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n </div>\n}\n@if (value().length && !hideFileList()) {\n <ul class=\"tls-file-input__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-input__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-input__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-input__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n" }]
|
|
5981
6106
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], hideFileList: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFileList", required: false }] }], nativeInput: [{ type: i0.ViewChild, args: ['nativeInput', { isSignal: true }] }], dropZoneTemplate: [{ type: i0.ContentChild, args: ['dropZone', { isSignal: true }] }], fileTemplate: [{ type: i0.ContentChild, args: ['file', { isSignal: true }] }] } });
|
|
5982
6107
|
|
|
5983
6108
|
const DEFAULT_INPUT_CONFIG = {
|
|
@@ -10107,5 +10232,5 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
10107
10232
|
* Generated bundle index. Do not edit.
|
|
10108
10233
|
*/
|
|
10109
10234
|
|
|
10110
|
-
export { ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, AUTOCOMPLETE_CONFIG, ActivityHeatmap, Alert, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_PROGRESS_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_RATING_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEPPER_LABELS, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DEFAULT_VIRTUAL_SCROLL_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogRef, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, HIGHLIGHT_CONFIG, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, PROGRESS_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, Progress, RADIO_BUTTON_CONFIG, RATING_CONFIG, RadioButton, Rating, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, VIRTUAL_SCROLL_CONFIG, ValueFormControl, VirtualScroll, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, provideThalassicIcons, provideThalassicUIConfig, resolveActivityLevel };
|
|
10235
|
+
export { ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, AUTOCOMPLETE_CONFIG, ActivityHeatmap, Alert, AlertIcon, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_PROGRESS_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_RATING_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEPPER_LABELS, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DEFAULT_VIRTUAL_SCROLL_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogRef, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileDropTargetDirective, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, HIGHLIGHT_CONFIG, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, PROGRESS_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, Progress, RADIO_BUTTON_CONFIG, RATING_CONFIG, RadioButton, Rating, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, VIRTUAL_SCROLL_CONFIG, ValueFormControl, VirtualScroll, acceptsFile, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, isTypeRejected, normalizeAccept, provideThalassicIcons, provideThalassicUIConfig, resolveActivityLevel };
|
|
10111
10236
|
//# sourceMappingURL=thalassic-ui.mjs.map
|