@kemu-io/hs-react 0.3.1 → 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.
- package/cjs/components/KemuPrimaryButton.js +1 -0
- package/cjs/components/SettingsDialog.d.ts +3 -1
- package/cjs/components/SettingsDialog.js +2 -2
- package/cjs/components/index.d.ts +3 -1
- package/mjs/components/KemuPrimaryButton.js +1 -0
- package/mjs/components/SettingsDialog.d.ts +3 -1
- package/mjs/components/SettingsDialog.js +2 -2
- package/mjs/components/index.d.ts +3 -1
- package/package.json +2 -2
|
@@ -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,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
position: absolute;
|
|
54
54
|
margin-top: 20px;
|
|
55
55
|
width: 100%;
|
|
56
|
-
padding:
|
|
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=
|
|
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;
|
|
@@ -346,6 +346,8 @@ export interface SettingsDialogProps {
|
|
|
346
346
|
minWidth?: number;
|
|
347
347
|
maxWidth?: number;
|
|
348
348
|
maxHeight?: number;
|
|
349
|
+
initialHeight?: number;
|
|
350
|
+
initialWidth?: number;
|
|
349
351
|
cancelButtonText?: string;
|
|
350
352
|
saveButtonText?: string;
|
|
351
353
|
disableResizing?: boolean;
|
|
@@ -355,7 +357,7 @@ export interface SettingsDialogProps {
|
|
|
355
357
|
dialogContentClassName?: string;
|
|
356
358
|
dialogActionsClassName?: string;
|
|
357
359
|
}
|
|
358
|
-
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;
|
|
359
361
|
/**
|
|
360
362
|
* Container for SVG icons with customizable fill color.
|
|
361
363
|
*
|
|
@@ -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,
|
|
@@ -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:
|
|
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=
|
|
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;
|
|
@@ -346,6 +346,8 @@ export interface SettingsDialogProps {
|
|
|
346
346
|
minWidth?: number;
|
|
347
347
|
maxWidth?: number;
|
|
348
348
|
maxHeight?: number;
|
|
349
|
+
initialHeight?: number;
|
|
350
|
+
initialWidth?: number;
|
|
349
351
|
cancelButtonText?: string;
|
|
350
352
|
saveButtonText?: string;
|
|
351
353
|
disableResizing?: boolean;
|
|
@@ -355,7 +357,7 @@ export interface SettingsDialogProps {
|
|
|
355
357
|
dialogContentClassName?: string;
|
|
356
358
|
dialogActionsClassName?: string;
|
|
357
359
|
}
|
|
358
|
-
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;
|
|
359
361
|
/**
|
|
360
362
|
* Container for SVG icons with customizable fill color.
|
|
361
363
|
*
|
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.
|
|
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.
|
|
43
|
+
"re-resizable": "^6.11.2",
|
|
44
44
|
"react": "^18.3.1",
|
|
45
45
|
"react-dom": "^18.3.1"
|
|
46
46
|
}
|