tp-react-elements-dev 0.1.0 → 0.3.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/components/Form/FormConstants.d.ts +17 -0
- package/dist/components/Form/FormRender.d.ts +2 -2
- package/dist/components/Form/FormRenderWrapper.d.ts +3 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +139 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +139 -13
- package/dist/index.js.map +1 -1
- package/dist/styles/theme.d.ts +9 -0
- package/dist/theme.d.ts +10 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4955,6 +4955,41 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
4955
4955
|
ThemeContext$1.displayName = 'EmotionThemeContext';
|
|
4956
4956
|
}
|
|
4957
4957
|
|
|
4958
|
+
var getTheme = function getTheme(outerTheme, theme) {
|
|
4959
|
+
if (typeof theme === 'function') {
|
|
4960
|
+
var mergedTheme = theme(outerTheme);
|
|
4961
|
+
|
|
4962
|
+
if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {
|
|
4963
|
+
throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
|
|
4964
|
+
}
|
|
4965
|
+
|
|
4966
|
+
return mergedTheme;
|
|
4967
|
+
}
|
|
4968
|
+
|
|
4969
|
+
if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {
|
|
4970
|
+
throw new Error('[ThemeProvider] Please make your theme prop a plain object');
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
return _extends$1({}, outerTheme, theme);
|
|
4974
|
+
};
|
|
4975
|
+
|
|
4976
|
+
var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
|
|
4977
|
+
return weakMemoize(function (theme) {
|
|
4978
|
+
return getTheme(outerTheme, theme);
|
|
4979
|
+
});
|
|
4980
|
+
});
|
|
4981
|
+
var ThemeProvider = function ThemeProvider(props) {
|
|
4982
|
+
var theme = React__namespace.useContext(ThemeContext$1);
|
|
4983
|
+
|
|
4984
|
+
if (props.theme !== theme) {
|
|
4985
|
+
theme = createCacheWithTheme(theme)(props.theme);
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
return /*#__PURE__*/React__namespace.createElement(ThemeContext$1.Provider, {
|
|
4989
|
+
value: theme
|
|
4990
|
+
}, props.children);
|
|
4991
|
+
};
|
|
4992
|
+
|
|
4958
4993
|
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
|
4959
4994
|
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
|
|
4960
4995
|
|
|
@@ -40588,7 +40623,7 @@ default_1$3 = ArrowDropDownSharp.default = (0, _createSvgIcon$3.default)( /*#__P
|
|
|
40588
40623
|
d: "m7 10 5 5 5-5z"
|
|
40589
40624
|
}), 'ArrowDropDownSharp');
|
|
40590
40625
|
|
|
40591
|
-
styled$1(Grid)(({ theme }) => ({
|
|
40626
|
+
const FormComponent = styled$1(Grid)(({ theme }) => ({
|
|
40592
40627
|
alignItems: 'flex-start',
|
|
40593
40628
|
flexWrap: 'wrap',
|
|
40594
40629
|
[theme.breakpoints.down('md')]: {
|
|
@@ -40604,7 +40639,7 @@ styled$1(Box)(({ theme }) => ({
|
|
|
40604
40639
|
boxShadow: '0 1px 15px rgba(0,0,0,.04), 0 1px 6px rgba(0,0,0,.04)',
|
|
40605
40640
|
borderRadius: '0.75rem'
|
|
40606
40641
|
}));
|
|
40607
|
-
styled$1(Grid, {
|
|
40642
|
+
const Formitem = styled$1(Grid, {
|
|
40608
40643
|
shouldForwardProp: prop => prop !== 'isActive' && prop !== 'noOfColumn'
|
|
40609
40644
|
})(({ theme, noOfColumn }) => ({
|
|
40610
40645
|
width: `calc(100%/${noOfColumn})`,
|
|
@@ -45723,6 +45758,7 @@ const DateRangePickerComponent = ({ props }) => {
|
|
|
45723
45758
|
setOpen(false);
|
|
45724
45759
|
}
|
|
45725
45760
|
}, [props.getValues('ToDate')]);
|
|
45761
|
+
console.log(props.getValues('ToDate'), 'props.getValues');
|
|
45726
45762
|
console.log(props.getValues('FromDate'), props.getValues('FromDate'), 'from date range picker');
|
|
45727
45763
|
const value = props.getValues('FromDate') && props.getValues('ToDate')
|
|
45728
45764
|
? `${props.getValues('FromDate')} - ${props.getValues('ToDate')}`
|
|
@@ -45733,7 +45769,7 @@ const DateRangePickerComponent = ({ props }) => {
|
|
|
45733
45769
|
"& .css-1holvmy, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
45734
45770
|
top: "-10px",
|
|
45735
45771
|
},
|
|
45736
|
-
} }, { children: [jsxRuntimeExports.jsx(TextField, { label: props.item.label, value: value, className: "read-only", inputRef: textRef, sx: { width: '100%', '& input': { cursor: 'pointer' } }, onClick: () => {
|
|
45772
|
+
} }, { children: [jsxRuntimeExports.jsx(TextField, { label: props.item.label, value: value || null, className: "read-only", inputRef: textRef, sx: { width: '100%', '& input': { cursor: 'pointer' } }, onClick: () => {
|
|
45737
45773
|
setOpen(true);
|
|
45738
45774
|
} }), open && (jsxRuntimeExports.jsx(Box, Object.assign({ sx: {
|
|
45739
45775
|
position: "absolute",
|
|
@@ -49995,7 +50031,7 @@ const PasswordField = ({ props }) => {
|
|
|
49995
50031
|
const handleTogglePasswordVisibility = () => {
|
|
49996
50032
|
setShowPassword((prevShowPassword) => !prevShowPassword);
|
|
49997
50033
|
};
|
|
49998
|
-
return (jsxRuntimeExports.jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [" ", jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ sx: { position:
|
|
50034
|
+
return (jsxRuntimeExports.jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [" ", jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ sx: { position: "relative" } }, { children: [" ", jsxRuntimeExports.jsx(TextField, Object.assign({ size: "small", type: showPassword ? "text" : "password" }, field, { label: props.item.label, sx: {
|
|
49999
50035
|
width: "100%",
|
|
50000
50036
|
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
50001
50037
|
top: "-8px",
|
|
@@ -50005,7 +50041,17 @@ const PasswordField = ({ props }) => {
|
|
|
50005
50041
|
right: "14px",
|
|
50006
50042
|
top: "50%",
|
|
50007
50043
|
transform: "translateY(-50%)",
|
|
50008
|
-
}, "aria-label": "toggle password visibility", onClick: handleTogglePasswordVisibility, edge: "end" }, { children: showPassword ? (jsxRuntimeExports.jsx(Visibility, { sx: {
|
|
50044
|
+
}, "aria-label": "toggle password visibility", onClick: handleTogglePasswordVisibility, edge: "end" }, { children: showPassword ? (jsxRuntimeExports.jsx(Visibility, { sx: {
|
|
50045
|
+
fontSize: "12px",
|
|
50046
|
+
position: "absolute",
|
|
50047
|
+
top: "22%",
|
|
50048
|
+
right: 10,
|
|
50049
|
+
} })) : (jsxRuntimeExports.jsx(VisibilityOff, { sx: {
|
|
50050
|
+
fontSize: "12px",
|
|
50051
|
+
position: "absolute",
|
|
50052
|
+
top: "22%",
|
|
50053
|
+
right: 10,
|
|
50054
|
+
} })) }))] })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] })) })] })));
|
|
50009
50055
|
};
|
|
50010
50056
|
|
|
50011
50057
|
const Monthpickerrender = ({ props }) => {
|
|
@@ -50104,7 +50150,7 @@ const DatepickerWrapperV2 = ({ props }) => {
|
|
|
50104
50150
|
// onFocus: () => inputTextRef.current?.blur(),
|
|
50105
50151
|
},
|
|
50106
50152
|
}, sx: {
|
|
50107
|
-
"& .css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root,.css-zy8vme,.css-1holvmy": {
|
|
50153
|
+
"& .css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root,.css-zy8vme,.css-1holvmy,.css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
50108
50154
|
top: "-10px !important",
|
|
50109
50155
|
},
|
|
50110
50156
|
"& input:hover": {
|
|
@@ -50205,7 +50251,7 @@ const RenderForm = (props) => {
|
|
|
50205
50251
|
},
|
|
50206
50252
|
},
|
|
50207
50253
|
// classes={{ option: { color: "red !important" } }}
|
|
50208
|
-
value: field.value || "", disabled: props.item.disable })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
|
|
50254
|
+
value: field.value || "", size: "small", disabled: props.item.disable })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
|
|
50209
50255
|
fontFamily: "Roboto-Reg",
|
|
50210
50256
|
fontSize: "11px",
|
|
50211
50257
|
color: "#3651d3",
|
|
@@ -50220,7 +50266,9 @@ const RenderForm = (props) => {
|
|
|
50220
50266
|
border: "none",
|
|
50221
50267
|
},
|
|
50222
50268
|
}, onInput: (e) => {
|
|
50223
|
-
e.target.value = e.target.value
|
|
50269
|
+
e.target.value = e.target.value
|
|
50270
|
+
.replace(/\s/g, "")
|
|
50271
|
+
.replace(/[^a-zA-Z0-9!@#$%^&*()_+{}\[\]:;<>,.?/~`|\\-]/g, "");
|
|
50224
50272
|
}, sx: {
|
|
50225
50273
|
fontFamily: "Roboto-Reg",
|
|
50226
50274
|
"& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
@@ -50264,10 +50312,11 @@ const RenderForm = (props) => {
|
|
|
50264
50312
|
// );
|
|
50265
50313
|
case "number":
|
|
50266
50314
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {
|
|
50267
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { label: props.item.label, value: props.getValues(props.item.name) || "", defaultValue: props.getValues(props.item.name) || null, onInput: (e) => {
|
|
50315
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { size: "small", label: props.item.label, value: props.getValues(props.item.name) || "", defaultValue: props.getValues(props.item.name) || null, onInput: (e) => {
|
|
50268
50316
|
var _a, _b;
|
|
50269
50317
|
e.target.value = e.target.value.replace(/[^0-9]/g, "");
|
|
50270
|
-
((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onChangeFn) &&
|
|
50318
|
+
((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onChangeFn) &&
|
|
50319
|
+
((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.onChangeFn(e.target.value));
|
|
50271
50320
|
(props === null || props === void 0 ? void 0 : props.clearErrors) && (props === null || props === void 0 ? void 0 : props.clearErrors(props.item.name));
|
|
50272
50321
|
}, sx: {
|
|
50273
50322
|
"& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root,.css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
@@ -50513,11 +50562,11 @@ const RenderForm = (props) => {
|
|
|
50513
50562
|
},
|
|
50514
50563
|
}, label: props.item.label, views: ["year"], value: dayjs(field.value), onChange: (date) => field.onChange(date), slots: {
|
|
50515
50564
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50516
|
-
textField: (textFieldProps) => jsxRuntimeExports.jsx(TextField, Object.assign({}, textFieldProps, { fullWidth: true, disabled: props.item.disable || false, InputLabelProps: {
|
|
50565
|
+
textField: (textFieldProps) => (jsxRuntimeExports.jsx(TextField, Object.assign({}, textFieldProps, { fullWidth: true, disabled: props.item.disable || false, InputLabelProps: {
|
|
50517
50566
|
shrink: true,
|
|
50518
50567
|
}, error: props.errors, inputProps: {
|
|
50519
50568
|
min: props.item.minDate,
|
|
50520
|
-
} }))
|
|
50569
|
+
} }))),
|
|
50521
50570
|
} }) })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] })) }) }));
|
|
50522
50571
|
case "dateRangePicker":
|
|
50523
50572
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(DateRangePickerComponent, { props: props }) }));
|
|
@@ -50636,9 +50685,86 @@ const RenderForm = (props) => {
|
|
|
50636
50685
|
// </ErrorMessageComponent>
|
|
50637
50686
|
// </>
|
|
50638
50687
|
// );
|
|
50688
|
+
default:
|
|
50689
|
+
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
50690
|
+
}
|
|
50691
|
+
};
|
|
50692
|
+
|
|
50693
|
+
const customTheme = createTheme({
|
|
50694
|
+
breakpoints: {
|
|
50695
|
+
values: {
|
|
50696
|
+
xs: 0,
|
|
50697
|
+
sm: 600,
|
|
50698
|
+
md: 900,
|
|
50699
|
+
lg: 1200,
|
|
50700
|
+
xl: 1536,
|
|
50701
|
+
},
|
|
50702
|
+
},
|
|
50703
|
+
typography: {
|
|
50704
|
+
fontFamily: 'Roboto-Reg'
|
|
50705
|
+
},
|
|
50706
|
+
palette: {
|
|
50707
|
+
// primary: {
|
|
50708
|
+
// // main: 'linear-gradient(135deg, #6379c3 0%, #546ee5 60%)',
|
|
50709
|
+
// },
|
|
50710
|
+
// secondary: {
|
|
50711
|
+
// main: 'linear-gradient(135deg, #6379c3 0%, #546ee5 60%)',
|
|
50712
|
+
// },
|
|
50713
|
+
},
|
|
50714
|
+
components: {
|
|
50715
|
+
MuiInputLabel: {
|
|
50716
|
+
styleOverrides: {
|
|
50717
|
+
root: {
|
|
50718
|
+
fontSize: '12px',
|
|
50719
|
+
},
|
|
50720
|
+
},
|
|
50721
|
+
},
|
|
50722
|
+
MuiInputBase: {
|
|
50723
|
+
styleOverrides: {
|
|
50724
|
+
root: {
|
|
50725
|
+
fontSize: '12px',
|
|
50726
|
+
input: {
|
|
50727
|
+
padding: '6.38px 14px',
|
|
50728
|
+
}
|
|
50729
|
+
}
|
|
50730
|
+
}
|
|
50731
|
+
},
|
|
50732
|
+
MuiRadio: {
|
|
50733
|
+
styleOverrides: {
|
|
50734
|
+
root: {
|
|
50735
|
+
padding: '4px 4px 0 8px'
|
|
50736
|
+
}
|
|
50737
|
+
}
|
|
50738
|
+
},
|
|
50739
|
+
MuiSelect: {
|
|
50740
|
+
styleOverrides: {
|
|
50741
|
+
select: {
|
|
50742
|
+
padding: '6.38px 32px 6.38px 14px'
|
|
50743
|
+
}
|
|
50744
|
+
}
|
|
50745
|
+
},
|
|
50746
|
+
MuiButton: {
|
|
50747
|
+
styleOverrides: {
|
|
50748
|
+
root: {
|
|
50749
|
+
fontFamily: 'Roboto-Reg',
|
|
50750
|
+
textTransform: 'none'
|
|
50751
|
+
}
|
|
50752
|
+
}
|
|
50753
|
+
}
|
|
50639
50754
|
}
|
|
50755
|
+
});
|
|
50756
|
+
|
|
50757
|
+
const FormRenderWrapper = ({ formArray, name, numberOfColumns = 3, form, }) => {
|
|
50758
|
+
// const formContext=useFormControl({
|
|
50759
|
+
// })
|
|
50760
|
+
// useEffect(() => {
|
|
50761
|
+
// // form.reset(initialValues, { resolver: yupResolver(validationSchema) });
|
|
50762
|
+
// }, [formArray, validationSchema, initialValues]);
|
|
50763
|
+
return (jsxRuntimeExports.jsx(ThemeProvider, Object.assign({ theme: customTheme }, { children: jsxRuntimeExports.jsx(FormComponent, Object.assign({ container: true, margin: "auto" }, { children: formArray.map((item, i) => {
|
|
50764
|
+
return (jsxRuntimeExports.jsx(Formitem, Object.assign({ container: true, sx: item.CustomProps, noOfColumn: item.numberOfColumns || numberOfColumns }, { children: jsxRuntimeExports.jsx(RenderForm, { item: item, register: form.register, control: form.control, errors: form.formState.errors, getValues: form.getValues, clearErrors: form.clearErrors, setValue: form.setValue }) }), i));
|
|
50765
|
+
}) })) })));
|
|
50640
50766
|
};
|
|
50641
50767
|
|
|
50642
50768
|
exports.Button = Button$1;
|
|
50643
|
-
exports.RenderForm =
|
|
50769
|
+
exports.RenderForm = FormRenderWrapper;
|
|
50644
50770
|
//# sourceMappingURL=index.js.map
|