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

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 (155) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +3 -1
  2. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +24 -1
  3. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +32 -11
  4. package/lib/cjs/components/Composer/Attributes/Attributes.d.ts +1 -1
  5. package/lib/cjs/components/Composer/Attributes/Attributes.js +9 -2
  6. package/lib/cjs/components/Composer/Composer.d.ts +2 -1
  7. package/lib/cjs/components/Composer/Composer.js +39 -12
  8. package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
  9. package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  10. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
  11. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +46 -12
  12. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +2 -2
  13. package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +5 -6
  14. package/lib/cjs/components/CustomAdv/CustomAdv.d.ts +4 -0
  15. package/lib/cjs/components/{CreateGroup/CreateGroup.d.ts → EditGroupButton/EditGroupButton.d.ts} +11 -16
  16. package/lib/cjs/components/EditGroupButton/EditGroupButton.js +61 -0
  17. package/lib/cjs/components/EditGroupButton/index.d.ts +3 -0
  18. package/lib/cjs/components/EditGroupButton/index.js +5 -0
  19. package/lib/cjs/components/FeedObject/FeedObject.d.ts +1 -0
  20. package/lib/cjs/components/FeedObject/FeedObject.js +23 -6
  21. package/lib/cjs/components/Group/Group.d.ts +4 -3
  22. package/lib/cjs/components/Group/Group.js +5 -4
  23. package/lib/cjs/components/Group/Skeleton.js +1 -1
  24. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
  25. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +101 -0
  26. package/lib/cjs/components/GroupAutocomplete/index.d.ts +3 -0
  27. package/lib/cjs/components/GroupAutocomplete/index.js +5 -0
  28. package/lib/cjs/components/GroupForm/GroupForm.d.ts +70 -0
  29. package/lib/cjs/components/GroupForm/GroupForm.js +239 -0
  30. package/lib/cjs/components/GroupForm/constants.d.ts +1 -0
  31. package/lib/cjs/components/{CreateGroup → GroupForm}/constants.js +1 -1
  32. package/lib/cjs/components/GroupForm/index.d.ts +3 -0
  33. package/lib/cjs/components/GroupForm/index.js +5 -0
  34. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -5
  35. package/lib/cjs/components/GroupHeader/GroupHeader.js +21 -11
  36. package/lib/cjs/components/GroupHeader/Skeleton.d.ts +2 -4
  37. package/lib/cjs/components/GroupHeader/Skeleton.js +10 -10
  38. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +8 -8
  39. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +9 -6
  40. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
  41. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +3 -2
  42. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +37 -14
  43. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +0 -5
  44. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +17 -7
  45. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
  46. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +132 -0
  47. package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
  48. package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
  49. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +8 -3
  50. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +26 -9
  51. package/lib/cjs/components/Groups/Groups.d.ts +65 -0
  52. package/lib/cjs/components/Groups/Groups.js +135 -0
  53. package/lib/cjs/components/Groups/Skeleton.d.ts +34 -0
  54. package/lib/cjs/components/Groups/Skeleton.js +45 -0
  55. package/lib/cjs/components/Groups/constants.d.ts +1 -0
  56. package/lib/cjs/components/Groups/constants.js +4 -0
  57. package/lib/cjs/components/Groups/index.d.ts +4 -0
  58. package/lib/cjs/components/Groups/index.js +8 -0
  59. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +2 -1
  60. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
  61. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
  62. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
  63. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
  64. package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +1 -1
  65. package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.js +10 -7
  66. package/lib/cjs/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
  67. package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +3 -3
  68. package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +24 -6
  69. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
  70. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +45 -20
  71. package/lib/cjs/index.d.ts +7 -3
  72. package/lib/cjs/index.js +14 -4
  73. package/lib/esm/components/BottomNavigation/BottomNavigation.js +3 -1
  74. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +24 -1
  75. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +32 -11
  76. package/lib/esm/components/Composer/Attributes/Attributes.d.ts +1 -1
  77. package/lib/esm/components/Composer/Attributes/Attributes.js +9 -2
  78. package/lib/esm/components/Composer/Composer.d.ts +2 -1
  79. package/lib/esm/components/Composer/Composer.js +39 -12
  80. package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
  81. package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  82. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
  83. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +45 -12
  84. package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +2 -2
  85. package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +5 -6
  86. package/lib/esm/components/CustomAdv/CustomAdv.d.ts +4 -0
  87. package/lib/esm/components/{CreateGroup/CreateGroup.d.ts → EditGroupButton/EditGroupButton.d.ts} +11 -16
  88. package/lib/esm/components/EditGroupButton/EditGroupButton.js +58 -0
  89. package/lib/esm/components/EditGroupButton/index.d.ts +3 -0
  90. package/lib/esm/components/EditGroupButton/index.js +2 -0
  91. package/lib/esm/components/FeedObject/FeedObject.d.ts +1 -0
  92. package/lib/esm/components/FeedObject/FeedObject.js +24 -7
  93. package/lib/esm/components/Group/Group.d.ts +4 -3
  94. package/lib/esm/components/Group/Group.js +5 -4
  95. package/lib/esm/components/Group/Skeleton.js +1 -1
  96. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
  97. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +99 -0
  98. package/lib/esm/components/GroupAutocomplete/index.d.ts +3 -0
  99. package/lib/esm/components/GroupAutocomplete/index.js +2 -0
  100. package/lib/esm/components/GroupForm/GroupForm.d.ts +70 -0
  101. package/lib/esm/components/GroupForm/GroupForm.js +236 -0
  102. package/lib/esm/components/GroupForm/constants.d.ts +1 -0
  103. package/lib/esm/components/GroupForm/constants.js +1 -0
  104. package/lib/esm/components/GroupForm/index.d.ts +3 -0
  105. package/lib/esm/components/GroupForm/index.js +2 -0
  106. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -5
  107. package/lib/esm/components/GroupHeader/GroupHeader.js +21 -11
  108. package/lib/esm/components/GroupHeader/Skeleton.d.ts +2 -4
  109. package/lib/esm/components/GroupHeader/Skeleton.js +10 -10
  110. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +8 -8
  111. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +9 -6
  112. package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
  113. package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +4 -3
  114. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +39 -16
  115. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +0 -5
  116. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +17 -7
  117. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
  118. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +129 -0
  119. package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
  120. package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
  121. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +8 -3
  122. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +27 -10
  123. package/lib/esm/components/Groups/Groups.d.ts +65 -0
  124. package/lib/esm/components/Groups/Groups.js +132 -0
  125. package/lib/esm/components/Groups/Skeleton.d.ts +34 -0
  126. package/lib/esm/components/Groups/Skeleton.js +42 -0
  127. package/lib/esm/components/Groups/constants.d.ts +1 -0
  128. package/lib/esm/components/Groups/constants.js +1 -0
  129. package/lib/esm/components/Groups/index.d.ts +4 -0
  130. package/lib/esm/components/Groups/index.js +4 -0
  131. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +2 -1
  132. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
  133. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
  134. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
  135. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
  136. package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +1 -1
  137. package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.js +11 -8
  138. package/lib/esm/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
  139. package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +3 -3
  140. package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +26 -8
  141. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
  142. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +47 -22
  143. package/lib/esm/index.d.ts +7 -3
  144. package/lib/esm/index.js +8 -4
  145. package/lib/umd/react-ui.js +1 -1
  146. package/package.json +6 -6
  147. package/lib/cjs/components/CreateGroup/CreateGroup.js +0 -187
  148. package/lib/cjs/components/CreateGroup/constants.d.ts +0 -1
  149. package/lib/cjs/components/CreateGroup/index.d.ts +0 -3
  150. package/lib/cjs/components/CreateGroup/index.js +0 -5
  151. package/lib/esm/components/CreateGroup/CreateGroup.js +0 -184
  152. package/lib/esm/components/CreateGroup/constants.d.ts +0 -1
  153. package/lib/esm/components/CreateGroup/constants.js +0 -1
  154. package/lib/esm/components/CreateGroup/index.d.ts +0 -3
  155. package/lib/esm/components/CreateGroup/index.js +0 -2
