@nanahoshi/mona-ui 0.45.1 → 0.47.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/THIRD_PARTY_NOTICES.md +34 -0
- package/docs/api/button.json +1 -1
- package/docs/api/button.md +1 -0
- package/docs/api/check-box.json +1 -1
- package/docs/api/check-box.md +1 -0
- package/docs/api/chip.json +1 -1
- package/docs/api/chip.md +1 -0
- package/docs/api/common.json +1 -1
- package/docs/api/common.md +1 -1
- package/docs/api/index.json +1 -1
- package/docs/api/radio-button.json +1 -1
- package/docs/api/radio-button.md +1 -0
- package/docs/api/ripple.json +1 -0
- package/docs/api/ripple.md +75 -0
- package/docs/api/sidebar.json +1 -1
- package/docs/api/sidebar.md +1 -0
- package/docs/api/switch.json +1 -1
- package/docs/api/switch.md +1 -0
- package/docs/api/theme.json +1 -1
- package/docs/api/theme.md +14 -6
- package/docs/installation.md +1 -1
- package/docs/manifest.json +1 -1
- package/docs/ripple.md +360 -0
- package/docs/sidebar-menus.md +8 -0
- package/docs/theming-built-in-themes.md +25 -12
- package/docs/theming-custom-themes.md +19 -0
- package/docs/theming.md +2 -1
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +6 -6
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-button.mjs +20 -2
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +15 -7
- package/fesm2022/nanahoshi-mona-ui-chat.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +36 -11
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +9 -3
- package/fesm2022/nanahoshi-mona-ui-masked-text-box.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +12 -4
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +105 -19
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +33 -9
- package/fesm2022/nanahoshi-mona-ui-ripple.mjs +196 -0
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +10 -4
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +21 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +5 -1
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +31 -6
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +7 -1
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +6 -6
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +295 -51
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1 -1
- package/llms.txt +4 -2
- package/package.json +5 -1
- package/ripple/package.json +5 -0
- package/types/nanahoshi-mona-ui-button.d.ts +8 -1
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-chat.d.ts +1 -1
- package/types/nanahoshi-mona-ui-check-box.d.ts +10 -1
- package/types/nanahoshi-mona-ui-chip.d.ts +8 -1
- package/types/nanahoshi-mona-ui-radio-button.d.ts +9 -1
- package/types/nanahoshi-mona-ui-ripple.d.ts +72 -0
- package/types/nanahoshi-mona-ui-sidebar.d.ts +12 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +10 -2
- package/types/nanahoshi-mona-ui-theme.d.ts +71 -1
|
@@ -4,6 +4,8 @@ import { Component, Directive, ElementRef, InjectionToken, afterNextRender, afte
|
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
7
|
+
import * as i1 from "@nanahoshi/mona-ui/ripple";
|
|
8
|
+
import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
|
|
7
9
|
import { FormsModule } from "@angular/forms";
|
|
8
10
|
const radioGroupThemeVariants = cva("flex", {
|
|
9
11
|
variants: { orientation: {
|
|
@@ -17,7 +19,7 @@ const radioButtonThemeVariants = cva(`
|
|
|
17
19
|
`);
|
|
18
20
|
const radioButtonCircleThemeVariants = cva(`
|
|
19
21
|
relative flex h-4.5 w-4.5 items-center justify-center
|
|
20
|
-
cursor-pointer
|
|
22
|
+
cursor-pointer
|
|
21
23
|
${themeControlSurfaceClasses}
|
|
22
24
|
border border-input-border
|
|
23
25
|
transition-colors duration-(--mona-motion-fast)
|
|
@@ -26,13 +28,13 @@ const radioButtonCircleThemeVariants = cva(`
|
|
|
26
28
|
peer-disabled:border-disabled-border peer-disabled:bg-disabled-background peer-disabled:text-disabled-foreground
|
|
27
29
|
|
|
28
30
|
peer-focus-visible:border-focus-indicator
|
|
29
|
-
peer-focus-visible:ring-
|
|
31
|
+
peer-focus-visible:ring-(length:--mona-focus-ring-width,2px) peer-focus-visible:ring-focus-indicator/(--mona-focus-ring-opacity,35%)
|
|
30
32
|
peer-focus-visible:outline-hidden
|
|
31
33
|
|
|
32
34
|
data-[invalid='true']:border-error
|
|
33
|
-
data-[invalid='true']:ring-
|
|
35
|
+
data-[invalid='true']:ring-(length:--mona-focus-ring-width,2px) data-[invalid='true']:ring-error/(--mona-focus-ring-opacity,35%)
|
|
34
36
|
data-[invalid='true']:peer-focus-visible:border-error
|
|
35
|
-
data-[invalid='true']:peer-focus-visible:ring-error/35
|
|
37
|
+
data-[invalid='true']:peer-focus-visible:ring-error/(--mona-focus-ring-opacity,35%)
|
|
36
38
|
`, { variants: { rounded: {
|
|
37
39
|
full: "rounded-full",
|
|
38
40
|
large: "rounded-lg",
|
|
@@ -88,12 +90,12 @@ const radioButtonDirectiveThemeVariants = cva(`
|
|
|
88
90
|
checked:after:rounded-full
|
|
89
91
|
|
|
90
92
|
focus-visible:border-focus-indicator
|
|
91
|
-
focus-visible:ring-
|
|
93
|
+
focus-visible:ring-(length:--mona-focus-ring-width,2px) focus-visible:ring-focus-indicator/(--mona-focus-ring-opacity,35%)
|
|
92
94
|
|
|
93
95
|
data-[invalid='true']:border-error
|
|
94
|
-
data-[invalid='true']:ring-
|
|
96
|
+
data-[invalid='true']:ring-(length:--mona-focus-ring-width,2px) data-[invalid='true']:ring-error/(--mona-focus-ring-opacity,35%)
|
|
95
97
|
data-[invalid='true']:focus-visible:border-error
|
|
96
|
-
data-[invalid='true']:focus-visible:ring-error/35
|
|
98
|
+
data-[invalid='true']:focus-visible:ring-error/(--mona-focus-ring-opacity,35%)
|
|
97
99
|
`, {
|
|
98
100
|
variants: { rounded: {
|
|
99
101
|
full: "rounded-full",
|
|
@@ -138,6 +140,7 @@ var RadioButtonComponent = class RadioButtonComponent {
|
|
|
138
140
|
focus: () => this.focus(),
|
|
139
141
|
wrapped: false
|
|
140
142
|
});
|
|
143
|
+
this.circleRef = viewChild("circle", ...ngDevMode ? [{ debugName: "circleRef" }] : /* istanbul ignore next */ []);
|
|
141
144
|
this.containerLabelClasses = computed(() => {
|
|
142
145
|
const labelSize = this.labelSize();
|
|
143
146
|
const userClasses = this.userClass();
|
|
@@ -218,6 +221,9 @@ var RadioButtonComponent = class RadioButtonComponent {
|
|
|
218
221
|
alias: "class"
|
|
219
222
|
});
|
|
220
223
|
this.value = model(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
224
|
+
const ripple = inject(RippleDirective, { self: true });
|
|
225
|
+
ripple.setHostDisabled(computed(() => this.effectiveDisabled() || this.effectiveReadonly()));
|
|
226
|
+
ripple.setHalo(() => this.circleRef()?.nativeElement);
|
|
221
227
|
const group = this.#group;
|
|
222
228
|
if (group) afterRenderEffect({ write: () => {
|
|
223
229
|
group.selectionVersion();
|
|
@@ -405,14 +411,24 @@ var RadioButtonComponent = class RadioButtonComponent {
|
|
|
405
411
|
"attr.data-disabled": "effectiveDisabled()"
|
|
406
412
|
} },
|
|
407
413
|
viewQueries: [{
|
|
414
|
+
propertyName: "circleRef",
|
|
415
|
+
first: true,
|
|
416
|
+
predicate: ["circle"],
|
|
417
|
+
descendants: true,
|
|
418
|
+
isSignal: true
|
|
419
|
+
}, {
|
|
408
420
|
propertyName: "inputRef",
|
|
409
421
|
first: true,
|
|
410
422
|
predicate: ["input"],
|
|
411
423
|
descendants: true,
|
|
412
424
|
isSignal: true
|
|
413
425
|
}],
|
|
426
|
+
hostDirectives: [{
|
|
427
|
+
directive: i1.RippleDirective,
|
|
428
|
+
inputs: ["monaRippleDisabled", "monaRippleDisabled"]
|
|
429
|
+
}],
|
|
414
430
|
ngImport: i0,
|
|
415
|
-
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"effectiveReadonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n #input\n type=\"radio\"\n [id]=\"inputId()\"\n [required]=\"effectiveRequired()\"\n [disabled]=\"effectiveDisabled()\"\n [name]=\"effectiveName()\"\n [attr.value]=\"nativeValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"selected()\"\n [attr.aria-invalid]=\"inputInvalid() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\">\n @if (selected()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n",
|
|
431
|
+
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"effectiveReadonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n #input\n type=\"radio\"\n [id]=\"inputId()\"\n [required]=\"effectiveRequired()\"\n [disabled]=\"effectiveDisabled()\"\n [name]=\"effectiveName()\"\n [attr.value]=\"nativeValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"selected()\"\n [attr.aria-invalid]=\"inputInvalid() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\" #circle>\n @if (selected()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n",
|
|
416
432
|
dependencies: [{
|
|
417
433
|
kind: "ngmodule",
|
|
418
434
|
type: FormsModule
|
|
@@ -438,6 +454,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
438
454
|
type: Component,
|
|
439
455
|
args: [{
|
|
440
456
|
selector: "mona-radio-button",
|
|
457
|
+
hostDirectives: [{
|
|
458
|
+
directive: RippleDirective,
|
|
459
|
+
inputs: ["monaRippleDisabled"]
|
|
460
|
+
}],
|
|
441
461
|
imports: [FormsModule, NgTemplateOutlet],
|
|
442
462
|
host: {
|
|
443
463
|
"[attr.aria-describedby]": "null",
|
|
@@ -447,11 +467,15 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
447
467
|
"[attr.data-selected]": "selected()",
|
|
448
468
|
"[attr.data-disabled]": "effectiveDisabled()"
|
|
449
469
|
},
|
|
450
|
-
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"effectiveReadonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n #input\n type=\"radio\"\n [id]=\"inputId()\"\n [required]=\"effectiveRequired()\"\n [disabled]=\"effectiveDisabled()\"\n [name]=\"effectiveName()\"\n [attr.value]=\"nativeValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"selected()\"\n [attr.aria-invalid]=\"inputInvalid() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\">\n @if (selected()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n"
|
|
470
|
+
template: "<label\n [class]=\"containerLabelClasses()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-readonly]=\"effectiveReadonly() || null\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n #input\n type=\"radio\"\n [id]=\"inputId()\"\n [required]=\"effectiveRequired()\"\n [disabled]=\"effectiveDisabled()\"\n [name]=\"effectiveName()\"\n [attr.value]=\"nativeValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"selected()\"\n [attr.aria-invalid]=\"inputInvalid() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-describedby]=\"describedBy()\"\n (blur)=\"onBlur($event)\"\n (click)=\"onInputClick($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\" #circle>\n @if (selected()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n"
|
|
451
471
|
}]
|
|
452
472
|
}],
|
|
453
473
|
ctorParameters: () => [],
|
|
454
474
|
propDecorators: {
|
|
475
|
+
circleRef: [{
|
|
476
|
+
type: i0.ViewChild,
|
|
477
|
+
args: ["circle", { isSignal: true }]
|
|
478
|
+
}],
|
|
455
479
|
inputRef: [{
|
|
456
480
|
type: i0.ViewChild,
|
|
457
481
|
args: ["input", { isSignal: true }]
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { isPlatformBrowser } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { DOCUMENT as DOCUMENT$1, DestroyRef, Directive, ElementRef, InjectionToken, NgZone, PLATFORM_ID, booleanAttribute, inject, input, makeEnvironmentProviders, signal } from "@angular/core";
|
|
4
|
+
const rippleLayerClasses = [
|
|
5
|
+
"pointer-events-none absolute -z-1",
|
|
6
|
+
"opacity-(--mona-ripple-opacity,12%)",
|
|
7
|
+
"forced-colors:hidden in-[.cdk-drag-placeholder]:hidden in-[.cdk-drag-preview]:hidden"
|
|
8
|
+
].join(" ");
|
|
9
|
+
const rippleContainerClasses = `${rippleLayerClasses} inset-0 overflow-hidden rounded-[inherit]`;
|
|
10
|
+
const rippleHaloContainerClasses = `${rippleLayerClasses} start-1/2 top-1/2 text-foreground`;
|
|
11
|
+
const rippleWaveClasses = "absolute top-0 start-0 rounded-full bg-current";
|
|
12
|
+
const DEFAULT_RIPPLE_OPTIONS = { enabled: false };
|
|
13
|
+
const RIPPLE_OPTIONS = new InjectionToken("Mona UI ripple options", {
|
|
14
|
+
providedIn: "root",
|
|
15
|
+
factory: () => DEFAULT_RIPPLE_OPTIONS
|
|
16
|
+
});
|
|
17
|
+
function parseCssTime(value, fallback) {
|
|
18
|
+
const match = /^(\d*\.?\d+)(ms|s)$/iu.exec(value.trim());
|
|
19
|
+
if (!match) return fallback;
|
|
20
|
+
const amount = Number(match[1]);
|
|
21
|
+
return match[2].toLowerCase() === "s" ? amount * 1e3 : amount;
|
|
22
|
+
}
|
|
23
|
+
const FALLBACK_SPREAD_DURATION = 450;
|
|
24
|
+
const FALLBACK_FADE_DURATION = 300;
|
|
25
|
+
const SPREAD_EASING = "cubic-bezier(0, 0, 0.2, 1)";
|
|
26
|
+
const RELEASE_EVENTS = [
|
|
27
|
+
"pointercancel",
|
|
28
|
+
"pointerleave",
|
|
29
|
+
"pointerup"
|
|
30
|
+
];
|
|
31
|
+
const NESTED_CONTROL_SELECTOR = "a[href], button, input, select, textarea, [contenteditable='true'], [role='button'], [role='link']";
|
|
32
|
+
const HALO_REACH = 10;
|
|
33
|
+
var RippleDirective = class RippleDirective {
|
|
34
|
+
#document;
|
|
35
|
+
#hostElementRef;
|
|
36
|
+
#options;
|
|
37
|
+
#container;
|
|
38
|
+
#haloTarget;
|
|
39
|
+
#hostDisabled;
|
|
40
|
+
constructor() {
|
|
41
|
+
this.#document = inject(DOCUMENT$1);
|
|
42
|
+
this.#hostElementRef = inject(ElementRef);
|
|
43
|
+
this.#options = inject(RIPPLE_OPTIONS);
|
|
44
|
+
this.#container = null;
|
|
45
|
+
this.#haloTarget = () => null;
|
|
46
|
+
this.#hostDisabled = signal(false, ...ngDevMode ? [{ debugName: "#hostDisabled" }] : /* istanbul ignore next */ []);
|
|
47
|
+
this.disabled = input(false, {
|
|
48
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
49
|
+
alias: "monaRippleDisabled",
|
|
50
|
+
transform: booleanAttribute
|
|
51
|
+
});
|
|
52
|
+
if (!this.#options.enabled || !isPlatformBrowser(inject(PLATFORM_ID))) return;
|
|
53
|
+
const host = this.#hostElementRef.nativeElement;
|
|
54
|
+
const listener = (event) => this.#launch(event);
|
|
55
|
+
inject(NgZone).runOutsideAngular(() => host.addEventListener("pointerdown", listener, { passive: true }));
|
|
56
|
+
inject(DestroyRef).onDestroy(() => host.removeEventListener("pointerdown", listener));
|
|
57
|
+
}
|
|
58
|
+
setHalo(target) {
|
|
59
|
+
this.#haloTarget = target;
|
|
60
|
+
}
|
|
61
|
+
setHostDisabled(disabled) {
|
|
62
|
+
this.#hostDisabled = disabled;
|
|
63
|
+
}
|
|
64
|
+
#canDraw(host, event) {
|
|
65
|
+
if (this.disabled() || this.#hostDisabled() || host.matches(":disabled, [aria-disabled='true']")) return false;
|
|
66
|
+
const control = event.target instanceof Element ? event.target.closest(NESTED_CONTROL_SELECTOR) : null;
|
|
67
|
+
const ownControl = host instanceof HTMLLabelElement && host.control === control;
|
|
68
|
+
if (control && control !== host && !ownControl && host.contains(control)) return false;
|
|
69
|
+
if (typeof host.animate !== "function") return false;
|
|
70
|
+
const view = this.#document.defaultView;
|
|
71
|
+
if (typeof view?.matchMedia !== "function") return true;
|
|
72
|
+
return !view.matchMedia("(prefers-reduced-motion: reduce)").matches && !view.matchMedia("(forced-colors: active)").matches;
|
|
73
|
+
}
|
|
74
|
+
#durations(host) {
|
|
75
|
+
const style = this.#document.defaultView?.getComputedStyle(host);
|
|
76
|
+
return {
|
|
77
|
+
fade: parseCssTime(style?.getPropertyValue("--mona-ripple-fade-duration") ?? "", FALLBACK_FADE_DURATION),
|
|
78
|
+
spread: parseCssTime(style?.getPropertyValue("--mona-ripple-duration") ?? "", FALLBACK_SPREAD_DURATION)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
#ensureContainer(host, halo) {
|
|
82
|
+
const parent = halo ?? host;
|
|
83
|
+
if (this.#container && this.#container.parentNode === parent) return this.#container;
|
|
84
|
+
const view = this.#document.defaultView;
|
|
85
|
+
if (view?.getComputedStyle(parent).position === "static") parent.style.position = "relative";
|
|
86
|
+
if (view?.getComputedStyle(host).isolation !== "isolate") host.style.isolation = "isolate";
|
|
87
|
+
const container = this.#document.createElement("span");
|
|
88
|
+
container.className = halo ? rippleHaloContainerClasses : rippleContainerClasses;
|
|
89
|
+
container.setAttribute("aria-hidden", "true");
|
|
90
|
+
container.dir = "ltr";
|
|
91
|
+
parent.append(container);
|
|
92
|
+
this.#container = container;
|
|
93
|
+
return container;
|
|
94
|
+
}
|
|
95
|
+
#launch(event) {
|
|
96
|
+
const host = this.#hostElementRef.nativeElement;
|
|
97
|
+
if (event.button !== 0 || !this.#canDraw(host, event)) return;
|
|
98
|
+
const halo = this.#haloTarget() ?? null;
|
|
99
|
+
const container = this.#ensureContainer(host, halo);
|
|
100
|
+
const wave = this.#document.createElement("span");
|
|
101
|
+
wave.className = rippleWaveClasses;
|
|
102
|
+
if (halo) {
|
|
103
|
+
const bounds = halo.getBoundingClientRect();
|
|
104
|
+
const radius = Math.max(bounds.width, bounds.height) / 2 + HALO_REACH;
|
|
105
|
+
this.#placeWave(wave, radius, -radius, -radius);
|
|
106
|
+
} else {
|
|
107
|
+
const bounds = container.getBoundingClientRect();
|
|
108
|
+
const x = event.clientX - bounds.x;
|
|
109
|
+
const y = event.clientY - bounds.y;
|
|
110
|
+
const radius = Math.hypot(Math.max(x, bounds.width - x), Math.max(y, bounds.height - y));
|
|
111
|
+
this.#placeWave(wave, radius, x - radius, y - radius);
|
|
112
|
+
}
|
|
113
|
+
container.append(wave);
|
|
114
|
+
const durations = this.#durations(host);
|
|
115
|
+
const spreading = wave.animate([{ scale: 0 }, { scale: 1 }], {
|
|
116
|
+
duration: durations.spread,
|
|
117
|
+
easing: SPREAD_EASING,
|
|
118
|
+
fill: "forwards"
|
|
119
|
+
});
|
|
120
|
+
const release = new AbortController();
|
|
121
|
+
const fadeOut = () => {
|
|
122
|
+
release.abort();
|
|
123
|
+
spreading.finished.then(() => wave.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
124
|
+
duration: durations.fade,
|
|
125
|
+
fill: "forwards"
|
|
126
|
+
}).finished).catch(() => void 0).finally(() => wave.remove());
|
|
127
|
+
};
|
|
128
|
+
for (const type of RELEASE_EVENTS) host.addEventListener(type, fadeOut, {
|
|
129
|
+
passive: true,
|
|
130
|
+
signal: release.signal
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
#placeWave(wave, radius, x, y) {
|
|
134
|
+
wave.style.width = `${radius * 2}px`;
|
|
135
|
+
wave.style.height = `${radius * 2}px`;
|
|
136
|
+
wave.style.translate = `${x}px ${y}px`;
|
|
137
|
+
}
|
|
138
|
+
static {
|
|
139
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
140
|
+
minVersion: "12.0.0",
|
|
141
|
+
version: "22.3.0",
|
|
142
|
+
ngImport: i0,
|
|
143
|
+
type: RippleDirective,
|
|
144
|
+
deps: [],
|
|
145
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
static {
|
|
149
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
150
|
+
minVersion: "17.1.0",
|
|
151
|
+
version: "22.3.0",
|
|
152
|
+
type: RippleDirective,
|
|
153
|
+
isStandalone: true,
|
|
154
|
+
selector: "[monaRipple]",
|
|
155
|
+
inputs: { disabled: {
|
|
156
|
+
classPropertyName: "disabled",
|
|
157
|
+
publicName: "monaRippleDisabled",
|
|
158
|
+
isSignal: true,
|
|
159
|
+
isRequired: false,
|
|
160
|
+
transformFunction: null
|
|
161
|
+
} },
|
|
162
|
+
ngImport: i0
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
167
|
+
minVersion: "12.0.0",
|
|
168
|
+
version: "22.3.0",
|
|
169
|
+
ngImport: i0,
|
|
170
|
+
type: RippleDirective,
|
|
171
|
+
decorators: [{
|
|
172
|
+
type: Directive,
|
|
173
|
+
args: [{ selector: "[monaRipple]" }]
|
|
174
|
+
}],
|
|
175
|
+
ctorParameters: () => [],
|
|
176
|
+
propDecorators: { disabled: [{
|
|
177
|
+
type: i0.Input,
|
|
178
|
+
args: [{
|
|
179
|
+
isSignal: true,
|
|
180
|
+
alias: "monaRippleDisabled",
|
|
181
|
+
required: false
|
|
182
|
+
}]
|
|
183
|
+
}] }
|
|
184
|
+
});
|
|
185
|
+
function provideRipple(options = {}) {
|
|
186
|
+
return makeEnvironmentProviders([{
|
|
187
|
+
provide: RIPPLE_OPTIONS,
|
|
188
|
+
useValue: {
|
|
189
|
+
enabled: true,
|
|
190
|
+
...options
|
|
191
|
+
}
|
|
192
|
+
}]);
|
|
193
|
+
}
|
|
194
|
+
export { DEFAULT_RIPPLE_OPTIONS, RIPPLE_OPTIONS, RippleDirective, provideRipple };
|
|
195
|
+
|
|
196
|
+
//# sourceMappingURL=nanahoshi-mona-ui-ripple.mjs.map
|
|
@@ -5,6 +5,7 @@ import { injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
|
5
5
|
import { twMerge } from "tailwind-merge";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
8
|
+
import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
|
|
8
9
|
var SegmentedItemTemplateDirective = class SegmentedItemTemplateDirective {
|
|
9
10
|
constructor() {
|
|
10
11
|
this.options = input(void 0, {
|
|
@@ -68,7 +69,7 @@ const segmentedContainerThemeVariants = cva(`
|
|
|
68
69
|
border border-input-border
|
|
69
70
|
p-1
|
|
70
71
|
data-[invalid='true']:border-error
|
|
71
|
-
data-[invalid='true']:ring-
|
|
72
|
+
data-[invalid='true']:ring-(length:--mona-focus-ring-width,2px) data-[invalid='true']:ring-error/(--mona-focus-ring-opacity,35%)
|
|
72
73
|
data-[readonly='true']:[&_*]:cursor-default
|
|
73
74
|
transition-colors duration-(--mona-motion-fast)
|
|
74
75
|
`, {
|
|
@@ -574,7 +575,7 @@ var SegmentedComponent = class SegmentedComponent {
|
|
|
574
575
|
isSignal: true
|
|
575
576
|
}],
|
|
576
577
|
ngImport: i0,
|
|
577
|
-
template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span class=\"pointer-events-none flex flex-1 items-center justify-center gap-1 [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n",
|
|
578
|
+
template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n monaRipple\n [monaRippleDisabled]=\"optionDisabled || readonly()\"\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span class=\"pointer-events-none flex flex-1 items-center justify-center gap-1 [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n",
|
|
578
579
|
dependencies: [{
|
|
579
580
|
kind: "directive",
|
|
580
581
|
type: NgTemplateOutlet,
|
|
@@ -584,6 +585,11 @@ var SegmentedComponent = class SegmentedComponent {
|
|
|
584
585
|
"ngTemplateOutlet",
|
|
585
586
|
"ngTemplateOutletInjector"
|
|
586
587
|
]
|
|
588
|
+
}, {
|
|
589
|
+
kind: "directive",
|
|
590
|
+
type: RippleDirective,
|
|
591
|
+
selector: "[monaRipple]",
|
|
592
|
+
inputs: ["monaRippleDisabled"]
|
|
587
593
|
}]
|
|
588
594
|
});
|
|
589
595
|
}
|
|
@@ -597,7 +603,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
597
603
|
type: Component,
|
|
598
604
|
args: [{
|
|
599
605
|
selector: "mona-segmented",
|
|
600
|
-
imports: [NgTemplateOutlet],
|
|
606
|
+
imports: [NgTemplateOutlet, RippleDirective],
|
|
601
607
|
host: {
|
|
602
608
|
"[attr.aria-disabled]": "effectiveDisabled() || undefined",
|
|
603
609
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
@@ -613,7 +619,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
613
619
|
"[attr.role]": "'radiogroup'",
|
|
614
620
|
"[class]": "containerClasses()"
|
|
615
621
|
},
|
|
616
|
-
template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span class=\"pointer-events-none flex flex-1 items-center justify-center gap-1 [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n"
|
|
622
|
+
template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n monaRipple\n [monaRippleDisabled]=\"optionDisabled || readonly()\"\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span class=\"pointer-events-none flex flex-1 items-center justify-center gap-1 [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n"
|
|
617
623
|
}]
|
|
618
624
|
}],
|
|
619
625
|
ctorParameters: () => [],
|
|
@@ -1482,10 +1482,15 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1482
1482
|
var SidebarMenuSkeletonComponent = class SidebarMenuSkeletonComponent {
|
|
1483
1483
|
constructor() {
|
|
1484
1484
|
this.#sidebarService = inject(SidebarService, { optional: true });
|
|
1485
|
-
this.baseClass = computed(() => sidebarMenuSkeletonThemeVariants({ iconOnly: this.iconOnly() }), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
1485
|
+
this.baseClass = computed(() => twMerge(sidebarMenuSkeletonThemeVariants({ iconOnly: this.iconOnly() }), this.userClass()), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
1486
1486
|
this.iconOnly = computed(() => this.#sidebarService?.iconOnly() ?? false, ...ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []);
|
|
1487
1487
|
this.labelWidth = input("60%", ...ngDevMode ? [{ debugName: "labelWidth" }] : /* istanbul ignore next */ []);
|
|
1488
1488
|
this.showIcon = input(true, ...ngDevMode ? [{ debugName: "showIcon" }] : /* istanbul ignore next */ []);
|
|
1489
|
+
this.userClass = input("", {
|
|
1490
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
1491
|
+
alias: "class",
|
|
1492
|
+
transform: (value) => classInputToClass(value)
|
|
1493
|
+
});
|
|
1489
1494
|
}
|
|
1490
1495
|
#sidebarService;
|
|
1491
1496
|
static {
|
|
@@ -1519,6 +1524,13 @@ var SidebarMenuSkeletonComponent = class SidebarMenuSkeletonComponent {
|
|
|
1519
1524
|
isSignal: true,
|
|
1520
1525
|
isRequired: false,
|
|
1521
1526
|
transformFunction: null
|
|
1527
|
+
},
|
|
1528
|
+
userClass: {
|
|
1529
|
+
classPropertyName: "userClass",
|
|
1530
|
+
publicName: "class",
|
|
1531
|
+
isSignal: true,
|
|
1532
|
+
isRequired: false,
|
|
1533
|
+
transformFunction: null
|
|
1522
1534
|
}
|
|
1523
1535
|
},
|
|
1524
1536
|
host: { properties: { "class": "baseClass()" } },
|
|
@@ -1579,6 +1591,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1579
1591
|
alias: "showIcon",
|
|
1580
1592
|
required: false
|
|
1581
1593
|
}]
|
|
1594
|
+
}],
|
|
1595
|
+
userClass: [{
|
|
1596
|
+
type: i0.Input,
|
|
1597
|
+
args: [{
|
|
1598
|
+
isSignal: true,
|
|
1599
|
+
alias: "class",
|
|
1600
|
+
required: false
|
|
1601
|
+
}]
|
|
1582
1602
|
}]
|
|
1583
1603
|
}
|
|
1584
1604
|
});
|
|
@@ -316,13 +316,13 @@ const sliderHandleThemeVariants = cva(`
|
|
|
316
316
|
data-[orientation="vertical"]:data-[dragging="true"]:transition-none
|
|
317
317
|
|
|
318
318
|
data-[focused="true"]:border-focus-indicator
|
|
319
|
-
data-[focused="true"]:ring-
|
|
320
|
-
data-[focused="true"]:ring-focus-indicator/35
|
|
319
|
+
data-[focused="true"]:ring-(length:--mona-focus-ring-width,2px)
|
|
320
|
+
data-[focused="true"]:ring-focus-indicator/(--mona-focus-ring-opacity,35%)
|
|
321
321
|
|
|
322
322
|
data-[invalid="true"]:border-error
|
|
323
|
-
data-[invalid="true"]:ring-
|
|
323
|
+
data-[invalid="true"]:ring-(length:--mona-focus-ring-width,2px) data-[invalid="true"]:ring-error/(--mona-focus-ring-opacity,35%)
|
|
324
324
|
data-[invalid="true"]:data-[focused="true"]:border-error
|
|
325
|
-
data-[invalid="true"]:data-[focused="true"]:ring-error/35
|
|
325
|
+
data-[invalid="true"]:data-[focused="true"]:ring-error/(--mona-focus-ring-opacity,35%)
|
|
326
326
|
`, { variants: { rounded: {
|
|
327
327
|
full: "rounded-full",
|
|
328
328
|
large: "rounded-lg",
|
|
@@ -6,6 +6,8 @@ import { PreventableEvent } from "@nanahoshi/mona-ui/common";
|
|
|
6
6
|
import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
8
|
import { createElementControlId } from "@nanahoshi/mona-ui/internal";
|
|
9
|
+
import * as i1 from "@nanahoshi/mona-ui/ripple";
|
|
10
|
+
import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
|
|
9
11
|
import { select } from "@mirei/ts-collections";
|
|
10
12
|
var StepSelectEvent = class extends PreventableEvent {
|
|
11
13
|
#index;
|
|
@@ -152,7 +154,7 @@ const stepperStepListItemThemeVariants = cva(`
|
|
|
152
154
|
defaultVariants: { orientation: "horizontal" }
|
|
153
155
|
});
|
|
154
156
|
const stepperStepIndicatorThemeVariants = cva(`
|
|
155
|
-
flex h-8 w-8 items-center justify-center
|
|
157
|
+
relative flex h-8 w-8 items-center justify-center
|
|
156
158
|
border border-border cursor-[inherit]
|
|
157
159
|
transition-colors duration-(--mona-motion-standard) ease-in-out
|
|
158
160
|
focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-focus-indicator
|
|
@@ -271,6 +273,7 @@ var StepperIndicatorDirective = class StepperIndicatorDirective {
|
|
|
271
273
|
}
|
|
272
274
|
},
|
|
273
275
|
host: { properties: { "class": "stepIndicatorClass()" } },
|
|
276
|
+
hostDirectives: [{ directive: i1.RippleDirective }],
|
|
274
277
|
ngImport: i0
|
|
275
278
|
});
|
|
276
279
|
}
|
|
@@ -284,6 +287,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
284
287
|
type: Directive,
|
|
285
288
|
args: [{
|
|
286
289
|
selector: "button[monaStepperIndicator]",
|
|
290
|
+
hostDirectives: [RippleDirective],
|
|
287
291
|
host: { "[class]": "stepIndicatorClass()" }
|
|
288
292
|
}]
|
|
289
293
|
}],
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from "@angular/common";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, inject, input, model, numberAttribute, output } from "@angular/core";
|
|
3
|
+
import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, inject, input, model, numberAttribute, output, viewChild } from "@angular/core";
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
7
7
|
import { injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses, themeRaisedSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
8
8
|
import { filter, fromEvent, merge, tap } from "rxjs";
|
|
9
|
+
import * as i1 from "@nanahoshi/mona-ui/ripple";
|
|
10
|
+
import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
|
|
9
11
|
var SwitchHandleContentTemplateDirective = class SwitchHandleContentTemplateDirective {
|
|
10
12
|
static ngTemplateContextGuard(_directive, _context) {
|
|
11
13
|
return true;
|
|
@@ -130,12 +132,12 @@ const switchThemeVariants = cva(`
|
|
|
130
132
|
data-[disabled='true']:data-[active='true']:bg-disabled-background
|
|
131
133
|
|
|
132
134
|
focus-visible:border-focus-indicator
|
|
133
|
-
focus-visible:ring-
|
|
135
|
+
focus-visible:ring-(length:--mona-focus-ring-width,2px) focus-visible:ring-focus-indicator/(--mona-focus-ring-opacity,35%)
|
|
134
136
|
|
|
135
137
|
data-[invalid='true']:border-error
|
|
136
|
-
data-[invalid='true']:ring-
|
|
138
|
+
data-[invalid='true']:ring-(length:--mona-focus-ring-width,2px) data-[invalid='true']:ring-error/(--mona-focus-ring-opacity,35%)
|
|
137
139
|
data-[invalid='true']:focus-visible:border-error
|
|
138
|
-
data-[invalid='true']:focus-visible:ring-error/35
|
|
140
|
+
data-[invalid='true']:focus-visible:ring-error/(--mona-focus-ring-opacity,35%)
|
|
139
141
|
`, { variants: {
|
|
140
142
|
rounded: {
|
|
141
143
|
full: "rounded-full",
|
|
@@ -228,6 +230,7 @@ var SwitchComponent = class SwitchComponent {
|
|
|
228
230
|
...ngDevMode ? { debugName: "handleContentTemplate" } : /* istanbul ignore next */ {},
|
|
229
231
|
read: TemplateRef
|
|
230
232
|
});
|
|
233
|
+
this.handleRef = viewChild("handle", ...ngDevMode ? [{ debugName: "handleRef" }] : /* istanbul ignore next */ []);
|
|
231
234
|
this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && !this.checked()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
232
235
|
this.labelClasses = computed(() => {
|
|
233
236
|
const classes = switchLabelThemeVariants();
|
|
@@ -288,6 +291,9 @@ var SwitchComponent = class SwitchComponent {
|
|
|
288
291
|
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
289
292
|
alias: "class"
|
|
290
293
|
});
|
|
294
|
+
const ripple = inject(RippleDirective, { self: true });
|
|
295
|
+
ripple.setHostDisabled(computed(() => this.effectiveDisabled() || this.readonly()));
|
|
296
|
+
ripple.setHalo(() => this.handleRef()?.nativeElement);
|
|
291
297
|
afterNextRender({ read: () => this.#setEventListeners() });
|
|
292
298
|
}
|
|
293
299
|
activateFromLabel() {
|
|
@@ -488,8 +494,19 @@ var SwitchComponent = class SwitchComponent {
|
|
|
488
494
|
isSignal: true
|
|
489
495
|
}
|
|
490
496
|
],
|
|
497
|
+
viewQueries: [{
|
|
498
|
+
propertyName: "handleRef",
|
|
499
|
+
first: true,
|
|
500
|
+
predicate: ["handle"],
|
|
501
|
+
descendants: true,
|
|
502
|
+
isSignal: true
|
|
503
|
+
}],
|
|
504
|
+
hostDirectives: [{
|
|
505
|
+
directive: i1.RippleDirective,
|
|
506
|
+
inputs: ["monaRippleDisabled", "monaRippleDisabled"]
|
|
507
|
+
}],
|
|
491
508
|
ngImport: i0,
|
|
492
|
-
template: "<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (checked() && !onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ onLabel() }}</span>\n }\n @if (checked() && onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"onLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (!checked() && !offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ offLabel() }}</span>\n }\n @if (!checked() && offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"offLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<div [class]=\"handleClasses()\" [attr.data-active]=\"checked()\">\n @if (handleContentTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"handleContentTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: checked() }\"></ng-container>\n }\n</div>\n",
|
|
509
|
+
template: "<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (checked() && !onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ onLabel() }}</span>\n }\n @if (checked() && onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"onLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (!checked() && !offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ offLabel() }}</span>\n }\n @if (!checked() && offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"offLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<div [class]=\"handleClasses()\" [attr.data-active]=\"checked()\" #handle>\n @if (handleContentTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"handleContentTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: checked() }\"></ng-container>\n }\n</div>\n",
|
|
493
510
|
styles: [".mona-switch-label-enter{animation:mona-switch-label-fade-in .3s ease-out}.mona-switch-label-leave{animation:mona-switch-label-fade-out .3s ease-out}@keyframes mona-switch-label-fade-in{0%{opacity:0}to{opacity:1}}@keyframes mona-switch-label-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.mona-switch-label-enter,.mona-switch-label-leave{animation-duration:1ms}}\n"],
|
|
494
511
|
dependencies: [{
|
|
495
512
|
kind: "directive",
|
|
@@ -513,6 +530,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
513
530
|
type: Component,
|
|
514
531
|
args: [{
|
|
515
532
|
selector: "mona-switch",
|
|
533
|
+
hostDirectives: [{
|
|
534
|
+
directive: RippleDirective,
|
|
535
|
+
inputs: ["monaRippleDisabled"]
|
|
536
|
+
}],
|
|
516
537
|
imports: [NgTemplateOutlet],
|
|
517
538
|
host: {
|
|
518
539
|
"[attr.role]": "'switch'",
|
|
@@ -532,7 +553,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
532
553
|
"[class]": "classes()",
|
|
533
554
|
"(blur)": "onBlur()"
|
|
534
555
|
},
|
|
535
|
-
template: "<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (checked() && !onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ onLabel() }}</span>\n }\n @if (checked() && onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"onLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (!checked() && !offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ offLabel() }}</span>\n }\n @if (!checked() && offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"offLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<div [class]=\"handleClasses()\" [attr.data-active]=\"checked()\">\n @if (handleContentTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"handleContentTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: checked() }\"></ng-container>\n }\n</div>\n",
|
|
556
|
+
template: "<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (checked() && !onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ onLabel() }}</span>\n }\n @if (checked() && onLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"onLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<span aria-hidden=\"true\" [class]=\"labelClasses()\">\n @if (!checked() && !offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">{{ offLabel() }}</span>\n }\n @if (!checked() && offLabelTemplate()) {\n <span animate.enter=\"mona-switch-label-enter\" animate.leave=\"mona-switch-label-leave\">\n <ng-container [ngTemplateOutlet]=\"offLabelTemplate() ?? null\"></ng-container>\n </span>\n }\n</span>\n<div [class]=\"handleClasses()\" [attr.data-active]=\"checked()\" #handle>\n @if (handleContentTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"handleContentTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: checked() }\"></ng-container>\n }\n</div>\n",
|
|
536
557
|
styles: [".mona-switch-label-enter{animation:mona-switch-label-fade-in .3s ease-out}.mona-switch-label-leave{animation:mona-switch-label-fade-out .3s ease-out}@keyframes mona-switch-label-fade-in{0%{opacity:0}to{opacity:1}}@keyframes mona-switch-label-fade-out{0%{opacity:1}to{opacity:0}}@media(prefers-reduced-motion:reduce){.mona-switch-label-enter,.mona-switch-label-leave{animation-duration:1ms}}\n"]
|
|
537
558
|
}]
|
|
538
559
|
}],
|
|
@@ -545,6 +566,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
545
566
|
isSignal: true
|
|
546
567
|
}]
|
|
547
568
|
}],
|
|
569
|
+
handleRef: [{
|
|
570
|
+
type: i0.ViewChild,
|
|
571
|
+
args: ["handle", { isSignal: true }]
|
|
572
|
+
}],
|
|
548
573
|
offLabelTemplate: [{
|
|
549
574
|
type: i0.ContentChild,
|
|
550
575
|
args: [i0.forwardRef(() => SwitchOffLabelTemplateDirective), {
|
|
@@ -10,6 +10,8 @@ import { cva } from "class-variance-authority";
|
|
|
10
10
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
11
11
|
import { createElementControlId } from "@nanahoshi/mona-ui/internal";
|
|
12
12
|
import { EMPTY, Subject, asapScheduler, interval, switchMap, tap, timer } from "rxjs";
|
|
13
|
+
import * as i1 from "@nanahoshi/mona-ui/ripple";
|
|
14
|
+
import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
|
|
13
15
|
import { firstOrDefault, select } from "@mirei/ts-collections";
|
|
14
16
|
import { SortableDirective, SortableItemDirective } from "@nanahoshi/mona-ui/sortable";
|
|
15
17
|
var TabCloseEvent = class extends PreventableEvent {
|
|
@@ -247,6 +249,7 @@ var TabListItemDirective = class TabListItemDirective {
|
|
|
247
249
|
this.disabled = input.required(...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
248
250
|
this.position = input.required(...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
|
|
249
251
|
this.size = input.required(...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
252
|
+
inject(RippleDirective, { self: true }).setHostDisabled(this.disabled);
|
|
250
253
|
}
|
|
251
254
|
static {
|
|
252
255
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -296,6 +299,7 @@ var TabListItemDirective = class TabListItemDirective {
|
|
|
296
299
|
}
|
|
297
300
|
},
|
|
298
301
|
host: { properties: { "class": "listItemClass()" } },
|
|
302
|
+
hostDirectives: [{ directive: i1.RippleDirective }],
|
|
299
303
|
ngImport: i0
|
|
300
304
|
});
|
|
301
305
|
}
|
|
@@ -309,9 +313,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
309
313
|
type: Directive,
|
|
310
314
|
args: [{
|
|
311
315
|
selector: "li[monaTabListItem]",
|
|
312
|
-
host: { "[class]": "listItemClass()" }
|
|
316
|
+
host: { "[class]": "listItemClass()" },
|
|
317
|
+
hostDirectives: [RippleDirective]
|
|
313
318
|
}]
|
|
314
319
|
}],
|
|
320
|
+
ctorParameters: () => [],
|
|
315
321
|
propDecorators: {
|
|
316
322
|
active: [{
|
|
317
323
|
type: i0.Input,
|