@selfcommunity/react-ui 0.7.9-alpha.0 → 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.
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +140 -0
- package/lib/cjs/components/ChangeGroupCover/constants.d.ts +1 -0
- package/lib/cjs/components/ChangeGroupCover/constants.js +4 -0
- package/lib/cjs/components/ChangeGroupCover/index.d.ts +3 -0
- package/lib/cjs/components/ChangeGroupCover/index.js +5 -0
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +135 -0
- package/lib/cjs/components/ChangeGroupPicture/constants.d.ts +1 -0
- package/lib/cjs/components/ChangeGroupPicture/constants.js +4 -0
- package/lib/cjs/components/ChangeGroupPicture/index.d.ts +3 -0
- package/lib/cjs/components/ChangeGroupPicture/index.js +5 -0
- package/lib/cjs/components/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/cjs/components/Composer/Attributes/Attributes.js +7 -0
- package/lib/cjs/components/Composer/Composer.d.ts +2 -1
- package/lib/cjs/components/Composer/Composer.js +39 -12
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +46 -12
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +72 -0
- package/lib/cjs/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/CreateGroupButton/index.js +5 -0
- package/lib/cjs/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/cjs/components/EditGroupButton/EditGroupButton.d.ts +43 -0
- package/lib/cjs/components/EditGroupButton/EditGroupButton.js +61 -0
- package/lib/cjs/components/EditGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/EditGroupButton/index.js +5 -0
- package/lib/cjs/components/Group/Group.d.ts +68 -0
- package/lib/cjs/components/Group/Group.js +96 -0
- package/lib/cjs/components/Group/Skeleton.d.ts +22 -0
- package/lib/cjs/components/Group/Skeleton.js +42 -0
- package/lib/cjs/components/Group/constants.d.ts +1 -0
- package/lib/cjs/components/Group/constants.js +4 -0
- package/lib/cjs/components/Group/index.d.ts +4 -0
- package/lib/cjs/components/Group/index.js +8 -0
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +101 -0
- package/lib/cjs/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/cjs/components/GroupAutocomplete/index.js +5 -0
- package/lib/cjs/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/cjs/components/GroupForm/GroupForm.js +239 -0
- package/lib/cjs/components/GroupForm/constants.d.ts +1 -0
- package/lib/cjs/components/GroupForm/constants.js +4 -0
- package/lib/cjs/components/GroupForm/index.d.ts +3 -0
- package/lib/cjs/components/GroupForm/index.js +5 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +84 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +147 -0
- package/lib/cjs/components/GroupHeader/Skeleton.d.ts +25 -0
- package/lib/cjs/components/GroupHeader/Skeleton.js +56 -0
- package/lib/cjs/components/GroupHeader/constants.d.ts +1 -0
- package/lib/cjs/components/GroupHeader/constants.js +4 -0
- package/lib/cjs/components/GroupHeader/index.d.ts +4 -0
- package/lib/cjs/components/GroupHeader/index.js +8 -0
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +100 -0
- package/lib/cjs/components/GroupInfoWidget/Skeleton.d.ts +21 -0
- package/lib/cjs/components/GroupInfoWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupInfoWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupInfoWidget/constants.js +4 -0
- package/lib/cjs/components/GroupInfoWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupInfoWidget/index.js +8 -0
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +262 -0
- package/lib/cjs/components/GroupInviteButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupInviteButton/index.js +5 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +51 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +136 -0
- package/lib/cjs/components/GroupMembersButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupMembersButton/index.js +5 -0
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +205 -0
- package/lib/cjs/components/GroupMembersWidget/Skeleton.d.ts +22 -0
- package/lib/cjs/components/GroupMembersWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupMembersWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupMembersWidget/constants.js +4 -0
- package/lib/cjs/components/GroupMembersWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupMembersWidget/index.js +8 -0
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +74 -0
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +203 -0
- package/lib/cjs/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
- package/lib/cjs/components/GroupRequestsWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupRequestsWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupRequestsWidget/constants.js +4 -0
- package/lib/cjs/components/GroupRequestsWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupRequestsWidget/index.js +8 -0
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +137 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +132 -0
- package/lib/cjs/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSubscribeButton/index.js +5 -0
- package/lib/cjs/components/Groups/Groups.d.ts +61 -0
- package/lib/cjs/components/Groups/Groups.js +128 -0
- package/lib/cjs/components/Groups/Skeleton.d.ts +34 -0
- package/lib/cjs/components/Groups/Skeleton.js +45 -0
- package/lib/cjs/components/Groups/constants.d.ts +1 -0
- package/lib/cjs/components/Groups/constants.js +4 -0
- package/lib/cjs/components/Groups/index.d.ts +4 -0
- package/lib/cjs/components/Groups/index.js +8 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -3
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +9 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +3 -4
- package/lib/cjs/components/User/User.d.ts +12 -0
- package/lib/cjs/components/User/User.js +5 -3
- package/lib/cjs/constants/Group.d.ts +2 -0
- package/lib/cjs/constants/Group.js +5 -0
- package/lib/cjs/index.d.ts +18 -2
- package/lib/cjs/index.js +44 -5
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +137 -0
- package/lib/esm/components/ChangeGroupCover/constants.d.ts +1 -0
- package/lib/esm/components/ChangeGroupCover/constants.js +1 -0
- package/lib/esm/components/ChangeGroupCover/index.d.ts +3 -0
- package/lib/esm/components/ChangeGroupCover/index.js +2 -0
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +132 -0
- package/lib/esm/components/ChangeGroupPicture/constants.d.ts +1 -0
- package/lib/esm/components/ChangeGroupPicture/constants.js +1 -0
- package/lib/esm/components/ChangeGroupPicture/index.d.ts +3 -0
- package/lib/esm/components/ChangeGroupPicture/index.js +2 -0
- package/lib/esm/components/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/esm/components/Composer/Attributes/Attributes.js +7 -0
- package/lib/esm/components/Composer/Composer.d.ts +2 -1
- package/lib/esm/components/Composer/Composer.js +39 -12
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +45 -12
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +69 -0
- package/lib/esm/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/esm/components/CreateGroupButton/index.js +2 -0
- package/lib/esm/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/esm/components/EditGroupButton/EditGroupButton.d.ts +43 -0
- package/lib/esm/components/EditGroupButton/EditGroupButton.js +58 -0
- package/lib/esm/components/EditGroupButton/index.d.ts +3 -0
- package/lib/esm/components/EditGroupButton/index.js +2 -0
- package/lib/esm/components/Group/Group.d.ts +68 -0
- package/lib/esm/components/Group/Group.js +93 -0
- package/lib/esm/components/Group/Skeleton.d.ts +22 -0
- package/lib/esm/components/Group/Skeleton.js +38 -0
- package/lib/esm/components/Group/constants.d.ts +1 -0
- package/lib/esm/components/Group/constants.js +1 -0
- package/lib/esm/components/Group/index.d.ts +4 -0
- package/lib/esm/components/Group/index.js +4 -0
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +99 -0
- package/lib/esm/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/esm/components/GroupAutocomplete/index.js +2 -0
- package/lib/esm/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/esm/components/GroupForm/GroupForm.js +236 -0
- package/lib/esm/components/GroupForm/constants.d.ts +1 -0
- package/lib/esm/components/GroupForm/constants.js +1 -0
- package/lib/esm/components/GroupForm/index.d.ts +3 -0
- package/lib/esm/components/GroupForm/index.js +2 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +84 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +144 -0
- package/lib/esm/components/GroupHeader/Skeleton.d.ts +25 -0
- package/lib/esm/components/GroupHeader/Skeleton.js +53 -0
- package/lib/esm/components/GroupHeader/constants.d.ts +1 -0
- package/lib/esm/components/GroupHeader/constants.js +1 -0
- package/lib/esm/components/GroupHeader/index.d.ts +4 -0
- package/lib/esm/components/GroupHeader/index.js +4 -0
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +97 -0
- package/lib/esm/components/GroupInfoWidget/Skeleton.d.ts +21 -0
- package/lib/esm/components/GroupInfoWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupInfoWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupInfoWidget/constants.js +1 -0
- package/lib/esm/components/GroupInfoWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupInfoWidget/index.js +4 -0
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +259 -0
- package/lib/esm/components/GroupInviteButton/index.d.ts +3 -0
- package/lib/esm/components/GroupInviteButton/index.js +2 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +51 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +133 -0
- package/lib/esm/components/GroupMembersButton/index.d.ts +3 -0
- package/lib/esm/components/GroupMembersButton/index.js +2 -0
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +202 -0
- package/lib/esm/components/GroupMembersWidget/Skeleton.d.ts +22 -0
- package/lib/esm/components/GroupMembersWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupMembersWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupMembersWidget/constants.js +1 -0
- package/lib/esm/components/GroupMembersWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupMembersWidget/index.js +4 -0
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +74 -0
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +200 -0
- package/lib/esm/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
- package/lib/esm/components/GroupRequestsWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupRequestsWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupRequestsWidget/constants.js +1 -0
- package/lib/esm/components/GroupRequestsWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupRequestsWidget/index.js +4 -0
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +134 -0
- package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +129 -0
- package/lib/esm/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSubscribeButton/index.js +2 -0
- package/lib/esm/components/Groups/Groups.d.ts +61 -0
- package/lib/esm/components/Groups/Groups.js +125 -0
- package/lib/esm/components/Groups/Skeleton.d.ts +34 -0
- package/lib/esm/components/Groups/Skeleton.js +42 -0
- package/lib/esm/components/Groups/constants.d.ts +1 -0
- package/lib/esm/components/Groups/constants.js +1 -0
- package/lib/esm/components/Groups/index.d.ts +4 -0
- package/lib/esm/components/Groups/index.js +4 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -4
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/index.js +2 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +9 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -5
- package/lib/esm/components/User/User.d.ts +12 -0
- package/lib/esm/components/User/User.js +5 -3
- package/lib/esm/constants/Group.d.ts +2 -0
- package/lib/esm/constants/Group.js +2 -0
- package/lib/esm/index.d.ts +18 -2
- package/lib/esm/index.js +47 -31
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -12,8 +12,13 @@ import Icon from '@mui/material/Icon';
|
|
|
12
12
|
import DialogContent from '@mui/material/DialogContent';
|
|
13
13
|
import { useSCFetchAddressingTagList } from '@selfcommunity/react-core';
|
|
14
14
|
import { PREFIX } from '../../constants';
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import GroupAutocomplete from '../../../GroupAutocomplete';
|
|
16
|
+
export var AudienceTypes;
|
|
17
|
+
(function (AudienceTypes) {
|
|
18
|
+
AudienceTypes["AUDIENCE_ALL"] = "all";
|
|
19
|
+
AudienceTypes["AUDIENCE_TAG"] = "tag";
|
|
20
|
+
AudienceTypes["AUDIENCE_GROUP"] = "group";
|
|
21
|
+
})(AudienceTypes || (AudienceTypes = {}));
|
|
17
22
|
const classes = {
|
|
18
23
|
root: `${PREFIX}-layer-audience-root`,
|
|
19
24
|
title: `${PREFIX}-layer-title`,
|
|
@@ -27,23 +32,36 @@ const Root = styled(Box, {
|
|
|
27
32
|
})(() => ({}));
|
|
28
33
|
const AudienceLayer = React.forwardRef((props, ref) => {
|
|
29
34
|
// Props
|
|
30
|
-
const { className, onClose, onSave, defaultValue = [], TextFieldProps = {
|
|
35
|
+
const { className, onClose, onSave, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
|
|
31
36
|
variant: 'outlined',
|
|
32
37
|
label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tags.label", defaultMessage: "ui.composer.layer.audience.tags.label" })
|
|
33
38
|
} } = props, rest = __rest(props, ["className", "onClose", "onSave", "defaultValue", "TextFieldProps"]);
|
|
34
39
|
// STATE
|
|
35
40
|
const [autocompleteOpen, setAutocompleteOpen] = useState(false);
|
|
36
|
-
const [audience, setAudience] = useState(
|
|
41
|
+
const [audience, setAudience] = useState(
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
defaultValue === null || defaultValue.length === 0
|
|
45
|
+
? AudienceTypes.AUDIENCE_ALL
|
|
46
|
+
: typeof defaultValue === 'object'
|
|
47
|
+
? AudienceTypes.AUDIENCE_GROUP
|
|
48
|
+
: AudienceTypes.AUDIENCE_TAG);
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
// @ts-ignore
|
|
37
51
|
const [value, setValue] = useState(defaultValue || undefined);
|
|
38
52
|
// HOOKS
|
|
39
53
|
const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
|
|
40
54
|
// HANDLERS
|
|
41
|
-
const handleSave = useCallback(
|
|
55
|
+
const handleSave = useCallback(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
() => (typeof defaultValue === 'object' ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null)), [value, onSave]);
|
|
42
59
|
const handleChange = useCallback((event, tags) => setValue(tags), []);
|
|
60
|
+
const handleGroupChange = useCallback((group) => setValue(group), []);
|
|
43
61
|
const handleChangeAudience = useCallback((event, data) => setAudience(data), []);
|
|
44
62
|
const handleAutocompleteOpen = useCallback(() => setAutocompleteOpen(true), []);
|
|
45
63
|
const handleAutocompleteClose = useCallback(() => setAutocompleteOpen(false), []);
|
|
46
|
-
return React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
|
|
64
|
+
return (React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
|
|
47
65
|
React.createElement(DialogTitle, { className: classes.title },
|
|
48
66
|
React.createElement(IconButton, { onClick: onClose },
|
|
49
67
|
React.createElement(Icon, null, "arrow_back")),
|
|
@@ -53,12 +71,26 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
53
71
|
React.createElement(FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }))),
|
|
54
72
|
React.createElement(DialogContent, { className: classes.content },
|
|
55
73
|
React.createElement(Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
|
|
56
|
-
React.createElement(Tab, { value: AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
57
|
-
React.createElement(Tab
|
|
74
|
+
React.createElement(Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
75
|
+
React.createElement(Tab
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
, {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
disabled: defaultValue && defaultValue.length !== 0, value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
|
|
82
|
+
React.createElement(Tab
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
, {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
disabled: typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
|
|
58
89
|
React.createElement(Typography, { className: classes.message },
|
|
59
|
-
audience === AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
60
|
-
audience ===
|
|
61
|
-
|
|
90
|
+
audience === AudienceTypes.AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
91
|
+
audience === AudienceTypes.AUDIENCE_GROUP && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
|
|
92
|
+
audience === AudienceTypes.AUDIENCE_TAG && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag.message", defaultMessage: "ui.composer.audience.layer.tag.message" }))),
|
|
93
|
+
audience === AudienceTypes.AUDIENCE_TAG && (React.createElement(Autocomplete, { className: classes.autocomplete, open: autocompleteOpen, onOpen: handleAutocompleteOpen, onClose: handleAutocompleteClose, multiple: true, options: scAddressingTags || [], getOptionLabel: (option) => option.name || '', value: value, selectOnFocus: true, clearOnBlur: true, handleHomeEndKeys: true, clearIcon: null, noOptionsText: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tags.empty", defaultMessage: "ui.composer.layer.audience.tags.empty" }), onChange: handleChange, isOptionEqualToValue: (option, value) => value.id === option.id, renderTags: (value, getTagProps) => {
|
|
62
94
|
return value.map((option, index) => React.createElement(TagChip, Object.assign({ key: option.id, tag: option }, getTagProps({ index }))));
|
|
63
95
|
}, renderOption: (props, option, { selected, inputValue }) => {
|
|
64
96
|
const matches = match(option.name, inputValue);
|
|
@@ -67,6 +99,7 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
67
99
|
React.createElement(TagChip, { key: option.id, tag: option, label: React.createElement(React.Fragment, null, parts.map((part, index) => (React.createElement("span", { key: index, style: { fontWeight: part.highlight ? 700 : 400 } }, part.text)))) })));
|
|
68
100
|
}, renderInput: (params) => {
|
|
69
101
|
return (React.createElement(TextField, Object.assign({}, params, TextFieldProps, { InputProps: Object.assign(Object.assign({}, params.InputProps), { autoComplete: 'addressing', endAdornment: React.createElement(React.Fragment, null, params.InputProps.endAdornment) }) })));
|
|
70
|
-
} }))
|
|
102
|
+
} })),
|
|
103
|
+
audience === AudienceTypes.AUDIENCE_GROUP && React.createElement(GroupAutocomplete, { onChange: handleGroupChange, defaultValue: defaultValue }))));
|
|
71
104
|
});
|
|
72
105
|
export default AudienceLayer;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
+
import { GroupFormProps } from '../GroupForm';
|
|
3
|
+
export interface CreateGroupButtonProps extends ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Props to spread to CreateGroup component
|
|
11
|
+
* @default empty object
|
|
12
|
+
*/
|
|
13
|
+
GroupFormProps?: GroupFormProps;
|
|
14
|
+
/**
|
|
15
|
+
* Any other properties
|
|
16
|
+
*/
|
|
17
|
+
[p: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
21
|
+
*
|
|
22
|
+
#### Import
|
|
23
|
+
```jsx
|
|
24
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### Component Name
|
|
28
|
+
The name `SCCreateGroupButton` can be used when providing style overrides in the theme.
|
|
29
|
+
|
|
30
|
+
#### CSS
|
|
31
|
+
|
|
32
|
+
|Rule Name|Global class|Description|
|
|
33
|
+
|---|---|---|
|
|
34
|
+
|root|.SCCreateGroupButton-root|Styles applied to the root element.|
|
|
35
|
+
|
|
36
|
+
* @param inProps
|
|
37
|
+
*/
|
|
38
|
+
export default function CreateGroupButton(inProps: CreateGroupButtonProps): JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { useThemeProps } from '@mui/system';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Button, Icon } from '@mui/material';
|
|
6
|
+
import { FormattedMessage } from 'react-intl';
|
|
7
|
+
import { SCUserContext } from '@selfcommunity/react-core';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import GroupForm from '../GroupForm';
|
|
10
|
+
const PREFIX = 'SCCreateGroupButton';
|
|
11
|
+
const classes = {
|
|
12
|
+
root: `${PREFIX}-root`
|
|
13
|
+
};
|
|
14
|
+
const Root = styled(Button, {
|
|
15
|
+
name: PREFIX,
|
|
16
|
+
slot: 'Root',
|
|
17
|
+
overridesResolver: (props, styles) => styles.root
|
|
18
|
+
})(({ theme }) => ({}));
|
|
19
|
+
/**
|
|
20
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
21
|
+
*
|
|
22
|
+
#### Import
|
|
23
|
+
```jsx
|
|
24
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### Component Name
|
|
28
|
+
The name `SCCreateGroupButton` can be used when providing style overrides in the theme.
|
|
29
|
+
|
|
30
|
+
#### CSS
|
|
31
|
+
|
|
32
|
+
|Rule Name|Global class|Description|
|
|
33
|
+
|---|---|---|
|
|
34
|
+
|root|.SCCreateGroupButton-root|Styles applied to the root element.|
|
|
35
|
+
|
|
36
|
+
* @param inProps
|
|
37
|
+
*/
|
|
38
|
+
export default function CreateGroupButton(inProps) {
|
|
39
|
+
//PROPS
|
|
40
|
+
const props = useThemeProps({
|
|
41
|
+
props: inProps,
|
|
42
|
+
name: PREFIX
|
|
43
|
+
});
|
|
44
|
+
const { className, GroupFormProps = {}, children } = props, rest = __rest(props, ["className", "GroupFormProps", "children"]);
|
|
45
|
+
// CONTEXT
|
|
46
|
+
const scUserContext = useContext(SCUserContext);
|
|
47
|
+
// STATE
|
|
48
|
+
const [open, setOpen] = React.useState(false);
|
|
49
|
+
// CONST
|
|
50
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
51
|
+
/**
|
|
52
|
+
* Handle click on button
|
|
53
|
+
*/
|
|
54
|
+
const handleClick = () => {
|
|
55
|
+
setOpen((o) => !o);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* If there's no authUserId, component is hidden.
|
|
59
|
+
*/
|
|
60
|
+
if (!authUserId) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Renders root object
|
|
65
|
+
*/
|
|
66
|
+
return (React.createElement(React.Fragment, null,
|
|
67
|
+
React.createElement(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClick, variant: "contained", startIcon: React.createElement(Icon, { fontSize: "small" }, "add") }, rest), children !== null && children !== void 0 ? children : React.createElement(FormattedMessage, { id: "ui.createGroupButton", defaultMessage: "ui.createGroupButton" })),
|
|
68
|
+
open && React.createElement(GroupForm, Object.assign({}, GroupFormProps, { open: true, onClose: handleClick }))));
|
|
69
|
+
}
|
|
@@ -23,6 +23,10 @@ export interface CustomAdvProps extends VirtualScrollerItemProps {
|
|
|
23
23
|
* Category ids if the adv must be related to specific categories
|
|
24
24
|
*/
|
|
25
25
|
categoriesId?: Array<number> | null;
|
|
26
|
+
/**
|
|
27
|
+
* Group ids if the adv must be related to specific groups
|
|
28
|
+
*/
|
|
29
|
+
groupsId?: Array<number> | null;
|
|
26
30
|
/**
|
|
27
31
|
* Prefixed height. Usefull to re-mount item on scroll feed.
|
|
28
32
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CreateGroupButtonProps } from '../CreateGroupButton';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
export interface EditGroupButtonProps extends CreateGroupButtonProps {
|
|
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
|
+
* On edit success callback function
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
onEditSuccess?: (data: SCGroupType) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Any other properties
|
|
21
|
+
*/
|
|
22
|
+
[p: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
26
|
+
*
|
|
27
|
+
#### Import
|
|
28
|
+
```jsx
|
|
29
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Component Name
|
|
33
|
+
The name `SCEditGroupButton` can be used when providing style overrides in the theme.
|
|
34
|
+
|
|
35
|
+
#### CSS
|
|
36
|
+
|
|
37
|
+
|Rule Name|Global class|Description|
|
|
38
|
+
|---|---|---|
|
|
39
|
+
|root|.SCEditGroupButton-root|Styles applied to the root element.|
|
|
40
|
+
|
|
41
|
+
* @param inProps
|
|
42
|
+
*/
|
|
43
|
+
export default function EditGroupButton(inProps: EditGroupButtonProps): JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useThemeProps } from '@mui/system';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { useSCFetchGroup, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import CreateGroupButton from '../CreateGroupButton';
|
|
9
|
+
const PREFIX = 'SCEditGroupButton';
|
|
10
|
+
const classes = {
|
|
11
|
+
root: `${PREFIX}-root`
|
|
12
|
+
};
|
|
13
|
+
const Root = styled(CreateGroupButton, {
|
|
14
|
+
name: PREFIX,
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(({ theme }) => ({}));
|
|
18
|
+
/**
|
|
19
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
20
|
+
*
|
|
21
|
+
#### Import
|
|
22
|
+
```jsx
|
|
23
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Component Name
|
|
27
|
+
The name `SCEditGroupButton` can be used when providing style overrides in the theme.
|
|
28
|
+
|
|
29
|
+
#### CSS
|
|
30
|
+
|
|
31
|
+
|Rule Name|Global class|Description|
|
|
32
|
+
|---|---|---|
|
|
33
|
+
|root|.SCEditGroupButton-root|Styles applied to the root element.|
|
|
34
|
+
|
|
35
|
+
* @param inProps
|
|
36
|
+
*/
|
|
37
|
+
export default function EditGroupButton(inProps) {
|
|
38
|
+
//PROPS
|
|
39
|
+
const props = useThemeProps({
|
|
40
|
+
props: inProps,
|
|
41
|
+
name: PREFIX
|
|
42
|
+
});
|
|
43
|
+
const { className, groupId, group, onEditSuccess } = props, rest = __rest(props, ["className", "groupId", "group", "onEditSuccess"]);
|
|
44
|
+
const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
|
|
45
|
+
const scUserContext = useSCUser();
|
|
46
|
+
const handleSuccess = (data) => {
|
|
47
|
+
setSCGroup(data);
|
|
48
|
+
onEditSuccess && onEditSuccess(data);
|
|
49
|
+
};
|
|
50
|
+
if (!scUserContext.user) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders root object
|
|
55
|
+
*/
|
|
56
|
+
return (React.createElement(Root, Object.assign({ variant: "outlined", className: classNames(classes.root, className), GroupFormProps: { group: scGroup, onSuccess: handleSuccess } }, rest),
|
|
57
|
+
React.createElement(FormattedMessage, { id: "ui.editGroupButton", defaultMessage: "ui.editGroupButton" })));
|
|
58
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ButtonBaseProps } from '@mui/material';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
import { WidgetProps } from '../Widget';
|
|
4
|
+
import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
|
|
5
|
+
export interface GroupProps extends WidgetProps {
|
|
6
|
+
/**
|
|
7
|
+
* Group Object
|
|
8
|
+
* @default null
|
|
9
|
+
*/
|
|
10
|
+
group?: SCGroupType;
|
|
11
|
+
/**
|
|
12
|
+
* Id of the group for filter the feed
|
|
13
|
+
* @default null
|
|
14
|
+
*/
|
|
15
|
+
groupId?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Props to spread to group subscribe/unsubscribe button
|
|
18
|
+
* @default {}
|
|
19
|
+
*/
|
|
20
|
+
groupSubscribeButtonProps?: GroupSubscribeButtonProps;
|
|
21
|
+
/**
|
|
22
|
+
* Badge content to show as group avatar badge if show reaction is true.
|
|
23
|
+
*/
|
|
24
|
+
badgeContent?: any;
|
|
25
|
+
/**
|
|
26
|
+
* Prop to hide actions
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
hideActions?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread to the button
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
34
|
+
buttonProps?: ButtonBaseProps;
|
|
35
|
+
/**
|
|
36
|
+
* Any other properties
|
|
37
|
+
*/
|
|
38
|
+
[p: string]: any;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* > API documentation for the Community-JS Group component. Learn about the available props and the CSS API.
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* This component renders a group item.
|
|
45
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/User)
|
|
46
|
+
|
|
47
|
+
#### Import
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
import {group} from '@selfcommunity/react-ui';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Component Name
|
|
54
|
+
|
|
55
|
+
The name `SCGroup` can be used when providing style overrides in the theme.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#### CSS
|
|
59
|
+
|
|
60
|
+
|Rule Name|Global class|Description|
|
|
61
|
+
|---|---|---|
|
|
62
|
+
|root|.SCGroup-root|Styles applied to the root element.|
|
|
63
|
+
|avatar|.SCGroup-avatar|Styles applied to the avatar element.|
|
|
64
|
+
|
|
65
|
+
*
|
|
66
|
+
* @param inProps
|
|
67
|
+
*/
|
|
68
|
+
export default function Group(inProps: GroupProps): JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { Avatar, Icon, Stack } from '@mui/material';
|
|
5
|
+
import { Link, SCRoutes, useSCFetchGroup, useSCRouting } from '@selfcommunity/react-core';
|
|
6
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { useThemeProps } from '@mui/system';
|
|
9
|
+
import BaseItemButton from '../../shared/BaseItemButton';
|
|
10
|
+
import UserDeletedSnackBar from '../../shared/UserDeletedSnackBar';
|
|
11
|
+
import { PREFIX } from './constants';
|
|
12
|
+
import GroupSkeleton from './Skeleton';
|
|
13
|
+
import GroupSubscribeButton from '../GroupSubscribeButton';
|
|
14
|
+
const messages = defineMessages({
|
|
15
|
+
groupMembers: {
|
|
16
|
+
id: 'ui.group.members',
|
|
17
|
+
defaultMessage: 'ui.group.members'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const classes = {
|
|
21
|
+
root: `${PREFIX}-root`,
|
|
22
|
+
avatar: `${PREFIX}-avatar`,
|
|
23
|
+
actions: `${PREFIX}-actions`
|
|
24
|
+
};
|
|
25
|
+
const Root = styled(BaseItemButton, {
|
|
26
|
+
name: PREFIX,
|
|
27
|
+
slot: 'Root',
|
|
28
|
+
overridesResolver: (props, styles) => styles.root
|
|
29
|
+
})(({ theme }) => ({}));
|
|
30
|
+
/**
|
|
31
|
+
* > API documentation for the Community-JS Group component. Learn about the available props and the CSS API.
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
* This component renders a group item.
|
|
35
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/User)
|
|
36
|
+
|
|
37
|
+
#### Import
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
import {group} from '@selfcommunity/react-ui';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Component Name
|
|
44
|
+
|
|
45
|
+
The name `SCGroup` can be used when providing style overrides in the theme.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#### CSS
|
|
49
|
+
|
|
50
|
+
|Rule Name|Global class|Description|
|
|
51
|
+
|---|---|---|
|
|
52
|
+
|root|.SCGroup-root|Styles applied to the root element.|
|
|
53
|
+
|avatar|.SCGroup-avatar|Styles applied to the avatar element.|
|
|
54
|
+
|
|
55
|
+
*
|
|
56
|
+
* @param inProps
|
|
57
|
+
*/
|
|
58
|
+
export default function Group(inProps) {
|
|
59
|
+
// PROPS
|
|
60
|
+
const props = useThemeProps({
|
|
61
|
+
props: inProps,
|
|
62
|
+
name: PREFIX
|
|
63
|
+
});
|
|
64
|
+
const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, visible = true } = props, rest = __rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "visible"]);
|
|
65
|
+
// STATE
|
|
66
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
67
|
+
// CONTEXT
|
|
68
|
+
const scRoutingContext = useSCRouting();
|
|
69
|
+
const [openAlert, setOpenAlert] = useState(false);
|
|
70
|
+
// INTL
|
|
71
|
+
const intl = useIntl();
|
|
72
|
+
/**
|
|
73
|
+
* Render authenticated actions
|
|
74
|
+
* @return {JSX.Element}
|
|
75
|
+
*/
|
|
76
|
+
function renderAuthenticatedActions() {
|
|
77
|
+
return (React.createElement(Stack, { className: classes.actions, direction: "row", alignItems: "center", justifyContent: "center", spacing: 2 },
|
|
78
|
+
React.createElement(Icon, null, !visible ? 'private' : 'public'),
|
|
79
|
+
React.createElement(GroupSubscribeButton, Object.assign({ group: group, groupId: groupId }, groupSubscribeButtonProps))));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renders group object
|
|
83
|
+
*/
|
|
84
|
+
if (!scGroup) {
|
|
85
|
+
return React.createElement(GroupSkeleton, { elevation: elevation });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Renders root object
|
|
89
|
+
*/
|
|
90
|
+
return (React.createElement(React.Fragment, null,
|
|
91
|
+
React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
|
|
92
|
+
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
93
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WidgetProps } from '../Widget';
|
|
2
|
+
/**
|
|
3
|
+
* > API documentation for the Community-JS Group Skeleton component. Learn about the available props and the CSS API.
|
|
4
|
+
|
|
5
|
+
#### Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import {GroupSkeleton} from '@selfcommunity/react-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
#### Component Name
|
|
12
|
+
|
|
13
|
+
The name `SCGroup-skeleton-root` can be used when providing style overrides in the theme.
|
|
14
|
+
|
|
15
|
+
#### CSS
|
|
16
|
+
|
|
17
|
+
|Rule Name|Global class|Description|
|
|
18
|
+
|---|---|---|
|
|
19
|
+
|root|.SCGroup-skeleton-root|Styles applied to the root element.|
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export default function GroupSkeleton(props: WidgetProps): JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, useTheme } from '@mui/material';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import Skeleton from '@mui/material/Skeleton';
|
|
5
|
+
import BaseItem from '../../shared/BaseItem';
|
|
6
|
+
import { PREFIX } from './constants';
|
|
7
|
+
const classes = {
|
|
8
|
+
root: `${PREFIX}-skeleton-root`
|
|
9
|
+
};
|
|
10
|
+
const Root = styled(BaseItem, {
|
|
11
|
+
name: PREFIX,
|
|
12
|
+
slot: 'SkeletonRoot'
|
|
13
|
+
})(() => ({}));
|
|
14
|
+
/**
|
|
15
|
+
* > API documentation for the Community-JS Group Skeleton component. Learn about the available props and the CSS API.
|
|
16
|
+
|
|
17
|
+
#### Import
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
import {GroupSkeleton} from '@selfcommunity/react-ui';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### Component Name
|
|
24
|
+
|
|
25
|
+
The name `SCGroup-skeleton-root` can be used when providing style overrides in the theme.
|
|
26
|
+
|
|
27
|
+
#### CSS
|
|
28
|
+
|
|
29
|
+
|Rule Name|Global class|Description|
|
|
30
|
+
|---|---|---|
|
|
31
|
+
|root|.SCGroup-skeleton-root|Styles applied to the root element.|
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export default function GroupSkeleton(props) {
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
return (React.createElement(Root, Object.assign({ className: classes.root }, props, { image: React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeSmall, height: theme.selfcommunity.group.avatar.sizeSmall }), primary: React.createElement(Skeleton, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } }), secondary: React.createElement(Skeleton, { animation: "wave", height: 10, width: 70, style: { marginBottom: 10 } }), actions: React.createElement(Button, { size: "small", variant: "outlined", disabled: true },
|
|
37
|
+
React.createElement(Skeleton, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } })) })));
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCGroup";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCGroup';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
|
+
import { AutocompleteProps } from '@mui/material';
|
|
3
|
+
import { SCGroupType } from '@selfcommunity/types/src/index';
|
|
4
|
+
export interface GroupAutocompleteProps extends Pick<AutocompleteProps<SCGroupType | null, any, any, any>, Exclude<keyof AutocompleteProps<SCGroupType | null, any, any, any>, 'open' | 'onOpen' | 'onClose' | 'onChange' | 'filterSelectedOptions' | 'disableCloseOnSelect' | 'options' | 'getOptionLabel' | 'value' | 'selectOnFocus' | 'clearOnBlur' | 'blurOnSelect' | 'handleHomeEndKeys' | 'clearIcon' | 'noOptionsText' | 'isOptionEqualToValue' | 'renderTags' | 'renderOption' | 'renderInput'>> {
|
|
5
|
+
/**
|
|
6
|
+
* The maximum number of groups that will be visible when not focused.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
limitCountGroups?: number;
|
|
10
|
+
/**
|
|
11
|
+
* If checkbox is selected
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
checkboxSelect?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The props applied to text field
|
|
17
|
+
* @default {variant: 'outlined, label: groups_label}
|
|
18
|
+
*/
|
|
19
|
+
TextFieldProps?: TextFieldProps;
|
|
20
|
+
/**
|
|
21
|
+
* Callback for change event on poll object
|
|
22
|
+
* @param value
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (value: any) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* > API documentation for the Community-JS Group Autocomplete component. Learn about the available props and the CSS API.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* This component renders a bar that allows users to search (with autocomplete) for all the groups available in the application.
|
|
31
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupAutocomplete)
|
|
32
|
+
*
|
|
33
|
+
* #### Import
|
|
34
|
+
* ```jsx
|
|
35
|
+
* import {GroupAutocomplete} from '@selfcommunity/react-ui';
|
|
36
|
+
* ```
|
|
37
|
+
* #### Component Name
|
|
38
|
+
* The name `SCGroupAutocomplete` can be used when providing style overrides in the theme.
|
|
39
|
+
*
|
|
40
|
+
* #### CSS
|
|
41
|
+
*
|
|
42
|
+
* |Rule Name|Global class|Description|
|
|
43
|
+
* |---|---|---|
|
|
44
|
+
* |root|.SCGroupAutocomplete-root|Styles applied to the root element.|
|
|
45
|
+
*
|
|
46
|
+
* @param inProps
|
|
47
|
+
*/
|
|
48
|
+
declare const GroupAutocomplete: (inProps: GroupAutocompleteProps) => JSX.Element;
|
|
49
|
+
export default GroupAutocomplete;
|