@selfcommunity/react-ui 0.7.9-alpha.1 → 0.7.9-alpha.10

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 (234) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +3 -1
  2. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
  3. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +140 -0
  4. package/lib/cjs/components/ChangeGroupCover/constants.d.ts +1 -0
  5. package/lib/cjs/components/ChangeGroupCover/constants.js +4 -0
  6. package/lib/cjs/components/ChangeGroupCover/index.d.ts +3 -0
  7. package/lib/cjs/components/ChangeGroupCover/index.js +5 -0
  8. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
  9. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +135 -0
  10. package/lib/cjs/components/ChangeGroupPicture/constants.d.ts +1 -0
  11. package/lib/cjs/components/ChangeGroupPicture/constants.js +4 -0
  12. package/lib/cjs/components/ChangeGroupPicture/index.d.ts +3 -0
  13. package/lib/cjs/components/ChangeGroupPicture/index.js +5 -0
  14. package/lib/cjs/components/Composer/Attributes/Attributes.d.ts +1 -1
  15. package/lib/cjs/components/Composer/Attributes/Attributes.js +7 -0
  16. package/lib/cjs/components/Composer/Composer.d.ts +2 -1
  17. package/lib/cjs/components/Composer/Composer.js +39 -12
  18. package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
  19. package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  20. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
  21. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +46 -12
  22. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
  23. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +72 -0
  24. package/lib/cjs/components/CreateGroupButton/index.d.ts +3 -0
  25. package/lib/cjs/components/CreateGroupButton/index.js +5 -0
  26. package/lib/cjs/components/CustomAdv/CustomAdv.d.ts +4 -0
  27. package/lib/cjs/components/EditGroupButton/EditGroupButton.d.ts +43 -0
  28. package/lib/cjs/components/EditGroupButton/EditGroupButton.js +61 -0
  29. package/lib/cjs/components/EditGroupButton/index.d.ts +3 -0
  30. package/lib/cjs/components/EditGroupButton/index.js +5 -0
  31. package/lib/cjs/components/Group/Group.d.ts +68 -0
  32. package/lib/cjs/components/Group/Group.js +96 -0
  33. package/lib/cjs/components/Group/Skeleton.d.ts +22 -0
  34. package/lib/cjs/components/Group/Skeleton.js +42 -0
  35. package/lib/cjs/components/Group/constants.d.ts +1 -0
  36. package/lib/cjs/components/Group/constants.js +4 -0
  37. package/lib/cjs/components/Group/index.d.ts +4 -0
  38. package/lib/cjs/components/Group/index.js +8 -0
  39. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
  40. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +101 -0
  41. package/lib/cjs/components/GroupAutocomplete/index.d.ts +3 -0
  42. package/lib/cjs/components/GroupAutocomplete/index.js +5 -0
  43. package/lib/cjs/components/GroupForm/GroupForm.d.ts +70 -0
  44. package/lib/cjs/components/GroupForm/GroupForm.js +239 -0
  45. package/lib/cjs/components/GroupForm/constants.d.ts +1 -0
  46. package/lib/cjs/components/GroupForm/constants.js +4 -0
  47. package/lib/cjs/components/GroupForm/index.d.ts +3 -0
  48. package/lib/cjs/components/GroupForm/index.js +5 -0
  49. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +84 -0
  50. package/lib/cjs/components/GroupHeader/GroupHeader.js +147 -0
  51. package/lib/cjs/components/GroupHeader/Skeleton.d.ts +25 -0
  52. package/lib/cjs/components/GroupHeader/Skeleton.js +56 -0
  53. package/lib/cjs/components/GroupHeader/constants.d.ts +1 -0
  54. package/lib/cjs/components/GroupHeader/constants.js +4 -0
  55. package/lib/cjs/components/GroupHeader/index.d.ts +4 -0
  56. package/lib/cjs/components/GroupHeader/index.js +8 -0
  57. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
  58. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +100 -0
  59. package/lib/cjs/components/GroupInfoWidget/Skeleton.d.ts +21 -0
  60. package/lib/cjs/components/GroupInfoWidget/Skeleton.js +38 -0
  61. package/lib/cjs/components/GroupInfoWidget/constants.d.ts +1 -0
  62. package/lib/cjs/components/GroupInfoWidget/constants.js +4 -0
  63. package/lib/cjs/components/GroupInfoWidget/index.d.ts +4 -0
  64. package/lib/cjs/components/GroupInfoWidget/index.js +8 -0
  65. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
  66. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +262 -0
  67. package/lib/cjs/components/GroupInviteButton/index.d.ts +3 -0
  68. package/lib/cjs/components/GroupInviteButton/index.js +5 -0
  69. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +51 -0
  70. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +136 -0
  71. package/lib/cjs/components/GroupMembersButton/index.d.ts +3 -0
  72. package/lib/cjs/components/GroupMembersButton/index.js +5 -0
  73. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
  74. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +205 -0
  75. package/lib/cjs/components/GroupMembersWidget/Skeleton.d.ts +22 -0
  76. package/lib/cjs/components/GroupMembersWidget/Skeleton.js +38 -0
  77. package/lib/cjs/components/GroupMembersWidget/constants.d.ts +1 -0
  78. package/lib/cjs/components/GroupMembersWidget/constants.js +4 -0
  79. package/lib/cjs/components/GroupMembersWidget/index.d.ts +4 -0
  80. package/lib/cjs/components/GroupMembersWidget/index.js +8 -0
  81. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +74 -0
  82. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +203 -0
  83. package/lib/cjs/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
  84. package/lib/cjs/components/GroupRequestsWidget/Skeleton.js +38 -0
  85. package/lib/cjs/components/GroupRequestsWidget/constants.d.ts +1 -0
  86. package/lib/cjs/components/GroupRequestsWidget/constants.js +4 -0
  87. package/lib/cjs/components/GroupRequestsWidget/index.d.ts +4 -0
  88. package/lib/cjs/components/GroupRequestsWidget/index.js +8 -0
  89. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
  90. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +137 -0
  91. package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
  92. package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
  93. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
  94. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +132 -0
  95. package/lib/cjs/components/GroupSubscribeButton/index.d.ts +3 -0
  96. package/lib/cjs/components/GroupSubscribeButton/index.js +5 -0
  97. package/lib/cjs/components/Groups/Groups.d.ts +61 -0
  98. package/lib/cjs/components/Groups/Groups.js +128 -0
  99. package/lib/cjs/components/Groups/Skeleton.d.ts +34 -0
  100. package/lib/cjs/components/Groups/Skeleton.js +45 -0
  101. package/lib/cjs/components/Groups/constants.d.ts +1 -0
  102. package/lib/cjs/components/Groups/constants.js +4 -0
  103. package/lib/cjs/components/Groups/index.d.ts +4 -0
  104. package/lib/cjs/components/Groups/index.js +8 -0
  105. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
  106. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -3
  107. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
  108. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
  109. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
  110. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
  111. package/lib/cjs/components/User/User.d.ts +12 -0
  112. package/lib/cjs/components/User/User.js +5 -3
  113. package/lib/cjs/constants/Group.d.ts +2 -0
  114. package/lib/cjs/constants/Group.js +5 -0
  115. package/lib/cjs/index.d.ts +17 -1
  116. package/lib/cjs/index.js +40 -2
  117. package/lib/esm/components/BottomNavigation/BottomNavigation.js +3 -1
  118. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
  119. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +137 -0
  120. package/lib/esm/components/ChangeGroupCover/constants.d.ts +1 -0
  121. package/lib/esm/components/ChangeGroupCover/constants.js +1 -0
  122. package/lib/esm/components/ChangeGroupCover/index.d.ts +3 -0
  123. package/lib/esm/components/ChangeGroupCover/index.js +2 -0
  124. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
  125. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +132 -0
  126. package/lib/esm/components/ChangeGroupPicture/constants.d.ts +1 -0
  127. package/lib/esm/components/ChangeGroupPicture/constants.js +1 -0
  128. package/lib/esm/components/ChangeGroupPicture/index.d.ts +3 -0
  129. package/lib/esm/components/ChangeGroupPicture/index.js +2 -0
  130. package/lib/esm/components/Composer/Attributes/Attributes.d.ts +1 -1
  131. package/lib/esm/components/Composer/Attributes/Attributes.js +7 -0
  132. package/lib/esm/components/Composer/Composer.d.ts +2 -1
  133. package/lib/esm/components/Composer/Composer.js +39 -12
  134. package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
  135. package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  136. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
  137. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +45 -12
  138. package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
  139. package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +69 -0
  140. package/lib/esm/components/CreateGroupButton/index.d.ts +3 -0
  141. package/lib/esm/components/CreateGroupButton/index.js +2 -0
  142. package/lib/esm/components/CustomAdv/CustomAdv.d.ts +4 -0
  143. package/lib/esm/components/EditGroupButton/EditGroupButton.d.ts +43 -0
  144. package/lib/esm/components/EditGroupButton/EditGroupButton.js +58 -0
  145. package/lib/esm/components/EditGroupButton/index.d.ts +3 -0
  146. package/lib/esm/components/EditGroupButton/index.js +2 -0
  147. package/lib/esm/components/Group/Group.d.ts +68 -0
  148. package/lib/esm/components/Group/Group.js +93 -0
  149. package/lib/esm/components/Group/Skeleton.d.ts +22 -0
  150. package/lib/esm/components/Group/Skeleton.js +38 -0
  151. package/lib/esm/components/Group/constants.d.ts +1 -0
  152. package/lib/esm/components/Group/constants.js +1 -0
  153. package/lib/esm/components/Group/index.d.ts +4 -0
  154. package/lib/esm/components/Group/index.js +4 -0
  155. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
  156. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +99 -0
  157. package/lib/esm/components/GroupAutocomplete/index.d.ts +3 -0
  158. package/lib/esm/components/GroupAutocomplete/index.js +2 -0
  159. package/lib/esm/components/GroupForm/GroupForm.d.ts +70 -0
  160. package/lib/esm/components/GroupForm/GroupForm.js +236 -0
  161. package/lib/esm/components/GroupForm/constants.d.ts +1 -0
  162. package/lib/esm/components/GroupForm/constants.js +1 -0
  163. package/lib/esm/components/GroupForm/index.d.ts +3 -0
  164. package/lib/esm/components/GroupForm/index.js +2 -0
  165. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +84 -0
  166. package/lib/esm/components/GroupHeader/GroupHeader.js +144 -0
  167. package/lib/esm/components/GroupHeader/Skeleton.d.ts +25 -0
  168. package/lib/esm/components/GroupHeader/Skeleton.js +53 -0
  169. package/lib/esm/components/GroupHeader/constants.d.ts +1 -0
  170. package/lib/esm/components/GroupHeader/constants.js +1 -0
  171. package/lib/esm/components/GroupHeader/index.d.ts +4 -0
  172. package/lib/esm/components/GroupHeader/index.js +4 -0
  173. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
  174. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +97 -0
  175. package/lib/esm/components/GroupInfoWidget/Skeleton.d.ts +21 -0
  176. package/lib/esm/components/GroupInfoWidget/Skeleton.js +34 -0
  177. package/lib/esm/components/GroupInfoWidget/constants.d.ts +1 -0
  178. package/lib/esm/components/GroupInfoWidget/constants.js +1 -0
  179. package/lib/esm/components/GroupInfoWidget/index.d.ts +4 -0
  180. package/lib/esm/components/GroupInfoWidget/index.js +4 -0
  181. package/lib/esm/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
  182. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +259 -0
  183. package/lib/esm/components/GroupInviteButton/index.d.ts +3 -0
  184. package/lib/esm/components/GroupInviteButton/index.js +2 -0
  185. package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +51 -0
  186. package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +133 -0
  187. package/lib/esm/components/GroupMembersButton/index.d.ts +3 -0
  188. package/lib/esm/components/GroupMembersButton/index.js +2 -0
  189. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
  190. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +202 -0
  191. package/lib/esm/components/GroupMembersWidget/Skeleton.d.ts +22 -0
  192. package/lib/esm/components/GroupMembersWidget/Skeleton.js +34 -0
  193. package/lib/esm/components/GroupMembersWidget/constants.d.ts +1 -0
  194. package/lib/esm/components/GroupMembersWidget/constants.js +1 -0
  195. package/lib/esm/components/GroupMembersWidget/index.d.ts +4 -0
  196. package/lib/esm/components/GroupMembersWidget/index.js +4 -0
  197. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +74 -0
  198. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +200 -0
  199. package/lib/esm/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
  200. package/lib/esm/components/GroupRequestsWidget/Skeleton.js +34 -0
  201. package/lib/esm/components/GroupRequestsWidget/constants.d.ts +1 -0
  202. package/lib/esm/components/GroupRequestsWidget/constants.js +1 -0
  203. package/lib/esm/components/GroupRequestsWidget/index.d.ts +4 -0
  204. package/lib/esm/components/GroupRequestsWidget/index.js +4 -0
  205. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
  206. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +134 -0
  207. package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
  208. package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
  209. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
  210. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +129 -0
  211. package/lib/esm/components/GroupSubscribeButton/index.d.ts +3 -0
  212. package/lib/esm/components/GroupSubscribeButton/index.js +2 -0
  213. package/lib/esm/components/Groups/Groups.d.ts +61 -0
  214. package/lib/esm/components/Groups/Groups.js +125 -0
  215. package/lib/esm/components/Groups/Skeleton.d.ts +34 -0
  216. package/lib/esm/components/Groups/Skeleton.js +42 -0
  217. package/lib/esm/components/Groups/constants.d.ts +1 -0
  218. package/lib/esm/components/Groups/constants.js +1 -0
  219. package/lib/esm/components/Groups/index.d.ts +4 -0
  220. package/lib/esm/components/Groups/index.js +4 -0
  221. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
  222. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -4
  223. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
  224. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
  225. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
  226. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
  227. package/lib/esm/components/User/User.d.ts +12 -0
  228. package/lib/esm/components/User/User.js +5 -3
  229. package/lib/esm/constants/Group.d.ts +2 -0
  230. package/lib/esm/constants/Group.js +2 -0
  231. package/lib/esm/index.d.ts +17 -1
  232. package/lib/esm/index.js +19 -3
  233. package/lib/umd/react-ui.js +1 -1
  234. package/package.json +6 -6
