@iobroker/adapter-react-v5 8.0.8 → 8.0.10

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/README.md CHANGED
@@ -691,7 +691,10 @@ You can find the migration instructions:
691
691
  -->
692
692
 
693
693
  ## Changelog
694
- ### 8.0.8 (2025-11-02)
694
+ ### 8.0.10 (2025-11-09)
695
+ - (@GermanBluefox) Fixing ref for Icon and TabContent components
696
+
697
+ ### 8.0.9 (2025-11-02)
695
698
  - (@GermanBluefox) Added possibility to import objects from text
696
699
  - (@GermanBluefox) Object browser was split into a few files
697
700
 
@@ -27,9 +27,7 @@ export interface IconProps {
27
27
  styleUTF8?: React.CSSProperties;
28
28
  /** On error handler */
29
29
  onError?: ReactEventHandler<HTMLImageElement>;
30
- /** Reference to image */
31
- ref?: React.RefObject<HTMLImageElement>;
32
30
  /** Alternative text for image */
33
31
  alt?: string;
34
32
  }
35
- export declare function Icon(props: IconProps): React.JSX.Element | null;
33
+ export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement | HTMLImageElement>>;
@@ -3,7 +3,6 @@ import SVG from 'react-inlinesvg';
3
3
  import { Box } from '@mui/material';
4
4
  import { SettingsApplications as IconSystem, Photo as IconPhoto, SupervisedUserCircle as IconGroup, PersonOutlined as IconUser, Router as IconHost, Wifi as IconConnection, Info as IconInfo, Description as IconMeta, } from '@mui/icons-material';
5
5
  import { IconAlias } from '../icons/IconAlias';
