@starasia/input 1.0.4 → 2.0.1

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,545 @@
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-text-placeholder: rgb(201, 206, 204);
30
+
31
+ --sa-input-radius: 6px;
32
+ --sa-input-padding-x: 12px;
33
+ --sa-input-padding-y: 8px;
34
+ --sa-input-gap: 8px;
35
+ }
36
+
37
+ /* ROOT */
38
+ .sa-tf {
39
+ box-sizing: border-box;
40
+ display: flex;
41
+ flex-direction: column;
42
+ align-items: stretch;
43
+ gap: 8px;
44
+ font-family: "Poppins", sans-serif;
45
+ width: max-content;
46
+ }
47
+ .sa-tf *,
48
+ .sa-tf *::before,
49
+ .sa-tf *::after {
50
+ box-sizing: border-box;
51
+ }
52
+ .sa-tf-fullwidth {
53
+ width: 100%;
54
+ }
105
55
 
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);
56
+ /* outside-left layout */
57
+ .sa-tf-label-outside-left {
58
+ flex-direction: row;
59
+ align-items: flex-start;
60
+ gap: 8px;
61
+ }
62
+ .sa-tf-label-outside-left > .sa-tf-label-col {
63
+ width: 40%;
64
+ min-width: 120px;
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: 8px;
68
+ padding-top: 9.5px;
69
+ }
70
+ .sa-tf-label-outside-left > .sa-tf-input-col {
71
+ flex: 1 1 0;
72
+ min-width: 0;
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: 8px;
76
+ }
111
77
 
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);
78
+ /* LABEL ROW */
79
+ .sa-tf-label {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 4px;
83
+ width: 100%;
84
+ color: var(--sa-input-text-primary);
85
+ font-weight: 500;
86
+ font-size: 14px;
87
+ line-height: normal;
88
+ margin: 0;
89
+ }
90
+ .sa-tf-size-sm .sa-tf-label,
91
+ .sa-tf-size-sm .sa-tf-label-inside-text {
92
+ font-size: 12px;
93
+ }
94
+ .sa-tf-required {
95
+ color: var(--sa-input-text-error);
96
+ font-weight: 500;
97
+ }
98
+ .sa-tf-optional {
99
+ background: var(--sa-input-accent-subtle);
100
+ border: 1px solid var(--sa-input-border-subtle);
101
+ border-radius: 4px;
102
+ padding: 0 8px;
103
+ font-size: 10px;
104
+ font-weight: 500;
105
+ line-height: 18px;
106
+ color: var(--sa-input-text-primary);
107
+ display: inline-flex;
108
+ align-items: center;
109
+ }
116
110
 
117
- --starasia-ui-input-placeholder-color: var(
118
- --starasia-ui-color-gray-200,
119
- rgba(201, 206, 204, 1)
120
- );
111
+ /* DESCRIPTIONS */
112
+ .sa-tf-desc-top,
113
+ .sa-tf-helper,
114
+ .sa-tf-error {
115
+ font-size: 12px;
116
+ line-height: 18px;
117
+ margin: 0;
118
+ font-weight: 400;
119
+ }
120
+ .sa-tf-desc-top,
121
+ .sa-tf-helper {
122
+ color: var(--sa-input-text-subtlest);
123
+ }
124
+ .sa-tf-error {
125
+ color: var(--sa-input-text-error);
126
+ }
127
+ .sa-tf-size-sm .sa-tf-desc-top,
128
+ .sa-tf-size-sm .sa-tf-helper,
129
+ .sa-tf-size-sm .sa-tf-error {
130
+ font-size: 10px;
131
+ line-height: 15px;
121
132
  }
122
133
 
