@nanahoshi/mona-ui 0.7.1 → 0.9.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.
Files changed (20) hide show
  1. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +8 -11
  2. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-BbBPZj7t.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-D05Rq7-1.mjs} +2 -2
  3. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-BkISJoqL.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-Bad0K1Cw.mjs} +2 -2
  4. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-QqUUL60F.mjs +122 -0
  5. package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-QDo6TweF.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-DvuQvc7E.mjs} +46 -5
  6. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-BmahjOXq.mjs +232 -0
  7. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DWzYyGnb.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-RQvhjBse.mjs} +227 -48
  8. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  9. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +159 -0
  10. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +159 -97
  11. package/fesm2022/nanahoshi-mona-ui-theme.mjs +4 -12
  12. package/package.json +5 -1
  13. package/segmented/package.json +4 -0
  14. package/types/nanahoshi-mona-ui-check-box.d.ts +1 -2
  15. package/types/nanahoshi-mona-ui-grid.d.ts +66 -1
  16. package/types/nanahoshi-mona-ui-segmented.d.ts +90 -0
  17. package/types/nanahoshi-mona-ui-tabs.d.ts +16 -11
  18. package/types/nanahoshi-mona-ui-theme.d.ts +1 -1
  19. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DReEfWfG.mjs +0 -121
  20. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-BCIs_lmz.mjs +0 -231
@@ -1,2 +1,2 @@
1
- export { C as CellEditEvent, w as GridAddCommandDirective, x as GridAddEvent, y as GridCancelCommandDirective, z as GridCancelEvent, A as GridCellTemplateDirective, B as GridColumnComponent, D as GridColumnTitleTemplateDirective, E as GridCommandColumnComponent, F as GridComponent, H as GridContextMenuDirective, I as GridDetailTemplateDirective, J as GridEditCommandDirective, K as GridEditEvent, L as GridEditTemplateDirective, M as GridEditableDirective, N as GridExportDirective, O as GridFilterableDirective, P as GridFooterTemplateDirective, Q as GridGroupFooterTemplateDirective, R as GridGroupableDirective, S as GridHeaderTemplateDirective, T as GridNoDataTemplateDirective, U as GridRemoveCommandDirective, V as GridRemoveEvent, W as GridReorderableDirective, X as GridResizableDirective, Y as GridSaveCommandDirective, Z as GridSaveEvent, _ as GridSelectableDirective, $ as GridSortableDirective, a0 as GridStatePersistenceDirective, a1 as GridToolbarTemplateDirective, a2 as GridVirtualScrollDirective, a3 as RowEditEvent } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DWzYyGnb.mjs';
1
+ export { C as CellEditEvent, x as GridAddCommandDirective, y as GridAddEvent, z as GridCancelCommandDirective, A as GridCancelEvent, B as GridCellTemplateDirective, D as GridColumnComponent, E as GridColumnTitleTemplateDirective, F as GridCommandColumnComponent, H as GridComponent, I as GridContextMenuDirective, J as GridDetailTemplateDirective, K as GridEditCommandDirective, L as GridEditEvent, M as GridEditTemplateDirective, N as GridEditableDirective, O as GridExportDirective, P as GridFilterableDirective, Q as GridFooterTemplateDirective, R as GridGroupFooterTemplateDirective, S as GridGroupableDirective, T as GridHeaderTemplateDirective, U as GridNoDataTemplateDirective, V as GridRemoveCommandDirective, W as GridRemoveEvent, X as GridReorderableDirective, Y as GridResizableDirective, Z as GridSaveCommandDirective, _ as GridSaveEvent, $ as GridSelectableDirective, a0 as GridSortableDirective, a1 as GridStatePersistenceDirective, a2 as GridToolbarTemplateDirective, a3 as GridVirtualScrollDirective, a4 as RowEditEvent } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-RQvhjBse.mjs';
2
2
  //# sourceMappingURL=nanahoshi-mona-ui-grid.mjs.map