@@ -0,0 +1,99 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useEffect, useState } from 'react';
3
+ import { FormattedMessage } from 'react-intl';
4
+ import Autocomplete from '@mui/material/Autocomplete';
5
+ import TextField from '@mui/material/TextField';
6
+ import CircularProgress from '@mui/material/CircularProgress';
7
+ import parse from 'autosuggest-highlight/parse';
8
+ import match from 'autosuggest-highlight/match';
9
+ import { Avatar, Box, Typography } from '@mui/material';
10
+ import { useSCFetchGroups } from '@selfcommunity/react-core';
11
+ import { styled } from '@mui/material/styles';
12
+ import { useThemeProps } from '@mui/system';
13
+ const PREFIX = 'SCGroupAutocomplete';
14
+ const classes = {
15
+ root: `${PREFIX}-root`
16
+ };
17
+ const Root = styled(Autocomplete, {
18
+ name: PREFIX,
19
+ slot: 'Root',
20
+ overridesResolver: (props, styles) => styles.root
21
+ })(() => ({}));
22
+ /**
23
+ * > API documentation for the Community-JS Group Autocomplete component. Learn about the available props and the CSS API.
24
+ *
25
+ *
26
+ * This component renders a bar that allows users to search (with autocomplete) for all the groups available in the application.
27
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupAutocomplete)
28
+ *
29
+ * #### Import
30
+ * ```jsx
31
+ * import {GroupAutocomplete} from '@selfcommunity/react-ui';
32
+ * ```
33
+ * #### Component Name
34
+ * The name `SCGroupAutocomplete` can be used when providing style overrides in the theme.
35
+ *
36
+ * #### CSS
37
+ *
38
+ * |Rule Name|Global class|Description|
39
+ * |---|---|---|
40
+ * |root|.SCGroupAutocomplete-root|Styles applied to the root element.|
41
+ *
42
+ * @param inProps
43
+ */
44
+ const GroupAutocomplete = (inProps) => {
45
+ const props = useThemeProps({
46
+ props: inProps,
47
+ name: PREFIX
48
+ });
49
+ // Props
50
+ const { onChange, defaultValue = null, disabled = false, TextFieldProps = {
51
+ variant: 'outlined',
52
+ label: React.createElement(FormattedMessage, { id: "ui.groupAutocomplete.label", defaultMessage: "ui.groupAutocomplete.label" })
53
+ } } = props, rest = __rest(props, ["onChange", "defaultValue", "disabled", "TextFieldProps"]);
54
+ // State
55
+ const [open, setOpen] = useState(false);
56
+ const [value, setValue] = useState(typeof defaultValue === 'string' ? null : defaultValue);
57
+ // HOOKS
58
+ const { groups, isLoading } = useSCFetchGroups();
59
+ useEffect(() => {
60
+ if (value === null) {
61
+ return;
62
+ }
63
+ onChange && onChange(value);
64
+ }, [value]);
65
+ useEffect(() => {
66
+ if (!isLoading && typeof defaultValue === 'string') {
67
+ setValue(groups.find((g) => g.id === Number(defaultValue)));
68
+ }
69
+ }, [isLoading]);
70
+ // Handlers
71
+ const handleOpen = () => {
72
+ setOpen(true);
73
+ };
74
+ const handleClose = () => {
75
+ setOpen(false);
76
+ };
77
+ const handleChange = (event, value) => {
78
+ setValue(value);
79
+ };
80
+ // Render
81
+ return (React.createElement(Root, Object.assign({ freeSolo: true, className: classes.root, open: open, onOpen: handleOpen, onClose: handleClose, options: groups || [], getOptionLabel: (option) => option.name || '', value: value, selectOnFocus: true, clearOnBlur: true, blurOnSelect: true, handleHomeEndKeys: true, clearIcon: null, disabled: disabled || isLoading, noOptionsText: React.createElement(FormattedMessage, { id: "ui.groupAutocomplete.empty", defaultMessage: "ui.groupAutocomplete.empty" }), onChange: handleChange, isOptionEqualToValue: (option, value) => value.id === option.id,
82
+ // renderTags={(value, getTagProps) => {
83
+ // return value.map((option: any, index) => (
84
+ // <Chip key={option.id} id={option.id} label={option.name} color={option.color} {...getTagProps({index})} />
85
+ // ));
86
+ // }}
87
+ renderOption: (props, option, { inputValue }) => {
88
+ const matches = match(option.name, inputValue);
89
+ const parts = parse(option.name, matches);
90
+ return (React.createElement(Box, Object.assign({ component: "li" }, props),
91
+ React.createElement(Avatar, { alt: option.name, src: option.image_small, sx: { marginRight: 1 } }),
92
+ React.createElement(React.Fragment, null, parts.map((part, index) => (React.createElement(Typography, { key: index, sx: { fontWeight: part.highlight ? 700 : 400, marginRight: 0.2 } }, part.text))))));
93
+ }, renderInput: (params) => {
94
+ return (React.createElement(TextField, Object.assign({}, params, TextFieldProps, { margin: "dense", InputProps: Object.assign(Object.assign({}, params.InputProps), { autoComplete: 'groups', endAdornment: (React.createElement(React.Fragment, null,
95
+ isLoading ? React.createElement(CircularProgress, { color: "inherit", size: 20 }) : null,
96
+ params.InputProps.endAdornment)) }) })));
97
+ } }, rest)));
98
+ };
99
+ export default GroupAutocomplete;
@@ -0,0 +1,3 @@
1
+ import GroupAutocomplete, { GroupAutocompleteProps } from './GroupAutocomplete';
2
+ export default GroupAutocomplete;
3
+ export { GroupAutocompleteProps };
@@ -0,0 +1,2 @@
1
+ import GroupAutocomplete from './GroupAutocomplete';
2
+ export default GroupAutocomplete;
@@ -0,0 +1,70 @@
1
+ import { BaseDialogProps } from '../../shared/BaseDialog';
2
+ import { SCGroupType } from '@selfcommunity/types';
3
+ export interface GroupFormProps extends BaseDialogProps {
4
+ /**
5
+ * Overrides or extends the styles applied to the component.
6
+ * @default null
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Open dialog
11
+ * @default true
12
+ */
13
+ open?: boolean;
14
+ /**
15
+ * On dialog close callback function
16
+ * @default null
17
+ */
18
+ onClose?: () => void;
19
+ /**
20
+ * Group Object
21
+ * @default null
22
+ */
23
+ group?: SCGroupType;
24
+ /**
25
+ * On success callback function
26
+ * @default null
27
+ */
28
+ onSuccess?: (data: SCGroupType) => void;
29
+ /**
30
+ * Any other properties
31
+ */
32
+ [p: string]: any;
33
+ }
34
+ /**
35
+ *> API documentation for the Community-JS Group Form component. Learn about the available props and the CSS API.
36
+ *
37
+ #### Import
38
+ ```jsx
39
+ import {GroupForm} from '@selfcommunity/react-ui';
40
+ ```
41
+
42
+ #### Component Name
43
+ The name `SCGroupForm` can be used when providing style overrides in the theme.
44
+
45
+ #### CSS
46
+
47
+ |Rule Name|Global class|Description|
48
+ |---|---|---|
49
+ |root|.SCGroupForm-root|Styles applied to the root element.|
50
+ |active|.SCGroupForm-active|Styles applied to the active element.|
51
+ |title|.SCGroupForm-title|Styles applied to the title element.|
52
+ |header|.SCGroupForm-header|Styles applied to the header element.|
53
+ |cover|.SCGroupForm-cover|Styles applied to the cover field.|
54
+ |avatar|.SCGroupForm-avatar|Styles applied to the avatar field.|
55
+ |form|.SCGroupForm-form|Styles applied to the form element.|
56
+ |switch|.SCGroupForm-switch|Styles applied to the switch element.|
57
+ |switchLabel|.SCGroupForm-switch-label|Styles applied to the switchLabel element.|
58
+ |name|.SCGroupForm-name|Styles applied to the name field.|
59
+ |description|.SCGroupForm-description|Styles applied to the description field.|
60
+ |content|.SCGroupForm-content|Styles applied to the element.|
61
+ |privacySection|.SCGroupForm-privacy-section|Styles applied to the privacy section.|
62
+ |privacySectionInfo|.SCGroupForm-privacy-section-info|Styles applied to the privacy info section.|
63
+ |visibilitySection|.SCGroupForm-visibility-section|Styles applied to the visibility section.|
64
+ |visibilitySectionInfo|.SCGroupForm-visibility-section-info|Styles applied to the visibility section info.|
65
+ |inviteSection|.SCGroupForm-invite-section|Styles applied to the invite section.|
66
+ |error|.SCGroupForm-error|Styles applied to the error elements.|
67
+
68
+ * @param inProps
69
+ */
70
+ export default function GroupForm(inProps: GroupFormProps): JSX.Element;
@@ -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
+ (!group || (group && group.privacy !== SCGroupPrivacyType.PRIVATE)) && (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 && !group) || (group && !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;
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
1
  import { SCGroupType } from '@selfcommunity/types';
3
2
  import { ChangeGroupCoverProps } from '../ChangeGroupCover';
4
3
  import { ChangeGroupPictureProps } from '../ChangeGroupPicture';
5
4
  import { GroupMembersButtonProps } from '../GroupMembersButton';
5
+ import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
6
6
  export interface GroupHeaderProps {
7
7
  /**
8
8
  * Id of group object
@@ -35,14 +35,15 @@ export interface GroupHeaderProps {
35
35
  */
36
36
  ChangeCoverProps?: ChangeGroupCoverProps;
37
37
  /**
38
- * Props to spread to the group memebers button
38
+ * Props to spread group button followed
39
39
  * @default {}
40
40
  */
41
- GroupMembersButtonProps?: GroupMembersButtonProps;
41
+ GroupSubscribeButtonProps?: GroupSubscribeButtonProps;
42
42
  /**
43
- *
43
+ * Props to spread to the group memebers button
44
+ * @default {}
44
45
  */
45
- actions?: React.ReactNode;
46
+ GroupMembersButtonProps?: GroupMembersButtonProps;
46
47
  /**
47
48
  * Any other properties
48
49
  */
@@ -13,6 +13,9 @@ import { FormattedMessage } from 'react-intl';
13
13
  import Bullet from '../../shared/Bullet';
14
14
  import ChangeGroupPicture from '../ChangeGroupPicture';
15
15
  import GroupMembersButton from '../GroupMembersButton';
16
+ import EditGroupButton from '../EditGroupButton';
17
+ import GroupSubscribeButton from '../GroupSubscribeButton';
18
+ import GroupInviteButton from '../GroupInviteButton';
16
19
  const classes = {
17
20
  root: `${PREFIX}-root`,
18
21
  cover: `${PREFIX}-cover`,
@@ -63,13 +66,13 @@ const Root = styled(Box, {
63
66
  * @param inProps
64
67
  */
65
68
  export default function GroupHeader(inProps) {
66
- var _a, _b;
69
+ var _a;
67
70
  // PROPS
68
71
  const props = useThemeProps({
69
72
  props: inProps,
70
73
  name: PREFIX
71
74
  });
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"]);
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"]);
73
76
  // PREFERENCES
74
77
  const scPreferences = useSCPreferences();
75
78
  // CONTEXT
@@ -77,14 +80,14 @@ export default function GroupHeader(inProps) {
77
80
  // HOOKS
78
81
  const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
79
82
  // 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]);
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]);
81
84
  /**
82
85
  * Handles Change Avatar
83
86
  * @param avatar
84
87
  */
85
88
  function handleChangeAvatar(avatar) {
86
- if (canEdit) {
87
- setSCGroup(Object.assign({}, scGroup, { image_bigger: avatar }));
89
+ if (isGroupAdmin) {
90
+ setSCGroup(Object.assign({}, scGroup, { image_big: avatar }));
88
91
  }
89
92
  }
90
93
  /**
@@ -92,10 +95,16 @@ export default function GroupHeader(inProps) {
92
95
  * @param cover
93
96
  */
94
97
  function handleChangeCover(cover) {
95
- if (canEdit) {
98
+ if (isGroupAdmin) {
96
99
  setSCGroup(Object.assign({}, scGroup, { emotional_image: cover }));
97
100
  }
98
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
+ };
99
108
  // RENDER
100
109
  if (!scGroup) {
101
110
  return React.createElement(GroupHeaderSkeleton, null);
@@ -107,12 +116,13 @@ export default function GroupHeader(inProps) {
107
116
  React.createElement(Paper, { style: _backgroundCover, classes: { root: classes.cover } },
108
117
  React.createElement(Box, { className: classes.avatar },
109
118
  React.createElement(Avatar, null,
110
- React.createElement("img", { alt: "group", src: scGroup.image_bigger ? scGroup.image_bigger : '' }))),
111
- canEdit && (React.createElement(React.Fragment, null,
119
+ React.createElement("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }))),
120
+ isGroupAdmin && (React.createElement(React.Fragment, null,
112
121
  React.createElement(ChangeGroupPicture, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)),
113
122
  React.createElement("div", { className: classes.changeCover },
114
123
  React.createElement(ChangeGroupCover, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)))))),
115
124
  React.createElement(Box, { className: classes.info },
125
+ isGroupAdmin && React.createElement(EditGroupButton, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }),
116
126
  React.createElement(Typography, { variant: "h5", className: classes.name }, scGroup.name),
117
127
  React.createElement(Box, { className: classes.visibility },
118
128
  scGroup.privacy === SCGroupPrivacyType.PUBLIC ? (React.createElement(Typography, { className: classes.visibilityItem },
@@ -126,9 +136,9 @@ export default function GroupHeader(inProps) {
126
136
  React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
127
137
  React.createElement(Icon, null, "visibility_off"),
128
138
  React.createElement(FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })))),
129
- React.createElement(Box, { className: classes.members },
139
+ React.createElement(React.Fragment, null, ((scGroup && scGroup.privacy === SCGroupPrivacyType.PUBLIC) || isGroupAdmin) && (React.createElement(Box, { className: classes.members },
130
140
  React.createElement(Typography, { className: classes.membersCounter, component: "div" },
131
141
  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)));
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))))));
134
144
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
2
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
3
3
 
4
4
  #### Import
5
5
 
@@ -18,9 +18,7 @@
18
18
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
19
19
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
20
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.|
21
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
24
22
  *
25
23
  */
26
24
  declare function GroupHeaderSkeleton(): JSX.Element;
@@ -7,16 +7,14 @@ const classes = {
7
7
  root: `${PREFIX}-skeleton-root`,
8
8
  cover: `${PREFIX}-cover`,
9
9
  avatar: `${PREFIX}-avatar`,
10
- actions: `${PREFIX}-actions`,
11
- section: `${PREFIX}-section`,
12
- username: `${PREFIX}-username`
10
+ info: `${PREFIX}-info`
13
11
  };
14
12
  const Root = styled(Box, {
15
13
  name: PREFIX,
16
14
  slot: 'SkeletonRoot'
17
15
  })(() => ({}));
18
16
  /**
19
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
17
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
20
18
 
21
19
  #### Import
22
20
 
@@ -35,9 +33,7 @@ const Root = styled(Box, {
35
33
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
36
34
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
37
35
  |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.|
36
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
41
37
  *
42
38
  */
43
39
  function GroupHeaderSkeleton() {
@@ -46,8 +42,12 @@ function GroupHeaderSkeleton() {
46
42
  React.createElement(Skeleton, { className: classes.cover, animation: "wave", variant: "rectangular" }),
47
43
  React.createElement(Box, { className: classes.avatar },
48
44
  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 } })))));
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
52
  }
53
53
  export default GroupHeaderSkeleton;