@kemu-io/hs-react 0.2.39 → 0.3.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/cjs/WidgetWrapper.d.ts +64 -4
- package/cjs/components/BaseWidget.d.ts +61 -0
- package/cjs/components/BaseWidget.js +6 -0
- package/cjs/components/CheckboxField.d.ts +27 -0
- package/cjs/components/CheckboxField.js +3 -0
- package/cjs/components/CommonElements.d.ts +9 -0
- package/cjs/components/CommonElements.js +1 -0
- package/cjs/components/Field.d.ts +25 -0
- package/cjs/components/Field.js +9 -0
- package/cjs/components/FieldWithLabel.d.ts +35 -0
- package/cjs/components/FieldWithLabel.js +1 -0
- package/cjs/components/HorizontalField.d.ts +24 -0
- package/cjs/components/HorizontalField.js +9 -0
- package/cjs/components/KemuLightButton.d.ts +16 -0
- package/cjs/components/KemuLightButton.js +43 -0
- package/cjs/components/KemuPrimaryButton.d.ts +16 -0
- package/cjs/components/KemuPrimaryButton.js +43 -0
- package/cjs/components/KemuThemeWrapper.d.ts +44 -0
- package/cjs/components/KemuThemeWrapper.js +1 -0
- package/cjs/components/SettingsBar.d.ts +36 -0
- package/cjs/components/SettingsBar.js +8 -0
- package/cjs/components/SettingsDialog.d.ts +81 -0
- package/cjs/components/SettingsDialog.js +74 -0
- package/cjs/components/SvgContainer.d.ts +23 -0
- package/cjs/components/SvgContainer.js +9 -0
- package/cjs/components/WidgetBody.d.ts +20 -0
- package/cjs/components/WidgetBody.js +9 -0
- package/cjs/components/index.d.ts +318 -1
- package/cjs/components/index.js +1 -1
- package/cjs/hooks/index.d.ts +64 -4
- package/cjs/hooks/useOnBroadcastEvent.d.ts +64 -4
- package/cjs/hooks/useOnParentEvent.d.ts +64 -4
- package/cjs/hooks/useOnSetOutputsEvent.d.ts +64 -4
- package/cjs/lib/InstanceContext.d.ts +64 -4
- package/cjs/lib/globalContext.d.ts +64 -4
- package/cjs/types/context_t.d.ts +64 -4
- package/cjs/types/widgetUI_t.d.ts +64 -4
- package/mjs/WidgetWrapper.d.ts +64 -4
- package/mjs/components/BaseWidget.d.ts +61 -0
- package/mjs/components/BaseWidget.js +6 -0
- package/mjs/components/CheckboxField.d.ts +27 -0
- package/mjs/components/CheckboxField.js +3 -0
- package/mjs/components/CommonElements.d.ts +9 -0
- package/mjs/components/CommonElements.js +1 -0
- package/mjs/components/Field.d.ts +25 -0
- package/mjs/components/Field.js +9 -0
- package/mjs/components/FieldWithLabel.d.ts +35 -0
- package/mjs/components/FieldWithLabel.js +1 -0
- package/mjs/components/HorizontalField.d.ts +24 -0
- package/mjs/components/HorizontalField.js +9 -0
- package/mjs/components/KemuLightButton.d.ts +16 -0
- package/mjs/components/KemuLightButton.js +43 -0
- package/mjs/components/KemuPrimaryButton.d.ts +16 -0
- package/mjs/components/KemuPrimaryButton.js +43 -0
- package/mjs/components/KemuThemeWrapper.d.ts +44 -0
- package/mjs/components/KemuThemeWrapper.js +1 -0
- package/mjs/components/SettingsBar.d.ts +36 -0
- package/mjs/components/SettingsBar.js +8 -0
- package/mjs/components/SettingsDialog.d.ts +81 -0
- package/mjs/components/SettingsDialog.js +74 -0
- package/mjs/components/SvgContainer.d.ts +23 -0
- package/mjs/components/SvgContainer.js +9 -0
- package/mjs/components/WidgetBody.d.ts +20 -0
- package/mjs/components/WidgetBody.js +9 -0
- package/mjs/components/index.d.ts +318 -1
- package/mjs/components/index.js +1 -1
- package/mjs/hooks/index.d.ts +64 -4
- package/mjs/hooks/useOnBroadcastEvent.d.ts +64 -4
- package/mjs/hooks/useOnParentEvent.d.ts +64 -4
- package/mjs/hooks/useOnSetOutputsEvent.d.ts +64 -4
- package/mjs/lib/InstanceContext.d.ts +64 -4
- package/mjs/lib/globalContext.d.ts +64 -4
- package/mjs/types/context_t.d.ts +64 -4
- package/mjs/types/widgetUI_t.d.ts +64 -4
- package/package.json +3 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A resizable and expandable settings dialog with customizable buttons and styling.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* Basic usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const [open, setOpen] = useState(false);
|
|
10
|
+
*
|
|
11
|
+
* <SettingsDialog
|
|
12
|
+
* open={open}
|
|
13
|
+
* onClose={() => setOpen(false)}
|
|
14
|
+
* onSave={() => {
|
|
15
|
+
* // Save settings
|
|
16
|
+
* setOpen(false);
|
|
17
|
+
* }}
|
|
18
|
+
* >
|
|
19
|
+
* <FieldWithLabel label="Setting 1">
|
|
20
|
+
* <input type="text" />
|
|
21
|
+
* </FieldWithLabel>
|
|
22
|
+
* </SettingsDialog>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Disable resizing and expansion:
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <SettingsDialog
|
|
29
|
+
* open={open}
|
|
30
|
+
* onClose={() => setOpen(false)}
|
|
31
|
+
* onSave={handleSave}
|
|
32
|
+
* disableResizing={true}
|
|
33
|
+
* disableExpansion={true}
|
|
34
|
+
* >
|
|
35
|
+
* {children}
|
|
36
|
+
* </SettingsDialog>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* Custom button text:
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <SettingsDialog
|
|
43
|
+
* open={open}
|
|
44
|
+
* onClose={handleClose}
|
|
45
|
+
* onSave={handleSave}
|
|
46
|
+
* cancelButtonText="Discard"
|
|
47
|
+
* saveButtonText="Apply Changes"
|
|
48
|
+
* >
|
|
49
|
+
* {children}
|
|
50
|
+
* </SettingsDialog>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export interface SettingsDialogProps {
|
|
54
|
+
title?: string;
|
|
55
|
+
open: boolean;
|
|
56
|
+
noHeader?: boolean;
|
|
57
|
+
onClose: () => void;
|
|
58
|
+
onSave: () => void;
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
serviceOnline?: boolean;
|
|
61
|
+
saveDisabled?: boolean;
|
|
62
|
+
minHeight?: number;
|
|
63
|
+
minWidth?: number;
|
|
64
|
+
maxWidth?: number;
|
|
65
|
+
maxHeight?: number;
|
|
66
|
+
cancelButtonText?: string;
|
|
67
|
+
saveButtonText?: string;
|
|
68
|
+
disableResizing?: boolean;
|
|
69
|
+
disableExpansion?: boolean;
|
|
70
|
+
dialogClassName?: string;
|
|
71
|
+
resizableClassName?: string;
|
|
72
|
+
dialogContentClassName?: string;
|
|
73
|
+
dialogActionsClassName?: string;
|
|
74
|
+
}
|
|
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;
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
SettingsDialog as default,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useCallback,useState}from"react";import styled from"@emotion/styled";import Dialog from"@mui/material/Dialog";import DialogContent from"@mui/material/DialogContent";import DialogActions from"@mui/material/DialogActions";import IconButton from"@mui/material/IconButton";import{Resizable}from"re-resizable";import Fullscreen from"@mui/icons-material/Fullscreen";import FullscreenExit from"@mui/icons-material/FullscreenExit";import KemuThemeWrapper from"./KemuThemeWrapper.js";import KemuPrimaryButton from"./KemuPrimaryButton.js";import KemuLightButton from"./KemuLightButton.js";const ScrollableContainer=styled.div`
|
|
2
|
+
height: 100%;
|
|
3
|
+
overflow-y: auto;
|
|
4
|
+
padding: 0px 25px;
|
|
5
|
+
// Add extra pixels for the dialog actions
|
|
6
|
+
padding-bottom: 54px;
|
|
7
|
+
`,StyledDialogContent=styled(DialogContent)`
|
|
8
|
+
height: 100%;
|
|
9
|
+
overflow-y: unset;
|
|
10
|
+
padding: unset;
|
|
11
|
+
padding-top: 40px;
|
|
12
|
+
`,Header=styled.div`
|
|
13
|
+
line-height: 30px;
|
|
14
|
+
align-self: center;
|
|
15
|
+
width: 100%;
|
|
16
|
+
padding: 10px 25px;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
margin-bottom: 0px;
|
|
21
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
|
|
22
|
+
`,Title=styled.h4`
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
line-height: 28px;
|
|
25
|
+
padding-right: 10px;
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
font-family: 'Nunito', 'Segoe UI', arial;
|
|
29
|
+
color: #6c757d;
|
|
30
|
+
`,ResizableDialog=styled(Dialog)`
|
|
31
|
+
& .MuiDialog-paper {
|
|
32
|
+
margin: 0;
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 50%;
|
|
35
|
+
left: 50%;
|
|
36
|
+
transform: translate(-50%, -50%);
|
|
37
|
+
max-width: unset;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
|
|
40
|
+
/* Kemu modal style */
|
|
41
|
+
border-top-color: var(--kemu-color-primary);
|
|
42
|
+
border-top-style: solid;
|
|
43
|
+
border-top-width: 3px;
|
|
44
|
+
box-shadow: 0 4px 12px 0px rgb(0 0 0 / 28%);
|
|
45
|
+
border-radius: 10px;
|
|
46
|
+
background-clip: border-box;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& .MuiModal-backdrop {
|
|
50
|
+
background-color: rgba(0, 0, 0, 0.35);
|
|
51
|
+
}
|
|
52
|
+
`,StyledDialogActions=styled(DialogActions)`
|
|
53
|
+
position: absolute;
|
|
54
|
+
margin-top: 20px;
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding: 0 25px 20px;
|
|
57
|
+
bottom: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
background-color: white;
|
|
60
|
+
z-index: 2;
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 20px;
|
|
63
|
+
`,ExpandButton=styled(IconButton)`
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 8px;
|
|
66
|
+
right: 8px;
|
|
67
|
+
z-index: 2;
|
|
68
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
69
|
+
backdrop-filter: blur(4px);
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
background-color: rgba(255, 255, 255, 1);
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Container for SVG icons with customizable fill color.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <SvgContainer fill="blue">
|
|
9
|
+
* <svg>...</svg>
|
|
10
|
+
* </SvgContainer>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export interface SvgContainerProps {
|
|
14
|
+
fill?: string;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
SvgContainer as default,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import styled from"@emotion/styled";const StyledSvgContainer=styled.div`
|
|
2
|
+
fill: ${t=>t.fill||"white"};
|
|
3
|
+
margin-top: 10px;
|
|
4
|
+
|
|
5
|
+
svg {
|
|
6
|
+
width: 38px;
|
|
7
|
+
height: 38px;
|
|
8
|
+
}
|
|
9
|
+
`,SvgContainer=({fill:t,children:i})=>_jsx(StyledSvgContainer,{fill:t,children:i});export default SvgContainer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A container for widget body content. Provides centered flexbox layout with padding.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <WidgetBody>
|
|
7
|
+
* <div>Widget content</div>
|
|
8
|
+
* </WidgetBody>
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
declare const WidgetBody: import("@emotion/styled").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
WidgetBody as default,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {};
|
|
@@ -1,7 +1,194 @@
|
|
|
1
1
|
import { CSSObject } from '@emotion/styled';
|
|
2
|
+
import { Theme } from '@mui/material';
|
|
2
3
|
import React$1 from 'react';
|
|
3
|
-
import { CSSProperties } from 'react';
|
|
4
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* A theme wrapper component that provides Kemu's default Material-UI theme.
|
|
8
|
+
* Can be overridden with a custom theme.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Using default theme:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <KemuThemeWrapper>
|
|
14
|
+
* <MyComponent />
|
|
15
|
+
* </KemuThemeWrapper>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* With custom theme override:
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const customTheme = createTheme({
|
|
22
|
+
* palette: {
|
|
23
|
+
* primary: {
|
|
24
|
+
* main: '#ff0000',
|
|
25
|
+
* },
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* <KemuThemeWrapper theme={customTheme}>
|
|
30
|
+
* <MyComponent />
|
|
31
|
+
* </KemuThemeWrapper>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface KemuThemeWrapperProps {
|
|
35
|
+
children: React$1.ReactNode;
|
|
36
|
+
theme?: Theme;
|
|
37
|
+
}
|
|
38
|
+
export declare const KemuThemeWrapper: ({ children, theme }: KemuThemeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* A base widget component with settings bar, icon support, and customizable layout.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* Basic usage with custom icon:
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const MyIcon = () => <svg>...</svg>;
|
|
46
|
+
*
|
|
47
|
+
* <BaseWidget
|
|
48
|
+
* onOpenSettings={() => setSettingsOpen(true)}
|
|
49
|
+
* customIcon={<MyIcon />}
|
|
50
|
+
* >
|
|
51
|
+
* <div>Widget Content</div>
|
|
52
|
+
* </BaseWidget>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* Without settings:
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <BaseWidget
|
|
59
|
+
* showSettings={false}
|
|
60
|
+
* width={100}
|
|
61
|
+
* height={150}
|
|
62
|
+
* >
|
|
63
|
+
* <div>My Widget</div>
|
|
64
|
+
* </BaseWidget>
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* With custom icon color:
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <BaseWidget
|
|
71
|
+
* onOpenSettings={handleSettings}
|
|
72
|
+
* settingsIconColor="#333"
|
|
73
|
+
* customIcon={<CustomIcon />}
|
|
74
|
+
* >
|
|
75
|
+
* <div>Content</div>
|
|
76
|
+
* </BaseWidget>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export interface BaseWidgetProps {
|
|
80
|
+
children?: React$1.ReactNode;
|
|
81
|
+
showSettings?: boolean;
|
|
82
|
+
onOpenSettings?: () => void;
|
|
83
|
+
width?: number;
|
|
84
|
+
height?: number;
|
|
85
|
+
showIcon?: boolean;
|
|
86
|
+
customIcon?: React$1.ReactNode;
|
|
87
|
+
settingsIconColor?: string;
|
|
88
|
+
customTheme?: Theme;
|
|
89
|
+
}
|
|
90
|
+
export declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
91
|
+
/**
|
|
92
|
+
* A checkbox field component with label, wrapped in a horizontal field layout.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* const [enabled, setEnabled] = useState(false);
|
|
97
|
+
*
|
|
98
|
+
* <CheckboxField
|
|
99
|
+
* label="Enable feature"
|
|
100
|
+
* checked={enabled}
|
|
101
|
+
* onChange={(checked) => setEnabled(checked)}
|
|
102
|
+
* />
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export type CheckboxFieldProps = {
|
|
106
|
+
onChange?: (checked: boolean) => void;
|
|
107
|
+
checked: boolean;
|
|
108
|
+
label: string;
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
};
|
|
111
|
+
export declare const CheckboxField: (props: CheckboxFieldProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
112
|
+
/**
|
|
113
|
+
* A vertical field container for form elements. Use for stacking form fields vertically.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <Field mb={20}>
|
|
118
|
+
* <label>Name</label>
|
|
119
|
+
* <input type="text" />
|
|
120
|
+
* </Field>
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export interface FieldProps {
|
|
124
|
+
mb?: number;
|
|
125
|
+
mt?: number;
|
|
126
|
+
}
|
|
127
|
+
export declare const Field: import("@emotion/styled").StyledComponent<{
|
|
128
|
+
theme?: import("@emotion/react").Theme;
|
|
129
|
+
as?: React$1.ElementType;
|
|
130
|
+
} & FieldProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
131
|
+
/**
|
|
132
|
+
* A field component with a built-in label. Use this for simple form fields.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <FieldWithLabel label="Username">
|
|
137
|
+
* <input type="text" />
|
|
138
|
+
* </FieldWithLabel>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* With Material-UI components:
|
|
143
|
+
* ```tsx
|
|
144
|
+
* <FieldWithLabel label="Select Option">
|
|
145
|
+
* <Select>
|
|
146
|
+
* <MenuItem value="1">Option 1</MenuItem>
|
|
147
|
+
* </Select>
|
|
148
|
+
* </FieldWithLabel>
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export interface FieldWithLabelProps {
|
|
152
|
+
label: string;
|
|
153
|
+
children?: React$1.ReactNode;
|
|
154
|
+
mb?: number;
|
|
155
|
+
mt?: number;
|
|
156
|
+
}
|
|
157
|
+
export declare const FieldWithLabel: ({ label, children, mb, mt }: FieldWithLabelProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
158
|
+
/**
|
|
159
|
+
* A horizontal field container for form elements. Use for placing form fields side by side.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```tsx
|
|
163
|
+
* <HorizontalField alignItems="center">
|
|
164
|
+
* <label>Option:</label>
|
|
165
|
+
* <input type="checkbox" />
|
|
166
|
+
* </HorizontalField>
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export interface HorizontalFieldProps {
|
|
170
|
+
alignItems?: string;
|
|
171
|
+
}
|
|
172
|
+
export declare const HorizontalField: import("@emotion/styled").StyledComponent<{
|
|
173
|
+
theme?: import("@emotion/react").Theme;
|
|
174
|
+
as?: React$1.ElementType;
|
|
175
|
+
} & HorizontalFieldProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
176
|
+
export interface KemuLightButtonProps {
|
|
177
|
+
noShadow?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export declare const KemuLightButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent/index.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
180
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
181
|
+
}, "color" | "disabled" | "children" | "style" | "className" | "size" | "disableElevation" | "fullWidth" | "startIcon" | "endIcon" | "loading" | "loadingIndicator" | "classes" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "href" | "loadingPosition" | "variant"> & {
|
|
182
|
+
theme?: import("@emotion/react").Theme;
|
|
183
|
+
} & KemuLightButtonProps, {}, {}>;
|
|
184
|
+
export interface KemuPrimaryButtonProps {
|
|
185
|
+
noShadow?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export declare const KemuPrimaryButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button/Button.js").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent/index.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
188
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
189
|
+
}, "color" | "disabled" | "children" | "style" | "className" | "size" | "disableElevation" | "fullWidth" | "startIcon" | "endIcon" | "loading" | "loadingIndicator" | "classes" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "href" | "loadingPosition" | "variant"> & {
|
|
190
|
+
theme?: import("@emotion/react").Theme;
|
|
191
|
+
} & KemuPrimaryButtonProps, {}, {}>;
|
|
5
192
|
export type ResizableContainerProps = {
|
|
6
193
|
css?: CSSObject;
|
|
7
194
|
minWidth?: number;
|
|
@@ -63,6 +250,136 @@ export type WrapperProps = {
|
|
|
63
250
|
* ```
|
|
64
251
|
*/
|
|
65
252
|
export declare const ResizableContainer: (props: ResizableContainerProps & WrapperProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
253
|
+
/**
|
|
254
|
+
* A settings bar component with default settings icon. Renders in the top-right corner.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* With default settings icon:
|
|
258
|
+
* ```tsx
|
|
259
|
+
* <SettingsBar
|
|
260
|
+
* iconColor="white"
|
|
261
|
+
* onSettingsClick={() => console.log('Settings clicked')}
|
|
262
|
+
* />
|
|
263
|
+
* ```
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* With custom content:
|
|
267
|
+
* ```tsx
|
|
268
|
+
* <SettingsBar iconColor="#333">
|
|
269
|
+
* <IconButton onClick={handleClick}>
|
|
270
|
+
* <CustomIcon />
|
|
271
|
+
* </IconButton>
|
|
272
|
+
* </SettingsBar>
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export interface SettingsBarProps {
|
|
276
|
+
iconColor?: string;
|
|
277
|
+
onSettingsClick?: () => void;
|
|
278
|
+
children?: React$1.ReactNode;
|
|
279
|
+
}
|
|
280
|
+
export declare const SettingsBar: ({ iconColor, onSettingsClick, children }: SettingsBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
281
|
+
/**
|
|
282
|
+
* A resizable and expandable settings dialog with customizable buttons and styling.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* Basic usage:
|
|
286
|
+
* ```tsx
|
|
287
|
+
* const [open, setOpen] = useState(false);
|
|
288
|
+
*
|
|
289
|
+
* <SettingsDialog
|
|
290
|
+
* open={open}
|
|
291
|
+
* onClose={() => setOpen(false)}
|
|
292
|
+
* onSave={() => {
|
|
293
|
+
* // Save settings
|
|
294
|
+
* setOpen(false);
|
|
295
|
+
* }}
|
|
296
|
+
* >
|
|
297
|
+
* <FieldWithLabel label="Setting 1">
|
|
298
|
+
* <input type="text" />
|
|
299
|
+
* </FieldWithLabel>
|
|
300
|
+
* </SettingsDialog>
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* Disable resizing and expansion:
|
|
305
|
+
* ```tsx
|
|
306
|
+
* <SettingsDialog
|
|
307
|
+
* open={open}
|
|
308
|
+
* onClose={() => setOpen(false)}
|
|
309
|
+
* onSave={handleSave}
|
|
310
|
+
* disableResizing={true}
|
|
311
|
+
* disableExpansion={true}
|
|
312
|
+
* >
|
|
313
|
+
* {children}
|
|
314
|
+
* </SettingsDialog>
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* Custom button text:
|
|
319
|
+
* ```tsx
|
|
320
|
+
* <SettingsDialog
|
|
321
|
+
* open={open}
|
|
322
|
+
* onClose={handleClose}
|
|
323
|
+
* onSave={handleSave}
|
|
324
|
+
* cancelButtonText="Discard"
|
|
325
|
+
* saveButtonText="Apply Changes"
|
|
326
|
+
* >
|
|
327
|
+
* {children}
|
|
328
|
+
* </SettingsDialog>
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export interface SettingsDialogProps {
|
|
332
|
+
title?: string;
|
|
333
|
+
open: boolean;
|
|
334
|
+
noHeader?: boolean;
|
|
335
|
+
onClose: () => void;
|
|
336
|
+
onSave: () => void;
|
|
337
|
+
children: React$1.ReactNode;
|
|
338
|
+
serviceOnline?: boolean;
|
|
339
|
+
saveDisabled?: boolean;
|
|
340
|
+
minHeight?: number;
|
|
341
|
+
minWidth?: number;
|
|
342
|
+
maxWidth?: number;
|
|
343
|
+
maxHeight?: number;
|
|
344
|
+
cancelButtonText?: string;
|
|
345
|
+
saveButtonText?: string;
|
|
346
|
+
disableResizing?: boolean;
|
|
347
|
+
disableExpansion?: boolean;
|
|
348
|
+
dialogClassName?: string;
|
|
349
|
+
resizableClassName?: string;
|
|
350
|
+
dialogContentClassName?: string;
|
|
351
|
+
dialogActionsClassName?: string;
|
|
352
|
+
}
|
|
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;
|
|
354
|
+
/**
|
|
355
|
+
* Container for SVG icons with customizable fill color.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```tsx
|
|
359
|
+
* <SvgContainer fill="blue">
|
|
360
|
+
* <svg>...</svg>
|
|
361
|
+
* </SvgContainer>
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
export interface SvgContainerProps {
|
|
365
|
+
fill?: string;
|
|
366
|
+
children?: React$1.ReactNode;
|
|
367
|
+
}
|
|
368
|
+
export declare const SvgContainer: ({ fill, children }: SvgContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
369
|
+
/**
|
|
370
|
+
* A container for widget body content. Provides centered flexbox layout with padding.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```tsx
|
|
374
|
+
* <WidgetBody>
|
|
375
|
+
* <div>Widget content</div>
|
|
376
|
+
* </WidgetBody>
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
export declare const WidgetBody: import("@emotion/styled").StyledComponent<{
|
|
380
|
+
theme?: import("@emotion/react").Theme;
|
|
381
|
+
as?: React$1.ElementType;
|
|
382
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
66
383
|
type WrapperProps$1 = {
|
|
67
384
|
cWidth?: number | string;
|
|
68
385
|
cHeight?: number | string;
|
package/mjs/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import WidgetContainer from"./WidgetContainer.js";import ResizableContainer from"./ResizableContainer.js";export{WidgetContainer,ResizableContainer};
|
|
1
|
+
import WidgetContainer from"./WidgetContainer.js";import ResizableContainer from"./ResizableContainer.js";import SettingsDialog from"./SettingsDialog.js";import SvgContainer from"./SvgContainer.js";import SettingsBar from"./SettingsBar.js";import Field from"./Field.js";import HorizontalField from"./HorizontalField.js";import CheckboxField from"./CheckboxField.js";import FieldWithLabel from"./FieldWithLabel.js";import WidgetBody from"./WidgetBody.js";import BaseWidget from"./BaseWidget.js";import KemuThemeWrapper from"./KemuThemeWrapper.js";import KemuPrimaryButton from"./KemuPrimaryButton.js";import KemuLightButton from"./KemuLightButton.js";export{WidgetContainer,ResizableContainer,SettingsDialog,SvgContainer,SettingsBar,Field,HorizontalField,CheckboxField,FieldWithLabel,WidgetBody,BaseWidget,KemuThemeWrapper,KemuPrimaryButton,KemuLightButton};
|
package/mjs/hooks/index.d.ts
CHANGED
|
@@ -124,6 +124,17 @@ export type WidgetPort = {
|
|
|
124
124
|
* processor execution.
|
|
125
125
|
*/
|
|
126
126
|
triggerPort?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* A path to a markdown file that will be rendered as the ports documentation.
|
|
129
|
+
* If provided it will override the default 'description' property. Useful if the documentation of this port requires more than a simple text.
|
|
130
|
+
*
|
|
131
|
+
* The path can be relative to the service's `docs` folder. For example:
|
|
132
|
+
*
|
|
133
|
+
* ```
|
|
134
|
+
* docs/ports/inputA.md
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
mdHelp?: string;
|
|
127
138
|
};
|
|
128
139
|
export type WidgetState<T extends Record<string, any> = Record<string, unknown>> = T;
|
|
129
140
|
export type TargetOutput = {
|
|
@@ -148,6 +159,9 @@ export type TargetOutput = {
|
|
|
148
159
|
/** id of the variant that defined the output */
|
|
149
160
|
variantId?: string;
|
|
150
161
|
};
|
|
162
|
+
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
163
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
164
|
+
}[Keys];
|
|
151
165
|
export type WidgetPortStr = Omit<WidgetPort, "type"> & {
|
|
152
166
|
type: string;
|
|
153
167
|
};
|
|
@@ -177,7 +191,20 @@ export type ServiceWidgetVariant<P extends WidgetPort | WidgetPortStr> = {
|
|
|
177
191
|
inputs?: P[];
|
|
178
192
|
outputs?: P[];
|
|
179
193
|
};
|
|
180
|
-
|
|
194
|
+
/**
|
|
195
|
+
* A list of supported Linux distributions. This can be extended in the future.
|
|
196
|
+
* Use 'generic' for distribution-agnostic services.
|
|
197
|
+
*/
|
|
198
|
+
export type LinuxDistribution =
|
|
199
|
+
/** For distribution-agnostic services that run on most Linux systems. */
|
|
200
|
+
"generic"
|
|
201
|
+
/** Includes Debian, Ubuntu, Linux Mint, etc. (uses APT) */
|
|
202
|
+
| "debian"
|
|
203
|
+
/** Includes RHEL, Fedora, CentOS, etc. (uses YUM/DNF) */
|
|
204
|
+
| "rhel"
|
|
205
|
+
/** Includes Arch Linux, Manjaro, etc. (uses Pacman) */
|
|
206
|
+
| "arch";
|
|
207
|
+
export type ValidPlatformArch = "win-x64" | "win-x86" | "win-arm" | "win-arm64" | "osx-x64" | "osx-arm64" | `linux-${LinuxDistribution}-x64` | `linux-${LinuxDistribution}-arm64`;
|
|
181
208
|
export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
182
209
|
/** the unique name defined by the service */
|
|
183
210
|
name: string;
|
|
@@ -187,7 +214,17 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
|
187
214
|
title?: string;
|
|
188
215
|
/** a shorten title to be used in the canvas */
|
|
189
216
|
shortTitle?: string;
|
|
217
|
+
/** generic description shown when a service is selected from the Hub Services Grid */
|
|
190
218
|
description: string;
|
|
219
|
+
/**
|
|
220
|
+
* Relative to the markdown file that will be rendered when the user clicks on the 'help' icon for this service.
|
|
221
|
+
* The description is meant to be short and include video/sample images or a link to the description page. Eg:
|
|
222
|
+
*
|
|
223
|
+
* ```
|
|
224
|
+
* docs/help.md
|
|
225
|
+
* ```
|
|
226
|
+
**/
|
|
227
|
+
mdHelp?: string;
|
|
191
228
|
processor: ProcessorType;
|
|
192
229
|
/** Id of the user that published the service */
|
|
193
230
|
author: string;
|
|
@@ -269,6 +306,32 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
|
269
306
|
* and be visually distinct.
|
|
270
307
|
*/
|
|
271
308
|
variants?: ServiceWidgetVariant<P>[];
|
|
309
|
+
/**
|
|
310
|
+
* The default variant info. If provided, it allows overriding the default info
|
|
311
|
+
* of the service. Useful when the default variant behaviour does not match the service description.
|
|
312
|
+
*/
|
|
313
|
+
defaultVariantInfo?: {
|
|
314
|
+
/**
|
|
315
|
+
* The title of the default variant. If provided, it will override the `title` property.
|
|
316
|
+
*/
|
|
317
|
+
title?: string;
|
|
318
|
+
/**
|
|
319
|
+
* The short title of the default variant. If provided, it will override the `shortTitle` property.
|
|
320
|
+
*/
|
|
321
|
+
shortTitle?: string;
|
|
322
|
+
/**
|
|
323
|
+
* The description of the default variant. If provided, it will override the `description` property.
|
|
324
|
+
*/
|
|
325
|
+
description?: string;
|
|
326
|
+
/**
|
|
327
|
+
* The color of the default variant. If provided, it will override the `color` property.
|
|
328
|
+
*/
|
|
329
|
+
color?: string;
|
|
330
|
+
/**
|
|
331
|
+
* The SVG icon of the default variant. If provided, it will override the `svgIcon` property.
|
|
332
|
+
*/
|
|
333
|
+
svgIcon?: string;
|
|
334
|
+
};
|
|
272
335
|
/**
|
|
273
336
|
* A list of relative paths to folders containing extra services that are part of this service. Eg:
|
|
274
337
|
* ```json
|
|
@@ -341,9 +404,6 @@ export type ProcessedManifest<B extends Buffer | ArrayBuffer = Buffer> = Omit<Pa
|
|
|
341
404
|
version: string;
|
|
342
405
|
};
|
|
343
406
|
};
|
|
344
|
-
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
345
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
346
|
-
}[Keys];
|
|
347
407
|
export type DefineDynamicPortsArgs = RequireAtLeastOne<{
|
|
348
408
|
/**
|
|
349
409
|
* Set to null to remove any previously defined ports or
|