@matrix-widget-toolkit/mui 1.1.0 → 1.1.1

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.
@@ -2,13 +2,13 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var material = require('@mui/material');
5
+ var react$2 = require('react');
5
6
  require('@fontsource/inter/400.css');
6
7
  require('@fontsource/inter/600.css');
7
8
  var react$1 = require('@matrix-widget-toolkit/react');
8
9
  var locale = require('@mui/material/locale');
9
10
  var utils = require('@mui/utils');
10
11
  var i18n = require('i18next');
11
- var react$2 = require('react');
12
12
  var createCache = require('@emotion/cache');
13
13
  var react = require('@emotion/react');
14
14
  var lodash = require('lodash');
@@ -764,6 +764,17 @@ var __assign$9 = (undefined && undefined.__assign) || function () {
764
764
  };
765
765
  return __assign$9.apply(this, arguments);
766
766
  };
767
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
768
+ var t = {};
769
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
770
+ t[p] = s[p];
771
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
772
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
773
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
774
+ t[p[i]] = s[p[i]];
775
+ }
776
+ return t;
777
+ };
767
778
  var StyledAvatar = material.styled(material.Avatar, {
768
779
  shouldForwardProp: function (p) { return p !== 'color'; },
769
780
  })(function (_a) {
@@ -784,12 +795,12 @@ var StyledAvatar = material.styled(material.Avatar, {
784
795
  * A component to display user and room avatars in the style of Element.
785
796
  * @param param0 - {@link ElementAvatarProps}
786
797
  */
787
- function ElementAvatar(_a) {
788
- var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, sx = _a.sx;
798
+ var ElementAvatar = react$2.forwardRef(function ElementAvatar(_a, ref) {
799
+ var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, props = __rest(_a, ["avatarUrl", "userId", "displayName"]);
789
800
  var src = avatarUrl ? createAvatarUrl(avatarUrl) : undefined;
790
801
  var name = displayName !== null && displayName !== void 0 ? displayName : userId;
791
- return (jsxRuntime.jsx(StyledAvatar, __assign$9({ alt: "", "aria-hidden": true, src: src, color: getColor(userId), sx: sx }, { children: getInitialLetter(name) })));
792
- }
802
+ return (jsxRuntime.jsx(StyledAvatar, __assign$9({ ref: ref, alt: "", "aria-hidden": true, src: src, color: getColor(userId) }, props, { children: getInitialLetter(name) })));
803
+ });
793
804
 
794
805
  var __assign$8 = (undefined && undefined.__assign) || function () {
795
806
  __assign$8 = Object.assign || function(t) {
@@ -1,12 +1,12 @@
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
4
  import '@fontsource/inter/400.css';
4
5
  import '@fontsource/inter/600.css';
5
6
  import { ThemeSelectionProvider, useThemeSelection, CapabilitiesGuard, useWidgetApi, WidgetApiProvider } from '@matrix-widget-toolkit/react';
6
7
  import { deDE, enUS } from '@mui/material/locale';
7
8
  import { deepmerge, unstable_useId } from '@mui/utils';
8
9
  import i18n from 'i18next';
9
- import { useState, useEffect, useMemo, useCallback } from 'react';
10
10
  import createCache from '@emotion/cache';
11
11
  import { CacheProvider } from '@emotion/react';
12
12
  import { split } from 'lodash';
@@ -752,6 +752,17 @@ var __assign$9 = (undefined && undefined.__assign) || function () {
752
752
  };
753
753
  return __assign$9.apply(this, arguments);
754
754
  };
755
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
756
+ var t = {};
757
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
758
+ t[p] = s[p];
759
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
760
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
761
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
762
+ t[p[i]] = s[p[i]];
763
+ }
764
+ return t;
765
+ };
755
766
  var StyledAvatar = styled(Avatar, {
756
767
  shouldForwardProp: function (p) { return p !== 'color'; },
757
768
  })(function (_a) {
@@ -772,12 +783,12 @@ var StyledAvatar = styled(Avatar, {
772
783
  * A component to display user and room avatars in the style of Element.
773
784
  * @param param0 - {@link ElementAvatarProps}
774
785
  */
775
- function ElementAvatar(_a) {
776
- var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, sx = _a.sx;
786
+ var ElementAvatar = forwardRef(function ElementAvatar(_a, ref) {
787
+ var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, props = __rest(_a, ["avatarUrl", "userId", "displayName"]);
777
788
  var src = avatarUrl ? createAvatarUrl(avatarUrl) : undefined;
778
789
  var name = displayName !== null && displayName !== void 0 ? displayName : userId;
779
- return (jsx(StyledAvatar, __assign$9({ alt: "", "aria-hidden": true, src: src, color: getColor(userId), sx: sx }, { children: getInitialLetter(name) })));
780
- }
790
+ return (jsx(StyledAvatar, __assign$9({ ref: ref, alt: "", "aria-hidden": true, src: src, color: getColor(userId) }, props, { children: getInitialLetter(name) })));
791
+ });
781
792
 
782
793
  var __assign$8 = (undefined && undefined.__assign) || function () {
783
794
  __assign$8 = Object.assign || function(t) {
package/build/index.d.ts CHANGED
@@ -5,13 +5,15 @@
5
5
 
6
6
  /// <reference types="react" />
7
7
 
8
+ import { AvatarProps } from '@mui/material';
8
9
  import { BackendModule } from 'i18next';
9
10
  import { Capability } from 'matrix-widget-api';
11
+ import { CommonProps } from '@mui/material/OverridableComponent';
12
+ import { ForwardRefExoticComponent } from 'react';
10
13
  import LanguageDetector from 'i18next-browser-languagedetector';
11
14
  import { PropsWithChildren } from 'react';
12
15
  import { ReactElement } from 'react';
13
- import { SxProps } from '@mui/material';
14
- import { Theme } from '@mui/material';
16
+ import { RefAttributes } from 'react';
15
17
  import { WidgetApi } from '@matrix-widget-toolkit/api';
16
18
  import { WidgetEventCapability } from 'matrix-widget-api';
17
19
  import { WidgetRegistration } from '@matrix-widget-toolkit/api';
@@ -20,7 +22,7 @@ import { WidgetRegistration } from '@matrix-widget-toolkit/api';
20
22
  * A component to display user and room avatars in the style of Element.
21
23
  * @param param0 - {@link ElementAvatarProps}
22
24
  */
23
- export declare function ElementAvatar({ avatarUrl, userId, displayName, sx, }: ElementAvatarProps): JSX.Element;
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>>;
24
26
 
25
27
  /**
26
28
  * Props for the {@link ElementAvatar} component.
@@ -42,9 +44,7 @@ export declare type ElementAvatarProps = {
42
44
  * If not provided, the initial letter based on the display name or userId is used instead.
43
45
  */
44
46
  avatarUrl?: string;
45
- /** Additional styling for the avatar */
46
- sx?: SxProps<Theme>;
47
- };
47
+ } & AvatarProps;
48
48
 
49
49
  /**
50
50
  * Reads environment variables starting with `REACT_APP_` from a global variable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrix-widget-toolkit/mui",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",
@@ -18,7 +18,7 @@
18
18
  "@types/node": "^16.18.14",
19
19
  "@types/react": "^17.0.45",
20
20
  "copyfiles": "^2.4.1",
21
- "i18next-parser": "^7.6.0",
21
+ "i18next-parser": "^7.7.0",
22
22
  "jest-axe": "^7.0.0",
23
23
  "react": "^17.0.2",
24
24
  "react-scripts": "5.0.1",