@coinbase/cds-web 8.53.0 → 8.54.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 +12 -0
- package/dts/dates/Calendar.d.ts +67 -10
- package/dts/dates/Calendar.d.ts.map +1 -1
- package/dts/dates/DatePicker.d.ts +186 -111
- package/dts/dates/DatePicker.d.ts.map +1 -1
- package/dts/overlays/tray/Tray.d.ts +4 -0
- package/dts/overlays/tray/Tray.d.ts.map +1 -1
- package/esm/dates/Calendar.js +54 -14
- package/esm/dates/DatePicker.js +31 -8
- package/esm/media/RemoteImageGroup.js +1 -1
- package/esm/overlays/tray/Tray.js +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 8.54.0 (3/18/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Add component styling, improve a11y for Calendar and DatePicker. [[#139](https://github.com/coinbase/cds/pull/139)]
|
|
16
|
+
|
|
17
|
+
## 8.53.1 (3/17/2026 PST)
|
|
18
|
+
|
|
19
|
+
#### 🐞 Fixes
|
|
20
|
+
|
|
21
|
+
- Fix: update RemoteImageGroup excess bg color. [[#512](https://github.com/coinbase/cds/pull/512)]
|
|
22
|
+
|
|
11
23
|
## 8.53.0 (3/16/2026 PST)
|
|
12
24
|
|
|
13
25
|
#### 🚀 Updates
|
package/dts/dates/Calendar.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Polymorphic } from '../core/polymorphism';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type VStackBaseProps,
|
|
5
|
+
type VStackDefaultElement,
|
|
6
|
+
type VStackProps,
|
|
7
|
+
} from '../layout/VStack';
|
|
4
8
|
import { type PressableBaseProps } from '../system/Pressable';
|
|
9
|
+
import type { StylesAndClassNames } from '../types';
|
|
5
10
|
export declare const calendarPressableDefaultElement = 'button';
|
|
6
11
|
export type CalendarPressableDefaultElement = typeof calendarPressableDefaultElement;
|
|
7
12
|
export type CalendarPressableBaseProps = PressableBaseProps;
|
|
@@ -26,8 +31,14 @@ export type CalendarDayProps = {
|
|
|
26
31
|
isCurrentMonth?: boolean;
|
|
27
32
|
/** Tooltip content shown when hovering or focusing a disabled Calendar Day. */
|
|
28
33
|
disabledError?: string;
|
|
34
|
+
/** Accessibility hint announced for highlighted dates. */
|
|
35
|
+
highlightedDateAccessibilityHint?: string;
|
|
36
|
+
/** Custom class name for the date cell (CalendarPressable). */
|
|
37
|
+
className?: string;
|
|
38
|
+
/** Custom style for the date cell (CalendarPressable). */
|
|
39
|
+
style?: React.CSSProperties;
|
|
29
40
|
};
|
|
30
|
-
export type
|
|
41
|
+
export type CalendarBaseProps = Omit<VStackBaseProps, 'children'> & {
|
|
31
42
|
/** Currently selected Calendar date. Date used to generate the Calendar month. Will be rendered with active styles. */
|
|
32
43
|
selectedDate?: Date | null;
|
|
33
44
|
/** Date used to generate the Calendar month when there is no value for the `selectedDate` prop, defaults to today. */
|
|
@@ -61,12 +72,39 @@ export type CalendarProps = {
|
|
|
61
72
|
* @default 'Go to previous month'
|
|
62
73
|
*/
|
|
63
74
|
previousArrowAccessibilityLabel?: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Accessibility hint announced for highlighted dates. Applied to all highlighted dates.
|
|
77
|
+
* @default 'Highlighted'
|
|
78
|
+
*/
|
|
79
|
+
highlightedDateAccessibilityHint?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Static class names for Calendar component parts.
|
|
83
|
+
* Use these selectors to target specific elements with CSS.
|
|
84
|
+
*/
|
|
85
|
+
export declare const calendarClassNames: {
|
|
86
|
+
/** Root element */
|
|
87
|
+
readonly root: 'cds-Calendar';
|
|
88
|
+
/** Header section */
|
|
89
|
+
readonly header: 'cds-Calendar-header';
|
|
90
|
+
/** Month and year title text element */
|
|
91
|
+
readonly title: 'cds-Calendar-title';
|
|
92
|
+
/** Navigation controls element */
|
|
93
|
+
readonly navigation: 'cds-Calendar-navigation';
|
|
94
|
+
/** Main content area */
|
|
95
|
+
readonly content: 'cds-Calendar-content';
|
|
96
|
+
/** Individual date cell in a calendar grid */
|
|
97
|
+
readonly day: 'cds-Calendar-day';
|
|
98
|
+
};
|
|
99
|
+
export type CalendarProps = CalendarBaseProps &
|
|
100
|
+
StylesAndClassNames<typeof calendarClassNames> &
|
|
101
|
+
Omit<VStackProps<VStackDefaultElement>, 'children' | 'ref'> & {
|
|
102
|
+
className?: string;
|
|
103
|
+
style?: React.CSSProperties;
|
|
104
|
+
};
|
|
67
105
|
export declare const Calendar: React.MemoExoticComponent<
|
|
68
106
|
React.ForwardRefExoticComponent<
|
|
69
|
-
{
|
|
107
|
+
Omit<import('../layout').BoxBaseProps, 'children'> & {
|
|
70
108
|
/** Currently selected Calendar date. Date used to generate the Calendar month. Will be rendered with active styles. */
|
|
71
109
|
selectedDate?: Date | null;
|
|
72
110
|
/** Date used to generate the Calendar month when there is no value for the `selectedDate` prop, defaults to today. */
|
|
@@ -100,10 +138,29 @@ export declare const Calendar: React.MemoExoticComponent<
|
|
|
100
138
|
* @default 'Go to previous month'
|
|
101
139
|
*/
|
|
102
140
|
previousArrowAccessibilityLabel?: string;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Accessibility hint announced for highlighted dates. Applied to all highlighted dates.
|
|
143
|
+
* @default 'Highlighted'
|
|
144
|
+
*/
|
|
145
|
+
highlightedDateAccessibilityHint?: string;
|
|
146
|
+
} & StylesAndClassNames<{
|
|
147
|
+
/** Root element */
|
|
148
|
+
readonly root: 'cds-Calendar';
|
|
149
|
+
/** Header section */
|
|
150
|
+
readonly header: 'cds-Calendar-header';
|
|
151
|
+
/** Month and year title text element */
|
|
152
|
+
readonly title: 'cds-Calendar-title';
|
|
153
|
+
/** Navigation controls element */
|
|
154
|
+
readonly navigation: 'cds-Calendar-navigation';
|
|
155
|
+
/** Main content area */
|
|
156
|
+
readonly content: 'cds-Calendar-content';
|
|
157
|
+
/** Individual date cell in a calendar grid */
|
|
158
|
+
readonly day: 'cds-Calendar-day';
|
|
159
|
+
}> &
|
|
160
|
+
Omit<VStackProps<'div'>, 'ref' | 'children'> & {
|
|
161
|
+
className?: string;
|
|
162
|
+
style?: React.CSSProperties;
|
|
163
|
+
} & React.RefAttributes<HTMLElement>
|
|
107
164
|
>
|
|
108
165
|
>;
|
|
109
166
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/dates/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,OAAO,
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/dates/Calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAa,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAWpD,eAAO,MAAM,+BAA+B,WAAW,CAAC;AAExD,MAAM,MAAM,+BAA+B,GAAG,OAAO,+BAA+B,CAAC;AAErF,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE5D,MA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C,EAAE;IAC1C,0JAA0J;cAChJ,IAAI;IACd,wJAAwJ;cAC9I,IAAI;IACd;;;OAGG;wBACiB,MAAM;IAC1B;;;OAGG;kCAC2B,MAAM;IACpC;;;OAGG;sCAC+B,MAAM;IACxC;;;OAGG;uCACgC,MAAM;;IAQzC,mBAAmB;;IAEnB,qBAAqB;;IAErB,wCAAwC;;IAExC,kCAAkC;;IAElC,wBAAwB;;IAExB,8CAA8C;;;gBAqGhC,MAAM;YACV,KAAK,CAAC,aAAa;sCAiR9B,CAAC"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DateInputValidationError } from '@coinbase/cds-common/dates/DateInputValidationError';
|
|
2
2
|
import { type PopoverProps } from '../overlays/popover/PopoverProps';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CalendarBaseProps } from './Calendar';
|
|
4
4
|
import { type DateInputProps } from './DateInput';
|
|
5
|
-
export type
|
|
5
|
+
export type DatePickerBaseProps = Pick<
|
|
6
|
+
CalendarBaseProps,
|
|
7
|
+
| 'disabled'
|
|
8
|
+
| 'disabledDates'
|
|
9
|
+
| 'disabledDateError'
|
|
10
|
+
| 'highlightedDateAccessibilityHint'
|
|
11
|
+
| 'highlightedDates'
|
|
12
|
+
| 'maxDate'
|
|
13
|
+
| 'minDate'
|
|
14
|
+
| 'nextArrowAccessibilityLabel'
|
|
15
|
+
| 'previousArrowAccessibilityLabel'
|
|
16
|
+
| 'seedDate'
|
|
17
|
+
> & {
|
|
6
18
|
/** Control the date value of the DatePicker. */
|
|
7
19
|
date: Date | null;
|
|
8
20
|
/** Callback function fired when the date changes, e.g. when a valid date is selected or unselected. */
|
|
@@ -11,72 +23,111 @@ export type DatePickerProps = {
|
|
|
11
23
|
error: DateInputValidationError | null;
|
|
12
24
|
/** Callback function fired when validation finds an error, e.g. required input fields and impossible or disabled dates. Will always be called after `onChangeDate`. */
|
|
13
25
|
onErrorDate: (error: DateInputValidationError | null) => void;
|
|
14
|
-
/**
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** Array of disabled dates, and date tuples for date ranges. Make sure to set `disabledDateError` as well. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges. */
|
|
17
|
-
disabledDates?: (Date | [Date, Date])[];
|
|
18
|
-
/** Minimum date allowed to be selected, inclusive. Dates before the `minDate` are disabled. All navigation to months before the `minDate` is disabled. */
|
|
19
|
-
minDate?: Date;
|
|
20
|
-
/** Maximum date allowed to be selected, inclusive. Dates after the `maxDate` are disabled. All navigation to months after the `maxDate` is disabled. */
|
|
21
|
-
maxDate?: Date;
|
|
22
|
-
/**
|
|
23
|
-
* Error text to display when a disabled date is selected with the DateInput, including dates before the `minDate` or after the `maxDate`. Also used as the tooltip content shown when hovering or focusing a disabled date on the Calendar.
|
|
24
|
-
* @default 'Date unavailable'
|
|
25
|
-
*/
|
|
26
|
-
disabledDateError?: string;
|
|
27
|
-
/** Control the default open state of the Calendar popover. */
|
|
28
|
-
defaultOpen?: boolean;
|
|
29
|
-
/** Callback function fired when the DateInput text value changes. Prefer to use `onChangeDate` instead. Will always be called before `onChangeDate`. This prop should only be used for edge cases, such as custom error handling. */
|
|
30
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
/** Callback function fired when the Calendar popover is opened. */
|
|
26
|
+
/** Callback function fired when the picker is opened. */
|
|
32
27
|
onOpen?: () => void;
|
|
33
|
-
/** Callback function fired when the
|
|
28
|
+
/** Callback function fired when the picker is closed. Will always be called after `onCancel`, `onConfirm`, and `onChangeDate`. */
|
|
34
29
|
onClose?: () => void;
|
|
35
|
-
/** Callback function fired when the user selects a date using the
|
|
30
|
+
/** Callback function fired when the user selects a date using the picker. Interacting with the DateInput does not fire this callback. Will always be called before `onClose`. */
|
|
36
31
|
onConfirm?: () => void;
|
|
37
|
-
/** Callback function fired when the user closes the
|
|
32
|
+
/** Callback function fired when the user closes the picker without selecting a date. Interacting with the DateInput does not fire this callback. Will always be called before `onClose`. */
|
|
38
33
|
onCancel?: () => void;
|
|
39
|
-
/**
|
|
40
|
-
* If `true`, the focus trap will restore focus to the previously focused element when it unmounts.
|
|
41
|
-
*
|
|
42
|
-
* WARNING: If you disable this, you need to ensure that focus is restored properly so it doesn't end up on the body
|
|
43
|
-
* @default true
|
|
44
|
-
*/
|
|
45
|
-
restoreFocusOnUnmount?: boolean;
|
|
46
34
|
/**
|
|
47
35
|
* Accessibility label describing the calendar IconButton, which opens the calendar when pressed.
|
|
48
|
-
* @
|
|
36
|
+
* @deprecated Use openCalendarAccessibilityLabel/closeCalendarAccessibilityLabel instead
|
|
49
37
|
*/
|
|
50
38
|
calendarIconButtonAccessibilityLabel?: string;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
| '
|
|
70
|
-
| '
|
|
71
|
-
| '
|
|
72
|
-
| '
|
|
39
|
+
/**
|
|
40
|
+
* Accessibility label for the calendar IconButton when the popover is closed (opens the calendar when pressed).
|
|
41
|
+
* @default 'Open calendar'
|
|
42
|
+
*/
|
|
43
|
+
openCalendarAccessibilityLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Accessibility label for the calendar IconButton when the popover is open (closes the calendar when pressed).
|
|
46
|
+
* @default 'Close calendar'
|
|
47
|
+
*/
|
|
48
|
+
closeCalendarAccessibilityLabel?: string;
|
|
49
|
+
};
|
|
50
|
+
export type DatePickerProps = DatePickerBaseProps &
|
|
51
|
+
Pick<PopoverProps, 'showOverlay'> &
|
|
52
|
+
Omit<
|
|
53
|
+
DateInputProps,
|
|
54
|
+
| 'date'
|
|
55
|
+
| 'separator'
|
|
56
|
+
| 'onChangeDate'
|
|
57
|
+
| 'disabledDates'
|
|
58
|
+
| 'minDate'
|
|
59
|
+
| 'maxDate'
|
|
60
|
+
| 'disabledDateError'
|
|
73
61
|
| 'className'
|
|
74
62
|
| 'style'
|
|
75
|
-
> &
|
|
76
|
-
|
|
63
|
+
> & {
|
|
64
|
+
/** Control the default open state of the Calendar popover. */
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
/** Callback function fired when the DateInput text value changes. Prefer to use `onChangeDate` instead. Will always be called before `onChangeDate`. This prop should only be used for edge cases, such as custom error handling. */
|
|
67
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* If `true`, the focus trap will restore focus to the previously focused element when it unmounts.
|
|
70
|
+
*
|
|
71
|
+
* WARNING: If you disable this, you need to ensure that focus is restored properly so it doesn't end up on the body
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
restoreFocusOnUnmount?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Custom style to apply to the Calendar container.
|
|
77
|
+
* @deprecated Use `styles.calendar` instead.
|
|
78
|
+
*/
|
|
79
|
+
calendarStyle?: React.CSSProperties;
|
|
80
|
+
/**
|
|
81
|
+
* Custom class name to apply to the Calendar container.
|
|
82
|
+
* @deprecated Use `classNames.calendar` instead.
|
|
83
|
+
*/
|
|
84
|
+
calendarClassName?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Custom style to apply to the DateInput.
|
|
87
|
+
* @deprecated Use `styles.dateInput` instead.
|
|
88
|
+
*/
|
|
89
|
+
dateInputStyle?: React.CSSProperties;
|
|
90
|
+
/**
|
|
91
|
+
* Custom class name to apply to the DateInput.
|
|
92
|
+
* @deprecated Use `classNames.dateInput` instead.
|
|
93
|
+
*/
|
|
94
|
+
dateInputClassName?: string;
|
|
95
|
+
/** Custom class names for the DateInput and Calendar subcomponents. */
|
|
96
|
+
classNames?: {
|
|
97
|
+
dateInput?: string;
|
|
98
|
+
calendar?: string;
|
|
99
|
+
calendarHeader?: string;
|
|
100
|
+
calendarTitle?: string;
|
|
101
|
+
calendarNavigation?: string;
|
|
102
|
+
calendarContent?: string;
|
|
103
|
+
calendarDay?: string;
|
|
104
|
+
};
|
|
105
|
+
/** Custom styles for the DateInput and Calendar subcomponents. */
|
|
106
|
+
styles?: {
|
|
107
|
+
dateInput?: React.CSSProperties;
|
|
108
|
+
calendar?: React.CSSProperties;
|
|
109
|
+
calendarHeader?: React.CSSProperties;
|
|
110
|
+
calendarTitle?: React.CSSProperties;
|
|
111
|
+
calendarNavigation?: React.CSSProperties;
|
|
112
|
+
calendarContent?: React.CSSProperties;
|
|
113
|
+
calendarDay?: React.CSSProperties;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
77
116
|
export declare const DatePicker: import('react').MemoExoticComponent<
|
|
78
117
|
import('react').ForwardRefExoticComponent<
|
|
79
|
-
|
|
118
|
+
Pick<
|
|
119
|
+
CalendarBaseProps,
|
|
120
|
+
| 'disabled'
|
|
121
|
+
| 'previousArrowAccessibilityLabel'
|
|
122
|
+
| 'nextArrowAccessibilityLabel'
|
|
123
|
+
| 'highlightedDateAccessibilityHint'
|
|
124
|
+
| 'seedDate'
|
|
125
|
+
| 'disabledDates'
|
|
126
|
+
| 'highlightedDates'
|
|
127
|
+
| 'minDate'
|
|
128
|
+
| 'maxDate'
|
|
129
|
+
| 'disabledDateError'
|
|
130
|
+
> & {
|
|
80
131
|
/** Control the date value of the DatePicker. */
|
|
81
132
|
date: Date | null;
|
|
82
133
|
/** Callback function fired when the date changes, e.g. when a valid date is selected or unselected. */
|
|
@@ -85,70 +136,94 @@ export declare const DatePicker: import('react').MemoExoticComponent<
|
|
|
85
136
|
error: DateInputValidationError | null;
|
|
86
137
|
/** Callback function fired when validation finds an error, e.g. required input fields and impossible or disabled dates. Will always be called after `onChangeDate`. */
|
|
87
138
|
onErrorDate: (error: DateInputValidationError | null) => void;
|
|
88
|
-
/**
|
|
89
|
-
disabled?: boolean;
|
|
90
|
-
/** Array of disabled dates, and date tuples for date ranges. Make sure to set `disabledDateError` as well. A number is created for every individual date within a tuple range, so do not abuse this with massive ranges. */
|
|
91
|
-
disabledDates?: (Date | [Date, Date])[];
|
|
92
|
-
/** Minimum date allowed to be selected, inclusive. Dates before the `minDate` are disabled. All navigation to months before the `minDate` is disabled. */
|
|
93
|
-
minDate?: Date;
|
|
94
|
-
/** Maximum date allowed to be selected, inclusive. Dates after the `maxDate` are disabled. All navigation to months after the `maxDate` is disabled. */
|
|
95
|
-
maxDate?: Date;
|
|
96
|
-
/**
|
|
97
|
-
* Error text to display when a disabled date is selected with the DateInput, including dates before the `minDate` or after the `maxDate`. Also used as the tooltip content shown when hovering or focusing a disabled date on the Calendar.
|
|
98
|
-
* @default 'Date unavailable'
|
|
99
|
-
*/
|
|
100
|
-
disabledDateError?: string;
|
|
101
|
-
/** Control the default open state of the Calendar popover. */
|
|
102
|
-
defaultOpen?: boolean;
|
|
103
|
-
/** Callback function fired when the DateInput text value changes. Prefer to use `onChangeDate` instead. Will always be called before `onChangeDate`. This prop should only be used for edge cases, such as custom error handling. */
|
|
104
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
105
|
-
/** Callback function fired when the Calendar popover is opened. */
|
|
139
|
+
/** Callback function fired when the picker is opened. */
|
|
106
140
|
onOpen?: () => void;
|
|
107
|
-
/** Callback function fired when the
|
|
141
|
+
/** Callback function fired when the picker is closed. Will always be called after `onCancel`, `onConfirm`, and `onChangeDate`. */
|
|
108
142
|
onClose?: () => void;
|
|
109
|
-
/** Callback function fired when the user selects a date using the
|
|
143
|
+
/** Callback function fired when the user selects a date using the picker. Interacting with the DateInput does not fire this callback. Will always be called before `onClose`. */
|
|
110
144
|
onConfirm?: () => void;
|
|
111
|
-
/** Callback function fired when the user closes the
|
|
145
|
+
/** Callback function fired when the user closes the picker without selecting a date. Interacting with the DateInput does not fire this callback. Will always be called before `onClose`. */
|
|
112
146
|
onCancel?: () => void;
|
|
113
|
-
/**
|
|
114
|
-
* If `true`, the focus trap will restore focus to the previously focused element when it unmounts.
|
|
115
|
-
*
|
|
116
|
-
* WARNING: If you disable this, you need to ensure that focus is restored properly so it doesn't end up on the body
|
|
117
|
-
* @default true
|
|
118
|
-
*/
|
|
119
|
-
restoreFocusOnUnmount?: boolean;
|
|
120
147
|
/**
|
|
121
148
|
* Accessibility label describing the calendar IconButton, which opens the calendar when pressed.
|
|
122
|
-
* @
|
|
149
|
+
* @deprecated Use openCalendarAccessibilityLabel/closeCalendarAccessibilityLabel instead
|
|
123
150
|
*/
|
|
124
151
|
calendarIconButtonAccessibilityLabel?: string;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
| 'disabledDateError'
|
|
139
|
-
| 'onChangeDate'
|
|
140
|
-
> &
|
|
141
|
-
Pick<
|
|
142
|
-
CalendarProps,
|
|
152
|
+
/**
|
|
153
|
+
* Accessibility label for the calendar IconButton when the popover is closed (opens the calendar when pressed).
|
|
154
|
+
* @default 'Open calendar'
|
|
155
|
+
*/
|
|
156
|
+
openCalendarAccessibilityLabel?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Accessibility label for the calendar IconButton when the popover is open (closes the calendar when pressed).
|
|
159
|
+
* @default 'Close calendar'
|
|
160
|
+
*/
|
|
161
|
+
closeCalendarAccessibilityLabel?: string;
|
|
162
|
+
} & Pick<PopoverProps, 'showOverlay'> &
|
|
163
|
+
Omit<
|
|
164
|
+
DateInputProps,
|
|
143
165
|
| 'style'
|
|
144
166
|
| 'className'
|
|
145
|
-
| '
|
|
146
|
-
| '
|
|
147
|
-
| '
|
|
148
|
-
| '
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
167
|
+
| 'separator'
|
|
168
|
+
| 'date'
|
|
169
|
+
| 'disabledDates'
|
|
170
|
+
| 'minDate'
|
|
171
|
+
| 'maxDate'
|
|
172
|
+
| 'disabledDateError'
|
|
173
|
+
| 'onChangeDate'
|
|
174
|
+
> & {
|
|
175
|
+
/** Control the default open state of the Calendar popover. */
|
|
176
|
+
defaultOpen?: boolean;
|
|
177
|
+
/** Callback function fired when the DateInput text value changes. Prefer to use `onChangeDate` instead. Will always be called before `onChangeDate`. This prop should only be used for edge cases, such as custom error handling. */
|
|
178
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
179
|
+
/**
|
|
180
|
+
* If `true`, the focus trap will restore focus to the previously focused element when it unmounts.
|
|
181
|
+
*
|
|
182
|
+
* WARNING: If you disable this, you need to ensure that focus is restored properly so it doesn't end up on the body
|
|
183
|
+
* @default true
|
|
184
|
+
*/
|
|
185
|
+
restoreFocusOnUnmount?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Custom style to apply to the Calendar container.
|
|
188
|
+
* @deprecated Use `styles.calendar` instead.
|
|
189
|
+
*/
|
|
190
|
+
calendarStyle?: React.CSSProperties;
|
|
191
|
+
/**
|
|
192
|
+
* Custom class name to apply to the Calendar container.
|
|
193
|
+
* @deprecated Use `classNames.calendar` instead.
|
|
194
|
+
*/
|
|
195
|
+
calendarClassName?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Custom style to apply to the DateInput.
|
|
198
|
+
* @deprecated Use `styles.dateInput` instead.
|
|
199
|
+
*/
|
|
200
|
+
dateInputStyle?: React.CSSProperties;
|
|
201
|
+
/**
|
|
202
|
+
* Custom class name to apply to the DateInput.
|
|
203
|
+
* @deprecated Use `classNames.dateInput` instead.
|
|
204
|
+
*/
|
|
205
|
+
dateInputClassName?: string;
|
|
206
|
+
/** Custom class names for the DateInput and Calendar subcomponents. */
|
|
207
|
+
classNames?: {
|
|
208
|
+
dateInput?: string;
|
|
209
|
+
calendar?: string;
|
|
210
|
+
calendarHeader?: string;
|
|
211
|
+
calendarTitle?: string;
|
|
212
|
+
calendarNavigation?: string;
|
|
213
|
+
calendarContent?: string;
|
|
214
|
+
calendarDay?: string;
|
|
215
|
+
};
|
|
216
|
+
/** Custom styles for the DateInput and Calendar subcomponents. */
|
|
217
|
+
styles?: {
|
|
218
|
+
dateInput?: React.CSSProperties;
|
|
219
|
+
calendar?: React.CSSProperties;
|
|
220
|
+
calendarHeader?: React.CSSProperties;
|
|
221
|
+
calendarTitle?: React.CSSProperties;
|
|
222
|
+
calendarNavigation?: React.CSSProperties;
|
|
223
|
+
calendarContent?: React.CSSProperties;
|
|
224
|
+
calendarDay?: React.CSSProperties;
|
|
225
|
+
};
|
|
226
|
+
} & import('react').RefAttributes<HTMLDivElement>
|
|
152
227
|
>
|
|
153
228
|
>;
|
|
154
229
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/dates/DatePicker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/dates/DatePicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAUpG,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,iBAAiB,EACf,UAAU,GACV,eAAe,GACf,mBAAmB,GACnB,kCAAkC,GAClC,kBAAkB,GAClB,SAAS,GACT,SAAS,GACT,6BAA6B,GAC7B,iCAAiC,GACjC,UAAU,CACb,GAAG;IACF,gDAAgD;IAChD,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,uGAAuG;IACvG,YAAY,EAAE,CAAC,YAAY,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,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AAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI;IAC/D;;;;;OAKG;4BACqB,OAAO;IAC/B;;;OAGG;oBACa,KAAK,CAAC,aAAa;IACnC;;;OAGG;wBACiB,MAAM;IAC1B;;;OAGG;qBACc,KAAK,CAAC,aAAa;IACpC;;;OAGG;yBACkB,MAAM;IAC3B,uEAAuE;iBAC1D;QACX,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IACD,kEAAkE;aACzD;QACP,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC/B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACrC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACzC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QACtC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KACnC;mDAiSJ,CAAC"}
|
|
@@ -51,6 +51,8 @@ export type TrayBaseProps = Pick<
|
|
|
51
51
|
onClose?: () => void;
|
|
52
52
|
/** Action that will happen when tray is dismissed */
|
|
53
53
|
onCloseComplete: () => void;
|
|
54
|
+
/** Callback fired when the open animation completes. */
|
|
55
|
+
onOpenComplete?: () => void;
|
|
54
56
|
/**
|
|
55
57
|
* Optional callback that, if provided, will be triggered when the Tray is toggled open/ closed
|
|
56
58
|
* If used for analytics, context ('visible' | 'hidden') can be bundled with the event info to track whether the
|
|
@@ -146,6 +148,8 @@ export declare const Tray: React.MemoExoticComponent<
|
|
|
146
148
|
onClose?: () => void;
|
|
147
149
|
/** Action that will happen when tray is dismissed */
|
|
148
150
|
onCloseComplete: () => void;
|
|
151
|
+
/** Callback fired when the open animation completes. */
|
|
152
|
+
onOpenComplete?: () => void;
|
|
149
153
|
/**
|
|
150
154
|
* Optional callback that, if provided, will be triggered when the Tray is toggled open/ closed
|
|
151
155
|
* If used for analytics, context ('visible' | 'hidden') can be bundled with the event info to track whether the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tray.d.ts","sourceRoot":"","sources":["../../../src/overlays/tray/Tray.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAa,MAAM,sBAAsB,CAAC;AA2BlG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAkE9D;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,6BAA6B;;IAE7B,+BAA+B;;IAE/B,yCAAyC;;IAEzC,6BAA6B;;IAE7B,yBAAyB;;IAEzB,2BAA2B;;IAE3B,iGAAiG;;IAEjG,iGAAiG;;IAEjG,2BAA2B;;CAEnB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,EAAE,CAAC;IAAE,WAAW,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,EACd,uBAAuB,GAAG,2BAA2B,CACtD,GAAG;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,kBAAkB,CAAC;IAChD,gHAAgH;IAChH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,kBAAkB,CAAC;IAC9C,gHAAgH;IAChH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,kBAAkB,CA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S,GAAG,kBAAkB;IAC7C,gHAAgH;aACvG,KAAK,CAAC,SAAS,GAAG,kBAAkB;IAC7C,2BAA2B;SACtB,MAAM;IACX;;;OAGG;UACG,gBAAgB;IACtB,oEAAoE;aAC3D,MAAM,IAAI;IACnB,qDAAqD;cAC3C,MAAM,IAAI;IACpB,qDAAqD;qBACpC,MAAM,IAAI;IAC3B,wDAAwD;qBACvC,MAAM,IAAI;IAC3B;;;;OAIG;yBACkB,CAAC,OAAO,EAAE,SAAS,GAAG,QAAQ,KAAK,IAAI;IAC5D;;;OAGG;qBACc,OAAO;IACxB;;;OAGG;sBACe,OAAO;IACzB;;;OAGG;WACI,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC;IACxD,gDAAgD;YACxC,KAAK,CAAC,SAAS;IACvB;;;;;OAKG;qCAC8B,MAAM;IACvC,mCAAmC;aAC1B,MAAM;IACf;;;OAGG;mBACY,OAAO;IACtB;;;OAGG;4BACqB,OAAO;IAC/B;;;;;;OAMG;8BACuB,wBAAwB,CAAC,oBAAoB,CAAC;IACxE;;;;;;;OAOG;6BACsB,wBAAwB,CAAC,mBAAmB,CAAC;IACtE;;;;;;;;OAQG;oBACa,OAAO;;IAlHvB,6BAA6B;;IAE7B,+BAA+B;;IAE/B,yCAAyC;;IAEzC,6BAA6B;;IAE7B,yBAAyB;;IAEzB,2BAA2B;;IAE3B,iGAAiG;;IAEjG,iGAAiG;;IAEjG,2BAA2B;;wCAkf5B,CAAC"}
|
package/esm/dates/Calendar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _excluded = ["as", "className", "borderRadius", "width", "height", "background", "children"],
|
|
2
|
-
_excluded2 = ["selectedDate", "seedDate", "onPressDate", "disabled", "hideControls", "disabledDates", "highlightedDates", "minDate", "maxDate", "disabledDateError", "className", "style", "nextArrowAccessibilityLabel", "previousArrowAccessibilityLabel"];
|
|
2
|
+
_excluded2 = ["selectedDate", "seedDate", "onPressDate", "disabled", "hideControls", "disabledDates", "highlightedDates", "minDate", "maxDate", "disabledDateError", "className", "style", "classNames", "styles", "nextArrowAccessibilityLabel", "previousArrowAccessibilityLabel", "highlightedDateAccessibilityHint"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -23,6 +23,7 @@ import { Tooltip } from '../overlays/tooltip/Tooltip';
|
|
|
23
23
|
import { Pressable } from '../system/Pressable';
|
|
24
24
|
import { Text } from '../typography/Text';
|
|
25
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const CALENDAR_DAY_DIMENSION = 40;
|
|
26
27
|
const pressableCss = "pressableCss-pb7kwm3";
|
|
27
28
|
export const calendarPressableDefaultElement = 'button';
|
|
28
29
|
const CalendarPressable = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -30,8 +31,8 @@ const CalendarPressable = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
30
31
|
as,
|
|
31
32
|
className,
|
|
32
33
|
borderRadius = 1000,
|
|
33
|
-
width =
|
|
34
|
-
height =
|
|
34
|
+
width = CALENDAR_DAY_DIMENSION,
|
|
35
|
+
height = CALENDAR_DAY_DIMENSION,
|
|
35
36
|
background = 'transparent',
|
|
36
37
|
children
|
|
37
38
|
} = _ref,
|
|
@@ -49,6 +50,24 @@ const CalendarPressable = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
49
50
|
children: children
|
|
50
51
|
}));
|
|
51
52
|
}));
|
|
53
|
+
/**
|
|
54
|
+
* Static class names for Calendar component parts.
|
|
55
|
+
* Use these selectors to target specific elements with CSS.
|
|
56
|
+
*/
|
|
57
|
+
export const calendarClassNames = {
|
|
58
|
+
/** Root element */
|
|
59
|
+
root: 'cds-Calendar',
|
|
60
|
+
/** Header section */
|
|
61
|
+
header: 'cds-Calendar-header',
|
|
62
|
+
/** Month and year title text element */
|
|
63
|
+
title: 'cds-Calendar-title',
|
|
64
|
+
/** Navigation controls element */
|
|
65
|
+
navigation: 'cds-Calendar-navigation',
|
|
66
|
+
/** Main content area */
|
|
67
|
+
content: 'cds-Calendar-content',
|
|
68
|
+
/** Individual date cell in a calendar grid */
|
|
69
|
+
day: 'cds-Calendar-day'
|
|
70
|
+
};
|
|
52
71
|
const getDayAccessibilityLabel = function (date) {
|
|
53
72
|
let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
54
73
|
return "".concat(date.toLocaleDateString(locale, {
|
|
@@ -78,31 +97,38 @@ const CalendarDay = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
78
97
|
isToday,
|
|
79
98
|
isCurrentMonth,
|
|
80
99
|
onClick,
|
|
81
|
-
disabledError = 'Date unavailable'
|
|
100
|
+
disabledError = 'Date unavailable',
|
|
101
|
+
highlightedDateAccessibilityHint,
|
|
102
|
+
className,
|
|
103
|
+
style
|
|
82
104
|
} = _ref2;
|
|
83
105
|
const {
|
|
84
106
|
locale
|
|
85
107
|
} = useLocale();
|
|
86
108
|
const handleClick = useCallback(() => onClick === null || onClick === void 0 ? void 0 : onClick(date), [date, onClick]);
|
|
87
|
-
const
|
|
109
|
+
const baseLabel = getDayAccessibilityLabel(date, locale);
|
|
88
110
|
const calendarDayButton = useMemo(() => /*#__PURE__*/_jsx(CalendarPressable, {
|
|
89
111
|
ref: ref,
|
|
90
112
|
focusable: true,
|
|
91
|
-
|
|
113
|
+
accessibilityHint: highlighted ? highlightedDateAccessibilityHint : undefined,
|
|
114
|
+
accessibilityLabel: baseLabel,
|
|
92
115
|
"aria-current": isToday ? 'date' : undefined,
|
|
93
116
|
"aria-pressed": active ? 'true' : undefined,
|
|
94
117
|
background: active ? 'bgPrimary' : 'bg',
|
|
95
118
|
borderColor: isToday ? 'bgPrimary' : undefined,
|
|
119
|
+
className: className,
|
|
96
120
|
"data-calendar-date": getISOStringLocal(date),
|
|
121
|
+
"data-highlight": highlighted ? 'true' : undefined,
|
|
97
122
|
disabled: disabled,
|
|
98
123
|
onClick: disabled ? undefined : handleClick,
|
|
124
|
+
style: style,
|
|
99
125
|
tabIndex: date.getDate() === 1 ? undefined : -1,
|
|
100
126
|
children: /*#__PURE__*/_jsx(Text, {
|
|
101
127
|
color: active ? 'fgInverse' : highlighted ? 'fgPrimary' : undefined,
|
|
102
128
|
font: "body",
|
|
103
129
|
children: date.getDate()
|
|
104
130
|
})
|
|
105
|
-
}), [date, active, disabled, highlighted, isToday,
|
|
131
|
+
}), [date, active, disabled, highlighted, highlightedDateAccessibilityHint, isToday, baseLabel, handleClick, ref, className, style]);
|
|
106
132
|
if (!isCurrentMonth) return /*#__PURE__*/_jsx("div", {});
|
|
107
133
|
if (!disabled || disabled && !disabledError) return calendarDayButton;
|
|
108
134
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -127,8 +153,11 @@ export const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, ref) =
|
|
|
127
153
|
disabledDateError = 'Date unavailable',
|
|
128
154
|
className,
|
|
129
155
|
style,
|
|
156
|
+
classNames,
|
|
157
|
+
styles,
|
|
130
158
|
nextArrowAccessibilityLabel = 'Go to next month',
|
|
131
|
-
previousArrowAccessibilityLabel = 'Go to previous month'
|
|
159
|
+
previousArrowAccessibilityLabel = 'Go to previous month',
|
|
160
|
+
highlightedDateAccessibilityHint = 'Highlighted'
|
|
132
161
|
} = _ref3,
|
|
133
162
|
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
134
163
|
const calendarRef = useRef(null);
|
|
@@ -193,29 +222,35 @@ export const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, ref) =
|
|
|
193
222
|
ref: calendarRef,
|
|
194
223
|
background: "bg",
|
|
195
224
|
borderRadius: 400,
|
|
196
|
-
className: className,
|
|
225
|
+
className: cx(calendarClassNames.root, className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
197
226
|
opacity: disabled ? accessibleOpacityDisabled : undefined,
|
|
198
227
|
overflow: "auto",
|
|
199
228
|
padding: 2,
|
|
200
|
-
style: style,
|
|
229
|
+
style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root),
|
|
201
230
|
width: 360
|
|
202
231
|
}, props), {}, {
|
|
203
232
|
children: [/*#__PURE__*/_jsxs(HStack, {
|
|
204
233
|
alignItems: "center",
|
|
234
|
+
className: cx(calendarClassNames.header, classNames === null || classNames === void 0 ? void 0 : classNames.header),
|
|
205
235
|
justifyContent: "space-between",
|
|
206
236
|
paddingBottom: 2,
|
|
207
237
|
paddingX: 1.5,
|
|
238
|
+
style: styles === null || styles === void 0 ? void 0 : styles.header,
|
|
208
239
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
209
240
|
as: "h3",
|
|
241
|
+
className: cx(calendarClassNames.title, classNames === null || classNames === void 0 ? void 0 : classNames.title),
|
|
210
242
|
display: "block",
|
|
211
243
|
font: "headline",
|
|
244
|
+
style: styles === null || styles === void 0 ? void 0 : styles.title,
|
|
212
245
|
children: calendarSeedDate.toLocaleDateString('en-US', {
|
|
213
246
|
month: 'long',
|
|
214
247
|
year: 'numeric'
|
|
215
248
|
})
|
|
216
249
|
}), !hideControls && /*#__PURE__*/_jsxs(HStack, {
|
|
250
|
+
className: cx(calendarClassNames.navigation, classNames === null || classNames === void 0 ? void 0 : classNames.navigation),
|
|
217
251
|
gap: 1,
|
|
218
252
|
marginEnd: -1,
|
|
253
|
+
style: styles === null || styles === void 0 ? void 0 : styles.navigation,
|
|
219
254
|
children: [/*#__PURE__*/_jsx(CalendarPressable, {
|
|
220
255
|
accessibilityLabel: previousArrowAccessibilityLabel,
|
|
221
256
|
background: "bg",
|
|
@@ -239,14 +274,16 @@ export const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, ref) =
|
|
|
239
274
|
})]
|
|
240
275
|
})]
|
|
241
276
|
}), /*#__PURE__*/_jsxs(Grid, {
|
|
277
|
+
className: cx(calendarClassNames.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
|
|
242
278
|
gap: 1,
|
|
243
279
|
justifyContent: "space-between",
|
|
244
|
-
|
|
280
|
+
style: styles === null || styles === void 0 ? void 0 : styles.content,
|
|
281
|
+
templateColumns: "repeat(7, ".concat(CALENDAR_DAY_DIMENSION, "px)"),
|
|
245
282
|
children: [daysOfWeek.map(day => /*#__PURE__*/_jsx(VStack, {
|
|
246
283
|
alignItems: "center",
|
|
247
|
-
height:
|
|
284
|
+
height: CALENDAR_DAY_DIMENSION,
|
|
248
285
|
justifyContent: "center",
|
|
249
|
-
width:
|
|
286
|
+
width: CALENDAR_DAY_DIMENSION,
|
|
250
287
|
children: /*#__PURE__*/_jsx(Text, {
|
|
251
288
|
font: "body",
|
|
252
289
|
userSelect: "none",
|
|
@@ -256,13 +293,16 @@ export const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, ref) =
|
|
|
256
293
|
const time = date.getTime();
|
|
257
294
|
return /*#__PURE__*/_jsx(CalendarDay, {
|
|
258
295
|
active: time === selectedTime,
|
|
296
|
+
className: cx(calendarClassNames.day, classNames === null || classNames === void 0 ? void 0 : classNames.day),
|
|
259
297
|
date: date,
|
|
260
298
|
disabled: disabled || minTime && time < minTime || maxTime && time > maxTime || disabledTimes.includes(time),
|
|
261
299
|
disabledError: disabledDateError,
|
|
262
300
|
highlighted: highlightedTimes.includes(time),
|
|
301
|
+
highlightedDateAccessibilityHint: highlightedDateAccessibilityHint,
|
|
263
302
|
isCurrentMonth: date.getMonth() === calendarSeedDate.getMonth(),
|
|
264
303
|
isToday: time === today.getTime(),
|
|
265
|
-
onClick: onPressDate
|
|
304
|
+
onClick: onPressDate,
|
|
305
|
+
style: styles === null || styles === void 0 ? void 0 : styles.day
|
|
266
306
|
}, time);
|
|
267
307
|
})]
|
|
268
308
|
})]
|
package/esm/dates/DatePicker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["date", "onChangeDate", "error", "onErrorDate", "required", "disabled", "seedDate", "disabledDates", "highlightedDates", "minDate", "maxDate", "requiredError", "invalidDateError", "disabledDateError", "label", "restoreFocusOnUnmount", "accessibilityLabel", "accessibilityLabelledBy", "calendarIconButtonAccessibilityLabel", "nextArrowAccessibilityLabel", "previousArrowAccessibilityLabel", "compact", "variant", "helperText", "showOverlay", "defaultOpen", "calendarStyle", "calendarClassName", "dateInputStyle", "dateInputClassName", "width", "onOpen", "onClose", "onConfirm", "onCancel", "onChange"];
|
|
1
|
+
const _excluded = ["date", "onChangeDate", "error", "onErrorDate", "required", "disabled", "seedDate", "disabledDates", "highlightedDates", "highlightedDateAccessibilityHint", "minDate", "maxDate", "requiredError", "invalidDateError", "disabledDateError", "label", "restoreFocusOnUnmount", "accessibilityLabel", "accessibilityLabelledBy", "calendarIconButtonAccessibilityLabel", "openCalendarAccessibilityLabel", "closeCalendarAccessibilityLabel", "nextArrowAccessibilityLabel", "previousArrowAccessibilityLabel", "compact", "variant", "helperText", "showOverlay", "defaultOpen", "calendarStyle", "calendarClassName", "dateInputStyle", "dateInputClassName", "classNames", "styles", "width", "onOpen", "onClose", "onConfirm", "onCancel", "onChange"];
|
|
2
2
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -12,6 +12,7 @@ import { getISOStringLocal } from '@coinbase/cds-common/dates/getISOStringLocal'
|
|
|
12
12
|
import { zIndex } from '@coinbase/cds-common/tokens/zIndex';
|
|
13
13
|
import { m as motion } from 'framer-motion';
|
|
14
14
|
import { InputIconButton } from '../controls/InputIconButton';
|
|
15
|
+
import { cx } from '../cx';
|
|
15
16
|
import { Box, VStack } from '../layout';
|
|
16
17
|
import { getMotionProps } from '../motion/useMotionProps';
|
|
17
18
|
import { Popover } from '../overlays/popover/Popover';
|
|
@@ -43,6 +44,7 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
43
44
|
seedDate,
|
|
44
45
|
disabledDates,
|
|
45
46
|
highlightedDates,
|
|
47
|
+
highlightedDateAccessibilityHint,
|
|
46
48
|
minDate,
|
|
47
49
|
maxDate,
|
|
48
50
|
requiredError = 'This field is required',
|
|
@@ -53,6 +55,8 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
53
55
|
accessibilityLabel,
|
|
54
56
|
accessibilityLabelledBy,
|
|
55
57
|
calendarIconButtonAccessibilityLabel,
|
|
58
|
+
openCalendarAccessibilityLabel = 'Open calendar',
|
|
59
|
+
closeCalendarAccessibilityLabel = 'Close calendar',
|
|
56
60
|
nextArrowAccessibilityLabel,
|
|
57
61
|
previousArrowAccessibilityLabel,
|
|
58
62
|
compact,
|
|
@@ -64,6 +68,8 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
64
68
|
calendarClassName,
|
|
65
69
|
dateInputStyle,
|
|
66
70
|
dateInputClassName,
|
|
71
|
+
classNames,
|
|
72
|
+
styles,
|
|
67
73
|
width = '100%',
|
|
68
74
|
onOpen,
|
|
69
75
|
onClose,
|
|
@@ -117,16 +123,16 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
117
123
|
children: /*#__PURE__*/_jsx(InputIconButton, {
|
|
118
124
|
disableInheritFocusStyle: true,
|
|
119
125
|
transparent: true,
|
|
120
|
-
accessibilityLabel: calendarIconButtonAccessibilityLabel !== null && calendarIconButtonAccessibilityLabel !== void 0 ? calendarIconButtonAccessibilityLabel : showCalendar ?
|
|
126
|
+
accessibilityLabel: calendarIconButtonAccessibilityLabel !== null && calendarIconButtonAccessibilityLabel !== void 0 ? calendarIconButtonAccessibilityLabel : showCalendar ? closeCalendarAccessibilityLabel : openCalendarAccessibilityLabel,
|
|
121
127
|
name: "calendarEmpty",
|
|
122
128
|
onClick: handleOpenCalendar,
|
|
123
129
|
variant: "secondary"
|
|
124
130
|
})
|
|
125
|
-
}), [handleOpenCalendar, showCalendar, calendarIconButtonAccessibilityLabel]);
|
|
131
|
+
}), [handleOpenCalendar, showCalendar, calendarIconButtonAccessibilityLabel, openCalendarAccessibilityLabel, closeCalendarAccessibilityLabel]);
|
|
126
132
|
const dateInput = useMemo(() => /*#__PURE__*/_jsx(DateInput, _objectSpread(_objectSpread({}, props), {}, {
|
|
127
133
|
accessibilityLabel: accessibilityLabel,
|
|
128
134
|
accessibilityLabelledBy: accessibilityLabelledBy,
|
|
129
|
-
className: dateInputClassName,
|
|
135
|
+
className: cx(classNames === null || classNames === void 0 ? void 0 : classNames.dateInput, dateInputClassName),
|
|
130
136
|
compact: compact,
|
|
131
137
|
date: date,
|
|
132
138
|
disabled: disabled,
|
|
@@ -144,9 +150,9 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
144
150
|
onErrorDate: onErrorDate,
|
|
145
151
|
required: required,
|
|
146
152
|
requiredError: requiredError,
|
|
147
|
-
style: dateInputStyle,
|
|
153
|
+
style: _objectSpread(_objectSpread({}, dateInputStyle), styles === null || styles === void 0 ? void 0 : styles.dateInput),
|
|
148
154
|
variant: variant
|
|
149
|
-
})), [date, onChangeDate, error, onErrorDate, required, compact, disabled, dateInputCalendarButton, requiredError, invalidDateError, disabledDates, minDate, maxDate, disabledDateError, onChange, label, accessibilityLabel, accessibilityLabelledBy, helperText, variant, dateInputClassName, dateInputStyle, props]);
|
|
155
|
+
})), [date, onChangeDate, error, onErrorDate, required, compact, disabled, dateInputCalendarButton, requiredError, invalidDateError, disabledDates, minDate, maxDate, disabledDateError, onChange, label, accessibilityLabel, accessibilityLabelledBy, helperText, variant, dateInputClassName, dateInputStyle, classNames, styles, props]);
|
|
150
156
|
const calendar = useMemo(() => /*#__PURE__*/_jsx(MotionVStack, _objectSpread(_objectSpread({
|
|
151
157
|
background: true,
|
|
152
158
|
borderRadius: 400,
|
|
@@ -159,9 +165,18 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
159
165
|
children: /*#__PURE__*/_jsx(Calendar, {
|
|
160
166
|
ref: calendarRef,
|
|
161
167
|
className: calendarClassName,
|
|
168
|
+
classNames: {
|
|
169
|
+
root: classNames === null || classNames === void 0 ? void 0 : classNames.calendar,
|
|
170
|
+
header: classNames === null || classNames === void 0 ? void 0 : classNames.calendarHeader,
|
|
171
|
+
title: classNames === null || classNames === void 0 ? void 0 : classNames.calendarTitle,
|
|
172
|
+
navigation: classNames === null || classNames === void 0 ? void 0 : classNames.calendarNavigation,
|
|
173
|
+
content: classNames === null || classNames === void 0 ? void 0 : classNames.calendarContent,
|
|
174
|
+
day: classNames === null || classNames === void 0 ? void 0 : classNames.calendarDay
|
|
175
|
+
},
|
|
162
176
|
disabled: disabled,
|
|
163
177
|
disabledDateError: disabledDateError,
|
|
164
178
|
disabledDates: disabledDates,
|
|
179
|
+
highlightedDateAccessibilityHint: highlightedDateAccessibilityHint,
|
|
165
180
|
highlightedDates: highlightedDates,
|
|
166
181
|
maxDate: maxDate,
|
|
167
182
|
minDate: minDate,
|
|
@@ -170,9 +185,17 @@ export const DatePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
|
|
|
170
185
|
previousArrowAccessibilityLabel: previousArrowAccessibilityLabel,
|
|
171
186
|
seedDate: seedDate,
|
|
172
187
|
selectedDate: date,
|
|
173
|
-
style: calendarStyle
|
|
188
|
+
style: calendarStyle,
|
|
189
|
+
styles: {
|
|
190
|
+
root: styles === null || styles === void 0 ? void 0 : styles.calendar,
|
|
191
|
+
header: styles === null || styles === void 0 ? void 0 : styles.calendarHeader,
|
|
192
|
+
title: styles === null || styles === void 0 ? void 0 : styles.calendarTitle,
|
|
193
|
+
navigation: styles === null || styles === void 0 ? void 0 : styles.calendarNavigation,
|
|
194
|
+
content: styles === null || styles === void 0 ? void 0 : styles.calendarContent,
|
|
195
|
+
day: styles === null || styles === void 0 ? void 0 : styles.calendarDay
|
|
196
|
+
}
|
|
174
197
|
})
|
|
175
|
-
})), [date, disabled, seedDate, disabledDates, highlightedDates, minDate, maxDate, disabledDateError, handleConfirmCalendarDate, calendarRef,
|
|
198
|
+
})), [date, disabled, seedDate, disabledDates, highlightedDates, highlightedDateAccessibilityHint, minDate, maxDate, disabledDateError, handleConfirmCalendarDate, calendarRef, nextArrowAccessibilityLabel, previousArrowAccessibilityLabel, calendarClassName, calendarStyle, classNames, styles]);
|
|
176
199
|
return /*#__PURE__*/_jsx(Box, {
|
|
177
200
|
ref: ref,
|
|
178
201
|
width: width,
|
|
@@ -83,7 +83,7 @@ export const RemoteImageGroup = _ref => {
|
|
|
83
83
|
}, index);
|
|
84
84
|
}), excess > 0 && /*#__PURE__*/_jsx(Box, {
|
|
85
85
|
alignItems: "center",
|
|
86
|
-
background: "
|
|
86
|
+
background: "bgSecondary",
|
|
87
87
|
borderColor: borderColor,
|
|
88
88
|
borderWidth: borderWidth,
|
|
89
89
|
className: cx(excessContainerCss, borderRadiusCss[shape]),
|
|
@@ -101,6 +101,7 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
101
101
|
onBlur,
|
|
102
102
|
onClose,
|
|
103
103
|
onCloseComplete,
|
|
104
|
+
onOpenComplete,
|
|
104
105
|
preventDismiss,
|
|
105
106
|
id,
|
|
106
107
|
role = 'dialog',
|
|
@@ -128,6 +129,7 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
128
129
|
height: trayHeight
|
|
129
130
|
} = useDimensions();
|
|
130
131
|
const contentRef = useRef(null);
|
|
132
|
+
const hasCalledOnOpenComplete = useRef(false);
|
|
131
133
|
const [scope, animate] = useAnimate();
|
|
132
134
|
const dragControls = useDragControls();
|
|
133
135
|
const isSideTray = pin === 'right' || pin === 'left';
|
|
@@ -205,6 +207,11 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
205
207
|
});
|
|
206
208
|
}
|
|
207
209
|
}, [trayHeight, handleSwipeClose, animate, scope]);
|
|
210
|
+
const handleOpenComplete = useCallback(() => {
|
|
211
|
+
if (hasCalledOnOpenComplete.current) return;
|
|
212
|
+
hasCalledOnOpenComplete.current = true;
|
|
213
|
+
onOpenComplete === null || onOpenComplete === void 0 || onOpenComplete();
|
|
214
|
+
}, [onOpenComplete]);
|
|
208
215
|
const initialAnimationValue = useMemo(() => {
|
|
209
216
|
if (reduceMotion) {
|
|
210
217
|
return {
|
|
@@ -319,6 +326,7 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
319
326
|
elevation: 2,
|
|
320
327
|
id: id,
|
|
321
328
|
initial: initialAnimationValue,
|
|
329
|
+
onAnimationComplete: handleOpenComplete,
|
|
322
330
|
onClick: e => e.stopPropagation(),
|
|
323
331
|
onDragEnd: !preventDismiss ? handleDragEnd : undefined,
|
|
324
332
|
pin: pin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.54.0",
|
|
4
4
|
"description": "Coinbase Design System - Web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -207,9 +207,9 @@
|
|
|
207
207
|
"react-dom": "^18.3.1"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@coinbase/cds-common": "^8.
|
|
210
|
+
"@coinbase/cds-common": "^8.54.0",
|
|
211
211
|
"@coinbase/cds-icons": "^5.13.0",
|
|
212
|
-
"@coinbase/cds-illustrations": "^4.
|
|
212
|
+
"@coinbase/cds-illustrations": "^4.34.0",
|
|
213
213
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
214
214
|
"@coinbase/cds-utils": "^2.3.5",
|
|
215
215
|
"@floating-ui/react-dom": "^2.1.1",
|