@pipelinesolucoes/form 1.2.0-beta.2 → 1.2.0-beta.20
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/components/ChipList.d.ts +9 -0
- package/dist/components/ChipList.js +60 -0
- package/dist/components/ChipList.js.map +1 -0
- package/dist/components/SelectField.d.ts +73 -0
- package/dist/components/SelectField.js +142 -0
- package/dist/components/SelectField.js.map +1 -0
- package/dist/components/TextFieldPassword.d.ts +140 -43
- package/dist/components/TextFieldPassword.js +159 -98
- package/dist/components/TextFieldPassword.js.map +1 -1
- package/dist/components/TextFieldValidate.d.ts +84 -38
- package/dist/components/TextFieldValidate.js +101 -94
- package/dist/components/TextFieldValidate.js.map +1 -1
- package/dist/components/login/ClickResult.d.ts +11 -0
- package/dist/components/login/ClickResult.js +2 -0
- package/dist/components/login/ClickResult.js.map +1 -0
- package/dist/components/login/FormLogin.d.ts +113 -94
- package/dist/components/login/FormLogin.js +136 -141
- package/dist/components/login/FormLogin.js.map +1 -1
- package/dist/components/login/FormPasswordRecovery.d.ts +97 -89
- package/dist/components/login/FormPasswordRecovery.js +131 -124
- package/dist/components/login/FormPasswordRecovery.js.map +1 -1
- package/dist/components/login/FormSignUp.d.ts +114 -100
- package/dist/components/login/FormSignUp.js +138 -153
- package/dist/components/login/FormSignUp.js.map +1 -1
- package/dist/components/login/StyleLogin.d.ts +14 -0
- package/dist/components/login/StyleLogin.js +57 -0
- package/dist/components/login/StyleLogin.js.map +1 -0
- package/dist/constant.d.ts +11 -0
- package/dist/constant.js +12 -0
- package/dist/constant.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/{components/style → style}/ButtonFormStyled.d.ts +1 -1
- package/dist/{components/style → style}/ButtonFormStyled.js +6 -5
- package/dist/style/ButtonFormStyled.js.map +1 -0
- package/dist/{components/style → style}/LinkFormStyled.d.ts +3 -3
- package/dist/style/LinkFormStyled.js +16 -0
- package/dist/style/LinkFormStyled.js.map +1 -0
- package/dist/style/TextFieldStyle.d.ts +17 -0
- package/dist/style/TextFieldStyle.js +59 -0
- package/dist/style/TextFieldStyle.js.map +1 -0
- package/dist/theme.js +46 -18
- package/dist/theme.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/FieldProps.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/style/ButtonFormStyled.js.map +0 -1
- package/dist/components/style/LinkFormStyled.js +0 -15
- package/dist/components/style/LinkFormStyled.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypographyVariant } from '@mui/material/styles';
|
|
3
|
+
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
4
|
+
export interface ChipListProps extends Pick<ColorProps, 'background' | 'color' | 'backgroundHover' | 'colorHover'>, Pick<LayoutProps, 'width' | 'height' | 'padding' | 'margin'>, BorderProps {
|
|
5
|
+
items: string[];
|
|
6
|
+
variant?: TypographyVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const ChipList: React.FC<ChipListProps>;
|
|
9
|
+
export default ChipList;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Chip from '@mui/material/Chip';
|
|
5
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
6
|
+
const StyledChipArea = styled(Box)({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
gap: 8,
|
|
10
|
+
});
|
|
11
|
+
const StyledChip = styled(Chip, {
|
|
12
|
+
shouldForwardProp: (prop) => ![
|
|
13
|
+
'width',
|
|
14
|
+
'height',
|
|
15
|
+
'padding',
|
|
16
|
+
'margin',
|
|
17
|
+
'background',
|
|
18
|
+
'colorText',
|
|
19
|
+
'borderRadius',
|
|
20
|
+
'boxShadow',
|
|
21
|
+
'border',
|
|
22
|
+
'backgroundHover',
|
|
23
|
+
'colorHover',
|
|
24
|
+
'typo',
|
|
25
|
+
].includes(prop),
|
|
26
|
+
})(({ width, height, padding, margin, background, colorText, borderRadius, boxShadow, border, backgroundHover, colorHover, typo }) => (Object.assign(Object.assign({ width,
|
|
27
|
+
height,
|
|
28
|
+
padding,
|
|
29
|
+
margin,
|
|
30
|
+
borderRadius,
|
|
31
|
+
boxShadow, backgroundColor: background, color: colorText, border }, (typo !== null && typo !== void 0 ? typo : {})), { '&:hover': {
|
|
32
|
+
backgroundColor: backgroundHover !== null && backgroundHover !== void 0 ? backgroundHover : background,
|
|
33
|
+
color: colorHover !== null && colorHover !== void 0 ? colorHover : colorText,
|
|
34
|
+
}, '&.MuiChip-outlined': {
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
}, '&.MuiChip-outlined:hover': {
|
|
37
|
+
backgroundColor: backgroundHover !== null && backgroundHover !== void 0 ? backgroundHover : 'transparent',
|
|
38
|
+
color: colorHover !== null && colorHover !== void 0 ? colorHover : colorText,
|
|
39
|
+
} })));
|
|
40
|
+
const ChipList = ({ items, variant, width, height, padding, margin, background, color, borderRadius, boxShadow, border, backgroundHover, colorHover, }) => {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
42
|
+
const theme = useTheme();
|
|
43
|
+
const themechip = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.chip;
|
|
44
|
+
const wchip = (_d = (_c = themechip === null || themechip === void 0 ? void 0 : themechip.width) !== null && _c !== void 0 ? _c : width) !== null && _d !== void 0 ? _d : '100%';
|
|
45
|
+
const hchip = (_f = (_e = themechip === null || themechip === void 0 ? void 0 : themechip.height) !== null && _e !== void 0 ? _e : height) !== null && _f !== void 0 ? _f : 'auto';
|
|
46
|
+
const pchip = (_h = (_g = themechip === null || themechip === void 0 ? void 0 : themechip.padding) !== null && _g !== void 0 ? _g : padding) !== null && _h !== void 0 ? _h : '16px';
|
|
47
|
+
const mchip = (_k = (_j = themechip === null || themechip === void 0 ? void 0 : themechip.margin) !== null && _j !== void 0 ? _j : margin) !== null && _k !== void 0 ? _k : '0';
|
|
48
|
+
const bchip = (_m = (_l = themechip === null || themechip === void 0 ? void 0 : themechip.background) !== null && _l !== void 0 ? _l : background) !== null && _m !== void 0 ? _m : '#ffffff';
|
|
49
|
+
const clchip = (_p = (_o = themechip === null || themechip === void 0 ? void 0 : themechip.color) !== null && _o !== void 0 ? _o : color) !== null && _p !== void 0 ? _p : 'inherit';
|
|
50
|
+
const brchip = (_r = (_q = themechip === null || themechip === void 0 ? void 0 : themechip.borderRadius) !== null && _q !== void 0 ? _q : borderRadius) !== null && _r !== void 0 ? _r : 'inherit';
|
|
51
|
+
const bschip = (_t = (_s = themechip === null || themechip === void 0 ? void 0 : themechip.boxShadow) !== null && _s !== void 0 ? _s : boxShadow) !== null && _t !== void 0 ? _t : 'none';
|
|
52
|
+
const bdchip = (_v = (_u = themechip === null || themechip === void 0 ? void 0 : themechip.border) !== null && _u !== void 0 ? _u : border) !== null && _v !== void 0 ? _v : 'inherit';
|
|
53
|
+
const bHoverchip = (_x = (_w = themechip === null || themechip === void 0 ? void 0 : themechip.backgroundHover) !== null && _w !== void 0 ? _w : backgroundHover) !== null && _x !== void 0 ? _x : bchip;
|
|
54
|
+
const clHoverchip = (_z = (_y = themechip === null || themechip === void 0 ? void 0 : themechip.colorHover) !== null && _y !== void 0 ? _y : colorHover) !== null && _z !== void 0 ? _z : clchip;
|
|
55
|
+
const typo = (_1 = (_0 = (variant && theme.typography[variant])) !== null && _0 !== void 0 ? _0 : themechip === null || themechip === void 0 ? void 0 : themechip.typography) !== null && _1 !== void 0 ? _1 : theme.typography.body1;
|
|
56
|
+
return (_jsx(StyledChipArea, { children: items.map((item, idx) => (_jsx(StyledChip, { label: item, width: wchip, height: hchip, padding: pchip, margin: mchip, background: bchip, colorText: clchip, borderRadius: brchip, boxShadow: bschip, border: bdchip, backgroundHover: bHoverchip, colorHover: clHoverchip, typo: typo }, `${item}-${idx}`))) }));
|
|
57
|
+
};
|
|
58
|
+
ChipList.displayName = 'ChipList';
|
|
59
|
+
export default ChipList;
|
|
60
|
+
//# sourceMappingURL=ChipList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipList.js","sourceRoot":"","sources":["../../src/components/ChipList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAa,MAAM,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYtF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,GAAG,EAAE,CAAC;CACP,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE;IAC9B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,OAAO;QACP,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,WAAW;QACX,cAAc;QACd,WAAW;QACX,QAAQ;QACR,iBAAiB;QACjB,YAAY;QACZ,MAAM;KACP,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CAcA,CAAC,EACC,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,SAAS,EACT,MAAM,EACN,eAAe,EACf,UAAU,EACV,IAAI,EACL,EAAE,EAAE,CAAC,+BACJ,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,YAAY;IACZ,SAAS,EACT,eAAe,EAAE,UAAU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E,KAAK,EACjB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,UAAU,EAC3B,UAAU,EAAE,WAAW,EACvB,IAAI,EAAE,IAAI,IAbL,GAAG,IAAI,IAAI,GAAG,EAAE,CAcrB,CACH,CAAC,GACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAClC,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypographyProps } from '@mui/material/Typography';
|
|
3
|
+
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
4
|
+
export interface SelectFieldOption {
|
|
5
|
+
value: string | number;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface SelectFieldProps extends BorderProps, ColorProps, LayoutProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
value?: string | number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
variant?: TypographyProps['variant'];
|
|
15
|
+
helperText?: string;
|
|
16
|
+
helperTextColor?: string;
|
|
17
|
+
options: SelectFieldOption[];
|
|
18
|
+
onChange: (value: string | number) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* ComboBox baseado no Material UI, sem validação e sem máscaras,
|
|
22
|
+
* permitindo customização visual e controle completo do valor selecionado.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} [id] Identificador único do campo (usado para acessibilidade).
|
|
25
|
+
* @param {ComboBoxOption[]} options Lista de opções exibidas no ComboBox.
|
|
26
|
+
* @param {string | number} value Valor selecionado.
|
|
27
|
+
* @param {(value: string | number) => void} onChange Callback disparado ao selecionar uma opção.
|
|
28
|
+
* @param {string} [label] Texto do rótulo do campo.
|
|
29
|
+
* @param {string} [placeholder] Texto exibido quando nenhum valor está selecionado.
|
|
30
|
+
* @param {string} [helperText] Texto auxiliar exibido abaixo do campo.
|
|
31
|
+
* @param {string} [helperTextColor] Cor do helperText. Se não for informada, usa a cor de erro do theme.
|
|
32
|
+
* @param {TypographyProps['variant']} [variant='body1'] Variante da tipografia aplicada ao label, valor, opções e helperText.
|
|
33
|
+
* @param {string | number} [width='100%'] Largura do componente.
|
|
34
|
+
* @param {string | number} [height='auto'] Altura do campo.
|
|
35
|
+
* @param {string | number} [containerMargin=0] Margem externa do container.
|
|
36
|
+
* @param {string | number} [padding=0] Padding interno do texto selecionado.
|
|
37
|
+
* @param {string} [background='transparent'] Cor de fundo do campo e do menu aberto.
|
|
38
|
+
* @param {string} [colorText='#000'] Cor do texto (label, valor selecionado e itens).
|
|
39
|
+
* @param {string | number} [borderRadius=4] Raio da borda.
|
|
40
|
+
* @param {string} [boxShadow='none'] Sombra do campo.
|
|
41
|
+
* @param {string} [borderColor='#c4c4c4'] Cor da borda.
|
|
42
|
+
* @param {boolean} [disabled=false] Desabilita o campo.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* import { ComboBox } from '@/components/ComboBox';
|
|
47
|
+
*
|
|
48
|
+
* const Example = () => (
|
|
49
|
+
* <ComboBox
|
|
50
|
+
* id="category"
|
|
51
|
+
* label="Categoria"
|
|
52
|
+
* placeholder="Selecione uma opção"
|
|
53
|
+
* helperText="Campo obrigatório"
|
|
54
|
+
* helperTextColor="warning.main"
|
|
55
|
+
* variant="body2"
|
|
56
|
+
* background="#111"
|
|
57
|
+
* colorText="#fff"
|
|
58
|
+
* options={[
|
|
59
|
+
* { value: 1, label: 'Frontend' },
|
|
60
|
+
* { value: 2, label: 'Backend' },
|
|
61
|
+
* ]}
|
|
62
|
+
* value={1}
|
|
63
|
+
* onChange={(v) => console.log(v)}
|
|
64
|
+
* width={320}
|
|
65
|
+
* containerMargin="16px 0"
|
|
66
|
+
* padding="12px"
|
|
67
|
+
* borderRadius={12}
|
|
68
|
+
* />
|
|
69
|
+
* );
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare const SelectField: React.FC<SelectFieldProps>;
|
|
73
|
+
export default SelectField;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FormControl, InputLabel, MenuItem, Select, FormHelperText, Typography } from '@mui/material';
|
|
4
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
5
|
+
import { fbbackground, fbborderColor, fbborderRadius, fbboxShadow, fbcolor, fbcolorFocused, fbheigth, fbpadding } from '../constant';
|
|
6
|
+
const StyledWrapper = styled('div', {
|
|
7
|
+
shouldForwardProp: (prop) => !['width', 'margin'].includes(prop),
|
|
8
|
+
})(({ width, margin }) => ({
|
|
9
|
+
width: width,
|
|
10
|
+
margin: margin,
|
|
11
|
+
}));
|
|
12
|
+
const StyledFormControl = styled(FormControl, {
|
|
13
|
+
shouldForwardProp: (prop) => !['height',
|
|
14
|
+
'padding',
|
|
15
|
+
'background',
|
|
16
|
+
'borderRadius',
|
|
17
|
+
'boxShadow',
|
|
18
|
+
'borderColor',
|
|
19
|
+
'colorText',
|
|
20
|
+
].includes(prop),
|
|
21
|
+
})(({ height, padding, background, borderRadius, boxShadow, borderColor, colorText }) => ({
|
|
22
|
+
width: '100%',
|
|
23
|
+
'& .MuiOutlinedInput-root': {
|
|
24
|
+
height: height,
|
|
25
|
+
background: background !== null && background !== void 0 ? background : fbbackground,
|
|
26
|
+
borderRadius: borderRadius !== null && borderRadius !== void 0 ? borderRadius : fbborderRadius,
|
|
27
|
+
boxShadow: boxShadow !== null && boxShadow !== void 0 ? boxShadow : fbboxShadow,
|
|
28
|
+
'& fieldset': {
|
|
29
|
+
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : fbborderColor,
|
|
30
|
+
},
|
|
31
|
+
'&:hover fieldset': {
|
|
32
|
+
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : fbborderColor,
|
|
33
|
+
},
|
|
34
|
+
'&.Mui-focused fieldset': {
|
|
35
|
+
borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : fbcolorFocused,
|
|
36
|
+
},
|
|
37
|
+
'& .MuiSelect-select': {
|
|
38
|
+
padding: padding !== null && padding !== void 0 ? padding : fbpadding,
|
|
39
|
+
color: colorText !== null && colorText !== void 0 ? colorText : fbcolor,
|
|
40
|
+
display: 'flex',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
'& .MuiInputLabel-root': {
|
|
45
|
+
color: colorText !== null && colorText !== void 0 ? colorText : fbcolor,
|
|
46
|
+
},
|
|
47
|
+
'& .MuiInputLabel-root.Mui-focused': {
|
|
48
|
+
color: colorText !== null && colorText !== void 0 ? colorText : fbcolor,
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
/**
|
|
52
|
+
* ComboBox baseado no Material UI, sem validação e sem máscaras,
|
|
53
|
+
* permitindo customização visual e controle completo do valor selecionado.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} [id] Identificador único do campo (usado para acessibilidade).
|
|
56
|
+
* @param {ComboBoxOption[]} options Lista de opções exibidas no ComboBox.
|
|
57
|
+
* @param {string | number} value Valor selecionado.
|
|
58
|
+
* @param {(value: string | number) => void} onChange Callback disparado ao selecionar uma opção.
|
|
59
|
+
* @param {string} [label] Texto do rótulo do campo.
|
|
60
|
+
* @param {string} [placeholder] Texto exibido quando nenhum valor está selecionado.
|
|
61
|
+
* @param {string} [helperText] Texto auxiliar exibido abaixo do campo.
|
|
62
|
+
* @param {string} [helperTextColor] Cor do helperText. Se não for informada, usa a cor de erro do theme.
|
|
63
|
+
* @param {TypographyProps['variant']} [variant='body1'] Variante da tipografia aplicada ao label, valor, opções e helperText.
|
|
64
|
+
* @param {string | number} [width='100%'] Largura do componente.
|
|
65
|
+
* @param {string | number} [height='auto'] Altura do campo.
|
|
66
|
+
* @param {string | number} [containerMargin=0] Margem externa do container.
|
|
67
|
+
* @param {string | number} [padding=0] Padding interno do texto selecionado.
|
|
68
|
+
* @param {string} [background='transparent'] Cor de fundo do campo e do menu aberto.
|
|
69
|
+
* @param {string} [colorText='#000'] Cor do texto (label, valor selecionado e itens).
|
|
70
|
+
* @param {string | number} [borderRadius=4] Raio da borda.
|
|
71
|
+
* @param {string} [boxShadow='none'] Sombra do campo.
|
|
72
|
+
* @param {string} [borderColor='#c4c4c4'] Cor da borda.
|
|
73
|
+
* @param {boolean} [disabled=false] Desabilita o campo.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* import { ComboBox } from '@/components/ComboBox';
|
|
78
|
+
*
|
|
79
|
+
* const Example = () => (
|
|
80
|
+
* <ComboBox
|
|
81
|
+
* id="category"
|
|
82
|
+
* label="Categoria"
|
|
83
|
+
* placeholder="Selecione uma opção"
|
|
84
|
+
* helperText="Campo obrigatório"
|
|
85
|
+
* helperTextColor="warning.main"
|
|
86
|
+
* variant="body2"
|
|
87
|
+
* background="#111"
|
|
88
|
+
* colorText="#fff"
|
|
89
|
+
* options={[
|
|
90
|
+
* { value: 1, label: 'Frontend' },
|
|
91
|
+
* { value: 2, label: 'Backend' },
|
|
92
|
+
* ]}
|
|
93
|
+
* value={1}
|
|
94
|
+
* onChange={(v) => console.log(v)}
|
|
95
|
+
* width={320}
|
|
96
|
+
* containerMargin="16px 0"
|
|
97
|
+
* padding="12px"
|
|
98
|
+
* borderRadius={12}
|
|
99
|
+
* />
|
|
100
|
+
* );
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
const SelectField = ({ id, label, placeholder, value, background, backgroundDisabled, color, colorFocused, colorDisabled, borderRadius, boxShadow, borderColor, width = "100%", height, padding, margin = '0', disabled = false, variant = 'body1', helperText, helperTextColor, options, onChange, }) => {
|
|
104
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
105
|
+
const labelId = id ? `${id}-label` : undefined;
|
|
106
|
+
const shouldShrinkLabel = Boolean(value) || Boolean(placeholder);
|
|
107
|
+
const handleChange = (event, _child) => {
|
|
108
|
+
const raw = event.target.value;
|
|
109
|
+
const matched = options.find((opt) => String(opt.value) === raw);
|
|
110
|
+
onChange(matched ? matched.value : raw);
|
|
111
|
+
};
|
|
112
|
+
const theme = useTheme();
|
|
113
|
+
const field = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.field;
|
|
114
|
+
const bg = (_c = background !== null && background !== void 0 ? background : field === null || field === void 0 ? void 0 : field.background) !== null && _c !== void 0 ? _c : '#fff';
|
|
115
|
+
const txt = (_d = color !== null && color !== void 0 ? color : field === null || field === void 0 ? void 0 : field.color) !== null && _d !== void 0 ? _d : '#000';
|
|
116
|
+
const bgDisabled = (_e = backgroundDisabled !== null && backgroundDisabled !== void 0 ? backgroundDisabled : field === null || field === void 0 ? void 0 : field.backgroundDisabled) !== null && _e !== void 0 ? _e : "#E5E7EB";
|
|
117
|
+
const txtDisabled = (_f = colorDisabled !== null && colorDisabled !== void 0 ? colorDisabled : field === null || field === void 0 ? void 0 : field.colorDisabled) !== null && _f !== void 0 ? _f : "#9CA3AF";
|
|
118
|
+
const bdFocused = (_g = colorFocused !== null && colorFocused !== void 0 ? colorFocused : field === null || field === void 0 ? void 0 : field.colorFocused) !== null && _g !== void 0 ? _g : '#1976d2';
|
|
119
|
+
const br = (_h = borderRadius !== null && borderRadius !== void 0 ? borderRadius : field === null || field === void 0 ? void 0 : field.borderRadius) !== null && _h !== void 0 ? _h : "0";
|
|
120
|
+
const sh = (_j = boxShadow !== null && boxShadow !== void 0 ? boxShadow : field === null || field === void 0 ? void 0 : field.boxShadow) !== null && _j !== void 0 ? _j : "none";
|
|
121
|
+
const bd = (_k = borderColor !== null && borderColor !== void 0 ? borderColor : field === null || field === void 0 ? void 0 : field.borderColor) !== null && _k !== void 0 ? _k : '#ccc';
|
|
122
|
+
const pad = (_l = padding !== null && padding !== void 0 ? padding : field === null || field === void 0 ? void 0 : field.padding) !== null && _l !== void 0 ? _l : '4px 8px';
|
|
123
|
+
const mg = (_m = margin !== null && margin !== void 0 ? margin : field === null || field === void 0 ? void 0 : field.margin) !== null && _m !== void 0 ? _m : '0';
|
|
124
|
+
const hg = (_o = height !== null && height !== void 0 ? height : field === null || field === void 0 ? void 0 : field.height) !== null && _o !== void 0 ? _o : fbheigth;
|
|
125
|
+
return (_jsx(StyledWrapper, { width: width, margin: mg, children: _jsxs(StyledFormControl, { id: id, disabled: disabled, variant: "outlined", background: bg, borderRadius: br, boxShadow: sh, borderColor: bd, colorText: txt, height: hg, padding: pad, children: [label && (_jsx(InputLabel, { id: labelId, htmlFor: id, shrink: shouldShrinkLabel, children: _jsx(Typography, { variant: variant, sx: { color: txt }, children: label }) })), _jsx(Select, { id: id, labelId: labelId, value: value !== undefined && value !== null ? String(value) : '', onChange: handleChange, displayEmpty: true, label: label, MenuProps: {
|
|
126
|
+
PaperProps: {
|
|
127
|
+
sx: {
|
|
128
|
+
backgroundColor: bg,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}, renderValue: (selected) => {
|
|
132
|
+
var _a;
|
|
133
|
+
if ((selected === '' || selected === undefined) && placeholder) {
|
|
134
|
+
return (_jsx(Typography, { variant: variant, color: "text.disabled", children: placeholder }));
|
|
135
|
+
}
|
|
136
|
+
const option = options.find((opt) => String(opt.value) === selected);
|
|
137
|
+
return _jsx(Typography, { variant: variant, children: (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : '' });
|
|
138
|
+
}, children: options.map((option) => (_jsx(MenuItem, { value: String(option.value), children: _jsx(Typography, { variant: variant, sx: { color: txt }, children: option.label }) }, option.value))) }), helperText && (_jsx(FormHelperText, { error: !helperTextColor, children: _jsx(Typography, { variant: variant, sx: { color: helperTextColor }, children: helperText }) }))] }) }));
|
|
139
|
+
};
|
|
140
|
+
SelectField.displayName = 'SelectField';
|
|
141
|
+
export default SelectField;
|
|
142
|
+
//# sourceMappingURL=SelectField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../src/components/SelectField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAqB,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuBrI,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE;IAClC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC3E,CAAC,CAAkC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAE1D,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;CACf,CAAC,CAAC,CAAC;AAEJ,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,EAAE;IAC5C,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC,CAAC,QAAQ;QACR,SAAS;QACT,YAAY;QACZ,cAAc;QACd,WAAW;QACX,aAAa;QACb,WAAW;KACZ,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CAQC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC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E,CAAC,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,KAAC,QAAQ,IAAoB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,YACtD,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,YAC7C,MAAM,CAAC,KAAK,GACF,IAHA,MAAM,CAAC,KAAK,CAIhB,CACZ,CAAC,GACK,EAER,UAAU,IAAI,CACb,KAAC,cAAc,IAAC,KAAK,EAAE,CAAC,eAAe,YACrC,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,YACzD,UAAU,GACA,GACE,CAClB,IAEiB,GACN,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TypographyVariant } from '@mui/material/styles';
|
|
2
3
|
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
3
4
|
type ValidationStatus = 'idle' | 'required' | 'invalid' | 'valid';
|
|
4
5
|
interface PasswordValidationResult {
|
|
@@ -12,6 +13,7 @@ interface TextFieldPasswordProps extends BorderProps, ColorProps, LayoutProps {
|
|
|
12
13
|
label?: string;
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
value?: string;
|
|
16
|
+
textVariant?: TypographyVariant;
|
|
15
17
|
background?: string;
|
|
16
18
|
backgroundDisabled?: string;
|
|
17
19
|
color?: string;
|
|
@@ -27,59 +29,154 @@ interface TextFieldPasswordProps extends BorderProps, ColorProps, LayoutProps {
|
|
|
27
29
|
pattern?: RegExp;
|
|
28
30
|
patternMessage?: string;
|
|
29
31
|
showErrorOn?: 'blur' | 'change' | 'both';
|
|
30
|
-
/**
|
|
31
|
-
* Retorna somente a senha digitada (string).
|
|
32
|
-
*/
|
|
33
32
|
onPasswordChange?: (password: string) => void;
|
|
34
|
-
/**
|
|
35
|
-
* "Evento" com o resultado completo da validação.
|
|
36
|
-
*/
|
|
37
33
|
onValidationChange?: (result: PasswordValidationResult) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Se você ainda quiser receber o evento nativo.
|
|
40
|
-
*/
|
|
41
34
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
42
35
|
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
43
36
|
}
|
|
44
37
|
/**
|
|
45
38
|
* Componente de campo de senha baseado no TextField do Material UI, com botão para alternar
|
|
46
|
-
* entre mostrar
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* -
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
39
|
+
* entre mostrar e ocultar a senha.
|
|
40
|
+
*
|
|
41
|
+
* O componente oferece:
|
|
42
|
+
* - Retorno apenas do valor da senha digitada via `onPasswordChange`
|
|
43
|
+
* - Validação automática de obrigatoriedade e formato (Regex)
|
|
44
|
+
* - Exibição controlada de mensagens de erro
|
|
45
|
+
* - Evento de validação completo via `onValidationChange`
|
|
46
|
+
* - Estilização via props com fallback para tokens do theme da Pipeline
|
|
47
|
+
*
|
|
48
|
+
* ---
|
|
49
|
+
*
|
|
50
|
+
* ### Tokens de estilo (ordem de prioridade)
|
|
51
|
+
*
|
|
52
|
+
* Para propriedades visuais, o componente resolve os valores nesta ordem:
|
|
53
|
+
* 1. **Props do componente**
|
|
54
|
+
* 2. **Theme da Pipeline** (`theme.pipelinesolucoes.forms.field`)
|
|
55
|
+
* 3. **Fallback interno** (valores padrão do componente)
|
|
56
|
+
*
|
|
57
|
+
* ---
|
|
58
|
+
*
|
|
59
|
+
* ### Tipografia
|
|
60
|
+
*
|
|
61
|
+
* A tipografia do texto digitado e do placeholder pode ser definida de duas formas:
|
|
62
|
+
*
|
|
63
|
+
* 1. **Material UI**
|
|
64
|
+
* Ao informar `textVariant`, o componente utiliza `theme.typography[textVariant]`.
|
|
65
|
+
*
|
|
66
|
+
* 2. **Theme da Pipeline**
|
|
67
|
+
* Quando `textVariant` não é informado, utiliza `theme.pipelinesolucoes.forms.field.typography`.
|
|
68
|
+
*
|
|
69
|
+
* **Ordem de prioridade (tipografia):**
|
|
70
|
+
* 1. `textVariant` (prop do componente)
|
|
71
|
+
* 2. `theme.typography[textVariant]` (Material UI)
|
|
72
|
+
* 3. `theme.pipelinesolucoes.forms.field.typography` (Pipeline)
|
|
73
|
+
* 4. Fallback interno (`theme.typography.body1`)
|
|
74
|
+
*
|
|
75
|
+
* ---
|
|
76
|
+
*
|
|
77
|
+
* @param {string} [id]
|
|
78
|
+
* ID do input.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} [label]
|
|
81
|
+
* Label exibido no campo.
|
|
82
|
+
*
|
|
83
|
+
* @param {string} [placeholder]
|
|
84
|
+
* Texto de placeholder do input.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} [value]
|
|
87
|
+
* Valor controlado do campo.
|
|
88
|
+
*
|
|
89
|
+
* @param {import('@mui/material/styles').TypographyVariant} [textVariant]
|
|
90
|
+
* Variante de tipografia do Material UI aplicada ao texto digitado e ao placeholder.
|
|
91
|
+
* Quando omitida, utiliza a tipografia do theme da Pipeline (`theme.pipelinesolucoes.forms.field.typography`).
|
|
92
|
+
*
|
|
93
|
+
* ---
|
|
94
|
+
* ### Estilo / Aparência
|
|
95
|
+
*
|
|
96
|
+
* @param {string} [background]
|
|
97
|
+
* Cor de fundo do campo.
|
|
98
|
+
* Ordem: `background` → `theme.pipelinesolucoes.forms.field.background` → `#fff`.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} [backgroundDisabled]
|
|
101
|
+
* Cor de fundo do campo quando desabilitado.
|
|
102
|
+
* Ordem: `backgroundDisabled` → `theme.pipelinesolucoes.forms.field.backgroundDisabled` → `#E5E7EB`.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} [color]
|
|
105
|
+
* Cor do texto do campo (texto digitado e label).
|
|
106
|
+
* Ordem: `color` → `theme.pipelinesolucoes.forms.field.color` → `#000`.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} [colorFocused]
|
|
109
|
+
* Cor aplicada ao estado focado (usada como cor de borda no focus).
|
|
110
|
+
* Ordem: `colorFocused` → `theme.pipelinesolucoes.forms.field.colorFocused` → `#1976d2`.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} [colorDisabled]
|
|
113
|
+
* Cor do texto do campo quando desabilitado.
|
|
114
|
+
* Ordem: `colorDisabled` → `theme.pipelinesolucoes.forms.field.colorDisabled` → `#9CA3AF`.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} [borderRadius]
|
|
117
|
+
* Raio da borda do campo.
|
|
118
|
+
* Ordem: `borderRadius` → `theme.pipelinesolucoes.forms.field.borderRadius` → `"0"`.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} [boxShadow]
|
|
121
|
+
* Sombra do campo.
|
|
122
|
+
* Ordem: `boxShadow` → `theme.pipelinesolucoes.forms.field.boxShadow` → `"none"`.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} [borderColor]
|
|
125
|
+
* Cor da borda do campo (estado padrão/hover).
|
|
126
|
+
* Ordem: `borderColor` → `theme.pipelinesolucoes.forms.field.borderColor` → `#ccc`.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} [padding]
|
|
129
|
+
* Espaçamento interno do input (aplicado no texto e textarea).
|
|
130
|
+
* Ordem: `padding` → `theme.pipelinesolucoes.forms.field.padding` → `"4px 8px"`.
|
|
131
|
+
*
|
|
132
|
+
* ---
|
|
133
|
+
* ### Validação
|
|
134
|
+
*
|
|
135
|
+
* @param {boolean} [required=true]
|
|
136
|
+
* Define se o campo é obrigatório.
|
|
137
|
+
*
|
|
138
|
+
* @param {RegExp} [pattern=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,}$/]
|
|
139
|
+
* Expressão regular usada para validar o formato da senha.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} [requiredMessage='Senha obrigatória']
|
|
142
|
+
* Mensagem exibida quando o campo obrigatório está vazio.
|
|
143
|
+
*
|
|
144
|
+
* @param {string} [patternMessage]
|
|
145
|
+
* Mensagem exibida quando a senha não atende ao formato definido.
|
|
146
|
+
*
|
|
147
|
+
* @param {'blur' | 'change' | 'both'} [showErrorOn='blur']
|
|
148
|
+
* Define quando a validação e exibição de erros deve ocorrer.
|
|
149
|
+
*
|
|
150
|
+
* @param {boolean} [disabled=false]
|
|
151
|
+
* Desabilita o campo.
|
|
152
|
+
*
|
|
153
|
+
* ---
|
|
154
|
+
* ### Eventos
|
|
155
|
+
*
|
|
156
|
+
* @param {(password: string) => void} [onPasswordChange]
|
|
157
|
+
* Callback que retorna apenas o valor da senha digitada.
|
|
158
|
+
*
|
|
159
|
+
* @param {(result: PasswordValidationResult) => void} [onValidationChange]
|
|
160
|
+
* Callback disparado sempre que a validação é executada, contendo o resultado completo.
|
|
161
|
+
*
|
|
162
|
+
* @param {(event: React.ChangeEvent<HTMLInputElement>) => void} [onChange]
|
|
163
|
+
* Evento `onChange` nativo do input (opcional).
|
|
164
|
+
*
|
|
165
|
+
* @param {(event: React.FocusEvent<HTMLInputElement>) => void} [onBlur]
|
|
166
|
+
* Evento `onBlur` nativo do input (opcional).
|
|
167
|
+
*
|
|
168
|
+
* ---
|
|
64
169
|
*
|
|
65
170
|
* @example
|
|
66
171
|
* ```tsx
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* label="Senha"
|
|
76
|
-
* value={password}
|
|
77
|
-
* onPasswordChange={(p) => setPassword(p)}
|
|
78
|
-
* onValidationChange={(r) => console.log(r)}
|
|
79
|
-
* validateOn="both"
|
|
80
|
-
* />
|
|
81
|
-
* );
|
|
82
|
-
* };
|
|
172
|
+
* <TextFieldPassword
|
|
173
|
+
* label="Senha"
|
|
174
|
+
* background="#fff"
|
|
175
|
+
* borderRadius="10px"
|
|
176
|
+
* textVariant="body2"
|
|
177
|
+
* showErrorOn="both"
|
|
178
|
+
* onPasswordChange={(password) => console.log(password)}
|
|
179
|
+
* />
|
|
83
180
|
* ```
|
|
84
181
|
*/
|
|
85
182
|
declare const TextFieldPassword: React.FC<TextFieldPasswordProps>;
|