123
- .starasia-input-container {
124
- box-sizing: border-box;
134
+ /* INPUT BOX */
135
+ .sa-tf-box {
136
+ display: flex;
137
+ align-items: stretch;
138
+ gap: var(--sa-input-gap);
139
+ border-radius: var(--sa-input-radius);
140
+ position: relative;
141
+ width: 100%;
142
+ background: transparent;
143
+ border: 0.8px solid var(--sa-input-border-subtle);
125
144
  overflow: hidden;
145
+ transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
146
+ }
147
+ .sa-tf-box-content {
126
148
  display: flex;
127
149
  align-items: center;
128
- /* gap: var(--starasia-ui-input-spacing-sm); */
150
+ gap: var(--sa-input-gap);
151
+ flex: 1 1 0;
152
+ min-width: 0;
153
+ padding: var(--sa-input-padding-y) var(--sa-input-padding-x);
129
154
  }
130
155
 
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);
156
+ /* sizes */
157
+ .sa-tf-size-sm .sa-tf-box {
158
+ min-height: 32px;
134
159
  }
135
-
136
- .starasia-input-container:has(input:disabled)
137
- .starasia-input-container-icon-left {
138
- background-color: var(--starasia-ui-input-color-disabled-bg);
160
+ .sa-tf-size-md .sa-tf-box {
161
+ min-height: 40px;
139
162
  }
140
-
141
- .starasia-input-container:has(input:disabled)
142
- .starasia-input-container-icon-right {
143
- background-color: var(--starasia-ui-input-color-disabled-bg);
163
+ .sa-tf-size-lg .sa-tf-box {
164
+ min-height: 48px;
144
165
  }
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);
166
+ .sa-tf-size-xl .sa-tf-box {
167
+ min-height: 56px;
151
168
  }
152
169
 
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);
170
+ /* variants */
171
+ .sa-tf-variant-outline .sa-tf-box {
172
+ background: transparent;
173
+ border: 0.8px solid var(--sa-input-border-subtle);
157
174
  }
158
-
159
- .starasia-input-outline.starasia-input-container-error {
160
- border-color: var(--starasia-ui-input-color-secondary-red) !important;
175
+ .sa-tf-variant-standard .sa-tf-box {
176
+ background: var(--sa-input-bg-neutral);
177
+ border: 0.8px solid transparent;
161
178
  }
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);
179
+ .sa-tf-variant-flushed .sa-tf-box {
180
+ background: transparent;
181
+ border: 0;
182
+ border-bottom: 0.8px solid var(--sa-input-border-subtle);
183
+ border-radius: 0;
166
184
  }
167
185
 
