@selfcommunity/react-core 0.7.0-alpha.0 → 0.7.0-alpha.2
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/provider/SCThemeProvider/index.js +3 -3
- package/lib/cjs/hooks/useSCJoinedCoursesManager.js +0 -1
- package/lib/cjs/hooks/useSCWebPushMessaging.js +2 -2
- package/lib/cjs/themes/theme.js +2 -2
- package/lib/cjs/types/theme.d.ts +1 -1
- package/lib/esm/components/provider/SCThemeProvider/index.js +1 -1
- package/lib/esm/hooks/useSCJoinedCoursesManager.js +0 -1
- package/lib/esm/hooks/useSCWebPushMessaging.js +1 -1
- package/lib/esm/themes/theme.js +1 -1
- package/lib/esm/types/theme.d.ts +1 -1
- package/lib/umd/react-core.js +1 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ exports.useSCTheme = exports.withSCTheme = exports.SCThemeContext = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
8
|
const theme_1 = tslib_1.__importDefault(require("../../../themes/theme"));
|
|
9
9
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
10
10
|
const SCPreferencesProvider_1 = require("../SCPreferencesProvider");
|
|
@@ -60,7 +60,7 @@ function SCThemeProvider({ children = null }) {
|
|
|
60
60
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
61
61
|
setCustomTheme(theme);
|
|
62
62
|
}, [scContext.settings.theme]);
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(exports.SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: (0, jsx_runtime_1.jsx)(
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: (0, jsx_runtime_1.jsx)(material_1.ThemeProvider, Object.assign({ theme: theme }, { children: children })) })));
|
|
64
64
|
}
|
|
65
65
|
exports.default = SCThemeProvider;
|
|
66
66
|
/**
|
|
@@ -69,7 +69,7 @@ exports.default = SCThemeProvider;
|
|
|
69
69
|
*/
|
|
70
70
|
const withSCTheme = (Component) => (props) => {
|
|
71
71
|
const scThemeContext = (0, react_1.useContext)(exports.SCThemeContext);
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, Object.assign({ theme: scThemeContext.theme }, { children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props)) })));
|
|
73
73
|
};
|
|
74
74
|
exports.withSCTheme = withSCTheme;
|
|
75
75
|
/**
|
|
@@ -32,7 +32,6 @@ function useSCJoinedCoursesManager(user) {
|
|
|
32
32
|
const authUserId = user ? user.id : null;
|
|
33
33
|
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
34
34
|
features &&
|
|
35
|
-
features.includes(types_1.SCFeatureName.TAGGING) &&
|
|
36
35
|
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
37
36
|
Preferences_1.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
38
37
|
preferences[Preferences_1.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
@@ -7,7 +7,7 @@ const react_1 = require("react");
|
|
|
7
7
|
const SCContextProvider_1 = require("../components/provider/SCContextProvider");
|
|
8
8
|
const SCUserProvider_1 = require("../components/provider/SCUserProvider");
|
|
9
9
|
const utils_1 = require("@selfcommunity/utils");
|
|
10
|
-
const
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
11
|
const utils_2 = require("@selfcommunity/utils");
|
|
12
12
|
const Errors_1 = require("../constants/Errors");
|
|
13
13
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
@@ -61,7 +61,7 @@ function useSCWebPushMessaging() {
|
|
|
61
61
|
const showCustomRequestNotificationSnackbar = () => {
|
|
62
62
|
if (!js_cookie_1.default.get(Notifications_1.NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE)) {
|
|
63
63
|
enqueueSnackbar(intl.formatMessage({ id: 'ui.webPushNotification.requestPermission', defaultMessage: 'ui.webPushNotification.requestPermission' }), {
|
|
64
|
-
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
64
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' }) }))] })),
|
|
65
65
|
variant: 'default',
|
|
66
66
|
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
67
67
|
preventDuplicate: true,
|
package/lib/cjs/themes/theme.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
5
|
const utils_1 = require("@selfcommunity/utils");
|
|
6
6
|
const validate_color_1 = tslib_1.__importDefault(require("validate-color"));
|
|
7
7
|
const Preferences_1 = require("../constants/Preferences");
|
|
@@ -60,6 +60,6 @@ const getTheme = (options, preferences) => {
|
|
|
60
60
|
typography: Object.assign({}, (isValidPreference(preferences, Preferences_1.STYLE_FONT_FAMILY, utils_2.isString) && { fontFamily: preferences[Preferences_1.STYLE_FONT_FAMILY].value })),
|
|
61
61
|
}
|
|
62
62
|
: {};
|
|
63
|
-
return (0,
|
|
63
|
+
return (0, material_1.createTheme)((0, utils_1.mergeDeep)(Object.assign({ selfcommunity }, defaultOptions), options));
|
|
64
64
|
};
|
|
65
65
|
exports.default = getTheme;
|
package/lib/cjs/types/theme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useState } from 'react';
|
|
3
|
-
import ThemeProvider from '@mui/material
|
|
3
|
+
import { ThemeProvider } from '@mui/material';
|
|
4
4
|
import getTheme from '../../../themes/theme';
|
|
5
5
|
import { useSCContext } from '../SCContextProvider';
|
|
6
6
|
import { useSCPreferences } from '../SCPreferencesProvider';
|
|
@@ -29,7 +29,6 @@ export default function useSCJoinedCoursesManager(user) {
|
|
|
29
29
|
const authUserId = user ? user.id : null;
|
|
30
30
|
const coursesEnabled = useMemo(() => preferences &&
|
|
31
31
|
features &&
|
|
32
|
-
features.includes(SCFeatureName.TAGGING) &&
|
|
33
32
|
features.includes(SCFeatureName.COURSE) &&
|
|
34
33
|
CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
35
34
|
preferences[CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
@@ -3,7 +3,7 @@ import { useContext, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import { useSCContext } from '../components/provider/SCContextProvider';
|
|
4
4
|
import { useSCUser } from '../components/provider/SCUserProvider';
|
|
5
5
|
import { Logger } from '@selfcommunity/utils';
|
|
6
|
-
import Button from '@mui/material
|
|
6
|
+
import { Button } from '@mui/material';
|
|
7
7
|
import { loadVersionBrowser, urlB64ToUint8Array } from '@selfcommunity/utils';
|
|
8
8
|
import { SCOPE_SC_CORE } from '../constants/Errors';
|
|
9
9
|
import { http, Endpoints } from '@selfcommunity/api-services';
|
package/lib/esm/themes/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import createTheme from '@mui/material
|
|
1
|
+
import { createTheme } from '@mui/material';
|
|
2
2
|
import { mergeDeep } from '@selfcommunity/utils';
|
|
3
3
|
import validateColor from 'validate-color';
|
|
4
4
|
import { COLORS_COLORBACK, COLORS_COLORPRIMARY, COLORS_COLORSECONDARY, COLORS_COLORFONT, COLORS_COLORFONTSECONDARY, COLORS_NAVBARBACK, STYLE_FONT_FAMILY, } from '../constants/Preferences';
|
package/lib/esm/types/theme.d.ts
CHANGED