bromcom-ui-next 0.1.3 → 0.1.4

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 (200) hide show
  1. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js.map +1 -1
  3. package/dist/bromcom-ui/global/global.js +14 -15
  4. package/dist/bromcom-ui/p-04f6d730.entry.js +2 -0
  5. package/dist/bromcom-ui/p-04f6d730.entry.js.map +1 -0
  6. package/dist/bromcom-ui/{p-b36f4f44.js → p-12360e4c.js} +1 -1
  7. package/dist/bromcom-ui/p-15fe392b.js +3 -0
  8. package/dist/bromcom-ui/p-15fe392b.js.map +1 -0
  9. package/dist/bromcom-ui/p-1b11150b.entry.js +2 -0
  10. package/dist/bromcom-ui/{p-6430a887.entry.js.map → p-1b11150b.entry.js.map} +1 -1
  11. package/dist/bromcom-ui/p-1d86c1cf.entry.js +2 -0
  12. package/dist/bromcom-ui/p-1d86c1cf.entry.js.map +1 -0
  13. package/dist/bromcom-ui/p-31354aaa.js +2 -0
  14. package/dist/bromcom-ui/p-31354aaa.js.map +1 -0
  15. package/dist/bromcom-ui/p-3b607038.entry.js +2 -0
  16. package/dist/bromcom-ui/p-3b607038.entry.js.map +1 -0
  17. package/dist/bromcom-ui/p-5d0838e9.entry.js +2 -0
  18. package/dist/bromcom-ui/{p-bde58312.entry.js.map → p-5d0838e9.entry.js.map} +1 -1
  19. package/dist/bromcom-ui/p-729a870f.js +2 -0
  20. package/dist/bromcom-ui/p-729a870f.js.map +1 -0
  21. package/dist/bromcom-ui/p-a590f793.entry.js +2 -0
  22. package/dist/bromcom-ui/p-a590f793.entry.js.map +1 -0
  23. package/dist/bromcom-ui/p-cd437280.entry.js +2 -0
  24. package/dist/bromcom-ui/p-cd437280.entry.js.map +1 -0
  25. package/dist/bromcom-ui/{p-dcc13a55.entry.js → p-dcea8d62.entry.js} +2 -2
  26. package/dist/bromcom-ui/{p-3805363a.entry.js → p-ebed10d5.entry.js} +2 -2
  27. package/dist/cjs/app-globals-29edfda4.js +39 -0
  28. package/dist/cjs/app-globals-29edfda4.js.map +1 -0
  29. package/dist/cjs/bcm-accordion-group.cjs.entry.js +3 -3
  30. package/dist/cjs/bcm-accordion-group.cjs.entry.js.map +1 -1
  31. package/dist/cjs/bcm-accordion.cjs.entry.js +7 -7
  32. package/dist/cjs/bcm-accordion.cjs.entry.js.map +1 -1
  33. package/dist/cjs/bcm-alert.cjs.entry.js +1 -1
  34. package/dist/cjs/bcm-avatar_4.cjs.entry.js +577 -0
  35. package/dist/cjs/bcm-avatar_4.cjs.entry.js.map +1 -0
  36. package/dist/cjs/bcm-chip.cjs.entry.js +4 -4
  37. package/dist/cjs/bcm-chip.cjs.entry.js.map +1 -1
  38. package/dist/cjs/bcm-divider.cjs.entry.js +81 -0
  39. package/dist/cjs/bcm-divider.cjs.entry.js.map +1 -0
  40. package/dist/cjs/bcm-input.cjs.entry.js +313 -0
  41. package/dist/cjs/bcm-input.cjs.entry.js.map +1 -0
  42. package/dist/cjs/bcm-text.cjs.entry.js +3 -3
  43. package/dist/cjs/bcm-text.cjs.entry.js.map +1 -1
  44. package/dist/cjs/bcm-textarea.cjs.entry.js +316 -0
  45. package/dist/cjs/bcm-textarea.cjs.entry.js.map +1 -0
  46. package/dist/cjs/bromcom-ui.cjs.js +3 -3
  47. package/dist/cjs/{index-c36002ae.js → index-4795c073.js} +13 -4
  48. package/dist/cjs/index-4795c073.js.map +1 -0
  49. package/dist/{components/p-b36f4f44.js → cjs/index-5a88e57b.js} +5 -3
  50. package/dist/cjs/{index-a4eea4bb.js.map → index-5a88e57b.js.map} +1 -1
  51. package/dist/cjs/loader.cjs.js +3 -3
  52. package/dist/cjs/validation-messages-c36e5c31.js +134 -0
  53. package/dist/cjs/validation-messages-c36e5c31.js.map +1 -0
  54. package/dist/collection/collection-manifest.json +5 -1
  55. package/dist/collection/components/accordion/accordion.component.js +5 -5
  56. package/dist/collection/components/accordion/accordion.component.js.map +1 -1
  57. package/dist/collection/components/accordion/accordion.css +1 -1
  58. package/dist/collection/components/accordion-group/accordion-group.component.js +1 -1
  59. package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -1
  60. package/dist/collection/components/accordion-group/accordion-group.css +1 -1
  61. package/dist/collection/components/avatar/avatar.component.js.map +1 -1
  62. package/dist/collection/components/avatar/avatar.css +1 -1
  63. package/dist/collection/components/badge/badge.component.js +373 -0
  64. package/dist/collection/components/badge/badge.component.js.map +1 -0
  65. package/dist/collection/components/badge/badge.css +1 -0
  66. package/dist/collection/components/basic-badge/basic-badge.component.js +236 -0
  67. package/dist/collection/components/basic-badge/basic-badge.component.js.map +1 -0
  68. package/dist/collection/components/basic-badge/basic-badge.css +1 -0
  69. package/dist/collection/components/button/button.component.js +2 -2
  70. package/dist/collection/components/button/button.css +1 -1
  71. package/dist/collection/components/chip/chip.component.js +2 -2
  72. package/dist/collection/components/chip/chip.component.js.map +1 -1
  73. package/dist/collection/components/chip/chip.css +1 -1
  74. package/dist/collection/components/divider/divider.component.js +190 -0
  75. package/dist/collection/components/divider/divider.component.js.map +1 -0
  76. package/dist/collection/components/divider/divider.css +1 -0
  77. package/dist/collection/components/input/input.component.js +209 -24
  78. package/dist/collection/components/input/input.component.js.map +1 -1
  79. package/dist/collection/components/input/input.css +1 -1
  80. package/dist/collection/components/input/types.js +10 -1
  81. package/dist/collection/components/input/types.js.map +1 -1
  82. package/dist/collection/components/text/text.component.js +1 -1
  83. package/dist/collection/components/textarea/textarea.component.js +1013 -0
  84. package/dist/collection/components/textarea/textarea.component.js.map +1 -0
  85. package/dist/collection/components/textarea/textarea.css +2 -0
  86. package/dist/collection/components/textarea/types.js +2 -0
  87. package/dist/collection/components/textarea/types.js.map +1 -0
  88. package/dist/collection/global/global.js +14 -15
  89. package/dist/collection/utils/i18n.js +29 -0
  90. package/dist/collection/utils/i18n.js.map +1 -0
  91. package/dist/collection/utils/slot/check-slot-content.js +15 -0
  92. package/dist/collection/utils/slot/check-slot-content.js.map +1 -0
  93. package/dist/collection/utils/validation-messages.js +17 -0
  94. package/dist/collection/utils/validation-messages.js.map +1 -0
  95. package/dist/components/bcm-accordion-group.js +3 -3
  96. package/dist/components/bcm-accordion-group.js.map +1 -1
  97. package/dist/components/bcm-accordion.js +7 -7
  98. package/dist/components/bcm-accordion.js.map +1 -1
  99. package/dist/components/bcm-alert.js +1 -1
  100. package/dist/components/bcm-avatar.js +13 -7
  101. package/dist/components/bcm-avatar.js.map +1 -1
  102. package/dist/components/bcm-badge.d.ts +11 -0
  103. package/dist/components/bcm-badge.js +8 -0
  104. package/dist/components/bcm-badge.js.map +1 -0
  105. package/dist/components/bcm-basic-badge.d.ts +11 -0
  106. package/dist/components/bcm-basic-badge.js +113 -0
  107. package/dist/components/bcm-basic-badge.js.map +1 -0
  108. package/dist/components/bcm-button.js +4 -4
  109. package/dist/components/bcm-button.js.map +1 -1
  110. package/dist/components/bcm-chip.js +4 -4
  111. package/dist/components/bcm-chip.js.map +1 -1
  112. package/dist/components/bcm-divider.d.ts +11 -0
  113. package/dist/components/bcm-divider.js +100 -0
  114. package/dist/components/bcm-divider.js.map +1 -0
  115. package/dist/components/bcm-input.js +168 -105
  116. package/dist/components/bcm-input.js.map +1 -1
  117. package/dist/components/bcm-text.js +3 -3
  118. package/dist/components/bcm-text.js.map +1 -1
  119. package/dist/components/bcm-textarea.d.ts +11 -0
  120. package/dist/components/bcm-textarea.js +369 -0
  121. package/dist/components/bcm-textarea.js.map +1 -0
  122. package/dist/components/index.js +12 -16
  123. package/dist/components/index.js.map +1 -1
  124. package/dist/{esm/index-f0e9d579.js → components/p-12360e4c.js} +3 -3
  125. package/dist/components/{p-b36f4f44.js.map → p-12360e4c.js.map} +1 -1
  126. package/dist/components/{p-8ded2c73.js → p-13582168.js} +10 -2
  127. package/dist/components/p-13582168.js.map +1 -0
  128. package/dist/components/p-31354aaa.js +129 -0
  129. package/dist/components/p-31354aaa.js.map +1 -0
  130. package/dist/components/p-39637e05.js +145 -0
  131. package/dist/components/p-39637e05.js.map +1 -0
  132. package/dist/esm/app-globals-bfa07b76.js +37 -0
  133. package/dist/esm/app-globals-bfa07b76.js.map +1 -0
  134. package/dist/esm/bcm-accordion-group.entry.js +3 -3
  135. package/dist/esm/bcm-accordion-group.entry.js.map +1 -1
  136. package/dist/esm/bcm-accordion.entry.js +7 -7
  137. package/dist/esm/bcm-accordion.entry.js.map +1 -1
  138. package/dist/esm/bcm-alert.entry.js +1 -1
  139. package/dist/esm/bcm-avatar_4.entry.js +570 -0
  140. package/dist/esm/bcm-avatar_4.entry.js.map +1 -0
  141. package/dist/esm/bcm-chip.entry.js +4 -4
  142. package/dist/esm/bcm-chip.entry.js.map +1 -1
  143. package/dist/esm/bcm-divider.entry.js +77 -0
  144. package/dist/esm/bcm-divider.entry.js.map +1 -0
  145. package/dist/esm/bcm-input.entry.js +309 -0
  146. package/dist/esm/bcm-input.entry.js.map +1 -0
  147. package/dist/esm/bcm-text.entry.js +3 -3
  148. package/dist/esm/bcm-text.entry.js.map +1 -1
  149. package/dist/esm/bcm-textarea.entry.js +312 -0
  150. package/dist/esm/bcm-textarea.entry.js.map +1 -0
  151. package/dist/esm/bromcom-ui.js +4 -4
  152. package/dist/{cjs/index-a4eea4bb.js → esm/index-097075ad.js} +3 -5
  153. package/dist/esm/{index-f0e9d579.js.map → index-097075ad.js.map} +1 -1
  154. package/dist/esm/{index-e23ee9b0.js → index-27cc1bac.js} +13 -4
  155. package/dist/esm/index-27cc1bac.js.map +1 -0
  156. package/dist/esm/loader.js +4 -4
  157. package/dist/esm/validation-messages-a29d53be.js +129 -0
  158. package/dist/esm/validation-messages-a29d53be.js.map +1 -0
  159. package/dist/types/components/badge/badge.component.d.ts +87 -0
  160. package/dist/types/components/basic-badge/basic-badge.component.d.ts +54 -0
  161. package/dist/types/components/divider/divider.component.d.ts +40 -0
  162. package/dist/types/components/input/input.component.d.ts +19 -0
  163. package/dist/types/components/input/types.d.ts +10 -0
  164. package/dist/types/components/textarea/textarea.component.d.ts +85 -0
  165. package/dist/types/components/textarea/types.d.ts +7 -0
  166. package/dist/types/components.d.ts +643 -0
  167. package/dist/types/utils/i18n.d.ts +8 -0
  168. package/dist/types/utils/slot/check-slot-content.d.ts +7 -0
  169. package/dist/types/utils/validation-messages.d.ts +11 -0
  170. package/package.json +1 -1
  171. package/dist/bromcom-ui/p-047e562f.entry.js +0 -2
  172. package/dist/bromcom-ui/p-047e562f.entry.js.map +0 -1
  173. package/dist/bromcom-ui/p-40643b53.js +0 -2
  174. package/dist/bromcom-ui/p-40643b53.js.map +0 -1
  175. package/dist/bromcom-ui/p-61c030c5.js +0 -3
  176. package/dist/bromcom-ui/p-61c030c5.js.map +0 -1
  177. package/dist/bromcom-ui/p-6430a887.entry.js +0 -2
  178. package/dist/bromcom-ui/p-9e94d920.entry.js +0 -2
  179. package/dist/bromcom-ui/p-9e94d920.entry.js.map +0 -1
  180. package/dist/bromcom-ui/p-bde58312.entry.js +0 -2
  181. package/dist/bromcom-ui/p-e7732b0c.entry.js +0 -2
  182. package/dist/bromcom-ui/p-e7732b0c.entry.js.map +0 -1
  183. package/dist/cjs/app-globals-e8faea0d.js +0 -43
  184. package/dist/cjs/app-globals-e8faea0d.js.map +0 -1
  185. package/dist/cjs/bcm-avatar.cjs.entry.js +0 -89
  186. package/dist/cjs/bcm-avatar.cjs.entry.js.map +0 -1
  187. package/dist/cjs/bcm-button_2.cjs.entry.js +0 -549
  188. package/dist/cjs/bcm-button_2.cjs.entry.js.map +0 -1
  189. package/dist/cjs/index-c36002ae.js.map +0 -1
  190. package/dist/components/p-8ded2c73.js.map +0 -1
  191. package/dist/esm/app-globals-f781c325.js +0 -41
  192. package/dist/esm/app-globals-f781c325.js.map +0 -1
  193. package/dist/esm/bcm-avatar.entry.js +0 -85
  194. package/dist/esm/bcm-avatar.entry.js.map +0 -1
  195. package/dist/esm/bcm-button_2.entry.js +0 -544
  196. package/dist/esm/bcm-button_2.entry.js.map +0 -1
  197. package/dist/esm/index-e23ee9b0.js.map +0 -1
  198. /package/dist/bromcom-ui/{p-b36f4f44.js.map → p-12360e4c.js.map} +0 -0
  199. /package/dist/bromcom-ui/{p-dcc13a55.entry.js.map → p-dcea8d62.entry.js.map} +0 -0
  200. /package/dist/bromcom-ui/{p-3805363a.entry.js.map → p-ebed10d5.entry.js.map} +0 -0
