@nanahoshi/mona-ui 0.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 +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { NgTemplateOutlet, DecimalPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, TemplateRef, Directive, computed, contentChild, input, Component } from '@angular/core';
|
|
4
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
5
|
+
import { getPercentage } from '@nanahoshi/mona-ui/common';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
|
|
9
|
+
class ProgressBarLabelTemplateDirective {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.templateRef = inject(TemplateRef);
|
|
12
|
+
}
|
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ProgressBarLabelTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
14
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ProgressBarLabelTemplateDirective, isStandalone: true, selector: "ng-template[monaProgressBarLabelTemplate]", ngImport: i0 }); }
|
|
15
|
+
}
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ProgressBarLabelTemplateDirective, decorators: [{
|
|
17
|
+
type: Directive,
|
|
18
|
+
args: [{
|
|
19
|
+
selector: "ng-template[monaProgressBarLabelTemplate]"
|
|
20
|
+
}]
|
|
21
|
+
}] });
|
|
22
|
+
|
|
23
|
+
const progressBarBaseVariants = cva(`
|
|
24
|
+
relative flex items-center justify-center
|
|
25
|
+
w-full h-5.5
|
|
26
|
+
bg-input-background border border-input-border
|
|
27
|
+
overflow-hidden select-none
|
|
28
|
+
data-[disabled='true']:pointer-events-none
|
|
29
|
+
data-[disabled='true']:cursor-not-allowed
|
|
30
|
+
data-[disabled='true']:opacity-50
|
|
31
|
+
`, {
|
|
32
|
+
variants: {
|
|
33
|
+
rounded: {
|
|
34
|
+
full: "rounded-full",
|
|
35
|
+
large: "rounded-lg",
|
|
36
|
+
medium: "rounded-md",
|
|
37
|
+
none: "rounded-none",
|
|
38
|
+
small: "rounded-sm"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const progressBarIndeterminateVariants = cva(`
|
|
43
|
+
absolute w-full h-full
|
|
44
|
+
flex items-center justify-center
|
|
45
|
+
bg-[repeating-linear-gradient(135deg,var(--color-background),var(--color-background)_10px,var(--color-secondary)_10px,var(--color-secondary)_20px)]
|
|
46
|
+
bg-size-[200%_200%]
|
|
47
|
+
`);
|
|
48
|
+
const progressBarLabelVariants = cva(`
|
|
49
|
+
px-1.5
|
|
50
|
+
`);
|
|
51
|
+
const progressBarTrackVariants = cva(`
|
|
52
|
+
relative
|
|
53
|
+
flex items-center justify-center
|
|
54
|
+
w-full h-full
|
|
55
|
+
text-xs font-medium
|
|
56
|
+
bg-primary text-primary-foreground
|
|
57
|
+
data-[prev='true']:transition-[background-color]
|
|
58
|
+
data-[prev='true']:duration-200
|
|
59
|
+
data-[prev='true']:ease-in
|
|
60
|
+
data-[next='true']:absolute
|
|
61
|
+
data-[next='true']:bg-background
|
|
62
|
+
data-[next='true']:text-foreground
|
|
63
|
+
data-[next='true']:transition-[clip-path]
|
|
64
|
+
data-[next='true']:duration-200
|
|
65
|
+
data-[next='true']:ease-in
|
|
66
|
+
data-[value='0']:bg-transparent
|
|
67
|
+
data-[left='true']:justify-start
|
|
68
|
+
data-[right='true']:justify-end
|
|
69
|
+
`, {
|
|
70
|
+
variants: {
|
|
71
|
+
rounded: {
|
|
72
|
+
full: "rounded-full",
|
|
73
|
+
large: "rounded-lg",
|
|
74
|
+
medium: "rounded-md",
|
|
75
|
+
none: "rounded-none",
|
|
76
|
+
small: "rounded-sm"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const progressBarBaseThemeVariants = (theme) => {
|
|
82
|
+
switch (theme) {
|
|
83
|
+
case "mona":
|
|
84
|
+
return progressBarBaseVariants;
|
|
85
|
+
default:
|
|
86
|
+
return progressBarBaseVariants;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const progressBarIndeterminateThemeVariants = (theme) => {
|
|
90
|
+
switch (theme) {
|
|
91
|
+
case "mona":
|
|
92
|
+
return progressBarIndeterminateVariants;
|
|
93
|
+
default:
|
|
94
|
+
return progressBarIndeterminateVariants;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const progressBarLabelThemeVariants = (theme) => {
|
|
98
|
+
switch (theme) {
|
|
99
|
+
case "mona":
|
|
100
|
+
return progressBarLabelVariants;
|
|
101
|
+
default:
|
|
102
|
+
return progressBarLabelVariants;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const progressBarTrackThemeVariants = (theme) => {
|
|
106
|
+
switch (theme) {
|
|
107
|
+
case "mona":
|
|
108
|
+
return progressBarTrackVariants;
|
|
109
|
+
default:
|
|
110
|
+
return progressBarTrackVariants;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
class ProgressBarComponent {
|
|
115
|
+
constructor() {
|
|
116
|
+
this.#color = computed(() => {
|
|
117
|
+
const color = this.color();
|
|
118
|
+
const progress = this.progress();
|
|
119
|
+
return typeof color === "string" ? color : color?.(progress);
|
|
120
|
+
}, /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "#color" }] : /* istanbul ignore next */ []));
|
|
122
|
+
this.#themeService = inject(ThemeService);
|
|
123
|
+
this.baseClasses = computed(() => {
|
|
124
|
+
const theme = this.#themeService.theme();
|
|
125
|
+
const rounded = this.rounded();
|
|
126
|
+
const classes = progressBarBaseThemeVariants(theme)({ rounded });
|
|
127
|
+
const userClass = this.userClass();
|
|
128
|
+
return twMerge(classes, userClass);
|
|
129
|
+
}, /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
131
|
+
this.indeterminateClasses = computed(() => {
|
|
132
|
+
const theme = this.#themeService.theme();
|
|
133
|
+
return progressBarIndeterminateThemeVariants(theme)();
|
|
134
|
+
}, /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "indeterminateClasses" }] : /* istanbul ignore next */ []));
|
|
136
|
+
this.labelClasses = computed(() => {
|
|
137
|
+
const theme = this.#themeService.theme();
|
|
138
|
+
return progressBarLabelThemeVariants(theme)();
|
|
139
|
+
}, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []));
|
|
141
|
+
this.labelTemplate = contentChild(ProgressBarLabelTemplateDirective, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "labelTemplate" }] : /* istanbul ignore next */ []));
|
|
143
|
+
this.nextTrackClipPath = computed(() => {
|
|
144
|
+
const progress = this.progress();
|
|
145
|
+
return `inset(-1px -1px -1px ${progress}%)`;
|
|
146
|
+
}, /* @ts-ignore */
|
|
147
|
+
...(ngDevMode ? [{ debugName: "nextTrackClipPath" }] : /* istanbul ignore next */ []));
|
|
148
|
+
this.prevTrackClipPath = computed(() => {
|
|
149
|
+
const progress = this.progress();
|
|
150
|
+
const indeterminate = this.indeterminate();
|
|
151
|
+
if (indeterminate) {
|
|
152
|
+
return `inset(-1px -1px -1px -1px)`;
|
|
153
|
+
}
|
|
154
|
+
const right = progress < 100 ? 8 : 0;
|
|
155
|
+
return `inset(-1px ${right}px -1px 0px)`;
|
|
156
|
+
}, /* @ts-ignore */
|
|
157
|
+
...(ngDevMode ? [{ debugName: "prevTrackClipPath" }] : /* istanbul ignore next */ []));
|
|
158
|
+
this.progress = computed(() => getPercentage(this.value(), this.min(), this.max()), /* @ts-ignore */
|
|
159
|
+
...(ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []));
|
|
160
|
+
this.trackClasses = computed(() => {
|
|
161
|
+
const theme = this.#themeService.theme();
|
|
162
|
+
const rounded = this.rounded();
|
|
163
|
+
const classes = progressBarTrackThemeVariants(theme)({ rounded });
|
|
164
|
+
return this.animate()
|
|
165
|
+
? classes
|
|
166
|
+
: twMerge(classes, "data-[next='true']:transition-none data-[prev='true']:transition-none");
|
|
167
|
+
}, /* @ts-ignore */
|
|
168
|
+
...(ngDevMode ? [{ debugName: "trackClasses" }] : /* istanbul ignore next */ []));
|
|
169
|
+
this.trackColor = this.#color;
|
|
170
|
+
/**
|
|
171
|
+
* @description Accessible label for the progress bar host element.
|
|
172
|
+
* Use to describe what is being measured (e.g., "Upload progress").
|
|
173
|
+
* When empty, assistive technology announces the role and numeric values only.
|
|
174
|
+
* @default ""
|
|
175
|
+
*/
|
|
176
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
177
|
+
/**
|
|
178
|
+
* @description Overrides the numeric aria-valuenow announcement for assistive technology.
|
|
179
|
+
* Particularly useful in indeterminate mode — set to a localized string such as "Loading"
|
|
180
|
+
* so screen readers announce state rather than silence.
|
|
181
|
+
* When empty, assistive technology falls back to the numeric value.
|
|
182
|
+
* @default ""
|
|
183
|
+
*/
|
|
184
|
+
this.ariaValueText = input("", { ...(ngDevMode ? { debugName: "ariaValueText" } : /* istanbul ignore next */ {}), alias: "aria-valuetext" });
|
|
185
|
+
/**
|
|
186
|
+
* @description Enables CSS transitions on fill and color changes.
|
|
187
|
+
* Set to `false` when updating `value` at high frequency (e.g., a real-time byte counter).
|
|
188
|
+
* @default true
|
|
189
|
+
*/
|
|
190
|
+
this.animate = input(true, /* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
192
|
+
/**
|
|
193
|
+
* @description Fill color of the progress track.
|
|
194
|
+
* Pass a CSS color string, or a function that receives the current percentage (0–100) and returns a color string.
|
|
195
|
+
* When empty, falls back to the primary theme color.
|
|
196
|
+
* @default ""
|
|
197
|
+
*/
|
|
198
|
+
this.color = input("", /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
200
|
+
/**
|
|
201
|
+
* @description Renders the bar with reduced visual emphasis and removes pointer interaction.
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
205
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
206
|
+
/**
|
|
207
|
+
* @description Switches to indeterminate mode: plays a looping animation and hides the label.
|
|
208
|
+
* ARIA value attributes are removed and `aria-busy` is set on the host element.
|
|
209
|
+
* @default false
|
|
210
|
+
*/
|
|
211
|
+
this.indeterminate = input(false, /* @ts-ignore */
|
|
212
|
+
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
213
|
+
/**
|
|
214
|
+
* @description Horizontal alignment of the label within the bar.
|
|
215
|
+
* @default center
|
|
216
|
+
*/
|
|
217
|
+
this.labelPosition = input("center", /* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
219
|
+
/**
|
|
220
|
+
* @description Inline styles applied to the default label span.
|
|
221
|
+
* Has no effect when a custom `monaProgressBarLabelTemplate` is provided.
|
|
222
|
+
* @default {}
|
|
223
|
+
*/
|
|
224
|
+
this.labelStyles = input({}, /* @ts-ignore */
|
|
225
|
+
...(ngDevMode ? [{ debugName: "labelStyles" }] : /* istanbul ignore next */ []));
|
|
226
|
+
/**
|
|
227
|
+
* @description Controls label visibility in determinate mode.
|
|
228
|
+
* Has no effect in indeterminate mode — the label is always hidden there.
|
|
229
|
+
* @default true
|
|
230
|
+
*/
|
|
231
|
+
this.labelVisible = input(true, /* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "labelVisible" }] : /* istanbul ignore next */ []));
|
|
233
|
+
/**
|
|
234
|
+
* @description Upper bound of the value range. Must be greater than `min`.
|
|
235
|
+
* @default 100
|
|
236
|
+
*/
|
|
237
|
+
this.max = input(100, /* @ts-ignore */
|
|
238
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
239
|
+
/**
|
|
240
|
+
* @description Lower bound of the value range.
|
|
241
|
+
* @default 0
|
|
242
|
+
*/
|
|
243
|
+
this.min = input(0, /* @ts-ignore */
|
|
244
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
245
|
+
/**
|
|
246
|
+
* @description Border-radius preset applied to the bar.
|
|
247
|
+
* @default medium
|
|
248
|
+
*/
|
|
249
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
251
|
+
/**
|
|
252
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
253
|
+
* @default ""
|
|
254
|
+
*/
|
|
255
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
256
|
+
/**
|
|
257
|
+
* @description Current progress value within `[min, max]`.
|
|
258
|
+
* Values outside the range are clamped before rendering; non-finite values are treated as `0`.
|
|
259
|
+
* @default 0
|
|
260
|
+
*/
|
|
261
|
+
this.value = input(0, /* @ts-ignore */
|
|
262
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
263
|
+
}
|
|
264
|
+
#color;
|
|
265
|
+
#themeService;
|
|
266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
267
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ProgressBarComponent, isStandalone: true, selector: "mona-progress-bar", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaValueText: { classPropertyName: "ariaValueText", publicName: "aria-valuetext", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelStyles: { classPropertyName: "labelStyles", publicName: "labelStyles", isSignal: true, isRequired: false, transformFunction: null }, labelVisible: { classPropertyName: "labelVisible", publicName: "labelVisible", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "class": "baseClasses()", "attr.aria-busy": "indeterminate() || null", "attr.aria-label": "ariaLabel() || null", "attr.aria-valuemin": "indeterminate() ? null : min()", "attr.aria-valuemax": "indeterminate() ? null : max()", "attr.aria-valuenow": "indeterminate() ? null : value()", "attr.aria-valuetext": "ariaValueText() || null", "attr.aria-disabled": "disabled() || null", "attr.data-disabled": "disabled()" } }, queries: [{ propertyName: "labelTemplate", first: true, predicate: ProgressBarLabelTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n [class]=\"trackClasses()\"\r\n [style.background-color]=\"trackColor()\"\r\n [attr.data-prev]=\"true\"\r\n [attr.data-left]=\"labelPosition() === 'start'\"\r\n [attr.data-right]=\"labelPosition() === 'end'\"\r\n [attr.data-indeterminate]=\"indeterminate()\"\r\n [attr.data-value]=\"progress()\"\r\n [style.clip-path]=\"prevTrackClipPath()\">\r\n @if (indeterminate()) {\r\n <div [class]=\"indeterminateClasses()\" class=\"indeterminate\"></div>\r\n } @else if (labelVisible()) {\r\n @if (labelTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\r\n </ng-container>\r\n } @else {\r\n <span [class]=\"labelClasses()\" [style]=\"labelStyles()\">{{ progress() | number: \"1.0-2\" }}</span>\r\n }\r\n }\r\n</div>\r\n\r\n@if (!indeterminate()) {\r\n <div\r\n [class]=\"trackClasses()\"\r\n [attr.data-next]=\"true\"\r\n [attr.data-left]=\"labelPosition() === 'start'\"\r\n [attr.data-right]=\"labelPosition() === 'end'\"\r\n [style.clip-path]=\"nextTrackClipPath()\">\r\n @if (labelVisible()) {\r\n @if (labelTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\r\n </ng-container>\r\n } @else {\r\n <span [class]=\"labelClasses()\" [style]=\"labelStyles()\">{{ progress() | number: \"1.0-2\" }}</span>\r\n }\r\n }\r\n </div>\r\n}\r\n", styles: [".indeterminate{animation:indeterminate 16s linear infinite}@keyframes indeterminate{0%{background-position:0 0}to{background-position:100% 0}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: DecimalPipe, name: "number" }] }); }
|
|
268
|
+
}
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ProgressBarComponent, decorators: [{
|
|
270
|
+
type: Component,
|
|
271
|
+
args: [{ selector: "mona-progress-bar", imports: [DecimalPipe, NgTemplateOutlet], host: {
|
|
272
|
+
"[class]": "baseClasses()",
|
|
273
|
+
"[attr.aria-busy]": "indeterminate() || null",
|
|
274
|
+
"[attr.aria-label]": "ariaLabel() || null",
|
|
275
|
+
"[attr.aria-valuemin]": "indeterminate() ? null : min()",
|
|
276
|
+
"[attr.aria-valuemax]": "indeterminate() ? null : max()",
|
|
277
|
+
"[attr.aria-valuenow]": "indeterminate() ? null : value()",
|
|
278
|
+
"[attr.aria-valuetext]": "ariaValueText() || null",
|
|
279
|
+
"[attr.aria-disabled]": "disabled() || null",
|
|
280
|
+
"[attr.data-disabled]": "disabled()",
|
|
281
|
+
role: "progressbar"
|
|
282
|
+
}, template: "<div\r\n [class]=\"trackClasses()\"\r\n [style.background-color]=\"trackColor()\"\r\n [attr.data-prev]=\"true\"\r\n [attr.data-left]=\"labelPosition() === 'start'\"\r\n [attr.data-right]=\"labelPosition() === 'end'\"\r\n [attr.data-indeterminate]=\"indeterminate()\"\r\n [attr.data-value]=\"progress()\"\r\n [style.clip-path]=\"prevTrackClipPath()\">\r\n @if (indeterminate()) {\r\n <div [class]=\"indeterminateClasses()\" class=\"indeterminate\"></div>\r\n } @else if (labelVisible()) {\r\n @if (labelTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\r\n </ng-container>\r\n } @else {\r\n <span [class]=\"labelClasses()\" [style]=\"labelStyles()\">{{ progress() | number: \"1.0-2\" }}</span>\r\n }\r\n }\r\n</div>\r\n\r\n@if (!indeterminate()) {\r\n <div\r\n [class]=\"trackClasses()\"\r\n [attr.data-next]=\"true\"\r\n [attr.data-left]=\"labelPosition() === 'start'\"\r\n [attr.data-right]=\"labelPosition() === 'end'\"\r\n [style.clip-path]=\"nextTrackClipPath()\">\r\n @if (labelVisible()) {\r\n @if (labelTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\r\n </ng-container>\r\n } @else {\r\n <span [class]=\"labelClasses()\" [style]=\"labelStyles()\">{{ progress() | number: \"1.0-2\" }}</span>\r\n }\r\n }\r\n </div>\r\n}\r\n", styles: [".indeterminate{animation:indeterminate 16s linear infinite}@keyframes indeterminate{0%{background-position:0 0}to{background-position:100% 0}}\n"] }]
|
|
283
|
+
}], propDecorators: { labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ProgressBarLabelTemplateDirective), { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaValueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-valuetext", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelStyles", required: false }] }], labelVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVisible", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
* Public API Surface of @nanahoshi/mona-ui/progress-bar
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Generated bundle index. Do not edit.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
export { ProgressBarComponent, ProgressBarLabelTemplateDirective };
|
|
294
|
+
//# sourceMappingURL=nanahoshi-mona-ui-progress-bar.mjs.map
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Enumerator } from '@mirei/ts-collections';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
|
|
4
|
+
const compositeDescriptorToPredicate = (descriptor, fieldSelector) => {
|
|
5
|
+
return (item) => {
|
|
6
|
+
const filters = descriptor.filters;
|
|
7
|
+
const logic = descriptor.logic;
|
|
8
|
+
if (logic === "and") {
|
|
9
|
+
return filters.every(f => processFilter(f, item, fieldSelector));
|
|
10
|
+
}
|
|
11
|
+
else if (logic === "or") {
|
|
12
|
+
return filters.some(f => processFilter(f, item, fieldSelector));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const descriptorToPredicate = (descriptor, fieldSelector) => {
|
|
20
|
+
return (item) => {
|
|
21
|
+
const source = fieldSelector ? fieldSelector(item) : item;
|
|
22
|
+
const value = source != null ? source[descriptor.field] : undefined;
|
|
23
|
+
switch (descriptor.operator) {
|
|
24
|
+
case "eq":
|
|
25
|
+
return equateValues(value, descriptor.value);
|
|
26
|
+
case "neq":
|
|
27
|
+
return !equateValues(value, descriptor.value);
|
|
28
|
+
case "gt":
|
|
29
|
+
if (value == null || descriptor.value == null)
|
|
30
|
+
return false;
|
|
31
|
+
return compareOrdered(value, descriptor.value) > 0;
|
|
32
|
+
case "gte":
|
|
33
|
+
if (value == null || descriptor.value == null)
|
|
34
|
+
return false;
|
|
35
|
+
return compareOrdered(value, descriptor.value) >= 0;
|
|
36
|
+
case "lt":
|
|
37
|
+
if (value == null || descriptor.value == null)
|
|
38
|
+
return false;
|
|
39
|
+
return compareOrdered(value, descriptor.value) < 0;
|
|
40
|
+
case "lte":
|
|
41
|
+
if (value == null || descriptor.value == null)
|
|
42
|
+
return false;
|
|
43
|
+
return compareOrdered(value, descriptor.value) <= 0;
|
|
44
|
+
case "startswith":
|
|
45
|
+
return typeof value === "string" && typeof descriptor.value === "string"
|
|
46
|
+
? value.toLowerCase().startsWith(descriptor.value.toLowerCase())
|
|
47
|
+
: false;
|
|
48
|
+
case "endswith":
|
|
49
|
+
return typeof value === "string" && typeof descriptor.value === "string"
|
|
50
|
+
? value.toLowerCase().endsWith(descriptor.value.toLowerCase())
|
|
51
|
+
: false;
|
|
52
|
+
case "contains":
|
|
53
|
+
return typeof value === "string" && typeof descriptor.value === "string"
|
|
54
|
+
? value.toLowerCase().includes(descriptor.value.toLowerCase())
|
|
55
|
+
: false;
|
|
56
|
+
case "doesnotcontain":
|
|
57
|
+
return typeof value === "string" && typeof descriptor.value === "string"
|
|
58
|
+
? !value.toLowerCase().includes(descriptor.value.toLowerCase())
|
|
59
|
+
: false;
|
|
60
|
+
case "isfalse":
|
|
61
|
+
return value === false;
|
|
62
|
+
case "istrue":
|
|
63
|
+
return value === true;
|
|
64
|
+
case "isnull":
|
|
65
|
+
return value == null;
|
|
66
|
+
case "isnotnull":
|
|
67
|
+
return value != null;
|
|
68
|
+
case "isempty":
|
|
69
|
+
return value === "";
|
|
70
|
+
case "isnotempty":
|
|
71
|
+
return value !== "";
|
|
72
|
+
case "isnullorempty":
|
|
73
|
+
return value == null || value === "";
|
|
74
|
+
case "isnotnullorempty":
|
|
75
|
+
return value != null && value !== "";
|
|
76
|
+
case "in":
|
|
77
|
+
return Array.isArray(descriptor.value) && descriptor.value.includes(value);
|
|
78
|
+
case "notin":
|
|
79
|
+
return !Array.isArray(descriptor.value) || !descriptor.value.includes(value);
|
|
80
|
+
case "function":
|
|
81
|
+
return descriptor.predicate(value);
|
|
82
|
+
default:
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const isDate = (value) => value instanceof Date || value instanceof DateTime;
|
|
88
|
+
const toDateOnly = (date) => {
|
|
89
|
+
const dt = date instanceof DateTime ? date : DateTime.fromJSDate(date);
|
|
90
|
+
return dt.startOf("day");
|
|
91
|
+
};
|
|
92
|
+
const equateValues = (a, b) => {
|
|
93
|
+
if (a == null && b == null)
|
|
94
|
+
return true;
|
|
95
|
+
if (a == null || b == null)
|
|
96
|
+
return false;
|
|
97
|
+
if (isDate(a) && isDate(b))
|
|
98
|
+
return toDateOnly(a).valueOf() === toDateOnly(b).valueOf();
|
|
99
|
+
return a === b;
|
|
100
|
+
};
|
|
101
|
+
const compareOrdered = (a, b) => {
|
|
102
|
+
if (isDate(a) && isDate(b))
|
|
103
|
+
return toDateOnly(a).valueOf() - toDateOnly(b).valueOf();
|
|
104
|
+
return a - b;
|
|
105
|
+
};
|
|
106
|
+
const processFilter = (f, item, fieldSelector) => {
|
|
107
|
+
if (f.hasOwnProperty("field")) {
|
|
108
|
+
return descriptorToPredicate(f, fieldSelector)(item);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return compositeDescriptorToPredicate(f, fieldSelector)(item);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
class Query {
|
|
116
|
+
#enumerator;
|
|
117
|
+
constructor(iterable) {
|
|
118
|
+
this.iterable = iterable;
|
|
119
|
+
this.#enumerator = new QueryEnumerator(() => iterable);
|
|
120
|
+
}
|
|
121
|
+
*[Symbol.iterator]() {
|
|
122
|
+
yield* this.iterable;
|
|
123
|
+
}
|
|
124
|
+
static from(iterable) {
|
|
125
|
+
return new Query(iterable);
|
|
126
|
+
}
|
|
127
|
+
filter(filter, fieldSelector) {
|
|
128
|
+
return this.#enumerator.filter(filter, fieldSelector);
|
|
129
|
+
}
|
|
130
|
+
run() {
|
|
131
|
+
return this.#enumerator.toArray();
|
|
132
|
+
}
|
|
133
|
+
sort(descriptor, fieldSelector) {
|
|
134
|
+
return this.#enumerator.sort(descriptor, fieldSelector);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class QueryEnumerator extends Enumerator {
|
|
138
|
+
constructor(iterable) {
|
|
139
|
+
super(iterable);
|
|
140
|
+
}
|
|
141
|
+
filter(filter, fieldSelector) {
|
|
142
|
+
return new QueryEnumerator(() => this.filterGenerator(filter, fieldSelector));
|
|
143
|
+
}
|
|
144
|
+
run() {
|
|
145
|
+
return Array.from(this);
|
|
146
|
+
}
|
|
147
|
+
sort(descriptor, fieldSelector) {
|
|
148
|
+
return new QueryEnumerator(() => this.sortGenerator(descriptor, fieldSelector));
|
|
149
|
+
}
|
|
150
|
+
*filterGenerator(filter, fieldSelector) {
|
|
151
|
+
const predicate = filter.hasOwnProperty("field")
|
|
152
|
+
? descriptorToPredicate(filter, fieldSelector)
|
|
153
|
+
: compositeDescriptorToPredicate(filter, fieldSelector);
|
|
154
|
+
yield* this.where(predicate);
|
|
155
|
+
}
|
|
156
|
+
*sortGenerator(descriptor, fieldSelector) {
|
|
157
|
+
let result = descriptor[0].dir === "asc"
|
|
158
|
+
? this.orderBy(d => (fieldSelector ? fieldSelector(d) : d)[descriptor[0].field], descriptor[0].sort)
|
|
159
|
+
: this.orderByDescending(d => (fieldSelector ? fieldSelector(d) : d)[descriptor[0].field], descriptor[0].sort);
|
|
160
|
+
for (let i = 1; i < descriptor.length; i++) {
|
|
161
|
+
result =
|
|
162
|
+
descriptor[i].dir === "asc"
|
|
163
|
+
? result.thenBy(d => (fieldSelector ? fieldSelector(d) : d)[descriptor[i].field], descriptor[i].sort)
|
|
164
|
+
: result.thenByDescending(d => (fieldSelector ? fieldSelector(d) : d)[descriptor[i].field], descriptor[i].sort);
|
|
165
|
+
}
|
|
166
|
+
yield* result;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Generated bundle index. Do not edit.
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
export { Query };
|
|
175
|
+
//# sourceMappingURL=nanahoshi-mona-ui-query.mjs.map
|