gd-ui-library 1.0.21 → 1.0.23

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 ADDED
@@ -0,0 +1,449 @@
1
+ # gd-ui-library
2
+
3
+ > A comprehensive, production-ready React component library built natively — no external UI frameworks required. Fully typed with TypeScript.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/gd-ui-library.svg)](https://www.npmjs.com/package/gd-ui-library)
6
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
+
8
+ ---
9
+
10
+ ## ✨ Features
11
+
12
+ - **70+ components** covering every UI need
13
+ - **Fully typed** with TypeScript
14
+ - **Zero external UI dependency** — built from scratch
15
+ - **Tailwind CSS** powered styling
16
+ - **Accessible** — proper ARIA roles throughout
17
+ - **Responsive** — mobile-first design
18
+ - Works with **React 18+** / **Next.js** (App Router)
19
+
20
+ ---
21
+
22
+ ## 📦 Installation
23
+
24
+ ```bash
25
+ npm install gd-ui-library
26
+ # or
27
+ yarn add gd-ui-library
28
+ # or
29
+ pnpm add gd-ui-library
30
+ ```
31
+
32
+ ### Import CSS
33
+
34
+ Add this **once** to your root layout or `_app.tsx`:
35
+
36
+ ```ts
37
+ import 'gd-ui-library/dist/index.css';
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 🚀 Quick Start
43
+
44
+ ```tsx
45
+ "use client"; // Required in Next.js App Router
46
+
47
+ import { Button, Input, Alert, toast, Toaster } from "gd-ui-library";
48
+ import "gd-ui-library/dist/index.css";
49
+
50
+ export default function Page() {
51
+ return (
52
+ <div className="p-6 space-y-4">
53
+ {/* Mount Toaster once in your layout */}
54
+ <Toaster />
55
+
56
+ <Alert variant="info" title="Welcome!" description="gd-ui-library is ready to use." />
57
+
58
+ <Input label="Email" placeholder="you@example.com" />
59
+
60
+ <Button variant="filled" onClick={() => toast.success("Hello!")}>
61
+ Click me
62
+ </Button>
63
+ </div>
64
+ );
65
+ }
66
+ ```
67
+
68
+ > **Next.js App Router note:** Because many components use React hooks and browser APIs, add `"use client"` at the top of any file that imports from `gd-ui-library`.
69
+
70
+ ---
71
+
72
+ ## 🧩 Component Categories
73
+
74
+ ### 📝 Forms & Inputs
75
+
76
+ | Component | Description |
77
+ |-----------|-------------|
78
+ | `Input` | Text input with label, icons, error, and description |
79
+ | `Textarea` | Multi-line input |
80
+ | `Select` | Custom dropdown — single/multi, searchable |
81
+ | `Checkbox` | Styled checkbox with label |
82
+ | `Radio` | Radio button |
83
+ | `Toggle` | On/off switch |
84
+ | `Slider` | Range slider |
85
+ | `ColorPicker` | Inline color picker |
86
+ | `Rating` | Star rating |
87
+ | `OTPInput` | One-time password digit boxes |
88
+ | `FileUpload` | Drag-and-drop file upload |
89
+ | `DatePicker` | Calendar date picker |
90
+ | `TimePicker` | Time selection |
91
+ | `InputGroup` | Input with prefix/suffix |
92
+ | `DebouncedInput` | Input with debounce delay |
93
+ | `AutoComplete` | Searchable dropdown, single or multi-select |
94
+ | `FormBuilder` | Generate full forms from JSON |
95
+ | `ProductFilter` | Sidebar filter panel with groups |
96
+
97
+ ### 🖼️ Display
98
+
99
+ | Component | Description |
100
+ |-----------|-------------|
101
+ | `Button` | Button with variants, sizes, icons |
102
+ | `Badge` | Small status label |
103
+ | `Chip` | Removable tag with icon/avatar |
104
+ | `Avatar` | Image or initials avatar with status dot |
105
+ | `Card` + sub-components | Content container (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`) |
106
+ | `List` / `ListItem` | Semantic list |
107
+ | `EmptyState` | Placeholder for empty content areas |
108
+ | `Tooltip` | Hover label |
109
+ | `Statistic` | Animated number display |
110
+ | `ProgressBar` | Horizontal progress indicator |
111
+ | `Skeleton` | Loading placeholder |
112
+
113
+ ### 🔔 Feedback & Status
114
+
115
+ | Component | Description |
116
+ |-----------|-------------|
117
+ | `Alert` | Inline notification banner |
118
+ | `toast` / `Toaster` | Imperative toast notifications |
119
+ | `Spinner` | Loading spinner |
120
+ | `Banner` | Full-width announcement bar |
121
+ | `StatusIndicator` | Colored dot with optional ping |
122
+
123
+ ### 🧭 Navigation & Menus
124
+
125
+ | Component | Description |
126
+ |-----------|-------------|
127
+ | `Navbar` | Responsive top navigation bar |
128
+ | `Sidebar` | Collapsible side navigation with nested items |
129
+ | `Breadcrumb` | Page hierarchy trail |
130
+ | `Pagination` | Page navigation with ellipsis |
131
+ | `Stepper` | Multi-step progress indicator |
132
+ | `Dropdown` | Standard / context / mega menu |
133
+
134
+ ### 🔲 Overlays
135
+
136
+ | Component | Description |
137
+ |-----------|-------------|
138
+ | `Dialog` | Modal with overlay |
139
+ | `Drawer` | Slide-in panel (any direction) |
140
+ | `Popover` | Anchored floating panel |
141
+
142
+ ### 🎛️ Interactive
143
+
144
+ | Component | Description |
145
+ |-----------|-------------|
146
+ | `Accordion` | Collapsible sections |
147
+ | `Tabs` | Tabbed panels (solid/underline variants) |
148
+ | `Carousel` | Slide show with controls and auto-play |
149
+ | `Timeline` | Dated event list |
150
+ | `TreeView` | Collapsible file/folder tree |
151
+
152
+ ### 📐 Layout
153
+
154
+ | Component | Description |
155
+ |-----------|-------------|
156
+ | `Grid` | Responsive CSS grid (1–12 columns) |
157
+ | `Stack` | FlexBox layout primitive |
158
+ | `SplitPane` | Resizable two-panel layout |
159
+ | `MasonryGrid` | Pinterest-style masonry columns |
160
+ | `Container` | Centered max-width wrapper |
161
+ | `Section` | Semantic `<section>` with padding |
162
+ | `Hero` | Large hero banner area |
163
+ | `Footer` | Semantic `<footer>` |
164
+
165
+ ### ⚙️ Utilities & Behaviors
166
+
167
+ | Component | Description |
168
+ |-----------|-------------|
169
+ | `Portal` | Render children into `document.body` |
170
+ | `Transition` | Mount/unmount CSS animations |
171
+ | `ClickAwayListener` | Callback on outside click |
172
+ | `VirtualScroll` | Virtualized list for 100K+ items |
173
+ | `InfiniteScroll` | Load more on scroll |
174
+ | `LazyLoad` | Defer rendering until in viewport |
175
+
176
+ ### 📊 Advanced Widgets
177
+
178
+ | Component | Description |
179
+ |-----------|-------------|
180
+ | `Table` | Sortable, searchable, exportable data table |
181
+ | `Chart` | SVG bar / line / pie / donut charts |
182
+ | `Calendar` | Date-picker calendar |
183
+ | `CalendarWithEvents` | Calendar with event markers |
184
+ | `GanttChart` | Project timeline chart |
185
+ | `Kanban` | Drag-and-drop Kanban board |
186
+ | `ShoppingCart` | Cart UI with quantity controls and checkout |
187
+ | `RichTextEditor` | WYSIWYG editor |
188
+ | `CodeEditor` | Syntax-highlighted code editor |
189
+ | `FileManager` | File browser with folder navigation |
190
+ | `EmailComposer` | Email compose UI |
191
+
192
+ ---
193
+
194
+ ## 📖 Usage Examples
195
+
196
+ ### Input
197
+
198
+ ```tsx
199
+ import { Input } from "gd-ui-library";
200
+ import { Search } from "lucide-react";
201
+
202
+ <Input
203
+ label="Search"
204
+ placeholder="Type to search..."
205
+ leftIcon={<Search className="w-4 h-4" />}
206
+ description="Press Enter to search"
207
+ />
208
+
209
+ <Input
210
+ label="Password"
211
+ type="password"
212
+ error="Must be at least 8 characters"
213
+ />
214
+ ```
215
+
216
+ ### Select
217
+
218
+ ```tsx
219
+ import { Select } from "gd-ui-library";
220
+
221
+ const [role, setRole] = useState("");
222
+
223
+ <Select
224
+ label="Role"
225
+ value={role}
226
+ onChange={setRole}
227
+ searchable
228
+ options={[
229
+ { label: "Admin", value: "admin" },
230
+ { label: "Editor", value: "editor" },
231
+ { label: "User", value: "user" },
232
+ ]}
233
+ />
234
+ ```
235
+
236
+ ### API Integration (Axios)
237
+
238
+ A full-featured API service for handling authentication, CSRF, and CRUD.
239
+
240
+ ```tsx
241
+ import { api, useQuery, useMutation, createResourceService } from "gd-ui-library";
242
+
243
+ // 1. Configure once
244
+ api.getCsrfToken(); // For Laravel Sanctum
245
+
246
+ // 2. Standard Query
247
+ const { data, loading } = useQuery("/users");
248
+
249
+ // 3. Mutation
250
+ const { mutate } = useMutation("post", "/login", {
251
+ onSuccess: (res) => api.setToken(res.token)
252
+ });
253
+
254
+ // 4. Resource factory
255
+ const userService = createResourceService<User>("/users");
256
+ const users = await userService.getAll();
257
+ ```
258
+
259
+
260
+ ```tsx
261
+ import { Table } from "gd-ui-library";
262
+
263
+ interface User { id: number; name: string; email: string; }
264
+
265
+ <Table<User>
266
+ data={users}
267
+ columns={[
268
+ { key: "name", header: "Name", sortable: true, searchable: true },
269
+ { key: "email", header: "Email", sortable: true },
270
+ ]}
271
+ onEdit={(u) => handleEdit(u)}
272
+ onDelete={(u) => handleDelete(u)}
273
+ exportFileName="users"
274
+ />
275
+ ```
276
+
277
+ ### Toast
278
+
279
+ ```tsx
280
+ import { toast, Toaster } from "gd-ui-library";
281
+
282
+ // 1. Mount once in your root layout
283
+ <Toaster />
284
+
285
+ // 2. Call anywhere
286
+ toast.success("Saved!");
287
+ toast.error("Something went wrong.");
288
+ toast.warning("Please review your input.");
289
+ toast.info("New update available.");
290
+ toast({ title: "Custom", description: "With description", variant: "info", duration: 5000 });
291
+ ```
292
+
293
+ ### Kanban
294
+
295
+ ```tsx
296
+ import { Kanban } from "gd-ui-library";
297
+
298
+ const columns = [
299
+ { id: "todo", title: "To Do" },
300
+ { id: "wip", title: "In Progress" },
301
+ { id: "done", title: "Done" },
302
+ ];
303
+
304
+ const [items, setItems] = useState([
305
+ { id: "1", title: "Design UI", columnId: "todo" },
306
+ { id: "2", title: "Build API", columnId: "wip" },
307
+ { id: "3", title: "Write tests", columnId: "done" },
308
+ ]);
309
+
310
+ <Kanban columns={columns} items={items} onChange={setItems} />
311
+ ```
312
+
313
+ ### Chart
314
+
315
+ ```tsx
316
+ import { Chart } from "gd-ui-library";
317
+
318
+ <Chart
319
+ type="bar"
320
+ labels={["Jan", "Feb", "Mar", "Apr", "May"]}
321
+ datasets={[
322
+ { label: "Revenue", data: [4000, 5500, 4800, 7200, 6100], color: "#3B82F6" },
323
+ { label: "Expenses", data: [2800, 3200, 3100, 4000, 3800], color: "#F59E0B" },
324
+ ]}
325
+ height={300}
326
+ />
327
+ ```
328
+
329
+ ### Dialog
330
+
331
+ ```tsx
332
+ import { Dialog, Button } from "gd-ui-library";
333
+
334
+ const [open, setOpen] = useState(false);
335
+
336
+ <Button onClick={() => setOpen(true)}>Open</Button>
337
+
338
+ <Dialog
339
+ open={open}
340
+ onOpenChange={setOpen}
341
+ title="Confirm Delete"
342
+ description="This action cannot be undone."
343
+ footer={
344
+ <>
345
+ <Button onClick={() => setOpen(false)}>Cancel</Button>
346
+ <Button variant="filled" onClick={handleDelete}>Delete</Button>
347
+ </>
348
+ }
349
+ >
350
+ <p>Are you sure?</p>
351
+ </Dialog>
352
+ ```
353
+
354
+ ---
355
+
356
+ ## 🗂️ Complete Import Reference
357
+
358
+ ```tsx
359
+ import {
360
+ cn,
361
+
362
+ // Forms
363
+ Input, Textarea, Select, Checkbox, Radio, Toggle, Slider, ColorPicker,
364
+ Rating, OTPInput, FileUpload, DatePicker, TimePicker, InputGroup,
365
+ DebouncedInput, AutoComplete, FormBuilder, ProductFilter,
366
+
367
+ // Button & Table
368
+ Button, Table,
369
+
370
+ // Display
371
+ Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter,
372
+ List, ListItem, Avatar, Badge, Chip, EmptyState, Tooltip,
373
+ Statistic, ProgressBar, Skeleton,
374
+
375
+ // Overlays
376
+ Popover, Dialog, Drawer,
377
+
378
+ // Feedback
379
+ Alert, toast, Toaster, Spinner, Banner, StatusIndicator,
380
+
381
+ // Navigation
382
+ Navbar, Sidebar, Breadcrumb, Pagination, Stepper, Dropdown,
383
+
384
+ // Interactive
385
+ Accordion, Tabs, Carousel, Timeline, TreeView, Calendar, Kanban,
386
+
387
+ // Layout
388
+ Grid, Stack, SplitPane, MasonryGrid, Container, Section, Hero, Footer,
389
+
390
+ // Utilities
391
+ Portal, Transition, ClickAwayListener, VirtualScroll, InfiniteScroll, LazyLoad,
392
+
393
+ // Widgets
394
+ Chart, ShoppingCart, RichTextEditor, CodeEditor,
395
+ FileManager, EmailComposer, CalendarWithEvents, GanttChart,
396
+ } from "gd-ui-library";
397
+
398
+ import "gd-ui-library/dist/index.css";
399
+ ```
400
+
401
+ ---
402
+
403
+ ## 🛠️ Development
404
+
405
+ ```bash
406
+ # Clone the repo
407
+ git clone <repo-url>
408
+ cd gd-ui-library
409
+
410
+ # Install dependencies
411
+ npm install
412
+
413
+ # Build the library
414
+ npm run build
415
+ ```
416
+
417
+ ### Output
418
+
419
+ | File | Format |
420
+ |------|--------|
421
+ | `dist/index.js` | CommonJS |
422
+ | `dist/index.mjs` | ES Module |
423
+ | `dist/index.d.ts` | TypeScript types |
424
+ | `dist/index.css` | Compiled styles |
425
+
426
+ ---
427
+
428
+ ## 📋 Peer Dependencies
429
+
430
+ | Package | Version |
431
+ |---------|---------|
432
+ | `react` | `^18.0.0` or `^19.0.0` |
433
+ | `react-dom` | `^18.0.0` or `^19.0.0` |
434
+
435
+ ---
436
+
437
+ ## 🗒️ Changelog
438
+
439
+ ### v1.0.21
440
+ - Added `GanttChart`, `EmailComposer`, `FileManager`
441
+ - Added layout components: `Grid`, `Stack`, `SplitPane`, `MasonryGrid`, `Container`, `Section`, `Hero`, `Footer`
442
+ - Added utilities: `Portal`, `Transition`, `ClickAwayListener`, `VirtualScroll`, `InfiniteScroll`, `LazyLoad`
443
+ - Full TypeScript types for all new components
444
+
445
+ ---
446
+
447
+ ## 📄 License
448
+
449
+ ISC © gd-ui-library
package/dist/index.css CHANGED
@@ -1374,6 +1374,9 @@ video {
1374
1374
  --tw-border-opacity: 1;
1375
1375
  border-top-color: rgb(75 85 99 / var(--tw-border-opacity, 1));
1376
1376
  }
