tp-react-elements-dev 1.10.6 → 1.10.8
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.esm.js +72 -217
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +72 -217
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -12012,175 +12012,6 @@ function generateUtilityClasses(componentName, slots) {
|
|
|
12012
12012
|
return result;
|
|
12013
12013
|
}
|
|
12014
12014
|
|
|
12015
|
-
function mapEventPropToEvent(eventProp) {
|
|
12016
|
-
return eventProp.substring(2).toLowerCase();
|
|
12017
|
-
}
|
|
12018
|
-
function clickedRootScrollbar$1(event, doc) {
|
|
12019
|
-
return doc.documentElement.clientWidth < event.clientX || doc.documentElement.clientHeight < event.clientY;
|
|
12020
|
-
}
|
|
12021
|
-
/**
|
|
12022
|
-
* Listen for click events that occur somewhere in the document, outside of the element itself.
|
|
12023
|
-
* For instance, if you need to hide a menu when people click anywhere else on your page.
|
|
12024
|
-
*
|
|
12025
|
-
* Demos:
|
|
12026
|
-
*
|
|
12027
|
-
* - [Click-Away Listener](https://mui.com/base-ui/react-click-away-listener/)
|
|
12028
|
-
*
|
|
12029
|
-
* API:
|
|
12030
|
-
*
|
|
12031
|
-
* - [ClickAwayListener API](https://mui.com/base-ui/react-click-away-listener/components-api/#click-away-listener)
|
|
12032
|
-
*/
|
|
12033
|
-
function ClickAwayListener(props) {
|
|
12034
|
-
const {
|
|
12035
|
-
children,
|
|
12036
|
-
disableReactTree = false,
|
|
12037
|
-
mouseEvent = 'onClick',
|
|
12038
|
-
onClickAway,
|
|
12039
|
-
touchEvent = 'onTouchEnd'
|
|
12040
|
-
} = props;
|
|
12041
|
-
const movedRef = React$1.useRef(false);
|
|
12042
|
-
const nodeRef = React$1.useRef(null);
|
|
12043
|
-
const activatedRef = React$1.useRef(false);
|
|
12044
|
-
const syntheticEventRef = React$1.useRef(false);
|
|
12045
|
-
React$1.useEffect(() => {
|
|
12046
|
-
// Ensure that this component is not "activated" synchronously.
|
|
12047
|
-
// https://github.com/facebook/react/issues/20074
|
|
12048
|
-
setTimeout(() => {
|
|
12049
|
-
activatedRef.current = true;
|
|
12050
|
-
}, 0);
|
|
12051
|
-
return () => {
|
|
12052
|
-
activatedRef.current = false;
|
|
12053
|
-
};
|
|
12054
|
-
}, []);
|
|
12055
|
-
const handleRef = useForkRef(
|
|
12056
|
-
// @ts-expect-error TODO upstream fix
|
|
12057
|
-
children.ref, nodeRef);
|
|
12058
|
-
|
|
12059
|
-
// The handler doesn't take event.defaultPrevented into account:
|
|
12060
|
-
//
|
|
12061
|
-
// event.preventDefault() is meant to stop default behaviors like
|
|
12062
|
-
// clicking a checkbox to check it, hitting a button to submit a form,
|
|
12063
|
-
// and hitting left arrow to move the cursor in a text input etc.
|
|
12064
|
-
// Only special HTML elements have these default behaviors.
|
|
12065
|
-
const handleClickAway = useEventCallback(event => {
|
|
12066
|
-
// Given developers can stop the propagation of the synthetic event,
|
|
12067
|
-
// we can only be confident with a positive value.
|
|
12068
|
-
const insideReactTree = syntheticEventRef.current;
|
|
12069
|
-
syntheticEventRef.current = false;
|
|
12070
|
-
const doc = ownerDocument(nodeRef.current);
|
|
12071
|
-
|
|
12072
|
-
// 1. IE11 support, which trigger the handleClickAway even after the unbind
|
|
12073
|
-
// 2. The child might render null.
|
|
12074
|
-
// 3. Behave like a blur listener.
|
|
12075
|
-
if (!activatedRef.current || !nodeRef.current || 'clientX' in event && clickedRootScrollbar$1(event, doc)) {
|
|
12076
|
-
return;
|
|
12077
|
-
}
|
|
12078
|
-
|
|
12079
|
-
// Do not act if user performed touchmove
|
|
12080
|
-
if (movedRef.current) {
|
|
12081
|
-
movedRef.current = false;
|
|
12082
|
-
return;
|
|
12083
|
-
}
|
|
12084
|
-
let insideDOM;
|
|
12085
|
-
|
|
12086
|
-
// If not enough, can use https://github.com/DieterHolvoet/event-propagation-path/blob/master/propagationPath.js
|
|
12087
|
-
if (event.composedPath) {
|
|
12088
|
-
insideDOM = event.composedPath().indexOf(nodeRef.current) > -1;
|
|
12089
|
-
} else {
|
|
12090
|
-
insideDOM = !doc.documentElement.contains(
|
|
12091
|
-
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
12092
|
-
event.target) || nodeRef.current.contains(
|
|
12093
|
-
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
12094
|
-
event.target);
|
|
12095
|
-
}
|
|
12096
|
-
if (!insideDOM && (disableReactTree || !insideReactTree)) {
|
|
12097
|
-
onClickAway(event);
|
|
12098
|
-
}
|
|
12099
|
-
});
|
|
12100
|
-
|
|
12101
|
-
// Keep track of mouse/touch events that bubbled up through the portal.
|
|
12102
|
-
const createHandleSynthetic = handlerName => event => {
|
|
12103
|
-
syntheticEventRef.current = true;
|
|
12104
|
-
const childrenPropsHandler = children.props[handlerName];
|
|
12105
|
-
if (childrenPropsHandler) {
|
|
12106
|
-
childrenPropsHandler(event);
|
|
12107
|
-
}
|
|
12108
|
-
};
|
|
12109
|
-
const childrenProps = {
|
|
12110
|
-
ref: handleRef
|
|
12111
|
-
};
|
|
12112
|
-
if (touchEvent !== false) {
|
|
12113
|
-
childrenProps[touchEvent] = createHandleSynthetic(touchEvent);
|
|
12114
|
-
}
|
|
12115
|
-
React$1.useEffect(() => {
|
|
12116
|
-
if (touchEvent !== false) {
|
|
12117
|
-
const mappedTouchEvent = mapEventPropToEvent(touchEvent);
|
|
12118
|
-
const doc = ownerDocument(nodeRef.current);
|
|
12119
|
-
const handleTouchMove = () => {
|
|
12120
|
-
movedRef.current = true;
|
|
12121
|
-
};
|
|
12122
|
-
doc.addEventListener(mappedTouchEvent, handleClickAway);
|
|
12123
|
-
doc.addEventListener('touchmove', handleTouchMove);
|
|
12124
|
-
return () => {
|
|
12125
|
-
doc.removeEventListener(mappedTouchEvent, handleClickAway);
|
|
12126
|
-
doc.removeEventListener('touchmove', handleTouchMove);
|
|
12127
|
-
};
|
|
12128
|
-
}
|
|
12129
|
-
return undefined;
|
|
12130
|
-
}, [handleClickAway, touchEvent]);
|
|
12131
|
-
if (mouseEvent !== false) {
|
|
12132
|
-
childrenProps[mouseEvent] = createHandleSynthetic(mouseEvent);
|
|
12133
|
-
}
|
|
12134
|
-
React$1.useEffect(() => {
|
|
12135
|
-
if (mouseEvent !== false) {
|
|
12136
|
-
const mappedMouseEvent = mapEventPropToEvent(mouseEvent);
|
|
12137
|
-
const doc = ownerDocument(nodeRef.current);
|
|
12138
|
-
doc.addEventListener(mappedMouseEvent, handleClickAway);
|
|
12139
|
-
return () => {
|
|
12140
|
-
doc.removeEventListener(mappedMouseEvent, handleClickAway);
|
|
12141
|
-
};
|
|
12142
|
-
}
|
|
12143
|
-
return undefined;
|
|
12144
|
-
}, [handleClickAway, mouseEvent]);
|
|
12145
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(React$1.Fragment, {
|
|
12146
|
-
children: /*#__PURE__*/React$1.cloneElement(children, childrenProps)
|
|
12147
|
-
});
|
|
12148
|
-
}
|
|
12149
|
-
process.env.NODE_ENV !== "production" ? ClickAwayListener.propTypes /* remove-proptypes */ = {
|
|
12150
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
12151
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
12152
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
12153
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
12154
|
-
/**
|
|
12155
|
-
* The wrapped element.
|
|
12156
|
-
*/
|
|
12157
|
-
children: elementAcceptingRef.isRequired,
|
|
12158
|
-
/**
|
|
12159
|
-
* If `true`, the React tree is ignored and only the DOM tree is considered.
|
|
12160
|
-
* This prop changes how portaled elements are handled.
|
|
12161
|
-
* @default false
|
|
12162
|
-
*/
|
|
12163
|
-
disableReactTree: PropTypes.bool,
|
|
12164
|
-
/**
|
|
12165
|
-
* The mouse event to listen to. You can disable the listener by providing `false`.
|
|
12166
|
-
* @default 'onClick'
|
|
12167
|
-
*/
|
|
12168
|
-
mouseEvent: PropTypes.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
|
|
12169
|
-
/**
|
|
12170
|
-
* Callback fired when a "click away" event is detected.
|
|
12171
|
-
*/
|
|
12172
|
-
onClickAway: PropTypes.func.isRequired,
|
|
12173
|
-
/**
|
|
12174
|
-
* The touch event to listen to. You can disable the listener by providing `false`.
|
|
12175
|
-
* @default 'onTouchEnd'
|
|
12176
|
-
*/
|
|
12177
|
-
touchEvent: PropTypes.oneOf(['onTouchEnd', 'onTouchStart', false])
|
|
12178
|
-
} : void 0;
|
|
12179
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12180
|
-
// eslint-disable-next-line
|
|
12181
|
-
ClickAwayListener['propTypes' + ''] = exactProp(ClickAwayListener.propTypes);
|
|
12182
|
-
}
|
|
12183
|
-
|
|
12184
12015
|
// Inspired by https://github.com/focus-trap/tabbable
|
|
12185
12016
|
const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
|
|
12186
12017
|
function getTabIndex(node) {
|
|
@@ -59371,55 +59202,63 @@ const PasswordField = ({ props, variant }) => {
|
|
|
59371
59202
|
|
|
59372
59203
|
const Monthpickerrender = ({ props, variant }) => {
|
|
59373
59204
|
const ref = useRef(null);
|
|
59374
|
-
const [calenderOpen, setCalenderOpen] = useState(false);
|
|
59205
|
+
// const [calenderOpen, setCalenderOpen] = useState(false);
|
|
59206
|
+
const [open, setOpen] = useState(false);
|
|
59207
|
+
const handleToggle = () => {
|
|
59208
|
+
var _a;
|
|
59209
|
+
if (!open) {
|
|
59210
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
59211
|
+
}
|
|
59212
|
+
setOpen(!open);
|
|
59213
|
+
};
|
|
59375
59214
|
return (jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {
|
|
59376
59215
|
var _a, _b;
|
|
59377
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(
|
|
59378
|
-
|
|
59379
|
-
|
|
59380
|
-
|
|
59381
|
-
|
|
59382
|
-
|
|
59383
|
-
|
|
59384
|
-
|
|
59385
|
-
|
|
59386
|
-
|
|
59387
|
-
|
|
59388
|
-
|
|
59389
|
-
|
|
59390
|
-
|
|
59391
|
-
|
|
59392
|
-
|
|
59393
|
-
|
|
59394
|
-
|
|
59395
|
-
|
|
59396
|
-
|
|
59397
|
-
|
|
59398
|
-
|
|
59399
|
-
|
|
59400
|
-
|
|
59401
|
-
|
|
59402
|
-
|
|
59403
|
-
|
|
59404
|
-
|
|
59405
|
-
|
|
59406
|
-
|
|
59407
|
-
|
|
59408
|
-
|
|
59409
|
-
|
|
59410
|
-
|
|
59411
|
-
|
|
59412
|
-
|
|
59413
|
-
|
|
59414
|
-
|
|
59415
|
-
|
|
59416
|
-
|
|
59417
|
-
|
|
59418
|
-
|
|
59419
|
-
|
|
59420
|
-
|
|
59421
|
-
|
|
59422
|
-
|
|
59216
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(DatePicker, { ref: ref, label: variant !== "standard" && `${props.item.label}${props.item.required ? ' *' : ''}`, views: ["month", "year"], disabled: props.item.disable, value: field.value
|
|
59217
|
+
? dayjs(formatDateMonthAndYear(field.value || null))
|
|
59218
|
+
: null, slotProps: {
|
|
59219
|
+
textField: {
|
|
59220
|
+
onClick: () => handleToggle(),
|
|
59221
|
+
inputRef: ref,
|
|
59222
|
+
},
|
|
59223
|
+
}, disableOpenPicker: props.item.disable,
|
|
59224
|
+
// onMonthChange={() => setCalenderOpen(false)}
|
|
59225
|
+
// onYearChange={() => setCalenderOpen(false)}
|
|
59226
|
+
open: open, onOpen: handleToggle, onClose: handleToggle, defaultValue: field.value, onChange: (date) => {
|
|
59227
|
+
field.onChange(dayjs(date).format("MM/YYYY"));
|
|
59228
|
+
props.setValue(dayjs(date).format("MM/YYYY"));
|
|
59229
|
+
}, sx: {
|
|
59230
|
+
"& .css-1holvmy,.css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
59231
|
+
top: "-10px",
|
|
59232
|
+
},
|
|
59233
|
+
"& input": {
|
|
59234
|
+
paddingRight: "0px !important",
|
|
59235
|
+
},
|
|
59236
|
+
"& button": {
|
|
59237
|
+
paddingLeft: "0px !important",
|
|
59238
|
+
paddingRight: "0px !important",
|
|
59239
|
+
},
|
|
59240
|
+
},
|
|
59241
|
+
// renderInput={(params:any) => (
|
|
59242
|
+
// <TextField
|
|
59243
|
+
// {...params}
|
|
59244
|
+
// fullWidth
|
|
59245
|
+
// disabled={props.item.disable || false}
|
|
59246
|
+
// InputLabelProps={{
|
|
59247
|
+
// shrink: true,
|
|
59248
|
+
// }}
|
|
59249
|
+
// inputProps={{
|
|
59250
|
+
// min: props.item.minDate,
|
|
59251
|
+
// }}
|
|
59252
|
+
// />
|
|
59253
|
+
// )}
|
|
59254
|
+
// ToolbarComponent={({ date, decreaseMonth, increaseMonth }:any) => (
|
|
59255
|
+
// <div>
|
|
59256
|
+
// <button onClick={decreaseMonth}><</button>
|
|
59257
|
+
// <span>{date.getMonth() + 1}</span>
|
|
59258
|
+
// <button onClick={increaseMonth}>></button>
|
|
59259
|
+
// </div>
|
|
59260
|
+
// )}
|
|
59261
|
+
minDate: props.item.minDate ? dayjs(props.item.minDate, 'MM/YYYY') : null, maxDate: props.item.maxDate ? dayjs(props.item.maxDate, 'MM/YYYY') : null })] })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
|
|
59423
59262
|
fontSize: "11px",
|
|
59424
59263
|
color: "#3651d3",
|
|
59425
59264
|
} }, { children: ["(", (_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.helperText, ")"] }))), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
|
|
@@ -59831,7 +59670,7 @@ function formatDateMonthAndYear(date) {
|
|
|
59831
59670
|
}
|
|
59832
59671
|
const renderLabel = (variant, props) => variant === "standard" && (jsxRuntimeExports.jsxs("span", Object.assign({ className: "formInputlabel", style: { fontSize: "12px" } }, { children: [props.item.label, " ", props.item.required && jsxRuntimeExports.jsx("span", Object.assign({ style: { color: "red" } }, { children: "*" }))] })));
|
|
59833
59672
|
const RenderForm = (props) => {
|
|
59834
|
-
var _a, _b;
|
|
59673
|
+
var _a, _b, _c;
|
|
59835
59674
|
const variant = props.variant || "";
|
|
59836
59675
|
switch ((_a = props.item) === null || _a === void 0 ? void 0 : _a.inputType) {
|
|
59837
59676
|
case "text":
|
|
@@ -60129,6 +59968,22 @@ const RenderForm = (props) => {
|
|
|
60129
59968
|
// />
|
|
60130
59969
|
// </>
|
|
60131
59970
|
// );
|
|
59971
|
+
case "checkbox-group":
|
|
59972
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(FormControl, Object.assign({ component: "fieldset" }, { children: jsxRuntimeExports.jsx(FormGroup, Object.assign({ row: true }, { children: ((_c = props.item) === null || _c === void 0 ? void 0 : _c.settings) &&
|
|
59973
|
+
props.item.settings.map((settings, i) => {
|
|
59974
|
+
return (jsxRuntimeExports.jsx(Controller, { name: settings.name, control: props.control, render: ({ field }) => {
|
|
59975
|
+
return (jsxRuntimeExports.jsx(FormControlLabel, { control: jsxRuntimeExports.jsx(Checkbox, Object.assign({}, field, { checked: field.value })), sx: {
|
|
59976
|
+
".MuiCheckbox-root": {
|
|
59977
|
+
padding: "6px 2px 6px 8px",
|
|
59978
|
+
".css-imrjgg-MuiButtonBase-root-MuiCheckbox-root": {
|
|
59979
|
+
color: "rgb(0, 0, 0) !important",
|
|
59980
|
+
},
|
|
59981
|
+
},
|
|
59982
|
+
},
|
|
59983
|
+
// label={settings.label}
|
|
59984
|
+
label: jsxRuntimeExports.jsx(Typography, Object.assign({ variant: "subtitle2", fontSize: "11px", fontWeight: "normal !important" }, { children: settings.label })), labelPlacement: "end" }));
|
|
59985
|
+
} }, i));
|
|
59986
|
+
}) })) })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
|
|
60132
59987
|
case "radio-group":
|
|
60133
59988
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(FormControl, Object.assign({ component: "fieldset" }, { children: jsxRuntimeExports.jsx(Controller, { name: props.item.name, control: props.control, render: ({ field }) => {
|
|
60134
59989
|
var _a, _b;
|