@kemu-io/hs-react 0.3.0 → 0.3.3

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.
@@ -47,12 +47,17 @@ export interface BaseWidgetProps {
47
47
  onOpenSettings?: () => void;
48
48
  width?: number;
49
49
  height?: number;
50
+ iconWidth?: number;
51
+ iconHeight?: number;
50
52
  showIcon?: boolean;
51
53
  customIcon?: ReactNode;
52
54
  settingsIconColor?: string;
53
55
  customTheme?: Theme;
56
+ svgContainerClassName?: string;
57
+ widgetContainerClassName?: string;
58
+ widgetBodyClassName?: string;
54
59
  }
55
- declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
60
+ declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, iconWidth, iconHeight, showIcon, customIcon, settingsIconColor, customTheme, svgContainerClassName, widgetContainerClassName, widgetBodyClassName, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
56
61
 
57
62
  export {
58
63
  BaseWidget as default,
@@ -1,6 +1,6 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("@emotion/react"),WidgetContainer_js_1=__importDefault(require("./WidgetContainer.js")),SettingsBar_js_1=__importDefault(require("./SettingsBar.js")),WidgetBody_js_1=__importDefault(require("./WidgetBody.js")),SvgContainer_js_1=__importDefault(require("./SvgContainer.js")),KemuThemeWrapper_js_1=__importDefault(require("./KemuThemeWrapper.js")),BaseWidget=({children:e,showSettings:t=!0,onOpenSettings:i,width:r=84,height:s=134,showIcon:_=!0,customIcon:n,settingsIconColor:o="white",customTheme:u})=>(0,jsx_runtime_1.jsx)(KemuThemeWrapper_js_1.default,{theme:u,children:(0,jsx_runtime_1.jsxs)(WidgetContainer_js_1.default,{width:r,height:s,css:react_1.css`
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("@emotion/react"),WidgetContainer_js_1=__importDefault(require("./WidgetContainer.js")),SettingsBar_js_1=__importDefault(require("./SettingsBar.js")),WidgetBody_js_1=__importDefault(require("./WidgetBody.js")),SvgContainer_js_1=__importDefault(require("./SvgContainer.js")),KemuThemeWrapper_js_1=__importDefault(require("./KemuThemeWrapper.js")),BaseWidget=({children:e,showSettings:t=!0,onOpenSettings:i,width:s=84,height:r=134,iconWidth:n=38,iconHeight:_=38,showIcon:a=!0,customIcon:o,settingsIconColor:u="white",customTheme:l,svgContainerClassName:d,widgetContainerClassName:m,widgetBodyClassName:c})=>(0,jsx_runtime_1.jsx)(KemuThemeWrapper_js_1.default,{theme:l,children:(0,jsx_runtime_1.jsxs)(WidgetContainer_js_1.default,{className:m,width:s,height:r,css:react_1.css`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: center;
5
5
  justify-content: center;
6
- `,children:[t&&i&&(0,jsx_runtime_1.jsx)(SettingsBar_js_1.default,{iconColor:o,onSettingsClick:i}),(0,jsx_runtime_1.jsxs)(WidgetBody_js_1.default,{children:[_&&n&&(0,jsx_runtime_1.jsx)(SvgContainer_js_1.default,{children:n}),e]})]})});exports.default=BaseWidget;
6
+ `,children:[t&&i&&(0,jsx_runtime_1.jsx)(SettingsBar_js_1.default,{iconColor:u,onSettingsClick:i}),(0,jsx_runtime_1.jsxs)(WidgetBody_js_1.default,{className:c,children:[a&&o&&(0,jsx_runtime_1.jsx)(SvgContainer_js_1.default,{width:n,height:_,className:d,children:o}),e]})]})});exports.default=BaseWidget;
@@ -39,5 +39,6 @@
39
39
  &:disabled {
40
40
  opacity: 0.65;
41
41
  pointer-events: none;
42
+ color: #ffffffb0;
42
43
  }
43
44
  `;exports.default=KemuPrimaryButton;
@@ -63,6 +63,8 @@ export interface SettingsDialogProps {
63
63
  minWidth?: number;
64
64
  maxWidth?: number;
65
65
  maxHeight?: number;
66
+ initialHeight?: number;
67
+ initialWidth?: number;
66
68
  cancelButtonText?: string;
67
69
  saveButtonText?: string;
68
70
  disableResizing?: boolean;
@@ -72,7 +74,7 @@ export interface SettingsDialogProps {
72
74
  dialogContentClassName?: string;
73
75
  dialogActionsClassName?: string;
74
76
  }
75
- declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
77
+ declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, initialHeight, initialWidth, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
76
78
 
77
79
  export {
78
80
  SettingsDialog as default,
@@ -8,7 +8,7 @@
8
8
  height: 100%;
9
9
  overflow-y: unset;
10
10
  padding: unset;
11
- padding-top: 40px;
11
+ padding-top: 20px;
12
12
  `,Header=styled_1.default.div`
13
13
  line-height: 30px;
14
14
  align-self: center;
@@ -53,7 +53,7 @@
53
53
  position: absolute;
54
54
  margin-top: 20px;
55
55
  width: 100%;
56
- padding: 0 25px 20px;
56
+ padding: 10px 25px 20px;
57
57
  bottom: 0;
58
58
  right: 0;
59
59
  background-color: white;
@@ -71,4 +71,4 @@
71
71
  &:hover {
72
72
  background-color: rgba(255, 255, 255, 1);
73
73
  }
74
- `,SettingsDialog=({title:e="Settings",open:t,noHeader:i=!1,onClose:o,onSave:a,children:r,serviceOnline:l=!0,saveDisabled:n=!1,minHeight:s=400,minWidth:d=500,maxWidth:u,maxHeight:_,cancelButtonText:m="Cancel",saveButtonText:p="Save",disableResizing:c=!1,disableExpansion:x=!1,dialogClassName:h,resizableClassName:g,dialogContentClassName:b,dialogActionsClassName:f})=>{const[j,D]=(0,react_1.useState)({width:d,height:s}),[y,C]=(0,react_1.useState)(!1),[w,S]=(0,react_1.useState)({width:d,height:s}),k=(0,react_1.useCallback)(((e,t,i,o)=>{if(c)return;const a={width:i.offsetWidth,height:i.offsetHeight};D(a)}),[c]),v=(0,react_1.useCallback)(((e,t)=>{"backdropClick"!==t&&"escapeKeyDown"!==t&&o()}),[o]),z=(0,react_1.useCallback)((()=>{if(y)D(w),C(!1);else{S(j);const e=window.innerWidth-180,t=window.innerHeight-120-60;D({width:Math.max(d,e),height:Math.max(s,t)}),C(!0)}}),[y,j,w,d,s]),q={pointerEvents:"none"},B=!x,K=!c&&!y,N=(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[!i&&(0,jsx_runtime_1.jsx)(Header,{children:(0,jsx_runtime_1.jsx)(Title,{children:e})}),B&&(0,jsx_runtime_1.jsx)(ExpandButton,{onClick:z,size:"small",children:y?(0,jsx_runtime_1.jsx)(FullscreenExit_1.default,{}):(0,jsx_runtime_1.jsx)(Fullscreen_1.default,{})}),(0,jsx_runtime_1.jsx)(StyledDialogContent,{className:b,children:(0,jsx_runtime_1.jsx)(ScrollableContainer,{children:r})}),(0,jsx_runtime_1.jsxs)(StyledDialogActions,{className:f,children:[(0,jsx_runtime_1.jsx)(KemuLightButton_js_1.default,{onClick:o,children:m}),(0,jsx_runtime_1.jsx)(KemuPrimaryButton_js_1.default,{disabled:!l||n,onClick:a,children:p})]})]});return(0,jsx_runtime_1.jsx)(ResizableDialog,{onClose:v,open:t,className:h,children:(0,jsx_runtime_1.jsx)(KemuThemeWrapper_js_1.default,{children:c?(0,jsx_runtime_1.jsx)("div",{className:g,style:{width:j.width,height:j.height},children:N}):(0,jsx_runtime_1.jsx)(re_resizable_1.Resizable,{enable:{top:K,right:K,bottom:K,left:K,topRight:K,bottomRight:K,bottomLeft:K,topLeft:K},handleStyles:{bottomLeft:q,bottomRight:{zIndex:2},bottom:q,top:q,topLeft:q,topRight:q},minHeight:s,minWidth:d,maxWidth:u,maxHeight:_,size:j,onResizeStop:k,className:g,children:N})})})};exports.default=SettingsDialog;
74
+ `,SettingsDialog=({title:e="Settings",open:t,noHeader:i=!1,onClose:o,onSave:a,children:r,serviceOnline:l=!0,saveDisabled:n=!1,minHeight:s=250,minWidth:d=450,maxWidth:u,maxHeight:_=(window.visualViewport?.height??window.innerHeight)-100,initialHeight:m=Math.min(800,(window.visualViewport?.height??window.innerHeight)-100),initialWidth:h=450,cancelButtonText:p="Cancel",saveButtonText:c="Save",disableResizing:g=!1,disableExpansion:x=!1,dialogClassName:b,resizableClassName:f,dialogContentClassName:j,dialogActionsClassName:D})=>{const[w,y]=(0,react_1.useState)({width:h,height:m}),[C,v]=(0,react_1.useState)(!1),[S,k]=(0,react_1.useState)({width:h,height:m}),z=(0,react_1.useCallback)(((e,t,i,o)=>{if(g)return;const a={width:i.offsetWidth,height:i.offsetHeight};y(a)}),[g]),q=(0,react_1.useCallback)(((e,t)=>{"backdropClick"!==t&&"escapeKeyDown"!==t&&o()}),[o]),B=(0,react_1.useCallback)((()=>{if(C)y(S),v(!1);else{k(w);const e=window.innerWidth-180,t=window.innerHeight-120-60;y({width:Math.max(d,e),height:Math.max(s,t)}),v(!0)}}),[C,w,S,d,s]),H={pointerEvents:"none"},K=!x,N=!g&&!C,W=(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[!i&&(0,jsx_runtime_1.jsx)(Header,{children:(0,jsx_runtime_1.jsx)(Title,{children:e})}),K&&(0,jsx_runtime_1.jsx)(ExpandButton,{onClick:B,size:"small",children:C?(0,jsx_runtime_1.jsx)(FullscreenExit_1.default,{}):(0,jsx_runtime_1.jsx)(Fullscreen_1.default,{})}),(0,jsx_runtime_1.jsx)(StyledDialogContent,{className:j,children:(0,jsx_runtime_1.jsx)(ScrollableContainer,{children:r})}),(0,jsx_runtime_1.jsxs)(StyledDialogActions,{className:D,children:[(0,jsx_runtime_1.jsx)(KemuLightButton_js_1.default,{onClick:o,children:p}),(0,jsx_runtime_1.jsx)(KemuPrimaryButton_js_1.default,{disabled:!l||n,onClick:a,children:c})]})]});return(0,jsx_runtime_1.jsx)(ResizableDialog,{onClose:q,open:t,className:b,children:(0,jsx_runtime_1.jsx)(KemuThemeWrapper_js_1.default,{children:g?(0,jsx_runtime_1.jsx)("div",{className:f,style:{width:w.width,height:w.height},children:W}):(0,jsx_runtime_1.jsx)(re_resizable_1.Resizable,{enable:{top:N,right:N,bottom:N,left:N,topRight:N,bottomRight:N,bottomLeft:N,topLeft:N},handleStyles:{bottomLeft:H,bottomRight:{zIndex:2},bottom:H,top:H,topLeft:H,topRight:H},minHeight:s,minWidth:d,maxWidth:u,maxHeight:_,size:w,onResizeStop:z,className:f,children:W})})})};exports.default=SettingsDialog;
@@ -13,8 +13,11 @@ import { ReactNode } from 'react';
13
13
  export interface SvgContainerProps {
14
14
  fill?: string;
15
15
  children?: ReactNode;
16
+ width?: number;
17
+ height?: number;
18
+ className?: string;
16
19
  }
17
- declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
20
+ declare const SvgContainer: ({ fill, children, width, height, className }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
18
21
 
19
22
  export {
20
23
  SvgContainer as default,
@@ -3,7 +3,7 @@
3
3
  margin-top: 10px;
4
4
 
5
5
  svg {
6
- width: 38px;
7
- height: 38px;
6
+ width: ${e=>e.width||38}px;
7
+ height: ${e=>e.height||38}px;
8
8
  }
9
- `,SvgContainer=({fill:e,children:t})=>(0,jsx_runtime_1.jsx)(StyledSvgContainer,{fill:e,children:t});exports.default=SvgContainer;
9
+ `,SvgContainer=({fill:e,children:t,width:i,height:l,className:r})=>(0,jsx_runtime_1.jsx)(StyledSvgContainer,{fill:e,width:i,height:l,className:r,children:t});exports.default=SvgContainer;
@@ -82,12 +82,17 @@ export interface BaseWidgetProps {
82
82
  onOpenSettings?: () => void;
83
83
  width?: number;
84
84
  height?: number;
85
+ iconWidth?: number;
86
+ iconHeight?: number;
85
87
  showIcon?: boolean;
86
88
  customIcon?: React$1.ReactNode;
87
89
  settingsIconColor?: string;
88
90
  customTheme?: Theme;
91
+ svgContainerClassName?: string;
92
+ widgetContainerClassName?: string;
93
+ widgetBodyClassName?: string;
89
94
  }
90
- export declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
95
+ export declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, iconWidth, iconHeight, showIcon, customIcon, settingsIconColor, customTheme, svgContainerClassName, widgetContainerClassName, widgetBodyClassName, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
91
96
  /**
92
97
  * A checkbox field component with label, wrapped in a horizontal field layout.
93
98
  *
@@ -341,6 +346,8 @@ export interface SettingsDialogProps {
341
346
  minWidth?: number;
342
347
  maxWidth?: number;
343
348
  maxHeight?: number;
349
+ initialHeight?: number;
350
+ initialWidth?: number;
344
351
  cancelButtonText?: string;
345
352
  saveButtonText?: string;
346
353
  disableResizing?: boolean;
@@ -350,7 +357,7 @@ export interface SettingsDialogProps {
350
357
  dialogContentClassName?: string;
351
358
  dialogActionsClassName?: string;
352
359
  }
353
- export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
360
+ export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, initialHeight, initialWidth, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
354
361
  /**
355
362
  * Container for SVG icons with customizable fill color.
356
363
  *
@@ -364,8 +371,11 @@ export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave,
364
371
  export interface SvgContainerProps {
365
372
  fill?: string;
366
373
  children?: React$1.ReactNode;
374
+ width?: number;
375
+ height?: number;
376
+ className?: string;
367
377
  }
368
- export declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
378
+ export declare const SvgContainer: ({ fill, children, width, height, className }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
369
379
  /**
370
380
  * A container for widget body content. Provides centered flexbox layout with padding.
371
381
  *
@@ -47,12 +47,17 @@ export interface BaseWidgetProps {
47
47
  onOpenSettings?: () => void;
48
48
  width?: number;
49
49
  height?: number;
50
+ iconWidth?: number;
51
+ iconHeight?: number;
50
52
  showIcon?: boolean;
51
53
  customIcon?: ReactNode;
52
54
  settingsIconColor?: string;
53
55
  customTheme?: Theme;
56
+ svgContainerClassName?: string;
57
+ widgetContainerClassName?: string;
58
+ widgetBodyClassName?: string;
54
59
  }
55
- declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
60
+ declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, iconWidth, iconHeight, showIcon, customIcon, settingsIconColor, customTheme, svgContainerClassName, widgetContainerClassName, widgetBodyClassName, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
56
61
 
57
62
  export {
58
63
  BaseWidget as default,
@@ -1,6 +1,6 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{css}from"@emotion/react";import WidgetContainer from"./WidgetContainer.js";import SettingsBar from"./SettingsBar.js";import WidgetBody from"./WidgetBody.js";import SvgContainer from"./SvgContainer.js";import KemuThemeWrapper from"./KemuThemeWrapper.js";const BaseWidget=({children:e,showSettings:t=!0,onOpenSettings:i,width:s=84,height:o=134,showIcon:r=!0,customIcon:n,settingsIconColor:m="white",customTheme:c})=>_jsx(KemuThemeWrapper,{theme:c,children:_jsxs(WidgetContainer,{width:s,height:o,css:css`
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{css}from"@emotion/react";import WidgetContainer from"./WidgetContainer.js";import SettingsBar from"./SettingsBar.js";import WidgetBody from"./WidgetBody.js";import SvgContainer from"./SvgContainer.js";import KemuThemeWrapper from"./KemuThemeWrapper.js";const BaseWidget=({children:e,showSettings:t=!0,onOpenSettings:i,width:s=84,height:o=134,iconWidth:n=38,iconHeight:r=38,showIcon:a=!0,customIcon:m,settingsIconColor:c="white",customTheme:d,svgContainerClassName:g,widgetContainerClassName:h,widgetBodyClassName:l})=>_jsx(KemuThemeWrapper,{theme:d,children:_jsxs(WidgetContainer,{className:h,width:s,height:o,css:css`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: center;
5
5
  justify-content: center;
6
- `,children:[t&&i&&_jsx(SettingsBar,{iconColor:m,onSettingsClick:i}),_jsxs(WidgetBody,{children:[r&&n&&_jsx(SvgContainer,{children:n}),e]})]})});export default BaseWidget;
6
+ `,children:[t&&i&&_jsx(SettingsBar,{iconColor:c,onSettingsClick:i}),_jsxs(WidgetBody,{className:l,children:[a&&m&&_jsx(SvgContainer,{width:n,height:r,className:g,children:m}),e]})]})});export default BaseWidget;
@@ -39,5 +39,6 @@ import styled from"@emotion/styled";import{ButtonWithoutRipple}from"./CommonElem
39
39
  &:disabled {
40
40
  opacity: 0.65;
41
41
  pointer-events: none;
42
+ color: #ffffffb0;
42
43
  }
43
44
  `;export default KemuPrimaryButton;
