@pipelinesolucoes/form 1.3.5 → 1.3.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/dist/components/Field.d.ts +12 -0
- package/dist/components/Field.js +50 -0
- package/dist/components/Field.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.js +3 -0
- package/dist/theme.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypographyVariant } from '@mui/material/styles';
|
|
3
|
+
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
4
|
+
export interface FieldProps extends Omit<ColorProps, 'backgroundHover' | 'backgroundFocused' | 'backgroundDisabled' | 'colorHover' | 'colorDisabled' | 'colorFocused'>, Omit<BorderProps, 'border'>, Pick<LayoutProps, 'height' | 'padding' | 'margin' | "maxWidth"> {
|
|
5
|
+
label: string;
|
|
6
|
+
textVariantLabel?: TypographyVariant;
|
|
7
|
+
colorLabel: string;
|
|
8
|
+
value?: string | number | null;
|
|
9
|
+
textVariantField?: TypographyVariant;
|
|
10
|
+
}
|
|
11
|
+
declare const Field: React.FC<FieldProps>;
|
|
12
|
+
export default Field;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
5
|
+
import { fbbackground, fbborderColor, fbborderRadius, fbboxShadow, fbcolor, fbheigth, fbmargin, fbpadding } from '@/constant';
|
|
6
|
+
const StyledContainer = styled(Box, {
|
|
7
|
+
shouldForwardProp: (prop) => ![
|
|
8
|
+
'maxWidth',
|
|
9
|
+
'background',
|
|
10
|
+
'backgroundFocused',
|
|
11
|
+
'backgroundDisabled',
|
|
12
|
+
'color',
|
|
13
|
+
'colorFocused',
|
|
14
|
+
'colorDisabled',
|
|
15
|
+
'borderRadius',
|
|
16
|
+
'boxShadow',
|
|
17
|
+
'borderColor',
|
|
18
|
+
'textVariant',
|
|
19
|
+
'padding',
|
|
20
|
+
'height',
|
|
21
|
+
'margin',
|
|
22
|
+
'disabled',
|
|
23
|
+
'focused',
|
|
24
|
+
].includes(prop),
|
|
25
|
+
})(({ maxWidth, background, color, borderRadius, boxShadow, borderColor, padding, height, margin, typo, theme, }) => (Object.assign({ display: 'flex', flexDirection: 'column', minWidth: 150, maxWidth: maxWidth || '100%', background: background || 'transparent', color: color || theme.palette.text.primary, borderRadius: borderRadius !== null && borderRadius !== void 0 ? borderRadius : theme.shape.borderRadius, boxShadow: boxShadow !== null && boxShadow !== void 0 ? boxShadow : 'none', border: borderColor ? `1px solid ${borderColor}` : 'none', padding: padding !== null && padding !== void 0 ? padding : theme.spacing(1), height: height !== null && height !== void 0 ? height : 'auto', margin: margin !== null && margin !== void 0 ? margin : 0 }, (typo !== null && typo !== void 0 ? typo : {}))));
|
|
26
|
+
const LabelStyle = styled(Box, {
|
|
27
|
+
shouldForwardProp: (prop) => !['color', 'typo',].includes(prop),
|
|
28
|
+
})(({ color, typo, theme, }) => (Object.assign({ color: color || theme.palette.text.primary }, (typo !== null && typo !== void 0 ? typo : {}))));
|
|
29
|
+
const Field = ({ label, textVariantLabel, colorLabel, value, background, color, borderRadius, boxShadow, borderColor, textVariantField, padding, height, margin, maxWidth = '100%' }) => {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
31
|
+
const theme = useTheme();
|
|
32
|
+
// props -> tokens -> fallback
|
|
33
|
+
const field = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.field;
|
|
34
|
+
const bg = (_c = background !== null && background !== void 0 ? background : field === null || field === void 0 ? void 0 : field.background) !== null && _c !== void 0 ? _c : fbbackground;
|
|
35
|
+
const txt = (_d = color !== null && color !== void 0 ? color : field === null || field === void 0 ? void 0 : field.color) !== null && _d !== void 0 ? _d : fbcolor;
|
|
36
|
+
const br = (_e = borderRadius !== null && borderRadius !== void 0 ? borderRadius : field === null || field === void 0 ? void 0 : field.borderRadius) !== null && _e !== void 0 ? _e : fbborderRadius;
|
|
37
|
+
const sh = (_f = boxShadow !== null && boxShadow !== void 0 ? boxShadow : field === null || field === void 0 ? void 0 : field.boxShadow) !== null && _f !== void 0 ? _f : fbboxShadow;
|
|
38
|
+
const bd = (_g = borderColor !== null && borderColor !== void 0 ? borderColor : field === null || field === void 0 ? void 0 : field.borderColor) !== null && _g !== void 0 ? _g : fbborderColor;
|
|
39
|
+
const pad = (_h = padding !== null && padding !== void 0 ? padding : field === null || field === void 0 ? void 0 : field.padding) !== null && _h !== void 0 ? _h : fbpadding;
|
|
40
|
+
const mg = (_j = margin !== null && margin !== void 0 ? margin : field === null || field === void 0 ? void 0 : field.margin) !== null && _j !== void 0 ? _j : fbmargin;
|
|
41
|
+
const hg = (_k = height !== null && height !== void 0 ? height : field === null || field === void 0 ? void 0 : field.height) !== null && _k !== void 0 ? _k : fbheigth;
|
|
42
|
+
const typoField = (_m = (_l = (textVariantField && theme.typography[textVariantField])) !== null && _l !== void 0 ? _l : field === null || field === void 0 ? void 0 : field.typography) !== null && _m !== void 0 ? _m : theme.typography.body1;
|
|
43
|
+
const labelTheme = (_p = (_o = theme.pipelinesolucoes) === null || _o === void 0 ? void 0 : _o.forms) === null || _p === void 0 ? void 0 : _p.label;
|
|
44
|
+
const typoLabel = (_r = (_q = (textVariantLabel && theme.typography[textVariantLabel])) !== null && _q !== void 0 ? _q : labelTheme === null || labelTheme === void 0 ? void 0 : labelTheme.typography) !== null && _r !== void 0 ? _r : theme.typography.body1;
|
|
45
|
+
const color_label = (_s = colorLabel !== null && colorLabel !== void 0 ? colorLabel : labelTheme === null || labelTheme === void 0 ? void 0 : labelTheme.color) !== null && _s !== void 0 ? _s : fbcolor;
|
|
46
|
+
return (_jsxs(StyledContainer, { maxWidth: maxWidth, background: bg, color: txt, borderRadius: br, boxShadow: sh, borderColor: bd, padding: pad, height: hg, margin: mg, typo: typoField, children: [_jsx(LabelStyle, { typo: typoLabel, color: color_label, children: label }), _jsx("div", { children: value !== null && value !== void 0 ? value : '-' })] }));
|
|
47
|
+
};
|
|
48
|
+
Field.displayName = 'Field';
|
|
49
|
+
export default Field;
|
|
50
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/components/Field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAa,MAAM,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAe9H,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,EAAE;IAClC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,UAAU;QACV,YAAY;QACZ,mBAAmB;QACnB,oBAAoB;QACpB,OAAO;QACP,cAAc;QACd,eAAe;QACf,cAAc;QACd,WAAW;QACX,aAAa;QACb,aAAa;QACb,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,UAAU;QACV,SAAS;KACV,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CAKA,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EA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e,KAAK,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as FormMessage } from './components/FormMessage';
|
|
|
3
3
|
export { default as NotificationSnackbar } from './components/NotificationSnackbar';
|
|
4
4
|
export { default as SelectField } from './components/SelectField';
|
|
5
5
|
export { default as ChipList } from './components/ChipList';
|
|
6
|
+
export { default as Field } from './components/Field';
|
|
6
7
|
export { default as TextFieldValidate } from './components/TextFieldValidate';
|
|
7
8
|
export { default as TextFieldPassword } from './components/TextFieldPassword';
|
|
8
9
|
export { default as TextFieldNumberValidate } from './components/TextFieldNumberValidate';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { default as FormMessage } from './components/FormMessage';
|
|
|
3
3
|
export { default as NotificationSnackbar } from './components/NotificationSnackbar';
|
|
4
4
|
export { default as SelectField } from './components/SelectField';
|
|
5
5
|
export { default as ChipList } from './components/ChipList';
|
|
6
|
+
export { default as Field } from './components/Field';
|
|
6
7
|
export { default as TextFieldValidate } from './components/TextFieldValidate';
|
|
7
8
|
export { default as TextFieldPassword } from './components/TextFieldPassword';
|
|
8
9
|
export { default as TextFieldNumberValidate } from './components/TextFieldNumberValidate';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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