6
- import { Utils } from './Utils';
7
6
  /**
8
7
  * Get icon by object type (state, channel, device, ...).
9
8
  *
@@ -67,7 +66,7 @@ export function getSelectIdIcon(obj, imagePrefix) {
67
66
  if (obj.type === 'instance' || obj.type === 'adapter') {
68
67
  src = `${imagePrefix}/adapter/${common.name}/${cIcon}`;
69
68
  }
70
- else if (obj._id && obj._id.startsWith('system.adapter.')) {
69
+ else if (obj._id?.startsWith('system.adapter.')) {
71
70
  instance = obj._id.split('.', 3);
72
71
  if (cIcon[0] === '/') {
73
72
  instance[2] += cIcon;
@@ -102,18 +101,18 @@ export function getSelectIdIcon(obj, imagePrefix) {
102
101
  }
103
102
  const REMOTE_SERVER = window.location.hostname.endsWith('iobroker.in');
104
103
  const REMOTE_PREFIX = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1);
105
- export function Icon(props) {
104
+ export const Icon = React.forwardRef(function IconComponent(props, ref) {
106
105
  if (props.src) {
107
106
  if (typeof props.src === 'string') {
108
107
  if (props.src.length < 3) {
109
108
  // utf-8 char
110
109
  if (props.sx) {
111
- return (React.createElement(Box, { component: "span", sx: props.sx, title: props.title || undefined, style: { height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }, className: Utils.clsx(props.className, 'iconOwn') }, props.src));
110
+ return (React.createElement(Box, { component: "span", sx: props.sx, ref: ref, title: props.title || undefined, style: { height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }, className: props.className ? `iconOwn ${props.className}` : 'iconOwn' }, props.src));
112
111
  }
113
- return (React.createElement("span", { title: props.title || undefined, style: { height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }, className: Utils.clsx(props.className, 'iconOwn') }, props.src));
112
+ return (React.createElement("span", { ref: ref, title: props.title || undefined, style: { height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }, className: props.className ? `iconOwn ${props.className}` : 'iconOwn' }, props.src));
114
113
  }
115
114
  if (props.src.startsWith('data:image/svg')) {
116
- return (React.createElement(SVG, { title: props.title || undefined, src: props.src, className: Utils.clsx(props.className, 'iconOwn'), width: props.style?.width || 28, height: props.style?.height || props.style?.width || 28, style: props.style || undefined }));
115
+ return (React.createElement(SVG, { title: props.title || undefined, src: props.src, className: props.className ? `iconOwn ${props.className}` : 'iconOwn', width: props.style?.width || 28, height: props.style?.height || props.style?.width || 28, style: props.style || undefined }));
117
116
  }
118
117
  if (REMOTE_SERVER && !props.src.startsWith('http://') && !props.src.startsWith('https://')) {
119
118
  let src = props.src;
@@ -124,17 +123,18 @@ export function Icon(props) {
124
123
  src = REMOTE_PREFIX + src;
125
124
  }
126
125
  if (props.sx) {
127
- return (React.createElement(Box, { component: "img", sx: props.sx, title: props.title || undefined, style: props.style || undefined, className: Utils.clsx(props.className, 'iconOwn'), src: `https://remote-files.iobroker.in${src}`, alt: props.alt || undefined, ref: props.ref, onError: e => props.onError && props.onError(e) }));
126
+ return (React.createElement(Box, { component: "img", sx: props.sx, title: props.title || undefined, style: props.style || undefined, className: props.className ? `iconOwn ${props.className}` : 'iconOwn', src: `https://remote-files.iobroker.in${src}`, alt: props.alt || undefined, ref: ref, onError: e => props.onError?.(e) }));
128
127
  }
129
- return (React.createElement("img", { title: props.title || undefined, style: props.style || undefined, className: Utils.clsx(props.className, 'iconOwn'), src: `https://remote-files.iobroker.in${src}`, alt: props.alt || undefined, ref: props.ref, onError: e => props.onError && props.onError(e) }));
128
+ return (React.createElement("img", { title: props.title || undefined, style: props.style || undefined, className: props.className ? `iconOwn ${props.className}` : 'iconOwn', src: `https://remote-files.iobroker.in${src}`, alt: props.alt || undefined, ref: ref, onError: e => props.onError?.(e) }));
130
129
  }
131
130
  if (props.sx) {
132
- return (React.createElement(Box, { component: "img", sx: props.sx, title: props.title || undefined, style: props.style || undefined, className: Utils.clsx(props.className, 'iconOwn'), src: props.src, alt: props.alt || undefined, ref: props.ref, onError: props.onError }));
131
+ return (React.createElement(Box, { component: "img", sx: props.sx, title: props.title || undefined, style: props.style || undefined, className: props.className ? `iconOwn ${props.className}` : 'iconOwn', src: props.src, alt: props.alt || undefined, ref: ref, onError: props.onError }));
133
132
  }
134
- return (React.createElement("img", { title: props.title || undefined, style: props.style || undefined, className: Utils.clsx(props.className, 'iconOwn'), src: props.src, alt: props.alt || undefined, ref: props.ref, onError: props.onError }));
133
+ return (React.createElement("img", { title: props.title || undefined, style: props.style || undefined, className: props.className ? `iconOwn ${props.className}` : 'iconOwn', src: props.src, alt: props.alt || undefined, ref: ref, onError: props.onError }));
135
134
  }
136
135
  return props.src;
137
136
  }
138
137
  return null;
139
- }
138
+ });
139
+ Icon.displayName = 'Icon';
140
140
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"./src/","sources":["Components/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACH,oBAAoB,IAAI,UAAU,EAClC,KAAK,IAAI,SAAS,EAClB,oBAAoB,IAAI,SAAS,EACjC,cAAc,IAAI,QAAQ,EAC1B,MAAM,IAAI,QAAQ,EAClB,IAAI,IAAI,cAAc,EACtB,IAAI,IAAI,QAAQ,EAChB,WAAW,IAAI,QAAQ,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAA2B;IACrD,IAAI,IAAI,CAAC;IACT,MAAM,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC;IAEpB,IAAI,CAAC,EAAE,EAAE,CAAC;QACN,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,qCAAqC;IACrC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC/C,IAAI,GAAG,oBAAC,UAAU,IAAC,SAAS,EAAC,SAAS,GAAG,CAAC;IAC9C,CAAC;SAAM,IAAI,EAAE,KAAK,YAAY,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;QACtD,IAAI,GAAG,oBAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,CAAC;IAC7C,CAAC;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QAC5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BACX,OAAO,CACH,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,EACjD,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,SAAS,EAC3B,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,CACL,CAAC;YACN,CAAC;YACD,OAAO,CACH,6BACI,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,EACjD,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,SAAS,EAC3B,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,CACL,CAAC;QACN,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import React, { type ReactEventHandler } from 'react';\nimport SVG from 'react-inlinesvg';\n\nimport { Box } from '@mui/material';\n\nimport {\n SettingsApplications as IconSystem,\n Photo as IconPhoto,\n SupervisedUserCircle as IconGroup,\n PersonOutlined as IconUser,\n Router as IconHost,\n Wifi as IconConnection,\n Info as IconInfo,\n Description as IconMeta,\n} from '@mui/icons-material';\n\nimport { IconAlias } from '../icons/IconAlias';\nimport { Utils } from './Utils';\n\n/**\n * Get icon by object type (state, channel, device, ...).\n *\n * @param obj Object\n */\nexport function getSystemIcon(obj: ioBroker.Object | null): React.JSX.Element | null {\n let icon;\n const id = obj?._id;\n\n if (!id) {\n return null;\n }\n\n // system or design has special icons\n if (id.startsWith('_design/') || id === 'system') {\n icon = <IconSystem className=\"iconOwn\" />;\n } else if (id === '0_userdata' || id === '0_userdata.0') {\n icon = <IconPhoto className=\"iconOwn\" />;\n } else if (id === 'alias' || id === 'alias.0') {\n icon = <IconAlias className=\"iconOwn\" />;\n } else if (id === 'system.adapter') {\n icon = <IconSystem className=\"iconOwn\" />;\n } else if (id === 'system.group') {\n icon = <IconGroup className=\"iconOwn\" />;\n } else if (id === 'system.user') {\n icon = <IconUser className=\"iconOwn\" />;\n } else if (id === 'system.host') {\n icon = <IconHost className=\"iconOwn\" />;\n } else if (id.endsWith('.connection') || id.endsWith('.connected')) {\n icon = <IconConnection className=\"iconOwn\" />;\n } else if (id.endsWith('.info')) {\n icon = <IconInfo className=\"iconOwn\" />;\n } else if (obj?.type === 'meta') {\n icon = <IconMeta className=\"iconOwn\" />;\n }\n\n return icon || null;\n}\n\n/**\n * Get icon from the object.\n *\n * @param obj Object\n * @param imagePrefix Prefix for image\n */\nexport function getSelectIdIcon(obj: ioBroker.Object | null, imagePrefix?: string): string | null {\n imagePrefix = imagePrefix || '.'; // http://localhost:8081';\n let src = '';\n const common = obj?.common;\n\n if (common) {\n const cIcon = common.icon;\n if (cIcon) {\n if (!cIcon.startsWith('data:image/')) {\n if (cIcon.includes('.')) {\n let instance;\n if (obj.type === 'instance' || obj.type === 'adapter') {\n src = `${imagePrefix}/adapter/${common.name as string}/${cIcon}`;\n } else if (obj._id && obj._id.startsWith('system.adapter.')) {\n instance = obj._id.split('.', 3);\n if (cIcon[0] === '/') {\n instance[2] += cIcon;\n } else {\n instance[2] += `/${cIcon}`;\n }\n src = `${imagePrefix}/adapter/${instance[2]}`;\n } else {\n instance = obj._id.split('.', 2);\n if (cIcon[0] === '/') {\n instance[0] += cIcon;\n } else {\n instance[0] += `/${cIcon}`;\n }\n src = `${imagePrefix}/adapter/${instance[0]}`;\n }\n } else {\n return null;\n }\n } else {\n // base 64 image\n src = cIcon;\n }\n }\n }\n\n return src || null;\n}\n\nexport interface IconProps {\n /** URL, UTF-8 character, or svg code (data:image/svg...) */\n src: string | React.JSX.Element | null | undefined;\n /** Class name */\n className?: string;\n /** Style for image */\n style?: React.CSSProperties;\n /** Styles for mui */\n sx?: Record<string, any>;\n /** Tooltip */\n title?: string;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: ReactEventHandler<HTMLImageElement>;\n /** Reference to image */\n ref?: React.RefObject<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n}\n\nconst REMOTE_SERVER = window.location.hostname.endsWith('iobroker.in');\nconst REMOTE_PREFIX = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1);\n\nexport function Icon(props: IconProps): React.JSX.Element | null {\n if (props.src) {\n if (typeof props.src === 'string') {\n if (props.src.length < 3) {\n // utf-8 char\n if (props.sx) {\n return (\n <Box\n component=\"span\"\n sx={props.sx}\n title={props.title || undefined}\n style={{ height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }}\n className={Utils.clsx(props.className, 'iconOwn')}\n >\n {props.src}\n </Box>\n );\n }\n return (\n <span\n title={props.title || undefined}\n style={{ height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }}\n className={Utils.clsx(props.className, 'iconOwn')}\n >\n {props.src}\n </span>\n );\n }\n if (props.src.startsWith('data:image/svg')) {\n return (\n <SVG\n title={props.title || undefined}\n src={props.src}\n className={Utils.clsx(props.className, 'iconOwn')}\n width={props.style?.width || 28}\n height={props.style?.height || props.style?.width || 28}\n style={props.style || undefined}\n />\n );\n }\n if (REMOTE_SERVER && !props.src.startsWith('http://') && !props.src.startsWith('https://')) {\n let src = props.src;\n if (src.startsWith('./')) {\n src = REMOTE_PREFIX + src.substring(2);\n } else if (!src.startsWith('/')) {\n src = REMOTE_PREFIX + src;\n }\n\n if (props.sx) {\n return (\n <Box\n component=\"img\"\n sx={props.sx}\n title={props.title || undefined}\n style={props.style || undefined}\n className={Utils.clsx(props.className, 'iconOwn')}\n src={`https://remote-files.iobroker.in${src}`}\n alt={props.alt || undefined}\n ref={props.ref}\n onError={e => props.onError && props.onError(e)}\n />\n );\n }\n return (\n <img\n title={props.title || undefined}\n style={props.style || undefined}\n className={Utils.clsx(props.className, 'iconOwn')}\n src={`https://remote-files.iobroker.in${src}`}\n alt={props.alt || undefined}\n ref={props.ref}\n onError={e => props.onError && props.onError(e)}\n />\n );\n }\n if (props.sx) {\n return (\n <Box\n component=\"img\"\n sx={props.sx}\n title={props.title || undefined}\n style={props.style || undefined}\n className={Utils.clsx(props.className, 'iconOwn')}\n src={props.src}\n alt={props.alt || undefined}\n ref={props.ref}\n onError={props.onError}\n />\n );\n }\n return (\n <img\n title={props.title || undefined}\n style={props.style || undefined}\n className={Utils.clsx(props.className, 'iconOwn')}\n src={props.src}\n alt={props.alt || undefined}\n ref={props.ref}\n onError={props.onError}\n />\n );\n }\n\n return props.src;\n }\n return null;\n}\n"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"./src/","sources":["Components/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACH,oBAAoB,IAAI,UAAU,EAClC,KAAK,IAAI,SAAS,EAClB,oBAAoB,IAAI,SAAS,EACjC,cAAc,IAAI,QAAQ,EAC1B,MAAM,IAAI,QAAQ,EAClB,IAAI,IAAI,cAAc,EACtB,IAAI,IAAI,QAAQ,EAChB,WAAW,IAAI,QAAQ,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAA2B;I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,KAAK,IAAI,SAAS,EAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,EACrE,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,SAAS,EAC3B,GAAG,EAAE,GAAkC,EACvC,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,CACL,CAAC;QACN,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CACJ,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC","sourcesContent":["import React, { type ReactEventHandler } from 'react';\nimport SVG from 'react-inlinesvg';\n\nimport { Box } from '@mui/material';\n\nimport {\n SettingsApplications as IconSystem,\n Photo as IconPhoto,\n SupervisedUserCircle as IconGroup,\n PersonOutlined as IconUser,\n Router as IconHost,\n Wifi as IconConnection,\n Info as IconInfo,\n Description as IconMeta,\n} from '@mui/icons-material';\n\nimport { IconAlias } from '../icons/IconAlias';\n\n/**\n * Get icon by object type (state, channel, device, ...).\n *\n * @param obj Object\n */\nexport function getSystemIcon(obj: ioBroker.Object | null): React.JSX.Element | null {\n let icon;\n const id = obj?._id;\n\n if (!id) {\n return null;\n }\n\n // system or design has special icons\n if (id.startsWith('_design/') || id === 'system') {\n icon = <IconSystem className=\"iconOwn\" />;\n } else if (id === '0_userdata' || id === '0_userdata.0') {\n icon = <IconPhoto className=\"iconOwn\" />;\n } else if (id === 'alias' || id === 'alias.0') {\n icon = <IconAlias className=\"iconOwn\" />;\n } else if (id === 'system.adapter') {\n icon = <IconSystem className=\"iconOwn\" />;\n } else if (id === 'system.group') {\n icon = <IconGroup className=\"iconOwn\" />;\n } else if (id === 'system.user') {\n icon = <IconUser className=\"iconOwn\" />;\n } else if (id === 'system.host') {\n icon = <IconHost className=\"iconOwn\" />;\n } else if (id.endsWith('.connection') || id.endsWith('.connected')) {\n icon = <IconConnection className=\"iconOwn\" />;\n } else if (id.endsWith('.info')) {\n icon = <IconInfo className=\"iconOwn\" />;\n } else if (obj?.type === 'meta') {\n icon = <IconMeta className=\"iconOwn\" />;\n }\n\n return icon || null;\n}\n\n/**\n * Get icon from the object.\n *\n * @param obj Object\n * @param imagePrefix Prefix for image\n */\nexport function getSelectIdIcon(obj: ioBroker.Object | null, imagePrefix?: string): string | null {\n imagePrefix = imagePrefix || '.'; // http://localhost:8081';\n let src = '';\n const common = obj?.common;\n\n if (common) {\n const cIcon = common.icon;\n if (cIcon) {\n if (!cIcon.startsWith('data:image/')) {\n if (cIcon.includes('.')) {\n let instance;\n if (obj.type === 'instance' || obj.type === 'adapter') {\n src = `${imagePrefix}/adapter/${common.name as string}/${cIcon}`;\n } else if (obj._id?.startsWith('system.adapter.')) {\n instance = obj._id.split('.', 3);\n if (cIcon[0] === '/') {\n instance[2] += cIcon;\n } else {\n instance[2] += `/${cIcon}`;\n }\n src = `${imagePrefix}/adapter/${instance[2]}`;\n } else {\n instance = obj._id.split('.', 2);\n if (cIcon[0] === '/') {\n instance[0] += cIcon;\n } else {\n instance[0] += `/${cIcon}`;\n }\n src = `${imagePrefix}/adapter/${instance[0]}`;\n }\n } else {\n return null;\n }\n } else {\n // base 64 image\n src = cIcon;\n }\n }\n }\n\n return src || null;\n}\n\nexport interface IconProps {\n /** URL, UTF-8 character, or svg code (data:image/svg...) */\n src: string | React.JSX.Element | null | undefined;\n /** Class name */\n className?: string;\n /** Style for image */\n style?: React.CSSProperties;\n /** Styles for mui */\n sx?: Record<string, any>;\n /** Tooltip */\n title?: string;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: ReactEventHandler<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n}\n\nconst REMOTE_SERVER = window.location.hostname.endsWith('iobroker.in');\nconst REMOTE_PREFIX = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1);\n\nexport const Icon = React.forwardRef<HTMLImageElement | HTMLSpanElement, IconProps>(\n function IconComponent(props, ref): React.JSX.Element | null {\n if (props.src) {\n if (typeof props.src === 'string') {\n if (props.src.length < 3) {\n // utf-8 char\n if (props.sx) {\n return (\n <Box\n component=\"span\"\n sx={props.sx}\n ref={ref as React.Ref<HTMLSpanElement>}\n title={props.title || undefined}\n style={{ height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n >\n {props.src}\n </Box>\n );\n }\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n title={props.title || undefined}\n style={{ height: 27, marginTop: -8, ...(props.styleUTF8 || props.style) }}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n >\n {props.src}\n </span>\n );\n }\n if (props.src.startsWith('data:image/svg')) {\n return (\n <SVG\n title={props.title || undefined}\n src={props.src}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n width={props.style?.width || 28}\n height={props.style?.height || props.style?.width || 28}\n style={props.style || undefined}\n />\n );\n }\n if (REMOTE_SERVER && !props.src.startsWith('http://') && !props.src.startsWith('https://')) {\n let src = props.src;\n if (src.startsWith('./')) {\n src = REMOTE_PREFIX + src.substring(2);\n } else if (!src.startsWith('/')) {\n src = REMOTE_PREFIX + src;\n }\n\n if (props.sx) {\n return (\n <Box\n component=\"img\"\n sx={props.sx}\n title={props.title || undefined}\n style={props.style || undefined}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n src={`https://remote-files.iobroker.in${src}`}\n alt={props.alt || undefined}\n ref={ref as React.Ref<HTMLImageElement>}\n onError={e => props.onError?.(e)}\n />\n );\n }\n return (\n <img\n title={props.title || undefined}\n style={props.style || undefined}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n src={`https://remote-files.iobroker.in${src}`}\n alt={props.alt || undefined}\n ref={ref as React.Ref<HTMLImageElement>}\n onError={e => props.onError?.(e)}\n />\n );\n }\n if (props.sx) {\n return (\n <Box\n component=\"img\"\n sx={props.sx}\n title={props.title || undefined}\n style={props.style || undefined}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n src={props.src}\n alt={props.alt || undefined}\n ref={ref as React.Ref<HTMLImageElement>}\n onError={props.onError}\n />\n );\n }\n return (\n <img\n title={props.title || undefined}\n style={props.style || undefined}\n className={props.className ? `iconOwn ${props.className}` : 'iconOwn'}\n src={props.src}\n alt={props.alt || undefined}\n ref={ref as React.Ref<HTMLImageElement>}\n onError={props.onError}\n />\n );\n }\n\n return props.src;\n }\n return null;\n },\n);\n\nIcon.displayName = 'Icon';\n"]}
@@ -2488,7 +2488,7 @@ export class ObjectBrowserClass extends Component {
2488
2488
  if (text) {
2489
2489
  void this.parseJsonFile(text);
2490
2490
  }
2491
- }, t: this.props.t }));
2491
+ }, themeName: this.props.themeName, themeType: this.props.themeType, t: this.props.t }));
2492
2492
  }
