tp-react-elements 1.1.13 → 1.1.17

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.
@@ -1,3 +1,3 @@
1
- var DayCell = {};
1
+ var Month = {};
2
2
 
3
- export { DayCell as __exports };
3
+ export { Month as __exports };
@@ -1,3 +1,3 @@
1
- var DateInput = {};
1
+ var DayCell = {};
2
2
 
3
- export { DateInput as __exports };
3
+ export { DayCell as __exports };
@@ -1,3 +1,3 @@
1
- var Month = {};
1
+ var DateInput = {};
2
2
 
3
- export { Month as __exports };
3
+ export { DateInput as __exports };
@@ -1,3 +1,3 @@
1
- var DateRangePicker = {};
1
+ var Calendar = {};
2
2
 
3
- export { DateRangePicker as __exports };
3
+ export { Calendar as __exports };
@@ -1,3 +1,3 @@
1
- var Calendar = {};
1
+ var DateRange = {};
2
2
 
3
- export { Calendar as __exports };
3
+ export { DateRange as __exports };
@@ -1,3 +1,3 @@
1
- var DateRange = {};
1
+ var DefinedRange = {};
2
2
 
3
- export { DateRange as __exports };
3
+ export { DefinedRange as __exports };
@@ -1,3 +1,3 @@
1
- var DefinedRange = {};
1
+ var DateRangePicker = {};
2
2
 
3
- export { DefinedRange as __exports };
3
+ export { DateRangePicker as __exports };
@@ -26,6 +26,7 @@ const DatepickerWrapperV2 = ({ props, variant, }) => {
26
26
  if (!open) {
27
27
  inputTextRef.current?.blur();
28
28
  }
29
+ document.activeElement?.blur();
29
30
  setOpen(!open);
30
31
  };
31
32
  const isError = !!props.errors?.[props.item.name];
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useState } from 'react';
2
+ import { useRef, useState } from 'react';
3
3
  import { Controller } from 'react-hook-form';
4
4
  import { TextField, FormGroup, FormControlLabel, Checkbox } from '@mui/material';
5
5
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
@@ -7,7 +7,16 @@ import { LocalizationProvider } from '@mui/x-date-pickers';
7
7
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
8
8
 
9
9
  const MonthPicker = ({ props }) => {
10
+ const inputTextRef = useRef(null);
11
+ const [open, setOpen] = useState(false);
10
12
  const [selectedMonths, setSelectedMonths] = useState([]);
13
+ const handleToggle = () => {
14
+ if (!open) {
15
+ inputTextRef.current?.blur();
16
+ }
17
+ document.activeElement?.blur();
18
+ setOpen(!open);
19
+ };
11
20
  const handleMonthChange = (date) => {
12
21
  // Handle the selected months
13
22
  setSelectedMonths((prevSelectedMonths) => {
@@ -22,12 +31,14 @@ const MonthPicker = ({ props }) => {
22
31
  }
23
32
  });
24
33
  };
25
- return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxs(Fragment, { children: [jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsx(DatePicker, { value: field.value, onChange: handleMonthChange, slots: {
34
+ return (jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => (jsxs(Fragment, { children: [jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsx(DatePicker, { value: field.value, onChange: handleMonthChange, open: open, onOpen: handleToggle, onClose: handleToggle, slots: {
26
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- textField: (textFieldProps) => (jsx(TextField, { ...textFieldProps, fullWidth: true, disabled: props.item.disable || false, InputLabelProps: {
36
+ textField: (textFieldProps) => (jsx(TextField, { ...textFieldProps, fullWidth: true, onClick: () => handleToggle(), inputRef: inputTextRef, disabled: props.item.disable || false, InputLabelProps: {
28
37
  shrink: true,
29
38
  }, error: props.errors, inputProps: {
30
39
  min: props.item.minDate,
40
+ readOnly: true,
41
+ style: { cursor: 'pointer' },
31
42
  } })),
32
43
  }, slotProps: {
33
44
  textField: {
@@ -26,6 +26,7 @@ const Monthpickerrender = ({ props, variant, }) => {
26
26
  if (!open) {
27
27
  ref.current?.blur();
28
28
  }
29
+ document.activeElement?.blur();
29
30
  setOpen(!open);
30
31
  };
31
32
  const isError = !!props.errors?.[props.item.name];
@@ -39,6 +40,10 @@ const Monthpickerrender = ({ props, variant, }) => {
39
40
  onClick: () => handleToggle(),
40
41
  inputRef: ref,
41
42
  error: isShowBorderError,
43
+ inputProps: {
44
+ readOnly: true,
45
+ style: { cursor: 'pointer' },
46
+ },
42
47
  },
43
48
  }, disableOpenPicker: props.item.disable, open: open, onOpen: handleToggle, onClose: handleToggle, defaultValue: field.value, onChange: (date) => {
44
49
  const formatted = dayjs(date).format('MM/YYYY');
@@ -87,7 +87,7 @@ const FormNumberField = ({ props, variant }) => {
87
87
  '& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root,.css-kichxs-MuiFormLabel-root-MuiInputLabel-root': {
88
88
  top: '-10px',
89
89
  },
90
- },
90
+ }, placeholder: props.item.placeholder || '',
91
91
  /**
92
92
  * Additional input properties for the TextField
93
93
  * Controls input pattern, length restrictions, and additional input handling
@@ -33,7 +33,7 @@ const FormNumberFieldDecimal = ({ props, variant, }) => {
33
33
  '& .css-16hdwvj,.css-1idq7r3-MuiFormLabel-root-MuiInputLabel-root': {
34
34
  top: '-5px',
35
35
  },
36
- }, onBlur: (e) => {
36
+ }, placeholder: props.item.placeholder || '', onBlur: (e) => {
37
37
  props?.item?.onBlurFn && props?.item?.onBlurFn(e);
38
38
  }, InputProps: {
39
39
  inputProps: {
@@ -1,4 +1,4 @@
1
- import { __exports as Calendar } from '../../../../../_virtual/index.esm5.js';
1
+ import { __exports as Calendar } from '../../../../../_virtual/index.esm4.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireDayCell } from '../DayCell/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DateInput } from '../../../../../_virtual/index.esm12.js';
1
+ import { __exports as DateInput } from '../../../../../_virtual/index.esm13.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DateRange } from '../../../../../_virtual/index.esm6.js';
1
+ import { __exports as DateRange } from '../../../../../_virtual/index.esm5.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireCalendar } from '../Calendar/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm4.js';
1
+ import { __exports as DateRangePicker } from '../../../../../_virtual/index.esm7.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireDateRange } from '../DateRange/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DayCell } from '../../../../../_virtual/index.esm11.js';
1
+ import { __exports as DayCell } from '../../../../../_virtual/index.esm12.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireClassnames } from '../../../../classnames/index.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as DefinedRange } from '../../../../../_virtual/index.esm7.js';
1
+ import { __exports as DefinedRange } from '../../../../../_virtual/index.esm6.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireStyles } from '../../styles.esm.js';
@@ -1,4 +1,4 @@
1
- import { __exports as Month } from '../../../../../_virtual/index.esm13.js';
1
+ import { __exports as Month } from '../../../../../_virtual/index.esm11.js';
2
2
  import require$$0__default from 'react';
3
3
  import { __require as requirePropTypes } from '../../../../prop-types/index.esm.js';
4
4
  import { __require as requireDayCell } from '../DayCell/index.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tp-react-elements",
3
- "version": "1.1.13",
3
+ "version": "1.1.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "React form components library built with React Hook Form and Yup",