@primer/components 0.0.0-2021927202224 → 0.0.0-2021927203020

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +1 -23
  2. package/dist/browser.esm.js +53 -54
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +50 -51
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Item.d.ts +0 -6
  7. package/lib/ActionList/Item.js +1 -5
  8. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  9. package/lib/Autocomplete/Autocomplete.d.ts +4 -2
  10. package/lib/Autocomplete/AutocompleteInput.d.ts +4 -2
  11. package/lib/Breadcrumbs.d.ts +7 -8
  12. package/lib/Breadcrumbs.js +12 -7
  13. package/lib/DatePicker/DatePicker.d.ts +48 -0
  14. package/lib/DatePicker/DatePicker.js +104 -0
  15. package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
  16. package/lib/DatePicker/DatePickerAnchor.js +182 -0
  17. package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
  18. package/lib/DatePicker/DatePickerOverlay.js +48 -0
  19. package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
  20. package/lib/DatePicker/DatePickerPanel.js +126 -0
  21. package/lib/DatePicker/Day.d.ts +14 -0
  22. package/lib/DatePicker/Day.js +190 -0
  23. package/lib/DatePicker/Month.d.ts +9 -0
  24. package/lib/DatePicker/Month.js +120 -0
  25. package/lib/DatePicker/index.d.ts +2 -0
  26. package/lib/DatePicker/index.js +13 -0
  27. package/lib/DatePicker/useDatePicker.d.ts +88 -0
  28. package/lib/DatePicker/useDatePicker.js +433 -0
  29. package/lib/SelectMenu/SelectMenu.d.ts +4 -2
  30. package/lib/TextInputWithTokens.d.ts +4 -6
  31. package/lib/TextInputWithTokens.js +29 -102
  32. package/lib/Token/Token.js +2 -13
  33. package/lib/Token/TokenBase.js +4 -0
  34. package/lib/Token/_RemoveTokenButton.js +2 -15
  35. package/lib/_TextInputWrapper.js +1 -1
  36. package/lib/hooks/useDebounce.d.ts +2 -0
  37. package/lib/hooks/useDebounce.js +24 -0
  38. package/lib/theme-preval.js +2 -2
  39. package/lib/utils/testing.d.ts +1 -1
  40. package/lib-esm/ActionList/Item.d.ts +0 -6
  41. package/lib-esm/ActionList/Item.js +1 -5
  42. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
  43. package/lib-esm/Autocomplete/Autocomplete.d.ts +4 -2
  44. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +4 -2
  45. package/lib-esm/Breadcrumbs.d.ts +7 -8
  46. package/lib-esm/Breadcrumbs.js +13 -8
  47. package/lib-esm/DatePicker/DatePicker.d.ts +48 -0
  48. package/lib-esm/DatePicker/DatePicker.js +87 -0
  49. package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
  50. package/lib-esm/DatePicker/DatePickerAnchor.js +155 -0
  51. package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
  52. package/lib-esm/DatePicker/DatePickerOverlay.js +29 -0
  53. package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
  54. package/lib-esm/DatePicker/DatePickerPanel.js +100 -0
  55. package/lib-esm/DatePicker/Day.d.ts +14 -0
  56. package/lib-esm/DatePicker/Day.js +167 -0
  57. package/lib-esm/DatePicker/Month.d.ts +9 -0
  58. package/lib-esm/DatePicker/Month.js +96 -0
  59. package/lib-esm/DatePicker/index.d.ts +2 -0
  60. package/lib-esm/DatePicker/index.js +1 -0
  61. package/lib-esm/DatePicker/useDatePicker.d.ts +88 -0
  62. package/lib-esm/DatePicker/useDatePicker.js +403 -0
  63. package/lib-esm/SelectMenu/SelectMenu.d.ts +4 -2
  64. package/lib-esm/TextInputWithTokens.d.ts +4 -6
  65. package/lib-esm/TextInputWithTokens.js +30 -101
  66. package/lib-esm/Token/Token.js +2 -13
  67. package/lib-esm/Token/TokenBase.js +4 -0
  68. package/lib-esm/Token/_RemoveTokenButton.js +2 -11
  69. package/lib-esm/_TextInputWrapper.js +1 -1
  70. package/lib-esm/hooks/useDebounce.d.ts +2 -0
  71. package/lib-esm/hooks/useDebounce.js +16 -0
  72. package/lib-esm/theme-preval.js +2 -2
  73. package/lib-esm/utils/testing.d.ts +1 -1
  74. package/package.json +14 -13
