@iobroker/adapter-react-v5 6.0.10 → 6.0.12

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.
@@ -36,6 +36,7 @@ interface ColorPickerProps {
36
36
  customPalette?: string[];
37
37
  noInputField?: boolean;
38
38
  barWidth?: number;
39
+ sx?: Record<string, any>;
39
40
  }
40
41
  interface ColorPickerState {
41
42
  displayColorPicker: boolean;
@@ -44,14 +45,8 @@ interface ColorPickerState {
44
45
  }
45
46
  declare class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
46
47
  constructor(props: ColorPickerProps);
47
- /**
48
- * @private
49
- */
50
- handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
51
- /**
52
- * @private
53
- */
54
- handleClose: () => void;
48
+ private handleClick;
49
+ private handleClose;
55
50
  /**
56
51
  * Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.
57
52
  * @returns the hex or rgba representation of the given color.
@@ -68,8 +63,6 @@ declare class ColorPicker extends Component<ColorPickerProps, ColorPickerState>
68
63
  private handleChange;
69
64
  /**
70
65
  * IF the props are updated from outside, they should override the state
71
- * @param _prevProps
72
- * @param prevState
73
66
  */
74
67
  componentDidUpdate(_prevProps: ColorPickerProps, prevState: ColorPickerState): void;
75
68
  renderCustomPalette(): React.JSX.Element;
@@ -115,18 +115,12 @@ const styles = {
115
115
  class ColorPicker extends react_1.Component {
116
116
  constructor(props) {
117
117
  super(props);
118
- /**
119
- * @private
120
- */
121
118
  this.handleClick = (e) => {
122
119
  this.setState({
123
120
  displayColorPicker: !this.state.displayColorPicker,
124
121
  anchorEl: this.state.displayColorPicker ? null : e.currentTarget,
125
122
  });
126
123
  };
127
- /**
128
- * @private
129
- */
130
124
  this.handleClose = () => {
131
125
  this.setState({ displayColorPicker: false, anchorEl: null });
132
126
  };
@@ -177,8 +171,6 @@ class ColorPicker extends react_1.Component {
177
171
  }
178
172
  /**
179
173
  * IF the props are updated from outside, they should override the state
180
- * @param _prevProps
181
- * @param prevState
182
174
  */
183
175
  componentDidUpdate(_prevProps, prevState) {
184
176
  const color = ColorPicker.getColor(this.props.color || this.props.value || '');
@@ -200,7 +192,7 @@ class ColorPicker extends react_1.Component {
200
192
  const style = Object.assign({}, (this.props.style || {}));
201
193
  style.position = 'relative';
202
194
  const { color } = this.state;
203
- return react_1.default.createElement(material_1.Box, { component: "div", style: style, className: this.props.className || '' },
195
+ return react_1.default.createElement(material_1.Box, { component: "div", style: style, sx: this.props.sx || undefined, className: this.props.className || '' },
204
196
  this.props.noInputField ? null : react_1.default.createElement(material_1.TextField, { disabled: this.props.disabled, variant: "standard", id: "ar_color_picker_name", label: this.props.label || this.props.name || 'color', value: color || '', margin: "dense", sx: {
205
197
  '&.MuiFormControl-root': styles.textDense,
206
198
  width: color ? 'calc(100% - 80px)' : 'calc(100% - 56px)',
@@ -198,6 +198,7 @@ interface ObjectBrowserEditObjectProps {
198
198
  isFloatComma: boolean;
199
199
  onNewObject: (obj: ioBroker.AnyObject) => void;
200
200
  t: Translate;
201
+ width: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
201
202
  }
202
203
  interface ObjectAliasEditorProps {
203
204
  t: Translate;
@@ -5113,7 +5113,7 @@ class ObjectBrowserClass extends react_1.Component {
5113
5113
  .catch(e => this.showError(`Cannot write object: ${e}`));
5114
5114
  }
5115
5115
  this.setState({ editObjectDialog: '', editObjectAlias: false });
5116
- } });
5116
+ }, width: this.props.width });
5117
5117
  }
5118
5118
  renderViewObjectFileDialog() {
5119
5119
  if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
package/README.md CHANGED
@@ -771,6 +771,9 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
771
771
  -->
772
772
 
773
773
  ## Changelog
774
+ ### 6.0.12 (2024-06-29)
775
+ * (bluefox) Added support for the overrides in the theme
776
+
774
777
  ### 6.0.10 (2024-06-27)
775
778
  * (bluefox) Added translation
776
779
  * (bluefox) Mobile object browser improved
package/Theme.d.ts CHANGED
@@ -2,5 +2,5 @@ import { type IobTheme, type ThemeName } from './types';
2
2
  /**
3
3
  * The theme creation factory function.
4
4
  */
5
- declare const CustomTheme: (type: ThemeName) => IobTheme;
6
- export default CustomTheme;
5
+ declare function customTheme(type: ThemeName, overrides?: Record<string, any>): IobTheme;
6
+ export default customTheme;
package/Theme.js CHANGED
@@ -67,12 +67,12 @@ overlay) {
67
67
  /**
68
68
  * The theme creation factory function.
69
69
  */
70
- const CustomTheme = (type) => {
70
+ function customTheme(type, overrides) {
71
71
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
72
72
  let options;
73
- let overrides;
73
+ let localOverrides;
74
74
  if (type === 'dark') {
75
- overrides = {
75
+ localOverrides = {
76
76
  MuiAppBar: {
77
77
  colorDefault: {
78
78
  backgroundColor: '#272727',
@@ -113,7 +113,7 @@ const CustomTheme = (type) => {
113
113
  };
114
114
  }
115
115
  else if (type === 'blue') {
116
- overrides = {
116
+ localOverrides = {
117
117
  MuiAppBar: {
118
118
  colorDefault: {
119
119
  backgroundColor: '#3399CC',
@@ -153,7 +153,7 @@ const CustomTheme = (type) => {
153
153
  };
154
154
  }
155
155
  else if (type === 'colored') {
156
- overrides = {
156
+ localOverrides = {
157
157
  MuiAppBar: {
158
158
  colorDefault: {
159
159
  backgroundColor: '#2a3135',
@@ -186,7 +186,7 @@ const CustomTheme = (type) => {
186
186
  };
187
187
  }
188
188
  else if (type === 'PT') {
189
- overrides = {
189
+ localOverrides = {
190
190
  MuiAppBar: {
191
191
  colorDefault: {
192
192
  backgroundColor: '#0F99DE',
@@ -218,7 +218,7 @@ const CustomTheme = (type) => {
218
218
  };
219
219
  }
220
220
  else if (type === 'DX') {
221
- overrides = {
221
+ localOverrides = {
222
222
  MuiAppBar: {
223
223
  colorDefault: {
224
224
  backgroundColor: '#a9a9a9',
@@ -255,7 +255,7 @@ const CustomTheme = (type) => {
255
255
  };
256
256
  }
257
257
  else {
258
- overrides = {
258
+ localOverrides = {
259
259
  MuiLink: {
260
260
  root: {
261
261
  textTransform: 'uppercase',
@@ -273,9 +273,8 @@ const CustomTheme = (type) => {
273
273
  mode: 'light',
274
274
  primary: {
275
275
  main: '#3399CC',
276
- light: undefined,
277
- dark: undefined,
278
- contrastText: undefined,
276
+ dark: '#256c97',
277
+ light: '#76d0fd',
279
278
  },
280
279
  secondary: {
281
280
  main: '#164477',
@@ -302,8 +301,7 @@ const CustomTheme = (type) => {
302
301
  }
303
302
  const theme = (0, styles_1.createTheme)(options);
304
303
  const palette = theme.palette;
305
- return (0, styles_1.createTheme)(theme, {
306
- components: Object.assign(Object.assign({}, overrides), { MuiButton: {
304
+ return (0, styles_1.createTheme)(theme, Object.assign(Object.assign({}, (overrides || undefined)), { components: Object.assign(Object.assign(Object.assign({}, localOverrides), { MuiButton: {
307
305
  variants: [
308
306
  {
309
307
  props: { variant: 'contained', color: 'grey' },
@@ -339,7 +337,6 @@ const CustomTheme = (type) => {
339
337
  },
340
338
  },
341
339
  ],
342
- } }),
343
- });
344
- };
345
- exports.default = CustomTheme;
340
+ } }), ((overrides === null || overrides === void 0 ? void 0 : overrides.components) || undefined)) }));
341
+ }
342
+ exports.default = customTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "6.0.10",
3
+ "version": "6.0.12",
4
4
  "description": "React classes to develop admin interfaces for ioBroker with react.",
5
5
  "author": {
6
6
  "name": "Denis Haev (bluefox)",
@@ -30,13 +30,13 @@
30
30
  "@emotion/react": "^11.11.4",
31
31
  "@emotion/styled": "^11.11.5",
32
32
  "@iobroker/socket-client": "^2.4.18",
33
- "@iobroker/types": "^6.0.5",
33
+ "@iobroker/types": "^6.0.6-alpha.0-20240624-92c3310c8",
34
34
  "@iobroker/js-controller-common": "^6.0.5",
35
35
  "@iobroker/js-controller-common-db": "^6.0.5",
36
- "@mui/icons-material": "^5.15.20",
37
- "@mui/material": "^5.15.20",
38
- "@mui/x-date-pickers": "^7.7.1",
39
- "@sentry/browser": "^8.11.0",
36
+ "@mui/icons-material": "^5.15.21",
37
+ "@mui/material": "^5.15.21",
38
+ "@mui/x-date-pickers": "^7.8.0",
39
+ "@sentry/browser": "^8.13.0",
40
40
  "react-color": "^2.19.3",
41
41
  "react-colorful": "^5.6.1",
42
42
  "react-cropper": "^2.3.3",