@selfcommunity/react-ui 0.8.0-alpha.3 → 0.8.0-alpha.5

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.
@@ -25,7 +25,7 @@ export interface EventFormProps extends BaseDialogProps {
25
25
  * On success callback function
26
26
  * @default null
27
27
  */
28
- onSuccess?: (data: any) => void;
28
+ onSuccess?: (data: SCEventType) => void;
29
29
  /**
30
30
  * Any other properties
31
31
  */
@@ -113,7 +113,7 @@ const Root = (0, styles_1.styled)(BaseDialog_1.default, {
113
113
  * @param inProps
114
114
  */
115
115
  function EventForm(inProps) {
116
- var _a, _b, _c, _d, _e, _f, _g;
116
+ var _a, _b, _c, _d, _e;
117
117
  //PROPS
118
118
  const props = (0, system_1.useThemeProps)({
119
119
  props: inProps,
@@ -126,7 +126,7 @@ function EventForm(inProps) {
126
126
  const intl = (0, react_intl_1.useIntl)();
127
127
  const initialFieldState = {
128
128
  imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
129
- imageOriginalFile: new Blob(),
129
+ imageOriginalFile: '',
130
130
  startDate: event ? new Date(event.start_date) : null,
131
131
  startTime: event ? new Date(event.start_date) : null,
132
132
  endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? new Date(event.end_date) : null,
@@ -281,7 +281,7 @@ function EventForm(inProps) {
281
281
  field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ||
282
282
  field.description.length > Event_1.EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadEventCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
283
283
  endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Event_1.EVENT_TITLE_MAX_LENGTH - field.name.length }))
284
- }, error: Boolean(((_c = field === null || field === void 0 ? void 0 : field.name) === null || _c === void 0 ? void 0 : _c.length) > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error[`nameError`]), helperText: ((_d = field === null || field === void 0 ? void 0 : field.name) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error[`nameError`] ? (error[`nameError`]) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
284
+ }, error: Boolean(field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
285
285
  textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }) }) }))) }) })))
286
286
  }, slotProps: {
287
287
  toolbar: {
@@ -315,7 +315,7 @@ function EventForm(inProps) {
315
315
  // @ts-ignore
316
316
  b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
317
317
  } })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
318
- endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
319
- }, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
318
+ endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
319
+ }, error: Boolean(((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
320
320
  }
321
321
  exports.default = EventForm;
@@ -12,7 +12,7 @@ export declare type Geolocation = {
12
12
  };
13
13
  export declare type InitialFieldState = Geolocation & {
14
14
  imageOriginal: string | ArrayBuffer;
15
- imageOriginalFile: Blob;
15
+ imageOriginalFile: string | Blob;
16
16
  startDate: Date | null;
17
17
  startTime: Date | null;
18
18
  endDate: Date | null;
@@ -154,7 +154,7 @@ const OnBoardingWidget = (inProps) => {
154
154
  // EFFECTS
155
155
  (0, react_1.useEffect)(() => {
156
156
  if (prevContentsStep &&
157
- prevCategoriesStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS &&
157
+ prevContentsStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS &&
158
158
  (currentContentsStep === null || currentContentsStep === void 0 ? void 0 : currentContentsStep.status) === types_1.SCOnBoardingStepStatusType.COMPLETED) {
159
159
  showSuccessAlert(currentContentsStep);
160
160
  }
@@ -25,7 +25,7 @@ export interface EventFormProps extends BaseDialogProps {
25
25
  * On success callback function
26
26
  * @default null
27
27
  */
28
- onSuccess?: (data: any) => void;
28
+ onSuccess?: (data: SCEventType) => void;
29
29
  /**
30
30
  * Any other properties
31
31
  */
@@ -111,7 +111,7 @@ const Root = styled(BaseDialog, {
111
111
  * @param inProps
112
112
  */
113
113
  export default function EventForm(inProps) {
114
- var _a, _b, _c, _d, _e, _f, _g;
114
+ var _a, _b, _c, _d, _e;
115
115
  //PROPS
116
116
  const props = useThemeProps({
117
117
  props: inProps,
@@ -124,7 +124,7 @@ export default function EventForm(inProps) {
124
124
  const intl = useIntl();
125
125
  const initialFieldState = {
126
126
  imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
127
- imageOriginalFile: new Blob(),
127
+ imageOriginalFile: '',
128
128
  startDate: event ? new Date(event.start_date) : null,
129
129
  startTime: event ? new Date(event.start_date) : null,
130
130
  endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? new Date(event.end_date) : null,
@@ -279,7 +279,7 @@ export default function EventForm(inProps) {
279
279
  field.name.length > EVENT_TITLE_MAX_LENGTH ||
280
280
  field.description.length > EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? (_jsx(FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }, rest, { children: _jsxs(_Fragment, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
281
281
  endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: EVENT_TITLE_MAX_LENGTH - field.name.length }))
282
- }, error: Boolean(((_c = field === null || field === void 0 ? void 0 : field.name) === null || _c === void 0 ? void 0 : _c.length) > EVENT_TITLE_MAX_LENGTH) || Boolean(error[`nameError`]), helperText: ((_d = field === null || field === void 0 ? void 0 : field.name) === null || _d === void 0 ? void 0 : _d.length) > EVENT_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error[`nameError`] ? (error[`nameError`]) : null }), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
282
+ }, error: Boolean(field.name.length > EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > EVENT_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
283
283
  textField: (params) => (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) }) })))
284
284
  }, slotProps: {
285
285
  toolbar: {
@@ -313,6 +313,6 @@ export default function EventForm(inProps) {
313
313
  // @ts-ignore
314
314
  b: (chunks) => _jsx("strong", { children: chunks })
315
315
  } })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
316
- endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
317
- }, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
316
+ endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
317
+ }, error: Boolean(((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
318
318
  }
@@ -12,7 +12,7 @@ export declare type Geolocation = {
12
12
  };
13
13
  export declare type InitialFieldState = Geolocation & {
14
14
  imageOriginal: string | ArrayBuffer;
15
- imageOriginalFile: Blob;
15
+ imageOriginalFile: string | Blob;
16
16
  startDate: Date | null;
17
17
  startTime: Date | null;
18
18
  endDate: Date | null;
@@ -152,7 +152,7 @@ const OnBoardingWidget = (inProps) => {
152
152
  // EFFECTS
153
153
  useEffect(() => {
154
154
  if (prevContentsStep &&
155
- prevCategoriesStep.status === SCOnBoardingStepStatusType.IN_PROGRESS &&
155
+ prevContentsStep.status === SCOnBoardingStepStatusType.IN_PROGRESS &&
156
156
  (currentContentsStep === null || currentContentsStep === void 0 ? void 0 : currentContentsStep.status) === SCOnBoardingStepStatusType.COMPLETED) {
157
157
  showSuccessAlert(currentContentsStep);
158
158
  }