@raketa-builder/ui 0.2.2-alpha → 0.4.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.
package/src/Stack.jsx ADDED
@@ -0,0 +1,8 @@
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 ADDED
@@ -0,0 +1,41 @@
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;
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,12 @@
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/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export { default as theme } from "./theme";
2
- export { default as reset } from "./reset";
3
- export { default as buttonReset } from "./buttonReset";
4
2
  export { default as H } from "./H";
5
3
  export { default as P } from "./P";
6
4
  export { default as Button } from "./Button";
@@ -28,3 +26,4 @@ export { default as Pagination } from "./Pagination";
28
26
  export { default as LanguageSwitcher } from "./LanguageSwitcher";
29
27
  export { default as ImageAvatar } from "./ImageAvatar";
30
28
  export { default as DefaultAvatar } from "./DefaultAvatar";
29
+ export { default as cn } from "./cn";