@semapps/date-components 1.1.4 → 1.2.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/index.es.js CHANGED
@@ -1,241 +1,230 @@
1
- import { jsx as $5Ihaz$jsx, jsxs as $5Ihaz$jsxs } from 'react/jsx-runtime';
2
- import '@fullcalendar/core/vdom';
3
- import { DatePicker as $5Ihaz$DatePicker } from '@mui/x-date-pickers/DatePicker';
4
- import { TimePicker as $5Ihaz$TimePicker } from '@mui/x-date-pickers/TimePicker';
5
- import { DateTimePicker as $5Ihaz$DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
6
- import { useCallback as $5Ihaz$useCallback, useMemo as $5Ihaz$useMemo } from 'react';
7
- import {
8
- useInput as $5Ihaz$useInput,
9
- useTranslateLabel as $5Ihaz$useTranslateLabel,
10
- InputHelperText as $5Ihaz$InputHelperText,
11
- useListContext as $5Ihaz$useListContext,
12
- useCreatePath as $5Ihaz$useCreatePath
13
- } from 'react-admin';
14
- import { LocalizationProvider as $5Ihaz$LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
15
- import { AdapterDateFns as $5Ihaz$AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
16
- import $5Ihaz$fullcalendarreact from '@fullcalendar/react';
17
- import $5Ihaz$fullcalendardaygrid from '@fullcalendar/daygrid';
18
- import { useTheme as $5Ihaz$useTheme } from '@mui/material';
19
- import $5Ihaz$muistylesmakeStyles from '@mui/styles/makeStyles';
20
- import { useSearchParams as $5Ihaz$useSearchParams, useNavigate as $5Ihaz$useNavigate } from 'react-router-dom';
21
- import $5Ihaz$fullcalendarlist from '@fullcalendar/list';
1
+ import {jsx as $5Ihaz$jsx, jsxs as $5Ihaz$jsxs, Fragment as $5Ihaz$Fragment} from "react/jsx-runtime";
2
+ import "@fullcalendar/react/dist/vdom";
3
+ import {DatePicker as $5Ihaz$DatePicker} from "@mui/x-date-pickers/DatePicker";
4
+ import {TimePicker as $5Ihaz$TimePicker} from "@mui/x-date-pickers/TimePicker";
5
+ import {DateTimePicker as $5Ihaz$DateTimePicker} from "@mui/x-date-pickers/DateTimePicker";
6
+ import {useCallback as $5Ihaz$useCallback, useMemo as $5Ihaz$useMemo} from "react";
7
+ import {useInput as $5Ihaz$useInput, useTranslateLabel as $5Ihaz$useTranslateLabel, InputHelperText as $5Ihaz$InputHelperText, useListContext as $5Ihaz$useListContext, useCreatePath as $5Ihaz$useCreatePath} from "react-admin";
8
+ import {LocalizationProvider as $5Ihaz$LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider";
9
+ import {AdapterDateFns as $5Ihaz$AdapterDateFns} from "@mui/x-date-pickers/AdapterDateFns";
10
+ import $5Ihaz$fullcalendarreact from "@fullcalendar/react";
11
+ import $5Ihaz$fullcalendardaygrid from "@fullcalendar/daygrid";
12
+ import {useTheme as $5Ihaz$useTheme, GlobalStyles as $5Ihaz$GlobalStyles} from "@mui/material";
13
+ import {useSearchParams as $5Ihaz$useSearchParams, useNavigate as $5Ihaz$useNavigate} from "react-router-dom";
14
+ import $5Ihaz$fullcalendarlist from "@fullcalendar/list";
22
15
 
23
16
  /* eslint-disable react/react-in-jsx-scope */ /* eslint-disable react/jsx-props-no-spreading */ // Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6
24
17
  // See https://github.com/fullcalendar/fullcalendar-vue/issues/152
25
18
 
26
- /* eslint-disable react/react-in-jsx-scope */ /* eslint-disable react/require-default-props */
27
-
28
- const $610808f89222f9cc$var$Picker = ({
29
- PickerComponent: PickerComponent,
30
- label: label,
31
- source: source,
32
- helperText: helperText,
33
- fullWidth: fullWidth,
34
- onBlur: onBlur,
35
- onChange: onChange,
36
- format: format,
37
- parse: parse,
38
- validate: validate,
39
- defaultValue: defaultValue,
40
- locale: locale,
41
- translations: translations,
42
- stringFormat: stringFormat = 'ISO',
43
- ...rest
44
- }) => {
45
- const {
46
- field: field,
47
- isRequired: isRequired,
48
- fieldState: { error: error, isTouched: isTouched, invalid: invalid },
49
- formState: { isSubmitted: isSubmitted }
50
- } = (0, $5Ihaz$useInput)({
51
- format: format,
52
- onBlur: onBlur,
53
- onChange: onChange,
54
- parse: parse,
55
- source: source,
56
- validate: validate,
57
- defaultValue: defaultValue
58
- });
59
- const handleChange = (0, $5Ihaz$useCallback)(
60
- value => {
61
- if (value instanceof Date) field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());
62
- else field.onChange(null);
63
- },
64
- [field, stringFormat]
65
- );
66
- const translateLabel = (0, $5Ihaz$useTranslateLabel)();
67
- const translatedLabel = /*#__PURE__*/ (0, $5Ihaz$jsxs)('span', {
68
- children: [
69
- translateLabel({
70
- label: label,
71
- source: source
72
- }),
73
- isRequired &&
74
- /*#__PURE__*/ (0, $5Ihaz$jsx)('span', {
75
- 'aria-hidden': 'true',
76
- children: '\u2009*'
19
+
20
+
21
+
22
+
23
+ /* eslint-disable react/react-in-jsx-scope */ /* eslint-disable react/require-default-props */
24
+
25
+
26
+
27
+
28
+ const $610808f89222f9cc$var$Picker = ({ PickerComponent: PickerComponent, label: label, source: source, helperText: helperText, fullWidth: fullWidth, onBlur: onBlur, onChange: onChange, format: format, parse: parse, validate: validate, defaultValue: defaultValue, locale: locale, translations: translations, stringFormat: stringFormat = 'ISO', ...rest })=>{
29
+ const { field: field, isRequired: isRequired, fieldState: { error: error, isTouched: isTouched, invalid: invalid }, formState: { isSubmitted: isSubmitted } } = (0, $5Ihaz$useInput)({
30
+ format: format,
31
+ onBlur: onBlur,
32
+ onChange: onChange,
33
+ parse: parse,
34
+ source: source,
35
+ validate: validate,
36
+ defaultValue: defaultValue
37
+ });
38
+ const handleChange = (0, $5Ihaz$useCallback)((value)=>{
39
+ if (value instanceof Date) field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());
40
+ else field.onChange(null);
41
+ }, [
42
+ field,
43
+ stringFormat
44
+ ]);
45
+ const translateLabel = (0, $5Ihaz$useTranslateLabel)();
46
+ const translatedLabel = /*#__PURE__*/ (0, $5Ihaz$jsxs)("span", {
47
+ children: [
48
+ translateLabel({
49
+ label: label,
50
+ source: source
51
+ }),
52
+ isRequired && /*#__PURE__*/ (0, $5Ihaz$jsx)("span", {
53
+ "aria-hidden": "true",
54
+ children: "\u2009*"
55
+ })
56
+ ]
57
+ });
58
+ return /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$LocalizationProvider), {
59
+ dateAdapter: (0, $5Ihaz$AdapterDateFns),
60
+ adapterLocale: locale,
61
+ localeText: translations?.components.MuiLocalizationProvider.defaultProps.localeText,
62
+ children: /*#__PURE__*/ (0, $5Ihaz$jsx)(PickerComponent, {
63
+ label: translatedLabel,
64
+ slotProps: {
65
+ textField: {
66
+ error: (isTouched || isSubmitted) && invalid,
67
+ size: 'small',
68
+ fullWidth: fullWidth,
69
+ helperText: // @ts-expect-error TS(2322): Type '{ touched: boolean; error: string | undefine... Remove this comment to see the full error message
70
+ /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$InputHelperText), {
71
+ touched: isTouched || isSubmitted,
72
+ error: error?.message,
73
+ helperText: helperText
74
+ })
75
+ }
76
+ },
77
+ value: field.value ? new Date(field.value) : null,
78
+ onChange: handleChange,
79
+ ...rest
77
80
  })
78
- ]
79
- });
80
- return /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$LocalizationProvider), {
81
- dateAdapter: (0, $5Ihaz$AdapterDateFns),
82
- adapterLocale: locale,
83
- localeText: translations?.components.MuiLocalizationProvider.defaultProps.localeText,
84
- children: /*#__PURE__*/ (0, $5Ihaz$jsx)(PickerComponent, {
85
- label: translatedLabel,
86
- slotProps: {
87
- textField: {
88
- error: (isTouched || isSubmitted) && invalid,
89
- size: 'small',
90
- fullWidth: fullWidth,
91
- helperText: /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$InputHelperText), {
92
- touched: isTouched || isSubmitted,
93
- error: error?.message,
94
- helperText: helperText
95
- })
96
- }
97
- },
98
- value: field.value ? new Date(field.value) : null,
99
- onChange: handleChange,
100
- ...rest
101
- })
102
- });
81
+ });
103
82
  };