@@ -0,0 +1,1013 @@
1
+ import { h } from "@stencil/core";
2
+ import { tv } from "tailwind-variants";
3
+ import classNames from "classnames";
4
+ import { generateId } from "../../utils/id/generate-id";
5
+ // import { checkSlotContent } from '../../utils/slot/check-slot-content';
6
+ import { getValidationMessage, setValidationMessages, defaultValidationMessages } from "../../utils/validation-messages";
7
+ export class BcmTextarea {
8
+ constructor() {
9
+ this.isFocused = false;
10
+ this.isValid = true;
11
+ this.internalStatus = 'default';
12
+ /** Textarea value */
13
+ this.value = '';
14
+ /** Textarea rows */
15
+ this.rows = 3;
16
+ /** Resize behavior */
17
+ this.resize = 'none';
18
+ /** Auto grow height based on content */
19
+ this.autoGrow = false;
20
+ /** Input id */
21
+ this._id = generateId('textarea');
22
+ /** Controls the textarea size */
23
+ this.size = 'medium';
24
+ /** Defines the textarea's status/state */
25
+ this.status = 'default';
26
+ /** Full width textarea */
27
+ this.fullWidth = false;
28
+ /** Whether the textarea is disabled */
29
+ this.disabled = false;
30
+ /** Whether the textarea is readonly */
31
+ this.readonly = false;
32
+ /** Whether the textarea is required */
33
+ this.required = false;
34
+ /** Show character counter */
35
+ this.showCounter = true;
36
+ this.onChange = (event) => {
37
+ this.bcmChange.emit(event);
38
+ };
39
+ this.onFocus = (event) => {
40
+ this.isFocused = true;
41
+ this.bcmFocus.emit(event);
42
+ };
43
+ this.onBlur = (event) => {
44
+ this.isFocused = false;
45
+ this.bcmBlur.emit(event);
46
+ this.validateInput();
47
+ };
48
+ this.onKeyDown = (event) => {
49
+ this.bcmKeyDown.emit(event);
50
+ };
51
+ this.onKeyUp = (event) => {
52
+ this.bcmKeyUp.emit(event);
53
+ };
54
+ this.styleClass = tv({
55
+ slots: {
56
+ base: [
57
+ 'bcm-textarea bcm-textarea__container',
58
+ 'bg-[--bcm-ui-color-background-base-default]',
59
+ 'border border-solid rounded',
60
+ 'flex flex-col', // flex-col ekledik
61
+ 'transition-colors duration-200',
62
+ 'px-2 py-2',
63
+ 'w-full', // w-full ekledik
64
+ ],
65
+ textareaClass: [
66
+ 'textarea',
67
+ 'w-full',
68
+ 'border-0 outline-0 bg-transparent',
69
+ 'appearance-none',
70
+ 'text-[--bcm-ui-color-text-default] placeholder:text-[--bcm-ui-color-text-placeholder] placeholder:font-normal',
71
+ 'font-sans antialiased font-medium',
72
+ 'px-1',
73
+ 'overflow-y-auto', // overflow-y-auto ekledik
74
+ 'min-h-0', // min-h-0 ekledik
75
+ ],
76
+ counterText: ['textarea-counter-text', 'text-[--bcm-ui-color-text-placeholder]', 'text-right', 'mt-1'],
77
+ },
78
+ variants: {
79
+ size: {
80
+ small: {
81
+ base: '',
82
+ textareaClass: 'text-size-4 min-h-[3rem]',
83
+ counterText: 'text-size-3',
84
+ },
85
+ medium: {
86
+ base: '',
87
+ textareaClass: 'text-size-5 min-h-[4rem]',
88
+ counterText: 'text-size-4',
89
+ },
90
+ large: {
91
+ base: '',
92
+ textareaClass: 'text-size-6 min-h-[5rem]',
93
+ counterText: 'text-size-5',
94
+ },
95
+ },
96
+ resize: {
97
+ none: { textareaClass: '!resize-none' },
98
+ both: { textareaClass: '!resize' },
99
+ horizontal: { textareaClass: '!resize-x' },
100
+ vertical: { textareaClass: '!resize-y' },
101
+ },
102
+ status: {
103
+ default: {
104
+ base: ['border-[--bcm-ui-color-border-default]', 'hover:border-[--bcm-ui-color-border-primary]', 'has-[:focus]:border-[--bcm-ui-color-border-primary]'],
105
+ },
106
+ error: {
107
+ base: ['border-[--bcm-ui-color-border-error]', 'hover:border-[--bcm-ui-color-border-error]', 'has-[:focus]:border-[--bcm-ui-color-border-error]'],
108
+ },
109
+ success: {
110
+ base: ['border-[--bcm-ui-color-border-success]', 'hover:border-[--bcm-ui-color-border-success]', 'has-[:focus]:border-[--bcm-ui-color-border-success]'],
111
+ },
112
+ warning: {
113
+ base: ['border-[--bcm-ui-color-border-warning]', 'hover:border-[--bcm-ui-color-border-warning]', 'has-[:focus]:border-[--bcm-ui-color-border-warning]'],
114
+ },
115
+ info: {
116
+ base: ['border-[--bcm-ui-color-border-info]', 'hover:border-[--bcm-ui-color-border-info]', 'has-[:focus]:border-[--bcm-ui-color-border-info]'],
117
+ },
118
+ },
119
+ fullWidth: {
120
+ true: 'full-width w-full',
121
+ },
122
+ disabled: {
123
+ true: {
124
+ base: 'disabled cursor-not-allowed opacity-50',
125
+ textareaClass: '!resize-none', // disabled durumunda resize'ı engelle
126
+ },
127
+ false: '',
128
+ },
129
+ focused: {
130
+ true: {
131
+ base: 'ring-2 ring-[--bcm-ui-color-border-primary] ring-opacity-50',
132
+ },
133
+ false: '',
134
+ },
135
+ },
136
+ defaultVariants: {
137
+ size: 'medium',
138
+ status: 'default',
139
+ resize: 'vertical',
140
+ fullWidth: false,
141
+ disabled: false,
142
+ focused: false,
143
+ },
144
+ }, {
145
+ twMerge: false,
146
+ });
147
+ }
148
+ handleValueChange(newValue) {
149
+ if (this.textareaRef) {
150
+ this.textareaRef.value = newValue;
151
+ if (this.autoGrow) {
152
+ this.adjustHeight();
153
+ }
154
+ }
155
+ }
156
+ watchStatus(newValue) {
157
+ this.internalStatus = newValue;
158
+ }
159
+ watchErrorMessage(newValue) {
160
+ this.internalErrorMessage = newValue;
161
+ }
162
+ componentWillLoad() {
163
+ setValidationMessages('en', defaultValidationMessages);
164
+ this.internalStatus = this.status;
165
+ this.internalErrorMessage = this.errorMessage;
166
+ }
167
+ componentDidLoad() {
168
+ var _a;
169
+ if (this.autoGrow) {
170
+ this.adjustHeight();
171
+ // Input event'ini dinle
172
+ (_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.addEventListener('input', () => this.adjustHeight());
173
+ }
174
+ }
175
+ disconnectedCallback() {
176
+ // Event listener'ı temizle
177
+ if (this.autoGrow && this.textareaRef) {
178
+ this.textareaRef.removeEventListener('input', () => this.adjustHeight());
179
+ }
180
+ }
181
+ async setFocus() {
182
+ var _a;
183
+ (_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.focus();
184
+ }
185
+ async setBlur() {
186
+ var _a;
187
+ (_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.blur();
188
+ }
189
+ async select() {
190
+ var _a;
191
+ (_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.select();
192
+ }
193
+ adjustHeight() {
194
+ if (!this.autoGrow || !this.textareaRef)
195
+ return;
196
+ requestAnimationFrame(() => {
197
+ // Önce height'ı sıfırla ki scrollHeight doğru hesaplansın
198
+ this.textareaRef.style.height = '0px';
199
+ const computedStyle = getComputedStyle(this.textareaRef);
200
+ const lineHeight = parseInt(computedStyle.lineHeight);
201
+ const paddingTop = parseInt(computedStyle.paddingTop);
202
+ const paddingBottom = parseInt(computedStyle.paddingBottom);
203
+ const scrollHeight = this.textareaRef.scrollHeight;
204
+ let newHeight = scrollHeight;
205
+ // Min/max kontrolleri
206
+ if (this.minRows) {
207
+ const minHeight = this.minRows * lineHeight + paddingTop + paddingBottom;
208
+ newHeight = Math.max(newHeight, minHeight);
209
+ }
210
+ if (this.maxRows) {
211
+ const maxHeight = this.maxRows * lineHeight + paddingTop + paddingBottom;
212
+ newHeight = Math.min(newHeight, maxHeight);
213
+ }
214
+ this.textareaRef.style.height = `${newHeight}px`;
215
+ });
216
+ }
217
+ validateInput() {
218
+ if (!this.textareaRef)
219
+ return;
220
+ // Reset validation state
221
+ this.isValid = true;
222
+ this.validationMessage = '';
223
+ const value = this.textareaRef.value;
224
+ // Required check
225
+ if (this.required && !value) {
226
+ this.isValid = false;
227
+ this.validationMessage = getValidationMessage('required');
228
+ this.internalStatus = 'error';
229
+ this.internalErrorMessage = this.validationMessage;
230
+ return;
231
+ }
232
+ // Minimum length check
233
+ if (this.minLength && value.length < this.minLength) {
234
+ this.isValid = false;
235
+ this.validationMessage = getValidationMessage('minlength', { min: this.minLength });
236
+ }
237
+ // Maximum length check
238
+ else if (this.maxLength && value.length > this.maxLength) {
239
+ this.isValid = false;
240
+ this.validationMessage = getValidationMessage('maxlength', { max: this.maxLength });
241
+ }
242
+ // Custom validator
243
+ if (this.validator) {
244
+ const customError = this.validator(value);
245
+ if (customError) {
246
+ this.isValid = false;
247
+ this.validationMessage = customError;
248
+ }
249
+ }
250
+ // Update component state
251
+ this.internalStatus = this.isValid ? 'default' : 'error';
252
+ this.internalErrorMessage = this.validationMessage;
253
+ }
254
+ render() {
255
+ const textareaId = this._id + '-textarea' || this.name;
256
+ const { base, textareaClass, counterText } = this.styleClass({
257
+ size: this.size,
258
+ status: this.internalStatus,
259
+ resize: this.resize,
260
+ fullWidth: this.fullWidth,
261
+ disabled: this.disabled,
262
+ focused: this.isFocused,
263
+ });
264
+ return (h("div", { key: '3b518823eafee23f5efb8fecdd1869cb0625f712', class: "bcm-ui-element" }, this.label && (h("label", { key: '17851980564ab95c9a1ac30fa494c3b4ef50f75b', class: classNames('textarea-label font-medium', {
265
+ 'text-color-label': !this.disabled,
266
+ 'text-color-disabled': this.disabled,
267
+ }, {
268
+ 'text-size-3': this.size === 'small',
269
+ 'text-size-4': this.size === 'medium',
270
+ 'text-size-5': this.size === 'large',
271
+ }), htmlFor: textareaId }, h("slot", { key: '3a0c9c5d95ac3389f3d48d41577b88ee21dfb940', name: "label" }, this.label), this.required && h("span", { key: 'fd499a157c4ff22f17feaabcbe7c5a2d2d75e35b' }, "*"))), h("div", { key: '625e4a27c30495aaf39259e8ac68bc1d819fd506', class: base() }, h("textarea", { key: 'be30548713a724d4f535885c7b6838fb056d0b3d', ref: el => (this.textareaRef = el), id: textareaId, class: textareaClass(), name: this.name, rows: this.rows, cols: this.cols, disabled: this.disabled, readonly: this.readonly, required: this.required, placeholder: this.placeholder, minLength: this.minLength, maxLength: this.maxLength, "aria-invalid": this.status === 'error', "aria-required": this.required, "aria-labelledby": this.labelledby, "aria-describedby": this.describedby, value: this.value, onInput: event => {
272
+ const target = event.target;
273
+ this.value = target.value;
274
+ this.bcmInput.emit(event);
275
+ this.validateInput();
276
+ if (this.autoGrow) {
277
+ this.adjustHeight();
278
+ }
279
+ }, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown, onKeyUp: this.onKeyUp }), this.showCounter && (h("div", { key: '1ebabb979efac47054160558fab66d4fccc603f9', class: counterText() }, this.value.length, this.maxLength ? `/${this.maxLength}` : ''))), (this.captionText || this.internalErrorMessage || this.validationMessage) && (h("div", { key: '1c7f59c0d4337c7c359dc9aea3e332e5715bf80d', class: classNames('textarea-caption-text font-regular mt-1', {
280
+ 'text-[--bcm-ui-color-text-caption]': !this.disabled && this.internalStatus === 'default',
281
+ 'text-[--bcm-ui-color-text-error]': !this.disabled && (this.internalStatus === 'error' || !this.isValid),
282
+ 'text-[--bcm-ui-color-text-success]': !this.disabled && this.internalStatus === 'success',
283
+ 'text-[--bcm-ui-color-text-warning]': !this.disabled && this.internalStatus === 'warning',
284
+ 'text-[--bcm-ui-color-text-info]': !this.disabled && this.internalStatus === 'info',
285
+ 'text-[--bcm-ui-color-text-disabled]': this.disabled,
286
+ }, {
287
+ 'text-size-3': this.size === 'small',
288
+ 'text-size-4': this.size === 'medium',
289
+ 'text-size-5': this.size === 'large',
290
+ }) }, !this.isValid ? this.validationMessage : this.internalStatus === 'error' ? this.internalErrorMessage : this.captionText))));
291
+ }
292
+ static get is() { return "bcm-textarea"; }
293
+ static get encapsulation() { return "shadow"; }
294
+ static get originalStyleUrls() {
295
+ return {
296
+ "$": ["textarea.scss"]
297
+ };
298
+ }
299
+ static get styleUrls() {
300
+ return {
301
+ "$": ["textarea.css"]
302
+ };
303
+ }
304
+ static get properties() {
305
+ return {
306
+ "value": {
307
+ "type": "string",
308
+ "mutable": true,
309
+ "complexType": {
310
+ "original": "string",
311
+ "resolved": "string",
312
+ "references": {}
313
+ },
314
+ "required": false,
315
+ "optional": false,
316
+ "docs": {
317
+ "tags": [],
318
+ "text": "Textarea value"
319
+ },
320
+ "getter": false,
321
+ "setter": false,
322
+ "attribute": "value",
323
+ "reflect": true,
324
+ "defaultValue": "''"
325
+ },
326
+ "rows": {
327
+ "type": "number",
328
+ "mutable": false,
329
+ "complexType": {
330
+ "original": "number",
331
+ "resolved": "number",
332
+ "references": {}
333
+ },
334
+ "required": false,
335
+ "optional": true,
336
+ "docs": {
337
+ "tags": [],
338
+ "text": "Textarea rows"
339
+ },
340
+ "getter": false,
341
+ "setter": false,
342
+ "attribute": "rows",
343
+ "reflect": false,
344
+ "defaultValue": "3"
345
+ },
346
+ "cols": {
347
+ "type": "number",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "number",
351
+ "resolved": "number",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": true,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "Textarea cols"
359
+ },
360
+ "getter": false,
361
+ "setter": false,
362
+ "attribute": "cols",
363
+ "reflect": false
364
+ },
365
+ "minRows": {
366
+ "type": "number",
367
+ "mutable": false,
368
+ "complexType": {
369
+ "original": "number",
370
+ "resolved": "number",
371
+ "references": {}
372
+ },
373
+ "required": false,
374
+ "optional": true,
375
+ "docs": {
376
+ "tags": [],
377
+ "text": "Minimum height in rows"
378
+ },
379
+ "getter": false,
380
+ "setter": false,
381
+ "attribute": "min-rows",
382
+ "reflect": false
383
+ },
384
+ "maxRows": {
385
+ "type": "number",
386
+ "mutable": false,
387
+ "complexType": {
388
+ "original": "number",
389
+ "resolved": "number",
390
+ "references": {}
391
+ },
392
+ "required": false,
393
+ "optional": true,
394
+ "docs": {
395
+ "tags": [],
396
+ "text": "Maximum height in rows"
397
+ },
398
+ "getter": false,
399
+ "setter": false,
400
+ "attribute": "max-rows",
401
+ "reflect": false
402
+ },
403
+ "resize": {
404
+ "type": "string",
405
+ "mutable": false,
406
+ "complexType": {
407
+ "original": "TextareaResize",
408
+ "resolved": "\"both\" | \"horizontal\" | \"none\" | \"vertical\"",
409
+ "references": {
410
+ "TextareaResize": {
411
+ "location": "import",
412
+ "path": "./types",
413
+ "id": "src/components/textarea/types.ts::TextareaResize"
414
+ }
415
+ }
416
+ },
417
+ "required": false,
418
+ "optional": false,
419
+ "docs": {
420
+ "tags": [],
421
+ "text": "Resize behavior"
422
+ },
423
+ "getter": false,
424
+ "setter": false,
425
+ "attribute": "resize",
426
+ "reflect": false,
427
+ "defaultValue": "'none'"
428
+ },
429
+ "autoGrow": {
430
+ "type": "boolean",
431
+ "mutable": false,
432
+ "complexType": {
433
+ "original": "boolean",
434
+ "resolved": "boolean",
435
+ "references": {}
436
+ },
437
+ "required": false,
438
+ "optional": false,
439
+ "docs": {
440
+ "tags": [],
441
+ "text": "Auto grow height based on content"
442
+ },
443
+ "getter": false,
444
+ "setter": false,
445
+ "attribute": "auto-grow",
446
+ "reflect": false,
447
+ "defaultValue": "false"
448
+ },
449
+ "placeholder": {
450
+ "type": "string",
451
+ "mutable": false,
452
+ "complexType": {
453
+ "original": "string",
454
+ "resolved": "string",
455
+ "references": {}
456
+ },
457
+ "required": false,
458
+ "optional": true,
459
+ "docs": {
460
+ "tags": [],
461
+ "text": "Input placeholder text"
462
+ },
463
+ "getter": false,
464
+ "setter": false,
465
+ "attribute": "placeholder",
466
+ "reflect": false
467
+ },
468
+ "name": {
469
+ "type": "string",
470
+ "mutable": false,
471
+ "complexType": {
472
+ "original": "string",
473
+ "resolved": "string",
474
+ "references": {}
475
+ },
476
+ "required": false,
477
+ "optional": true,
478
+ "docs": {
479
+ "tags": [],
480
+ "text": "Input name"
481
+ },
482
+ "getter": false,
483
+ "setter": false,
484
+ "attribute": "name",
485
+ "reflect": false
486
+ },
487
+ "_id": {
488
+ "type": "string",
489
+ "mutable": false,
490
+ "complexType": {
491
+ "original": "string",
492
+ "resolved": "string",
493
+ "references": {}
494
+ },
495
+ "required": false,
496
+ "optional": true,
497
+ "docs": {
498
+ "tags": [],
499
+ "text": "Input id"
500
+ },
501
+ "getter": false,
502
+ "setter": false,
503
+ "attribute": "id",
504
+ "reflect": true,
505
+ "defaultValue": "generateId('textarea')"
506
+ },
507
+ "size": {
508
+ "type": "string",
509
+ "mutable": false,
510
+ "complexType": {
511
+ "original": "InputSize",
512
+ "resolved": "\"large\" | \"medium\" | \"small\"",
513
+ "references": {
514
+ "InputSize": {
515
+ "location": "import",
516
+ "path": "./types",
517
+ "id": "src/components/textarea/types.ts::InputSize"
518
+ }
519
+ }
520
+ },
521
+ "required": false,
522
+ "optional": false,
523
+ "docs": {
524
+ "tags": [],
525
+ "text": "Controls the textarea size"
526
+ },
527
+ "getter": false,
528
+ "setter": false,
529
+ "attribute": "size",
530
+ "reflect": false,
531
+ "defaultValue": "'medium'"
532
+ },
533
+ "status": {
534
+ "type": "string",
535
+ "mutable": false,
536
+ "complexType": {
537
+ "original": "InputStatus",
538
+ "resolved": "\"default\" | \"error\" | \"info\" | \"success\" | \"warning\"",
539
+ "references": {
540
+ "InputStatus": {
541
+ "location": "import",
542
+ "path": "./types",
543
+ "id": "src/components/textarea/types.ts::InputStatus"
544
+ }
545
+ }
546
+ },
547
+ "required": false,
548
+ "optional": false,
549
+ "docs": {
550
+ "tags": [],
551
+ "text": "Defines the textarea's status/state"
552
+ },
553
+ "getter": false,
554
+ "setter": false,
555
+ "attribute": "status",
556
+ "reflect": false,
557
+ "defaultValue": "'default'"
558
+ },
559
+ "fullWidth": {
560
+ "type": "boolean",
561
+ "mutable": false,
562
+ "complexType": {
563
+ "original": "boolean",
564
+ "resolved": "boolean",
565
+ "references": {}
566
+ },
567
+ "required": false,
568
+ "optional": false,
569
+ "docs": {
570
+ "tags": [],
571
+ "text": "Full width textarea"
572
+ },
573
+ "getter": false,
574
+ "setter": false,
575
+ "attribute": "full-width",
576
+ "reflect": true,
577
+ "defaultValue": "false"
578
+ },
579
+ "disabled": {
580
+ "type": "boolean",
581
+ "mutable": false,
582
+ "complexType": {
583
+ "original": "boolean",
584
+ "resolved": "boolean",
585
+ "references": {}
586
+ },
587
+ "required": false,
588
+ "optional": false,
589
+ "docs": {
590
+ "tags": [],
591
+ "text": "Whether the textarea is disabled"
592
+ },
593
+ "getter": false,
594
+ "setter": false,
595
+ "attribute": "disabled",
596
+ "reflect": false,
597
+ "defaultValue": "false"
598
+ },
599
+ "readonly": {
600
+ "type": "boolean",
601
+ "mutable": false,
602
+ "complexType": {
603
+ "original": "boolean",
604
+ "resolved": "boolean",
605
+ "references": {}
606
+ },
607
+ "required": false,
608
+ "optional": false,
609
+ "docs": {
610
+ "tags": [],
611
+ "text": "Whether the textarea is readonly"
612
+ },
613
+ "getter": false,
614
+ "setter": false,
615
+ "attribute": "readonly",
616
+ "reflect": false,
617
+ "defaultValue": "false"
618
+ },
619
+ "required": {
620
+ "type": "boolean",
621
+ "mutable": false,
622
+ "complexType": {
623
+ "original": "boolean",
624
+ "resolved": "boolean",
625
+ "references": {}
626
+ },
627
+ "required": false,
628
+ "optional": false,
629
+ "docs": {
630
+ "tags": [],
631
+ "text": "Whether the textarea is required"
632
+ },
633
+ "getter": false,
634
+ "setter": false,
635
+ "attribute": "required",
636
+ "reflect": false,
637
+ "defaultValue": "false"
638
+ },
639
+ "minLength": {
640
+ "type": "number",
641
+ "mutable": false,
642
+ "complexType": {
643
+ "original": "number",
644
+ "resolved": "number",
645
+ "references": {}
646
+ },
647
+ "required": false,
648
+ "optional": true,
649
+ "docs": {
650
+ "tags": [],
651
+ "text": "Min length for text input"
652
+ },
653
+ "getter": false,
654
+ "setter": false,
655
+ "attribute": "min-length",
656
+ "reflect": false
657
+ },
658
+ "maxLength": {
659
+ "type": "number",
660
+ "mutable": false,
661
+ "complexType": {
662
+ "original": "number",
663
+ "resolved": "number",
664
+ "references": {}
665
+ },
666
+ "required": false,
667
+ "optional": true,
668
+ "docs": {
669
+ "tags": [],
670
+ "text": "Max length for text input"
671
+ },
672
+ "getter": false,
673
+ "setter": false,
674
+ "attribute": "max-length",
675
+ "reflect": false
676
+ },
677
+ "showCounter": {
678
+ "type": "boolean",
679
+ "mutable": false,
680
+ "complexType": {
681
+ "original": "boolean",
682
+ "resolved": "boolean",
683
+ "references": {}
684
+ },
685
+ "required": false,
686
+ "optional": false,
687
+ "docs": {
688
+ "tags": [],
689
+ "text": "Show character counter"
690
+ },
691
+ "getter": false,
692
+ "setter": false,
693
+ "attribute": "show-counter",
694
+ "reflect": false,
695
+ "defaultValue": "true"
696
+ },
697
+ "label": {
698
+ "type": "string",
699
+ "mutable": false,
700
+ "complexType": {
701
+ "original": "string",
702
+ "resolved": "string",
703
+ "references": {}
704
+ },
705
+ "required": false,
706
+ "optional": true,
707
+ "docs": {
708
+ "tags": [],
709
+ "text": "Textarea label for accessibility"
710
+ },
711
+ "getter": false,
712
+ "setter": false,
713
+ "attribute": "label",
714
+ "reflect": false
715
+ },
716
+ "errorMessage": {
717
+ "type": "string",
718
+ "mutable": false,
719
+ "complexType": {
720
+ "original": "string",
721
+ "resolved": "string",
722
+ "references": {}
723
+ },
724
+ "required": false,
725
+ "optional": true,
726
+ "docs": {
727
+ "tags": [],
728
+ "text": "Error message to display"
729
+ },
730
+ "getter": false,
731
+ "setter": false,
732
+ "attribute": "error-message",
733
+ "reflect": false
734
+ },
735
+ "captionText": {
736
+ "type": "string",
737
+ "mutable": false,
738
+ "complexType": {
739
+ "original": "string",
740
+ "resolved": "string",
741
+ "references": {}
742
+ },
743
+ "required": false,
744
+ "optional": true,
745
+ "docs": {
746
+ "tags": [],
747
+ "text": "Caption text to display below textarea"
748
+ },
749
+ "getter": false,
750
+ "setter": false,
751
+ "attribute": "caption-text",
752
+ "reflect": false
753
+ },
754
+ "labelledby": {
755
+ "type": "string",
756
+ "mutable": false,
757
+ "complexType": {
758
+ "original": "string",
759
+ "resolved": "string",
760
+ "references": {}
761
+ },
762
+ "required": false,
763
+ "optional": true,
764
+ "docs": {
765
+ "tags": [],
766
+ "text": "ID of associated label element"
767
+ },
768
+ "getter": false,
769
+ "setter": false,
770
+ "attribute": "labelledby",
771
+ "reflect": false
772
+ },
773
+ "describedby": {
774
+ "type": "string",
775
+ "mutable": false,
776
+ "complexType": {
777
+ "original": "string",
778
+ "resolved": "string",
779
+ "references": {}
780
+ },
781
+ "required": false,
782
+ "optional": true,
783
+ "docs": {
784
+ "tags": [],
785
+ "text": "ID of associated caption/error text element"
786
+ },
787
+ "getter": false,
788
+ "setter": false,
789
+ "attribute": "describedby",
790
+ "reflect": false
791
+ },
792
+ "validator": {
793
+ "type": "unknown",
794
+ "mutable": false,
795
+ "complexType": {
796
+ "original": "(value: string) => string | undefined",
797
+ "resolved": "(value: string) => string",
798
+ "references": {}
799
+ },
800
+ "required": false,
801
+ "optional": true,
802
+ "docs": {
803
+ "tags": [],
804
+ "text": "Custom validation function"
805
+ },
806
+ "getter": false,
807
+ "setter": false
808
+ }
809
+ };
810
+ }
811
+ static get states() {
812
+ return {
813
+ "isFocused": {},
814
+ "validationMessage": {},
815
+ "isValid": {},
816
+ "internalStatus": {},
817
+ "internalErrorMessage": {}
818
+ };
819
+ }
820
+ static get events() {
821
+ return [{
822
+ "method": "bcmInput",
823
+ "name": "bcmInput",
824
+ "bubbles": false,
825
+ "cancelable": true,
826
+ "composed": false,
827
+ "docs": {
828
+ "tags": [],
829
+ "text": ""
830
+ },
831
+ "complexType": {
832
+ "original": "InputEvent",
833
+ "resolved": "InputEvent",
834
+ "references": {
835
+ "InputEvent": {
836
+ "location": "global",
837
+ "id": "global::InputEvent"
838
+ }
839
+ }
840
+ }
841
+ }, {
842
+ "method": "bcmChange",
843
+ "name": "bcmChange",
844
+ "bubbles": false,
845
+ "cancelable": true,
846
+ "composed": false,
847
+ "docs": {
848
+ "tags": [],
849
+ "text": ""
850
+ },
851
+ "complexType": {
852
+ "original": "Event",
853
+ "resolved": "Event",
854
+ "references": {
855
+ "Event": {
856
+ "location": "import",
857
+ "path": "@stencil/core",
858
+ "id": "node_modules::Event"
859
+ }
860
+ }
861
+ }
862
+ }, {
863
+ "method": "bcmFocus",
864
+ "name": "bcmFocus",
865
+ "bubbles": false,
866
+ "cancelable": true,
867
+ "composed": false,
868
+ "docs": {
869
+ "tags": [],
870
+ "text": ""
871
+ },
872
+ "complexType": {
873
+ "original": "FocusEvent",
874
+ "resolved": "FocusEvent",
875
+ "references": {
876
+ "FocusEvent": {
877
+ "location": "global",
878
+ "id": "global::FocusEvent"
879
+ }
880
+ }
881
+ }
882
+ }, {
883
+ "method": "bcmBlur",
884
+ "name": "bcmBlur",
885
+ "bubbles": false,
886
+ "cancelable": true,
887
+ "composed": false,
888
+ "docs": {
889
+ "tags": [],
890
+ "text": ""
891
+ },
892
+ "complexType": {
893
+ "original": "FocusEvent",
894
+ "resolved": "FocusEvent",
895
+ "references": {
896
+ "FocusEvent": {
897
+ "location": "global",
898
+ "id": "global::FocusEvent"
899
+ }
900
+ }
901
+ }
902
+ }, {
903
+ "method": "bcmKeyDown",
904
+ "name": "bcmKeyDown",
905
+ "bubbles": false,
906
+ "cancelable": true,
907
+ "composed": false,
908
+ "docs": {
909
+ "tags": [],
910
+ "text": ""
911
+ },
912
+ "complexType": {
913
+ "original": "KeyboardEvent",
914
+ "resolved": "KeyboardEvent",
915
+ "references": {
916
+ "KeyboardEvent": {
917
+ "location": "global",
918
+ "id": "global::KeyboardEvent"
919
+ }
920
+ }
921
+ }
922
+ }, {
923
+ "method": "bcmKeyUp",
924
+ "name": "bcmKeyUp",
925
+ "bubbles": false,
926
+ "cancelable": true,
927
+ "composed": false,
928
+ "docs": {
929
+ "tags": [],
930
+ "text": ""
931
+ },
932
+ "complexType": {
933
+ "original": "KeyboardEvent",
934
+ "resolved": "KeyboardEvent",
935
+ "references": {
936
+ "KeyboardEvent": {
937
+ "location": "global",
938
+ "id": "global::KeyboardEvent"
939
+ }
940
+ }
941
+ }
942
+ }];
943
+ }
944
+ static get methods() {
945
+ return {
946
+ "setFocus": {
947
+ "complexType": {
948
+ "signature": "() => Promise<void>",
949
+ "parameters": [],
950
+ "references": {
951
+ "Promise": {
952
+ "location": "global",
953
+ "id": "global::Promise"
954
+ }
955
+ },
956
+ "return": "Promise<void>"
957
+ },
958
+ "docs": {
959
+ "text": "",
960
+ "tags": []
961
+ }
962
+ },
963
+ "setBlur": {
964
+ "complexType": {
965
+ "signature": "() => Promise<void>",
966
+ "parameters": [],
967
+ "references": {
968
+ "Promise": {
969
+ "location": "global",
970
+ "id": "global::Promise"
971
+ }
972
+ },
973
+ "return": "Promise<void>"
974
+ },
975
+ "docs": {
976
+ "text": "",
977
+ "tags": []
978
+ }
979
+ },
980
+ "select": {
981
+ "complexType": {
982
+ "signature": "() => Promise<void>",
983
+ "parameters": [],
984
+ "references": {
985
+ "Promise": {
986
+ "location": "global",
987
+ "id": "global::Promise"
988
+ }
989
+ },
990
+ "return": "Promise<void>"
991
+ },
992
+ "docs": {
993
+ "text": "",
994
+ "tags": []
995
+ }
996
+ }
997
+ };
998
+ }
999
+ static get elementRef() { return "el"; }
1000
+ static get watchers() {
1001
+ return [{
1002
+ "propName": "value",
1003
+ "methodName": "handleValueChange"
1004
+ }, {
1005
+ "propName": "status",
1006
+ "methodName": "watchStatus"
1007
+ }, {
1008
+ "propName": "errorMessage",
1009
+ "methodName": "watchErrorMessage"
1010
+ }];
1011
+ }
1012
+ }
1013
+ //# sourceMappingURL=textarea.component.js.map