react-datepicker-bkrdmrcioglu 0.1.0 → 0.1.1
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 +83 -81
- package/components/DatePicker.tsx +526 -152
- package/components/DateRangePicker.tsx +485 -34
- package/lib/i18n.ts +179 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
# React DatePicker
|
|
2
2
|
|
|
3
|
-
Modern,
|
|
3
|
+
Modern, customizable, and user-friendly React DatePicker component. Built with Next.js and Tailwind CSS.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/bkrdmrcioglu/react-datepicker)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- ✅ **Dark Mode** - Tam karanlık mod desteği
|
|
9
|
-
- ✅ **11 Dil Desteği** - English, Türkçe, Deutsch, Français, Español, Italiano, Português, Русский, 日本語, 中文, العربية
|
|
10
|
-
- ✅ Tarih seçimi
|
|
11
|
-
- ✅ Tarih ve saat seçimi
|
|
12
|
-
- ✅ Tarih aralığı seçimi (DateRangePicker)
|
|
13
|
-
- ✅ Min/Max tarih kısıtlaması
|
|
14
|
-
- ✅ Devre dışı bırakılabilir
|
|
15
|
-
- ✅ TypeScript desteği
|
|
16
|
-
- ✅ Tamamen özelleştirilebilir
|
|
17
|
-
- ✅ Responsive tasarım
|
|
7
|
+
## 🚀 Features
|
|
18
8
|
|
|
19
|
-
|
|
9
|
+
- ✅ Modern and elegant design
|
|
10
|
+
- ✅ **Dark Mode** - Full dark mode support
|
|
11
|
+
- ✅ **11 Language Support** - English, Turkish, German, French, Spanish, Italian, Portuguese, Russian, Japanese, Chinese, Arabic
|
|
12
|
+
- ✅ Date selection
|
|
13
|
+
- ✅ Date and time selection
|
|
14
|
+
- ✅ Date range selection (DateRangePicker)
|
|
15
|
+
- ✅ Min/Max date constraints
|
|
16
|
+
- ✅ Disableable
|
|
17
|
+
- ✅ TypeScript support
|
|
18
|
+
- ✅ Fully customizable
|
|
19
|
+
- ✅ Responsive design
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
### Install via NPM
|
|
22
24
|
|
|
23
25
|
```bash
|
|
24
26
|
npm install react-datepicker-bkrdmrcioglu
|
|
25
|
-
#
|
|
27
|
+
# or
|
|
26
28
|
yarn add react-datepicker-bkrdmrcioglu
|
|
27
|
-
#
|
|
29
|
+
# or
|
|
28
30
|
pnpm add react-datepicker-bkrdmrcioglu
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
###
|
|
33
|
+
### Requirements
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
This package uses Tailwind CSS. You must have Tailwind CSS installed in your project:
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
38
|
npm install -D tailwindcss postcss autoprefixer
|
|
37
39
|
npx tailwindcss init -p
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
`tailwind.config.js`
|
|
42
|
+
Add this to your `tailwind.config.js` file:
|
|
41
43
|
|
|
42
44
|
```js
|
|
43
45
|
module.exports = {
|
|
@@ -45,23 +47,23 @@ module.exports = {
|
|
|
45
47
|
"./src/**/*.{js,jsx,ts,tsx}",
|
|
46
48
|
"./node_modules/react-datepicker-bkrdmrcioglu/**/*.{js,jsx,ts,tsx}"
|
|
47
49
|
],
|
|
48
|
-
darkMode: 'class', //
|
|
49
|
-
// ...
|
|
50
|
+
darkMode: 'class', // For dark mode
|
|
51
|
+
// ... your other settings
|
|
50
52
|
}
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
## 🏃
|
|
55
|
+
## 🏃 Development (For This Repo)
|
|
54
56
|
|
|
55
57
|
```bash
|
|
56
58
|
npm install
|
|
57
59
|
npm run dev
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
Open [http://localhost:3000](http://localhost:3000) in your browser.
|
|
61
63
|
|
|
62
|
-
## 📖
|
|
64
|
+
## 📖 Usage
|
|
63
65
|
|
|
64
|
-
###
|
|
66
|
+
### Basic Usage
|
|
65
67
|
|
|
66
68
|
```tsx
|
|
67
69
|
import { DatePicker } from 'react-datepicker-bkrdmrcioglu';
|
|
@@ -80,58 +82,58 @@ function MyComponent() {
|
|
|
80
82
|
}
|
|
81
83
|
```
|
|
82
84
|
|
|
83
|
-
###
|
|
85
|
+
### Language Support
|
|
84
86
|
|
|
85
87
|
```tsx
|
|
86
88
|
import { DatePicker } from 'react-datepicker-bkrdmrcioglu';
|
|
87
89
|
import type { Language } from 'react-datepicker-bkrdmrcioglu';
|
|
88
90
|
|
|
89
|
-
//
|
|
91
|
+
// English (default)
|
|
90
92
|
<DatePicker language="en" />
|
|
91
93
|
|
|
92
|
-
//
|
|
94
|
+
// Turkish
|
|
93
95
|
<DatePicker language="tr" />
|
|
94
96
|
|
|
95
|
-
//
|
|
97
|
+
// German
|
|
96
98
|
<DatePicker language="de" />
|
|
97
99
|
|
|
98
|
-
//
|
|
100
|
+
// French
|
|
99
101
|
<DatePicker language="fr" />
|
|
100
102
|
|
|
101
|
-
//
|
|
103
|
+
// Spanish
|
|
102
104
|
<DatePicker language="es" />
|
|
103
105
|
|
|
104
|
-
//
|
|
106
|
+
// Italian
|
|
105
107
|
<DatePicker language="it" />
|
|
106
108
|
|
|
107
|
-
//
|
|
109
|
+
// Portuguese
|
|
108
110
|
<DatePicker language="pt" />
|
|
109
111
|
|
|
110
|
-
//
|
|
112
|
+
// Russian
|
|
111
113
|
<DatePicker language="ru" />
|
|
112
114
|
|
|
113
|
-
//
|
|
115
|
+
// Japanese
|
|
114
116
|
<DatePicker language="ja" />
|
|
115
117
|
|
|
116
|
-
//
|
|
118
|
+
// Chinese
|
|
117
119
|
<DatePicker language="zh" />
|
|
118
120
|
|
|
119
|
-
//
|
|
121
|
+
// Arabic
|
|
120
122
|
<DatePicker language="ar" />
|
|
121
123
|
```
|
|
122
124
|
|
|
123
|
-
###
|
|
125
|
+
### Date and Time Selection
|
|
124
126
|
|
|
125
127
|
```tsx
|
|
126
128
|
<DatePicker
|
|
127
129
|
value={date}
|
|
128
130
|
onChange={setDate}
|
|
129
131
|
showTime={true}
|
|
130
|
-
placeholder="
|
|
132
|
+
placeholder="Select date and time..."
|
|
131
133
|
/>
|
|
132
134
|
```
|
|
133
135
|
|
|
134
|
-
### Min/Max
|
|
136
|
+
### Min/Max Date Constraints
|
|
135
137
|
|
|
136
138
|
```tsx
|
|
137
139
|
const minDate = new Date();
|
|
@@ -147,7 +149,7 @@ maxDate.setDate(maxDate.getDate() + 30);
|
|
|
147
149
|
/>
|
|
148
150
|
```
|
|
149
151
|
|
|
150
|
-
###
|
|
152
|
+
### Date Range Selection
|
|
151
153
|
|
|
152
154
|
```tsx
|
|
153
155
|
import { DateRangePicker } from 'react-datepicker-bkrdmrcioglu';
|
|
@@ -170,45 +172,45 @@ function MyComponent() {
|
|
|
170
172
|
}
|
|
171
173
|
```
|
|
172
174
|
|
|
173
|
-
## 🔧 API
|
|
175
|
+
## 🔧 API Reference
|
|
174
176
|
|
|
175
177
|
### DatePicker Props
|
|
176
178
|
|
|
177
|
-
| Prop |
|
|
178
|
-
|
|
179
|
-
| `value` | `Date \| null` | `undefined` |
|
|
180
|
-
| `onChange` | `(date: Date \| null) => void` | `undefined` |
|
|
181
|
-
| `placeholder` | `string` | `"
|
|
182
|
-
| `minDate` | `Date` | `undefined` | Minimum
|
|
183
|
-
| `maxDate` | `Date` | `undefined` |
|
|
184
|
-
| `disabled` | `boolean` | `false` |
|
|
185
|
-
| `className` | `string` | `""` |
|
|
186
|
-
| `showTime` | `boolean` | `false` |
|
|
187
|
-
| `format` | `string` | `"DD/MM/YYYY"` |
|
|
188
|
-
| `language` | `Language` | `"en"` |
|
|
179
|
+
| Prop | Type | Default | Description |
|
|
180
|
+
|------|------|---------|-------------|
|
|
181
|
+
| `value` | `Date \| null` | `undefined` | Selected date |
|
|
182
|
+
| `onChange` | `(date: Date \| null) => void` | `undefined` | Called when date changes |
|
|
183
|
+
| `placeholder` | `string` | `"Select date..."` | Input placeholder text |
|
|
184
|
+
| `minDate` | `Date` | `undefined` | Minimum selectable date |
|
|
185
|
+
| `maxDate` | `Date` | `undefined` | Maximum selectable date |
|
|
186
|
+
| `disabled` | `boolean` | `false` | Disable the picker |
|
|
187
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
188
|
+
| `showTime` | `boolean` | `false` | Show time selection |
|
|
189
|
+
| `format` | `string` | `"DD/MM/YYYY"` | Date format |
|
|
190
|
+
| `language` | `Language` | `"en"` | Language selection (en, tr, de, fr, es, it, pt, ru, ja, zh, ar) |
|
|
189
191
|
|
|
190
192
|
### DateRangePicker Props
|
|
191
193
|
|
|
192
|
-
| Prop |
|
|
193
|
-
|
|
194
|
-
| `startDate` | `Date \| null` | `undefined` |
|
|
195
|
-
| `endDate` | `Date \| null` | `undefined` |
|
|
196
|
-
| `onChange` | `(start: Date \| null, end: Date \| null) => void` | `undefined` |
|
|
197
|
-
| `placeholder` | `string` | `"
|
|
198
|
-
| `minDate` | `Date` | `undefined` | Minimum
|
|
199
|
-
| `maxDate` | `Date` | `undefined` |
|
|
200
|
-
| `disabled` | `boolean` | `false` |
|
|
201
|
-
| `className` | `string` | `""` |
|
|
194
|
+
| Prop | Type | Default | Description |
|
|
195
|
+
|------|------|---------|-------------|
|
|
196
|
+
| `startDate` | `Date \| null` | `undefined` | Start date |
|
|
197
|
+
| `endDate` | `Date \| null` | `undefined` | End date |
|
|
198
|
+
| `onChange` | `(start: Date \| null, end: Date \| null) => void` | `undefined` | Called when dates change |
|
|
199
|
+
| `placeholder` | `string` | `"Select date range..."` | Placeholder text |
|
|
200
|
+
| `minDate` | `Date` | `undefined` | Minimum selectable date |
|
|
201
|
+
| `maxDate` | `Date` | `undefined` | Maximum selectable date |
|
|
202
|
+
| `disabled` | `boolean` | `false` | Disable the picker |
|
|
203
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
202
204
|
|
|
203
|
-
## 🎨
|
|
205
|
+
## 🎨 Customization
|
|
204
206
|
|
|
205
|
-
|
|
207
|
+
Components are built using Tailwind CSS. You can customize the styles by modifying the className properties in the `components/DatePicker.tsx` file.
|
|
206
208
|
|
|
207
209
|
### Dark Mode
|
|
208
210
|
|
|
209
|
-
Dark mode
|
|
211
|
+
Dark mode is automatically set based on system preference or can be controlled manually using the `DarkModeToggle` component. All components support dark mode.
|
|
210
212
|
|
|
211
|
-
|
|
213
|
+
**Important:** You need to add the `dark` class to the HTML element for dark mode:
|
|
212
214
|
|
|
213
215
|
```tsx
|
|
214
216
|
import { DarkModeToggle } from 'react-datepicker-bkrdmrcioglu';
|
|
@@ -218,19 +220,19 @@ function MyComponent() {
|
|
|
218
220
|
}
|
|
219
221
|
```
|
|
220
222
|
|
|
221
|
-
|
|
223
|
+
To manually control dark mode:
|
|
222
224
|
|
|
223
225
|
```tsx
|
|
224
|
-
//
|
|
226
|
+
// Enable dark mode
|
|
225
227
|
document.documentElement.classList.add('dark');
|
|
226
228
|
|
|
227
|
-
//
|
|
229
|
+
// Disable dark mode
|
|
228
230
|
document.documentElement.classList.remove('dark');
|
|
229
231
|
```
|
|
230
232
|
|
|
231
|
-
###
|
|
233
|
+
### Language Selector
|
|
232
234
|
|
|
233
|
-
|
|
235
|
+
You can use the `LanguageSelector` component for language selection:
|
|
234
236
|
|
|
235
237
|
```tsx
|
|
236
238
|
import { LanguageSelector, DatePicker } from 'react-datepicker-bkrdmrcioglu';
|
|
@@ -249,18 +251,18 @@ function MyComponent() {
|
|
|
249
251
|
}
|
|
250
252
|
```
|
|
251
253
|
|
|
252
|
-
## 📝
|
|
254
|
+
## 📝 License
|
|
253
255
|
|
|
254
|
-
MIT License -
|
|
256
|
+
MIT License - Feel free to use it.
|
|
255
257
|
|
|
256
|
-
## 🤝
|
|
258
|
+
## 🤝 Contributing
|
|
257
259
|
|
|
258
|
-
|
|
260
|
+
We welcome your contributions! Please open an issue or submit a pull request.
|
|
259
261
|
|
|
260
|
-
## 📧
|
|
262
|
+
## 📧 Contact
|
|
261
263
|
|
|
262
|
-
|
|
264
|
+
You can use GitHub Issues for your questions.
|
|
263
265
|
|
|
264
266
|
---
|
|
265
267
|
|
|
266
|
-
⭐
|
|
268
|
+
⭐ If you liked this project, don't forget to give it a star!
|