best-react-datepicker 0.2.2 → 0.2.4
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 +27 -0
- package/dist/index.cjs +39 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -17
- package/dist/index.js.map +1 -1
- package/dist/styles.css +93 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
The most customizable, accessible, zero-dependency React date picker.
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="./assets/datepicker.png" alt="DatePicker" width="380"/>
|
|
7
|
+
<img src="./assets/dark-mode.png" alt="Dark mode" width="380"/>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
5
10
|
- **7 picker components** — DatePicker, RangePicker, TimePicker, DateTimePicker, MonthPicker, YearPicker, WeekPicker
|
|
6
11
|
- **Zero dependencies** — only React as a peer dependency
|
|
7
12
|
- **Fully accessible** — keyboard navigation, ARIA labels, screen reader announcements
|
|
@@ -42,6 +47,8 @@ function App() {
|
|
|
42
47
|
|
|
43
48
|
### DatePicker
|
|
44
49
|
|
|
50
|
+
<img src="./assets/datepicker.png" alt="DatePicker" width="380"/>
|
|
51
|
+
|
|
45
52
|
Single date selection with optional constraints.
|
|
46
53
|
|
|
47
54
|
```tsx
|
|
@@ -59,6 +66,8 @@ Single date selection with optional constraints.
|
|
|
59
66
|
|
|
60
67
|
### RangePicker
|
|
61
68
|
|
|
69
|
+
<img src="./assets/rangepicker.png" alt="RangePicker" width="720"/>
|
|
70
|
+
|
|
62
71
|
Date range selection with optional presets.
|
|
63
72
|
|
|
64
73
|
```tsx
|
|
@@ -77,6 +86,8 @@ const presets = createPresets();
|
|
|
77
86
|
|
|
78
87
|
**Compact mode** — single calendar with presets below:
|
|
79
88
|
|
|
89
|
+
<img src="./assets/rangepicker-compact.png" alt="RangePicker compact" width="380"/>
|
|
90
|
+
|
|
80
91
|
```tsx
|
|
81
92
|
<RangePicker
|
|
82
93
|
value={range}
|
|
@@ -90,6 +101,8 @@ const presets = createPresets();
|
|
|
90
101
|
|
|
91
102
|
### TimePicker
|
|
92
103
|
|
|
104
|
+
<img src="./assets/timepicker.png" alt="TimePicker" width="300"/>
|
|
105
|
+
|
|
93
106
|
```tsx
|
|
94
107
|
<TimePicker
|
|
95
108
|
value={time}
|
|
@@ -101,6 +114,8 @@ const presets = createPresets();
|
|
|
101
114
|
|
|
102
115
|
### DateTimePicker
|
|
103
116
|
|
|
117
|
+
<img src="./assets/datetimepicker.png" alt="DateTimePicker" width="380"/>
|
|
118
|
+
|
|
104
119
|
Combined date and time selection with tabbed interface.
|
|
105
120
|
|
|
106
121
|
```tsx
|
|
@@ -113,6 +128,8 @@ Combined date and time selection with tabbed interface.
|
|
|
113
128
|
|
|
114
129
|
### MonthPicker
|
|
115
130
|
|
|
131
|
+
<img src="./assets/monthpicker.png" alt="MonthPicker" width="300"/>
|
|
132
|
+
|
|
116
133
|
```tsx
|
|
117
134
|
<MonthPicker
|
|
118
135
|
value={monthDate}
|
|
@@ -123,6 +140,8 @@ Combined date and time selection with tabbed interface.
|
|
|
123
140
|
|
|
124
141
|
### YearPicker
|
|
125
142
|
|
|
143
|
+
<img src="./assets/yearpicker.png" alt="YearPicker" width="300"/>
|
|
144
|
+
|
|
126
145
|
```tsx
|
|
127
146
|
<YearPicker
|
|
128
147
|
value={year}
|
|
@@ -133,6 +152,8 @@ Combined date and time selection with tabbed interface.
|
|
|
133
152
|
|
|
134
153
|
### WeekPicker
|
|
135
154
|
|
|
155
|
+
<img src="./assets/weekpicker.png" alt="WeekPicker" width="380"/>
|
|
156
|
+
|
|
136
157
|
```tsx
|
|
137
158
|
<WeekPicker
|
|
138
159
|
onChange={(start, end, weekNumber) => {
|
|
@@ -143,6 +164,8 @@ Combined date and time selection with tabbed interface.
|
|
|
143
164
|
|
|
144
165
|
## Size Variants
|
|
145
166
|
|
|
167
|
+
<img src="./assets/sizes.png" alt="Size variants" width="640"/>
|
|
168
|
+
|
|
146
169
|
All pickers accept a `size` prop: `"sm"`, `"md"` (default), or `"lg"`.
|
|
147
170
|
|
|
148
171
|
```tsx
|
|
@@ -182,6 +205,8 @@ Built-in preset keys: `today`, `yesterday`, `last7`, `last30`, `thisMonth`, `las
|
|
|
182
205
|
|
|
183
206
|
## Theming
|
|
184
207
|
|
|
208
|
+
<img src="./assets/theming.png" alt="Theming" width="640"/>
|
|
209
|
+
|
|
185
210
|
Override CSS variables to match your brand:
|
|
186
211
|
|
|
187
212
|
```tsx
|
|
@@ -196,6 +221,8 @@ Override CSS variables to match your brand:
|
|
|
196
221
|
|
|
197
222
|
### Dark Mode
|
|
198
223
|
|
|
224
|
+
<img src="./assets/dark-mode.png" alt="Dark mode" width="380"/>
|
|
225
|
+
|
|
199
226
|
```tsx
|
|
200
227
|
<div className="brdp-dark">
|
|
201
228
|
<DatePicker placeholder="Dark mode" />
|
package/dist/index.cjs
CHANGED
|
@@ -663,12 +663,16 @@ var DatePicker = react.forwardRef(
|
|
|
663
663
|
);
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
|
+
function SwapArrow() {
|
|
667
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", className: "brdp-unified__arrow-icon", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 8H12M12 8L9.5 5.5M12 8L9.5 10.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
668
|
+
}
|
|
666
669
|
function RangePicker(props) {
|
|
667
670
|
const {
|
|
668
671
|
className,
|
|
669
672
|
style,
|
|
670
673
|
size,
|
|
671
674
|
compact = false,
|
|
675
|
+
variant = "default",
|
|
672
676
|
showPresets = false,
|
|
673
677
|
presetsPosition = "left",
|
|
674
678
|
renderDay,
|
|
@@ -715,6 +719,40 @@ function RangePicker(props) {
|
|
|
715
719
|
},
|
|
716
720
|
i
|
|
717
721
|
)) });
|
|
722
|
+
const isUnified = variant === "unified";
|
|
723
|
+
const inputSection = isUnified ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `brdp-unified ${picker.isOpen ? "brdp-unified--focused" : ""}`, children: [
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
725
|
+
"input",
|
|
726
|
+
{
|
|
727
|
+
...startInputProps,
|
|
728
|
+
className: "brdp-unified__input"
|
|
729
|
+
}
|
|
730
|
+
),
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "brdp-unified__separator", children: /* @__PURE__ */ jsxRuntime.jsx(SwapArrow, {}) }),
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
733
|
+
"input",
|
|
734
|
+
{
|
|
735
|
+
...endInputProps,
|
|
736
|
+
className: "brdp-unified__input"
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "brdp-range-input", children: [
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
"input",
|
|
742
|
+
{
|
|
743
|
+
...startInputProps,
|
|
744
|
+
className: "brdp-input brdp-range-input__start"
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "brdp-range-input__separator", children: picker.separator }),
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
+
"input",
|
|
750
|
+
{
|
|
751
|
+
...endInputProps,
|
|
752
|
+
className: "brdp-input brdp-range-input__end"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] });
|
|
718
756
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
719
757
|
"div",
|
|
720
758
|
{
|
|
@@ -723,23 +761,7 @@ function RangePicker(props) {
|
|
|
723
761
|
style: { ...sizeStyles, ...style },
|
|
724
762
|
dir: dir ?? picker.locale.dir,
|
|
725
763
|
children: [
|
|
726
|
-
|
|
727
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
728
|
-
"input",
|
|
729
|
-
{
|
|
730
|
-
...startInputProps,
|
|
731
|
-
className: "brdp-input brdp-range-input__start"
|
|
732
|
-
}
|
|
733
|
-
),
|
|
734
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "brdp-range-input__separator", children: picker.separator }),
|
|
735
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
-
"input",
|
|
737
|
-
{
|
|
738
|
-
...endInputProps,
|
|
739
|
-
className: "brdp-input brdp-range-input__end"
|
|
740
|
-
}
|
|
741
|
-
)
|
|
742
|
-
] }),
|
|
764
|
+
inputSection,
|
|
743
765
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
744
766
|
Popover,
|
|
745
767
|
{
|