@@ -0,0 +1,236 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useState } from 'react';
3
+ import { useThemeProps } from '@mui/system';
4
+ import { styled } from '@mui/material/styles';
5
+ import { Avatar, Box, Divider, FormGroup, Icon, Paper, Stack, Switch, TextField, Typography } from '@mui/material';
6
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
7
+ import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
8
+ import classNames from 'classnames';
9
+ import { PREFIX } from './constants';
10
+ import BaseDialog from '../../shared/BaseDialog';
11
+ import { LoadingButton } from '@mui/lab';
12
+ import ChangeGroupPicture from '../ChangeGroupPicture';
13
+ import ChangeGroupCover from '../ChangeGroupCover';
14
+ import { GROUP_DESCRIPTION_MAX_LENGTH, GROUP_TITLE_MAX_LENGTH } from '../../constants/Group';
15
+ import GroupInviteButton from '../GroupInviteButton';
16
+ import { SCGroupPrivacyType } from '@selfcommunity/types';
17
+ import { SCOPE_SC_UI } from '../../constants/Errors';
18
+ import { formatHttpErrorCode, GroupService } from '@selfcommunity/api-services';
19
+ import { Logger } from '@selfcommunity/utils';
20
+ const messages = defineMessages({
21
+ name: {
22
+ id: 'ui.groupForm.name.placeholder',
23
+ defaultMessage: 'ui.groupForm.name.placeholder'
24
+ },
25
+ description: {
26
+ id: 'ui.groupForm.description.placeholder',
27
+ defaultMessage: 'ui.groupForm.description.placeholder'
28
+ }
29
+ });
30
+ const classes = {
31
+ root: `${PREFIX}-root`,
32
+ active: `${PREFIX}-active`,
33
+ title: `${PREFIX}-title`,
34
+ header: `${PREFIX}-header`,
35
+ cover: `${PREFIX}-cover`,
36
+ avatar: `${PREFIX}-avatar`,
37
+ form: `${PREFIX}-form`,
38
+ switch: `${PREFIX}-switch`,
39
+ switchLabel: `${PREFIX}-switch-label`,
40
+ name: `${PREFIX}-name`,
41
+ description: `${PREFIX}-description`,
42
+ content: `${PREFIX}-content`,
43
+ privacySection: `${PREFIX}-privacy-section`,
44
+ privacySectionInfo: `${PREFIX}-privacy-section-info`,
45
+ visibilitySection: `${PREFIX}-visibility-section`,
46
+ visibilitySectionInfo: `${PREFIX}-visibility-section-info`,
47
+ inviteSection: `${PREFIX}-invite-section`,
48
+ error: `${PREFIX}-error`
49
+ };
50
+ const Root = styled(BaseDialog, {
51
+ name: PREFIX,
52
+ slot: 'Root'
53
+ })(() => ({}));
54
+ /**
55
+ *> API documentation for the Community-JS Group Form component. Learn about the available props and the CSS API.
56
+ *
57
+ #### Import
58
+ ```jsx
59
+ import {GroupForm} from '@selfcommunity/react-ui';
60
+ ```
61
+
62
+ #### Component Name
63
+ The name `SCGroupForm` can be used when providing style overrides in the theme.
64
+
65
+ #### CSS
66
+
67
+ |Rule Name|Global class|Description|
68
+ |---|---|---|
69
+ |root|.SCGroupForm-root|Styles applied to the root element.|
70
+ |active|.SCGroupForm-active|Styles applied to the active element.|
71
+ |title|.SCGroupForm-title|Styles applied to the title element.|
72
+ |header|.SCGroupForm-header|Styles applied to the header element.|
73
+ |cover|.SCGroupForm-cover|Styles applied to the cover field.|
74
+ |avatar|.SCGroupForm-avatar|Styles applied to the avatar field.|
75
+ |form|.SCGroupForm-form|Styles applied to the form element.|
76
+ |switch|.SCGroupForm-switch|Styles applied to the switch element.|
77
+ |switchLabel|.SCGroupForm-switch-label|Styles applied to the switchLabel element.|
78
+ |name|.SCGroupForm-name|Styles applied to the name field.|
79
+ |description|.SCGroupForm-description|Styles applied to the description field.|
80
+ |content|.SCGroupForm-content|Styles applied to the element.|
81
+ |privacySection|.SCGroupForm-privacy-section|Styles applied to the privacy section.|
82
+ |privacySectionInfo|.SCGroupForm-privacy-section-info|Styles applied to the privacy info section.|
83
+ |visibilitySection|.SCGroupForm-visibility-section|Styles applied to the visibility section.|
84
+ |visibilitySectionInfo|.SCGroupForm-visibility-section-info|Styles applied to the visibility section info.|
85
+ |inviteSection|.SCGroupForm-invite-section|Styles applied to the invite section.|
86
+ |error|.SCGroupForm-error|Styles applied to the error elements.|
87
+
88
+ * @param inProps
89
+ */
90
+ export default function GroupForm(inProps) {
91
+ //PROPS
92
+ const props = useThemeProps({
93
+ props: inProps,
94
+ name: PREFIX
95
+ });
96
+ const { className, open = true, onClose, onSuccess, group = null } = props, rest = __rest(props, ["className", "open", "onClose", "onSuccess", "group"]);
97
+ const initialFieldState = {
98
+ imageOriginal: group ? group.image_medium : '',
99
+ imageOriginalFile: '',
100
+ emotionalImageOriginal: group ? group.emotional_image : '',
101
+ emotionalImageOriginalFile: '',
102
+ name: group ? group.name : '',
103
+ description: group ? group.description : '',
104
+ isPublic: group && group.privacy === SCGroupPrivacyType.PUBLIC,
105
+ isVisible: group ? group.visible : true,
106
+ invitedUsers: null,
107
+ isSubmitting: false
108
+ };
109
+ // STATE
110
+ const [field, setField] = useState(initialFieldState);
111
+ const [error, setError] = useState({});
112
+ // INTL
113
+ const intl = useIntl();
114
+ // PREFERENCES
115
+ const scPreferences = useSCPreferences();
116
+ const _backgroundCover = Object.assign({}, (field.emotionalImageOriginal
117
+ ? { background: `url('${field.emotionalImageOriginal}') center / cover` }
118
+ : { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
119
+ function handleChangeAvatar(avatar) {
120
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['imageOriginalFile']: avatar })));
121
+ const reader = new FileReader();
122
+ reader.onloadend = () => {
123
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['imageOriginal']: reader.result })));
124
+ };
125
+ reader.readAsDataURL(avatar);
126
+ if (error.imageOriginalError) {
127
+ delete error.imageOriginalError;
128
+ setError(error);
129
+ }
130
+ }
131
+ function handleChangeCover(cover) {
132
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['emotionalImageOriginalFile']: cover })));
133
+ const reader = new FileReader();
134
+ reader.onloadend = () => {
135
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['emotionalImageOriginal']: reader.result })));
136
+ };
137
+ reader.readAsDataURL(cover);
138
+ if (error.emotionalImageOriginalError) {
139
+ delete error.emotionalImageOriginalError;
140
+ setError(error);
141
+ }
142
+ }
143
+ const handleSubmit = () => {
144
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: true })));
145
+ const formData = new FormData();
146
+ formData.append('name', field.name);
147
+ formData.append('description', field.description);
148
+ formData.append('privacy', field.isPublic ? SCGroupPrivacyType.PUBLIC : SCGroupPrivacyType.PRIVATE);
149
+ formData.append('visible', field.isVisible);
150
+ if (field.imageOriginalFile) {
151
+ formData.append('image_original', field.imageOriginalFile);
152
+ }
153
+ if (field.emotionalImageOriginalFile) {
154
+ formData.append('emotional_image_original', field.emotionalImageOriginalFile);
155
+ }
156
+ for (const key in field.invitedUsers) {
157
+ formData.append(key, field.invitedUsers[key]);
158
+ }
159
+ let groupService;
160
+ if (group) {
161
+ groupService = GroupService.updateGroup(group.id, formData, { headers: { 'Content-Type': 'multipart/form-data' } });
162
+ }
163
+ else {
164
+ groupService = GroupService.createGroup(formData, { headers: { 'Content-Type': 'multipart/form-data' } });
165
+ }
166
+ groupService
167
+ .then((data) => {
168
+ onSuccess && onSuccess(data);
169
+ onClose && onClose();
170
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
171
+ })
172
+ .catch((e) => {
173
+ setError(Object.assign(Object.assign({}, error), formatHttpErrorCode(e)));
174
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
175
+ Logger.error(SCOPE_SC_UI, e);
176
+ });
177
+ };
178
+ const handleInviteSection = (data) => {
179
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['invitedUsers']: data })));
180
+ };
181
+ const handleChange = (event) => {
182
+ const { name, value } = event.target;
183
+ setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
184
+ if (error[`${name}Error`]) {
185
+ delete error[`${name}Error`];
186
+ setError(error);
187
+ }
188
+ };
189
+ /**
190
+ * Renders root object
191
+ */
192
+ return (React.createElement(Root, Object.assign({ DialogContentProps: { dividers: false }, title: group ? (React.createElement(FormattedMessage, { id: "ui.groupForm.title.edit", defaultMessage: "ui.groupForm.title.edit" })) : (React.createElement(FormattedMessage, { id: "ui.groupForm.title", defaultMessage: "ui.groupForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className), actions: React.createElement(LoadingButton, { loading: field.isSubmitting, disabled: !field.name || Object.keys(error).length !== 0, variant: "contained", onClick: handleSubmit, color: "secondary" }, group ? (React.createElement(FormattedMessage, { id: "ui.groupForm.button.edit", defaultMessage: "ui.groupForm.button.edit" })) : (React.createElement(FormattedMessage, { id: "ui.groupForm.button.create", defaultMessage: "ui.groupForm.button.create" }))) }, rest),
193
+ React.createElement(React.Fragment, null,
194
+ React.createElement(React.Fragment, null,
195
+ React.createElement(Paper, { style: _backgroundCover, classes: { root: classes.cover } },
196
+ React.createElement(Box, { className: classes.avatar },
197
+ React.createElement(Avatar, null, field.imageOriginal ? React.createElement("img", { src: field.imageOriginal, alt: "avatar" }) : React.createElement(Icon, null, "icon_image"))),
198
+ React.createElement(React.Fragment, null,
199
+ React.createElement(ChangeGroupPicture, { isCreationMode: true, onChange: handleChangeAvatar }),
200
+ React.createElement(ChangeGroupCover, { isCreationMode: true, onChange: handleChangeCover }))),
201
+ React.createElement(Typography, { className: classNames(classes.header, { [classes.error]: error.emotionalImageOriginalError || error.imageOriginalError }), align: "center" }, error.emotionalImageOriginalError || error.imageOriginalError ? (React.createElement(FormattedMessage, { id: "ui.groupForm.header.error", defaultMessage: "ui.groupForm.header.error" })) : (React.createElement(FormattedMessage, { id: "ui.groupForm.header", defaultMessage: "ui.groupForm.header" })))),
202
+ React.createElement(FormGroup, { className: classes.form },
203
+ React.createElement(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
204
+ endAdornment: React.createElement(Typography, { variant: "body2" }, GROUP_TITLE_MAX_LENGTH - field.name.length)
205
+ } }),
206
+ React.createElement(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
207
+ endAdornment: React.createElement(Typography, { variant: "body2" }, GROUP_DESCRIPTION_MAX_LENGTH - field.description.length)
208
+ } }),
209
+ React.createElement(Box, { className: classes.privacySection },
210
+ React.createElement(Typography, { variant: "h4" },
211
+ React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.title", defaultMessage: "ui.groupForm.privacy.title", values: { b: (chunks) => React.createElement("strong", null, chunks) } })),
212
+ React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
213
+ React.createElement(Typography, { className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) },
214
+ React.createElement(Icon, null, "private"),
215
+ React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.private", defaultMessage: "ui.groupForm.privacy.private" })),
216
+ React.createElement(Switch, { className: classes.switch, checked: field.isPublic, onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))) }),
217
+ React.createElement(Typography, { className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) },
218
+ React.createElement(Icon, null, "public"),
219
+ React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.public", defaultMessage: "ui.groupForm.privacy.public" }))),
220
+ React.createElement(Typography, { variant: "body2", className: classes.privacySectionInfo }, field.isPublic ? (React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.public.info", defaultMessage: "ui.groupForm.privacy.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })) : (React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.private.info", defaultMessage: "ui.groupForm.private.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))),
221
+ React.createElement(Box, { className: classes.visibilitySection }, !field.isPublic && (React.createElement(React.Fragment, null,
222
+ React.createElement(Typography, { variant: "h4" },
223
+ React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.title", defaultMessage: "ui.groupForm.visibility.title", values: { b: (chunks) => React.createElement("strong", null, chunks) } })),
224
+ React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
225
+ React.createElement(Typography, { className: classNames(classes.switchLabel, { [classes.active]: !field.isVisible }) },
226
+ React.createElement(Icon, null, "visibility_off"),
227
+ React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.hidden", defaultMessage: "ui.groupForm.visibility.hidden" })),
228
+ React.createElement(Switch, { className: classes.switch, checked: field.isVisible, onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isVisible']: !field.isVisible }))) }),
229
+ React.createElement(Typography, { className: classNames(classes.switchLabel, { [classes.active]: field.isVisible }) },
230
+ React.createElement(Icon, null, "visibility"),
231
+ React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.visible", defaultMessage: "ui.groupForm.visibility.visible" }))),
232
+ React.createElement(Typography, { variant: "body2", className: classes.visibilitySectionInfo }, !field.isVisible ? (React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.hidden.info", defaultMessage: "ui.groupForm.visibility.hidden.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })) : (React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.visible.info", defaultMessage: "ui.groupForm.visibility.visible.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } }))))))),
233
+ React.createElement(Divider, null),
234
+ React.createElement(Box, { className: classes.inviteSection },
235
+ React.createElement(GroupInviteButton, { handleInvitations: handleInviteSection })))));
236
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCGroupForm";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCGroupForm';
@@ -0,0 +1,3 @@
1
+ import GroupForm, { GroupFormProps } from './GroupForm';
2
+ export default GroupForm;
3
+ export { GroupFormProps };
@@ -0,0 +1,2 @@
1
+ import GroupForm from './GroupForm';
2
+ export default GroupForm;
@@ -0,0 +1,84 @@
1
+ import { SCGroupType } from '@selfcommunity/types';
2
+ import { ChangeGroupCoverProps } from '../ChangeGroupCover';
3
+ import { ChangeGroupPictureProps } from '../ChangeGroupPicture';
4
+ import { GroupMembersButtonProps } from '../GroupMembersButton';
5
+ import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
6
+ export interface GroupHeaderProps {
7
+ /**
8
+ * Id of group object
9
+ * @default null
10
+ */
11
+ id?: string;
12
+ /**
13
+ * Overrides or extends the styles applied to the component.
14
+ * @default null
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Group Object
19
+ * @default null
20
+ */
21
+ group?: SCGroupType;
22
+ /**
23
+ * Id of the group
24
+ * @default null
25
+ */
26
+ groupId?: number;
27
+ /**
28
+ * Props to spread change picture button
29
+ * @default {}
30
+ */
31
+ ChangePictureProps?: ChangeGroupPictureProps;
32
+ /**
33
+ * Props to spread change cover button
34
+ * @default {}
35
+ */
36
+ ChangeCoverProps?: ChangeGroupCoverProps;
37
+ /**
38
+ * Props to spread category button followed
39
+ * @default {}
40
+ */
41
+ GroupSubscribeButtonProps?: Pick<GroupSubscribeButtonProps, Exclude<keyof GroupSubscribeButtonProps, 'group' | 'onSubscribe'>>;
42
+ /**
43
+ * Props to spread to the group memebers button
44
+ * @default {}
45
+ */
46
+ GroupMembersButtonProps?: GroupMembersButtonProps;
47
+ /**
48
+ * Any other properties
49
+ */
50
+ [p: string]: any;
51
+ }
52
+ /**
53
+ * > API documentation for the Community-JS Group Header component. Learn about the available props and the CSS API.
54
+ *
55
+ *
56
+ * This component renders the groups top section.
57
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/UserProfileHeader)
58
+
59
+ #### Import
60
+
61
+ ```jsx
62
+ import {UserProfileHeader} from '@selfcommunity/react-ui';
63
+ ```
64
+
65
+ #### Component Name
66
+
67
+ The name `SCGroupHeader` can be used when providing style overrides in the theme.
68
+
69
+
70
+ #### CSS
71
+
72
+ |Rule Name|Global class|Description|
73
+ |---|---|---|
74
+ |root|.SCGroupHeader-root|Styles applied to the root element.|
75
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
76
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
77
+ |info|SCGroupHeader-info|Styles applied to the info section.|
78
+ |name|SCGroupHeader-username|Styles applied to the username element.|
79
+ |changePicture|.SCGroupHeader-change-picture|Styles applied to changePicture element.|
80
+ |changeCover|.SCGroupHeader-change-cover`|Styles applied to changeCover element.|
81
+
82
+ * @param inProps
83
+ */
84
+ export default function GroupHeader(inProps: GroupHeaderProps): JSX.Element;
@@ -0,0 +1,144 @@
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
+ import EditGroupButton from '../EditGroupButton';
17
+ import GroupSubscribeButton from '../GroupSubscribeButton';
18
+ import GroupInviteButton from '../GroupInviteButton';
19
+ const classes = {
20
+ root: `${PREFIX}-root`,
21
+ cover: `${PREFIX}-cover`,
22
+ avatar: `${PREFIX}-avatar`,
23
+ info: `${PREFIX}-info`,
24
+ name: `${PREFIX}-name`,
25
+ changePicture: `${PREFIX}-change-picture`,
26
+ changeCover: `${PREFIX}-change-cover`,
27
+ visibility: `${PREFIX}-visibility`,
28
+ visibilityItem: `${PREFIX}-visibility-item`,
29
+ members: `${PREFIX}-members`,
30
+ membersCounter: `${PREFIX}-members-counter`
31
+ };
32
+ const Root = styled(Box, {
33
+ name: PREFIX,
34
+ slot: 'Root'
35
+ })(() => ({}));
36
+ /**
37
+ * > API documentation for the Community-JS Group Header component. Learn about the available props and the CSS API.
38
+ *
39
+ *
40
+ * This component renders the groups top section.
41
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/UserProfileHeader)
42
+
43
+ #### Import
44
+
45
+ ```jsx
46
+ import {UserProfileHeader} from '@selfcommunity/react-ui';
47
+ ```
48
+
49
+ #### Component Name
50
+
51
+ The name `SCGroupHeader` can be used when providing style overrides in the theme.
52
+
53
+
54
+ #### CSS
55
+
56
+ |Rule Name|Global class|Description|
57
+ |---|---|---|
58
+ |root|.SCGroupHeader-root|Styles applied to the root element.|
59
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
60
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
61
+ |info|SCGroupHeader-info|Styles applied to the info section.|
62
+ |name|SCGroupHeader-username|Styles applied to the username element.|
63
+ |changePicture|.SCGroupHeader-change-picture|Styles applied to changePicture element.|
64
+ |changeCover|.SCGroupHeader-change-cover`|Styles applied to changeCover element.|
65
+
66
+ * @param inProps
67
+ */
68
+ export default function GroupHeader(inProps) {
69
+ var _a;
70
+ // PROPS
71
+ const props = useThemeProps({
72
+ props: inProps,
73
+ name: PREFIX
74
+ });
75
+ const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {} } = props, rest = __rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps"]);
76
+ // PREFERENCES
77
+ const scPreferences = useSCPreferences();
78
+ // CONTEXT
79
+ const scUserContext = useSCUser();
80
+ // HOOKS
81
+ const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
82
+ // CONST
83
+ const isGroupAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
84
+ /**
85
+ * Handles Change Avatar
86
+ * @param avatar
87
+ */
88
+ function handleChangeAvatar(avatar) {
89
+ if (isGroupAdmin) {
90
+ setSCGroup(Object.assign({}, scGroup, { image_bigger: avatar }));
91
+ }
92
+ }
93
+ /**
94
+ * Handles Change Cover
95
+ * @param cover
96
+ */
97
+ function handleChangeCover(cover) {
98
+ if (isGroupAdmin) {
99
+ setSCGroup(Object.assign({}, scGroup, { emotional_image: cover }));
100
+ }
101
+ }
102
+ /**
103
+ * Handles callback subscribe/unsubscribe group
104
+ */
105
+ const handleSubscribe = (group, status) => {
106
+ setSCGroup(Object.assign(Object.assign({}, group), { subscribers_counter: group.subscribers_counter + (status ? 1 : -1) }));
107
+ };
108
+ // RENDER
109
+ if (!scGroup) {
110
+ return React.createElement(GroupHeaderSkeleton, null);
111
+ }
112
+ const _backgroundCover = Object.assign({}, (scGroup.emotional_image
113
+ ? { background: `url('${scGroup.emotional_image}') center / cover` }
114
+ : { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
115
+ return (React.createElement(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest),
116
+ React.createElement(Paper, { style: _backgroundCover, classes: { root: classes.cover } },
117
+ React.createElement(Box, { className: classes.avatar },
118
+ React.createElement(Avatar, null,
119
+ React.createElement("img", { alt: "group", src: scGroup.image_bigger ? scGroup.image_bigger : '' }))),
120
+ isGroupAdmin && (React.createElement(React.Fragment, null,
121
+ React.createElement(ChangeGroupPicture, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)),
122
+ React.createElement("div", { className: classes.changeCover },
123
+ React.createElement(ChangeGroupCover, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)))))),
124
+ React.createElement(Box, { className: classes.info },
125
+ isGroupAdmin && React.createElement(EditGroupButton, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }),
126
+ React.createElement(Typography, { variant: "h5", className: classes.name }, scGroup.name),
127
+ React.createElement(Box, { className: classes.visibility },
128
+ scGroup.privacy === SCGroupPrivacyType.PUBLIC ? (React.createElement(Typography, { className: classes.visibilityItem },
129
+ React.createElement(Icon, null, "public"),
130
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
131
+ React.createElement(Icon, null, "private"),
132
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" }))),
133
+ React.createElement(Bullet, null),
134
+ scGroup.visible ? (React.createElement(Typography, { className: classes.visibilityItem },
135
+ React.createElement(Icon, null, "visibility"),
136
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
137
+ React.createElement(Icon, null, "visibility_off"),
138
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })))),
139
+ React.createElement(React.Fragment, null, ((scGroup && scGroup.privacy === SCGroupPrivacyType.PUBLIC) || isGroupAdmin) && (React.createElement(Box, { className: classes.members },
140
+ React.createElement(Typography, { className: classes.membersCounter, component: "div" },
141
+ React.createElement(FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } })),
142
+ React.createElement(GroupMembersButton, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps))))),
143
+ isGroupAdmin ? (React.createElement(GroupInviteButton, { group: scGroup, groupId: scGroup.id })) : (React.createElement(GroupSubscribeButton, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps))))));
144
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * > API documentation for the Community-JS Group Header 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
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
22
+ *
23
+ */
24
+ declare function GroupHeaderSkeleton(): JSX.Element;
25
+ 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
+ info: `${PREFIX}-info`
11
+ };
12
+ const Root = styled(Box, {
13
+ name: PREFIX,
14
+ slot: 'SkeletonRoot'
15
+ })(() => ({}));
16
+ /**
17
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
18
+
19
+ #### Import
20
+
21
+ ```jsx
22
+ import {GroupHeaderSkeleton} from '@selfcommunity/react-ui';
23
+ ```
24
+
25
+ #### Component Name
26
+
27
+ The name `SCGroupHeader-skeleton-root` can be used when providing style overrides in the theme.
28
+
29
+ #### CSS
30
+
31
+ |Rule Name|Global class|Description|
32
+ |---|---|---|
33
+ |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
34
+ |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
35
+ |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
36
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
37
+ *
38
+ */
39
+ function GroupHeaderSkeleton() {
40
+ const theme = useTheme();
41
+ return (React.createElement(Root, { className: classes.root },
42
+ React.createElement(Skeleton, { className: classes.cover, animation: "wave", variant: "rectangular" }),
43
+ React.createElement(Box, { className: classes.avatar },
44
+ React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeLarge, height: theme.selfcommunity.group.avatar.sizeLarge })),
45
+ React.createElement(Box, { className: classes.info },
46
+ React.createElement(Typography, { variant: "h5" },
47
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 30, width: 200 } })),
48
+ React.createElement(Typography, null,
49
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 20, width: 150 } })),
50
+ React.createElement(Typography, null,
51
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 20, 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;