@torq-ui/react-date-picker 0.3.0
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/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/index.cjs +1485 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +301 -0
- package/dist/index.d.ts +301 -0
- package/dist/index.js +1478 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @torq-ui/react-date-picker
|
|
2
|
+
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Axis lift-and-shift: publish DatePicker under `@at5/axis-datepicker`.
|
|
8
|
+
|
|
9
|
+
- Add `@at5/axis-datepicker` — same DatePicker API and behavior as `@at5/kairo` (migrated from `packages/kairo` to `packages/datepicker`)
|
|
10
|
+
- Add `@at5/axis` — aggregator re-exporting `DatePicker`
|
|
11
|
+
- `@at5/kairo` — deprecated; thin re-export of `@at5/axis-datepicker` for transition
|
|
12
|
+
- Docs site and playground now depend on `@at5/axis-datepicker`
|
|
13
|
+
|
|
14
|
+
**Migration:** replace `@at5/kairo` with `@at5/axis-datepicker` (or `@at5/axis`). No API changes.
|
|
15
|
+
|
|
16
|
+
## 0.2.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- cad8443: Improve README with full API reference and accurate dependency description
|
|
21
|
+
|
|
22
|
+
## 0.2.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- fb70ffd: Initial release
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Allyson Soares
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# @torq-ui/react-date-picker
|
|
2
|
+
|
|
3
|
+
Torq UI — headless date & scheduling primitives for React. Built on top of the native `Intl` API, timescape and Floating UI — with full keyboard navigation and WAI-ARIA compliance.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Calendar** — WAI-ARIA grid pattern with roving focus and full keyboard navigation
|
|
8
|
+
- **Date Picker** — Input + popover calendar, semantic HTML only
|
|
9
|
+
- **Date Range Picker** — Dual-endpoint selection with live hover preview and optional presets
|
|
10
|
+
- **Date Field** — Segmented spinbutton input (day/month/year), no calendar required
|
|
11
|
+
- Locale-aware: respects week start day, date format order, and RTL scripts
|
|
12
|
+
- Unstyled — bring your own CSS
|
|
13
|
+
- React 19+, TypeScript-first
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @torq-ui/react-date-picker
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { DatePicker } from "@torq-ui/react-date-picker";
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<DatePicker.Root>
|
|
29
|
+
<DatePicker.Trigger>Pick a date</DatePicker.Trigger>
|
|
30
|
+
<DatePicker.Content>
|
|
31
|
+
<DatePicker.Calendar />
|
|
32
|
+
</DatePicker.Content>
|
|
33
|
+
</DatePicker.Root>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
### Calendar
|
|
41
|
+
|
|
42
|
+
Standalone month grid (composed via DatePicker.Root + calendar parts for full control, or the shorthand).
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { DatePicker } from "@torq-ui/react-date-picker";
|
|
46
|
+
|
|
47
|
+
<DatePicker.Root locale="en-US" onValueChange={(date) => console.log(date)}>
|
|
48
|
+
<DatePicker.ViewControl>
|
|
49
|
+
<DatePicker.PrevTrigger />
|
|
50
|
+
<DatePicker.ViewTrigger />
|
|
51
|
+
<DatePicker.NextTrigger />
|
|
52
|
+
</DatePicker.ViewControl>
|
|
53
|
+
<DatePicker.View view="day">
|
|
54
|
+
<DatePicker.Grid header={<DatePicker.WeekDays />}>
|
|
55
|
+
{({ weeks }) => weeks.map((week, i) => (
|
|
56
|
+
<tr key={i}>
|
|
57
|
+
{week.map((d, j) => <DatePicker.Day key={j} date={d} />)}
|
|
58
|
+
</tr>
|
|
59
|
+
))}
|
|
60
|
+
</DatePicker.Grid>
|
|
61
|
+
</DatePicker.View>
|
|
62
|
+
</DatePicker.Root>
|
|
63
|
+
|
|
64
|
+
// Or shorthand inside a Root:
|
|
65
|
+
<DatePicker.Root>
|
|
66
|
+
<DatePicker.Calendar />
|
|
67
|
+
</DatePicker.Root>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Props on Root:** `value`, `defaultValue`, `onValueChange`, `locale`, `weekStartsOn`, `minDate`, `maxDate`, `disabled`, `mode`
|
|
71
|
+
|
|
72
|
+
**Data attributes (on Day):** `[data-selected]`, `[data-today]`, `[data-outside-month]`, `[data-disabled]`, `[data-in-range]`, `[data-range-start]`, `[data-range-end]`
|
|
73
|
+
|
|
74
|
+
For the dedicated "Date Field" experience use a minimal Root + Input only.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Date Picker
|
|
79
|
+
|
|
80
|
+
Text input paired with a calendar popover.
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { DatePicker } from "@torq-ui/react-date-picker";
|
|
84
|
+
|
|
85
|
+
<DatePicker.Root locale="en-US" onValueChange={(date) => console.log(date)}>
|
|
86
|
+
<DatePicker.Trigger />
|
|
87
|
+
<DatePicker.Content>
|
|
88
|
+
<DatePicker.Calendar />
|
|
89
|
+
</DatePicker.Content>
|
|
90
|
+
</DatePicker.Root>;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Props:** `value`, `defaultValue`, `onValueChange`, `open`, `onOpenChange`, `locale`, `format`, `closeOnSelect`, `placement`
|
|
94
|
+
|
|
95
|
+
**Keyboard:** `Enter`/`Space` opens popover, `Escape` closes, arrow keys navigate calendar.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### Date Range Picker
|
|
100
|
+
|
|
101
|
+
Selects a start and end date with optional night presets.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { DateRangePicker } from "@torq-ui/react-date-picker";
|
|
105
|
+
|
|
106
|
+
<DateRangePicker.Root locale="en-US" onValueChange={({ start, end }) => console.log(start, end)}>
|
|
107
|
+
<DateRangePicker.Trigger />
|
|
108
|
+
<DateRangePicker.Content>
|
|
109
|
+
<DateRangePicker.Calendar />
|
|
110
|
+
</DateRangePicker.Content>
|
|
111
|
+
</DateRangePicker.Root>;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Props:** `value`, `defaultValue`, `onValueChange`, `minNights`, `maxNights`, `presets`, `locale`
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### Date Field
|
|
119
|
+
|
|
120
|
+
Segmented spinbutton input — no popover, locale-aware segment order.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { DateField } from "@torq-ui/react-date-picker";
|
|
124
|
+
|
|
125
|
+
<DateField.Root locale="en-US" onValueChange={(date) => console.log(date)}>
|
|
126
|
+
<DateField.Segment segment="month" />
|
|
127
|
+
<DateField.Literal>/</DateField.Literal>
|
|
128
|
+
<DateField.Segment segment="day" />
|
|
129
|
+
<DateField.Literal>/</DateField.Literal>
|
|
130
|
+
<DateField.Segment segment="year" />
|
|
131
|
+
</DateField.Root>;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Props:** `value`, `defaultValue`, `onValueChange`, `locale`, `granularity`, `min`, `max`
|
|
135
|
+
|
|
136
|
+
**Keyboard:** `↑`/`↓` increments/decrements the focused segment, `Tab` advances to next segment.
|
|
137
|
+
|
|
138
|
+
## Localization
|
|
139
|
+
|
|
140
|
+
All components accept a `locale` prop compatible with `Intl.Locale`. Week start day, month/day/year order, and calendar display adapt automatically.
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
// Arabic RTL
|
|
144
|
+
<DatePicker.Root locale="ar" />
|
|
145
|
+
|
|
146
|
+
// Brazilian Portuguese
|
|
147
|
+
<DatePicker.Root locale="pt-BR" />
|
|
148
|
+
|
|
149
|
+
// Japanese
|
|
150
|
+
<DatePicker.Root locale="ja-JP" />
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Requirements
|
|
154
|
+
|
|
155
|
+
- React `>=19.0.0`
|
|
156
|
+
- Node.js `>=22`
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
*Torq UI*
|