@starasia/input 1.0.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/input.umd.js CHANGED
@@ -1,334 +1,543 @@
1
- (function(b,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],i):(b=typeof globalThis<"u"?globalThis:b||self,i(b.Input={},b.jsxRuntime,b.React))})(this,function(b,i,t){"use strict";const D=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
2
-
3
- * {
4
- margin: 0;
5
- padding: 0;
6
- }
1
+ (function(h,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(h=typeof globalThis<"u"?globalThis:h||self,n(h.Input={},h.jsxRuntime,h.React))})(this,function(h,n,o){"use strict";const pn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
7
2
 
8
3
  :root {
9
- /* spacing */
10
- --starasia-ui-input-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
11
- --starasia-ui-input-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
12
- --starasia-ui-input-spacing-ms: var(--starasia-ui-spacing-12, 12px);
13
- --starasia-ui-input-spacing-md: var(--starasia-ui-spacing-lg, 16px);
14
- --starasia-ui-input-spacing-lg: var(--starasia-ui-spacing-xl, 24px);
15
-
16
- /* color */
17
- /* brand */
18
- --starasia-ui-input-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
19
- --starasia-ui-input-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
20
- --starasia-ui-input-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary, rgba(144, 176, 218, 1));
21
- --starasia-ui-input-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
22
- --starasia-ui-input-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
23
- /* gray */
24
- --starasia-ui-input-color-primary-gray: var(
25
- --starasia-ui-color-gray-700,
26
- rgba(72, 80, 76, 1)
27
- );
28
- --starasia-ui-input-color-secondary-gray: var(
29
- --starasia-ui-color-gray-500,
30
- rgba(120, 134, 127, 1)
31
- );
32
- --starasia-ui-input-color-tertiary-gray: var(
33
- --starasia-ui-color-gray-300,
34
- rgba(174, 182, 178, 1)
35
- );
36
- --starasia-ui-input-color-quaternary-gray: var(
37
- --starasia-ui-color-gray-100,
38
- rgba(239, 243, 248, 1)
39
- );
40
- --starasia-ui-input-color-quinary-gray: var(
41
- --starasia-ui-color-gray-50,
42
- rgba(255, 254, 255, 1)
43
- );
44
- /* red */
45
- --starasia-ui-input-color-primary-red: var(
46
- --starasia-ui-color-red-700,
47
- rgba(164, 19, 60, 1)
48
- );
49
- --starasia-ui-input-color-secondary-red: var(
50
- --starasia-ui-color-red-500,
51
- rgba(255, 77, 109, 1)
52
- );
53
- --starasia-ui-input-color-tertiary-red: var(
54
- --starasia-ui-color-red-300,
55
- rgba(255, 143, 163, 1)
56
- );
57
- --starasia-ui-input-color-quaternary-red: var(
58
- --starasia-ui-color-red-100,
59
- rgba(255, 204, 213, 1)
60
- );
61
- --starasia-ui-input-color-quinary-red: var(
62
- --starasia-ui-color-red-50,
63
- rgba(255, 240, 243, 1)
64
- );
65
- /* orange */
66
- --starasia-ui-input-color-primary-orange: var(
67
- --starasia-ui-color-orange-700,
68
- rgba(152, 104, 0, 1)
69
- );
70
- --starasia-ui-input-color-secondary-orange: var(
71
- --starasia-ui-color-orange-500,
72
- rgba(210, 160, 58, 1)
73
- );
74
- --starasia-ui-input-color-tertiary-orange: var(
75
- --starasia-ui-color-orange-300,
76
- rgba(255, 203, 105, 1)
77
- );
78
- --starasia-ui-input-color-quaternary-orange: var(
79
- --starasia-ui-color-orange-100,
80
- rgba(255, 245, 193, 1)
81
- );
82
- --starasia-ui-input-color-quinary-orange: var(
83
- --starasia-ui-color-orange-50,
84
- rgba(250, 246, 224, 1)
85
- );
86
-
87
- /* text color */
88
- --starasia-ui-text-default: var(--starasia-ui-color-gray-900);
89
- --starasia-ui-color-text: var(--starasia-ui-text-default);
90
-
91
- /* border width */
92
- --starasia-ui-input-border-width: var(--starasia-ui-border, 1px);
93
-
94
- /* border color */
95
- --starasia-ui-color-border: rgba(120, 134, 127, 0.2);
96
-
97
- /* disabled */
98
- --starasia-ui-input-color-disabled-bg: rgba(242, 243, 242, 1);
99
- --starasia-ui-input-color-disabled-text: rgba(147, 158, 153, 1);
100
- --starasia-ui-input-color-addons-bg: rgba(120, 134, 127, 0.1);
101
- --starasia-ui-input-color-addons-bg-disabled: rgba(120, 134, 127, 0.3);
102
-
103
- /* white */
104
- --starasia-ui-input-color-white: var(--starasia-ui-color-gray-50, rgba(255, 254, 255, 1));
4
+ /* Figma design tokens */
5
+ --sa-input-text-primary: #292a2e;
6
+ --sa-input-text-subtle: #505258;
7
+ --sa-input-text-subtlest: #6b6e76;
8
+ --sa-input-text-error: #a4133c;
9
+ --sa-input-text-disable: rgba(24, 26, 25, 0.56);
10
+
11
+ --sa-input-icon-subtle: #505258;
12
+ --sa-input-icon-subtlest: #6b6e76;
13
+ --sa-input-icon-success: #208958;
14
+ --sa-input-icon-disable: rgba(24, 26, 25, 0.56);
15
+
16
+ --sa-input-border-subtle: rgba(11, 18, 14, 0.14);
17
+ --sa-input-border-brand: #1976d2;
18
+ --sa-input-border-brand-subtle: #90caf9;
19
+ --sa-input-border-danger: #c9184a;
20
+ --sa-input-border-danger-subtle: #ffb3c1;
21
+ --sa-input-border-success: #28ac6e;
22
+ --sa-input-border-disabled: rgba(24, 26, 25, 0.56);
23
+
24
+ --sa-input-bg-neutral: #f0f1f2;
25
+ --sa-input-bg-error-subtlest: #fff0f3;
26
+ --sa-input-bg-success-subtlest: #ecfff6;
27
+ --sa-input-accent-subtle: #f0f1f2;
28
+
29
+ --sa-input-radius: 6px;
30
+ --sa-input-padding-x: 12px;
31
+ --sa-input-padding-y: 8px;
32
+ --sa-input-gap: 8px;
33
+ }
34
+
35
+ /* ROOT */
36
+ .sa-tf {
37
+ box-sizing: border-box;
38
+ display: flex;
39
+ flex-direction: column;
40
+ align-items: stretch;
41
+ gap: 8px;
42
+ font-family: "Poppins", sans-serif;
43
+ width: max-content;
44
+ }
45
+ .sa-tf *,
46
+ .sa-tf *::before,
47
+ .sa-tf *::after {
48
+ box-sizing: border-box;
49
+ }
50
+ .sa-tf-fullwidth {
51
+ width: 100%;
52
+ }
105
53
 
106
- /* height */
107
- --starasia-ui-input-height-sm: var(--starasia-ui-h-8, 32px);
108
- /* --starasia-ui-input-height-md: var(--starasia-ui-h-10, 40px); */
109
- --starasia-ui-input-height-md: 38px;
110
- --starasia-ui-input-height-lg: var(--starasia-ui-h-12, 48px);
54
+ /* outside-left layout */
55
+ .sa-tf-label-outside-left {
56
+ flex-direction: row;
57
+ align-items: flex-start;
58
+ gap: 8px;
59
+ }
60
+ .sa-tf-label-outside-left > .sa-tf-label-col {
61
+ width: 40%;
62
+ min-width: 120px;
63
+ display: flex;
64
+ flex-direction: column;
65
+ gap: 8px;
66
+ padding-top: 9.5px;
67
+ }
68
+ .sa-tf-label-outside-left > .sa-tf-input-col {
69
+ flex: 1 1 0;
70
+ min-width: 0;
71
+ display: flex;
72
+ flex-direction: column;
73
+ gap: 8px;
74
+ }
111
75
 
112
- /* border radius */
113
- --starasia-ui-input-border-radius-sm: var(--starasia-ui-radii-md, 8px);
114
- --starasia-ui-input-border-radius-md: var(--starasia-ui-radii-md, 8px);
115
- --starasia-ui-input-border-radius-lg: var(--starasia-ui-radii-lg, 12px);
76
+ /* LABEL ROW */
77
+ .sa-tf-label {
78
+ display: flex;
79
+ align-items: center;
80
+ gap: 4px;
81
+ width: 100%;
82
+ color: var(--sa-input-text-primary);
83
+ font-weight: 500;
84
+ font-size: 14px;
85
+ line-height: normal;
86
+ margin: 0;
87
+ }
88
+ .sa-tf-size-sm .sa-tf-label,
89
+ .sa-tf-size-sm .sa-tf-label-inside-text {
90
+ font-size: 12px;
91
+ }
92
+ .sa-tf-required {
93
+ color: var(--sa-input-text-error);
94
+ font-weight: 500;
95
+ }
96
+ .sa-tf-optional {
97
+ background: var(--sa-input-accent-subtle);
98
+ border: 1px solid var(--sa-input-border-subtle);
99
+ border-radius: 4px;
100
+ padding: 0 8px;
101
+ font-size: 10px;
102
+ font-weight: 500;
103
+ line-height: 18px;
104
+ color: var(--sa-input-text-primary);
105
+ display: inline-flex;
106
+ align-items: center;
107
+ }
116
108
 
117
- --starasia-ui-input-placeholder-color: var(
118
- --starasia-ui-color-gray-200,
119
- rgba(201, 206, 204, 1)
120
- );
109
+ /* DESCRIPTIONS */
110
+ .sa-tf-desc-top,
111
+ .sa-tf-helper,
112
+ .sa-tf-error {
113
+ font-size: 12px;
114
+ line-height: 18px;
115
+ margin: 0;
116
+ font-weight: 400;
117
+ }
118
+ .sa-tf-desc-top,
119
+ .sa-tf-helper {
120
+ color: var(--sa-input-text-subtlest);
121
+ }
122
+ .sa-tf-error {
123
+ color: var(--sa-input-text-error);
124
+ }
125
+ .sa-tf-size-sm .sa-tf-desc-top,
126
+ .sa-tf-size-sm .sa-tf-helper,
127
+ .sa-tf-size-sm .sa-tf-error {
128
+ font-size: 10px;
129
+ line-height: 15px;
121
130
  }
122
131
 
123
- .starasia-input-container {
124
- box-sizing: border-box;
132
+ /* INPUT BOX */
133
+ .sa-tf-box {
134
+ display: flex;
135
+ align-items: stretch;
136
+ gap: var(--sa-input-gap);
137
+ border-radius: var(--sa-input-radius);
138
+ position: relative;
139
+ width: 100%;
140
+ background: transparent;
141
+ border: 0.8px solid var(--sa-input-border-subtle);
125
142
  overflow: hidden;
143
+ transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
144
+ }
145
+ .sa-tf-box-content {
126
146
  display: flex;
127
147
  align-items: center;
128
- /* gap: var(--starasia-ui-input-spacing-sm); */
148
+ gap: var(--sa-input-gap);
149
+ flex: 1 1 0;
150
+ min-width: 0;
151
+ padding: var(--sa-input-padding-y) var(--sa-input-padding-x);
129
152
  }
130
153
 
131
- .starasia-input-container:has(input:focus) {
132
- border-color: var(--starasia-ui-input-color-primary-blue);
133
- box-shadow: 0px 0px 0px 2px var(--starasia-ui-input-color-quaternary-blue);
154
+ /* sizes */
155
+ .sa-tf-size-sm .sa-tf-box {
156
+ min-height: 32px;
134
157
  }
135
-
136
- .starasia-input-container:has(input:disabled)
137
- .starasia-input-container-icon-left {
138
- background-color: var(--starasia-ui-input-color-disabled-bg);
158
+ .sa-tf-size-md .sa-tf-box {
159
+ min-height: 40px;
139
160
  }
140
-
141
- .starasia-input-container:has(input:disabled)
142
- .starasia-input-container-icon-right {
143
- background-color: var(--starasia-ui-input-color-disabled-bg);
161
+ .sa-tf-size-lg .sa-tf-box {
162
+ min-height: 48px;
144
163
  }
145
-
146
- .starasia-input-container:has(input:disabled) {
147
- /* border-color: var(--starasia-ui-input-color-tertiary-gray); */
148
- /* background-color: var(--starasia-ui-input-color-tertiary-gray); */
149
- border-color: var(--starasia-ui-color-border);
150
- background-color: var(--starasia-ui-input-color-disabled-bg);
164
+ .sa-tf-size-xl .sa-tf-box {
165
+ min-height: 56px;
151
166
  }
152
167
 
153
- .starasia-input-container:has(input:disabled) input {
154
- color: var(--starasia-ui-input-color-disabled-text) !important;
155
- border-color: var(--starasia-ui-color-border);
156
- background-color: var(--starasia-ui-input-color-disabled-bg);
168
+ /* variants */
169
+ .sa-tf-variant-outline .sa-tf-box {
170
+ background: transparent;
171
+ border: 0.8px solid var(--sa-input-border-subtle);
157
172
  }
158
-
159
- .starasia-input-outline.starasia-input-container-error {
160
- border-color: var(--starasia-ui-input-color-secondary-red) !important;
173
+ .sa-tf-variant-standard .sa-tf-box {
174
+ background: var(--sa-input-bg-neutral);
175
+ border: 0.8px solid transparent;
161
176
  }
162
-
163
- .starasia-input-filled.starasia-input-container-error {
164
- border-color: var(--starasia-ui-input-color-secondary-red) !important;
165
- background-color: var(--starasia-ui-input-color-quinary-red);
177
+ .sa-tf-variant-flushed .sa-tf-box {
178
+ background: transparent;
179
+ border: 0;
180
+ border-bottom: 0.8px solid var(--sa-input-border-subtle);
181
+ border-radius: 0;
166
182
  }
167
183
 
168
- .starasia-input-flushed.starasia-input-container-error {
169
- border-color: var(--starasia-ui-input-color-secondary-red) !important;
184
+ /* state: focused */
185
+ .sa-tf-focused.sa-tf-status-default .sa-tf-box,
186
+ .sa-tf-variant-outline.sa-tf-focused.sa-tf-status-default .sa-tf-box {
187
+ border-color: var(--sa-input-border-brand);
188
+ border-width: 1.2px;
170
189
  }
171
-
172
- .starasia-input-outline.starasia-input-container-warning {
173
- border-color: var(--starasia-ui-input-color-secondary-orange) !important;
190
+ .sa-tf-variant-flushed.sa-tf-focused.sa-tf-status-default .sa-tf-box {
191
+ border-bottom-color: var(--sa-input-border-brand);
192
+ border-bottom-width: 1.2px;
174
193
  }
175
-
176
- .starasia-input-filled.starasia-input-container-warning {
177
- border-color: var(--starasia-ui-input-color-secondary-orange) !important;
178
- background-color: var(--starasia-ui-input-color-quinary-orange);
194
+ .sa-tf-variant-standard.sa-tf-focused.sa-tf-status-default .sa-tf-box {
195
+ border-color: var(--sa-input-border-brand);
196
+ border-width: 1.2px;
179
197
  }
180
198
 
181
- .starasia-input-flushed.starasia-input-container-warning {
182
- border-color: var(--starasia-ui-input-color-secondary-orange) !important;
199
+ /* inside-label focused: outer ring */
200
+ .sa-tf-label-inside.sa-tf-focused.sa-tf-status-default .sa-tf-box {
201
+ box-shadow: 0 0 0 1.2px var(--sa-input-border-brand-subtle);
183
202
  }
184
203
 
185
- .starasia-input-outline {
186
- border-color: var(--starasia-ui-color-border);
187
- background-color: transparent;
188
- border-width: var(--starasia-ui-input-border-width);
189
- border-style: solid;
204
+ /* state: error */
205
+ .sa-tf-status-error .sa-tf-box {
206
+ border-color: var(--sa-input-border-danger);
207
+ border-width: 1.2px;
190
208
  }
191
-
192
- .starasia-input-filled {
193
- border-width: var(--starasia-ui-input-border-width);
194
- border-style: solid;
195
- border-color: var(--starasia-ui-input-color-quinary-gray);
196
- background-color: var(--starasia-ui-input-color-quinary-gray);
209
+ .sa-tf-variant-flushed.sa-tf-status-error .sa-tf-box {
210
+ border: 0;
211
+ border-bottom: 1.2px solid var(--sa-input-border-danger);
197
212
  }
198
213
 
199
- .starasia-input-flushed.starasia-input-container:has(input:focus) {
200
- box-shadow: none;
214
+ /* Flushed must never render a box-shadow ring — only the bottom border. */
215
+ .sa-tf-variant-flushed .sa-tf-box {
216
+ box-shadow: none !important;
201
217
  }
202
-
203
- .starasia-input-flushed {
204
- border-bottom: var(--starasia-ui-input-border-width) solid
205
- var(--starasia-ui-input-color-tertiary-gray);
206
- border-bottom-left-radius: 0 !important;
207
- border-bottom-right-radius: 0 !important;
218
+ .sa-tf-variant-standard.sa-tf-status-error .sa-tf-box {
219
+ background: var(--sa-input-bg-error-subtlest);
208
220
  }
209
-
210
- .starasia-input-container.sm {
211
- height: var(--starasia-ui-input-height-sm);
212
- border-radius: var(--starasia-ui-input-border-radius-sm);
213
- font-size: var(--starasia-ui-fontSizes-sm, 12px);
214
- /* padding-inline: var(--starasia-ui-input-spacing-sm); */
221
+ .sa-tf-status-error.sa-tf-focused .sa-tf-box {
222
+ box-shadow: 0 0 0 1.2px var(--sa-input-border-danger-subtle);
215
223
  }
216
224
 
217
- .starasia-input-container.md {
218
- height: var(--starasia-ui-input-height-md);
219
- border-radius: var(--starasia-ui-input-border-radius-md);
220
- font-size: var(--starasia-ui-fontSizes-md, 14px);
221
- /* padding-inline: var(--starasia-ui-input-spacing-ms); */
225
+ /* state: success */
226
+ .sa-tf-status-success .sa-tf-box {
227
+ border-color: var(--sa-input-border-success);
228
+ border-width: 1.2px;
229
+ }
230
+ .sa-tf-variant-flushed.sa-tf-status-success .sa-tf-box {
231
+ border: 0;
232
+ border-bottom: 1.2px solid var(--sa-input-border-success);
233
+ }
234
+ .sa-tf-variant-standard.sa-tf-status-success .sa-tf-box {
235
+ background: var(--sa-input-bg-success-subtlest);
222
236
  }
223
237
 
224
- .starasia-input-container.lg {
225
- height: var(--starasia-ui-input-height-lg);
226
- border-radius: var(--starasia-ui-input-border-radius-lg);
227
- font-size: var(--starasia-ui-fontSizes-lg, 16px);
228
- /* padding-inline: var(--starasia-ui-input-spacing-ms); */
238
+ /* state: disable */
239
+ .sa-tf-status-disable .sa-tf-box,
240
+ .sa-tf-disabled .sa-tf-box {
241
+ border-color: var(--sa-input-border-disabled);
242
+ cursor: not-allowed;
243
+ }
244
+ .sa-tf-variant-standard.sa-tf-status-disable .sa-tf-box,
245
+ .sa-tf-variant-standard.sa-tf-disabled .sa-tf-box {
246
+ background: var(--sa-input-bg-neutral);
247
+ border-color: transparent;
248
+ }
249
+ .sa-tf-status-disable .sa-tf-input,
250
+ .sa-tf-disabled .sa-tf-input {
251
+ color: var(--sa-input-text-disable);
252
+ cursor: not-allowed;
253
+ }
254
+ .sa-tf-status-disable .sa-tf-placeholder,
255
+ .sa-tf-disabled .sa-tf-placeholder {
256
+ color: var(--sa-input-text-disable);
229
257
  }
230
258
 
231
- .starasia-input-preview-container {
232
- width: 100%;
233
- position: relative;
234
- z-index: 1;
235
- height: 100%;
259
+ /* Icons inside box */
260
+ .sa-tf-icon {
261
+ display: inline-flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+ flex-shrink: 0;
265
+ color: var(--sa-input-icon-subtle);
266
+ }
267
+ .sa-tf-icon-clickable {
268
+ cursor: pointer;
269
+ }
270
+ .sa-tf-status-disable .sa-tf-icon,
271
+ .sa-tf-disabled .sa-tf-icon {
272
+ color: var(--sa-input-icon-disable);
273
+ }
274
+ .sa-tf-status-success .sa-tf-success-mark {
275
+ color: var(--sa-input-icon-success);
236
276
  }
237
277
 
238
- .starasia-input-placeholder {
239
- position: absolute;
240
- top: 50%;
241
- left: 8px;
242
- transform: translateY(-50%);
243
- font-family: "Poppins", serif;
244
- color: var(--starasia-ui-input-placeholder-color);
245
- font-weight: var(--starasia-ui-fontWeights-normal, 300);
278
+ /* Clear (×) button — slot is always reserved to keep input width stable */
279
+ .sa-tf-clear {
280
+ appearance: none;
281
+ border: 0;
282
+ background: transparent;
283
+ padding: 0;
284
+ margin: 0;
285
+ cursor: pointer;
286
+ color: var(--sa-input-icon-subtlest);
287
+ border-radius: 50%;
288
+ opacity: 1;
289
+ transition: opacity 120ms ease, color 120ms ease, transform 80ms ease;
290
+ }
291
+ .sa-tf-clear:hover {
292
+ color: var(--sa-input-icon-subtle);
293
+ }
294
+ .sa-tf-clear:active {
295
+ transform: scale(0.92);
296
+ }
297
+ .sa-tf-clear:focus-visible {
298
+ outline: 2px solid var(--sa-input-border-brand-subtle);
299
+ outline-offset: 2px;
300
+ }
301
+ .sa-tf-clear-hidden {
302
+ opacity: 0;
246
303
  pointer-events: none;
304
+ cursor: default;
247
305
  }
248
306
 
249
- .starasia-input-placeholder-highlighted {
250
- color: var(--starasia-ui-input-color-primary-gray);
307
+ /* Addons (left/right blocks) */
308
+ .sa-tf-addon {
309
+ display: flex;
310
+ align-items: center;
311
+ justify-content: center;
312
+ padding: 0 12px;
313
+ background: var(--sa-input-bg-neutral);
314
+ color: var(--sa-input-text-subtle);
315
+ font-size: 14px;
316
+ line-height: 21px;
317
+ flex-shrink: 0;
318
+ align-self: stretch;
251
319
  }
252
-
253
- .starasia-input-preview-container
254
- .starasia-input:focus
255
- + .starasia-input-placeholder {
256
- display: none;
320
+ .sa-tf-addon-left {
321
+ border-right: 0.8px solid var(--sa-input-border-subtle);
322
+ }
323
+ .sa-tf-addon-right {
324
+ border-left: 0.8px solid var(--sa-input-border-subtle);
325
+ }
326
+ .sa-tf-size-sm .sa-tf-addon {
327
+ font-size: 12px;
328
+ line-height: 18px;
257
329
  }
258
330
 
259
- .starasia-input {
331
+ /* Input field + placeholder */
332
+ .sa-tf-field-wrap {
333
+ display: flex;
334
+ align-items: center;
335
+ flex: 1 1 0;
336
+ min-width: 0;
337
+ position: relative;
338
+ }
339
+ .sa-tf-input {
260
340
  width: 100%;
261
- box-sizing: border-box;
262
- height: 100%;
263
- border: none;
341
+ border: 0;
264
342
  outline: none;
265
- font-family: "Poppins", serif;
266
- font-size: inherit;
267
- font-weight: var(--starasia-ui-fontWeights-medium, 400);
268
343
  background: transparent;
269
- color: var(--starasia-ui-color-text);
270
- padding-inline: var(--starasia-ui-input-spacing-sm) !important;
344
+ padding: 0;
345
+ margin: 0;
346
+ font-family: inherit;
347
+ font-size: 14px;
348
+ font-weight: 400;
349
+ line-height: 21px;
350
+ color: var(--sa-input-text-primary);
351
+ }
352
+ .sa-tf-size-sm .sa-tf-input {
353
+ font-size: 12px;
354
+ line-height: 18px;
355
+ }
356
+ .sa-tf-input::placeholder {
357
+ color: var(--sa-input-text-subtlest);
358
+ font-weight: 400;
359
+ opacity: 1;
360
+ }
361
+ .sa-tf-variant-standard .sa-tf-input::placeholder,
362
+ .sa-tf-variant-standard .sa-tf-placeholder {
363
+ color: var(--sa-input-text-subtle);
364
+ }
365
+ .sa-tf-input:disabled {
366
+ color: var(--sa-input-text-disable);
367
+ cursor: not-allowed;
368
+ -webkit-text-fill-color: var(--sa-input-text-disable);
271
369
  }
272
370
 
273
- /* .starasia-input-container:not(:has(.starasia-input-container-icon-left)) .starasia-input {
274
- padding-inline: 12px !important;
275
- } */
276
- /* just icon */
277
-
278
- /* INPUT ICON */
279
- .starasia-input-container-icon-left {
371
+ .sa-tf-placeholder {
372
+ position: absolute;
373
+ inset: 0;
280
374
  display: flex;
281
- height: 100%;
282
375
  align-items: center;
283
- padding-left: 12px;
284
- background: transparent;
376
+ pointer-events: none;
377
+ color: var(--sa-input-text-subtlest);
378
+ font-size: 14px;
379
+ font-weight: 400;
380
+ line-height: 21px;
381
+ margin: 0;
382
+ white-space: nowrap;
383
+ overflow: hidden;
384
+ text-overflow: ellipsis;
385
+ }
386
+ .sa-tf-size-sm .sa-tf-placeholder {
387
+ font-size: 12px;
388
+ line-height: 18px;
389
+ }
390
+ .sa-tf-placeholder-highlight {
391
+ color: var(--sa-input-text-primary);
392
+ font-weight: 500;
285
393
  }
286
394
 
287
- .starasia-input-container-icon-right {
288
- display: flex;
289
- height: 100%;
395
+ /* ─────────────────────────────────────────────────────────────────
396
+ Inside-label (floating) layout & animation
397
+ ─────────────────────────────────────────────────────────────────
398
+ Both rows always render so the transition is smooth — visibility
399
+ is controlled with max-height + opacity, not conditional render.
400
+ */
401
+ .sa-tf-label-inside .sa-tf-box {
290
402
  align-items: center;
291
- padding-right: 12px;
292
- background: transparent;
403
+ cursor: text;
404
+ }
405
+ .sa-tf-label-inside.sa-tf-disabled .sa-tf-box,
406
+ .sa-tf-label-inside.sa-tf-status-disable .sa-tf-box {
407
+ cursor: not-allowed;
408
+ }
409
+ /* Box-content stays as a flex row so icons share container padding. */
410
+ .sa-tf-label-inside .sa-tf-box-content {
411
+ flex-direction: row;
412
+ align-items: center;
413
+ gap: var(--sa-input-gap);
293
414
  }
294
415
 
295
- /* INPUT ADDONS */
296
- .starasia-input-container-addons-left {
297
- background-color: var(--starasia-ui-input-color-addons-bg);
298
- height: 100%;
416
+ /* The label + input rows live inside this column. Stack handles the
417
+ floating animation; icons (siblings) translate to align with the
418
+ input row when floating. */
419
+ .sa-tf-label-inside .sa-tf-inside-stack {
299
420
  display: flex;
300
- padding-inline: var(--starasia-ui-input-spacing-ms);
301
- align-items: center;
421
+ flex-direction: column;
422
+ flex: 1 1 0;
423
+ min-width: 0;
424
+ gap: 0;
302
425
  justify-content: center;
303
- font-family: "Poppins", serif;
304
- color: var(--starasia-ui-input-color-secondary-gray);
305
- border-right: 1px solid var(--starasia-ui-color-border);
426
+ transition: gap 180ms cubic-bezier(0.4, 0, 0.2, 1);
427
+ }
428
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-stack {
429
+ gap: 4px;
430
+ }
431
+
432
+ /* Icons & success-mark: align with active row.
433
+ Resting → vertical-center of label.
434
+ Floating → translated down so they sit next to the input text. */
435
+ .sa-tf-label-inside .sa-tf-box-content > .sa-tf-icon {
436
+ align-self: center;
437
+ transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
438
+ transform: translateY(0);
439
+ }
440
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
441
+ transform: translateY(11px);
442
+ }
443
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
444
+ transform: translateY(9px);
445
+ }
446
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
447
+ transform: translateY(12px);
448
+ }
449
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
450
+ transform: translateY(13px);
306
451
  }
307
452
 
308
- .starasia-input-container-addons-right {
309
- background-color: var(--starasia-ui-input-color-addons-bg);
310
- height: 100%;
453
+ /* Label row — animates font-size when floating */
454
+ .sa-tf-label-inside .sa-tf-inside-label-row {
311
455
  display: flex;
312
- padding-inline: var(--starasia-ui-input-spacing-ms);
313
456
  align-items: center;
314
- justify-content: center;
315
- font-family: "Poppins", serif;
316
- color: var(--starasia-ui-input-color-secondary-gray);
317
- border-left: 1px solid var(--starasia-ui-color-border);
457
+ gap: 4px;
458
+ width: 100%;
459
+ font-size: 14px;
460
+ font-weight: 500;
461
+ color: var(--sa-input-text-primary);
462
+ line-height: 21px;
463
+ transition: font-size 180ms cubic-bezier(0.4, 0, 0.2, 1),
464
+ line-height 180ms cubic-bezier(0.4, 0, 0.2, 1),
465
+ color 180ms cubic-bezier(0.4, 0, 0.2, 1);
466
+ pointer-events: none;
318
467
  }
319
-
320
- .starasia-input-container:has(input:disabled)
321
- .starasia-input-container-addons-right {
322
- background-color: var(--starasia-ui-input-color-addons-bg-disabled) !important;
468
+ .sa-tf-label-inside .sa-tf-inside-label-row label {
469
+ pointer-events: auto;
470
+ }
471
+ .sa-tf-label-inside.sa-tf-size-sm .sa-tf-inside-label-row {
472
+ font-size: 12px;
473
+ line-height: 18px;
474
+ }
475
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-label-row {
476
+ font-size: 12px;
477
+ line-height: 18px;
478
+ color: var(--sa-input-text-subtle);
479
+ }
480
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-inside-label-row {
481
+ font-size: 10px;
482
+ line-height: 15px;
483
+ }
484
+ .sa-tf-label-inside.sa-tf-focused.sa-tf-status-default .sa-tf-inside-label-row {
485
+ color: var(--sa-input-border-brand);
486
+ }
487
+ .sa-tf-label-inside.sa-tf-status-error .sa-tf-inside-label-row {
488
+ color: var(--sa-input-text-error);
489
+ }
490
+ .sa-tf-label-inside.sa-tf-no-label .sa-tf-inside-label-row {
491
+ display: none;
323
492
  }
324
493
 
325
- .starasia-input-container:has(input:disabled)
326
- .starasia-input-container-addons-left {
327
- background-color: var(--starasia-ui-input-color-addons-bg-disabled) !important;
494
+ /* Input row — collapsed when not floating */
495
+ .sa-tf-label-inside .sa-tf-inside-row {
496
+ display: flex;
497
+ align-items: center;
498
+ gap: var(--sa-input-gap);
499
+ width: 100%;
500
+ max-height: 0;
501
+ opacity: 0;
502
+ overflow: hidden;
503
+ transform-origin: top left;
504
+ transform: translateY(-4px);
505
+ transition: max-height 180ms cubic-bezier(0.4, 0, 0.2, 1),
506
+ opacity 140ms cubic-bezier(0.4, 0, 0.2, 1),
507
+ transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
508
+ }
509
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-row,
510
+ .sa-tf-label-inside.sa-tf-no-label .sa-tf-inside-row {
511
+ max-height: 28px;
512
+ opacity: 1;
513
+ transform: translateY(0);
514
+ }
515
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-inside-row,
516
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-no-label .sa-tf-inside-row {
517
+ max-height: 22px;
518
+ }
519
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-floating .sa-tf-inside-row,
520
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-floating .sa-tf-inside-row,
521
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-no-label .sa-tf-inside-row,
522
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-no-label .sa-tf-inside-row {
523
+ max-height: 32px;
328
524
  }
329
525
 
330
- .starasia-input::placeholder {
331
- color: var(--starasia-ui-input-placeholder-color);
332
- font-weight: var(--starasia-ui-fontWeights-normal, 300);
526
+ /* Box height grows smoothly when floating */
527
+ .sa-tf-label-inside .sa-tf-box {
528
+ transition: border-color 120ms ease, box-shadow 120ms ease,
529
+ background-color 120ms ease, min-height 180ms cubic-bezier(0.4, 0, 0.2, 1);
530
+ }
531
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-sm .sa-tf-box {
532
+ min-height: 56px;
533
+ }
534
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-md .sa-tf-box {
535
+ min-height: 64px;
536
+ }
537
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-lg .sa-tf-box {
538
+ min-height: 72px;
539
+ }
540
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-xl .sa-tf-box {
541
+ min-height: 80px;
333
542
  }
334
- `,q=a=>{if(a==="sm")return 16;if(a==="md")return 16;if(a==="lg")return 20},z=a=>a==="default"?"#939E99":a==="error"?"#EF4444":a==="warning"?"#EAB308":"#939E99",j=a=>a==="default"?"#939E99":a==="error"?"#EF4444":a==="warning"?"#EAB308":"#939E99",O=t.forwardRef(({options:a,value:n,setValue:o,isComponentVisible:l,onOptionChange:u},s)=>{const[k,V]=t.useState([]),d=t.useRef(null),h=()=>{if(s!=null&&s.current&&d.current){const v=window.innerHeight,f=s==null?void 0:s.current.getBoundingClientRect(),C=d.current.getBoundingClientRect(),m=f.bottom+C.height;d.current.style.left=`${f.left}px`,d.current.style.width=`${f.width}px`,m>=v-10?d.current.style.top=`${f.top-C.height-5}px`:d.current.style.top=`${f.top+f.height}px`}};return t.useEffect(()=>(window.addEventListener("scroll",h),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h),window.removeEventListener("resize",h)}),[s,d]),t.useEffect(()=>{h()},[l]),t.useEffect(()=>{V((a==null?void 0:a.filter(v=>v.toLowerCase().startsWith(n.toLowerCase())))||[])},[n,a]),i.jsx("div",{ref:d,style:{position:"fixed",padding:"8px",boxSizing:"border-box",boxShadow:"0px 8px 12px 0px rgba(0, 0, 0, 0.08)",borderRadius:"8px",background:"white",overflow:"auto",zIndex:5e4},children:k==null?void 0:k.map(v=>W(v,n,o,u))})}),W=(a,n,o,l)=>{const u=a.toLowerCase().indexOf(n.toLowerCase());return i.jsxs("p",{style:{fontFamily:"Poppins",color:"#c9cecc",fontWeight:500,padding:"8px 14px",cursor:"pointer"},onClick:()=>{o(a),l&&l(a)},children:[a.slice(0,u),i.jsx("span",{style:{color:"#374151"},children:a.slice(u,u+n.length)}),a.slice(u+n.length)]})};function A(a){const[n,o]=t.useState(a),l=t.useRef(null),u=s=>{l.current&&!l.current.contains(s.target)&&o(!1)};return t.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)}),[]),{ref:l,isComponentVisible:n,setIsComponentVisible:o}}const T="starasia-input-styles";(a=>{if(!document.getElementById(T)){const n=document.createElement("style");n.id=T,n.textContent=a,document.head.appendChild(n)}})(D);function K(a){return Number(a.replace(/\./g,""))}const N=a=>{let n=a.replace(/[^\d]/g,"");return n=n.replace(/^0+(?=\d)/,""),n.replace(/\B(?=(\d{3})+(?!\d))/g,".")},F=t.forwardRef((a,n)=>{const{leftIcon:o,rightIcon:l,size:u="md",status:s="default",inputUse:k="icon",variant:V="outline",leftAddons:d,rightAddons:h,onClickLeftIcon:v,onClickRightIcon:f,highlightPlaceholder:C,currency:m,fullWidth:U=!1,options:S,onOptionChange:M,...r}=a;{const[Y,E]=t.useState(!0),[y,I]=t.useState(""),[G,$]=t.useState(""),{isComponentVisible:B,ref:P,setIsComponentVisible:J}=A(!1),Q=()=>{J(e=>!e)};return t.useEffect(()=>{typeof r.value=="string"&&r.value.length||r.defaultValue||typeof r.value=="number"?E(!1):E(!0)},[r.value,r.defaultValue]),t.useEffect(()=>{I(m?N(String(r.value)):r.value||"")},[r]),i.jsxs("div",{className:`starasia-input-container starasia-input-${V} starasia-input-container-${s} ${u} `,style:{width:U?"auto":"max-content",position:"relative"},ref:P,onClick:Q,children:[d?i.jsx("div",{className:"starasia-input-container-addons-left",children:d}):null,o?i.jsx("div",{className:"starasia-input-container-icon-left",children:t.cloneElement(o,{width:q(u),color:z(r.disabled?"disable":s),onClick:v,style:{color:`${z(r.disabled?"disable":s)}`}})}):null,i.jsxs("div",{className:"starasia-input-preview-container",children:[i.jsx("input",{className:"starasia-input",...r,placeholder:"",disabled:s==="disable"?!0:r.disabled,ref:n,onChange:e=>{let p=m?N(e.target.value):e.target.value;const c=e.target.selectionStart;if(m)if(G==="Backspace")if(typeof c=="number"&&y[c]==="."){let x=p.slice(0,c-1),w=p.slice(c,p.length);p=N(x+w);const g=y.length-1,L=p.length-1;setTimeout(()=>e.target.setSelectionRange(c-(g-L)<0?0:c-(g-L),c-(g-L)<0?0:c-(g-L)),0)}else{const x=y.length-1,w=p.length-1;let g=c+1-(x-w);setTimeout(()=>e.target.setSelectionRange(g<0?0:g,g<0?0:g),0)}else{const x=y.length-1,w=p.length-1;setTimeout(()=>e.target.setSelectionRange(c+(w-x)-1,c+(w-x)-1),0)}I(p),e.target.value?E(!1):E(!0),r.onChange&&r.onChange({...e,target:{...e.target,value:m?String(K(p)):p,name:e.target.name}}),$("")},value:y,onKeyDown:e=>{e.key==="Backspace"&&$(e.key),r.onKeyDown&&r.onKeyDown(e)}}),Y?H(r.placeholder,C):null]}),l?i.jsx("div",{className:"starasia-input-container-icon-right",children:t.cloneElement(l,{width:q(u),color:j(r.disabled?"disable":s),onClick:f,style:{color:`${j(r.disabled?"disable":s)}`}})}):null,h?i.jsx("div",{className:"starasia-input-container-addons-right",children:h}):null,y&&B&&(S!=null&&S.length)?i.jsx(O,{options:S,value:y,setValue:I,ref:P,isComponentVisible:B,onOptionChange:M}):null]})}}),H=(a,n)=>{if(!a||!n)return i.jsx("p",{className:"starasia-input-placeholder",children:a||""});const o=a.toLowerCase().indexOf(n.toLowerCase());return o===-1?i.jsx("p",{className:"starasia-input-placeholder",children:a}):i.jsxs("p",{className:"starasia-input-placeholder",children:[a.slice(0,o),i.jsx("span",{className:"starasia-input-placeholder-highlighted",children:a.slice(o,o+n.length)}),a.slice(o+n.length)]})};b.Input=F,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
543
+ `,y=t=>t==="lg"||t==="xl"?18:16,j={default:"#505258",error:"#a4133c",success:"#208958",disable:"rgba(24, 26, 25, 0.56)"},J=(t,a)=>a?j.disable:j[t]??j.default;function bn(t){return Number(t.replace(/\./g,""))}function O(t){let a=t.replace(/[^\d]/g,"");return a=a.replace(/^0+(?=\d)/,""),a.replace(/\B(?=(\d{3})+(?!\d))/g,".")}function hn(t,a){if(a<=0)return 0;let r=0;for(let l=0;l<t.length;l++)if(/\d/.test(t[l])&&(r+=1,r===a))return l+1;return t.length}const gn=o.forwardRef(({options:t,value:a,setValue:r,isComponentVisible:l,onOptionChange:d},f)=>{const[m,V]=o.useState([]),c=o.useRef(null),u=()=>{if(f!=null&&f.current&&c.current){const g=window.innerHeight,p=f==null?void 0:f.current.getBoundingClientRect(),v=c.current.getBoundingClientRect(),z=p.bottom+v.height;c.current.style.left=`${p.left}px`,c.current.style.width=`${p.width}px`,z>=g-10?c.current.style.top=`${p.top-v.height-5}px`:c.current.style.top=`${p.top+p.height}px`}};return o.useEffect(()=>(window.addEventListener("scroll",u),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),[f,c]),o.useEffect(()=>{u()},[l]),o.useEffect(()=>{V((t==null?void 0:t.filter(g=>g.toLowerCase().startsWith(a.toLowerCase())))||[])},[a,t]),n.jsx("div",{ref:c,style:{position:"fixed",padding:"8px",boxSizing:"border-box",boxShadow:"0px 8px 12px 0px rgba(0, 0, 0, 0.08)",borderRadius:"8px",background:"white",overflow:"auto",zIndex:5e4},children:m==null?void 0:m.map(g=>xn(g,a,r,d))})}),xn=(t,a,r,l)=>{const d=t.toLowerCase().indexOf(a.toLowerCase());return n.jsxs("p",{style:{fontFamily:"Poppins",color:"#c9cecc",fontWeight:500,padding:"8px 14px",cursor:"pointer"},onClick:()=>{r(t),l&&l(t)},children:[t.slice(0,d),n.jsx("span",{style:{color:"#374151"},children:t.slice(d,d+a.length)}),t.slice(d+a.length)]})};function mn(t){const[a,r]=o.useState(t),l=o.useRef(null),d=f=>{l.current&&!l.current.contains(f.target)&&r(!1)};return o.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}),[]),{ref:l,isComponentVisible:a,setIsComponentVisible:r}}const Q="starasia-input-styles";(t=>{if(!(typeof document>"u")&&!document.getElementById(Q)){const a=document.createElement("style");a.id=Q,a.textContent=t,document.head.appendChild(a)}})(pn);const vn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M5.2 8.2l1.8 1.8 3.8-4.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),wn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"currentColor",opacity:"0.2"}),n.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),Z=o.forwardRef((t,a)=>{const{size:r="md",variant:l="outline",status:d="default",label:f,labelPosition:m="outside-top",required:V,optional:c,description:u,helperText:g,errorText:p,leftIcon:v,rightIcon:z,leftAddons:S,rightAddons:L,onClickLeftIcon:R,onClickRightIcon:nn,fullWidth:zn=!1,highlightPlaceholder:$,currency:B,options:E,onOptionChange:Y,clearable:kn=!0,onClear:M,...s}=t,P=s.value!==void 0,[W,k]=o.useState(()=>{const e=s.value!==void 0?String(s.value??""):String(s.defaultValue??"");return B?O(e):e}),[tn,en]=o.useState(!1),[Cn,sn]=o.useState(""),C=o.useRef(null),N=o.useRef(null);o.useImperativeHandle(a,()=>N.current);const an=o.useRef(s.id??`sa-input-${Math.random().toString(36).slice(2,9)}`),{isComponentVisible:rn,ref:q,setIsComponentVisible:Nn}=mn(!1);o.useLayoutEffect(()=>{if(!P)return;const e=s.value===void 0||s.value===null?"":String(s.value),i=B?O(e):e;k(b=>b===i?b:i)},[s.value,B,P]),o.useLayoutEffect(()=>{if(C.current===null)return;const e=N.current,i=C.current;if(C.current=null,!!e)try{e.setSelectionRange(i,i)}catch{}},[W]);const I=W,D=I!==""&&I!==void 0,w=d==="disable"||s.disabled,A=w?"disable":d,H=m==="inside",In=H&&(D||tn),K=["sa-tf",`sa-tf-variant-${l}`,`sa-tf-size-${r}`,`sa-tf-status-${A}`,`sa-tf-label-${m}`,tn?"sa-tf-focused":"",w?"sa-tf-disabled":"",In?"sa-tf-floating":"",f?"":"sa-tf-no-label",zn?"sa-tf-fullwidth":""].filter(Boolean).join(" "),Sn=()=>{var e;return(e=N.current)==null?void 0:e.focus()},Ln=e=>{var cn,un;if(!B){const T=e.target.selectionStart;T!==null&&(C.current=T),k(e.target.value),(cn=s.onChange)==null||cn.call(s,e);return}const i=e.target.value;let b=i,x=e.target.selectionStart??i.length;if(Cn==="Backspace"){const T=W.replace(/\D/g,""),Tn=i.replace(/\D/g,"");T.length===Tn.length&&x>0&&(b=i.slice(0,x-1)+i.slice(x),x-=1)}const G=O(b),Dn=b.slice(0,x).replace(/\D/g,"").length,Fn=hn(G,Dn);C.current=Fn,k(G),(un=s.onChange)==null||un.call(s,{...e,target:{...e.target,value:String(bn(G)),name:e.target.name}}),sn("")},_=e=>f?n.jsxs("div",{className:e,children:[n.jsx("label",{htmlFor:an.current,style:{cursor:w?"not-allowed":"pointer"},children:f}),c?n.jsx("span",{className:"sa-tf-optional",children:"Optional"}):null,V?n.jsx("span",{className:"sa-tf-required","aria-hidden":"true",children:"*"}):null]}):null,U=n.jsxs(n.Fragment,{children:[g?n.jsx("p",{className:"sa-tf-helper",children:g}):null,p&&d==="error"?n.jsx("p",{className:"sa-tf-error",children:p}):null]}),F=(e,i)=>n.jsx("span",{className:`sa-tf-icon${i?" sa-tf-icon-clickable":""}`,onClick:i,children:o.cloneElement(e,{width:y(r),height:y(r),color:J(A,w),style:{color:J(A,w)}})}),on=d==="success"?n.jsx("span",{className:"sa-tf-icon sa-tf-success-mark","aria-hidden":"true",children:n.jsx(vn,{width:y(r),height:y(r)})}):null,Bn=e=>{var b;e.stopPropagation(),P||k("");const i={target:{value:"",name:s.name},currentTarget:{value:"",name:s.name}};(b=s.onChange)==null||b.call(s,i),M==null||M(),C.current=0,requestAnimationFrame(()=>{var x;return(x=N.current)==null?void 0:x.focus()})},ln=kn&&!w?n.jsx("button",{type:"button",className:`sa-tf-icon sa-tf-clear${D?"":" sa-tf-clear-hidden"}`,"aria-label":"Clear input","aria-hidden":!D,tabIndex:-1,onClick:Bn,onMouseDown:e=>e.preventDefault(),children:n.jsx(wn,{width:y(r),height:y(r)})}):null,En=!D&&!!s.placeholder&&!!$,dn=n.jsxs("div",{className:"sa-tf-field-wrap",children:[n.jsx("input",{...s,id:an.current,ref:N,className:"sa-tf-input",disabled:w,placeholder:$?"":s.placeholder,value:I,onFocus:e=>{var i;en(!0),Nn(!0),(i=s.onFocus)==null||i.call(s,e)},onBlur:e=>{var i;en(!1),(i=s.onBlur)==null||i.call(s,e)},onKeyDown:e=>{var i;e.key==="Backspace"&&sn(e.key),(i=s.onKeyDown)==null||i.call(s,e)},onChange:Ln}),En?yn(s.placeholder,$):null]}),fn=I&&rn&&(E!=null&&E.length)?n.jsx(gn,{options:E,value:I,setValue:k,ref:q,isComponentVisible:rn,onOptionChange:e=>{Y==null||Y(e),k(e)}}):null,X=H?n.jsxs("div",{className:"sa-tf-box",ref:q,onClick:Sn,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[v?F(v,R):null,n.jsxs("div",{className:"sa-tf-inside-stack",children:[_("sa-tf-inside-label-row"),n.jsx("div",{className:"sa-tf-inside-row",children:dn})]}),ln,on,z?F(z,nn):null]}),L?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:L}):null,fn]}):n.jsxs("div",{className:"sa-tf-box",ref:q,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[v?F(v,R):null,dn,ln,on,z?F(z,nn):null]}),L?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:L}):null,fn]});return m==="outside-left"?n.jsxs("div",{className:K,children:[n.jsxs("div",{className:"sa-tf-label-col",children:[_("sa-tf-label"),u?n.jsx("p",{className:"sa-tf-desc-top",children:u}):null]}),n.jsxs("div",{className:"sa-tf-input-col",children:[X,U]})]}):H?n.jsxs("div",{className:K,children:[X,U]}):n.jsxs("div",{className:K,children:[_("sa-tf-label"),u?n.jsx("p",{className:"sa-tf-desc-top",children:u}):null,X,U]})}),yn=(t,a)=>{if(!t)return null;if(!a)return n.jsx("p",{className:"sa-tf-placeholder",children:t});const r=t.toLowerCase().indexOf(a.toLowerCase());return r===-1?n.jsx("p",{className:"sa-tf-placeholder",children:t}):n.jsxs("p",{className:"sa-tf-placeholder",children:[t.slice(0,r),n.jsx("span",{className:"sa-tf-placeholder-highlight",children:t.slice(r,r+a.length)}),t.slice(r+a.length)]})};Z.displayName="Input",h.Input=Z,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});