@raketa-builder/ui 1.3.8 → 1.3.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.
@@ -1,88 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Wrapper = ({ className, ...props }) => (
5
- <div className={cn("r-reset", "r-pagination", className)} {...props} />
6
- );
7
-
8
- const Prev = ({ LinkComponent, router, currentPage }) => {
9
- if (currentPage === 1) {
10
- return <span>Previous</span>;
11
- }
12
-
13
- return (
14
- <LinkComponent
15
- href={{
16
- pathname: router.pathname,
17
- query: { ...router.query, ...{ page: currentPage - 1 } },
18
- }}
19
- >
20
- Previous
21
- </LinkComponent>
22
- );
23
- };
24
-
25
- const Next = ({ currentPage, pagesCount, LinkComponent, router }) => {
26
- if (currentPage === pagesCount) {
27
- return <span>Next</span>;
28
- }
29
-
30
- return (
31
- <LinkComponent
32
- href={{
33
- pathname: router.pathname,
34
- query: { ...router.query, ...{ page: currentPage + 1 } },
35
- }}
36
- >
37
- Next
38
- </LinkComponent>
39
- );
40
- };
41
-
42
- const Pagination = ({ pagination, LinkComponent, router }) => {
43
- const { currentPage, pagesCount } = pagination;
44
- const pages = Array(pagesCount).fill(1);
45
-
46
- if (pagesCount <= 1 || router === null) {
47
- return "";
48
- }
49
-
50
- return (
51
- <Wrapper>
52
- <Prev
53
- LinkComponent={LinkComponent}
54
- router={router}
55
- currentPage={currentPage}
56
- />
57
-
58
- {pages.map((_, idx) => {
59
- const pageNum = idx + 1;
60
-
61
- if (pageNum === currentPage) {
62
- return <span key={pageNum}>{pageNum}</span>;
63
- } else {
64
- return (
65
- <LinkComponent
66
- key={pageNum}
67
- href={{
68
- pathname: router.pathname,
69
- query: { ...router.query, ...{ page: pageNum } },
70
- }}
71
- >
72
- {pageNum}
73
- </LinkComponent>
74
- );
75
- }
76
- })}
77
-
78
- <Next
79
- LinkComponent={LinkComponent}
80
- router={router}
81
- currentPage={currentPage}
82
- pagesCount={pagesCount}
83
- />
84
- </Wrapper>
85
- );
86
- };
87
-
88
- export default Pagination;
package/src/Panel.jsx DELETED
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Panel = ({ className, ...props }) => (
5
- <div className={cn("r-reset", "r-panel", className)} {...props} />
6
- );
7
-
8
- const PanelTitle = ({ className, ...props }) => (
9
- <div className={cn("r-reset", "r-panel-title", className)} {...props} />
10
- );
11
-
12
- const PanelContent = ({ className, ...props }) => (
13
- <div className={cn("r-panel-content", className)} {...props} />
14
- );
15
-
16
- export { Panel, PanelTitle, PanelContent };
package/src/Select.jsx DELETED
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Select = ({ className, ...props }) => (
5
- <select className={cn("r-reset", "r-input r-select", className)} {...props} />
6
- );
7
-
8
- export default Select;
package/src/Stack.jsx DELETED
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Stack = ({ className, ...props }) => (
5
- <div className={cn("r-stack", className)} {...props}></div>
6
- );
7
-
8
- export default Stack;
package/src/Tabs.jsx DELETED
@@ -1,41 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const TabsWrapper = ({ className, ...props }) => (
5
- <div {...props} className={cn("r-reset", "r-tab-wrapper", className)}></div>
6
- );
7
-
8
- const Tab = ({ active, className, ...props }) => (
9
- <button
10
- className={cn(
11
- `r-reset-button r-tab-button ${active ? "r-tab-button-active" : ""}`,
12
- className,
13
- )}
14
- {...props}
15
- ></button>
16
- );
17
-
18
- const Tabs = ({ initial = 0, children }) => {
19
- const [current, setCurrent] = React.useState(initial);
20
-
21
- return (
22
- <React.Fragment>
23
- <TabsWrapper>
24
- {children.map((child, idx) => (
25
- <Tab
26
- key={idx}
27
- type="button"
28
- active={idx === current}
29
- onClick={() => setCurrent(idx)}
30
- >
31
- {child.props.title}
32
- </Tab>
33
- ))}
34
- </TabsWrapper>
35
-
36
- {children[current]}
37
- </React.Fragment>
38
- );
39
- };
40
-
41
- export default Tabs;
package/src/Textarea.jsx DELETED
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Textarea = ({ className, ...props }) => (
5
- <textarea
6
- className={cn("r-reset", "r-input r-textarea", className)}
7
- {...props}
8
- />
9
- );
10
-
11
- export default Textarea;
package/src/Toolbar.jsx DELETED
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import cn from "./cn";
3
-
4
- const Toolbar = ({ mb, className, ...props }) => (
5
- <div
6
- style={{ marginBottom: mb || 0 }}
7
- className={cn("r-reset", "r-toolbar", className)}
8
- {...props}
9
- />
10
- );
11
-
12
- export default Toolbar;
package/src/cn.js DELETED
@@ -1,3 +0,0 @@
1
- export default function cn() {
2
- return Array.from(arguments).filter(Boolean).map(String).join(" ");
3
- }
package/src/index.js DELETED
@@ -1,31 +0,0 @@
1
- export { default as theme } from "./theme";
2
- export { default as H } from "./H";
3
- export { default as P } from "./P";
4
- export { default as Button } from "./Button";
5
- export { default as Tabs } from "./Tabs";
6
- export { default as Input } from "./Input";
7
- export { default as Textarea } from "./Textarea";
8
- export { default as Select } from "./Select";
9
- export { default as FormGroup } from "./FormGroup";
10
- export { default as Label } from "./Label";
11
- export { default as Field } from "./Field";
12
- export { default as Hint } from "./Hint";
13
- export { default as Toolbar } from "./Toolbar";
14
- export { default as Stack } from "./Stack";
15
- export { default as Container } from "./Container";
16
- export { Panel } from "./Panel";
17
- export { PanelTitle } from "./Panel";
18
- export { PanelContent } from "./Panel";
19
- export { default as Handle } from "./Handle";
20
- export { default as Modal } from "./Modal";
21
- export { default as DataGrid } from "./DataGrid";
22
- export { Shift, Row, Col } from "./Grid";
23
- export { Navigation, NavItem } from "./Navigation";
24
- export { default as PageTitle } from "./PageTitle";
25
- export { default as Pagination } from "./Pagination";
26
- export { default as LanguageSwitcher } from "./LanguageSwitcher";
27
- export { default as ImageAvatar } from "./ImageAvatar";
28
- export { default as DefaultAvatar } from "./DefaultAvatar";
29
- export { default as cn } from "./cn";
30
- export { default as CategoriesMenu } from "./CategoriesMenu";
31
- export { default as FieldSet } from "./FieldSet";