newron-ui 1.0.52 → 1.0.55
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 +119 -78
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,12 +18,85 @@ npm install newron-ui --save
|
|
|
18
18
|
npm link
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Components
|
|
22
|
+
|
|
23
|
+
**Here are the components available in the Newron UI Library:**
|
|
24
|
+
|
|
25
|
+
| Type | Name | Description |
|
|
26
|
+
| ---------- | ------------------------- | -------------------------------------------------------- |
|
|
27
|
+
| Components | Button | A customizable button component. |
|
|
28
|
+
| Components | Card | A card-style component for displaying content. |
|
|
29
|
+
| Components | Input | An input field component. |
|
|
30
|
+
| Components | Dropdown | A dropdown component for selecting options. |
|
|
31
|
+
| Components | Select | A select component for selecting options. |
|
|
32
|
+
| Components | SearchBar | A search bar component. |
|
|
33
|
+
| Components | ResponsiveLayoutWrapper | A responsive layout wrapper component. |
|
|
34
|
+
| Components | Datalist | A datalist component. |
|
|
35
|
+
| Components | Datalist2 | Another datalist component. |
|
|
36
|
+
| Components | SearchableList | A searchable list component. |
|
|
37
|
+
| Components | MultiSelectDatalist | A multi-select datalist component. |
|
|
38
|
+
| Components | DynamicForm | A dynamic form component. |
|
|
39
|
+
| Components | DataTable | A data table component. |
|
|
40
|
+
| Components | Loader | A loader component. |
|
|
41
|
+
| Components | Checkbox | A checkbox component. |
|
|
42
|
+
| Components | ActionsCell | A cell for action buttons in a table. |
|
|
43
|
+
| Components | NoPermission | A component for displaying a "No Permission" message. |
|
|
44
|
+
| Components | Breadcrumb | A breadcrumb navigation component. |
|
|
45
|
+
| Components | Avatar | An avatar component. |
|
|
46
|
+
| Components | Badge | A badge component. |
|
|
47
|
+
| Components | Spinner | A spinner component. |
|
|
48
|
+
| Components | HoverableButton | A button with hover effects. |
|
|
49
|
+
| Components | AscDscShorter | A component for sorting data. |
|
|
50
|
+
| Components | Table | A table component. |
|
|
51
|
+
| Components | VerticalLine | A vertical line component. |
|
|
52
|
+
| Components | HorizontalLine | A horizontal line component. |
|
|
53
|
+
| Components | TableSkeleton | A skeleton loader for tables. |
|
|
54
|
+
| Components | TablePagination | A pagination component for tables. |
|
|
55
|
+
| Components | SelectAllHeader | A header component for selecting all items in a table. |
|
|
56
|
+
| Components | TableHeaderSkeleton | A skeleton loader for table headers. |
|
|
57
|
+
| Components | TableBodySkeleton | A skeleton loader for table body. |
|
|
58
|
+
| Components | ActionHeader | A header for action buttons in a table. |
|
|
59
|
+
| Components | UploadFile | A file upload component. |
|
|
60
|
+
| Components | FormField | A form field component. |
|
|
61
|
+
| Components | CombinedImageUploader | An image uploader component. |
|
|
62
|
+
| Components | Stepper | A stepper component. |
|
|
63
|
+
| Components | CloseButton | A close button component. |
|
|
64
|
+
| Components | ExcelGenerator | A component for generating Excel files. |
|
|
65
|
+
| Components | DownloadFile | A component for downloading files. |
|
|
66
|
+
| Components | ButtonElement | A button element component. |
|
|
67
|
+
| Components | InputElement | An input element component. |
|
|
68
|
+
| Components | Profiles | A component for displaying user profiles. |
|
|
69
|
+
| Components | ProfileListModel | A list model component for profiles. |
|
|
70
|
+
| Hooks | useClickOutsideHandler | A hook for handling clicks outside a specified element. |
|
|
71
|
+
| Hooks | useWindowWidthHeight | A hook for tracking window width and height. |
|
|
72
|
+
| Hooks | useScrollToLastElement | A hook for scrolling to the last element in a container. |
|
|
73
|
+
| Hooks | useColumnWidths | A hook for managing column widths. |
|
|
74
|
+
| Hooks | useBodyOverflow | A hook for controlling the overflow of the body. |
|
|
75
|
+
| Hooks | useTimeout | A hook for managing timeouts. |
|
|
76
|
+
| Hooks | useMediaQuery | A hook for working with media queries. |
|
|
77
|
+
| Hooks | usePrevious | A hook for accessing the previous value of a state. |
|
|
78
|
+
| Hooks | useDocumentTitle | A hook for setting the document title. |
|
|
79
|
+
| Hooks | useKeyPress | A hook for handling keyboard keypress events. |
|
|
80
|
+
| Hooks | useOnlineStatus | A hook for detecting online/offline status. |
|
|
81
|
+
| Hooks | useScrollPosition | A hook for tracking scroll position. |
|
|
82
|
+
| Hooks | useGeolocation | A hook for accessing geolocation information. |
|
|
83
|
+
| Hooks | useLocalStorageWithExpiry | A hook for managing local storage with expiry. |
|
|
84
|
+
| Hooks | useClipboard | A hook for working with the clipboard. |
|
|
85
|
+
| Hooks | useInterval | A hook for managing intervals. |
|
|
86
|
+
| Hooks | useHover | A hook for detecting hover status. |
|
|
87
|
+
| Hooks | useDocumentVisibility | A hook for monitoring document visibility. |
|
|
88
|
+
| Hooks | useDebounce | A hook for debouncing function calls. |
|
|
89
|
+
| Hooks | useMediaRecorder | A hook for media recording capabilities. |
|
|
90
|
+
| Hooks | useWebSocket | A hook for WebSocket communication. |
|
|
91
|
+
| Hooks | useModelPosition | A hook for managing model position. |
|
|
92
|
+
| Utilities | getStatusColorClass | A utility function for obtaining status color classes. |
|
|
93
|
+
|
|
21
94
|
## Usage
|
|
22
95
|
|
|
23
96
|
Import the components you need from the library in your React application and use them in your UI:
|
|
24
97
|
|
|
25
98
|
```jsx
|
|
26
|
-
import React from
|
|
99
|
+
import React from 'react';
|
|
27
100
|
import {
|
|
28
101
|
Button,
|
|
29
102
|
Card,
|
|
@@ -33,30 +106,23 @@ import {
|
|
|
33
106
|
SearchBar,
|
|
34
107
|
ResponsiveLayoutWrapper,
|
|
35
108
|
Datalist,
|
|
36
|
-
DynamicForm
|
|
37
|
-
} from
|
|
109
|
+
DynamicForm
|
|
110
|
+
} from 'newron-ui';
|
|
38
111
|
|
|
39
112
|
const App = () => {
|
|
40
113
|
return (
|
|
41
114
|
<ResponsiveLayoutWrapper>
|
|
42
115
|
{/* Use the components here */}
|
|
43
|
-
<Card title=
|
|
44
|
-
<Button variant=
|
|
116
|
+
<Card title='Sample Card' content='This is a sample card component.' />
|
|
117
|
+
<Button variant='primary' size='lg'>
|
|
45
118
|
Click Me
|
|
46
119
|
</Button>
|
|
47
|
-
<Input type=
|
|
48
|
-
<Dropdown options={[
|
|
49
|
-
<Select options={[
|
|
50
|
-
<SearchBar onSearch={
|
|
51
|
-
<Datalist
|
|
52
|
-
|
|
53
|
-
onSelect={(option) => console.log(option)}
|
|
54
|
-
/>
|
|
55
|
-
<DynamicForm
|
|
56
|
-
initialValues={initialValues}
|
|
57
|
-
validationSchema={validationSchema}
|
|
58
|
-
fields={fields}
|
|
59
|
-
/>
|
|
120
|
+
<Input type='text' placeholder='Enter text...' />
|
|
121
|
+
<Dropdown options={['Option 1', 'Option 2', 'Option 3']} />
|
|
122
|
+
<Select options={['Option 1', 'Option 2', 'Option 3']} />
|
|
123
|
+
<SearchBar onSearch={searchText => console.log(searchText)} />
|
|
124
|
+
<Datalist options={['Option 1', 'Option 2', 'Option 3']} onSelect={option => console.log(option)} />
|
|
125
|
+
<DynamicForm initialValues={initialValues} validationSchema={validationSchema} fields={fields} />
|
|
60
126
|
</ResponsiveLayoutWrapper>
|
|
61
127
|
);
|
|
62
128
|
};
|
|
@@ -93,12 +159,12 @@ Props:
|
|
|
93
159
|
Usage Example:
|
|
94
160
|
|
|
95
161
|
```jsx
|
|
96
|
-
import React from
|
|
97
|
-
import { Button } from
|
|
162
|
+
import React from 'react';
|
|
163
|
+
import { Button } from 'newron-ui-lib';
|
|
98
164
|
|
|
99
165
|
const MyComponent = () => {
|
|
100
166
|
return (
|
|
101
|
-
<Button variant=
|
|
167
|
+
<Button variant='primary' size='lg'>
|
|
102
168
|
Click Me
|
|
103
169
|
</Button>
|
|
104
170
|
);
|
|
@@ -117,13 +183,11 @@ Props:
|
|
|
117
183
|
Usage Example:
|
|
118
184
|
|
|
119
185
|
```jsx
|
|
120
|
-
import React from
|
|
121
|
-
import { Card } from
|
|
186
|
+
import React from 'react';
|
|
187
|
+
import { Card } from 'newron-ui-lib';
|
|
122
188
|
|
|
123
189
|
const MyComponent = () => {
|
|
124
|
-
return
|
|
125
|
-
<Card title="Sample Card" content="This is a sample card component." />
|
|
126
|
-
);
|
|
190
|
+
return <Card title='Sample Card' content='This is a sample card component.' />;
|
|
127
191
|
};
|
|
128
192
|
```
|
|
129
193
|
|
|
@@ -143,19 +207,11 @@ Props:
|
|
|
143
207
|
Usage Example:
|
|
144
208
|
|
|
145
209
|
```jsx
|
|
146
|
-
import React from
|
|
147
|
-
import { Input } from
|
|
210
|
+
import React from 'react';
|
|
211
|
+
import { Input } from 'newron-ui-lib';
|
|
148
212
|
|
|
149
213
|
const MyComponent = () => {
|
|
150
|
-
return
|
|
151
|
-
<Input
|
|
152
|
-
label="Username:"
|
|
153
|
-
field={field}
|
|
154
|
-
form={form}
|
|
155
|
-
variant="outlined"
|
|
156
|
-
size="small"
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
214
|
+
return <Input label='Username:' field={field} form={form} variant='outlined' size='small' />;
|
|
159
215
|
};
|
|
160
216
|
```
|
|
161
217
|
|
|
@@ -170,11 +226,11 @@ Props:
|
|
|
170
226
|
Usage Example:
|
|
171
227
|
|
|
172
228
|
```jsx
|
|
173
|
-
import React from
|
|
174
|
-
import { Dropdown } from
|
|
229
|
+
import React from 'react';
|
|
230
|
+
import { Dropdown } from 'newron-ui-lib';
|
|
175
231
|
|
|
176
232
|
const MyComponent = () => {
|
|
177
|
-
return <Dropdown options={[
|
|
233
|
+
return <Dropdown options={['Option 1', 'Option 2', 'Option 3']} />;
|
|
178
234
|
};
|
|
179
235
|
```
|
|
180
236
|
|
|
@@ -189,11 +245,11 @@ Props:
|
|
|
189
245
|
Usage Example:
|
|
190
246
|
|
|
191
247
|
```jsx
|
|
192
|
-
import React from
|
|
193
|
-
import { Select } from
|
|
248
|
+
import React from 'react';
|
|
249
|
+
import { Select } from 'newron-ui-lib';
|
|
194
250
|
|
|
195
251
|
const MyComponent = () => {
|
|
196
|
-
return <Select options={[
|
|
252
|
+
return <Select options={['Option 1', 'Option 2', 'Option 3']} />;
|
|
197
253
|
};
|
|
198
254
|
```
|
|
199
255
|
|
|
@@ -208,12 +264,12 @@ Props:
|
|
|
208
264
|
Usage Example:
|
|
209
265
|
|
|
210
266
|
```jsx
|
|
211
|
-
import React from
|
|
212
|
-
import { SearchBar } from
|
|
267
|
+
import React from 'react';
|
|
268
|
+
import { SearchBar } from 'newron-ui-lib';
|
|
213
269
|
|
|
214
270
|
const MyComponent = () => {
|
|
215
|
-
const handleSearch =
|
|
216
|
-
console.log(
|
|
271
|
+
const handleSearch = searchText => {
|
|
272
|
+
console.log('Searching for:', searchText);
|
|
217
273
|
// Perform the search action here
|
|
218
274
|
};
|
|
219
275
|
|
|
@@ -228,15 +284,11 @@ A wrapper component to create a responsive layout for your components.
|
|
|
228
284
|
Usage Example:
|
|
229
285
|
|
|
230
286
|
```jsx
|
|
231
|
-
import React from
|
|
232
|
-
import { ResponsiveLayoutWrapper } from
|
|
287
|
+
import React from 'react';
|
|
288
|
+
import { ResponsiveLayoutWrapper } from 'newron-ui-lib';
|
|
233
289
|
|
|
234
290
|
const MyComponent = () => {
|
|
235
|
-
return
|
|
236
|
-
<ResponsiveLayoutWrapper>
|
|
237
|
-
{/* Your components go here */}
|
|
238
|
-
</ResponsiveLayoutWrapper>
|
|
239
|
-
);
|
|
291
|
+
return <ResponsiveLayoutWrapper>{/* Your components go here */}</ResponsiveLayoutWrapper>;
|
|
240
292
|
};
|
|
241
293
|
```
|
|
242
294
|
|
|
@@ -252,22 +304,17 @@ Props:
|
|
|
252
304
|
Usage Example:
|
|
253
305
|
|
|
254
306
|
```jsx
|
|
255
|
-
import React, { useState } from
|
|
256
|
-
import { Datalist } from
|
|
307
|
+
import React, { useState } from 'react';
|
|
308
|
+
import { Datalist } from 'newron-ui-lib';
|
|
257
309
|
|
|
258
310
|
const MyComponent = () => {
|
|
259
|
-
const [selectedOption, setSelectedOption] = useState(
|
|
311
|
+
const [selectedOption, setSelectedOption] = useState('');
|
|
260
312
|
|
|
261
|
-
const handleSelect =
|
|
313
|
+
const handleSelect = option => {
|
|
262
314
|
setSelectedOption(option);
|
|
263
315
|
};
|
|
264
316
|
|
|
265
|
-
return
|
|
266
|
-
<Datalist
|
|
267
|
-
options={["Option 1", "Option 2", "Option 3"]}
|
|
268
|
-
onSelect={handleSelect}
|
|
269
|
-
/>
|
|
270
|
-
);
|
|
317
|
+
return <Datalist options={['Option 1', 'Option 2', 'Option 3']} onSelect={handleSelect} />;
|
|
271
318
|
};
|
|
272
319
|
```
|
|
273
320
|
|
|
@@ -284,32 +331,26 @@ Props:
|
|
|
284
331
|
Usage Example:
|
|
285
332
|
|
|
286
333
|
```jsx
|
|
287
|
-
import React from
|
|
288
|
-
import { DynamicForm } from
|
|
289
|
-
import * as Yup from
|
|
334
|
+
import React from 'react';
|
|
335
|
+
import { DynamicForm } from 'newron-ui-lib';
|
|
336
|
+
import * as Yup from 'yup';
|
|
290
337
|
|
|
291
338
|
const MyComponent = () => {
|
|
292
339
|
const initialValues = {
|
|
293
|
-
username:
|
|
294
|
-
password:
|
|
340
|
+
username: '',
|
|
341
|
+
password: ''
|
|
295
342
|
};
|
|
296
343
|
|
|
297
344
|
const validationSchema = Yup.object({
|
|
298
|
-
username: Yup.string().required(
|
|
299
|
-
password: Yup.string().required(
|
|
345
|
+
username: Yup.string().required('Username is required'),
|
|
346
|
+
password: Yup.string().required('Password is required')
|
|
300
347
|
});
|
|
301
348
|
|
|
302
349
|
const fields = [
|
|
303
350
|
// Define your form fields here
|
|
304
351
|
];
|
|
305
352
|
|
|
306
|
-
return
|
|
307
|
-
<DynamicForm
|
|
308
|
-
initialValues={initialValues}
|
|
309
|
-
validationSchema={validationSchema}
|
|
310
|
-
fields={fields}
|
|
311
|
-
/>
|
|
312
|
-
);
|
|
353
|
+
return <DynamicForm initialValues={initialValues} validationSchema={validationSchema} fields={fields} />;
|
|
313
354
|
};
|
|
314
355
|
```
|
|
315
356
|
|