@arquimedes.co/eureka-forms 3.0.25-refactor → 3.0.25-test

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.
@@ -5,12 +5,12 @@ export const DraftApi = RootApi.injectEndpoints({
5
5
  endpoints: (build) => ({
6
6
  mapDraft: build.query({
7
7
  queryFn: async ({ idForm, dependencies, property, mapDraftEntities }, { getState }) => {
8
- const idOrganization = getState()[idForm].global.idOrganization;
8
+ const idOrganization = getState().forms[idForm].global.idOrganization;
9
9
  if (mapDraftEntities)
10
10
  return {
11
11
  data: await mapDraftEntities(property, dependencies),
12
12
  };
13
- const apiKey = getState()[idForm].global.apiKey;
13
+ const apiKey = getState().forms[idForm].global.apiKey;
14
14
  if (!apiKey)
15
15
  return { data: undefined };
16
16
  let response;
@@ -1,23 +1,55 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { styled, Dialog as MuiDialog, InputAdornment } from '@mui/material';
4
- import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, PickersDay as MuiPickerDay, } from '@mui/x-date-pickers';
2
+ import React, { forwardRef } from 'react';
3
+ import { styled, Dialog as MuiDialog } from '@mui/material';
4
+ import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, PickersDay as MuiPickerDay, usePickerContext, } from '@mui/x-date-pickers';
5
5
  import { StyledTextField } from '../ErkTextField/ErkTextField';
6
6
  import CalendarIcon from '../../Icons/CalendarIcon';
7
- const StyledDateTimePicker = styled(MuiDateTimePicker)(({ ...props }) => ({
7
+ import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
8
+ const StyledDateTimePicker = styled(MuiDateTimePicker, {
9
+ shouldForwardProp: (propName) => propName !== 'size',
10
+ })(({ disabled, size }) => ({
8
11
  '& .Erk-MuiInputBase-root': {
9
- cursor: props.disabled ? 'default' : 'pointer',
12
+ cursor: disabled ? 'default' : 'pointer',
10
13
  '& input': {
11
- cursor: props.disabled ? 'default' : 'pointer',
14
+ cursor: disabled ? 'default' : 'pointer',
12
15
  paddingRight: '0px',
13
16
  },
14
17
  },
18
+ '& .Erk-MuiInputBase-adornedEnd': {
19
+ paddingRight: '7px',
20
+ },
21
+ '& .Erk-MuiInputAdornment-root': {
22
+ minWidth: size === 'small' ? 24 : 26,
23
+ '& .Erk-MuiButtonBase-root': {
24
+ margin: '-2px',
25
+ padding: 3,
26
+ width: size === 'small' ? 28 : 26,
27
+ height: size === 'small' ? 28 : 26,
28
+ },
29
+ },
30
+ '& .Erk-MuiClock-root': {
31
+ marginBottom: '16px',
32
+ },
15
33
  }));
16
- const StyledDatePicker = styled(MuiDatePicker)(({ ...props }) => ({
34
+ const StyledDatePicker = styled(MuiDatePicker, {
35
+ shouldForwardProp: (propName) => propName !== 'size',
36
+ })(({ disabled, size }) => ({
17
37
  '& .Erk-MuiInputBase-root': {
18
- cursor: props.disabled ? 'default' : 'pointer',
38
+ cursor: disabled ? 'default' : 'pointer',
19
39
  '& input': {
20
- cursor: props.disabled ? 'default' : 'pointer',
40
+ cursor: disabled ? 'default' : 'pointer',
41
+ },
42
+ },
43
+ '& .Erk-MuiInputBase-adornedEnd': {
44
+ paddingRight: '7px',
45
+ },
46
+ '& .Erk-MuiInputAdornment-root': {
47
+ minWidth: size === 'small' ? 24 : 26,
48
+ '& .Erk-MuiButtonBase-root': {
49
+ margin: '-2px',
50
+ padding: 3,
51
+ width: size === 'small' ? 28 : 26,
52
+ height: size === 'small' ? 28 : 26,
21
53
  },
22
54
  },
23
55
  }));
@@ -27,7 +59,7 @@ const StyledDateTimeToolBar = styled(MuiDateTimePickerToolbar)(({ theme }) => ({
27
59
  color: theme.palette.primary.contrastText,
28
60
  '& span': {
29
61
  fontSize: '1rem',
30
- textTransform: 'capitalize',
62
+ textTransform: 'none',
31
63
  color: theme.palette.primary.contrastText,
32
64
  },
33
65
  '& .Erk-MuiDateTimePickerToolbar-dateContainer': {
@@ -102,9 +134,14 @@ const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
102
134
  },
103
135
  },
104
136
  }));
137
+ // eslint-disable-next-line react/display-name
138
+ const CustomTextField = forwardRef((props, ref) => {
139
+ const pickerContext = usePickerContext();
140
+ return _jsx(StyledTextField, { ...props, inputRef: ref, onClick: () => pickerContext.setOpen((prev) => !prev) });
141
+ });
105
142
  function CustomDatePicker({ error, required, disabled, readOnly, helperText, size = 'small', labelMargin = 5, pickTime = false, ...others }) {
106
143
  if (pickTime) {
107
- return (_jsx(StyledDateTimePicker, { ampm: true, reduceAnimations: true, ...others, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
144
+ return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
108
145
  actionBar: {
109
146
  actions: ['clear', 'accept'],
110
147
  },
@@ -153,18 +190,22 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
153
190
  fullWidth: true,
154
191
  InputProps: {
155
192
  disabled: disabled ?? readOnly,
156
- endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(CalendarIcon, { size: size === 'small' ? 22 : 26 }) })),
157
193
  },
158
194
  },
195
+ }, viewRenderers: {
196
+ hours: renderTimeViewClock,
197
+ minutes: renderTimeViewClock,
198
+ seconds: renderTimeViewClock,
159
199
  }, slots: {
160
200
  day: StyledDay,
161
201
  dialog: StyledDialog,
162
202
  toolbar: StyledDateTimeToolBar,
163
- textField: StyledTextField,
164
- } }));
203
+ textField: CustomTextField,
204
+ openPickerIcon: CalendarIcon,
205
+ }, enableAccessibleFieldDOMStructure: false }));
165
206
  }
166
207
  else {
167
- return (_jsx(StyledDatePicker, { ...others, reduceAnimations: true, readOnly: readOnly, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
208
+ return (_jsx(StyledDatePicker, { ...others, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
168
209
  actionBar: {
169
210
  actions: ['clear', 'accept'],
170
211
  },
@@ -203,15 +244,15 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
203
244
  placeholder: '',
204
245
  InputProps: {
205
246
  disabled: disabled ?? readOnly,
206
- endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(CalendarIcon, { size: size === 'small' ? 20 : 24 }) })),
207
247
  },
208
248
  },
209
249
  }, slots: {
210
250
  day: StyledDay,
211
251
  dialog: StyledDialog,
212
252
  toolbar: StyledDateToolBar,
213
- textField: StyledTextField,
214
- } }));
253
+ textField: CustomTextField,
254
+ openPickerIcon: CalendarIcon,
255
+ }, enableAccessibleFieldDOMStructure: false }));
215
256
  }