104
83
  var $610808f89222f9cc$export$2e2bcd8739ae039 = $610808f89222f9cc$var$Picker;
105
84
 
106
- const $37245c02f9b1b006$var$useFullCalendarProps = ({
107
- label: label,
108
- startDate: startDate,
109
- endDate: endDate,
110
- linkType: linkType
111
- }) => {
112
- const { data: data, isLoading: isLoading, resource: resource } = (0, $5Ihaz$useListContext)();
113
- const [searchParams, setSearchParams] = (0, $5Ihaz$useSearchParams)();
114
- const navigate = (0, $5Ihaz$useNavigate)();
115
- const createPath = (0, $5Ihaz$useCreatePath)();
116
- const query = new URLSearchParams(location.search);
117
- // Bypass the link in order to use React-Router
118
- const eventClick = (0, $5Ihaz$useCallback)(({ event: event, jsEvent: jsEvent }) => {
119
- jsEvent.preventDefault();
120
- navigate(event.url);
121
- }, []);
122
- // Change the query string when month change
123
- const datesSet = (0, $5Ihaz$useCallback)(
124
- ({ view: view }) => {
125
- setSearchParams(params => ({
126
- ...params,
127
- month: view.currentStart.getMonth() + 1,
128
- year: view.currentStart.getFullYear()
129
- }));
130
- },
131
- [setSearchParams]
132
- );
133
- const events = (0, $5Ihaz$useMemo)(
134
- () =>
135
- !isLoading &&
136
- data
137
- .filter(record => record)
138
- .map(record => ({
139
- id: record.id,
140
- title: typeof label === 'string' ? record[label] : label(record),
141
- start: typeof startDate === 'string' ? record[startDate] : startDate(record),
142
- end: typeof endDate === 'string' ? record[endDate] : endDate(record),
143
- url: createPath({
144
- resource: resource,
145
- id: record.id,
146
- type: linkType
147
- })
148
- })),
149
- [isLoading, data, resource, createPath]
150
- );
151
- return {
152
- initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),
153
- events: events,
154
- datesSet: datesSet,
155
- eventClick: eventClick
156
- };
157
- };
158
- var $37245c02f9b1b006$export$2e2bcd8739ae039 = $37245c02f9b1b006$var$useFullCalendarProps;
159
-
160
- const $abbcc02f55461290$var$useGlobalStyles = (0, $5Ihaz$muistylesmakeStyles)(theme => ({
161
- '@global': {
162
- '.fc-button': {
163
- backgroundColor: `${theme.palette.primary.main} !important`,
164
- border: 'none !important',
165
- opacity: '1 !important'
166
- },
167
- '.fc-day-today': {
168
- backgroundColor: `${theme.palette.secondary.light} !important`
169
- },
170
- // Overwrite violet color of links
171
- 'a.fc-daygrid-dot-event': {
172
- color: 'black !important'
173
- }
174
- }
175
- }));
176
- const $abbcc02f55461290$var$CalendarList = props => {
177
- const theme = (0, $5Ihaz$useTheme)();
178
- const fullCalendarProps = (0, $37245c02f9b1b006$export$2e2bcd8739ae039)(props);
179
- $abbcc02f55461290$var$useGlobalStyles();
180
- return /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$fullcalendarreact), {
181
- plugins: [(0, $5Ihaz$fullcalendardaygrid)],
182
- locale: props.locale,
183
- initialView: 'dayGridMonth',
184
- eventBackgroundColor: theme.palette.primary.main,
185
- ...fullCalendarProps
186
- });
187
- };
188
- $abbcc02f55461290$var$CalendarList.defaultProps = {
189
- linkType: 'edit'
190
- };
191
- var $abbcc02f55461290$export$2e2bcd8739ae039 = $abbcc02f55461290$var$CalendarList;
192
-
193
- const $69d9f850452774a2$var$useGlobalStyles = (0, $5Ihaz$muistylesmakeStyles)(theme => ({
194
- '@global': {
195
- '.fc-button': {
196
- backgroundColor: `${theme.palette.primary.main} !important`,
197
- border: 'none !important',
198
- opacity: '1 !important'
199
- }
200
- }
201
- }));
202
- const $69d9f850452774a2$var$DaysList = props => {
203
- const fullCalendarProps = (0, $37245c02f9b1b006$export$2e2bcd8739ae039)(props);
204
- $69d9f850452774a2$var$useGlobalStyles();
205
- return /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$fullcalendarreact), {
206
- plugins: [(0, $5Ihaz$fullcalendarlist)],
207
- locale: props.locale,
208
- initialView: 'listMonth',
209
- ...fullCalendarProps
210
- });
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ const $cb9049d6e1676554$var$useFullCalendarProps = ({ label: label, startDate: startDate, endDate: endDate, linkType: linkType = 'edit' })=>{
95
+ const { data: data, isLoading: isLoading, resource: resource } = (0, $5Ihaz$useListContext)();
96
+ const [searchParams, setSearchParams] = (0, $5Ihaz$useSearchParams)();
97
+ const navigate = (0, $5Ihaz$useNavigate)();
98
+ const createPath = (0, $5Ihaz$useCreatePath)();
99
+ const query = new URLSearchParams(location.search);
100
+ // Bypass the link in order to use React-Router
101
+ const eventClick = (0, $5Ihaz$useCallback)(({ event: event, jsEvent: jsEvent })=>{
102
+ jsEvent.preventDefault();
103
+ navigate(event.url);
104
+ }, []);
105
+ // Change the query string when month change
106
+ const datesSet = (0, $5Ihaz$useCallback)(({ view: view })=>{
107
+ // @ts-expect-error TS(2345): Argument of type '(params: URLSearchParams) => { m... Remove this comment to see the full error message
108
+ setSearchParams((params)=>({
109
+ ...params,
110
+ month: view.currentStart.getMonth() + 1,
111
+ year: view.currentStart.getFullYear()
112
+ }));
113
+ }, [
114
+ setSearchParams
115
+ ]);
116
+ const events = (0, $5Ihaz$useMemo)(()=>!isLoading && // @ts-expect-error TS(2532): Object is possibly 'undefined'.
117
+ data.filter((record)=>record).map((record)=>({
118
+ id: record.id,
119
+ title: typeof label === 'string' ? record[label] : label(record),
120
+ start: typeof startDate === 'string' ? record[startDate] : startDate(record),
121
+ end: typeof endDate === 'string' ? record[endDate] : endDate(record),
122
+ url: createPath({
123
+ resource: resource,
124
+ id: record.id,
125
+ type: linkType
126
+ })
127
+ })), [
128
+ isLoading,
129
+ data,
130
+ resource,
131
+ createPath
132
+ ]);
133
+ return {
134
+ // @ts-expect-error TS(2345): Argument of type 'string | null' is not assignable... Remove this comment to see the full error message
135
+ initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),
136
+ events: events,
137
+ datesSet: datesSet,
138
+ eventClick: eventClick
139
+ };
211
140
  };
