@iobroker/gui-components 10.0.14 → 10.0.16

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
@@ -36,7 +36,7 @@ npm create vite@latest src -- --template react-ts
36
36
  "dependencies": {
37
37
  "@emotion/react": "^11.14.0",
38
38
  "@emotion/styled": "^11.14.1",
39
- "@iobroker/gui-components": "^10.0.14",
39
+ "@iobroker/gui-components": "^10.0.16",
40
40
  "@mui/icons-material": "^9.0.1",
41
41
  "@mui/material": "^9.0.1",
42
42
  "react": "^19.2.5",
@@ -856,6 +856,14 @@ You can find the migration instructions:
856
856
  -->
857
857
 
858
858
  ## Changelog
859
+ ### 10.0.16 (2026-08-10)
860
+
861
+ - (@GermanBluefox) Corrected the text color of the filled alerts (snackbars) in the dark themes
862
+
863
+ ### 10.0.15 (2026-08-07)
864
+
865
+ - (@GermanBluefox) Tuned TextWithIcon component
866
+
859
867
  ### 10.0.14 (2026-08-07)
860
868
 
861
869
  - (@GermanBluefox) Allowed to tap empty value to edit the value in the `TreeTable` component (mobile view)
@@ -16,6 +16,11 @@ interface TextWithIconProps {
16
16
  };
17
17
  icon?: string;
18
18
  color?: string;
19
+ /**
20
+ * Keep the place of the icon free if the entry has no icon.
21
+ * Use it in lists and tables, where entries with and without icon must stay aligned under each other.
22
+ */
23
+ reserveIconSpace?: boolean;
19
24
  }
20
25
  export declare function TextWithIcon(props: TextWithIconProps): React.JSX.Element;
21
26
  export {};
@@ -107,7 +107,7 @@ export function TextWithIcon(props) {
107
107
  }
108
108
  : {};
109
109
  return (React.createElement("div", { style: { ...(props.style || undefined), ...styles.div, ...(style || undefined) }, className: Utils.clsx(props.className, props.moreClasses?.root), title: props.title || item.value },
110
- item?.icon ? (React.createElement(Icon, { src: item?.icon, className: props.moreClasses?.icon, style: styles.icon })) : null,
110
+ item?.icon ? (React.createElement(Icon, { src: item?.icon, className: props.moreClasses?.icon, style: styles.icon })) : props.reserveIconSpace ? (React.createElement("div", { style: { width: styles.icon.width, marginRight: styles.icon.marginRight, flexShrink: 0 } })) : null,
111
111
  React.createElement("div", { style: styles.text, className: props.moreClasses?.text }, item?.name)));
112
112
  }
