@carbon-labs/react-date-picker 0.2.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 IBM Corp.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # React DatePicker Implementation
2
+
3
+ This directory will contain the React implementation of the DatePicker component
4
+ in Phase 2.
5
+
6
+ ## Planned Structure
7
+
8
+ ```
9
+ components/react/
10
+ ├── DatePicker.tsx - Main wrapper component
11
+ ├── DatePickerInput.tsx - Input component
12
+ ├── Calendar.tsx - Calendar component
13
+ ├── hooks/
14
+ │ └── useDatePicker.ts - React hook for state machine integration
15
+ └── adapters/
16
+ └── react-adapter.ts - React-specific adapter
17
+ ```
18
+
19
+ ## Implementation Guide
20
+
21
+ See `../../REACT_IMPLEMENTATION_GUIDE.md` for detailed implementation
22
+ instructions.
23
+
24
+ ## Key Features
25
+
26
+ - 100% backwards compatible with Carbon React v11 DatePicker API
27
+ - Shares state machine logic with Web Components implementation
28
+ - Uses Temporal API for date handling
29
+ - Supports single, simple, and range modes
30
+ - Full keyboard navigation support
31
+
32
+ ## Phase 2 Timeline
33
+
34
+ React implementation is planned for Phase 2 of the Carbon Labs restructuring
35
+ effort.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ function _extends() {
9
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
10
+ for (var e = 1; e < arguments.length; e++) {
11
+ var t = arguments[e];
12
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
13
+ }
14
+ return n;
15
+ }, _extends.apply(null, arguments);
16
+ }
17
+
18
+ export { _extends as extends };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import type { DatePickerContext } from '@carbon-labs/primitives/date-picker';
9
+ /**
10
+ * Calendar component props
11
+ */
12
+ export interface CalendarProps {
13
+ /**
14
+ * State machine context
15
+ */
16
+ context: DatePickerContext;
17
+ /**
18
+ * Date selection handler
19
+ */
20
+ onDateSelect: (date: Temporal.PlainDate) => void;
21
+ /**
22
+ * Navigation handler
23
+ */
24
+ onNavigate: (eventType: string) => void;
25
+ /**
26
+ * Additional CSS class names
27
+ */
28
+ className?: string;
29
+ }
30
+ /**
31
+ * Calendar component
32
+ * Renders a calendar grid for date selection
33
+ */
34
+ export declare function Calendar({ context, onDateSelect, onNavigate, className, }: CalendarProps): React.JSX.Element | null;
35
+ export declare namespace Calendar {
36
+ var displayName: string;
37
+ }
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React, { useMemo, useCallback } from 'react';
9
+ import classNames from 'classnames';
10
+ import { plainDateToDate, addDays } from '@carbon-labs/primitives/date-picker';
11
+
12
+ var _svg, _svg2;
13
+
14
+ /**
15
+ * Calendar component props
16
+ */
17
+
18
+ /**
19
+ * Day cell in the calendar grid
20
+ */
21
+
22
+ /**
23
+ * Generate calendar grid for a given month
24
+ *
25
+ * @param {Temporal.PlainDate} viewDate - The date to generate calendar for
26
+ * @param {Temporal.PlainDate | null} minDate - Minimum selectable date
27
+ * @param {Temporal.PlainDate | null} maxDate - Maximum selectable date
28
+ * @returns {DayCell[][]} 2D array of day cells (weeks x days)
29
+ */
30
+ function generateCalendarGrid(viewDate, minDate, maxDate) {
31
+ const today = Temporal.Now.plainDateISO();
32
+ const firstDayOfMonth = viewDate.with({
33
+ day: 1
34
+ });
35
+
36
+ // Get the day of week for the first day (0 = Sunday)
37
+ // Convert Temporal dayOfWeek (1=Monday) to JS (0=Sunday)
38
+ const jsDate = plainDateToDate(firstDayOfMonth);
39
+ const firstDayOfWeek = jsDate.getDay();
40
+
41
+ // Calculate start date (may be from previous month)
42
+ const startDate = addDays(firstDayOfMonth, -firstDayOfWeek);
43
+
44
+ // Generate 6 weeks (42 days) to ensure consistent calendar height
45
+ const weeks = [];
46
+ let currentDate = startDate;
47
+ for (let week = 0; week < 6; week++) {
48
+ const days = [];
49
+ for (let day = 0; day < 7; day++) {
50
+ const isCurrentMonth = currentDate.month === viewDate.month;
51
+ const isToday = Temporal.PlainDate.compare(currentDate, today) === 0;
52
+
53
+ // Check if date is disabled
54
+ let isDisabled = false;
55
+ if (minDate && Temporal.PlainDate.compare(currentDate, minDate) < 0) {
56
+ isDisabled = true;
57
+ }
58
+ if (maxDate && Temporal.PlainDate.compare(currentDate, maxDate) > 0) {
59
+ isDisabled = true;
60
+ }
61
+ days.push({
62
+ date: currentDate,
63
+ isCurrentMonth,
64
+ isDisabled,
65
+ isToday
66
+ });
67
+ currentDate = addDays(currentDate, 1);
68
+ }
69
+ weeks.push(days);
70
+ }
71
+ return weeks;
72
+ }
73
+
74
+ /**
75
+ * Calendar component
76
+ * Renders a calendar grid for date selection
77
+ */
78
+ function Calendar({
79
+ context,
80
+ onDateSelect,
81
+ onNavigate,
82
+ className
83
+ }) {
84
+ // Use Carbon's standard 'cds' prefix to match Carbon's date-picker styles
85
+ const prefix = 'cds';
86
+ const {
87
+ viewDate,
88
+ startDate,
89
+ endDate,
90
+ minDate,
91
+ maxDate,
92
+ focusedDate,
93
+ mode
94
+ } = context;
95
+
96
+ // Generate calendar grid
97
+ const calendarGrid = useMemo(() => {
98
+ if (!viewDate) {
99
+ return [];
100
+ }
101
+ return generateCalendarGrid(viewDate, minDate, maxDate);
102
+ }, [viewDate, minDate, maxDate]);
103
+
104
+ // Navigation handlers
105
+ const handlePrevMonth = useCallback(() => {
106
+ onNavigate('PREV_MONTH');
107
+ }, [onNavigate]);
108
+ const handleNextMonth = useCallback(() => {
109
+ onNavigate('NEXT_MONTH');
110
+ }, [onNavigate]);
111
+ const handleDateClick = useCallback((date, isDisabled) => {
112
+ if (!isDisabled) {
113
+ onDateSelect(date);
114
+ }
115
+ }, [onDateSelect]);
116
+
117
+ // Check if a date is selected
118
+ const isDateSelected = useCallback(date => {
119
+ if (!startDate) {
120
+ return false;
121
+ }
122
+ if (Temporal.PlainDate.compare(date, startDate) === 0) {
123
+ return true;
124
+ }
125
+ if (endDate && Temporal.PlainDate.compare(date, endDate) === 0) {
126
+ return true;
127
+ }
128
+ return false;
129
+ }, [startDate, endDate]);
130
+
131
+ // Check if a date is in the selected range
132
+ const isDateInRange = useCallback(date => {
133
+ if (mode !== 'range' || !startDate) {
134
+ return false;
135
+ }
136
+
137
+ // If endDate exists, use it for the range
138
+ if (endDate) {
139
+ return Temporal.PlainDate.compare(date, startDate) > 0 && Temporal.PlainDate.compare(date, endDate) < 0;
140
+ }
141
+
142
+ // If endDate doesn't exist but focusedDate does (user is selecting end date),
143
+ // show the range between startDate and focusedDate
144
+ if (focusedDate) {
145
+ const earlierDate = Temporal.PlainDate.compare(startDate, focusedDate) < 0 ? startDate : focusedDate;
146
+ const laterDate = Temporal.PlainDate.compare(startDate, focusedDate) < 0 ? focusedDate : startDate;
147
+ return Temporal.PlainDate.compare(date, earlierDate) > 0 && Temporal.PlainDate.compare(date, laterDate) < 0;
148
+ }
149
+ return false;
150
+ }, [mode, startDate, endDate, focusedDate]);
151
+
152
+ // Check if a date is the range start (not currently used but kept for future range styling)
153
+ useCallback(date => {
154
+ if (mode !== 'range' || !startDate) {
155
+ return false;
156
+ }
157
+ return Temporal.PlainDate.compare(date, startDate) === 0;
158
+ }, [mode, startDate]);
159
+
160
+ // Check if a date is the range end (not currently used but kept for future range styling)
161
+ useCallback(date => {
162
+ if (mode !== 'range' || !endDate) {
163
+ return false;
164
+ }
165
+ return Temporal.PlainDate.compare(date, endDate) === 0;
166
+ }, [mode, endDate]);
167
+
168
+ // Check if a date is focused
169
+ const isDateFocused = useCallback(date => {
170
+ if (!focusedDate) {
171
+ return false;
172
+ }
173
+ return Temporal.PlainDate.compare(date, focusedDate) === 0;
174
+ }, [focusedDate]);
175
+ if (!viewDate) {
176
+ return null;
177
+ }
178
+ const calendarClasses = classNames(`${prefix}--date-picker__calendar`, className);
179
+
180
+ // Format month and year for display
181
+ const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
182
+ const monthYear = `${monthNames[viewDate.month - 1]} ${viewDate.year}`;
183
+ return /*#__PURE__*/React.createElement("div", {
184
+ className: calendarClasses,
185
+ role: "grid",
186
+ "aria-label": "Calendar",
187
+ tabIndex: 0
188
+ }, /*#__PURE__*/React.createElement("div", {
189
+ className: `${prefix}--date-picker__month`
190
+ }, /*#__PURE__*/React.createElement("button", {
191
+ type: "button",
192
+ className: `${prefix}--date-picker__month-nav`,
193
+ onClick: handlePrevMonth,
194
+ "aria-label": "Previous month"
195
+ }, _svg || (_svg = /*#__PURE__*/React.createElement("svg", {
196
+ focusable: "false",
197
+ preserveAspectRatio: "xMidYMid meet",
198
+ xmlns: "http://www.w3.org/2000/svg",
199
+ fill: "currentColor",
200
+ width: "16",
201
+ height: "16",
202
+ viewBox: "0 0 16 16",
203
+ "aria-hidden": "true"
204
+ }, /*#__PURE__*/React.createElement("path", {
205
+ d: "M11 8l-5 5-.7-.7L9.6 8 5.3 3.7 6 3z",
206
+ transform: "rotate(180 8 8)"
207
+ })))), /*#__PURE__*/React.createElement("div", {
208
+ className: `${prefix}--date-picker__current-month`
209
+ }, monthYear), /*#__PURE__*/React.createElement("button", {
210
+ type: "button",
211
+ className: `${prefix}--date-picker__month-nav`,
212
+ onClick: handleNextMonth,
213
+ "aria-label": "Next month"
214
+ }, _svg2 || (_svg2 = /*#__PURE__*/React.createElement("svg", {
215
+ focusable: "false",
216
+ preserveAspectRatio: "xMidYMid meet",
217
+ xmlns: "http://www.w3.org/2000/svg",
218
+ fill: "currentColor",
219
+ width: "16",
220
+ height: "16",
221
+ viewBox: "0 0 16 16",
222
+ "aria-hidden": "true"
223
+ }, /*#__PURE__*/React.createElement("path", {
224
+ d: "M11 8l-5 5-.7-.7L9.6 8 5.3 3.7 6 3z"
225
+ }))))), /*#__PURE__*/React.createElement("div", {
226
+ className: `${prefix}--date-picker__weekdays`
227
+ }, ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => /*#__PURE__*/React.createElement("div", {
228
+ key: day,
229
+ className: `${prefix}--date-picker__weekday`,
230
+ title: day
231
+ }, day))), /*#__PURE__*/React.createElement("div", {
232
+ className: `${prefix}--date-picker__days`
233
+ }, calendarGrid.flat().map((dayCell, index) => {
234
+ const {
235
+ date,
236
+ isCurrentMonth,
237
+ isDisabled,
238
+ isToday
239
+ } = dayCell;
240
+ const selected = isDateSelected(date);
241
+ const inRange = isDateInRange(date);
242
+ const focused = isDateFocused(date);
243
+ const dayClasses = classNames(`${prefix}--date-picker__day`, {
244
+ today: isToday,
245
+ selected: selected,
246
+ inRange: inRange,
247
+ prevMonthDay: !isCurrentMonth && date.month < viewDate.month,
248
+ nextMonthDay: !isCurrentMonth && date.month > viewDate.month,
249
+ disabled: isDisabled,
250
+ focused: focused
251
+ });
252
+ return /*#__PURE__*/React.createElement("button", {
253
+ key: index,
254
+ type: "button",
255
+ className: dayClasses,
256
+ onClick: () => handleDateClick(date, isDisabled),
257
+ disabled: isDisabled,
258
+ "aria-label": `${monthNames[date.month - 1]} ${date.day}, ${date.year}`,
259
+ "aria-pressed": selected || undefined,
260
+ "aria-current": isToday ? 'date' : undefined,
261
+ tabIndex: focused ? 0 : -1
262
+ }, date.day);
263
+ })));
264
+ }
265
+ Calendar.displayName = 'Calendar';
266
+
267
+ export { Calendar };
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ /**
9
+ * DatePicker component props
10
+ * Maintains 100% backwards compatibility with Carbon React v11 API
11
+ */
12
+ export interface DatePickerProps {
13
+ /**
14
+ * The type of date picker (Carbon API uses datePickerType, not mode)
15
+ */
16
+ datePickerType?: 'simple' | 'single' | 'range';
17
+ /**
18
+ * The date format string (Flatpickr-compatible format)
19
+ */
20
+ dateFormat?: string;
21
+ /**
22
+ * Minimum selectable date (mm/dd/yyyy format - Carbon API)
23
+ */
24
+ minDate?: string;
25
+ /**
26
+ * Maximum selectable date (mm/dd/yyyy format - Carbon API)
27
+ */
28
+ maxDate?: string;
29
+ /**
30
+ * Locale for date formatting
31
+ */
32
+ locale?: string;
33
+ /**
34
+ * Whether the picker is read-only (Carbon uses readOnly, not readonly)
35
+ */
36
+ readOnly?: boolean;
37
+ /**
38
+ * Whether to use the light variant
39
+ */
40
+ light?: boolean;
41
+ /**
42
+ * Whether to use the short variant
43
+ */
44
+ short?: boolean;
45
+ /**
46
+ * Whether to allow manual input
47
+ */
48
+ allowInput?: boolean;
49
+ /**
50
+ * Whether to close calendar on date selection
51
+ */
52
+ closeOnSelect?: boolean;
53
+ /**
54
+ * Change handler - receives array of Date objects (Carbon API)
55
+ */
56
+ onChange?: (dates: Date[]) => void;
57
+ /**
58
+ * Close handler
59
+ */
60
+ onClose?: () => void;
61
+ /**
62
+ * Open handler
63
+ */
64
+ onOpen?: () => void;
65
+ /**
66
+ * Additional CSS class names
67
+ */
68
+ className?: string;
69
+ /**
70
+ * Children (DatePickerInput components)
71
+ */
72
+ children?: React.ReactNode;
73
+ /**
74
+ * Initial value
75
+ */
76
+ value?: string;
77
+ /**
78
+ * Append the calendar to a specific element
79
+ */
80
+ appendTo?: HTMLElement;
81
+ }
82
+ /**
83
+ * DatePicker component
84
+ * Main wrapper component that orchestrates date picker functionality
85
+ * Maintains 100% backwards compatibility with Carbon React v11
86
+ */
87
+ export declare function DatePicker({ datePickerType, dateFormat, minDate, maxDate, locale, readOnly, light, short, allowInput, closeOnSelect, onChange, onClose, onOpen, className, children, value, }: DatePickerProps): React.JSX.Element;
88
+ export declare namespace DatePicker {
89
+ var displayName: string;
90
+ }