@matrix-widget-toolkit/mui 1.2.1 → 2.0.0

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.
@@ -658,7 +658,7 @@ function ElementMuiThemeProvider(_a) {
658
658
  * limitations under the License.
659
659
  */
660
660
  function createAvatarUrl(url, _a) {
661
- var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
661
+ var _b = {} , _c = _b.size, size = _c === void 0 ? 60 : _c;
662
662
  var mxcPrefix = 'mxc://';
663
663
  if (url.indexOf(mxcPrefix) !== 0) {
664
664
  return url;
@@ -782,7 +782,7 @@ var ElementAvatar = react$2.forwardRef(function ElementAvatar(_a, ref) {
782
782
  });
783
783
 
784
784
  function LoadingView() {
785
- var id = utils.unstable_useId();
785
+ var id = react$2.useId();
786
786
  var isLongLoad = reactUse.useTimeout(100)[0];
787
787
  var t = reactI18next.useTranslation('widget-toolkit').t;
788
788
  return isLongLoad() ? (jsxRuntime.jsxs(material.Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, children: [jsxRuntime.jsx(material.CircularProgress, { "aria-labelledby": id }), jsxRuntime.jsx(material.Typography, { py: 2, variant: "h6", id: id, children: t('loading.message', 'Loading…') })] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
@@ -890,10 +890,10 @@ function MissingParametersError(_a) {
890
890
  }
891
891
  });
892
892
  }); }, [widgetApi, widgetRegistration]);
893
- var errorDialogTitleId = utils.unstable_useId();
894
- var errorDialogTextId = utils.unstable_useId();
895
- var successDialogTitleId = utils.unstable_useId();
896
- var successDialogTextId = utils.unstable_useId();
893
+ var errorDialogTitleId = react$2.useId();
894
+ var errorDialogTextId = react$2.useId();
895
+ var successDialogTitleId = react$2.useId();
896
+ var successDialogTextId = react$2.useId();
897
897
  return (jsxRuntime.jsxs(material.Box, { my: 2, children: [jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('missing-parameters.title', 'Wrong widget registration') }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('missing-parameters.instructions', 'The widget is not registered correctly. Make sure to include the correct parameters in the widget URL:') }), jsxRuntime.jsx(material.Box, { my: 1, children: jsxRuntime.jsx(CopyableCode, { code: api.generateWidgetRegistrationUrl() }) }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('missing-parameters.repair-instructions', 'You can either modify the widget registration manually or fix it automatically:') }), jsxRuntime.jsx(material.Box, { mt: 1, children: jsxRuntime.jsx(material.Button, { variant: "contained", onClick: handleRepairWidget, children: t('missing-parameters.repair', 'Repair registration') }) })] }), jsxRuntime.jsxs(material.Dialog, { open: isErrorDialogOpen, onClose: function () { return setErrorDialogOpen(false); }, "aria-labelledby": errorDialogTitleId, "aria-describedby": errorDialogTextId, children: [jsxRuntime.jsx(material.DialogTitle, { id: errorDialogTitleId, children: t('missing-parameters.permissions-error.title', 'Error') }), jsxRuntime.jsx(material.DialogContent, { children: jsxRuntime.jsx(material.DialogContentText, { id: errorDialogTextId, children: t('missing-parameters.permissions-error.instructions', 'Insufficient permissions, could not configure widget. Only room admins can configure the widget.') }) }), jsxRuntime.jsx(material.DialogActions, { children: jsxRuntime.jsx(material.Button, { onClick: function () { return setErrorDialogOpen(false); }, autoFocus: true, children: t('missing-parameters.permissions-error.close', 'Close') }) })] }), jsxRuntime.jsxs(material.Dialog, { open: isCompleted, "aria-labelledby": successDialogTitleId, "aria-describedby": successDialogTextId, children: [jsxRuntime.jsx(material.DialogTitle, { id: successDialogTitleId, children: t('missing-parameters.completed.title', 'Widget configuration complete') }), jsxRuntime.jsx(material.DialogContent, { children: jsxRuntime.jsx(material.DialogContentText, { id: successDialogTextId, children: t('missing-parameters.completed.instructions', 'Configuration completed, reopen the widget to start using it.') }) })] })] }));
898
898
  }