113
113
  //# sourceMappingURL=TextWithIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextWithIcon.js","sourceRoot":"./src/","sources":["Components/TextWithIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,MAAM,GAAwC;IAChD,GAAG,EAAE;QACD,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,QAAQ;KAC1B;IACD,IAAI,EAAE;QACF,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,UAAU;KAC3B;CACJ,CAAC;AA2BF,MAAM,UAAU,YAAY,CAAC,KAAwB;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,IAAsB,CAAC;IAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;IAExC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,IAAI,EAAE,CAAC;YACP,yDAAyD;YACzD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,MAAM,KAAK,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AAE,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,IAAI,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS;YACzF,eAAe,EAAE,IAAI,EAAE,KAAK;SAC/B;QACH,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,CACH,6BACI,KAAK,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,EAChF,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,EAC/D,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;QAE/B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CACV,oBAAC,IAAI,IACD,GAAG,EAAE,IAAI,EAAE,IAAI,EACf,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAClC,KAAK,EAAE,MAAM,CAAC,IAAI,GACpB,CACL,CAAC,CAAC,CAAC,IAAI;QACR,6BACI,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAEjC,IAAI,EAAE,IAAI,CACT,CACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\n\nimport { Icon } from './Icon';\nimport { Utils } from './Utils';\nimport type { ThemeType } from '../types';\n\nconst styles: Record<string, React.CSSProperties> = {\n div: {\n borderRadius: 3,\n padding: '0 3px',\n lineHeight: '20px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n },\n icon: {\n width: 16,\n height: 16,\n marginRight: 8,\n verticalAlign: 'middle',\n },\n text: {\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n};\n\ninterface TextWithIconProps {\n lang: ioBroker.Languages;\n themeType?: ThemeType;\n value: string | Record<string, any>;\n list?: ioBroker.Object[] | Record<string, ioBroker.Object>;\n className?: string;\n style?: React.CSSProperties;\n title?: string;\n removePrefix?: string;\n moreClasses?: {\n root?: string;\n icon?: string;\n text?: string;\n };\n icon?: string;\n color?: string;\n}\n\ninterface TextWithIconItem {\n name: string;\n value: string;\n icon?: string;\n color?: string;\n}\n\nexport function TextWithIcon(props: TextWithIconProps): React.JSX.Element {\n const value = props.value;\n let item: TextWithIconItem;\n const prefix = props.removePrefix || '';\n\n if (typeof value === 'string') {\n const list = props.list;\n if (list) {\n // if a list is array, then it is list of ioBroker.Object\n if (Array.isArray(list)) {\n const _item: ioBroker.Object | undefined = list.find(\n (obj: ioBroker.Object) => obj?._id === prefix + value,\n );\n if (_item) {\n item = {\n name: Utils.getObjectNameFromObj(_item, props.lang).replace('system.group.', ''),\n value: _item._id,\n icon: props.icon || _item.common?.icon,\n color: props.color || _item.common?.color,\n };\n } else {\n item = {\n name: value,\n value: prefix + value,\n };\n }\n } else if (list[prefix + value]) {\n // List is the object with key-value pairs: {'enum.rooms.1': {common: {name: 'Room 1'}}}\n const obj: ioBroker.Object = list[prefix + value];\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang).replace('system.group.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n } else {\n // value is a string, ignore list\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else {\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else if (!value || typeof value !== 'object') {\n item = {\n name: '',\n value: '',\n icon: props.icon,\n color: props.color,\n };\n } else {\n // Item is an ioBroker.Object\n const obj: ioBroker.Object = value as ioBroker.Object;\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang)\n .replace('system.group.', '')\n .replace('system.user.', '')\n .replace('enum.rooms.', '')\n .replace('enum.functions.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n }\n\n const style = item?.color\n ? {\n border: `1px solid ${Utils.invertColor(item?.color)}`,\n color: Utils.getInvertedColor(item?.color, props.themeType || 'light', true) || undefined,\n backgroundColor: item?.color,\n }\n : {};\n\n return (\n <div\n style={{ ...(props.style || undefined), ...styles.div, ...(style || undefined) }}\n className={Utils.clsx(props.className, props.moreClasses?.root)}\n title={props.title || item.value}\n >\n {item?.icon ? (\n <Icon\n src={item?.icon}\n className={props.moreClasses?.icon}\n style={styles.icon}\n />\n ) : null}\n <div\n style={styles.text}\n className={props.moreClasses?.text}\n >\n {item?.name}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"TextWithIcon.js","sourceRoot":"./src/","sources":["Components/TextWithIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,MAAM,GAAwC;IAChD,GAAG,EAAE;QACD,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,QAAQ;KAC1B;IACD,IAAI,EAAE;QACF,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,UAAU;KAC3B;CACJ,CAAC;AAgCF,MAAM,UAAU,YAAY,CAAC,KAAwB;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,IAAsB,CAAC;IAC3B,MAAM,MAAM,GAAG,KA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AM,CAAC,IAAI,EAClB,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAEjC,IAAI,EAAE,IAAI,CACT,CACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\n\nimport { Icon } from './Icon';\nimport { Utils } from './Utils';\nimport type { ThemeType } from '../types';\n\nconst styles: Record<string, React.CSSProperties> = {\n div: {\n borderRadius: 3,\n padding: '0 3px',\n lineHeight: '20px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n },\n icon: {\n width: 16,\n height: 16,\n marginRight: 8,\n verticalAlign: 'middle',\n },\n text: {\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n};\n\ninterface TextWithIconProps {\n lang: ioBroker.Languages;\n themeType?: ThemeType;\n value: string | Record<string, any>;\n list?: ioBroker.Object[] | Record<string, ioBroker.Object>;\n className?: string;\n style?: React.CSSProperties;\n title?: string;\n removePrefix?: string;\n moreClasses?: {\n root?: string;\n icon?: string;\n text?: string;\n };\n icon?: string;\n color?: string;\n /**\n * Keep the place of the icon free if the entry has no icon.\n * Use it in lists and tables, where entries with and without icon must stay aligned under each other.\n */\n reserveIconSpace?: boolean;\n}\n\ninterface TextWithIconItem {\n name: string;\n value: string;\n icon?: string;\n color?: string;\n}\n\nexport function TextWithIcon(props: TextWithIconProps): React.JSX.Element {\n const value = props.value;\n let item: TextWithIconItem;\n const prefix = props.removePrefix || '';\n\n if (typeof value === 'string') {\n const list = props.list;\n if (list) {\n // if a list is array, then it is list of ioBroker.Object\n if (Array.isArray(list)) {\n const _item: ioBroker.Object | undefined = list.find(\n (obj: ioBroker.Object) => obj?._id === prefix + value,\n );\n if (_item) {\n item = {\n name: Utils.getObjectNameFromObj(_item, props.lang).replace('system.group.', ''),\n value: _item._id,\n icon: props.icon || _item.common?.icon,\n color: props.color || _item.common?.color,\n };\n } else {\n item = {\n name: value,\n value: prefix + value,\n };\n }\n } else if (list[prefix + value]) {\n // List is the object with key-value pairs: {'enum.rooms.1': {common: {name: 'Room 1'}}}\n const obj: ioBroker.Object = list[prefix + value];\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang).replace('system.group.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n } else {\n // value is a string, ignore list\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else {\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else if (!value || typeof value !== 'object') {\n item = {\n name: '',\n value: '',\n icon: props.icon,\n color: props.color,\n };\n } else {\n // Item is an ioBroker.Object\n const obj: ioBroker.Object = value as ioBroker.Object;\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang)\n .replace('system.group.', '')\n .replace('system.user.', '')\n .replace('enum.rooms.', '')\n .replace('enum.functions.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n }\n\n const style = item?.color\n ? {\n border: `1px solid ${Utils.invertColor(item?.color)}`,\n color: Utils.getInvertedColor(item?.color, props.themeType || 'light', true) || undefined,\n backgroundColor: item?.color,\n }\n : {};\n\n return (\n <div\n style={{ ...(props.style || undefined), ...styles.div, ...(style || undefined) }}\n className={Utils.clsx(props.className, props.moreClasses?.root)}\n title={props.title || item.value}\n >\n {item?.icon ? (\n <Icon\n src={item?.icon}\n className={props.moreClasses?.icon}\n style={styles.icon}\n />\n ) : props.reserveIconSpace ? (\n <div style={{ width: styles.icon.width, marginRight: styles.icon.marginRight, flexShrink: 0 }} />\n ) : null}\n <div\n style={styles.text}\n className={props.moreClasses?.text}\n >\n {item?.name}\n </div>\n </div>\n );\n}\n"]}
