@selfcommunity/react-ui 0.7.50-alpha.1 → 0.7.50-event.29

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.
Files changed (176) hide show
  1. package/lib/cjs/assets/logo.d.ts +2 -0
  2. package/lib/cjs/assets/logo.js +3 -0
  3. package/lib/cjs/components/Category/Category.d.ts +1 -1
  4. package/lib/cjs/components/Category/Category.js +1 -1
  5. package/lib/cjs/components/ChangeCover/ChangeCover.js +3 -3
  6. package/lib/cjs/components/ChangePicture/ChangePictureDialog/ChangePictureDialog.js +1 -1
  7. package/lib/cjs/components/Composer/Composer.js +9 -7
  8. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
  9. package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  10. package/lib/cjs/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +1 -1
  11. package/lib/cjs/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +1 -1
  12. package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +1 -1
  13. package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +38 -0
  14. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +79 -0
  15. package/lib/cjs/components/CreateEventButton/index.d.ts +3 -0
  16. package/lib/cjs/components/CreateEventButton/index.js +5 -0
  17. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +1 -1
  18. package/lib/cjs/components/Event/Event.d.ts +57 -0
  19. package/lib/cjs/components/Event/Event.js +90 -0
  20. package/lib/cjs/components/Event/Skeleton.d.ts +22 -0
  21. package/lib/cjs/components/Event/Skeleton.js +44 -0
  22. package/lib/cjs/components/Event/constants.d.ts +1 -0
  23. package/lib/cjs/components/Event/constants.js +4 -0
  24. package/lib/cjs/components/Event/index.d.ts +4 -0
  25. package/lib/cjs/components/Event/index.js +8 -0
  26. package/lib/cjs/components/EventForm/EventAddress.d.ts +12 -0
  27. package/lib/cjs/components/EventForm/EventAddress.js +129 -0
  28. package/lib/cjs/components/EventForm/EventForm.d.ts +59 -0
  29. package/lib/cjs/components/EventForm/EventForm.js +323 -0
  30. package/lib/cjs/components/EventForm/UploadEventCover.d.ts +40 -0
  31. package/lib/cjs/components/EventForm/UploadEventCover.js +98 -0
  32. package/lib/cjs/components/EventForm/constants.d.ts +1 -0
  33. package/lib/cjs/components/EventForm/constants.js +4 -0
  34. package/lib/cjs/components/EventForm/index.d.ts +3 -0
  35. package/lib/cjs/components/EventForm/index.js +5 -0
  36. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.d.ts +55 -0
  37. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +103 -0
  38. package/lib/cjs/components/EventLocationWidget/Skeleton.d.ts +22 -0
  39. package/lib/cjs/components/EventLocationWidget/Skeleton.js +47 -0
  40. package/lib/cjs/components/EventLocationWidget/constants.d.ts +1 -0
  41. package/lib/cjs/components/EventLocationWidget/constants.js +4 -0
  42. package/lib/cjs/components/EventLocationWidget/index.d.ts +4 -0
  43. package/lib/cjs/components/EventLocationWidget/index.js +8 -0
  44. package/lib/cjs/components/Feed/Feed.js +1 -1
  45. package/lib/cjs/components/FeedObject/Actions/Share/Share.js +5 -5
  46. package/lib/cjs/components/GroupForm/GroupForm.js +2 -2
  47. package/lib/cjs/components/GroupHeader/GroupHeader.js +3 -3
  48. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +1 -1
  49. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +3 -3
  50. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  51. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +1 -1
  52. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +1 -1
  53. package/lib/cjs/components/IncubatorListWidget/IncubatorListWidget.js +1 -1
  54. package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.d.ts +3 -2
  55. package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +19 -3
  56. package/lib/cjs/components/NavigationMenuIconButton/DefaultHeaderContent.d.ts +3 -1
  57. package/lib/cjs/components/NavigationMenuIconButton/DefaultHeaderContent.js +22 -3
  58. package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
  59. package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
  60. package/lib/cjs/components/Notification/Notification.js +1 -1
  61. package/lib/cjs/components/PlatformWidget/PlatformWidget.d.ts +24 -2
  62. package/lib/cjs/components/PlatformWidget/PlatformWidget.js +256 -18
  63. package/lib/cjs/components/PlatformWidget/constants.d.ts +4 -0
  64. package/lib/cjs/components/PlatformWidget/constants.js +5 -1
  65. package/lib/cjs/components/PrivateMessageEditor/MessageMediaUploader/index.js +1 -1
  66. package/lib/cjs/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +6 -6
  67. package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +1 -1
  68. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +1 -1
  69. package/lib/cjs/constants/Event.d.ts +2 -0
  70. package/lib/cjs/constants/Event.js +5 -0
  71. package/lib/cjs/constants/PubSub.d.ts +1 -1
  72. package/lib/cjs/constants/PubSub.js +10 -10
  73. package/lib/cjs/index.d.ts +12 -4
  74. package/lib/cjs/index.js +21 -5
  75. package/lib/cjs/shared/BaseDialog/BaseDialog.js +3 -2
  76. package/lib/cjs/shared/EmojiPicker/EmojiPicker.js +4 -2
  77. package/lib/cjs/shared/Media/File/PreviewComponent.d.ts +1 -1
  78. package/lib/cjs/shared/Media/Link/LayerComponent.d.ts +1 -1
  79. package/lib/cjs/shared/Media/Link/PreviewComponent.d.ts +1 -1
  80. package/lib/cjs/shared/MetadataField/index.d.ts +2 -1
  81. package/lib/cjs/types/index.d.ts +2 -1
  82. package/lib/cjs/types/platformWidget.d.ts +15 -0
  83. package/lib/cjs/types/platformWidget.js +2 -0
  84. package/lib/cjs/utils/string.d.ts +1 -0
  85. package/lib/cjs/utils/string.js +9 -1
  86. package/lib/esm/assets/logo.d.ts +2 -0
  87. package/lib/esm/assets/logo.js +1 -0
  88. package/lib/esm/components/Category/Category.d.ts +1 -1
  89. package/lib/esm/components/Category/Category.js +1 -1
  90. package/lib/esm/components/ChangeCover/ChangeCover.js +3 -3
  91. package/lib/esm/components/ChangePicture/ChangePictureDialog/ChangePictureDialog.js +1 -1
  92. package/lib/esm/components/Composer/Composer.js +9 -7
  93. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
  94. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  95. package/lib/esm/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +1 -1
  96. package/lib/esm/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +1 -1
  97. package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +1 -1
  98. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +38 -0
  99. package/lib/esm/components/CreateEventButton/CreateEventButton.js +76 -0
  100. package/lib/esm/components/CreateEventButton/index.d.ts +3 -0
  101. package/lib/esm/components/CreateEventButton/index.js +2 -0
  102. package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +1 -1
  103. package/lib/esm/components/Event/Event.d.ts +57 -0
  104. package/lib/esm/components/Event/Event.js +87 -0
  105. package/lib/esm/components/Event/Skeleton.d.ts +22 -0
  106. package/lib/esm/components/Event/Skeleton.js +40 -0
  107. package/lib/esm/components/Event/constants.d.ts +1 -0
  108. package/lib/esm/components/Event/constants.js +1 -0
  109. package/lib/esm/components/Event/index.d.ts +4 -0
  110. package/lib/esm/components/Event/index.js +4 -0
  111. package/lib/esm/components/EventForm/EventAddress.d.ts +12 -0
  112. package/lib/esm/components/EventForm/EventAddress.js +126 -0
  113. package/lib/esm/components/EventForm/EventForm.d.ts +59 -0
  114. package/lib/esm/components/EventForm/EventForm.js +320 -0
  115. package/lib/esm/components/EventForm/UploadEventCover.d.ts +40 -0
  116. package/lib/esm/components/EventForm/UploadEventCover.js +95 -0
  117. package/lib/esm/components/EventForm/constants.d.ts +1 -0
  118. package/lib/esm/components/EventForm/constants.js +1 -0
  119. package/lib/esm/components/EventForm/index.d.ts +3 -0
  120. package/lib/esm/components/EventForm/index.js +2 -0
  121. package/lib/esm/components/EventLocationWidget/EventLocationWidget.d.ts +55 -0
  122. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +100 -0
  123. package/lib/esm/components/EventLocationWidget/Skeleton.d.ts +22 -0
  124. package/lib/esm/components/EventLocationWidget/Skeleton.js +43 -0
  125. package/lib/esm/components/EventLocationWidget/constants.d.ts +1 -0
  126. package/lib/esm/components/EventLocationWidget/constants.js +1 -0
  127. package/lib/esm/components/EventLocationWidget/index.d.ts +4 -0
  128. package/lib/esm/components/EventLocationWidget/index.js +4 -0
  129. package/lib/esm/components/Feed/Feed.js +2 -2
  130. package/lib/esm/components/FeedObject/Actions/Share/Share.js +5 -5
  131. package/lib/esm/components/GroupForm/GroupForm.js +3 -3
  132. package/lib/esm/components/GroupHeader/GroupHeader.js +4 -4
  133. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +2 -2
  134. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +4 -4
  135. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +2 -2
  136. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +2 -2
  137. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +2 -2
  138. package/lib/esm/components/IncubatorListWidget/IncubatorListWidget.js +1 -1
  139. package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.d.ts +3 -2
  140. package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +21 -4
  141. package/lib/esm/components/NavigationMenuIconButton/DefaultHeaderContent.d.ts +3 -1
  142. package/lib/esm/components/NavigationMenuIconButton/DefaultHeaderContent.js +23 -3
  143. package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
  144. package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
  145. package/lib/esm/components/Notification/Notification.js +1 -1
  146. package/lib/esm/components/PlatformWidget/PlatformWidget.d.ts +24 -2
  147. package/lib/esm/components/PlatformWidget/PlatformWidget.js +260 -22
  148. package/lib/esm/components/PlatformWidget/constants.d.ts +4 -0
  149. package/lib/esm/components/PlatformWidget/constants.js +4 -0
  150. package/lib/esm/components/PrivateMessageEditor/MessageMediaUploader/index.js +1 -1
  151. package/lib/esm/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +6 -6
  152. package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +1 -1
  153. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +1 -1
  154. package/lib/esm/constants/Event.d.ts +2 -0
  155. package/lib/esm/constants/Event.js +2 -0
  156. package/lib/esm/constants/PubSub.d.ts +1 -1
  157. package/lib/esm/constants/PubSub.js +9 -9
  158. package/lib/esm/index.d.ts +12 -4
  159. package/lib/esm/index.js +13 -3
  160. package/lib/esm/shared/BaseDialog/BaseDialog.js +3 -2
  161. package/lib/esm/shared/EmojiPicker/EmojiPicker.js +4 -2
  162. package/lib/esm/shared/Media/File/PreviewComponent.d.ts +1 -1
  163. package/lib/esm/shared/Media/Link/LayerComponent.d.ts +1 -1
  164. package/lib/esm/shared/Media/Link/PreviewComponent.d.ts +1 -1
  165. package/lib/esm/shared/MetadataField/index.d.ts +2 -1
  166. package/lib/esm/types/index.d.ts +2 -1
  167. package/lib/esm/types/platformWidget.d.ts +15 -0
  168. package/lib/esm/types/platformWidget.js +1 -0
  169. package/lib/esm/utils/string.d.ts +1 -0
  170. package/lib/esm/utils/string.js +7 -0
  171. package/lib/umd/204.js +2 -0
  172. package/lib/umd/204.js.LICENSE.txt +22 -0
  173. package/lib/umd/react-ui.js +1 -1
  174. package/package.json +24 -7
  175. package/lib/umd/311.js +0 -2
  176. package/lib/umd/311.js.LICENSE.txt +0 -7
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
+ const types_1 = require("@selfcommunity/types");
8
+ const react_core_1 = require("@selfcommunity/react-core");
9
+ const react_intl_1 = require("react-intl");
10
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
11
+ const system_1 = require("@mui/system");
12
+ const BaseItemButton_1 = tslib_1.__importDefault(require("../../shared/BaseItemButton"));
13
+ const constants_1 = require("./constants");
14
+ const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
15
+ const classes = {
16
+ root: `${constants_1.PREFIX}-root`,
17
+ avatar: `${constants_1.PREFIX}-avatar`,
18
+ primary: `${constants_1.PREFIX}-primary`,
19
+ secondary: `${constants_1.PREFIX}-secondary`,
20
+ actions: `${constants_1.PREFIX}-actions`
21
+ };
22
+ const Root = (0, styles_1.styled)(BaseItemButton_1.default, {
23
+ name: constants_1.PREFIX,
24
+ slot: 'Root',
25
+ overridesResolver: (props, styles) => styles.root
26
+ })(() => ({}));
27
+ /**
28
+ * > API documentation for the Community-JS Event component. Learn about the available props and the CSS API.
29
+ *
30
+ *
31
+ * This component renders an event item.
32
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/Event)
33
+
34
+ #### Import
35
+
36
+ ```jsx
37
+ import {event} from '@selfcommunity/react-ui';
38
+ ```
39
+
40
+ #### Component Name
41
+
42
+ The name `SCEvent` can be used when providing style overrides in the theme.
43
+
44
+
45
+ #### CSS
46
+
47
+ |Rule Name|Global class|Description|
48
+ |---|---|---|
49
+ |root|.SCEvent-root|Styles applied to the root element.|
50
+ |avatar|.SCEvent-avatar|Styles applied to the avatar element.|
51
+ |primary|.SCEvent-primary|Styles applied to the primary item element section|
52
+ |secondary|.SCEvent-secondary|Styles applied to the secondary item element section|
53
+ |actions|.SCEvent-actions|Styles applied to the actions section.|
54
+
55
+
56
+ *
57
+ * @param inProps
58
+ */
59
+ function Event(inProps) {
60
+ // PROPS
61
+ const props = (0, system_1.useThemeProps)({
62
+ props: inProps,
63
+ name: constants_1.PREFIX
64
+ });
65
+ const { eventId = null, event = null, className = null, elevation } = props, rest = tslib_1.__rest(props, ["eventId", "event", "className", "elevation"]);
66
+ // STATE
67
+ const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
68
+ // CONTEXT
69
+ const scRoutingContext = (0, react_core_1.useSCRouting)();
70
+ // HOOKS
71
+ const intl = (0, react_intl_1.useIntl)();
72
+ /**
73
+ * Renders event object
74
+ */
75
+ if (!scEvent) {
76
+ return react_1.default.createElement(Skeleton_1.default, { elevation: elevation });
77
+ }
78
+ /**
79
+ * Renders root object
80
+ */
81
+ return (react_1.default.createElement(Root, Object.assign({ elevation: elevation, disableTypography: true }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, image: react_1.default.createElement(material_1.Avatar, { variant: "square", alt: scEvent.name, src: scEvent.image_medium, className: classes.avatar }), primary: react_1.default.createElement(material_1.Typography, { component: "div", className: classes.primary },
82
+ react_1.default.createElement(material_1.Typography, { component: "span" }, `${intl.formatDate(scEvent.start_date, { weekday: 'long', month: 'long', day: 'numeric' })}`),
83
+ react_1.default.createElement(material_1.Typography, { variant: "body1" }, scEvent.name)), secondary: react_1.default.createElement(material_1.Typography, { component: "p", variant: "body2", className: classes.secondary },
84
+ react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }),
85
+ " -",
86
+ ' ',
87
+ (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.PERSON ? (react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : (react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` }))), actions: react_1.default.createElement(material_1.Button, { size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) },
88
+ react_1.default.createElement(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" })) })));
89
+ }
90
+ exports.default = Event;
@@ -0,0 +1,22 @@
1
+ import { WidgetProps } from '../Widget';
2
+ /**
3
+ * > API documentation for the Community-JS Event Skeleton component. Learn about the available props and the CSS API.
4
+
5
+ #### Import
6
+
7
+ ```jsx
8
+ import {EventSkeleton} from '@selfcommunity/react-ui';
9
+ ```
10
+
11
+ #### Component Name
12
+
13
+ The name `SCEvent-skeleton-root` can be used when providing style overrides in the theme.
14
+
15
+ #### CSS
16
+
17
+ |Rule Name|Global class|Description|
18
+ |---|---|---|
19
+ |root|.SCEvent-skeleton-root|Styles applied to the root element.|
20
+ *
21
+ */
22
+ export default function EventSkeleton(props: WidgetProps): JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const material_1 = require("@mui/material");
6
+ const styles_1 = require("@mui/material/styles");
7
+ const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
8
+ const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
9
+ const constants_1 = require("./constants");
10
+ const classes = {
11
+ root: `${constants_1.PREFIX}-skeleton-root`
12
+ };
13
+ const Root = (0, styles_1.styled)(BaseItem_1.default, {
14
+ name: constants_1.PREFIX,
15
+ slot: 'SkeletonRoot'
16
+ })(() => ({}));
17
+ /**
18
+ * > API documentation for the Community-JS Event Skeleton component. Learn about the available props and the CSS API.
19
+
20
+ #### Import
21
+
22
+ ```jsx
23
+ import {EventSkeleton} from '@selfcommunity/react-ui';
24
+ ```
25
+
26
+ #### Component Name
27
+
28
+ The name `SCEvent-skeleton-root` can be used when providing style overrides in the theme.
29
+
30
+ #### CSS
31
+
32
+ |Rule Name|Global class|Description|
33
+ |---|---|---|
34
+ |root|.SCEvent-skeleton-root|Styles applied to the root element.|
35
+ *
36
+ */
37
+ function EventSkeleton(props) {
38
+ //const theme = useTheme<SCThemeType>();
39
+ return (react_1.default.createElement(Root, Object.assign({ className: classes.root }, props, { image: react_1.default.createElement(Skeleton_1.default, { animation: "wave", variant: "rectangular", width: 100, height: 60 }), primary: react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } }), secondary: react_1.default.createElement(react_1.default.Fragment, null,
40
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } }),
41
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } })), actions: react_1.default.createElement(material_1.Button, { size: "small", variant: "outlined", disabled: true },
42
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } })) })));
43
+ }
44
+ exports.default = EventSkeleton;
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCEvent";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PREFIX = void 0;
4
+ exports.PREFIX = 'SCEvent';
@@ -0,0 +1,4 @@
1
+ import Event, { EventProps } from './Event';
2
+ import EventSkeleton from './Skeleton';
3
+ export default Event;
4
+ export { EventProps, EventSkeleton };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventSkeleton = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Event_1 = tslib_1.__importDefault(require("./Event"));
6
+ const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
7
+ exports.EventSkeleton = Skeleton_1.default;
8
+ exports.default = Event_1.default;
@@ -0,0 +1,12 @@
1
+ import { SCEventLocationType } from '@selfcommunity/types';
2
+ export interface EventAddressProps {
3
+ forwardGeolocationData: (data: {
4
+ location: SCEventLocationType;
5
+ geolocation?: string;
6
+ lat?: number;
7
+ lng?: number;
8
+ link?: string;
9
+ }) => void;
10
+ className?: string;
11
+ }
12
+ export default function EventAddress(inProps: EventAddressProps): JSX.Element;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
+ const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
8
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
9
+ const system_1 = require("@mui/system");
10
+ const constants_1 = require("./constants");
11
+ const react_intl_1 = require("react-intl");
12
+ const UrlTextField_1 = tslib_1.__importDefault(require("../../shared/UrlTextField"));
13
+ const axios_1 = tslib_1.__importDefault(require("axios"));
14
+ const react_core_1 = require("@selfcommunity/react-core");
15
+ const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
16
+ const types_1 = require("@selfcommunity/types");
17
+ const api_1 = require("@react-google-maps/api");
18
+ const messages = (0, react_intl_1.defineMessages)({
19
+ virtualPlaceholder: {
20
+ id: 'ui.eventForm.address.online.placeholder',
21
+ defaultMessage: 'ui.eventForm.address.online.placeholder'
22
+ }
23
+ });
24
+ const classes = {
25
+ root: `${constants_1.PREFIX}-event-address-root`,
26
+ tabs: `${constants_1.PREFIX}-event-address-tabs`,
27
+ tab: `${constants_1.PREFIX}-event-address-tab`,
28
+ tabContent: `${constants_1.PREFIX}-event-address-tab-content`
29
+ };
30
+ const Root = (0, styles_1.styled)(material_1.Box, {
31
+ name: constants_1.PREFIX,
32
+ slot: 'EventAddressRoot'
33
+ })(() => ({}));
34
+ function EventAddress(inProps) {
35
+ //PROPS
36
+ const props = (0, system_1.useThemeProps)({
37
+ props: inProps,
38
+ name: constants_1.PREFIX
39
+ });
40
+ // INTL
41
+ const intl = (0, react_intl_1.useIntl)();
42
+ // PROPS
43
+ const { className, forwardGeolocationData } = props;
44
+ // STATE
45
+ const [location, setLocation] = (0, react_1.useState)(types_1.SCEventLocationType.PERSON);
46
+ const [geolocation, setGeoLocation] = (0, react_1.useState)(null);
47
+ const [inputValue, setInputValue] = (0, react_1.useState)('');
48
+ const [suggestions, setSuggestions] = (0, react_1.useState)([]);
49
+ const [timeoutId, setTimeoutId] = (0, react_1.useState)(null);
50
+ // CONTEXT
51
+ const scContext = (0, react_core_1.useSCContext)();
52
+ const geocodingApiKey = (0, react_1.useMemo)(() => scContext.settings.integrations && scContext.settings.integrations.geocoding.apiKey, [scContext.settings.integrations]);
53
+ const { isLoaded } = (0, api_1.useLoadScript)({
54
+ googleMapsApiKey: scContext.settings.integrations.geocoding.apiKey,
55
+ libraries: ['places', 'geocoding']
56
+ });
57
+ // HANDLERS
58
+ const handleChange = (event, newValue) => {
59
+ setLocation(newValue);
60
+ };
61
+ const handleSelection = (event, newValue) => tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ if (newValue) {
63
+ try {
64
+ const response = yield axios_1.default.get(`https://maps.googleapis.com/maps/api/geocode/json`, {
65
+ params: {
66
+ place_id: newValue.place_id,
67
+ key: geocodingApiKey
68
+ }
69
+ });
70
+ const place = response.data.results[0];
71
+ setGeoLocation(newValue);
72
+ forwardGeolocationData({
73
+ location: location,
74
+ geolocation: place.formatted_address,
75
+ lat: place.geometry.location.lat,
76
+ lng: place.geometry.location.lng
77
+ });
78
+ }
79
+ catch (error) {
80
+ console.error('Error fetching place details:', error);
81
+ }
82
+ }
83
+ });
84
+ const handleLocationChange = (event, newInputValue) => {
85
+ setInputValue(newInputValue);
86
+ };
87
+ const handleLinkChange = (event) => {
88
+ forwardGeolocationData({ location: location, link: event.target.value });
89
+ };
90
+ (0, react_1.useEffect)(() => {
91
+ if (timeoutId) {
92
+ clearTimeout(timeoutId);
93
+ }
94
+ if (inputValue === '') {
95
+ setSuggestions([]);
96
+ return;
97
+ }
98
+ if (inputValue.length >= 3) {
99
+ const newTimeoutId = window.setTimeout(() => {
100
+ const autocompleteService = new window.google.maps.places.AutocompleteService();
101
+ autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
102
+ if (status === window.google.maps.places.PlacesServiceStatus.OK && predictions) {
103
+ setSuggestions(predictions.map((prediction) => ({
104
+ description: prediction.description,
105
+ place_id: prediction.place_id
106
+ })));
107
+ }
108
+ });
109
+ }, 300);
110
+ setTimeoutId(newTimeoutId);
111
+ }
112
+ }, [inputValue]);
113
+ if (!geocodingApiKey && !isLoaded) {
114
+ return react_1.default.createElement(HiddenPlaceholder_1.default, null);
115
+ }
116
+ return (react_1.default.createElement(Root, { className: (0, classnames_1.default)(classes.root, className) },
117
+ react_1.default.createElement(material_1.Tabs, { className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" },
118
+ react_1.default.createElement(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: react_1.default.createElement(Icon_1.default, null, "add_location_alt"), iconPosition: "start", label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }),
119
+ react_1.default.createElement(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: react_1.default.createElement(Icon_1.default, null, "play_circle_outline"), iconPosition: "start", label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })),
120
+ react_1.default.createElement(material_1.Box, { className: classes.tabContent },
121
+ location === types_1.SCEventLocationType.PERSON && (react_1.default.createElement(material_1.Autocomplete, { freeSolo: true, size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description, noOptionsText: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), renderInput: (params) => (react_1.default.createElement(material_1.TextField, Object.assign({}, params, { label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (react_1.default.createElement(react_1.default.Fragment, null,
122
+ react_1.default.createElement(material_1.InputAdornment, { position: "start" },
123
+ react_1.default.createElement(Icon_1.default, null, "add_location_alt")),
124
+ params.InputProps.endAdornment)) }) }))) })),
125
+ location === types_1.SCEventLocationType.ONLINE && (react_1.default.createElement(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
126
+ endAdornment: react_1.default.createElement(Icon_1.default, null, "play_circle_outline")
127
+ }, onChange: handleLinkChange })))));
128
+ }
129
+ exports.default = EventAddress;
@@ -0,0 +1,59 @@
1
+ import { BaseDialogProps } from '../../shared/BaseDialog';
2
+ export interface EventFormProps extends BaseDialogProps {
3
+ /**
4
+ * Overrides or extends the styles applied to the component.
5
+ * @default null
6
+ */
7
+ className?: string;
8
+ /**
9
+ * Open dialog
10
+ * @default true
11
+ */
12
+ open?: boolean;
13
+ /**
14
+ * On dialog close callback function
15
+ * @default null
16
+ */
17
+ onClose?: () => void;
18
+ /**
19
+ * On success callback function
20
+ * @default null
21
+ */
22
+ onSuccess?: (data: any) => void;
23
+ /**
24
+ * Any other properties
25
+ */
26
+ [p: string]: any;
27
+ }
28
+ /**
29
+ *> API documentation for the Community-JS Event Form component. Learn about the available props and the CSS API.
30
+ *
31
+ #### Import
32
+ ```jsx
33
+ import {EventForm} from '@selfcommunity/react-ui';
34
+ ```
35
+
36
+ #### Component Name
37
+ The name `SCEventForm` can be used when providing style overrides in the theme.
38
+
39
+ #### CSS
40
+
41
+ |Rule Name|Global class|Description|
42
+ |---|---|---|
43
+ |root|.SCEventForm-root|Styles applied to the root element.|
44
+ |active|.SCEventForm-active|Styles applied to the active element.|
45
+ |title|.SCEventForm-title|Styles applied to the title element.|
46
+ |cover|.SCEventForm-cover|Styles applied to the cover field.|
47
+ |form|.SCEventForm-form|Styles applied to the form element.|
48
+ |switch|.SCEventForm-switch|Styles applied to the switch element.|
49
+ |switchLabel|.SCEventForm-switch-label|Styles applied to the switchLabel element.|
50
+ |name|.SCEventForm-name|Styles applied to the name field.|
51
+ |description|.SCEventForm-description|Styles applied to the description field.|
52
+ |content|.SCEventForm-content|Styles applied to the element.|
53
+ |privacySection|.SCEventForm-privacy-section|Styles applied to the privacy section.|
54
+ |privacySectionInfo|.SCEventForm-privacy-section-info|Styles applied to the privacy info section.|
55
+ |error|.SCEventForm-error|Styles applied to the error elements.|
56
+
57
+ * @param inProps
58
+ */
59
+ export default function EventForm(inProps: EventFormProps): JSX.Element;