@selfcommunity/react-ui 0.7.9-alpha.0 → 0.7.9-alpha.2

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 (174) hide show
  1. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
  2. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +117 -0
  3. package/lib/cjs/components/ChangeGroupCover/constants.d.ts +1 -0
  4. package/lib/cjs/components/ChangeGroupCover/constants.js +4 -0
  5. package/lib/cjs/components/ChangeGroupCover/index.d.ts +3 -0
  6. package/lib/cjs/components/ChangeGroupCover/index.js +5 -0
  7. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
  8. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +117 -0
  9. package/lib/cjs/components/ChangeGroupPicture/constants.d.ts +1 -0
  10. package/lib/cjs/components/ChangeGroupPicture/constants.js +4 -0
  11. package/lib/cjs/components/ChangeGroupPicture/index.d.ts +3 -0
  12. package/lib/cjs/components/ChangeGroupPicture/index.js +5 -0
  13. package/lib/cjs/components/CreateGroup/CreateGroup.d.ts +48 -0
  14. package/lib/cjs/components/CreateGroup/CreateGroup.js +187 -0
  15. package/lib/cjs/components/CreateGroup/constants.d.ts +1 -0
  16. package/lib/cjs/components/CreateGroup/constants.js +4 -0
  17. package/lib/cjs/components/CreateGroup/index.d.ts +3 -0
  18. package/lib/cjs/components/CreateGroup/index.js +5 -0
  19. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
  20. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +73 -0
  21. package/lib/cjs/components/CreateGroupButton/index.d.ts +3 -0
  22. package/lib/cjs/components/CreateGroupButton/index.js +5 -0
  23. package/lib/cjs/components/Group/Group.d.ts +67 -0
  24. package/lib/cjs/components/Group/Group.js +96 -0
  25. package/lib/cjs/components/Group/Skeleton.d.ts +22 -0
  26. package/lib/cjs/components/Group/Skeleton.js +42 -0
  27. package/lib/cjs/components/Group/constants.d.ts +1 -0
  28. package/lib/cjs/components/Group/constants.js +4 -0
  29. package/lib/cjs/components/Group/index.d.ts +4 -0
  30. package/lib/cjs/components/Group/index.js +8 -0
  31. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +83 -0
  32. package/lib/cjs/components/GroupHeader/GroupHeader.js +137 -0
  33. package/lib/cjs/components/GroupHeader/Skeleton.d.ts +27 -0
  34. package/lib/cjs/components/GroupHeader/Skeleton.js +56 -0
  35. package/lib/cjs/components/GroupHeader/constants.d.ts +1 -0
  36. package/lib/cjs/components/GroupHeader/constants.js +4 -0
  37. package/lib/cjs/components/GroupHeader/index.d.ts +4 -0
  38. package/lib/cjs/components/GroupHeader/index.js +8 -0
  39. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
  40. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +100 -0
  41. package/lib/cjs/components/GroupInfoWidget/Skeleton.d.ts +21 -0
  42. package/lib/cjs/components/GroupInfoWidget/Skeleton.js +38 -0
  43. package/lib/cjs/components/GroupInfoWidget/constants.d.ts +1 -0
  44. package/lib/cjs/components/GroupInfoWidget/constants.js +4 -0
  45. package/lib/cjs/components/GroupInfoWidget/index.d.ts +4 -0
  46. package/lib/cjs/components/GroupInfoWidget/index.js +8 -0
  47. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
  48. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +259 -0
  49. package/lib/cjs/components/GroupInviteButton/index.d.ts +3 -0
  50. package/lib/cjs/components/GroupInviteButton/index.js +5 -0
  51. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +46 -0
  52. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +135 -0
  53. package/lib/cjs/components/GroupMembersButton/index.d.ts +3 -0
  54. package/lib/cjs/components/GroupMembersButton/index.js +5 -0
  55. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
  56. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +194 -0
  57. package/lib/cjs/components/GroupMembersWidget/Skeleton.d.ts +22 -0
  58. package/lib/cjs/components/GroupMembersWidget/Skeleton.js +38 -0
  59. package/lib/cjs/components/GroupMembersWidget/constants.d.ts +1 -0
  60. package/lib/cjs/components/GroupMembersWidget/constants.js +4 -0
  61. package/lib/cjs/components/GroupMembersWidget/index.d.ts +4 -0
  62. package/lib/cjs/components/GroupMembersWidget/index.js +8 -0
  63. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +79 -0
  64. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +194 -0
  65. package/lib/cjs/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
  66. package/lib/cjs/components/GroupRequestsWidget/Skeleton.js +38 -0
  67. package/lib/cjs/components/GroupRequestsWidget/constants.d.ts +1 -0
  68. package/lib/cjs/components/GroupRequestsWidget/constants.js +4 -0
  69. package/lib/cjs/components/GroupRequestsWidget/index.d.ts +4 -0
  70. package/lib/cjs/components/GroupRequestsWidget/index.js +8 -0
  71. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +51 -0
  72. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +117 -0
  73. package/lib/cjs/components/GroupSubscribeButton/index.d.ts +3 -0
  74. package/lib/cjs/components/GroupSubscribeButton/index.js +5 -0
  75. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +4 -0
  76. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -3
  77. package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
  78. package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -0
  79. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +5 -0
  80. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -2
  81. package/lib/cjs/components/User/User.d.ts +12 -0
  82. package/lib/cjs/components/User/User.js +5 -3
  83. package/lib/cjs/constants/Group.d.ts +2 -0
  84. package/lib/cjs/constants/Group.js +5 -0
  85. package/lib/cjs/index.d.ts +14 -2
  86. package/lib/cjs/index.js +34 -5
  87. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
  88. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +114 -0
  89. package/lib/esm/components/ChangeGroupCover/constants.d.ts +1 -0
  90. package/lib/esm/components/ChangeGroupCover/constants.js +1 -0
  91. package/lib/esm/components/ChangeGroupCover/index.d.ts +3 -0
  92. package/lib/esm/components/ChangeGroupCover/index.js +2 -0
  93. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
  94. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +114 -0
  95. package/lib/esm/components/ChangeGroupPicture/constants.d.ts +1 -0
  96. package/lib/esm/components/ChangeGroupPicture/constants.js +1 -0
  97. package/lib/esm/components/ChangeGroupPicture/index.d.ts +3 -0
  98. package/lib/esm/components/ChangeGroupPicture/index.js +2 -0
  99. package/lib/esm/components/CreateGroup/CreateGroup.d.ts +48 -0
  100. package/lib/esm/components/CreateGroup/CreateGroup.js +184 -0
  101. package/lib/esm/components/CreateGroup/constants.d.ts +1 -0
  102. package/lib/esm/components/CreateGroup/constants.js +1 -0
  103. package/lib/esm/components/CreateGroup/index.d.ts +3 -0
  104. package/lib/esm/components/CreateGroup/index.js +2 -0
  105. package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
  106. package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +70 -0
  107. package/lib/esm/components/CreateGroupButton/index.d.ts +3 -0
  108. package/lib/esm/components/CreateGroupButton/index.js +2 -0
  109. package/lib/esm/components/Group/Group.d.ts +67 -0
  110. package/lib/esm/components/Group/Group.js +93 -0
  111. package/lib/esm/components/Group/Skeleton.d.ts +22 -0
  112. package/lib/esm/components/Group/Skeleton.js +38 -0
  113. package/lib/esm/components/Group/constants.d.ts +1 -0
  114. package/lib/esm/components/Group/constants.js +1 -0
  115. package/lib/esm/components/Group/index.d.ts +4 -0
  116. package/lib/esm/components/Group/index.js +4 -0
  117. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +83 -0
  118. package/lib/esm/components/GroupHeader/GroupHeader.js +134 -0
  119. package/lib/esm/components/GroupHeader/Skeleton.d.ts +27 -0
  120. package/lib/esm/components/GroupHeader/Skeleton.js +53 -0
  121. package/lib/esm/components/GroupHeader/constants.d.ts +1 -0
  122. package/lib/esm/components/GroupHeader/constants.js +1 -0
  123. package/lib/esm/components/GroupHeader/index.d.ts +4 -0
  124. package/lib/esm/components/GroupHeader/index.js +4 -0
  125. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
  126. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +97 -0
  127. package/lib/esm/components/GroupInfoWidget/Skeleton.d.ts +21 -0
  128. package/lib/esm/components/GroupInfoWidget/Skeleton.js +34 -0
  129. package/lib/esm/components/GroupInfoWidget/constants.d.ts +1 -0
  130. package/lib/esm/components/GroupInfoWidget/constants.js +1 -0
  131. package/lib/esm/components/GroupInfoWidget/index.d.ts +4 -0
  132. package/lib/esm/components/GroupInfoWidget/index.js +4 -0
  133. package/lib/esm/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
  134. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +256 -0
  135. package/lib/esm/components/GroupInviteButton/index.d.ts +3 -0
  136. package/lib/esm/components/GroupInviteButton/index.js +2 -0
  137. package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +46 -0
  138. package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +132 -0
  139. package/lib/esm/components/GroupMembersButton/index.d.ts +3 -0
  140. package/lib/esm/components/GroupMembersButton/index.js +2 -0
  141. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
  142. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +191 -0
  143. package/lib/esm/components/GroupMembersWidget/Skeleton.d.ts +22 -0
  144. package/lib/esm/components/GroupMembersWidget/Skeleton.js +34 -0
  145. package/lib/esm/components/GroupMembersWidget/constants.d.ts +1 -0
  146. package/lib/esm/components/GroupMembersWidget/constants.js +1 -0
  147. package/lib/esm/components/GroupMembersWidget/index.d.ts +4 -0
  148. package/lib/esm/components/GroupMembersWidget/index.js +4 -0
  149. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +79 -0
  150. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +191 -0
  151. package/lib/esm/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
  152. package/lib/esm/components/GroupRequestsWidget/Skeleton.js +34 -0
  153. package/lib/esm/components/GroupRequestsWidget/constants.d.ts +1 -0
  154. package/lib/esm/components/GroupRequestsWidget/constants.js +1 -0
  155. package/lib/esm/components/GroupRequestsWidget/index.d.ts +4 -0
  156. package/lib/esm/components/GroupRequestsWidget/index.js +4 -0
  157. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +51 -0
  158. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +114 -0
  159. package/lib/esm/components/GroupSubscribeButton/index.d.ts +3 -0
  160. package/lib/esm/components/GroupSubscribeButton/index.js +2 -0
  161. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +4 -0
  162. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -4
  163. package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
  164. package/lib/esm/components/NavigationMenuIconButton/index.js +2 -0
  165. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +5 -0
  166. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +3 -3
  167. package/lib/esm/components/User/User.d.ts +12 -0
  168. package/lib/esm/components/User/User.js +5 -3
  169. package/lib/esm/constants/Group.d.ts +2 -0
  170. package/lib/esm/constants/Group.js +2 -0
  171. package/lib/esm/index.d.ts +14 -2
  172. package/lib/esm/index.js +41 -29
  173. package/lib/umd/react-ui.js +1 -1
  174. package/package.json +6 -6
