@1money/react-ui 1.7.20 → 1.7.21

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/CLAUDE.md ADDED
@@ -0,0 +1,104 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Development Commands
6
+
7
+ ### Development Server
8
+ - `pnpm dev` - Start Storybook development server on port 6205
9
+ - `pnpm start` - Alternative command to start development server
10
+
11
+ ### Building
12
+ - `pnpm build` - Build the component library (both CommonJS and ES modules)
13
+ - `pnpm build -n` - Build bypassing all pre-checks
14
+ - `pnpm build:demo` - Build Storybook demo
15
+
16
+ ### Testing and Linting
17
+ - `pnpm test` - Run Jest tests (passes with no tests by default)
18
+ - `pnpm test:snapshot` - Update Jest snapshots
19
+ - `pnpm lint` - Run all linting (ESLint, Prettier, Stylelint)
20
+ - `pnpm lint:fix` - Auto-fix all linting issues
21
+ - `pnpm lint:es` / `pnpm lint:es_fix` - ESLint only
22
+ - `pnpm lint:prettier` / `pnpm lint:prettier_fix` - Prettier only
23
+ - `pnpm lint:style` / `pnpm lint:style_fix` - Stylelint only
24
+
25
+ ### Component Generation
26
+ - `pnpm new` - Interactive component scaffolding using omni-door
27
+ - `pnpm new ComponentName -f` - Generate functional component with given name
28
+
29
+ ### Package Management
30
+ - `pnpm release` - Release new version (auto-builds first)
31
+ - `pnpm release -i` - Release ignoring version iteration
32
+ - `pnpm release -m 0.3.25` - Release with specific version
33
+ - `pnpm release -n` - Release bypassing pre-checks
34
+
35
+ ## Project Architecture
36
+
37
+ ### Component Library Structure
38
+ This is a React component library built with PrimeReact as the base, using the omni-door CLI framework for scaffolding and build processes.
39
+
40
+ **Core Dependencies:**
41
+ - **PrimeReact**: Base UI component library (>=10.9.0)
42
+ - **React**: >=16.8.0 with React 19+ for development
43
+ - **TailwindCSS**: >=3.0.0 for styling system
44
+ - **TypeScript**: Full TypeScript support with strict mode
45
+
46
+ **Build System:**
47
+ - Dual output: CommonJS (`lib/`) and ES modules (`es/`)
48
+ - Gulp-based build pipeline via omni-door
49
+ - SCSS preprocessing with modern API
50
+ - Path aliasing: `@/` maps to `src/`
51
+
52
+ ### Directory Structure
53
+ ```
54
+ src/
55
+ ├── components/ # All UI components
56
+ │ └── ComponentName/
57
+ │ ├── ComponentName.tsx # Main component file
58
+ │ ├── ComponentName.stories.tsx # Storybook stories
59
+ │ ├── interface.ts # TypeScript interfaces
60
+ │ ├── index.ts # Export barrel
61
+ │ ├── README.md # Component documentation
62
+ │ ├── __test__/ # Jest tests with snapshots
63
+ │ └── style/ # SCSS styles
64
+ ├── utils/ # Utility functions (classnames, clipboard, uuid)
65
+ ├── variable.scss # Global SCSS variables
66
+ └── index.ts # Main library export
67
+ ```
68
+
69
+ ### Component Development Patterns
70
+ - **Base Components**: Most components wrap PrimeReact components with custom styling
71
+ - **Props Interface**: Each component has a dedicated `interface.ts` file
72
+ - **Styling**: SCSS modules with BEM-like naming via `classnames` utility
73
+ - **Testing**: Jest with snapshot testing for visual regression
74
+ - **Stories**: Storybook stories for documentation and testing
75
+
76
+ ### Key Files
77
+ - `omni.config.js`: Main configuration for build, dev server, and scaffolding
78
+ - `gulpfile.js`: Custom build pipeline configuration
79
+ - `tsconfig.json`: TypeScript configuration with path mapping
80
+ - `.storybook/`: Storybook configuration with custom theming
81
+
82
+ ### Package Exports
83
+ The library provides both named exports and individual component imports:
84
+ ```js
85
+ // Named imports
86
+ import { Button, Input } from '@1money/react-ui';
87
+
88
+ // Individual component imports
89
+ import { Button } from '@1money/react-ui/Button';
90
+ import '@1money/react-ui/index.css';
91
+ ```
92
+
93
+ ### Development Workflow
94
+ 1. Use `pnpm new ComponentName -f` to scaffold new components
95
+ 2. Components automatically include TypeScript interfaces, SCSS styles, Storybook stories, and Jest tests
96
+ 3. All components must pass linting (ESLint, Prettier, Stylelint) and tests before building
97
+ 4. Build process generates both CommonJS and ES module outputs with TypeScript declarations
98
+ 5. Storybook serves as both development environment and documentation
99
+
100
+ ### Important Notes
101
+ - Components are patches applied to PrimeReact and react-pro-sidebar (see `patches/` directory)
102
+ - Font assets (Aeonik, Inter, Outfit) are included in `public/fonts/`
103
+ - Lottie animations are used in Loading component
104
+ - Pre-commit hooks enforce code quality via husky and lint-staged
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 1Money Co
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # @1money/react-ui
2
- The React Components Library for @1money co
2
+
3
+ A comprehensive React component library built on PrimeReact, specifically designed for financial applications and modern web interfaces.
3
4
 
