@torq-north/react-tools 1.1.1 → 1.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/dist/index.cjs +125 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +124 -114
- package/dist/index.es.js.map +1 -1
- package/dist/src/Form/Components/CheckboxFormField.d.ts +1 -0
- package/dist/src/Form/Components/ComboboxFormField.d.ts +4 -1
- package/dist/src/Form/Components/FileEditorField/FileEditorField.d.ts +2 -5
- package/dist/src/Form/Components/FileEditorField/useFileEditorField.d.ts +4 -38
- package/dist/src/Form/Components/FileEditorField.d.ts +13 -0
- package/dist/src/Form/Components/RadioFormField.d.ts +1 -0
- package/dist/src/Form/Utilities/isFileRequired.d.ts +3 -0
- package/dist/src/MUI/Components/FileEditor/DropIndicator.d.ts +9 -0
- package/dist/src/MUI/Components/FileEditor/FileEditor.d.ts +8 -0
- package/dist/src/MUI/Components/FileEditor/index.d.ts +4 -0
- package/dist/src/MUI/Components/FileEditor/useFileEditor.d.ts +17 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +3 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { CommonFieldProps } from "../Types";
|
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
|
2
3
|
type T = boolean | undefined;
|
|
3
|
-
export interface ComboboxFormFieldProps<M extends T> extends CommonFieldProps
|
|
4
|
+
export interface ComboboxFormFieldProps<M extends T> extends CommonFieldProps<{
|
|
5
|
+
textField: TextFieldProps;
|
|
6
|
+
}> {
|
|
4
7
|
options: string[];
|
|
5
8
|
disableClearable?: boolean;
|
|
6
9
|
multiple?: M;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Asset } from "../../../MUI/Components/FileDisplay/asset";
|
|
2
1
|
import { CommonFieldProps } from "../../Types";
|
|
3
2
|
import { Accept } from "react-dropzone";
|
|
4
|
-
export interface PrexistingAsset {
|
|
5
|
-
}
|
|
6
|
-
export type FileType = (Asset | File)[] | Asset | File | string | null | undefined;
|
|
7
3
|
export interface FileEditorFieldProps extends CommonFieldProps<{}> {
|
|
8
4
|
multiple?: boolean;
|
|
9
5
|
placeholder?: boolean;
|
|
10
6
|
accept?: Accept;
|
|
11
7
|
maxFiles?: number;
|
|
8
|
+
forceError?: boolean;
|
|
12
9
|
}
|
|
13
|
-
export declare function FileEditorField({ name, label, icon, showSpace, multiple, disabled, helperText, placeholder, required, slotProps, accept, }: FileEditorFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function FileEditorField({ name, label, icon, showSpace, multiple, disabled, helperText, placeholder, required, slotProps, accept, maxFiles, forceError, }: FileEditorFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
import { UseFieldConfig } from "react-final-form";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type FileEditorOptions = Pick<DropzoneOptions, "accept" | "multiple" | "maxSize" | "minSize" | "maxFiles"> & {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
fieldProps?: UseFieldConfig;
|
|
2
|
+
import { FileType } from "../../../MUI/Components/FileEditor";
|
|
3
|
+
export declare function useFileEditorField(name: string, options?: {
|
|
7
4
|
required?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
dragOverDropzone: boolean;
|
|
11
|
-
getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T) => T;
|
|
12
|
-
getInputProps: <T extends import("react-dropzone").DropzoneInputProps>(props?: T) => T;
|
|
13
|
-
open: () => void;
|
|
14
|
-
removeFile: (file: Asset | File) => void;
|
|
15
|
-
values: (Asset | File)[];
|
|
16
|
-
showError: boolean;
|
|
17
|
-
setShowError: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
18
|
-
errorMessage: string;
|
|
19
|
-
meta: {
|
|
20
|
-
active?: boolean;
|
|
21
|
-
data?: Record<string, any>;
|
|
22
|
-
dirty?: boolean;
|
|
23
|
-
dirtySinceLastSubmit?: boolean;
|
|
24
|
-
error?: any;
|
|
25
|
-
initial?: any;
|
|
26
|
-
invalid?: boolean;
|
|
27
|
-
length?: number;
|
|
28
|
-
modified?: boolean;
|
|
29
|
-
modifiedSinceLastSubmit?: boolean;
|
|
30
|
-
pristine?: boolean;
|
|
31
|
-
submitError?: any;
|
|
32
|
-
submitFailed?: boolean;
|
|
33
|
-
submitSucceeded?: boolean;
|
|
34
|
-
submitting?: boolean;
|
|
35
|
-
touched?: boolean;
|
|
36
|
-
valid?: boolean;
|
|
37
|
-
validating?: boolean;
|
|
38
|
-
visited?: boolean;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
5
|
+
fieldProps?: UseFieldConfig;
|
|
6
|
+
}): import("react-final-form").FieldRenderProps<FileType, HTMLElement, any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonFieldProps } from "../Types";
|
|
3
|
+
import { Accept } from "react-dropzone";
|
|
4
|
+
export interface FileEditorFieldProps extends CommonFieldProps<{}> {
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
placeholder?: React.ReactNode;
|
|
7
|
+
accept?: Accept;
|
|
8
|
+
maxFiles?: number;
|
|
9
|
+
maxSize?: number;
|
|
10
|
+
minSize?: number;
|
|
11
|
+
forceError?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function FileEditorField({ name, label, icon, showSpace, multiple, disabled, helperText, placeholder, required, slotProps, accept, maxFiles, maxSize, minSize, forceError, validators, }: FileEditorFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BoxProps } from "@mui/material";
|
|
2
|
+
import { StyledComponent } from "@emotion/styled";
|
|
3
|
+
type DropIndicatorProps = BoxProps & {
|
|
4
|
+
dragOver: boolean;
|
|
5
|
+
multiple: boolean | undefined;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const DropIndicator: StyledComponent<DropIndicatorProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileEditorOptions, FileType } from "./useFileEditor";
|
|
3
|
+
export interface FileEditorProps extends FileEditorOptions {
|
|
4
|
+
value: FileType;
|
|
5
|
+
onChange: (value: FileType) => void;
|
|
6
|
+
placeholder?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function FileEditor({ value, onChange, multiple, disabled, placeholder, accept, maxFiles, maxSize, minSize, }: FileEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DropzoneOptions } from "react-dropzone";
|
|
2
|
+
import { Asset } from "../FileDisplay/asset";
|
|
3
|
+
export type FileType = (Asset | File)[] | Asset | File | string | null | undefined;
|
|
4
|
+
export type FileEditorOptions = Pick<DropzoneOptions, "accept" | "multiple" | "maxSize" | "minSize" | "maxFiles"> & {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function useFileEditor(value: FileType, onChange: (value: FileType) => void, options: FileEditorOptions): {
|
|
8
|
+
dragOverDropzone: boolean;
|
|
9
|
+
getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T) => T;
|
|
10
|
+
getInputProps: <T extends import("react-dropzone").DropzoneInputProps>(props?: T) => T;
|
|
11
|
+
open: () => void;
|
|
12
|
+
removeFile: (file: Asset | File) => void;
|
|
13
|
+
values: (Asset | File)[];
|
|
14
|
+
showError: boolean;
|
|
15
|
+
setShowError: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
16
|
+
errorMessage: string;
|
|
17
|
+
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./MUI/Components/LoaderButton";
|
|
|
10
10
|
export * from "./MUI/Components/ExtendedPagination";
|
|
11
11
|
export * from "./MUI/Components/FileDisplay";
|
|
12
12
|
export * from "./MUI/Components/FileDropper";
|
|
13
|
+
export * from "./MUI/Components/FileEditor";
|
|
13
14
|
export * from "./MUI/Components/EditableBlock";
|
|
14
15
|
export * from "./MUI/Components/LabeledValue";
|
|
15
16
|
export * from "./MUI/Components/TabSet";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@torq-north/react-tools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "A collection of commonly used utilities",
|
|
6
6
|
"author": "@torq-north",
|
|
7
7
|
"license": "SEE LICENCE.md",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"ladle": "npx ladle serve",
|
|
23
23
|
"build": "rollup -c",
|
|
24
24
|
"predeploy": "npm run build",
|
|
25
|
-
"deploy": "npm publish --access public"
|
|
25
|
+
"deploy": "npm publish --access public",
|
|
26
|
+
"typewatch": "tsc -w --noEmit"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [],
|
|
28
29
|
"peerDependencies": {
|