1377
+ .border-t-transparent {
1378
+ border-top-color: transparent;
1379
+ }
1377
1380
  .border-t-white {
1378
1381
  --tw-border-opacity: 1;
1379
1382
  border-top-color: rgb(255 255 255 / var(--tw-border-opacity, 1));
@@ -1640,6 +1643,9 @@ video {
1640
1643
  .pb-8 {
1641
1644
  padding-bottom: 2rem;
1642
1645
  }
1646
+ .pl-0\.5 {
1647
+ padding-left: 0.125rem;
1648
+ }
1643
1649
  .pl-1 {
1644
1650
  padding-left: 0.25rem;
1645
1651
  }
@@ -1956,6 +1962,9 @@ video {
1956
1962
  .opacity-50 {
1957
1963
  opacity: 0.5;
1958
1964
  }
1965
+ .opacity-60 {
1966
+ opacity: 0.6;
1967
+ }
1959
1968
  .opacity-70 {
1960
1969
  opacity: 0.7;
1961
1970
  }
@@ -2190,6 +2199,10 @@ video {
2190
2199
  --tw-border-opacity: 1;
2191
2200
  border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
2192
2201
  }
2202
+ .hover\:border-gray-400:hover {
2203
+ --tw-border-opacity: 1;
2204
+ border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
2205
+ }
2193
2206
  .hover\:bg-black\/10:hover {
2194
2207
  background-color: rgb(0 0 0 / 0.1);
2195
2208
  }