@ttianqii/takaui 0.0.6 ā 0.0.61
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 +56 -6
- package/package.json +6 -2
- package/src/cli/setup.js +135 -0
package/README.md
CHANGED
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
# TakaUI
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@ttianqii/takaui)
|
|
4
|
+
[](https://www.npmjs.com/package/@ttianqii/takaui)
|
|
5
|
+
[](https://github.com/ttianqii/takaui/blob/main/LICENSE)
|
|
6
|
+
|
|
3
7
|
A modern, customizable React UI component library built with TypeScript, Tailwind CSS, and Radix UI primitives.
|
|
4
8
|
|
|
9
|
+
**Current Version:** 0.0.6
|
|
10
|
+
|
|
11
|
+
## ⨠What's New in 0.0.6
|
|
12
|
+
|
|
13
|
+
- šÆ **DatePicker Range Selection** - Select date ranges with 1 or 2 month views
|
|
14
|
+
- šØ **Enhanced Hover States** - Improved visual feedback for range selection
|
|
15
|
+
- š§ **DataGrid System** - New modular table components for better composition
|
|
16
|
+
- š
**Schedule Component** - Now supports Date type in custom metadata fields
|
|
17
|
+
- š **Bug Fixes** - Text alignment and various improvements
|
|
18
|
+
|
|
5
19
|
## š¦ Installation
|
|
6
20
|
|
|
21
|
+
### Quick Setup (Recommended)
|
|
22
|
+
|
|
23
|
+
Run the automatic setup wizard:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @ttianqii/takaui
|
|
27
|
+
npx takaui-setup
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This will:
|
|
31
|
+
- ā
Configure your Tailwind config automatically
|
|
32
|
+
- ā
Add CSS import to your main file
|
|
33
|
+
- ā
Verify your setup is correct
|
|
34
|
+
|
|
35
|
+
### Manual Installation
|
|
36
|
+
|
|
37
|
+
If you prefer manual setup:
|
|
38
|
+
|
|
7
39
|
```bash
|
|
8
40
|
# npm
|
|
9
41
|
npm install @ttianqii/takaui
|
|
@@ -63,15 +95,18 @@ Import the TakaUI styles in your main entry file (e.g., `main.tsx` or `App.tsx`)
|
|
|
63
95
|
import '@ttianqii/takaui/styles.css'
|
|
64
96
|
```
|
|
65
97
|
|
|
98
|
+
**š” Tip:** Run `npx takaui-setup` to automatically add this import!
|
|
99
|
+
|
|
66
100
|
## š Quick Start
|
|
67
101
|
|
|
68
102
|
```tsx
|
|
69
|
-
import {
|
|
103
|
+
import { DatePicker, TimePicker, DataTable } from '@ttianqii/takaui'
|
|
70
104
|
import '@ttianqii/takaui/styles.css'
|
|
71
105
|
import { useState } from 'react'
|
|
72
106
|
|
|
73
107
|
function App() {
|
|
74
108
|
const [date, setDate] = useState<Date | undefined>(new Date())
|
|
109
|
+
const [dateRange, setDateRange] = useState<{ from: Date; to?: Date }>()
|
|
75
110
|
|
|
76
111
|
// DataTable example - No TanStack required!
|
|
77
112
|
const columns = [
|
|
@@ -95,10 +130,18 @@ function App() {
|
|
|
95
130
|
|
|
96
131
|
return (
|
|
97
132
|
<div>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
133
|
+
{/* Single Date Picker */}
|
|
134
|
+
<DatePicker
|
|
135
|
+
date={date}
|
|
136
|
+
onDateChange={setDate}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
{/* Date Range Picker - NEW! */}
|
|
140
|
+
<DatePicker
|
|
141
|
+
mode="range"
|
|
142
|
+
dateRange={dateRange}
|
|
143
|
+
onDateRangeChange={setDateRange}
|
|
144
|
+
numberOfMonths={2}
|
|
102
145
|
/>
|
|
103
146
|
|
|
104
147
|
<DataTable
|
|
@@ -120,18 +163,25 @@ TakaUI includes the following components:
|
|
|
120
163
|
|
|
121
164
|
- **[Calendar](./docs/CALENDAR.md)** - Flexible date picker with multiple selection modes
|
|
122
165
|
- **[DatePicker](./docs/DATEPICKER.md)** - Date picker with popover and custom formatting
|
|
166
|
+
- ⨠**NEW:** Range selection with dual month view
|
|
167
|
+
- ⨠**NEW:** Enhanced hover states for better UX
|
|
123
168
|
- **[TimePicker](./docs/TIMEPICKER.md)** - Time picker with 12h/24h formats and timezone support
|
|
124
169
|
- **[DropdownMenu](./docs/DROPDOWN.md)** - Accessible dropdown menu component
|
|
125
170
|
|
|
126
171
|
### Data Display Components
|
|
127
172
|
|
|
128
|
-
- **[DataTable](./docs/DATATABLE_NEW.md)** -
|
|
173
|
+
- **[DataTable](./docs/DATATABLE_NEW.md)** - Independent table with sorting, filtering, and pagination (No TanStack!)
|
|
129
174
|
- ā
Zero external dependencies (except icons)
|
|
130
175
|
- ā
Built-in sorting, pagination, search
|
|
131
176
|
- ā
Custom cell rendering
|
|
132
177
|
- ā
Loading states
|
|
133
178
|
- [Quick Reference](./DATATABLE_QUICKREF.md) - Cheat sheet
|
|
179
|
+
- **DataGrid System** - ⨠**NEW!** Modular table components for custom layouts
|
|
180
|
+
- DataGrid, DataGridTable, DataGridPagination
|
|
181
|
+
- DataGridColumnHeader, DataGridRowSelect
|
|
182
|
+
- Perfect for complex table compositions
|
|
134
183
|
- **[Schedule](./docs/SCHEDULE.md)** - Weekly schedule component with custom fields
|
|
184
|
+
- ⨠**NEW:** Supports Date type in metadata
|
|
135
185
|
- **[WeekNavigator](./docs/WEEKNAVIGATOR.md)** - Week navigation with date range display
|
|
136
186
|
|
|
137
187
|
### Advanced Table System (Optional)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttianqii/takaui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.61",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/takaui.cjs",
|
|
7
7
|
"module": "./dist/takaui.js",
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
"./styles.css": "./dist/takaui.css"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"src/cli"
|
|
19
20
|
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"takaui-setup": "./src/cli/setup.js"
|
|
23
|
+
},
|
|
20
24
|
"sideEffects": [
|
|
21
25
|
"**/*.css"
|
|
22
26
|
],
|
package/src/cli/setup.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
console.log('\nšØ TakaUI Setup Wizard\n');
|
|
12
|
+
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
|
|
15
|
+
// 1. Check for Tailwind config
|
|
16
|
+
const tailwindConfigFiles = [
|
|
17
|
+
'tailwind.config.js',
|
|
18
|
+
'tailwind.config.ts',
|
|
19
|
+
'tailwind.config.mjs',
|
|
20
|
+
'tailwind.config.cjs'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let tailwindConfigPath = null;
|
|
24
|
+
for (const file of tailwindConfigFiles) {
|
|
25
|
+
if (existsSync(join(cwd, file))) {
|
|
26
|
+
tailwindConfigPath = file;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!tailwindConfigPath) {
|
|
32
|
+
console.log('ā ļø No Tailwind config found!');
|
|
33
|
+
console.log('\nPlease install Tailwind CSS first:');
|
|
34
|
+
console.log(' npm install -D tailwindcss postcss autoprefixer');
|
|
35
|
+
console.log(' npx tailwindcss init');
|
|
36
|
+
console.log('\nThen run this setup again: npx takaui-setup\n');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log(`ā
Found Tailwind config: ${tailwindConfigPath}`);
|
|
41
|
+
|
|
42
|
+
// 2. Update Tailwind config
|
|
43
|
+
try {
|
|
44
|
+
let configContent = readFileSync(join(cwd, tailwindConfigPath), 'utf-8');
|
|
45
|
+
|
|
46
|
+
const takaUIPath = './node_modules/@ttianqii/takaui/dist/**/*.{js,mjs,cjs}';
|
|
47
|
+
|
|
48
|
+
if (configContent.includes(takaUIPath)) {
|
|
49
|
+
console.log('ā
TakaUI already configured in Tailwind');
|
|
50
|
+
} else {
|
|
51
|
+
// Add TakaUI to content array
|
|
52
|
+
const contentRegex = /content:\s*\[([\s\S]*?)\]/;
|
|
53
|
+
const match = configContent.match(contentRegex);
|
|
54
|
+
|
|
55
|
+
if (match) {
|
|
56
|
+
const currentContent = match[1];
|
|
57
|
+
const updatedContent = currentContent.trim()
|
|
58
|
+
? `${currentContent.trim()},\n "${takaUIPath}"`
|
|
59
|
+
: `"${takaUIPath}"`;
|
|
60
|
+
|
|
61
|
+
configContent = configContent.replace(
|
|
62
|
+
contentRegex,
|
|
63
|
+
`content: [\n ${updatedContent}\n ]`
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
writeFileSync(join(cwd, tailwindConfigPath), configContent, 'utf-8');
|
|
67
|
+
console.log('ā
Updated Tailwind config with TakaUI paths');
|
|
68
|
+
} else {
|
|
69
|
+
console.log('ā ļø Could not auto-update Tailwind config');
|
|
70
|
+
console.log(`\nPlease manually add to ${tailwindConfigPath}:`);
|
|
71
|
+
console.log(` content: [`);
|
|
72
|
+
console.log(` "${takaUIPath}"`);
|
|
73
|
+
console.log(` ]`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.log('ā ļø Could not update Tailwind config:', error.message);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 3. Check for CSS import
|
|
81
|
+
const possibleEntryPoints = [
|
|
82
|
+
'src/main.tsx',
|
|
83
|
+
'src/main.ts',
|
|
84
|
+
'src/main.jsx',
|
|
85
|
+
'src/main.js',
|
|
86
|
+
'src/index.tsx',
|
|
87
|
+
'src/index.ts',
|
|
88
|
+
'src/index.jsx',
|
|
89
|
+
'src/index.js',
|
|
90
|
+
'src/App.tsx',
|
|
91
|
+
'src/App.ts',
|
|
92
|
+
'src/App.jsx',
|
|
93
|
+
'src/App.js',
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
let entryPoint = null;
|
|
97
|
+
for (const file of possibleEntryPoints) {
|
|
98
|
+
if (existsSync(join(cwd, file))) {
|
|
99
|
+
entryPoint = file;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.log('\nš Next Steps:\n');
|
|
105
|
+
|
|
106
|
+
if (entryPoint) {
|
|
107
|
+
const entryContent = readFileSync(join(cwd, entryPoint), 'utf-8');
|
|
108
|
+
|
|
109
|
+
if (entryContent.includes("@ttianqii/takaui/styles.css")) {
|
|
110
|
+
console.log(`ā
CSS already imported in ${entryPoint}`);
|
|
111
|
+
} else {
|
|
112
|
+
console.log(`Add this import to your ${entryPoint}:`);
|
|
113
|
+
console.log(` import '@ttianqii/takaui/styles.css'`);
|
|
114
|
+
|
|
115
|
+
// Auto-add if it's a simple case
|
|
116
|
+
if (entryContent.includes('import')) {
|
|
117
|
+
const lines = entryContent.split('\n');
|
|
118
|
+
const lastImportIndex = lines.findLastIndex(line => line.trim().startsWith('import'));
|
|
119
|
+
|
|
120
|
+
if (lastImportIndex !== -1) {
|
|
121
|
+
lines.splice(lastImportIndex + 1, 0, "import '@ttianqii/takaui/styles.css'");
|
|
122
|
+
writeFileSync(join(cwd, entryPoint), lines.join('\n'), 'utf-8');
|
|
123
|
+
console.log(` ā
Auto-added CSS import to ${entryPoint}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
console.log('Add this import to your main entry file (e.g., main.tsx or App.tsx):');
|
|
129
|
+
console.log(" import '@ttianqii/takaui/styles.css'");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('\n⨠Setup Complete!\n');
|
|
133
|
+
console.log('You can now use TakaUI components:');
|
|
134
|
+
console.log(" import { DatePicker, DataTable, Calendar } from '@ttianqii/takaui'\n");
|
|
135
|
+
console.log('š Documentation: https://github.com/ttianqii/takaui\n');
|