@rolder/kit 3.0.0-alpha-9 → 3.0.0-alpha-10
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/package.json +1 -1
- package/dist/ai/index.js +0 -2
- package/dist/ai/ui/conversation/ConversationContext.js +0 -8
- package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
- package/dist/ai/ui/conversation/Empty.js +0 -21
- package/dist/ai/ui/conversation/File.js +0 -42
- package/dist/ai/ui/conversation/FileIcon.js +0 -43
- package/dist/ai/ui/conversation/Loader.js +0 -12
- package/dist/ai/ui/conversation/Message.js +0 -25
- package/dist/ai/ui/conversation/Root.js +0 -26
- package/dist/ai/ui/conversation/index.js +0 -15
- package/dist/ai/ui/conversation/types.js +0 -0
- package/dist/ai/ui/conversation/useChatMessage.js +0 -12
- package/dist/ai/ui/index.js +0 -2
- package/dist/ai/ui/promptInput/File.js +0 -69
- package/dist/ai/ui/promptInput/FileIcon.js +0 -43
- package/dist/ai/ui/promptInput/Footer.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
- package/dist/ai/ui/promptInput/Root.js +0 -18
- package/dist/ai/ui/promptInput/Submit.js +0 -21
- package/dist/ai/ui/promptInput/Textarea.js +0 -34
- package/dist/ai/ui/promptInput/index.js +0 -14
- package/dist/ai/ui/promptInput/styles.module.js +0 -7
- package/dist/ai/ui/promptInput/styles_module.css +0 -24
- package/dist/ai/ui/promptInput/types.js +0 -0
- package/dist/ai/utils/convertFileUIPartBlobToDataURL.js +0 -21
- package/dist/ai/utils/index.js +0 -2
- package/dist/ai/utils/parseAiMessagePart.js +0 -12
- package/dist/app/AppDefaults.js +0 -27
- package/dist/app/DefaultApp.js +0 -43
- package/dist/app/cookieColorSchemeManager.js +0 -46
- package/dist/app/defaultRequestMiddlewares.js +0 -24
- package/dist/app/defaultTheme.js +0 -24
- package/dist/app/index.js +0 -3
- package/dist/functions/cookies/getCookie.js +0 -8
- package/dist/functions/cookies/index.js +0 -3
- package/dist/functions/cookies/setCookie.js +0 -19
- package/dist/functions/cookies/setCookies.js +0 -13
- package/dist/functions/index.js +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/useMutation.js +0 -8
- package/dist/hooks/useMutationWithInvalidate.js +0 -16
- package/dist/surreal/connection.js +0 -49
- package/dist/surreal/deafaultCrud.js +0 -18
- package/dist/surreal/deserialize.js +0 -46
- package/dist/surreal/encryption.js +0 -30
- package/dist/surreal/index.js +0 -5
- package/dist/ui/AnimatedChevron.js +0 -13
- package/dist/ui/JsonInput.js +0 -45
- package/dist/ui/editor/Content.js +0 -13
- package/dist/ui/editor/Provider.js +0 -80
- package/dist/ui/editor/Root.js +0 -19
- package/dist/ui/editor/Toolbar.js +0 -138
- package/dist/ui/editor/index.js +0 -11
- package/dist/ui/editor/styles.module.js +0 -7
- package/dist/ui/editor/styles_module.css +0 -16
- package/dist/ui/editor/types.js +0 -0
- package/dist/ui/error/DefaultError.js +0 -62
- package/dist/ui/error/DefaultNotFound.js +0 -37
- package/dist/ui/error/Forbidden.js +0 -32
- package/dist/ui/error/defaultErrorNotification.js +0 -8
- package/dist/ui/error/index.js +0 -4
- package/dist/ui/form/blurOnError.js +0 -11
- package/dist/ui/form/buttons/CancelButton.js +0 -22
- package/dist/ui/form/buttons/SubmitButton.js +0 -22
- package/dist/ui/form/buttons/SubscribeActionIcon.js +0 -15
- package/dist/ui/form/buttons/SubscribeButton.js +0 -16
- package/dist/ui/form/buttons/index.js +0 -4
- package/dist/ui/form/context.js +0 -26
- package/dist/ui/form/fields/JsonField.js +0 -13
- package/dist/ui/form/fields/MultiSelectField.js +0 -15
- package/dist/ui/form/fields/NumberField.js +0 -15
- package/dist/ui/form/fields/PassowrdField.js +0 -18
- package/dist/ui/form/fields/SelectField.js +0 -15
- package/dist/ui/form/fields/SwitchField.js +0 -15
- package/dist/ui/form/fields/TextField.js +0 -15
- package/dist/ui/form/fields/TextPassowrdField.js +0 -29
- package/dist/ui/form/fields/TextareaField.js +0 -15
- package/dist/ui/form/fields/index.js +0 -9
- package/dist/ui/form/fieldsSchema.js +0 -13
- package/dist/ui/form/index.js +0 -4
- package/dist/ui/hoverPaper/HoverPaper.js +0 -16
- package/dist/ui/hoverPaper/index.js +0 -2
- package/dist/ui/hoverPaper/styles.module.js +0 -5
- package/dist/ui/hoverPaper/styles_module.css +0 -15
- package/dist/ui/hoverPaper/usePaperHover.js +0 -9
- package/dist/ui/index.js +0 -9
- package/dist/ui/routerLink/RouterLink.js +0 -37
- package/dist/ui/routerLink/index.js +0 -1
- package/dist/ui/routerLink/styles.module.js +0 -5
- package/dist/ui/routerLink/styles_module.css +0 -5
- package/dist/ui/saveInput/JsonInput.js +0 -34
- package/dist/ui/saveInput/NumberInput.js +0 -27
- package/dist/ui/saveInput/SaveInput.js +0 -15
- package/dist/ui/saveInput/Select.js +0 -27
- package/dist/ui/saveInput/Switch.js +0 -30
- package/dist/ui/saveInput/TextInput.js +0 -26
- package/dist/ui/saveInput/Textarea.js +0 -26
- package/dist/ui/saveInput/index.js +0 -2
- package/dist/ui/scrollArea/ScrollArea.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaButton.js +0 -30
- package/dist/ui/scrollArea/ScrollAreaContent.js +0 -30
- package/dist/ui/scrollArea/context.js +0 -10
- package/dist/ui/scrollArea/index.js +0 -3
- package/dist/ui/scrollArea/styles.module.js +0 -7
- package/dist/ui/scrollArea/styles_module.css +0 -14
- package/dist/ui/scrollArea/types.js +0 -0
- package/dist/ui/scrollArea/useScrollArea.js +0 -146
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Loader } from "@mantine/core";
|
|
3
|
-
import { RichTextEditor } from "@mantine/tiptap";
|
|
4
|
-
import { IconCheck } from "@tabler/icons-react";
|
|
5
|
-
import { useEditor } from "./Provider.js";
|
|
6
|
-
const Toolbar = ({ saving, children })=>{
|
|
7
|
-
const { editor, disabledToolbar } = useEditor();
|
|
8
|
-
return disabledToolbar ? null : /*#__PURE__*/ jsxs(RichTextEditor.Toolbar, {
|
|
9
|
-
sticky: true,
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
12
|
-
children: [
|
|
13
|
-
/*#__PURE__*/ jsx(RichTextEditor.Bold, {
|
|
14
|
-
disabled: !editor?.isEditable
|
|
15
|
-
}),
|
|
16
|
-
/*#__PURE__*/ jsx(RichTextEditor.Italic, {
|
|
17
|
-
disabled: !editor?.isEditable
|
|
18
|
-
}),
|
|
19
|
-
/*#__PURE__*/ jsx(RichTextEditor.Underline, {
|
|
20
|
-
disabled: !editor?.isEditable
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ jsx(RichTextEditor.Strikethrough, {
|
|
23
|
-
disabled: !editor?.isEditable
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsx(RichTextEditor.ClearFormatting, {
|
|
26
|
-
disabled: !editor?.isEditable
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ jsx(RichTextEditor.Highlight, {
|
|
29
|
-
disabled: !editor?.isEditable
|
|
30
|
-
}),
|
|
31
|
-
/*#__PURE__*/ jsx(RichTextEditor.Code, {
|
|
32
|
-
disabled: !editor?.isEditable
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
37
|
-
children: [
|
|
38
|
-
/*#__PURE__*/ jsx(RichTextEditor.H1, {
|
|
39
|
-
disabled: !editor?.isEditable
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ jsx(RichTextEditor.H2, {
|
|
42
|
-
disabled: !editor?.isEditable
|
|
43
|
-
}),
|
|
44
|
-
/*#__PURE__*/ jsx(RichTextEditor.H3, {
|
|
45
|
-
disabled: !editor?.isEditable
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ jsx(RichTextEditor.H4, {
|
|
48
|
-
disabled: !editor?.isEditable
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
}),
|
|
52
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
53
|
-
children: [
|
|
54
|
-
/*#__PURE__*/ jsx(RichTextEditor.Blockquote, {
|
|
55
|
-
disabled: !editor?.isEditable
|
|
56
|
-
}),
|
|
57
|
-
/*#__PURE__*/ jsx(RichTextEditor.Hr, {
|
|
58
|
-
disabled: !editor?.isEditable
|
|
59
|
-
}),
|
|
60
|
-
/*#__PURE__*/ jsx(RichTextEditor.BulletList, {
|
|
61
|
-
disabled: !editor?.isEditable
|
|
62
|
-
}),
|
|
63
|
-
/*#__PURE__*/ jsx(RichTextEditor.OrderedList, {
|
|
64
|
-
disabled: !editor?.isEditable
|
|
65
|
-
})
|
|
66
|
-
]
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
69
|
-
children: [
|
|
70
|
-
/*#__PURE__*/ jsx(RichTextEditor.TaskList, {
|
|
71
|
-
disabled: !editor?.isEditable
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ jsx(RichTextEditor.TaskListLift, {
|
|
74
|
-
disabled: !editor?.isEditable
|
|
75
|
-
}),
|
|
76
|
-
/*#__PURE__*/ jsx(RichTextEditor.TaskListSink, {
|
|
77
|
-
disabled: !editor?.isEditable
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
}),
|
|
81
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
82
|
-
children: [
|
|
83
|
-
/*#__PURE__*/ jsx(RichTextEditor.Link, {
|
|
84
|
-
disabled: !editor?.isEditable
|
|
85
|
-
}),
|
|
86
|
-
/*#__PURE__*/ jsx(RichTextEditor.Unlink, {
|
|
87
|
-
disabled: !editor?.isEditable
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
}),
|
|
91
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
92
|
-
children: [
|
|
93
|
-
/*#__PURE__*/ jsx(RichTextEditor.AlignLeft, {
|
|
94
|
-
disabled: !editor?.isEditable
|
|
95
|
-
}),
|
|
96
|
-
/*#__PURE__*/ jsx(RichTextEditor.AlignCenter, {
|
|
97
|
-
disabled: !editor?.isEditable
|
|
98
|
-
}),
|
|
99
|
-
/*#__PURE__*/ jsx(RichTextEditor.AlignJustify, {
|
|
100
|
-
disabled: !editor?.isEditable
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ jsx(RichTextEditor.AlignRight, {
|
|
103
|
-
disabled: !editor?.isEditable
|
|
104
|
-
})
|
|
105
|
-
]
|
|
106
|
-
}),
|
|
107
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
108
|
-
children: [
|
|
109
|
-
/*#__PURE__*/ jsx(RichTextEditor.Undo, {
|
|
110
|
-
disabled: !editor?.isEditable
|
|
111
|
-
}),
|
|
112
|
-
/*#__PURE__*/ jsx(RichTextEditor.Redo, {
|
|
113
|
-
disabled: !editor?.isEditable
|
|
114
|
-
})
|
|
115
|
-
]
|
|
116
|
-
}),
|
|
117
|
-
/*#__PURE__*/ jsxs(RichTextEditor.ControlsGroup, {
|
|
118
|
-
ml: "auto",
|
|
119
|
-
children: [
|
|
120
|
-
children,
|
|
121
|
-
/*#__PURE__*/ jsx(RichTextEditor.Control, {
|
|
122
|
-
ml: "10px",
|
|
123
|
-
style: {
|
|
124
|
-
cursor: 'default'
|
|
125
|
-
},
|
|
126
|
-
children: saving ? /*#__PURE__*/ jsx(Loader, {
|
|
127
|
-
size: 14
|
|
128
|
-
}) : /*#__PURE__*/ jsx(IconCheck, {
|
|
129
|
-
stroke: 1.5,
|
|
130
|
-
size: 16
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
]
|
|
134
|
-
})
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
export { Toolbar };
|
package/dist/ui/editor/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Content } from "./Content.js";
|
|
2
|
-
import { Provider, useEditor } from "./Provider.js";
|
|
3
|
-
import { Root } from "./Root.js";
|
|
4
|
-
import { Toolbar } from "./Toolbar.js";
|
|
5
|
-
const Editor = {
|
|
6
|
-
Root: Root,
|
|
7
|
-
Content: Content,
|
|
8
|
-
Toolbar: Toolbar,
|
|
9
|
-
Provider: Provider
|
|
10
|
-
};
|
|
11
|
-
export { Editor, useEditor };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.root-OYYJgs {
|
|
2
|
-
--editor-border-color: light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
|
|
3
|
-
border: rem(1px) solid var(--editor-border-color);
|
|
4
|
-
border-radius: var(--mantine-radius-md);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.content-b5nnhz {
|
|
8
|
-
border-radius: var(--mantine-radius-md);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.toolbar-RksEGD {
|
|
12
|
-
border-color: var(--editor-border-color);
|
|
13
|
-
border-top-left-radius: var(--mantine-radius-md);
|
|
14
|
-
border-top-right-radius: var(--mantine-radius-md);
|
|
15
|
-
}
|
|
16
|
-
|
package/dist/ui/editor/types.js
DELETED
|
File without changes
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Group, Stack, Title } from "@mantine/core";
|
|
3
|
-
import { rootRouteId, useMatch, useRouter } from "@tanstack/react-router";
|
|
4
|
-
import { RouterLink } from "../routerLink/index.js";
|
|
5
|
-
const DefaultError = ({ error })=>{
|
|
6
|
-
const router = useRouter();
|
|
7
|
-
const isRoot = useMatch({
|
|
8
|
-
strict: false,
|
|
9
|
-
select: (state)=>state.id === rootRouteId
|
|
10
|
-
});
|
|
11
|
-
return /*#__PURE__*/ jsxs(Stack, {
|
|
12
|
-
align: "center",
|
|
13
|
-
justify: "center",
|
|
14
|
-
gap: 0,
|
|
15
|
-
ta: "center",
|
|
16
|
-
h: "100vh",
|
|
17
|
-
children: [
|
|
18
|
-
/*#__PURE__*/ jsx(Title, {
|
|
19
|
-
textWrap: "balance",
|
|
20
|
-
size: 65,
|
|
21
|
-
children: "Произошла ошибка!"
|
|
22
|
-
}),
|
|
23
|
-
error.message && /*#__PURE__*/ jsx(Title, {
|
|
24
|
-
order: 3,
|
|
25
|
-
ml: 4,
|
|
26
|
-
textWrap: "balance",
|
|
27
|
-
c: "var(--mantine-color-error)",
|
|
28
|
-
children: error.message
|
|
29
|
-
}),
|
|
30
|
-
/*#__PURE__*/ jsxs(Group, {
|
|
31
|
-
children: [
|
|
32
|
-
/*#__PURE__*/ jsx(Button, {
|
|
33
|
-
mt: "xl",
|
|
34
|
-
size: "lg",
|
|
35
|
-
variant: "light",
|
|
36
|
-
onClick: ()=>{
|
|
37
|
-
router.invalidate();
|
|
38
|
-
},
|
|
39
|
-
children: "Попробовать еще раз"
|
|
40
|
-
}),
|
|
41
|
-
isRoot ? /*#__PURE__*/ jsx(RouterLink.Button, {
|
|
42
|
-
to: "/",
|
|
43
|
-
mt: "xl",
|
|
44
|
-
size: "lg",
|
|
45
|
-
radius: "md",
|
|
46
|
-
children: "На главную"
|
|
47
|
-
}) : /*#__PURE__*/ jsx(Button, {
|
|
48
|
-
mt: "xl",
|
|
49
|
-
radius: "md",
|
|
50
|
-
size: "lg",
|
|
51
|
-
onClick: (e)=>{
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
router.history.back();
|
|
54
|
-
},
|
|
55
|
-
children: "Назад"
|
|
56
|
-
})
|
|
57
|
-
]
|
|
58
|
-
})
|
|
59
|
-
]
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
export { DefaultError };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Stack, Text, Title } from "@mantine/core";
|
|
3
|
-
import { RouterLink } from "../routerLink/index.js";
|
|
4
|
-
const DefaultNotFound = ()=>/*#__PURE__*/ jsxs(Stack, {
|
|
5
|
-
align: "center",
|
|
6
|
-
justify: "center",
|
|
7
|
-
gap: 0,
|
|
8
|
-
ta: "center",
|
|
9
|
-
h: "100vh",
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ jsx(Text, {
|
|
12
|
-
c: "dimmed",
|
|
13
|
-
fw: "bold",
|
|
14
|
-
children: "404"
|
|
15
|
-
}),
|
|
16
|
-
/*#__PURE__*/ jsx(Title, {
|
|
17
|
-
textWrap: "balance",
|
|
18
|
-
size: 65,
|
|
19
|
-
children: "Страница не найдена"
|
|
20
|
-
}),
|
|
21
|
-
/*#__PURE__*/ jsx(Title, {
|
|
22
|
-
order: 3,
|
|
23
|
-
ml: 4,
|
|
24
|
-
textWrap: "balance",
|
|
25
|
-
c: "dimmed",
|
|
26
|
-
children: "Извините, но здесь нет страницы. Возможно она перемещена."
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ jsx(RouterLink.Button, {
|
|
29
|
-
to: "/",
|
|
30
|
-
mt: "xl",
|
|
31
|
-
size: "lg",
|
|
32
|
-
radius: "md",
|
|
33
|
-
children: "На главную"
|
|
34
|
-
})
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
export { DefaultNotFound };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Stack, Title } from "@mantine/core";
|
|
3
|
-
import { RouterLink } from "../routerLink/index.js";
|
|
4
|
-
const Forbidden = ()=>/*#__PURE__*/ jsxs(Stack, {
|
|
5
|
-
align: "center",
|
|
6
|
-
justify: "center",
|
|
7
|
-
gap: 0,
|
|
8
|
-
ta: "center",
|
|
9
|
-
h: "100vh",
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ jsx(Title, {
|
|
12
|
-
textWrap: "balance",
|
|
13
|
-
size: 65,
|
|
14
|
-
children: "Доступ запрещен!"
|
|
15
|
-
}),
|
|
16
|
-
/*#__PURE__*/ jsx(Title, {
|
|
17
|
-
order: 3,
|
|
18
|
-
ml: 4,
|
|
19
|
-
textWrap: "balance",
|
|
20
|
-
c: "var(--mantine-color-error)",
|
|
21
|
-
children: "У вас нет доступа к этой странице"
|
|
22
|
-
}),
|
|
23
|
-
/*#__PURE__*/ jsx(RouterLink.Button, {
|
|
24
|
-
to: "/",
|
|
25
|
-
mt: "xl",
|
|
26
|
-
size: "lg",
|
|
27
|
-
radius: "md",
|
|
28
|
-
children: "На главную"
|
|
29
|
-
})
|
|
30
|
-
]
|
|
31
|
-
});
|
|
32
|
-
export { Forbidden };
|
package/dist/ui/error/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const blurOnError = ({ formApi })=>{
|
|
2
|
-
const inputNames = Array.from(new Set(Object.keys(formApi.state.fieldMeta).filter((i)=>formApi.state.fieldMeta[i]?.errors.length)));
|
|
3
|
-
for (const inputName of inputNames){
|
|
4
|
-
const input = document.querySelector(`#form input[name="${inputName}"]`);
|
|
5
|
-
if (input) {
|
|
6
|
-
input.focus();
|
|
7
|
-
break;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
export { blurOnError };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "@mantine/core";
|
|
3
|
-
import { IconCancel } from "@tabler/icons-react";
|
|
4
|
-
import { useFormContext } from "../context.js";
|
|
5
|
-
const CancelButton = (props)=>{
|
|
6
|
-
const form = useFormContext();
|
|
7
|
-
return /*#__PURE__*/ jsx(form.Subscribe, {
|
|
8
|
-
selector: (state)=>state.isSubmitting,
|
|
9
|
-
children: (isSubmitting)=>/*#__PURE__*/ jsx(Button, {
|
|
10
|
-
type: "reset",
|
|
11
|
-
size: "xs",
|
|
12
|
-
variant: "light",
|
|
13
|
-
leftSection: /*#__PURE__*/ jsx(IconCancel, {
|
|
14
|
-
size: 16
|
|
15
|
-
}),
|
|
16
|
-
disabled: isSubmitting,
|
|
17
|
-
...props,
|
|
18
|
-
children: props.label || 'Отмена'
|
|
19
|
-
})
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
export { CancelButton };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "@mantine/core";
|
|
3
|
-
import { IconDeviceFloppy } from "@tabler/icons-react";
|
|
4
|
-
import { useFormContext } from "../context.js";
|
|
5
|
-
const SubmitButton = (props)=>{
|
|
6
|
-
const form = useFormContext();
|
|
7
|
-
return /*#__PURE__*/ jsx(form.Subscribe, {
|
|
8
|
-
selector: (state)=>state,
|
|
9
|
-
children: (state)=>/*#__PURE__*/ jsx(Button, {
|
|
10
|
-
type: "submit",
|
|
11
|
-
size: "xs",
|
|
12
|
-
leftSection: /*#__PURE__*/ jsx(IconDeviceFloppy, {
|
|
13
|
-
size: 20
|
|
14
|
-
}),
|
|
15
|
-
loading: state.isSubmitting,
|
|
16
|
-
disabled: !state.isDirty,
|
|
17
|
-
...props,
|
|
18
|
-
children: props.label || 'Сохранить'
|
|
19
|
-
})
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
export { SubmitButton };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ActionIcon } from "@mantine/core";
|
|
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 };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "@mantine/core";
|
|
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 };
|
package/dist/ui/form/context.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
|
|
2
|
-
import { CancelButton, SubmitButton, SubscribeActionIcon, SubscribeButton } from "./buttons/index.js";
|
|
3
|
-
import { JsonField, MultiSelectField, NumberField, PassowrdField, SelectField, SwitchField, TextField, TextPassowrdField, 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
|
-
TextPassowrdField: TextPassowrdField,
|
|
11
|
-
PassowrdField: PassowrdField,
|
|
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 };
|
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { MultiSelect } from "@mantine/core";
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { NumberInput } from "@mantine/core";
|
|
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 };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PasswordInput } from "@mantine/core";
|
|
3
|
-
import { useFieldContext } from "../context.js";
|
|
4
|
-
const PassowrdField = (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 { PassowrdField };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Select } from "@mantine/core";
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Switch } from "@mantine/core";
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TextInput } from "@mantine/core";
|
|
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 };
|
|
@@ -1,29 +0,0 @@
|
|
|
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 TextPassowrdField = (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 { TextPassowrdField };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Textarea } from "@mantine/core";
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./JsonField.js";
|
|
2
|
-
export * from "./MultiSelectField.js";
|
|
3
|
-
export * from "./NumberField.js";
|
|
4
|
-
export * from "./PassowrdField.js";
|
|
5
|
-
export * from "./SelectField.js";
|
|
6
|
-
export * from "./SwitchField.js";
|
|
7
|
-
export * from "./TextareaField.js";
|
|
8
|
-
export * from "./TextField.js";
|
|
9
|
-
export * from "./TextPassowrdField.js";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import v4 from "zod/v4";
|
|
2
|
-
const fieldsSchema = {
|
|
3
|
-
id: v4.string().min(1, 'ID не может быть пустым'),
|
|
4
|
-
str: v4.string().min(1, 'Значение не может быть пустым'),
|
|
5
|
-
strArr: v4.array(v4.string().min(1, 'Значение не может быть пустым')),
|
|
6
|
-
strMin3: v4.string().min(3, 'Должно содержать не менее 3 символов'),
|
|
7
|
-
select: v4.string().min(1, 'Выберите значение'),
|
|
8
|
-
email: v4.email('Неверный формат email'),
|
|
9
|
-
username: v4.string().min(3, 'Должен быть не менее 3 символов').max(24, 'Должен быть не более 24 символов'),
|
|
10
|
-
password: v4.string('Пароль не может быть пустым').min(8, 'Пароль должен содержать не менее 8 символов'),
|
|
11
|
-
kebab: v4.string().min(3, 'Минимум 3 символа').regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Должен быть в формате kebab-case (только строчные буквы, цифры и дефисы)')
|
|
12
|
-
};
|
|
13
|
-
export { fieldsSchema };
|
package/dist/ui/form/index.js
DELETED