@bigbinary/neetoui 2.0.46 → 2.0.50

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.
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import * as iconset from "@bigbinary/neeto-icons";
3
+
4
+ export default {
5
+ title: "Foundation/Iconography",
6
+ parameters: {
7
+ layout: "padded",
8
+ docs: {
9
+ description: {
10
+ component: '`import { ClockIcon } from "@bigbinary/neeto-icons";` <br><br> Anywhere in your React file <br><br> `<ClockIcon color="#1e1e20" size={24} />`',
11
+ }
12
+ }
13
+ },
14
+ };
15
+
16
+ export const Iconography = () => {
17
+ return (
18
+ <div className="p-4">
19
+ <p className="mb-4">
20
+ <a
21
+ href="https://github.com/bigbinary/neeto-icons"
22
+ target="_blank"
23
+ rel="noreferrer"
24
+ className="flex items-center space-x-0.5 text-sm font-medium text-gray-600 hover:text-gray-900 mr-8"
25
+ >
26
+ <svg
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ width="18"
29
+ height="18"
30
+ viewBox="0 0 24 24"
31
+ >
32
+ <path fill="none" d="M0 0h24v24H0z"></path>
33
+ <path
34
+ fill="currentColor"
35
+ d="M12 2C6.475 2 2 6.475 2 12a9.994 9.994 0 006.838 9.488c.5.087.687-.213.687-.476 0-.237-.013-1.024-.013-1.862-2.512.463-3.162-.612-3.362-1.175-.113-.288-.6-1.175-1.025-1.413-.35-.187-.85-.65-.013-.662.788-.013 1.35.725 1.538 1.025.9 1.512 2.338 1.087 2.912.825.088-.65.35-1.087.638-1.337-2.225-.25-4.55-1.113-4.55-4.938 0-1.088.387-1.987 1.025-2.688-.1-.25-.45-1.275.1-2.65 0 0 .837-.262 2.75 1.026a9.28 9.28 0 012.5-.338c.85 0 1.7.112 2.5.337 1.912-1.3 2.75-1.024 2.75-1.024.55 1.375.2 2.4.1 2.65.637.7 1.025 1.587 1.025 2.687 0 3.838-2.337 4.688-4.562 4.938.362.312.675.912.675 1.85 0 1.337-.013 2.412-.013 2.75 0 .262.188.574.688.474A10.016 10.016 0 0022 12c0-5.525-4.475-10-10-10z"
36
+ ></path>
37
+ </svg>
38
+ <span>Source</span>
39
+ </a>
40
+ </p>
41
+ <div className="grid grid-cols-4 lg:grid-cols-8 gap-3">
42
+ {iconset.iconList.map((icon) => {
43
+ const Component = iconset[icon];
44
+ return (
45
+ <div
46
+ key={icon}
47
+ className="flex items-center justify-center p-5 bg-gray-50 hover:bg-gray-100 rounded-lg flex-col cursor-pointer transition-colors"
48
+ >
49
+ <Component />
50
+ <div className="mt-2 text-xs">{icon}</div>
51
+ </div>
52
+ );
53
+ })}
54
+ </div>
55
+ </div>
56
+ );
57
+ };
@@ -0,0 +1,100 @@
1
+ import { Meta } from "@storybook/addon-docs";
2
+
3
+ <Meta title="Introduction" />
4
+
5
+ <style>{`
6
+ .subheading {
7
+ --mediumdark: '#999999';
8
+ font-weight: 900;
9
+ font-size: 13px;
10
+ color: #999;
11
+ letter-spacing: 2px;
12
+ line-height: 24px;
13
+ text-transform: uppercase;
14
+ margin-bottom: 12px;
15
+ margin-top: 40px;
16
+ }
17
+
18
+ .tip {
19
+ display: inline-block;
20
+ border-radius: 1em;
21
+ font-size: 11px;
22
+ line-height: 12px;
23
+ font-weight: 700;
24
+ background: #2f3941;
25
+ color: #fff;
26
+ padding: 4px 12px;
27
+ margin-right: 10px;
28
+ vertical-align: top;
29
+ }
30
+
31
+ .tip-wrapper {
32
+ font-size: 13px;
33
+ line-height: 20px;
34
+ margin-top: 40px;
35
+ margin-bottom: 40px;
36
+ }
37
+
38
+ .tip-wrapper code {
39
+ font-size: 12px;
40
+ display: inline-block;
41
+ }
42
+
43
+
44
+ `}</style>
45
+
46
+ # What is NeetoUI?
47
+
48
+ NeetoUI is the library that drives the experience in all Neeto products built at BigBinary
49
+
50
+ <div className="subheading">Installation</div>
51
+
52
+ To install NeetoUI via yarn, use this command.
53
+
54
+ ```
55
+ yarn add @bigbinary/neetoui
56
+ ```
57
+
58
+ For other installation methods, refer our [**official npm page**](https://www.npmjs.com/package/@bigbinary/neetoui)
59
+
60
+ <div className="tip-wrapper">
61
+ <span className="tip">To use NeetoUI, you need a recent version of React.js installed (version 16.13.1+ recommended)</span>
62
+ </div>
63
+
64
+ <div className="subheading">Basic Usage</div>
65
+
66
+ ##### Importing
67
+
68
+ NeetoUI exports all it’s component as named exports. You can individually import necessary components in the following way:
69
+
70
+ ```
71
+ import { Button, Tooltip, } from "@bigbinary/neetoui";
72
+ ```
73
+
74
+ If you need access to an object that contains references to all the components you can do a wildcard import. This way, you can render dynamic components from NeetoUI.
75
+
76
+ ```
77
+ import React from "react";
78
+ import * as NeetoUI from "@bigbinary/neetoui";
79
+
80
+ export default function index() {
81
+ const Button = NeetoUI.Button;
82
+
83
+ // get a random component
84
+ const componentName = Math.random() > 0.5 ? "Badge" : "Avatar";
85
+ const MyDynamicComponent = NeetoUI[componentName];
86
+
87
+ return (
88
+ <div>
89
+ <Button />
90
+ <MyDynamicComponent />
91
+ </div>
92
+ );
93
+ }
94
+ ```
95
+
96
+ #### Acceptable props for Components
97
+
98
+ Refer documentation of each component for a detailed list of available props and their usage.
99
+
100
+
@@ -0,0 +1,126 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { MenuHorizontal } from "@bigbinary/neeto-icons";
3
+
4
+ import {
5
+ Header,
6
+ SubHeader,
7
+ Container,
8
+ Scrollable,
9
+ } from "../lib/components/layouts";
10
+ import {
11
+ Button,
12
+ PageLoader,
13
+ Pagination,
14
+ Checkbox,
15
+ Dropdown,
16
+ } from "../lib/components";
17
+
18
+ export default {
19
+ title: "Layouts/Page",
20
+ };
21
+
22
+ export const Page = () => {
23
+ const [searchString, setSearchString] = useState("");
24
+ const [isLoading, setIsLoading] = useState(true);
25
+
26
+ useEffect(() => {
27
+ setTimeout(() => {
28
+ setIsLoading(false);
29
+ }, 2000);
30
+ }, []);
31
+
32
+ return (
33
+ <Container>
34
+ <Header title="Layouts" actionBlock={<Button label="Primary Action" />} />
35
+ <SubHeader
36
+ searchProps={{
37
+ value: searchString,
38
+ onChange: (e) => setSearchString(e.target.value),
39
+ }}
40
+ deleteButtonProps={{
41
+ count: 0,
42
+ selectedIDs: [],
43
+ onClick: () => {},
44
+ }}
45
+ disableButtonProps={{
46
+ count: 0,
47
+ selectedIDs: [],
48
+ onClick: () => {},
49
+ }}
50
+ />
51
+ <Scrollable className="w-full">
52
+ {isLoading ? (
53
+ <PageLoader />
54
+ ) : (
55
+ <table className={`nui-table nui-table--checkbox nui-table--actions`}>
56
+ <thead>
57
+ <tr>
58
+ <th>
59
+ <Checkbox name="header" />
60
+ </th>
61
+ <th>Name</th>
62
+ <th>Email</th>
63
+ <th>Company</th>
64
+ <th>Phone No</th>
65
+ <th></th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ {Array(50)
70
+ .fill()
71
+ .map((_, index) => (
72
+ <React.Fragment key={index}>
73
+ <tr>
74
+ <td>
75
+ <Checkbox name="1" />
76
+ </td>
77
+ <td>Goutham Subramanyam</td>
78
+ <td>goutham.subramanyam@bigbinary.com</td>
79
+ <td>BigBinary</td>
80
+ <td>+91 9633123456</td>
81
+ <td>
82
+ <div className="flex flex-row items-center justify-end space-x-3">
83
+ <Dropdown
84
+ icon={MenuHorizontal}
85
+ buttonStyle="icon"
86
+ autoWidth
87
+ >
88
+ <li>Edit</li>
89
+ <li>Delete</li>
90
+ </Dropdown>
91
+ </div>
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <td>
96
+ <Checkbox name="2" />
97
+ </td>
98
+ <td>Edwin Babu</td>
99
+ <td>edwin.babu@bigbinary.com</td>
100
+ <td>BigBinary</td>
101
+ <td>+91 8281331983</td>
102
+ <td>
103
+ <div className="flex flex-row items-center justify-end space-x-3">
104
+ <Dropdown
105
+ icon={MenuHorizontal}
106
+ buttonStyle="icon"
107
+ autoWidth
108
+ >
109
+ <li>Edit</li>
110
+ <li>Delete</li>
111
+ </Dropdown>
112
+ </div>
113
+ </td>
114
+ </tr>
115
+ </React.Fragment>
116
+ ))}
117
+ </tbody>
118
+ </table>
119
+ )}
120
+ </Scrollable>
121
+ <div className="flex flex-row justify-end items-center w-full mt-6 mb-8">
122
+ <Pagination count={300} pageNo={1} pageSize={25} navigate={() => {}} />
123
+ </div>
124
+ </Container>
125
+ );
126
+ };
@@ -0,0 +1,72 @@
1
+ import React, { useState } from "react";
2
+ import { Check } from "@bigbinary/neeto-icons";
3
+
4
+ import Button from "../lib/components/Button";
5
+ import Modal from "../lib/components/Modal";
6
+ import Alert from "../lib/components/Alert";
7
+
8
+ export default {
9
+ title: "Overlays/Modal",
10
+ component: Modal,
11
+ subcomponents: { Button, Alert },
12
+ parameters: {
13
+ layout: "padded",
14
+ docs: {
15
+ description: {
16
+ component: '`import { Modal } from "@bigbinary/neetoui";`'
17
+ }
18
+ }
19
+ },
20
+ };
21
+
22
+ export const Modals = () => {
23
+ const [showModal, setShowModal] = useState(false);
24
+ const [showAlert, setShowAlert] = useState(false);
25
+ return (
26
+ <div className="w-full">
27
+ <div className="space-y-6">
28
+ <div className="w-1/2 space-y-8">
29
+ <div className="flex flex-row items-center justify-start space-x-6">
30
+ <Button label="Show Modal" onClick={() => setShowModal(true)} />
31
+ <Button label="Show Alert" onClick={() => setShowAlert(true)} />
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <Modal isOpen={showModal} onClose={() => setShowModal(false)}>
37
+ <Modal.Header>
38
+ <h2>Add Label</h2>
39
+ </Modal.Header>
40
+ <Modal.Body>
41
+ Somewhere out in space live The Herculoids! Zok, the laser-ray dragon!
42
+ Igoo, the giant rock ape! Tundro, the tremendous! Gloop and Gleep, the
43
+ formless, fearless wonders! With Zandor, their leader, and his wife,
44
+ Tara, and son, Dorno, they team up to protect their planet from
45
+ sinister invaders! All-strong! All-brave! All-heroes! They're The
46
+ Herculoids!
47
+ </Modal.Body>
48
+ <Modal.Footer className="space-x-4">
49
+ <Button
50
+ icon={Check}
51
+ label="Continue"
52
+ onClick={() => setShowModal(false)}
53
+ />
54
+ <Button
55
+ style="text"
56
+ label="Cancel"
57
+ onClick={() => setShowModal(false)}
58
+ />
59
+ </Modal.Footer>
60
+ </Modal>
61
+
62
+ <Alert
63
+ isOpen={showAlert}
64
+ onClose={() => setShowAlert(false)}
65
+ onSubmit={() => setShowAlert(false)}
66
+ message="Are you sure you want to continue? All of your unsaved changes will be
67
+ lost."
68
+ title="You have unsaved changes!"
69
+ />
70
+ </div>
71
+ );
72
+ };
@@ -0,0 +1,60 @@
1
+ import React, { useState } from "react";
2
+ import { Check } from "@bigbinary/neeto-icons";
3
+
4
+ import Button from "../lib/components/Button";
5
+ import Pane from "../lib/components/Pane";
6
+
7
+ export default {
8
+ title: "Overlays/Pane",
9
+ component: Pane,
10
+ subcomponents: { Button },
11
+ parameters: {
12
+ layout: "padded",
13
+ docs: {
14
+ description: {
15
+ component: '`import { Pane } from "@bigbinary/neetoui";`'
16
+ }
17
+ }
18
+ },
19
+ };
20
+
21
+ export const Panes = () => {
22
+ const [showPane, setShowPane] = useState(false);
23
+ return (
24
+ <div className="w-full">
25
+ <div className="space-y-6">
26
+ <div className="w-1/2 space-y-8">
27
+ <div className="flex flex-row items-center justify-start space-x-6">
28
+ <Button label="Show Pane" onClick={() => setShowPane(true)} />
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <Pane isOpen={showPane} onClose={() => setShowPane(false)}>
34
+ <Pane.Header>
35
+ <h2>User Info</h2>
36
+ </Pane.Header>
37
+ <Pane.Body>
38
+ Somewhere out in space live The Herculoids! Zok, the laser-ray dragon!
39
+ Igoo, the giant rock ape! Tundro, the tremendous! Gloop and Gleep, the
40
+ formless, fearless wonders! With Zandor, their leader, and his wife,
41
+ Tara, and son, Dorno, they team up to protect their planet from
42
+ sinister invaders! All-strong! All-brave! All-heroes! They're The
43
+ Herculoids!
44
+ </Pane.Body>
45
+ <Pane.Footer className="flex space-x-4">
46
+ <Button
47
+ icon={Check}
48
+ label="Continue"
49
+ onClick={() => setShowPane(false)}
50
+ />
51
+ <Button
52
+ style="text"
53
+ label="Cancel"
54
+ onClick={() => setShowPane(false)}
55
+ />
56
+ </Pane.Footer>
57
+ </Pane>
58
+ </div>
59
+ );
60
+ };
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
3
+ import { Sidebar } from "../lib/components/layouts";
4
+ import { NAV_LINKS, COMPONENT_MAPPING } from "../example/src/constants";
5
+
6
+ export default {
7
+ title: "Layouts/Sidebar",
8
+ };
9
+
10
+ export const Sidenav = () => {
11
+ let ROUTER_LINKS = [];
12
+ NAV_LINKS.map((navLink) => {
13
+ if (navLink.items) {
14
+ navLink.items.map((item) => {
15
+ ROUTER_LINKS.push(item);
16
+ });
17
+ } else {
18
+ ROUTER_LINKS.push(navLink);
19
+ }
20
+ });
21
+ return (
22
+ <Router>
23
+ <div className="flex flex-row items-start justify-start">
24
+ <Sidebar
25
+ organizationInfo={{
26
+ name: "neetoUI",
27
+ subdomain: "neetoui.netlify.app",
28
+ }}
29
+ navLinks={NAV_LINKS}
30
+ profileInfo={{
31
+ name: "Kieran Miller",
32
+ email: "kieranmiller@gmail.com",
33
+ imageUrl: "https://randomuser.me/api/portraits/women/90.jpg",
34
+ dropdownProps: [
35
+ {
36
+ label: "Edit",
37
+ onClick: () => {},
38
+ },
39
+ {
40
+ label: "Logout",
41
+ onClick: () => {},
42
+ },
43
+ ],
44
+ }}
45
+ />
46
+ <div className="relative flex flex-col flex-grow h-screen overflow-auto">
47
+ <Switch>
48
+ {ROUTER_LINKS &&
49
+ ROUTER_LINKS.map(({ label, to }, index) => {
50
+ return (
51
+ <Route
52
+ key={index}
53
+ path={to}
54
+ component={COMPONENT_MAPPING[label]}
55
+ />
56
+ );
57
+ })}
58
+ </Switch>
59
+ </div>
60
+ </div>
61
+ </Router>
62
+ );
63
+ };
@@ -0,0 +1,51 @@
1
+ import React, { useState } from "react";
2
+
3
+ import Tab from "../lib/components/Tab";
4
+
5
+ export default {
6
+ title: "Components/Tab",
7
+ component: Tab,
8
+ parameters: {
9
+ layout: "padded",
10
+ docs: {
11
+ description: {
12
+ component: '`import { Tab } from "@bigbinary/neetoui";`'
13
+ }
14
+ }
15
+ },
16
+ };
17
+
18
+ export const TwoItems = () => {
19
+ const [tab, setTab] = useState(true);
20
+ return (
21
+ <Tab className="grid grid-cols-2">
22
+ <Tab.Item active={tab} onClick={() => setTab(true)}>
23
+ Tab 1
24
+ </Tab.Item>
25
+ <Tab.Item active={!tab} onClick={() => setTab(false)}>
26
+ Tab 2
27
+ </Tab.Item>
28
+ </Tab>
29
+ );
30
+ };
31
+
32
+ export const ThreeItems = () => {
33
+ return (
34
+ <Tab className="grid grid-cols-3">
35
+ <Tab.Item active>Tab 1</Tab.Item>
36
+ <Tab.Item>Tab 2</Tab.Item>
37
+ <Tab.Item>Tab 3</Tab.Item>
38
+ </Tab>
39
+ );
40
+ };
41
+
42
+ export const FourItems = (args) => {
43
+ return (
44
+ <Tab className="grid grid-cols-3">
45
+ <Tab.Item active>Tab 1</Tab.Item>
46
+ <Tab.Item>Tab 2</Tab.Item>
47
+ <Tab.Item>Tab 3</Tab.Item>
48
+ <Tab.Item>Tab 4</Tab.Item>
49
+ </Tab>
50
+ );
51
+ };
@@ -0,0 +1,83 @@
1
+ import React from "react";
2
+ import { Favorite } from "@bigbinary/neeto-icons";
3
+
4
+ import Tag from "../lib/components/Tag";
5
+
6
+ export default {
7
+ title: "Components/Tag",
8
+ component: Tag,
9
+ parameters: {
10
+ layout: "padded",
11
+ docs: {
12
+ description: {
13
+ component: '`import { Tag } from "@bigbinary/neetoui";`'
14
+ }
15
+ }
16
+ },
17
+ };
18
+
19
+ export const Tags = () => {
20
+ const onClose = () => alert("onClose Triggered!");
21
+
22
+ return (
23
+ <div className="p-6">
24
+ <div className="p-4 space-y-8 border border-indigo-500 border-dashed">
25
+ <div className="flex flex-col space-y-6 p-2">
26
+ <div className="flex flex-row justify-start items-start space-x-4">
27
+ <h5>Outline Small: </h5>
28
+ <Tag label="Label" />
29
+ <Tag icon={Favorite} label="Label" />
30
+ <Tag onClose={onClose} label="Label" />
31
+ <Tag icon={Favorite} onClose={onClose} label="Label" />
32
+ </div>
33
+ <div className="flex flex-row justify-start items-start space-x-4">
34
+ <h5>Outline Large: </h5>
35
+ <Tag size="large" label="Label" />
36
+ <Tag size="large" icon={Favorite} label="Label" />
37
+ <Tag size="large" onClose={onClose} label="Label" />
38
+ <Tag size="large" icon={Favorite} onClose={onClose} label="Label" />
39
+ </div>
40
+ <div className="flex flex-row justify-start items-start space-x-4">
41
+ <h5>Solid Small: </h5>
42
+ <Tag style="solid" label="Label" />
43
+ <Tag style="solid" icon={Favorite} label="Label" />
44
+ <Tag style="solid" onClose={onClose} label="Label" />
45
+ <Tag
46
+ style="solid"
47
+ icon={Favorite}
48
+ onClose={onClose}
49
+ label="Label"
50
+ />
51
+ </div>
52
+ <div className="flex flex-row justify-start items-start space-x-4">
53
+ <h5>Solid Large : </h5>
54
+ <Tag style="solid" size="large" label="Label" />
55
+ <Tag style="solid" size="large" icon={Favorite} label="Label" />
56
+ <Tag style="solid" size="large" onClose={onClose} label="Label" />
57
+ <Tag
58
+ style="solid"
59
+ size="large"
60
+ icon={Favorite}
61
+ onClose={onClose}
62
+ label="Label"
63
+ />
64
+ </div>
65
+ <div className="flex flex-row justify-start items-start space-x-4">
66
+ <h5>With Indicator : </h5>
67
+ <Tag label="Label" indicator="bg-green-500" />
68
+ <Tag label="Label" indicator="bg-yellow-500" />
69
+ <Tag label="Label" indicator="bg-blue-500" />
70
+ <Tag label="Label" indicator="bg-red-500" />
71
+ </div>
72
+ <div className="flex flex-row justify-start items-start space-x-4">
73
+ <h5>With Indicator Large : </h5>
74
+ <Tag size="large" label="Label" indicator="bg-green-500" />
75
+ <Tag size="large" label="Label" indicator="bg-yellow-500" />
76
+ <Tag size="large" label="Label" indicator="bg-blue-500" />
77
+ <Tag size="large" label="Label" indicator="bg-red-500" />
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ );
83
+ };
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import { ToastContainer } from "react-toastify";
3
+
4
+ import Button from "../lib/components/Button";
5
+ import Toastr from "../lib/components/Toastr";
6
+
7
+ export default {
8
+ title: "Overlays/Toastr",
9
+ component: Toastr,
10
+ parameters: {
11
+ layout: "padded",
12
+ docs: {
13
+ description: {
14
+ component: '`import { Toastr } from "@bigbinary/neetoui";`'
15
+ }
16
+ }
17
+ },
18
+ subcomponents: { Button },
19
+ };
20
+
21
+ export const Toastrs = () => {
22
+ return (
23
+ <>
24
+ <ToastContainer />
25
+ <div className="space-y-6">
26
+ <div className="flex flex-row items-center justify-start space-x-6">
27
+ <Button
28
+ label="Info Toastr"
29
+ onClick={() => Toastr.info("This is an info toastr.")}
30
+ />
31
+ <Button
32
+ label="Warning Toastr"
33
+ onClick={() => Toastr.warning("This is a warning toastr.")}
34
+ />
35
+ <Button
36
+ label="Success Toastr"
37
+ onClick={() => Toastr.success("Form has been successfully saved.")}
38
+ />
39
+ <Button
40
+ label="Toastr with CTA"
41
+ onClick={() =>
42
+ Toastr.error(
43
+ Error("Ticket marked as spam."),
44
+ "Block Customer",
45
+ () => alert("Customer blocked successfully!")
46
+ )
47
+ }
48
+ />
49
+ <Button
50
+ label="Error Toastr"
51
+ onClick={() =>
52
+ Toastr.error(
53
+ Error(
54
+ "Some error occured! Please visit https://github.com/bigbinary/neeto-ui."
55
+ )
56
+ )
57
+ }
58
+ />
59
+ </div>
60
+ </div>
61
+ </>
62
+ );
63
+ };