168
- .starasia-input-flushed.starasia-input-container-error {
169
- border-color: var(--starasia-ui-input-color-secondary-red) !important;
186
+ /* state: focused */
187
+ .sa-tf-focused.sa-tf-status-default .sa-tf-box,
188
+ .sa-tf-variant-outline.sa-tf-focused.sa-tf-status-default .sa-tf-box {
189
+ border-color: var(--sa-input-border-brand);
190
+ border-width: 1.2px;
170
191
  }
171
-
172
- .starasia-input-outline.starasia-input-container-warning {
173
- border-color: var(--starasia-ui-input-color-secondary-orange) !important;
192
+ .sa-tf-variant-flushed.sa-tf-focused.sa-tf-status-default .sa-tf-box {
193
+ border-bottom-color: var(--sa-input-border-brand);
194
+ border-bottom-width: 1.2px;
174
195
  }
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);
196
+ .sa-tf-variant-standard.sa-tf-focused.sa-tf-status-default .sa-tf-box {
197
+ border-color: var(--sa-input-border-brand);
198
+ border-width: 1.2px;
179
199
  }
180
200
 
181
- .starasia-input-flushed.starasia-input-container-warning {
182
- border-color: var(--starasia-ui-input-color-secondary-orange) !important;
201
+ /* inside-label focused: outer ring */
202
+ .sa-tf-label-inside.sa-tf-focused.sa-tf-status-default .sa-tf-box {
203
+ box-shadow: 0 0 0 1.2px var(--sa-input-border-brand-subtle);
183
204
  }
184
205
 
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;
206
+ /* state: error */
207
+ .sa-tf-status-error .sa-tf-box {
208
+ border-color: var(--sa-input-border-danger);
209
+ border-width: 1.2px;
190
210
  }
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);
211
+ .sa-tf-variant-flushed.sa-tf-status-error .sa-tf-box {
212
+ border: 0;
213
+ border-bottom: 1.2px solid var(--sa-input-border-danger);
197
214
  }
198
215
 
199
- .starasia-input-flushed.starasia-input-container:has(input:focus) {
200
- box-shadow: none;
216
+ /* Flushed must never render a box-shadow ring — only the bottom border. */
217
+ .sa-tf-variant-flushed .sa-tf-box {
218
+ box-shadow: none !important;
201
219
  }
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;
220
+ .sa-tf-variant-standard.sa-tf-status-error .sa-tf-box {
221
+ background: var(--sa-input-bg-error-subtlest);
208
222
  }
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); */
223
+ .sa-tf-status-error.sa-tf-focused .sa-tf-box {
224
+ box-shadow: 0 0 0 1.2px var(--sa-input-border-danger-subtle);
215
225
  }
216
226
 
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); */
227
+ /* state: success */
228
+ .sa-tf-status-success .sa-tf-box {
229
+ border-color: var(--sa-input-border-success);
230
+ border-width: 1.2px;
231
+ }
232
+ .sa-tf-variant-flushed.sa-tf-status-success .sa-tf-box {
233
+ border: 0;
234
+ border-bottom: 1.2px solid var(--sa-input-border-success);
235
+ }
236
+ .sa-tf-variant-standard.sa-tf-status-success .sa-tf-box {
237
+ background: var(--sa-input-bg-success-subtlest);
222
238
  }
223
239
 
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); */
240
+ /* state: disable */
241
+ .sa-tf-status-disable .sa-tf-box,
242
+ .sa-tf-disabled .sa-tf-box {
243
+ border-color: var(--sa-input-border-disabled);
244
+ cursor: not-allowed;
245
+ }
246
+ .sa-tf-variant-standard.sa-tf-status-disable .sa-tf-box,
247
+ .sa-tf-variant-standard.sa-tf-disabled .sa-tf-box {
248
+ background: var(--sa-input-bg-neutral);
249
+ border-color: transparent;
250
+ }
251
+ .sa-tf-status-disable .sa-tf-input,
252
+ .sa-tf-disabled .sa-tf-input {
253
+ color: var(--sa-input-text-disable);
254
+ cursor: not-allowed;
255
+ }
256
+ .sa-tf-status-disable .sa-tf-placeholder,
257
+ .sa-tf-disabled .sa-tf-placeholder {
258
+ color: var(--sa-input-text-disable);
229
259
  }
230
260
 
231
- .starasia-input-preview-container {
232
- width: 100%;
233
- position: relative;
234
- z-index: 1;
235
- height: 100%;
261
+ /* Icons inside box */
262
+ .sa-tf-icon {
263
+ display: inline-flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ flex-shrink: 0;
267
+ color: var(--sa-input-icon-subtle);
268
+ }
269
+ .sa-tf-icon-clickable {
270
+ cursor: pointer;
271
+ }
272
+ .sa-tf-status-disable .sa-tf-icon,
273
+ .sa-tf-disabled .sa-tf-icon {
274
+ color: var(--sa-input-icon-disable);
275
+ }
276
+ .sa-tf-status-success .sa-tf-success-mark {
277
+ color: var(--sa-input-icon-success);
236
278
  }
237
279
 
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);
280
+ /* Clear (×) button — slot is always reserved to keep input width stable */
281
+ .sa-tf-clear {
282
+ appearance: none;
283
+ border: 0;
284
+ background: transparent;
285
+ padding: 0;
286
+ margin: 0;
287
+ cursor: pointer;
288
+ color: var(--sa-input-icon-subtlest);
289
+ border-radius: 50%;
290
+ opacity: 1;
291
+ transition: opacity 120ms ease, color 120ms ease, transform 80ms ease;
292
+ }
293
+ .sa-tf-clear:hover {
294
+ color: var(--sa-input-icon-subtle);
295
+ }
296
+ .sa-tf-clear:active {
297
+ transform: scale(0.92);
298
+ }
299
+ .sa-tf-clear:focus-visible {
300
+ outline: 2px solid var(--sa-input-border-brand-subtle);
301
+ outline-offset: 2px;
302
+ }
303
+ .sa-tf-clear-hidden {
304
+ opacity: 0;
246
305
  pointer-events: none;
306
+ cursor: default;
247
307
  }
