@rolder-kit/ui 0.1.0-alpha.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/AnimatedChevron.d.ts +5 -0
- package/dist/AnimatedChevron.js +12 -0
- package/dist/JsonInput.d.ts +2 -0
- package/dist/JsonInput.js +45 -0
- package/dist/RouterLink.d.ts +16 -0
- package/dist/RouterLink.js +36 -0
- package/dist/editor/Content.d.ts +3 -0
- package/dist/editor/Content.js +13 -0
- package/dist/editor/Root.d.ts +8 -0
- package/dist/editor/Root.js +55 -0
- package/dist/editor/Toolbar.d.ts +6 -0
- package/dist/editor/Toolbar.js +138 -0
- package/dist/editor/index.d.ts +8 -0
- package/dist/editor/index.js +10 -0
- package/dist/editor/store.d.ts +6 -0
- package/dist/editor/store.js +10 -0
- package/dist/error/DefaultError.d.ts +2 -0
- package/dist/error/DefaultError.js +62 -0
- package/dist/error/DefaultNotFound.d.ts +1 -0
- package/dist/error/DefaultNotFound.js +37 -0
- package/dist/error/Forbidden.d.ts +1 -0
- package/dist/error/Forbidden.js +32 -0
- package/dist/error/defaultErrorNotification.d.ts +1 -0
- package/dist/error/defaultErrorNotification.js +8 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/index.js +5 -0
- package/dist/form/blurOnError.d.ts +4 -0
- package/dist/form/blurOnError.js +11 -0
- package/dist/form/buttons/CancelButton.d.ts +5 -0
- package/dist/form/buttons/CancelButton.js +22 -0
- package/dist/form/buttons/SubmitButton.d.ts +5 -0
- package/dist/form/buttons/SubmitButton.js +22 -0
- package/dist/form/buttons/SubscribeActionIcon.d.ts +4 -0
- package/dist/form/buttons/SubscribeActionIcon.js +15 -0
- package/dist/form/buttons/SubscribeButton.d.ts +5 -0
- package/dist/form/buttons/SubscribeButton.js +16 -0
- package/dist/form/buttons/index.d.ts +4 -0
- package/dist/form/buttons/index.js +4 -0
- package/dist/form/context.d.ts +83 -0
- package/dist/form/context.js +26 -0
- package/dist/form/fields/JsonField.d.ts +2 -0
- package/dist/form/fields/JsonField.js +13 -0
- package/dist/form/fields/MultiSelectField.d.ts +2 -0
- package/dist/form/fields/MultiSelectField.js +15 -0
- package/dist/form/fields/NumberField.d.ts +2 -0
- package/dist/form/fields/NumberField.js +15 -0
- package/dist/form/fields/PasswordField.d.ts +2 -0
- package/dist/form/fields/PasswordField.js +18 -0
- package/dist/form/fields/SelectField.d.ts +2 -0
- package/dist/form/fields/SelectField.js +15 -0
- package/dist/form/fields/SwitchField.d.ts +2 -0
- package/dist/form/fields/SwitchField.js +15 -0
- package/dist/form/fields/TextField.d.ts +2 -0
- package/dist/form/fields/TextField.js +15 -0
- package/dist/form/fields/TextPasswordField.d.ts +2 -0
- package/dist/form/fields/TextPasswordField.js +29 -0
- package/dist/form/fields/TextareaField.d.ts +2 -0
- package/dist/form/fields/TextareaField.js +15 -0
- package/dist/form/fields/index.d.ts +9 -0
- package/dist/form/fields/index.js +9 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.js +4 -0
- package/dist/hoverPaper/HoverPaper.d.ts +6 -0
- package/dist/hoverPaper/HoverPaper.js +15 -0
- package/dist/hoverPaper/index.d.ts +2 -0
- package/dist/hoverPaper/index.js +3 -0
- package/dist/hoverPaper/usePaperHover.d.ts +4 -0
- package/dist/hoverPaper/usePaperHover.js +9 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/saveInput/JsonInput.d.ts +6 -0
- package/dist/saveInput/JsonInput.js +33 -0
- package/dist/saveInput/NumberInput.d.ts +6 -0
- package/dist/saveInput/NumberInput.js +26 -0
- package/dist/saveInput/SaveInput.d.ts +36 -0
- package/dist/saveInput/SaveInput.js +15 -0
- package/dist/saveInput/Select.d.ts +6 -0
- package/dist/saveInput/Select.js +26 -0
- package/dist/saveInput/Switch.d.ts +6 -0
- package/dist/saveInput/Switch.js +29 -0
- package/dist/saveInput/TextInput.d.ts +6 -0
- package/dist/saveInput/TextInput.js +25 -0
- package/dist/saveInput/Textarea.d.ts +6 -0
- package/dist/saveInput/Textarea.js +25 -0
- package/dist/saveInput/index.d.ts +1 -0
- package/dist/saveInput/index.js +2 -0
- package/dist/scrollArea/Root.d.ts +7 -0
- package/dist/scrollArea/Root.js +41 -0
- package/dist/scrollArea/ScrollButton.d.ts +7 -0
- package/dist/scrollArea/ScrollButton.js +30 -0
- package/dist/scrollArea/index.d.ts +6 -0
- package/dist/scrollArea/index.js +7 -0
- package/dist/scrollArea/methods.d.ts +4 -0
- package/dist/scrollArea/methods.js +32 -0
- package/dist/scrollArea/store.d.ts +12 -0
- package/dist/scrollArea/store.js +25 -0
- package/package.json +53 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFormContext } from "../context.js";
|
|
4
|
+
const SubscribeActionIcon = (props)=>{
|
|
5
|
+
const form = useFormContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(form.Subscribe, {
|
|
7
|
+
selector: (state)=>state.isSubmitting,
|
|
8
|
+
children: (isSubmitting)=>/*#__PURE__*/ jsx(ActionIcon, {
|
|
9
|
+
disabled: isSubmitting,
|
|
10
|
+
...props,
|
|
11
|
+
children: props.children
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { SubscribeActionIcon };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFormContext } from "../context.js";
|
|
4
|
+
const SubscribeButton = (props)=>{
|
|
5
|
+
const form = useFormContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(form.Subscribe, {
|
|
7
|
+
selector: (state)=>state.isSubmitting,
|
|
8
|
+
children: (isSubmitting)=>/*#__PURE__*/ jsx(Button, {
|
|
9
|
+
type: "button",
|
|
10
|
+
disabled: isSubmitting,
|
|
11
|
+
...props,
|
|
12
|
+
children: props.label
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { SubscribeButton };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => import("@tanstack/react-form").ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
2
|
+
declare const useAppForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta>(props: import("@tanstack/react-form").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
3
|
+
readonly TextField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
4
|
+
readonly NumberField: import("react").FC<import("@mantine/core").NumberInputProps>;
|
|
5
|
+
readonly TextareaField: import("react").FC<import("@mantine/core").TextareaProps>;
|
|
6
|
+
readonly TextPasswordField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
7
|
+
readonly PasswordField: import("react").FC<import("@mantine/core").PasswordInputProps>;
|
|
8
|
+
readonly SelectField: import("react").FC<import("@mantine/core").SelectProps>;
|
|
9
|
+
readonly MultiSelectField: import("react").FC<import("@mantine/core").MultiSelectProps>;
|
|
10
|
+
readonly SwitchField: import("react").FC<import("@mantine/core").SwitchProps>;
|
|
11
|
+
readonly JsonField: import("react").FC<import("@uiw/react-codemirror").ReactCodeMirrorProps>;
|
|
12
|
+
}, {
|
|
13
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
14
|
+
label?: string;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
}>;
|
|
17
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
18
|
+
label?: string;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
}>;
|
|
21
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
22
|
+
label: string;
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}>;
|
|
25
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
}>;
|
|
28
|
+
}>, withForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
29
|
+
readonly TextField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
30
|
+
readonly NumberField: import("react").FC<import("@mantine/core").NumberInputProps>;
|
|
31
|
+
readonly TextareaField: import("react").FC<import("@mantine/core").TextareaProps>;
|
|
32
|
+
readonly TextPasswordField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
33
|
+
readonly PasswordField: import("react").FC<import("@mantine/core").PasswordInputProps>;
|
|
34
|
+
readonly SelectField: import("react").FC<import("@mantine/core").SelectProps>;
|
|
35
|
+
readonly MultiSelectField: import("react").FC<import("@mantine/core").MultiSelectProps>;
|
|
36
|
+
readonly SwitchField: import("react").FC<import("@mantine/core").SwitchProps>;
|
|
37
|
+
readonly JsonField: import("react").FC<import("@uiw/react-codemirror").ReactCodeMirrorProps>;
|
|
38
|
+
}, {
|
|
39
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
40
|
+
label?: string;
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
}>;
|
|
43
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
44
|
+
label?: string;
|
|
45
|
+
onClick?: () => void;
|
|
46
|
+
}>;
|
|
47
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
48
|
+
label: string;
|
|
49
|
+
onClick?: () => void;
|
|
50
|
+
}>;
|
|
51
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
52
|
+
onClick?: () => void;
|
|
53
|
+
}>;
|
|
54
|
+
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
55
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
56
|
+
readonly TextField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
57
|
+
readonly NumberField: import("react").FC<import("@mantine/core").NumberInputProps>;
|
|
58
|
+
readonly TextareaField: import("react").FC<import("@mantine/core").TextareaProps>;
|
|
59
|
+
readonly TextPasswordField: import("react").FC<import("@mantine/core").TextInputProps>;
|
|
60
|
+
readonly PasswordField: import("react").FC<import("@mantine/core").PasswordInputProps>;
|
|
61
|
+
readonly SelectField: import("react").FC<import("@mantine/core").SelectProps>;
|
|
62
|
+
readonly MultiSelectField: import("react").FC<import("@mantine/core").MultiSelectProps>;
|
|
63
|
+
readonly SwitchField: import("react").FC<import("@mantine/core").SwitchProps>;
|
|
64
|
+
readonly JsonField: import("react").FC<import("@uiw/react-codemirror").ReactCodeMirrorProps>;
|
|
65
|
+
}, {
|
|
66
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
67
|
+
label?: string;
|
|
68
|
+
onClick?: () => void;
|
|
69
|
+
}>;
|
|
70
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
71
|
+
label?: string;
|
|
72
|
+
onClick?: () => void;
|
|
73
|
+
}>;
|
|
74
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
75
|
+
label: string;
|
|
76
|
+
onClick?: () => void;
|
|
77
|
+
}>;
|
|
78
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
79
|
+
onClick?: () => void;
|
|
80
|
+
}>;
|
|
81
|
+
}>;
|
|
82
|
+
}>>;
|
|
83
|
+
export { useAppForm, useFieldContext, useFormContext, withForm };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
|
|
2
|
+
import { CancelButton, SubmitButton, SubscribeActionIcon, SubscribeButton } from "./buttons/index.js";
|
|
3
|
+
import { JsonField, MultiSelectField, NumberField, PasswordField, SelectField, SwitchField, TextField, TextPasswordField, TextareaField } from "./fields/index.js";
|
|
4
|
+
const { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
|
|
5
|
+
const { useAppForm, withForm } = createFormHook({
|
|
6
|
+
fieldComponents: {
|
|
7
|
+
TextField: TextField,
|
|
8
|
+
NumberField: NumberField,
|
|
9
|
+
TextareaField: TextareaField,
|
|
10
|
+
TextPasswordField: TextPasswordField,
|
|
11
|
+
PasswordField: PasswordField,
|
|
12
|
+
SelectField: SelectField,
|
|
13
|
+
MultiSelectField: MultiSelectField,
|
|
14
|
+
SwitchField: SwitchField,
|
|
15
|
+
JsonField: JsonField
|
|
16
|
+
},
|
|
17
|
+
formComponents: {
|
|
18
|
+
SubmitButton: SubmitButton,
|
|
19
|
+
CancelButton: CancelButton,
|
|
20
|
+
SubscribeButton: SubscribeButton,
|
|
21
|
+
SubscribeActionIcon: SubscribeActionIcon
|
|
22
|
+
},
|
|
23
|
+
fieldContext,
|
|
24
|
+
formContext
|
|
25
|
+
});
|
|
26
|
+
export { useAppForm, useFieldContext, useFormContext, withForm };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { JsonInput } from "../../JsonInput.js";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const JsonField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(JsonInput, {
|
|
7
|
+
value: field.state.value || '',
|
|
8
|
+
onChange: field.handleChange,
|
|
9
|
+
onBlur: field.handleBlur,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { JsonField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MultiSelect } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const MultiSelectField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(MultiSelect, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
value: field.state.value || [],
|
|
9
|
+
onChange: field.handleChange,
|
|
10
|
+
onBlur: field.handleBlur,
|
|
11
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { MultiSelectField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NumberInput } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const NumberField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(NumberInput, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
value: field.state.value || '',
|
|
9
|
+
onChange: (v)=>field.handleChange(v),
|
|
10
|
+
onBlur: field.handleBlur,
|
|
11
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { NumberField };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PasswordInput } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const PasswordField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(PasswordInput, {
|
|
7
|
+
size: "lg",
|
|
8
|
+
label: "Пароль",
|
|
9
|
+
placeholder: "Введите пароль",
|
|
10
|
+
name: field.name,
|
|
11
|
+
value: field.state.value || '',
|
|
12
|
+
onChange: (e)=>field.handleChange(e.target.value),
|
|
13
|
+
onBlur: field.handleBlur,
|
|
14
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { PasswordField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const SelectField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
value: field.state.value,
|
|
9
|
+
onChange: field.handleChange,
|
|
10
|
+
onBlur: field.handleBlur,
|
|
11
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { SelectField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const SwitchField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(Switch, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
checked: field.state.value,
|
|
9
|
+
onChange: (e)=>field.handleChange(e.currentTarget.checked),
|
|
10
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
11
|
+
w: "fit-content",
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { SwitchField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextInput } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const TextField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(TextInput, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
value: field.state.value || '',
|
|
9
|
+
onChange: (e)=>field.handleChange(e.target.value),
|
|
10
|
+
onBlur: field.handleBlur,
|
|
11
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { TextField };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon, TextInput } from "@rolder-kit/mantine";
|
|
3
|
+
import { IconRefresh } from "@tabler/icons-react";
|
|
4
|
+
import omgopass from "omgopass";
|
|
5
|
+
import { useFieldContext } from "../context.js";
|
|
6
|
+
const TextPasswordField = (props)=>{
|
|
7
|
+
const field = useFieldContext();
|
|
8
|
+
return /*#__PURE__*/ jsx(TextInput, {
|
|
9
|
+
label: "Пароль",
|
|
10
|
+
placeholder: "Введите пароль",
|
|
11
|
+
rightSection: /*#__PURE__*/ jsx(ActionIcon, {
|
|
12
|
+
variant: "light",
|
|
13
|
+
onClick: ()=>field.setValue(omgopass({
|
|
14
|
+
minSyllableLength: 2,
|
|
15
|
+
maxSyllableLength: 2
|
|
16
|
+
})),
|
|
17
|
+
children: /*#__PURE__*/ jsx(IconRefresh, {
|
|
18
|
+
size: 16
|
|
19
|
+
})
|
|
20
|
+
}),
|
|
21
|
+
name: field.name,
|
|
22
|
+
value: field.state.value || '',
|
|
23
|
+
onChange: (e)=>field.handleChange(e.target.value),
|
|
24
|
+
onBlur: field.handleBlur,
|
|
25
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export { TextPasswordField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Textarea } from "@rolder-kit/mantine";
|
|
3
|
+
import { useFieldContext } from "../context.js";
|
|
4
|
+
const TextareaField = (props)=>{
|
|
5
|
+
const field = useFieldContext();
|
|
6
|
+
return /*#__PURE__*/ jsx(Textarea, {
|
|
7
|
+
name: field.name,
|
|
8
|
+
value: field.state.value || '',
|
|
9
|
+
onChange: (e)=>field.handleChange(e.target.value),
|
|
10
|
+
onBlur: field.handleBlur,
|
|
11
|
+
error: field.state.meta.errors.map((error)=>error.message).join(', '),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { TextareaField };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './JsonField';
|
|
2
|
+
export * from './MultiSelectField';
|
|
3
|
+
export * from './NumberField';
|
|
4
|
+
export * from './PasswordField';
|
|
5
|
+
export * from './SelectField';
|
|
6
|
+
export * from './SwitchField';
|
|
7
|
+
export * from './TextareaField';
|
|
8
|
+
export * from './TextField';
|
|
9
|
+
export * from './TextPasswordField';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./JsonField.js";
|
|
2
|
+
export * from "./MultiSelectField.js";
|
|
3
|
+
export * from "./NumberField.js";
|
|
4
|
+
export * from "./PasswordField.js";
|
|
5
|
+
export * from "./SelectField.js";
|
|
6
|
+
export * from "./SwitchField.js";
|
|
7
|
+
export * from "./TextareaField.js";
|
|
8
|
+
export * from "./TextField.js";
|
|
9
|
+
export * from "./TextPasswordField.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ElementProps, type PaperProps } from '@rolder-kit/mantine';
|
|
2
|
+
interface Props extends PaperProps, ElementProps<'div', keyof PaperProps> {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const HoverPaper: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Paper } from "@rolder-kit/mantine";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const HoverPaper = /*#__PURE__*/ forwardRef(({ disabled, classNames, ...props }, ref)=>/*#__PURE__*/ jsx(Paper, {
|
|
5
|
+
ref: ref,
|
|
6
|
+
classNames: {
|
|
7
|
+
root: 'rolder-hover-paper-root',
|
|
8
|
+
...classNames
|
|
9
|
+
},
|
|
10
|
+
mod: {
|
|
11
|
+
disabled
|
|
12
|
+
},
|
|
13
|
+
...props
|
|
14
|
+
}));
|
|
15
|
+
export { HoverPaper };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Loader, useDebouncedCallback } from "@rolder-kit/mantine";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { JsonInput } from "../JsonInput.js";
|
|
5
|
+
const JsonInput_JsonInput = ({ initialValue, onChange, debounce = 300, ...props })=>{
|
|
6
|
+
const [value, setValue] = useState(initialValue);
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
const handleSave = useDebouncedCallback(async (content)=>{
|
|
9
|
+
setLoading(true);
|
|
10
|
+
await onChange(content);
|
|
11
|
+
setLoading(false);
|
|
12
|
+
}, debounce);
|
|
13
|
+
return /*#__PURE__*/ jsxs(Box, {
|
|
14
|
+
pos: "relative",
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsx(JsonInput, {
|
|
17
|
+
value: value,
|
|
18
|
+
onChange: (e)=>{
|
|
19
|
+
setValue(e);
|
|
20
|
+
handleSave(e);
|
|
21
|
+
},
|
|
22
|
+
...props
|
|
23
|
+
}),
|
|
24
|
+
loading && /*#__PURE__*/ jsx(Loader, {
|
|
25
|
+
size: "sm",
|
|
26
|
+
pos: "absolute",
|
|
27
|
+
top: 8,
|
|
28
|
+
left: 8
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export { JsonInput_JsonInput as JsonInput };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, NumberInput, useDebouncedCallback } from "@rolder-kit/mantine";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
const NumberInput_NumberInput = ({ initialValue, onChange, debounce = 300, ...props })=>{
|
|
5
|
+
const [value, setValue] = useState(initialValue);
|
|
6
|
+
const [loading, setLoading] = useState(false);
|
|
7
|
+
const handleSave = useDebouncedCallback(async (content)=>{
|
|
8
|
+
setLoading(true);
|
|
9
|
+
await onChange(content);
|
|
10
|
+
setLoading(false);
|
|
11
|
+
}, debounce);
|
|
12
|
+
return /*#__PURE__*/ jsx(NumberInput, {
|
|
13
|
+
value: value,
|
|
14
|
+
onChange: (v)=>{
|
|
15
|
+
setValue(v);
|
|
16
|
+
handleSave(v);
|
|
17
|
+
},
|
|
18
|
+
flex: props.w ? void 0 : 1,
|
|
19
|
+
rightSection: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
20
|
+
size: "sm",
|
|
21
|
+
mr: 8
|
|
22
|
+
}) : void 0,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export { NumberInput_NumberInput as NumberInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const SaveInput: import("react").FC<{
|
|
2
|
+
initialValue?: string;
|
|
3
|
+
onChange: (value: string) => Promise<void>;
|
|
4
|
+
debounce?: number;
|
|
5
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">> & {
|
|
6
|
+
TextInput: import("react").FC<{
|
|
7
|
+
initialValue?: string;
|
|
8
|
+
onChange: (value: string) => Promise<void>;
|
|
9
|
+
debounce?: number;
|
|
10
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">>;
|
|
11
|
+
NumberInput: import("react").FC<{
|
|
12
|
+
initialValue: string | number;
|
|
13
|
+
onChange: (value: string | number) => Promise<void>;
|
|
14
|
+
debounce?: number;
|
|
15
|
+
} & Omit<import("@mantine/core").NumberInputProps, "onChange" | "value">>;
|
|
16
|
+
Textarea: import("react").FC<{
|
|
17
|
+
initialValue: string;
|
|
18
|
+
onChange: (value: string) => Promise<void>;
|
|
19
|
+
debounce?: number;
|
|
20
|
+
} & Omit<import("@mantine/core").TextareaProps, "onChange" | "value">>;
|
|
21
|
+
Switch: import("react").FC<{
|
|
22
|
+
initialValue: boolean;
|
|
23
|
+
onChange: (value: boolean) => Promise<void>;
|
|
24
|
+
debounce?: number;
|
|
25
|
+
} & Omit<import("@mantine/core").SwitchProps, "onChange" | "checked">>;
|
|
26
|
+
JsonInput: import("react").FC<{
|
|
27
|
+
initialValue: string;
|
|
28
|
+
onChange: (value: string) => Promise<void>;
|
|
29
|
+
debounce?: number;
|
|
30
|
+
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "onChange" | "value">>;
|
|
31
|
+
Select: import("react").FC<{
|
|
32
|
+
initialValue: string | null;
|
|
33
|
+
onChange: (value: string | null) => Promise<void>;
|
|
34
|
+
debounce?: number;
|
|
35
|
+
} & Omit<import("@mantine/core").SelectProps, "onChange" | "value">>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JsonInput } from "./JsonInput.js";
|
|
2
|
+
import { NumberInput } from "./NumberInput.js";
|
|
3
|
+
import { Select } from "./Select.js";
|
|
4
|
+
import { Switch } from "./Switch.js";
|
|
5
|
+
import { Textarea } from "./Textarea.js";
|
|
6
|
+
import { TextInput } from "./TextInput.js";
|
|
7
|
+
const SaveInput = Object.assign(TextInput, {
|
|
8
|
+
TextInput: TextInput,
|
|
9
|
+
NumberInput: NumberInput,
|
|
10
|
+
Textarea: Textarea,
|
|
11
|
+
Switch: Switch,
|
|
12
|
+
JsonInput: JsonInput,
|
|
13
|
+
Select: Select
|
|
14
|
+
});
|
|
15
|
+
export { SaveInput };
|