@seedgrid/fe-components 0.2.4 → 0.2.7
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/package.json +3 -2
- package/dist/buttons/SgSpeedDial.d.ts +0 -40
- package/dist/buttons/SgSpeedDial.d.ts.map +0 -1
- package/dist/buttons/SgSpeedDial.js +0 -149
- package/dist/clock/SgClock.d.ts +0 -28
- package/dist/clock/SgClock.d.ts.map +0 -1
- package/dist/clock/SgClock.js +0 -280
- package/dist/clock/SgTimeProvider.d.ts +0 -13
- package/dist/clock/SgTimeProvider.d.ts.map +0 -1
- package/dist/clock/SgTimeProvider.js +0 -44
- package/dist/clock/themes/SgClockThemePicker.d.ts +0 -14
- package/dist/clock/themes/SgClockThemePicker.d.ts.map +0 -1
- package/dist/clock/themes/SgClockThemePicker.js +0 -71
- package/dist/clock/themes/SgClockThemePreview.d.ts +0 -7
- package/dist/clock/themes/SgClockThemePreview.d.ts.map +0 -1
- package/dist/clock/themes/SgClockThemePreview.js +0 -11
- package/dist/clock/themes/builtins.d.ts +0 -3
- package/dist/clock/themes/builtins.d.ts.map +0 -1
- package/dist/clock/themes/builtins.js +0 -241
- package/dist/clock/themes/index.d.ts +0 -9
- package/dist/clock/themes/index.d.ts.map +0 -1
- package/dist/clock/themes/index.js +0 -7
- package/dist/clock/themes/provider.d.ts +0 -19
- package/dist/clock/themes/provider.d.ts.map +0 -1
- package/dist/clock/themes/provider.js +0 -54
- package/dist/clock/themes/registry.d.ts +0 -9
- package/dist/clock/themes/registry.d.ts.map +0 -1
- package/dist/clock/themes/registry.js +0 -25
- package/dist/clock/themes/renderTheme.d.ts +0 -7
- package/dist/clock/themes/renderTheme.d.ts.map +0 -1
- package/dist/clock/themes/renderTheme.js +0 -41
- package/dist/clock/themes/types.d.ts +0 -21
- package/dist/clock/themes/types.d.ts.map +0 -1
- package/dist/clock/themes/types.js +0 -1
- package/dist/clock/themes/urlThemeCache.d.ts +0 -2
- package/dist/clock/themes/urlThemeCache.d.ts.map +0 -1
- package/dist/clock/themes/urlThemeCache.js +0 -11
- package/dist/clock/themes/useDarkFlag.d.ts +0 -2
- package/dist/clock/themes/useDarkFlag.d.ts.map +0 -1
- package/dist/clock/themes/useDarkFlag.js +0 -14
- package/dist/commons/SgButton.d.ts +0 -39
- package/dist/commons/SgButton.d.ts.map +0 -1
- package/dist/commons/SgButton.js +0 -116
- package/dist/commons/SgPopup.d.ts +0 -42
- package/dist/commons/SgPopup.d.ts.map +0 -1
- package/dist/commons/SgPopup.js +0 -218
- package/dist/inputs/FloatingInput.d.ts +0 -13
- package/dist/inputs/FloatingInput.d.ts.map +0 -1
- package/dist/inputs/FloatingInput.js +0 -53
- package/dist/inputs/FloatingSelect.d.ts +0 -15
- package/dist/inputs/FloatingSelect.d.ts.map +0 -1
- package/dist/inputs/FloatingSelect.js +0 -52
- package/dist/inputs/FloatingTextArea.d.ts +0 -11
- package/dist/inputs/FloatingTextArea.d.ts.map +0 -1
- package/dist/inputs/FloatingTextArea.js +0 -34
- package/dist/inputs/InputBirthDate.d.ts +0 -13
- package/dist/inputs/InputBirthDate.d.ts.map +0 -1
- package/dist/inputs/InputBirthDate.js +0 -46
- package/dist/inputs/InputDate.d.ts +0 -8
- package/dist/inputs/InputDate.d.ts.map +0 -1
- package/dist/inputs/InputDate.js +0 -23
- package/dist/inputs/InputEmail.d.ts +0 -14
- package/dist/inputs/InputEmail.d.ts.map +0 -1
- package/dist/inputs/InputEmail.js +0 -43
- package/dist/inputs/InputPassword.d.ts +0 -12
- package/dist/inputs/InputPassword.d.ts.map +0 -1
- package/dist/inputs/InputPassword.js +0 -42
- package/dist/inputs/MaskedInputs.d.ts +0 -27
- package/dist/inputs/MaskedInputs.d.ts.map +0 -1
- package/dist/inputs/MaskedInputs.js +0 -161
- package/dist/inputs/SgInputCEP.d.ts +0 -33
- package/dist/inputs/SgInputCEP.d.ts.map +0 -1
- package/dist/inputs/SgInputCEP.js +0 -117
- package/dist/inputs/SgInputFone.d.ts +0 -15
- package/dist/inputs/SgInputFone.d.ts.map +0 -1
- package/dist/inputs/SgInputFone.js +0 -60
- package/dist/inputs/SgInputMasked.d.ts +0 -27
- package/dist/inputs/SgInputMasked.d.ts.map +0 -1
- package/dist/inputs/SgInputMasked.js +0 -161
- package/dist/layout/GroupBox.d.ts +0 -10
- package/dist/layout/GroupBox.d.ts.map +0 -1
- package/dist/layout/GroupBox.js +0 -14
- /package/dist/wizard/{SGWizard.d.ts → SgWizard.d.ts} +0 -0
- /package/dist/wizard/{SGWizard.d.ts.map → SgWizard.d.ts.map} +0 -0
- /package/dist/wizard/{SGWizard.js → SgWizard.js} +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type SgInputTextProps } from "./SgInputText";
|
|
3
|
-
type MaskedInputProps = Omit<SgInputTextProps, "inputProps" | "error"> & {
|
|
4
|
-
inputProps: React.InputHTMLAttributes<HTMLInputElement>;
|
|
5
|
-
mask: (value: string) => string;
|
|
6
|
-
};
|
|
7
|
-
type ValidationProps = {
|
|
8
|
-
error?: string;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
requiredMessage?: string;
|
|
11
|
-
lengthMessage?: string;
|
|
12
|
-
invalidMessage?: string;
|
|
13
|
-
onValidation?: (message: string | null) => void;
|
|
14
|
-
validateOnBlur?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type SgInputCPFProps = Omit<MaskedInputProps, "mask"> & ValidationProps;
|
|
17
|
-
export declare function SgInputCPF(props: SgInputCPFProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export type SgInputCNPJProps = Omit<MaskedInputProps, "mask"> & ValidationProps;
|
|
19
|
-
export declare function SgInputCNPJ(props: SgInputCNPJProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export type SgInputCPFCNPJProps = Omit<MaskedInputProps, "mask"> & ValidationProps;
|
|
21
|
-
export declare function SgInputCPFCNPJ(props: SgInputCPFCNPJProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export type SgInputCEPProps = Omit<MaskedInputProps, "mask"> & ValidationProps;
|
|
23
|
-
export declare function SgInputCEP(props: SgInputCEPProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export type SgInputFoneProps = Omit<MaskedInputProps, "mask"> & ValidationProps;
|
|
25
|
-
export declare function SgInputFone(props: SgInputFoneProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=SgInputMasked.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputMasked.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputMasked.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAInE,KAAK,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG;IACvE,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACxD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACjC,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAqCF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAE/E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA4BhD;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAEhF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA4BlD;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAEnF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA+BxD;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAE/E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA2BhD;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAEhF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA6BlD"}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { SgInputText } from "./SgInputText";
|
|
5
|
-
import { maskCep, maskCnpj, maskCpf, maskCpfCnpj, maskPhone } from "../masks";
|
|
6
|
-
import { isValidCnpj, isValidCpf } from "../validators";
|
|
7
|
-
function onlyDigits(value) {
|
|
8
|
-
return value.replace(/\D/g, "");
|
|
9
|
-
}
|
|
10
|
-
function useValidationState(props, validateFn) {
|
|
11
|
-
const [internalError, setInternalError] = React.useState(null);
|
|
12
|
-
const runValidation = React.useCallback((value) => {
|
|
13
|
-
const message = validateFn(value);
|
|
14
|
-
setInternalError(message);
|
|
15
|
-
props.onValidation?.(message);
|
|
16
|
-
return message;
|
|
17
|
-
}, [props, validateFn]);
|
|
18
|
-
return { internalError, runValidation };
|
|
19
|
-
}
|
|
20
|
-
function applyMaskProps(props, inputMode) {
|
|
21
|
-
const { inputProps, mask } = props;
|
|
22
|
-
const onChange = inputProps.onChange;
|
|
23
|
-
return {
|
|
24
|
-
...inputProps,
|
|
25
|
-
inputMode: inputProps.inputMode ?? inputMode,
|
|
26
|
-
onChange: (event) => {
|
|
27
|
-
event.target.value = mask(event.target.value);
|
|
28
|
-
onChange?.(event);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export function SgInputCPF(props) {
|
|
33
|
-
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, ...rest } = props;
|
|
34
|
-
const { internalError, runValidation } = useValidationState(props, (value) => {
|
|
35
|
-
const digits = onlyDigits(value);
|
|
36
|
-
if (!digits && !required)
|
|
37
|
-
return null;
|
|
38
|
-
if (!digits && required)
|
|
39
|
-
return requiredMessage ?? "Informe o CPF.";
|
|
40
|
-
if (digits.length !== 11)
|
|
41
|
-
return lengthMessage ?? "CPF deve ter 11 dígitos.";
|
|
42
|
-
if (!isValidCpf(value))
|
|
43
|
-
return invalidMessage ?? "CPF inválido.";
|
|
44
|
-
return null;
|
|
45
|
-
});
|
|
46
|
-
const inputProps = applyMaskProps({ ...rest, mask: maskCpf }, "numeric");
|
|
47
|
-
const onBlur = inputProps.onBlur;
|
|
48
|
-
const shouldValidateOnBlur = validateOnBlur ?? true;
|
|
49
|
-
return (_jsx(SgInputText, { ...rest, error: error ?? internalError ?? undefined, inputProps: {
|
|
50
|
-
...inputProps,
|
|
51
|
-
onBlur: (event) => {
|
|
52
|
-
if (shouldValidateOnBlur)
|
|
53
|
-
runValidation(event.currentTarget.value);
|
|
54
|
-
onBlur?.(event);
|
|
55
|
-
}
|
|
56
|
-
} }));
|
|
57
|
-
}
|
|
58
|
-
export function SgInputCNPJ(props) {
|
|
59
|
-
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, ...rest } = props;
|
|
60
|
-
const { internalError, runValidation } = useValidationState(props, (value) => {
|
|
61
|
-
const digits = onlyDigits(value);
|
|
62
|
-
if (!digits && !required)
|
|
63
|
-
return null;
|
|
64
|
-
if (!digits && required)
|
|
65
|
-
return requiredMessage ?? "Informe o CNPJ.";
|
|
66
|
-
if (digits.length !== 14)
|
|
67
|
-
return lengthMessage ?? "CNPJ deve ter 14 dígitos.";
|
|
68
|
-
if (!isValidCnpj(value))
|
|
69
|
-
return invalidMessage ?? "CNPJ inválido.";
|
|
70
|
-
return null;
|
|
71
|
-
});
|
|
72
|
-
const inputProps = applyMaskProps({ ...rest, mask: maskCnpj }, "numeric");
|
|
73
|
-
const onBlur = inputProps.onBlur;
|
|
74
|
-
const shouldValidateOnBlur = validateOnBlur ?? true;
|
|
75
|
-
return (_jsx(SgInputText, { ...rest, error: error ?? internalError ?? undefined, inputProps: {
|
|
76
|
-
...inputProps,
|
|
77
|
-
onBlur: (event) => {
|
|
78
|
-
if (shouldValidateOnBlur)
|
|
79
|
-
runValidation(event.currentTarget.value);
|
|
80
|
-
onBlur?.(event);
|
|
81
|
-
}
|
|
82
|
-
} }));
|
|
83
|
-
}
|
|
84
|
-
export function SgInputCPFCNPJ(props) {
|
|
85
|
-
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, ...rest } = props;
|
|
86
|
-
const { internalError, runValidation } = useValidationState(props, (value) => {
|
|
87
|
-
const digits = onlyDigits(value);
|
|
88
|
-
if (!digits && !required)
|
|
89
|
-
return null;
|
|
90
|
-
if (!digits && required)
|
|
91
|
-
return requiredMessage ?? "Informe o documento.";
|
|
92
|
-
if (digits.length <= 11) {
|
|
93
|
-
if (digits.length !== 11)
|
|
94
|
-
return lengthMessage ?? "CPF deve ter 11 dígitos.";
|
|
95
|
-
return isValidCpf(value) ? null : (invalidMessage ?? "CPF inválido.");
|
|
96
|
-
}
|
|
97
|
-
if (digits.length !== 14)
|
|
98
|
-
return lengthMessage ?? "CNPJ deve ter 14 dígitos.";
|
|
99
|
-
return isValidCnpj(value) ? null : (invalidMessage ?? "CNPJ inválido.");
|
|
100
|
-
});
|
|
101
|
-
const inputProps = applyMaskProps({ ...rest, mask: maskCpfCnpj }, "numeric");
|
|
102
|
-
const onBlur = inputProps.onBlur;
|
|
103
|
-
const shouldValidateOnBlur = validateOnBlur ?? true;
|
|
104
|
-
return (_jsx(SgInputText, { ...rest, error: error ?? internalError ?? undefined, inputProps: {
|
|
105
|
-
...inputProps,
|
|
106
|
-
onBlur: (event) => {
|
|
107
|
-
if (shouldValidateOnBlur)
|
|
108
|
-
runValidation(event.currentTarget.value);
|
|
109
|
-
onBlur?.(event);
|
|
110
|
-
}
|
|
111
|
-
} }));
|
|
112
|
-
}
|
|
113
|
-
export function SgInputCEP(props) {
|
|
114
|
-
const { required, requiredMessage, lengthMessage, validateOnBlur, error, ...rest } = props;
|
|
115
|
-
const { internalError, runValidation } = useValidationState(props, (value) => {
|
|
116
|
-
const digits = onlyDigits(value);
|
|
117
|
-
if (!digits && !required)
|
|
118
|
-
return null;
|
|
119
|
-
if (!digits && required)
|
|
120
|
-
return requiredMessage ?? "Informe o CEP.";
|
|
121
|
-
if (digits.length !== 8)
|
|
122
|
-
return lengthMessage ?? "CEP deve ter 8 dígitos.";
|
|
123
|
-
return null;
|
|
124
|
-
});
|
|
125
|
-
const inputProps = applyMaskProps({ ...rest, mask: maskCep }, "numeric");
|
|
126
|
-
const onBlur = inputProps.onBlur;
|
|
127
|
-
const shouldValidateOnBlur = validateOnBlur ?? true;
|
|
128
|
-
return (_jsx(SgInputText, { ...rest, error: error ?? internalError ?? undefined, inputProps: {
|
|
129
|
-
...inputProps,
|
|
130
|
-
onBlur: (event) => {
|
|
131
|
-
if (shouldValidateOnBlur)
|
|
132
|
-
runValidation(event.currentTarget.value);
|
|
133
|
-
onBlur?.(event);
|
|
134
|
-
}
|
|
135
|
-
} }));
|
|
136
|
-
}
|
|
137
|
-
export function SgInputFone(props) {
|
|
138
|
-
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, ...rest } = props;
|
|
139
|
-
const { internalError, runValidation } = useValidationState(props, (value) => {
|
|
140
|
-
const digits = onlyDigits(value);
|
|
141
|
-
if (!digits && !required)
|
|
142
|
-
return null;
|
|
143
|
-
if (!digits && required)
|
|
144
|
-
return requiredMessage ?? "Informe o telefone.";
|
|
145
|
-
if (digits.length !== 10 && digits.length !== 11) {
|
|
146
|
-
return lengthMessage ?? invalidMessage ?? "Telefone inválido.";
|
|
147
|
-
}
|
|
148
|
-
return null;
|
|
149
|
-
});
|
|
150
|
-
const inputProps = applyMaskProps({ ...rest, mask: maskPhone }, "numeric");
|
|
151
|
-
const onBlur = inputProps.onBlur;
|
|
152
|
-
const shouldValidateOnBlur = validateOnBlur ?? true;
|
|
153
|
-
return (_jsx(SgInputText, { ...rest, error: error ?? internalError ?? undefined, inputProps: {
|
|
154
|
-
...inputProps,
|
|
155
|
-
onBlur: (event) => {
|
|
156
|
-
if (shouldValidateOnBlur)
|
|
157
|
-
runValidation(event.currentTarget.value);
|
|
158
|
-
onBlur?.(event);
|
|
159
|
-
}
|
|
160
|
-
} }));
|
|
161
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type SgGroupBoxProps = {
|
|
3
|
-
title: string;
|
|
4
|
-
height?: number | string;
|
|
5
|
-
width?: number | string;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function SgGroupBox(props: SgGroupBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=GroupBox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GroupBox.d.ts","sourceRoot":"","sources":["../../src/layout/GroupBox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAOF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAmBhD"}
|
package/dist/layout/GroupBox.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
function toCssSize(value) {
|
|
4
|
-
if (value === undefined || value === null)
|
|
5
|
-
return undefined;
|
|
6
|
-
return typeof value === "number" ? `${value}px` : value;
|
|
7
|
-
}
|
|
8
|
-
export function SgGroupBox(props) {
|
|
9
|
-
const { title, height, width, children, className } = props;
|
|
10
|
-
return (_jsx("div", { className: className, style: {
|
|
11
|
-
width: toCssSize(width) ?? "100%",
|
|
12
|
-
height: toCssSize(height)
|
|
13
|
-
}, children: _jsxs("fieldset", { className: "relative rounded-lg border border-border bg-white px-4 pb-4 pt-5", children: [_jsx("legend", { className: "px-2 text-xs font-semibold uppercase tracking-wider text-foreground/70", children: title }), _jsx("div", { children: children })] }) }));
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|