@kemu-io/hs-react 0.2.38 → 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/WidgetContainer.d.ts +5 -0
- package/cjs/components/WidgetContainer.js +4 -3
- package/cjs/components/index.d.ts +323 -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/WidgetContainer.d.ts +5 -0
- package/mjs/components/WidgetContainer.js +4 -3
- package/mjs/components/index.d.ts +323 -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
|
@@ -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
|
package/mjs/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
|
+
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`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
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;
|
|
@@ -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
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useCallback}from"react";import HorizontalField from"./HorizontalField.js";import{Checkbox,css,FormControlLabel}from"@mui/material";const CheckboxField=e=>{const o=useCallback((o=>{const l=o.target.checked;e.onChange&&e.onChange(l)}),[e.onChange]);return _jsx(HorizontalField,{children:_jsx(FormControlLabel,{css:css`
|
|
2
|
+
margin-left: 0px;
|
|
3
|
+
`,control:_jsx(Checkbox,{style:{paddingRight:8},onChange:o,checked:e.checked,disabled:e.disabled}),label:e.label})})};export 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
|
+
import{jsx as _jsx}from"react/jsx-runtime";import styled from"@emotion/styled";import Button from"@mui/material/Button";export const ButtonWithoutRipple=styled((({...t})=>_jsx(Button,{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,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
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import Field from"./Field.js";const FieldWithLabel=({label:e,children:l,mb:s,mt:i})=>_jsxs(Field,{mb:s,mt:i,children:[_jsx("label",{children:e}),l]});export 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,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
|
+
import styled from"@emotion/styled";import{ButtonWithoutRipple}from"./CommonElements.js";const KemuLightButton=styled(ButtonWithoutRipple)`
|
|
2
|
+
background-color: var(--kemu-color-light);
|
|
3
|
+
border-color: var(--kemu-color-light);
|
|
4
|
+
color: #191d21;
|
|
5
|
+
box-shadow: ${({noShadow:o})=>o?"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:o})=>o?"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
|
+
`;export 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
|
+
import styled from"@emotion/styled";import{ButtonWithoutRipple}from"./CommonElements.js";const KemuPrimaryButton=styled(ButtonWithoutRipple)`
|
|
2
|
+
color: #fff;
|
|
3
|
+
box-shadow: ${({noShadow:o})=>o?"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:o})=>o?"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
|
+
`;export 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
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{ThemeProvider,createTheme}from"@mui/material";export const defaultKemuTheme=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?createTheme(defaultKemuTheme,r):defaultKemuTheme;return _jsx(ThemeProvider,{theme:t,children:e})};export 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
|
+
import{jsx as _jsx}from"react/jsx-runtime";import styled from"@emotion/styled";import IconButton from"@mui/material/IconButton";import SettingsIcon from"@mui/icons-material/Settings";const SettingsBarContainer=styled.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:i,children:n})=>_jsx(SettingsBarContainer,{iconColor:t,children:n||(i?_jsx(IconButton,{"aria-label":"settings",onClick:i,children:_jsx(SettingsIcon,{style:{color:t},sx:{fontSize:10}})}):null)});export default SettingsBar;
|