@@ -0,0 +1,134 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useMemo } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { Avatar, Box, Icon, Paper, Typography } from '@mui/material';
5
+ import { SCGroupPrivacyType } from '@selfcommunity/types';
6
+ import { SCPreferences, useSCFetchGroup, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
7
+ import GroupHeaderSkeleton from './Skeleton';
8
+ import classNames from 'classnames';
9
+ import { useThemeProps } from '@mui/system';
10
+ import { PREFIX } from './constants';
11
+ import ChangeGroupCover from '../ChangeGroupCover';
12
+ import { FormattedMessage } from 'react-intl';
13
+ import Bullet from '../../shared/Bullet';
14
+ import ChangeGroupPicture from '../ChangeGroupPicture';
15
+ import GroupMembersButton from '../GroupMembersButton';
16
+ const classes = {
17
+ root: `${PREFIX}-root`,
18
+ cover: `${PREFIX}-cover`,
19
+ avatar: `${PREFIX}-avatar`,
20
+ info: `${PREFIX}-info`,
21
+ name: `${PREFIX}-name`,
22
+ changePicture: `${PREFIX}-change-picture`,
23
+ changeCover: `${PREFIX}-change-cover`,
24
+ visibility: `${PREFIX}-visibility`,
25
+ visibilityItem: `${PREFIX}-visibility-item`,
26
+ members: `${PREFIX}-members`,
27
+ membersCounter: `${PREFIX}-members-counter`
28
+ };
29
+ const Root = styled(Box, {
30
+ name: PREFIX,
31
+ slot: 'Root'
32
+ })(() => ({}));
33
+ /**
34
+ * > API documentation for the Community-JS Group Header component. Learn about the available props and the CSS API.
35
+ *
36
+ *
37
+ * This component renders the groups top section.
38
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/UserProfileHeader)
39
+
40
+ #### Import
41
+
42
+ ```jsx
43
+ import {UserProfileHeader} from '@selfcommunity/react-ui';
44
+ ```
45
+
46
+ #### Component Name
47
+
48
+ The name `SCGroupHeader` can be used when providing style overrides in the theme.
49
+
50
+
51
+ #### CSS
52
+
53
+ |Rule Name|Global class|Description|
54
+ |---|---|---|
55
+ |root|.SCGroupHeader-root|Styles applied to the root element.|
56
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
57
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
58
+ |info|SCGroupHeader-info|Styles applied to the info section.|
59
+ |name|SCGroupHeader-username|Styles applied to the username element.|
60
+ |changePicture|.SCGroupHeader-change-picture|Styles applied to changePicture element.|
61
+ |changeCover|.SCGroupHeader-change-cover`|Styles applied to changeCover element.|
62
+
63
+ * @param inProps
64
+ */
65
+ export default function GroupHeader(inProps) {
66
+ var _a, _b;
67
+ // PROPS
68
+ const props = useThemeProps({
69
+ props: inProps,
70
+ name: PREFIX
71
+ });
72
+ const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupMembersButtonProps = {}, actions } = props, rest = __rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupMembersButtonProps", "actions"]);
73
+ // PREFERENCES
74
+ const scPreferences = useSCPreferences();
75
+ // CONTEXT
76
+ const scUserContext = useSCUser();
77
+ // HOOKS
78
+ const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
79
+ // CONST
80
+ const canEdit = useMemo(() => { var _a, _b; return scUserContext.user && (((_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.created_by) === null || _a === void 0 ? void 0 : _a.id) || ((_b = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _b === void 0 ? void 0 : _b.id)) === scUserContext.user.id; }, [scUserContext.user, (_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.created_by) === null || _a === void 0 ? void 0 : _a.id, (_b = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _b === void 0 ? void 0 : _b.id]);
81
+ /**
82
+ * Handles Change Avatar
83
+ * @param avatar
84
+ */
85
+ function handleChangeAvatar(avatar) {
86
+ if (canEdit) {
87
+ setSCGroup(Object.assign({}, scGroup, { image_bigger: avatar }));
88
+ }
89
+ }
90
+ /**
91
+ * Handles Change Cover
92
+ * @param cover
93
+ */
94
+ function handleChangeCover(cover) {
95
+ if (canEdit) {
96
+ setSCGroup(Object.assign({}, scGroup, { emotional_image: cover }));
97
+ }
98
+ }
99
+ // RENDER
100
+ if (!scGroup) {
101
+ return React.createElement(GroupHeaderSkeleton, null);
102
+ }
103
+ const _backgroundCover = Object.assign({}, (scGroup.emotional_image
104
+ ? { background: `url('${scGroup.emotional_image}') center / cover` }
105
+ : { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
106
+ return (React.createElement(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest),
107
+ React.createElement(Paper, { style: _backgroundCover, classes: { root: classes.cover } },
108
+ React.createElement(Box, { className: classes.avatar },
109
+ React.createElement(Avatar, null,
110
+ React.createElement("img", { alt: "group", src: scGroup.image_bigger ? scGroup.image_bigger : '' }))),
111
+ canEdit && (React.createElement(React.Fragment, null,
112
+ React.createElement(ChangeGroupPicture, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)),
113
+ React.createElement("div", { className: classes.changeCover },
114
+ React.createElement(ChangeGroupCover, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)))))),
115
+ React.createElement(Box, { className: classes.info },
116
+ React.createElement(Typography, { variant: "h5", className: classes.name }, scGroup.name),
117
+ React.createElement(Box, { className: classes.visibility },
118
+ scGroup.privacy === SCGroupPrivacyType.PUBLIC ? (React.createElement(Typography, { className: classes.visibilityItem },
119
+ React.createElement(Icon, null, "public"),
120
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
121
+ React.createElement(Icon, null, "private"),
122
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" }))),
123
+ React.createElement(Bullet, null),
124
+ scGroup.visible ? (React.createElement(Typography, { className: classes.visibilityItem },
125
+ React.createElement(Icon, null, "visibility"),
126
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
127
+ React.createElement(Icon, null, "visibility_off"),
128
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })))),
129
+ React.createElement(Box, { className: classes.members },
130
+ React.createElement(Typography, { className: classes.membersCounter, component: "div" },
131
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } })),
132
+ React.createElement(GroupMembersButton, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup }, GroupMembersButtonProps))),
133
+ actions && actions)));
134
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
3
+
4
+ #### Import
5
+
6
+ ```jsx
7
+ import {GroupHeaderSkeleton} from '@selfcommunity/react-ui';
8
+ ```
9
+
10
+ #### Component Name
11
+
12
+ The name `SCGroupHeader-skeleton-root` can be used when providing style overrides in the theme.
13
+
14
+ #### CSS
15
+
16
+ |Rule Name|Global class|Description|
17
+ |---|---|---|
18
+ |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
19
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
20
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
21
+ |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
22
+ |section|.SCGroupHeader-section|Styles applied to the info section.|
23
+ |username|.SCGroupHeader-username|Styles applied to the username element.|
24
+ *
25
+ */
26
+ declare function GroupHeaderSkeleton(): JSX.Element;
27
+ export default GroupHeaderSkeleton;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { Box, Typography, useTheme } from '@mui/material';
3
+ import { styled } from '@mui/material/styles';
4
+ import Skeleton from '@mui/material/Skeleton';
5
+ import { PREFIX } from './constants';
6
+ const classes = {
7
+ root: `${PREFIX}-skeleton-root`,
8
+ cover: `${PREFIX}-cover`,
9
+ avatar: `${PREFIX}-avatar`,
10
+ actions: `${PREFIX}-actions`,
11
+ section: `${PREFIX}-section`,
12
+ username: `${PREFIX}-username`
13
+ };
14
+ const Root = styled(Box, {
15
+ name: PREFIX,
16
+ slot: 'SkeletonRoot'
17
+ })(() => ({}));
18
+ /**
19
+ * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
20
+
21
+ #### Import
22
+
23
+ ```jsx
24
+ import {GroupHeaderSkeleton} from '@selfcommunity/react-ui';
25
+ ```
26
+
27
+ #### Component Name
28
+
29
+ The name `SCGroupHeader-skeleton-root` can be used when providing style overrides in the theme.
30
+
31
+ #### CSS
32
+
33
+ |Rule Name|Global class|Description|
34
+ |---|---|---|
35
+ |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
36
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
37
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
38
+ |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
39
+ |section|.SCGroupHeader-section|Styles applied to the info section.|
40
+ |username|.SCGroupHeader-username|Styles applied to the username element.|
41
+ *
42
+ */
43
+ function GroupHeaderSkeleton() {
44
+ const theme = useTheme();
45
+ return (React.createElement(Root, { className: classes.root },
46
+ React.createElement(Skeleton, { className: classes.cover, animation: "wave", variant: "rectangular" }),
47
+ React.createElement(Box, { className: classes.avatar },
48
+ React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeLarge, height: theme.selfcommunity.group.avatar.sizeLarge })),
49
+ React.createElement(Box, { className: classes.section },
50
+ React.createElement(Typography, { variant: "h5", className: classes.username },
51
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 30, width: 100 } })))));
52
+ }
53
+ export default GroupHeaderSkeleton;
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCGroupHeader";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCGroupHeader';
@@ -0,0 +1,4 @@
1
+ import GroupHeader, { GroupHeaderProps } from './GroupHeader';
2
+ import GroupHeaderSkeleton from './Skeleton';
3
+ export default GroupHeader;
4
+ export { GroupHeaderProps, GroupHeaderSkeleton };
@@ -0,0 +1,4 @@
1
+ import GroupHeader from './GroupHeader';
2
+ import GroupHeaderSkeleton from './Skeleton';
3
+ export default GroupHeader;
4
+ export { GroupHeaderSkeleton };
@@ -0,0 +1,52 @@
1
+ import { VirtualScrollerItemProps } from '../../types/virtualScroller';
2
+ import { SCGroupType } from '@selfcommunity/types';
3
+ export interface GroupInfoWidgetProps extends VirtualScrollerItemProps {
4
+ /**
5
+ * Group Object
6
+ * @default null
7
+ */
8
+ group?: SCGroupType;
9
+ /**
10
+ * Id of the group
11
+ * @default null
12
+ */
13
+ groupId?: number | string;
14
+ /**
15
+ * Overrides or extends the styles applied to the component.
16
+ * @default null
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Other props
21
+ */
22
+ [p: string]: any;
23
+ }
24
+ /**
25
+ * > API documentation for the Community-JS Group Info Widget component. Learn about the available props and the CSS API.
26
+ *
27
+ *
28
+ * This component renders a widget containing the group info.
29
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupInfoWidget)
30
+
31
+ #### Import
32
+
33
+ ```jsx
34
+ import {GroupInfoWidget} from '@selfcommunity/react-ui';
35
+ ```
36
+
37
+ #### Component Name
38
+
39
+ The name `SCGroupInfoWidget` can be used when providing style overrides in the theme.
40
+
41
+
42
+ #### CSS
43
+
44
+ |Rule Name|Global class|Description|
45
+ |---|---|---|
46
+ |root|.SCGroupInfoWidget-root|Styles applied to the root element.|
47
+ |title|.SCGroupInfoWidget-title|Styles applied to the title element.|
48
+
49
+ *
50
+ * @param inProps
51
+ */
52
+ export default function GroupInfoWidget(inProps: GroupInfoWidgetProps): JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { CardContent, Icon, Typography } from '@mui/material';
5
+ import classNames from 'classnames';
6
+ import Widget from '../Widget';
7
+ import { useThemeProps } from '@mui/system';
8
+ import { PREFIX } from './constants';
9
+ import { FormattedMessage, useIntl } from 'react-intl';
10
+ import { SCGroupPrivacyType } from '@selfcommunity/types';
11
+ import { useSCFetchGroup } from '@selfcommunity/react-core';
12
+ const classes = {
13
+ root: `${PREFIX}-root`,
14
+ title: `${PREFIX}-title`,
15
+ description: `${PREFIX}-description`,
16
+ privacy: `${PREFIX}-privacy`,
17
+ privacyTitle: `${PREFIX}-privacy-title`,
18
+ visibility: `${PREFIX}-visibility`,
19
+ visibilityTitle: `${PREFIX}-visibility-title`,
20
+ date: `${PREFIX}-date`
21
+ };
22
+ const Root = styled(Widget, {
23
+ name: PREFIX,
24
+ slot: 'Root'
25
+ })(() => ({}));
26
+ /**
27
+ * > API documentation for the Community-JS Group Info Widget component. Learn about the available props and the CSS API.
28
+ *
29
+ *
30
+ * This component renders a widget containing the group info.
31
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupInfoWidget)
32
+
33
+ #### Import
34
+
35
+ ```jsx
36
+ import {GroupInfoWidget} from '@selfcommunity/react-ui';
37
+ ```
38
+
39
+ #### Component Name
40
+
41
+ The name `SCGroupInfoWidget` can be used when providing style overrides in the theme.
42
+
43
+
44
+ #### CSS
45
+
46
+ |Rule Name|Global class|Description|
47
+ |---|---|---|
48
+ |root|.SCGroupInfoWidget-root|Styles applied to the root element.|
49
+ |title|.SCGroupInfoWidget-title|Styles applied to the title element.|
50
+
51
+ *
52
+ * @param inProps
53
+ */
54
+ export default function GroupInfoWidget(inProps) {
55
+ // PROPS
56
+ const props = useThemeProps({
57
+ props: inProps,
58
+ name: PREFIX
59
+ });
60
+ const { className, group, groupId, onHeightChange, onStateChange } = props, rest = __rest(props, ["className", "group", "groupId", "onHeightChange", "onStateChange"]);
61
+ // HOOKS
62
+ const { scGroup } = useSCFetchGroup({ id: groupId, group });
63
+ // INTL
64
+ const intl = useIntl();
65
+ /**
66
+ * Renders root object
67
+ */
68
+ return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest),
69
+ React.createElement(CardContent, null,
70
+ React.createElement(Typography, { variant: "h4", className: classes.title },
71
+ React.createElement(FormattedMessage, { id: "ui.groupInfoWidget.title", defaultMessage: "ui.groupInfoWidget.title" })),
72
+ React.createElement(Typography, { variant: "body1", className: classes.description }, scGroup.description),
73
+ React.createElement(Typography, { component: "div", className: classes.privacy }, scGroup.privacy === SCGroupPrivacyType.PUBLIC ? (React.createElement(React.Fragment, null,
74
+ React.createElement(Typography, { className: classes.privacyTitle },
75
+ React.createElement(Icon, null, "public"),
76
+ React.createElement(FormattedMessage, { id: "ui.createGroup.privacy.public", defaultMessage: "ui.createGroup.privacy.public" })),
77
+ React.createElement(Typography, { variant: "body2" },
78
+ React.createElement(FormattedMessage, { id: "ui.createGroup.privacy.public.info", defaultMessage: "ui.createGroup.privacy.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))) : (React.createElement(React.Fragment, null,
79
+ React.createElement(Typography, { className: classes.privacyTitle },
80
+ React.createElement(Icon, null, "private"),
81
+ React.createElement(FormattedMessage, { id: "ui.createGroup.privacy.private", defaultMessage: "ui.createGroup.privacy.private" })),
82
+ React.createElement(Typography, { variant: "body2" },
83
+ React.createElement(FormattedMessage, { id: "ui.createGroup.privacy.private.info", defaultMessage: "ui.createGroup.private.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } }))))),
84
+ scGroup.privacy === SCGroupPrivacyType.PRIVATE && (React.createElement(Typography, { component: "div", className: classes.visibility }, scGroup.visible ? (React.createElement(React.Fragment, null,
85
+ React.createElement(Typography, { className: classes.visibilityTitle },
86
+ React.createElement(Icon, null, "visibility"),
87
+ React.createElement(FormattedMessage, { id: "ui.createGroup.visibility.visible", defaultMessage: "ui.createGroup.visibility.visible" })),
88
+ React.createElement(Typography, { variant: "body2" },
89
+ React.createElement(FormattedMessage, { id: "ui.createGroup.visibility.visible.info", defaultMessage: "ui.createGroup.visibility.visible.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))) : (React.createElement(React.Fragment, null,
90
+ React.createElement(Typography, { className: classes.visibilityTitle },
91
+ React.createElement(Icon, null, "visibility_off"),
92
+ React.createElement(FormattedMessage, { id: "ui.createGroup.visibility.hidden", defaultMessage: "ui.createGroup.visibility.hidden" })),
93
+ React.createElement(Typography, { variant: "body2" },
94
+ React.createElement(FormattedMessage, { id: "ui.createGroup.visibility.hidden.info", defaultMessage: "ui.createGroup.visibility.hidden.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))))),
95
+ React.createElement(Typography, { variant: "body2", className: classes.date },
96
+ React.createElement(FormattedMessage, { id: "ui.groupInfoWidget.date", defaultMessage: "ui.groupInfoWidget.date", values: { date: intl.formatDate(scGroup.created_at, { day: 'numeric', year: 'numeric', month: 'long' }) } })))));
97
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
3
+
4
+ #### Import
5
+
6
+ ```jsx
7
+ import {PlatformWidgetSkeleton} from '@selfcommunity/react-ui';
8
+ ```
9
+
10
+ #### Component Name
11
+
12
+ The name `SCPlatformWidget-skeleton-root` can be used when providing style overrides in the theme.
13
+
14
+ #### CSS
15
+
16
+ |Rule Name|Global class|Description|
17
+ |---|---|---|
18
+ |root|.SCPlatformWidget-skeleton-root|Styles applied to the root element.|
19
+ *
20
+ */
21
+ export default function PlatformWidgetSkeleton(): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { GenericSkeleton } from '../Skeleton';
3
+ import { styled } from '@mui/material/styles';
4
+ import { PREFIX } from './constants';
5
+ const classes = {
6
+ root: `${PREFIX}-skeleton-root`
7
+ };
8
+ const Root = styled(GenericSkeleton, {
9
+ name: PREFIX,
10
+ slot: 'SkeletonRoot'
11
+ })(() => ({}));
12
+ /**
13
+ * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
14
+
15
+ #### Import
16
+
17
+ ```jsx
18
+ import {PlatformWidgetSkeleton} from '@selfcommunity/react-ui';
19
+ ```
20
+
21
+ #### Component Name
22
+
23
+ The name `SCPlatformWidget-skeleton-root` can be used when providing style overrides in the theme.
24
+
25
+ #### CSS
26
+
27
+ |Rule Name|Global class|Description|
28
+ |---|---|---|
29
+ |root|.SCPlatformWidget-skeleton-root|Styles applied to the root element.|
30
+ *
31
+ */
32
+ export default function PlatformWidgetSkeleton() {
33
+ return React.createElement(Root, { className: classes.root });
34
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCGroupInfoWidget";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCGroupInfoWidget';
@@ -0,0 +1,4 @@
1
+ import GroupInfoWidget, { GroupInfoWidgetProps } from './GroupInfoWidget';
2
+ import GroupInfoWidgetSkeleton from './Skeleton';
3
+ export default GroupInfoWidget;
4
+ export { GroupInfoWidgetProps, GroupInfoWidgetSkeleton };
@@ -0,0 +1,4 @@
1
+ import GroupInfoWidget from './GroupInfoWidget';
2
+ import GroupInfoWidgetSkeleton from './Skeleton';
3
+ export default GroupInfoWidget;
4
+ export { GroupInfoWidgetSkeleton };
@@ -0,0 +1,57 @@
1
+ import { ButtonProps } from '@mui/material/Button/Button';
2
+ import { SCGroupType } from '@selfcommunity/types';
3
+ export interface GroupInviteButtonProps extends ButtonProps {
4
+ /**
5
+ * Overrides or extends the styles applied to the component.
6
+ * @default null
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Group Object
11
+ * @default null
12
+ */
13
+ group?: SCGroupType;
14
+ /**
15
+ * Id of the group
16
+ * @default null
17
+ */
18
+ groupId?: number | string;
19
+ /**
20
+ * Functions to handle invitations sending in group creation mode
21
+ * @default null
22
+ */
23
+ handleInvitations?: (data: any) => any;
24
+ /**
25
+ * Any other properties
26
+ */
27
+ [p: string]: any;
28
+ }
29
+ /**
30
+ *> API documentation for the Community-JS Group Invite Button component. Learn about the available props and the CSS API.
31
+ *
32
+ #### Import
33
+ ```jsx
34
+ import {SCGroupInviteButton} from '@selfcommunity/react-ui';
35
+ ```
36
+
37
+ #### Component Name
38
+ The name `SCGroupInviteButton` can be used when providing style overrides in the theme.
39
+
40
+ #### CSS
41
+
42
+ |Rule Name|Global class|Description|
43
+ |---|---|---|
44
+ |root|.SCGroupInviteButton-root|Styles applied to the root element.|
45
+ |dialogRoot|.SCGroupInviteButton-dialog-root|Styles applied to the dialog root.|
46
+ |dialogTitle|.SCGroupInviteButton-dialog-title|Styles applied to the dialog title element.|
47
+ |dialogContent|.SCGroupInviteButton-dialog-content|Styles applied to the dialog content.|
48
+ |autocomplete|.SCGroupInviteButton-autocomplete|Styles applied to the autocomplete element.|
49
+ |icon|.SCGroupInviteButton-icon|Styles applied to the autocomplete icon element.|
50
+ |input|.SCGroupInviteButton-input|Styles applied to the autocomplete input element.|
51
+ |clear|.SCGroupInviteButton-clear|Styles applied to the autocomplete clear icon element.|
52
+ |invitedBox|.SCGroupInviteButton-invited-box|Styles applied to the invited users box.|
53
+ |suggested|.SCGroupInviteButton-suggested|Styles applied to the suggested users box.|
54
+
55
+ * @param inProps
56
+ */
57
+ export default function GroupInviteButton(inProps: GroupInviteButtonProps): JSX.Element;