@selfcommunity/react-ui 0.10.4-alpha.2 → 0.10.4-alpha.3
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/Composer.js +13 -0
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +1 -1
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +1 -1
- package/lib/esm/components/Composer/Composer.js +13 -0
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +1 -1
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +2 -2
- package/lib/umd/314.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -2
- package/lib/umd/148.js +0 -2
- /package/lib/umd/{148.js.LICENSE.txt → 314.js.LICENSE.txt} +0 -0
|
@@ -31,6 +31,7 @@ const constants_1 = require("./constants");
|
|
|
31
31
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
32
32
|
const CloseLayer_1 = tslib_1.__importDefault(require("./Layer/CloseLayer"));
|
|
33
33
|
const BackdropScrollDisabled_1 = tslib_1.__importDefault(require("../../shared/BackdropScrollDisabled"));
|
|
34
|
+
const body_scroll_lock_1 = require("body-scroll-lock");
|
|
34
35
|
const DialogTransition = (0, react_1.forwardRef)(function Transition(props, ref) {
|
|
35
36
|
return (0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ ref: ref }, props));
|
|
36
37
|
});
|
|
@@ -271,10 +272,21 @@ function Composer(inProps) {
|
|
|
271
272
|
*/
|
|
272
273
|
dialogRef.current.addEventListener('touchstart', handleTouchStart);
|
|
273
274
|
dialogRef.current.addEventListener('touchmove', handleTouchmove);
|
|
275
|
+
(0, body_scroll_lock_1.disableBodyScroll)(dialogRef.current, {
|
|
276
|
+
allowTouchMove: (el) => {
|
|
277
|
+
return (el &&
|
|
278
|
+
typeof el === 'object' &&
|
|
279
|
+
el.className &&
|
|
280
|
+
typeof el.className === 'string' &&
|
|
281
|
+
el.className.include &&
|
|
282
|
+
el.className.include('SCComposer-content'));
|
|
283
|
+
}
|
|
284
|
+
});
|
|
274
285
|
return () => {
|
|
275
286
|
var _a, _b;
|
|
276
287
|
(_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', handleTouchStart);
|
|
277
288
|
(_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchmove', handleTouchmove);
|
|
289
|
+
(0, body_scroll_lock_1.enableBodyScroll)(dialogRef.current);
|
|
278
290
|
};
|
|
279
291
|
}, [dialogRef.current, isIOS]);
|
|
280
292
|
/* Handlers */
|
|
@@ -503,6 +515,7 @@ function Composer(inProps) {
|
|
|
503
515
|
});
|
|
504
516
|
}
|
|
505
517
|
else {
|
|
518
|
+
(0, body_scroll_lock_1.clearAllBodyScrollLocks)();
|
|
506
519
|
onClose && onClose(e);
|
|
507
520
|
setLayer(null);
|
|
508
521
|
dispatch({ type: 'reset' });
|
|
@@ -85,5 +85,5 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
85
85
|
autoHideDuration: 7000
|
|
86
86
|
});
|
|
87
87
|
}, []);
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleClick, ref: ref }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))] }));
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleClick, ref: ref }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), open && (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))] }));
|
|
89
89
|
});
|
|
@@ -103,6 +103,6 @@ function InlineComposerWidget(inProps) {
|
|
|
103
103
|
if (!react_core_1.UserUtils.isStaff(scUserContext.user) && onlyStaffEnabled) {
|
|
104
104
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
105
105
|
}
|
|
106
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.input }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "circular" })) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), (0, jsx_runtime_1.jsx)(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType })] }));
|
|
106
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.input }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "circular" })) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && ((0, jsx_runtime_1.jsx)(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
107
107
|
}
|
|
108
108
|
exports.default = InlineComposerWidget;
|
|
@@ -29,6 +29,7 @@ import { PREFIX } from './constants';
|
|
|
29
29
|
import ComposerSkeleton from './Skeleton';
|
|
30
30
|
import CloseLayer from './Layer/CloseLayer';
|
|
31
31
|
import BackdropScrollDisabled from '../../shared/BackdropScrollDisabled';
|
|
32
|
+
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
|
|
32
33
|
const DialogTransition = forwardRef(function Transition(props, ref) {
|
|
33
34
|
return _jsx(Fade, Object.assign({ ref: ref }, props));
|
|
34
35
|
});
|
|
@@ -269,10 +270,21 @@ export default function Composer(inProps) {
|
|
|
269
270
|
*/
|
|
270
271
|
dialogRef.current.addEventListener('touchstart', handleTouchStart);
|
|
271
272
|
dialogRef.current.addEventListener('touchmove', handleTouchmove);
|
|
273
|
+
disableBodyScroll(dialogRef.current, {
|
|
274
|
+
allowTouchMove: (el) => {
|
|
275
|
+
return (el &&
|
|
276
|
+
typeof el === 'object' &&
|
|
277
|
+
el.className &&
|
|
278
|
+
typeof el.className === 'string' &&
|
|
279
|
+
el.className.include &&
|
|
280
|
+
el.className.include('SCComposer-content'));
|
|
281
|
+
}
|
|
282
|
+
});
|
|
272
283
|
return () => {
|
|
273
284
|
var _a, _b;
|
|
274
285
|
(_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', handleTouchStart);
|
|
275
286
|
(_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchmove', handleTouchmove);
|
|
287
|
+
enableBodyScroll(dialogRef.current);
|
|
276
288
|
};
|
|
277
289
|
}, [dialogRef.current, isIOS]);
|
|
278
290
|
/* Handlers */
|
|
@@ -501,6 +513,7 @@ export default function Composer(inProps) {
|
|
|
501
513
|
});
|
|
502
514
|
}
|
|
503
515
|
else {
|
|
516
|
+
clearAllBodyScrollLocks();
|
|
504
517
|
onClose && onClose(e);
|
|
505
518
|
setLayer(null);
|
|
506
519
|
dispatch({ type: 'reset' });
|
|
@@ -83,5 +83,5 @@ export default React.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
|
83
83
|
autoHideDuration: 7000
|
|
84
84
|
});
|
|
85
85
|
}, []);
|
|
86
|
-
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleClick, ref: ref }, { children: _jsx(Icon, { children: "add_circle_outline" }) })), _jsx(Composer, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))] }));
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleClick, ref: ref }, { children: _jsx(Icon, { children: "add_circle_outline" }) })), open && _jsx(Composer, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))] }));
|
|
87
87
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
|
-
import { SCFeedTypologyType
|
|
4
|
+
import { SCFeedTypologyType } from '@selfcommunity/types';
|
|
5
5
|
import { Link, SCPreferences, SCRoutes, UserUtils, useSCContext, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
6
6
|
import { Avatar, Box, Button, CardContent } from '@mui/material';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
@@ -101,5 +101,5 @@ export default function InlineComposerWidget(inProps) {
|
|
|
101
101
|
if (!UserUtils.isStaff(scUserContext.user) && onlyStaffEnabled) {
|
|
102
102
|
return _jsx(HiddenPlaceholder, {});
|
|
103
103
|
}
|
|
104
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Box, Object.assign({ className: classes.input }, { children: _jsx(Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : _jsx(FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), _jsx(Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? (_jsx(Avatar, { variant: "circular" })) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: _jsx(Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), _jsx(Composer, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType })] }));
|
|
104
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Box, Object.assign({ className: classes.input }, { children: _jsx(Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : _jsx(FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), _jsx(Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? (_jsx(Avatar, { variant: "circular" })) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: _jsx(Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && (_jsx(Composer, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
105
105
|
}
|