2493
2493
  /**
2494
2494
  * Renders the toolbar.
@@ -2591,11 +2591,11 @@ export class ObjectBrowserClass extends Component {
2591
2591
  }, size: "large" },
2592
2592
  React.createElement(PublishIcon, null)))),
2593
2593
  this.props.objectBrowserInsertJsonObjects ? (React.createElement(Menu, { anchorEl: this.state.showImportMenu, open: !!this.state.showImportMenu, onClose: () => this.setState({ showImportMenu: null }) },
2594
- React.createElement(MenuItem, { onClick: () => this.onOpenFile() },
2594
+ React.createElement(MenuItem, { onClick: () => this.setState({ showImportMenu: null }, () => this.onOpenFile()) },
2595
2595
  React.createElement(ListItemIcon, null,
2596
2596
  React.createElement(UploadFile, null)),
2597
2597
  React.createElement(ListItemText, null, this.props.t('ra_From file'))),
2598
- React.createElement(MenuItem, { onClick: () => this.setState({ showImportDialog: true }) },
2598
+ React.createElement(MenuItem, { onClick: () => this.setState({ showImportMenu: null, showImportDialog: true }) },
2599
2599
  React.createElement(ListItemIcon, null,
2600
2600
  React.createElement(ContentPaste, null)),
2601
2601
  React.createElement(ListItemText, null, this.props.t('ra_From text'))))) : null,