@sigep/react 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -21,7 +21,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Button: () => Button,
24
- button: () => button
24
+ InputCNPJ: () => InputCNPJ,
25
+ InputCPF: () => InputCPF,
26
+ InputCep: () => InputCep,
27
+ InputCheckbox: () => InputCheckbox,
28
+ InputCurrency: () => InputCurrency,
29
+ InputEmail: () => InputEmail,
30
+ InputNumber: () => InputNumber,
31
+ InputPassword: () => InputPassword,
32
+ InputPhone: () => InputPhone,
33
+ InputRadio: () => InputRadio,
34
+ InputString: () => InputString,
35
+ InputWrapper: () => InputWrapper,
36
+ Textarea: () => Textarea,
37
+ button: () => button,
38
+ maskCEP: () => maskCEP,
39
+ maskCNPJ: () => maskCNPJ,
40
+ maskCPF: () => maskCPF,
41
+ maskCurrency: () => maskCurrency,
42
+ maskPhone: () => maskPhone,
43
+ unmask: () => unmask,
44
+ unmaskCurrency: () => unmaskCurrency
25
45
  });
26
46
  module.exports = __toCommonJS(index_exports);
27
47
 
@@ -62,8 +82,774 @@ var Button = (0, import_react.forwardRef)(
62
82
  }
63
83
  );
64
84
  Button.displayName = "Button";
