@nanahoshi/mona-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,111 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, computed, input, Directive } from '@angular/core';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
5
+ import { cva } from 'class-variance-authority';
6
+
7
+ const textAreaVariants = cva(`
8
+ bg-input-background
9
+
10
+ border border-input-border outline-none
11
+ selection:bg-primary selection:text-primary-foreground
12
+ transition-[color,box-shadow,border] ease-in-out duration-300
13
+
14
+ shadow-xs
15
+ px-2 py-1 text-sm
16
+
17
+ placeholder:text-muted-foreground
18
+
19
+ focus-visible:ring-2 focus-visible:ring-primary/40
20
+ focus-visible:border-primary
21
+
22
+ disabled:pointer-events-none disabled:opacity-50
23
+ disabled:cursor-not-allowed disabled:select-none
24
+
25
+ [&.ng-touched.ng-invalid]:border-error
26
+ [&.ng-touched.ng-invalid]:ring-error/40
27
+ data-[invalid='true']:border-error
28
+ data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
29
+ `, {
30
+ variants: {
31
+ rounded: {
32
+ large: "rounded-lg",
33
+ medium: "rounded-md",
34
+ none: "rounded-none",
35
+ small: "rounded-sm"
36
+ }
37
+ }
38
+ });
39
+
40
+ const textAreaThemeVariants = (theme) => {
41
+ switch (theme) {
42
+ case "mona":
43
+ return textAreaVariants;
44
+ default:
45
+ return textAreaVariants;
46
+ }
47
+ };
48
+
49
+ class TextAreaDirective {
50
+ constructor() {
51
+ this.#themeService = inject(ThemeService);
52
+ this.baseClass = computed(() => {
53
+ const theme = this.#themeService.theme();
54
+ const rounded = this.rounded();
55
+ const classes = textAreaThemeVariants(theme)({ rounded });
56
+ const userClass = this.userClass();
57
+ return twMerge(classes, userClass);
58
+ }, /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
60
+ this.inputInvalid = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "inputInvalid" }] : /* istanbul ignore next */ []));
62
+ /**
63
+ * @description Sets the border radius of the textarea.
64
+ * @default "medium"
65
+ */
66
+ this.rounded = input("medium", /* @ts-ignore */
67
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
68
+ /**
69
+ * @description Marks the textarea as invalid, triggering error border and ring styling.
70
+ * @default false
71
+ */
72
+ this.invalid = input(false, /* @ts-ignore */
73
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
74
+ /**
75
+ * @description Marks the textarea as touched. Error styling is only shown when both `invalid` and `touched` are `true`.
76
+ * @default false
77
+ */
78
+ this.touched = input(false, /* @ts-ignore */
79
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
80
+ /**
81
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
82
+ * @default ""
83
+ */
84
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
85
+ }
86
+ #themeService;
87
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextAreaDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
88
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TextAreaDirective, isStandalone: true, selector: "textarea[monaTextArea]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", 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 } }, host: { properties: { "attr.aria-invalid": "inputInvalid() || null", "attr.data-invalid": "inputInvalid() || null", "class": "baseClass()" } }, ngImport: i0 }); }
89
+ }
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextAreaDirective, decorators: [{
91
+ type: Directive,
92
+ args: [{
93
+ selector: "textarea[monaTextArea]",
94
+ host: {
95
+ "[attr.aria-invalid]": "inputInvalid() || null",
96
+ "[attr.data-invalid]": "inputInvalid() || null",
97
+ "[class]": "baseClass()"
98
+ }
99
+ }]
100
+ }], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
101
+
102
+ /*
103
+ * Public API Surface of @nanahoshi/mona-ui/text-area
104
+ */
105
+
106
+ /**
107
+ * Generated bundle index. Do not edit.
108
+ */
109
+
110
+ export { TextAreaDirective };
111
+ //# sourceMappingURL=nanahoshi-mona-ui-text-area.mjs.map
@@ -0,0 +1,369 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Directive, inject, DestroyRef, computed, viewChild, contentChildren, TemplateRef, input, output, model, Component } from '@angular/core';
4
+ import * as i1 from '@angular/forms';
5
+ import { FormsModule } from '@angular/forms';
6
+ import { LucideX } from '@lucide/angular';
7
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
8
+ import { rxTimeout, AttributeBinderDirective } from '@nanahoshi/mona-ui/internal';
9
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
10
+ import { twMerge } from 'tailwind-merge';
11
+ import { cva } from 'class-variance-authority';
12
+
13
+ class TextBoxPrefixTemplateDirective {
14
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxPrefixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
15
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: TextBoxPrefixTemplateDirective, isStandalone: true, selector: "ng-template[monaTextBoxPrefixTemplate]", ngImport: i0 }); }
16
+ }
17
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxPrefixTemplateDirective, decorators: [{
18
+ type: Directive,
19
+ args: [{
20
+ selector: "ng-template[monaTextBoxPrefixTemplate]"
21
+ }]
22
+ }] });
23
+
24
+ class TextBoxSuffixTemplateDirective {
25
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxSuffixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
26
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: TextBoxSuffixTemplateDirective, isStandalone: true, selector: "ng-template[monaTextBoxSuffixTemplate]", ngImport: i0 }); }
27
+ }
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxSuffixTemplateDirective, decorators: [{
29
+ type: Directive,
30
+ args: [{
31
+ selector: "ng-template[monaTextBoxSuffixTemplate]"
32
+ }]
33
+ }] });
34
+
35
+ const textBoxVariants = cva(`
36
+ flex items-center w-full min-w-0
37
+ overflow-hidden
38
+
39
+ bg-input-background
40
+ border border-input-border outline-none
41
+ selection:bg-primary selection:text-primary-foreground
42
+
43
+ transition-[color,box-shadow,border] ease-in-out duration-300
44
+
45
+ data-[disabled='true']:pointer-events-none
46
+ data-[disabled='true']:cursor-not-allowed
47
+ data-[disabled='true']:opacity-50
48
+
49
+ focus-within:ring-2 focus-within:ring-primary/40
50
+ focus-within:border-primary
51
+
52
+ [&>input]:w-full [&>input]:h-full
53
+ [&>input]:bg-transparent
54
+ [&>input]:border-0 [&>input]:outline-none
55
+ [&>input]:placeholder:text-muted-foreground
56
+ [&>input]:px-2
57
+
58
+ data-[invalid='true']:border-error
59
+ data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
60
+ `, {
61
+ variants: {
62
+ rounded: {
63
+ full: "rounded-full",
64
+ large: "rounded-lg",
65
+ medium: "rounded-md",
66
+ none: "rounded-none",
67
+ small: "rounded-sm"
68
+ },
69
+ size: {
70
+ large: "h-10 text-md",
71
+ medium: "h-9 text-sm",
72
+ small: "h-8 text-xs"
73
+ }
74
+ }
75
+ });
76
+ const inputVariants = cva(`
77
+ bg-input-background
78
+ px-2
79
+
80
+ border border-input-border outline-none
81
+ selection:bg-primary selection:text-primary-foreground
82
+
83
+ transition-[color,box-shadow,border] ease-in-out duration-300
84
+
85
+ shadow-xs
86
+
87
+ file:text-foreground
88
+ file:inline-flex file:border-0
89
+ file:bg-transparent file:text-xs
90
+ file:font-medium
91
+
92
+ placeholder:text-muted-foreground
93
+
94
+ disabled:pointer-events-none
95
+ disabled:cursor-not-allowed
96
+ disabled:opacity-50
97
+
98
+ focus-visible:ring-2 focus-visible:ring-primary/40
99
+ focus-visible:border-primary
100
+
101
+ [&.ng-touched.ng-invalid]:border-error
102
+ [&.ng-touched.ng-invalid]:ring-error/40
103
+ `, {
104
+ variants: {
105
+ rounded: {
106
+ full: "rounded-full px-4",
107
+ large: "rounded-lg",
108
+ medium: "rounded-md",
109
+ none: "rounded-none",
110
+ small: "rounded-sm"
111
+ },
112
+ size: {
113
+ large: "h-10 text-md",
114
+ medium: "h-9 text-sm",
115
+ small: "h-8 text-xs"
116
+ }
117
+ },
118
+ compoundVariants: [
119
+ {
120
+ rounded: "full",
121
+ size: "large",
122
+ class: "px-4"
123
+ },
124
+ {
125
+ rounded: "full",
126
+ size: "medium",
127
+ class: "px-4"
128
+ },
129
+ {
130
+ rounded: "full",
131
+ size: "small",
132
+ class: "px-4"
133
+ }
134
+ ]
135
+ });
136
+
137
+ const textBoxThemeVariants = (theme) => {
138
+ switch (theme) {
139
+ case "mona":
140
+ return textBoxVariants;
141
+ default:
142
+ return textBoxVariants; // Default to Mona styles
143
+ }
144
+ };
145
+ const inputThemeVariants = (theme) => {
146
+ switch (theme) {
147
+ case "mona":
148
+ return inputVariants;
149
+ default:
150
+ return inputVariants; // Default to Mona styles
151
+ }
152
+ };
153
+
154
+ class TextBoxComponent {
155
+ constructor() {
156
+ this.#destroyRef = inject(DestroyRef);
157
+ this.#themeService = inject(ThemeService);
158
+ this.classes = computed(() => {
159
+ const theme = this.#themeService.theme();
160
+ const rounded = this.rounded();
161
+ const size = this.size();
162
+ const classes = textBoxThemeVariants(theme)({ rounded, size });
163
+ const userClass = this.userClass();
164
+ return twMerge(classes, userClass);
165
+ }, /* @ts-ignore */
166
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
167
+ this.inputRef = viewChild.required("input", /* @ts-ignore */
168
+ ...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
169
+ this.invalidInput = computed(() => this.invalid() || (this.required() && !this.value() && this.touched()), /* @ts-ignore */
170
+ ...(ngDevMode ? [{ debugName: "invalidInput" }] : /* istanbul ignore next */ []));
171
+ this.prefixTemplateList = contentChildren(TextBoxPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
172
+ this.suffixTemplateList = contentChildren(TextBoxSuffixTemplateDirective, { ...(ngDevMode ? { debugName: "suffixTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
173
+ /**
174
+ * @description Displays a clear button that resets the value to empty.
175
+ * @default false
176
+ */
177
+ this.clearButton = input(false, /* @ts-ignore */
178
+ ...(ngDevMode ? [{ debugName: "clearButton" }] : /* istanbul ignore next */ []));
179
+ /**
180
+ * @description Renders the component with reduced visual emphasis and removes pointer interaction.
181
+ * @default false
182
+ */
183
+ this.disabled = input(false, /* @ts-ignore */
184
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
185
+ /**
186
+ * @description Additional HTML attributes applied directly to the inner `<input>` element.
187
+ * @default {}
188
+ */
189
+ this.inputAttributes = input({}, /* @ts-ignore */
190
+ ...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
191
+ /**
192
+ * @description Emitted when the inner input loses focus.
193
+ */
194
+ this.inputBlur = output();
195
+ /**
196
+ * @description Emitted when the inner input gains focus.
197
+ */
198
+ this.inputFocus = output();
199
+ /**
200
+ * @description Additional CSS classes applied to the inner `<input>` element.
201
+ * @default ""
202
+ */
203
+ this.inputClass = input("", /* @ts-ignore */
204
+ ...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
205
+ /**
206
+ * @description Inline styles applied to the inner `<input>` element.
207
+ * Accepts a style string or a `CSSStyleDeclaration` partial.
208
+ * @default null
209
+ */
210
+ this.inputStyle = input(null, /* @ts-ignore */
211
+ ...(ngDevMode ? [{ debugName: "inputStyle" }] : /* istanbul ignore next */ []));
212
+ /**
213
+ * @description Marks the text box as invalid. When bound to a signal form field via `[formField]`,
214
+ * this is written by the `FormField` directive.
215
+ * @default false
216
+ */
217
+ this.invalid = input(false, /* @ts-ignore */
218
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
219
+ /**
220
+ * @description Placeholder text shown when no value has been entered.
221
+ * @default ""
222
+ */
223
+ this.placeholder = input("", /* @ts-ignore */
224
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
225
+ /**
226
+ * @description Prevents value changes while preserving the component's visual state.
227
+ * @default false
228
+ */
229
+ this.readonly = input(false, /* @ts-ignore */
230
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
231
+ /**
232
+ * @description Marks the text box as required.
233
+ * Triggers the invalid state when the value is empty and the field has been touched.
234
+ * @default false
235
+ */
236
+ this.required = input(false, /* @ts-ignore */
237
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
238
+ /**
239
+ * @description Border-radius preset applied to the component.
240
+ * @default "medium"
241
+ */
242
+ this.rounded = input("medium", /* @ts-ignore */
243
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
244
+ /**
245
+ * @description Size preset controlling the component's dimensions.
246
+ * @default "medium"
247
+ */
248
+ this.size = input("medium", /* @ts-ignore */
249
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
250
+ /**
251
+ * @description Emitted when the text box is interacted with — on blur, value change, or clear.
252
+ * The `FormField` directive listens to this to mark the field as touched.
253
+ */
254
+ this.touch = output();
255
+ /**
256
+ * @description Sets the touched state of the text box. When bound to a signal form field via `[formField]`,
257
+ * this is written by the `FormField` directive.
258
+ * @default false
259
+ */
260
+ this.touched = input(false, /* @ts-ignore */
261
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
262
+ /**
263
+ * @description Sets the `type` attribute of the inner `<input>` element.
264
+ * @default "text"
265
+ */
266
+ this.type = input("text", /* @ts-ignore */
267
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
268
+ /**
269
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
270
+ * @default ""
271
+ */
272
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
273
+ /**
274
+ * @description Two-way bindable current value of the text box.
275
+ * @default ""
276
+ */
277
+ this.value = model("", /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
279
+ }
280
+ #destroyRef;
281
+ #themeService;
282
+ focus() {
283
+ const el = this.inputRef().nativeElement;
284
+ el.focus();
285
+ rxTimeout(this.#destroyRef, () => {
286
+ el.scrollLeft = el.scrollWidth;
287
+ });
288
+ }
289
+ onClearClick() {
290
+ this.value.set("");
291
+ this.touch.emit();
292
+ this.inputRef().nativeElement.focus();
293
+ }
294
+ onInputBlur(event) {
295
+ this.inputBlur.emit(event);
296
+ this.touch.emit();
297
+ }
298
+ onValueChange(value) {
299
+ this.value.set(value);
300
+ this.touch.emit();
301
+ }
302
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
303
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TextBoxComponent, isStandalone: true, selector: "mona-text-box", inputs: { clearButton: { classPropertyName: "clearButton", publicName: "clearButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputAttributes: { classPropertyName: "inputAttributes", publicName: "inputAttributes", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, inputStyle: { classPropertyName: "inputStyle", publicName: "inputStyle", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, 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 }, type: { classPropertyName: "type", publicName: "type", 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: { inputBlur: "inputBlur", inputFocus: "inputFocus", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-disabled": "disabled() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null", "attr.data-invalid": "invalidInput() || null", "class": "classes()" } }, queries: [{ propertyName: "prefixTemplateList", predicate: TextBoxPrefixTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplateList", predicate: TextBoxSuffixTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\r\n <span class=\"flex items-center flex-wrap h-full\">\r\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\r\n </span>\r\n}\r\n<input\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [required]=\"required()\"\r\n [placeholder]=\"placeholder()\"\r\n [type]=\"type()\"\r\n [class]=\"inputClass()\"\r\n [style]=\"inputStyle()\"\r\n [attr.aria-invalid]=\"invalidInput() ? 'true' : null\"\r\n [monaAttributeBinder]=\"inputAttributes()\"\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (blur)=\"onInputBlur($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n #input />\r\n\r\n@let textBoxValue = value();\r\n@if (clearButton() && textBoxValue && textBoxValue.length !== 0) {\r\n <button monaButton look=\"link\" size=\"small\" class=\"p-0 mr-2\" aria-label=\"Clear\" (click)=\"onClearClick()\">\r\n <svg lucideX class=\"opacity-50 size-4 hover:opacity-90\"></svg>\r\n </button>\r\n}\r\n\r\n@for (suffixTemplate of suffixTemplateList(); track $index) {\r\n <span class=\"flex items-center flex-wrap h-full\">\r\n <ng-container *ngTemplateOutlet=\"suffixTemplate\"></ng-container>\r\n </span>\r\n}\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: AttributeBinderDirective, selector: "[monaAttributeBinder]", inputs: ["monaAttributeBinder"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
304
+ }
305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxComponent, decorators: [{
306
+ type: Component,
307
+ args: [{ selector: "mona-text-box", imports: [NgTemplateOutlet, FormsModule, ButtonDirective, AttributeBinderDirective, LucideX], host: {
308
+ "[attr.data-disabled]": "disabled() || null",
309
+ "[attr.data-readonly]": "readonly() || null",
310
+ "[attr.data-required]": "required() || null",
311
+ "[attr.data-invalid]": "invalidInput() || null",
312
+ "[class]": "classes()"
313
+ }, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\r\n <span class=\"flex items-center flex-wrap h-full\">\r\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\r\n </span>\r\n}\r\n<input\r\n [disabled]=\"disabled()\"\r\n [readonly]=\"readonly()\"\r\n [required]=\"required()\"\r\n [placeholder]=\"placeholder()\"\r\n [type]=\"type()\"\r\n [class]=\"inputClass()\"\r\n [style]=\"inputStyle()\"\r\n [attr.aria-invalid]=\"invalidInput() ? 'true' : null\"\r\n [monaAttributeBinder]=\"inputAttributes()\"\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (blur)=\"onInputBlur($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n #input />\r\n\r\n@let textBoxValue = value();\r\n@if (clearButton() && textBoxValue && textBoxValue.length !== 0) {\r\n <button monaButton look=\"link\" size=\"small\" class=\"p-0 mr-2\" aria-label=\"Clear\" (click)=\"onClearClick()\">\r\n <svg lucideX class=\"opacity-50 size-4 hover:opacity-90\"></svg>\r\n </button>\r\n}\r\n\r\n@for (suffixTemplate of suffixTemplateList(); track $index) {\r\n <span class=\"flex items-center flex-wrap h-full\">\r\n <ng-container *ngTemplateOutlet=\"suffixTemplate\"></ng-container>\r\n </span>\r\n}\r\n" }]
314
+ }], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ["input", { isSignal: true }] }], prefixTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TextBoxPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], suffixTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TextBoxSuffixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], clearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearButton", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputAttributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputAttributes", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], inputStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputStyle", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], 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 }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", 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"] }] } });
315
+
316
+ class TextBoxDirective {
317
+ constructor() {
318
+ this.#themeService = inject(ThemeService);
319
+ this.classes = computed(() => {
320
+ const rounded = this.rounded();
321
+ const size = this.size();
322
+ const theme = this.#themeService.theme();
323
+ const classes = inputThemeVariants(theme)({ rounded, size });
324
+ const userClass = this.userClass();
325
+ return twMerge(classes, userClass);
326
+ }, /* @ts-ignore */
327
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
328
+ /**
329
+ * @description Border-radius preset applied to the component.
330
+ * @default "medium"
331
+ */
332
+ this.rounded = input("medium", /* @ts-ignore */
333
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
334
+ /**
335
+ * @description Size preset controlling the component's dimensions.
336
+ * @default "medium"
337
+ */
338
+ this.size = input("medium", /* @ts-ignore */
339
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
340
+ /**
341
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
342
+ * @default ""
343
+ */
344
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
345
+ }
346
+ #themeService;
347
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
348
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TextBoxDirective, isStandalone: true, selector: "input[monaTextBox]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0 }); }
349
+ }
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxDirective, decorators: [{
351
+ type: Directive,
352
+ args: [{
353
+ selector: "input[monaTextBox]",
354
+ host: {
355
+ "[class]": "classes()"
356
+ }
357
+ }]
358
+ }], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
359
+
360
+ /*
361
+ * Public API Surface of @nanahoshi/mona-ui/text-box
362
+ */
363
+
364
+ /**
365
+ * Generated bundle index. Do not edit.
366
+ */
367
+
368
+ export { TextBoxComponent, TextBoxDirective, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective };
369
+ //# sourceMappingURL=nanahoshi-mona-ui-text-box.mjs.map