@matrix-widget-toolkit/mui 1.1.1 → 1.1.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.
@@ -681,10 +681,11 @@ function ElementMuiThemeProvider(_a) {
681
681
  */
682
682
  function createAvatarUrl(url, _a) {
683
683
  var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
684
- var mxcUrl = new URL(url);
685
- if (mxcUrl.protocol.toLowerCase() !== 'mxc:') {
684
+ var mxcPrefix = 'mxc://';
685
+ if (url.indexOf(mxcPrefix) !== 0) {
686
686
  return url;
687
687
  }
688
+ var mxcUrl = url.slice(mxcPrefix.length);
688
689
  // TODO: Instead of retrieving the home server from an env variable, it would
689
690
  // be good to get this passed by the widget host, e.g. as an URL parameter.
690
691
  // In general our tight CSP makes it difficult to load images from this
@@ -693,7 +694,7 @@ function createAvatarUrl(url, _a) {
693
694
  // current users id and resolving the home server URL from the well-known
694
695
  // endpoint. However, this would also require a broad connect-src in the CSP.
695
696
  var homeServer = getEnvironment('REACT_APP_HOME_SERVER_URL', 'https://matrix-client.matrix.org');
696
- var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl.hostname).concat(mxcUrl.pathname, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
697
+ var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
697
698
  return imageUrl.toString();
698
699
  }
699
700
 
@@ -876,6 +877,7 @@ function CopyableCode(_a) {
876
877
  var t = reactI18next.useTranslation('widget-toolkit').t;
877
878
  var _b = react$2.useState(false), hasCopied = _b[0], setHasCopied = _b[1];
878
879
  var _c = reactUse.useCopyToClipboard(), copyToClipboard = _c[1];
880
+ var copyLabel = t('code.copy-to-clipboard', 'Copy to clipboard');
879
881
  return (jsxRuntime.jsx(material.Paper, __assign$5({ sx: { position: 'relative' } }, { children: jsxRuntime.jsxs(material.Box, __assign$5({ sx: { overflowY: 'auto' } }, { children: [jsxRuntime.jsx(material.Box, __assign$5({ component: "code", sx: { userSelect: 'all' }, m: 0 }, { children: jsxRuntime.jsx(material.Box, __assign$5({ component: "pre", m: 2 }, { children: code })) })), jsxRuntime.jsx(material.IconButton, __assign$5({ sx: function (theme) { return ({
880
882
  position: 'absolute',
881
883
  right: theme.spacing(1),
@@ -883,7 +885,7 @@ function CopyableCode(_a) {
883
885
  }); }, onClick: function () {
884
886
  copyToClipboard(code);
885
887
  setHasCopied(true);
886
- }, onBlur: function () { return setHasCopied(false); }, "aria-label": t('code.copy-to-clipboard', 'Copy to clipboard') }, { children: hasCopied ? jsxRuntime.jsx(CheckOutlinedIcon__default.default, {}) : jsxRuntime.jsx(ContentCopyOutlinedIcon__default.default, {}) }))] })) })));
888
+ }, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel }, { children: hasCopied ? jsxRuntime.jsx(CheckOutlinedIcon__default.default, {}) : jsxRuntime.jsx(ContentCopyOutlinedIcon__default.default, {}) }))] })) })));
887
889
  }
888
890
 
889
891
  var __assign$4 = (undefined && undefined.__assign) || function () {
@@ -669,10 +669,11 @@ function ElementMuiThemeProvider(_a) {
669
669
  */
670
670
  function createAvatarUrl(url, _a) {
671
671
  var _b = _a === void 0 ? {} : _a, _c = _b.size, size = _c === void 0 ? 60 : _c;
672
- var mxcUrl = new URL(url);
673
- if (mxcUrl.protocol.toLowerCase() !== 'mxc:') {
672
+ var mxcPrefix = 'mxc://';
673
+ if (url.indexOf(mxcPrefix) !== 0) {
674
674
  return url;
675
675
  }
676
+ var mxcUrl = url.slice(mxcPrefix.length);
676
677
  // TODO: Instead of retrieving the home server from an env variable, it would
677
678
  // be good to get this passed by the widget host, e.g. as an URL parameter.
678
679
  // In general our tight CSP makes it difficult to load images from this
@@ -681,7 +682,7 @@ function createAvatarUrl(url, _a) {
681
682
  // current users id and resolving the home server URL from the well-known
682
683
  // endpoint. However, this would also require a broad connect-src in the CSP.
683
684
  var homeServer = getEnvironment('REACT_APP_HOME_SERVER_URL', 'https://matrix-client.matrix.org');
684
- var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl.hostname).concat(mxcUrl.pathname, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
685
+ var imageUrl = new URL("/_matrix/media/r0/thumbnail/".concat(mxcUrl, "?width=").concat(size, "&height=").concat(size, "&method=crop"), homeServer);
685
686
  return imageUrl.toString();
686
687
  }
687
688
 
@@ -864,6 +865,7 @@ function CopyableCode(_a) {
864
865
  var t = useTranslation('widget-toolkit').t;
865
866
  var _b = useState(false), hasCopied = _b[0], setHasCopied = _b[1];
866
867
  var _c = useCopyToClipboard(), copyToClipboard = _c[1];
868
+ var copyLabel = t('code.copy-to-clipboard', 'Copy to clipboard');
867
869
  return (jsx(Paper, __assign$5({ sx: { position: 'relative' } }, { children: jsxs(Box, __assign$5({ sx: { overflowY: 'auto' } }, { children: [jsx(Box, __assign$5({ component: "code", sx: { userSelect: 'all' }, m: 0 }, { children: jsx(Box, __assign$5({ component: "pre", m: 2 }, { children: code })) })), jsx(IconButton, __assign$5({ sx: function (theme) { return ({
868
870
  position: 'absolute',
869
871
  right: theme.spacing(1),
@@ -871,7 +873,7 @@ function CopyableCode(_a) {
871
873
  }); }, onClick: function () {
872
874
  copyToClipboard(code);
873
875
  setHasCopied(true);
874
- }, onBlur: function () { return setHasCopied(false); }, "aria-label": t('code.copy-to-clipboard', 'Copy to clipboard') }, { children: hasCopied ? jsx(CheckOutlinedIcon, {}) : jsx(ContentCopyOutlinedIcon, {}) }))] })) })));
876
+ }, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel }, { children: hasCopied ? jsx(CheckOutlinedIcon, {}) : jsx(ContentCopyOutlinedIcon, {}) }))] })) })));
875
877
  }