85
+
86
+ // src/components/Input/InputString.tsx
87
+ var import_react3 = require("react");
88
+
89
+ // src/components/Input/InputWrapper.tsx
90
+ var import_react2 = require("react");
91
+ var import_tailwind_variants2 = require("tailwind-variants");
92
+ var import_jsx_runtime2 = require("react/jsx-runtime");
93
+ var wrapper = (0, import_tailwind_variants2.tv)({
94
+ base: "flex w-full flex-col gap-1"
95
+ });
96
+ var labelStyle = (0, import_tailwind_variants2.tv)({
97
+ base: "text-xs text-gray-700 flex items-start gap-0.5"
98
+ });
99
+ var containerStyle = (0, import_tailwind_variants2.tv)({
100
+ base: "flex items-center w-full rounded-md border bg-white transition-colors",
101
+ variants: {
102
+ size: {
103
+ sm: "h-8 text-sm",
104
+ md: "h-9 text-sm",
105
+ lg: "h-10 text-base"
106
+ },
107
+ error: {
108
+ true: "border-red-500 focus-within:border-red-500 focus-within:ring-1 focus-within:ring-red-500",
109
+ false: "border-gray-300 hover:border-gray-400 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500"
110
+ },
111
+ disabled: {
112
+ true: "opacity-50 cursor-not-allowed bg-gray-50"
113
+ }
114
+ },
115
+ defaultVariants: {
116
+ size: "md",
117
+ error: false
118
+ }
119
+ });
120
+ var errorStyle = (0, import_tailwind_variants2.tv)({
121
+ base: "text-xs text-red-500 mt-0.5"
122
+ });
123
+ var InputWrapper = (0, import_react2.forwardRef)(
124
+ ({ label, error, errorMessage, required, disabled, size, children, className, classContainer, htmlFor }, ref) => {
125
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: wrapper({ className }), children: [
126
+ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { htmlFor, className: labelStyle(), children: [
127
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label }),
128
+ required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
129
+ ] }),
130
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: containerStyle({ size, error: !!error, disabled: !!disabled, className: classContainer }), children }),
131
+ error && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: errorStyle(), children: errorMessage })
132
+ ] });
133
+ }
134
+ );
135
+ InputWrapper.displayName = "InputWrapper";
136
+
137
+ // src/components/Input/InputString.tsx
138
+ var import_jsx_runtime3 = require("react/jsx-runtime");
139
+ var InputString = (0, import_react3.forwardRef)(
140
+ ({
141
+ label,
142
+ error,
143
+ errorMessage,
144
+ required,
145
+ size,
146
+ showClearButton = true,
147
+ leftIcon,
148
+ rightIcon,
149
+ classContainer,
150
+ classInput,
151
+ value,
152
+ onChange,
153
+ disabled,
154
+ name,
155
+ ...props
156
+ }, ref) => {
157
+ const [hovered, setHovered] = (0, import_react3.useState)(false);
158
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
159
+ "div",
160
+ {
161
+ onMouseEnter: () => setHovered(true),
162
+ onMouseLeave: () => setHovered(false),
163
+ className: "w-full",
164
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
165
+ InputWrapper,
166
+ {
167
+ label,
168
+ error,
169
+ errorMessage,
170
+ required,
171
+ disabled,
172
+ size,
173
+ classContainer,
174
+ htmlFor: name,
175
+ children: [
176
+ leftIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
177
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
178
+ "input",
179
+ {
180
+ ref,
181
+ id: name,
182
+ name,
183
+ type: "text",
184
+ value: value ?? "",
185
+ onChange: (e) => onChange?.(e.target.value),
186
+ disabled,
187
+ "aria-invalid": !!error,
188
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
189
+ ...props
190
+ }
191
+ ),
192
+ showClearButton && hovered && value && !disabled && !required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
193
+ "button",
194
+ {
195
+ type: "button",
196
+ tabIndex: -1,
197
+ "aria-label": "Limpar campo",
198
+ className: "px-2 text-gray-400 hover:text-gray-600",
199
+ onMouseDown: (e) => e.preventDefault(),
200
+ onClick: () => onChange?.(""),
201
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
202
+ "svg",
203
+ {
204
+ width: "14",
205
+ height: "14",
206
+ viewBox: "0 0 24 24",
207
+ fill: "none",
208
+ stroke: "currentColor",
209
+ strokeWidth: "2",
210
+ strokeLinecap: "round",
211
+ strokeLinejoin: "round",
212
+ children: [
213
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
214
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
215
+ ]
216
+ }
217
+ )
218
+ }
219
+ ),
220
+ rightIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
221
+ ]
222
+ }
223
+ )
224
+ }
225
+ );
226
+ }
227
+ );
228
+ InputString.displayName = "InputString";
229
+
230
+ // src/components/Input/InputEmail.tsx
231
+ var import_react4 = require("react");
232
+ var import_jsx_runtime4 = require("react/jsx-runtime");
233
+ var InputEmail = (0, import_react4.forwardRef)(
234
+ ({ label, error, errorMessage, required, size, leftIcon, rightIcon, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
235
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
236
+ InputWrapper,
237
+ {
238
+ label,
239
+ error,
240
+ errorMessage,
241
+ required,
242
+ disabled,
243
+ size,
244
+ classContainer,
245
+ htmlFor: name,
246
+ children: [
247
+ leftIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
248
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
249
+ "input",
250
+ {
251
+ ref,
252
+ id: name,
253
+ name,
254
+ type: "email",
255
+ autoComplete: "email",
256
+ value: value ?? "",
257
+ onChange: (e) => onChange?.(e.target.value),
258
+ disabled,
259
+ "aria-invalid": !!error,
260
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
261
+ ...props
262
+ }
263
+ ),
264
+ rightIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
265
+ ]
266
+ }
267
+ );
268
+ }
269
+ );
270
+ InputEmail.displayName = "InputEmail";
271
+
272
+ // src/components/Input/InputPassword.tsx
273
+ var import_react5 = require("react");
274
+ var import_jsx_runtime5 = require("react/jsx-runtime");
275
+ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
276
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
277
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "3" })
278
+ ] });
279
+ var EyeOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
280
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
281
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
282
+ ] });
283
+ var InputPassword = (0, import_react5.forwardRef)(
284
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
285
+ const [visible, setVisible] = (0, import_react5.useState)(false);
286
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
287
+ InputWrapper,
288
+ {
289
+ label,
290
+ error,
291
+ errorMessage,
292
+ required,
293
+ disabled,
294
+ size,
295
+ classContainer,
296
+ htmlFor: name,
297
+ children: [
298
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
299
+ "input",
300
+ {
301
+ ref,
302
+ id: name,
303
+ name,
304
+ type: visible ? "text" : "password",
305
+ autoComplete: "current-password",
306
+ value: value ?? "",
307
+ onChange: (e) => onChange?.(e.target.value),
308
+ disabled,
309
+ "aria-invalid": !!error,
310
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
311
+ ...props
312
+ }
313
+ ),
314
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
315
+ "button",
316
+ {
317
+ type: "button",
318
+ tabIndex: -1,
319
+ "aria-label": visible ? "Ocultar senha" : "Mostrar senha",
320
+ className: "px-2.5 text-gray-400 hover:text-gray-600",
321
+ onClick: () => setVisible(!visible),
322
+ children: visible ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EyeOffIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EyeIcon, {})
323
+ }
324
+ )
325
+ ]
326
+ }
327
+ );
328
+ }
329
+ );
330
+ InputPassword.displayName = "InputPassword";
331
+
332
+ // src/components/Input/InputNumber.tsx
333
+ var import_react6 = require("react");
334
+ var import_jsx_runtime6 = require("react/jsx-runtime");
335
+ var allowedKeys = ["Backspace", "Delete", "Tab", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"];
336
+ var InputNumber = (0, import_react6.forwardRef)(
337
+ ({ label, error, errorMessage, required, size, leftIcon, rightIcon, classContainer, classInput, value, onChange, disabled, name, min = 0, max, ...props }, ref) => {
338
+ function handleKeyDown(e) {
339
+ if (e.ctrlKey || e.metaKey) return;
340
+ if (allowedKeys.includes(e.key)) return;
341
+ if (!/^[0-9]$/.test(e.key)) {
342
+ e.preventDefault();
343
+ }
344
+ }
345
+ function handleChange(raw) {
346
+ if (raw === "") {
347
+ onChange?.(void 0);
348
+ return;
349
+ }
350
+ const num = Number(raw);
351
+ if (isNaN(num)) return;
352
+ if (min !== void 0 && num < min) return;
353
+ if (max !== void 0 && num > max) return;
354
+ onChange?.(num);
355
+ }
356
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
357
+ InputWrapper,
358
+ {
359
+ label,
360
+ error,
361
+ errorMessage,
362
+ required,
363
+ disabled,
364
+ size,
365
+ classContainer,
366
+ htmlFor: name,
367
+ children: [
368
+ leftIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
369
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
370
+ "input",
371
+ {
372
+ ref,
373
+ id: name,
374
+ name,
375
+ type: "text",
376
+ inputMode: "numeric",
377
+ value: value ?? "",
378
+ onChange: (e) => handleChange(e.target.value),
379
+ onKeyDown: handleKeyDown,
380
+ disabled,
381
+ "aria-invalid": !!error,
382
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
383
+ ...props
384
+ }
385
+ ),
386
+ rightIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
387
+ ]
388
+ }
389
+ );
390
+ }
391
+ );
392
+ InputNumber.displayName = "InputNumber";
393
+
394
+ // src/components/Input/InputCPF.tsx
395
+ var import_react7 = require("react");
396
+
397
+ // src/components/Input/masks.ts
398
+ function maskCPF(value) {
399
+ const digits = value.replace(/\D/g, "").slice(0, 11);
400
+ return digits.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2");
401
+ }
402
+ function maskCNPJ(value) {
403
+ const digits = value.replace(/\D/g, "").slice(0, 14);
404
+ return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1/$2").replace(/(\d{4})(\d{1,2})$/, "$1-$2");
405
+ }
406
+ function maskPhone(value) {
407
+ const digits = value.replace(/\D/g, "").slice(0, 11);
408
+ if (digits.length <= 10) {
409
+ return digits.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2");
410
+ }
411
+ return digits.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2");
412
+ }
413
+ function maskCEP(value) {
414
+ const digits = value.replace(/\D/g, "").slice(0, 8);
415
+ return digits.replace(/(\d{5})(\d)/, "$1-$2");
416
+ }
417
+ function unmask(value) {
418
+ return value.replace(/\D/g, "");
419
+ }
420
+ function maskCurrency(value, prefix = "R$ ", decimalScale = 2) {
421
+ return prefix + value.toFixed(decimalScale).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, ".");
422
+ }
423
+ function unmaskCurrency(value) {
424
+ const cleaned = value.replace(/[^\d,-]/g, "").replace(",", ".");
425
+ return parseFloat(cleaned) || 0;
426
+ }
427
+
428
+ // src/components/Input/InputCPF.tsx
429
+ var import_jsx_runtime7 = require("react/jsx-runtime");
430
+ var InputCPF = (0, import_react7.forwardRef)(
431
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
432
+ function handleChange(raw) {
433
+ const digits = unmask(raw);
434
+ onChange?.(digits);
435
+ }
436
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
437
+ InputWrapper,
438
+ {
439
+ label,
440
+ error,
441
+ errorMessage,
442
+ required,
443
+ disabled,
444
+ size,
445
+ classContainer,
446
+ htmlFor: name,
447
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
448
+ "input",
449
+ {
450
+ ref,
451
+ id: name,
452
+ name,
453
+ type: "text",
454
+ inputMode: "numeric",
455
+ maxLength: 14,
456
+ placeholder: "000.000.000-00",
457
+ value: value ? maskCPF(value) : "",
458
+ onChange: (e) => handleChange(e.target.value),
459
+ disabled,
460
+ "aria-invalid": !!error,
461
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
462
+ ...props
463
+ }
464
+ )
465
+ }
466
+ );
467
+ }
468
+ );
469
+ InputCPF.displayName = "InputCPF";
470
+
471
+ // src/components/Input/InputCNPJ.tsx
472
+ var import_react8 = require("react");
473
+ var import_jsx_runtime8 = require("react/jsx-runtime");
474
+ var InputCNPJ = (0, import_react8.forwardRef)(
475
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
476
+ function handleChange(raw) {
477
+ const digits = unmask(raw);
478
+ onChange?.(digits);
479
+ }
480
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
481
+ InputWrapper,
482
+ {
483
+ label,
484
+ error,
485
+ errorMessage,
486
+ required,
487
+ disabled,
488
+ size,
489
+ classContainer,
490
+ htmlFor: name,
491
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
492
+ "input",
493
+ {
494
+ ref,
495
+ id: name,
496
+ name,
497
+ type: "text",
498
+ inputMode: "numeric",
499
+ maxLength: 18,
500
+ placeholder: "00.000.000/0000-00",
501
+ value: value ? maskCNPJ(value) : "",
502
+ onChange: (e) => handleChange(e.target.value),
503
+ disabled,
504
+ "aria-invalid": !!error,
505
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
506
+ ...props
507
+ }
508
+ )
509
+ }
510
+ );
511
+ }
512
+ );
513
+ InputCNPJ.displayName = "InputCNPJ";
514
+
515
+ // src/components/Input/InputPhone.tsx
516
+ var import_react9 = require("react");
517
+ var import_jsx_runtime9 = require("react/jsx-runtime");
518
+ var InputPhone = (0, import_react9.forwardRef)(
519
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
520
+ function handleChange(raw) {
521
+ const digits = unmask(raw);
522
+ onChange?.(digits);
523
+ }
524
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
525
+ InputWrapper,
526
+ {
527
+ label,
528
+ error,
529
+ errorMessage,
530
+ required,
531
+ disabled,
532
+ size,
533
+ classContainer,
534
+ htmlFor: name,
535
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
536
+ "input",
537
+ {
538
+ ref,
539
+ id: name,
540
+ name,
541
+ type: "tel",
542
+ inputMode: "numeric",
543
+ maxLength: 15,
544
+ placeholder: "(00) 00000-0000",
545
+ value: value ? maskPhone(value) : "",
546
+ onChange: (e) => handleChange(e.target.value),
547
+ disabled,
548
+ "aria-invalid": !!error,
549
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
550
+ ...props
551
+ }
552
+ )
553
+ }
554
+ );
555
+ }
556
+ );
557
+ InputPhone.displayName = "InputPhone";
558
+
559
+ // src/components/Input/InputCurrency.tsx
560
+ var import_react10 = require("react");
561
+ var import_jsx_runtime10 = require("react/jsx-runtime");
562
+ function formatCurrency(value, prefix, decimalScale) {
563
+ const fixed = Math.abs(value).toFixed(decimalScale);
564
+ const [intPart, decPart] = fixed.split(".");
565
+ const formatted = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
566
+ const sign = value < 0 ? "-" : "";
567
+ return `${sign}${prefix}${formatted},${decPart}`;
568
+ }
569
+ var InputCurrency = (0, import_react10.forwardRef)(
570
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, prefix = "R$ ", decimalScale = 2, allowNegative = false, ...props }, ref) => {
571
+ function handleChange(e) {
572
+ const raw = e.target.value;
573
+ const num = unmaskCurrency(raw);
574
+ if (!allowNegative && num < 0) return;
575
+ onChange?.(isNaN(num) ? void 0 : num);
576
+ }
577
+ const displayValue = value !== void 0 && value !== null ? formatCurrency(value, prefix, decimalScale) : "";
578
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
579
+ InputWrapper,
580
+ {
581
+ label,
582
+ error,
583
+ errorMessage,
584
+ required,
585
+ disabled,
586
+ size,
587
+ classContainer,
588
+ htmlFor: name,
589
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
590
+ "input",
591
+ {
592
+ ref,
593
+ id: name,
594
+ name,
595
+ type: "text",
596
+ inputMode: "decimal",
597
+ value: displayValue,
598
+ onChange: handleChange,
599
+ disabled,
600
+ "aria-invalid": !!error,
601
+ placeholder: `${prefix}0,${"0".repeat(decimalScale)}`,
602
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
603
+ ...props
604
+ }
605
+ )
606
+ }
607
+ );
608
+ }
609
+ );
610
+ InputCurrency.displayName = "InputCurrency";
611
+
612
+ // src/components/Input/InputCep.tsx
613
+ var import_react11 = require("react");
614
+ var import_jsx_runtime11 = require("react/jsx-runtime");
615
+ var InputCep = (0, import_react11.forwardRef)(
616
+ ({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
617
+ function handleChange(raw) {
618
+ const digits = unmask(raw);
619
+ onChange?.(digits);
620
+ }
621
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
622
+ InputWrapper,
623
+ {
624
+ label,
625
+ error,
626
+ errorMessage,
627
+ required,
628
+ disabled,
629
+ size,
630
+ classContainer,
631
+ htmlFor: name,
632
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
633
+ "input",
634
+ {
635
+ ref,
636
+ id: name,
637
+ name,
638
+ type: "text",
639
+ inputMode: "numeric",
640
+ autoComplete: "postal-code",
641
+ maxLength: 9,
642
+ placeholder: "00000-000",
643
+ value: value ? maskCEP(value) : "",
644
+ onChange: (e) => handleChange(e.target.value),
645
+ disabled,
646
+ "aria-invalid": !!error,
647
+ className: `flex-1 min-w-0 h-full bg-transparent px-2.5 outline-none text-gray-900 placeholder:text-gray-400 disabled:cursor-not-allowed ${classInput ?? ""}`,
648
+ ...props
649
+ }
650
+ )
651
+ }
652
+ );
653
+ }
654
+ );
655
+ InputCep.displayName = "InputCep";
656
+
657
+ // src/components/Input/InputCheckbox.tsx
658
+ var import_react12 = require("react");
659
+ var import_tailwind_variants3 = require("tailwind-variants");
660
+ var import_jsx_runtime12 = require("react/jsx-runtime");
661
+ var checkboxContainer = (0, import_tailwind_variants3.tv)({
662
+ base: "inline-flex items-center justify-center w-[18px] h-[18px] rounded border cursor-pointer transition-colors",
663
+ variants: {
664
+ checked: {
665
+ true: "bg-blue-600 border-blue-600",
666
+ false: "bg-white border-gray-300 hover:border-blue-500 hover:bg-blue-50"
667
+ },
668
+ disabled: {
669
+ true: "opacity-50 cursor-not-allowed"
670
+ },
671
+ error: {
672
+ true: "border-red-500"
673
+ }
674
+ },
675
+ defaultVariants: {
676
+ checked: false
677
+ }
678
+ });
679
+ var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("polyline", { points: "20 6 9 17 4 12" }) });
680
+ var IndeterminateIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-2 h-2 rounded-sm bg-gray-300" });
681
+ var InputCheckbox = (0, import_react12.forwardRef)(
682
+ ({ label, checked = false, indeterminate = false, onChange, disabled, error, labelPosition = "right", className, name, required }, ref) => {
683
+ function handleClick() {
684
+ if (disabled) return;
685
+ onChange?.(!checked);
686
+ }
687
+ const box = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
688
+ "button",
689
+ {
690
+ ref,
691
+ type: "button",
692
+ role: "checkbox",
693
+ id: name,
694
+ "aria-checked": indeterminate ? "mixed" : checked,
695
+ "aria-required": required,
696
+ className: checkboxContainer({ checked: checked || indeterminate, disabled: !!disabled, error: !!error }),
697
+ onClick: handleClick,
698
+ disabled,
699
+ children: [
700
+ checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CheckIcon, {}),
701
+ indeterminate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IndeterminateIcon, {})
702
+ ]
703
+ }
704
+ );
705
+ if (!label) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className, children: box });
706
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex items-center gap-2 ${className ?? ""}`, children: [
707
+ labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: name, className: "text-sm text-gray-700 cursor-pointer select-none", children: label }),
708
+ box,
709
+ labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: name, className: "text-sm text-gray-700 cursor-pointer select-none", children: label }),
710
+ required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-red-500 text-[10px]", children: "*" })
711
+ ] });
712
+ }
713
+ );
714
+ InputCheckbox.displayName = "InputCheckbox";
715
+
716
+ // src/components/Input/InputRadio.tsx
717
+ var import_react13 = require("react");
718
+ var import_tailwind_variants4 = require("tailwind-variants");
719
+ var import_jsx_runtime13 = require("react/jsx-runtime");
720
+ var radioButton = (0, import_tailwind_variants4.tv)({
721
+ base: "inline-flex items-center justify-center w-[18px] h-[18px] rounded-full border cursor-pointer transition-colors",
722
+ variants: {
723
+ selected: {
724
+ true: "border-blue-600",
725
+ false: "border-gray-300 hover:border-blue-500 hover:bg-blue-50"
726
+ },
727
+ disabled: {
728
+ true: "opacity-50 cursor-not-allowed"
729
+ },
730
+ error: {
731
+ true: "border-red-500"
732
+ }
733
+ },
734
+ defaultVariants: {
735
+ selected: false
736
+ }
737
+ });
738
+ var InputRadio = (0, import_react13.forwardRef)(
739
+ ({ label, options, value, onChange, disabled, error, required, name, className, direction = "horizontal" }, ref) => {
740
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref, className: `flex w-full flex-col gap-1 ${className ?? ""}`, children: [
741
+ label && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-xs text-gray-700 flex items-start gap-0.5", children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: label }),
743
+ required && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
744
+ ] }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
746
+ "div",
747
+ {
748
+ role: "radiogroup",
749
+ "aria-label": label,
750
+ className: `flex gap-3 ${direction === "vertical" ? "flex-col" : "items-center"}`,
751
+ children: options.map((option) => {
752
+ const isSelected = value === option.value;
753
+ const isDisabled = disabled || option.disabled;
754
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
755
+ "label",
756
+ {
757
+ className: `flex items-center gap-2 cursor-pointer select-none ${isDisabled ? "opacity-50 cursor-not-allowed" : ""}`,
758
+ children: [
759
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
760
+ "button",
761
+ {
762
+ type: "button",
763
+ role: "radio",
764
+ "aria-checked": isSelected,
765
+ className: radioButton({ selected: isSelected, disabled: !!isDisabled, error: !!error }),
766
+ onClick: () => !isDisabled && onChange?.(option.value),
767
+ disabled: isDisabled,
768
+ children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w-[10px] h-[10px] rounded-full bg-blue-600" })
769
+ }
770
+ ),
771
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-sm text-gray-700", children: option.label })
772
+ ]
773
+ },
774
+ String(option.value)
775
+ );
776
+ })
777
+ }
778
+ ),
779
+ error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-xs text-red-500 mt-0.5", children: "Selecione uma op\xE7\xE3o" })
780
+ ] });
781
+ }
782
+ );
783
+ InputRadio.displayName = "InputRadio";
784
+
785
+ // src/components/Input/Textarea.tsx
786
+ var import_react14 = require("react");
787
+ var import_tailwind_variants5 = require("tailwind-variants");
788
+ var import_jsx_runtime14 = require("react/jsx-runtime");
789
+ var textareaStyle = (0, import_tailwind_variants5.tv)({
790
+ base: "w-full rounded-md border bg-white px-2.5 py-2 text-sm text-gray-900 outline-none placeholder:text-gray-400 resize-vertical transition-colors",
791
+ variants: {
792
+ error: {
793
+ true: "border-red-500 focus:border-red-500 focus:ring-1 focus:ring-red-500",
794
+ false: "border-gray-300 hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
795
+ },
796
+ disabled: {
797
+ true: "opacity-50 cursor-not-allowed bg-gray-50"
798
+ }
799
+ },
800
+ defaultVariants: {
801
+ error: false
802
+ }
803
+ });
804
+ var Textarea = (0, import_react14.forwardRef)(
805
+ ({ label, error, errorMessage, required, size, classInput, value, onChange, disabled, name, rows = 4, ...props }, ref) => {
806
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
807
+ label && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: name, className: "text-xs text-gray-700 flex items-start gap-0.5", children: [
808
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: label }),
809
+ required && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
810
+ ] }),
811
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
812
+ "textarea",
813
+ {
814
+ ref,
815
+ id: name,
816
+ name,
817
+ rows,
818
+ value: value ?? "",
819
+ onChange: (e) => onChange?.(e.target.value),
820
+ disabled,
821
+ "aria-invalid": !!error,
822
+ className: textareaStyle({ error: !!error, disabled: !!disabled, className: classInput }),
823
+ ...props
824
+ }
825
+ ),
826
+ error && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-xs text-red-500 mt-0.5", children: errorMessage })
827
+ ] });
828
+ }
829
+ );
830
+ Textarea.displayName = "Textarea";
65
831
  // Annotate the CommonJS export names for ESM import in node:
66
832
  0 && (module.exports = {
67
833
  Button,
68
- button
834
+ InputCNPJ,
835
+ InputCPF,
836
+ InputCep,
837
+ InputCheckbox,
838
+ InputCurrency,
839
+ InputEmail,
840
+ InputNumber,
841
+ InputPassword,
842
+ InputPhone,
843
+ InputRadio,
844
+ InputString,
845
+ InputWrapper,
846
+ Textarea,
847
+ button,
848
+ maskCEP,
849
+ maskCNPJ,
850
+ maskCPF,
851
+ maskCurrency,
852
+ maskPhone,
853
+ unmask,
854
+ unmaskCurrency
69
855
  });