4
5
  [![Build Status](https://github.com/1Money-Co/1money-react-ui/actions/workflows/cicd-npm.yml/badge.svg)](https://github.com/1Money-Co/1money-react-ui/actions/workflows/cicd-npm.yml)
5
6
  [![NPM downloads](http://img.shields.io/npm/dm/%401money%2Freact-ui.svg?style=flat-square)](https://www.npmjs.com/package/@1money/react-ui)
@@ -7,32 +8,442 @@ The React Components Library for @1money co
7
8
  [![install size](https://packagephobia.now.sh/badge?p=%401money%2Freact-ui)](https://packagephobia.now.sh/result?p=%401money%2Freact-ui)
8
9
  [![license](http://img.shields.io/npm/l/%401money%2Freact-ui.svg)](https://github.com/1money/tpls/blob/master/packages/react-ui/LICENSE)
9
10
 
10
- [Online Preview](https://1money-co.github.io/1money-react-ui/)
11
+ 📖 [Online Documentation & Storybook](https://1money-co.github.io/1money-react-ui/)
11
12
 
12
13
  English | [简体中文](./README.zh-CN.md)
13
14
 
14
- ## Quick start
15
- ### Install
16
- ```shell
17
- npm i -S @1money/react-ui
18
- # or
15
+ ## Features
16
+
17
+ - 🎨 **30+ High-quality Components** - Built on PrimeReact with enhanced styling
18
+ - 💰 **Financial Application Ready** - Components designed for fintech interfaces
19
+ - 🎯 **TypeScript Support** - Full TypeScript definitions with strict typing
20
+ - 📱 **Responsive Design** - Mobile-first approach with TailwindCSS integration
21
+ - ♿ **Accessibility First** - WCAG compliant with keyboard navigation
22
+ - 🌍 **I18n Ready** - Internationalization support out of the box
23
+ - 🎭 **Customizable Theming** - Easy customization with SCSS variables
24
+ - 📦 **Tree Shaking** - Optimized bundle size with individual component imports
25
+
26
+ ## 📦 Installation
27
+
28
+ ```bash
29
+ # npm
30
+ npm install @1money/react-ui
31
+
32
+ # yarn
19
33
  yarn add @1money/react-ui
20
- # or
21
- pnpm i -S @1money/react-ui
34
+
35
+ # pnpm
36
+ pnpm add @1money/react-ui
37
+ ```
38
+
39
+ ### Peer Dependencies
40
+
41
+ Make sure you have the required peer dependencies installed:
42
+
43
+ ```bash
44
+ npm install react react-dom primereact primeicons tailwindcss
45
+ ```
46
+
47
+ ## 🚀 Quick Start
48
+
49
+ ### Basic Setup
50
+
51
+ ```tsx
52
+ import '@1money/react-ui/index.css';
53
+ import { Button, Input, Modal } from '@1money/react-ui';
54
+
55
+ function App() {
56
+ return (
57
+ <div className="p-4">
58
+ <Button severity="primary">Get Started</Button>
59
+ </div>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ### Individual Component Imports
65
+
66
+ For better tree shaking, import components individually:
67
+
68
+ ```tsx
69
+ import { Button } from '@1money/react-ui/Button';
70
+ import { Input } from '@1money/react-ui/Input';
71
+ import { Modal } from '@1money/react-ui/Modal';
72
+ import '@1money/react-ui/index.css';
73
+ ```
74
+
75
+ ## 📋 Component Categories
76
+
77
+ ### 🎮 Form Components
78
+ Perfect for building complex forms and data input interfaces.
79
+
80
+ ```tsx
81
+ import { Button, Input, Checkbox, Radio, Switch, Select } from '@1money/react-ui';
82
+
83
+ // Form example
84
+ <form className="space-y-4">
85
+ <Input
86
+ type="text"
87
+ label="Full Name"
88
+ placeholder="Enter your name"
89
+ required
90
+ />
91
+
92
+ <Input
93
+ type="number"
94
+ label="Investment Amount"
95
+ prefixEle="$"
96
+ placeholder="0.00"
97
+ />
98
+
99
+ <Select
100
+ label="Account Type"
101
+ options={[
102
+ { label: 'Checking', value: 'checking' },
103
+ { label: 'Savings', value: 'savings' },
104
+ { label: 'Investment', value: 'investment' }
105
+ ]}
106
+ />
107
+
108
+ <div className="flex items-center gap-2">
109
+ <Checkbox inputId="terms" />
110
+ <label htmlFor="terms">I agree to the terms and conditions</label>
111
+ </div>
112
+
113
+ <Button type="submit" severity="primary">
114
+ Create Account
115
+ </Button>
116
+ </form>
117
+ ```
118
+
119
+ ### 💼 Financial Components
120
+ Specialized components for financial applications.
121
+
122
+ ```tsx
123
+ import { InputAmount, Badge, Progress, Table } from '@1money/react-ui';
124
+
125
+ // Financial dashboard example
126
+ <div className="financial-dashboard">
127
+ <div className="balance-card">
128
+ <h3>Account Balance</h3>
129
+ <InputAmount
130
+ value={125430.50}
131
+ precision={2}
132
+ disabled
133
+ prefixEle="$"
134
+ />
135
+ <Badge severity="success" value="↑ 12.5%" />
136
+ </div>
137
+
138
+ <Progress
139
+ type="ring"
140
+ value={75}
141
+ label="Portfolio Growth"
142
+ color="var(--primary-color)"
143
+ />
144
+ </div>
145
+ ```
146
+
147
+ ### 🎨 Layout & Navigation
148
+ Build complex layouts and navigation systems.
149
+
150
+ ```tsx
151
+ import { Sidebar, Tab, Menu, Collapse } from '@1money/react-ui';
152
+
153
+ // Application layout
154
+ <div className="app-layout">
155
+ <Sidebar
156
+ items={[
157
+ { label: 'Dashboard', icon: 'dashboard', command: () => navigate('/dashboard') },
158
+ { label: 'Accounts', icon: 'account-balance', command: () => navigate('/accounts') },
159
+ { label: 'Transactions', icon: 'receipt', command: () => navigate('/transactions') },
160
+ { label: 'Settings', icon: 'settings', command: () => navigate('/settings') }
161
+ ]}
162
+ />
163
+
164
+ <main className="main-content">
165
+ <Tab
166
+ items={[
167
+ { label: 'Overview', content: <DashboardOverview /> },
168
+ { label: 'Analytics', content: <Analytics />, count: 3 },
169
+ { label: 'Reports', content: <Reports /> }
170
+ ]}
171
+ />
172
+ </main>
173
+ </div>
174
+ ```
175
+
176
+ ### 📊 Data Display
177
+ Present data in tables, lists, and other formats.
178
+
179
+ ```tsx
180
+ import { Table, Cell, Typography, Loading } from '@1money/react-ui';
181
+
182
+ // Transaction table
183
+ const transactions = [
184
+ { id: 1, date: '2024-01-15', description: 'Coffee Shop', amount: -4.50, category: 'Food' },
185
+ { id: 2, date: '2024-01-14', description: 'Salary Deposit', amount: 3500.00, category: 'Income' },
186
+ { id: 3, date: '2024-01-13', description: 'Grocery Store', amount: -89.32, category: 'Shopping' }
187
+ ];
188
+
189
+ <Table
190
+ data={transactions}
191
+ selectionMode="multiple"
192
+ pagination
193
+ pageSize={10}
194
+ >
195
+ <Column field="date" header="Date" />
196
+ <Column field="description" header="Description" />
197
+ <Column
198
+ field="amount"
199
+ header="Amount"
200
+ body={(rowData) => (
201
+ <Typography.Body
202
+ className={rowData.amount > 0 ? 'text-green-600' : 'text-red-600'}
203
+ >
204
+ ${Math.abs(rowData.amount).toFixed(2)}
205
+ </Typography.Body>
206
+ )}
207
+ />
208
+ <Column field="category" header="Category" />
209
+ </Table>
210
+ ```
211
+
212
+ ### 💬 Feedback Components
213
+ Provide user feedback and system status.
214
+
215
+ ```tsx
216
+ import { Toast, Notification, Message, Progress } from '@1money/react-ui';
217
+
218
+ // Payment processing feedback
219
+ const PaymentFlow = () => {
220
+ const [processing, setProcessing] = useState(false);
221
+ const toast = useRef<Toast>(null);
222
+
223
+ const processPayment = async () => {
224
+ setProcessing(true);
225
+
226
+ try {
227
+ await paymentAPI.process();
228
+ toast.current?.show({
229
+ severity: 'success',
230
+ summary: 'Payment Successful',
231
+ detail: 'Your payment has been processed successfully'
232
+ });
233
+ } catch (error) {
234
+ toast.current?.show({
235
+ severity: 'error',
236
+ summary: 'Payment Failed',
237
+ detail: error.message
238
+ });
239
+ } finally {
240
+ setProcessing(false);
241
+ }
242
+ };
243
+
244
+ return (
245
+ <div>
246
+ <Button
247
+ onClick={processPayment}
248
+ loading={processing}
249
+ disabled={processing}
250
+ >
251
+ Process Payment
252
+ </Button>
253
+
254
+ {processing && (
255
+ <Progress
256
+ type="bar"
257
+ mode="indeterminate"
258
+ className="mt-4"
259
+ />
260
+ )}
261
+
262
+ <Toast ref={toast} />
263
+ </div>
264
+ );
265
+ };
266
+ ```
267
+
268
+ ### 🎭 Interactive Components
269
+ Modals, popups, and other interactive elements.
270
+
271
+ ```tsx
272
+ import { Modal, Popup, Tooltip, ConfirmPopup } from '@1money/react-ui';
273
+
274
+ // Account deletion confirmation
275
+ const AccountSettings = () => {
276
+ const [deleteModalVisible, setDeleteModalVisible] = useState(false);
277
+
278
+ return (
279
+ <div className="account-settings">
280
+ <Tooltip target=".delete-btn" content="This action cannot be undone">
281
+ <Button
282
+ className="delete-btn"
283
+ severity="danger"
284
+ outlined
285
+ onClick={() => setDeleteModalVisible(true)}
286
+ >
287
+ Delete Account
288
+ </Button>
289
+ </Tooltip>
290
+
291
+ <Modal
292
+ visible={deleteModalVisible}
293
+ onHide={() => setDeleteModalVisible(false)}
294
+ header="Confirm Account Deletion"
295
+ footer={
296
+ <div className="flex gap-2">
297
+ <Button
298
+ severity="secondary"
299
+ onClick={() => setDeleteModalVisible(false)}
300
+ >
301
+ Cancel
302
+ </Button>
303
+ <Button
304
+ severity="danger"
305
+ onClick={handleAccountDeletion}
306
+ >
307
+ Delete Account
308
+ </Button>
309
+ </div>
310
+ }
311
+ >
312
+ <Message
313
+ severity="warn"
314
+ text="This will permanently delete your account and all associated data."
315
+ />
316
+ <Typography.Body className="mt-4">
317
+ Are you sure you want to proceed? This action cannot be undone.
318
+ </Typography.Body>
319
+ </Modal>
320
+ </div>
321
+ );
322
+ };
323
+ ```
324
+
325
+ ## 🎨 Theming & Customization
326
+
327
+ ### CSS Custom Properties
328
+
329
+ ```css
330
+ :root {
331
+ --primary-color: #007bff;
332
+ --secondary-color: #6c757d;
333
+ --success-color: #28a745;
334
+ --warning-color: #ffc107;
335
+ --danger-color: #dc3545;
336
+ --info-color: #17a2b8;
337
+
338
+ --border-radius: 6px;
339
+ --font-family: 'Inter', sans-serif;
340
+ --transition-duration: 0.15s;
341
+ }
342
+ ```
343
+
344
+ ### SCSS Variables
345
+
346
+ ```scss
347
+ @import '@1money/react-ui/variable.scss';
348
+
349
+ // Override default variables
350
+ $primary-color: #007bff;
351
+ $secondary-color: #6c757d;
352
+ $border-radius: 8px;
353
+ $font-size-base: 14px;
354
+ ```
355
+
356
+ ### Component-level Customization
357
+
358
+ ```tsx
359
+ // Using prefixCls for component-level styling
360
+ <Button
361
+ prefixCls="custom-button"
362
+ className="my-custom-styles"
363
+ >
364
+ Custom Button
365
+ </Button>
22
366
  ```
23
367
 
24
- ### Usage
25
- ```js
26
- import UI from '@1money/react-ui';
368
+ ```css
369
+ .custom-button {
370
+ background: linear-gradient(45deg, #007bff, #0056b3);
371
+ border: none;
372
+ box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
373
+ }
27
374
  ```
28
375
 
29
- ## Dev
30
- For debugging or maintenance, you can clone the whole git repository and run the project:
376
+ ## 🛠️ Development
31
377
 
32
- ```shell
33
- git clone --depth 1
378
+ ### Prerequisites
379
+
380
+ - Node.js >= 16
381
+ - pnpm (recommended)
382
+
383
+ ### Getting Started
384
+
385
+ ```bash
386
+ # Clone the repository
387
+ git clone https://github.com/1Money-Co/1money-react-ui.git
388
+ cd 1money-react-ui
389
+
390
+ # Install dependencies
391
+ pnpm install
392
+
393
+ # Start development server (Storybook)
394
+ pnpm dev
395
+
396
+ # Build components
397
+ pnpm build
398
+
399
+ # Run tests
400
+ pnpm test
401
+
402
+ # Lint code
403
+ pnpm lint
404
+ ```
405
+
406
+ ### Project Structure
34
407
 
35
- pnpm i && pnpm dev
36
408
  ```
409
+ src/
410
+ ├── components/ # All UI components
411
+ │ ├── Button/ # Individual component
412
+ │ │ ├── Button.tsx # Component implementation
413
+ │ │ ├── interface.ts # TypeScript interfaces
414
+ │ │ ├── index.ts # Export barrel
415
+ │ │ ├── style/ # Component styles
416
+ │ │ └── README.md # Component documentation
417
+ │ └── ...
418
+ ├── utils/ # Utility functions
419
+ ├── variable.scss # Global SCSS variables
420
+ └── index.ts # Main library export
421
+ ```
422
+
423
+ ## 📚 Documentation
424
+
425
+ - 📖 [Storybook Documentation](https://1money-co.github.io/1money-react-ui/)
426
+ - 🔧 [Development Guide](./DEV.md)
427
+ - 📝 [Component Documentation](./src/components/)
428
+ - 🤖 [Claude Code Guide](./CLAUDE.md)
429
+
430
+ ### Development Workflow
431
+
432
+ 1. Fork the repository
433
+ 2. Create a feature branch: `git checkout -b feature/new-component`
434
+ 3. Make your changes and add tests
435
+ 4. Run linting and tests: `pnpm lint && pnpm test`
436
+ 5. Create a pull request
437
+
438
+ ## 📄 License
439
+
440
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
441
+
442
+ ## 🆘 Support
443
+
444
+ - 📖 [Documentation](https://1money-co.github.io/1money-react-ui/)
445
+ - 🐛 [Issues](https://github.com/1Money-Co/1money-react-ui/issues)
446
+
447
+ ---
37
448
 
38
- [More Detials](./DEV.md)
449
+ Made with ❤️ by the [@1money](https://github.com/1Money-Co) team