212
- $69d9f850452774a2$var$DaysList.defaultProps = {
213
- linkType: 'edit'
141
+ var $cb9049d6e1676554$export$2e2bcd8739ae039 = $cb9049d6e1676554$var$useFullCalendarProps;
142
+
143
+
144
+ const $e2ca335ee375606a$var$CalendarList = (props)=>{
145
+ const theme = (0, $5Ihaz$useTheme)();
146
+ const fullCalendarProps = (0, $cb9049d6e1676554$export$2e2bcd8739ae039)(props);
147
+ return /*#__PURE__*/ (0, $5Ihaz$jsxs)((0, $5Ihaz$Fragment), {
148
+ children: [
149
+ /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$GlobalStyles), {
150
+ styles: (theme)=>({
151
+ '.fc-button': {
152
+ backgroundColor: `${theme.palette.primary.main} !important`,
153
+ border: 'none !important',
154
+ opacity: '1 !important'
155
+ },
156
+ '.fc-day-today': {
157
+ backgroundColor: `${theme.palette.secondary.light} !important`
158
+ },
159
+ // Overwrite violet color of links
160
+ 'a.fc-daygrid-dot-event': {
161
+ color: 'black !important'
162
+ }
163
+ })
164
+ }),
165
+ /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$fullcalendarreact), {
166
+ plugins: [
167
+ (0, $5Ihaz$fullcalendardaygrid)
168
+ ],
169
+ locale: props.locale,
170
+ initialView: "dayGridMonth",
171
+ eventBackgroundColor: theme.palette.primary.main,
172
+ ...fullCalendarProps
173
+ })
174
+ ]
175
+ });
214
176
  };
