@paygreen/pgui 2.14.9 → 3.0.0-beta
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 +125 -59
- package/dist/components/actions-button/actions-button.d.ts +20 -0
- package/dist/components/data-list/datalist.d.ts +88 -0
- package/dist/components/data-table/data-table.d.ts +67 -0
- package/dist/components/date-picker/date-picker.d.ts +44 -0
- package/dist/components/field-wrapper/field-wrapper.d.ts +50 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/input/input.d.ts +24 -0
- package/dist/components/input-mask/input-mask.d.ts +27 -0
- package/dist/components/input-phone/input-phone.d.ts +62 -0
- package/dist/components/input-phone/partials/search-on-list.d.ts +61 -0
- package/dist/components/loader/loader.d.ts +23 -0
- package/dist/components/logos/logoPaygreenByLemonway.d.ts +26 -0
- package/dist/components/modal/modal.d.ts +42 -0
- package/dist/components/pagination/pagination.d.ts +31 -0
- package/dist/components/select/select.d.ts +44 -0
- package/dist/components/sidebar/sidebar.d.ts +103 -0
- package/dist/components/ui/color-mode.d.ts +21 -0
- package/dist/hooks/scroll-shadow.d.ts +7 -0
- package/dist/hooks/use-data-table.d.ts +12 -0
- package/dist/index.d.ts +2 -352
- package/dist/index.js +48 -0
- package/dist/index.mjs +8355 -0
- package/dist/pgui.css +1 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/recipes/card-recipe.d.ts +18 -0
- package/dist/theme/recipes/index.d.ts +21 -0
- package/dist/theme/recipes/text-recipe.d.ts +2 -0
- package/dist/theme/semanticTokens/colors.d.ts +46 -0
- package/dist/theme/semanticTokens/index.d.ts +48 -0
- package/dist/theme/tokens/colors.d.ts +35 -0
- package/dist/theme/tokens/font-sizes.d.ts +42 -0
- package/dist/theme/tokens/fonts.d.ts +12 -0
- package/dist/theme/tokens/gradients.d.ts +6 -0
- package/dist/theme/tokens/index.d.ts +188 -0
- package/dist/theme/tokens/radii.d.ts +39 -0
- package/dist/theme/tokens/sizes.d.ts +57 -0
- package/package.json +94 -103
- package/src/components/date-picker/date-picker.css +206 -0
- package/src/components/select/select.css +75 -0
- package/src/styles/index.css +12 -0
- package/dist/cjs/index.js +0 -60887
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types/components/ActionsButton/index.d.ts +0 -6
- package/dist/cjs/types/components/Card/index.d.ts +0 -3
- package/dist/cjs/types/components/ConfirmMenuItem/index.d.ts +0 -13
- package/dist/cjs/types/components/DataList/index.d.ts +0 -42
- package/dist/cjs/types/components/FormGroup/index.d.ts +0 -12
- package/dist/cjs/types/components/InputDayPicker/index.d.ts +0 -20
- package/dist/cjs/types/components/InputPhone/SearchOnList.d.ts +0 -19
- package/dist/cjs/types/components/InputPhone/index.d.ts +0 -12
- package/dist/cjs/types/components/InputRangePicker/index.d.ts +0 -25
- package/dist/cjs/types/components/ModalResponsive/index.d.ts +0 -5
- package/dist/cjs/types/components/Pagination/index.d.ts +0 -43
- package/dist/cjs/types/components/SearchInput/index.d.ts +0 -12
- package/dist/cjs/types/components/Select/index.d.ts +0 -120
- package/dist/cjs/types/components/Textarea/index.d.ts +0 -8
- package/dist/cjs/types/components/index.d.ts +0 -12
- package/dist/cjs/types/hooks/useClickOutside.d.ts +0 -3
- package/dist/cjs/types/index.d.ts +0 -4
- package/dist/cjs/types/layout/BottomBar/index.d.ts +0 -3
- package/dist/cjs/types/layout/LayoutContainer/index.d.ts +0 -3
- package/dist/cjs/types/layout/SideNav/index.d.ts +0 -21
- package/dist/cjs/types/layout/TopBar/index.d.ts +0 -10
- package/dist/cjs/types/layout/index.d.ts +0 -4
- package/dist/cjs/types/theme/components/alert.d.ts +0 -9
- package/dist/cjs/types/theme/components/badge.d.ts +0 -9
- package/dist/cjs/types/theme/components/button.d.ts +0 -163
- package/dist/cjs/types/theme/components/checkbox.d.ts +0 -11
- package/dist/cjs/types/theme/components/drawer.d.ts +0 -6
- package/dist/cjs/types/theme/components/form.d.ts +0 -8
- package/dist/cjs/types/theme/components/index.d.ts +0 -16
- package/dist/cjs/types/theme/components/input.d.ts +0 -58
- package/dist/cjs/types/theme/components/menu.d.ts +0 -9
- package/dist/cjs/types/theme/components/number-input.d.ts +0 -54
- package/dist/cjs/types/theme/components/pin-input.d.ts +0 -42
- package/dist/cjs/types/theme/components/radio.d.ts +0 -6
- package/dist/cjs/types/theme/components/slider.d.ts +0 -6
- package/dist/cjs/types/theme/components/switch.d.ts +0 -6
- package/dist/cjs/types/theme/components/tag.d.ts +0 -14
- package/dist/cjs/types/theme/components/textarea.d.ts +0 -54
- package/dist/cjs/types/theme/components/tooltip.d.ts +0 -8
- package/dist/cjs/types/theme/foundations/colors.d.ts +0 -66
- package/dist/cjs/types/theme/foundations/index.d.ts +0 -129
- package/dist/cjs/types/theme/foundations/radius.d.ts +0 -11
- package/dist/cjs/types/theme/foundations/shadows.d.ts +0 -10
- package/dist/cjs/types/theme/foundations/sizes.d.ts +0 -21
- package/dist/cjs/types/theme/foundations/typography.d.ts +0 -21
- package/dist/cjs/types/theme/index.d.ts +0 -1
- package/dist/cjs/types/theme/rawStyle/chakraStyle.d.ts +0 -2
- package/dist/cjs/types/theme/rawStyle/index.d.ts +0 -3
- package/dist/cjs/types/theme/rawStyle/reactDayPicker.d.ts +0 -23
- package/dist/cjs/types/theme/rawStyle/scrollbarStyles.d.ts +0 -11
- package/dist/cjs/types/theme/styles.d.ts +0 -2
- package/dist/cjs/types/theme/theme.d.ts +0 -1
- package/dist/cjs/types/utils/date.d.ts +0 -1
- package/dist/cjs/types/utils/index.d.ts +0 -2
- package/dist/cjs/types/utils/responsive.d.ts +0 -1
- package/dist/esm/index.js +0 -60814
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/components/ActionsButton/index.d.ts +0 -6
- package/dist/esm/types/components/Card/index.d.ts +0 -3
- package/dist/esm/types/components/ConfirmMenuItem/index.d.ts +0 -13
- package/dist/esm/types/components/DataList/index.d.ts +0 -42
- package/dist/esm/types/components/FormGroup/index.d.ts +0 -12
- package/dist/esm/types/components/InputDayPicker/index.d.ts +0 -20
- package/dist/esm/types/components/InputPhone/SearchOnList.d.ts +0 -19
- package/dist/esm/types/components/InputPhone/index.d.ts +0 -12
- package/dist/esm/types/components/InputRangePicker/index.d.ts +0 -25
- package/dist/esm/types/components/ModalResponsive/index.d.ts +0 -5
- package/dist/esm/types/components/Pagination/index.d.ts +0 -43
- package/dist/esm/types/components/SearchInput/index.d.ts +0 -12
- package/dist/esm/types/components/Select/index.d.ts +0 -120
- package/dist/esm/types/components/Textarea/index.d.ts +0 -8
- package/dist/esm/types/components/index.d.ts +0 -12
- package/dist/esm/types/hooks/useClickOutside.d.ts +0 -3
- package/dist/esm/types/index.d.ts +0 -4
- package/dist/esm/types/layout/BottomBar/index.d.ts +0 -3
- package/dist/esm/types/layout/LayoutContainer/index.d.ts +0 -3
- package/dist/esm/types/layout/SideNav/index.d.ts +0 -21
- package/dist/esm/types/layout/TopBar/index.d.ts +0 -10
- package/dist/esm/types/layout/index.d.ts +0 -4
- package/dist/esm/types/theme/components/alert.d.ts +0 -9
- package/dist/esm/types/theme/components/badge.d.ts +0 -9
- package/dist/esm/types/theme/components/button.d.ts +0 -163
- package/dist/esm/types/theme/components/checkbox.d.ts +0 -11
- package/dist/esm/types/theme/components/drawer.d.ts +0 -6
- package/dist/esm/types/theme/components/form.d.ts +0 -8
- package/dist/esm/types/theme/components/index.d.ts +0 -16
- package/dist/esm/types/theme/components/input.d.ts +0 -58
- package/dist/esm/types/theme/components/menu.d.ts +0 -9
- package/dist/esm/types/theme/components/number-input.d.ts +0 -54
- package/dist/esm/types/theme/components/pin-input.d.ts +0 -42
- package/dist/esm/types/theme/components/radio.d.ts +0 -6
- package/dist/esm/types/theme/components/slider.d.ts +0 -6
- package/dist/esm/types/theme/components/switch.d.ts +0 -6
- package/dist/esm/types/theme/components/tag.d.ts +0 -14
- package/dist/esm/types/theme/components/textarea.d.ts +0 -54
- package/dist/esm/types/theme/components/tooltip.d.ts +0 -8
- package/dist/esm/types/theme/foundations/colors.d.ts +0 -66
- package/dist/esm/types/theme/foundations/index.d.ts +0 -129
- package/dist/esm/types/theme/foundations/radius.d.ts +0 -11
- package/dist/esm/types/theme/foundations/shadows.d.ts +0 -10
- package/dist/esm/types/theme/foundations/sizes.d.ts +0 -21
- package/dist/esm/types/theme/foundations/typography.d.ts +0 -21
- package/dist/esm/types/theme/index.d.ts +0 -1
- package/dist/esm/types/theme/rawStyle/chakraStyle.d.ts +0 -2
- package/dist/esm/types/theme/rawStyle/index.d.ts +0 -3
- package/dist/esm/types/theme/rawStyle/reactDayPicker.d.ts +0 -23
- package/dist/esm/types/theme/rawStyle/scrollbarStyles.d.ts +0 -11
- package/dist/esm/types/theme/styles.d.ts +0 -2
- package/dist/esm/types/theme/theme.d.ts +0 -1
- package/dist/esm/types/utils/date.d.ts +0 -1
- package/dist/esm/types/utils/index.d.ts +0 -2
- package/dist/esm/types/utils/responsive.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,109 +1,175 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @paygreen/pgui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
PGUI is the current Paygreen's Design System. The purpose of the package is to provide Components for [Paygreen](https://paygreen.io) applications that works with [Chakra UI](https://chakra-ui.com)
|
|
5
|
-
___
|
|
3
|
+
Core UI components library for Paygreen applications built with React and Chakra UI.
|
|
6
4
|
|
|
7
|
-
##
|
|
8
|
-
To setup PGUI in a local environment, please install the package in your target project.
|
|
5
|
+
## 📦 Installation
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
npm i @paygreen/pgui
|
|
12
|
-
```
|
|
7
|
+
### Base Installation
|
|
13
8
|
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
```bash
|
|
10
|
+
# Install the core library
|
|
11
|
+
npm install @paygreen/pgui
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</ChakraProvider>
|
|
13
|
+
# Install required peer dependencies
|
|
14
|
+
npm install react react-dom @chakra-ui/react @emotion/react @emotion/styled framer-motion
|
|
21
15
|
```
|
|
22
|
-
___
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
### Component-Specific Dependencies
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
Install additional packages based on the components you want to use:
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
| Component | Required Package | Command |
|
|
22
|
+
|-----------|------------------|---------|
|
|
23
|
+
| **DatePicker** | `react-datepicker` | `npm install react-datepicker` |
|
|
24
|
+
| **Select** | `react-select` | `npm install react-select` |
|
|
25
|
+
| **InputPhone** | `react-phone-number-input` | `npm install react-phone-number-input` |
|
|
26
|
+
| **InputMask** | `use-mask-input` | `npm install use-mask-input` |
|
|
27
|
+
| **DataTable** | `@tanstack/react-table` | `npm install @tanstack/react-table` |
|
|
28
|
+
| **All Icons** | `react-icons` | `npm install react-icons` |
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
```src/components/index.ts``` and ```src/index.ts``` file.
|
|
30
|
+
### Complete Installation (All Components)
|
|
32
31
|
|
|
33
|
-
To make your modifications accessible, build the package with rollup.
|
|
34
32
|
```bash
|
|
35
|
-
|
|
33
|
+
# Install everything at once
|
|
34
|
+
npm install @paygreen/pgui react react-dom @chakra-ui/react @emotion/react @emotion/styled framer-motion react-datepicker react-select react-phone-number-input use-mask-input @tanstack/react-table react-icons
|
|
36
35
|
```
|
|
37
|
-
___
|
|
38
36
|
|
|
39
|
-
##
|
|
37
|
+
## 🎨 CSS Setup
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
npm run storybook
|
|
39
|
+
```javascript
|
|
40
|
+
// In your main App.js or index.js
|
|
41
|
+
import '@paygreen/pgui/src/styles/index.css';
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
___
|
|
44
|
+
## 🚀 Basic Usage
|
|
49
45
|
|
|
50
|
-
|
|
46
|
+
```javascript
|
|
47
|
+
import React from 'react';
|
|
48
|
+
import { ChakraProvider } from '@chakra-ui/react';
|
|
49
|
+
import { DatePicker, Select, Input, systemTheme } from '@paygreen/pgui';
|
|
50
|
+
import '@paygreen/pgui/src/styles/index.css';
|
|
51
|
+
|
|
52
|
+
function App() {
|
|
53
|
+
return (
|
|
54
|
+
<ChakraProvider value={systemTheme}>
|
|
55
|
+
{/* Your components */}
|
|
56
|
+
</ChakraProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🔧 Development & Testing
|
|
62
|
+
|
|
63
|
+
### Why YALC?
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
**YALC** (Yet Another Local Cache) is the best tool for testing libraries locally because it:
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
- ✅ **No symlinks** - Avoids React duplicate issues from `npm link`
|
|
68
|
+
- ✅ **Real package simulation** - Works exactly like published packages
|
|
69
|
+
- ✅ **Fast updates** - Push changes instantly to consuming projects
|
|
70
|
+
- ✅ **No conflicts** - Prevents peer dependency resolution issues
|
|
71
|
+
- ✅ **Production-like** - Tests the actual built package, not source
|
|
55
72
|
|
|
56
|
-
|
|
73
|
+
### Setting up YALC
|
|
74
|
+
|
|
75
|
+
#### 1. Install YALC globally
|
|
57
76
|
|
|
58
|
-
1. in ```/target_app/node_modules/@chakra-ui/react```, this will create 1st symlink to @chakra-ui/react
|
|
59
77
|
```bash
|
|
60
|
-
npm
|
|
78
|
+
npm install -g yalc
|
|
61
79
|
```
|
|
62
80
|
|
|
63
|
-
2.
|
|
81
|
+
#### 2. In this library (pgui/)
|
|
82
|
+
|
|
64
83
|
```bash
|
|
65
|
-
|
|
84
|
+
# Build and publish to local store
|
|
85
|
+
npm run build
|
|
86
|
+
yalc publish
|
|
87
|
+
|
|
88
|
+
# For development - rebuild and push changes
|
|
89
|
+
npm run build
|
|
90
|
+
yalc push # Updates all projects using this package
|
|
66
91
|
```
|
|
67
92
|
|
|
68
|
-
3.
|
|
93
|
+
#### 3. In your test project
|
|
94
|
+
|
|
69
95
|
```bash
|
|
70
|
-
|
|
96
|
+
# Install from local YALC store
|
|
97
|
+
yalc add @paygreen/pgui
|
|
98
|
+
npm install
|
|
99
|
+
|
|
100
|
+
# When done testing, clean up
|
|
101
|
+
yalc remove @paygreen/pgui
|
|
102
|
+
npm install @paygreen/pgui # Back to npm registry
|
|
71
103
|
```
|
|
72
104
|
|
|
73
|
-
|
|
105
|
+
### Development Workflow
|
|
106
|
+
|
|
74
107
|
```bash
|
|
75
|
-
|
|
108
|
+
# 1. Make changes to components in pgui/
|
|
109
|
+
# 2. Build and push
|
|
110
|
+
npm run build && yalc push
|
|
111
|
+
|
|
112
|
+
# 3. Your test project automatically gets the updates
|
|
113
|
+
# 4. Test your changes
|
|
114
|
+
|
|
115
|
+
# 5. When ready, publish to npm
|
|
116
|
+
npm publish
|
|
76
117
|
```
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
### Useful YALC Commands
|
|
120
|
+
|
|
79
121
|
```bash
|
|
80
|
-
|
|
122
|
+
# See which packages are published locally
|
|
123
|
+
yalc installations show
|
|
124
|
+
|
|
125
|
+
# Remove package from YALC store
|
|
126
|
+
yalc remove @paygreen/pgui --all
|
|
127
|
+
|
|
128
|
+
# Clean all YALC installations
|
|
129
|
+
yalc remove --all
|
|
81
130
|
```
|
|
82
131
|
|
|
83
|
-
|
|
132
|
+
## 🏗️ Building
|
|
133
|
+
|
|
84
134
|
```bash
|
|
85
|
-
|
|
135
|
+
# Build the library
|
|
136
|
+
npm run build
|
|
137
|
+
|
|
138
|
+
# Output files:
|
|
139
|
+
# - dist/index.mjs (ES modules)
|
|
140
|
+
# - dist/index.js (CommonJS)
|
|
141
|
+
# - dist/index.d.ts (TypeScript definitions)
|
|
142
|
+
# - dist/pgui.css (Compiled styles)
|
|
86
143
|
```
|
|
87
144
|
|
|
88
|
-
|
|
145
|
+
## 🐛 Troubleshooting
|
|
89
146
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
147
|
+
### CSS Not Loading
|
|
148
|
+
|
|
149
|
+
Make sure you import the CSS file:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
import '@paygreen/pgui/src/styles/index.css';
|
|
93
153
|
```
|
|
94
154
|
|
|
95
|
-
|
|
155
|
+
### Missing Dependencies
|
|
96
156
|
|
|
97
|
-
|
|
157
|
+
If you get an error about missing packages, install the required dependency for the component you're using (see table above).
|
|
98
158
|
|
|
99
|
-
|
|
159
|
+
### Source Map Warnings
|
|
100
160
|
|
|
101
|
-
|
|
161
|
+
If you see warnings about react-datepicker source maps, add this to your `.env` file:
|
|
102
162
|
|
|
103
|
-
### React Invalid Hook Call Warning
|
|
104
|
-
If you have an error based on [React Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html), this is because you're trying to use the local project without npm link (on chakra-ui/react or react). Please use the command to normally solve it
|
|
105
163
|
```bash
|
|
106
|
-
|
|
164
|
+
GENERATE_SOURCEMAP=false
|
|
107
165
|
```
|
|
108
166
|
|
|
109
|
-
|
|
167
|
+
## 📋 Requirements
|
|
168
|
+
|
|
169
|
+
- **React** ^18.0.0 || ^19.0.0
|
|
170
|
+
- **Node.js** >= 16
|
|
171
|
+
- **TypeScript** >= 4.5 (if using TypeScript)
|
|
172
|
+
|
|
173
|
+
## 📄 License
|
|
174
|
+
|
|
175
|
+
Private - Paygreen Internal Use Only
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IconButtonProps } from '@chakra-ui/react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the ActionsButton component
|
|
4
|
+
*/
|
|
5
|
+
export interface ActionsButtonProps extends Omit<IconButtonProps, 'aria-label' | 'icon'> {
|
|
6
|
+
/** Accessible label for the action button (used for aria-label) */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Optional custom icon to display instead of the default three dots */
|
|
9
|
+
icon?: React.ReactElement;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* ActionsButton component - A semantic action button for triggering contextual menus
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <ActionsButton label="Open actions menu" />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const ActionsButton: import('react').ForwardRefExoticComponent<ActionsButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
20
|
+
export { ActionsButton };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AccordionItemProps, AccordionRootProps, FlexProps } from '@chakra-ui/react';
|
|
3
|
+
/**
|
|
4
|
+
* Record mapping column names to their configuration properties
|
|
5
|
+
*/
|
|
6
|
+
interface DataListColumns extends Record<string, DataListCellProps> {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Props for individual data list cells that represent table columns
|
|
10
|
+
*/
|
|
11
|
+
interface DataListCellProps extends FlexProps {
|
|
12
|
+
/** Unique identifier for the column, used to link header and body cells */
|
|
13
|
+
colName?: string;
|
|
14
|
+
/** Column width configuration - can be relative number, CSS unit, or responsive object */
|
|
15
|
+
colWidth?: string | number | Record<string, string | number>;
|
|
16
|
+
/** Column visibility configuration - can be boolean or responsive object */
|
|
17
|
+
isVisible?: boolean | boolean[] | Record<string, boolean>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props for accordion items within the DataList
|
|
21
|
+
*/
|
|
22
|
+
interface DataListAccordionProps extends AccordionItemProps {
|
|
23
|
+
/** Unique string identifier for the accordion item */
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for DataList row components
|
|
28
|
+
*/
|
|
29
|
+
interface DataListRowProps extends FlexProps {
|
|
30
|
+
/** Row visibility configuration - can be boolean or responsive object */
|
|
31
|
+
isVisible?: boolean | boolean[] | Record<string, boolean>;
|
|
32
|
+
/** Whether the row is disabled (grayed out and non-interactive) */
|
|
33
|
+
isDisabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for DataList header component
|
|
37
|
+
*/
|
|
38
|
+
interface DataListHeaderProps extends DataListRowProps {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Props for DataList footer component
|
|
42
|
+
*/
|
|
43
|
+
interface DataListFooterProps extends DataListRowProps {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Main props for the DataList component
|
|
47
|
+
*/
|
|
48
|
+
interface DataListProps extends AccordionRootProps {
|
|
49
|
+
/** Whether to enable hover effects on rows */
|
|
50
|
+
isHover?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* DataList component - A flexible data list with accordion functionality
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <DataList>
|
|
58
|
+
* <DataList.Header>
|
|
59
|
+
* <DataList.Cell colName="name">Name</DataList.Cell>
|
|
60
|
+
* <DataList.Cell colName="email">Email</DataList.Cell>
|
|
61
|
+
* </DataList.Header>
|
|
62
|
+
* <DataList.Row>
|
|
63
|
+
* <DataList.Cell colName="name">John Doe</DataList.Cell>
|
|
64
|
+
* <DataList.Cell colName="email">john@example.com</DataList.Cell>
|
|
65
|
+
* </DataList.Row>
|
|
66
|
+
* </DataList>
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare const DataList: {
|
|
70
|
+
({ multiple, collapsible, isHover, ...rest }: DataListProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
Cell: React.NamedExoticComponent<DataListCellProps>;
|
|
72
|
+
Row({ isVisible, isDisabled, ...rest }: DataListRowProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
Header({ ...rest }: DataListHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
Footer({ ...rest }: DataListFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
Accordion({ value, ...rest }: DataListAccordionProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
AccordionButton({ ...rest }: {
|
|
77
|
+
[x: string]: any;
|
|
78
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
AccordionIcon({ ...rest }: {
|
|
80
|
+
[x: string]: any;
|
|
81
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
AccordionPanel({ ...rest }: {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
displayName: string;
|
|
86
|
+
};
|
|
87
|
+
export { DataList };
|
|
88
|
+
export type { DataListAccordionProps, DataListCellProps, DataListColumns, DataListFooterProps, DataListHeaderProps, DataListProps, DataListRowProps, };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ColumnDef, ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
3
|
+
import { PaginationProps } from '../pagination/pagination';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for DataTable pagination
|
|
6
|
+
*/
|
|
7
|
+
export interface DataTablePagination extends PaginationProps {
|
|
8
|
+
/** Whether to enable client-side pagination (all data loaded at once) */
|
|
9
|
+
enableClientSide?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Props for the DataTable component
|
|
13
|
+
*/
|
|
14
|
+
export interface DataTableProps<TData> {
|
|
15
|
+
/** Array of data objects to display in the table */
|
|
16
|
+
data: TData[];
|
|
17
|
+
/** Column definitions for the table structure and rendering */
|
|
18
|
+
columns: ColumnDef<TData, any>[];
|
|
19
|
+
/** Pagination configuration (optional) */
|
|
20
|
+
pagination?: DataTablePagination;
|
|
21
|
+
/** Visual variant of the table */
|
|
22
|
+
variant?: 'simple' | 'striped';
|
|
23
|
+
/** Enable column filtering functionality */
|
|
24
|
+
enableFiltering?: boolean;
|
|
25
|
+
/** Enable column sorting functionality */
|
|
26
|
+
enableSorting?: boolean;
|
|
27
|
+
/** Content to display when no data is available */
|
|
28
|
+
emptyState?: React.ReactNode;
|
|
29
|
+
/** Enable responsive behavior (mobile cards view) */
|
|
30
|
+
responsive?: boolean;
|
|
31
|
+
/** Mobile view mode when responsive is enabled */
|
|
32
|
+
mobileView?: 'cards' | 'scroll';
|
|
33
|
+
/** Force mobile view regardless of screen size */
|
|
34
|
+
isMobile?: boolean;
|
|
35
|
+
/** Show loading state */
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
/** Callback fired when column filters change */
|
|
38
|
+
onFilterChange?: (filters: ColumnFiltersState) => void;
|
|
39
|
+
/** Callback fired when sorting changes */
|
|
40
|
+
onSortingChange?: (sorting: SortingState) => void;
|
|
41
|
+
/** Callback fired when a row is clicked */
|
|
42
|
+
onRowClick?: (row: TData) => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* DataTable component - A flexible, responsive data table with sorting, filtering, and pagination
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <DataTable
|
|
50
|
+
* data={users}
|
|
51
|
+
* columns={columns}
|
|
52
|
+
* enableSorting
|
|
53
|
+
* enableFiltering
|
|
54
|
+
* pagination={{
|
|
55
|
+
* page: 1,
|
|
56
|
+
* pageSize: 10,
|
|
57
|
+
* totalItems: 100,
|
|
58
|
+
* setPage: setCurrentPage
|
|
59
|
+
* }}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function DataTable<TData>({ data, columns, pagination, variant, enableFiltering, enableSorting, emptyState, responsive, mobileView, isMobile, isLoading, onFilterChange, onSortingChange, onRowClick, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
declare namespace DataTable {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
export { DataTable };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Locale } from 'date-fns';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DatePicker component
|
|
4
|
+
*/
|
|
5
|
+
export interface DatePickerProps {
|
|
6
|
+
/** The selected date or date range */
|
|
7
|
+
value?: Date | [Date | null, Date | null] | null;
|
|
8
|
+
/** Label text displayed above the input */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Callback fired when the date selection changes */
|
|
11
|
+
onChange?: (date: Date | [Date | null, Date | null] | null) => void;
|
|
12
|
+
/** Whether to enable date range selection */
|
|
13
|
+
isRange?: boolean;
|
|
14
|
+
/** Whether to enable time selection */
|
|
15
|
+
isDateTime?: boolean;
|
|
16
|
+
/** Placeholder text for the input */
|
|
17
|
+
placeholderText?: string;
|
|
18
|
+
/** Locale for date formatting and translations */
|
|
19
|
+
locale?: Locale;
|
|
20
|
+
/** Minimum selectable date */
|
|
21
|
+
minDate?: Date;
|
|
22
|
+
/** Maximum selectable date */
|
|
23
|
+
maxDate?: Date;
|
|
24
|
+
/** Custom date format string */
|
|
25
|
+
dateFormat?: string;
|
|
26
|
+
/** Callback fired when the input loses focus */
|
|
27
|
+
onBlur?: () => void;
|
|
28
|
+
/** Whether the input is disabled */
|
|
29
|
+
isDisabled?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A reusable date picker component with floating label and range selection support
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <DatePicker
|
|
37
|
+
* label="Birthdate"
|
|
38
|
+
* value={date}
|
|
39
|
+
* onChange={setDate}
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
44
|
+
export { DatePicker };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface FieldContextType {
|
|
3
|
+
/** Whether the field is invalid */
|
|
4
|
+
isInvalid?: boolean;
|
|
5
|
+
/** Whether the field is required */
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
/** Whether the field is disabled */
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FieldWrapperProps {
|
|
11
|
+
/** The field label */
|
|
12
|
+
label?: string;
|
|
13
|
+
/** The error message to display */
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
/** Whether the field is invalid */
|
|
16
|
+
isInvalid?: boolean;
|
|
17
|
+
/** Whether the field is required */
|
|
18
|
+
isRequired?: boolean;
|
|
19
|
+
/** Whether the field is disabled */
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
/** Helper text to display below the field */
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/** The field content (input, select, etc.) */
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
/** Additional props for the field root */
|
|
26
|
+
fieldRootProps?: Record<string, any>;
|
|
27
|
+
/** Additional props for the field container */
|
|
28
|
+
containerProps?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* FieldWrapper component - A wrapper for form fields with label, error message, and context
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <FieldWrapper
|
|
36
|
+
* label="Email"
|
|
37
|
+
* errorMessage="Please enter a valid email"
|
|
38
|
+
* isInvalid={hasError}
|
|
39
|
+
* isRequired
|
|
40
|
+
* >
|
|
41
|
+
* <Input type="email" />
|
|
42
|
+
* </FieldWrapper>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const FieldWrapper: import('react').ForwardRefExoticComponent<FieldWrapperProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
46
|
+
/**
|
|
47
|
+
* Hook to access the field context
|
|
48
|
+
*/
|
|
49
|
+
declare const useField: () => FieldContextType;
|
|
50
|
+
export { FieldWrapper, useField };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './actions-button/actions-button';
|
|
2
|
+
export * from './data-list/datalist';
|
|
3
|
+
export * from './data-table/data-table';
|
|
4
|
+
export * from './date-picker/date-picker';
|
|
5
|
+
export * from './field-wrapper/field-wrapper';
|
|
6
|
+
export * from './input-mask/input-mask';
|
|
7
|
+
export * from './input-phone/input-phone';
|
|
8
|
+
export * from './input/input';
|
|
9
|
+
export * from './loader/loader';
|
|
10
|
+
export * from './logos/logoPaygreenByLemonway';
|
|
11
|
+
export * from './modal/modal';
|
|
12
|
+
export * from './pagination/pagination';
|
|
13
|
+
export * from './select/select';
|
|
14
|
+
export * from './sidebar/sidebar';
|
|
15
|
+
export * from './ui/color-mode';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InputProps as ChakraInputProps } from '@chakra-ui/react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Input component
|
|
4
|
+
*/
|
|
5
|
+
export interface InputProps extends ChakraInputProps {
|
|
6
|
+
/** Label text displayed above the input */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Whether the input is disabled */
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A reusable input component that extends Chakra UI's Input with floating label and field validation
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Input
|
|
17
|
+
* label="Email"
|
|
18
|
+
* placeholder="Enter your email"
|
|
19
|
+
* isRequired
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
24
|
+
export { Input };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InputProps } from '../input/input';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the InputMask component
|
|
4
|
+
*/
|
|
5
|
+
export interface InputMaskProps extends Omit<InputProps, 'onChange'> {
|
|
6
|
+
/** The mask pattern to apply to the input */
|
|
7
|
+
mask: string | string[];
|
|
8
|
+
/** Additional options for the mask behavior */
|
|
9
|
+
maskOptions?: any;
|
|
10
|
+
/** Callback fired when the input value changes */
|
|
11
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A reusable input component that extends the base Input with mask functionality
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <InputMask
|
|
19
|
+
* label="Phone"
|
|
20
|
+
* mask="(999) 999-9999"
|
|
21
|
+
* placeholder="(555) 555-5555"
|
|
22
|
+
* isRequired
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare const InputMask: import('react').ForwardRefExoticComponent<InputMaskProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export { InputMask };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the InputPhone component
|
|
3
|
+
*/
|
|
4
|
+
export interface InputPhoneProps {
|
|
5
|
+
/** The locale to use for translations ('fr' or 'en') */
|
|
6
|
+
locale?: 'fr' | 'en';
|
|
7
|
+
/** The phone number value in E.164 format */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** The label to display above the input */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Placeholder text for the input */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Whether the input is disabled */
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
/** Additional props to pass to the input element */
|
|
16
|
+
inputProps?: Record<string, unknown>;
|
|
17
|
+
/** Callback fired when the phone number changes */
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
/** Whether the input is required */
|
|
20
|
+
isRequired?: boolean;
|
|
21
|
+
/** Whether the input is invalid */
|
|
22
|
+
isInvalid?: boolean;
|
|
23
|
+
/** Error message to display when invalid */
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
/** Custom labels for the country search component */
|
|
26
|
+
searchLabels?: {
|
|
27
|
+
/** Placeholder text for the search input */
|
|
28
|
+
search?: string;
|
|
29
|
+
/** Text shown when no results are found */
|
|
30
|
+
noResults?: string;
|
|
31
|
+
/** Text shown while loading */
|
|
32
|
+
loading?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates if a phone number is valid
|
|
37
|
+
*/
|
|
38
|
+
declare const isValidPhone: (val: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Formats a phone number to international format
|
|
41
|
+
*/
|
|
42
|
+
declare const formatPhoneIntl: (val: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* A reusable phone input component with international formatting and country selection
|
|
45
|
+
*
|
|
46
|
+
* Note: This component does NOT use forwardRef intentionally, as react-phone-number-input
|
|
47
|
+
* manages its own ref system for proper focus management and country selection.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <InputPhone
|
|
52
|
+
* value="+33612345678"
|
|
53
|
+
* onChange={setPhoneNumber}
|
|
54
|
+
* isRequired
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare const InputPhone: {
|
|
59
|
+
({ locale, label, value, placeholder, isDisabled, inputProps, onChange, isRequired, isInvalid, errorMessage, searchLabels, ...props }: InputPhoneProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
export { formatPhoneIntl, InputPhone, isValidPhone };
|