@bigbinary/neetoui 4.4.26 → 5.0.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/README.md +177 -18
- package/formik.cjs.js +686 -450
- package/formik.cjs.js.map +1 -1
- package/formik.js +686 -450
- package/formik.js.map +1 -1
- package/index.cjs.js +10298 -10255
- package/index.cjs.js.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +3 -6
- package/index.js +10298 -10254
- package/index.js.map +1 -1
- package/layouts.cjs.js +2074 -24756
- package/layouts.cjs.js.map +1 -1
- package/layouts.js +1920 -24577
- package/layouts.js.map +1 -1
- package/package.json +3 -2
- package/layouts.d.ts +0 -169
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/@bigbinary/neetoui)
|
|
1
|
+
[](https://www.npmjs.com/package/@bigbinary/neetoui)
|
|
2
|
+
[](https://standardjs.com)
|
|
2
3
|
|
|
3
|
-
**neetoUI** is the library that drives the experience in all
|
|
4
|
+
**neetoUI** is the library that drives the experience in all
|
|
5
|
+
[neeto products](https://neeto.com/) built at
|
|
6
|
+
[BigBinary](https://www.bigbinary.com).
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
@@ -8,20 +11,27 @@
|
|
|
8
11
|
yarn add @bigbinary/neetoui
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
This would install `neetoui` package inside your application.
|
|
12
|
-
|
|
14
|
+
This would install `neetoui` package inside your application. Starting `3.0.x`,
|
|
15
|
+
neetoUI stylesheet has been separated from the bundle. To get the styles
|
|
16
|
+
working, please import the neetoUI stylesheet to your main `scss` entry point.
|
|
13
17
|
|
|
14
18
|
```scss
|
|
15
19
|
@import "@bigbinary/neetoui";
|
|
16
20
|
```
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
## Dependencies
|
|
23
|
+
|
|
24
|
+
**neetoUI** has few peer dependencies which are required to use neetoUI
|
|
25
|
+
properly. Install the peer dependencies using the below command:
|
|
19
26
|
|
|
20
27
|
```
|
|
21
28
|
yarn add react-toastify@9.0.1 formik@2.2.0 react-router-dom@5.2.0
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
### `react-toastify`
|
|
32
|
+
|
|
33
|
+
neetoUI depends on `react-toastify` for Toasters, so the styles for toaster must
|
|
34
|
+
be imported to your main `scss` entry point.
|
|
25
35
|
|
|
26
36
|
```scss
|
|
27
37
|
@import "react-toastify/dist/ReactToastify.min.css";
|
|
@@ -44,6 +54,150 @@ const App = () => {
|
|
|
44
54
|
};
|
|
45
55
|
```
|
|
46
56
|
|
|
57
|
+
### `formik`
|
|
58
|
+
|
|
59
|
+
To make form handling easier with neetoUI, we provide Formik binding with
|
|
60
|
+
neetoUI components. To know about Formik, ref the
|
|
61
|
+
[official documentation](https://formik.org/docs/overview).
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
neetoUI exports all it’s component as named exports. You can individually import
|
|
66
|
+
necessary components in the following way:
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
import { Button, Tooltip } from "@bigbinary/neetoui";
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If you need access to an object that contains references to all the components
|
|
73
|
+
you can do a wildcard import. This way, you can render dynamic components from
|
|
74
|
+
neetoUI.
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
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
|
+
### Formik
|
|
97
|
+
|
|
98
|
+
neetoUI formik exports all its component as named exports. You can individually
|
|
99
|
+
import necessary components in the following way:
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
import { Input } from "@bigbinary/neetoui/formik";
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Available components in neetoUI formik:
|
|
106
|
+
|
|
107
|
+
- Input
|
|
108
|
+
- Radio
|
|
109
|
+
- Button
|
|
110
|
+
- Form
|
|
111
|
+
- ActionBlock
|
|
112
|
+
- Select
|
|
113
|
+
- Switch
|
|
114
|
+
- Textarea
|
|
115
|
+
- CheckBox
|
|
116
|
+
- BlockNavigation
|
|
117
|
+
|
|
118
|
+
You can refer the
|
|
119
|
+
[formik folder](https://github.com/bigbinary/neeto-ui/tree/main/src/components/formik)
|
|
120
|
+
to check for latest Formik components.
|
|
121
|
+
|
|
122
|
+
In order to use the neetoUI formik components, you need to wrap your form with
|
|
123
|
+
the `Form` component.
|
|
124
|
+
|
|
125
|
+
```jsx
|
|
126
|
+
import * as Yup from "yup";
|
|
127
|
+
import { Form } from "@bigbinary/neetoui/formik";
|
|
128
|
+
|
|
129
|
+
<Form
|
|
130
|
+
formikProps={{
|
|
131
|
+
initialValues: {
|
|
132
|
+
name: "",
|
|
133
|
+
email: "",
|
|
134
|
+
},
|
|
135
|
+
onSubmit: (values, formikBag) => {
|
|
136
|
+
console.log(values, formikBag);
|
|
137
|
+
},
|
|
138
|
+
validationSchema: Yup.object({
|
|
139
|
+
name: Yup.string().required("Name is required"),
|
|
140
|
+
email: Yup.string().email("Invalid email").required("Email is required"),
|
|
141
|
+
}),
|
|
142
|
+
}}
|
|
143
|
+
className="w-full space-y-6"
|
|
144
|
+
>
|
|
145
|
+
{props => {
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<Input {...props} label="Name" name="name" />
|
|
149
|
+
<Input {...props} label="Email" name="email" />
|
|
150
|
+
<Button label="Submit" type="submit" style="primary" />
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}}
|
|
154
|
+
</Form>;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
In case, you wish not to pass `children` as a function, you can use the
|
|
158
|
+
following syntax:
|
|
159
|
+
|
|
160
|
+
```jsx
|
|
161
|
+
import * as Yup from "yup";
|
|
162
|
+
import { Form } from "@bigbinary/neetoui/formik";
|
|
163
|
+
|
|
164
|
+
<Form
|
|
165
|
+
formikProps={{
|
|
166
|
+
initialValues: {
|
|
167
|
+
name: "",
|
|
168
|
+
email: "",
|
|
169
|
+
},
|
|
170
|
+
onSubmit: (values, formikbag) => {
|
|
171
|
+
console.log(values, formikbag);
|
|
172
|
+
},
|
|
173
|
+
validationSchema: Yup.object({
|
|
174
|
+
name: Yup.string().required("Name is required"),
|
|
175
|
+
email: Yup.string().email("Invalid email").required("Email is required"),
|
|
176
|
+
}),
|
|
177
|
+
}}
|
|
178
|
+
className="w-full space-y-6"
|
|
179
|
+
>
|
|
180
|
+
<>
|
|
181
|
+
<Input {...props} label="Name" name="name" />
|
|
182
|
+
<Input {...props} label="Email" name="email" />
|
|
183
|
+
<Button label="Submit" type="submit" style="primary" />
|
|
184
|
+
</>
|
|
185
|
+
</Form>;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The `Form` component accepts the following props:
|
|
189
|
+
|
|
190
|
+
- `formikProps`: Formik props object. You can pass `initialValues`,
|
|
191
|
+
`validationSchema`, `onSubmit` etc. as props to the `Form` component.
|
|
192
|
+
- `children`: You can pass a function as `children` to the `Form` component. The
|
|
193
|
+
function will receive the formik props object as an argument. Or you can
|
|
194
|
+
directly pass the `children` inside the `Form` component.
|
|
195
|
+
- `className`: You can use this prop to provide a custom class to the form.
|
|
196
|
+
- `formProps`: Form props object. You can pass `className`, `style` etc. as
|
|
197
|
+
props to the `Form` component.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
47
201
|
## Development
|
|
48
202
|
|
|
49
203
|
Install all the dependencies by executing following command.
|
|
@@ -52,9 +206,12 @@ Install all the dependencies by executing following command.
|
|
|
52
206
|
yarn
|
|
53
207
|
```
|
|
54
208
|
|
|
55
|
-
You can create new components in `src/components` and export them from
|
|
209
|
+
You can create new components in `src/components` and export them from
|
|
210
|
+
`src/index.js`.
|
|
56
211
|
|
|
57
|
-
Running the `yarn storybook` command starts a storybook app. Use this
|
|
212
|
+
Running the `yarn storybook` command starts a storybook app. Use this
|
|
213
|
+
application to test out changes and see how your component behaves in the
|
|
214
|
+
storybook for **neetoUI**
|
|
58
215
|
|
|
59
216
|
- To see if tests associated with your components pass run `yarn test`.
|
|
60
217
|
- To see if **neetoUI** gets built and bundled after changes run `yarn bundle`.
|
|
@@ -64,19 +221,19 @@ Note that nothing in the `stories` folder will be bundled with **neetoUI**.
|
|
|
64
221
|
|
|
65
222
|
# Building and releasing.
|
|
66
223
|
|
|
67
|
-
The `@bigbinary/neetoui` package gets published to NPM when we
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
224
|
+
The `@bigbinary/neetoui` package gets published to NPM when we merge a PR with
|
|
225
|
+
`patch`, `minor` or `major` label to the `main` branch. The `patch` label is
|
|
226
|
+
used for bug fixes, `minor` label is used for new features and `major` label is
|
|
227
|
+
used for breaking changes. You can checkout the `Create and publish releases`
|
|
228
|
+
workflow in GitHub Actions to get a live update.
|
|
72
229
|
|
|
73
230
|
In case if you missed to add the label, you can manually publish the package.
|
|
74
231
|
For that first you need to create a PR to update the version number in the
|
|
75
232
|
`package.json` file and merge it to the `main` branch. After merging the PR, you
|
|
76
233
|
need to create a
|
|
77
|
-
[new github release](https://github.com/bigbinary/neeto-ui/releases/new)
|
|
78
|
-
|
|
79
|
-
|
|
234
|
+
[new github release](https://github.com/bigbinary/neeto-ui/releases/new) from
|
|
235
|
+
main branch. Whenever a new release is created with a new version number, the
|
|
236
|
+
github actions will automatically publish the built package to npm. You can
|
|
80
237
|
checkout the `Publish to npm` workflow in GitHub Actions to get a live update.
|
|
81
238
|
|
|
82
239
|
Please note that before publishing the package, you need to verify the
|
|
@@ -92,5 +249,7 @@ https://neeto-ui.neeto.com
|
|
|
92
249
|
|
|
93
250
|
## Other Libraries
|
|
94
251
|
|
|
95
|
-
- [neetoIcons](https://github.com/bigbinary/neeto-icons): **NeetoIcons** is the
|
|
96
|
-
|
|
252
|
+
- [neetoIcons](https://github.com/bigbinary/neeto-icons): **NeetoIcons** is the
|
|
253
|
+
official icons library from BigBinary.
|
|
254
|
+
- [neetoEditor](https://github.com/bigbinary/neeto-editor-tiptap):
|
|
255
|
+
**NeetoEditor** is a prose-mirror based rich-text editor used at BigBinary.
|