@iobroker/gui-components 10.0.15 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.15",
39
+ "@iobroker/gui-components": "^10.1.0",
40
40
  "@mui/icons-material": "^9.0.1",
41
41
  "@mui/material": "^9.0.1",
42
42
  "react": "^19.2.5",
@@ -812,6 +812,22 @@ npm start
812
812
 
813
813
  It expects a running ioBroker admin on `127.0.0.1:8081`.
814
814
 
815
+ ## Checks
816
+
817
+ There is no unit test suite. The following checks run in CI and should be run before a pull request:
818
+
819
+ ```bash
820
+ npm run check # type check (tsc --noEmit)
821
+ npm run lint # eslint
822
+ npm run check-device-types # device types are in sync with @iobroker/type-detector
823
+ ```
824
+
825
+ `check-device-types` fails if a device type of `@iobroker/type-detector` has no icon in
826
+ `DeviceTypeIcon.tsx` or no name in one of the `src/Components/DeviceType/i18n/*.json` files, if a
827
+ name is left over for a type that no longer exists, or if a language file is not imported by
828
+ `deviceTypeTranslations.ts`. See [the DeviceType readme](src/Components/DeviceType/README.md) for
829
+ the details.
830
+
815
831
  ## List of adapters that use this library
816
832
 
817
833
  - Admin
@@ -856,6 +872,18 @@ You can find the migration instructions:
856
872
  -->
857
873
 
858
874
  ## Changelog
875
+ ### 10.1.0 (2026-08-13)
876
+
877
+ - (@GermanBluefox) Updated `@iobroker/type-detector` to 6.0.0
878
+ - (@GermanBluefox) Added icons and names for the device types `airPurifier`, `airQuality`, `coAlarm`, `contact`, `electricity`, `fan`, `fillLevel`, `flow`, `pressure`, `pump` and `unknown`
879
+ - (@GermanBluefox) Removed the names of the no longer existing device types `url` and `valve`
880
+ - (@GermanBluefox) Corrected the Spanish translations of the device types, as they were never loaded
881
+ - (@GermanBluefox) Added `npm run check-device-types` to detect missing device type icons and names
882
+
883
+ ### 10.0.16 (2026-08-10)
884
+
885
+ - (@GermanBluefox) Corrected the text color of the filled alerts (snackbars) in the dark themes
886
+
859
887
  ### 10.0.15 (2026-08-07)
860
888
 
861
889
  - (@GermanBluefox) Tuned TextWithIcon component
@@ -5,11 +5,12 @@ import { GoDeviceCameraVideo as TypeIconCamera } from 'react-icons/go';
5
5
  import {
6
6
  // FaExternalLinkSquareAlt as TypeIconURL,
7
7
  FaImage as TypeIconImage, FaRegLightbulb as TypeIconDimmer, FaInfoCircle as TypeIconInfo, FaLightbulb as TypeIconLight, FaLock as TypeIconLock, FaStreetView as TypeIconLocation, FaStepForward as TypeIconMedia, FaSlidersH as TypeIconSlider, FaVolumeDown as TypeIconVolume, FaVolumeUp as TypeIconVolumeGroup, FaFan as TypeIconAC, FaWrench as TypeIconInstance, } from 'react-icons/fa';
8
- import { MdFormatColorFill as TypeIconHUE, MdFormatColorFill as TypeIconCT, MdWarning as TypeIconWarning, MdQuestionMark as TypeIconUnknown, MdOutlineMyLocation as TypeIconLocationOne, MdDeviceHub as TypeIconHub3, MdPolyline as TypeIconNode, MdHub as TypeIconHub5, MdControlCamera as TypeIconController, } from 'react-icons/md';
8
+ import { MdFormatColorFill as TypeIconHUE, MdFormatColorFill as TypeIconCT, MdWarning as TypeIconWarning, MdQuestionMark as TypeIconUnknown, MdOutlineMyLocation as TypeIconLocationOne, MdDeviceHub as TypeIconHub3, MdPolyline as TypeIconNode, MdHub as TypeIconHub5, MdControlCamera as TypeIconController, MdAir as TypeIconAirQuality, MdElectricMeter as TypeIconElectricity, } from 'react-icons/md';
9
9
  import { WiCloudy as TypeIconWeather } from 'react-icons/wi';
10
10
  import { IoIosRadioButtonOn as TypeIconButtonSensor } from 'react-icons/io';
11
- import { TbSunElectricity as TypeIconIlluminance } from 'react-icons/tb';
12
- import { PiPaletteDuotone as TypeIconRGBWSingle } from 'react-icons/pi';
11
+ import { TbSunElectricity as TypeIconIlluminance, TbAlarmSmoke as TypeIconCoAlarm, TbBarrel as TypeIconFillLevel, TbRipple as TypeIconFlow, TbGauge as TypeIconPressure, TbEngine as TypeIconPump, TbCircuitSwitchClosed as TypeIconContact, } from 'react-icons/tb';
12
+ import { PiPaletteDuotone as TypeIconRGBWSingle, PiFan as TypeIconFan } from 'react-icons/pi';
13
+ import { LuAirVent as TypeIconAirPurifier } from 'react-icons/lu';
13
14
  import { Types } from '@iobroker/type-detector';
14
15
  import { I18n } from '../../i18n';
15
16
  import { Icon } from '../Icon';
@@ -17,23 +18,36 @@ import { Cleaner as TypeIconVacuumCleaner, Humidity as TypeIconHumidity, Jalousi
17
18
  // HeatValve as TypeIconValve,
18
19
  WindowOpened as TypeIconWindow, WindowTilted as TypeIconWindowTilt, } from './icons';
19
20
  import { extendDeviceTypeTranslation } from './deviceTypeTranslations';
