@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
package/cjs/WidgetWrapper.d.ts
CHANGED
|
@@ -126,6 +126,17 @@ export type WidgetPort = {
|
|
|
126
126
|
* processor execution.
|
|
127
127
|
*/
|
|
128
128
|
triggerPort?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* A path to a markdown file that will be rendered as the ports documentation.
|
|
131
|
+
* If provided it will override the default 'description' property. Useful if the documentation of this port requires more than a simple text.
|
|
132
|
+
*
|
|
133
|
+
* The path can be relative to the service's `docs` folder. For example:
|
|
134
|
+
*
|
|
135
|
+
* ```
|
|
136
|
+
* docs/ports/inputA.md
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
mdHelp?: string;
|
|
129
140
|
};
|
|
130
141
|
export type WidgetState<T extends Record<string, any> = Record<string, unknown>> = T;
|
|
131
142
|
export type TargetOutput = {
|
|
@@ -150,6 +161,9 @@ export type TargetOutput = {
|
|
|
150
161
|
/** id of the variant that defined the output */
|
|
151
162
|
variantId?: string;
|
|
152
163
|
};
|
|
164
|
+
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
165
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
166
|
+
}[Keys];
|
|
153
167
|
export type WidgetPortStr = Omit<WidgetPort, "type"> & {
|
|
154
168
|
type: string;
|
|
155
169
|
};
|
|
@@ -179,7 +193,20 @@ export type ServiceWidgetVariant<P extends WidgetPort | WidgetPortStr> = {
|
|
|
179
193
|
inputs?: P[];
|
|
180
194
|
outputs?: P[];
|
|
181
195
|
};
|
|
182
|
-
|
|
196
|
+
/**
|
|
197
|
+
* A list of supported Linux distributions. This can be extended in the future.
|
|
198
|
+
* Use 'generic' for distribution-agnostic services.
|
|
199
|
+
*/
|
|
200
|
+
export type LinuxDistribution =
|
|
201
|
+
/** For distribution-agnostic services that run on most Linux systems. */
|
|
202
|
+
"generic"
|
|
203
|
+
/** Includes Debian, Ubuntu, Linux Mint, etc. (uses APT) */
|
|
204
|
+
| "debian"
|
|
205
|
+
/** Includes RHEL, Fedora, CentOS, etc. (uses YUM/DNF) */
|
|
206
|
+
| "rhel"
|
|
207
|
+
/** Includes Arch Linux, Manjaro, etc. (uses Pacman) */
|
|
208
|
+
| "arch";
|
|
209
|
+
export type ValidPlatformArch = "win-x64" | "win-x86" | "win-arm" | "win-arm64" | "osx-x64" | "osx-arm64" | `linux-${LinuxDistribution}-x64` | `linux-${LinuxDistribution}-arm64`;
|
|
183
210
|
export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
184
211
|
/** the unique name defined by the service */
|
|
185
212
|
name: string;
|
|
@@ -189,7 +216,17 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
|
189
216
|
title?: string;
|
|
190
217
|
/** a shorten title to be used in the canvas */
|
|
191
218
|
shortTitle?: string;
|
|
219
|
+
/** generic description shown when a service is selected from the Hub Services Grid */
|
|
192
220
|
description: string;
|
|
221
|
+
/**
|
|
222
|
+
* Relative to the markdown file that will be rendered when the user clicks on the 'help' icon for this service.
|
|
223
|
+
* The description is meant to be short and include video/sample images or a link to the description page. Eg:
|
|
224
|
+
*
|
|
225
|
+
* ```
|
|
226
|
+
* docs/help.md
|
|
227
|
+
* ```
|
|
228
|
+
**/
|
|
229
|
+
mdHelp?: string;
|
|
193
230
|
processor: ProcessorType;
|
|
194
231
|
/** Id of the user that published the service */
|
|
195
232
|
author: string;
|
|
@@ -271,6 +308,32 @@ export type ServiceManifest<P extends WidgetPort | WidgetPortStr> = {
|
|
|
271
308
|
* and be visually distinct.
|
|
272
309
|
*/
|
|
273
310
|
variants?: ServiceWidgetVariant<P>[];
|
|
311
|
+
/**
|
|
312
|
+
* The default variant info. If provided, it allows overriding the default info
|
|
313
|
+
* of the service. Useful when the default variant behaviour does not match the service description.
|
|
314
|
+
*/
|
|
315
|
+
defaultVariantInfo?: {
|
|
316
|
+
/**
|
|
317
|
+
* The title of the default variant. If provided, it will override the `title` property.
|
|
318
|
+
*/
|
|
319
|
+
title?: string;
|
|
320
|
+
/**
|
|
321
|
+
* The short title of the default variant. If provided, it will override the `shortTitle` property.
|
|
322
|
+
*/
|
|
323
|
+
shortTitle?: string;
|
|
324
|
+
/**
|
|
325
|
+
* The description of the default variant. If provided, it will override the `description` property.
|
|
326
|
+
*/
|
|
327
|
+
description?: string;
|
|
328
|
+
/**
|
|
329
|
+
* The color of the default variant. If provided, it will override the `color` property.
|
|
330
|
+
*/
|
|
331
|
+
color?: string;
|
|
332
|
+
/**
|
|
333
|
+
* The SVG icon of the default variant. If provided, it will override the `svgIcon` property.
|
|
334
|
+
*/
|
|
335
|
+
svgIcon?: string;
|
|
336
|
+
};
|
|
274
337
|
/**
|
|
275
338
|
* A list of relative paths to folders containing extra services that are part of this service. Eg:
|
|
276
339
|
* ```json
|
|
@@ -343,9 +406,6 @@ export type ProcessedManifest<B extends Buffer | ArrayBuffer = Buffer> = Omit<Pa
|
|
|
343
406
|
version: string;
|
|
344
407
|
};
|
|
345
408
|
};
|
|
346
|
-
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
347
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
348
|
-
}[Keys];
|
|
349
409
|
export type DefineDynamicPortsArgs = RequireAtLeastOne<{
|
|
350
410
|
/**
|
|
351
411
|
* Set to null to remove any previously defined ports or
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A base widget component with settings bar, icon support, and customizable layout.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* Basic usage with custom icon:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const MyIcon = () => <svg>...</svg>;
|
|
11
|
+
*
|
|
12
|
+
* <BaseWidget
|
|
13
|
+
* onOpenSettings={() => setSettingsOpen(true)}
|
|
14
|
+
* customIcon={<MyIcon />}
|
|
15
|
+
* >
|
|
16
|
+
* <div>Widget Content</div>
|
|
17
|
+
* </BaseWidget>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* Without settings:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <BaseWidget
|
|
24
|
+
* showSettings={false}
|
|
25
|
+
* width={100}
|
|
26
|
+
* height={150}
|
|
27
|
+
* >
|
|
28
|
+
* <div>My Widget</div>
|
|
29
|
+
* </BaseWidget>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* With custom icon color:
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <BaseWidget
|
|
36
|
+
* onOpenSettings={handleSettings}
|
|
37
|
+
* settingsIconColor="#333"
|
|
38
|
+
* customIcon={<CustomIcon />}
|
|
39
|
+
* >
|
|
40
|
+
* <div>Content</div>
|
|
41
|
+
* </BaseWidget>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface BaseWidgetProps {
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
showSettings?: boolean;
|
|
47
|
+
onOpenSettings?: () => void;
|
|
48
|
+
width?: number;
|
|
49
|
+
height?: number;
|
|
50
|
+
showIcon?: boolean;
|
|
51
|
+
customIcon?: ReactNode;
|
|
52
|
+
settingsIconColor?: string;
|
|
53
|
+
customTheme?: Theme;
|
|
54
|
+
}
|
|
55
|
+
declare const BaseWidget: ({ children, showSettings, onOpenSettings, width, height, showIcon, customIcon, settingsIconColor, customTheme, }: BaseWidgetProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
BaseWidget as default,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export {};
|
|
@@ -0,0 +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`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A checkbox field component with label, wrapped in a horizontal field layout.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* const [enabled, setEnabled] = useState(false);
|
|
7
|
+
*
|
|
8
|
+
* <CheckboxField
|
|
9
|
+
* label="Enable feature"
|
|
10
|
+
* checked={enabled}
|
|
11
|
+
* onChange={(checked) => setEnabled(checked)}
|
|
12
|
+
* />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type CheckboxFieldProps = {
|
|
16
|
+
onChange?: (checked: boolean) => void;
|
|
17
|
+
checked: boolean;
|
|
18
|
+
label: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const CheckboxField: (props: CheckboxFieldProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
CheckboxField as default,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
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("react"),HorizontalField_js_1=__importDefault(require("./HorizontalField.js")),material_1=require("@mui/material"),CheckboxField=e=>{const t=(0,react_1.useCallback)((t=>{const r=t.target.checked;e.onChange&&e.onChange(r)}),[e.onChange]);return(0,jsx_runtime_1.jsx)(HorizontalField_js_1.default,{children:(0,jsx_runtime_1.jsx)(material_1.FormControlLabel,{css:material_1.css`
|
|
2
|
+
margin-left: 0px;
|
|
3
|
+
`,control:(0,jsx_runtime_1.jsx)(material_1.Checkbox,{style:{paddingRight:8},onChange:t,checked:e.checked,disabled:e.disabled}),label:e.label})})};exports.default=CheckboxField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export declare const ButtonWithoutRipple: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
4
|
+
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;
|
|
5
|
+
}, "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"> & {
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
}, {}, {}>;
|
|
8
|
+
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ButtonWithoutRipple=void 0;const jsx_runtime_1=require("react/jsx-runtime"),styled_1=__importDefault(require("@emotion/styled")),Button_1=__importDefault(require("@mui/material/Button"));exports.ButtonWithoutRipple=(0,styled_1.default)((({...t})=>(0,jsx_runtime_1.jsx)(Button_1.default,{disableRipple:!0,...t})))``;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A vertical field container for form elements. Use for stacking form fields vertically.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Field mb={20}>
|
|
7
|
+
* <label>Name</label>
|
|
8
|
+
* <input type="text" />
|
|
9
|
+
* </Field>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface FieldProps {
|
|
13
|
+
mb?: number;
|
|
14
|
+
mt?: number;
|
|
15
|
+
}
|
|
16
|
+
declare const Field: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
} & FieldProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
Field as default,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const styled_1=__importDefault(require("@emotion/styled")),Field=styled_1.default.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
margin-bottom: ${e=>e.mb||10}px;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
margin-top: ${e=>e.mt||0}px;
|
|
6
|
+
label {
|
|
7
|
+
margin-bottom: 5px;
|
|
8
|
+
}
|
|
9
|
+
`;exports.default=Field;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A field component with a built-in label. Use this for simple form fields.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <FieldWithLabel label="Username">
|
|
9
|
+
* <input type="text" />
|
|
10
|
+
* </FieldWithLabel>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* With Material-UI components:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <FieldWithLabel label="Select Option">
|
|
17
|
+
* <Select>
|
|
18
|
+
* <MenuItem value="1">Option 1</MenuItem>
|
|
19
|
+
* </Select>
|
|
20
|
+
* </FieldWithLabel>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface FieldWithLabelProps {
|
|
24
|
+
label: string;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
mb?: number;
|
|
27
|
+
mt?: number;
|
|
28
|
+
}
|
|
29
|
+
declare const FieldWithLabel: ({ label, children, mb, mt }: FieldWithLabelProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
FieldWithLabel as default,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
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"),Field_js_1=__importDefault(require("./Field.js")),FieldWithLabel=({label:e,children:t,mb:i,mt:l})=>(0,jsx_runtime_1.jsxs)(Field_js_1.default,{mb:i,mt:l,children:[(0,jsx_runtime_1.jsx)("label",{children:e}),t]});exports.default=FieldWithLabel;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A horizontal field container for form elements. Use for placing form fields side by side.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <HorizontalField alignItems="center">
|
|
7
|
+
* <label>Option:</label>
|
|
8
|
+
* <input type="checkbox" />
|
|
9
|
+
* </HorizontalField>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface HorizontalFieldProps {
|
|
13
|
+
alignItems?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const HorizontalField: import("@emotion/styled").StyledComponent<{
|
|
16
|
+
theme?: import("@emotion/react").Theme;
|
|
17
|
+
as?: React.ElementType;
|
|
18
|
+
} & HorizontalFieldProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
HorizontalField as default,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const styled_1=__importDefault(require("@emotion/styled")),HorizontalField=styled_1.default.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
margin-bottom: 10px;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: ${e=>e.alignItems||"flex-start"};
|
|
6
|
+
label {
|
|
7
|
+
margin-right: 5px;
|
|
8
|
+
}
|
|
9
|
+
`;exports.default=HorizontalField;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export interface KemuLightButtonProps {
|
|
4
|
+
noShadow?: boolean;
|
|
5
|
+
}
|
|
6
|
+
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"> & {
|
|
7
|
+
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;
|
|
8
|
+
}, "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"> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
} & KemuLightButtonProps, {}, {}>;
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
KemuLightButton as default,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const styled_1=__importDefault(require("@emotion/styled")),CommonElements_js_1=require("./CommonElements.js"),KemuLightButton=(0,styled_1.default)(CommonElements_js_1.ButtonWithoutRipple)`
|
|
2
|
+
background-color: var(--kemu-color-light);
|
|
3
|
+
border-color: var(--kemu-color-light);
|
|
4
|
+
color: #191d21;
|
|
5
|
+
box-shadow: ${({noShadow:e})=>e?"unset":"0 2px 6px var(--kemu-color-light)"};
|
|
6
|
+
|
|
7
|
+
margin-left: .25rem;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
line-height: 24px;
|
|
12
|
+
padding: .3rem .8rem;
|
|
13
|
+
letter-spacing: .5px;
|
|
14
|
+
border-radius: .25rem;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
text-align: center;
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
-webkit-user-select: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
border: 1px solid transparent;
|
|
21
|
+
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
22
|
+
height: initial;
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
|
|
25
|
+
&:hover:not(:disabled) {
|
|
26
|
+
box-shadow: ${({noShadow:e})=>e?"unset":"0 2px 6px var(--kemu-color-light-darken-10)"};
|
|
27
|
+
color: #7866ff;
|
|
28
|
+
border-color: #7866ff;
|
|
29
|
+
background: #ffffff;
|
|
30
|
+
|
|
31
|
+
&:active {
|
|
32
|
+
color: #3229d9;
|
|
33
|
+
border-color: #3229d9;
|
|
34
|
+
box-shadow: unset;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:disabled {
|
|
39
|
+
opacity: 0.65;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
background: rgba(24, 33, 45, 0.04);
|
|
42
|
+
}
|
|
43
|
+
`;exports.default=KemuLightButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export interface KemuPrimaryButtonProps {
|
|
4
|
+
noShadow?: boolean;
|
|
5
|
+
}
|
|
6
|
+
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"> & {
|
|
7
|
+
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;
|
|
8
|
+
}, "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"> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
} & KemuPrimaryButtonProps, {}, {}>;
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
KemuPrimaryButton as default,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const styled_1=__importDefault(require("@emotion/styled")),CommonElements_js_1=require("./CommonElements.js"),KemuPrimaryButton=(0,styled_1.default)(CommonElements_js_1.ButtonWithoutRipple)`
|
|
2
|
+
color: #fff;
|
|
3
|
+
box-shadow: ${({noShadow:e})=>e?"none":"0 2px 6px var(--kemu-color-primary)"};
|
|
4
|
+
background-color: var(--kemu-color-primary);
|
|
5
|
+
border-color: var(--kemu-color-primary);
|
|
6
|
+
|
|
7
|
+
margin-left: .25rem;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
line-height: 24px;
|
|
12
|
+
padding: .3rem .8rem;
|
|
13
|
+
letter-spacing: .5px;
|
|
14
|
+
border-radius: .25rem;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
text-align: center;
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
-webkit-user-select: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
border: 1px solid transparent;
|
|
21
|
+
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
22
|
+
height: auto;
|
|
23
|
+
height: initial;
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
|
|
26
|
+
&:hover:not(:disabled) {
|
|
27
|
+
border-color: transparent;
|
|
28
|
+
background-color: var(--kemu-color-primary-darken-10);
|
|
29
|
+
box-shadow: ${({noShadow:e})=>e?"none":"0 2px 6px var(--kemu-color-primary-darken-10)"};
|
|
30
|
+
|
|
31
|
+
&:active {
|
|
32
|
+
border-color: transparent;
|
|
33
|
+
background-color: var(--kemu-color-primary-darken-20);
|
|
34
|
+
box-shadow: unset;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
&:disabled {
|
|
40
|
+
opacity: 0.65;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
`;exports.default=KemuPrimaryButton;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A theme wrapper component that provides Kemu's default Material-UI theme.
|
|
6
|
+
* Can be overridden with a custom theme.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* Using default theme:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <KemuThemeWrapper>
|
|
12
|
+
* <MyComponent />
|
|
13
|
+
* </KemuThemeWrapper>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* With custom theme override:
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const customTheme = createTheme({
|
|
20
|
+
* palette: {
|
|
21
|
+
* primary: {
|
|
22
|
+
* main: '#ff0000',
|
|
23
|
+
* },
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* <KemuThemeWrapper theme={customTheme}>
|
|
28
|
+
* <MyComponent />
|
|
29
|
+
* </KemuThemeWrapper>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface KemuThemeWrapperProps {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
theme?: Theme;
|
|
35
|
+
}
|
|
36
|
+
export declare const defaultKemuTheme: Theme;
|
|
37
|
+
declare const KemuThemeWrapper: ({ children, theme }: KemuThemeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
KemuThemeWrapper as default,
|
|
41
|
+
Theme,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultKemuTheme=void 0;const jsx_runtime_1=require("react/jsx-runtime"),material_1=require("@mui/material");exports.defaultKemuTheme=(0,material_1.createTheme)({palette:{primary:{main:"#4e3eff"}},typography:{fontFamily:'Nunito, "Segoe UI", arial'},components:{MuiButton:{styleOverrides:{root:{textTransform:"none"}}},MuiTab:{styleOverrides:{root:{textTransform:"none"}}},MuiChip:{styleOverrides:{root:{textTransform:"none"}}}}});const KemuThemeWrapper=({children:e,theme:r})=>{const t=r?(0,material_1.createTheme)(exports.defaultKemuTheme,r):exports.defaultKemuTheme;return(0,jsx_runtime_1.jsx)(material_1.ThemeProvider,{theme:t,children:e})};exports.default=KemuThemeWrapper;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A settings bar component with default settings icon. Renders in the top-right corner.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* With default settings icon:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <SettingsBar
|
|
10
|
+
* iconColor="white"
|
|
11
|
+
* onSettingsClick={() => console.log('Settings clicked')}
|
|
12
|
+
* />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* With custom content:
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <SettingsBar iconColor="#333">
|
|
19
|
+
* <IconButton onClick={handleClick}>
|
|
20
|
+
* <CustomIcon />
|
|
21
|
+
* </IconButton>
|
|
22
|
+
* </SettingsBar>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface SettingsBarProps {
|
|
26
|
+
iconColor?: string;
|
|
27
|
+
onSettingsClick?: () => void;
|
|
28
|
+
children?: React$1.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const SettingsBar: ({ iconColor, onSettingsClick, children }: SettingsBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
SettingsBar as default,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});const jsx_runtime_1=require("react/jsx-runtime"),styled_1=__importDefault(require("@emotion/styled")),IconButton_1=__importDefault(require("@mui/material/IconButton")),Settings_1=__importDefault(require("@mui/icons-material/Settings")),SettingsBarContainer=styled_1.default.div`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
padding: 5px;
|
|
8
|
+
`,SettingsBar=({iconColor:t="white",onSettingsClick:e,children:i})=>(0,jsx_runtime_1.jsx)(SettingsBarContainer,{iconColor:t,children:i||(e?(0,jsx_runtime_1.jsx)(IconButton_1.default,{"aria-label":"settings",onClick:e,children:(0,jsx_runtime_1.jsx)(Settings_1.default,{style:{color:t},sx:{fontSize:10}})}):null)});exports.default=SettingsBar;
|
|
@@ -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 {};
|