899
899
 
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { createTheme, ThemeProvider, CssBaseline, styled, Avatar, Box, CircularProgress, Typography, Alert, AlertTitle, Button, Paper, IconButton, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions } from '@mui/material';
3
- import { useState, useEffect, useMemo, forwardRef, useCallback } from 'react';
3
+ import { useState, useEffect, useMemo, forwardRef, useId, useCallback } from 'react';
4
4
  import '@fontsource/inter/400.css';
5
5
  import '@fontsource/inter/600.css';
6
6
  import { ThemeSelectionProvider, useThemeSelection, CapabilitiesGuard, useWidgetApi, WidgetApiProvider } from '@matrix-widget-toolkit/react';
7
7
  import { deDE, enUS } from '@mui/material/locale';
8
- import { deepmerge, unstable_useId } from '@mui/utils';
8
+ import { deepmerge } from '@mui/utils';
9
9
  import i18n from 'i18next';
10
10
  import createCache from '@emotion/cache';
11
11
  import { CacheProvider } from '@emotion/react';
@@ -646,7 +646,7 @@ function ElementMuiThemeProvider(_a) {
646
646
  * limitations under the License.
647
647
  */
648
648
  function createAvatarUrl(url, _a) {
649
- var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
649
+ var _b = {} , _c = _b.size, size = _c === void 0 ? 60 : _c;
650
650
  var mxcPrefix = 'mxc://';
651
651
  if (url.indexOf(mxcPrefix) !== 0) {
652
652
  return url;
@@ -770,7 +770,7 @@ var ElementAvatar = forwardRef(function ElementAvatar(_a, ref) {
770
770
  });
771
771
 
772
772
  function LoadingView() {
773
- var id = unstable_useId();
773
+ var id = useId();
774
774
  var isLongLoad = useTimeout(100)[0];
775
775
  var t = useTranslation('widget-toolkit').t;
776
776
  return isLongLoad() ? (jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, children: [jsx(CircularProgress, { "aria-labelledby": id }), jsx(Typography, { py: 2, variant: "h6", id: id, children: t('loading.message', 'Loading…') })] })) : (jsx(Fragment, {}));
@@ -878,10 +878,10 @@ function MissingParametersError(_a) {
878
878
  }
879
879
  });
880
880
  }); }, [widgetApi, widgetRegistration]);
881
- var errorDialogTitleId = unstable_useId();
882
- var errorDialogTextId = unstable_useId();
883
- var successDialogTitleId = unstable_useId();
884
- var successDialogTextId = unstable_useId();
881
+ var errorDialogTitleId = useId();
882
+ var errorDialogTextId = useId();
883
+ var successDialogTitleId = useId();
884
+ var successDialogTextId = useId();
885
885
  return (jsxs(Box, { my: 2, children: [jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('missing-parameters.title', 'Wrong widget registration') }), jsx(Typography, { variant: "body2", children: t('missing-parameters.instructions', 'The widget is not registered correctly. Make sure to include the correct parameters in the widget URL:') }), jsx(Box, { my: 1, children: jsx(CopyableCode, { code: generateWidgetRegistrationUrl() }) }), jsx(Typography, { variant: "body2", children: t('missing-parameters.repair-instructions', 'You can either modify the widget registration manually or fix it automatically:') }), jsx(Box, { mt: 1, children: jsx(Button, { variant: "contained", onClick: handleRepairWidget, children: t('missing-parameters.repair', 'Repair registration') }) })] }), jsxs(Dialog, { open: isErrorDialogOpen, onClose: function () { return setErrorDialogOpen(false); }, "aria-labelledby": errorDialogTitleId, "aria-describedby": errorDialogTextId, children: [jsx(DialogTitle, { id: errorDialogTitleId, children: t('missing-parameters.permissions-error.title', 'Error') }), jsx(DialogContent, { children: jsx(DialogContentText, { id: errorDialogTextId, children: t('missing-parameters.permissions-error.instructions', 'Insufficient permissions, could not configure widget. Only room admins can configure the widget.') }) }), jsx(DialogActions, { children: jsx(Button, { onClick: function () { return setErrorDialogOpen(false); }, autoFocus: true, children: t('missing-parameters.permissions-error.close', 'Close') }) })] }), jsxs(Dialog, { open: isCompleted, "aria-labelledby": successDialogTitleId, "aria-describedby": successDialogTextId, children: [jsx(DialogTitle, { id: successDialogTitleId, children: t('missing-parameters.completed.title', 'Widget configuration complete') }), jsx(DialogContent, { children: jsx(DialogContentText, { id: successDialogTextId, children: t('missing-parameters.completed.instructions', 'Configuration completed, reopen the widget to start using it.') }) })] })] }));
