@selfcommunity/react-ui 0.8.0-alpha.30 → 0.8.0-alpha.32
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/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +2 -2
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +2 -2
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -37,6 +37,6 @@ function ComposerTypeButtonGroup(props) {
|
|
|
37
37
|
const handleChange = (0, react_1.useCallback)((event, value) => {
|
|
38
38
|
onChange && onChange(value);
|
|
39
39
|
}, [onChange]);
|
|
40
|
-
return (0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POST }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) })), hasDiscussionType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_DISCUSSION }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) })), hasPollType && (0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POLL }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) }))] }));
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POST }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) }))), hasDiscussionType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_DISCUSSION }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) }))), hasPostType && hasPollType && ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, Object.assign({ value: Composer_1.COMPOSER_TYPE_POLL }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) })))] })));
|
|
41
41
|
}
|
|
42
42
|
exports.default = ComposerTypeButtonGroup;
|
|
@@ -48,12 +48,12 @@ function NavigationMenuDrawer(inProps) {
|
|
|
48
48
|
// Subscriber for pubsub callback
|
|
49
49
|
const subscriber = (0, react_1.useCallback)((msg, data) => {
|
|
50
50
|
if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.TOGGLE_DRAWER}`) {
|
|
51
|
-
setIsDrawerOpen(!
|
|
51
|
+
setIsDrawerOpen(!isDrawerOpen);
|
|
52
52
|
}
|
|
53
53
|
else if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.SET_DRAWER}`) {
|
|
54
54
|
setIsDrawerOpen(data.open);
|
|
55
55
|
}
|
|
56
|
-
}, [
|
|
56
|
+
}, [isDrawerOpen]);
|
|
57
57
|
/**
|
|
58
58
|
* When a ws notification arrives, update data
|
|
59
59
|
*/
|
|
@@ -5,7 +5,7 @@ import { ToggleButton, ToggleButtonGroup } from '@mui/material';
|
|
|
5
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { FormattedMessage } from 'react-intl';
|
|
8
|
-
import { SCPreferences, UserUtils, useSCPreferences, useSCUser
|
|
8
|
+
import { SCPreferences, UserUtils, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
9
9
|
import { COMPOSER_TYPE_DISCUSSION, COMPOSER_TYPE_POLL, COMPOSER_TYPE_POST } from '../../../constants/Composer';
|
|
10
10
|
import { PREFIX } from '../constants';
|
|
11
11
|
const classes = {
|
|
@@ -35,5 +35,5 @@ export default function ComposerTypeButtonGroup(props) {
|
|
|
35
35
|
const handleChange = useCallback((event, value) => {
|
|
36
36
|
onChange && onChange(value);
|
|
37
37
|
}, [onChange]);
|
|
38
|
-
return _jsxs(Root, Object.assign({ className: classNames(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && _jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_POST }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) })), hasDiscussionType && _jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_DISCUSSION }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) })), hasPollType && _jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_POLL }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) }))] }));
|
|
38
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onChange: handleChange, exclusive: true, value: value }, rest, { children: [hasPostType && (_jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_POST }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.post", defaultMessage: "ui.composer.typeSwitch.post" }) }))), hasDiscussionType && (_jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_DISCUSSION }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.discussion", defaultMessage: "ui.composer.typeSwitch.discussion" }) }))), hasPostType && hasPollType && (_jsx(ToggleButton, Object.assign({ value: COMPOSER_TYPE_POLL }, { children: _jsx(FormattedMessage, { id: "ui.composer.typeSwitch.poll", defaultMessage: "ui.composer.typeSwitch.poll" }) })))] })));
|
|
39
39
|
}
|
|
@@ -46,12 +46,12 @@ export default function NavigationMenuDrawer(inProps) {
|
|
|
46
46
|
// Subscriber for pubsub callback
|
|
47
47
|
const subscriber = useCallback((msg, data) => {
|
|
48
48
|
if (msg === `${SCTopicType.LAYOUT}.${SCLayoutEventType.TOGGLE_DRAWER}`) {
|
|
49
|
-
setIsDrawerOpen(!
|
|
49
|
+
setIsDrawerOpen(!isDrawerOpen);
|
|
50
50
|
}
|
|
51
51
|
else if (msg === `${SCTopicType.LAYOUT}.${SCLayoutEventType.SET_DRAWER}`) {
|
|
52
52
|
setIsDrawerOpen(data.open);
|
|
53
53
|
}
|
|
54
|
-
}, [
|
|
54
|
+
}, [isDrawerOpen]);
|
|
55
55
|
/**
|
|
56
56
|
* When a ws notification arrives, update data
|
|
57
57
|
*/
|