package/build/Theme.js CHANGED
@@ -62,6 +62,24 @@ function getElevations(color, overlay) {
62
62
  }
63
63
  return elevations;
64
64
  }
65
+ const ALERT_SEVERITIES = ['error', 'warning', 'info', 'success'];
66
+ /**
67
+ * Text color for a filled alert (`<Alert variant="filled"/>` and with it every snackbar/toast).
68
+ *
69
+ * MUI fills the box with `palette[severity].dark` in the dark themes, but derives the text color from
70
+ * `palette[severity].main`. For "info" and "success" that ends up as almost black text on a mid-blue
71
+ * or mid-green box. Calculate the contrast against the background that is really painted.
72
+ *
73
+ * @param palette palette of the already created theme
74
+ * @param color `color` or `severity` of the alert. Anything but the four severities is left to MUI
75
+ */
76
+ function getFilledAlertTextColor(palette, color) {
77
+ if (!ALERT_SEVERITIES.includes(color)) {
78
+ return undefined;
79
+ }
80
+ const severity = color;
81
+ return palette.getContrastText(palette.mode === 'dark' ? palette[severity].dark : palette[severity].main);
82
+ }
65
83
  /**
66
84
  * The theme creation factory function.
67
85
  */
@@ -353,6 +371,17 @@ export function Theme(type, overrides) {
353
371
  ...(overrides || undefined),
354
372
  components: {
355
373
  ...localOverrides,
374
+ MuiAlert: {
375
+ // do not lose the alert overrides of the theme itself (e.g. of the "modern*" themes)
376
+ ...(localOverrides.MuiAlert || undefined),
377
+ styleOverrides: {
378
+ ...(localOverrides.MuiAlert?.styleOverrides || undefined),
379
+ // "filled" is the only per-variant slot of the alert - the severity comes with the ownerState
380
+ filled: (props) => ({
381
+ color: getFilledAlertTextColor(theme.palette, props.ownerState?.color || props.ownerState?.severity || 'success'),
382
+ }),
383
+ },
384
+ },
356
385
  MuiButton: {
357
386
  // do not lose the button overrides of the theme itself (e.g. of the "modern*" themes)
358
387
  ...(localOverrides.MuiButton || undefined),
@@ -1 +1 @@
1
- {"version":3,"file":"Theme.js","sourceRoot":"./src/","sources":["Theme.tsx"],"names":[],"mappings":"AACA,OAAO,EACH,WAAW,EACX,KAAK,GAIR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG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O;4BAC5B,SAAS,EAAE;gCACP,eAAe,EAAE,KAAK,CAClB,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAC3B,OAAO,CAAC,MAAM,EAAE,YAAY,IAAI,IAAI,CACvC;6BACJ;yBACJ;qBACJ;iBACJ;aACJ;YACD,GAAG,CAAC,SAAS,EAAE,UAAU,IAAI,SAAS,CAAC;SAC1C;KACJ,CAAa,CAAC;AACnB,CAAC","sourcesContent":["import { type CSSProperties } from 'react';\nimport {\n createTheme,\n alpha,\n type PaletteOptions as PaletteOptionsMui,\n type SimplePaletteColorOptions,\n type ThemeOptions as ThemeOptionsMui,\n} from '@mui/material/styles';\nimport { orange, grey } from '@mui/material/colors';\n\nimport type { IobTheme, ThemeName, ThemeType } from './types';\nimport { getModernTheme } from './ThemeModern';\n\nconst step = (16 - 5) / 23 / 100;\n\n/**\n * Convert hex color in the format '#rrggbb' or '#rgb' to an RGB object.\n */\nfunction toInt(hex: string): { r: number; g: number; b: number } {\n const rgb: { r: number; g: number; b: number } = {\n r: 0,\n g: 0,\n b: 0,\n };\n\n if (hex.length === 7) {\n rgb.r = parseInt(hex.substring(1, 3), 16);\n rgb.g = parseInt(hex.substring(3, 5), 16);\n rgb.b = parseInt(hex.substring(5, 7), 16);\n } else if (hex.length === 4) {\n const r = hex[1];\n const g = hex[2];\n const b = hex[3];\n\n rgb.r = parseInt(r + r, 16);\n rgb.g = parseInt(g + g, 16);\n rgb.b = parseInt(b + b, 16);\n }\n\n return rgb;\n}\n\n/**\n * Convert an RGB object to a hex color string in the format '#rrggbb'.\n */\nfunction toHex(int: { r: number; g: number; b: number }): string {\n return `#${Math.round(int.r).toString(16).padStart(2, '0')}${Math.round(int.g).toString(16).padStart(2, '0')}${Math.round(int.b).toString(16).padStart(2, '0')}`;\n}\n\n/** Returns the hex color string in the format '#rrggbb' */\nfunction getElevation(\n /** color in the format '#rrggbb' or '#rgb' */\n color: string,\n /** overlay color in the format '#rrggbb' or '#rgb' */\n overlayColor: string,\n /** elevation as an integer starting with 1 */\n elevation: number,\n): string {\n const rgb: { r: number; g: number; b: number } = toInt(color);\n const overlay: { r: number; g: number; b: number } = toInt(overlayColor);\n\n rgb.r += overlay.r * (0.05 + step * (elevation - 1));\n rgb.g += overlay.g * (0.05 + step * (elevation - 1));\n rgb.b += overlay.b * (0.05 + step * (elevation - 1));\n\n return toHex(rgb);\n}\n\n/**\n * Get all 24 elevations of the given color and overlay.\n *\n * @param color color in the format '#rrggbb' or '#rgb'\n * @param overlay overlay color in the format '#rrggbb' or '#rgb'\n */\nfunction getElevations(color: string, overlay: string): Record<string, CSSProperties> {\n const elevations: Record<string, CSSProperties> = {};\n\n for (let i = 1; i <= 24; i++) {\n elevations[`elevation${i}`] = {\n backgroundColor: getElevation(color, overlay, i),\n };\n }\n\n return elevations;\n}\n\n// const buttonsPalette = () => ({\n// palette: {\n// // mode: \"dark\",\n// grey: {\n// main: grey[300],\n// dark: grey[400],\n// },\n// },\n// });\n\n// const buttonsTheme = theme => ({\n// components: {\n// MuiButton: {\n// variants: [\n// {\n// props: { variant: 'contained', color: 'grey' },\n// style: {\n// color: theme.palette.getContrastText(theme.palette.grey[300]),\n// },\n// },\n// {\n// props: { variant: 'outlined', color: 'grey' },\n// style: {\n// color: theme.palette.text.primary,\n// borderColor:\n// theme.palette.mode === 'light'\n// ? 'rgba(0, 0, 0, 0.23)'\n// : 'rgba(255, 255, 255, 0.23)',\n// '&.Mui-disabled': {\n// border: `1px solid ${theme.palette.action.disabledBackground}`,\n// },\n// '&:hover': {\n// borderColor:\n// theme.palette.mode === 'light'\n// ? 'rgba(0, 0, 0, 0.23)'\n// : 'rgba(255, 255, 255, 0.23)',\n// backgroundColor: alpha(\n// theme.palette.text.primary,\n// theme.palette.action.hoverOpacity,\n// ),\n// },\n// },\n// },\n// {\n// props: { color: 'grey', variant: 'text' },\n// style: {\n// color: 'black',\n// '&:hover': {\n// backgroundColor: alpha(\n// theme.palette.text.primary,\n// theme.palette.action.hoverOpacity,\n// ),\n// },\n// },\n// },\n// ],\n// },\n// },\n// });\n\nexport interface PaletteOptions extends PaletteOptionsMui {\n mode: ThemeType;\n expert: string;\n nonAck?: string;\n grey?: {\n main?: string;\n dark?: string;\n 50?: string;\n 100?: string;\n 200?: string;\n 300?: string;\n 400?: string;\n 500?: string;\n 600?: string;\n 700?: string;\n 800?: string;\n 900?: string;\n A100?: string;\n A200?: string;\n A400?: string;\n A700?: string;\n };\n}\n\nexport interface ThemeOptions extends ThemeOptionsMui {\n name: ThemeName;\n palette?: PaletteOptions;\n toolbar?: CSSProperties;\n saveToolbar?: {\n background: string;\n button: CSSProperties;\n };\n}\n\n/**\n * The theme creation factory function.\n */\nexport function Theme(type: ThemeName, overrides?: Record<string, any>): IobTheme {\n let options: ThemeOptions;\n let localOverrides: Record<string, any>;\n\n if (type === 'modernDark' || type === 'modernLight') {\n const modern = getModernTheme(type, type === 'modernDark' ? 'dark' : 'light');\n options = modern.options;\n localOverrides = modern.components;\n } else if (type === 'dark') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100],\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#4dabf5',\n },\n secondary: {\n main: '#436a93',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'blue') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#3399CC',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#151d21',\n default: '#151d21',\n },\n primary: {\n main: '#4dabf5',\n },\n secondary: {\n main: '#436a93',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'colored') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#2a3135',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100],\n },\n },\n },\n MuiPaper: getElevations('#151d21', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#3399CC',\n },\n secondary: {\n main: '#164477',\n },\n expert: '#96fc96',\n },\n };\n } else if (type === 'PT') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#0F99DE',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#0F99DE',\n },\n secondary: {\n main: '#88A536',\n },\n expert: '#BD1B24',\n },\n };\n } else if (type === 'NW') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#00af78',\n },\n secondary: {\n main: '#005a40',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'HA') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: '#db0a33',\n '&:hover': {\n color: '#FF0a33',\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#970720',\n },\n secondary: {\n main: '#db0a33',\n },\n expert: '#db0a33',\n nonAck: '#ffe96a',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else {\n localOverrides = {\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#3399CC',\n dark: '#256c97',\n light: '#76d0fd',\n },\n secondary: {\n main: '#164477',\n },\n expert: '#14bb00',\n },\n };\n }\n\n options.toolbar ||= {\n height: 48,\n };\n\n options.saveToolbar ||= {\n background: (options.palette?.primary as SimplePaletteColorOptions)?.main,\n button: {\n borderRadius: 3,\n height: 32,\n },\n };\n\n if (options.palette) {\n options.palette.grey = {\n main: grey[300],\n dark: grey[400],\n };\n }\n\n const theme: IobTheme = createTheme(options) as IobTheme;\n\n const palette: PaletteOptions = theme.palette;\n\n return createTheme(theme, {\n ...(overrides || undefined),\n components: {\n ...localOverrides,\n MuiButton: {\n // do not lose the button overrides of the theme itself (e.g. of the \"modern*\" themes)\n ...(localOverrides.MuiButton || undefined),\n variants: [\n ...(localOverrides.MuiButton?.variants || []),\n {\n props: { variant: 'contained', color: 'grey' },\n style: {\n backgroundColor: palette.grey?.[300],\n color:\n palette.getContrastText && palette.grey?.[300]\n ? palette.getContrastText(palette.grey[300])\n : undefined,\n },\n },\n {\n props: { variant: 'outlined', color: 'grey' },\n style: {\n color: palette.text?.primary,\n borderColor: palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)',\n '&.Mui-disabled': {\n border: `1px solid ${palette.action?.disabledBackground}`,\n },\n '&:hover': {\n borderColor:\n palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)',\n backgroundColor: alpha(\n palette.text?.primary || '',\n palette.action?.hoverOpacity || 0.04,\n ),\n },\n },\n },\n {\n props: { variant: 'text', color: 'grey' },\n style: {\n color: palette.text?.primary,\n '&:hover': {\n backgroundColor: alpha(\n palette.text?.primary || '',\n palette.action?.hoverOpacity || 0.04,\n ),\n },\n },\n },\n ],\n },\n ...(overrides?.components || undefined),\n },\n }) as IobTheme;\n}\n"]}
1
+ {"version":3,"file":"Theme.js","sourceRoot":"./src/","sources":["Theme.tsx"],"names":[],"mappings":"AACA,OAAO,EACH,WAAW,EACX,KAAK,GAKR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC;AAEjC;;GAEG;AACH,SAAS,KAAK,CAAC,GAAW;IACtB,MAAM,GAAG,GAAwC;QAC7C,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACP,CAAC;IAEF,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnB,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,GAAG,CAA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,CAAC,CAAC,CAAC,2BAA2B;gCAClF,eAAe,EAAE,KAAK,CAClB,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAC3B,OAAO,CAAC,MAAM,EAAE,YAAY,IAAI,IAAI,CACvC;6BACJ;yBACJ;qBACJ;oBACD;wBACI,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;wBACzC,KAAK,EAAE;4BACH,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO;4BAC5B,SAAS,EAAE;gCACP,eAAe,EAAE,KAAK,CAClB,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAC3B,OAAO,CAAC,MAAM,EAAE,YAAY,IAAI,IAAI,CACvC;6BACJ;yBACJ;qBACJ;iBACJ;aACJ;YACD,GAAG,CAAC,SAAS,EAAE,UAAU,IAAI,SAAS,CAAC;SAC1C;KACJ,CAAa,CAAC;AACnB,CAAC","sourcesContent":["import { type CSSProperties } from 'react';\nimport {\n createTheme,\n alpha,\n type Palette as PaletteMui,\n type PaletteOptions as PaletteOptionsMui,\n type SimplePaletteColorOptions,\n type ThemeOptions as ThemeOptionsMui,\n} from '@mui/material/styles';\nimport { orange, grey } from '@mui/material/colors';\n\nimport type { IobTheme, ThemeName, ThemeType } from './types';\nimport { getModernTheme } from './ThemeModern';\n\nconst step = (16 - 5) / 23 / 100;\n\n/**\n * Convert hex color in the format '#rrggbb' or '#rgb' to an RGB object.\n */\nfunction toInt(hex: string): { r: number; g: number; b: number } {\n const rgb: { r: number; g: number; b: number } = {\n r: 0,\n g: 0,\n b: 0,\n };\n\n if (hex.length === 7) {\n rgb.r = parseInt(hex.substring(1, 3), 16);\n rgb.g = parseInt(hex.substring(3, 5), 16);\n rgb.b = parseInt(hex.substring(5, 7), 16);\n } else if (hex.length === 4) {\n const r = hex[1];\n const g = hex[2];\n const b = hex[3];\n\n rgb.r = parseInt(r + r, 16);\n rgb.g = parseInt(g + g, 16);\n rgb.b = parseInt(b + b, 16);\n }\n\n return rgb;\n}\n\n/**\n * Convert an RGB object to a hex color string in the format '#rrggbb'.\n */\nfunction toHex(int: { r: number; g: number; b: number }): string {\n return `#${Math.round(int.r).toString(16).padStart(2, '0')}${Math.round(int.g).toString(16).padStart(2, '0')}${Math.round(int.b).toString(16).padStart(2, '0')}`;\n}\n\n/** Returns the hex color string in the format '#rrggbb' */\nfunction getElevation(\n /** color in the format '#rrggbb' or '#rgb' */\n color: string,\n /** overlay color in the format '#rrggbb' or '#rgb' */\n overlayColor: string,\n /** elevation as an integer starting with 1 */\n elevation: number,\n): string {\n const rgb: { r: number; g: number; b: number } = toInt(color);\n const overlay: { r: number; g: number; b: number } = toInt(overlayColor);\n\n rgb.r += overlay.r * (0.05 + step * (elevation - 1));\n rgb.g += overlay.g * (0.05 + step * (elevation - 1));\n rgb.b += overlay.b * (0.05 + step * (elevation - 1));\n\n return toHex(rgb);\n}\n\n/**\n * Get all 24 elevations of the given color and overlay.\n *\n * @param color color in the format '#rrggbb' or '#rgb'\n * @param overlay overlay color in the format '#rrggbb' or '#rgb'\n */\nfunction getElevations(color: string, overlay: string): Record<string, CSSProperties> {\n const elevations: Record<string, CSSProperties> = {};\n\n for (let i = 1; i <= 24; i++) {\n elevations[`elevation${i}`] = {\n backgroundColor: getElevation(color, overlay, i),\n };\n }\n\n return elevations;\n}\n\nconst ALERT_SEVERITIES = ['error', 'warning', 'info', 'success'] as const;\n\ntype AlertSeverity = (typeof ALERT_SEVERITIES)[number];\n\n/**\n * Text color for a filled alert (`<Alert variant=\"filled\"/>` and with it every snackbar/toast).\n *\n * MUI fills the box with `palette[severity].dark` in the dark themes, but derives the text color from\n * `palette[severity].main`. For \"info\" and \"success\" that ends up as almost black text on a mid-blue\n * or mid-green box. Calculate the contrast against the background that is really painted.\n *\n * @param palette palette of the already created theme\n * @param color `color` or `severity` of the alert. Anything but the four severities is left to MUI\n */\nfunction getFilledAlertTextColor(palette: PaletteMui, color: string | undefined): string | undefined {\n if (!ALERT_SEVERITIES.includes(color as AlertSeverity)) {\n return undefined;\n }\n const severity = color as AlertSeverity;\n\n return palette.getContrastText(palette.mode === 'dark' ? palette[severity].dark : palette[severity].main);\n}\n\n// const buttonsPalette = () => ({\n// palette: {\n// // mode: \"dark\",\n// grey: {\n// main: grey[300],\n// dark: grey[400],\n// },\n// },\n// });\n\n// const buttonsTheme = theme => ({\n// components: {\n// MuiButton: {\n// variants: [\n// {\n// props: { variant: 'contained', color: 'grey' },\n// style: {\n// color: theme.palette.getContrastText(theme.palette.grey[300]),\n// },\n// },\n// {\n// props: { variant: 'outlined', color: 'grey' },\n// style: {\n// color: theme.palette.text.primary,\n// borderColor:\n// theme.palette.mode === 'light'\n// ? 'rgba(0, 0, 0, 0.23)'\n// : 'rgba(255, 255, 255, 0.23)',\n// '&.Mui-disabled': {\n// border: `1px solid ${theme.palette.action.disabledBackground}`,\n// },\n// '&:hover': {\n// borderColor:\n// theme.palette.mode === 'light'\n// ? 'rgba(0, 0, 0, 0.23)'\n// : 'rgba(255, 255, 255, 0.23)',\n// backgroundColor: alpha(\n// theme.palette.text.primary,\n// theme.palette.action.hoverOpacity,\n// ),\n// },\n// },\n// },\n// {\n// props: { color: 'grey', variant: 'text' },\n// style: {\n// color: 'black',\n// '&:hover': {\n// backgroundColor: alpha(\n// theme.palette.text.primary,\n// theme.palette.action.hoverOpacity,\n// ),\n// },\n// },\n// },\n// ],\n// },\n// },\n// });\n\nexport interface PaletteOptions extends PaletteOptionsMui {\n mode: ThemeType;\n expert: string;\n nonAck?: string;\n grey?: {\n main?: string;\n dark?: string;\n 50?: string;\n 100?: string;\n 200?: string;\n 300?: string;\n 400?: string;\n 500?: string;\n 600?: string;\n 700?: string;\n 800?: string;\n 900?: string;\n A100?: string;\n A200?: string;\n A400?: string;\n A700?: string;\n };\n}\n\nexport interface ThemeOptions extends ThemeOptionsMui {\n name: ThemeName;\n palette?: PaletteOptions;\n toolbar?: CSSProperties;\n saveToolbar?: {\n background: string;\n button: CSSProperties;\n };\n}\n\n/**\n * The theme creation factory function.\n */\nexport function Theme(type: ThemeName, overrides?: Record<string, any>): IobTheme {\n let options: ThemeOptions;\n let localOverrides: Record<string, any>;\n\n if (type === 'modernDark' || type === 'modernLight') {\n const modern = getModernTheme(type, type === 'modernDark' ? 'dark' : 'light');\n options = modern.options;\n localOverrides = modern.components;\n } else if (type === 'dark') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100],\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#4dabf5',\n },\n secondary: {\n main: '#436a93',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'blue') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#3399CC',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#151d21',\n default: '#151d21',\n },\n primary: {\n main: '#4dabf5',\n },\n secondary: {\n main: '#436a93',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'colored') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#2a3135',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100],\n },\n },\n },\n MuiPaper: getElevations('#151d21', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#3399CC',\n },\n secondary: {\n main: '#164477',\n },\n expert: '#96fc96',\n },\n };\n } else if (type === 'PT') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#0F99DE',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#0F99DE',\n },\n secondary: {\n main: '#88A536',\n },\n expert: '#BD1B24',\n },\n };\n } else if (type === 'NW') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#00af78',\n },\n secondary: {\n main: '#005a40',\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else if (type === 'HA') {\n localOverrides = {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727',\n },\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: '#db0a33',\n '&:hover': {\n color: '#FF0a33',\n },\n },\n },\n MuiPaper: getElevations('#121212', '#fff'),\n };\n\n options = {\n name: type,\n palette: {\n mode: 'dark',\n background: {\n paper: '#121212',\n default: '#121212',\n },\n primary: {\n main: '#970720',\n },\n secondary: {\n main: '#db0a33',\n },\n expert: '#db0a33',\n nonAck: '#ffe96a',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff',\n },\n },\n };\n } else {\n localOverrides = {\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300],\n },\n },\n },\n };\n\n options = {\n name: type,\n palette: {\n mode: 'light',\n primary: {\n main: '#3399CC',\n dark: '#256c97',\n light: '#76d0fd',\n },\n secondary: {\n main: '#164477',\n },\n expert: '#14bb00',\n },\n };\n }\n\n options.toolbar ||= {\n height: 48,\n };\n\n options.saveToolbar ||= {\n background: (options.palette?.primary as SimplePaletteColorOptions)?.main,\n button: {\n borderRadius: 3,\n height: 32,\n },\n };\n\n if (options.palette) {\n options.palette.grey = {\n main: grey[300],\n dark: grey[400],\n };\n }\n\n const theme: IobTheme = createTheme(options) as IobTheme;\n\n const palette: PaletteOptions = theme.palette;\n\n return createTheme(theme, {\n ...(overrides || undefined),\n components: {\n ...localOverrides,\n MuiAlert: {\n // do not lose the alert overrides of the theme itself (e.g. of the \"modern*\" themes)\n ...(localOverrides.MuiAlert || undefined),\n styleOverrides: {\n ...(localOverrides.MuiAlert?.styleOverrides || undefined),\n // \"filled\" is the only per-variant slot of the alert - the severity comes with the ownerState\n filled: (props: { ownerState?: { color?: string; severity?: string } }) => ({\n color: getFilledAlertTextColor(\n theme.palette,\n props.ownerState?.color || props.ownerState?.severity || 'success',\n ),\n }),\n },\n },\n MuiButton: {\n // do not lose the button overrides of the theme itself (e.g. of the \"modern*\" themes)\n ...(localOverrides.MuiButton || undefined),\n variants: [\n ...(localOverrides.MuiButton?.variants || []),\n {\n props: { variant: 'contained', color: 'grey' },\n style: {\n backgroundColor: palette.grey?.[300],\n color:\n palette.getContrastText && palette.grey?.[300]\n ? palette.getContrastText(palette.grey[300])\n : undefined,\n },\n },\n {\n props: { variant: 'outlined', color: 'grey' },\n style: {\n color: palette.text?.primary,\n borderColor: palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)',\n '&.Mui-disabled': {\n border: `1px solid ${palette.action?.disabledBackground}`,\n },\n '&:hover': {\n borderColor:\n palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)',\n backgroundColor: alpha(\n palette.text?.primary || '',\n palette.action?.hoverOpacity || 0.04,\n ),\n },\n },\n },\n {\n props: { variant: 'text', color: 'grey' },\n style: {\n color: palette.text?.primary,\n '&:hover': {\n backgroundColor: alpha(\n palette.text?.primary || '',\n palette.action?.hoverOpacity || 0.04,\n ),\n },\n },\n },\n ],\n },\n ...(overrides?.components || undefined),\n },\n }) as IobTheme;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/gui-components",
3
- "version": "10.0.14",
3
+ "version": "10.0.16",
4
4
  "description": "Shared React components (React 19 / MUI 9) to develop ioBroker interfaces. Successor of @iobroker/adapter-react-v5.",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -57,13 +57,13 @@
57
57
  "@iobroker/socket-client": "^5.2.1",
58
58
  "@iobroker/type-detector": "^5.0.15",
59
59
  "@iobroker/types": "^7.2.2",
60
- "@sentry/browser": "^10.69.0",
60
+ "@sentry/browser": "^10.70.0",
61
61
  "cronstrue": "^3.24.0",
62
62
  "file-selector": "^5.0.0",
63
63
  "react-color": "^2.19.3",
64
64
  "react-colorful": "^5.8.0",
65
65
  "react-cropper": "^2.3.3",
66
- "react-dropzone": "^20.0.0",
66
+ "react-dropzone": "^20.1.0",
67
67
  "react-icons": "^5.7.0",
68
68
  "react-inlinesvg": "^4.5.0"
69
69
  },
@@ -82,7 +82,7 @@
82
82
  "@iobroker/eslint-config": "^2.3.4",
83
83
  "@mui/icons-material": "^9.3.1",
84
84
  "@mui/material": "^9.3.1",
85
- "@types/node": "^26.1.2",
85
+ "@types/node": "^26.2.0",
86
86
  "@types/react": "^19.2.18",
87
87
  "@types/react-color": "^3.0.13",
88
88
  "@types/react-dom": "^19.2.4",