@@ -0,0 +1,2 @@
1
+ export { DatePicker } from './DatePicker';
2
+ export type { DatePickerProps } from './DatePicker';
@@ -0,0 +1 @@
1
+ export { DatePicker } from './DatePicker';
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ export declare type AnchorVariant = 'input' | 'button' | 'icon-only';
3
+ export declare type DateFormat = 'short' | 'long' | string;
4
+ export declare type SelectionVariant = 'single' | 'multi' | 'range';
5
+ export interface DatePickerConfiguration {
6
+ anchorVariant?: AnchorVariant;
7
+ blockedDates?: Array<Date>;
8
+ confirmation?: boolean;
9
+ confirmUnsavedClose?: boolean;
10
+ dateFormat?: DateFormat;
11
+ disableWeekends?: boolean;
12
+ iconPlacement?: 'start' | 'end' | 'none';
13
+ maxDate?: Date | null;
14
+ maxSelections?: number;
15
+ maxRangeSize?: number;
16
+ minDate?: Date | null;
17
+ placeholder?: string;
18
+ rangeIncrement?: number;
19
+ selection?: SelectionVariant;
20
+ view?: '1-month' | '2-month';
21
+ weekStartsOn?: 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday';
22
+ }
23
+ export declare type RangeSelection = {
24
+ from: Date;
25
+ to: Date | null;
26
+ };
27
+ export declare type StringRangeSelection = {
28
+ from: string;
29
+ to: string;
30
+ };
31
+ export interface DatePickerContext {
32
+ disabled?: boolean;
33
+ configuration: DatePickerConfiguration;
34
+ currentViewingDate: Date;
35
+ goToMonth: (date: Date) => void;
36
+ hoverRange?: RangeSelection | null;
37
+ selection?: Selection;
38
+ softSelection?: Partial<RangeSelection> | null;
39
+ selectionActive?: boolean;
40
+ formattedDate: string;
41
+ nextMonth: () => void;
42
+ onClose: () => void;
43
+ onDateInput: (updatedSelection: Selection) => void;
44
+ onDayFocus: (date: Date) => void;
45
+ onSelection: (date: Date) => void;
46
+ previousMonth: () => void;
47
+ revertValue: () => void;
48
+ saveValue: (selection?: Selection) => void;
49
+ }
50
+ export declare type Selection = Date | Array<Date> | RangeSelection | null;
51
+ export declare type StringSelection = string | Array<string> | {
52
+ to: string;
53
+ from: string;
54
+ } | null;
55
+ export declare type DaySelection = boolean | 'start' | 'middle' | 'end';
56
+ declare const useDatePicker: (date?: Date | undefined) => {
57
+ blocked: boolean | undefined;
58
+ disabled: boolean;
59
+ selected: DaySelection;
60
+ today: boolean;
61
+ configuration: DatePickerConfiguration;
62
+ currentViewingDate: Date;
63
+ goToMonth: (date: Date) => void;
64
+ hoverRange?: RangeSelection | null | undefined;
65
+ selection?: Selection | undefined;
66
+ softSelection?: Partial<RangeSelection> | null | undefined;
67
+ selectionActive?: boolean | undefined;
68
+ formattedDate: string;
69
+ nextMonth: () => void;
70
+ onClose: () => void;
71
+ onDateInput: (updatedSelection: Selection) => void;
72
+ onDayFocus: (date: Date) => void;
73
+ onSelection: (date: Date) => void;
74
+ previousMonth: () => void;
75
+ revertValue: () => void;
76
+ saveValue: (selection?: Selection | undefined) => void;
77
+ };
78
+ export default useDatePicker;
79
+ export interface DatePickerProviderProps {
80
+ closePicker?: () => void;
81
+ configuration?: DatePickerConfiguration;
82
+ value?: Selection | StringSelection;
83
+ }
84
+ export declare function isSingleSelection(selection: Selection): selection is Date;
85
+ export declare function isMultiSelection(selection: Selection | StringSelection): selection is Array<Date> | Array<string>;
86
+ export declare function isRangeSelection(selection: Selection | StringSelection): selection is RangeSelection | StringRangeSelection;
87
+ export declare function isStringRangeSelection(selection: StringSelection): selection is StringRangeSelection;
88
+ export declare const DatePickerProvider: React.FC<DatePickerProviderProps>;
@@ -0,0 +1,403 @@
1
+ import { CheckIcon, TrashIcon } from '@primer/octicons-react';
2
+ import { format, isEqual, isAfter, isBefore, addMonths, subMonths, isToday, isWeekend, differenceInDays, addDays, subDays } from 'date-fns';
3
+ import deepmerge from 'deepmerge';
4
+ import React, { createContext, useCallback, useContext, useMemo, useEffect, useState } from 'react';
5
+ import { Text, useConfirm } from '..';
6
+ const DatePickerContext = /*#__PURE__*/createContext(null);
7
+
8
+ const useDatePicker = date => {
9
+ const value = useContext(DatePickerContext);
10
+ const [selected, setSelected] = useState(false);
11
+ const today = date ? isToday(date) : false;
12
+
13
+ if (!value) {
14
+ throw new Error('useDatePicker must be used inside a DatePickerProvider');
15
+ }
16
+
17
+ useEffect(() => {
18
+ if (date) {
19
+ if (value.hoverRange) {
20
+ if (isRangeSelection(value.hoverRange)) {
21
+ if (isEqual(date, value.hoverRange.from)) {
22
+ setSelected('start');
23
+ } else if (value.hoverRange.to && isEqual(date, value.hoverRange.to)) {
24
+ setSelected('end');
25
+ } else if (isAfter(date, value.hoverRange.from) && value.hoverRange.to && isBefore(date, value.hoverRange.to)) {
26
+ setSelected('middle');
27
+ } else {
28
+ setSelected(false);
29
+ }
30
+ }
31
+ } else if (value.selection) {
32
+ if (isMultiSelection(value.selection)) {
33
+ setSelected(!!value.selection.find(d => isEqual(d, date)));
34
+ } else if (isRangeSelection(value.selection)) {
35
+ if (isEqual(date, value.selection.from)) {
36
+ setSelected('start');
37
+ } else if (value.selection.to && isEqual(date, value.selection.to)) {
38
+ setSelected('end');
39
+ } else if (isAfter(date, value.selection.from) && value.selection.to && isBefore(date, value.selection.to)) {
40
+ setSelected('middle');
41
+ } else {
42
+ setSelected(false);
43
+ }
44
+ } else {
45
+ setSelected(isEqual(date, value.selection));
46
+ }
47
+ }
48
+ }
49
+ }, [date, value.hoverRange, value.selection, today]);
50
+ let blocked,
51
+ disabled = false;
52
+
53
+ if (date) {
54
+ // Determine if date is blocked out
55
+ if (value.configuration.blockedDates) {
56
+ blocked = !!value.configuration.blockedDates.find(d => isEqual(d, date));
57
+ } // Determine if date is disabled
58
+
59
+
60
+ if (value.configuration.minDate || value.configuration.maxDate || value.configuration.disableWeekends) {
61
+ disabled = (value.configuration.minDate ? isBefore(date, value.configuration.minDate) : false) || (value.configuration.maxDate ? isAfter(date, value.configuration.maxDate) : false) || (value.configuration.disableWeekends ? isWeekend(date) : false);
62
+ }
63
+ }
64
+
65
+ return { ...value,
66
+ blocked,
67
+ disabled,
68
+ selected,
69
+ today
70
+ };
71
+ };
72
+
73
+ export default useDatePicker;
74
+ export function isSingleSelection(selection) {
75
+ return selection instanceof Date;
76
+ }
77
+ export function isMultiSelection(selection) {
78
+ return Array.isArray(selection);
79
+ }
80
+ export function isRangeSelection(selection) {
81
+ return !!selection.from;
82
+ }
83
+ export function isStringRangeSelection(selection) {
84
+ return !!selection.from;
85
+ }
86
+
87
+ function parseSelection(selection, variant) {
88
+ if (!selection) return;
89
+
90
+ if (variant === 'multi') {
91
+ if (isMultiSelection(selection)) {
92
+ const parsedSelection = [];
93
+
94
+ for (const d of selection) {
95
+ parsedSelection.push(new Date(new Date(d).toDateString()));
96
+ }
97
+
98
+ return parsedSelection.sort((a, b) => a.getTime() - b.getTime());
99
+ } else if (selection instanceof Date) {
100
+ return [new Date(new Date(selection).toDateString())];
101
+ } else if (isRangeSelection(selection)) {
102
+ const parsedSelection = [];
103
+ parsedSelection.push(new Date(new Date(selection.from).toDateString()));
104
+
105
+ if (selection.to) {
106
+ parsedSelection.push(new Date(new Date(selection.to).toDateString()));
107
+ }
108
+
109
+ return parsedSelection.sort((a, b) => a.getTime() - b.getTime());
110
+ }
111
+ } else if (variant === 'range') {
112
+ if (isRangeSelection(selection)) {
113
+ return {
114
+ from: new Date(new Date(selection.from).toDateString()),
115
+ to: selection.to ? new Date(new Date(selection.to).toDateString()) : null
116
+ };
117
+ } else if (isMultiSelection(selection)) {
118
+ return {
119
+ from: new Date(new Date(selection[0]).toDateString()),
120
+ to: selection[1] ? new Date(new Date(selection[1]).toDateString()) : null
121
+ };
122
+ } else if (selection instanceof Date) {
123
+ return {
124
+ from: new Date(new Date(selection).toDateString()),
125
+ to: null
126
+ };
127
+ }
128
+ } else {
129
+ if (selection instanceof Date) {
130
+ return new Date(new Date(selection).toDateString());
131
+ } else if (isMultiSelection(selection)) {
132
+ return new Date(new Date(selection[0]).toDateString());
133
+ } else if (isRangeSelection(selection)) {
134
+ return new Date(new Date(selection.from).toDateString());
135
+ } else {
136
+ return;
137
+ }
138
+ }
139
+ }
140
+
141
+ const defaultConfiguration = {
142
+ anchorVariant: 'button',
143
+ confirmation: false,
144
+ confirmUnsavedClose: false,
145
+ disableWeekends: false,
146
+ iconPlacement: 'start',
147
+ placeholder: 'Select a Date...',
148
+ selection: 'single',
149
+ view: '2-month',
150
+ weekStartsOn: 'Sunday'
151
+ };
152
+ export const DatePickerProvider = ({
153
+ configuration: externalConfig = {},
154
+ children,
155
+ closePicker,
156
+ value
157
+ }) => {
158
+ const [configuration, setConfiguration] = useState(deepmerge(defaultConfiguration, externalConfig));
159
+ const [previousSelection, setPreviousSelection] = useState(parseSelection(value, configuration.selection));
160
+ const [isDirty, setIsDirty] = useState(false);
161
+ const [selection, setSelection] = useState(parseSelection(value, configuration.selection));
162
+ const [hoverRange, setHoverRange] = useState(null);
163
+ const [currentViewingDate, setCurrentViewingDate] = useState(new Date());
164
+ const confirm = useConfirm();
165
+ useEffect(() => {
166
+ setConfiguration(deepmerge(defaultConfiguration, externalConfig));
167
+ setSelection(parseSelection(selection, configuration.selection)); // Don't want this to run every time selection gets updated
168
+ // eslint-disable-next-line react-hooks/exhaustive-deps
169
+ }, [configuration.selection, externalConfig]);
170
+ const goToMonth = useCallback(date => {
171
+ setCurrentViewingDate(new Date(new Date(date).toDateString()));
172
+ }, []);
173
+ const nextMonth = useCallback(() => {
174
+ setCurrentViewingDate(addMonths(currentViewingDate, 1));
175
+ }, [currentViewingDate]);
176
+ const previousMonth = useCallback(() => {
177
+ setCurrentViewingDate(subMonths(currentViewingDate, 1));
178
+ }, [currentViewingDate]);
179
+ const getFormattedDate = useMemo(() => {
180
+ if (!selection) {
181
+ return configuration.placeholder;
182
+ }
183
+
184
+ let template = 'MMM d';
185
+
186
+ if (configuration.anchorVariant !== 'input' && configuration.dateFormat) {
187
+ switch (configuration.dateFormat) {
188
+ case 'short':
189
+ template = 'MMM d';
190
+ break;
191
+
192
+ case 'long':
193
+ template = 'MMM d, yyyy';
194
+ break;
195
+
196
+ default:
197
+ template = configuration.dateFormat;
198
+ break;
199
+ }
200
+ } else {
201
+ template = 'MM/dd/yyyy';
202
+ }
203
+
204
+ switch (configuration.selection) {
205
+ case 'single':
206
+ {
207
+ if (selection instanceof Date) {
208
+ return format(selection, template);
209
+ } else if (Array.isArray(selection)) {
210
+ return format(selection[0], template);
211
+ } else if (isRangeSelection(selection)) {
212
+ return format(selection.from, template);
213
+ } else {
214
+ return 'Invalid Selection';
215
+ }
216
+ }
217
+
218
+ case 'multi':
219
+ {
220
+ if (Array.isArray(selection)) {
221
+ if (selection.length > 3) return `${selection.length} Selected`;
222
+ const formatted = selection.map(d => format(d, template)).join(', ');
223
+ return formatted;
224
+ } else if (selection instanceof Date) {
225
+ return [selection].map(d => format(d, template)).join(', ');
226
+ } else if (isRangeSelection(selection)) {
227
+ return [selection.to, selection.from].map(d => d ? format(d, template) : '').join(', ');
228
+ } else {
229
+ return 'Invalid Selection';
230
+ }
231
+ }
232
+
233
+ case 'range':
234
+ {
235
+ if (isRangeSelection(selection)) {
236
+ return Object.entries(selection).map(([_, date]) => date ? format(date, template) : '').join(' - ');
237
+ } else if (selection instanceof Date) {
238
+ return Object.entries({
239
+ from: selection,
240
+ to: null
241
+ }).map(([_, date]) => date ? format(date, template) : '').join(' - ');
242
+ } else if (Array.isArray(selection)) {
243
+ return Object.entries({
244
+ from: selection[0],
245
+ to: selection[1]
246
+ }) // to date can still be null
247
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
248
+ .map(([_, date]) => date ? format(date, template) : '').join(' - ');
249
+ } else {
250
+ return 'Invalid Selection';
251
+ }
252
+ }
253
+
254
+ default:
255
+ {
256
+ return 'Invalid Configuration';
257
+ }
258
+ }
259
+ }, [configuration.anchorVariant, configuration.dateFormat, configuration.placeholder, configuration.selection, selection]);
260
+ const saveValue = useCallback(updatedSelection => {
261
+ setPreviousSelection(updatedSelection !== null && updatedSelection !== void 0 ? updatedSelection : selection);
262
+ setIsDirty(false);
263
+ closePicker === null || closePicker === void 0 ? void 0 : closePicker();
264
+ }, [closePicker, selection]);
265
+ const revertValue = useCallback(() => {
266
+ setSelection(previousSelection);
267
+ setIsDirty(false);
268
+ }, [previousSelection]);
269
+ const handleClose = useCallback(async () => {
270
+ if (configuration.confirmUnsavedClose) {
271
+ if (isDirty) {
272
+ const result = await confirm({
273
+ title: 'Save Changes?',
274
+ content: 'You have unsaved changes, would you like to save them?',
275
+ confirmButtonContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CheckIcon, null), /*#__PURE__*/React.createElement(Text, {
276
+ sx: {
277
+ ml: 1
278
+ }
279
+ }, "Save")),
280
+ cancelButtonContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TrashIcon, null), /*#__PURE__*/React.createElement(Text, {
281
+ sx: {
282
+ ml: 1
283
+ }
284
+ }, "Discard"))
285
+ });
286
+
287
+ if (result) {
288
+ saveValue();
289
+ } else {
290
+ revertValue();
291
+ }
292
+ }
293
+ } else if (isDirty) revertValue();
294
+ }, [configuration.confirmUnsavedClose, confirm, isDirty, revertValue, saveValue]);
295
+ const inputHandler = useCallback(updatedSelection => {
296
+ // validate date falls within range
297
+ setSelection(updatedSelection);
298
+ }, []);
299
+ const selectionHandler = useCallback(date => {
300
+ setIsDirty(true);
301
+
302
+ if (configuration.selection === 'multi') {
303
+ const selections = [...selection];
304
+ const existingIndex = selections.findIndex(s => isEqual(s, date));
305
+
306
+ if (existingIndex > -1) {
307
+ selections.splice(existingIndex, 1);
308
+ setSelection(selections.sort((a, b) => a.getTime() - b.getTime()));
309
+ } else {
310
+ if (configuration.maxSelections && selections.length + 1 > configuration.maxSelections) return;
311
+ setSelection([...selections, date].sort((a, b) => a.getTime() - b.getTime()));
312
+ }
313
+ } else if (configuration.selection === 'range') {
314
+ if (selection && isRangeSelection(selection) && !selection.to) {
315
+ let toDate = date;
316
+
317
+ if (configuration.maxRangeSize && Math.abs(differenceInDays(selection.from, date)) >= configuration.maxRangeSize) {
318
+ toDate = isBefore(date, selection.from) ? subDays(selection.from, configuration.maxRangeSize - 1) : addDays(selection.from, configuration.maxRangeSize - 1);
319
+ }
320
+
321
+ const updatedSelection = isBefore(toDate, selection.from) ? {
322
+ from: toDate,
323
+ to: selection.from
324
+ } : {
325
+ from: selection.from,
326
+ to: toDate
327
+ };
328
+ setSelection(updatedSelection);
329
+ setHoverRange(null);
330
+
331
+ if (!configuration.confirmation) {
332
+ saveValue(updatedSelection);
333
+ }
334
+ } else {
335
+ setHoverRange({
336
+ from: date,
337
+ to: date
338
+ });
339
+ setSelection({
340
+ from: date,
341
+ to: null
342
+ });
343
+ }
344
+ } else {
345
+ setSelection(date);
346
+
347
+ if (!configuration.confirmation) {
348
+ saveValue(date);
349
+ }
350
+ }
351
+ }, [configuration.confirmation, configuration.maxRangeSize, configuration.maxSelections, configuration.selection, saveValue, selection]);
352
+ const focusHnadler = useCallback(date => {
353
+ if (!selection) return;
354
+ const {
355
+ minDate,
356
+ maxDate,
357
+ maxRangeSize,
358
+ selection: configSelection
359
+ } = configuration;
360
+
361
+ if (configSelection === 'range' && isRangeSelection(selection) && hoverRange) {
362
+ let hoverDate = date;
363
+ if (minDate) hoverDate = isBefore(date, minDate) ? minDate : hoverDate;
364
+ if (maxDate) hoverDate = isAfter(date, maxDate) ? maxDate : hoverDate;
365
+
366
+ if (maxRangeSize && Math.abs(differenceInDays(selection.from, hoverDate)) >= maxRangeSize) {
367
+ hoverDate = isBefore(hoverDate, selection.from) ? subDays(selection.from, configuration.maxRangeSize - 1) : addDays(selection.from, configuration.maxRangeSize - 1);
368
+ }
369
+
370
+ setHoverRange(isBefore(hoverDate, selection.from) ? {
371
+ from: hoverDate,
372
+ to: selection.from
373
+ } : {
374
+ from: selection.from,
375
+ to: hoverDate
376
+ });
377
+ }
378
+ }, [configuration, hoverRange, selection]);
379
+ const datePickerCtx = useMemo(() => {
380
+ return {
381
+ configuration,
382
+ currentViewingDate,
383
+ disabled: false,
384
+ formattedDate: getFormattedDate,
385
+ goToMonth,
386
+ hoverRange,
387
+ nextMonth,
388
+ onClose: handleClose,
389
+ onDateInput: inputHandler,
390
+ onDayFocus: focusHnadler,
391
+ onSelection: selectionHandler,
392
+ previousMonth,
393
+ revertValue,
394
+ saveValue,
395
+ selectionActive: false,
396
+ selection
397
+ };
398
+ }, [configuration, currentViewingDate, focusHnadler, getFormattedDate, goToMonth, handleClose, hoverRange, inputHandler, nextMonth, previousMonth, revertValue, saveValue, selection, selectionHandler]);
399
+ return /*#__PURE__*/React.createElement(DatePickerContext.Provider, {
400
+ value: datePickerCtx
401
+ }, children);
402
+ };
403
+ DatePickerProvider.displayName = "DatePickerProvider";
@@ -32,12 +32,14 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
32
32
  Divider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