@@ -0,0 +1,159 @@
1
+ import * as i0 from '@angular/core';
2
+ import { computed, input, output, model, Component } from '@angular/core';
3
+ import { themeControlSurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { cva } from 'class-variance-authority';
6
+
7
+ const segmentedContainerThemeVariants = cva(`
8
+ inline-flex items-center gap-0.5
9
+ ${themeControlSurfaceClasses}
10
+ border border-input-border
11
+ rounded-lg
12
+ p-1
13
+ data-[invalid='true']:border-error
14
+ data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
15
+ transition-colors duration-(--mona-motion-fast)
16
+ `);
17
+ const segmentedOptionThemeVariants = cva(`
18
+ relative flex flex-1 cursor-pointer items-center justify-center gap-1
19
+ whitespace-nowrap
20
+ rounded-md
21
+ transition-colors duration-(--mona-motion-fast)
22
+ data-[disabled='true']:pointer-events-none
23
+ data-[disabled='true']:cursor-not-allowed
24
+ data-[disabled='true']:text-disabled-foreground
25
+ data-[selected='true']:bg-primary data-[selected='true']:text-primary-foreground
26
+ data-[selected='true']:shadow-sm data-[selected='true']:ring-1 data-[selected='true']:ring-selected-border
27
+ data-[selected='false']:text-muted-foreground
28
+ data-[selected='false']:hover:bg-hover data-[selected='false']:hover:text-foreground
29
+ `, {
30
+ variants: {
31
+ size: {
32
+ small: "h-6 px-1.5 text-sm",
33
+ medium: "h-8 px-2.5 text-sm",
34
+ large: "h-10 px-3.5 text-base"
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ size: "medium"
39
+ }
40
+ });
41
+ const segmentedInputThemeVariants = cva(`
42
+ peer absolute inset-0 z-10 h-full w-full
43
+ cursor-pointer appearance-none opacity-0
44
+ outline-none
45
+ disabled:cursor-not-allowed
46
+ `);
47
+
48
+ class SegmentedComponent {
49
+ constructor() {
50
+ this.containerClasses = computed(() => {
51
+ const classes = segmentedContainerThemeVariants();
52
+ return twMerge(classes, this.userClass());
53
+ }, /* @ts-ignore */
54
+ ...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
55
+ this.groupName = createElementControlId();
56
+ this.inputClasses = computed(() => segmentedInputThemeVariants(), /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
58
+ this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
60
+ this.optionClasses = computed(() => {
61
+ const size = this.size();
62
+ return segmentedOptionThemeVariants({ size });
63
+ }, /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "optionClasses" }] : /* istanbul ignore next */ []));
65
+ /**
66
+ * @description Accessible name for the radio group. Provide either `aria-label` or `aria-labelledby`.
67
+ * @default null
68
+ */
69
+ this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
70
+ /**
71
+ * @description ID of an external element that provides the accessible name for the radio group.
72
+ * @default null
73
+ */
74
+ this.ariaLabelledBy = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
75
+ /**
76
+ * @description Disables every option in the group and prevents value changes.
77
+ * @default false
78
+ */
79
+ this.disabled = input(false, /* @ts-ignore */
80
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
81
+ /**
82
+ * @description Marks the component as invalid. Error styling requires both `invalid` and `touched` to be `true`.
83
+ * When bound to a signal form field via `[formField]`, this is written by the signal forms `Field` directive.
84
+ * @default false
85
+ */
86
+ this.invalid = input(false, /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
88
+ /**
89
+ * @description The list of selectable options. Exactly one option is selected at a time.
90
+ */
91
+ this.options = input.required(/* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
93
+ /**
94
+ * @description Size preset controlling the height, horizontal padding, text size, and spacing of each option.
95
+ * @default "medium"
96
+ */
97
+ this.size = input("medium", /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
99
+ /**
100
+ * @description Emitted when the selected value changes or focus leaves a radio input.
101
+ */
102
+ this.touch = output();
103
+ /**
104
+ * @description Marks the component as touched. When bound to a signal form field via `[formField]`,
105
+ * this is written by the signal forms `Field` directive.
106
+ * @default false
107
+ */
108
+ this.touched = input(false, /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
110
+ /**
111
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
112
+ * @default ""
113
+ */
114
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
115
+ /**
116
+ * @description The currently selected value. When it matches no current option, no option is checked.
117
+ * A `null` value is allowed initially but cannot be restored through segmented interaction.
118
+ * @default null
119
+ */
120
+ this.value = model(null, /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
122
+ }
123
+ onOptionBlur() {
124
+ this.touch.emit();
125
+ }
126
+ onOptionChange(option) {
127
+ if (this.disabled() || option.disabled) {
128
+ return;
129
+ }
130
+ this.value.set(option.value);
131
+ this.touch.emit();
132
+ }
133
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
134
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SegmentedComponent, isStandalone: true, selector: "mona-segmented", inputs: { 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 }, 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": "disabled() || undefined", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "ariaLabelledBy()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.role": "'radiogroup'", "class": "containerClasses()" } }, ngImport: i0, template: "@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = disabled() || option.disabled;\n\n <label [class]=\"optionClasses()\" [attr.data-selected]=\"selected\" [attr.data-disabled]=\"optionDisabled\">\n <input\n type=\"radio\"\n [name]=\"groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n (change)=\"onOptionChange(option)\"\n (blur)=\"onOptionBlur()\" />\n\n <span\n class=\"pointer-events-none absolute inset-0 flex items-center justify-center gap-1 rounded-md peer-focus-visible:ring-2 peer-focus-visible:ring-focus-indicator/35\">\n {{ option.label }}\n </span>\n </label>\n}\n" }); }
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, decorators: [{
137
+ type: Component,
138
+ args: [{ selector: "mona-segmented", host: {
139
+ "[attr.aria-disabled]": "disabled() || undefined",
140
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
141
+ "[attr.aria-label]": "ariaLabel()",
142
+ "[attr.aria-labelledby]": "ariaLabelledBy()",
143
+ "[attr.data-disabled]": "disabled()",
144
+ "[attr.data-invalid]": "invalidState() || null",
145
+ "[attr.role]": "'radiogroup'",
146
+ "[class]": "containerClasses()"
147
+ }, template: "@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = disabled() || option.disabled;\n\n <label [class]=\"optionClasses()\" [attr.data-selected]=\"selected\" [attr.data-disabled]=\"optionDisabled\">\n <input\n type=\"radio\"\n [name]=\"groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n (change)=\"onOptionChange(option)\"\n (blur)=\"onOptionBlur()\" />\n\n <span\n class=\"pointer-events-none absolute inset-0 flex items-center justify-center gap-1 rounded-md peer-focus-visible:ring-2 peer-focus-visible:ring-focus-indicator/35\">\n {{ option.label }}\n </span>\n </label>\n}\n" }]
148
+ }], propDecorators: { 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 }] }], 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"] }] } });
149
+
150
+ /*
151
+ * Public API Surface of @nanahoshi/mona-ui/segmented
152
+ */
153
+
154
+ /**
155
+ * Generated bundle index. Do not edit.
156
+ */
157
+
158
+ export { SegmentedComponent };
159
+ //# sourceMappingURL=nanahoshi-mona-ui-segmented.mjs.map