@ttianqii/takaui 0.1.3 → 0.1.5

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 CHANGED
@@ -1,39 +1,8 @@
1
1
  # TakaUI
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@ttianqii/takaui.svg)](https://www.npmjs.com/package/@ttianqii/takaui)
4
- [![npm downloads](https://img.shields.io/npm/dm/@ttianqii/takaui.svg)](https://www.npmjs.com/package/@ttianqii/takaui)
5
- [![license](https://img.shields.io/npm/l/@ttianqii/takaui.svg)](https://github.com/ttianqii/takaui/blob/main/LICENSE)
3
+ Modern, accessible React component library built with TypeScript, Tailwind CSS, and Radix UI primitives.
6
4
 
7
- A modern, customizable React UI component library built with TypeScript, Tailwind CSS, and Radix UI primitives.
8
-
9
- **Current Version:** 0.1.0
10
-
11
- ## ✨ What's New in 0.1.0
12
-
13
- - 🎯 **Table Alignment Fixed** - Table cells now properly align horizontally with headers
14
- - 📐 **Consistent Padding** - Checkbox columns and all table content use matching padding (px-3 py-2)
15
- - ✨ **Previous Features** - All v0.0.9 features (no CSS imports, pure Tailwind, original design preserved)
16
-
17
- ## 📦 Installation
18
-
19
- ### Quick Setup (Recommended)
20
-
21
- Run the automatic setup wizard:
22
-
23
- ```bash
24
- npm install @ttianqii/takaui
25
- npx takaui-setup
26
- ```
27
-
28
- This will:
29
- - ✅ Configure your Tailwind config automatically
30
- - ✅ Verify your setup is correct
31
-
32
- **No CSS imports needed!** Components work with pure Tailwind CSS.
33
-
34
- ### Manual Installation
35
-
36
- If you prefer manual setup:
5
+ ## Installation
37
6
 
38
7
  ```bash
39
8
  # npm
@@ -49,15 +18,24 @@ pnpm add @ttianqii/takaui
49
18
  bun add @ttianqii/takaui
50
19
  ```
51
20
 
52
- **That's it!** Just make sure you have Tailwind CSS configured in your project.
53
-
54
21
  ### Peer Dependencies
55
22
 
56
- TakaUI requires React 18+ or React 19+:
57
-
58
23
  ```bash
59
24
  # npm
60
- npm install react react-dom
25
+ npm install -D tailwindcss postcss autoprefixer
26
+ npx tailwindcss init -p
27
+
28
+ # yarn
29
+ yarn add -D tailwindcss postcss autoprefixer
30
+ npx tailwindcss init -p
31
+
32
+ # pnpm
33
+ pnpm add -D tailwindcss postcss autoprefixer
34
+ npx tailwindcss init -p
35
+
36
+ # bun
37
+ bun add -d tailwindcss postcss autoprefixer
38
+ bunm install react react-dom
61
39
 
62
40
  # yarn
63
41
  yarn add react react-dom
@@ -69,20 +47,20 @@ pnpm add react react-dom
69
47
  bun add react react-dom
70
48
  ```
71
49
 
72
- ### Tailwind CSS Setup
50
+ ## Setup
73
51
 
74
- **Important:** TakaUI uses Tailwind CSS for styling (no CSS imports needed!). You must have Tailwind CSS configured in your project.
52
+ TakaUI uses Tailwind CSS. Configure your project:
75
53
 
76
- #### 1. Install Tailwind CSS (if not already installed)
54
+ ### 1. Install Tailwind CSS
77
55
 
78
56
  ```bash
79
57
  npm install -D tailwindcss postcss autoprefixer
80
58
  npx tailwindcss init -p
81
59
  ```
82
60
 
83
- #### 2. Configure Tailwind
61
+ ### 2. Configure Tailwind
84
62
 
85
- Add TakaUI to your `tailwind.config.js` content paths:
63
+ Update your `tailwind.config.js`:
86
64
 
87
65
  ```js
88
66
  /** @type {import('tailwindcss').Config} */
@@ -90,7 +68,7 @@ export default {
90
68
  content: [
91
69
  "./index.html",
92
70
  "./src/**/*.{js,ts,jsx,tsx}",
93
- "./node_modules/@ttianqii/takaui/dist/**/*.{js,mjs,cjs}"
71
+ "./node_modules/@ttianqii/takaui/dist/**/*.{js,cjs}"
94
72
  ],
95
73
  theme: {
96
74
  extend: {},
@@ -99,7 +77,7 @@ export default {
99
77
  }
100
78
  ```
101
79
 
102
- #### 3. Add Tailwind directives
80
+ ### 3. Add Tailwind Directives
103
81
 
104
82
  In your main CSS file (e.g., `src/index.css`):
105
83
 
@@ -109,206 +87,308 @@ In your main CSS file (e.g., `src/index.css`):
109
87
  @tailwind utilities;
110
88
  ```
111
89
 
112
- **That's it!** No CSS imports needed from TakaUI. 🎉
90
+ ## Components
113
91
 
114
- ## 🚀 Quick Start
92
+ ### Calendar
93
+
94
+ Interactive calendar with holiday support and customizable styling.
115
95
 
116
96
  ```tsx
117
- import { DatePicker, TimePicker, DataTable } from '@ttianqii/takaui'
118
- import '@ttianqii/takaui/styles.css'
97
+ import { Calendar } from '@ttianqii/takaui'
119
98
  import { useState } from 'react'
120
99
 
121
100
  function App() {
122
- const [date, setDate] = useState<Date | undefined>(new Date())
123
- const [dateRange, setDateRange] = useState<{ from: Date; to?: Date }>()
124
-
125
- // DataTable example - No TanStack required!
126
- const columns = [
127
- { key: 'name', header: 'Name', sortable: true },
128
- { key: 'email', header: 'Email' },
129
- {
130
- key: 'status',
131
- header: 'Status',
132
- cell: (value) => (
133
- <span className="px-2 py-1 bg-green-100 text-green-800 rounded">
134
- {value}
135
- </span>
136
- )
137
- },
138
- ]
139
-
140
- const data = [
141
- { id: 1, name: 'John', email: 'john@example.com', status: 'Active' },
142
- { id: 2, name: 'Jane', email: 'jane@example.com', status: 'Active' },
143
- ]
144
-
101
+ const [date, setDate] = useState(new Date())
102
+
145
103
  return (
146
- <div>
147
- {/* Single Date Picker */}
148
- <DatePicker
149
- date={date}
150
- onDateChange={setDate}
151
- />
152
-
153
- {/* Date Range Picker - NEW! */}
154
- <DatePicker
155
- mode="range"
156
- dateRange={dateRange}
157
- onDateRangeChange={setDateRange}
158
- numberOfMonths={2}
159
- />
160
-
161
- <DataTable
162
- data={data}
163
- columns={columns}
164
- showSearch
165
- searchPlaceholder="Search users..."
166
- />
167
- </div>
104
+ <Calendar
105
+ selectedDate={date}
106
+ onDateChange={setDate}
107
+ holidays={['US']}
108
+ showWeekNumbers
109
+ />
168
110
  )
169
111
  }
170
112
  ```
171
113
 
172
- ## 📚 Components
114
+ **Props:**
115
+ - `selectedDate`: Current selected date
116
+ - `onDateChange`: Callback when date changes
117
+ - `holidays`: Array of country codes for holiday display
118
+ - `showWeekNumbers`: Show week numbers (default: false)
173
119
 
174
- TakaUI includes the following components:
120
+ ---
175
121
 
176
- ### Form & Input Components
122
+ ### DatePicker
177
123
 
178
- - **[Calendar](./docs/CALENDAR.md)** - Flexible date picker with multiple selection modes
179
- - **[DatePicker](./docs/DATEPICKER.md)** - Date picker with popover and custom formatting
180
- - ✨ **NEW:** Range selection with dual month view
181
- - ✨ **NEW:** Enhanced hover states for better UX
182
- - **[TimePicker](./docs/TIMEPICKER.md)** - Time picker with 12h/24h formats and timezone support
183
- - **[DropdownMenu](./docs/DROPDOWN.md)** - Accessible dropdown menu component
124
+ Dropdown date selector with calendar popup.
184
125
 
185
- ### Data Display Components
126
+ ```tsx
127
+ import { DatePicker } from '@ttianqii/takaui'
186
128
 
187
- - **[DataTable](./docs/DATATABLE_NEW.md)** - Independent table with sorting, filtering, and pagination (No TanStack!)
188
- - Zero external dependencies (except icons)
189
- - ✅ Built-in sorting, pagination, search
190
- - ✅ Custom cell rendering
191
- - ✅ Loading states
192
- - [Quick Reference](./DATATABLE_QUICKREF.md) - Cheat sheet
193
- - **DataGrid System** - ✨ **NEW!** Modular table components for custom layouts
194
- - DataGrid, DataGridTable, DataGridPagination
195
- - DataGridColumnHeader, DataGridRowSelect
196
- - Perfect for complex table compositions
197
- - **[Schedule](./docs/SCHEDULE.md)** - Weekly schedule component with custom fields
198
- - ✨ **NEW:** Supports Date type in metadata
199
- - **[WeekNavigator](./docs/WEEKNAVIGATOR.md)** - Week navigation with date range display
129
+ function App() {
130
+ const [date, setDate] = useState<Date>()
200
131
 
201
- ### Advanced Table System (Optional)
132
+ return (
133
+ <DatePicker
134
+ selected={date}
135
+ onSelect={setDate}
136
+ placeholder="Select a date"
137
+ />
138
+ )
139
+ }
140
+ ```
202
141
 
203
- For advanced users who need TanStack Table features:
142
+ **Props:**
143
+ - `selected`: Selected date
144
+ - `onSelect`: Callback when date is selected
145
+ - `placeholder`: Input placeholder text
204
146
 
205
- - **[TableRoot, TableContent, TableNavigator](./docs/DATATABLE.md)** - Modular table components
206
- - Requires: `npm install @tanstack/react-table`
207
- - [Modular Structure](./docs/DATATABLE_MODULAR.md)
208
- - [Architecture](./DATATABLE_ARCHITECTURE.md)
147
+ ---
209
148
 
210
- ### Base UI Components
149
+ ### TimePicker
211
150
 
212
- All components are built on top of shadcn/ui primitives:
151
+ Time selection input with hour/minute controls.
213
152
 
214
- - Button
215
- - Input
216
- - Label
217
- - Select
218
- - Popover
219
- - Dialog/Modal
220
- - Checkbox
221
- - Card
153
+ ```tsx
154
+ import { TimePicker } from '@ttianqii/takaui'
222
155
 
223
- ## 📖 Documentation
156
+ function App() {
157
+ const [time, setTime] = useState('09:00')
224
158
 
225
- Detailed documentation for each component:
159
+ return (
160
+ <TimePicker
161
+ value={time}
162
+ onChange={setTime}
163
+ />
164
+ )
165
+ }
166
+ ```
226
167
 
227
- - [Calendar Documentation](./docs/CALENDAR.md)
228
- - [DatePicker Documentation](./docs/DATEPICKER.md)
229
- - [TimePicker Documentation](./docs/TIMEPICKER.md)
230
- - [DataTable Documentation](./docs/DATATABLE.md)
231
- - [Schedule Documentation](./docs/SCHEDULE.md)
232
- - [WeekNavigator Documentation](./docs/WEEKNAVIGATOR.md)
233
- - [DropdownMenu Documentation](./docs/DROPDOWN.md)
168
+ **Props:**
169
+ - `value`: Time string in HH:MM format
170
+ - `onChange`: Callback when time changes
234
171
 
235
- ## 🎨 Customization
172
+ ---
236
173
 
237
- ### Styling with Tailwind
174
+ ### WeekNavigator
238
175
 
239
- All components accept a `className` prop for custom styling:
176
+ Week-based navigation component.
240
177
 
241
178
  ```tsx
242
- <Calendar
243
- className="rounded-lg shadow-lg border-2 border-blue-500"
244
- mode="single"
245
- selected={date}
246
- onSelect={setDate}
247
- />
179
+ import { WeekNavigator } from '@ttianqii/takaui'
180
+
181
+ function App() {
182
+ const [date, setDate] = useState(new Date())
183
+
184
+ return (
185
+ <WeekNavigator
186
+ currentDate={date}
187
+ onDateChange={setDate}
188
+ onWeekChange={(start, end) => {
189
+ console.log('Week:', start, 'to', end)
190
+ }}
191
+ />
192
+ )
193
+ }
248
194
  ```
249
195
 
250
- ### Theming
196
+ **Props:**
197
+ - `currentDate`: Current date in view
198
+ - `onDateChange`: Callback when date changes
199
+ - `onWeekChange`: Callback with week start/end dates
251
200
 
252
- TakaUI components use CSS variables for theming. You can customize colors in your global CSS:
201
+ ---
253
202
 
254
- ```css
255
- :root {
256
- --primary: 220 90% 56%;
257
- --primary-foreground: 0 0% 100%;
258
- --destructive: 0 84% 60%;
259
- /* Add more custom variables */
203
+ ### Schedule
204
+
205
+ Weekly schedule view with time slots.
206
+
207
+ ```tsx
208
+ import { Schedule } from '@ttianqii/takaui'
209
+
210
+ function App() {
211
+ return (
212
+ <Schedule
213
+ events={[
214
+ {
215
+ id: '1',
216
+ title: 'Meeting',
217
+ start: new Date('2024-01-15T10:00:00'),
218
+ end: new Date('2024-01-15T11:00:00'),
219
+ }
220
+ ]}
221
+ onEventClick={(event) => console.log(event)}
222
+ />
223
+ )
260
224
  }
261
225
  ```
262
226
 
263
- ## 🔧 TypeScript Support
227
+ **Props:**
228
+ - `events`: Array of event objects
229
+ - `onEventClick`: Callback when event is clicked
230
+
231
+ ---
232
+
233
+ ### DataTable
264
234
 
265
- TakaUI is built with TypeScript and includes full type definitions. All props are fully typed for excellent IDE support.
235
+ Powerful data table with sorting, filtering, and pagination.
266
236
 
267
237
  ```tsx
268
- import type { CalendarProps, DatePickerProps } from '@ttianqii/takaui'
238
+ import { DataTable } from '@ttianqii/takaui'
239
+ import { ColumnDef } from '@tanstack/react-table'
240
+
241
+ interface User {
242
+ id: string
243
+ name: string
244
+ email: string
245
+ }
246
+
247
+ const columns: ColumnDef<User>[] = [
248
+ {
249
+ accessorKey: 'name',
250
+ header: 'Name',
251
+ },
252
+ {
253
+ accessorKey: 'email',
254
+ header: 'Email',
255
+ },
256
+ ]
257
+
258
+ function App() {
259
+ const data: User[] = [
260
+ { id: '1', name: 'John Doe', email: 'john@example.com' },
261
+ { id: '2', name: 'Jane Smith', email: 'jane@example.com' },
262
+ ]
263
+
264
+ return <DataTable columns={columns} data={data} />
265
+ }
266
+ ```
267
+
268
+ **Required peer dependency:**
269
+ ```bash
270
+ npm install @tanstack/react-table
269
271
  ```
270
272
 
271
- ## 📦 Tree Shaking
273
+ **Props:**
274
+ - `columns`: Column definitions (TanStack Table format)
275
+ - `data`: Array of data objects
276
+ - `enableSorting`: Enable column sorting (default: true)
277
+ - `enableFiltering`: Enable filtering (default: true)
272
278
 
273
- TakaUI supports tree shaking. Import only the components you need:
279
+ ---
280
+
281
+ ### DropdownMenu
282
+
283
+ Accessible dropdown menu component.
274
284
 
275
285
  ```tsx
276
- // Good - Only imports Calendar
277
- import { Calendar } from '@ttianqii/takaui'
286
+ import { DropdownMenu } from '@ttianqii/takaui'
287
+
288
+ function App() {
289
+ return (
290
+ <DropdownMenu
291
+ trigger={<button>Options</button>}
292
+ items={[
293
+ { label: 'Edit', onClick: () => console.log('Edit') },
294
+ { label: 'Delete', onClick: () => console.log('Delete') },
295
+ { type: 'separator' },
296
+ { label: 'Archive', onClick: () => console.log('Archive') },
297
+ ]}
298
+ />
299
+ )
300
+ }
301
+ ```
302
+
303
+ **Props:**
304
+ - `trigger`: Trigger element
305
+ - `items`: Array of menu items
306
+
307
+ ---
308
+
309
+ ## UI Components
278
310
 
279
- // Also works - Named imports
280
- import { Calendar, TimePicker, DataTable } from '@ttianqii/takaui'
311
+ TakaUI also exports low-level UI primitives:
312
+
313
+ ```tsx
314
+ import {
315
+ Button,
316
+ Card,
317
+ Checkbox,
318
+ Input,
319
+ Label,
320
+ Modal,
321
+ Popover,
322
+ Select,
323
+ Separator,
324
+ Table,
325
+ } from '@ttianqii/takaui'
281
326
  ```
282
327
 
283
- ## 🤝 Contributing
328
+ ### Button
284
329
 
285
- Contributions are welcome! Please feel free to submit a Pull Request.
330
+ ```tsx
331
+ <Button variant="default" size="default">
332
+ Click me
333
+ </Button>
334
+ ```
286
335
 
287
- ## 📄 License
336
+ **Variants:** `default`, `destructive`, `outline`, `secondary`, `ghost`, `link`
337
+ **Sizes:** `default`, `sm`, `lg`, `icon`
288
338
 
289
- MIT
339
+ ### Card
340
+
341
+ ```tsx
342
+ <Card>
343
+ <Card.Header>
344
+ <Card.Title>Card Title</Card.Title>
345
+ </Card.Header>
346
+ <Card.Content>
347
+ Content goes here
348
+ </Card.Content>
349
+ </Card>
350
+ ```
351
+
352
+ ### Input
353
+
354
+ ```tsx
355
+ <Input
356
+ type="email"
357
+ placeholder="Email"
358
+ value={email}
359
+ onChange={(e) => setEmail(e.target.value)}
360
+ />
361
+ ```
362
+
363
+ ### Modal
290
364
 
291
- ## 🔗 Links
365
+ ```tsx
366
+ <Modal
367
+ open={isOpen}
368
+ onOpenChange={setIsOpen}
369
+ title="Modal Title"
370
+ >
371
+ <p>Modal content</p>
372
+ </Modal>
373
+ ```
292
374
 
293
- - [GitHub Repository](https://github.com/ttianqii/takaui)
294
- - [npm Package](https://www.npmjs.com/package/@ttianqii/takaui)
375
+ ## Utilities
295
376
 
296
- ## 📞 Support
377
+ ```tsx
378
+ import { cn } from '@ttianqii/takaui'
297
379
 
298
- For issues and questions:
380
+ // Merge Tailwind classes
381
+ const className = cn('text-red-500', isActive && 'font-bold')
382
+ ```
299
383
 
300
- - Open an issue on [GitHub](https://github.com/ttianqii/takaui/issues)
301
- - Check the [documentation](./docs/)
384
+ ## TypeScript
302
385
 
303
- ## 🎯 Roadmap
386
+ TakaUI is built with TypeScript and includes full type definitions.
304
387
 
305
- - [ ] Additional form components (Switch, Radio, Slider)
306
- - [ ] Chart components
307
- - [ ] Toast notifications
308
- - [ ] Command palette
309
- - [ ] Theme switcher
310
- - [ ] More data display components
388
+ ## License
311
389
 
312
- ---
390
+ MIT
391
+
392
+ ## Support
313
393
 
314
- Made with ❤️ by [@ttianqii](https://github.com/ttianqii)
394
+ For issues and questions, visit [GitHub](https://github.com/ttianqii/takaui)