886
886
  }
887
887
 
package/build/index.d.ts CHANGED
@@ -21,7 +21,7 @@ import { WidgetRegistration } from '@matrix-widget-toolkit/api';
21
21
  * A component to display user and room avatars in the style of Element.
22
22
  * @param param0 - {@link ElementAvatarProps}
23
23
  */
24
- export declare const ElementAvatar: ForwardRefExoticComponent<Pick<ElementAvatarProps, "id" | "userId" | "displayName" | "avatarUrl" | "title" | "results" | "children" | "slot" | "style" | "onReset" | "onError" | "color" | "translate" | "classes" | "className" | "sx" | "tabIndex" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "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" | "component" | "variant" | "slotProps" | "slots" | "sizes" | "alt" | "src" | "imgProps" | "srcSet"> & RefAttributes<HTMLDivElement>>;
24
+ export declare const ElementAvatar: ForwardRefExoticComponent<Omit<ElementAvatarProps, "ref"> & RefAttributes<HTMLDivElement>>;
25
25
 
26
26
  /**
27
27
  * Props for the {@link ElementAvatar} component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrix-widget-toolkit/mui",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "A customized material-ui theme that matches the style of the Element Matrix client",
5
5
  "author": "Nordeck IT + Consulting GmbH",
6
6
  "license": "Apache-2.0",
@@ -9,20 +9,20 @@
9
9
  "types": "./build/index.d.ts",
10
10
  "devDependencies": {
11
11
  "@craco/craco": "^7.1.0",
12
- "@testing-library/jest-dom": "^6.1.4",
13
- "@testing-library/react": "^12.1.5",
14
- "@testing-library/user-event": "^14.5.1",
12
+ "@testing-library/jest-dom": "^6.4.2",
13
+ "@testing-library/react": "^14.2.2",
14
+ "@testing-library/user-event": "^14.5.2",
15
15
  "@types/jest": "^27.5.2",
16
- "@types/jest-axe": "^3.5.6",
17
- "@types/lodash": "^4.14.199",
16
+ "@types/jest-axe": "^3.5.9",
17
+ "@types/lodash": "^4.17.0",
18
18
  "@types/node": "^20.8.6",
19
- "@types/react": "^17.0.45",
19
+ "@types/react": "^18.2.74",
20
20
  "copyfiles": "^2.4.1",
21
- "i18next-parser": "^8.9.0",
21
+ "i18next-parser": "^8.13.0",
22
22
  "jest-axe": "^8.0.0",
23
- "react": "^17.0.2",
23
+ "react": "^18.2.0",
24
24
  "react-scripts": "5.0.1",
25
- "typescript": "^5.2.2"
25
+ "typescript": "^5.4.5"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsc && rollup --config ../../rollup.config.mjs",
@@ -40,20 +40,20 @@
40
40
  "dependencies": {
41
41
  "@emotion/cache": "^11.11.0",
42
42
  "@emotion/react": "^11.11.4",
43
- "@emotion/styled": "^11.11.0",
44
- "@fontsource/inter": "^5.0.17",
45
- "@mui/icons-material": "^5.15.14",
46
- "@mui/material": "^5.15.14",
43
+ "@emotion/styled": "^11.11.5",
44
+ "@fontsource/inter": "^5.0.18",
45
+ "@mui/icons-material": "^5.15.15",
46
+ "@mui/material": "^5.15.15",
47
47
  "@mui/utils": "^5.14.13",
48
48
  "@matrix-widget-toolkit/api": "^3.2.2",
49
- "@matrix-widget-toolkit/react": "^1.0.6",
50
- "i18next": "^23.10.1",
51
- "i18next-browser-languagedetector": "^7.2.0",
52
- "i18next-resources-to-backend": "^1.2.0",
49
+ "@matrix-widget-toolkit/react": "^2.0.0",
50
+ "i18next": "^23.11.2",
51
+ "i18next-browser-languagedetector": "^7.2.1",
52
+ "i18next-resources-to-backend": "^1.2.1",
53
53
  "lodash": "^4.17.21",
54
54
  "matrix-widget-api": "^1.6.0",
55
- "react": "^17.0.2",
56
- "react-i18next": "^14.1.0",
55
+ "react": "^18.2.0",
56
+ "react-i18next": "^14.1.1",
57
57
  "react-use": "^17.5.0"
58
58
  },
59
59
  "repository": {