@rolder/kit 3.0.0-alpha.8 → 3.0.0-alpha.9
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/ui/conversation/ConversationContext.d.ts +7 -0
- package/dist/ai/ui/conversation/ConversationContext.js +8 -0
- package/dist/ai/ui/conversation/ConversationProvider.d.ts +2 -0
- package/dist/ai/ui/conversation/ConversationProvider.js +14 -0
- package/dist/ai/ui/conversation/Empty.d.ts +1 -0
- package/dist/ai/ui/conversation/Empty.js +21 -0
- package/dist/ai/ui/conversation/File.d.ts +4 -0
- package/dist/ai/ui/conversation/File.js +42 -0
- package/dist/ai/ui/conversation/FileIcon.d.ts +3 -0
- package/dist/ai/ui/conversation/FileIcon.js +225 -0
- package/dist/ai/ui/conversation/Loader.d.ts +2 -0
- package/dist/ai/ui/conversation/Loader.js +12 -0
- package/dist/ai/ui/conversation/Message.d.ts +4 -0
- package/dist/ai/ui/conversation/Message.js +25 -0
- package/dist/ai/ui/conversation/Root.d.ts +2 -0
- package/dist/ai/ui/conversation/Root.js +26 -0
- package/dist/ai/ui/conversation/index.d.ts +13 -0
- package/dist/ai/ui/conversation/index.js +14 -0
- package/{src/ai/ui/conversation/types.ts → dist/ai/ui/conversation/types.d.ts} +4 -5
- package/dist/ai/ui/conversation/types.js +0 -0
- package/dist/ai/ui/conversation/useChatMessage.d.ts +2 -0
- package/dist/ai/ui/conversation/useChatMessage.js +12 -0
- package/dist/ai/ui/promptInput/File.d.ts +2 -0
- package/dist/ai/ui/promptInput/File.js +117 -0
- package/dist/ai/ui/promptInput/FileIcon.d.ts +3 -0
- package/dist/ai/ui/promptInput/FileIcon.js +225 -0
- package/dist/ai/ui/promptInput/Footer.d.ts +2 -0
- package/dist/ai/ui/promptInput/Footer.js +8 -0
- package/dist/ai/ui/promptInput/PromptInputContext.d.ts +12 -0
- package/dist/ai/ui/promptInput/PromptInputContext.js +8 -0
- package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +2 -0
- package/dist/ai/ui/promptInput/PromptInputProvider.js +50 -0
- package/dist/ai/ui/promptInput/Root.d.ts +3 -0
- package/dist/ai/ui/promptInput/Root.js +17 -0
- package/dist/ai/ui/promptInput/Submit.d.ts +2 -0
- package/dist/ai/ui/promptInput/Submit.js +40 -0
- package/dist/ai/ui/promptInput/Textarea.d.ts +2 -0
- package/dist/ai/ui/promptInput/Textarea.js +33 -0
- package/dist/ai/ui/promptInput/index.d.ts +8 -0
- package/dist/ai/ui/promptInput/index.js +13 -0
- package/dist/ai/ui/promptInput/types.d.ts +11 -0
- package/dist/ai/ui/promptInput/types.js +0 -0
- package/dist/ai/utils/convertFileUIPartBlobToDataURL.d.ts +5 -0
- package/dist/ai/utils/convertFileUIPartBlobToDataURL.js +21 -0
- package/dist/ai/utils/parseAiMessagePart.d.ts +2 -0
- package/dist/ai/utils/parseAiMessagePart.js +12 -0
- package/dist/app/AppDefaults.d.ts +3 -0
- package/dist/app/AppDefaults.js +27 -0
- package/dist/app/DefaultApp.d.ts +6 -0
- package/dist/app/DefaultApp.js +43 -0
- package/dist/app/cookieColorSchemeManager.d.ts +6 -0
- package/dist/app/cookieColorSchemeManager.js +46 -0
- package/dist/app/defaultRequestMiddlewares.d.ts +4 -0
- package/dist/app/defaultRequestMiddlewares.js +24 -0
- package/dist/app/defaultTheme.d.ts +141 -0
- package/dist/app/defaultTheme.js +24 -0
- package/dist/functions/getCookie.d.ts +3 -0
- package/dist/functions/getCookie.js +8 -0
- package/dist/functions/setCookie.d.ts +10 -0
- package/dist/functions/setCookie.js +19 -0
- package/dist/functions/setCookies.d.ts +14 -0
- package/dist/functions/setCookies.js +13 -0
- package/dist/hooks/useMutation.d.ts +4 -0
- package/dist/hooks/useMutation.js +8 -0
- package/dist/hooks/useMutationWithInvalidate.d.ts +4 -0
- package/dist/hooks/useMutationWithInvalidate.js +16 -0
- package/{src/index.ts → dist/index.d.ts} +5 -45
- package/dist/index.js +26 -0
- package/{src → dist}/styles.css +11 -21
- package/dist/surreal/connection.d.ts +9 -0
- package/dist/surreal/connection.js +49 -0
- package/dist/surreal/deafaultCrud.d.ts +2 -0
- package/dist/surreal/deafaultCrud.js +18 -0
- package/dist/surreal/deserialize.d.ts +17 -0
- package/dist/surreal/deserialize.js +46 -0
- package/dist/surreal/encryption.d.ts +6 -0
- package/dist/surreal/encryption.js +30 -0
- package/dist/ui/AnimatedChevron.d.ts +6 -0
- package/dist/ui/AnimatedChevron.js +31 -0
- package/dist/ui/JsonInput.d.ts +2 -0
- package/dist/ui/JsonInput.js +45 -0
- package/dist/ui/RouterLink.d.ts +16 -0
- package/dist/ui/RouterLink.js +36 -0
- package/dist/ui/editor/Content.d.ts +3 -0
- package/dist/ui/editor/Content.js +13 -0
- package/dist/ui/editor/Provider.d.ts +17 -0
- package/dist/ui/editor/Provider.js +80 -0
- package/dist/ui/editor/Root.d.ts +2 -0
- package/dist/ui/editor/Root.js +18 -0
- package/dist/ui/editor/Toolbar.d.ts +5 -0
- package/dist/ui/editor/Toolbar.js +156 -0
- package/dist/ui/editor/index.d.ts +12 -0
- package/dist/ui/editor/index.js +11 -0
- package/dist/ui/editor/types.d.ts +7 -0
- package/dist/ui/editor/types.js +0 -0
- package/dist/ui/error/DefaultError.d.ts +2 -0
- package/dist/ui/error/DefaultError.js +62 -0
- package/dist/ui/error/DefaultNotFound.d.ts +1 -0
- package/dist/ui/error/DefaultNotFound.js +37 -0
- package/dist/ui/error/Forbidden.d.ts +1 -0
- package/dist/ui/error/Forbidden.js +32 -0
- package/dist/ui/error/defaultErrorNotification.d.ts +1 -0
- package/dist/ui/error/defaultErrorNotification.js +8 -0
- package/dist/ui/error/index.js +5 -0
- package/dist/ui/form/blurOnError.d.ts +4 -0
- package/dist/ui/form/blurOnError.js +11 -0
- package/dist/ui/form/buttons/CancelButton.d.ts +5 -0
- package/dist/ui/form/buttons/CancelButton.js +44 -0
- package/dist/ui/form/buttons/SubmitButton.d.ts +5 -0
- package/dist/ui/form/buttons/SubmitButton.js +47 -0
- package/dist/ui/form/buttons/SubscribeActionIcon.d.ts +4 -0
- package/dist/ui/form/buttons/SubscribeActionIcon.js +15 -0
- package/dist/ui/form/buttons/SubscribeButton.d.ts +5 -0
- package/dist/ui/form/buttons/SubscribeButton.js +16 -0
- package/dist/ui/form/buttons/index.js +4 -0
- package/dist/ui/form/context.d.ts +83 -0
- package/dist/ui/form/context.js +26 -0
- package/dist/ui/form/fields/JsonField.d.ts +2 -0
- package/dist/ui/form/fields/JsonField.js +13 -0
- package/dist/ui/form/fields/MultiSelectField.d.ts +2 -0
- package/dist/ui/form/fields/MultiSelectField.js +15 -0
- package/dist/ui/form/fields/NumberField.d.ts +2 -0
- package/dist/ui/form/fields/NumberField.js +15 -0
- package/dist/ui/form/fields/PassowrdField.d.ts +2 -0
- package/dist/ui/form/fields/PassowrdField.js +18 -0
- package/dist/ui/form/fields/SelectField.d.ts +2 -0
- package/dist/ui/form/fields/SelectField.js +15 -0
- package/dist/ui/form/fields/SwitchField.d.ts +2 -0
- package/dist/ui/form/fields/SwitchField.js +15 -0
- package/dist/ui/form/fields/TextField.d.ts +2 -0
- package/dist/ui/form/fields/TextField.js +15 -0
- package/dist/ui/form/fields/TextPassowrdField.d.ts +2 -0
- package/dist/ui/form/fields/TextPassowrdField.js +51 -0
- package/dist/ui/form/fields/TextareaField.d.ts +2 -0
- package/dist/ui/form/fields/TextareaField.js +15 -0
- package/dist/ui/form/fields/index.js +9 -0
- package/dist/ui/form/fieldsSchema.d.ts +12 -0
- package/dist/ui/form/fieldsSchema.js +13 -0
- package/dist/ui/form/index.js +4 -0
- package/dist/ui/hoverPaper/HoverPaper.d.ts +6 -0
- package/dist/ui/hoverPaper/HoverPaper.js +15 -0
- package/dist/ui/hoverPaper/index.js +3 -0
- package/dist/ui/hoverPaper/usePaperHover.d.ts +4 -0
- package/dist/ui/hoverPaper/usePaperHover.js +9 -0
- package/dist/ui/saveInput/JsonInput.d.ts +6 -0
- package/dist/ui/saveInput/JsonInput.js +34 -0
- package/dist/ui/saveInput/NumberInput.d.ts +6 -0
- package/dist/ui/saveInput/NumberInput.js +27 -0
- package/dist/ui/saveInput/SaveInput.d.ts +36 -0
- package/dist/ui/saveInput/SaveInput.js +15 -0
- package/dist/ui/saveInput/Select.d.ts +6 -0
- package/dist/ui/saveInput/Select.js +27 -0
- package/dist/ui/saveInput/Switch.d.ts +6 -0
- package/dist/ui/saveInput/Switch.js +30 -0
- package/dist/ui/saveInput/TextInput.d.ts +6 -0
- package/dist/ui/saveInput/TextInput.js +26 -0
- package/dist/ui/saveInput/Textarea.d.ts +6 -0
- package/dist/ui/saveInput/Textarea.js +26 -0
- package/dist/ui/saveInput/index.js +2 -0
- package/{src/ui/scrollArea/ScrollArea.tsx → dist/ui/scrollArea/ScrollArea.d.ts} +10 -41
- package/dist/ui/scrollArea/ScrollArea.js +30 -0
- package/dist/ui/scrollArea/ScrollAreaButton.d.ts +5 -0
- package/dist/ui/scrollArea/ScrollAreaButton.js +51 -0
- package/dist/ui/scrollArea/ScrollAreaContent.d.ts +6 -0
- package/dist/ui/scrollArea/ScrollAreaContent.js +29 -0
- package/{src/ui/scrollArea/context.tsx → dist/ui/scrollArea/context.d.ts} +3 -18
- package/dist/ui/scrollArea/context.js +10 -0
- package/dist/ui/scrollArea/index.d.ts +3 -0
- package/dist/ui/scrollArea/index.js +3 -0
- package/dist/ui/scrollArea/types.d.ts +65 -0
- package/dist/ui/scrollArea/types.js +0 -0
- package/dist/ui/scrollArea/useScrollArea.d.ts +9 -0
- package/dist/ui/scrollArea/useScrollArea.js +146 -0
- package/package.json +4 -1
- package/rslib.config.ts +0 -21
- package/src/ai/ui/conversation/ConversationContext.ts +0 -21
- package/src/ai/ui/conversation/ConversationProvider.tsx +0 -21
- package/src/ai/ui/conversation/Empty.tsx +0 -15
- package/src/ai/ui/conversation/File.tsx +0 -40
- package/src/ai/ui/conversation/FileIcon.tsx +0 -143
- package/src/ai/ui/conversation/Loader.tsx +0 -8
- package/src/ai/ui/conversation/Message.tsx +0 -34
- package/src/ai/ui/conversation/Root.tsx +0 -24
- package/src/ai/ui/conversation/index.ts +0 -16
- package/src/ai/ui/conversation/useChatMessage.ts +0 -13
- package/src/ai/ui/promptInput/File.tsx +0 -98
- package/src/ai/ui/promptInput/FileIcon.tsx +0 -149
- package/src/ai/ui/promptInput/Footer.tsx +0 -5
- package/src/ai/ui/promptInput/PromptInputContext.ts +0 -24
- package/src/ai/ui/promptInput/PromptInputProvider.tsx +0 -54
- package/src/ai/ui/promptInput/Root.tsx +0 -29
- package/src/ai/ui/promptInput/Submit.tsx +0 -39
- package/src/ai/ui/promptInput/Textarea.tsx +0 -39
- package/src/ai/ui/promptInput/index.ts +0 -15
- package/src/ai/ui/promptInput/types.ts +0 -9
- package/src/ai/utils/convertFileUIPartBlobToDataURL.ts +0 -29
- package/src/ai/utils/parseAiMessagePart.ts +0 -19
- package/src/app/AppDefaults.tsx +0 -21
- package/src/app/DefaultApp.tsx +0 -50
- package/src/app/cookieColorSchemeManager.ts +0 -70
- package/src/app/defaultRequestMiddlewares.ts +0 -22
- package/src/app/defaultTheme.ts +0 -22
- package/src/functions/getCookie.ts +0 -36
- package/src/functions/setCookie.ts +0 -29
- package/src/functions/setCookies.ts +0 -24
- package/src/hooks/useMutation.ts +0 -14
- package/src/hooks/useMutationWithInvalidate.ts +0 -23
- package/src/surreal/connection.ts +0 -72
- package/src/surreal/deafaultCrud.ts +0 -25
- package/src/surreal/deserialize.ts +0 -144
- package/src/surreal/encryption.ts +0 -51
- package/src/ui/AnimatedChevron.tsx +0 -32
- package/src/ui/JsonInput.tsx +0 -52
- package/src/ui/RouterLink.tsx +0 -78
- package/src/ui/editor/Content.tsx +0 -11
- package/src/ui/editor/Provider.tsx +0 -96
- package/src/ui/editor/Root.tsx +0 -25
- package/src/ui/editor/Toolbar.tsx +0 -92
- package/src/ui/editor/index.ts +0 -13
- package/src/ui/editor/types.ts +0 -7
- package/src/ui/error/DefaultError.tsx +0 -60
- package/src/ui/error/DefaultNotFound.tsx +0 -19
- package/src/ui/error/Forbidden.tsx +0 -18
- package/src/ui/error/defaultErrorNotification.ts +0 -9
- package/src/ui/form/blurOnError.ts +0 -21
- package/src/ui/form/buttons/CancelButton.tsx +0 -42
- package/src/ui/form/buttons/SubmitButton.tsx +0 -43
- package/src/ui/form/buttons/SubscribeActionIcon.tsx +0 -18
- package/src/ui/form/buttons/SubscribeButton.tsx +0 -17
- package/src/ui/form/context.ts +0 -45
- package/src/ui/form/fields/JsonField.tsx +0 -16
- package/src/ui/form/fields/MultiSelectField.tsx +0 -17
- package/src/ui/form/fields/NumberField.tsx +0 -17
- package/src/ui/form/fields/PassowrdField.tsx +0 -20
- package/src/ui/form/fields/SelectField.tsx +0 -17
- package/src/ui/form/fields/SwitchField.tsx +0 -17
- package/src/ui/form/fields/TextField.tsx +0 -17
- package/src/ui/form/fields/TextPassowrdField.tsx +0 -51
- package/src/ui/form/fields/TextareaField.tsx +0 -17
- package/src/ui/form/fieldsSchema.ts +0 -24
- package/src/ui/hoverPaper/HoverPaper.tsx +0 -17
- package/src/ui/hoverPaper/usePaperHover.ts +0 -9
- package/src/ui/saveInput/JsonInput.tsx +0 -40
- package/src/ui/saveInput/NumberInput.tsx +0 -40
- package/src/ui/saveInput/SaveInput.tsx +0 -15
- package/src/ui/saveInput/Select.tsx +0 -41
- package/src/ui/saveInput/Switch.tsx +0 -46
- package/src/ui/saveInput/TextInput.tsx +0 -40
- package/src/ui/saveInput/Textarea.tsx +0 -40
- package/src/ui/scrollArea/ARCH.md +0 -204
- package/src/ui/scrollArea/README.md +0 -369
- package/src/ui/scrollArea/ScrollAreaButton.tsx +0 -56
- package/src/ui/scrollArea/ScrollAreaContent.tsx +0 -36
- package/src/ui/scrollArea/index.ts +0 -10
- package/src/ui/scrollArea/types.ts +0 -77
- package/src/ui/scrollArea/useScrollArea.ts +0 -227
- package/tsconfig.json +0 -14
- /package/{src/ui/error/index.ts → dist/ui/error/index.d.ts} +0 -0
- /package/{src/ui/form/buttons/index.ts → dist/ui/form/buttons/index.d.ts} +0 -0
- /package/{src/ui/form/fields/index.ts → dist/ui/form/fields/index.d.ts} +0 -0
- /package/{src/ui/form/index.ts → dist/ui/form/index.d.ts} +0 -0
- /package/{src/ui/hoverPaper/index.ts → dist/ui/hoverPaper/index.d.ts} +0 -0
- /package/{src/ui/saveInput/index.ts → dist/ui/saveInput/index.d.ts} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
2
|
+
export declare const JsonInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
initialValue: string;
|
|
4
|
+
onChange: (value: string) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<ReactCodeMirrorProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Loader } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { JsonInput } from "../JsonInput.js";
|
|
6
|
+
const JsonInput_JsonInput = ({ initialValue, onChange, debounce = 300, ...props })=>{
|
|
7
|
+
const [value, setValue] = useState(initialValue);
|
|
8
|
+
const [loading, setLoading] = useState(false);
|
|
9
|
+
const handleSave = useDebouncedCallback(async (content)=>{
|
|
10
|
+
setLoading(true);
|
|
11
|
+
await onChange(content);
|
|
12
|
+
setLoading(false);
|
|
13
|
+
}, debounce);
|
|
14
|
+
return /*#__PURE__*/ jsxs(Box, {
|
|
15
|
+
pos: "relative",
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsx(JsonInput, {
|
|
18
|
+
value: value,
|
|
19
|
+
onChange: (e)=>{
|
|
20
|
+
setValue(e);
|
|
21
|
+
handleSave(e);
|
|
22
|
+
},
|
|
23
|
+
...props
|
|
24
|
+
}),
|
|
25
|
+
loading && /*#__PURE__*/ jsx(Loader, {
|
|
26
|
+
size: "sm",
|
|
27
|
+
pos: "absolute",
|
|
28
|
+
top: 8,
|
|
29
|
+
left: 8
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export { JsonInput_JsonInput as JsonInput };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type NumberInputProps } from '@mantine/core';
|
|
2
|
+
export declare const NumberInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
initialValue: string | number;
|
|
4
|
+
onChange: (value: string | number) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<NumberInputProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, NumberInput } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const NumberInput_NumberInput = ({ 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__*/ jsx(NumberInput, {
|
|
14
|
+
value: value,
|
|
15
|
+
onChange: (v)=>{
|
|
16
|
+
setValue(v);
|
|
17
|
+
handleSave(v);
|
|
18
|
+
},
|
|
19
|
+
flex: props.w ? void 0 : 1,
|
|
20
|
+
rightSection: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
21
|
+
size: "sm",
|
|
22
|
+
mr: 8
|
|
23
|
+
}) : void 0,
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export { NumberInput_NumberInput as NumberInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const SaveInput: (({ initialValue, onChange, debounce, ...props }: {
|
|
2
|
+
initialValue?: string;
|
|
3
|
+
onChange: (value: string) => Promise<void>;
|
|
4
|
+
debounce?: number;
|
|
5
|
+
} & Omit<import("@mantine/core").TextInputProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
+
TextInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
7
|
+
initialValue?: string;
|
|
8
|
+
onChange: (value: string) => Promise<void>;
|
|
9
|
+
debounce?: number;
|
|
10
|
+
} & Omit<import("@mantine/core").TextInputProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
NumberInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
12
|
+
initialValue: string | number;
|
|
13
|
+
onChange: (value: string | number) => Promise<void>;
|
|
14
|
+
debounce?: number;
|
|
15
|
+
} & Omit<import("@mantine/core").NumberInputProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Textarea: ({ initialValue, onChange, debounce, ...props }: {
|
|
17
|
+
initialValue: string;
|
|
18
|
+
onChange: (value: string) => Promise<void>;
|
|
19
|
+
debounce?: number;
|
|
20
|
+
} & Omit<import("@mantine/core").TextareaProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
Switch: ({ initialValue, onChange, debounce, w, ...props }: {
|
|
22
|
+
initialValue: boolean;
|
|
23
|
+
onChange: (value: boolean) => Promise<void>;
|
|
24
|
+
debounce?: number;
|
|
25
|
+
} & Omit<import("@mantine/core").SwitchProps, "checked" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
JsonInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
27
|
+
initialValue: string;
|
|
28
|
+
onChange: (value: string) => Promise<void>;
|
|
29
|
+
debounce?: number;
|
|
30
|
+
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
Select: ({ initialValue, onChange, debounce, ...props }: {
|
|
32
|
+
initialValue: string | null;
|
|
33
|
+
onChange: (value: string | null) => Promise<void>;
|
|
34
|
+
debounce?: number;
|
|
35
|
+
} & Omit<import("@mantine/core").SelectProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
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 };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SelectProps } from '@mantine/core';
|
|
2
|
+
export declare const Select: ({ initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
initialValue: string | null;
|
|
4
|
+
onChange: (value: string | null) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<SelectProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, Select } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const Select_Select = ({ 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__*/ jsx(Select, {
|
|
14
|
+
value: value,
|
|
15
|
+
onChange: (v)=>{
|
|
16
|
+
setValue(v);
|
|
17
|
+
handleSave(v);
|
|
18
|
+
},
|
|
19
|
+
flex: props.w ? void 0 : 1,
|
|
20
|
+
disabled: loading,
|
|
21
|
+
rightSection: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
22
|
+
size: "sm"
|
|
23
|
+
}) : void 0,
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export { Select_Select as Select };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SwitchProps } from '@mantine/core';
|
|
2
|
+
export declare const Switch: ({ initialValue, onChange, debounce, w, ...props }: {
|
|
3
|
+
initialValue: boolean;
|
|
4
|
+
onChange: (value: boolean) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<SwitchProps, "checked" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Loader, Switch } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const Switch_Switch = ({ initialValue, onChange, debounce = 300, w, ...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__*/ jsx(Box, {
|
|
14
|
+
flex: 1,
|
|
15
|
+
w: w,
|
|
16
|
+
children: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
17
|
+
size: "sm",
|
|
18
|
+
mt: 6.5,
|
|
19
|
+
ml: 8
|
|
20
|
+
}) : /*#__PURE__*/ jsx(Switch, {
|
|
21
|
+
checked: value,
|
|
22
|
+
onChange: (e)=>{
|
|
23
|
+
setValue(e.currentTarget.checked);
|
|
24
|
+
handleSave(e.currentTarget.checked);
|
|
25
|
+
},
|
|
26
|
+
...props
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export { Switch_Switch as Switch };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TextInputProps } from '@mantine/core';
|
|
2
|
+
export declare const TextInput: ({ initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
initialValue?: string;
|
|
4
|
+
onChange: (value: string) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<TextInputProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, TextInput } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const TextInput_TextInput = ({ 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__*/ jsx(TextInput, {
|
|
14
|
+
value: value,
|
|
15
|
+
onChange: (e)=>{
|
|
16
|
+
setValue(e.target.value);
|
|
17
|
+
handleSave(e.target.value);
|
|
18
|
+
},
|
|
19
|
+
flex: props.w ? void 0 : 1,
|
|
20
|
+
rightSection: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
21
|
+
size: "sm"
|
|
22
|
+
}) : void 0,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export { TextInput_TextInput as TextInput };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TextareaProps } from '@mantine/core';
|
|
2
|
+
export declare const Textarea: ({ initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
initialValue: string;
|
|
4
|
+
onChange: (value: string) => Promise<void>;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<TextareaProps, "value" | "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, Textarea } from "@mantine/core";
|
|
3
|
+
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const Textarea_Textarea = ({ 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__*/ jsx(Textarea, {
|
|
14
|
+
value: value,
|
|
15
|
+
onChange: (e)=>{
|
|
16
|
+
setValue(e.target.value);
|
|
17
|
+
handleSave(e.target.value);
|
|
18
|
+
},
|
|
19
|
+
flex: props.w ? void 0 : 1,
|
|
20
|
+
rightSection: loading ? /*#__PURE__*/ jsx(Loader, {
|
|
21
|
+
size: "sm"
|
|
22
|
+
}) : void 0,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export { Textarea_Textarea as Textarea };
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
import { ScrollAreaProvider } from './context';
|
|
2
|
-
import { ScrollAreaButton } from './ScrollAreaButton';
|
|
3
|
-
import { ScrollAreaContent } from './ScrollAreaContent';
|
|
4
1
|
import type { ScrollAreaContextValue, ScrollAreaProps } from './types';
|
|
5
|
-
import { useScrollAreaState } from './useScrollArea';
|
|
6
|
-
|
|
7
|
-
const ScrollAreaRoot = ({
|
|
8
|
-
children,
|
|
9
|
-
autoScroll = false,
|
|
10
|
-
scrollToBottomOnInit = false,
|
|
11
|
-
animated = true,
|
|
12
|
-
nearThreshold = 100,
|
|
13
|
-
radius,
|
|
14
|
-
...mantineProps
|
|
15
|
-
}: ScrollAreaProps) => {
|
|
16
|
-
const scrollAreaValue = useScrollAreaState({
|
|
17
|
-
autoScroll,
|
|
18
|
-
scrollToBottomOnInit,
|
|
19
|
-
animated,
|
|
20
|
-
nearThreshold,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Создаем контекст с mantineProps
|
|
24
|
-
const contextValue: ScrollAreaContextValue = {
|
|
25
|
-
...scrollAreaValue,
|
|
26
|
-
radius,
|
|
27
|
-
mantineProps,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<ScrollAreaProvider value={contextValue}>
|
|
32
|
-
<ScrollAreaContent>{children}</ScrollAreaContent>
|
|
33
|
-
</ScrollAreaProvider>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
ScrollAreaRoot.displayName = 'ScrollArea';
|
|
38
|
-
|
|
39
2
|
/**
|
|
40
3
|
* ScrollArea Component - Расширенная область прокрутки с автоскроллом
|
|
41
4
|
*
|
|
@@ -87,7 +50,13 @@ ScrollAreaRoot.displayName = 'ScrollArea';
|
|
|
87
50
|
* );
|
|
88
51
|
* }
|
|
89
52
|
*/
|
|
90
|
-
export const ScrollArea
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
53
|
+
export declare const ScrollArea: {
|
|
54
|
+
({ children, autoScroll, scrollToBottomOnInit, animated, nearThreshold, radius, ...mantineProps }: ScrollAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
} & {
|
|
57
|
+
ScrollButton: {
|
|
58
|
+
({ className }: import("./types").ScrollButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
61
|
+
Provider: import("react").Provider<ScrollAreaContextValue | null>;
|
|
62
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ScrollAreaProvider } from "./context.js";
|
|
3
|
+
import { ScrollAreaButton } from "./ScrollAreaButton.js";
|
|
4
|
+
import { ScrollAreaContent } from "./ScrollAreaContent.js";
|
|
5
|
+
import { useScrollAreaState } from "./useScrollArea.js";
|
|
6
|
+
const ScrollAreaRoot = ({ children, autoScroll = false, scrollToBottomOnInit = false, animated = true, nearThreshold = 100, radius, ...mantineProps })=>{
|
|
7
|
+
const scrollAreaValue = useScrollAreaState({
|
|
8
|
+
autoScroll,
|
|
9
|
+
scrollToBottomOnInit,
|
|
10
|
+
animated,
|
|
11
|
+
nearThreshold
|
|
12
|
+
});
|
|
13
|
+
const contextValue = {
|
|
14
|
+
...scrollAreaValue,
|
|
15
|
+
radius,
|
|
16
|
+
mantineProps
|
|
17
|
+
};
|
|
18
|
+
return /*#__PURE__*/ jsx(ScrollAreaProvider, {
|
|
19
|
+
value: contextValue,
|
|
20
|
+
children: /*#__PURE__*/ jsx(ScrollAreaContent, {
|
|
21
|
+
children: children
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
ScrollAreaRoot.displayName = 'ScrollArea';
|
|
26
|
+
const ScrollArea = Object.assign(ScrollAreaRoot, {
|
|
27
|
+
ScrollButton: ScrollAreaButton,
|
|
28
|
+
Provider: ScrollAreaProvider
|
|
29
|
+
});
|
|
30
|
+
export { ScrollArea };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon } from "@mantine/core";
|
|
3
|
+
import { useScrollArea } from "./context.js";
|
|
4
|
+
const ScrollAreaButton = ({ className })=>{
|
|
5
|
+
const { hasScrollableContent, isAboveCenter, scrollToTop, scrollToBottom } = useScrollArea();
|
|
6
|
+
if (!hasScrollableContent) return null;
|
|
7
|
+
const isScrollingDown = isAboveCenter;
|
|
8
|
+
const icon = /*#__PURE__*/ jsxs("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: "1.5",
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
role: "img",
|
|
19
|
+
"aria-label": "Chevron",
|
|
20
|
+
style: {
|
|
21
|
+
transition: 'transform 0.2s ease-in-out',
|
|
22
|
+
transform: isScrollingDown ? 'rotate(-180deg)' : 'rotate(0deg)'
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ jsx("path", {
|
|
26
|
+
stroke: "none",
|
|
27
|
+
d: "M0 0h24v24H0z",
|
|
28
|
+
fill: "none"
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx("path", {
|
|
31
|
+
d: "M6 9l6 6l6 -6"
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
const handleClick = ()=>{
|
|
36
|
+
if (isScrollingDown) scrollToBottom();
|
|
37
|
+
else scrollToTop();
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
40
|
+
pos: "absolute",
|
|
41
|
+
bottom: 16,
|
|
42
|
+
right: 16,
|
|
43
|
+
variant: "light",
|
|
44
|
+
onClick: handleClick,
|
|
45
|
+
className: className,
|
|
46
|
+
"aria-label": isScrollingDown ? 'Scroll to bottom' : 'Scroll to top',
|
|
47
|
+
children: icon
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
ScrollAreaButton.displayName = 'ScrollArea.ScrollButton';
|
|
51
|
+
export { ScrollAreaButton };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, ScrollArea, getRadius } from "@mantine/core";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { ScrollAreaContext } from "./context.js";
|
|
5
|
+
const ScrollAreaContent = ({ children })=>{
|
|
6
|
+
const fullContext = useContext(ScrollAreaContext);
|
|
7
|
+
if (!fullContext) throw new Error('ScrollAreaContent must be used within ScrollArea');
|
|
8
|
+
const { _callbackRef, mantineProps, radius, _contentResizeRef } = fullContext;
|
|
9
|
+
return /*#__PURE__*/ jsx(ScrollArea, {
|
|
10
|
+
classNames: {
|
|
11
|
+
viewport: 'rolder-scroll-area-viewport',
|
|
12
|
+
content: 'rolder-scroll-area-content',
|
|
13
|
+
scrollbar: 'rolder-scroll-area-scrollbar'
|
|
14
|
+
},
|
|
15
|
+
style: {
|
|
16
|
+
'--radius': radius ? getRadius(radius) : void 0
|
|
17
|
+
},
|
|
18
|
+
...mantineProps,
|
|
19
|
+
viewportRef: _callbackRef,
|
|
20
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
21
|
+
h: "100%",
|
|
22
|
+
w: "100%",
|
|
23
|
+
ref: _contentResizeRef,
|
|
24
|
+
children: children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
ScrollAreaContent.displayName = 'ScrollArea.Content';
|
|
29
|
+
export { ScrollAreaContent };
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
1
|
import type { ScrollAreaContextValue, ScrollAreaHook } from './types';
|
|
3
|
-
|
|
4
2
|
/** Внутренний контекст для передачи состояния ScrollArea */
|
|
5
|
-
export const ScrollAreaContext
|
|
6
|
-
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
export const ScrollAreaProvider = ScrollAreaContext.Provider;
|
|
10
|
-
|
|
3
|
+
export declare const ScrollAreaContext: import("react").Context<ScrollAreaContextValue | null>;
|
|
4
|
+
export declare const ScrollAreaProvider: import("react").Provider<ScrollAreaContextValue | null>;
|
|
11
5
|
/**
|
|
12
6
|
* Хук для доступа к состоянию и методам ScrollArea
|
|
13
7
|
*
|
|
@@ -31,13 +25,4 @@ export const ScrollAreaProvider = ScrollAreaContext.Provider;
|
|
|
31
25
|
* }
|
|
32
26
|
* ```
|
|
33
27
|
*/
|
|
34
|
-
export const useScrollArea
|
|
35
|
-
const context = useContext(ScrollAreaContext);
|
|
36
|
-
if (!context) {
|
|
37
|
-
throw new Error('useScrollArea must be used within ScrollArea');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Возвращаем только публичный API, скрывая внутренние детали
|
|
41
|
-
const { _callbackRef, mantineProps: _, radius: __, ...publicAPI } = context;
|
|
42
|
-
return publicAPI;
|
|
43
|
-
};
|
|
28
|
+
export declare const useScrollArea: () => ScrollAreaHook;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const ScrollAreaContext = /*#__PURE__*/ createContext(null);
|
|
3
|
+
const ScrollAreaProvider = ScrollAreaContext.Provider;
|
|
4
|
+
const useScrollArea = ()=>{
|
|
5
|
+
const context = useContext(ScrollAreaContext);
|
|
6
|
+
if (!context) throw new Error('useScrollArea must be used within ScrollArea');
|
|
7
|
+
const { _callbackRef, mantineProps: _, radius: __, ...publicAPI } = context;
|
|
8
|
+
return publicAPI;
|
|
9
|
+
};
|
|
10
|
+
export { ScrollAreaContext, ScrollAreaProvider, useScrollArea };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { MantineRadius, ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export interface ScrollAreaProps extends Omit<MantineScrollAreaProps, 'children'> {
|
|
4
|
+
/** Включение автоскролла при добавлении контента (по умолчанию false) */
|
|
5
|
+
autoScroll?: boolean;
|
|
6
|
+
/** Прокрутить к концу при инициализации компонента (по умолчанию false) */
|
|
7
|
+
scrollToBottomOnInit?: boolean;
|
|
8
|
+
/** Анимированная прокрутка (по умолчанию true) */
|
|
9
|
+
animated?: boolean;
|
|
10
|
+
/** Отступ для near-зон в пикселях (по умолчанию 100) */
|
|
11
|
+
nearThreshold?: number;
|
|
12
|
+
/** Радиус для viewport и scrollbar на тот случай, когда они "торчат" углами*/
|
|
13
|
+
radius?: MantineRadius;
|
|
14
|
+
/** Дочерние элементы - автоматически оборачиваются в ScrollArea.Content */
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface ScrollAreaHook {
|
|
18
|
+
/** Точно в начале (scrollTop === 0) */
|
|
19
|
+
isAtTop: boolean;
|
|
20
|
+
/** В пределах nearThreshold от начала */
|
|
21
|
+
isNearTop: boolean;
|
|
22
|
+
/** Точно в конце (scrollTop + clientHeight >= scrollHeight) */
|
|
23
|
+
isAtBottom: boolean;
|
|
24
|
+
/** В пределах nearThreshold от конца */
|
|
25
|
+
isNearBottom: boolean;
|
|
26
|
+
/** Выше центральной точки области прокрутки */
|
|
27
|
+
isAboveCenter: boolean;
|
|
28
|
+
/** Есть контент требующий прокрутки */
|
|
29
|
+
hasScrollableContent: boolean;
|
|
30
|
+
/** Прокрутить к началу области */
|
|
31
|
+
scrollToTop: (animated?: boolean) => void;
|
|
32
|
+
/** Прокрутить к концу области */
|
|
33
|
+
scrollToBottom: (animated?: boolean) => void;
|
|
34
|
+
/** React ref на viewport элемент для прямого доступа к DOM */
|
|
35
|
+
viewportRef: React.RefObject<HTMLDivElement | null>;
|
|
36
|
+
}
|
|
37
|
+
export interface ScrollAreaState extends ScrollAreaHook {
|
|
38
|
+
/** Внутренний callback ref для подключения к Mantine ScrollArea */
|
|
39
|
+
_callbackRef: (node: HTMLDivElement | null) => void;
|
|
40
|
+
/** Внутренний ref для наблюдения за изменениями контента */
|
|
41
|
+
_contentResizeRef: (node: HTMLDivElement | null) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface ScrollAreaContextValue extends ScrollAreaState {
|
|
44
|
+
/** Радиус для viewport и scrollbar на тот случай, когда они "торчат" углами*/
|
|
45
|
+
radius?: MantineRadius;
|
|
46
|
+
/** Пропсы Mantine ScrollArea, переданные в корневой компонент */
|
|
47
|
+
mantineProps: Omit<MantineScrollAreaProps, 'children'>;
|
|
48
|
+
}
|
|
49
|
+
export interface ScrollButtonProps {
|
|
50
|
+
/** CSS классы для стилизации кнопки */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** Иконка для прокрутки вверх (по умолчанию IconChevronUp) */
|
|
53
|
+
upIcon?: ReactNode;
|
|
54
|
+
/** Иконка для прокрутки вниз (по умолчанию IconChevronDown) */
|
|
55
|
+
downIcon?: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/** Внутренний тип для отслеживания позиции скролла */
|
|
58
|
+
export interface ScrollPosition {
|
|
59
|
+
/** Текущая позиция скролла сверху */
|
|
60
|
+
scrollTop: number;
|
|
61
|
+
/** Высота видимой области */
|
|
62
|
+
clientHeight: number;
|
|
63
|
+
/** Общая высота прокручиваемого контента */
|
|
64
|
+
scrollHeight: number;
|
|
65
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScrollAreaState } from './types';
|
|
2
|
+
interface UseScrollAreaOptions {
|
|
3
|
+
autoScroll?: boolean;
|
|
4
|
+
scrollToBottomOnInit?: boolean;
|
|
5
|
+
animated?: boolean;
|
|
6
|
+
nearThreshold?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const useScrollAreaState: (options?: UseScrollAreaOptions) => ScrollAreaState;
|
|
9
|
+
export {};
|