groovinads-ui 1.2.75 → 1.9.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 +628 -236
- package/dist/index.es.js +2 -15
- package/dist/index.js +2 -15
- package/index.d.ts +364 -0
- package/package.json +87 -79
- package/.babelrc +0 -3
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -32
- package/.prettierignore +0 -9
- package/.prettierrc +0 -7
- package/.storybook/main.js +0 -19
- package/.storybook/preview-head.html +0 -6
- package/.storybook/preview.js +0 -13
- package/.yarn/releases/yarn-4.1.1.cjs +0 -893
- package/.yarnrc.yml +0 -3
- package/rollup.config.mjs +0 -42
- package/src/components/Button/Button.jsx +0 -78
- package/src/components/Button/index.js +0 -3
- package/src/components/Dropdowns/DropdownComponent.jsx +0 -135
- package/src/components/Dropdowns/DropdownFilter.jsx +0 -304
- package/src/components/Dropdowns/DropdownMultiSelect.jsx +0 -304
- package/src/components/Dropdowns/DropdownSimpleDatePicker.jsx +0 -175
- package/src/components/Dropdowns/DropdownsDatePicker/DropdownDatePicker.jsx +0 -313
- package/src/components/Dropdowns/DropdownsDatePicker/PeriodAndDetailDropdowns.tsx +0 -351
- package/src/components/Dropdowns/DropdownsDatePicker/index.js +0 -3
- package/src/components/Dropdowns/index.js +0 -7
- package/src/components/Inputs/Checkbox.jsx +0 -55
- package/src/components/Inputs/Input.jsx +0 -155
- package/src/components/Inputs/InputChip.jsx +0 -168
- package/src/components/Inputs/InputEmail.jsx +0 -175
- package/src/components/Inputs/Radio.jsx +0 -57
- package/src/components/Inputs/Switch.jsx +0 -70
- package/src/components/Inputs/Textarea.jsx +0 -68
- package/src/components/Inputs/index.js +0 -9
- package/src/components/Labels/Alert.jsx +0 -62
- package/src/components/Labels/Icon.jsx +0 -76
- package/src/components/Labels/LoginSource.jsx +0 -19
- package/src/components/Labels/PillComponent.jsx +0 -47
- package/src/components/Labels/Spinner.jsx +0 -35
- package/src/components/Labels/StatusIcon.jsx +0 -66
- package/src/components/Labels/index.js +0 -8
- package/src/components/Navigation/Dropdowns/DeckDropdown.jsx +0 -210
- package/src/components/Navigation/Dropdowns/DropdownClient.jsx +0 -171
- package/src/components/Navigation/Dropdowns/UserDropdown.jsx +0 -69
- package/src/components/Navigation/Dropdowns/index.js +0 -5
- package/src/components/Navigation/Navbar.jsx +0 -81
- package/src/components/Navigation/Sidebar.jsx +0 -201
- package/src/components/Navigation/Stepper.jsx +0 -22
- package/src/components/Navigation/Tabnav.jsx +0 -73
- package/src/components/Navigation/index.js +0 -6
- package/src/components/Toasts/Toast/ToastCardComponent.jsx +0 -47
- package/src/components/Toasts/ToastComponent.jsx +0 -45
- package/src/components/Toasts/ToastProgress.jsx +0 -118
- package/src/components/Toasts/index.js +0 -4
- package/src/components/index.js +0 -50
- package/src/hooks/index.js +0 -4
- package/src/hooks/useGetBaseDomain.jsx +0 -9
- package/src/hooks/useTextFormatter.jsx +0 -48
- package/src/index.js +0 -51
- package/src/services/components.services.js +0 -29
- package/src/services/helpers.js +0 -32
- package/src/services/index.jsx +0 -10
- package/src/services/url.path.js +0 -29
- package/src/stories/Alert.stories.jsx +0 -11
- package/src/stories/Button.stories.jsx +0 -20
- package/src/stories/Checkbox.stories.jsx +0 -17
- package/src/stories/DropdownComponent.stories.jsx +0 -89
- package/src/stories/DropdownDatePicker.stories.jsx +0 -69
- package/src/stories/DropdownFilter.stories.jsx +0 -60
- package/src/stories/DropdownMultiSelect.stories.jsx +0 -72
- package/src/stories/DropdownSimpleDatePicker.stories.jsx +0 -64
- package/src/stories/Icon.stories.jsx +0 -11
- package/src/stories/Input.stories.jsx +0 -20
- package/src/stories/InputChip.stories.jsx +0 -44
- package/src/stories/InputEmail.stories.jsx +0 -27
- package/src/stories/Layout.stories.jsx +0 -73
- package/src/stories/LoginSource.stories.jsx +0 -11
- package/src/stories/Navbar.stories.jsx +0 -24
- package/src/stories/PillComponent.stories.jsx +0 -22
- package/src/stories/Radio.stories.jsx +0 -18
- package/src/stories/Sidebar.stories.jsx +0 -169
- package/src/stories/Spinner.stories.jsx +0 -11
- package/src/stories/StatusIcon.stories.jsx +0 -11
- package/src/stories/Stepper.stories.jsx +0 -16
- package/src/stories/Switch.stories.jsx +0 -17
- package/src/stories/Tabnav.stories.jsx +0 -55
- package/src/stories/Textarea.stories.jsx +0 -20
- package/src/stories/ToastComponent.stories.jsx +0 -62
- package/src/stories/ToastProgress.stories.jsx +0 -11
- package/version.js +0 -8
package/README.md
CHANGED
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
The library includes the following components:
|
|
15
15
|
|
|
16
16
|
- [Buttons](#buttons):
|
|
17
|
-
|
|
18
17
|
- [Button](#button): For user actions.
|
|
19
18
|
|
|
20
19
|
- [Dropdowns](#dropdowns):
|
|
21
|
-
|
|
22
20
|
- [DropdownComponent](#dropdowncomponent): For dropdown menus.
|
|
23
21
|
- [DropdownDatePicker](#dropdowndatepicker): For filter dropdowns.
|
|
24
22
|
- [DropdownFilter](#dropdownfilter): For filter dropdowns.
|
|
@@ -26,7 +24,6 @@ The library includes the following components:
|
|
|
26
24
|
- [DropdownSimpleDatePicker](#dropdownsimpledatepicker): For filter dropdowns.
|
|
27
25
|
|
|
28
26
|
- [Inputs](#inputs):
|
|
29
|
-
|
|
30
27
|
- [Checkbox](#checkbox): For multiple option selections.
|
|
31
28
|
- [Input](#input): For user data entry.
|
|
32
29
|
- [InputChip](#inputChip): For dynamically managing and displaying keywords.
|
|
@@ -36,35 +33,42 @@ The library includes the following components:
|
|
|
36
33
|
- [Textarea](#textarea): For multiline text input.
|
|
37
34
|
|
|
38
35
|
- [Labels](#labels):
|
|
39
|
-
|
|
40
36
|
- [Alert](#alert): For displaying alerts.
|
|
37
|
+
- [EditableContent](#editablecontent): For inline editing of text content.
|
|
41
38
|
- [Icon](#icon): For displaying icons.
|
|
42
39
|
- [LoginSource](#loginsource): For show icons of login sources.
|
|
43
40
|
- [PillComponent](#pillcomponent): For displaying information.
|
|
44
41
|
- [Spinner](#spinner): For loading animations.
|
|
45
42
|
- [StatusIcon](#statusicon): For displaying status icons.
|
|
46
43
|
|
|
47
|
-
- [
|
|
44
|
+
- [Modals](#modals):
|
|
45
|
+
- [ModalComponent](#modalcomponent): For displaying modals.
|
|
48
46
|
|
|
47
|
+
- [Navigation](#navigation):
|
|
48
|
+
- [Aside](#aside): For displaying aside panels.
|
|
49
49
|
- [Navbar](#navbar): For top navigation bars.
|
|
50
|
+
- [Pagination](#pagination): For pagination of tables.
|
|
50
51
|
- [Sidebar](#sidebar): For side navigation bars.
|
|
51
52
|
- [Stepper](#stepper): For step-by-step navigation.
|
|
52
53
|
- [Tabnav](#tabnav): For tab navigation.
|
|
53
54
|
|
|
54
|
-
- [
|
|
55
|
+
- [Tables](#tables):
|
|
56
|
+
- [TableSkeleton](#tableskeleton): For displaying table skeletons.
|
|
57
|
+
|
|
58
|
+
- [Toasts](#toasts):
|
|
55
59
|
- [ToastComponent](#toastcomponent): For displaying notifications.
|
|
56
60
|
- [ToastProgress](#toastprogress): For displaying progress notifications.
|
|
57
61
|
|
|
58
62
|
# Requirements
|
|
59
63
|
|
|
60
|
-
- The component styles must be included from: `https://ui.groovinads.com/styles.min.css`.
|
|
61
|
-
- **npm** (
|
|
64
|
+
- The component styles must be included from: `https://ui.groovinads.com/2.0.0/styles.min.css`.
|
|
65
|
+
- **npm** (v20 or higher).
|
|
62
66
|
- [Font Awesome](https://fontawesome.com/) icons must be included in the project.
|
|
63
67
|
|
|
64
68
|
## ⚠️ Important: Use of additional CSS libraries
|
|
65
69
|
|
|
66
70
|
When utilizing external libraries that require additional CSS styles, it is important to ensure that these styles are not added directly to individual components.
|
|
67
|
-
Instead, they should be included in the `index.html` file of your project. This ensures that all styles are loaded correctly and in the desired order. Specifically, make sure that the CSS file `https://ui.groovinads.com/styles.min.css` is the last one to be loaded to avoid style conflicts and ensure that the default Groovinads styles have the proper priority.
|
|
71
|
+
Instead, they should be included in the `index.html` file of your project. This ensures that all styles are loaded correctly and in the desired order. Specifically, make sure that the CSS file `https://ui.groovinads.com/2.0.0/styles.min.css` is the last one to be loaded to avoid style conflicts and ensure that the default Groovinads styles have the proper priority.
|
|
68
72
|
|
|
69
73
|
```html
|
|
70
74
|
<!-- Example of how to include additional CSS styles in index.html -->
|
|
@@ -72,7 +76,7 @@ Instead, they should be included in the `index.html` file of your project. This
|
|
|
72
76
|
<!-- Other CSS files -->
|
|
73
77
|
<link rel="stylesheet" href="https://example.com/external-library.css" />
|
|
74
78
|
<!-- Groovinads CSS file, ensure it is the last to be loaded -->
|
|
75
|
-
<link rel="stylesheet" href="https://ui.groovinads.com/styles.min.css" />
|
|
79
|
+
<link rel="stylesheet" href="https://ui.groovinads.com/2.0.0/styles.min.css" />
|
|
76
80
|
</head>
|
|
77
81
|
```
|
|
78
82
|
|
|
@@ -99,11 +103,11 @@ import { Button } from 'groovinads-ui';
|
|
|
99
103
|
<Button
|
|
100
104
|
variant={'outline'}
|
|
101
105
|
size={'xs'}
|
|
102
|
-
|
|
106
|
+
onClick={() => {
|
|
103
107
|
console.log('Button clicked');
|
|
104
108
|
}}
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
startIcon={'plus'}
|
|
110
|
+
endIcon={'arrow-right'}
|
|
107
111
|
style={'warning'}
|
|
108
112
|
className={'mb-5'}
|
|
109
113
|
processing={true}
|
|
@@ -112,55 +116,90 @@ import { Button } from 'groovinads-ui';
|
|
|
112
116
|
</Button>;
|
|
113
117
|
```
|
|
114
118
|
|
|
115
|
-
| Property
|
|
116
|
-
|
|
|
117
|
-
| `children`
|
|
118
|
-
| `className`
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
119
|
+
| Property | Type | Required | Options | Default | Description |
|
|
120
|
+
| ------------------------- | -------- | -------- | --------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
121
|
+
| `children` | Node | No | n/a | n/a | If true, children will be displayed alongside the spinner with '…' added to indicate the processing status in the label. If false, only the spinner will be shown. It can include text, icons, or other components. |
|
|
122
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the button. |
|
|
123
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If true, disables the button. If false, the button is enabled. |
|
|
124
|
+
| `endIcon` | String | No | n/a | n/a | Specifies the name of the icon to be displayed at the end of the button (after the text). |
|
|
125
|
+
| `hideLabelOnMobile` | Boolean | No | `true` `false` | `false` | If true, the text inside the button will not be displayed on mobile. If false, the text will be displayed on mobile. |
|
|
126
|
+
| `onClick` | Function | No | n/a | n/a | Function to be executed when the button is clicked. |
|
|
127
|
+
| `processing` | Boolean | No | `true` `false` | `false` | If true, displays a loading animation (…) with a spinner. If false, it will not be displayed. |
|
|
128
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Defines the size of the button. It's optional. |
|
|
129
|
+
| `startIcon` | String | No | n/a | n/a | Specifies the name of the icon to be displayed at the start of the button (before the text). |
|
|
130
|
+
| `style` | String | No | `default` `success` `danger` `warning` `link` | `default` | Specifies the style variant of the button, which can change its color and visual appearance. It's optional. |
|
|
131
|
+
| `variant` | String | No | `primary` `secondary` `terciary` `outline` | `primary` | Defines the visual style of the button. It's optional. |
|
|
127
132
|
|
|
128
133
|
## Dropdowns
|
|
129
134
|
|
|
135
|
+
All dropdown components support a unified validation system:
|
|
136
|
+
|
|
137
|
+
### Validation System
|
|
138
|
+
|
|
139
|
+
All form dropdowns (DropdownComponent, DropdownFilter, DropdownMultiSelect, DropdownDatePicker, DropdownSimpleDatePicker) share a consistent validation approach:
|
|
140
|
+
|
|
141
|
+
- **`showError`** (Boolean): Controls the visual error state. When `true`, applies the `not-validated` CSS class to the toggle.
|
|
142
|
+
- **`requiredText`** (String): Custom error message displayed via the `data-error` attribute.
|
|
143
|
+
- **External Control**: Validation state is managed by the parent component, providing full flexibility.
|
|
144
|
+
- **Auto-clear**: Error messages can be configured to automatically disappear after 2 seconds (implemented in parent component).
|
|
145
|
+
|
|
146
|
+
**Example validation pattern:**
|
|
147
|
+
|
|
148
|
+
```jsx
|
|
149
|
+
const [showError, setShowError] = useState(false);
|
|
150
|
+
|
|
151
|
+
const handleValidate = () => {
|
|
152
|
+
if (!isValid) {
|
|
153
|
+
setShowError(true);
|
|
154
|
+
// Auto-hide after 2 seconds
|
|
155
|
+
setTimeout(() => setShowError(false), 2000);
|
|
156
|
+
} else {
|
|
157
|
+
setShowError(false);
|
|
158
|
+
// Validation passed
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// In the dropdown component
|
|
163
|
+
<DropdownComponent
|
|
164
|
+
showError={showError}
|
|
165
|
+
requiredText="Please select an option"
|
|
166
|
+
// ... other props
|
|
167
|
+
/>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
|
|
130
173
|
### DropdownComponent
|
|
131
174
|
|
|
132
175
|
```jsx
|
|
133
176
|
import React, { useState } from 'react';
|
|
134
|
-
import { DropdownComponent
|
|
177
|
+
import { DropdownComponent } from 'groovinads-ui';
|
|
135
178
|
import { DropdownMenu, DropdownItem } from 'react-bootstrap';
|
|
136
179
|
|
|
137
180
|
const DropdownComponentExample = () => {
|
|
138
181
|
const [show, setShow] = useState(false);
|
|
139
|
-
|
|
140
|
-
const handleToggle = () => {
|
|
141
|
-
setShow((prevShow) => !prevShow);
|
|
142
|
-
};
|
|
182
|
+
const [selected, setSelected] = useState('');
|
|
143
183
|
|
|
144
184
|
return (
|
|
145
185
|
<DropdownComponent
|
|
146
186
|
show={show}
|
|
147
187
|
setShow={setShow}
|
|
148
|
-
|
|
149
|
-
|
|
188
|
+
autoClose={true}
|
|
189
|
+
label='Category'
|
|
190
|
+
selectedValue={selected}
|
|
191
|
+
variant='input'
|
|
192
|
+
fullWidth
|
|
150
193
|
>
|
|
151
|
-
<Button
|
|
152
|
-
variant='outline'
|
|
153
|
-
icon='plus'
|
|
154
|
-
className='dropdown-toggle'
|
|
155
|
-
onClick={handleToggle}
|
|
156
|
-
>
|
|
157
|
-
<span>Add filter</span>
|
|
158
|
-
<Icon iconName='chevron-down' className='ms-2' />
|
|
159
|
-
</Button>
|
|
160
|
-
|
|
161
194
|
<DropdownMenu>
|
|
162
|
-
<DropdownItem onClick={() =>
|
|
163
|
-
|
|
195
|
+
<DropdownItem onClick={() => setSelected('Option 1')}>
|
|
196
|
+
Option 1
|
|
197
|
+
</DropdownItem>
|
|
198
|
+
<DropdownItem onClick={() => setSelected('Option 2')}>
|
|
199
|
+
Option 2
|
|
200
|
+
</DropdownItem>
|
|
201
|
+
<DropdownItem onClick={() => setSelected('Option 3')}>
|
|
202
|
+
Option 3
|
|
164
203
|
</DropdownItem>
|
|
165
204
|
</DropdownMenu>
|
|
166
205
|
</DropdownComponent>
|
|
@@ -170,37 +209,75 @@ const DropdownComponentExample = () => {
|
|
|
170
209
|
export default DropdownComponentExample;
|
|
171
210
|
```
|
|
172
211
|
|
|
173
|
-
##### Dropdown
|
|
212
|
+
##### Dropdown with submenu
|
|
174
213
|
|
|
175
214
|
```jsx
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
215
|
+
import React, { useState } from 'react';
|
|
216
|
+
import { DropdownComponent } from 'groovinads-ui';
|
|
217
|
+
import { DropdownMenu, DropdownItem } from 'react-bootstrap';
|
|
218
|
+
|
|
219
|
+
const NestedDropdownExample = () => {
|
|
220
|
+
const [showParent, setShowParent] = useState(false);
|
|
221
|
+
const [showChild, setShowChild] = useState(false);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<DropdownComponent
|
|
225
|
+
show={showParent}
|
|
226
|
+
setShow={setShowParent}
|
|
227
|
+
autoClose='outside'
|
|
228
|
+
label='Parent Menu'
|
|
229
|
+
variant='primary'
|
|
230
|
+
>
|
|
231
|
+
<DropdownMenu>
|
|
232
|
+
<DropdownItem>
|
|
233
|
+
<DropdownComponent
|
|
234
|
+
show={showChild}
|
|
235
|
+
setShow={setShowChild}
|
|
236
|
+
autoClose={true}
|
|
237
|
+
label='Child Menu'
|
|
238
|
+
variant='primary'
|
|
239
|
+
isChild
|
|
240
|
+
drop='end'
|
|
241
|
+
>
|
|
242
|
+
<DropdownMenu>
|
|
243
|
+
<DropdownItem>Submenu Item 1</DropdownItem>
|
|
244
|
+
<DropdownItem>Submenu Item 2</DropdownItem>
|
|
245
|
+
<DropdownItem>Submenu Item 3</DropdownItem>
|
|
246
|
+
</DropdownMenu>
|
|
247
|
+
</DropdownComponent>
|
|
248
|
+
</DropdownItem>
|
|
249
|
+
<DropdownItem>Regular Item 1</DropdownItem>
|
|
250
|
+
<DropdownItem>Regular Item 2</DropdownItem>
|
|
251
|
+
</DropdownMenu>
|
|
252
|
+
</DropdownComponent>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export default NestedDropdownExample;
|
|
193
257
|
```
|
|
194
258
|
|
|
195
|
-
| Property
|
|
196
|
-
|
|
|
197
|
-
| `align`
|
|
198
|
-
| `autoClose`
|
|
199
|
-
| `children`
|
|
200
|
-
| `className`
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
259
|
+
| Property | Type | Required | Options | Default | Description |
|
|
260
|
+
| --------------- | ---------------- | -------- | ------------------------------------------------------ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
261
|
+
| `align` | String | No | `start` `end` | `start` | Determines the alignment of the dropdown menu relative to the toggle. |
|
|
262
|
+
| `autoClose` | Boolean / String | No | `true` `false` `outside` `inside` | `false` | Determines when the dropdown should auto-close. If `true` or `inside`, it closes on inside click. If `outside`, it closes on outside click. |
|
|
263
|
+
| `children` | Node | Yes | n/a | n/a | DropdownMenu component to be rendered inside the dropdown. |
|
|
264
|
+
| `className` | String | No | n/a | `''` | Adds a custom CSS class to the dropdown container. |
|
|
265
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the dropdown. |
|
|
266
|
+
| `drop` | String | No | `up` `down` `start` `end` | n/a | Determines the direction in which the dropdown menu will be displayed. Caret icon adapts automatically. |
|
|
267
|
+
| `fullWidth` | Boolean | No | `true` `false` | `false` | If `true`, makes the dropdown menu match the toggle button width dynamically. |
|
|
268
|
+
| `icon` | String | No | n/a | n/a | FontAwesome icon name to display before the label in the toggle button. |
|
|
269
|
+
| `isChild` | Boolean | No | `true` `false` | `false` | If `true`, renders the toggle without button styles (useful for nested dropdowns). |
|
|
270
|
+
| `label` | Node | No | n/a | n/a | Label text for the dropdown toggle button. |
|
|
271
|
+
| `onToggle` | Function | No | n/a | n/a | Callback function triggered when dropdown visibility changes. |
|
|
272
|
+
| `overflow` | Boolean | No | `true` `false` | `false` | Adjusts the dropdown's position to handle overflow situations with fixed positioning. |
|
|
273
|
+
| `requiredText` | String | No | n/a | n/a | Error message displayed when validation fails. Used with `showError` prop. |
|
|
274
|
+
| `selectedValue` | Node | No | n/a | n/a | Selected value to display (used with `variant='input'` to show the current selection). |
|
|
275
|
+
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
276
|
+
| `show` | Boolean | No | `true` `false` | n/a | Controls the visibility of the dropdown. If true, the dropdown is visible; if false, it is hidden. |
|
|
277
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If `true`, displays the dropdown in error state with `not-validated` class. Used for validation. |
|
|
278
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Size of the toggle button. |
|
|
279
|
+
| `style` | String | No | `default` `success` `danger` `warning` `link` | `default` | Style/color scheme of the toggle button. |
|
|
280
|
+
| `variant` | String | No | `primary` `secondary` `terciary` `outline` `input` | `primary` | Variant of the toggle button. Use `input` for form-field style dropdowns with label and selected value display. |
|
|
204
281
|
|
|
205
282
|
### DropdownDatePicker
|
|
206
283
|
|
|
@@ -252,18 +329,22 @@ export default DropdownDatePickerExample;
|
|
|
252
329
|
| `className` | String | No | n/a | n/a | Adds a custom CSS class to the component. |
|
|
253
330
|
| `dateFrom` | String | No | n/a | `null` | Start date. |
|
|
254
331
|
| `dateTo` | String | No | n/a | `null` | End date. |
|
|
332
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the dropdown. If `false`, the dropdown is enabled. |
|
|
255
333
|
| `inputLabel` | String | No | n/a | `period` | Label to display on the dropdown toggle button. |
|
|
256
334
|
| `locked` | Boolean | No | `true` `false` | `false` | Determines if the dropdown is locked. If true, it is not interactive. If false, it is interactive. |
|
|
257
|
-
| `
|
|
335
|
+
| `maxDate` | Object | No | n/a | n/a | Max date filter. |
|
|
336
|
+
| `minDate` | Object | No | n/a | n/a | Min date filter. |
|
|
258
337
|
| `onRemoveFilter` | Function | No | n/a | n/a | Remove the filter when the remove filter button is clicked. |
|
|
338
|
+
| `onToggle` | Function | No | n/a | n/a | Function that is called when the dropdown is toggled. |
|
|
259
339
|
| `overflow` | Boolean | No | `true` `false` | `false` | Adjusts the dropdown's position to handle overflow situations. |
|
|
340
|
+
| `requiredText` | String | No | n/a | n/a | Error message displayed when validation fails. Used with `showError` prop. |
|
|
341
|
+
| `searchLabel` | String | No | n/a | `Search` | Label to display on the search input. |
|
|
260
342
|
| `setDateFrom` | Function | No | n/a | n/a | Allows updating the start date of the date range. Function to update the start date of the range to be selected. |
|
|
261
343
|
| `setDateTo` | Function | No | n/a | n/a | Allows you to update the end date of the selection range. |
|
|
262
344
|
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
263
345
|
| `show` | Boolean | No | `true` `false` | `false` | Controls the visibility of the dropdown. If true, the dropdown is displayed; if false, it is hidden. |
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `maxDate` | Object | No | n/a | n/a | Max date filter. |
|
|
346
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If `true`, displays the dropdown in error state with `not-validated` class. Controlled externally for validation. |
|
|
347
|
+
| `variant` | String | No | `input` `filter` | `input` | Determines the type of dropdown. If `input`, it will be displayed as a button. If `filter`, it will be displayed as a filter dropdown. |
|
|
267
348
|
|
|
268
349
|
### DropdownFilter
|
|
269
350
|
|
|
@@ -286,19 +367,24 @@ import { DropdownFilter } from 'groovinads-ui';
|
|
|
286
367
|
/>;
|
|
287
368
|
```
|
|
288
369
|
|
|
289
|
-
| Property | Type | Required | Options
|
|
290
|
-
| ------------------- | -------- | -------- |
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
301
|
-
| `
|
|
370
|
+
| Property | Type | Required | Options | Default | Description |
|
|
371
|
+
| ------------------- | -------- | -------- | -------------------------- | -------- | --------------------------------------------------------- |
|
|
372
|
+
| `autoClose` | Boolean | No | `true` `false` `outside` | `false` | Controls when the dropdown menu closes. If `false`, the menu does not close on click. If `true`, it closes when clicking an item in the list or outside the menu. If outside, it closes when clicking outside the menu but not when clicking an item in the list. |
|
|
373
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names. |
|
|
374
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the dropdown. If `false`, the dropdown is enabled. |
|
|
375
|
+
| `locked` | Boolean | No | `true` `false` | `false` | If true, the filter cannot be removed. |
|
|
376
|
+
| `menuType` | String | No | `simple` `selection` | `simple` | Type of dropdown menu. |
|
|
377
|
+
| `onRemoveFilter` | Function | No | n/a | n/a | Function to handle filter removal. |
|
|
378
|
+
| `onToggle` | Function | No | n/a | n/a | Function to handle toggle state changes. |
|
|
379
|
+
| `overflow` | Boolean | No | `true` `false` | `false` | Whether to enable overflow strategy for the dropdown. |
|
|
380
|
+
| `requiredText` | String | No | n/a | n/a | Error message displayed when validation fails. Used with `showError` prop. |
|
|
381
|
+
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
382
|
+
| `setValuesSelected` | Function | No | n/a | n/a | Function to set the selected values. |
|
|
383
|
+
| `show` | Boolean | No | `true` `false` | n/a | Controls the visibility of the dropdown. |
|
|
384
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If `true`, displays the dropdown in error state with `not-validated` class. Controlled externally for validation. |
|
|
385
|
+
| `title` | String | No | n/a | n/a | Title of the dropdown filter. |
|
|
386
|
+
| `values` | Array | No | n/a | [ ] | Available values for selection. |
|
|
387
|
+
| `valuesSelected` | Array | No | n/a | [ ] | Available values for selection. |
|
|
302
388
|
|
|
303
389
|
### DropdownMultiSelect
|
|
304
390
|
|
|
@@ -313,11 +399,8 @@ const MultiSelectComponent = () => {
|
|
|
313
399
|
const [show, setShow] = useState(false);
|
|
314
400
|
const [show1, setShow1] = useState(false);
|
|
315
401
|
|
|
316
|
-
const [errorRequired, setErrorRequired] = useState(false);
|
|
317
|
-
const [errorRequired1, setErrorRequired1] = useState(false);
|
|
318
|
-
|
|
319
402
|
const handleToggle = () => setShow((prevShow) => !prevShow);
|
|
320
|
-
const handleToggle1 = () =>
|
|
403
|
+
const handleToggle1 = () => setShow1((prevShow) => !prevShow);
|
|
321
404
|
|
|
322
405
|
const [filters] = useState([
|
|
323
406
|
{ id: 1, name: 'Filter 1', showStatus: '1' },
|
|
@@ -352,10 +435,8 @@ const MultiSelectComponent = () => {
|
|
|
352
435
|
focus={show}
|
|
353
436
|
buttonVariant='primary'
|
|
354
437
|
nowrap={true}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
validate={true}
|
|
358
|
-
requiredText='customizable text'
|
|
438
|
+
showError={false}
|
|
439
|
+
requiredText='Please select at least one filter'
|
|
359
440
|
/>
|
|
360
441
|
{/* OPCION 1 */}
|
|
361
442
|
<DropdownMultiSelect
|
|
@@ -372,10 +453,8 @@ const MultiSelectComponent = () => {
|
|
|
372
453
|
inputLabel={'Filters (array de objetos)'}
|
|
373
454
|
focus={show}
|
|
374
455
|
hasId={false}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
validate={true}
|
|
378
|
-
disableHash={true}
|
|
456
|
+
showError={false}
|
|
457
|
+
requiredText='Please select at least one filter'
|
|
379
458
|
/>
|
|
380
459
|
</>
|
|
381
460
|
);
|
|
@@ -384,32 +463,33 @@ const MultiSelectComponent = () => {
|
|
|
384
463
|
export default MultiSelectComponent;
|
|
385
464
|
```
|
|
386
465
|
|
|
387
|
-
| Property
|
|
388
|
-
|
|
|
389
|
-
| `autoClose`
|
|
390
|
-
| `buttonVariant`
|
|
391
|
-
| `className`
|
|
392
|
-
| `
|
|
393
|
-
| `
|
|
394
|
-
| `
|
|
395
|
-
| `
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
398
|
-
| `
|
|
399
|
-
| `
|
|
400
|
-
| `
|
|
401
|
-
| `
|
|
402
|
-
| `
|
|
403
|
-
| `
|
|
404
|
-
| `
|
|
405
|
-
| `
|
|
406
|
-
| `
|
|
407
|
-
| `
|
|
408
|
-
| `
|
|
409
|
-
| `
|
|
410
|
-
| `
|
|
411
|
-
| `
|
|
412
|
-
| `
|
|
466
|
+
| Property | Type | Required | Options | Default | Description |
|
|
467
|
+
| ---------------------- | ---------------- | -------- | --------------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
468
|
+
| `autoClose` | Boolean / String | No | `true` `false` `inside` `outside` | `false` | Controls when the dropdown menu closes. If `false`, the menu does not close on click. If `true`, it closes when clicking an item in the list or outside the menu. If inside, it closes when clicking an item in the list but not when clicking outside the menu. If outside, it closes when clicking outside the menu but not when clicking an item in the list. |
|
|
469
|
+
| `buttonVariant` | String | No | `input` | `primary` `secondary` `terciary` `outline` | Defines the visual style of the button, used to toggle the dropdown menu. |
|
|
470
|
+
| `className` | String | No | n/a | n/a | Adds custom CSS properties to style the component. |
|
|
471
|
+
| `customKey` | String | No | n/a | n/a | You must provide the name of a key within an object. It will allow customization of the displayed value by internally concatenating and displaying "`nameKey` - `customKey`" |
|
|
472
|
+
| `drop` | String | No | `up` `down` | n/a | Specifies the direction in which the dropdown should open. |
|
|
473
|
+
| `focus` | Boolean | No | `true` `false` | `false` | If true, the search input will be focused when the dropdown is shown. |
|
|
474
|
+
| `hasId` | Boolean | No | `true` `false` | `true` | Controls wether the hashtag and id shows or not in the dropdown options |
|
|
475
|
+
| `idInPill` | Boolean | No | `true` `false` | `false` | If true, ID will be shown in the pill component. |
|
|
476
|
+
| `idKey` | String | No | n/a | n/a | Defines the key used in the object to find the item's ID, allowing for the identification and handling of selected items and other operations within the component. |
|
|
477
|
+
| `inputLabel` | String | No | n/a | '' | Allows customizing the label for the input field within the dropdown menu. |
|
|
478
|
+
| `nameKey` | String | No | n/a | n/a | Defines the key that will be used in the object to display the item's name. |
|
|
479
|
+
| `notMatchedText` | String | No | n/a | 'No match found' | Text displayed when no matching items are found. |
|
|
480
|
+
| `nowrap` | Boolean | No | `true` `false` | `false` | If `true`, the content will be displayed on a single line. If it exceeds the width, a scroll will be shown. If `false`, it will fit the width of the button. If it exceeds, the content will be displayed on multiple lines. |
|
|
481
|
+
| `object` | Boolean | No | `true` `false` | `false` | `object` determines whether the values in values are objects (with properties `nameKey` and `idKey`) or simple values (strings or numbers). |
|
|
482
|
+
| `onToggle` | Function | No | n/a | n/a | Contains the handleToggle function which handles changing the show state between true and false, toggling the visibility of the menu. |
|
|
483
|
+
| `overflow` | Boolean | No | `true` `false` | `false` | Whether to enable overflow strategy for the dropdown. |
|
|
484
|
+
| `requiredText` | String | No | n/a | 'Required' | Error message displayed when validation fails. Used with `showError` prop. |
|
|
485
|
+
| `searchLabel` | String | No | n/a | 'Search' | Label for the search input field. |
|
|
486
|
+
| `setValuesSelected` | Function | No | n/a | n/a | Allows users to control the values that are currently selected. |
|
|
487
|
+
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
488
|
+
| `show` | Boolean | No | `true` `false` | n/a | Controls the visibility of the dropdown. |
|
|
489
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If `true`, displays the dropdown in error state with `not-validated` class. Controlled externally for validation. |
|
|
490
|
+
| `showStatus` | String | No | n/a | String | Filter items by status if applicable. |
|
|
491
|
+
| `values` | Array | No | n/a | [ ] | Available values for selection. |
|
|
492
|
+
| `valuesSelected` | Array / Object | No | n/a | [ ] | Represents the state of the values that are currently selected. |
|
|
413
493
|
|
|
414
494
|
### DropdownSimpleDatePicker
|
|
415
495
|
|
|
@@ -455,18 +535,19 @@ export default DropdownSimpleDatePickerExample;
|
|
|
455
535
|
| Property | Type | Required | Option | Default | Description |
|
|
456
536
|
| -------------- | -------- | -------- | -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
457
537
|
| `className` | String | No | n/a | n/a | Adds a custom CSS class to the component. |
|
|
458
|
-
| `show` | Boolean | No | `true` `false` | `false` | Controls the visibility of the dropdown. If true, the dropdown is displayed; if false, it is hidden. |
|
|
459
|
-
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
460
|
-
| `onToggle` | Function | No | n/a | n/a | Function that is called when the dropdown is toggled. |
|
|
461
|
-
| `inputLabel` | String | No | n/a | `period` | Label to display on the dropdown toggle button. |
|
|
462
|
-
| `overflow` | Boolean | No | `true` `false` | `false` | Adjusts the dropdown's position to handle overflow situations. |
|
|
463
538
|
| `date` | String | No | n/a | `null` | Selected date. |
|
|
464
|
-
| `
|
|
539
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the dropdown. If `false`, the dropdown is enabled. |
|
|
465
540
|
| `handleClear` | Function | No | n/a | n/a | Allows providing, as needed, a function to reset the date, update the state as necessary, etc. If none is provided, the date will be cleared by default. |
|
|
466
|
-
| `
|
|
541
|
+
| `inputLabel` | String | No | n/a | `period` | Label to display on the dropdown toggle button. |
|
|
467
542
|
| `maxDate` | Object | No | n/a | n/a | Max date filter. |
|
|
543
|
+
| `minDate` | Object | No | n/a | n/a | Min date filter. |
|
|
544
|
+
| `onToggle` | Function | No | n/a | n/a | Function that is called when the dropdown is toggled. |
|
|
545
|
+
| `overflow` | Boolean | No | `true` `false` | `false` | Adjusts the dropdown's position to handle overflow situations. |
|
|
468
546
|
| `requiredText` | String | No | n/a | n/a | Text displayed when input validation fails, used to indicate an error. |
|
|
469
|
-
| `
|
|
547
|
+
| `setDate` | Function | No | n/a | n/a | Function that updates the start date. |
|
|
548
|
+
| `setShow` | Function | No | n/a | n/a | Function to update the visibility state of the dropdown. |
|
|
549
|
+
| `show` | Boolean | No | `true` `false` | `false` | Controls the visibility of the dropdown. If true, the dropdown is displayed; if false, it is hidden. |
|
|
550
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If true, the input will be displayed with an error. |
|
|
470
551
|
|
|
471
552
|
### Checkbox
|
|
472
553
|
|
|
@@ -497,9 +578,11 @@ export default CheckboxComponent;
|
|
|
497
578
|
| ----------- | -------- | -------- | -------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
|
|
498
579
|
| `children` | Node | No | n/a | n/a | Content that is rendered as the label for the checkbox. |
|
|
499
580
|
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the checkbox. |
|
|
581
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the checkbox. If `false`, the checkbox is enabled. |
|
|
500
582
|
| `id` | String | No | n/a | n/a | The unique identifier for the checkbox. It's required for associating the label and checkbox. |
|
|
501
583
|
| `name` | String | No | n/a | n/a | The `name` attribute of the checkbox. Used to identify the form data after it's submitted. |
|
|
502
584
|
| `setStatus` | Function | No | n/a | n/a | Function to set the `status` of the checkbox. This is a handler function typically used for state management. |
|
|
585
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Sets the size of the checkbox. |
|
|
503
586
|
| `status` | Boolean | No | `true` `false` | `false` | Indicates whether the checkbox is checked, `true` or unchecked `false`. |
|
|
504
587
|
|
|
505
588
|
### Input
|
|
@@ -545,28 +628,28 @@ const InputComponent = () => {
|
|
|
545
628
|
export default InputComponent;
|
|
546
629
|
```
|
|
547
630
|
|
|
548
|
-
| Property | Type | Required | Options | Default
|
|
549
|
-
| -------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
550
|
-
| `autoFocus` | Boolean | No | `true` `false` | `false`
|
|
551
|
-
| `className` | String | No | n/a | n/a
|
|
552
|
-
| `disabled` | Boolean | No | `true` `false` | `false`
|
|
553
|
-
| `focus` | Boolean | No | `true` `false` | `false`
|
|
554
|
-
| `helpText` | String | No | n/a | n/a
|
|
555
|
-
| `icon` | String | No | n/a | n/a
|
|
556
|
-
| `label` | String | No | n/a | '
|
|
557
|
-
| `max` | Number | No | n/a | n/a
|
|
558
|
-
| `maxLength` | Number | No | n/a | n/a
|
|
559
|
-
| `min` | Number | No | n/a | n/a
|
|
560
|
-
| `name` | String | No | n/a | n/a
|
|
561
|
-
| `onChange` | Function | No | n/a | n/a
|
|
562
|
-
| `prefix` | String | No | n/a | n/a
|
|
563
|
-
| `requiredText` | String | No | n/a | n/a
|
|
564
|
-
| `setShowError` | Function | No | n/a | n/a
|
|
565
|
-
| `
|
|
566
|
-
| `
|
|
567
|
-
| `
|
|
568
|
-
| `type` | String | No | `color` `date` `datetime-local` `email` `file` `image` `month` `number` `password` `tel` `text` `time` `url` `week` | `text`
|
|
569
|
-
| `value` | String / Number | No | n/a | n/a
|
|
631
|
+
| Property | Type | Required | Options | Default | Description |
|
|
632
|
+
| -------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
633
|
+
| `autoFocus` | Boolean | No | `true` `false` | `false` | If true, automatically focuses the input when the component mounts. |
|
|
634
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the input. |
|
|
635
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If true, disables the input field. |
|
|
636
|
+
| `focus` | Boolean | No | `true` `false` | `false` | Controls whether the input field should automatically receive focus when the component is rendered. |
|
|
637
|
+
| `helpText` | String | No | n/a | n/a | Optional text under the input to guide the user or provide additional information. |
|
|
638
|
+
| `icon` | String | No | n/a | n/a | Specifies the name of the icon to be displayed inside the input. |
|
|
639
|
+
| `label` | String | No | n/a | 'Input label' | Input field that handles different `type` of data based on the assigned type prop. Allows for adding icons, managing error messages, and other functionalities. |
|
|
640
|
+
| `max` | Number | No | n/a | n/a | Specifies the maximum value that the input field can accept. |
|
|
641
|
+
| `maxLength` | Number | No | n/a | n/a | Specifies the maximum number of characters that the input field can accept. |
|
|
642
|
+
| `min` | Number | No | n/a | n/a | Specifies the minimum value that the input field can accept. |
|
|
643
|
+
| `name` | String | No | n/a | n/a | Indicates the name attribute for the input element, which represents the form data after it is submitted. |
|
|
644
|
+
| `onChange` | Function | No | n/a | n/a | Allows the user to update the value of the input field and synchronizes the field's value with the component's internal state. |
|
|
645
|
+
| `prefix` | String | No | n/a | n/a | Text or characters to display at the start of the input, e.g., 'USD' for currency. |
|
|
646
|
+
| `requiredText` | String | No | n/a | n/a | Text displayed when input validation fails, used to indicate an error. |
|
|
647
|
+
| `setShowError` | Function | No | n/a | n/a | Function used to change the state of `showError`. |
|
|
648
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If true, indicates that an error message should be displayed, usually controlled by `setShowError`. |
|
|
649
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Sets the size of the input field. |
|
|
650
|
+
| `suffix` | String | No | n/a | n/a | Optional suffix text to display inside the input field. |
|
|
651
|
+
| `type` | String | No | `color` `date` `datetime-local` `email` `file` `image` `month` `number` `password` `tel` `text` `time` `url` `week` | `text` | Type of input |
|
|
652
|
+
| `value` | String / Number | No | n/a | n/a | The value of the input. |
|
|
570
653
|
|
|
571
654
|
### InputChip
|
|
572
655
|
|
|
@@ -610,18 +693,21 @@ export default ExampleInputChip;
|
|
|
610
693
|
|
|
611
694
|
```
|
|
612
695
|
|
|
613
|
-
| Property | Type | Required | Options | Default
|
|
614
|
-
| --------------------------- | ------- | -------- | ------------------------------------------------------------------------- |
|
|
615
|
-
| `
|
|
616
|
-
| `
|
|
617
|
-
| `
|
|
618
|
-
| `
|
|
619
|
-
| `
|
|
620
|
-
| `
|
|
621
|
-
| `
|
|
622
|
-
| `
|
|
623
|
-
| `
|
|
624
|
-
| `
|
|
696
|
+
| Property | Type | Required | Options | Default | Description |
|
|
697
|
+
| --------------------------- | ------- | -------- | ------------------------------------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
698
|
+
| `autoFocus` | Boolean | No | `true` `false` | `false` | If true, automatically focuses the input when the component mounts. |
|
|
699
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the inputChip. |
|
|
700
|
+
| `counter` | Boolean | No | n/a | `false` | If true, it will display a progressive and numeric counter of keywords. If false, it will not display it. |
|
|
701
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the inputChip. If `false`, the inputChip is enabled. |
|
|
702
|
+
| `duplicateKeywordErrorText` | String | No | n/a | 'Duplicate keyword.' | Allows you to add a custom message when trying to add a keyword that already exists. |
|
|
703
|
+
| `keywordsList` | Array | Yes | n/a | n/a | This property expects an array of keywords. You can initialize it as an empty array or with keywords, and it will be updated when new keywords are added or removed from the input field. |
|
|
704
|
+
| `maxKeywords` | Number | Yes | n/a | n/a | Indicates the maximum number of allowed keywords. When the keywordsList reaches this limit, an error message defined in requiredText will be displayed. Additionally, if the counter is enabled, its status will change to the 'danger' color. |
|
|
705
|
+
| `maxKeywordLength` | Number | No | n/a | n/a | Indicates the maximum length of each keyword. When a keyword exceeds this limit, an error message defined in `duplicateKeywordErrorText` will be displayed. |
|
|
706
|
+
| `pillColor` | String | No | `blue` `danger` `dark` `green` `light` `midtone` `neutral` `red` `yellow` | `neutral` | Define the color of the keyword. |
|
|
707
|
+
| `placeholder` | String | Yes | n/a | 'Add keywords…' | Displays a suggested or descriptive text inside the input field before the user types. |
|
|
708
|
+
| `recomendedKeywords` | Number | No | n/a | n/a | Specifies the recommended number of keywords. When the keywords list (`keywordsList`) reaches the recommended number, the counter's status will change to the 'warning' color. |
|
|
709
|
+
| `requiredText` | String | Yes | n/a | n/a | Texto que se mostrará como error cuando la lista de keywords (keywordsList) alcance el límite máximo definido en maxKeywords. |
|
|
710
|
+
| `setKeywordsList` | String | Yes | n/a | n/a | Dynamically updates the list of keywords. It is called when a new keyword is added or removed from the list. The updated array will be passed to the `keywordsList` prop. |
|
|
625
711
|
|
|
626
712
|
### InputEmail
|
|
627
713
|
|
|
@@ -649,15 +735,16 @@ const ExampleInputEmail = () => {
|
|
|
649
735
|
export default ExampleInputChip;
|
|
650
736
|
```
|
|
651
737
|
|
|
652
|
-
| Property | Type | Required | Options | Default
|
|
653
|
-
| -------------- | ------- | -------- | -------------- |
|
|
654
|
-
| `apiGetEmail` | Array | Yes | n/a | n/a
|
|
655
|
-
| `apiPostEmail` | String | Yes | n/a | n/a
|
|
656
|
-
| `
|
|
657
|
-
| `
|
|
658
|
-
| `
|
|
659
|
-
| `
|
|
660
|
-
| `
|
|
738
|
+
| Property | Type | Required | Options | Default | Description |
|
|
739
|
+
| -------------- | ------- | -------- | -------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
740
|
+
| `apiGetEmail` | Array | Yes | n/a | n/a | Endpoint required to fetch the email list. The response should be an array of strings (or empy array) displayed below the input and `titleList`. |
|
|
741
|
+
| `apiPostEmail` | String | Yes | n/a | n/a | An endpoint is required to add or remove emails from the existing email list. |
|
|
742
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the inputEmail. If `false`, the inputEmail is enabled. |
|
|
743
|
+
| `label` | String | No | n/a | 'Email addresses' | Allows adding custom text as the input label. |
|
|
744
|
+
| `showModal` | Boolean | No | `true` `false` | `true` | If true, the email list received from apiGetEmail will be shown when rendering InputEmail. |
|
|
745
|
+
| `textButton` | String | No | n/a | 'Add' | Allows adding custom text to the button for adding emails. |
|
|
746
|
+
| `textError` | String | No | n/a | 'You must enter a valid email address' | Allows adding custom error text when entering an invalid email address. |
|
|
747
|
+
| `titleList` | String | No | n/a | 'Added emails' | Allows adding a custom text that will be shown as the title of the email list. |
|
|
661
748
|
|
|
662
749
|
### Radio
|
|
663
750
|
|
|
@@ -678,10 +765,14 @@ import { Radio } from 'groovinads-ui';
|
|
|
678
765
|
|
|
679
766
|
| Property | Type | Required | Options | Default | Description |
|
|
680
767
|
| ----------- | -------- | -------- | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
768
|
+
| `children` | Node | Yes | n/a | n/a | Content to be displayed inside the radio button. |
|
|
681
769
|
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the radio button. |
|
|
770
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the radio button. If `false`, the radio button is enabled. |
|
|
682
771
|
| `id` | String | No | n/a | n/a | The unique identifier for the radio button. It is used for linking the label and the radio button. |
|
|
772
|
+
| `fullWidth` | Boolean | No | `true` `false` | `false` | If `true`, the radio button will take the full width of its container. |
|
|
683
773
|
| `name` | String | No | n/a | n/a | The name attribute of the radio button. Used to group multiple radios into a single group. |
|
|
684
774
|
| `setStatus` | Function | No | n/a | n/a | It is used to update the selection state of the radio button based on user interaction. |
|
|
775
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Sets the size of the radio button. |
|
|
685
776
|
| `status` | Boolean | No | `true` `false` | `false` | Indicates whether the radio button is selected (true, the radio button appears selected) or not (false, it appears unselected). |
|
|
686
777
|
|
|
687
778
|
### Switch
|
|
@@ -702,11 +793,14 @@ import { Switch } from 'groovinads-ui';
|
|
|
702
793
|
|
|
703
794
|
| Property | Type | Required | Options | Default | Description |
|
|
704
795
|
| ---------------- | ---------------- | -------- | -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
796
|
+
| `children` | Node | No | n/a | n/a | Content to be displayed inside the switch. |
|
|
705
797
|
| `className` | String | No | n/a | ' ' | Additional CSS class names that can be applied to the switch. |
|
|
798
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the switch. If `false`, the switch is enabled. |
|
|
706
799
|
| `icon` | Boolean | No | `true` `false` | `false` | If `true`, displays an icon (play/pause) inside the switch. |
|
|
707
800
|
| `id` | String | No | n/a | n/a | It will be used as the id of the switch input. If not specified, an ID will be automatically generated based on the text of the children. |
|
|
708
801
|
| `name` | String | No | n/a | n/a | The name attribute of the switch. Used to identify the form data after it's submitted. |
|
|
709
802
|
| `setStatus` | Function | No | n/a | n/a | Function to set the `status` of the switch. This is a handler function typically used for state management. |
|
|
803
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Sets the size of the switch. |
|
|
710
804
|
| `status` | Number / Boolean | No | `0` `1` | `0` | Indicates whether the switch is on (`1` / `true`) or off (`0` / `false`). |
|
|
711
805
|
| `switchPosition` | String | No | `start` `end` | `start` | Determines the position of the switch relative to the label. |
|
|
712
806
|
|
|
@@ -726,18 +820,19 @@ import { Textarea } from 'groovinads-ui';
|
|
|
726
820
|
/>;
|
|
727
821
|
```
|
|
728
822
|
|
|
729
|
-
| Property | Type | Required | Options | Default
|
|
730
|
-
| -------------- | -------- | -------- | -------------- |
|
|
731
|
-
| `className` | String | No | n/a | n/a
|
|
732
|
-
| `
|
|
733
|
-
| `
|
|
734
|
-
| `
|
|
735
|
-
| `
|
|
736
|
-
| `
|
|
737
|
-
| `
|
|
738
|
-
| `
|
|
739
|
-
| `
|
|
740
|
-
| `
|
|
823
|
+
| Property | Type | Required | Options | Default | Description |
|
|
824
|
+
| -------------- | -------- | -------- | -------------- | ----------------- | ------------------------------------------------------------------------------------------ |
|
|
825
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the textarea. |
|
|
826
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the textarea. If `false`, the textarea is enabled. |
|
|
827
|
+
| `helpText` | String | No | n/a | n/a | Optional text under the textarea to guide the user or provide additional help information. |
|
|
828
|
+
| `label` | String | No | n/a | 'Textarea label' | Text label for the textarea field. |
|
|
829
|
+
| `name` | String | No | n/a | n/a | Attribute of the textarea. Used to identify the form data after it's submitted. |
|
|
830
|
+
| `onChange` | Function | No | n/a | n/a | Function to handle changes to the textarea's value. Typically used to update state. |
|
|
831
|
+
| `requiredText` | String | No | n/a | n/a | Text displayed when textarea validation fails, used to indicate an error. |
|
|
832
|
+
| `setShowError` | Function | No | n/a | n/a | Function to set the visibility of the error message. |
|
|
833
|
+
| `showError` | Boolean | No | `true` `false` | `false` | If true, indicates that an error message should be displayed controlled by `setShowError`. |
|
|
834
|
+
| `size` | String | No | `xs` `md` `lg` | `md` | Sets the size of the textarea field. |
|
|
835
|
+
| `value` | String | No | n/a | n/a | The value of the textarea. |
|
|
741
836
|
|
|
742
837
|
## Labels
|
|
743
838
|
|
|
@@ -775,9 +870,28 @@ export default ExampleAlert;
|
|
|
775
870
|
| `className` | String | No | n/a | n/a | Additional CSS class for the alert. |
|
|
776
871
|
| `icon` | Boolean | No | `true` `false` | `true` | If true, displays an icon in the alert. The icon can vary depending on the alert `type` and settings. If false, no icon is displayed in the alert. |
|
|
777
872
|
| `onClose` | Function | No | n/a | `null` | By default, `onClose` is `null`. You can provide a function for this property, which allows you to perform additional actions when the alert is closed. |
|
|
778
|
-
| `size` | String | No | `xs` `md` `lg` `md` | `
|
|
873
|
+
| `size` | String | No | `xs` `md` `lg` `md` | `md` | Size of the alert. |
|
|
779
874
|
| `type` | String | Yes | `info` `success` `warning` `danger` | `info` | Type of alert to display. Each `type` has a specific associated icon. |
|
|
780
875
|
|
|
876
|
+
|
|
877
|
+
### EditableContent
|
|
878
|
+
|
|
879
|
+
```jsx
|
|
880
|
+
import React from 'react';
|
|
881
|
+
import { EditableContent } from 'groovinads-ui';
|
|
882
|
+
|
|
883
|
+
<EditableContent value='Hello, world!' onChange={() => console.log('changed')} onSave={() => console.log('saved')} />;
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
| Property | Type | Required | Options | Default | Description |
|
|
887
|
+
| ----------- | -------- | -------- | ---------------------------------------------- | -------- | ------------------------------------------------------|
|
|
888
|
+
| `as` | String | Yes | `h1` `h2` `h3` `h4` `h5` `h6` `p` `span` `div` | n/a | The HTML element to render the content. |
|
|
889
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the editable content. |
|
|
890
|
+
| `onChange` | Function | Yes | n/a | n/a | Function to handle changes to the editable content. |
|
|
891
|
+
| `onSave` | Function | Yes | n/a | n/a | Function to handle saving the editable content. |
|
|
892
|
+
| `value` | String | No | n/a | n/a | The value of the editable content. |
|
|
893
|
+
|
|
894
|
+
|
|
781
895
|
### Icon
|
|
782
896
|
|
|
783
897
|
```jsx
|
|
@@ -787,7 +901,7 @@ import { Icon } from 'groovinads-ui';
|
|
|
787
901
|
<Icon
|
|
788
902
|
style='solid'
|
|
789
903
|
scale={1}
|
|
790
|
-
|
|
904
|
+
name='location-dot'
|
|
791
905
|
className=''
|
|
792
906
|
animation=''
|
|
793
907
|
/>;
|
|
@@ -797,9 +911,9 @@ import { Icon } from 'groovinads-ui';
|
|
|
797
911
|
| ----------- | ------ | -------- | ----------------------------------------------------------------------- | -------------------- | ---------------------------------- |
|
|
798
912
|
| `animation` | String | No | `beat` `fade` `beat-fade` `bounce` `flip` `shake` `spin` `spin-reverse` | String | Animation for the icon. |
|
|
799
913
|
| `className` | String | No | n/a | n/a | Additional CSS class for the icon. |
|
|
800
|
-
| `
|
|
914
|
+
| `name` | String | No | n/a | `user-bounty-hunter` | Name of the icon. |
|
|
801
915
|
| `scale` | Number | No | `0.7`, `1`, `2`, `3`, `4` | `1` | Scale of the icon. |
|
|
802
|
-
| `style` | String | No | `light` `solid` `regular` `thin` `duotone` `sharp`
|
|
916
|
+
| `style` | String | No | `light` `solid` `regular` `thin` `duotone` `sharp` `brands` | `solid` | Style of the icon. |
|
|
803
917
|
|
|
804
918
|
### LoginSource
|
|
805
919
|
|
|
@@ -810,9 +924,10 @@ import { LoginSource } from 'groovinads-ui';
|
|
|
810
924
|
<LoginSource logo={'groovinads'} />;
|
|
811
925
|
```
|
|
812
926
|
|
|
813
|
-
| Property
|
|
814
|
-
|
|
|
815
|
-
| `
|
|
927
|
+
| Property | Type | Required | Options | Default | Description |
|
|
928
|
+
| ----------- | ------ | -------- | ---------------------------------------------------- | ------------ | -------------------------------------------------------------- |
|
|
929
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the login source button. |
|
|
930
|
+
| `logo` | String | No | `groovinads` `google` `microsoft` `linkedin` `slack` | `groovinads` | Specifies the logo to be displayed on the login source button. |
|
|
816
931
|
|
|
817
932
|
### PillComponent
|
|
818
933
|
|
|
@@ -854,6 +969,7 @@ export default PillComponentExample;
|
|
|
854
969
|
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the pill. Defaults to an empty string. |
|
|
855
970
|
| `closeButton` | Boolean | No | `true` `false` | `false` | If true, a close button is displayed on the pill, allowing it to be dismissed. If false, no close button is shown. |
|
|
856
971
|
| `color` | String | No | `blue` `danger` `dark` `green` `light` `midtone` `neutral` `red` `yellow` | `neutral` | Specifies the background color of the pill. |
|
|
972
|
+
| `disabled` | Boolean | No | `true` `false` | `false` | If `true`, disables the pill. If `false`, the pill is enabled. |
|
|
857
973
|
| `onClick` | Function | No | n/a | n/a | Handles the click event to close the pill. This property is only relevant if closeButton is set to true. |
|
|
858
974
|
|
|
859
975
|
### Spinner
|
|
@@ -866,10 +982,10 @@ import { Spinner } from 'groovinads-ui';
|
|
|
866
982
|
<Spinner scale={3} className='m-5' />;
|
|
867
983
|
```
|
|
868
984
|
|
|
869
|
-
| Property | Type | Required | Options
|
|
870
|
-
| ----------- | ------ | -------- |
|
|
871
|
-
| `
|
|
872
|
-
| `
|
|
985
|
+
| Property | Type | Required | Options | Default | Description |
|
|
986
|
+
| ----------- | ------ | -------- | --------------------- | ------- | ------------------------------------- |
|
|
987
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the spinner. |
|
|
988
|
+
| `scale` | Number | No | `0.7` `1` `2` `3` `4` | `1` | Scale (size) of the spinner. |
|
|
873
989
|
|
|
874
990
|
### StatusIcon
|
|
875
991
|
|
|
@@ -898,8 +1014,78 @@ export default StatusIconExamples;
|
|
|
898
1014
|
| `className` | String | No | n/a | n/a | Add additional CSS class names for custom styling. |
|
|
899
1015
|
| `status` | Number | Yes | `0` `1` `3` `4` `5` | `0` | Specifies the visual state of the icon: Inactive (`0`), active (`1`), active-warning (`3`), warning (`4`), and danger (`5`). Each state reflects a specific condition of the system or interface. |
|
|
900
1016
|
|
|
1017
|
+
## Modals
|
|
1018
|
+
|
|
1019
|
+
### ModalComponent
|
|
1020
|
+
|
|
1021
|
+
```jsx
|
|
1022
|
+
import React from 'react';
|
|
1023
|
+
import { ModalComponent } from 'groovinads-ui';
|
|
1024
|
+
|
|
1025
|
+
<ModalComponent
|
|
1026
|
+
show={show}
|
|
1027
|
+
setShow={setShow}
|
|
1028
|
+
header={'Modal title'}
|
|
1029
|
+
footer={
|
|
1030
|
+
<>
|
|
1031
|
+
<div className='d-flex justify-content-end flex-row w-100 gap-3'>
|
|
1032
|
+
<Button
|
|
1033
|
+
variant='primary'
|
|
1034
|
+
onClick={() => {
|
|
1035
|
+
alert('Action confirmed');
|
|
1036
|
+
setShow(false);
|
|
1037
|
+
}}
|
|
1038
|
+
>
|
|
1039
|
+
Confirm
|
|
1040
|
+
</Button>
|
|
1041
|
+
<Button variant='secondary' onClick={() => setShow(false)}>
|
|
1042
|
+
Cancel
|
|
1043
|
+
</Button>
|
|
1044
|
+
</div>
|
|
1045
|
+
<Button variant='terciary' onClick={() => setShow(false)}>Adios</Button>
|
|
1046
|
+
</>
|
|
1047
|
+
}
|
|
1048
|
+
>
|
|
1049
|
+
<p>
|
|
1050
|
+
This is the content of the modal. Here you can add any
|
|
1051
|
+
information or form that you need.
|
|
1052
|
+
</p>
|
|
1053
|
+
</ModalComponent>
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1057
|
+
| ------------------ | ----------------- | -------- | --------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1058
|
+
| `className` | String | No | n/a | n/a | Allows adding custom CSS classes to the Modal. |
|
|
1059
|
+
| `children` | Node | Yes | n/a | n/a | Allows inserting custom content within the Modal. |
|
|
1060
|
+
| `footer` | Node | No | n/a | n/a | Allows inserting custom content within the Modal footer. If not provided, the footer is not displayed. |
|
|
1061
|
+
| `header` | String / Node | Yes | n/a | n/a | Allows inserting custom content within the Modal header. |
|
|
1062
|
+
| `setShow` | Function | Yes | n/a | n/a | Function to toggle the visibility state between visible and hidden. |
|
|
1063
|
+
| `show` | Boolean | Yes | `true` `false` | n/a | Controls the visibility of the Modal. If `true`, the Modal is displayed; if `false`, it is hidden. |
|
|
1064
|
+
| `size` | String | No | `sm` `md` `lg` | `md` | Sets the size of the Modal. It's optional. |
|
|
1065
|
+
| `type` | String | No | `default` `confirmation` `error` | `default` | Defines the type of the modal (optional). Each type has its own animation and behavior. If set to `default`, a class is added that applies `flow-reverse`, making the footer buttons appear inverted (on the right, not applied on mobile); if set to `confirmation` or `error`, they appear on the left. Defaults to default if not specified. |
|
|
1066
|
+
|
|
901
1067
|
## Navigation
|
|
902
1068
|
|
|
1069
|
+
### Aside
|
|
1070
|
+
```jsx
|
|
1071
|
+
import React from 'react';
|
|
1072
|
+
import { Aside } from 'groovinads-ui';
|
|
1073
|
+
|
|
1074
|
+
<Aside show={show} onHide={() => setShow(false)} header='Aside Title'>
|
|
1075
|
+
<p>This is the default aside panel. It slides in from the right side of the screen and includes a header with a close button.</p>
|
|
1076
|
+
</Aside>
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1080
|
+
| ----------------- | ----------------- | -------------- | -------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1081
|
+
| `backdrop` | Boolean | No | `true` `false` | `false` | Controls the visibility of the backdrop. If `true`, the backdrop is displayed; if `false`, it is hidden. |
|
|
1082
|
+
| `belowNavbar` | Boolean | No | `true` `false` | `false` | Controls the position of the aside below the navbar. If `true`, the aside is displayed below the navbar; if `false`, it is displayed on the right side of the screen. |
|
|
1083
|
+
| `children` | Node | No | n/a | n/a | Allows inserting custom content within the Aside. |
|
|
1084
|
+
| `className` | String | No | n/a | n/a | Additional CSS class names that can be applied to the aside. Defaults to an empty string. |
|
|
1085
|
+
| `header` | String / Node | Yes | n/a | n/a | Allows inserting custom content within the Aside header. |
|
|
1086
|
+
| `onHide` | Function | No | n/a | n/a | n/a | Function to toggle the visibility state between visible and hidden. |
|
|
1087
|
+
| `show` | Boolean | No | `true` `false` | `false` | n/a | Controls the visibility of the Aside. If `true`, the Aside is displayed; if `false`, it is hidden. |
|
|
1088
|
+
|
|
903
1089
|
### Navbar
|
|
904
1090
|
|
|
905
1091
|
```jsx
|
|
@@ -928,14 +1114,182 @@ const NavbarComponent = () => {
|
|
|
928
1114
|
export default NavbarComponent;
|
|
929
1115
|
```
|
|
930
1116
|
|
|
931
|
-
| Property
|
|
932
|
-
|
|
|
933
|
-
| `children`
|
|
934
|
-
| `logoUrl`
|
|
935
|
-
| `
|
|
936
|
-
| `
|
|
937
|
-
| `
|
|
938
|
-
| `
|
|
1117
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1118
|
+
| ----------------- | -------- | -------- | -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
1119
|
+
| `children` | Node | No | n/a | n/a | Allows inserting custom content within the Navbar. |
|
|
1120
|
+
| `logoUrl` | String | No | n/a | Groovinads logo | Accepts a URL to customize the logo image. If empty, show the Groovinads logo. |
|
|
1121
|
+
| `logoUrlMobile` | String | No | n/a | Groovinads logo | Accepts a URL for the mobile version of the logo. If not provided, uses `logoUrl` on mobile devices. |
|
|
1122
|
+
| `setShow` | Function | No | n/a | n/a | Function to toggle the visibility state between visible and hidden. |
|
|
1123
|
+
| `show` | Boolean | No | `true` `false` | n/a | Controls the visibility of the sidebar. If `true`, the sidebar is displayed; if `false`, it is hidden. |
|
|
1124
|
+
| `showDeckMenu` | Boolean | No | `true` `false` | `false` | Controls the visibility of the deck menu in the navbar. If `true`, it is displayed; if `false`, it is hidden. |
|
|
1125
|
+
| `showUserMenu` | Boolean | No | `true` `false` | `false` | Controls the visibility of the user menu. If `true`, the user menu is shown; if `false`, it is hidden. |
|
|
1126
|
+
|
|
1127
|
+
### Pagination
|
|
1128
|
+
|
|
1129
|
+
```jsx
|
|
1130
|
+
import React from 'react';
|
|
1131
|
+
import { Pagination } from 'groovinads-ui';
|
|
1132
|
+
|
|
1133
|
+
const PaginationComponent = () => {
|
|
1134
|
+
return (
|
|
1135
|
+
<div>
|
|
1136
|
+
<Table className='table shadow-1'>
|
|
1137
|
+
<thead>
|
|
1138
|
+
<tr>
|
|
1139
|
+
<th>ID</th>
|
|
1140
|
+
<th>Name</th>
|
|
1141
|
+
<th>Status</th>
|
|
1142
|
+
</tr>
|
|
1143
|
+
</thead>
|
|
1144
|
+
<tbody>
|
|
1145
|
+
<tr>
|
|
1146
|
+
<td>1</td>
|
|
1147
|
+
<td>John Doe</td>
|
|
1148
|
+
<td>Active</td>
|
|
1149
|
+
</tr>
|
|
1150
|
+
<tr>
|
|
1151
|
+
<td>2</td>
|
|
1152
|
+
<td>Jane Doe</td>
|
|
1153
|
+
<td>Inactive</td>
|
|
1154
|
+
</tr>
|
|
1155
|
+
...
|
|
1156
|
+
</tbody>
|
|
1157
|
+
</Table>
|
|
1158
|
+
<Pagination
|
|
1159
|
+
{...args}
|
|
1160
|
+
currentPage={currentPage}
|
|
1161
|
+
totalPages={totalPages}
|
|
1162
|
+
pageSize={pageSize}
|
|
1163
|
+
onPageChange={handlePageChange}
|
|
1164
|
+
onPageSizeChange={handlePageSizeChange}
|
|
1165
|
+
onPrevPage={handlePrevPage}
|
|
1166
|
+
onNextPage={handleNextPage}
|
|
1167
|
+
pageSizeOptions={[10, 50, 100]}
|
|
1168
|
+
showPerPageLabel='Show per page'
|
|
1169
|
+
/>
|
|
1170
|
+
</div>
|
|
1171
|
+
);
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
export default PaginationComponent;
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1178
|
+
| ----------------- | -------- | -------- | ---------------- | ------------------- | ---------------------------------------------------------|
|
|
1179
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the pagination. |
|
|
1180
|
+
| `currentPage` | Number | Yes | n/a | n/a | The current page number. |
|
|
1181
|
+
| `pageSize` | Number | Yes | n/a | n/a | The number of items per page. |
|
|
1182
|
+
| `onPageChange` | Function | Yes | n/a | n/a | The function to call when the page changes. |
|
|
1183
|
+
| `onPageSizeChange`| Function | Yes | n/a | n/a | The function to call when the page size changes. |
|
|
1184
|
+
| `onPrevPage` | Function | Yes | n/a | n/a | The function to call when the previous page is clicked. |
|
|
1185
|
+
| `onNextPage` | Function | Yes | n/a | n/a | The function to call when the next page is clicked. |
|
|
1186
|
+
| `pageSizeOptions` | Array | No | n/a | [10, 50, 100] | The options for the page size. |
|
|
1187
|
+
| `paginationMode` | String | No | `local` `remote` | `local` | The mode of pagination. |
|
|
1188
|
+
| `showPerPageLabel`| String | No | n/a | 'Show per page' | The label for the page size. |
|
|
1189
|
+
| `totalPages` | Number | No | n/a | n/a | The total number of pages. It is used to disable the next page button when the `currentPage` is the last page. |
|
|
1190
|
+
|
|
1191
|
+
#### Integration with Tabulator
|
|
1192
|
+
The table uses local pagination (`paginationMode: 'local'`).
|
|
1193
|
+
Pagination state is synchronized through Tabulator’s lifecycle events (`tableBuilt`, `pageLoaded`, `dataFiltered`, `dataSorted`).
|
|
1194
|
+
|
|
1195
|
+
The synchronization flow works as follows:
|
|
1196
|
+
1. When the table is mounted, the Tabulator instance is stored via a `ref` (`tableRef.current.table`).
|
|
1197
|
+
2. Each time the user changes the page, page size, or applies a filter/sort, Tabulator triggers events (`tableBuilt`, `pageLoaded`, `dataFiltered`, `dataSorted`).
|
|
1198
|
+
3. These events update the local state object:
|
|
1199
|
+
```jsx
|
|
1200
|
+
{
|
|
1201
|
+
currentPage: number,
|
|
1202
|
+
totalPages: number,
|
|
1203
|
+
pageSize: number,
|
|
1204
|
+
}
|
|
1205
|
+
```
|
|
1206
|
+
4. The external `Pagination` component receives this state and triggers callbacks (`onPageChange`, `onPrevPage`, `onNextPage`, `onPageSizeChange`) that invoke Tabulator methods such as `setPage()` or `setPageSize()`.
|
|
1207
|
+
|
|
1208
|
+
##### Example
|
|
1209
|
+
|
|
1210
|
+
```jsx
|
|
1211
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
1212
|
+
import { ReactTabulator } from 'react-tabulator';
|
|
1213
|
+
import { Pagination } from 'groovinads-ui';
|
|
1214
|
+
|
|
1215
|
+
const MyReportTable = ({ data, allData, pageSize = 50 }) => {
|
|
1216
|
+
const tableRef = useRef(null);
|
|
1217
|
+
const [paginationState, setPaginationState] = useState({
|
|
1218
|
+
currentPage: 1,
|
|
1219
|
+
totalPages: 1,
|
|
1220
|
+
pageSize,
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
const getTableInstance = () => tableRef.current?.table || null;
|
|
1224
|
+
|
|
1225
|
+
const handlePageChange = (page) => getTableInstance()?.setPage(page);
|
|
1226
|
+
const handlePrevPage = () => getTableInstance()?.previousPage();
|
|
1227
|
+
const handleNextPage = () => getTableInstance()?.nextPage();
|
|
1228
|
+
const handlePageSizeChange = (size) => {
|
|
1229
|
+
const table = getTableInstance();
|
|
1230
|
+
if (table) {
|
|
1231
|
+
table.setPageSize(size);
|
|
1232
|
+
table.setPage(1);
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
const handlePageSizeChange = (size) => {
|
|
1236
|
+
const table = getTableInstance();
|
|
1237
|
+
if (table) {
|
|
1238
|
+
table.setPageSize(size);
|
|
1239
|
+
table.setPage(1);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
return (
|
|
1244
|
+
<div className='table-with-pagination'>
|
|
1245
|
+
<ReactTabulator
|
|
1246
|
+
onRef={(ref) => (tableRef.current = ref)}
|
|
1247
|
+
data={allData || data}
|
|
1248
|
+
columns={[{ title: 'ID', field: 'id' }, { title: 'Name', field: 'name' }]}
|
|
1249
|
+
options={{
|
|
1250
|
+
pagination: true,
|
|
1251
|
+
paginationMode: 'local',
|
|
1252
|
+
paginationSize: pageSize,
|
|
1253
|
+
layout: 'fitColumns',
|
|
1254
|
+
}}
|
|
1255
|
+
events={{
|
|
1256
|
+
tableBuilt: function () {
|
|
1257
|
+
setPaginationState({
|
|
1258
|
+
currentPage: this.getPage(),
|
|
1259
|
+
totalPages: this.getPageMax(),
|
|
1260
|
+
pageSize: this.getPageSize(),
|
|
1261
|
+
});
|
|
1262
|
+
},
|
|
1263
|
+
pageLoaded: function () {
|
|
1264
|
+
setPaginationState({
|
|
1265
|
+
currentPage: this.getPage(),
|
|
1266
|
+
totalPages: this.getPageMax(),
|
|
1267
|
+
pageSize: this.getPageSize(),
|
|
1268
|
+
});
|
|
1269
|
+
},
|
|
1270
|
+
}}
|
|
1271
|
+
/>
|
|
1272
|
+
|
|
1273
|
+
<Pagination
|
|
1274
|
+
currentPage={paginationState.currentPage}
|
|
1275
|
+
totalPages={paginationState.totalPages}
|
|
1276
|
+
pageSize={paginationState.pageSize}
|
|
1277
|
+
onPageChange={handlePageChange}
|
|
1278
|
+
onPrevPage={handlePrevPage}
|
|
1279
|
+
onNextPage={handleNextPage}
|
|
1280
|
+
onPageSizeChange={handlePageSizeChange}
|
|
1281
|
+
/>
|
|
1282
|
+
</div>
|
|
1283
|
+
);
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
export default MyReportTable;
|
|
1287
|
+
```
|
|
1288
|
+
##### Notes & best practices
|
|
1289
|
+
- Use paginationMode: 'local' for immediate synchronization between Tabulator and the UI.
|
|
1290
|
+
- Clean up the table instance in a `useEffect` return function to prevent memory leaks.
|
|
1291
|
+
- Update `paginationState` after filtering or sorting, since Tabulator recalculates pagination internally.
|
|
1292
|
+
- The `Pagination` component should be fully controlled — avoid internal state handling.
|
|
939
1293
|
|
|
940
1294
|
### Sidebar
|
|
941
1295
|
|
|
@@ -952,7 +1306,7 @@ const SidebarComponent = () => {
|
|
|
952
1306
|
|
|
953
1307
|
const handleNavigation = (url) => {
|
|
954
1308
|
navigate(url);
|
|
955
|
-
console.log("
|
|
1309
|
+
console.log("Selected client:", client);
|
|
956
1310
|
};
|
|
957
1311
|
|
|
958
1312
|
return (
|
|
@@ -1060,19 +1414,24 @@ export default SidebarComponent;
|
|
|
1060
1414
|
|
|
1061
1415
|
```
|
|
1062
1416
|
|
|
1063
|
-
| Property | Type | Required | Options | Default
|
|
1064
|
-
| ---------------------- | -------------------- | -------- | ----------------------- |
|
|
1065
|
-
| `api` | String | No | n/a | n/a
|
|
1066
|
-
| `
|
|
1067
|
-
| `
|
|
1068
|
-
| `
|
|
1069
|
-
| `
|
|
1070
|
-
| `
|
|
1071
|
-
| `
|
|
1072
|
-
| `
|
|
1073
|
-
| `inModal` | Boolean | No | `true` `false` | `false`
|
|
1074
|
-
| `
|
|
1075
|
-
| `pendingIndicatorType` |
|
|
1417
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1418
|
+
| ---------------------- | -------------------- | -------- | ----------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1419
|
+
| `api` | String | No | n/a | n/a | It is the `url` corresponding to your `api`. From which you will receive the data, which will be used in the non-custom section. |
|
|
1420
|
+
| `clientLogoUrl` | String | No | n/a | n/a | It is the `url` of the client logo. It is displayed in the sidebar when the `showClients` property is set to `single` or a small version in the `DropdownClient` component. |
|
|
1421
|
+
| `clientNotFoundTitle` | String | No | n/a | "Client not found" | The title of the client not found message. It is displayed when the client is not found. |
|
|
1422
|
+
| `clientNotFoundText` | String | No | n/a | "It looks like this client does not exist." | The text of the client not found message. |
|
|
1423
|
+
| `clientSearchLabel` | String | No | n/a | "Search client" | The label of the search input. |
|
|
1424
|
+
| `customLinks` | Array | Yes | n/a | n/a | Creates the sections of the component based on the array of objects it receives. `title` names each section, and `links` is a section link item, that can optionally, contain an array of children for nested links. To use external data obtained from the `api` property, the object must contain the property `backData={true}`. |
|
|
1425
|
+
| `customURL` | String | No | n/a | `undefined` | Allows you to define a custom URL. You can provide a specific URL or a value representing a selected item in the Sidebar. If not defined, its value will be `undefined` (and window.location.pathname will be used as the default). |
|
|
1426
|
+
| `defaultOpened` | Boolean | No | `true` `false` | `false` | Determines whether the sidebar is initially opened or closed. |
|
|
1427
|
+
| `inModal` | Boolean | No | `true` `false` | `false` | If inModal is true, it will adjust the Sidebar based on the size of its parent container, allowing flexibility in a specific context, for example, a modal or a different layout. If false, its behavior will depend on the screen size. |
|
|
1428
|
+
| `onNavigate` | Function | Yes | n/a | n/a | Allows handling navigation to the url of the link when an item in the sidebar is clicked. You should provide a function to define how the navigation should be handled (handleNavigation). In our environment, use React Router DOM for navigation. |
|
|
1429
|
+
| `pendingIndicatorType` | String | No | `warning` `badge` | n/a | If the value is `warning`, an icon (triangle-exclamation) will be displayed. If the value is `badge`, a number (badge) will be shown. For this functionality, you need to add a key in `customLinks.links` named `pendingIndicatorNumber`, which expects a number representing the length (if greater than `1`, the warning icon or badge will be shown; otherwise, nothing will be displayed). |
|
|
1430
|
+
| `selectedClient` | Object | No | n/a | n/a | Represents the selected client object, used to display client-specific data in the sidebar. |
|
|
1431
|
+
| `setGroovinProfile` | Function | No | n/a | n/a | Updates the user's profile when a client is selected, used in the `DropdownClients` subcomponent. |
|
|
1432
|
+
| `setShow` | Function | No | n/a | n/a | Allows controlling the visibility of the sidebar from an external state. If `true`, the sidebar is displayed; if `false`, it is hidden. |
|
|
1433
|
+
| `show` | Boolean | No | `true` `false` | `false` | Controls the visibility of the sidebar from an external state. If `true`, the sidebar is displayed; if `false`, it is hidden. |
|
|
1434
|
+
| `showClients` | Boolean / String | No | `true` `false` `single` | `false` | Controls the visibility of the DropdownClient. Accepts `true` or `false` for visibility, or 'single' to show only one client. |
|
|
1076
1435
|
|
|
1077
1436
|
### Stepper
|
|
1078
1437
|
|
|
@@ -1089,10 +1448,32 @@ const StepperComponent = () => {
|
|
|
1089
1448
|
export default StepperComponent;
|
|
1090
1449
|
```
|
|
1091
1450
|
|
|
1092
|
-
| Property
|
|
1093
|
-
|
|
|
1094
|
-
| `
|
|
1095
|
-
| `
|
|
1451
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1452
|
+
| ------------- | ------ | -------- | ------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1453
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the stepper. |
|
|
1454
|
+
| `current` | Number | Yes | n/a | n/a | Uses a number to specify the index in the list array, determining which step is highlighted as the current one and applying a specific style. |
|
|
1455
|
+
| `orientation` | String | No | `horizontal` `vertical` | `horizontal` | The orientation of the stepper. |
|
|
1456
|
+
| `list` | Array | Yes | n/a | n/a | Array of steps to be displayed in the stepper. Each item represents a step. |
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
### TableSkeleton
|
|
1460
|
+
|
|
1461
|
+
```jsx
|
|
1462
|
+
import React from 'react';
|
|
1463
|
+
import { TableSkeleton } from 'groovinads-ui';
|
|
1464
|
+
|
|
1465
|
+
const TableSkeletonComponent = () => {
|
|
1466
|
+
return <TableSkeleton rows={5} cols={4} />;
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
export default TableSkeletonComponent;
|
|
1470
|
+
```
|
|
1471
|
+
|
|
1472
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1473
|
+
| ------------- | ------ | -------- | ------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1474
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the table skeleton. |
|
|
1475
|
+
| `rows` | Number | Yes | n/a | n/a | Number of rows to display in the table skeleton. |
|
|
1476
|
+
| `cols` | Number | Yes | n/a | n/a | Number of columns to display in the table skeleton. |
|
|
1096
1477
|
|
|
1097
1478
|
### Tabnav
|
|
1098
1479
|
|
|
@@ -1138,7 +1519,10 @@ export default TabnavComponent;
|
|
|
1138
1519
|
| Property | Type | Required | Options | Default | Description |
|
|
1139
1520
|
| -------------- | -------- | -------- | -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1140
1521
|
| `activeTab` | Number | No | n/a | `1` | Displays the active tab. By default, it is set to 1. You can use it alone to define the active tab or in combination with `setActiveTab` to manage external state and customize the initial active tab by providing a number. |
|
|
1141
|
-
| `
|
|
1522
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the tabnav. |
|
|
1523
|
+
| `disabledTabs` | Array | No | n/a | [] | Array of numbers representing the tabs to be disabled. |
|
|
1524
|
+
| `navigateTab` | Boolean | No | `true` `false` | `false` | If `true`, it enables navigation to the specified URL when the tab is selected. |
|
|
1525
|
+
| `onNavigate` | Function | No | n/a | n/a | Allows handling navigation to the url of the link when an item in the sidebar is clicked. You should provide a function to define how the navigation should be handled (handleNavigation). In our environment, use React Router DOM for navigation. |
|
|
1142
1526
|
| `setActiveTab` | Function | No | n/a | n/a | Allows the component to be managed through external state. If provided, Tabnav will update the active tab using this property. |
|
|
1143
1527
|
| `tabs` | Array | Yes | n/a | [ ] | Each array of objects represents tabs. Each object must have a `tab` key and may have `badgeNumber`, `url`, and `warningIcon` keys. |
|
|
1144
1528
|
|
|
@@ -1174,15 +1558,22 @@ const ToastExample = () => {
|
|
|
1174
1558
|
export default ToastExample;
|
|
1175
1559
|
```
|
|
1176
1560
|
|
|
1177
|
-
| Property
|
|
1178
|
-
|
|
|
1179
|
-
|
|
|
1180
|
-
| `position`
|
|
1181
|
-
| `toast`
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1561
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1562
|
+
| ----------------- | --------- | --------- | ------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1563
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the toast component. |
|
|
1564
|
+
| `position` | String | No | `top-start` `top-end` `bottom-start` `bottom-end` | `bottom-end` | Define the position on the screen where the toast will be displayed. |
|
|
1565
|
+
| `toast` | Object | No | n/a | n/a | The ToastComponent accepts a single object containing all its properties. This approach allows the entire configuration to be stored in a unified state or context, instead of managing multiple variables or separate states. Internally, ToastComponent keeps a history of notifications (toasts), making it essential to handle its configuration as an object rather than as individual variables. |
|
|
1566
|
+
|
|
1567
|
+
#### Toast object {}
|
|
1568
|
+
As described above, the ToastComponent receives an object containing all of its properties. These properties are listed below. Note that the state or variable holding this object does not need to be explicitly named `toast`; what really matters are the keys defined inside it.
|
|
1569
|
+
|
|
1570
|
+
| Property | Type | Required | Options | Default | Description |
|
|
1571
|
+
| ----------------- | --------- | --------- | ------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1572
|
+
| `toast.autoClose` | Boolean | No | `true` `false` | `true` | If `true`, it closes automatically after a certain amount of time. If `false`, it remains on the screen until the user closes it manually.|
|
|
1573
|
+
| `toast.children` | String | No | n/a | n/a | Custom content within the toast. It must be a string. In case of needing to use HTML tags, it must be send as a string. |
|
|
1574
|
+
| `toast.className` | String | No | n/a | n/a | Custom class name for the toast. |
|
|
1575
|
+
| `toast.position` | String | No | `top-start` `top-end` `bottom-start` `bottom-end` | `bottom-end` | Define the position on the screen where the toast will be displayed. |
|
|
1576
|
+
| `toast.variant` | String | No | `info` `success` `warning` `error` | `info` | Defines the type of message to display. Depending on the value, a different icon is displayed for each message type. |
|
|
1186
1577
|
|
|
1187
1578
|
### ToastProgress
|
|
1188
1579
|
|
|
@@ -1227,6 +1618,7 @@ export default MyToastExamples;
|
|
|
1227
1618
|
| Property | Type | Required | Options | Default | Description |
|
|
1228
1619
|
| ----------------- | -------- | -------- | ------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1229
1620
|
| `cancelButton` | Boolean | No | `true` `false` | `false` | Determines whether to show a cancel button. |
|
|
1621
|
+
| `className` | String | No | n/a | n/a | Additional CSS class for the toast progress component. |
|
|
1230
1622
|
| `currentProgress` | Number | No | n/a | n/a | Indicates the current progress of the task as a percentage with a number from 1 to 100. Used only when `variant` is set to `upload` |
|
|
1231
1623
|
| `onCancel` | Function | No | n/a | n/a | If `cancelButton` is true, it will display a cancel button that will execute the function provided in the `onCancel` prop when clicked. |
|
|
1232
1624
|
| `position` | String | No | `top-start` `top-end` `bottom-start` `bottom-end` | `bottom-start` | Defines the position on the screen where the toast will be displayed. |
|