33
33
  Filter: React.ForwardRefExoticComponent<Pick<{
34
34
  value?: string | undefined;
35
- } & Pick<Omit<Pick<{
35
+ } & Pick<Omit<Pick<({
36
36
  [x: string]: any;
37
37
  [x: number]: any;
38
38
  } & {
39
39
  theme?: any;
40
- } & {
40
+ } & ({} | {
41
+ children?: React.ReactNode;
42
+ })) & {
41
43
  as?: string | React.ComponentType<any> | undefined;
42
44
  forwardedAs?: string | React.ComponentType<any> | undefined;
43
45
  }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
@@ -32,16 +32,14 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
32
32
  * Whether the remove buttons should be rendered in the tokens
33
33
  */
34
34
  hideTokenRemoveButtons?: boolean | undefined;
35
- /**
36
- * The number of tokens to display before truncating
37
- */
38
- visibleTokenCount?: number | undefined;
39
- } & Pick<Omit<Pick<{
35
+ } & Pick<Omit<Pick<({
40
36
  [x: string]: any;
41
37
  [x: number]: any;
42
38
  } & {
43
39
  theme?: any;
44
- } & {
40
+ } & ({} | {
41
+ children?: React.ReactNode;
42
+ })) & {
45
43
  as?: string | React.ComponentType<any> | undefined;
46
44
  forwardedAs?: string | React.ComponentType<any> | undefined;
47
45
  }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {