@rolder-kit/ui 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/AnimatedChevron.d.ts +5 -0
  2. package/dist/AnimatedChevron.js +12 -0
  3. package/dist/JsonInput.d.ts +2 -0
  4. package/dist/JsonInput.js +45 -0
  5. package/dist/RouterLink.d.ts +16 -0
  6. package/dist/RouterLink.js +36 -0
  7. package/dist/editor/Content.d.ts +3 -0
  8. package/dist/editor/Content.js +13 -0
  9. package/dist/editor/Root.d.ts +8 -0
  10. package/dist/editor/Root.js +55 -0
  11. package/dist/editor/Toolbar.d.ts +6 -0
  12. package/dist/editor/Toolbar.js +138 -0
  13. package/dist/editor/index.d.ts +8 -0
  14. package/dist/editor/index.js +10 -0
  15. package/dist/editor/store.d.ts +6 -0
  16. package/dist/editor/store.js +10 -0
  17. package/dist/error/DefaultError.d.ts +2 -0
  18. package/dist/error/DefaultError.js +62 -0
  19. package/dist/error/DefaultNotFound.d.ts +1 -0
  20. package/dist/error/DefaultNotFound.js +37 -0
  21. package/dist/error/Forbidden.d.ts +1 -0
  22. package/dist/error/Forbidden.js +32 -0
  23. package/dist/error/defaultErrorNotification.d.ts +1 -0
  24. package/dist/error/defaultErrorNotification.js +8 -0
  25. package/dist/error/index.d.ts +4 -0
  26. package/dist/error/index.js +5 -0
  27. package/dist/form/blurOnError.d.ts +4 -0
  28. package/dist/form/blurOnError.js +11 -0
  29. package/dist/form/buttons/CancelButton.d.ts +5 -0
  30. package/dist/form/buttons/CancelButton.js +22 -0
  31. package/dist/form/buttons/SubmitButton.d.ts +5 -0
  32. package/dist/form/buttons/SubmitButton.js +22 -0
  33. package/dist/form/buttons/SubscribeActionIcon.d.ts +4 -0
  34. package/dist/form/buttons/SubscribeActionIcon.js +15 -0
  35. package/dist/form/buttons/SubscribeButton.d.ts +5 -0
  36. package/dist/form/buttons/SubscribeButton.js +16 -0
  37. package/dist/form/buttons/index.d.ts +4 -0
  38. package/dist/form/buttons/index.js +4 -0
  39. package/dist/form/context.d.ts +83 -0
  40. package/dist/form/context.js +26 -0
  41. package/dist/form/fields/JsonField.d.ts +2 -0
  42. package/dist/form/fields/JsonField.js +13 -0
  43. package/dist/form/fields/MultiSelectField.d.ts +2 -0
  44. package/dist/form/fields/MultiSelectField.js +15 -0
  45. package/dist/form/fields/NumberField.d.ts +2 -0
  46. package/dist/form/fields/NumberField.js +15 -0
  47. package/dist/form/fields/PasswordField.d.ts +2 -0
  48. package/dist/form/fields/PasswordField.js +18 -0
  49. package/dist/form/fields/SelectField.d.ts +2 -0
  50. package/dist/form/fields/SelectField.js +15 -0
  51. package/dist/form/fields/SwitchField.d.ts +2 -0
  52. package/dist/form/fields/SwitchField.js +15 -0
  53. package/dist/form/fields/TextField.d.ts +2 -0
  54. package/dist/form/fields/TextField.js +15 -0
  55. package/dist/form/fields/TextPasswordField.d.ts +2 -0
  56. package/dist/form/fields/TextPasswordField.js +29 -0
  57. package/dist/form/fields/TextareaField.d.ts +2 -0
  58. package/dist/form/fields/TextareaField.js +15 -0
  59. package/dist/form/fields/index.d.ts +9 -0
  60. package/dist/form/fields/index.js +9 -0
  61. package/dist/form/index.d.ts +3 -0
  62. package/dist/form/index.js +4 -0
  63. package/dist/hoverPaper/HoverPaper.d.ts +6 -0
  64. package/dist/hoverPaper/HoverPaper.js +15 -0
  65. package/dist/hoverPaper/index.d.ts +2 -0
  66. package/dist/hoverPaper/index.js +3 -0
  67. package/dist/hoverPaper/usePaperHover.d.ts +4 -0
  68. package/dist/hoverPaper/usePaperHover.js +9 -0
  69. package/dist/index.d.ts +4 -0
  70. package/dist/index.js +4 -0
  71. package/dist/saveInput/JsonInput.d.ts +6 -0
  72. package/dist/saveInput/JsonInput.js +33 -0
  73. package/dist/saveInput/NumberInput.d.ts +6 -0
  74. package/dist/saveInput/NumberInput.js +26 -0
  75. package/dist/saveInput/SaveInput.d.ts +36 -0
  76. package/dist/saveInput/SaveInput.js +15 -0
  77. package/dist/saveInput/Select.d.ts +6 -0
  78. package/dist/saveInput/Select.js +26 -0
  79. package/dist/saveInput/Switch.d.ts +6 -0
  80. package/dist/saveInput/Switch.js +29 -0
  81. package/dist/saveInput/TextInput.d.ts +6 -0
  82. package/dist/saveInput/TextInput.js +25 -0
  83. package/dist/saveInput/Textarea.d.ts +6 -0
  84. package/dist/saveInput/Textarea.js +25 -0
  85. package/dist/saveInput/index.d.ts +1 -0
  86. package/dist/saveInput/index.js +2 -0
  87. package/dist/scrollArea/Root.d.ts +7 -0
  88. package/dist/scrollArea/Root.js +41 -0
  89. package/dist/scrollArea/ScrollButton.d.ts +7 -0
  90. package/dist/scrollArea/ScrollButton.js +30 -0
  91. package/dist/scrollArea/index.d.ts +6 -0
  92. package/dist/scrollArea/index.js +7 -0
  93. package/dist/scrollArea/methods.d.ts +4 -0
  94. package/dist/scrollArea/methods.js +32 -0
  95. package/dist/scrollArea/store.d.ts +12 -0
  96. package/dist/scrollArea/store.js +25 -0
  97. package/package.json +53 -0