215
- var $69d9f850452774a2$export$2e2bcd8739ae039 = $69d9f850452774a2$var$DaysList;
216
-
217
- const $582746363a8b71b9$export$7edc06cf1783b30f = props =>
218
- /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
219
- PickerComponent: (0, $5Ihaz$DatePicker),
220
- ...props
221
- });
222
- const $582746363a8b71b9$export$a1af6f79df847fac = props =>
223
- /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
224
- PickerComponent: (0, $5Ihaz$TimePicker),
225
- ...props
226
- });
227
- const $582746363a8b71b9$export$183478aa40b5df1 = props =>
228
- /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
229
- PickerComponent: (0, $5Ihaz$DateTimePicker),
230
- ...props
231
- });
232
-
233
- export {
234
- $582746363a8b71b9$export$7edc06cf1783b30f as DateInput,
235
- $582746363a8b71b9$export$a1af6f79df847fac as TimeInput,
236
- $582746363a8b71b9$export$183478aa40b5df1 as DateTimeInput,
237
- $abbcc02f55461290$export$2e2bcd8739ae039 as CalendarList,
238
- $69d9f850452774a2$export$2e2bcd8739ae039 as DaysList,
239
- $37245c02f9b1b006$export$2e2bcd8739ae039 as useFullCalendarProps
177
+ var $e2ca335ee375606a$export$2e2bcd8739ae039 = $e2ca335ee375606a$var$CalendarList;
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ const $165f9618c6b47a8a$var$DaysList = (props)=>{
187
+ const fullCalendarProps = (0, $cb9049d6e1676554$export$2e2bcd8739ae039)(props);
188
+ return /*#__PURE__*/ (0, $5Ihaz$jsxs)((0, $5Ihaz$Fragment), {
189
+ children: [
190
+ /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$GlobalStyles), {
191
+ styles: (theme)=>({
192
+ '.fc-button': {
193
+ backgroundColor: `${theme.palette.primary.main} !important`,
194
+ border: 'none !important',
195
+ opacity: '1 !important'
196
+ }
197
+ })
198
+ }),
199
+ /*#__PURE__*/ (0, $5Ihaz$jsx)((0, $5Ihaz$fullcalendarreact), {
200
+ plugins: [
201
+ (0, $5Ihaz$fullcalendarlist)
202
+ ],
203
+ locale: props.locale,
204
+ initialView: "listMonth",
205
+ ...fullCalendarProps
206
+ }),
207
+ ";"
208
+ ]
209
+ });
240
210
  };
