@seygo/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,320 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Button: () => ButtonCustom,
24
+ Input: () => Input_default,
25
+ Modal: () => ModalCustom,
26
+ Select: () => Select_default
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+
30
+ // src/components/Button/Button.tsx
31
+ var import_antd = require("antd");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ function twColorVar(value) {
34
+ if (value.startsWith("[") && value.endsWith("]")) return value.slice(1, -1);
35
+ if (value === "transparent") return "transparent";
36
+ if (value === "current") return "currentColor";
37
+ if (value === "inherit") return "inherit";
38
+ return `var(--color-${value})`;
39
+ }
40
+ function antdVarsFromClassName(className) {
41
+ const vars = {};
42
+ let baseBg;
43
+ let baseColor;
44
+ for (const cls of className.split(" ")) {
45
+ if (/^bg-/.test(cls)) {
46
+ baseBg = twColorVar(cls.slice(3));
47
+ vars["--ant-button-default-bg"] = baseBg;
48
+ vars["--ant-button-default-active-bg"] = baseBg;
49
+ } else if (/^hover:bg-/.test(cls)) {
50
+ vars["--ant-button-default-hover-bg"] = twColorVar(cls.slice(9));
51
+ } else if (/^text-/.test(cls)) {
52
+ baseColor = twColorVar(cls.slice(5));
53
+ vars["--ant-button-default-color"] = baseColor;
54
+ vars["--ant-button-default-active-color"] = baseColor;
55
+ } else if (/^hover:text-/.test(cls)) {
56
+ vars["--ant-button-default-hover-color"] = twColorVar(cls.slice(11));
57
+ }
58
+ }
59
+ if (baseBg && !vars["--ant-button-default-hover-bg"]) {
60
+ vars["--ant-button-default-hover-bg"] = baseBg;
61
+ }
62
+ if (baseColor && !vars["--ant-button-default-hover-color"]) {
63
+ vars["--ant-button-default-hover-color"] = baseColor;
64
+ }
65
+ return vars;
66
+ }
67
+ function ButtonCustom({
68
+ className = "",
69
+ containerClassName = "",
70
+ style,
71
+ children,
72
+ ...antdProps
73
+ }) {
74
+ const bgVars = antdVarsFromClassName(className);
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: containerClassName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
+ import_antd.ConfigProvider,
77
+ {
78
+ theme: {
79
+ cssVar: true,
80
+ components: {
81
+ Button: {
82
+ defaultShadow: "none",
83
+ defaultColor: "inherit",
84
+ defaultBg: "transparent",
85
+ defaultBorderColor: "transparent",
86
+ defaultHoverColor: "inherit",
87
+ defaultHoverBg: "transparent",
88
+ defaultHoverBorderColor: "transparent",
89
+ defaultActiveColor: "inherit",
90
+ defaultActiveBg: "transparent",
91
+ defaultActiveBorderColor: "transparent"
92
+ }
93
+ }
94
+ },
95
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { className, style: { ...bgVars, ...style }, ...antdProps, children })
96
+ }
97
+ ) });
98
+ }
99
+
100
+ // src/components/Input/Input.tsx
101
+ var import_react = require("react");
102
+ var import_antd2 = require("antd");
103
+ var import_jsx_runtime2 = require("react/jsx-runtime");
104
+ var masks = {
105
+ cpf: (value) => {
106
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
107
+ },
108
+ cnpj: (value) => {
109
+ return value.replace(/\D/g, "").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").replace(/(-\d{2})\d+?$/, "$1");
110
+ },
111
+ cep: (value) => {
112
+ return value.replace(/\D/g, "").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{3})\d+?$/, "$1");
113
+ },
114
+ telefone: (value) => {
115
+ const cleaned = value.replace(/\D/g, "");
116
+ if (cleaned.length <= 10) {
117
+ return cleaned.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
118
+ } else {
119
+ return cleaned.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
120
+ }
121
+ },
122
+ celular: (value) => {
123
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
124
+ }
125
+ };
126
+ var getAutoPlaceholder = (label, fem) => {
127
+ if (!label) return "";
128
+ const article = fem ? "a" : "o";
129
+ const lowerLabel = label.toLowerCase();
130
+ return `Digite ${article} ${lowerLabel}`;
131
+ };
132
+ var InputCustom = (0, import_react.forwardRef)(
133
+ ({
134
+ label,
135
+ fem = false,
136
+ mask,
137
+ error,
138
+ helperText,
139
+ required = false,
140
+ onChange,
141
+ placeholder,
142
+ autoPlaceholder = true,
143
+ value,
144
+ className = "",
145
+ containerClassName = "",
146
+ labelClassName = "",
147
+ style = {},
148
+ ...antdProps
149
+ }, ref) => {
150
+ const [internalValue, setInternalValue] = (0, import_react.useState)("");
151
+ (0, import_react.useEffect)(() => {
152
+ const stringValue = value?.toString() || "";
153
+ const maskedValue = applyMask(stringValue);
154
+ if (maskedValue !== internalValue) {
155
+ setInternalValue(maskedValue);
156
+ }
157
+ }, [value]);
158
+ const applyMask = (inputValue) => {
159
+ if (!mask || !masks[mask]) return inputValue;
160
+ return masks[mask](inputValue);
161
+ };
162
+ const handleChange = (e) => {
163
+ let inputValue = e.target.value;
164
+ if (mask) {
165
+ const maxLengths = {
166
+ cpf: 11,
167
+ cnpj: 14,
168
+ cep: 8,
169
+ telefone: 11,
170
+ celular: 11
171
+ };
172
+ const numbersOnly = inputValue.replace(/\D/g, "");
173
+ const limitedNumbers = numbersOnly.slice(0, maxLengths[mask]);
174
+ const maskedValue = applyMask(limitedNumbers);
175
+ setInternalValue(maskedValue);
176
+ onChange?.(limitedNumbers);
177
+ } else {
178
+ setInternalValue(inputValue);
179
+ onChange?.(inputValue);
180
+ }
181
+ };
182
+ const finalPlaceholder = placeholder || (autoPlaceholder && label ? getAutoPlaceholder(label, fem) : "");
183
+ const containerClass = `w-full mb-4 ${containerClassName}`;
184
+ const labelClass = `block text-start text-sm font-medium mb-1 ${error ? "text-red-500" : ""} ${labelClassName}`;
185
+ const errorClass = "text-xs text-red-500 mt-1";
186
+ const helperClass = "text-xs text-gray-500 mt-1";
187
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: containerClass, style, children: [
188
+ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: labelClass, children: [
189
+ label,
190
+ required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
191
+ ] }),
192
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
193
+ import_antd2.Input,
194
+ {
195
+ ref,
196
+ value: internalValue,
197
+ onChange: handleChange,
198
+ placeholder: finalPlaceholder,
199
+ status: error ? "error" : void 0,
200
+ className,
201
+ ...antdProps
202
+ }
203
+ ),
204
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: errorClass, children: error }),
205
+ helperText && !error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: helperClass, children: helperText })
206
+ ] });
207
+ }
208
+ );
209
+ InputCustom.displayName = "CustomInput";
210
+ var Input_default = InputCustom;
211
+
212
+ // src/components/Select/Select.tsx
213
+ var import_react2 = require("react");
214
+ var import_antd3 = require("antd");
215
+ var import_jsx_runtime3 = require("react/jsx-runtime");
216
+ var SelectCustom = (0, import_react2.forwardRef)(
217
+ ({
218
+ label,
219
+ fem = false,
220
+ error,
221
+ helperText,
222
+ required = false,
223
+ onChange,
224
+ placeholder,
225
+ value,
226
+ className = "",
227
+ style = {},
228
+ options = [],
229
+ multiple = false,
230
+ ...antdProps
231
+ }, ref) => {
232
+ const [internalValue, setInternalValue] = (0, import_react2.useState)(value || []);
233
+ (0, import_react2.useEffect)(() => {
234
+ if (value !== internalValue) {
235
+ setInternalValue(value || []);
236
+ }
237
+ }, [value]);
238
+ const handleChange = (selectedValue) => {
239
+ setInternalValue(selectedValue);
240
+ onChange?.(selectedValue);
241
+ };
242
+ const finalPlaceholder = placeholder || (label ? `Selecione ${label}` : "Selecione");
243
+ const containerClass = "w-full mb-4";
244
+ const labelClass = `block text-start text-sm font-medium mb-1 ${error ? "text-red-500" : "text-black-600"}`;
245
+ const errorClass = "text-xs text-red-500 mt-1";
246
+ const helperClass = "text-xs text-gray-500 mt-1";
247
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: containerClass, style, children: [
248
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: labelClass, children: [
249
+ label,
250
+ required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
251
+ ] }),
252
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
253
+ import_antd3.Select,
254
+ {
255
+ ref,
256
+ value: internalValue,
257
+ onChange: handleChange,
258
+ placeholder: finalPlaceholder,
259
+ mode: multiple ? "multiple" : void 0,
260
+ options,
261
+ status: error ? "error" : void 0,
262
+ className,
263
+ ...antdProps
264
+ }
265
+ ),
266
+ error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: errorClass, children: error }),
267
+ helperText && !error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: helperClass, children: helperText })
268
+ ] });
269
+ }
270
+ );
271
+ SelectCustom.displayName = "CustomSelect";
272
+ var Select_default = SelectCustom;
273
+
274
+ // src/components/Modal/Modal.tsx
275
+ var import_react3 = require("@phosphor-icons/react");
276
+ var import_jsx_runtime4 = require("react/jsx-runtime");
277
+ function ModalCustom({
278
+ height,
279
+ width,
280
+ component,
281
+ onClose,
282
+ title
283
+ }) {
284
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
285
+ "section",
286
+ {
287
+ className: "flex items-center justify-center w-full h-full absolute inset-0 bg-black/50",
288
+ onClick: onClose,
289
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
290
+ "div",
291
+ {
292
+ className: "relative flex flex-col rounded-xl bg-white",
293
+ style: { width: `${width}px`, height: `${height}px` },
294
+ onClick: (e) => e.stopPropagation(),
295
+ children: [
296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex", children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "p-3 text-xl", children: title ? title : "" }),
298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
299
+ "button",
300
+ {
301
+ className: "absolute cursor-pointer top-3 right-3 text-gray-400 hover:text-gray-700 transition-colors",
302
+ onClick: onClose,
303
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.X, { size: 20, weight: "bold" })
304
+ }
305
+ )
306
+ ] }),
307
+ component
308
+ ]
309
+ }
310
+ )
311
+ }
312
+ );
313
+ }
314
+ // Annotate the CommonJS export names for ESM import in node:
315
+ 0 && (module.exports = {
316
+ Button,
317
+ Input,
318
+ Modal,
319
+ Select
320
+ });
@@ -0,0 +1,51 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ButtonProps, InputProps, InputRef, SelectProps } from 'antd';
3
+ import * as React$1 from 'react';
4
+ import React__default, { ReactNode } from 'react';
5
+
6
+ type ButtonCustomProps = ButtonProps & {
7
+ className?: string;
8
+ containerClassName?: string;
9
+ children: ReactNode;
10
+ };
11
+ declare function ButtonCustom({ className, containerClassName, style, children, ...antdProps }: ButtonCustomProps): react_jsx_runtime.JSX.Element;
12
+
13
+ type MaskType = "cpf" | "cnpj" | "cep" | "telefone" | "celular";
14
+ interface CustomInputProps extends Omit<InputProps, "onChange"> {
15
+ label?: string;
16
+ fem?: boolean;
17
+ mask?: MaskType;
18
+ error?: string;
19
+ helperText?: string;
20
+ required?: boolean;
21
+ onChange?: (value: string) => void;
22
+ autoPlaceholder?: boolean;
23
+ containerClassName?: string;
24
+ labelClassName?: string;
25
+ }
26
+ declare const InputCustom: React__default.ForwardRefExoticComponent<CustomInputProps & React__default.RefAttributes<InputRef>>;
27
+
28
+ interface CustomSelectProps extends Omit<SelectProps, "onChange" | "options"> {
29
+ label?: string;
30
+ fem?: boolean;
31
+ error?: string;
32
+ helperText?: string;
33
+ required?: boolean;
34
+ onChange?: (value: string | string[]) => void;
35
+ options: {
36
+ value: string;
37
+ label: string;
38
+ }[];
39
+ multiple?: boolean;
40
+ }
41
+ declare const SelectCustom: React$1.ForwardRefExoticComponent<CustomSelectProps & React$1.RefAttributes<any>>;
42
+
43
+ declare function ModalCustom({ height, width, component, onClose, title, }: {
44
+ height: string;
45
+ width: string;
46
+ component: React.ReactNode;
47
+ onClose: () => void;
48
+ title?: string;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ export { ButtonCustom as Button, InputCustom as Input, ModalCustom as Modal, SelectCustom as Select };
@@ -0,0 +1,51 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ButtonProps, InputProps, InputRef, SelectProps } from 'antd';
3
+ import * as React$1 from 'react';
4
+ import React__default, { ReactNode } from 'react';
5
+
6
+ type ButtonCustomProps = ButtonProps & {
7
+ className?: string;
8
+ containerClassName?: string;
9
+ children: ReactNode;
10
+ };
11
+ declare function ButtonCustom({ className, containerClassName, style, children, ...antdProps }: ButtonCustomProps): react_jsx_runtime.JSX.Element;
12
+
13
+ type MaskType = "cpf" | "cnpj" | "cep" | "telefone" | "celular";
14
+ interface CustomInputProps extends Omit<InputProps, "onChange"> {
15
+ label?: string;
16
+ fem?: boolean;
17
+ mask?: MaskType;
18
+ error?: string;
19
+ helperText?: string;
20
+ required?: boolean;
21
+ onChange?: (value: string) => void;
22
+ autoPlaceholder?: boolean;
23
+ containerClassName?: string;
24
+ labelClassName?: string;
25
+ }
26
+ declare const InputCustom: React__default.ForwardRefExoticComponent<CustomInputProps & React__default.RefAttributes<InputRef>>;
27
+
28
+ interface CustomSelectProps extends Omit<SelectProps, "onChange" | "options"> {
29
+ label?: string;
30
+ fem?: boolean;
31
+ error?: string;
32
+ helperText?: string;
33
+ required?: boolean;
34
+ onChange?: (value: string | string[]) => void;
35
+ options: {
36
+ value: string;
37
+ label: string;
38
+ }[];
39
+ multiple?: boolean;
40
+ }
41
+ declare const SelectCustom: React$1.ForwardRefExoticComponent<CustomSelectProps & React$1.RefAttributes<any>>;
42
+
43
+ declare function ModalCustom({ height, width, component, onClose, title, }: {
44
+ height: string;
45
+ width: string;
46
+ component: React.ReactNode;
47
+ onClose: () => void;
48
+ title?: string;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ export { ButtonCustom as Button, InputCustom as Input, ModalCustom as Modal, SelectCustom as Select };
package/dist/index.js ADDED
@@ -0,0 +1,290 @@
1
+ // src/components/Button/Button.tsx
2
+ import { Button, ConfigProvider } from "antd";
3
+ import { jsx } from "react/jsx-runtime";
4
+ function twColorVar(value) {
5
+ if (value.startsWith("[") && value.endsWith("]")) return value.slice(1, -1);
6
+ if (value === "transparent") return "transparent";
7
+ if (value === "current") return "currentColor";
8
+ if (value === "inherit") return "inherit";
9
+ return `var(--color-${value})`;
10
+ }
11
+ function antdVarsFromClassName(className) {
12
+ const vars = {};
13
+ let baseBg;
14
+ let baseColor;
15
+ for (const cls of className.split(" ")) {
16
+ if (/^bg-/.test(cls)) {
17
+ baseBg = twColorVar(cls.slice(3));
18
+ vars["--ant-button-default-bg"] = baseBg;
19
+ vars["--ant-button-default-active-bg"] = baseBg;
20
+ } else if (/^hover:bg-/.test(cls)) {
21
+ vars["--ant-button-default-hover-bg"] = twColorVar(cls.slice(9));
22
+ } else if (/^text-/.test(cls)) {
23
+ baseColor = twColorVar(cls.slice(5));
24
+ vars["--ant-button-default-color"] = baseColor;
25
+ vars["--ant-button-default-active-color"] = baseColor;
26
+ } else if (/^hover:text-/.test(cls)) {
27
+ vars["--ant-button-default-hover-color"] = twColorVar(cls.slice(11));
28
+ }
29
+ }
30
+ if (baseBg && !vars["--ant-button-default-hover-bg"]) {
31
+ vars["--ant-button-default-hover-bg"] = baseBg;
32
+ }
33
+ if (baseColor && !vars["--ant-button-default-hover-color"]) {
34
+ vars["--ant-button-default-hover-color"] = baseColor;
35
+ }
36
+ return vars;
37
+ }
38
+ function ButtonCustom({
39
+ className = "",
40
+ containerClassName = "",
41
+ style,
42
+ children,
43
+ ...antdProps
44
+ }) {
45
+ const bgVars = antdVarsFromClassName(className);
46
+ return /* @__PURE__ */ jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsx(
47
+ ConfigProvider,
48
+ {
49
+ theme: {
50
+ cssVar: true,
51
+ components: {
52
+ Button: {
53
+ defaultShadow: "none",
54
+ defaultColor: "inherit",
55
+ defaultBg: "transparent",
56
+ defaultBorderColor: "transparent",
57
+ defaultHoverColor: "inherit",
58
+ defaultHoverBg: "transparent",
59
+ defaultHoverBorderColor: "transparent",
60
+ defaultActiveColor: "inherit",
61
+ defaultActiveBg: "transparent",
62
+ defaultActiveBorderColor: "transparent"
63
+ }
64
+ }
65
+ },
66
+ children: /* @__PURE__ */ jsx(Button, { className, style: { ...bgVars, ...style }, ...antdProps, children })
67
+ }
68
+ ) });
69
+ }
70
+
71
+ // src/components/Input/Input.tsx
72
+ import { useState, useEffect, forwardRef } from "react";
73
+ import { Input as AntdInput } from "antd";
74
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
75
+ var masks = {
76
+ cpf: (value) => {
77
+ return value.replace(/\D/g, "").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})/, "$1-$2").replace(/(-\d{2})\d+?$/, "$1");
78
+ },
79
+ cnpj: (value) => {
80
+ return value.replace(/\D/g, "").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").replace(/(-\d{2})\d+?$/, "$1");
81
+ },
82
+ cep: (value) => {
83
+ return value.replace(/\D/g, "").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{3})\d+?$/, "$1");
84
+ },
85
+ telefone: (value) => {
86
+ const cleaned = value.replace(/\D/g, "");
87
+ if (cleaned.length <= 10) {
88
+ return cleaned.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
89
+ } else {
90
+ return cleaned.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
91
+ }
92
+ },
93
+ celular: (value) => {
94
+ return value.replace(/\D/g, "").replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2").replace(/(-\d{4})\d+?$/, "$1");
95
+ }
96
+ };
97
+ var getAutoPlaceholder = (label, fem) => {
98
+ if (!label) return "";
99
+ const article = fem ? "a" : "o";
100
+ const lowerLabel = label.toLowerCase();
101
+ return `Digite ${article} ${lowerLabel}`;
102
+ };
103
+ var InputCustom = forwardRef(
104
+ ({
105
+ label,
106
+ fem = false,
107
+ mask,
108
+ error,
109
+ helperText,
110
+ required = false,
111
+ onChange,
112
+ placeholder,
113
+ autoPlaceholder = true,
114
+ value,
115
+ className = "",
116
+ containerClassName = "",
117
+ labelClassName = "",
118
+ style = {},
119
+ ...antdProps
120
+ }, ref) => {
121
+ const [internalValue, setInternalValue] = useState("");
122
+ useEffect(() => {
123
+ const stringValue = value?.toString() || "";
124
+ const maskedValue = applyMask(stringValue);
125
+ if (maskedValue !== internalValue) {
126
+ setInternalValue(maskedValue);
127
+ }
128
+ }, [value]);
129
+ const applyMask = (inputValue) => {
130
+ if (!mask || !masks[mask]) return inputValue;
131
+ return masks[mask](inputValue);
132
+ };
133
+ const handleChange = (e) => {
134
+ let inputValue = e.target.value;
135
+ if (mask) {
136
+ const maxLengths = {
137
+ cpf: 11,
138
+ cnpj: 14,
139
+ cep: 8,
140
+ telefone: 11,
141
+ celular: 11
142
+ };
143
+ const numbersOnly = inputValue.replace(/\D/g, "");
144
+ const limitedNumbers = numbersOnly.slice(0, maxLengths[mask]);
145
+ const maskedValue = applyMask(limitedNumbers);
146
+ setInternalValue(maskedValue);
147
+ onChange?.(limitedNumbers);
148
+ } else {
149
+ setInternalValue(inputValue);
150
+ onChange?.(inputValue);
151
+ }
152
+ };
153
+ const finalPlaceholder = placeholder || (autoPlaceholder && label ? getAutoPlaceholder(label, fem) : "");
154
+ const containerClass = `w-full mb-4 ${containerClassName}`;
155
+ const labelClass = `block text-start text-sm font-medium mb-1 ${error ? "text-red-500" : ""} ${labelClassName}`;
156
+ const errorClass = "text-xs text-red-500 mt-1";
157
+ const helperClass = "text-xs text-gray-500 mt-1";
158
+ return /* @__PURE__ */ jsxs("div", { className: containerClass, style, children: [
159
+ label && /* @__PURE__ */ jsxs("label", { className: labelClass, children: [
160
+ label,
161
+ required && /* @__PURE__ */ jsx2("span", { className: "text-red-500 ml-1", children: "*" })
162
+ ] }),
163
+ /* @__PURE__ */ jsx2(
164
+ AntdInput,
165
+ {
166
+ ref,
167
+ value: internalValue,
168
+ onChange: handleChange,
169
+ placeholder: finalPlaceholder,
170
+ status: error ? "error" : void 0,
171
+ className,
172
+ ...antdProps
173
+ }
174
+ ),
175
+ error && /* @__PURE__ */ jsx2("div", { className: errorClass, children: error }),
176
+ helperText && !error && /* @__PURE__ */ jsx2("div", { className: helperClass, children: helperText })
177
+ ] });
178
+ }
179
+ );
180
+ InputCustom.displayName = "CustomInput";
181
+ var Input_default = InputCustom;
182
+
183
+ // src/components/Select/Select.tsx
184
+ import { useState as useState2, useEffect as useEffect2, forwardRef as forwardRef2 } from "react";
185
+ import { Select } from "antd";
186
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
187
+ var SelectCustom = forwardRef2(
188
+ ({
189
+ label,
190
+ fem = false,
191
+ error,
192
+ helperText,
193
+ required = false,
194
+ onChange,
195
+ placeholder,
196
+ value,
197
+ className = "",
198
+ style = {},
199
+ options = [],
200
+ multiple = false,
201
+ ...antdProps
202
+ }, ref) => {
203
+ const [internalValue, setInternalValue] = useState2(value || []);
204
+ useEffect2(() => {
205
+ if (value !== internalValue) {
206
+ setInternalValue(value || []);
207
+ }
208
+ }, [value]);
209
+ const handleChange = (selectedValue) => {
210
+ setInternalValue(selectedValue);
211
+ onChange?.(selectedValue);
212
+ };
213
+ const finalPlaceholder = placeholder || (label ? `Selecione ${label}` : "Selecione");
214
+ const containerClass = "w-full mb-4";
215
+ const labelClass = `block text-start text-sm font-medium mb-1 ${error ? "text-red-500" : "text-black-600"}`;
216
+ const errorClass = "text-xs text-red-500 mt-1";
217
+ const helperClass = "text-xs text-gray-500 mt-1";
218
+ return /* @__PURE__ */ jsxs2("div", { className: containerClass, style, children: [
219
+ label && /* @__PURE__ */ jsxs2("label", { className: labelClass, children: [
220
+ label,
221
+ required && /* @__PURE__ */ jsx3("span", { className: "text-red-500 ml-1", children: "*" })
222
+ ] }),
223
+ /* @__PURE__ */ jsx3(
224
+ Select,
225
+ {
226
+ ref,
227
+ value: internalValue,
228
+ onChange: handleChange,
229
+ placeholder: finalPlaceholder,
230
+ mode: multiple ? "multiple" : void 0,
231
+ options,
232
+ status: error ? "error" : void 0,
233
+ className,
234
+ ...antdProps
235
+ }
236
+ ),
237
+ error && /* @__PURE__ */ jsx3("div", { className: errorClass, children: error }),
238
+ helperText && !error && /* @__PURE__ */ jsx3("div", { className: helperClass, children: helperText })
239
+ ] });
240
+ }
241
+ );
242
+ SelectCustom.displayName = "CustomSelect";
243
+ var Select_default = SelectCustom;
244
+
245
+ // src/components/Modal/Modal.tsx
246
+ import { X } from "@phosphor-icons/react";
247
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
248
+ function ModalCustom({
249
+ height,
250
+ width,
251
+ component,
252
+ onClose,
253
+ title
254
+ }) {
255
+ return /* @__PURE__ */ jsx4(
256
+ "section",
257
+ {
258
+ className: "flex items-center justify-center w-full h-full absolute inset-0 bg-black/50",
259
+ onClick: onClose,
260
+ children: /* @__PURE__ */ jsxs3(
261
+ "div",
262
+ {
263
+ className: "relative flex flex-col rounded-xl bg-white",
264
+ style: { width: `${width}px`, height: `${height}px` },
265
+ onClick: (e) => e.stopPropagation(),
266
+ children: [
267
+ /* @__PURE__ */ jsxs3("div", { className: "flex", children: [
268
+ /* @__PURE__ */ jsx4("div", { className: "p-3 text-xl", children: title ? title : "" }),
269
+ /* @__PURE__ */ jsx4(
270
+ "button",
271
+ {
272
+ className: "absolute cursor-pointer top-3 right-3 text-gray-400 hover:text-gray-700 transition-colors",
273
+ onClick: onClose,
274
+ children: /* @__PURE__ */ jsx4(X, { size: 20, weight: "bold" })
275
+ }
276
+ )
277
+ ] }),
278
+ component
279
+ ]
280
+ }
281
+ )
282
+ }
283
+ );
284
+ }
285
+ export {
286
+ ButtonCustom as Button,
287
+ Input_default as Input,
288
+ ModalCustom as Modal,
289
+ Select_default as Select
290
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@seygo/ui",
3
+ "version": "0.1.0",
4
+ "description": "Biblioteca de componentes UI da Seygo — wrappers do Ant Design com padrões internos",
5
+ "license": "MIT",
6
+ "keywords": ["seygo", "ui", "components", "antd", "react"],
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/seygo/seygo-frontend-componentes"
10
+ },
11
+ "type": "module",
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.mjs",
19
+ "require": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "build:watch": "tsup --watch",
28
+ "typecheck": "tsc -p tsconfig.json --noEmit",
29
+ "prepublishOnly": "pnpm build"
30
+ },
31
+ "dependencies": {
32
+ "@phosphor-icons/react": "^2.1.10"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^19.1.1",
36
+ "react-dom": "^19.1.1",
37
+ "antd": "^5.27.2",
38
+ "tailwindcss": "^4.1.12"
39
+ },
40
+ "devDependencies": {
41
+ "@types/react": "^19.1.10",
42
+ "@types/react-dom": "^19.1.7",
43
+ "antd": "^5.27.2",
44
+ "react": "^19.1.1",
45
+ "react-dom": "^19.1.1",
46
+ "tailwindcss": "^4.1.12",
47
+ "tsup": "^8.5.0",
48
+ "typescript": "~5.8.3"
49
+ }
50
+ }