@@ -63,6 +63,8 @@ export interface SettingsDialogProps {
63
63
  minWidth?: number;
64
64
  maxWidth?: number;
65
65
  maxHeight?: number;
66
+ initialHeight?: number;
67
+ initialWidth?: number;
66
68
  cancelButtonText?: string;
67
69
  saveButtonText?: string;
68
70
  disableResizing?: boolean;
@@ -72,7 +74,7 @@ export interface SettingsDialogProps {
72
74
  dialogContentClassName?: string;
73
75
  dialogActionsClassName?: string;
74
76
  }
75
- declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
77
+ declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, initialHeight, initialWidth, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
76
78
 
77
79
  export {
78
80
  SettingsDialog as default,
@@ -8,7 +8,7 @@ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";i
8
8
  height: 100%;
9
9
  overflow-y: unset;
10
10
  padding: unset;
11
- padding-top: 40px;
11
+ padding-top: 20px;
12
12
  `,Header=styled.div`
13
13
  line-height: 30px;
14
14
  align-self: center;
@@ -53,7 +53,7 @@ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";i
53
53
  position: absolute;
54
54
  margin-top: 20px;
55
55
  width: 100%;
56
- padding: 0 25px 20px;
56
+ padding: 10px 25px 20px;
57
57
  bottom: 0;
58
58
  right: 0;
59
59
  background-color: white;
@@ -71,4 +71,4 @@ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";i
71
71
  &:hover {
72
72
  background-color: rgba(255, 255, 255, 1);
73
73
  }
74
- `,SettingsDialog=({title:e="Settings",open:t,noHeader:i=!1,onClose:o,onSave:a,children:l,serviceOnline:n=!0,saveDisabled:r=!1,minHeight:s=400,minWidth:d=500,maxWidth:m,maxHeight:p,cancelButtonText:g="Cancel",saveButtonText:h="Save",disableResizing:c=!1,disableExpansion:x=!1,dialogClassName:u,resizableClassName:b,dialogContentClassName:f,dialogActionsClassName:y})=>{const[C,j]=useState({width:d,height:s}),[w,D]=useState(!1),[S,_]=useState({width:d,height:s}),k=useCallback(((e,t,i,o)=>{if(c)return;const a={width:i.offsetWidth,height:i.offsetHeight};j(a)}),[c]),z=useCallback(((e,t)=>{"backdropClick"!==t&&"escapeKeyDown"!==t&&o()}),[o]),v=useCallback((()=>{if(w)j(S),D(!1);else{_(C);const e=window.innerWidth-180,t=window.innerHeight-120-60;j({width:Math.max(d,e),height:Math.max(s,t)}),D(!0)}}),[w,C,S,d,s]),B={pointerEvents:"none"},K=!x,N=!c&&!w,R=_jsxs(_Fragment,{children:[!i&&_jsx(Header,{children:_jsx(Title,{children:e})}),K&&_jsx(ExpandButton,{onClick:v,size:"small",children:_jsx(w?FullscreenExit:Fullscreen,{})}),_jsx(StyledDialogContent,{className:f,children:_jsx(ScrollableContainer,{children:l})}),_jsxs(StyledDialogActions,{className:y,children:[_jsx(KemuLightButton,{onClick:o,children:g}),_jsx(KemuPrimaryButton,{disabled:!n||r,onClick:a,children:h})]})]});return _jsx(ResizableDialog,{onClose:z,open:t,className:u,children:_jsx(KemuThemeWrapper,{children:c?_jsx("div",{className:b,style:{width:C.width,height:C.height},children:R}):_jsx(Resizable,{enable:{top:N,right:N,bottom:N,left:N,topRight:N,bottomRight:N,bottomLeft:N,topLeft:N},handleStyles:{bottomLeft:B,bottomRight:{zIndex:2},bottom:B,top:B,topLeft:B,topRight:B},minHeight:s,minWidth:d,maxWidth:m,maxHeight:p,size:C,onResizeStop:k,className:b,children:R})})})};export default SettingsDialog;
74
+ `,SettingsDialog=({title:e="Settings",open:t,noHeader:i=!1,onClose:o,onSave:a,children:l,serviceOnline:n=!0,saveDisabled:r=!1,minHeight:s=250,minWidth:d=450,maxWidth:m,maxHeight:h=(window.visualViewport?.height??window.innerHeight)-100,initialHeight:p=Math.min(800,(window.visualViewport?.height??window.innerHeight)-100),initialWidth:g=450,cancelButtonText:c="Cancel",saveButtonText:x="Save",disableResizing:u=!1,disableExpansion:b=!1,dialogClassName:f,resizableClassName:w,dialogContentClassName:y,dialogActionsClassName:C})=>{const[j,D]=useState({width:g,height:p}),[S,_]=useState(!1),[k,v]=useState({width:g,height:p}),z=useCallback(((e,t,i,o)=>{if(u)return;const a={width:i.offsetWidth,height:i.offsetHeight};D(a)}),[u]),B=useCallback(((e,t)=>{"backdropClick"!==t&&"escapeKeyDown"!==t&&o()}),[o]),H=useCallback((()=>{if(S)D(k),_(!1);else{v(j);const e=window.innerWidth-180,t=window.innerHeight-120-60;D({width:Math.max(d,e),height:Math.max(s,t)}),_(!0)}}),[S,j,k,d,s]),K={pointerEvents:"none"},N=!b,R=!u&&!S,W=_jsxs(_Fragment,{children:[!i&&_jsx(Header,{children:_jsx(Title,{children:e})}),N&&_jsx(ExpandButton,{onClick:H,size:"small",children:_jsx(S?FullscreenExit:Fullscreen,{})}),_jsx(StyledDialogContent,{className:y,children:_jsx(ScrollableContainer,{children:l})}),_jsxs(StyledDialogActions,{className:C,children:[_jsx(KemuLightButton,{onClick:o,children:c}),_jsx(KemuPrimaryButton,{disabled:!n||r,onClick:a,children:x})]})]});return _jsx(ResizableDialog,{onClose:B,open:t,className:f,children:_jsx(KemuThemeWrapper,{children:u?_jsx("div",{className:w,style:{width:j.width,height:j.height},children:W}):_jsx(Resizable,{enable:{top:R,right:R,bottom:R,left:R,topRight:R,bottomRight:R,bottomLeft:R,topLeft:R},handleStyles:{bottomLeft:K,bottomRight:{zIndex:2},bottom:K,top:K,topLeft:K,topRight:K},minHeight:s,minWidth:d,maxWidth:m,maxHeight:h,size:j,onResizeStop:z,className:w,children:W})})})};export default SettingsDialog;
@@ -13,8 +13,11 @@ import { ReactNode } from 'react';
13
13
  export interface SvgContainerProps {
14
14
  fill?: string;
15
15
  children?: ReactNode;
16
+ width?: number;
17
+ height?: number;
18
+ className?: string;
16
19
  }
17
- declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
20
+ declare const SvgContainer: ({ fill, children, width, height, className }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
18
21
 
19
22
  export {
20
23
  SvgContainer as default,
@@ -3,7 +3,7 @@ import{jsx as _jsx}from"react/jsx-runtime";import styled from"@emotion/styled";c
3
3
  margin-top: 10px;
4
4
 
5
5
  svg {
6
- width: 38px;
7
- height: 38px;
6
+ width: ${t=>t.width||38}px;
7
+ height: ${t=>t.height||38}px;
8
8
  }
9
- `,SvgContainer=({fill:t,children:i})=>_jsx(StyledSvgContainer,{fill:t,children:i});export default SvgContainer;
9
+ `,SvgContainer=({fill:t,children:i,width:e,height:l,className:h})=>_jsx(StyledSvgContainer,{fill:t,width:e,height:l,className:h,children:i});export default SvgContainer;
@@ -82,12 +82,17 @@ export interface BaseWidgetProps {
82
82
  onOpenSettings?: () => void;
83
83
  width?: number;
84
84
  height?: number;
85
+ iconWidth?: number;
86
+ iconHeight?: number;
85
87
  showIcon?: boolean;
86
88
  customIcon?: React$1.ReactNode;
87
89
  settingsIconColor?: string;
88
90
  customTheme?: Theme;
91
+ svgContainerClassName?: string;
92
+ widgetContainerClassName?: string;
93
+ widgetBodyClassName?: string;
89
94
  }
90
- export declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
95
+ export declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, iconWidth, iconHeight, showIcon, customIcon, settingsIconColor, customTheme, svgContainerClassName, widgetContainerClassName, widgetBodyClassName, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
91
96
  /**
92
97
  * A checkbox field component with label, wrapped in a horizontal field layout.
93
98
  *
@@ -341,6 +346,8 @@ export interface SettingsDialogProps {
341
346
  minWidth?: number;
342
347
  maxWidth?: number;
343
348
  maxHeight?: number;
349
+ initialHeight?: number;
350
+ initialWidth?: number;
344
351
  cancelButtonText?: string;
345
352
  saveButtonText?: string;
346
353
  disableResizing?: boolean;
@@ -350,7 +357,7 @@ export interface SettingsDialogProps {
350
357
  dialogContentClassName?: string;
351
358
  dialogActionsClassName?: string;
352
359
  }
353
- export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
360
+ export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave, children, serviceOnline, saveDisabled, minHeight, minWidth, maxWidth, maxHeight, initialHeight, initialWidth, cancelButtonText, saveButtonText, disableResizing, disableExpansion, dialogClassName, resizableClassName, dialogContentClassName, dialogActionsClassName, }: SettingsDialogProps) => import("react/jsx-runtime.js").JSX.Element;
354
361
  /**
355
362
  * Container for SVG icons with customizable fill color.
356
363
  *
@@ -364,8 +371,11 @@ export declare const SettingsDialog: ({ title, open, noHeader, onClose, onSave,
364
371
  export interface SvgContainerProps {
365
372
  fill?: string;
366
373
  children?: React$1.ReactNode;
374
+ width?: number;
375
+ height?: number;
376
+ className?: string;
367
377
  }
368
- export declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
378
+ export declare const SvgContainer: ({ fill, children, width, height, className }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
369
379
  /**
370
380
  * A container for widget body content. Provides centered flexbox layout with padding.
371
381
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kemu-io/hs-react",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.3",
5
5
  "description": "Kemu Hub Service library for React",
6
6
  "author": "Kemu Pty Ltd",
7
7
  "main": "cjs/WidgetWrapper.js",
@@ -40,7 +40,7 @@
40
40
  "@emotion/styled": "^11.13.0",
41
41
  "@mui/icons-material": "^7.3.4",
42
42
  "@mui/material": "^7.3.4",
43
- "re-resizable": "^6.9.17",
43
+ "re-resizable": "^6.11.2",
44
44
  "react": "^18.3.1",
45
45
  "react-dom": "^18.3.1"
46
46
  }