@selfcommunity/react-ui 0.7.9-alpha.1 → 0.7.9-alpha.11
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 +204 -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 +133 -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/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
- 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 +17 -1
- package/lib/cjs/index.js +40 -2
- 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 +201 -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 +130 -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/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
- 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 +17 -1
- package/lib/esm/index.js +19 -3
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -25,7 +25,8 @@ const DEFAULT_POST = {
|
|
|
25
25
|
categories: [],
|
|
26
26
|
medias: [],
|
|
27
27
|
html: '',
|
|
28
|
-
addressing: []
|
|
28
|
+
addressing: [],
|
|
29
|
+
group: null
|
|
29
30
|
};
|
|
30
31
|
exports.default = (props) => {
|
|
31
32
|
// PROPS
|
|
@@ -43,7 +44,7 @@ exports.default = (props) => {
|
|
|
43
44
|
}, [value]);
|
|
44
45
|
// RENDER
|
|
45
46
|
return (react_1.default.createElement(Root, { className: (0, classnames_1.default)(classes.root, className) },
|
|
46
|
-
generalError && react_1.default.createElement(material_1.Typography, { className: classes.generalError },
|
|
47
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` })),
|
|
47
|
+
generalError && (react_1.default.createElement(material_1.Typography, { className: classes.generalError },
|
|
48
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }))),
|
|
48
49
|
react_1.default.createElement(Editor_1.default, Object.assign({ ref: editorRef }, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html }))));
|
|
49
50
|
};
|
|
@@ -3,8 +3,14 @@ import { TextFieldProps } from '@mui/material/TextField';
|
|
|
3
3
|
import { BoxProps } from '@mui/material';
|
|
4
4
|
import { SCTagType } from '@selfcommunity/types/src/index';
|
|
5
5
|
import { ComposerLayerProps } from '../../../../types/composer';
|
|
6
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
7
|
+
export declare enum AudienceTypes {
|
|
8
|
+
AUDIENCE_ALL = "all",
|
|
9
|
+
AUDIENCE_TAG = "tag",
|
|
10
|
+
AUDIENCE_GROUP = "group"
|
|
11
|
+
}
|
|
6
12
|
export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
|
|
7
|
-
defaultValue: SCTagType[];
|
|
13
|
+
defaultValue: SCTagType[] | SCGroupType;
|
|
8
14
|
TextFieldProps?: TextFieldProps;
|
|
9
15
|
}
|
|
10
16
|
declare const AudienceLayer: React.ForwardRefExoticComponent<Pick<AudienceLayerProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "onClose" | "TextFieldProps" | "onSave"> & React.RefAttributes<unknown>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AudienceTypes = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
6
|
const react_intl_1 = require("react-intl");
|
|
@@ -14,8 +15,13 @@ const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
|
14
15
|
const DialogContent_1 = tslib_1.__importDefault(require("@mui/material/DialogContent"));
|
|
15
16
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
16
17
|
const constants_1 = require("../../constants");
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const GroupAutocomplete_1 = tslib_1.__importDefault(require("../../../GroupAutocomplete"));
|
|
19
|
+
var AudienceTypes;
|
|
20
|
+
(function (AudienceTypes) {
|
|
21
|
+
AudienceTypes["AUDIENCE_ALL"] = "all";
|
|
22
|
+
AudienceTypes["AUDIENCE_TAG"] = "tag";
|
|
23
|
+
AudienceTypes["AUDIENCE_GROUP"] = "group";
|
|
24
|
+
})(AudienceTypes = exports.AudienceTypes || (exports.AudienceTypes = {}));
|
|
19
25
|
const classes = {
|
|
20
26
|
root: `${constants_1.PREFIX}-layer-audience-root`,
|
|
21
27
|
title: `${constants_1.PREFIX}-layer-title`,
|
|
@@ -29,23 +35,36 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
29
35
|
})(() => ({}));
|
|
30
36
|
const AudienceLayer = react_1.default.forwardRef((props, ref) => {
|
|
31
37
|
// Props
|
|
32
|
-
const { className, onClose, onSave, defaultValue = [], TextFieldProps = {
|
|
38
|
+
const { className, onClose, onSave, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
|
|
33
39
|
variant: 'outlined',
|
|
34
40
|
label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tags.label", defaultMessage: "ui.composer.layer.audience.tags.label" })
|
|
35
41
|
} } = props, rest = tslib_1.__rest(props, ["className", "onClose", "onSave", "defaultValue", "TextFieldProps"]);
|
|
36
42
|
// STATE
|
|
37
43
|
const [autocompleteOpen, setAutocompleteOpen] = (0, react_1.useState)(false);
|
|
38
|
-
const [audience, setAudience] = (0, react_1.useState)(
|
|
44
|
+
const [audience, setAudience] = (0, react_1.useState)(
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
defaultValue === null || defaultValue.length === 0
|
|
48
|
+
? AudienceTypes.AUDIENCE_ALL
|
|
49
|
+
: typeof defaultValue === 'object'
|
|
50
|
+
? AudienceTypes.AUDIENCE_GROUP
|
|
51
|
+
: AudienceTypes.AUDIENCE_TAG);
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
53
|
+
// @ts-ignore
|
|
39
54
|
const [value, setValue] = (0, react_1.useState)(defaultValue || undefined);
|
|
40
55
|
// HOOKS
|
|
41
56
|
const { scAddressingTags } = (0, react_core_1.useSCFetchAddressingTagList)({ fetch: autocompleteOpen });
|
|
42
57
|
// HANDLERS
|
|
43
|
-
const handleSave = (0, react_1.useCallback)(
|
|
58
|
+
const handleSave = (0, react_1.useCallback)(
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
() => (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]);
|
|
44
62
|
const handleChange = (0, react_1.useCallback)((event, tags) => setValue(tags), []);
|
|
63
|
+
const handleGroupChange = (0, react_1.useCallback)((group) => setValue(group), []);
|
|
45
64
|
const handleChangeAudience = (0, react_1.useCallback)((event, data) => setAudience(data), []);
|
|
46
65
|
const handleAutocompleteOpen = (0, react_1.useCallback)(() => setAutocompleteOpen(true), []);
|
|
47
66
|
const handleAutocompleteClose = (0, react_1.useCallback)(() => setAutocompleteOpen(false), []);
|
|
48
|
-
return react_1.default.createElement(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.root) }, rest),
|
|
67
|
+
return (react_1.default.createElement(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.root) }, rest),
|
|
49
68
|
react_1.default.createElement(material_1.DialogTitle, { className: classes.title },
|
|
50
69
|
react_1.default.createElement(material_1.IconButton, { onClick: onClose },
|
|
51
70
|
react_1.default.createElement(Icon_1.default, null, "arrow_back")),
|
|
@@ -55,12 +74,26 @@ const AudienceLayer = react_1.default.forwardRef((props, ref) => {
|
|
|
55
74
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }))),
|
|
56
75
|
react_1.default.createElement(DialogContent_1.default, { className: classes.content },
|
|
57
76
|
react_1.default.createElement(material_1.Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
|
|
58
|
-
react_1.default.createElement(material_1.Tab, { value: AUDIENCE_ALL, icon: react_1.default.createElement(Icon_1.default, null, "public"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
59
|
-
react_1.default.createElement(material_1.Tab
|
|
77
|
+
react_1.default.createElement(material_1.Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: react_1.default.createElement(Icon_1.default, null, "public"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
78
|
+
react_1.default.createElement(material_1.Tab
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
, {
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
disabled: defaultValue && defaultValue.length !== 0, value: AudienceTypes.AUDIENCE_GROUP, icon: react_1.default.createElement(Icon_1.default, null, "groups"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
|
|
85
|
+
react_1.default.createElement(material_1.Tab
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
, {
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
disabled: typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: react_1.default.createElement(Icon_1.default, null, "label"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
|
|
60
92
|
react_1.default.createElement(material_1.Typography, { className: classes.message },
|
|
61
|
-
audience === AUDIENCE_ALL && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
62
|
-
audience ===
|
|
63
|
-
|
|
93
|
+
audience === AudienceTypes.AUDIENCE_ALL && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
94
|
+
audience === AudienceTypes.AUDIENCE_GROUP && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
|
|
95
|
+
audience === AudienceTypes.AUDIENCE_TAG && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tag.message", defaultMessage: "ui.composer.audience.layer.tag.message" }))),
|
|
96
|
+
audience === AudienceTypes.AUDIENCE_TAG && (react_1.default.createElement(material_1.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_1.default.createElement(react_intl_1.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) => {
|
|
64
97
|
return value.map((option, index) => react_1.default.createElement(TagChip_1.default, Object.assign({ key: option.id, tag: option }, getTagProps({ index }))));
|
|
65
98
|
}, renderOption: (props, option, { selected, inputValue }) => {
|
|
66
99
|
const matches = (0, match_1.default)(option.name, inputValue);
|
|
@@ -69,6 +102,7 @@ const AudienceLayer = react_1.default.forwardRef((props, ref) => {
|
|
|
69
102
|
react_1.default.createElement(TagChip_1.default, { key: option.id, tag: option, label: react_1.default.createElement(react_1.default.Fragment, null, parts.map((part, index) => (react_1.default.createElement("span", { key: index, style: { fontWeight: part.highlight ? 700 : 400 } }, part.text)))) })));
|
|
70
103
|
}, renderInput: (params) => {
|
|
71
104
|
return (react_1.default.createElement(TextField_1.default, Object.assign({}, params, TextFieldProps, { InputProps: Object.assign(Object.assign({}, params.InputProps), { autoComplete: 'addressing', endAdornment: react_1.default.createElement(react_1.default.Fragment, null, params.InputProps.endAdornment) }) })));
|
|
72
|
-
} }))
|
|
105
|
+
} })),
|
|
106
|
+
audience === AudienceTypes.AUDIENCE_GROUP && react_1.default.createElement(GroupAutocomplete_1.default, { onChange: handleGroupChange, defaultValue: defaultValue }))));
|
|
73
107
|
});
|
|
74
108
|
exports.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,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const system_1 = require("@mui/system");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const GroupForm_1 = tslib_1.__importDefault(require("../GroupForm"));
|
|
12
|
+
const PREFIX = 'SCCreateGroupButton';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${PREFIX}-root`
|
|
15
|
+
};
|
|
16
|
+
const Root = (0, styles_1.styled)(material_1.Button, {
|
|
17
|
+
name: PREFIX,
|
|
18
|
+
slot: 'Root',
|
|
19
|
+
overridesResolver: (props, styles) => styles.root
|
|
20
|
+
})(({ theme }) => ({}));
|
|
21
|
+
/**
|
|
22
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
23
|
+
*
|
|
24
|
+
#### Import
|
|
25
|
+
```jsx
|
|
26
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Component Name
|
|
30
|
+
The name `SCCreateGroupButton` can be used when providing style overrides in the theme.
|
|
31
|
+
|
|
32
|
+
#### CSS
|
|
33
|
+
|
|
34
|
+
|Rule Name|Global class|Description|
|
|
35
|
+
|---|---|---|
|
|
36
|
+
|root|.SCCreateGroupButton-root|Styles applied to the root element.|
|
|
37
|
+
|
|
38
|
+
* @param inProps
|
|
39
|
+
*/
|
|
40
|
+
function CreateGroupButton(inProps) {
|
|
41
|
+
//PROPS
|
|
42
|
+
const props = (0, system_1.useThemeProps)({
|
|
43
|
+
props: inProps,
|
|
44
|
+
name: PREFIX
|
|
45
|
+
});
|
|
46
|
+
const { className, GroupFormProps = {}, children } = props, rest = tslib_1.__rest(props, ["className", "GroupFormProps", "children"]);
|
|
47
|
+
// CONTEXT
|
|
48
|
+
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
49
|
+
// STATE
|
|
50
|
+
const [open, setOpen] = react_1.default.useState(false);
|
|
51
|
+
// CONST
|
|
52
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
53
|
+
/**
|
|
54
|
+
* Handle click on button
|
|
55
|
+
*/
|
|
56
|
+
const handleClick = () => {
|
|
57
|
+
setOpen((o) => !o);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* If there's no authUserId, component is hidden.
|
|
61
|
+
*/
|
|
62
|
+
if (!authUserId) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders root object
|
|
67
|
+
*/
|
|
68
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
69
|
+
react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClick, variant: "contained", startIcon: react_1.default.createElement(material_1.Icon, { fontSize: "small" }, "add") }, rest), children !== null && children !== void 0 ? children : react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.createGroupButton", defaultMessage: "ui.createGroupButton" })),
|
|
70
|
+
open && react_1.default.createElement(GroupForm_1.default, Object.assign({}, GroupFormProps, { open: true, onClose: handleClick }))));
|
|
71
|
+
}
|
|
72
|
+
exports.default = CreateGroupButton;
|
|
@@ -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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const system_1 = require("@mui/system");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
|
+
const CreateGroupButton_1 = tslib_1.__importDefault(require("../CreateGroupButton"));
|
|
11
|
+
const PREFIX = 'SCEditGroupButton';
|
|
12
|
+
const classes = {
|
|
13
|
+
root: `${PREFIX}-root`
|
|
14
|
+
};
|
|
15
|
+
const Root = (0, styles_1.styled)(CreateGroupButton_1.default, {
|
|
16
|
+
name: PREFIX,
|
|
17
|
+
slot: 'Root',
|
|
18
|
+
overridesResolver: (props, styles) => styles.root
|
|
19
|
+
})(({ theme }) => ({}));
|
|
20
|
+
/**
|
|
21
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
22
|
+
*
|
|
23
|
+
#### Import
|
|
24
|
+
```jsx
|
|
25
|
+
import {CreateGroupButton} from '@selfcommunity/react-ui';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Component Name
|
|
29
|
+
The name `SCEditGroupButton` can be used when providing style overrides in the theme.
|
|
30
|
+
|
|
31
|
+
#### CSS
|
|
32
|
+
|
|
33
|
+
|Rule Name|Global class|Description|
|
|
34
|
+
|---|---|---|
|
|
35
|
+
|root|.SCEditGroupButton-root|Styles applied to the root element.|
|
|
36
|
+
|
|
37
|
+
* @param inProps
|
|
38
|
+
*/
|
|
39
|
+
function EditGroupButton(inProps) {
|
|
40
|
+
//PROPS
|
|
41
|
+
const props = (0, system_1.useThemeProps)({
|
|
42
|
+
props: inProps,
|
|
43
|
+
name: PREFIX
|
|
44
|
+
});
|
|
45
|
+
const { className, groupId, group, onEditSuccess } = props, rest = tslib_1.__rest(props, ["className", "groupId", "group", "onEditSuccess"]);
|
|
46
|
+
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
47
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
48
|
+
const handleSuccess = (data) => {
|
|
49
|
+
setSCGroup(data);
|
|
50
|
+
onEditSuccess && onEditSuccess(data);
|
|
51
|
+
};
|
|
52
|
+
if (!scUserContext.user) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renders root object
|
|
57
|
+
*/
|
|
58
|
+
return (react_1.default.createElement(Root, Object.assign({ variant: "outlined", className: (0, classnames_1.default)(classes.root, className), GroupFormProps: { group: scGroup, onSuccess: handleSuccess } }, rest),
|
|
59
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.editGroupButton", defaultMessage: "ui.editGroupButton" })));
|
|
60
|
+
}
|
|
61
|
+
exports.default = EditGroupButton;
|
|
@@ -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,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
|
+
const system_1 = require("@mui/system");
|
|
11
|
+
const BaseItemButton_1 = tslib_1.__importDefault(require("../../shared/BaseItemButton"));
|
|
12
|
+
const UserDeletedSnackBar_1 = tslib_1.__importDefault(require("../../shared/UserDeletedSnackBar"));
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
15
|
+
const GroupSubscribeButton_1 = tslib_1.__importDefault(require("../GroupSubscribeButton"));
|
|
16
|
+
const messages = (0, react_intl_1.defineMessages)({
|
|
17
|
+
groupMembers: {
|
|
18
|
+
id: 'ui.group.members',
|
|
19
|
+
defaultMessage: 'ui.group.members'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const classes = {
|
|
23
|
+
root: `${constants_1.PREFIX}-root`,
|
|
24
|
+
avatar: `${constants_1.PREFIX}-avatar`,
|
|
25
|
+
actions: `${constants_1.PREFIX}-actions`
|
|
26
|
+
};
|
|
27
|
+
const Root = (0, styles_1.styled)(BaseItemButton_1.default, {
|
|
28
|
+
name: constants_1.PREFIX,
|
|
29
|
+
slot: 'Root',
|
|
30
|
+
overridesResolver: (props, styles) => styles.root
|
|
31
|
+
})(({ theme }) => ({}));
|
|
32
|
+
/**
|
|
33
|
+
* > API documentation for the Community-JS Group component. Learn about the available props and the CSS API.
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
* This component renders a group item.
|
|
37
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/User)
|
|
38
|
+
|
|
39
|
+
#### Import
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
import {group} from '@selfcommunity/react-ui';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Component Name
|
|
46
|
+
|
|
47
|
+
The name `SCGroup` can be used when providing style overrides in the theme.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#### CSS
|
|
51
|
+
|
|
52
|
+
|Rule Name|Global class|Description|
|
|
53
|
+
|---|---|---|
|
|
54
|
+
|root|.SCGroup-root|Styles applied to the root element.|
|
|
55
|
+
|avatar|.SCGroup-avatar|Styles applied to the avatar element.|
|
|
56
|
+
|
|
57
|
+
*
|
|
58
|
+
* @param inProps
|
|
59
|
+
*/
|
|
60
|
+
function Group(inProps) {
|
|
61
|
+
// PROPS
|
|
62
|
+
const props = (0, system_1.useThemeProps)({
|
|
63
|
+
props: inProps,
|
|
64
|
+
name: constants_1.PREFIX
|
|
65
|
+
});
|
|
66
|
+
const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, visible = true } = props, rest = tslib_1.__rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "visible"]);
|
|
67
|
+
// STATE
|
|
68
|
+
const { scGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
69
|
+
// CONTEXT
|
|
70
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
71
|
+
const [openAlert, setOpenAlert] = (0, react_1.useState)(false);
|
|
72
|
+
// INTL
|
|
73
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
74
|
+
/**
|
|
75
|
+
* Render authenticated actions
|
|
76
|
+
* @return {JSX.Element}
|
|
77
|
+
*/
|
|
78
|
+
function renderAuthenticatedActions() {
|
|
79
|
+
return (react_1.default.createElement(material_1.Stack, { className: classes.actions, direction: "row", alignItems: "center", justifyContent: "center", spacing: 2 },
|
|
80
|
+
react_1.default.createElement(material_1.Icon, null, !visible ? 'private' : 'public'),
|
|
81
|
+
react_1.default.createElement(GroupSubscribeButton_1.default, Object.assign({ group: group, groupId: groupId }, groupSubscribeButtonProps))));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Renders group object
|
|
85
|
+
*/
|
|
86
|
+
if (!scGroup) {
|
|
87
|
+
return react_1.default.createElement(Skeleton_1.default, { elevation: elevation });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Renders root object
|
|
91
|
+
*/
|
|
92
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
93
|
+
react_1.default.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: react_1.default.createElement(material_1.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() })),
|
|
94
|
+
openAlert && react_1.default.createElement(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
95
|
+
}
|
|
96
|
+
exports.default = Group;
|
|
@@ -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,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
8
|
+
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const classes = {
|
|
11
|
+
root: `${constants_1.PREFIX}-skeleton-root`
|
|
12
|
+
};
|
|
13
|
+
const Root = (0, styles_1.styled)(BaseItem_1.default, {
|
|
14
|
+
name: constants_1.PREFIX,
|
|
15
|
+
slot: 'SkeletonRoot'
|
|
16
|
+
})(() => ({}));
|
|
17
|
+
/**
|
|
18
|
+
* > API documentation for the Community-JS Group Skeleton component. Learn about the available props and the CSS API.
|
|
19
|
+
|
|
20
|
+
#### Import
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import {GroupSkeleton} from '@selfcommunity/react-ui';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Component Name
|
|
27
|
+
|
|
28
|
+
The name `SCGroup-skeleton-root` can be used when providing style overrides in the theme.
|
|
29
|
+
|
|
30
|
+
#### CSS
|
|
31
|
+
|
|
32
|
+
|Rule Name|Global class|Description|
|
|
33
|
+
|---|---|---|
|
|
34
|
+
|root|.SCGroup-skeleton-root|Styles applied to the root element.|
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
function GroupSkeleton(props) {
|
|
38
|
+
const theme = (0, material_1.useTheme)();
|
|
39
|
+
return (react_1.default.createElement(Root, Object.assign({ className: classes.root }, props, { image: react_1.default.createElement(Skeleton_1.default, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeSmall, height: theme.selfcommunity.group.avatar.sizeSmall }), primary: react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 120, style: { marginBottom: 10 } }), secondary: react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 70, style: { marginBottom: 10 } }), actions: react_1.default.createElement(material_1.Button, { size: "small", variant: "outlined", disabled: true },
|
|
40
|
+
react_1.default.createElement(Skeleton_1.default, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } })) })));
|
|
41
|
+
}
|
|
42
|
+
exports.default = GroupSkeleton;
|