@nanahoshi/mona-ui 0.27.2 → 0.28.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/docs/api/chart.md +2 -2
- package/docs/api/popup.md +1 -1
- package/docs/api/theme.md +2 -2
- package/docs/chart.md +14 -0
- package/docs/editor.md +2 -0
- package/docs/installation.md +147 -15
- package/docs/introduction.md +37 -15
- package/docs/theming-built-in-themes.md +67 -0
- package/docs/theming-custom-colors.md +274 -0
- package/docs/theming-custom-themes.md +168 -0
- package/docs/theming.md +164 -248
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
- package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
- package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
- package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
- package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
- package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
- package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
- package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
- package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
- package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
- package/llms.txt +6 -2
- package/package.json +62 -23
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
- package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
- package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
- package/types/nanahoshi-mona-ui-button.d.ts +227 -166
- package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
- package/types/nanahoshi-mona-ui-card.d.ts +125 -111
- package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
- package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
- package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
- package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
- package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
- package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
- package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
- package/types/nanahoshi-mona-ui-command.d.ts +279 -191
- package/types/nanahoshi-mona-ui-common.d.ts +354 -385
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
- package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
- package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
- package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
- package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
- package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
- package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
- package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
- package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
- package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
- package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
- package/types/nanahoshi-mona-ui-label.d.ts +108 -78
- package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
- package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
- package/types/nanahoshi-mona-ui-list.d.ts +2 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
- package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
- package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
- package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
- package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
- package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
- package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
- package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
- package/types/nanahoshi-mona-ui-query.d.ts +82 -88
- package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
- package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
- package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
- package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
- package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
- package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
- package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
- package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
- package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
- package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
- package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
- package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
- package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
- package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
- package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
- package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
- package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
- package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
- package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
- package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
- package/types/nanahoshi-mona-ui-window.d.ts +494 -399
- package/types/nanahoshi-mona-ui.d.ts +1 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
|
@@ -1,34 +1,67 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import { injectComponentDirection } from
|
|
5
|
-
import {
|
|
6
|
-
import { twMerge } from
|
|
7
|
-
import { cva } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, isDevMode, model, output, signal, viewChildren } from "@angular/core";
|
|
4
|
+
import { injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
5
|
+
import { createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
var SegmentedItemTemplateDirective = class SegmentedItemTemplateDirective {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.options = input(void 0, {
|
|
11
|
+
...ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {},
|
|
12
|
+
alias: "monaSegmentedItemTemplate"
|
|
13
|
+
});
|
|
14
|
+
this.templateRef = inject(TemplateRef);
|
|
15
|
+
}
|
|
16
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
21
|
+
minVersion: "12.0.0",
|
|
22
|
+
version: "22.2.6",
|
|
23
|
+
ngImport: i0,
|
|
24
|
+
type: SegmentedItemTemplateDirective,
|
|
25
|
+
deps: [],
|
|
26
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static {
|
|
30
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
31
|
+
minVersion: "17.1.0",
|
|
32
|
+
version: "22.2.6",
|
|
33
|
+
type: SegmentedItemTemplateDirective,
|
|
34
|
+
isStandalone: true,
|
|
35
|
+
selector: "ng-template[monaSegmentedItemTemplate]",
|
|
36
|
+
inputs: { options: {
|
|
37
|
+
classPropertyName: "options",
|
|
38
|
+
publicName: "monaSegmentedItemTemplate",
|
|
39
|
+
isSignal: true,
|
|
40
|
+
isRequired: false,
|
|
41
|
+
transformFunction: null
|
|
42
|
+
} },
|
|
43
|
+
ngImport: i0
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
48
|
+
minVersion: "12.0.0",
|
|
49
|
+
version: "22.2.6",
|
|
50
|
+
ngImport: i0,
|
|
51
|
+
type: SegmentedItemTemplateDirective,
|
|
52
|
+
decorators: [{
|
|
53
|
+
type: Directive,
|
|
54
|
+
args: [{ selector: "ng-template[monaSegmentedItemTemplate]" }]
|
|
55
|
+
}],
|
|
56
|
+
propDecorators: { options: [{
|
|
57
|
+
type: i0.Input,
|
|
58
|
+
args: [{
|
|
59
|
+
isSignal: true,
|
|
60
|
+
alias: "monaSegmentedItemTemplate",
|
|
61
|
+
required: false
|
|
62
|
+
}]
|
|
63
|
+
}] }
|
|
64
|
+
});
|
|
32
65
|
const segmentedContainerThemeVariants = cva(`
|
|
33
66
|
relative inline-flex items-center gap-0.5
|
|
34
67
|
${themeControlSurfaceClasses}
|
|
@@ -39,25 +72,25 @@ const segmentedContainerThemeVariants = cva(`
|
|
|
39
72
|
data-[readonly='true']:[&_*]:cursor-default
|
|
40
73
|
transition-colors duration-(--mona-motion-fast)
|
|
41
74
|
`, {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
variants: {
|
|
76
|
+
alignment: {
|
|
77
|
+
start: "justify-start",
|
|
78
|
+
center: "justify-center",
|
|
79
|
+
end: "justify-end",
|
|
80
|
+
stretch: "justify-stretch"
|
|
81
|
+
},
|
|
82
|
+
rounded: {
|
|
83
|
+
none: "rounded-none",
|
|
84
|
+
small: "rounded-sm",
|
|
85
|
+
medium: "rounded-md",
|
|
86
|
+
large: "rounded-lg",
|
|
87
|
+
full: "rounded-full"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
alignment: "stretch",
|
|
92
|
+
rounded: "medium"
|
|
93
|
+
}
|
|
61
94
|
});
|
|
62
95
|
const segmentedOptionThemeVariants = cva(`
|
|
63
96
|
relative flex cursor-pointer items-center justify-center gap-1
|
|
@@ -78,31 +111,31 @@ const segmentedOptionThemeVariants = cva(`
|
|
|
78
111
|
has-[input:focus-visible]:outline-offset-1
|
|
79
112
|
has-[input:focus-visible]:outline-focus-indicator
|
|
80
113
|
`, {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
variants: {
|
|
115
|
+
alignment: {
|
|
116
|
+
start: "flex-none",
|
|
117
|
+
center: "flex-none",
|
|
118
|
+
end: "flex-none",
|
|
119
|
+
stretch: "flex-1"
|
|
120
|
+
},
|
|
121
|
+
rounded: {
|
|
122
|
+
none: "rounded-none",
|
|
123
|
+
small: "rounded-xs",
|
|
124
|
+
medium: "rounded-sm",
|
|
125
|
+
large: "rounded-md",
|
|
126
|
+
full: "rounded-full"
|
|
127
|
+
},
|
|
128
|
+
size: {
|
|
129
|
+
small: "h-6 px-1.5 text-sm",
|
|
130
|
+
medium: "h-8 px-2.5 text-sm",
|
|
131
|
+
large: "h-10 px-3.5 text-base"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
alignment: "stretch",
|
|
136
|
+
rounded: "medium",
|
|
137
|
+
size: "medium"
|
|
138
|
+
}
|
|
106
139
|
});
|
|
107
140
|
const segmentedIndicatorThemeVariants = cva(`
|
|
108
141
|
pointer-events-none absolute top-0 left-0
|
|
@@ -111,23 +144,23 @@ const segmentedIndicatorThemeVariants = cva(`
|
|
|
111
144
|
data-[disabled='true']:opacity-50
|
|
112
145
|
motion-reduce:transition-none
|
|
113
146
|
`, {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
147
|
+
variants: {
|
|
148
|
+
animate: {
|
|
149
|
+
true: "transition-[transform,width,height] duration-(--mona-motion-fast) ease-out",
|
|
150
|
+
false: "transition-none"
|
|
151
|
+
},
|
|
152
|
+
rounded: {
|
|
153
|
+
none: "rounded-none",
|
|
154
|
+
small: "rounded-xs",
|
|
155
|
+
medium: "rounded-sm",
|
|
156
|
+
large: "rounded-md",
|
|
157
|
+
full: "rounded-full"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
defaultVariants: {
|
|
161
|
+
animate: true,
|
|
162
|
+
rounded: "medium"
|
|
163
|
+
}
|
|
131
164
|
});
|
|
132
165
|
const segmentedInputThemeVariants = cva(`
|
|
133
166
|
peer absolute inset-0 z-10 h-full w-full
|
|
@@ -135,367 +168,584 @@ const segmentedInputThemeVariants = cva(`
|
|
|
135
168
|
outline-none focus-visible:outline-hidden
|
|
136
169
|
disabled:cursor-not-allowed
|
|
137
170
|
`);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
171
|
+
var SegmentedComponent = class SegmentedComponent {
|
|
172
|
+
#destroyRef;
|
|
173
|
+
#direction;
|
|
174
|
+
#hostElementRef;
|
|
175
|
+
#label;
|
|
176
|
+
#lastAnimatedIndex;
|
|
177
|
+
#lastOptions;
|
|
178
|
+
#lastSize;
|
|
179
|
+
#observedOptionElements;
|
|
180
|
+
#resizeObserver;
|
|
181
|
+
constructor() {
|
|
182
|
+
this.#destroyRef = inject(DestroyRef);
|
|
183
|
+
this.#direction = injectComponentDirection();
|
|
184
|
+
this.#hostElementRef = inject(ElementRef);
|
|
185
|
+
this.#label = injectLabelAssociation({
|
|
186
|
+
activate: () => this.focus(),
|
|
187
|
+
ariaLabel: () => this.ariaLabel(),
|
|
188
|
+
ariaLabelledBy: () => this.ariaLabelledBy()
|
|
189
|
+
});
|
|
190
|
+
this.#lastAnimatedIndex = null;
|
|
191
|
+
this.#lastOptions = null;
|
|
192
|
+
this.#lastSize = null;
|
|
193
|
+
this.#observedOptionElements = [];
|
|
194
|
+
this.#resizeObserver = null;
|
|
195
|
+
this.containerClasses = computed(() => {
|
|
196
|
+
const classes = segmentedContainerThemeVariants({
|
|
197
|
+
alignment: this.alignment(),
|
|
198
|
+
rounded: this.rounded()
|
|
199
|
+
});
|
|
200
|
+
return twMerge(classes, this.userClass());
|
|
201
|
+
}, ...ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []);
|
|
202
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
203
|
+
this.geometryReady = computed(() => !!this.indicatorGeometry(), ...ngDevMode ? [{ debugName: "geometryReady" }] : /* istanbul ignore next */ []);
|
|
204
|
+
this.groupName = createElementControlId();
|
|
205
|
+
this.indicatorClasses = computed(() => {
|
|
206
|
+
const animate = this.animate() && this.indicatorTransitionEnabled();
|
|
207
|
+
const rounded = this.rounded();
|
|
208
|
+
return segmentedIndicatorThemeVariants({
|
|
209
|
+
animate,
|
|
210
|
+
rounded
|
|
211
|
+
});
|
|
212
|
+
}, ...ngDevMode ? [{ debugName: "indicatorClasses" }] : /* istanbul ignore next */ []);
|
|
213
|
+
this.indicatorGeometry = signal(null, ...ngDevMode ? [{ debugName: "indicatorGeometry" }] : /* istanbul ignore next */ []);
|
|
214
|
+
this.indicatorInitialized = signal(false, ...ngDevMode ? [{ debugName: "indicatorInitialized" }] : /* istanbul ignore next */ []);
|
|
215
|
+
this.indicatorTransitionEnabled = signal(false, ...ngDevMode ? [{ debugName: "indicatorTransitionEnabled" }] : /* istanbul ignore next */ []);
|
|
216
|
+
this.inputClasses = computed(() => segmentedInputThemeVariants(), ...ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []);
|
|
217
|
+
this.invalidState = computed(() => this.touched() && this.invalid(), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
218
|
+
this.itemTemplate = contentChild(SegmentedItemTemplateDirective, {
|
|
219
|
+
...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
|
|
220
|
+
read: TemplateRef
|
|
221
|
+
});
|
|
222
|
+
this.labelledBy = this.#label.labelledBy;
|
|
223
|
+
this.optionClasses = computed(() => {
|
|
224
|
+
const alignment = this.alignment();
|
|
225
|
+
const rounded = this.rounded();
|
|
226
|
+
const size = this.size();
|
|
227
|
+
return segmentedOptionThemeVariants({
|
|
228
|
+
alignment,
|
|
229
|
+
rounded,
|
|
230
|
+
size
|
|
231
|
+
});
|
|
232
|
+
}, ...ngDevMode ? [{ debugName: "optionClasses" }] : /* istanbul ignore next */ []);
|
|
233
|
+
this.optionContexts = computed(() => {
|
|
234
|
+
const disabled = this.effectiveDisabled();
|
|
235
|
+
const value = this.value();
|
|
236
|
+
return this.options().map((option, index) => ({
|
|
237
|
+
$implicit: option,
|
|
238
|
+
disabled: disabled || !!option.disabled,
|
|
239
|
+
index,
|
|
240
|
+
option,
|
|
241
|
+
selected: option.value === value
|
|
242
|
+
}));
|
|
243
|
+
}, ...ngDevMode ? [{ debugName: "optionContexts" }] : /* istanbul ignore next */ []);
|
|
244
|
+
this.optionElements = viewChildren("optionElement", ...ngDevMode ? [{ debugName: "optionElements" }] : /* istanbul ignore next */ []);
|
|
245
|
+
this.radioInputs = viewChildren("radioInput", ...ngDevMode ? [{ debugName: "radioInputs" }] : /* istanbul ignore next */ []);
|
|
246
|
+
this.selectedIndex = computed(() => {
|
|
247
|
+
const value = this.value();
|
|
248
|
+
return this.options().findIndex((option) => option.value === value);
|
|
249
|
+
}, ...ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []);
|
|
250
|
+
this.selectedOptionDisabled = computed(() => {
|
|
251
|
+
const selectedIndex = this.selectedIndex();
|
|
252
|
+
if (selectedIndex === -1) return false;
|
|
253
|
+
const option = this.options()[selectedIndex];
|
|
254
|
+
return this.effectiveDisabled() || !!option?.disabled;
|
|
255
|
+
}, ...ngDevMode ? [{ debugName: "selectedOptionDisabled" }] : /* istanbul ignore next */ []);
|
|
256
|
+
this.alignment = input("stretch", ...ngDevMode ? [{ debugName: "alignment" }] : /* istanbul ignore next */ []);
|
|
257
|
+
this.animate = input(true, {
|
|
258
|
+
...ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {},
|
|
259
|
+
transform: booleanAttribute
|
|
260
|
+
});
|
|
261
|
+
this.ariaLabel = input(null, {
|
|
262
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
263
|
+
alias: "aria-label"
|
|
264
|
+
});
|
|
265
|
+
this.ariaLabelledBy = input(null, {
|
|
266
|
+
...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
|
|
267
|
+
alias: "aria-labelledby"
|
|
268
|
+
});
|
|
269
|
+
this.disabled = input(false, {
|
|
270
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
271
|
+
transform: booleanAttribute
|
|
272
|
+
});
|
|
273
|
+
this.invalid = input(false, {
|
|
274
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
275
|
+
transform: booleanAttribute
|
|
276
|
+
});
|
|
277
|
+
this.name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
278
|
+
this.options = input.required(...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
279
|
+
this.readonly = input(false, {
|
|
280
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
281
|
+
transform: booleanAttribute
|
|
282
|
+
});
|
|
283
|
+
this.required = input(false, {
|
|
284
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
285
|
+
transform: booleanAttribute
|
|
286
|
+
});
|
|
287
|
+
this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
288
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
289
|
+
this.touch = output();
|
|
290
|
+
this.touched = input(false, {
|
|
291
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
292
|
+
transform: booleanAttribute
|
|
293
|
+
});
|
|
294
|
+
this.userClass = input("", {
|
|
295
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
296
|
+
alias: "class"
|
|
297
|
+
});
|
|
298
|
+
this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
299
|
+
afterNextRender(() => {
|
|
300
|
+
if (isDevMode() && !this.#label.labelledBy() && !this.ariaLabel()) console.warn("[Mona Segmented] A segmented control needs an accessible name. Set aria-label, aria-labelledby or use a mona-label.", this.#hostElementRef.nativeElement);
|
|
301
|
+
});
|
|
302
|
+
afterRenderEffect({ write: () => {
|
|
303
|
+
const value = this.value();
|
|
304
|
+
const options = this.options();
|
|
305
|
+
this.radioInputs().forEach(({ nativeElement }, index) => {
|
|
306
|
+
nativeElement.checked = options[index]?.value === value;
|
|
307
|
+
});
|
|
308
|
+
} });
|
|
309
|
+
afterRenderEffect({ read: () => {
|
|
310
|
+
this.selectedIndex();
|
|
311
|
+
this.#direction();
|
|
312
|
+
const optionElements = this.optionElements();
|
|
313
|
+
this.alignment();
|
|
314
|
+
this.rounded();
|
|
315
|
+
this.animate();
|
|
316
|
+
const size = this.size();
|
|
317
|
+
const options = this.options();
|
|
318
|
+
const isSizeChange = this.#lastSize !== null && this.#lastSize !== size;
|
|
319
|
+
const isOptionsChange = this.#lastOptions !== null && this.#lastOptions !== options;
|
|
320
|
+
const suppressTransition = isSizeChange || isOptionsChange;
|
|
321
|
+
this.#lastSize = size;
|
|
322
|
+
this.#lastOptions = options;
|
|
323
|
+
this.observeOptionElements(optionElements);
|
|
324
|
+
this.updateIndicatorGeometry({ suppressTransition });
|
|
325
|
+
} });
|
|
326
|
+
afterNextRender({ read: () => {
|
|
327
|
+
this.setupResizeObserver();
|
|
328
|
+
} });
|
|
329
|
+
this.#destroyRef.onDestroy(() => {
|
|
330
|
+
this.#resizeObserver?.disconnect();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
focus(options) {
|
|
334
|
+
const host = this.#hostElementRef.nativeElement;
|
|
335
|
+
(host.querySelector("input:checked:not(:disabled)") ?? host.querySelector("input:not(:disabled)"))?.focus(options);
|
|
336
|
+
}
|
|
337
|
+
setLabelledBy(id) {
|
|
338
|
+
this.#label.setLabelledBy(id);
|
|
339
|
+
}
|
|
340
|
+
onFocusOut(event) {
|
|
341
|
+
const nextTarget = event.relatedTarget;
|
|
342
|
+
if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) return;
|
|
343
|
+
this.touch.emit();
|
|
344
|
+
}
|
|
345
|
+
onOptionChange(option) {
|
|
346
|
+
if (this.effectiveDisabled() || this.readonly() || option.disabled) return;
|
|
347
|
+
this.value.set(option.value);
|
|
348
|
+
this.touch.emit();
|
|
349
|
+
}
|
|
350
|
+
onOptionClick(event) {
|
|
351
|
+
if (this.readonly()) event.preventDefault();
|
|
352
|
+
}
|
|
353
|
+
observeOptionElements(optionElements) {
|
|
354
|
+
if (!this.#resizeObserver) return;
|
|
355
|
+
const elements = optionElements.map((optionElement) => optionElement.nativeElement);
|
|
356
|
+
for (const element of this.#observedOptionElements) if (!elements.includes(element)) this.#resizeObserver.unobserve(element);
|
|
357
|
+
for (const element of elements) if (!this.#observedOptionElements.includes(element)) this.#resizeObserver.observe(element);
|
|
358
|
+
this.#observedOptionElements = elements;
|
|
359
|
+
}
|
|
360
|
+
setupResizeObserver() {
|
|
361
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
362
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
363
|
+
this.updateIndicatorGeometry({ suppressTransition: true });
|
|
364
|
+
});
|
|
365
|
+
this.#resizeObserver.observe(this.#hostElementRef.nativeElement);
|
|
366
|
+
this.observeOptionElements(this.optionElements());
|
|
367
|
+
}
|
|
368
|
+
updateIndicatorGeometry(options) {
|
|
369
|
+
const selectedIndex = this.selectedIndex();
|
|
370
|
+
if (selectedIndex === -1) {
|
|
371
|
+
this.#lastAnimatedIndex = null;
|
|
372
|
+
this.indicatorGeometry.set(null);
|
|
373
|
+
this.indicatorTransitionEnabled.set(false);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const selectedElementRef = this.optionElements()[selectedIndex];
|
|
377
|
+
if (!selectedElementRef?.nativeElement) {
|
|
378
|
+
this.#lastAnimatedIndex = null;
|
|
379
|
+
this.indicatorGeometry.set(null);
|
|
380
|
+
this.indicatorTransitionEnabled.set(false);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const option = selectedElementRef.nativeElement;
|
|
384
|
+
const x = option.offsetLeft;
|
|
385
|
+
const y = option.offsetTop;
|
|
386
|
+
const width = option.offsetWidth;
|
|
387
|
+
const height = option.offsetHeight;
|
|
388
|
+
const shouldAnimate = !options?.suppressTransition && this.animate() && this.indicatorInitialized() && this.#lastAnimatedIndex !== null && this.#lastAnimatedIndex !== selectedIndex;
|
|
389
|
+
this.indicatorTransitionEnabled.set(shouldAnimate);
|
|
390
|
+
this.indicatorGeometry.set({
|
|
391
|
+
height,
|
|
392
|
+
transform: `translate3d(${x}px, ${y}px, 0)`,
|
|
393
|
+
width
|
|
394
|
+
});
|
|
395
|
+
this.#lastAnimatedIndex = selectedIndex;
|
|
396
|
+
if (!this.indicatorInitialized()) this.indicatorInitialized.set(true);
|
|
397
|
+
}
|
|
398
|
+
static {
|
|
399
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
400
|
+
minVersion: "12.0.0",
|
|
401
|
+
version: "22.2.6",
|
|
402
|
+
ngImport: i0,
|
|
403
|
+
type: SegmentedComponent,
|
|
404
|
+
deps: [],
|
|
405
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
static {
|
|
409
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
410
|
+
minVersion: "17.0.0",
|
|
411
|
+
version: "22.2.6",
|
|
412
|
+
type: SegmentedComponent,
|
|
413
|
+
isStandalone: true,
|
|
414
|
+
selector: "mona-segmented",
|
|
415
|
+
inputs: {
|
|
416
|
+
alignment: {
|
|
417
|
+
classPropertyName: "alignment",
|
|
418
|
+
publicName: "alignment",
|
|
419
|
+
isSignal: true,
|
|
420
|
+
isRequired: false,
|
|
421
|
+
transformFunction: null
|
|
422
|
+
},
|
|
423
|
+
animate: {
|
|
424
|
+
classPropertyName: "animate",
|
|
425
|
+
publicName: "animate",
|
|
426
|
+
isSignal: true,
|
|
427
|
+
isRequired: false,
|
|
428
|
+
transformFunction: null
|
|
429
|
+
},
|
|
430
|
+
ariaLabel: {
|
|
431
|
+
classPropertyName: "ariaLabel",
|
|
432
|
+
publicName: "aria-label",
|
|
433
|
+
isSignal: true,
|
|
434
|
+
isRequired: false,
|
|
435
|
+
transformFunction: null
|
|
436
|
+
},
|
|
437
|
+
ariaLabelledBy: {
|
|
438
|
+
classPropertyName: "ariaLabelledBy",
|
|
439
|
+
publicName: "aria-labelledby",
|
|
440
|
+
isSignal: true,
|
|
441
|
+
isRequired: false,
|
|
442
|
+
transformFunction: null
|
|
443
|
+
},
|
|
444
|
+
disabled: {
|
|
445
|
+
classPropertyName: "disabled",
|
|
446
|
+
publicName: "disabled",
|
|
447
|
+
isSignal: true,
|
|
448
|
+
isRequired: false,
|
|
449
|
+
transformFunction: null
|
|
450
|
+
},
|
|
451
|
+
invalid: {
|
|
452
|
+
classPropertyName: "invalid",
|
|
453
|
+
publicName: "invalid",
|
|
454
|
+
isSignal: true,
|
|
455
|
+
isRequired: false,
|
|
456
|
+
transformFunction: null
|
|
457
|
+
},
|
|
458
|
+
name: {
|
|
459
|
+
classPropertyName: "name",
|
|
460
|
+
publicName: "name",
|
|
461
|
+
isSignal: true,
|
|
462
|
+
isRequired: false,
|
|
463
|
+
transformFunction: null
|
|
464
|
+
},
|
|
465
|
+
options: {
|
|
466
|
+
classPropertyName: "options",
|
|
467
|
+
publicName: "options",
|
|
468
|
+
isSignal: true,
|
|
469
|
+
isRequired: true,
|
|
470
|
+
transformFunction: null
|
|
471
|
+
},
|
|
472
|
+
readonly: {
|
|
473
|
+
classPropertyName: "readonly",
|
|
474
|
+
publicName: "readonly",
|
|
475
|
+
isSignal: true,
|
|
476
|
+
isRequired: false,
|
|
477
|
+
transformFunction: null
|
|
478
|
+
},
|
|
479
|
+
required: {
|
|
480
|
+
classPropertyName: "required",
|
|
481
|
+
publicName: "required",
|
|
482
|
+
isSignal: true,
|
|
483
|
+
isRequired: false,
|
|
484
|
+
transformFunction: null
|
|
485
|
+
},
|
|
486
|
+
rounded: {
|
|
487
|
+
classPropertyName: "rounded",
|
|
488
|
+
publicName: "rounded",
|
|
489
|
+
isSignal: true,
|
|
490
|
+
isRequired: false,
|
|
491
|
+
transformFunction: null
|
|
492
|
+
},
|
|
493
|
+
size: {
|
|
494
|
+
classPropertyName: "size",
|
|
495
|
+
publicName: "size",
|
|
496
|
+
isSignal: true,
|
|
497
|
+
isRequired: false,
|
|
498
|
+
transformFunction: null
|
|
499
|
+
},
|
|
500
|
+
touched: {
|
|
501
|
+
classPropertyName: "touched",
|
|
502
|
+
publicName: "touched",
|
|
503
|
+
isSignal: true,
|
|
504
|
+
isRequired: false,
|
|
505
|
+
transformFunction: null
|
|
506
|
+
},
|
|
507
|
+
userClass: {
|
|
508
|
+
classPropertyName: "userClass",
|
|
509
|
+
publicName: "class",
|
|
510
|
+
isSignal: true,
|
|
511
|
+
isRequired: false,
|
|
512
|
+
transformFunction: null
|
|
513
|
+
},
|
|
514
|
+
value: {
|
|
515
|
+
classPropertyName: "value",
|
|
516
|
+
publicName: "value",
|
|
517
|
+
isSignal: true,
|
|
518
|
+
isRequired: false,
|
|
519
|
+
transformFunction: null
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
outputs: {
|
|
523
|
+
touch: "touch",
|
|
524
|
+
value: "valueChange"
|
|
525
|
+
},
|
|
526
|
+
host: {
|
|
527
|
+
listeners: { "focusout": "onFocusOut($event)" },
|
|
528
|
+
properties: {
|
|
529
|
+
"attr.aria-disabled": "effectiveDisabled() || undefined",
|
|
530
|
+
"attr.aria-invalid": "invalidState() ? 'true' : null",
|
|
531
|
+
"attr.aria-label": "ariaLabel()",
|
|
532
|
+
"attr.aria-labelledby": "labelledBy()",
|
|
533
|
+
"attr.aria-readonly": "readonly() || null",
|
|
534
|
+
"attr.aria-required": "required() || null",
|
|
535
|
+
"attr.data-disabled": "effectiveDisabled()",
|
|
536
|
+
"attr.data-readonly": "readonly() || null",
|
|
537
|
+
"attr.data-invalid": "invalidState() || null",
|
|
538
|
+
"attr.role": "'radiogroup'",
|
|
539
|
+
"class": "containerClasses()"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
queries: [{
|
|
543
|
+
propertyName: "itemTemplate",
|
|
544
|
+
first: true,
|
|
545
|
+
predicate: SegmentedItemTemplateDirective,
|
|
546
|
+
descendants: true,
|
|
547
|
+
read: TemplateRef,
|
|
548
|
+
isSignal: true
|
|
549
|
+
}],
|
|
550
|
+
viewQueries: [{
|
|
551
|
+
propertyName: "optionElements",
|
|
552
|
+
predicate: ["optionElement"],
|
|
553
|
+
descendants: true,
|
|
554
|
+
isSignal: true
|
|
555
|
+
}, {
|
|
556
|
+
propertyName: "radioInputs",
|
|
557
|
+
predicate: ["radioInput"],
|
|
558
|
+
descendants: true,
|
|
559
|
+
isSignal: true
|
|
560
|
+
}],
|
|
561
|
+
ngImport: i0,
|
|
562
|
+
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",
|
|
563
|
+
dependencies: [{
|
|
564
|
+
kind: "directive",
|
|
565
|
+
type: NgTemplateOutlet,
|
|
566
|
+
selector: "[ngTemplateOutlet]",
|
|
567
|
+
inputs: [
|
|
568
|
+
"ngTemplateOutletContext",
|
|
569
|
+
"ngTemplateOutlet",
|
|
570
|
+
"ngTemplateOutletInjector"
|
|
571
|
+
]
|
|
572
|
+
}]
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
577
|
+
minVersion: "12.0.0",
|
|
578
|
+
version: "22.2.6",
|
|
579
|
+
ngImport: i0,
|
|
580
|
+
type: SegmentedComponent,
|
|
581
|
+
decorators: [{
|
|
582
|
+
type: Component,
|
|
583
|
+
args: [{
|
|
584
|
+
selector: "mona-segmented",
|
|
585
|
+
imports: [NgTemplateOutlet],
|
|
586
|
+
host: {
|
|
587
|
+
"[attr.aria-disabled]": "effectiveDisabled() || undefined",
|
|
588
|
+
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
589
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
590
|
+
"[attr.aria-labelledby]": "labelledBy()",
|
|
591
|
+
"[attr.aria-readonly]": "readonly() || null",
|
|
592
|
+
"[attr.aria-required]": "required() || null",
|
|
593
|
+
"[attr.data-disabled]": "effectiveDisabled()",
|
|
594
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
595
|
+
"(focusout)": "onFocusOut($event)",
|
|
596
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
597
|
+
"[attr.role]": "'radiogroup'",
|
|
598
|
+
"[class]": "containerClasses()"
|
|
599
|
+
},
|
|
600
|
+
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"
|
|
601
|
+
}]
|
|
602
|
+
}],
|
|
603
|
+
ctorParameters: () => [],
|
|
604
|
+
propDecorators: {
|
|
605
|
+
itemTemplate: [{
|
|
606
|
+
type: i0.ContentChild,
|
|
607
|
+
args: [i0.forwardRef(() => SegmentedItemTemplateDirective), {
|
|
608
|
+
read: TemplateRef,
|
|
609
|
+
isSignal: true
|
|
610
|
+
}]
|
|
611
|
+
}],
|
|
612
|
+
optionElements: [{
|
|
613
|
+
type: i0.ViewChildren,
|
|
614
|
+
args: ["optionElement", { isSignal: true }]
|
|
615
|
+
}],
|
|
616
|
+
radioInputs: [{
|
|
617
|
+
type: i0.ViewChildren,
|
|
618
|
+
args: ["radioInput", { isSignal: true }]
|
|
619
|
+
}],
|
|
620
|
+
alignment: [{
|
|
621
|
+
type: i0.Input,
|
|
622
|
+
args: [{
|
|
623
|
+
isSignal: true,
|
|
624
|
+
alias: "alignment",
|
|
625
|
+
required: false
|
|
626
|
+
}]
|
|
627
|
+
}],
|
|
628
|
+
animate: [{
|
|
629
|
+
type: i0.Input,
|
|
630
|
+
args: [{
|
|
631
|
+
isSignal: true,
|
|
632
|
+
alias: "animate",
|
|
633
|
+
required: false
|
|
634
|
+
}]
|
|
635
|
+
}],
|
|
636
|
+
ariaLabel: [{
|
|
637
|
+
type: i0.Input,
|
|
638
|
+
args: [{
|
|
639
|
+
isSignal: true,
|
|
640
|
+
alias: "aria-label",
|
|
641
|
+
required: false
|
|
642
|
+
}]
|
|
643
|
+
}],
|
|
644
|
+
ariaLabelledBy: [{
|
|
645
|
+
type: i0.Input,
|
|
646
|
+
args: [{
|
|
647
|
+
isSignal: true,
|
|
648
|
+
alias: "aria-labelledby",
|
|
649
|
+
required: false
|
|
650
|
+
}]
|
|
651
|
+
}],
|
|
652
|
+
disabled: [{
|
|
653
|
+
type: i0.Input,
|
|
654
|
+
args: [{
|
|
655
|
+
isSignal: true,
|
|
656
|
+
alias: "disabled",
|
|
657
|
+
required: false
|
|
658
|
+
}]
|
|
659
|
+
}],
|
|
660
|
+
invalid: [{
|
|
661
|
+
type: i0.Input,
|
|
662
|
+
args: [{
|
|
663
|
+
isSignal: true,
|
|
664
|
+
alias: "invalid",
|
|
665
|
+
required: false
|
|
666
|
+
}]
|
|
667
|
+
}],
|
|
668
|
+
name: [{
|
|
669
|
+
type: i0.Input,
|
|
670
|
+
args: [{
|
|
671
|
+
isSignal: true,
|
|
672
|
+
alias: "name",
|
|
673
|
+
required: false
|
|
674
|
+
}]
|
|
675
|
+
}],
|
|
676
|
+
options: [{
|
|
677
|
+
type: i0.Input,
|
|
678
|
+
args: [{
|
|
679
|
+
isSignal: true,
|
|
680
|
+
alias: "options",
|
|
681
|
+
required: true
|
|
682
|
+
}]
|
|
683
|
+
}],
|
|
684
|
+
readonly: [{
|
|
685
|
+
type: i0.Input,
|
|
686
|
+
args: [{
|
|
687
|
+
isSignal: true,
|
|
688
|
+
alias: "readonly",
|
|
689
|
+
required: false
|
|
690
|
+
}]
|
|
691
|
+
}],
|
|
692
|
+
required: [{
|
|
693
|
+
type: i0.Input,
|
|
694
|
+
args: [{
|
|
695
|
+
isSignal: true,
|
|
696
|
+
alias: "required",
|
|
697
|
+
required: false
|
|
698
|
+
}]
|
|
699
|
+
}],
|
|
700
|
+
rounded: [{
|
|
701
|
+
type: i0.Input,
|
|
702
|
+
args: [{
|
|
703
|
+
isSignal: true,
|
|
704
|
+
alias: "rounded",
|
|
705
|
+
required: false
|
|
706
|
+
}]
|
|
707
|
+
}],
|
|
708
|
+
size: [{
|
|
709
|
+
type: i0.Input,
|
|
710
|
+
args: [{
|
|
711
|
+
isSignal: true,
|
|
712
|
+
alias: "size",
|
|
713
|
+
required: false
|
|
714
|
+
}]
|
|
715
|
+
}],
|
|
716
|
+
touch: [{
|
|
717
|
+
type: i0.Output,
|
|
718
|
+
args: ["touch"]
|
|
719
|
+
}],
|
|
720
|
+
touched: [{
|
|
721
|
+
type: i0.Input,
|
|
722
|
+
args: [{
|
|
723
|
+
isSignal: true,
|
|
724
|
+
alias: "touched",
|
|
725
|
+
required: false
|
|
726
|
+
}]
|
|
727
|
+
}],
|
|
728
|
+
userClass: [{
|
|
729
|
+
type: i0.Input,
|
|
730
|
+
args: [{
|
|
731
|
+
isSignal: true,
|
|
732
|
+
alias: "class",
|
|
733
|
+
required: false
|
|
734
|
+
}]
|
|
735
|
+
}],
|
|
736
|
+
value: [{
|
|
737
|
+
type: i0.Input,
|
|
738
|
+
args: [{
|
|
739
|
+
isSignal: true,
|
|
740
|
+
alias: "value",
|
|
741
|
+
required: false
|
|
742
|
+
}]
|
|
743
|
+
}, {
|
|
744
|
+
type: i0.Output,
|
|
745
|
+
args: ["valueChange"]
|
|
746
|
+
}]
|
|
747
|
+
}
|
|
748
|
+
});
|
|
500
749
|
export { SegmentedComponent, SegmentedItemTemplateDirective };
|
|
501
|
-
|
|
750
|
+
|
|
751
|
+
//# sourceMappingURL=nanahoshi-mona-ui-segmented.mjs.map
|