@codecademy/gamut 68.1.3-alpha.77d8dc.0 → 68.1.3-alpha.e93e89.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.
|
@@ -131,7 +131,7 @@ export const DatePicker = props => {
|
|
|
131
131
|
y: 0,
|
|
132
132
|
onRequestClose: closeCalendar,
|
|
133
133
|
children: /*#__PURE__*/_jsx("div", {
|
|
134
|
-
"aria-label":
|
|
134
|
+
"aria-label": contextValue.translations.calendarDialogAriaLabel,
|
|
135
135
|
id: calendarDialogId,
|
|
136
136
|
role: "dialog",
|
|
137
137
|
children: /*#__PURE__*/_jsx(DatePickerCalendar, {
|
|
@@ -119,7 +119,7 @@ export const DatePickerCalendar = ({
|
|
|
119
119
|
})]
|
|
120
120
|
})]
|
|
121
121
|
}), /*#__PURE__*/_jsx(CalendarFooter, {
|
|
122
|
-
clearText: translations.
|
|
122
|
+
clearText: translations.clearText,
|
|
123
123
|
disabled: startOrSelectedDate === null && endDate === null,
|
|
124
124
|
locale: locale,
|
|
125
125
|
showClearButton: isRange,
|
|
@@ -44,7 +44,8 @@ export const DatePickerInput = /*#__PURE__*/forwardRef(({
|
|
|
44
44
|
openCalendar,
|
|
45
45
|
locale,
|
|
46
46
|
isCalendarOpen,
|
|
47
|
-
calendarDialogId
|
|
47
|
+
calendarDialogId,
|
|
48
|
+
translations
|
|
48
49
|
} = context;
|
|
49
50
|
const isRange = mode === 'range';
|
|
50
51
|
const inputID = useId();
|
|
@@ -98,7 +99,7 @@ export const DatePickerInput = /*#__PURE__*/forwardRef(({
|
|
|
98
99
|
const handleOpenCalendar = () => {
|
|
99
100
|
openCalendar();
|
|
100
101
|
};
|
|
101
|
-
const defaultLabel = isRange
|
|
102
|
+
const defaultLabel = !isRange ? translations.dateLabel : rangePart === 'end' ? translations.endDateLabel : translations.startDateLabel;
|
|
102
103
|
return /*#__PURE__*/_jsx(FormGroup, {
|
|
103
104
|
htmlFor: inputId,
|
|
104
105
|
isSoloField: true // should probaly be based on a prop
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/** Default UI strings; pass translations prop to override. */
|
|
2
2
|
export const DEFAULT_DATE_PICKER_TRANSLATIONS = {
|
|
3
|
-
|
|
3
|
+
clearText: 'Clear',
|
|
4
|
+
dateLabel: 'Date',
|
|
5
|
+
startDateLabel: 'Start date',
|
|
6
|
+
endDateLabel: 'End date',
|
|
7
|
+
calendarDialogAriaLabel: 'Choose date'
|
|
4
8
|
};
|
|
@@ -53,7 +53,15 @@ export type ActiveRangePart = 'start' | 'end' | null;
|
|
|
53
53
|
/** Optional translations for DatePicker UI strings. Pass to override defaults. */
|
|
54
54
|
export interface DatePickerTranslations {
|
|
55
55
|
/** Label for the clear date button (default: "Clear"). */
|
|
56
|
-
|
|
56
|
+
clearText?: string;
|
|
57
|
+
/** Default label for the date input in single mode (default: "Date"). */
|
|
58
|
+
dateLabel?: string;
|
|
59
|
+
/** Default label for the start date input in range mode (default: "Start date"). */
|
|
60
|
+
startDateLabel?: string;
|
|
61
|
+
/** Default label for the end date input in range mode (default: "End date"). */
|
|
62
|
+
endDateLabel?: string;
|
|
63
|
+
/** aria-label for the calendar dialog (default: "Choose date"). */
|
|
64
|
+
calendarDialogAriaLabel?: string;
|
|
57
65
|
}
|
|
58
66
|
/** Shared state provided by DatePicker via context. */
|
|
59
67
|
export interface DatePickerBaseContextValue {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/gamut",
|
|
3
3
|
"description": "Styleguide & Component library for Codecademy",
|
|
4
|
-
"version": "68.1.3-alpha.
|
|
4
|
+
"version": "68.1.3-alpha.e93e89.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@codecademy/gamut-icons": "9.57.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"dist/**/[A-Z]**/[A-Z]*.js",
|
|
60
60
|
"dist/**/[A-Z]**/index.js"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "597c47b90e8bb7ebae7c00c214c0ef0887bcb8a5"
|
|
63
63
|
}
|