248
308
 
249
- .starasia-input-placeholder-highlighted {
250
- color: var(--starasia-ui-input-color-primary-gray);
309
+ /* Addons (left/right blocks) */
310
+ .sa-tf-addon {
311
+ display: flex;
312
+ align-items: center;
313
+ justify-content: center;
314
+ padding: 0 12px;
315
+ background: var(--sa-input-bg-neutral);
316
+ color: var(--sa-input-text-subtle);
317
+ font-size: 14px;
318
+ line-height: 21px;
319
+ flex-shrink: 0;
320
+ align-self: stretch;
251
321
  }
252
-
253
- .starasia-input-preview-container
254
- .starasia-input:focus
255
- + .starasia-input-placeholder {
256
- display: none;
322
+ .sa-tf-addon-left {
323
+ border-right: 0.8px solid var(--sa-input-border-subtle);
324
+ }
325
+ .sa-tf-addon-right {
326
+ border-left: 0.8px solid var(--sa-input-border-subtle);
327
+ }
328
+ .sa-tf-size-sm .sa-tf-addon {
329
+ font-size: 12px;
330
+ line-height: 18px;
257
331
  }
258
332
 
259
- .starasia-input {
333
+ /* Input field + placeholder */
334
+ .sa-tf-field-wrap {
335
+ display: flex;
336
+ align-items: center;
337
+ flex: 1 1 0;
338
+ min-width: 0;
339
+ position: relative;
340
+ }
341
+ .sa-tf-input {
260
342
  width: 100%;
261
- box-sizing: border-box;
262
- height: 100%;
263
- border: none;
343
+ border: 0;
264
344
  outline: none;
265
- font-family: "Poppins", serif;
266
- font-size: inherit;
267
- font-weight: var(--starasia-ui-fontWeights-medium, 400);
268
345
  background: transparent;
269
- color: var(--starasia-ui-color-text);
270
- padding-inline: var(--starasia-ui-input-spacing-sm) !important;
346
+ padding: 0;
347
+ margin: 0;
348
+ font-family: inherit;
349
+ font-size: 14px;
350
+ font-weight: 400;
351
+ line-height: 21px;
352
+ color: var(--sa-input-text-primary);
353
+ }
354
+ .sa-tf-size-sm .sa-tf-input {
355
+ font-size: 12px;
356
+ line-height: 18px;
357
+ }
358
+ .sa-tf-input::placeholder {
359
+ color: var(--sa-input-text-placeholder);
360
+ font-weight: 300;
361
+ opacity: 1;
362
+ }
363
+ .sa-tf-variant-standard .sa-tf-input::placeholder,
364
+ .sa-tf-variant-standard .sa-tf-placeholder {
365
+ color: var(--sa-input-text-placeholder);
366
+ }
367
+ .sa-tf-input:disabled {
368
+ color: var(--sa-input-text-disable);
369
+ cursor: not-allowed;
370
+ -webkit-text-fill-color: var(--sa-input-text-disable);
271
371
  }
272
372
 
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 {
373
+ .sa-tf-placeholder {
374
+ position: absolute;
375
+ inset: 0;
280
376
  display: flex;
281
- height: 100%;
282
377
  align-items: center;
283
- padding-left: 12px;
284
- background: transparent;
378
+ pointer-events: none;
379
+ color: var(--sa-input-text-placeholder);
380
+ font-size: 14px;
381
+ font-weight: 300;
382
+ line-height: 21px;
383
+ margin: 0;
384
+ white-space: nowrap;
385
+ overflow: hidden;
386
+ text-overflow: ellipsis;
387
+ }
388
+ .sa-tf-size-sm .sa-tf-placeholder {
389
+ font-size: 12px;
390
+ line-height: 18px;
391
+ }
392
+ .sa-tf-placeholder-highlight {
393
+ color: var(--sa-input-text-primary);
394
+ font-weight: 500;
285
395
  }
286
396
 
287
- .starasia-input-container-icon-right {
288
- display: flex;
289
- height: 100%;
397
+ /* ─────────────────────────────────────────────────────────────────
398
+ Inside-label (floating) layout & animation
399
+ ─────────────────────────────────────────────────────────────────
400
+ Both rows always render so the transition is smooth — visibility
401
+ is controlled with max-height + opacity, not conditional render.
402
+ */
403
+ .sa-tf-label-inside .sa-tf-box {
290
404
  align-items: center;
291
- padding-right: 12px;
292
- background: transparent;
405
+ cursor: text;
406
+ }
407
+ .sa-tf-label-inside.sa-tf-disabled .sa-tf-box,
408
+ .sa-tf-label-inside.sa-tf-status-disable .sa-tf-box {
409
+ cursor: not-allowed;
410
+ }
411
+ /* Box-content stays as a flex row so icons share container padding. */
412
+ .sa-tf-label-inside .sa-tf-box-content {
413
+ flex-direction: row;
414
+ align-items: center;
415
+ gap: var(--sa-input-gap);
293
416
  }
294
417
 
295
- /* INPUT ADDONS */
296
- .starasia-input-container-addons-left {
297
- background-color: var(--starasia-ui-input-color-addons-bg);
298
- height: 100%;
418
+ /* The label + input rows live inside this column. Stack handles the
419
+ floating animation; icons (siblings) translate to align with the
420
+ input row when floating. */
421
+ .sa-tf-label-inside .sa-tf-inside-stack {
299
422
  display: flex;
300
- padding-inline: var(--starasia-ui-input-spacing-ms);
301
- align-items: center;
423
+ flex-direction: column;
424
+ flex: 1 1 0;
425
+ min-width: 0;
426
+ gap: 0;
302
427
  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);
428
+ transition: gap 180ms cubic-bezier(0.4, 0, 0.2, 1);
429
+ }
430
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-stack {
431
+ gap: 4px;
432
+ }
433
+
434
+ /* Icons & success-mark: align with active row.
435
+ Resting → vertical-center of label.
436
+ Floating → translated down so they sit next to the input text. */
437
+ .sa-tf-label-inside .sa-tf-box-content > .sa-tf-icon {
438
+ align-self: center;
439
+ transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
440
+ transform: translateY(0);
441
+ }
442
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
443
+ transform: translateY(11px);
444
+ }
445
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
446
+ transform: translateY(9px);
447
+ }
448
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
449
+ transform: translateY(12px);
450
+ }
451
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-floating .sa-tf-box-content > .sa-tf-icon {
452
+ transform: translateY(13px);
306
453
  }
307
454
 
308
- .starasia-input-container-addons-right {
309
- background-color: var(--starasia-ui-input-color-addons-bg);
310
- height: 100%;
455
+ /* Label row — animates font-size when floating */
456
+ .sa-tf-label-inside .sa-tf-inside-label-row {
311
457
  display: flex;
312
- padding-inline: var(--starasia-ui-input-spacing-ms);
313
458
  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);
459
+ gap: 4px;
460
+ width: 100%;
461
+ font-size: 14px;
462
+ font-weight: 500;
463
+ color: var(--sa-input-text-primary);
464
+ line-height: 21px;
465
+ transition: font-size 180ms cubic-bezier(0.4, 0, 0.2, 1),
466
+ line-height 180ms cubic-bezier(0.4, 0, 0.2, 1),
467
+ color 180ms cubic-bezier(0.4, 0, 0.2, 1);
468
+ pointer-events: none;
318
469
  }
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;
470
+ .sa-tf-label-inside .sa-tf-inside-label-row label {
471
+ pointer-events: auto;
472
+ }
473
+ .sa-tf-label-inside.sa-tf-size-sm .sa-tf-inside-label-row {
474
+ font-size: 12px;
475
+ line-height: 18px;
476
+ }
477
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-label-row {
478
+ font-size: 12px;
479
+ line-height: 18px;
480
+ color: var(--sa-input-text-subtle);
481
+ }
482
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-inside-label-row {
483
+ font-size: 10px;
484
+ line-height: 15px;
485
+ }
486
+ .sa-tf-label-inside.sa-tf-focused.sa-tf-status-default .sa-tf-inside-label-row {
487
+ color: var(--sa-input-border-brand);
488
+ }
489
+ .sa-tf-label-inside.sa-tf-status-error .sa-tf-inside-label-row {
490
+ color: var(--sa-input-text-error);
491
+ }
492
+ .sa-tf-label-inside.sa-tf-no-label .sa-tf-inside-label-row {
493
+ display: none;
323
494
  }
324
495
 
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;
496
+ /* Input row — collapsed when not floating */
497
+ .sa-tf-label-inside .sa-tf-inside-row {
498
+ display: flex;
499
+ align-items: center;
500
+ gap: var(--sa-input-gap);
501
+ width: 100%;
502
+ max-height: 0;
503
+ opacity: 0;
504
+ overflow: hidden;
505
+ transform-origin: top left;
506
+ transform: translateY(-4px);
507
+ transition: max-height 180ms cubic-bezier(0.4, 0, 0.2, 1),
508
+ opacity 140ms cubic-bezier(0.4, 0, 0.2, 1),
509
+ transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
510
+ }
511
+ .sa-tf-label-inside.sa-tf-floating .sa-tf-inside-row,
512
+ .sa-tf-label-inside.sa-tf-no-label .sa-tf-inside-row {
513
+ max-height: 28px;
514
+ opacity: 1;
515
+ transform: translateY(0);
516
+ }
517
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-floating .sa-tf-inside-row,
518
+ .sa-tf-label-inside.sa-tf-size-sm.sa-tf-no-label .sa-tf-inside-row {
519
+ max-height: 22px;
520
+ }
521
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-floating .sa-tf-inside-row,
522
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-floating .sa-tf-inside-row,
523
+ .sa-tf-label-inside.sa-tf-size-lg.sa-tf-no-label .sa-tf-inside-row,
524
+ .sa-tf-label-inside.sa-tf-size-xl.sa-tf-no-label .sa-tf-inside-row {
525
+ max-height: 32px;
328
526
  }
329
527
 
330
- .starasia-input::placeholder {
331
- color: var(--starasia-ui-input-placeholder-color);
332
- font-weight: var(--starasia-ui-fontWeights-normal, 300);
528
+ /* Box height grows smoothly when floating */
529
+ .sa-tf-label-inside .sa-tf-box {
530
+ transition: border-color 120ms ease, box-shadow 120ms ease,
531
+ background-color 120ms ease, min-height 180ms cubic-bezier(0.4, 0, 0.2, 1);
532
+ }
533
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-sm .sa-tf-box {
534
+ min-height: 56px;
535
+ }
536
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-md .sa-tf-box {
537
+ min-height: 64px;
538
+ }
539
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-lg .sa-tf-box {
540
+ min-height: 72px;
541
+ }
542
+ .sa-tf-label-inside.sa-tf-floating.sa-tf-size-xl .sa-tf-box {
543
+ min-height: 80px;
333
544
  }
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"})});
545
+ `,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"})});