216
257
  }
217
258
  /**
@@ -21,6 +21,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
21
21
  }>, import("redux").StoreEnhancer]>>;
22
22
  export type AppDispatch = typeof store.dispatch;
23
23
  export type AppStore = typeof store;
24
+ export type AppState = ReturnType<typeof store.getState>;
24
25
  export declare const getAppState: import("@reduxjs/toolkit").AsyncThunk<RootState, {
25
26
  idForm: string;
26
27
  }, {
@@ -31,5 +31,5 @@ export const store = configureStore({
31
31
  middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(RootApi.middleware),
32
32
  });
33
33
  export const getAppState = createAsyncThunk('get/state', ({ idForm }, thunkAPI) => {
34
- return thunkAPI.getState()[idForm];
34
+ return thunkAPI.getState().forms[idForm];
35
35
  });
package/dist/hooks.js CHANGED
@@ -17,6 +17,6 @@ export const useAppDispatch = () => {
17
17
  };
18
18
  export const useAppSelector = (selector, options) => {
19
19
  const idForm = useContext(IdFormContext);
20
- return useSelector((state) => selector(state[idForm] ?? defaultRootState), options);
20
+ return useSelector((state) => selector(state.forms[idForm] ?? defaultRootState), options);
21
21
  };
22
22
  export const selectBreakPoint = (state) => state.widthStats.currentBreakPoint;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"3.0.25-refactor",
4
+ "version":"3.0.25-test",
5
5
  "scripts": {
6
6
  "watch": "tsc --noEmit --watch --project tsconfig.app.json",
7
7
  "start": "vite",