@nanahoshi/mona-ui 0.24.11 → 0.25.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 +9 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
- package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
- package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +27 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
- package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -4
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
- package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
- package/i18n/catalogs/en-US.messages.json +33 -4
- package/locales/ar-sa/ar-sa.messages.json +33 -4
- package/locales/de-de/de-de.messages.json +33 -4
- package/locales/es-es/es-es.messages.json +33 -4
- package/locales/fr-fr/fr-fr.messages.json +33 -4
- package/locales/id-id/id-id.messages.json +33 -4
- package/locales/it-it/it-it.messages.json +33 -4
- package/locales/ja-jp/ja-jp.messages.json +33 -4
- package/locales/ko-kr/ko-kr.messages.json +33 -4
- package/locales/pt-br/pt-br.messages.json +33 -4
- package/locales/ru-ru/ru-ru.messages.json +33 -4
- package/locales/tr-tr/tr-tr.messages.json +33 -4
- package/locales/zh-cn/zh-cn.messages.json +33 -4
- package/locales/zh-tw/zh-tw.messages.json +33 -4
- package/package.json +2 -1
- package/styles.css +156 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
- package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
- package/types/nanahoshi-mona-ui-button.d.ts +26 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-card.d.ts +22 -6
- package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
- package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
- package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
- package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
- package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-common.d.ts +28 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
- package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +38 -3
- package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
- package/types/nanahoshi-mona-ui-label.d.ts +17 -2
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +29 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
- package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
- package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
- package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
- package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
- package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
- package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
- package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
- package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
- package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
- package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
- package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
- package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
- package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, TemplateRef, Directive, DestroyRef, ElementRef, computed, signal, contentChild, viewChildren,
|
|
4
|
-
import {
|
|
3
|
+
import { input, inject, TemplateRef, Directive, DestroyRef, ElementRef, computed, signal, contentChild, viewChildren, booleanAttribute, output, model, afterNextRender, isDevMode, afterRenderEffect, Component } from '@angular/core';
|
|
4
|
+
import { injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
|
|
5
|
+
import { themeControlSurfaceClasses, injectLabelAssociation, injectEffectiveDisabled, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
5
6
|
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import { cva } from 'class-variance-authority';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @description Renders the visual content of every segmented option. Overrides the default label
|
|
10
|
-
* text of each option.
|
|
11
|
+
* text of each option. Bind the options, as `[monaSegmentedItemTemplate]="options"`, to type `let-option` from them.
|
|
11
12
|
*/
|
|
12
13
|
class SegmentedItemTemplateDirective {
|
|
13
14
|
constructor() {
|
|
15
|
+
this.options = input(undefined, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaSegmentedItemTemplate" });
|
|
14
16
|
this.templateRef = inject(TemplateRef);
|
|
15
17
|
}
|
|
16
|
-
static ngTemplateContextGuard(_directive,
|
|
18
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
17
19
|
return true;
|
|
18
20
|
}
|
|
19
21
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
20
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
22
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: SegmentedItemTemplateDirective, isStandalone: true, selector: "ng-template[monaSegmentedItemTemplate]", inputs: { options: { classPropertyName: "options", publicName: "monaSegmentedItemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
21
23
|
}
|
|
22
24
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedItemTemplateDirective, decorators: [{
|
|
23
25
|
type: Directive,
|
|
24
26
|
args: [{
|
|
25
27
|
selector: "ng-template[monaSegmentedItemTemplate]"
|
|
26
28
|
}]
|
|
27
|
-
}] });
|
|
29
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaSegmentedItemTemplate", required: false }] }] } });
|
|
28
30
|
|
|
29
31
|
const segmentedContainerThemeVariants = cva(`
|
|
30
32
|
relative inline-flex items-center gap-0.5
|
|
31
33
|
${themeControlSurfaceClasses}
|
|
32
|
-
border border-
|
|
34
|
+
border border-border
|
|
33
35
|
p-1
|
|
34
36
|
data-[invalid='true']:border-error
|
|
35
37
|
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
38
|
+
data-[readonly='true']:[&_*]:cursor-default
|
|
36
39
|
transition-colors duration-(--mona-motion-fast)
|
|
37
40
|
`, {
|
|
38
41
|
variants: {
|
|
@@ -68,6 +71,11 @@ const segmentedOptionThemeVariants = cva(`
|
|
|
68
71
|
data-[selected='false']:hover:bg-hover data-[selected='false']:hover:text-foreground
|
|
69
72
|
data-[disabled='true']:data-[selected='false']:text-disabled-foreground
|
|
70
73
|
data-[selected='true']:transition-none
|
|
74
|
+
data-[selected='true']:not-data-[indicator]:bg-primary
|
|
75
|
+
has-[input:focus-visible]:z-20
|
|
76
|
+
has-[input:focus-visible]:outline-2
|
|
77
|
+
has-[input:focus-visible]:outline-offset-1
|
|
78
|
+
has-[input:focus-visible]:outline-focus-indicator
|
|
71
79
|
`, {
|
|
72
80
|
variants: {
|
|
73
81
|
alignment: {
|
|
@@ -96,7 +104,8 @@ const segmentedOptionThemeVariants = cva(`
|
|
|
96
104
|
}
|
|
97
105
|
});
|
|
98
106
|
const segmentedIndicatorThemeVariants = cva(`
|
|
99
|
-
pointer-events-none absolute top-0
|
|
107
|
+
pointer-events-none absolute top-0 left-0
|
|
108
|
+
border-2 border-transparent forced-colors:border-[Highlight]
|
|
100
109
|
bg-primary shadow-sm ring-1 ring-selected-border
|
|
101
110
|
data-[disabled='true']:opacity-50
|
|
102
111
|
motion-reduce:transition-none
|
|
@@ -122,13 +131,15 @@ const segmentedIndicatorThemeVariants = cva(`
|
|
|
122
131
|
const segmentedInputThemeVariants = cva(`
|
|
123
132
|
peer absolute inset-0 z-10 h-full w-full
|
|
124
133
|
cursor-pointer appearance-none opacity-0
|
|
125
|
-
outline-none
|
|
134
|
+
outline-none focus-visible:outline-hidden
|
|
126
135
|
disabled:cursor-not-allowed
|
|
127
136
|
`);
|
|
128
137
|
|
|
129
138
|
class SegmentedComponent {
|
|
130
139
|
#destroyRef;
|
|
140
|
+
#direction;
|
|
131
141
|
#hostElementRef;
|
|
142
|
+
#label;
|
|
132
143
|
#lastAnimatedIndex;
|
|
133
144
|
#lastOptions;
|
|
134
145
|
#lastSize;
|
|
@@ -136,7 +147,13 @@ class SegmentedComponent {
|
|
|
136
147
|
#resizeObserver;
|
|
137
148
|
constructor() {
|
|
138
149
|
this.#destroyRef = inject(DestroyRef);
|
|
150
|
+
this.#direction = injectComponentDirection();
|
|
139
151
|
this.#hostElementRef = inject(ElementRef);
|
|
152
|
+
this.#label = injectLabelAssociation({
|
|
153
|
+
activate: () => this.focus(),
|
|
154
|
+
ariaLabel: () => this.ariaLabel(),
|
|
155
|
+
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
156
|
+
});
|
|
140
157
|
this.#lastAnimatedIndex = null;
|
|
141
158
|
this.#lastOptions = null;
|
|
142
159
|
this.#lastSize = null;
|
|
@@ -147,6 +164,9 @@ class SegmentedComponent {
|
|
|
147
164
|
return twMerge(classes, this.userClass());
|
|
148
165
|
}, /* @ts-ignore */
|
|
149
166
|
...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
|
|
167
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
168
|
+
this.geometryReady = computed(() => !!this.indicatorGeometry(), /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "geometryReady" }] : /* istanbul ignore next */ []));
|
|
150
170
|
this.groupName = createElementControlId();
|
|
151
171
|
this.indicatorClasses = computed(() => {
|
|
152
172
|
const animate = this.animate() && this.indicatorTransitionEnabled();
|
|
@@ -165,6 +185,7 @@ class SegmentedComponent {
|
|
|
165
185
|
this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
166
186
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
167
187
|
this.itemTemplate = contentChild(SegmentedItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
188
|
+
this.labelledBy = this.#label.labelledBy;
|
|
168
189
|
this.optionClasses = computed(() => {
|
|
169
190
|
const alignment = this.alignment();
|
|
170
191
|
const rounded = this.rounded();
|
|
@@ -172,8 +193,22 @@ class SegmentedComponent {
|
|
|
172
193
|
return segmentedOptionThemeVariants({ alignment, rounded, size });
|
|
173
194
|
}, /* @ts-ignore */
|
|
174
195
|
...(ngDevMode ? [{ debugName: "optionClasses" }] : /* istanbul ignore next */ []));
|
|
196
|
+
this.optionContexts = computed(() => {
|
|
197
|
+
const disabled = this.effectiveDisabled();
|
|
198
|
+
const value = this.value();
|
|
199
|
+
return this.options().map((option, index) => ({
|
|
200
|
+
$implicit: option,
|
|
201
|
+
disabled: disabled || !!option.disabled,
|
|
202
|
+
index,
|
|
203
|
+
option,
|
|
204
|
+
selected: option.value === value
|
|
205
|
+
}));
|
|
206
|
+
}, /* @ts-ignore */
|
|
207
|
+
...(ngDevMode ? [{ debugName: "optionContexts" }] : /* istanbul ignore next */ []));
|
|
175
208
|
this.optionElements = viewChildren("optionElement", /* @ts-ignore */
|
|
176
209
|
...(ngDevMode ? [{ debugName: "optionElements" }] : /* istanbul ignore next */ []));
|
|
210
|
+
this.radioInputs = viewChildren("radioInput", /* @ts-ignore */
|
|
211
|
+
...(ngDevMode ? [{ debugName: "radioInputs" }] : /* istanbul ignore next */ []));
|
|
177
212
|
this.selectedIndex = computed(() => {
|
|
178
213
|
const value = this.value();
|
|
179
214
|
return this.options().findIndex(option => option.value === value);
|
|
@@ -185,7 +220,7 @@ class SegmentedComponent {
|
|
|
185
220
|
return false;
|
|
186
221
|
}
|
|
187
222
|
const option = this.options()[selectedIndex];
|
|
188
|
-
return this.
|
|
223
|
+
return this.effectiveDisabled() || !!option?.disabled;
|
|
189
224
|
}, /* @ts-ignore */
|
|
190
225
|
...(ngDevMode ? [{ debugName: "selectedOptionDisabled" }] : /* istanbul ignore next */ []));
|
|
191
226
|
/**
|
|
@@ -199,8 +234,7 @@ class SegmentedComponent {
|
|
|
199
234
|
* When false, selection changes are applied immediately without transition.
|
|
200
235
|
* @default true
|
|
201
236
|
*/
|
|
202
|
-
this.animate = input(true, /*
|
|
203
|
-
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
237
|
+
this.animate = input(true, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
204
238
|
/**
|
|
205
239
|
* @description Accessible name for the radio group. Provide either `aria-label` or `aria-labelledby`.
|
|
206
240
|
* @default null
|
|
@@ -215,20 +249,37 @@ class SegmentedComponent {
|
|
|
215
249
|
* @description Disables every option in the group and prevents value changes.
|
|
216
250
|
* @default false
|
|
217
251
|
*/
|
|
218
|
-
this.disabled = input(false, /*
|
|
219
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
252
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
220
253
|
/**
|
|
221
254
|
* @description Marks the component as invalid. Error styling requires both `invalid` and `touched` to be `true`.
|
|
222
|
-
* When bound to a signal form field via `[formField]`, this is written by the signal forms `
|
|
255
|
+
* When bound to a signal form field via `[formField]`, this is written by the signal forms `FormField` directive.
|
|
223
256
|
* @default false
|
|
224
257
|
*/
|
|
225
|
-
this.invalid = input(false, /*
|
|
226
|
-
|
|
258
|
+
this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
259
|
+
/**
|
|
260
|
+
* @description The name of the radios, for a native `<form>`. Generated when empty, so two groups don't interfere.
|
|
261
|
+
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
262
|
+
* @default ""
|
|
263
|
+
*/
|
|
264
|
+
this.name = input("", /* @ts-ignore */
|
|
265
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
227
266
|
/**
|
|
228
267
|
* @description The list of selectable options. Exactly one option is selected at a time.
|
|
229
268
|
*/
|
|
230
269
|
this.options = input.required(/* @ts-ignore */
|
|
231
270
|
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
271
|
+
/**
|
|
272
|
+
* @description Prevents value changes while the control stays focusable and readable. When bound to a signal form
|
|
273
|
+
* field via `[formField]`, this is written by the `FormField` directive.
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
277
|
+
/**
|
|
278
|
+
* @description Marks the group as required, as `aria-required`. When bound to a signal form field via `[formField]`,
|
|
279
|
+
* this is written by the `FormField` directive.
|
|
280
|
+
* @default false
|
|
281
|
+
*/
|
|
282
|
+
this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
232
283
|
/**
|
|
233
284
|
* @description Border-radius preset applied to the segmented container and its options.
|
|
234
285
|
* @default "medium"
|
|
@@ -242,16 +293,15 @@ class SegmentedComponent {
|
|
|
242
293
|
this.size = input("medium", /* @ts-ignore */
|
|
243
294
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
244
295
|
/**
|
|
245
|
-
* @description Emitted when the selected value changes or focus leaves
|
|
296
|
+
* @description Emitted when the selected value changes or focus leaves the group.
|
|
246
297
|
*/
|
|
247
298
|
this.touch = output();
|
|
248
299
|
/**
|
|
249
300
|
* @description Marks the component as touched. When bound to a signal form field via `[formField]`,
|
|
250
|
-
* this is written by the signal forms `
|
|
301
|
+
* this is written by the signal forms `FormField` directive.
|
|
251
302
|
* @default false
|
|
252
303
|
*/
|
|
253
|
-
this.touched = input(false, /*
|
|
254
|
-
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
304
|
+
this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
255
305
|
/**
|
|
256
306
|
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
257
307
|
* @default ""
|
|
@@ -264,9 +314,28 @@ class SegmentedComponent {
|
|
|
264
314
|
*/
|
|
265
315
|
this.value = model(null, /* @ts-ignore */
|
|
266
316
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
317
|
+
afterNextRender(() => {
|
|
318
|
+
if (isDevMode() && !this.#label.labelledBy() && !this.ariaLabel()) {
|
|
319
|
+
console.warn("[Mona Segmented] A segmented control needs an accessible name. Set aria-label, aria-labelledby " +
|
|
320
|
+
"or use a mona-label.", this.#hostElementRef.nativeElement);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
// A browser checks a clicked radio on its own, and `[checked]` writes only when its binding changes, so a value
|
|
324
|
+
// put back in the meantime would leave the rejected radio checked.
|
|
325
|
+
afterRenderEffect({
|
|
326
|
+
write: () => {
|
|
327
|
+
const value = this.value();
|
|
328
|
+
const options = this.options();
|
|
329
|
+
this.radioInputs().forEach(({ nativeElement }, index) => {
|
|
330
|
+
nativeElement.checked = options[index]?.value === value;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
});
|
|
267
334
|
afterRenderEffect({
|
|
268
335
|
read: () => {
|
|
269
336
|
this.selectedIndex();
|
|
337
|
+
// The options swap sides, with no change of size for the observer to report.
|
|
338
|
+
this.#direction();
|
|
270
339
|
const optionElements = this.optionElements();
|
|
271
340
|
this.alignment();
|
|
272
341
|
this.rounded();
|
|
@@ -291,25 +360,42 @@ class SegmentedComponent {
|
|
|
291
360
|
this.#resizeObserver?.disconnect();
|
|
292
361
|
});
|
|
293
362
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
363
|
+
/**
|
|
364
|
+
* @description Moves focus to the selected option, or the first enabled one.
|
|
365
|
+
* @param options Options passed to the native `focus()` call, such as `preventScroll`.
|
|
366
|
+
*/
|
|
367
|
+
focus(options) {
|
|
368
|
+
const host = this.#hostElementRef.nativeElement;
|
|
369
|
+
const target = host.querySelector("input:checked:not(:disabled)") ??
|
|
370
|
+
host.querySelector("input:not(:disabled)");
|
|
371
|
+
target?.focus(options);
|
|
302
372
|
}
|
|
303
|
-
|
|
373
|
+
/**
|
|
374
|
+
* @internal
|
|
375
|
+
*/
|
|
376
|
+
setLabelledBy(id) {
|
|
377
|
+
this.#label.setLabelledBy(id);
|
|
378
|
+
}
|
|
379
|
+
onFocusOut(event) {
|
|
380
|
+
const nextTarget = event.relatedTarget;
|
|
381
|
+
if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
304
384
|
this.touch.emit();
|
|
305
385
|
}
|
|
306
386
|
onOptionChange(option) {
|
|
307
|
-
if (this.
|
|
387
|
+
if (this.effectiveDisabled() || this.readonly() || option.disabled) {
|
|
308
388
|
return;
|
|
309
389
|
}
|
|
310
390
|
this.value.set(option.value);
|
|
311
391
|
this.touch.emit();
|
|
312
392
|
}
|
|
393
|
+
onOptionClick(event) {
|
|
394
|
+
// Canceling the click makes the browser restore the previously checked option.
|
|
395
|
+
if (this.readonly()) {
|
|
396
|
+
event.preventDefault();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
313
399
|
observeOptionElements(optionElements) {
|
|
314
400
|
if (!this.#resizeObserver) {
|
|
315
401
|
return;
|
|
@@ -382,21 +468,25 @@ class SegmentedComponent {
|
|
|
382
468
|
}
|
|
383
469
|
}
|
|
384
470
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
385
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SegmentedComponent, isStandalone: true, selector: "mona-segmented", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", 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 } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "attr.aria-disabled": "
|
|
471
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SegmentedComponent, isStandalone: true, selector: "mona-segmented", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", 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 } }, outputs: { touch: "touch", value: "valueChange" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "attr.aria-disabled": "effectiveDisabled() || undefined", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "labelledBy()", "attr.aria-readonly": "readonly() || null", "attr.aria-required": "required() || null", "attr.data-disabled": "effectiveDisabled()", "attr.data-readonly": "readonly() || null", "attr.data-invalid": "invalidState() || null", "attr.role": "'radiogroup'", "class": "containerClasses()" } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: SegmentedItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "optionElements", predicate: ["optionElement"], descendants: true, isSignal: true }, { propertyName: "radioInputs", predicate: ["radioInput"], descendants: true, isSignal: true }], ngImport: i0, 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\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [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\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
386
472
|
}
|
|
387
473
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, decorators: [{
|
|
388
474
|
type: Component,
|
|
389
475
|
args: [{ selector: "mona-segmented", imports: [NgTemplateOutlet], host: {
|
|
390
|
-
"[attr.aria-disabled]": "
|
|
476
|
+
"[attr.aria-disabled]": "effectiveDisabled() || undefined",
|
|
391
477
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
392
478
|
"[attr.aria-label]": "ariaLabel()",
|
|
393
|
-
"[attr.aria-labelledby]": "
|
|
394
|
-
"[attr.
|
|
479
|
+
"[attr.aria-labelledby]": "labelledBy()",
|
|
480
|
+
"[attr.aria-readonly]": "readonly() || null",
|
|
481
|
+
"[attr.aria-required]": "required() || null",
|
|
482
|
+
"[attr.data-disabled]": "effectiveDisabled()",
|
|
483
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
484
|
+
"(focusout)": "onFocusOut($event)",
|
|
395
485
|
"[attr.data-invalid]": "invalidState() || null",
|
|
396
486
|
"[attr.role]": "'radiogroup'",
|
|
397
487
|
"[class]": "containerClasses()"
|
|
398
|
-
}, 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 =
|
|
399
|
-
}], ctorParameters: () => [], propDecorators: { itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SegmentedItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], optionElements: [{ type: i0.ViewChildren, args: ["optionElement", { isSignal: true }] }], alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
488
|
+
}, 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\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [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\n" }]
|
|
489
|
+
}], ctorParameters: () => [], propDecorators: { itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SegmentedItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], optionElements: [{ type: i0.ViewChildren, args: ["optionElement", { isSignal: true }] }], radioInputs: [{ type: i0.ViewChildren, args: ["radioInput", { isSignal: true }] }], alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
400
490
|
|
|
401
491
|
/*
|
|
402
492
|
* Public API Surface of @nanahoshi/mona-ui/segmented
|
|
@@ -30,7 +30,7 @@ const sheetBaseVariants = cva(`
|
|
|
30
30
|
pb-[env(safe-area-inset-bottom)] ps-[env(safe-area-inset-left)]
|
|
31
31
|
rtl:pe-[env(safe-area-inset-left)] rtl:ps-[env(safe-area-inset-right)]
|
|
32
32
|
${themeOverlaySurfaceClasses} text-foreground
|
|
33
|
-
shadow-(--shadow-overlay) outline-none
|
|
33
|
+
shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden
|
|
34
34
|
`, {
|
|
35
35
|
variants: {
|
|
36
36
|
/* The physical edge the sheet opens from: its border faces the page, whatever the direction. */
|
|
@@ -280,7 +280,7 @@ class SheetComponent {
|
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
283
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SheetComponent, isStandalone: true, selector: "mona-sheet", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, viewQueries: [{ propertyName: "sheetTemplate", first: true, predicate: ["sheetTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #sheetTemplate>\n <section\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n [class]=\"baseClass()\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"title() ? titleId : null\"\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\n [attr.aria-label]=\"!title() ? ariaLabel() : null\">\n @if (title() || description() || closable()) {\n <header [class]=\"headerClass()\">\n <div class=\"min-w-0 flex-1\">\n @if (title()) {\n <h2 [id]=\"titleId\" [class]=\"titleClass()\">{{ title() }}</h2>\n }\n @if (description()) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ description() }}</p>\n }\n </div>\n @if (closable()) {\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"resolvedMessages().closeSheet\"\n size=\"small\"\n [class]=\"closeButtonClass()\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </header>\n }\n <div [class]=\"contentClass()\">\n <ng-content></ng-content>\n </div>\n </section>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
|
|
283
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SheetComponent, isStandalone: true, selector: "mona-sheet", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, viewQueries: [{ propertyName: "sheetTemplate", first: true, predicate: ["sheetTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #sheetTemplate>\n <section\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n [class]=\"baseClass()\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"title() ? titleId : null\"\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\n [attr.aria-label]=\"!title() ? ariaLabel() : null\">\n @if (title() || description() || closable()) {\n <header [class]=\"headerClass()\">\n <div class=\"min-w-0 flex-1\">\n @if (title()) {\n <h2 [id]=\"titleId\" [class]=\"titleClass()\">{{ title() }}</h2>\n }\n @if (description()) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ description() }}</p>\n }\n </div>\n @if (closable()) {\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"resolvedMessages().closeSheet\"\n size=\"small\"\n [class]=\"closeButtonClass()\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </header>\n }\n <div [class]=\"contentClass()\">\n <ng-content></ng-content>\n </div>\n </section>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
|
|
284
284
|
}
|
|
285
285
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SheetComponent, decorators: [{
|
|
286
286
|
type: Component,
|