876
878
 
877
879
  var __assign$4 = (undefined && undefined.__assign) || function () {
package/build/index.d.ts CHANGED
@@ -22,7 +22,7 @@ import { WidgetRegistration } from '@matrix-widget-toolkit/api';
22
22
  * A component to display user and room avatars in the style of Element.
23
23
  * @param param0 - {@link ElementAvatarProps}
24
24
  */
25
- export declare const ElementAvatar: ForwardRefExoticComponent<Pick<ElementAvatarProps, "id" | "userId" | "displayName" | "avatarUrl" | "title" | "children" | "slot" | "onReset" | "onError" | "color" | "translate" | keyof CommonProps | "sx" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "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" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & RefAttributes<HTMLDivElement>>;
25
+ export declare const ElementAvatar: ForwardRefExoticComponent<Pick<ElementAvatarProps, "id" | "userId" | "displayName" | "avatarUrl" | "title" | "results" | "children" | "slot" | "onReset" | "onError" | "color" | "translate" | keyof CommonProps | "sx" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "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" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & RefAttributes<HTMLDivElement>>;
26
26
 
27
27
  /**
28
28
  * 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.1.1",
3
+ "version": "1.1.3",
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",
@@ -14,12 +14,12 @@
14
14
  "@testing-library/user-event": "^14.4.3",
15
15
  "@types/jest": "^27.5.2",
16
16
  "@types/jest-axe": "^3.5.5",
17
- "@types/lodash": "^4.14.191",
18
- "@types/node": "^16.18.14",
17
+ "@types/lodash": "^4.14.194",
18
+ "@types/node": "^16.18.23",
19
19
  "@types/react": "^17.0.45",
20
20
  "copyfiles": "^2.4.1",
21
21
  "i18next-parser": "^7.7.0",
22
- "jest-axe": "^7.0.0",
22
+ "jest-axe": "^7.0.1",
23
23
  "react": "^17.0.2",
24
24
  "react-scripts": "5.0.1",
25
25
  "typescript": "^4.8.4"
@@ -38,22 +38,22 @@
38
38
  "generate-api-report": "tsc && api-extractor run --verbose --local"
39
39
  },
40
40
  "dependencies": {
41
- "@emotion/cache": "^11.10.5",
42
- "@emotion/react": "^11.10.5",
43
- "@emotion/styled": "^11.10.5",
44
- "@fontsource/inter": "^4.5.14",
45
- "@mui/icons-material": "^5.11.0",
46
- "@mui/material": "^5.11.3",
47
- "@mui/utils": "^5.11.2",
48
- "@matrix-widget-toolkit/api": "^3.0.0",
49
- "@matrix-widget-toolkit/react": "^1.0.4",
50
- "i18next": "^22.0.4",
41
+ "@emotion/cache": "^11.10.7",
42
+ "@emotion/react": "^11.10.6",
43
+ "@emotion/styled": "^11.10.6",
44
+ "@fontsource/inter": "^4.5.15",
45
+ "@mui/icons-material": "^5.11.16",
46
+ "@mui/material": "^5.12.0",
47
+ "@mui/utils": "^5.12.0",
48
+ "@matrix-widget-toolkit/api": "^3.2.0",
49
+ "@matrix-widget-toolkit/react": "^1.0.5",
50
+ "i18next": "^22.4.14",
51
51
  "i18next-browser-languagedetector": "^7.0.1",
52
- "i18next-resources-to-backend": "^1.0.0",
52
+ "i18next-resources-to-backend": "^1.1.3",
53
53
  "lodash": "^4.17.21",
54
- "matrix-widget-api": "^1.1.1",
54
+ "matrix-widget-api": "^1.3.1",
55
55
  "react": "^17.0.2",
56
- "react-i18next": "^12.0.0",
56
+ "react-i18next": "^12.2.0",
57
57
  "react-use": "^17.4.0"
58
58
  },
59
59
  "repository": {