@rolder/kit 3.0.0-alpha.9 → 3.0.0-alpha.91
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/ai/index.d.ts +2 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/ui/chat/Root.d.ts +55 -0
- package/dist/ai/ui/chat/Root.js +18 -0
- package/dist/ai/ui/chat/chatInput/File.js +71 -0
- package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
- package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
- package/dist/ai/ui/chat/chatInput/Root.js +24 -0
- package/dist/ai/ui/chat/chatInput/Submit.js +23 -0
- package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.js +8 -7
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.d.ts +2 -3
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.js +2 -2
- package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
- package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
- package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
- package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
- package/dist/ai/ui/chat/chatInput/store/input.js +81 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
- package/dist/ai/ui/chat/index.d.ts +12 -0
- package/dist/ai/ui/chat/index.js +15 -0
- package/dist/ai/ui/chat/messages/Empty.d.ts +4 -0
- package/dist/ai/ui/chat/messages/Empty.js +11 -0
- package/dist/ai/ui/chat/messages/Loader.d.ts +5 -0
- package/dist/ai/ui/chat/messages/Loader.js +12 -0
- package/dist/ai/ui/chat/messages/Message.d.ts +8 -0
- package/dist/ai/ui/chat/messages/Message.js +22 -0
- package/dist/ai/ui/chat/messages/Messages.d.ts +3 -0
- package/dist/ai/ui/chat/messages/Messages.js +40 -0
- package/dist/ai/ui/chat/messages/index.d.ts +2 -0
- package/dist/ai/ui/chat/messages/index.js +2 -0
- package/dist/ai/ui/chat/parts/File.d.ts +6 -0
- package/dist/ai/ui/{conversation → chat/parts}/File.js +10 -10
- package/dist/ai/ui/chat/parts/FileIcon.js +43 -0
- package/dist/ai/ui/chat/parts/PartPaper.d.ts +8 -0
- package/dist/ai/ui/chat/parts/PartPaper.js +14 -0
- package/dist/ai/ui/chat/parts/TextPart.d.ts +6 -0
- package/dist/ai/ui/chat/parts/TextPart.js +15 -0
- package/dist/ai/ui/chat/parts/ToolExecution.d.ts +7 -0
- package/dist/ai/ui/chat/parts/ToolExecution.js +56 -0
- package/dist/ai/ui/chat/parts/ToolPart.d.ts +10 -0
- package/dist/ai/ui/chat/parts/ToolPart.js +24 -0
- package/dist/ai/ui/chat/parts/index.d.ts +3 -0
- package/dist/ai/ui/chat/parts/index.js +3 -0
- package/dist/ai/ui/chat/store/index.d.ts +4 -0
- package/dist/ai/ui/chat/store/index.js +4 -0
- package/dist/ai/ui/chat/store/messages.d.ts +12 -0
- package/dist/ai/ui/chat/store/messages.js +40 -0
- package/dist/ai/ui/chat/store/send.d.ts +14 -0
- package/dist/ai/ui/chat/store/send.js +16 -0
- package/dist/ai/ui/chat/store/states.d.ts +11 -0
- package/dist/ai/ui/chat/store/states.js +20 -0
- package/dist/ai/ui/chat/store/useInitChat.d.ts +3 -0
- package/dist/ai/ui/chat/store/useInitChat.js +40 -0
- package/dist/ai/ui/index.d.ts +1 -0
- package/dist/ai/ui/index.js +1 -0
- package/dist/ai/utils/index.d.ts +2 -0
- package/dist/ai/utils/index.js +2 -0
- package/dist/app/AppDefaults.js +1 -1
- package/dist/app/DefaultApp.js +1 -1
- package/dist/app/cookieColorSchemeManager.js +1 -1
- package/dist/app/defaultRequestMiddlewares.d.ts +1 -1
- package/dist/app/defaultTheme.d.ts +6 -6
- package/dist/app/index.d.ts +4 -0
- package/dist/app/index.js +4 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/index.d.ts +5 -26
- package/dist/index.js +5 -26
- package/dist/styles.css +3 -8
- package/dist/tanstackFunctions/cookie/index.d.ts +3 -0
- package/dist/tanstackFunctions/cookie/index.js +4 -0
- package/dist/{functions → tanstackFunctions/cookie}/setCookie.d.ts +1 -1
- package/dist/tanstackFunctions/index.d.ts +3 -0
- package/dist/tanstackFunctions/index.js +3 -0
- package/dist/tanstackFunctions/s3/getS3Client.d.ts +2 -0
- package/dist/tanstackFunctions/s3/getS3Client.js +18 -0
- package/dist/tanstackFunctions/s3/getSignedFileUrlFn.d.ts +4 -0
- package/dist/tanstackFunctions/s3/getSignedFileUrlFn.js +21 -0
- package/dist/tanstackFunctions/s3/index.d.ts +2 -0
- package/dist/tanstackFunctions/s3/index.js +2 -0
- package/dist/tanstackFunctions/s3/uploadRequest.d.ts +3 -0
- package/dist/tanstackFunctions/s3/uploadRequest.js +21 -0
- package/dist/{surreal → tanstackFunctions/surreal}/connection.js +5 -1
- package/dist/tanstackFunctions/surreal/deafaultCrud.d.ts +2 -0
- package/dist/tanstackFunctions/surreal/index.d.ts +4 -0
- package/dist/tanstackFunctions/surreal/index.js +4 -0
- package/dist/ui/AnimatedChevron.d.ts +3 -4
- package/dist/ui/AnimatedChevron.js +6 -25
- package/dist/ui/JsonInput.d.ts +1 -1
- package/dist/ui/JsonInput.js +1 -1
- package/dist/ui/editor/Content.d.ts +2 -2
- package/dist/ui/editor/Content.js +2 -2
- package/dist/ui/editor/Root.d.ts +7 -1
- package/dist/ui/editor/Root.js +42 -5
- package/dist/ui/editor/Toolbar.d.ts +3 -2
- package/dist/ui/editor/Toolbar.js +7 -25
- package/dist/ui/editor/index.d.ts +5 -9
- package/dist/ui/editor/index.js +3 -4
- package/dist/ui/editor/store.d.ts +6 -0
- package/dist/ui/editor/store.js +10 -0
- package/dist/ui/error/DefaultError.d.ts +1 -1
- package/dist/ui/error/DefaultNotFound.d.ts +1 -1
- package/dist/ui/error/Forbidden.d.ts +1 -1
- package/dist/ui/form/buttons/CancelButton.d.ts +2 -2
- package/dist/ui/form/buttons/CancelButton.js +4 -26
- package/dist/ui/form/buttons/SubmitButton.d.ts +2 -2
- package/dist/ui/form/buttons/SubmitButton.js +4 -29
- package/dist/ui/form/buttons/SubscribeActionIcon.d.ts +2 -2
- package/dist/ui/form/buttons/SubscribeButton.d.ts +2 -2
- package/dist/ui/form/context.d.ts +55 -55
- package/dist/ui/form/context.js +3 -3
- package/dist/ui/form/fields/JsonField.d.ts +1 -1
- package/dist/ui/form/fields/MultiSelectField.d.ts +1 -1
- package/dist/ui/form/fields/NumberField.d.ts +1 -1
- package/dist/ui/form/fields/PasswordField.d.ts +2 -0
- package/dist/ui/form/fields/{PassowrdField.js → PasswordField.js} +2 -2
- package/dist/ui/form/fields/SelectField.d.ts +1 -1
- package/dist/ui/form/fields/SwitchField.d.ts +1 -1
- package/dist/ui/form/fields/TextField.d.ts +1 -1
- package/dist/ui/form/fields/TextPasswordField.d.ts +2 -0
- package/dist/ui/form/fields/TextPasswordField.js +29 -0
- package/dist/ui/form/fields/TextareaField.d.ts +1 -1
- package/dist/ui/form/fields/index.d.ts +2 -2
- package/dist/ui/form/fields/index.js +2 -2
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/saveInput/JsonInput.d.ts +2 -2
- package/dist/ui/saveInput/NumberInput.d.ts +2 -2
- package/dist/ui/saveInput/SaveInput.d.ts +14 -14
- package/dist/ui/saveInput/Select.d.ts +2 -2
- package/dist/ui/saveInput/Switch.d.ts +2 -2
- package/dist/ui/saveInput/TextInput.d.ts +2 -2
- package/dist/ui/saveInput/Textarea.d.ts +2 -2
- package/dist/ui/scrollArea/Root.d.ts +7 -0
- package/dist/ui/scrollArea/Root.js +42 -0
- package/dist/ui/scrollArea/ScrollButton.d.ts +7 -0
- package/dist/ui/scrollArea/ScrollButton.js +30 -0
- package/dist/ui/scrollArea/index.d.ts +6 -3
- package/dist/ui/scrollArea/index.js +7 -3
- package/dist/ui/scrollArea/methods.d.ts +4 -0
- package/dist/ui/scrollArea/methods.js +32 -0
- package/dist/ui/scrollArea/store.d.ts +12 -0
- package/dist/ui/scrollArea/store.js +25 -0
- package/package.json +73 -68
- package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
- package/dist/ai/ui/conversation/ConversationContext.js +0 -8
- package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
- package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
- package/dist/ai/ui/conversation/Empty.d.ts +0 -1
- package/dist/ai/ui/conversation/Empty.js +0 -21
- package/dist/ai/ui/conversation/File.d.ts +0 -4
- package/dist/ai/ui/conversation/FileIcon.js +0 -225
- package/dist/ai/ui/conversation/Loader.d.ts +0 -2
- package/dist/ai/ui/conversation/Loader.js +0 -12
- package/dist/ai/ui/conversation/Message.d.ts +0 -4
- package/dist/ai/ui/conversation/Message.js +0 -25
- package/dist/ai/ui/conversation/Root.d.ts +0 -2
- package/dist/ai/ui/conversation/Root.js +0 -26
- package/dist/ai/ui/conversation/index.d.ts +0 -13
- package/dist/ai/ui/conversation/index.js +0 -14
- package/dist/ai/ui/conversation/types.d.ts +0 -7
- package/dist/ai/ui/conversation/types.js +0 -0
- package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
- package/dist/ai/ui/conversation/useChatMessage.js +0 -12
- package/dist/ai/ui/promptInput/File.js +0 -117
- package/dist/ai/ui/promptInput/FileIcon.js +0 -225
- package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
- package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
- package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
- package/dist/ai/ui/promptInput/Root.d.ts +0 -3
- package/dist/ai/ui/promptInput/Root.js +0 -17
- package/dist/ai/ui/promptInput/Submit.js +0 -40
- package/dist/ai/ui/promptInput/types.d.ts +0 -11
- package/dist/ai/ui/promptInput/types.js +0 -0
- package/dist/surreal/deafaultCrud.d.ts +0 -2
- package/dist/ui/editor/Provider.d.ts +0 -17
- package/dist/ui/editor/Provider.js +0 -80
- package/dist/ui/editor/types.d.ts +0 -7
- package/dist/ui/editor/types.js +0 -0
- package/dist/ui/form/fields/PassowrdField.d.ts +0 -2
- package/dist/ui/form/fields/TextPassowrdField.d.ts +0 -2
- package/dist/ui/form/fields/TextPassowrdField.js +0 -51
- package/dist/ui/scrollArea/ScrollArea.d.ts +0 -62
- package/dist/ui/scrollArea/ScrollArea.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaButton.d.ts +0 -5
- package/dist/ui/scrollArea/ScrollAreaButton.js +0 -51
- package/dist/ui/scrollArea/ScrollAreaContent.d.ts +0 -6
- package/dist/ui/scrollArea/ScrollAreaContent.js +0 -29
- package/dist/ui/scrollArea/context.d.ts +0 -28
- package/dist/ui/scrollArea/context.js +0 -10
- package/dist/ui/scrollArea/types.d.ts +0 -65
- package/dist/ui/scrollArea/types.js +0 -0
- package/dist/ui/scrollArea/useScrollArea.d.ts +0 -9
- package/dist/ui/scrollArea/useScrollArea.js +0 -146
- /package/dist/ai/ui/{promptInput → chat/chatInput}/File.d.ts +0 -0
- /package/dist/ai/ui/{conversation → chat/chatInput}/FileIcon.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.js +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Submit.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/parts}/FileIcon.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/getCookie.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/getCookie.js +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookie.js +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookies.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookies.js +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/connection.d.ts +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/deafaultCrud.js +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/deserialize.d.ts +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/deserialize.js +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/encryption.d.ts +0 -0
- /package/dist/{surreal → tanstackFunctions/surreal}/encryption.js +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "@mantine/core";
|
|
3
|
+
import { IconDeviceFloppy } from "@tabler/icons-react";
|
|
3
4
|
import { useFormContext } from "../context.js";
|
|
4
5
|
const SubmitButton = (props)=>{
|
|
5
6
|
const form = useFormContext();
|
|
@@ -8,34 +9,8 @@ const SubmitButton = (props)=>{
|
|
|
8
9
|
children: (state)=>/*#__PURE__*/ jsx(Button, {
|
|
9
10
|
type: "submit",
|
|
10
11
|
size: "xs",
|
|
11
|
-
leftSection: /*#__PURE__*/
|
|
12
|
-
|
|
13
|
-
width: "20",
|
|
14
|
-
height: "20",
|
|
15
|
-
viewBox: "0 0 20 20",
|
|
16
|
-
fill: "none",
|
|
17
|
-
stroke: "currentColor",
|
|
18
|
-
strokeWidth: "2",
|
|
19
|
-
strokeLinecap: "round",
|
|
20
|
-
strokeLinejoin: "round",
|
|
21
|
-
role: "img",
|
|
22
|
-
"aria-label": "Submit",
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ jsx("path", {
|
|
25
|
-
stroke: "none",
|
|
26
|
-
d: "M0 0h24v24H0z",
|
|
27
|
-
fill: "none"
|
|
28
|
-
}),
|
|
29
|
-
/*#__PURE__*/ jsx("path", {
|
|
30
|
-
d: "M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"
|
|
31
|
-
}),
|
|
32
|
-
/*#__PURE__*/ jsx("path", {
|
|
33
|
-
d: "M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"
|
|
34
|
-
}),
|
|
35
|
-
/*#__PURE__*/ jsx("path", {
|
|
36
|
-
d: "M14 4l0 4l-6 0l0 -4"
|
|
37
|
-
})
|
|
38
|
-
]
|
|
12
|
+
leftSection: /*#__PURE__*/ jsx(IconDeviceFloppy, {
|
|
13
|
+
size: 20
|
|
39
14
|
}),
|
|
40
15
|
loading: state.isSubmitting,
|
|
41
16
|
disabled: !state.isDirty,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ActionIconProps } from '@mantine/core';
|
|
2
|
-
export declare const SubscribeActionIcon:
|
|
2
|
+
export declare const SubscribeActionIcon: React.FC<ActionIconProps & {
|
|
3
3
|
onClick?: () => void;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps } from '@mantine/core';
|
|
2
|
-
export declare const SubscribeButton:
|
|
2
|
+
export declare const SubscribeButton: React.FC<ButtonProps & {
|
|
3
3
|
label: string;
|
|
4
4
|
onClick?: () => void;
|
|
5
|
-
}
|
|
5
|
+
}>;
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
declare const useFieldContext: <TData>() => import("@tanstack/form
|
|
2
|
-
declare const useAppForm: <TFormData, TOnMount extends import("@tanstack/form
|
|
3
|
-
readonly TextField:
|
|
4
|
-
readonly NumberField:
|
|
5
|
-
readonly TextareaField:
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly SelectField:
|
|
9
|
-
readonly MultiSelectField:
|
|
10
|
-
readonly SwitchField:
|
|
11
|
-
readonly JsonField:
|
|
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
12
|
}, {
|
|
13
|
-
readonly SubmitButton: (
|
|
13
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
14
14
|
label?: string;
|
|
15
15
|
onClick?: () => void;
|
|
16
|
-
}
|
|
17
|
-
readonly CancelButton: (
|
|
16
|
+
}>;
|
|
17
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
18
18
|
label?: string;
|
|
19
19
|
onClick?: () => void;
|
|
20
|
-
}
|
|
21
|
-
readonly SubscribeButton: (
|
|
20
|
+
}>;
|
|
21
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
22
22
|
label: string;
|
|
23
23
|
onClick?: () => void;
|
|
24
|
-
}
|
|
25
|
-
readonly SubscribeActionIcon: (
|
|
24
|
+
}>;
|
|
25
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
26
26
|
onClick?: () => void;
|
|
27
|
-
}
|
|
28
|
-
}>, withForm: <TFormData, TOnMount extends import("@tanstack/form
|
|
29
|
-
readonly TextField:
|
|
30
|
-
readonly NumberField:
|
|
31
|
-
readonly TextareaField:
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly SelectField:
|
|
35
|
-
readonly MultiSelectField:
|
|
36
|
-
readonly SwitchField:
|
|
37
|
-
readonly JsonField:
|
|
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
38
|
}, {
|
|
39
|
-
readonly SubmitButton: (
|
|
39
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
40
40
|
label?: string;
|
|
41
41
|
onClick?: () => void;
|
|
42
|
-
}
|
|
43
|
-
readonly CancelButton: (
|
|
42
|
+
}>;
|
|
43
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
44
44
|
label?: string;
|
|
45
45
|
onClick?: () => void;
|
|
46
|
-
}
|
|
47
|
-
readonly SubscribeButton: (
|
|
46
|
+
}>;
|
|
47
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
48
48
|
label: string;
|
|
49
49
|
onClick?: () => void;
|
|
50
|
-
}
|
|
51
|
-
readonly SubscribeActionIcon: (
|
|
50
|
+
}>;
|
|
51
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
52
52
|
onClick?: () => void;
|
|
53
|
-
}
|
|
53
|
+
}>;
|
|
54
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/form
|
|
56
|
-
readonly TextField:
|
|
57
|
-
readonly NumberField:
|
|
58
|
-
readonly TextareaField:
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
readonly SelectField:
|
|
62
|
-
readonly MultiSelectField:
|
|
63
|
-
readonly SwitchField:
|
|
64
|
-
readonly JsonField:
|
|
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
65
|
}, {
|
|
66
|
-
readonly SubmitButton: (
|
|
66
|
+
readonly SubmitButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
67
67
|
label?: string;
|
|
68
68
|
onClick?: () => void;
|
|
69
|
-
}
|
|
70
|
-
readonly CancelButton: (
|
|
69
|
+
}>;
|
|
70
|
+
readonly CancelButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
71
71
|
label?: string;
|
|
72
72
|
onClick?: () => void;
|
|
73
|
-
}
|
|
74
|
-
readonly SubscribeButton: (
|
|
73
|
+
}>;
|
|
74
|
+
readonly SubscribeButton: import("react").FC<import("@mantine/core").ButtonProps & {
|
|
75
75
|
label: string;
|
|
76
76
|
onClick?: () => void;
|
|
77
|
-
}
|
|
78
|
-
readonly SubscribeActionIcon: (
|
|
77
|
+
}>;
|
|
78
|
+
readonly SubscribeActionIcon: import("react").FC<import("@mantine/core").ActionIconProps & {
|
|
79
79
|
onClick?: () => void;
|
|
80
|
-
}
|
|
80
|
+
}>;
|
|
81
81
|
}>;
|
|
82
82
|
}>>;
|
|
83
83
|
export { useAppForm, useFieldContext, useFormContext, withForm };
|
package/dist/ui/form/context.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
|
|
2
2
|
import { CancelButton, SubmitButton, SubscribeActionIcon, SubscribeButton } from "./buttons/index.js";
|
|
3
|
-
import { JsonField, MultiSelectField, NumberField,
|
|
3
|
+
import { JsonField, MultiSelectField, NumberField, PasswordField, SelectField, SwitchField, TextField, TextPasswordField, TextareaField } from "./fields/index.js";
|
|
4
4
|
const { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
|
|
5
5
|
const { useAppForm, withForm } = createFormHook({
|
|
6
6
|
fieldComponents: {
|
|
7
7
|
TextField: TextField,
|
|
8
8
|
NumberField: NumberField,
|
|
9
9
|
TextareaField: TextareaField,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
TextPasswordField: TextPasswordField,
|
|
11
|
+
PasswordField: PasswordField,
|
|
12
12
|
SelectField: SelectField,
|
|
13
13
|
MultiSelectField: MultiSelectField,
|
|
14
14
|
SwitchField: SwitchField,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
2
|
-
export declare const JsonField:
|
|
2
|
+
export declare const JsonField: React.FC<ReactCodeMirrorProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type MultiSelectProps } from '@mantine/core';
|
|
2
|
-
export declare const MultiSelectField:
|
|
2
|
+
export declare const MultiSelectField: React.FC<MultiSelectProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type NumberInputProps } from '@mantine/core';
|
|
2
|
-
export declare const NumberField:
|
|
2
|
+
export declare const NumberField: React.FC<NumberInputProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PasswordInput } from "@mantine/core";
|
|
3
3
|
import { useFieldContext } from "../context.js";
|
|
4
|
-
const
|
|
4
|
+
const PasswordField = (props)=>{
|
|
5
5
|
const field = useFieldContext();
|
|
6
6
|
return /*#__PURE__*/ jsx(PasswordInput, {
|
|
7
7
|
size: "lg",
|
|
@@ -15,4 +15,4 @@ const PassowrdField = (props)=>{
|
|
|
15
15
|
...props
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
export {
|
|
18
|
+
export { PasswordField };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SelectProps } from '@mantine/core';
|
|
2
|
-
export declare const SelectField:
|
|
2
|
+
export declare const SelectField: React.FC<SelectProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SwitchProps } from '@mantine/core';
|
|
2
|
-
export declare const SwitchField:
|
|
2
|
+
export declare const SwitchField: React.FC<SwitchProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TextInputProps } from '@mantine/core';
|
|
2
|
-
export declare const TextField:
|
|
2
|
+
export declare const TextField: React.FC<TextInputProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon, TextInput } from "@mantine/core";
|
|
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 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type TextareaProps } from '@mantine/core';
|
|
2
|
-
export declare const TextareaField:
|
|
2
|
+
export declare const TextareaField: React.FC<TextareaProps>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './JsonField';
|
|
2
2
|
export * from './MultiSelectField';
|
|
3
3
|
export * from './NumberField';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './PasswordField';
|
|
5
5
|
export * from './SelectField';
|
|
6
6
|
export * from './SwitchField';
|
|
7
7
|
export * from './TextareaField';
|
|
8
8
|
export * from './TextField';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './TextPasswordField';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./JsonField.js";
|
|
2
2
|
export * from "./MultiSelectField.js";
|
|
3
3
|
export * from "./NumberField.js";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./PasswordField.js";
|
|
5
5
|
export * from "./SelectField.js";
|
|
6
6
|
export * from "./SwitchField.js";
|
|
7
7
|
export * from "./TextareaField.js";
|
|
8
8
|
export * from "./TextField.js";
|
|
9
|
-
export * from "./
|
|
9
|
+
export * from "./TextPasswordField.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './AnimatedChevron';
|
|
2
|
+
export * from './editor';
|
|
3
|
+
export * from './error';
|
|
4
|
+
export * from './form';
|
|
5
|
+
export * from './hoverPaper';
|
|
6
|
+
export * from './JsonInput';
|
|
7
|
+
export * from './RouterLink';
|
|
8
|
+
export * from './saveInput';
|
|
9
|
+
export * from './scrollArea';
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./AnimatedChevron.js";
|
|
2
|
+
export * from "./editor/index.js";
|
|
3
|
+
export * from "./error/index.js";
|
|
4
|
+
export * from "./form/index.js";
|
|
5
|
+
export * from "./hoverPaper/index.js";
|
|
6
|
+
export * from "./JsonInput.js";
|
|
7
|
+
export * from "./RouterLink.js";
|
|
8
|
+
export * from "./saveInput/index.js";
|
|
9
|
+
export * from "./scrollArea/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
2
|
-
export declare const JsonInput:
|
|
2
|
+
export declare const JsonInput: React.FC<{
|
|
3
3
|
initialValue: string;
|
|
4
4
|
onChange: (value: string) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<ReactCodeMirrorProps,
|
|
6
|
+
} & Omit<ReactCodeMirrorProps, 'value' | 'onChange'>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NumberInputProps } from '@mantine/core';
|
|
2
|
-
export declare const NumberInput:
|
|
2
|
+
export declare const NumberInput: React.FC<{
|
|
3
3
|
initialValue: string | number;
|
|
4
4
|
onChange: (value: string | number) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<NumberInputProps,
|
|
6
|
+
} & Omit<NumberInputProps, 'value' | 'onChange'>>;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export declare const SaveInput: (
|
|
1
|
+
export declare const SaveInput: import("react").FC<{
|
|
2
2
|
initialValue?: string;
|
|
3
3
|
onChange: (value: string) => Promise<void>;
|
|
4
4
|
debounce?: number;
|
|
5
|
-
} & Omit<import("@mantine/core").TextInputProps, "
|
|
6
|
-
TextInput: ({
|
|
5
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">> & {
|
|
6
|
+
TextInput: import("react").FC<{
|
|
7
7
|
initialValue?: string;
|
|
8
8
|
onChange: (value: string) => Promise<void>;
|
|
9
9
|
debounce?: number;
|
|
10
|
-
} & Omit<import("@mantine/core").TextInputProps, "
|
|
11
|
-
NumberInput: ({
|
|
10
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">>;
|
|
11
|
+
NumberInput: import("react").FC<{
|
|
12
12
|
initialValue: string | number;
|
|
13
13
|
onChange: (value: string | number) => Promise<void>;
|
|
14
14
|
debounce?: number;
|
|
15
|
-
} & Omit<import("@mantine/core").NumberInputProps, "
|
|
16
|
-
Textarea: ({
|
|
15
|
+
} & Omit<import("@mantine/core").NumberInputProps, "onChange" | "value">>;
|
|
16
|
+
Textarea: import("react").FC<{
|
|
17
17
|
initialValue: string;
|
|
18
18
|
onChange: (value: string) => Promise<void>;
|
|
19
19
|
debounce?: number;
|
|
20
|
-
} & Omit<import("@mantine/core").TextareaProps, "
|
|
21
|
-
Switch: ({
|
|
20
|
+
} & Omit<import("@mantine/core").TextareaProps, "onChange" | "value">>;
|
|
21
|
+
Switch: import("react").FC<{
|
|
22
22
|
initialValue: boolean;
|
|
23
23
|
onChange: (value: boolean) => Promise<void>;
|
|
24
24
|
debounce?: number;
|
|
25
|
-
} & Omit<import("@mantine/core").SwitchProps, "
|
|
26
|
-
JsonInput: ({
|
|
25
|
+
} & Omit<import("@mantine/core").SwitchProps, "onChange" | "checked">>;
|
|
26
|
+
JsonInput: import("react").FC<{
|
|
27
27
|
initialValue: string;
|
|
28
28
|
onChange: (value: string) => Promise<void>;
|
|
29
29
|
debounce?: number;
|
|
30
|
-
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "
|
|
31
|
-
Select: ({
|
|
30
|
+
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "onChange" | "value">>;
|
|
31
|
+
Select: import("react").FC<{
|
|
32
32
|
initialValue: string | null;
|
|
33
33
|
onChange: (value: string | null) => Promise<void>;
|
|
34
34
|
debounce?: number;
|
|
35
|
-
} & Omit<import("@mantine/core").SelectProps, "
|
|
35
|
+
} & Omit<import("@mantine/core").SelectProps, "onChange" | "value">>;
|
|
36
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SelectProps } from '@mantine/core';
|
|
2
|
-
export declare const Select:
|
|
2
|
+
export declare const Select: React.FC<{
|
|
3
3
|
initialValue: string | null;
|
|
4
4
|
onChange: (value: string | null) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<SelectProps,
|
|
6
|
+
} & Omit<SelectProps, 'value' | 'onChange'>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SwitchProps } from '@mantine/core';
|
|
2
|
-
export declare const Switch:
|
|
2
|
+
export declare const Switch: React.FC<{
|
|
3
3
|
initialValue: boolean;
|
|
4
4
|
onChange: (value: boolean) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<SwitchProps,
|
|
6
|
+
} & Omit<SwitchProps, 'checked' | 'onChange'>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TextInputProps } from '@mantine/core';
|
|
2
|
-
export declare const TextInput:
|
|
2
|
+
export declare const TextInput: React.FC<{
|
|
3
3
|
initialValue?: string;
|
|
4
4
|
onChange: (value: string) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<TextInputProps,
|
|
6
|
+
} & Omit<TextInputProps, 'value' | 'onChange'>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TextareaProps } from '@mantine/core';
|
|
2
|
-
export declare const Textarea:
|
|
2
|
+
export declare const Textarea: React.FC<{
|
|
3
3
|
initialValue: string;
|
|
4
4
|
onChange: (value: string) => Promise<void>;
|
|
5
5
|
debounce?: number;
|
|
6
|
-
} & Omit<TextareaProps,
|
|
6
|
+
} & Omit<TextareaProps, 'value' | 'onChange'>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MantineRadius, type ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
|
2
|
+
export interface ScrollAreaProps extends Omit<MantineScrollAreaProps, 'h'> {
|
|
3
|
+
height: MantineScrollAreaProps['h'];
|
|
4
|
+
radius?: MantineRadius;
|
|
5
|
+
autoScroll?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Root: React.FC<ScrollAreaProps>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, ScrollArea, getRadius } from "@mantine/core";
|
|
3
|
+
import { useElementSize } from "@mantine/hooks";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { isAboveCenter } from "./methods.js";
|
|
6
|
+
import { getHasScrollableContent, getHeight, getIsAboveCenter, getScrollAreaRef, setAutoScroll, setHeight, setIsAboveCenter, setScrollAreaRef } from "./store.js";
|
|
7
|
+
const Root = ({ children, height, radius, autoScroll = false, ...props })=>{
|
|
8
|
+
const scrollAreaRef = useRef(null);
|
|
9
|
+
const { ref: boxRef, height: contentHeight } = useElementSize();
|
|
10
|
+
useEffect(()=>{
|
|
11
|
+
setAutoScroll(autoScroll);
|
|
12
|
+
});
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
if (getHeight() !== contentHeight) setHeight(contentHeight);
|
|
15
|
+
if (scrollAreaRef.current && !getScrollAreaRef()) setScrollAreaRef(scrollAreaRef.current);
|
|
16
|
+
}, [
|
|
17
|
+
contentHeight
|
|
18
|
+
]);
|
|
19
|
+
return /*#__PURE__*/ jsx(ScrollArea, {
|
|
20
|
+
viewportRef: scrollAreaRef,
|
|
21
|
+
h: height,
|
|
22
|
+
classNames: {
|
|
23
|
+
viewport: 'rolder-scroll-area-viewport',
|
|
24
|
+
scrollbar: 'rolder-scroll-area-scrollbar'
|
|
25
|
+
},
|
|
26
|
+
style: {
|
|
27
|
+
'--radius': radius ? getRadius(radius) : void 0
|
|
28
|
+
},
|
|
29
|
+
onScrollPositionChange: ()=>{
|
|
30
|
+
if (getHasScrollableContent()) {
|
|
31
|
+
const current = isAboveCenter();
|
|
32
|
+
if (getIsAboveCenter() !== current) setIsAboveCenter(current);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
...props,
|
|
36
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
37
|
+
ref: boxRef,
|
|
38
|
+
children: children
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export { Root };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ActionIconProps } from '@mantine/core';
|
|
2
|
+
import { type ReactNode } from '@tabler/icons-react';
|
|
3
|
+
export interface ScrollButtonProps extends ActionIconProps {
|
|
4
|
+
upIcon?: ReactNode;
|
|
5
|
+
downIcon?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const ScrollButton: React.FC<ScrollButtonProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon } from "@mantine/core";
|
|
3
|
+
import { IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
4
|
+
import { scrollToBottom, scrollToTop } from "./methods.js";
|
|
5
|
+
import { useHasScrollableContent, useIsAboveCenter } from "./store.js";
|
|
6
|
+
const ScrollButton = ({ upIcon, downIcon, ...props })=>{
|
|
7
|
+
const hasScrollableContent = useHasScrollableContent();
|
|
8
|
+
const isScrollingDown = useIsAboveCenter();
|
|
9
|
+
if (!hasScrollableContent) return null;
|
|
10
|
+
const icon = isScrollingDown ? downIcon ?? /*#__PURE__*/ jsx(IconChevronDown, {
|
|
11
|
+
strokeWidth: 1.5
|
|
12
|
+
}) : upIcon ?? /*#__PURE__*/ jsx(IconChevronUp, {
|
|
13
|
+
strokeWidth: 1.5
|
|
14
|
+
});
|
|
15
|
+
const handleClick = ()=>{
|
|
16
|
+
if (isScrollingDown) scrollToBottom();
|
|
17
|
+
else scrollToTop();
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
20
|
+
pos: "absolute",
|
|
21
|
+
bottom: 16,
|
|
22
|
+
right: 16,
|
|
23
|
+
variant: "light",
|
|
24
|
+
onClick: handleClick,
|
|
25
|
+
"aria-label": isScrollingDown ? 'Scroll to bottom' : 'Scroll to top',
|
|
26
|
+
...props,
|
|
27
|
+
children: icon
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export { ScrollButton };
|