@@ -0,0 +1,5 @@
1
+ import { type IconProps } from '@tabler/icons-react';
2
+ export interface AnimatedChevronProps extends IconProps {
3
+ expanded?: boolean;
4
+ }
5
+ export declare const AnimatedChevron: React.FC<AnimatedChevronProps>;
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconChevronDown } from "@tabler/icons-react";
3
+ const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsx(IconChevronDown, {
4
+ strokeWidth: 1.5,
5
+ style: {
6
+ transition: 'transform 0.2s ease-in-out',
7
+ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
8
+ ...style
9
+ },
10
+ ...props
11
+ });
12
+ export { AnimatedChevron };
@@ -0,0 +1,2 @@
1
+ import { type ReactCodeMirrorProps } from '@uiw/react-codemirror';
2
+ export declare const JsonInput: React.FC<ReactCodeMirrorProps>;
@@ -0,0 +1,45 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { indentSelection } from "@codemirror/commands";
3
+ import { json, jsonParseLinter } from "@codemirror/lang-json";
4
+ import { linter } from "@codemirror/lint";
5
+ import { keymap } from "@codemirror/view";
6
+ import { getCookie } from "@rolder-kit/tanstack/cookie";
7
+ import { vscodeDark, vscodeLight } from "@uiw/codemirror-theme-vscode";
8
+ import react_codemirror from "@uiw/react-codemirror";
9
+ const formatJson = (view)=>{
10
+ try {
11
+ const text = view.state.doc.toString();
12
+ const parsed = JSON.parse(text);
13
+ const formatted = JSON.stringify(parsed, null, 2);
14
+ view.dispatch({
15
+ changes: {
16
+ from: 0,
17
+ to: view.state.doc.length,
18
+ insert: formatted
19
+ }
20
+ });
21
+ return true;
22
+ } catch (_) {
23
+ return indentSelection(view);
24
+ }
25
+ };
26
+ const extensions = [
27
+ json(),
28
+ linter(jsonParseLinter()),
29
+ keymap.of([
30
+ {
31
+ key: 'Mod-Shift-f',
32
+ run: formatJson
33
+ }
34
+ ])
35
+ ];
36
+ const JsonInput = (props)=>{
37
+ const colorScheme = getCookie('colorScheme');
38
+ return /*#__PURE__*/ jsx(react_codemirror, {
39
+ height: "280px",
40
+ theme: 'light' === colorScheme ? vscodeLight : vscodeDark,
41
+ extensions: extensions,
42
+ ...props
43
+ });
44
+ };
45
+ export { JsonInput };
@@ -0,0 +1,16 @@
1
+ import { type ActionIconProps, type AnchorProps, type ButtonProps, type UnstyledButtonProps } from '@rolder-kit/mantine';
2
+ import { type LinkComponent } from '@tanstack/react-router';
3
+ interface MantineAnchorProps extends Omit<AnchorProps, 'href'> {
4
+ }
5
+ interface MantineButtonProps extends Omit<ButtonProps, 'href'> {
6
+ }
7
+ interface MantineActionIconProps extends Omit<ActionIconProps, 'href'> {
8
+ }
9
+ interface MantineUnstyledButtonProps extends Omit<UnstyledButtonProps, 'href'> {
10
+ }
11
+ export declare const RouterLink: LinkComponent<import("react").ForwardRefExoticComponent<MantineAnchorProps & import("react").RefAttributes<HTMLAnchorElement>>> & {
12
+ Button: LinkComponent<import("react").ForwardRefExoticComponent<MantineButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
13
+ ActionIcon: LinkComponent<import("react").ForwardRefExoticComponent<MantineActionIconProps & import("react").RefAttributes<HTMLButtonElement>>>;
14
+ UnstyledButton: LinkComponent<import("react").ForwardRefExoticComponent<MantineUnstyledButtonProps & import("react").RefAttributes<HTMLButtonElement>>>;
15
+ };
16
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ActionIcon, Anchor, Button, UnstyledButton } from "@rolder-kit/mantine";
3
+ import { createLink } from "@tanstack/react-router";
4
+ import { forwardRef } from "react";
5
+ const MantineLinkComponent = /*#__PURE__*/ forwardRef(({ classNames, ...props }, ref)=>/*#__PURE__*/ jsx(Anchor, {
6
+ ref: ref,
7
+ classNames: {
8
+ root: 'rolder-router-link-root',
9
+ ...classNames
10
+ },
11
+ c: "inherit",
12
+ underline: "never",
13
+ ...props
14
+ }));
15
+ const MantineButtonComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Button, {
16
+ ref: ref,
17
+ ...props
18
+ }));
19
+ const MantineActionIconComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(ActionIcon, {
20
+ ref: ref,
21
+ ...props
22
+ }));
23
+ const MantineUnstyledButtonComponent = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(UnstyledButton, {
24
+ ref: ref,
25
+ ...props
26
+ }));
27
+ const RouterLinkBase = createLink(MantineLinkComponent);
28
+ const RouterLinkButton = createLink(MantineButtonComponent);
29
+ const RouterLinkActionIcon = createLink(MantineActionIconComponent);
30
+ const RouterLinkUnstyledButton = createLink(MantineUnstyledButtonComponent);
31
+ const RouterLink = Object.assign(RouterLinkBase, {
32
+ Button: RouterLinkButton,
33
+ ActionIcon: RouterLinkActionIcon,
34
+ UnstyledButton: RouterLinkUnstyledButton
35
+ });
36
+ export { RouterLink };
@@ -0,0 +1,3 @@
1
+ export declare const Content: React.FC<{
2
+ height: string;
3
+ }>;
@@ -0,0 +1,13 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { RichTextEditor } from "@mantine/tiptap";
3
+ import { ScrollArea } from "../scrollArea/index.js";
4
+ const Content = ({ height })=>/*#__PURE__*/ jsxs(ScrollArea.Root, {
5
+ height: height,
6
+ autoScroll: true,
7
+ radius: "md",
8
+ children: [
9
+ /*#__PURE__*/ jsx(RichTextEditor.Content, {}),
10
+ /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
11
+ ]
12
+ });
13
+ export { Content };
@@ -0,0 +1,8 @@
1
+ import { type RichTextEditorProps } from '@mantine/tiptap';
2
+ import { type EditorOptions } from '@tiptap/react';
3
+ export interface EditorProps extends RichTextEditorProps {
4
+ editable?: boolean;
5
+ disabledToolbar?: boolean;
6
+ onUpdate: EditorOptions['onUpdate'];
7
+ }
8
+ export declare const Root: React.FC<EditorProps>;
@@ -0,0 +1,55 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Link, RichTextEditor, getTaskListExtension } from "@mantine/tiptap";
3
+ import extension_highlight from "@tiptap/extension-highlight";
4
+ import extension_placeholder from "@tiptap/extension-placeholder";
5
+ import { TableKit } from "@tiptap/extension-table";
6
+ import extension_task_item from "@tiptap/extension-task-item";
7
+ import extension_task_list from "@tiptap/extension-task-list";
8
+ import extension_text_align from "@tiptap/extension-text-align";
9
+ import { useEditor } from "@tiptap/react";
10
+ import starter_kit from "@tiptap/starter-kit";
11
+ import { useState } from "react";
12
+ import { setDisabledToolbar } from "./store.js";
13
+ const Root = ({ children, classNames, content, editable = true, disabledToolbar, onUpdate, editor: customEditor, ...props })=>{
14
+ useState(()=>setDisabledToolbar(disabledToolbar || false));
15
+ const editor = useEditor({
16
+ shouldRerenderOnTransaction: false,
17
+ immediatelyRender: false,
18
+ extensions: [
19
+ starter_kit.configure({
20
+ link: false
21
+ }),
22
+ extension_placeholder.configure({
23
+ placeholder: 'Документ пуст'
24
+ }),
25
+ Link,
26
+ extension_highlight,
27
+ extension_text_align.configure({
28
+ types: [
29
+ 'heading',
30
+ 'paragraph'
31
+ ]
32
+ }),
33
+ getTaskListExtension(extension_task_list),
34
+ extension_task_item.configure({
35
+ nested: true
36
+ }),
37
+ TableKit
38
+ ],
39
+ content,
40
+ onUpdate,
41
+ editable
42
+ });
43
+ return /*#__PURE__*/ jsx(RichTextEditor, {
44
+ editor: customEditor || editor,
45
+ classNames: {
46
+ root: 'rolder-editor-root',
47
+ content: 'rolder-editor-content',
48
+ toolbar: 'rolder-editor-toolbar',
49
+ ...classNames
50
+ },
51
+ ...props,
52
+ children: children
53
+ });
54
+ };
55
+ export { Root };
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ToolbarProps {
3
+ saving?: boolean;
4
+ children?: ReactNode;
5
+ }
6
+ export declare const Toolbar: React.FC<ToolbarProps>;
@@ -0,0 +1,138 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { RichTextEditor } from "@mantine/tiptap";
3
+ import { Loader } from "@rolder-kit/mantine";
4
+ import { IconCheck } from "@tabler/icons-react";
5
+ import { getDisabledToolbar, useEditor } from "./store.js";
6
+ const Toolbar = ({ saving, children })=>{
7
+ const editor = useEditor();
8
+ return getDisabledToolbar() ? 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 };
@@ -0,0 +1,8 @@
1
+ export declare const Editor: {
2
+ Root: import("react").FC<import("./Root").EditorProps>;
3
+ Content: import("react").FC<{
4
+ height: string;
5
+ }>;
6
+ Toolbar: import("react").FC<import("./Toolbar").ToolbarProps>;
7
+ };
8
+ export * from './store';
@@ -0,0 +1,10 @@
1
+ import { Content } from "./Content.js";
2
+ import { Root } from "./Root.js";
3
+ import { Toolbar } from "./Toolbar.js";
4
+ export * from "./store.js";
5
+ const Editor = {
6
+ Root: Root,
7
+ Content: Content,
8
+ Toolbar: Toolbar
9
+ };
10
+ export { Editor };
@@ -0,0 +1,6 @@
1
+ import type { Editor } from '@tiptap/react';
2
+ export declare const getEditor: () => Editor | null;
3
+ export declare const useEditor: () => Editor | null;
4
+ export declare const setEditor: (editor: Editor) => void;
5
+ export declare const getDisabledToolbar: () => boolean;
6
+ export declare const setDisabledToolbar: (disabled: boolean) => void;
@@ -0,0 +1,10 @@
1
+ import { useStore } from "@nanostores/react";
2
+ import { atom } from "nanostores";
3
+ const $editor = atom(null);
4
+ const getEditor = ()=>$editor.get();
5
+ const useEditor = ()=>useStore($editor);
6
+ const setEditor = (editor)=>$editor.set(editor);
7
+ const $disabledToolbar = atom(false);
8
+ const getDisabledToolbar = ()=>$disabledToolbar.get();
9
+ const setDisabledToolbar = (disabled)=>$disabledToolbar.set(disabled);
10
+ export { getDisabledToolbar, getEditor, setDisabledToolbar, setEditor, useEditor };
@@ -0,0 +1,2 @@
1
+ import type { ErrorComponentProps } from '@tanstack/react-router';
2
+ export declare const DefaultError: React.FC<ErrorComponentProps>;
@@ -0,0 +1,62 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Group, Stack, Title } from "@rolder-kit/mantine";
3
+ import { rootRouteId, useMatch, useRouter } from "@tanstack/react-router";
4
+ import { RouterLink } from "../RouterLink.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 };
@@ -0,0 +1 @@
1
+ export declare const DefaultNotFound: React.FC;
@@ -0,0 +1,37 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Stack, Text, Title } from "@rolder-kit/mantine";
3
+ import { RouterLink } from "../RouterLink.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 };
@@ -0,0 +1 @@
1
+ export declare const Forbidden: React.FC;
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Stack, Title } from "@rolder-kit/mantine";
3
+ import { RouterLink } from "../RouterLink.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 };
@@ -0,0 +1 @@
1
+ export declare const defaultErrorNotification: (error: Error) => string;
@@ -0,0 +1,8 @@
1
+ import { notifications } from "@rolder-kit/mantine/notifications";
2
+ const defaultErrorNotification = (error)=>notifications.show({
3
+ title: 'Системная ошибка',
4
+ message: error.message,
5
+ color: 'red',
6
+ autoClose: false
7
+ });
8
+ export { defaultErrorNotification };
@@ -0,0 +1,4 @@
1
+ export { DefaultError } from './DefaultError';
2
+ export { DefaultNotFound } from './DefaultNotFound';
3
+ export { defaultErrorNotification } from './defaultErrorNotification';
4
+ export { Forbidden } from './Forbidden';
@@ -0,0 +1,5 @@
1
+ import { DefaultError } from "./DefaultError.js";
2
+ import { DefaultNotFound } from "./DefaultNotFound.js";
3
+ import { defaultErrorNotification } from "./defaultErrorNotification.js";
4
+ import { Forbidden } from "./Forbidden.js";
5
+ export { DefaultError, DefaultNotFound, Forbidden, defaultErrorNotification };
@@ -0,0 +1,4 @@
1
+ import type { AnyFormApi } from '@tanstack/react-form';
2
+ export declare const blurOnError: ({ formApi }: {
3
+ formApi: AnyFormApi;
4
+ }) => void;
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,5 @@
1
+ import { type ButtonProps } from '@rolder-kit/mantine';
2
+ export declare const CancelButton: React.FC<ButtonProps & {
3
+ label?: string;
4
+ onClick?: () => void;
5
+ }>;
@@ -0,0 +1,22 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Button } from "@rolder-kit/mantine";
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 };
@@ -0,0 +1,5 @@
1
+ import { type ButtonProps } from '@rolder-kit/mantine';
2
+ export declare const SubmitButton: React.FC<ButtonProps & {
3
+ label?: string;
4
+ onClick?: () => void;
5
+ }>;
@@ -0,0 +1,22 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Button } from "@rolder-kit/mantine";
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 };
@@ -0,0 +1,4 @@
1
+ import { type ActionIconProps } from '@rolder-kit/mantine';
2
+ export declare const SubscribeActionIcon: React.FC<ActionIconProps & {
3
+ onClick?: () => void;
4
+ }>;