211
+ var $165f9618c6b47a8a$export$2e2bcd8739ae039 = $165f9618c6b47a8a$var$DaysList;
212
+
213
+
214
+
215
+ const $582746363a8b71b9$export$7edc06cf1783b30f = (props)=>/*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
216
+ PickerComponent: (0, $5Ihaz$DatePicker),
217
+ ...props
218
+ });
219
+ const $582746363a8b71b9$export$a1af6f79df847fac = (props)=>/*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
220
+ PickerComponent: (0, $5Ihaz$TimePicker),
221
+ ...props
222
+ });
223
+ const $582746363a8b71b9$export$183478aa40b5df1 = (props)=>/*#__PURE__*/ (0, $5Ihaz$jsx)((0, $610808f89222f9cc$export$2e2bcd8739ae039), {
224
+ PickerComponent: (0, $5Ihaz$DateTimePicker),
225
+ ...props
226
+ });
227
+
228
+
229
+ export {$582746363a8b71b9$export$7edc06cf1783b30f as DateInput, $582746363a8b71b9$export$a1af6f79df847fac as TimeInput, $582746363a8b71b9$export$183478aa40b5df1 as DateTimeInput, $e2ca335ee375606a$export$2e2bcd8739ae039 as CalendarList, $165f9618c6b47a8a$export$2e2bcd8739ae039 as DaysList, $cb9049d6e1676554$export$2e2bcd8739ae039 as useFullCalendarProps};
241
230
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA2C,GAC3C,+CAA+C,GAE/C,sFAAsF;AACtF,kEAAkE;;;;;;ACJlE,2CAA2C,GAC3C,8CAA8C;;;;;AAgB9C,MAAM,+BAAS,CAAe,mBAC5B,eAAe,SACf,KAAK,UACL,MAAM,cACN,UAAU,aACV,SAAS,UACT,MAAM,YACN,QAAQ,UACR,MAAM,SACN,KAAK,YACL,QAAQ,gBACR,YAAY,UACZ,MAAM,gBACN,YAAY,gBACZ,eAAe,OACf,GAAG,MACgB;IACnB,MAAM,SACJ,KAAK,cACL,UAAU,EACV,YAAY,SAAE,KAAK,aAAE,SAAS,WAAE,OAAO,EAAE,EACzC,WAAW,eAAE,WAAW,EAAE,EAC3B,GAAG,CAAA,GAAA,eAAO,EAAE;gBACX;gBACA;kBACA;eACA;gBACA;kB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AC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,qBAAa;QAAI,GAAG,KAAK","sources":["packages/date-components/src/index.tsx","packages/date-components/src/Picker.tsx","packages/date-components/src/CalendarList.js","packages/date-components/src/useFullCalendarProps.js","packages/date-components/src/DaysList.js"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/jsx-props-no-spreading */\n\n// Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6\n// See https://github.com/fullcalendar/fullcalendar-vue/issues/152\nimport '@fullcalendar/core/vdom';\n\nimport { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker';\nimport { TimePicker, TimePickerProps } from '@mui/x-date-pickers/TimePicker';\nimport { DateTimePicker, DateTimePickerProps } from '@mui/x-date-pickers/DateTimePicker';\nimport Picker, { Props as PickerProps } from './Picker';\n\nconst DateInput = <TDate,>(props: Omit<PickerProps<DatePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DatePicker} {...props} />\n);\nconst TimeInput = <TDate,>(props: Omit<PickerProps<TimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={TimePicker} {...props} />\n);\nconst DateTimeInput = <TDate,>(props: Omit<PickerProps<DateTimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DateTimePicker} {...props} />\n);\n\nexport { DateInput, TimeInput, DateTimeInput };\n\nexport { default as CalendarList } from './CalendarList';\nexport { default as DaysList } from './DaysList';\nexport { default as useFullCalendarProps } from './useFullCalendarProps';\n","/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/require-default-props */\nimport { useCallback, ComponentType } from 'react';\nimport { useInput, InputHelperText, TextInputProps, useTranslateLabel } from 'react-admin';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';\nimport { getPickersLocalization } from '@mui/x-date-pickers/locales/utils/getPickersLocalization';\nimport { Locale } from 'date-fns';\n\nexport type Props<PickerProps> = TextInputProps &\n Omit<PickerProps, 'format'> & {\n PickerComponent: ComponentType;\n locale?: Locale;\n translations?: ReturnType<typeof getPickersLocalization>;\n stringFormat?: string;\n };\n\nconst Picker = <PickerProps,>({\n PickerComponent,\n label,\n source,\n helperText,\n fullWidth,\n onBlur,\n onChange,\n format,\n parse,\n validate,\n defaultValue,\n locale,\n translations,\n stringFormat = 'ISO',\n ...rest\n}: Props<PickerProps>) => {\n const {\n field,\n isRequired,\n fieldState: { error, isTouched, invalid },\n formState: { isSubmitted }\n } = useInput({\n format,\n onBlur,\n onChange,\n parse,\n source,\n validate,\n defaultValue\n });\n\n const handleChange = useCallback(\n (value: Date) => {\n if (value instanceof Date) {\n field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());\n } else {\n field.onChange(null);\n }\n },\n [field, stringFormat]\n );\n\n const translateLabel = useTranslateLabel();\n const translatedLabel = (\n <span>\n {translateLabel({\n label,\n source\n })}\n {isRequired && <span aria-hidden=\"true\">&thinsp;*</span>}\n </span>\n );\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={locale}\n localeText={translations?.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <PickerComponent\n label={translatedLabel}\n slotProps={{\n textField: {\n error: (isTouched || isSubmitted) && invalid,\n size: 'small',\n fullWidth,\n helperText: (\n <InputHelperText touched={isTouched || isSubmitted} error={error?.message} helperText={helperText} />\n )\n }\n }}\n value={field.value ? new Date(field.value) : null}\n onChange={handleChange}\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default Picker;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/daygrid';\nimport { useTheme } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport useFullCalendarProps from './useFullCalendarProps';\n\nconst useGlobalStyles = makeStyles(theme => ({\n '@global': {\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n },\n '.fc-day-today': {\n backgroundColor: `${theme.palette.secondary.light} !important`\n },\n // Overwrite violet color of links\n 'a.fc-daygrid-dot-event': {\n color: 'black !important'\n }\n }\n}));\n\nconst CalendarList = props => {\n const theme = useTheme();\n const fullCalendarProps = useFullCalendarProps(props);\n useGlobalStyles();\n\n return (\n <FullCalendar\n plugins={[dayGridPlugin]}\n locale={props.locale}\n initialView=\"dayGridMonth\"\n eventBackgroundColor={theme.palette.primary.main}\n {...fullCalendarProps}\n />\n );\n};\n\nCalendarList.defaultProps = {\n linkType: 'edit'\n};\n\nexport default CalendarList;\n","import React, { useMemo, useCallback } from 'react';\nimport { useSearchParams, useNavigate } from 'react-router-dom';\nimport { useListContext, useCreatePath } from 'react-admin';\n\nconst useFullCalendarProps = ({ label, startDate, endDate, linkType }) => {\n const { data, isLoading, resource } = useListContext();\n const [searchParams, setSearchParams] = useSearchParams();\n const navigate = useNavigate();\n const createPath = useCreatePath();\n\n const query = new URLSearchParams(location.search);\n\n // Bypass the link in order to use React-Router\n const eventClick = useCallback(({ event, jsEvent }) => {\n jsEvent.preventDefault();\n navigate(event.url);\n }, []);\n\n // Change the query string when month change\n const datesSet = useCallback(\n ({ view }) => {\n setSearchParams(params => ({\n ...params,\n month: view.currentStart.getMonth() + 1,\n year: view.currentStart.getFullYear()\n }));\n },\n [setSearchParams]\n );\n\n const events = useMemo(\n () =>\n !isLoading &&\n data\n .filter(record => record)\n .map(record => ({\n id: record.id,\n title: typeof label === 'string' ? record[label] : label(record),\n start: typeof startDate === 'string' ? record[startDate] : startDate(record),\n end: typeof endDate === 'string' ? record[endDate] : endDate(record),\n url: createPath({ resource, id: record.id, type: linkType })\n })),\n [isLoading, data, resource, createPath]\n );\n\n return {\n initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),\n events,\n datesSet,\n eventClick\n };\n};\n\nexport default useFullCalendarProps;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport listPlugin from '@fullcalendar/list';\nimport makeStyles from '@mui/styles/makeStyles';\nimport useFullCalendarProps from './useFullCalendarProps';\n\nconst useGlobalStyles = makeStyles(theme => ({\n '@global': {\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n }\n }\n}));\n\nconst DaysList = props => {\n const fullCalendarProps = useFullCalendarProps(props);\n useGlobalStyles();\n\n return <FullCalendar plugins={[listPlugin]} locale={props.locale} initialView=\"listMonth\" {...fullCalendarProps} />;\n};\n\nDaysList.defaultProps = {\n linkType: 'edit'\n};\n\nexport default DaysList;\n"],"names":[],"version":3,"file":"index.es.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2C,GAC3C,+CAA+C,GAE/C,sFAAsF;AACtF,kEAAkE;;;;;;ACJlE,2CAA2C,GAC3C,8CAA8C;;;;;AAgB9C,MAAM,+BAAS,CAAe,mBAC5B,eAAe,SACf,KAAK,UACL,MAAM,cACN,UAAU,aACV,SAAS,UACT,MAAM,YACN,QAAQ,UACR,MAAM,SACN,KAAK,YACL,QAAQ,gBACR,YAAY,UACZ,MAAM,gBACN,YAAY,gBACZ,eAAe,OACf,GAAG,MACgB;IACnB,MAAM,SACJ,KAAK,cACL,UAAU,EACV,YAAY,SAAE,KAAK,aAAE,SAAS,WAAE,OAAO,EAAE,EACzC,WAAW,eAAE,WAAW,EAAE,EAC3B,GAAG,CAAA,GAAA,eAAO,EAAE;gBACX;gBACA;kBACA;eACA;gBACA;kBACA;sBACA;IACF;IAEA,MAAM,eAAe,CAAA,GAAA,kBAAU,EAC7B,CAAC;QACC,IAAI,iBAAiB,MACnB,MAAM,QAAQ,CAAC,iBAAiB,QAAQ,MAAM,WAAW,KAAK,MAAM,QAAQ;aAE5E,MAAM,QAAQ,CAAC;IAEnB,GACA;QAAC;QAAO;KAAa;IAGvB,MAAM,iBAAiB,CAAA,GA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ACF,CAAA;;0BAGF,gBAAC,CAAA,GAAA,wBAAW;gBACV,SAAS;oBAAC,CAAA,GAAA,0BAAY;iBAAE;gBACxB,QAAQ,MAAM,MAAM;gBACpB,aAAY;gBACZ,sBAAsB,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI;gBAC/C,GAAG,iBAAiB;;;;AAI7B;IAEA,2CAAe;;;;;;;;;AElCf,MAAM,iCAAW,CAAC;IAChB,MAAM,oBAAoB,CAAA,GAAA,wCAAmB,EAAE;IAE/C,qBACE;;0BACE,gBAAC,CAAA,GAAA,mBAAW;gBACV,QAAQ,CAAA,QAAU,CAAA;wBAChB,cAAc;4BACZ,iBAAiB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;4BAC3D,QAAQ;4BACR,SAAS;wBACX;oBACF,CAAA;;0BAEF,gBAAC,CAAA,GAAA,wBAAW;gBAAE,SAAS;oBAAC,CAAA,GAAA,uBAAS;iBAAE;gBAAE,QAAQ,MAAM,MAAM;gBAAE,aAAY;gBAAa,GAAG,iBAAiB;;YAAI;;;AAGlH;IAEA,2CAAe;;;;AJdf,MAAM,4CAAY,CAAS,sBACzB,gBAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,iBAAS;QAAI,GAAG,KAAK;;AAEhD,MAAM,4CAAY,CAAS,sBACzB,gBAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,iBAAS;QAAI,GAAG,KAAK;;AAEhD,MAAM,2CAAgB,CAAS,sBAC7B,gBAAC,CAAA,GAAA,wCAAK;QAAE,iBAAiB,CAAA,GAAA,qBAAa;QAAI,GAAG,KAAK","sources":["packages/date-components/src/index.tsx","packages/date-components/src/Picker.tsx","packages/date-components/src/CalendarList.tsx","packages/date-components/src/useFullCalendarProps.ts","packages/date-components/src/DaysList.tsx"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/jsx-props-no-spreading */\n\n// Solves bug with Vite in dev mode. Can be removed when we upgrade to FullCalendar v6\n// See https://github.com/fullcalendar/fullcalendar-vue/issues/152\nimport '@fullcalendar/react/dist/vdom';\n\nimport { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker';\nimport { TimePicker, TimePickerProps } from '@mui/x-date-pickers/TimePicker';\nimport { DateTimePicker, DateTimePickerProps } from '@mui/x-date-pickers/DateTimePicker';\nimport Picker, { Props as PickerProps } from './Picker';\n\nconst DateInput = <TDate,>(props: Omit<PickerProps<DatePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DatePicker} {...props} />\n);\nconst TimeInput = <TDate,>(props: Omit<PickerProps<TimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={TimePicker} {...props} />\n);\nconst DateTimeInput = <TDate,>(props: Omit<PickerProps<DateTimePickerProps<TDate>>, 'PickerComponent'>) => (\n <Picker PickerComponent={DateTimePicker} {...props} />\n);\n\nexport { DateInput, TimeInput, DateTimeInput };\n\nexport { default as CalendarList } from './CalendarList';\nexport { default as DaysList } from './DaysList';\nexport { default as useFullCalendarProps } from './useFullCalendarProps';\n","/* eslint-disable react/react-in-jsx-scope */\n/* eslint-disable react/require-default-props */\nimport { useCallback, ComponentType } from 'react';\nimport { useInput, InputHelperText, TextInputProps, useTranslateLabel } from 'react-admin';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';\nimport { getPickersLocalization } from '@mui/x-date-pickers/locales/utils/getPickersLocalization';\nimport { Locale } from 'date-fns';\n\nexport type Props<PickerProps> = TextInputProps &\n Omit<PickerProps, 'format'> & {\n PickerComponent: ComponentType;\n locale?: Locale;\n translations?: ReturnType<typeof getPickersLocalization>;\n stringFormat?: string;\n };\n\nconst Picker = <PickerProps,>({\n PickerComponent,\n label,\n source,\n helperText,\n fullWidth,\n onBlur,\n onChange,\n format,\n parse,\n validate,\n defaultValue,\n locale,\n translations,\n stringFormat = 'ISO',\n ...rest\n}: Props<PickerProps>) => {\n const {\n field,\n isRequired,\n fieldState: { error, isTouched, invalid },\n formState: { isSubmitted }\n } = useInput({\n format,\n onBlur,\n onChange,\n parse,\n source,\n validate,\n defaultValue\n });\n\n const handleChange = useCallback(\n (value: Date) => {\n if (value instanceof Date) {\n field.onChange(stringFormat === 'ISO' ? value.toISOString() : value.toString());\n } else {\n field.onChange(null);\n }\n },\n [field, stringFormat]\n );\n\n const translateLabel = useTranslateLabel();\n const translatedLabel = (\n <span>\n {translateLabel({\n label,\n source\n })}\n {isRequired && <span aria-hidden=\"true\">&thinsp;*</span>}\n </span>\n );\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={locale}\n localeText={translations?.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <PickerComponent\n label={translatedLabel}\n slotProps={{\n textField: {\n error: (isTouched || isSubmitted) && invalid,\n size: 'small',\n fullWidth,\n helperText: (\n // @ts-expect-error TS(2322): Type '{ touched: boolean; error: string | undefine... Remove this comment to see the full error message\n <InputHelperText touched={isTouched || isSubmitted} error={error?.message} helperText={helperText} />\n )\n }\n }}\n value={field.value ? new Date(field.value) : null}\n onChange={handleChange}\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default Picker;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/daygrid';\nimport { GlobalStyles, useTheme } from '@mui/material';\nimport useFullCalendarProps from './useFullCalendarProps';\nimport { makeStyles } from 'tss-react/mui';\n\nconst CalendarList = (props: any) => {\n const theme = useTheme();\n const fullCalendarProps = useFullCalendarProps(props);\n\n return (\n <>\n <GlobalStyles\n styles={theme => ({\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n },\n '.fc-day-today': {\n backgroundColor: `${theme.palette.secondary.light} !important`\n },\n // Overwrite violet color of links\n 'a.fc-daygrid-dot-event': {\n color: 'black !important'\n }\n })}\n />\n\n <FullCalendar\n plugins={[dayGridPlugin]}\n locale={props.locale}\n initialView=\"dayGridMonth\"\n eventBackgroundColor={theme.palette.primary.main}\n {...fullCalendarProps}\n />\n </>\n );\n};\n\nexport default CalendarList;\n","import React, { useMemo, useCallback } from 'react';\nimport { useSearchParams, useNavigate } from 'react-router-dom';\nimport { useListContext, useCreatePath } from 'react-admin';\n\nconst useFullCalendarProps = ({\n label,\n startDate,\n endDate,\n linkType = 'edit'\n}: any) => {\n const { data, isLoading, resource } = useListContext();\n const [searchParams, setSearchParams] = useSearchParams();\n const navigate = useNavigate();\n const createPath = useCreatePath();\n\n const query = new URLSearchParams(location.search);\n\n // Bypass the link in order to use React-Router\n const eventClick = useCallback(({\n event,\n jsEvent\n }: any) => {\n jsEvent.preventDefault();\n navigate(event.url);\n }, []);\n\n // Change the query string when month change\n const datesSet = useCallback(\n ({\n view\n }: any) => {\n // @ts-expect-error TS(2345): Argument of type '(params: URLSearchParams) => { m... Remove this comment to see the full error message\n setSearchParams(params => ({\n ...params,\n month: view.currentStart.getMonth() + 1,\n year: view.currentStart.getFullYear()\n }));\n },\n [setSearchParams]\n );\n\n const events = useMemo(\n () =>\n !isLoading &&\n // @ts-expect-error TS(2532): Object is possibly 'undefined'.\n data\n .filter(record => record)\n .map(record => ({\n id: record.id,\n title: typeof label === 'string' ? record[label] : label(record),\n start: typeof startDate === 'string' ? record[startDate] : startDate(record),\n end: typeof endDate === 'string' ? record[endDate] : endDate(record),\n url: createPath({ resource, id: record.id, type: linkType })\n })),\n [isLoading, data, resource, createPath]\n );\n\n return {\n // @ts-expect-error TS(2345): Argument of type 'string | null' is not assignable... Remove this comment to see the full error message\n initialDate: query.has('month') ? new Date(query.get('year'), query.get('month') - 1) : new Date(),\n events,\n datesSet,\n eventClick\n };\n};\n\nexport default useFullCalendarProps;\n","import React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport listPlugin from '@fullcalendar/list';\nimport { makeStyles } from 'tss-react/mui';\nimport useFullCalendarProps from './useFullCalendarProps';\nimport { GlobalStyles } from '@mui/material';\n\nconst DaysList = (props: any) => {\n const fullCalendarProps = useFullCalendarProps(props);\n\n return (\n <>\n <GlobalStyles\n styles={theme => ({\n '.fc-button': {\n backgroundColor: `${theme.palette.primary.main} !important`,\n border: 'none !important',\n opacity: '1 !important'\n }\n })}\n />\n <FullCalendar plugins={[listPlugin]} locale={props.locale} initialView=\"listMonth\" {...fullCalendarProps} />;\n </>\n );\n};\n\nexport default DaysList;\n"],"names":[],"version":3,"file":"index.es.js.map"}