21
+ /**
22
+ * Icon for every device type.
23
+ *
24
+ * This map is deliberately a complete `Record` over `TypesExtended`: when `@iobroker/type-detector`
25
+ * adds a new member to `Types`, the build fails here until an icon is assigned. Never add keys that
26
+ * are not part of `TypesExtended` (a single `@ts-expect-error` inside the literal would suppress the
27
+ * completeness check for the whole object) — put those in `ROLE_ICONS` below.
28
+ */
20
29
  const TYPE_ICONS = {
21
30
  [Types.airCondition]: TypeIconAC,
31
+ [Types.airPurifier]: TypeIconAirPurifier,
32
+ [Types.airQuality]: TypeIconAirQuality,
22
33
  [Types.blind]: TypeIconBlinds,
23
34
  [Types.blindButtons]: TypeIconBlinds,
24
35
  [Types.button]: TypeIconButton,
25
36
  [Types.buttonSensor]: TypeIconButtonSensor,
26
37
  [Types.camera]: TypeIconCamera,
27
38
  [Types.chart]: TypeIconChart,
39
+ [Types.coAlarm]: TypeIconCoAlarm,
40
+ [Types.contact]: TypeIconContact,
28
41
  // [Types.url]: TypeIconURL,
29
42
  [Types.image]: TypeIconImage,
30
43
  [Types.dimmer]: TypeIconDimmer,
31
44
  [Types.door]: TypeIconDoor,
45
+ [Types.electricity]: TypeIconElectricity,
46
+ [Types.fan]: TypeIconFan,
47
+ [Types.fillLevel]: TypeIconFillLevel,
32
48
  [Types.fireAlarm]: TypeIconFireAlarm,
33
- // @ts-expect-error special case
34
- 'sensor.alarm.fire': TypeIconFireAlarm,
35
49
  [Types.floodAlarm]: TypeIconFloodAlarm,
36
- 'sensor.alarm.flood': TypeIconFloodAlarm,
50
+ [Types.flow]: TypeIconFlow,
37
51
  [Types.gate]: TypeIconGate,
38
52
  [Types.humidity]: TypeIconHumidity,
39
53
  [Types.illuminance]: TypeIconIlluminance,
@@ -46,6 +60,8 @@ const TYPE_ICONS = {
46
60
  [Types.motion]: TypeIconMotion,
47
61
  [Types.ct]: TypeIconCT,
48
62
  [Types.percentage]: TypeIconSlider,
63
+ [Types.pressure]: TypeIconPressure,
64
+ [Types.pump]: TypeIconPump,
49
65
  [Types.rgb]: TypeIconRGB,
50
66
  [Types.rgbSingle]: TypeIconRGB,
51
67
  [Types.rgbwSingle]: TypeIconRGBWSingle,
@@ -73,6 +89,15 @@ const TYPE_ICONS = {
73
89
  hub5: TypeIconHub5,
74
90
  controller: TypeIconController,
75
91
  };
92
+ /** Icons for state roles that may be given as `src` instead of a device type */
93
+ const ROLE_ICONS = {
94
+ 'sensor.alarm.fire': TypeIconFireAlarm,
95
+ 'sensor.alarm.flood': TypeIconFloodAlarm,
96
+ };
97
+ const ALL_ICONS = { ...TYPE_ICONS, ...ROLE_ICONS };
98
+ function isKnownIcon(src) {
99
+ return typeof src === 'string' && Object.prototype.hasOwnProperty.call(ALL_ICONS, src);
100
+ }
76
101
  const defaultStyle = {
77
102
  width: 32,
78
103
  height: 32,
@@ -88,13 +113,12 @@ export function DeviceTypeIcon(props) {
88
113
  if (!loaded && props.title) {
89
114
  return (React.createElement(Box, { style: { ...defaultStyle, ...(props.style || undefined) }, className: props.className, sx: props.sx }));
90
115
  }
91
- // src could contain a device type too, so detect if it is a type
92
- const type = props.type ||
93
- (props.src ? Object.keys(TYPE_ICONS).find(type => props.src === type) : undefined);
116
+ // src could contain a device type or a state role too, so detect if it is a type
117
+ const type = props.type || (isKnownIcon(props.src) ? props.src : undefined);
94
118
  if (!type && props.src) {
95
119
  return (React.createElement(Icon, { style: defaultStyle, ...props, title: props.title === true ? undefined : props.title, src: props.src }));
96
120
  }
97
- const TypeIcon = type && TYPE_ICONS[type];
121
+ const TypeIcon = type && ALL_ICONS[type];
98
122
  if (!TypeIcon) {
99
123
  // Show the first letter of a type
100
124
  return type ? (React.createElement("span", { style: { ...defaultStyle, ...(props.style || undefined) } }, type[0].toUpperCase())) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceTypeIcon.js","sourceRoot":"./src/","sources":["Components/DeviceType/DeviceTypeIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO;AACH,0CAA0C;AAC1C,OAAO,IAAI,aAAa,EACxB,cAAc,IAAI,cAAc,EAChC,YAAY,IAAI,YAAY,EAC5B,WAAW,IAAI,aAAa,EAC5B,MAAM,IAAI,YAAY,EACtB,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,aAAa,EAC9B,UAAU,IAAI,cAAc,EAC5B,YAAY,IAAI,cAAc,EAC9B,UAAU,IAAI,mBAAmB,EACjC,KAAK,IAAI,UAAU,EACnB,QAAQ,IAAI,gBAAgB,GAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,IAAI,WAAW,EAChC,iBAAiB,IAAI,UAAU,EAC/B,SAAS,IAAI,eAAe,EAC5B,cAAc,IAAI,eAAe,EACjC,mBAAmB,IAAI,mBAAmB,EAC1C,WAAW,IA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G,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,IAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAQ,CAClG,CAAC,CAAC,CAAC,IAAI,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,CACT,oBAAC,QAAQ,IACL,KAAK,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,EACzD,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,EAAE,EAAE,KAAK,CAAC,EAAE,GACd,CACL,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,CACH,oBAAC,OAAO,IACJ,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;YAElE,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,IAAI,CAAO,CACvC,CACb,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Box, Tooltip } from '@mui/material';\n\nimport { AiOutlineLineChart as TypeIconChart } from 'react-icons/ai';\nimport { GoDeviceCameraVideo as TypeIconCamera } from 'react-icons/go';\n\nimport {\n // FaExternalLinkSquareAlt as TypeIconURL,\n FaImage as TypeIconImage,\n FaRegLightbulb as TypeIconDimmer,\n FaInfoCircle as TypeIconInfo,\n FaLightbulb as TypeIconLight,\n FaLock as TypeIconLock,\n FaStreetView as TypeIconLocation,\n FaStepForward as TypeIconMedia,\n FaSlidersH as TypeIconSlider,\n FaVolumeDown as TypeIconVolume,\n FaVolumeUp as TypeIconVolumeGroup,\n FaFan as TypeIconAC,\n FaWrench as TypeIconInstance,\n} from 'react-icons/fa';\n\nimport {\n MdFormatColorFill as TypeIconHUE,\n MdFormatColorFill as TypeIconCT,\n MdWarning as TypeIconWarning,\n MdQuestionMark as TypeIconUnknown,\n MdOutlineMyLocation as TypeIconLocationOne,\n MdDeviceHub as TypeIconHub3,\n MdPolyline as TypeIconNode,\n MdHub as TypeIconHub5,\n MdControlCamera as TypeIconController,\n} from 'react-icons/md';\nimport { WiCloudy as TypeIconWeather } from 'react-icons/wi';\nimport { IoIosRadioButtonOn as TypeIconButtonSensor } from 'react-icons/io';\nimport { TbSunElectricity as TypeIconIlluminance } from 'react-icons/tb';\nimport { PiPaletteDuotone as TypeIconRGBWSingle } from 'react-icons/pi';\n\nimport { Types } from '@iobroker/type-detector';\n\nimport { I18n } from '../../i18n';\nimport { Icon } from '../Icon';\n\nimport {\n Cleaner as TypeIconVacuumCleaner,\n Humidity as TypeIconHumidity,\n Jalousie as TypeIconBlinds,\n PushButton as TypeIconButton,\n DoorOpened as TypeIconDoor,\n FireOn as TypeIconFireAlarm,\n FloodOn as TypeIconFloodAlarm,\n Gate as TypeIconGate,\n MotionOn as TypeIconMotion,\n RGB as TypeIconRGB,\n Socket as TypeIconSocket,\n Thermometer as TypeIconTemperature,\n Thermostat as TypeIconThermostat,\n // HeatValve as TypeIconValve,\n WindowOpened as TypeIconWindow,\n WindowTilted as TypeIconWindowTilt,\n type IconPropsSVG,\n} from './icons';\nimport { extendDeviceTypeTranslation } from './deviceTypeTranslations';\n\nexport type TypesExtended = Types | 'invalid' | 'hub3' | 'node' | 'hub5' | 'controller';\n\nconst TYPE_ICONS: Record<TypesExtended, React.FC<IconPropsSVG>> = {\n [Types.airCondition]: TypeIconAC,\n [Types.blind]: TypeIconBlinds,\n [Types.blindButtons]: TypeIconBlinds,\n [Types.button]: TypeIconButton,\n [Types.buttonSensor]: TypeIconButtonSensor,\n [Types.camera]: TypeIconCamera,\n [Types.chart]: TypeIconChart,\n // [Types.url]: TypeIconURL,\n [Types.image]: TypeIconImage,\n [Types.dimmer]: TypeIconDimmer,\n [Types.door]: TypeIconDoor,\n [Types.fireAlarm]: TypeIconFireAlarm,\n // @ts-expect-error special case\n 'sensor.alarm.fire': TypeIconFireAlarm,\n [Types.floodAlarm]: TypeIconFloodAlarm,\n 'sensor.alarm.flood': TypeIconFloodAlarm,\n [Types.gate]: TypeIconGate,\n [Types.humidity]: TypeIconHumidity,\n [Types.illuminance]: TypeIconIlluminance,\n [Types.info]: TypeIconInfo,\n [Types.light]: TypeIconLight,\n [Types.lock]: TypeIconLock,\n [Types.location]: TypeIconLocation,\n [Types.locationOne]: TypeIconLocationOne,\n [Types.media]: TypeIconMedia,\n [Types.motion]: TypeIconMotion,\n [Types.ct]: TypeIconCT,\n [Types.percentage]: TypeIconSlider,\n [Types.rgb]: TypeIconRGB,\n [Types.rgbSingle]: TypeIconRGB,\n [Types.rgbwSingle]: TypeIconRGBWSingle,\n [Types.hue]: TypeIconHUE,\n [Types.cie]: TypeIconRGB,\n [Types.slider]: TypeIconSlider,\n [Types.socket]: TypeIconSocket,\n [Types.temperature]: TypeIconTemperature,\n [Types.thermostat]: TypeIconThermostat,\n // [Types.valve]: TypeIconValve,\n [Types.vacuumCleaner]: TypeIconVacuumCleaner,\n [Types.volume]: TypeIconVolume,\n [Types.volumeGroup]: TypeIconVolumeGroup,\n [Types.window]: TypeIconWindow,\n [Types.windowTilt]: TypeIconWindowTilt,\n [Types.weatherCurrent]: TypeIconWeather,\n [Types.weatherForecast]: TypeIconWeather,\n [Types.warning]: TypeIconWarning,\n\n [Types.unknown]: TypeIconUnknown,\n [Types.instance]: TypeIconInstance,\n\n // Special matter types\n invalid: TypeIconWarning,\n hub3: TypeIconHub3,\n node: TypeIconNode,\n hub5: TypeIconHub5,\n controller: TypeIconController,\n};\n\nconst defaultStyle: React.CSSProperties = {\n width: 32,\n height: 32,\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 | true;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: React.ReactEventHandler<HTMLImageElement>;\n /** Reference to image */\n ref?: React.RefObject<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n /** On click handler */\n onClick?: React.MouseEventHandler<any>;\n}\n\nexport type TypeIconProps = IconProps & { type?: TypesExtended };\n\nexport function DeviceTypeIcon(props: TypeIconProps): React.JSX.Element | null {\n const [loaded, setLoaded] = React.useState(false);\n\n useEffect(() => {\n if (props.title && !loaded) {\n extendDeviceTypeTranslation();\n setLoaded(true);\n }\n }, [props.title, loaded]);\n\n if (!loaded && props.title) {\n return (\n <Box\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n className={props.className}\n sx={props.sx}\n />\n );\n }\n // src could contain a device type too, so detect if it is a type\n const type: TypesExtended | undefined =\n props.type ||\n (props.src ? (Object.keys(TYPE_ICONS).find(type => props.src === type) as TypesExtended) : undefined);\n\n if (!type && props.src) {\n return (\n <Icon\n style={defaultStyle}\n {...props}\n title={props.title === true ? undefined : props.title}\n src={props.src}\n />\n );\n }\n\n const TypeIcon = type && TYPE_ICONS[type];\n if (!TypeIcon) {\n // Show the first letter of a type\n return type ? (\n <span style={{ ...defaultStyle, ...(props.style || undefined) }}>{type[0].toUpperCase()}</span>\n ) : null;\n }\n\n const icon = (\n <TypeIcon\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n onClick={props.onClick}\n className={props.className}\n sx={props.sx}\n />\n );\n\n if (props.title) {\n return (\n <Tooltip\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n title={props.title === true ? I18n.t(`type-${type}`) : props.title}\n >\n <div style={{ display: 'flex' }}>{icon}</div>\n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E,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;YAElE,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,IAAI,CAAO,CACvC,CACb,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Box, Tooltip } from '@mui/material';\n\nimport { AiOutlineLineChart as TypeIconChart } from 'react-icons/ai';\nimport { GoDeviceCameraVideo as TypeIconCamera } from 'react-icons/go';\n\nimport {\n // FaExternalLinkSquareAlt as TypeIconURL,\n FaImage as TypeIconImage,\n FaRegLightbulb as TypeIconDimmer,\n FaInfoCircle as TypeIconInfo,\n FaLightbulb as TypeIconLight,\n FaLock as TypeIconLock,\n FaStreetView as TypeIconLocation,\n FaStepForward as TypeIconMedia,\n FaSlidersH as TypeIconSlider,\n FaVolumeDown as TypeIconVolume,\n FaVolumeUp as TypeIconVolumeGroup,\n FaFan as TypeIconAC,\n FaWrench as TypeIconInstance,\n} from 'react-icons/fa';\n\nimport {\n MdFormatColorFill as TypeIconHUE,\n MdFormatColorFill as TypeIconCT,\n MdWarning as TypeIconWarning,\n MdQuestionMark as TypeIconUnknown,\n MdOutlineMyLocation as TypeIconLocationOne,\n MdDeviceHub as TypeIconHub3,\n MdPolyline as TypeIconNode,\n MdHub as TypeIconHub5,\n MdControlCamera as TypeIconController,\n MdAir as TypeIconAirQuality,\n MdElectricMeter as TypeIconElectricity,\n} from 'react-icons/md';\nimport { WiCloudy as TypeIconWeather } from 'react-icons/wi';\nimport { IoIosRadioButtonOn as TypeIconButtonSensor } from 'react-icons/io';\nimport {\n TbSunElectricity as TypeIconIlluminance,\n TbAlarmSmoke as TypeIconCoAlarm,\n TbBarrel as TypeIconFillLevel,\n TbRipple as TypeIconFlow,\n TbGauge as TypeIconPressure,\n TbEngine as TypeIconPump,\n TbCircuitSwitchClosed as TypeIconContact,\n} from 'react-icons/tb';\nimport { PiPaletteDuotone as TypeIconRGBWSingle, PiFan as TypeIconFan } from 'react-icons/pi';\nimport { LuAirVent as TypeIconAirPurifier } from 'react-icons/lu';\n\nimport { Types } from '@iobroker/type-detector';\n\nimport { I18n } from '../../i18n';\nimport { Icon } from '../Icon';\n\nimport {\n Cleaner as TypeIconVacuumCleaner,\n Humidity as TypeIconHumidity,\n Jalousie as TypeIconBlinds,\n PushButton as TypeIconButton,\n DoorOpened as TypeIconDoor,\n FireOn as TypeIconFireAlarm,\n FloodOn as TypeIconFloodAlarm,\n Gate as TypeIconGate,\n MotionOn as TypeIconMotion,\n RGB as TypeIconRGB,\n Socket as TypeIconSocket,\n Thermometer as TypeIconTemperature,\n Thermostat as TypeIconThermostat,\n // HeatValve as TypeIconValve,\n WindowOpened as TypeIconWindow,\n WindowTilted as TypeIconWindowTilt,\n type IconPropsSVG,\n} from './icons';\nimport { extendDeviceTypeTranslation } from './deviceTypeTranslations';\n\nexport type TypesExtended = Types | 'invalid' | 'hub3' | 'node' | 'hub5' | 'controller';\n\n/**\n * Icon for every device type.\n *\n * This map is deliberately a complete `Record` over `TypesExtended`: when `@iobroker/type-detector`\n * adds a new member to `Types`, the build fails here until an icon is assigned. Never add keys that\n * are not part of `TypesExtended` (a single `@ts-expect-error` inside the literal would suppress the\n * completeness check for the whole object) — put those in `ROLE_ICONS` below.\n */\nconst TYPE_ICONS: Record<TypesExtended, React.FC<IconPropsSVG>> = {\n [Types.airCondition]: TypeIconAC,\n [Types.airPurifier]: TypeIconAirPurifier,\n [Types.airQuality]: TypeIconAirQuality,\n [Types.blind]: TypeIconBlinds,\n [Types.blindButtons]: TypeIconBlinds,\n [Types.button]: TypeIconButton,\n [Types.buttonSensor]: TypeIconButtonSensor,\n [Types.camera]: TypeIconCamera,\n [Types.chart]: TypeIconChart,\n [Types.coAlarm]: TypeIconCoAlarm,\n [Types.contact]: TypeIconContact,\n // [Types.url]: TypeIconURL,\n [Types.image]: TypeIconImage,\n [Types.dimmer]: TypeIconDimmer,\n [Types.door]: TypeIconDoor,\n [Types.electricity]: TypeIconElectricity,\n [Types.fan]: TypeIconFan,\n [Types.fillLevel]: TypeIconFillLevel,\n [Types.fireAlarm]: TypeIconFireAlarm,\n [Types.floodAlarm]: TypeIconFloodAlarm,\n [Types.flow]: TypeIconFlow,\n [Types.gate]: TypeIconGate,\n [Types.humidity]: TypeIconHumidity,\n [Types.illuminance]: TypeIconIlluminance,\n [Types.info]: TypeIconInfo,\n [Types.light]: TypeIconLight,\n [Types.lock]: TypeIconLock,\n [Types.location]: TypeIconLocation,\n [Types.locationOne]: TypeIconLocationOne,\n [Types.media]: TypeIconMedia,\n [Types.motion]: TypeIconMotion,\n [Types.ct]: TypeIconCT,\n [Types.percentage]: TypeIconSlider,\n [Types.pressure]: TypeIconPressure,\n [Types.pump]: TypeIconPump,\n [Types.rgb]: TypeIconRGB,\n [Types.rgbSingle]: TypeIconRGB,\n [Types.rgbwSingle]: TypeIconRGBWSingle,\n [Types.hue]: TypeIconHUE,\n [Types.cie]: TypeIconRGB,\n [Types.slider]: TypeIconSlider,\n [Types.socket]: TypeIconSocket,\n [Types.temperature]: TypeIconTemperature,\n [Types.thermostat]: TypeIconThermostat,\n // [Types.valve]: TypeIconValve,\n [Types.vacuumCleaner]: TypeIconVacuumCleaner,\n [Types.volume]: TypeIconVolume,\n [Types.volumeGroup]: TypeIconVolumeGroup,\n [Types.window]: TypeIconWindow,\n [Types.windowTilt]: TypeIconWindowTilt,\n [Types.weatherCurrent]: TypeIconWeather,\n [Types.weatherForecast]: TypeIconWeather,\n [Types.warning]: TypeIconWarning,\n\n [Types.unknown]: TypeIconUnknown,\n [Types.instance]: TypeIconInstance,\n\n // Special matter types\n invalid: TypeIconWarning,\n hub3: TypeIconHub3,\n node: TypeIconNode,\n hub5: TypeIconHub5,\n controller: TypeIconController,\n};\n\n/** Icons for state roles that may be given as `src` instead of a device type */\nconst ROLE_ICONS: Record<string, React.FC<IconPropsSVG>> = {\n 'sensor.alarm.fire': TypeIconFireAlarm,\n 'sensor.alarm.flood': TypeIconFloodAlarm,\n};\n\nconst ALL_ICONS: Record<string, React.FC<IconPropsSVG>> = { ...TYPE_ICONS, ...ROLE_ICONS };\n\nfunction isKnownIcon(src: unknown): src is TypesExtended {\n return typeof src === 'string' && Object.prototype.hasOwnProperty.call(ALL_ICONS, src);\n}\n\nconst defaultStyle: React.CSSProperties = {\n width: 32,\n height: 32,\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 | true;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: React.ReactEventHandler<HTMLImageElement>;\n /** Reference to image */\n ref?: React.RefObject<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n /** On click handler */\n onClick?: React.MouseEventHandler<any>;\n}\n\nexport type TypeIconProps = IconProps & { type?: TypesExtended };\n\nexport function DeviceTypeIcon(props: TypeIconProps): React.JSX.Element | null {\n const [loaded, setLoaded] = React.useState(false);\n\n useEffect(() => {\n if (props.title && !loaded) {\n extendDeviceTypeTranslation();\n setLoaded(true);\n }\n }, [props.title, loaded]);\n\n if (!loaded && props.title) {\n return (\n <Box\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n className={props.className}\n sx={props.sx}\n />\n );\n }\n // src could contain a device type or a state role too, so detect if it is a type\n const type: TypesExtended | undefined = props.type || (isKnownIcon(props.src) ? props.src : undefined);\n\n if (!type && props.src) {\n return (\n <Icon\n style={defaultStyle}\n {...props}\n title={props.title === true ? undefined : props.title}\n src={props.src}\n />\n );\n }\n\n const TypeIcon = type && ALL_ICONS[type];\n if (!TypeIcon) {\n // Show the first letter of a type\n return type ? (\n <span style={{ ...defaultStyle, ...(props.style || undefined) }}>{type[0].toUpperCase()}</span>\n ) : null;\n }\n\n const icon = (\n <TypeIcon\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n onClick={props.onClick}\n className={props.className}\n sx={props.sx}\n />\n );\n\n if (props.title) {\n return (\n <Tooltip\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n title={props.title === true ? I18n.t(`type-${type}`) : props.title}\n >\n <div style={{ display: 'flex' }}>{icon}</div>\n </Tooltip>\n );\n }\n\n return icon;\n}\n"]}
@@ -4,6 +4,7 @@ import deLang from './i18n/de.json';
4
4
  import ruLang from './i18n/ru.json';
5
5
  import ptLang from './i18n/pt.json';
6
6
  import plLang from './i18n/pl.json';
7
+ import esLang from './i18n/es.json';
7
8
  import frLang from './i18n/fr.json';
8
9
  import itLang from './i18n/it.json';
9
10
  import nlLang from './i18n/nl.json';
@@ -19,6 +20,7 @@ export function extendDeviceTypeTranslation() {
19
20
  ru: ruLang,
20
21
  pt: ptLang,
21
22
  pl: plLang,
23
+ es: esLang,
22
24
  fr: frLang,
23
25
  it: itLang,
24
26
  nl: nlLang,
@@ -1 +1 @@
1
- {"version":3,"file":"deviceTypeTranslations.js","sourceRoot":"./src/","sources":["Components/DeviceType/deviceTypeTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,MAAM,UAAU,2BAA2B;IACvC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,iBAAiB,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,kBAAkB,CAAC;YACpB,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,MAAM;SAClB,CAAC,CAAC;IACP,CAAC;AACL,CAAC","sourcesContent":["import { I18n } from '../../i18n';\nimport enLang from './i18n/en.json';\nimport deLang from './i18n/de.json';\nimport ruLang from './i18n/ru.json';\nimport ptLang from './i18n/pt.json';\nimport plLang from './i18n/pl.json';\nimport frLang from './i18n/fr.json';\nimport itLang from './i18n/it.json';\nimport nlLang from './i18n/nl.json';\nimport ukLang from './i18n/uk.json';\nimport zhLang from './i18n/zh-cn.json';\n\nlet translationLoaded = false;\nexport function extendDeviceTypeTranslation(): void {\n if (!translationLoaded) {\n translationLoaded = true;\n I18n.extendTranslations({\n en: enLang,\n de: deLang,\n ru: ruLang,\n pt: ptLang,\n pl: plLang,\n fr: frLang,\n it: itLang,\n nl: nlLang,\n uk: ukLang,\n 'zh-cn': zhLang,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"deviceTypeTranslations.js","sourceRoot":"./src/","sources":["Components/DeviceType/deviceTypeTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,MAAM,UAAU,2BAA2B;IACvC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,iBAAiB,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,kBAAkB,CAAC;YACpB,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,MAAM;SAClB,CAAC,CAAC;IACP,CAAC;AACL,CAAC","sourcesContent":["import { I18n } from '../../i18n';\nimport enLang from './i18n/en.json';\nimport deLang from './i18n/de.json';\nimport ruLang from './i18n/ru.json';\nimport ptLang from './i18n/pt.json';\nimport plLang from './i18n/pl.json';\nimport esLang from './i18n/es.json';\nimport frLang from './i18n/fr.json';\nimport itLang from './i18n/it.json';\nimport nlLang from './i18n/nl.json';\nimport ukLang from './i18n/uk.json';\nimport zhLang from './i18n/zh-cn.json';\n\nlet translationLoaded = false;\nexport function extendDeviceTypeTranslation(): void {\n if (!translationLoaded) {\n translationLoaded = true;\n I18n.extendTranslations({\n en: enLang,\n de: deLang,\n ru: ruLang,\n pt: ptLang,\n pl: plLang,\n es: esLang,\n fr: frLang,\n it: itLang,\n nl: nlLang,\n uk: ukLang,\n 'zh-cn': zhLang,\n });\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Gerätetyp",
3
3
  "type-airCondition": "Klimaanlage",
4
+ "type-airPurifier": "Luftreiniger",
5
+ "type-airQuality": "Luftqualität",
4
6
  "type-blind": "Jalousien",
5
7
  "type-blindButtons": "Jalousie über Tasten gesteuert",
6
8
  "type-button": "Taste",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "Kamera",
9
11
  "type-chart": "Diagramm",
10
12
  "type-cie": "CIE Farblicht",
13
+ "type-coAlarm": "Kohlenmonoxid-Alarm",
14
+ "type-contact": "Kontaktsensor",
11
15
  "type-ct": "Farbtemperatur",
12
16
  "type-dimmer": "Dimmer",
13
17
  "type-door": "Türsensor",
18
+ "type-electricity": "Stromzähler",
19
+ "type-fan": "Ventilator",
20
+ "type-fillLevel": "Füllstand",
14
21
  "type-fireAlarm": "Feueralarm",
15
22
  "type-floodAlarm": "Wasseralarm",
23
+ "type-flow": "Durchfluss",
16
24
  "type-gate": "Tor-Steuerung",
17
25
  "type-hue": "HUE-Licht",
18
26
  "type-humidity": "Feuchtigkeit",
@@ -27,6 +35,8 @@
27
35
  "type-media": "Mediaplayer",
28
36
  "type-motion": "Bewegungssensor",
29
37
  "type-percentage": "Prozentsatz",
38
+ "type-pressure": "Druck",
39
+ "type-pump": "Pumpe",
30
40
  "type-rgb": "RGB-Licht",
31
41
  "type-rgbSingle": "R,G,B-Licht Einzelwerte",
32
42
  "type-rgbwSingle": "R,G,B,W-Licht Einzelwerte",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "Steckdose",
35
45
  "type-temperature": "Temperatur",
36
46
  "type-thermostat": "Thermostat",
37
- "type-url": "URL",
47
+ "type-unknown": "Unbekannt",
38
48
  "type-vacuumCleaner": "Staubsauger",
39
- "type-valve": "Ventil",
40
49
  "type-volume": "Lautstärke",
41
50
  "type-volumeGroup": "Lautstärke-Gruppe",
42
51
  "type-warning": "Warnung",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Device type",
3
3
  "type-airCondition": "Air conditioner",
4
+ "type-airPurifier": "Air purifier",
5
+ "type-airQuality": "Air quality",
4
6
  "type-blind": "Blinds",
5
7
  "type-blindButtons": "Blind controlled by buttons",
6
8
  "type-button": "Button",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "Camera",
9
11
  "type-chart": "Chart",
10
12
  "type-cie": "CIE color light",
13
+ "type-coAlarm": "Carbon monoxide alarm",
14
+ "type-contact": "Contact sensor",
11
15
  "type-ct": "Color temperature",
12
16
  "type-dimmer": "Dimmer",
13
17
  "type-door": "Door",
18
+ "type-electricity": "Electricity meter",
19
+ "type-fan": "Fan",
20
+ "type-fillLevel": "Fill level",
14
21
  "type-fireAlarm": "Fire alarm",
15
22
  "type-floodAlarm": "Flood alarm",
23
+ "type-flow": "Flow rate",
16
24
  "type-gate": "Gate",
17
25
  "type-hue": "HUE light",
18
26
  "type-humidity": "Humidity",
@@ -27,6 +35,8 @@
27
35
  "type-media": "Media-player",
28
36
  "type-motion": "Motion sensor",
29
37
  "type-percentage": "Percentage",
38
+ "type-pressure": "Pressure",
39
+ "type-pump": "Pump",
30
40
  "type-rgb": "RGB light",
31
41
  "type-rgbSingle": "R,G,B light - single states",
32
42
  "type-rgbwSingle": "R,G,B,W light - single states",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "Socket",
35
45
  "type-temperature": "Temperature",
36
46
  "type-thermostat": "Thermostat",
37
- "type-url": "URL",
47
+ "type-unknown": "Unknown",
38
48
  "type-vacuumCleaner": "Vacuum cleaner",
39
- "type-valve": "Valve",
40
49
  "type-volume": "Volume",
41
50
  "type-volumeGroup": "Volume group",
42
51
  "type-warning": "Warning",
@@ -0,0 +1,56 @@
1
+ {
2
+ "type-Device type": "Tipo de dispositivo",
3
+ "type-airCondition": "Acondicionador de aire",
4
+ "type-airPurifier": "Purificador de aire",
5
+ "type-airQuality": "Calidad del aire",
6
+ "type-blind": "persianas",
7
+ "type-blindButtons": "Persiana controlada por botones",
8
+ "type-button": "botón",
9
+ "type-buttonSensor": "Sensor de botón",
10
+ "type-camera": "cámara",
11
+ "type-chart": "Cuadro",
12
+ "type-cie": "Luz de color CIE",
13
+ "type-coAlarm": "Alarma de monóxido de carbono",
14
+ "type-contact": "Sensor de contacto",
15
+ "type-ct": "Temperatura de color",
16
+ "type-dimmer": "regulador de intensidad",
17
+ "type-door": "puerta",
18
+ "type-electricity": "Contador de electricidad",
19
+ "type-fan": "Ventilador",
20
+ "type-fillLevel": "Nivel de llenado",
21
+ "type-fireAlarm": "alarma de incendios",
22
+ "type-floodAlarm": "alarma de inundación",
23
+ "type-flow": "Caudal",
24
+ "type-gate": "puerta",
25
+ "type-hue": "Luz HUE",
26
+ "type-humidity": "humedad",
27
+ "type-illuminance": "Iluminancia",
28
+ "type-image": "imagen",
29
+ "type-info": "información",
30
+ "type-instance": "instancia",
31
+ "type-light": "luz",
32
+ "type-location": "ubicación",
33
+ "type-locationOne": "Posición como Estado",
34
+ "type-lock": "cerrar",
35
+ "type-media": "medios de comunicación",
36
+ "type-motion": "movimiento",
37
+ "type-percentage": "Porcentaje",
38
+ "type-pressure": "Presión",
39
+ "type-pump": "Bomba",
40
+ "type-rgb": "Luz RGB",
41
+ "type-rgbSingle": "Luz RGB individual",
42
+ "type-rgbwSingle": "RGBW como valor único",
43
+ "type-slider": "control deslizante",
44
+ "type-socket": "enchufe",
45
+ "type-temperature": "temperatura",
46
+ "type-thermostat": "termostato",
47
+ "type-unknown": "Desconocido",
48
+ "type-vacuumCleaner": "Aspiradora",
49
+ "type-volume": "volumen",
50
+ "type-volumeGroup": "grupo de volumen",
51
+ "type-warning": "advertencia",
52
+ "type-weatherCurrent": "el tiempo actual",
53
+ "type-weatherForecast": "pronóstico del tiempo",
54
+ "type-window": "ventana",
55
+ "type-windowTilt": "inclinación de la ventana"
56
+ }
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Type d'appareil",
3
3
  "type-airCondition": "Climatiseur",
4
+ "type-airPurifier": "Purificateur d'air",
5
+ "type-airQuality": "Qualité de l'air",
4
6
  "type-blind": "stores",
5
7
  "type-blindButtons": "Store commandé par boutons",
6
8
  "type-button": "bouton",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "caméra",
9
11
  "type-chart": "Graphique",
10
12
  "type-cie": "lumière colorée CIE",
13
+ "type-coAlarm": "Alarme monoxyde de carbone",
14
+ "type-contact": "Capteur de contact",
11
15
  "type-ct": "Température de couleur",
12
16
  "type-dimmer": "variateur",
13
17
  "type-door": "porte",
18
+ "type-electricity": "Compteur électrique",
19
+ "type-fan": "Ventilateur",
20
+ "type-fillLevel": "Niveau de remplissage",
14
21
  "type-fireAlarm": "alarme incendie",
15
22
  "type-floodAlarm": "alarme d'inondation",
23
+ "type-flow": "Débit",
16
24
  "type-gate": "grille",
17
25
  "type-hue": "Lumière HUE",
18
26
  "type-humidity": "humidité",
@@ -27,6 +35,8 @@
27
35
  "type-media": "médias",
28
36
  "type-motion": "mouvement",
29
37
  "type-percentage": "Pourcentage",
38
+ "type-pressure": "Pression",
39
+ "type-pump": "Pompe",
30
40
  "type-rgb": "lumière RVB",
31
41
  "type-rgbSingle": "Lumière RVB simple",
32
42
  "type-rgbwSingle": "RGBW comme valeur unique",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "douille",
35
45
  "type-temperature": "température",
36
46
  "type-thermostat": "thermostat",
37
- "type-url": "URL",
47
+ "type-unknown": "Inconnu",
38
48
  "type-vacuumCleaner": "Aspirateur",
39
- "type-valve": "soupape",
40
49
  "type-volume": "volume",
41
50
  "type-volumeGroup": "groupe de volumes",
42
51
  "type-warning": "avertissement",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Tipo di dispositivo",
3
3
  "type-airCondition": "Condizionatore d'aria",
4
+ "type-airPurifier": "Purificatore d'aria",
5
+ "type-airQuality": "Qualità dell'aria",
4
6
  "type-blind": "tende",
5
7
  "type-blindButtons": "Tenda controllata da pulsanti",
6
8
  "type-button": "pulsante",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "telecamera",
9
11
  "type-chart": "Grafico",
10
12
  "type-cie": "Luce colorata CIE",
13
+ "type-coAlarm": "Allarme monossido di carbonio",
14
+ "type-contact": "Sensore di contatto",
11
15
  "type-ct": "Temperatura del colore",
12
16
  "type-dimmer": "dimmer",
13
17
  "type-door": "porta",
18
+ "type-electricity": "Contatore elettrico",
19
+ "type-fan": "Ventilatore",
20
+ "type-fillLevel": "Livello di riempimento",
14
21
  "type-fireAlarm": "allarme antincendio",
15
22
  "type-floodAlarm": "allarme allagamento",
23
+ "type-flow": "Portata",
16
24
  "type-gate": "cancello",
17
25
  "type-hue": "Luce HUE",
18
26
  "type-humidity": "umidità",
@@ -27,6 +35,8 @@
27
35
  "type-media": "media",
28
36
  "type-motion": "movimento",
29
37
  "type-percentage": "Percentuale",
38
+ "type-pressure": "Pressione",
39
+ "type-pump": "Pompa",
30
40
  "type-rgb": "luce RGB",
31
41
  "type-rgbSingle": "Luce RGB singola",
32
42
  "type-rgbwSingle": "RGBW come valore singolo",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "PRESA",
35
45
  "type-temperature": "temperatura",
36
46
  "type-thermostat": "termostato",
37
- "type-url": "URL",
47
+ "type-unknown": "Sconosciuto",
38
48
  "type-vacuumCleaner": "Aspirapolvere",
39
- "type-valve": "valvola",
40
49
  "type-volume": "volume",
41
50
  "type-volumeGroup": "gruppo di volumi",
42
51
  "type-warning": "avvertimento",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Apparaattype",
3
3
  "type-airCondition": "Airconditioner",
4
+ "type-airPurifier": "Luchtreiniger",
5
+ "type-airQuality": "Luchtkwaliteit",
4
6
  "type-blind": "jaloezieën",
5
7
  "type-blindButtons": "Jaloezie bediend door knoppen",
6
8
  "type-button": "knop",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "camera",
9
11
  "type-chart": "Grafiek",
10
12
  "type-cie": "CIE-kleurenlicht",
13
+ "type-coAlarm": "Koolmonoxidealarm",
14
+ "type-contact": "Contactsensor",
11
15
  "type-ct": "Kleurtemperatuur",
12
16
  "type-dimmer": "dimmer",
13
17
  "type-door": "deur",
18
+ "type-electricity": "Elektriciteitsmeter",
19
+ "type-fan": "Ventilator",
20
+ "type-fillLevel": "Vulniveau",
14
21
  "type-fireAlarm": "brandalarm",
15
22
  "type-floodAlarm": "overstromingsalarm",
23
+ "type-flow": "Debiet",
16
24
  "type-gate": "hek",
17
25
  "type-hue": "HUE-licht",
18
26
  "type-humidity": "vochtigheid",
@@ -27,6 +35,8 @@
27
35
  "type-media": "media",
28
36
  "type-motion": "beweging",
29
37
  "type-percentage": "Percentage",
38
+ "type-pressure": "Druk",
39
+ "type-pump": "Pomp",
30
40
  "type-rgb": "RGB-licht",
31
41
  "type-rgbSingle": "RGB-licht enkel",
32
42
  "type-rgbwSingle": "RGBW als enkele waarde",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "stopcontact",
35
45
  "type-temperature": "temperatuur",
36
46
  "type-thermostat": "thermostaat",
37
- "type-url": "URL",
47
+ "type-unknown": "Onbekend",
38
48
  "type-vacuumCleaner": "Stofzuiger",
39
- "type-valve": "ventiel",
40
49
  "type-volume": "volume",
41
50
  "type-volumeGroup": "volumegroep",
42
51
  "type-warning": "waarschuwing",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Typ urządzenia",
3
3
  "type-airCondition": "Klimatyzator",
4
+ "type-airPurifier": "Oczyszczacz powietrza",
5
+ "type-airQuality": "Jakość powietrza",
4
6
  "type-blind": "żaluzje",
5
7
  "type-blindButtons": "Roleta sterowana przyciskami",
6
8
  "type-button": "przycisk",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "kamera",
9
11
  "type-chart": "Wykres",
10
12
  "type-cie": "Światło kolorowe CIE",
13
+ "type-coAlarm": "Alarm tlenku węgla",
14
+ "type-contact": "Czujnik kontaktronowy",
11
15
  "type-ct": "Temperatura barwowa",
12
16
  "type-dimmer": "opornik",
13
17
  "type-door": "drzwi",
18
+ "type-electricity": "Licznik energii elektrycznej",
19
+ "type-fan": "Wentylator",
20
+ "type-fillLevel": "Poziom napełnienia",
14
21
  "type-fireAlarm": "alarm pożarowy",
15
22
  "type-floodAlarm": "alarm przeciwpowodziowy",
23
+ "type-flow": "Przepływ",
16
24
  "type-gate": "brama",
17
25
  "type-hue": "Światło HUE",
18
26
  "type-humidity": "wilgotność",
@@ -27,6 +35,8 @@
27
35
  "type-media": "głoska bezdźwięczna",
28
36
  "type-motion": "ruch",
29
37
  "type-percentage": "Procent",
38
+ "type-pressure": "Ciśnienie",
39
+ "type-pump": "Pompa",
30
40
  "type-rgb": "Światło RGB",
31
41
  "type-rgbSingle": "Pojedyncze światło RGB",
32
42
  "type-rgbwSingle": "RGBW jako pojedyncza wartość",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "gniazdo",
35
45
  "type-temperature": "temperatura",
36
46
  "type-thermostat": "termostat",
37
- "type-url": "Adres URL",
47
+ "type-unknown": "Nieznany",
38
48
  "type-vacuumCleaner": "Odkurzacz",
39
- "type-valve": "zawór",
40
49
  "type-volume": "tom",
41
50
  "type-volumeGroup": "grupa woluminów",
42
51
  "type-warning": "ostrzeżenie",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Tipo de dispositivo",
3
3
  "type-airCondition": "Ar condicionado",
4
+ "type-airPurifier": "Purificador de ar",
5
+ "type-airQuality": "Qualidade do ar",
4
6
  "type-blind": "persianas",
5
7
  "type-blindButtons": "Persiana controlada por botões",
6
8
  "type-button": "botão",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "câmera",
9
11
  "type-chart": "Gráfico",
10
12
  "type-cie": "Luz colorida CIE",
13
+ "type-coAlarm": "Alarme de monóxido de carbono",
14
+ "type-contact": "Sensor de contato",
11
15
  "type-ct": "Temperatura de cor",
12
16
  "type-dimmer": "dimmer",
13
17
  "type-door": "porta",
18
+ "type-electricity": "Medidor de energia",
19
+ "type-fan": "Ventilador",
20
+ "type-fillLevel": "Nível de enchimento",
14
21
  "type-fireAlarm": "alarme de incêndio",
15
22
  "type-floodAlarm": "alarme de inundação",
23
+ "type-flow": "Vazão",
16
24
  "type-gate": "portão",
17
25
  "type-hue": "Luz HUE",
18
26
  "type-humidity": "umidade",
@@ -27,6 +35,8 @@
27
35
  "type-media": "mídia",
28
36
  "type-motion": "movimento",
29
37
  "type-percentage": "Percentagem",
38
+ "type-pressure": "Pressão",
39
+ "type-pump": "Bomba",
30
40
  "type-rgb": "Luz RGB",
31
41
  "type-rgbSingle": "Luz RGB única",
32
42
  "type-rgbwSingle": "RGBW como valor único",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "soquete",
35
45
  "type-temperature": "temperatura",
36
46
  "type-thermostat": "termostato",
37
- "type-url": "URL",
47
+ "type-unknown": "Desconhecido",
38
48
  "type-vacuumCleaner": "Aspirador de pó",
39
- "type-valve": "válvula",
40
49
  "type-volume": "volume",
41
50
  "type-volumeGroup": "grupo de volume",
42
51
  "type-warning": "aviso",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Тип устройства",
3
3
  "type-airCondition": "Кондиционер",
4
+ "type-airPurifier": "Очиститель воздуха",
5
+ "type-airQuality": "Качество воздуха",
4
6
  "type-blind": "Рольставни/Жалюзи",
5
7
  "type-blindButtons": "Жалюзи управляющиеся кнопками",
6
8
  "type-button": "Кнопка",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "Камера",
9
11
  "type-chart": "Диаграмма",
10
12
  "type-cie": "CIE свет",
13
+ "type-coAlarm": "Датчик угарного газа",
14
+ "type-contact": "Датчик контакта",
11
15
  "type-ct": "Цветовая температура",
12
16
  "type-dimmer": "Диммер",
13
17
  "type-door": "Датчик положения двери",
18
+ "type-electricity": "Счётчик электроэнергии",
19
+ "type-fan": "Вентилятор",
20
+ "type-fillLevel": "Уровень наполнения",
14
21
  "type-fireAlarm": "Датчик дыма",
15
22
  "type-floodAlarm": "Датчик затопления",
23
+ "type-flow": "Расход",
16
24
  "type-gate": "Ворота",
17
25
  "type-hue": "HUE свет",
18
26
  "type-humidity": "Влажность",
@@ -27,6 +35,8 @@
27
35
  "type-media": "Медиа-плейер",
28
36
  "type-motion": "Датчик движения",
29
37
  "type-percentage": "Проценты",
38
+ "type-pressure": "Давление",
39
+ "type-pump": "Насос",
30
40
  "type-rgb": "RGB свет",
31
41
  "type-rgbSingle": "R,G,B как отдельные значение",
32
42
  "type-rgbwSingle": "R,G,B,W как отдельные значение",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "Розетка",
35
45
  "type-temperature": "Температура",
36
46
  "type-thermostat": "Термостат",
37
- "type-url": "URL",
47
+ "type-unknown": "Неизвестно",
38
48
  "type-vacuumCleaner": "Пылесос",
39
- "type-valve": "Вентиль",
40
49
  "type-volume": "Громкость",
41
50
  "type-volumeGroup": "Группа громкости",
42
51
  "type-warning": "Предупреждение",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "Тип пристрою",
3
3
  "type-airCondition": "Кондиціонер",
4
+ "type-airPurifier": "Очищувач повітря",
5
+ "type-airQuality": "Якість повітря",
4
6
  "type-blind": "жалюзі",
5
7
  "type-blindButtons": "Штора керується кнопками",
6
8
  "type-button": "кнопку",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "камера",
9
11
  "type-chart": "Діаграма",
10
12
  "type-cie": "Кольорове світло CIE",
13
+ "type-coAlarm": "Датчик чадного газу",
14
+ "type-contact": "Датчик контакту",
11
15
  "type-ct": "Колірна температура",
12
16
  "type-dimmer": "диммер",
13
17
  "type-door": "двері",
18
+ "type-electricity": "Лічильник електроенергії",
19
+ "type-fan": "Вентилятор",
20
+ "type-fillLevel": "Рівень наповнення",
14
21
  "type-fireAlarm": "пожежна сигналізація",
15
22
  "type-floodAlarm": "сигналізація про повінь",
23
+ "type-flow": "Витрата",
16
24
  "type-gate": "ворота",
17
25
  "type-hue": "світло HUE",
18
26
  "type-humidity": "вологість",
@@ -27,6 +35,8 @@
27
35
  "type-media": "ЗМІ",
28
36
  "type-motion": "руху",
29
37
  "type-percentage": "Відсоток",
38
+ "type-pressure": "Тиск",
39
+ "type-pump": "Насос",
30
40
  "type-rgb": "RGB світло",
31
41
  "type-rgbSingle": "Одиночне світло RGB",
32
42
  "type-rgbwSingle": "RGBW як одне значення",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "гніздо",
35
45
  "type-temperature": "температура",
36
46
  "type-thermostat": "термостат",
37
- "type-url": "URL",
47
+ "type-unknown": "Невідомо",
38
48
  "type-vacuumCleaner": "Пилосос",
39
- "type-valve": "клапан",
40
49
  "type-volume": "обсяг",
41
50
  "type-volumeGroup": "група обсягів",
42
51
  "type-warning": "УВАГА",
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "type-Device type": "设备类型",
3
3
  "type-airCondition": "空调",
4
+ "type-airPurifier": "空气净化器",
5
+ "type-airQuality": "空气质量",
4
6
  "type-blind": "百叶窗",
5
7
  "type-blindButtons": "按钮控制百叶窗",
6
8
  "type-button": "按钮",
@@ -8,11 +10,17 @@
8
10
  "type-camera": "相机",
9
11
  "type-chart": "图表",
10
12
  "type-cie": "CIE色光",
13
+ "type-coAlarm": "一氧化碳报警器",
14
+ "type-contact": "触点传感器",
11
15
  "type-ct": "色温",
12
16
  "type-dimmer": "调光器",
13
17
  "type-door": "门",
18
+ "type-electricity": "电表",
19
+ "type-fan": "风扇",
20
+ "type-fillLevel": "填充量",
14
21
  "type-fireAlarm": "火灾报警",
15
22
  "type-floodAlarm": "洪水警报",
23
+ "type-flow": "流量",
16
24
  "type-gate": "门",
17
25
  "type-hue": "色调灯",
18
26
  "type-humidity": "湿度",
@@ -27,6 +35,8 @@
27
35
  "type-media": "媒体",
28
36
  "type-motion": "运动",
29
37
  "type-percentage": "百分比",
38
+ "type-pressure": "压力",
39
+ "type-pump": "泵",
30
40
  "type-rgb": "RGB灯",
31
41
  "type-rgbSingle": "RGB灯单",
32
42
  "type-rgbwSingle": "RGBW 作为单一值",
@@ -34,9 +44,8 @@
34
44
  "type-socket": "插座",
35
45
  "type-temperature": "温度",
36
46
  "type-thermostat": "恒温器",
37
- "type-url": "网址",
47
+ "type-unknown": "未知",
38
48
  "type-vacuumCleaner": "吸尘器",
39
- "type-valve": "阀门",
40
49
  "type-volume": "体积",
41
50
  "type-volumeGroup": "卷组",
42
51
  "type-warning": "警告",
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,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,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAEjB,GAAG,C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AE;6BAC5D;4BACD,SAAS,EAAE;gCACP,WAAW,EACP,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAqB,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 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,GA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,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE;wBAC7C,KAAK,EAAE;4BACH,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO;4BAC5B,WAAW,EAAE,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,2BAA2B;4BAC3F,gBAAgB,EAAE;gCACd,MAAM,EAAE,aAAa,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE;6BAC5D;4BACD,SAAS,EAAE;gCACP,WAAW,EACP,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAqB,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.15",
3
+ "version": "10.1.0",
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",
@@ -20,6 +20,8 @@
20
20
  "2-copy": "node tasks.ts --2-copy",
21
21
  "3-patchReadme": "node tasks.ts --3-patchReadme",
22
22
  "npm": "npm i",
23
+ "check": "tsc -p tsconfig.build.json --noEmit",
24
+ "check-device-types": "node tasks.ts --check-device-types",
23
25
  "lint": "eslint -c eslint.config.mjs src"
24
26
  },
25
27
  "repository": {
@@ -55,15 +57,15 @@
55
57
  "@iobroker/js-controller-common": "^7.2.2",
56
58
  "@iobroker/js-controller-common-db": "^7.2.2",
57
59
  "@iobroker/socket-client": "^5.2.1",
58
- "@iobroker/type-detector": "^5.0.15",
60
+ "@iobroker/type-detector": "^6.0.0",
59
61
  "@iobroker/types": "^7.2.2",
60
- "@sentry/browser": "^10.69.0",
62
+ "@sentry/browser": "^10.70.0",
61
63
  "cronstrue": "^3.24.0",
62
64
  "file-selector": "^5.0.0",
63
65
  "react-color": "^2.19.3",
64
66
  "react-colorful": "^5.8.0",
65
67
  "react-cropper": "^2.3.3",
66
- "react-dropzone": "^20.0.0",
68
+ "react-dropzone": "^20.1.0",
67
69
  "react-icons": "^5.7.0",
68
70
  "react-inlinesvg": "^4.5.0"
69
71
  },
@@ -82,7 +84,7 @@
82
84
  "@iobroker/eslint-config": "^2.3.4",
83
85
  "@mui/icons-material": "^9.3.1",
84
86
  "@mui/material": "^9.3.1",
85
- "@types/node": "^26.1.2",
87
+ "@types/node": "^26.2.0",
86
88
  "@types/react": "^19.2.18",
87
89
  "@types/react-color": "^3.0.13",
88
90
  "@types/react-dom": "^19.2.4",