pesona-ui 0.1.31 → 0.1.33
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 +227 -66
- package/dist/index.d.ts +27 -14
- package/dist/pesona-ui.cjs.js +42 -42
- package/dist/pesona-ui.css +2 -2
- package/dist/pesona-ui.es.js +2987 -2875
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,69 +1,230 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
# Pesona UI
|
|
2
|
+
|
|
3
|
+
Library komponen UI React yang modern dan dapat dikustomisasi, dibangun dengan TypeScript, Vite, dan SCSS. Pesona UI menyediakan set komponen yang lengkap dan dapat digunakan kembali untuk membangun aplikasi web yang indah.
|
|
4
|
+
|
|
5
|
+
## ✨ Fitur
|
|
6
|
+
|
|
7
|
+
- 🎨 **18+ Komponen Siap Pakai** - Button, Card, Modal, Dropdown, Table, Form, dan lainnya
|
|
8
|
+
- 💪 **Dukungan TypeScript** - Definisi tipe lengkap sudah termasuk
|
|
9
|
+
- 🎭 **Dapat di-Theme** - Kustomisasi mudah dengan SCSS variables
|
|
10
|
+
- 📦 **Tree-shakeable** - Import hanya yang Anda butuhkan
|
|
11
|
+
- ⚡ **Cepat** - Dibangun dengan Vite untuk performa optimal
|
|
12
|
+
- 🔧 **Fleksibel** - Komponen yang sangat dapat dikustomisasi
|
|
13
|
+
- 📱 **Responsive** - Pendekatan desain mobile-first
|
|
14
|
+
|
|
15
|
+
## 📦 Komponen yang Tersedia
|
|
16
|
+
|
|
17
|
+
- **Button** - Komponen tombol serbaguna dengan berbagai varian
|
|
18
|
+
- **Card** - Komponen container untuk konten
|
|
19
|
+
- **Spinner** - Indikator loading
|
|
20
|
+
- **Dropdown** - Menu dropdown dan select
|
|
21
|
+
- **Badge** - Badge status dan label
|
|
22
|
+
- **Box** - Container layout
|
|
23
|
+
- **Tab** - Navigasi tab
|
|
24
|
+
- **Alert** - Pesan alert
|
|
25
|
+
- **Callout** - Blok konten yang di-highlight
|
|
26
|
+
- **Tooltip** - Tooltip kontekstual
|
|
27
|
+
- **Popover** - Overlay popover
|
|
28
|
+
- **Modal** - Dialog modal
|
|
29
|
+
- **Accordion** - Panel konten yang dapat dilipat
|
|
30
|
+
- **Progress** - Progress bar dan indikator
|
|
31
|
+
- **Form** - Komponen form (Input, Select, Checkbox, dll.)
|
|
32
|
+
- **Loading** - State loading
|
|
33
|
+
- **List** - Komponen list
|
|
34
|
+
- **Table** - Tabel data
|
|
35
|
+
|
|
36
|
+
## 🚀 Instalasi
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install pesona-ui
|
|
40
|
+
# atau
|
|
41
|
+
yarn add pesona-ui
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 📖 Cara Penggunaan
|
|
45
|
+
|
|
46
|
+
Import komponen dan styles di aplikasi React Anda:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Button, Card, Modal } from 'pesona-ui';
|
|
50
|
+
import 'pesona-ui/dist/pesona-ui.css';
|
|
51
|
+
|
|
52
|
+
function App() {
|
|
53
|
+
return (
|
|
54
|
+
<Card>
|
|
55
|
+
<Button className="btn btn-primary">
|
|
56
|
+
Klik saya
|
|
57
|
+
</Button>
|
|
58
|
+
</Card>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🏗️ Struktur Project
|
|
64
|
+
|
|
65
|
+
Project ini menggunakan struktur monorepo:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
pesona-ui-react/
|
|
69
|
+
├── src/ # Library Komponen UI
|
|
70
|
+
│ ├── components/ # Semua komponen yang dapat digunakan kembali
|
|
71
|
+
│ ├── styles/ # Global styles dan variables
|
|
72
|
+
│ ├── hooks/ # Custom React hooks
|
|
73
|
+
│ └── index.ts # Entry point utama
|
|
74
|
+
├── demo/ # Aplikasi Demo
|
|
75
|
+
│ └── src/
|
|
76
|
+
│ ├── presentation/ # Demo pages dan contoh
|
|
77
|
+
│ ├── domain/ # Business logic
|
|
78
|
+
│ └── data/ # Data layer
|
|
79
|
+
└── dist/ # Output build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Root Folder (Library)
|
|
83
|
+
|
|
84
|
+
Berisi library komponen UI yang dapat dipublikasikan ke npm. Setiap komponen mengikuti struktur yang konsisten:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Component/
|
|
88
|
+
├── Component.tsx # Logic komponen
|
|
89
|
+
├── Component.scss # Styles komponen
|
|
90
|
+
└── index.ts # Export
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Demo Folder
|
|
94
|
+
|
|
95
|
+
Aplikasi admin dashboard lengkap yang mendemonstrasikan cara menggunakan komponen. Fitur yang tersedia:
|
|
96
|
+
|
|
97
|
+
- Contoh komponen live
|
|
98
|
+
- Dokumentasi interaktif
|
|
99
|
+
- Pola penggunaan real-world
|
|
100
|
+
- State management dengan Redux Toolkit
|
|
101
|
+
- Routing dengan React Router
|
|
102
|
+
- Internationalization (i18n)
|
|
103
|
+
- Form handling dengan React Hook Form
|
|
104
|
+
- Data fetching dengan React Query
|
|
105
|
+
|
|
106
|
+
## 🛠️ Development
|
|
107
|
+
|
|
108
|
+
### Prerequisites
|
|
109
|
+
|
|
110
|
+
- Node.js >= 18
|
|
111
|
+
- Yarn atau npm
|
|
112
|
+
|
|
113
|
+
### Setup
|
|
114
|
+
|
|
115
|
+
1. Clone repository:
|
|
116
|
+
```bash
|
|
117
|
+
git clone <repository-url>
|
|
118
|
+
cd pesona-ui-react
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. Install dependencies:
|
|
122
|
+
```bash
|
|
123
|
+
yarn install
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
3. Build library:
|
|
127
|
+
```bash
|
|
128
|
+
yarn build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
4. Jalankan aplikasi demo:
|
|
132
|
+
```bash
|
|
133
|
+
cd demo
|
|
134
|
+
yarn install
|
|
135
|
+
yarn dev
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Demo akan tersedia di `http://localhost:5180`
|
|
139
|
+
|
|
140
|
+
### Script yang Tersedia
|
|
141
|
+
|
|
142
|
+
**Root (Library):**
|
|
143
|
+
- `yarn dev` - Mulai mode development
|
|
144
|
+
- `yarn build` - Build library
|
|
145
|
+
- `yarn lint` - Jalankan ESLint
|
|
146
|
+
- `yarn lint:fix` - Perbaiki error ESLint
|
|
147
|
+
- `yarn format` - Format code dengan Prettier
|
|
148
|
+
- `yarn test` - Jalankan tests
|
|
149
|
+
- `yarn test:watch` - Jalankan tests dalam watch mode
|
|
150
|
+
|
|
151
|
+
**Demo:**
|
|
152
|
+
- `yarn dev` - Mulai aplikasi demo
|
|
153
|
+
- `yarn build` - Build aplikasi demo
|
|
154
|
+
- `yarn preview` - Preview production build
|
|
155
|
+
- `yarn lint` - Jalankan ESLint
|
|
156
|
+
- `yarn lint:fix` - Perbaiki error ESLint
|
|
157
|
+
|
|
158
|
+
## 📦 Building untuk Production
|
|
159
|
+
|
|
160
|
+
Build library:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
yarn build
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Ini akan menghasilkan:
|
|
167
|
+
- `dist/pesona-ui.es.js` - ES module
|
|
168
|
+
- `dist/pesona-ui.cjs.js` - CommonJS module
|
|
169
|
+
- `dist/pesona-ui.css` - Compiled styles
|
|
170
|
+
- `dist/index.d.ts` - TypeScript definitions
|
|
171
|
+
|
|
172
|
+
## 🎨 Kustomisasi
|
|
173
|
+
|
|
174
|
+
### Theming
|
|
175
|
+
|
|
176
|
+
Override SCSS variables untuk mengkustomisasi tampilan:
|
|
177
|
+
|
|
178
|
+
```scss
|
|
179
|
+
// Custom styles Anda
|
|
180
|
+
@use 'pesona-ui/src/styles/variables' as vars with (
|
|
181
|
+
$primary-color: #your-color,
|
|
182
|
+
$font-family: 'Your Font'
|
|
183
|
+
);
|
|
40
184
|
```
|
|
41
185
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
globalIgnores(['dist']),
|
|
51
|
-
{
|
|
52
|
-
files: ['**/*.{ts,tsx}'],
|
|
53
|
-
extends: [
|
|
54
|
-
// Other configs...
|
|
55
|
-
// Enable lint rules for React
|
|
56
|
-
reactX.configs['recommended-typescript'],
|
|
57
|
-
// Enable lint rules for React DOM
|
|
58
|
-
reactDom.configs.recommended,
|
|
59
|
-
],
|
|
60
|
-
languageOptions: {
|
|
61
|
-
parserOptions: {
|
|
62
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
63
|
-
tsconfigRootDir: import.meta.dirname,
|
|
64
|
-
},
|
|
65
|
-
// other options...
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
])
|
|
186
|
+
### Styling Komponen
|
|
187
|
+
|
|
188
|
+
Semua komponen menerima prop `className` untuk custom styling:
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<Button className="btn btn-primary custom-class">
|
|
192
|
+
Custom Button
|
|
193
|
+
</Button>
|
|
69
194
|
```
|
|
195
|
+
|
|
196
|
+
## 🔧 Tech Stack
|
|
197
|
+
|
|
198
|
+
- **React 18+** - UI library
|
|
199
|
+
- **TypeScript** - Type safety
|
|
200
|
+
- **Vite** - Build tool
|
|
201
|
+
- **SCSS** - Styling
|
|
202
|
+
- **ESLint** - Code linting
|
|
203
|
+
- **Prettier** - Code formatting
|
|
204
|
+
- **Vitest** - Testing framework
|
|
205
|
+
|
|
206
|
+
## 🎭 Fitur Demo
|
|
207
|
+
|
|
208
|
+
Aplikasi demo menampilkan:
|
|
209
|
+
|
|
210
|
+
- Galeri komponen dengan contoh live
|
|
211
|
+
- Contoh validasi form
|
|
212
|
+
- Tabel data dengan sorting dan filtering
|
|
213
|
+
- Fungsionalitas drag and drop
|
|
214
|
+
- Alur autentikasi
|
|
215
|
+
- Role-based access control (RBAC)
|
|
216
|
+
- Switching tema Dark/Light
|
|
217
|
+
- Dukungan multi-bahasa
|
|
218
|
+
- Layout responsive
|
|
219
|
+
|
|
220
|
+
## 🤝 Kontribusi
|
|
221
|
+
|
|
222
|
+
Kontribusi sangat diterima! Silakan submit Pull Request.
|
|
223
|
+
|
|
224
|
+
## 📄 License
|
|
225
|
+
|
|
226
|
+
MIT
|
|
227
|
+
|
|
228
|
+
## 📞 Support
|
|
229
|
+
|
|
230
|
+
Jika Anda menemukan bug atau memiliki pertanyaan, silakan buat issue di repository ini.
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { ReactNode } from 'react';
|
|
|
8
8
|
export declare const Accordion: default_2.FC<AccordionProps>;
|
|
9
9
|
|
|
10
10
|
declare interface AccordionProps {
|
|
11
|
-
defaultIndex?: number;
|
|
11
|
+
defaultIndex?: number | null;
|
|
12
|
+
alwaysOpen?: boolean;
|
|
13
|
+
flush?: boolean;
|
|
12
14
|
children: default_2.ReactNode;
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -47,7 +49,8 @@ export declare const Badge: default_2.FC<BadgeProps>;
|
|
|
47
49
|
|
|
48
50
|
declare interface BadgeProps {
|
|
49
51
|
className?: string;
|
|
50
|
-
|
|
52
|
+
children?: default_2.ReactNode;
|
|
53
|
+
style?: default_2.CSSProperties;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export declare const Box: default_2.FC<BoxProps>;
|
|
@@ -225,6 +228,7 @@ declare interface DropdownMenuItem {
|
|
|
225
228
|
label: string;
|
|
226
229
|
className?: string;
|
|
227
230
|
onClick: () => void;
|
|
231
|
+
divider?: boolean;
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
declare interface DropdownMenuProps {
|
|
@@ -284,10 +288,12 @@ declare interface InputDateProps extends Omit<default_2.InputHTMLAttributes<HTML
|
|
|
284
288
|
export declare const InputFile: default_2.ForwardRefExoticComponent<InputFileProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
285
289
|
|
|
286
290
|
declare interface InputFileProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
291
|
+
className?: string;
|
|
287
292
|
name: string;
|
|
288
293
|
label?: string;
|
|
289
294
|
message?: string;
|
|
290
295
|
accept?: string;
|
|
296
|
+
floatingLabel?: boolean;
|
|
291
297
|
error?: string;
|
|
292
298
|
}
|
|
293
299
|
|
|
@@ -317,8 +323,9 @@ declare interface InputProps_2 extends HTMLProps<HTMLInputElement> {
|
|
|
317
323
|
export declare const InputTextArea: default_2.ForwardRefExoticComponent<InputTextAreaProps & default_2.RefAttributes<HTMLTextAreaElement>>;
|
|
318
324
|
|
|
319
325
|
declare interface InputTextAreaProps extends default_2.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
326
|
+
className?: string;
|
|
320
327
|
name: string;
|
|
321
|
-
label
|
|
328
|
+
label?: string;
|
|
322
329
|
message?: string;
|
|
323
330
|
floatingLabel?: boolean;
|
|
324
331
|
error?: string | undefined;
|
|
@@ -399,6 +406,8 @@ declare interface PopoverProps {
|
|
|
399
406
|
className: string;
|
|
400
407
|
children: default_2.ReactNode;
|
|
401
408
|
text: string;
|
|
409
|
+
title?: string;
|
|
410
|
+
dismissible?: boolean;
|
|
402
411
|
}
|
|
403
412
|
|
|
404
413
|
declare type Props = {
|
|
@@ -429,8 +438,9 @@ declare interface RadioButtonGroupProps {
|
|
|
429
438
|
}
|
|
430
439
|
|
|
431
440
|
declare interface RadioProps extends HTMLProps<HTMLInputElement> {
|
|
441
|
+
className?: string;
|
|
432
442
|
name: string;
|
|
433
|
-
label
|
|
443
|
+
label?: string;
|
|
434
444
|
message?: string;
|
|
435
445
|
options: Option_2[];
|
|
436
446
|
error?: string | undefined;
|
|
@@ -468,6 +478,8 @@ declare interface SelectOption_2 {
|
|
|
468
478
|
}
|
|
469
479
|
|
|
470
480
|
declare interface SelectProps {
|
|
481
|
+
className?: string;
|
|
482
|
+
id?: string;
|
|
471
483
|
name: string;
|
|
472
484
|
label?: string;
|
|
473
485
|
message?: string;
|
|
@@ -492,6 +504,7 @@ declare interface SelectWithSearchOption {
|
|
|
492
504
|
}
|
|
493
505
|
|
|
494
506
|
declare interface SelectWithSearchProps {
|
|
507
|
+
id?: string;
|
|
495
508
|
name: string;
|
|
496
509
|
label?: string;
|
|
497
510
|
message?: string;
|
|
@@ -502,6 +515,7 @@ declare interface SelectWithSearchProps {
|
|
|
502
515
|
options: SelectWithSearchOption[];
|
|
503
516
|
value?: string | number;
|
|
504
517
|
onChange?: (event: default_2.ChangeEvent<HTMLSelectElement>) => void;
|
|
518
|
+
onBlur?: (event: default_2.FocusEvent<HTMLSelectElement>) => void;
|
|
505
519
|
required?: boolean;
|
|
506
520
|
disabled?: boolean;
|
|
507
521
|
role?: string;
|
|
@@ -534,16 +548,13 @@ declare interface TabGroupProps {
|
|
|
534
548
|
|
|
535
549
|
export declare const Table: default_2.FC<TableProps>;
|
|
536
550
|
|
|
537
|
-
export declare const TableBody: default_2.FC<
|
|
551
|
+
export declare const TableBody: default_2.FC<TableSectionProps>;
|
|
538
552
|
|
|
539
553
|
export declare const TableCell: default_2.FC<TableCellProps>;
|
|
540
554
|
|
|
541
|
-
declare interface TableCellProps {
|
|
555
|
+
declare interface TableCellProps extends default_2.TdHTMLAttributes<HTMLTableCellElement> {
|
|
542
556
|
children: default_2.ReactNode;
|
|
543
557
|
header?: boolean;
|
|
544
|
-
className?: string;
|
|
545
|
-
colSpan?: number;
|
|
546
|
-
style?: default_2.CSSProperties;
|
|
547
558
|
}
|
|
548
559
|
|
|
549
560
|
export declare const TableDeleteSelectedItems: default_2.FC<TableDeleteSelectedItemsProps>;
|
|
@@ -553,9 +564,9 @@ declare interface TableDeleteSelectedItemsProps {
|
|
|
553
564
|
handleMultipleDelete: () => void;
|
|
554
565
|
}
|
|
555
566
|
|
|
556
|
-
export declare const TableFooter: default_2.FC<
|
|
567
|
+
export declare const TableFooter: default_2.FC<TableSectionProps>;
|
|
557
568
|
|
|
558
|
-
export declare const TableHeader: default_2.FC<
|
|
569
|
+
export declare const TableHeader: default_2.FC<TableSectionProps>;
|
|
559
570
|
|
|
560
571
|
export declare const TablePaginating: default_2.FC<TablePaginatingProps>;
|
|
561
572
|
|
|
@@ -579,16 +590,18 @@ declare interface TablePickSelectedItemsProps {
|
|
|
579
590
|
selectedRows: string[];
|
|
580
591
|
}
|
|
581
592
|
|
|
582
|
-
declare interface TableProps {
|
|
593
|
+
declare interface TableProps extends default_2.TableHTMLAttributes<HTMLTableElement> {
|
|
583
594
|
children: default_2.ReactNode;
|
|
584
|
-
className?: string;
|
|
585
595
|
}
|
|
586
596
|
|
|
587
597
|
export declare const TableRow: default_2.FC<TableRowProps>;
|
|
588
598
|
|
|
589
599
|
declare interface TableRowProps extends default_2.HTMLAttributes<HTMLTableRowElement> {
|
|
590
600
|
children: default_2.ReactNode;
|
|
591
|
-
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
declare interface TableSectionProps extends default_2.HTMLAttributes<HTMLTableSectionElement> {
|
|
604
|
+
children: default_2.ReactNode;
|
|
592
605
|
}
|
|
593
606
|
|
|
594
607
|
declare interface TabProps {
|