@cloudscape-design/components 3.0.73 → 3.0.75
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/alert/interfaces.d.ts +5 -0
- package/alert/interfaces.d.ts.map +1 -1
- package/alert/interfaces.js.map +1 -1
- package/alert/internal.d.ts +1 -1
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +2 -2
- package/alert/internal.js.map +1 -1
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +30 -30
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/visual-refresh/styles.css.js +59 -59
- package/app-layout/visual-refresh/styles.scoped.css +218 -218
- package/app-layout/visual-refresh/styles.selectors.js +59 -59
- package/attribute-editor/interfaces.d.ts +7 -0
- package/attribute-editor/interfaces.d.ts.map +1 -1
- package/attribute-editor/interfaces.js.map +1 -1
- package/attribute-editor/internal.d.ts.map +1 -1
- package/attribute-editor/internal.js +2 -2
- package/attribute-editor/internal.js.map +1 -1
- package/attribute-editor/row.d.ts +2 -1
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js +5 -10
- package/attribute-editor/row.js.map +1 -1
- package/calendar/grid/index.d.ts +15 -3
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js +19 -17
- package/calendar/grid/index.js.map +1 -1
- package/calendar/internal.d.ts.map +1 -1
- package/calendar/internal.js +5 -17
- package/calendar/internal.js.map +1 -1
- package/calendar/utils/intl.d.ts +2 -3
- package/calendar/utils/intl.d.ts.map +1 -1
- package/calendar/utils/intl.js +6 -5
- package/calendar/utils/intl.js.map +1 -1
- package/calendar/utils/navigation.d.ts +6 -0
- package/calendar/utils/navigation.d.ts.map +1 -0
- package/calendar/utils/navigation.js +38 -0
- package/calendar/utils/navigation.js.map +1 -0
- package/date-picker/index.d.ts.map +1 -1
- package/date-picker/index.js +2 -1
- package/date-picker/index.js.map +1 -1
- package/date-picker/styles.css.js +6 -7
- package/date-picker/styles.scoped.css +7 -13
- package/date-picker/styles.selectors.js +6 -7
- package/date-range-picker/calendar/grids/grid.d.ts +1 -1
- package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/grid.js +36 -35
- package/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts +1 -3
- package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/index.js +10 -11
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/grids/styles.css.js +25 -21
- package/date-range-picker/calendar/grids/styles.scoped.css +60 -40
- package/date-range-picker/calendar/grids/styles.selectors.js +25 -21
- package/date-range-picker/calendar/header/index.d.ts +2 -2
- package/date-range-picker/calendar/header/index.d.ts.map +1 -1
- package/date-range-picker/calendar/header/index.js +13 -9
- package/date-range-picker/calendar/header/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +4 -6
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/dropdown.js +1 -1
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +4 -0
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/styles.css.js +37 -41
- package/date-range-picker/styles.scoped.css +45 -72
- package/date-range-picker/styles.selectors.js +37 -41
- package/flashbar/index.d.ts.map +1 -1
- package/flashbar/index.js +105 -34
- package/flashbar/index.js.map +1 -1
- package/flashbar/styles.css.js +29 -22
- package/flashbar/styles.scoped.css +208 -86
- package/flashbar/styles.selectors.js +29 -22
- package/form/interfaces.d.ts +5 -0
- package/form/interfaces.d.ts.map +1 -1
- package/form/interfaces.js.map +1 -1
- package/form/internal.d.ts +1 -1
- package/form/internal.d.ts.map +1 -1
- package/form/internal.js +10 -5
- package/form/internal.js.map +1 -1
- package/input/internal.d.ts +2 -1
- package/input/internal.d.ts.map +1 -1
- package/input/internal.js +4 -0
- package/input/internal.js.map +1 -1
- package/input/utils.js +1 -1
- package/input/utils.js.map +1 -1
- package/internal/base-component/styles.scoped.css +4 -4
- package/internal/components/autosuggest-input/index.js +1 -1
- package/internal/components/autosuggest-input/index.js.map +1 -1
- package/internal/components/live-region/index.d.ts +3 -2
- package/internal/components/live-region/index.d.ts.map +1 -1
- package/internal/components/live-region/index.js +5 -2
- package/internal/components/live-region/index.js.map +1 -1
- package/internal/components/live-region/styles.css.js +1 -1
- package/internal/components/live-region/styles.scoped.css +2 -92
- package/internal/components/live-region/styles.selectors.js +1 -1
- package/internal/components/screenreader-only/index.d.ts +22 -0
- package/internal/components/screenreader-only/index.d.ts.map +1 -0
- package/internal/components/screenreader-only/index.js +24 -0
- package/internal/components/screenreader-only/index.js.map +1 -0
- package/internal/components/screenreader-only/styles.css.js +6 -0
- package/internal/components/screenreader-only/styles.scoped.css +97 -0
- package/internal/components/screenreader-only/styles.selectors.js +7 -0
- package/internal/components/visual-context/index.d.ts +7 -0
- package/internal/components/visual-context/index.d.ts.map +1 -1
- package/internal/components/visual-context/index.js +10 -1
- package/internal/components/visual-context/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +26 -24
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/generated/styles/tokens.js +2 -2
- package/internal/generated/theming/index.cjs +3 -3
- package/internal/generated/theming/index.js +3 -3
- package/package.json +1 -1
- package/select/parts/filter.js +1 -1
- package/select/parts/filter.js.map +1 -1
- package/tag-editor/index.d.ts.map +1 -1
- package/tag-editor/index.js +1 -1
- package/tag-editor/index.js.map +1 -1
- package/test-utils/dom/date-range-picker/index.js +1 -1
- package/test-utils/dom/date-range-picker/index.js.map +1 -1
- package/test-utils/selectors/date-range-picker/index.js +1 -1
- package/test-utils/selectors/date-range-picker/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/tutorial-panel/interfaces.d.ts +2 -1
- package/tutorial-panel/interfaces.d.ts.map +1 -1
- package/tutorial-panel/interfaces.js.map +1 -1
- package/wizard/interfaces.d.ts +3 -0
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +1 -1
- package/wizard/wizard-form.js.map +1 -1
- package/wizard/wizard-navigation.d.ts.map +1 -1
- package/wizard/wizard-navigation.js +1 -1
- package/wizard/wizard-navigation.js.map +1 -1
- package/calendar/utils/move-focus-handler.d.ts +0 -7
- package/calendar/utils/move-focus-handler.d.ts.map +0 -1
- package/calendar/utils/move-focus-handler.js +0 -24
- package/calendar/utils/move-focus-handler.js.map +0 -1
- package/calendar/utils/rotate-day-indexes.d.ts +0 -3
- package/calendar/utils/rotate-day-indexes.d.ts.map +0 -1
- package/calendar/utils/rotate-day-indexes.js +0 -11
- package/calendar/utils/rotate-day-indexes.js.map +0 -1
- package/date-range-picker/calendar/get-base-date.d.ts +0 -3
- package/date-range-picker/calendar/get-base-date.d.ts.map +0 -1
- package/date-range-picker/calendar/get-base-date.js +0 -10
- package/date-range-picker/calendar/get-base-date.js.map +0 -1
|
@@ -5,14 +5,18 @@ import React from 'react';
|
|
|
5
5
|
import styles from '../../styles.css.js';
|
|
6
6
|
import { renderMonthAndYear } from '../../../calendar/utils/intl';
|
|
7
7
|
import HeaderButton from './button';
|
|
8
|
-
|
|
8
|
+
import LiveRegion from '../../../internal/components/live-region';
|
|
9
|
+
export default function CalendarHeader(_a) {
|
|
9
10
|
var baseDate = _a.baseDate, locale = _a.locale, onChangeMonth = _a.onChangeMonth, previousMonthLabel = _a.previousMonthLabel, nextMonthLabel = _a.nextMonthLabel, isSingleGrid = _a.isSingleGrid;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
React.createElement(
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
11
|
+
var prevMonthLabel = renderMonthAndYear(locale, add(baseDate, { months: -1 }));
|
|
12
|
+
var currentMonthLabel = renderMonthAndYear(locale, baseDate);
|
|
13
|
+
return (React.createElement(React.Fragment, null,
|
|
14
|
+
React.createElement("div", { className: styles['calendar-header'] },
|
|
15
|
+
React.createElement(HeaderButton, { ariaLabel: previousMonthLabel, isPrevious: true, onChangeMonth: onChangeMonth }),
|
|
16
|
+
React.createElement("div", { className: styles['calendar-header-months-wrapper'] },
|
|
17
|
+
!isSingleGrid && React.createElement("div", { className: styles['calendar-header-month'] }, prevMonthLabel),
|
|
18
|
+
React.createElement("div", { className: styles['calendar-header-month'] }, currentMonthLabel)),
|
|
19
|
+
React.createElement(HeaderButton, { ariaLabel: nextMonthLabel, isPrevious: false, onChangeMonth: onChangeMonth })),
|
|
20
|
+
React.createElement(LiveRegion, null, isSingleGrid ? currentMonthLabel : "".concat(prevMonthLabel, ", ").concat(currentMonthLabel))));
|
|
21
|
+
}
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/date-range-picker/calendar/header/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,YAAY,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/date-range-picker/calendar/header/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,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from 'date-fns';\nimport React from 'react';\nimport styles from '../../styles.css.js';\nimport { renderMonthAndYear } from '../../../calendar/utils/intl';\nimport HeaderButton from './button';\nimport LiveRegion from '../../../internal/components/live-region';\n\ninterface CalendarHeaderProps {\n baseDate: Date;\n locale: string;\n onChangeMonth: (prev?: boolean) => void;\n previousMonthLabel: string;\n nextMonthLabel: string;\n isSingleGrid: boolean;\n}\n\nexport default function CalendarHeader({\n baseDate,\n locale,\n onChangeMonth,\n previousMonthLabel,\n nextMonthLabel,\n isSingleGrid,\n}: CalendarHeaderProps) {\n const prevMonthLabel = renderMonthAndYear(locale, add(baseDate, { months: -1 }));\n const currentMonthLabel = renderMonthAndYear(locale, baseDate);\n\n return (\n <>\n <div className={styles['calendar-header']}>\n <HeaderButton ariaLabel={previousMonthLabel} isPrevious={true} onChangeMonth={onChangeMonth} />\n <div className={styles['calendar-header-months-wrapper']}>\n {!isSingleGrid && <div className={styles['calendar-header-month']}>{prevMonthLabel}</div>}\n <div className={styles['calendar-header-month']}>{currentMonthLabel}</div>\n </div>\n <HeaderButton ariaLabel={nextMonthLabel} isPrevious={false} onChangeMonth={onChangeMonth} />\n </div>\n <LiveRegion>{isSingleGrid ? currentMonthLabel : `${prevMonthLabel}, ${currentMonthLabel}`}</LiveRegion>\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAOhE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAU7D,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAMjD,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,oBAAoB,CAAC,qBAAqB,CAAC;IAC1D,iBAAiB,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,aAAa,KAAK,IAAI,CAAC;IACvE,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,OAAO,CAAC;CACvB;;AAED,wBAAoC"}
|
|
@@ -5,18 +5,17 @@ import { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSam
|
|
|
5
5
|
import styles from '../styles.css.js';
|
|
6
6
|
import CalendarHeader from './header';
|
|
7
7
|
import { Grids, selectFocusedDate } from './grids';
|
|
8
|
-
import moveFocusHandler from '../../calendar/utils/move-focus-handler';
|
|
9
8
|
import InternalSpaceBetween from '../../space-between/internal';
|
|
10
9
|
import InternalFormField from '../../form-field/internal';
|
|
11
10
|
import InternalDateInput from '../../date-input/internal';
|
|
12
11
|
import InternalTimeInput from '../../time-input/internal';
|
|
13
12
|
import clsx from 'clsx';
|
|
14
|
-
import { getBaseDate } from './get-base-date.js';
|
|
15
13
|
import { useUniqueId } from '../../internal/hooks/use-unique-id';
|
|
16
14
|
import { getDateLabel, renderTimeLabel } from '../../calendar/utils/intl';
|
|
17
15
|
import LiveRegion from '../../internal/components/live-region';
|
|
18
16
|
import { normalizeStartOfWeek } from '../../calendar/utils/locales';
|
|
19
17
|
import { formatDate, formatTime, joinDateTime, parseDate } from '../../internal/utils/date-time';
|
|
18
|
+
import { getBaseDate } from '../../calendar/utils/navigation';
|
|
20
19
|
export default forwardRef(Calendar);
|
|
21
20
|
function Calendar(_a, ref) {
|
|
22
21
|
var _b, _c, _d;
|
|
@@ -179,7 +178,7 @@ function Calendar(_a, ref) {
|
|
|
179
178
|
var newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);
|
|
180
179
|
setCurrentMonth(newCurrentMonth);
|
|
181
180
|
var newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);
|
|
182
|
-
var newBaseDate = getBaseDate(newBaseDateMonth,
|
|
181
|
+
var newBaseDate = getBaseDate(newBaseDateMonth, isDateEnabled);
|
|
183
182
|
setFocusedDate(newBaseDate);
|
|
184
183
|
};
|
|
185
184
|
var onChangeStartDate = function (e) {
|
|
@@ -200,7 +199,7 @@ function Calendar(_a, ref) {
|
|
|
200
199
|
_b[styles['one-grid']] = isSingleGrid,
|
|
201
200
|
_b)) },
|
|
202
201
|
React.createElement(CalendarHeader, { baseDate: currentMonth, locale: locale, onChangeMonth: onHeaderChangeMonthHandler, previousMonthLabel: i18nStrings.previousMonthAriaLabel, nextMonthLabel: i18nStrings.nextMonthAriaLabel, isSingleGrid: isSingleGrid }),
|
|
203
|
-
React.createElement(Grids, { isSingleGrid: isSingleGrid, locale: locale, baseDate: currentMonth, focusedDate: focusedDate, onFocusedDateChange: setFocusedDate, isDateEnabled: isDateEnabled, onSelectDate: onSelectDateHandler, onChangeMonth: setCurrentMonth, startOfWeek: normalizedStartOfWeek, todayAriaLabel: i18nStrings.todayAriaLabel, selectedStartDate: selectedStartDate, selectedEndDate: selectedEndDate
|
|
202
|
+
React.createElement(Grids, { isSingleGrid: isSingleGrid, locale: locale, baseDate: currentMonth, focusedDate: focusedDate, onFocusedDateChange: setFocusedDate, isDateEnabled: isDateEnabled, onSelectDate: onSelectDateHandler, onChangeMonth: setCurrentMonth, startOfWeek: normalizedStartOfWeek, todayAriaLabel: i18nStrings.todayAriaLabel, selectedStartDate: selectedStartDate, selectedEndDate: selectedEndDate })),
|
|
204
203
|
React.createElement(InternalSpaceBetween, { direction: "vertical", size: "xxs" },
|
|
205
204
|
React.createElement(InternalSpaceBetween, { size: "xs", direction: isSingleGrid ? 'vertical' : 'horizontal' },
|
|
206
205
|
React.createElement("div", { className: clsx(styles['date-and-time-wrapper'], (_c = {}, _c[styles['date-only']] = dateOnly, _c)) },
|
|
@@ -214,7 +213,6 @@ function Calendar(_a, ref) {
|
|
|
214
213
|
!dateOnly && (React.createElement(InternalFormField, { label: i18nStrings.endTimeLabel, stretch: true },
|
|
215
214
|
React.createElement(InternalTimeInput, { value: endTimeString, onChange: function (e) { return setEndTimeString(e.detail.value); }, format: timeInputFormat, placeholder: timeInputFormat, className: styles['end-time-input'], ariaDescribedby: constrainttextId }))))),
|
|
216
215
|
i18nStrings.dateTimeConstraintText && (React.createElement("div", { className: styles['date-and-time-constrainttext'], id: constrainttextId }, i18nStrings.dateTimeConstraintText)))),
|
|
217
|
-
React.createElement(LiveRegion,
|
|
218
|
-
React.createElement("span", { className: styles['calendar-aria-live'] }, announcement))));
|
|
216
|
+
React.createElement(LiveRegion, { className: styles['calendar-aria-live'] }, announcement)));
|
|
219
217
|
}
|
|
220
218
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx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4BAC/D,oBAAC,iBAAiB,IAChB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,UAAA,CAAC,IAAI,OAAA,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAhC,CAAgC,EAC/C,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,eAAe,EAAE,gBAAgB,GACjC,CACgB,CACrB,CACG,CACe;gBACtB,WAAW,CAAC,sBAAsB,IAAI,CACrC,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAE,EAAE,gBAAgB,IACzE,WAAW,CAAC,sBAAsB,CAC/B,CACP,CACoB,CACF;QACvB,oBAAC,UAAU;YACT,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,YAAY,CAAQ,CACzD,CACZ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport moveFocusHandler from '../../calendar/utils/move-focus-handler';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport InternalDateInput from '../../date-input/internal';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { getBaseDate } from './get-base-date.js';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { normalizeStartOfWeek } from '../../calendar/utils/locales';\nimport { formatDate, formatTime, joinDateTime, parseDate } from '../../internal/utils/date-time';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = joinDateTime(startDateString, startTimeString);\n const endDate = joinDateTime(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, 1, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n setStartDateString(e.detail.value);\n\n if (e.detail.value.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(e.detail.value));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n setEndDateString(e.detail.value);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n {/* The application role is necessary for screen-readers to allow arrow navigation by default. */}\n <div\n ref={elementRef}\n role=\"application\"\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={clsx(styles['date-and-time-wrapper'], { [styles['date-only']]: dateOnly })}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <InternalDateInput\n value={startDateString}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n {!dateOnly && (\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n )}\n </div>\n\n <div className={clsx(styles['date-and-time-wrapper'], { [styles['date-only']]: dateOnly })}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <InternalDateInput\n value={endDateString}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n {!dateOnly && (\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion>\n <span className={styles['calendar-aria-live']}>{announcement}</span>\n </LiveRegion>\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AE,IAAI;4BAC/D,oBAAC,iBAAiB,IAChB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,UAAA,CAAC,IAAI,OAAA,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAhC,CAAgC,EAC/C,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,eAAe,EAAE,gBAAgB,GACjC,CACgB,CACrB,CACG,CACe;gBACtB,WAAW,CAAC,sBAAsB,IAAI,CACrC,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAE,EAAE,gBAAgB,IACzE,WAAW,CAAC,sBAAsB,CAC/B,CACP,CACoB,CACF;QACvB,oBAAC,UAAU,IAAC,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,YAAY,CAAc,CAC/E,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport InternalDateInput from '../../date-input/internal';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { normalizeStartOfWeek } from '../../calendar/utils/locales';\nimport { formatDate, formatTime, joinDateTime, parseDate } from '../../internal/utils/date-time';\nimport { getBaseDate } from '../../calendar/utils/navigation';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = joinDateTime(startDateString, startTimeString);\n const endDate = joinDateTime(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n setStartDateString(e.detail.value);\n\n if (e.detail.value.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(e.detail.value));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n setEndDateString(e.detail.value);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n {/* The application role is necessary for screen-readers to allow arrow navigation by default. */}\n <div\n ref={elementRef}\n role=\"application\"\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={clsx(styles['date-and-time-wrapper'], { [styles['date-only']]: dateOnly })}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <InternalDateInput\n value={startDateString}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n {!dateOnly && (\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n )}\n </div>\n\n <div className={clsx(styles['date-and-time-wrapper'], { [styles['date-only']]: dateOnly })}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <InternalDateInput\n value={endDateString}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n {!dateOnly && (\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion className={styles['calendar-aria-live']}>{announcement}</LiveRegion>\n </>\n );\n}\n"]}
|
|
@@ -87,7 +87,7 @@ export function DateRangePickerDropdown(_a) {
|
|
|
87
87
|
rangeSelectionMode === 'absolute' && (React.createElement(Calendar, { ref: focusRefs['absolute-only'], isSingleGrid: isSingleGrid, initialEndDate: selectedAbsoluteRange === null || selectedAbsoluteRange === void 0 ? void 0 : selectedAbsoluteRange.endDate, initialStartDate: selectedAbsoluteRange === null || selectedAbsoluteRange === void 0 ? void 0 : selectedAbsoluteRange.startDate, locale: locale, startOfWeek: startOfWeek, isDateEnabled: isDateEnabled, i18nStrings: i18nStrings, onSelectDateRange: setSelectedAbsoluteRange, dateOnly: dateOnly, timeInputFormat: timeInputFormat })),
|
|
88
88
|
rangeSelectionMode === 'relative' && (React.createElement(RelativeRangePicker, { ref: focusRefs['relative-only'], isSingleGrid: isSingleGrid, options: relativeOptions, dateOnly: dateOnly, initialSelection: selectedRelativeRange, onChange: function (range) { return setSelectedRelativeRange(range); }, i18nStrings: i18nStrings }))),
|
|
89
89
|
React.createElement(InternalBox, { className: styles['validation-section'], margin: !validationResult.valid ? { top: 's' } : undefined }, !validationResult.valid && (React.createElement(React.Fragment, null,
|
|
90
|
-
React.createElement(InternalAlert, { type: "error" },
|
|
90
|
+
React.createElement(InternalAlert, { type: "error", statusIconAriaLabel: i18nStrings.errorIconAriaLabel },
|
|
91
91
|
React.createElement("span", { className: styles['validation-error'] }, validationResult.errorMessage)),
|
|
92
92
|
React.createElement(LiveRegion, null, validationResult.errorMessage))))),
|
|
93
93
|
React.createElement("div", { className: clsx(styles.footer, (_c = {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/date-range-picker/dropdown.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,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,oBAAC,UAAU,QAAE,gBAAgB,CAAC,YAAY,CAAc,CACvD,CACJ,CACW,CACF;wBAEd,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;gCAC3B,GAAC,MAAM,CAAC,UAAU,CAAC,IAAG,YAAY;gCAClC,GAAC,MAAM,CAAC,kBAAkB,CAAC,IAAG,eAAe;oCAC7C;4BAED,eAAe,IAAI,CAClB,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC;gCAC7C,oBAAC,cAAc,IACb,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EACjC,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,MAAM,IAEhB,WAAW,CAAC,gBAAgB,CACd,CACb,CACP;4BACD,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC;gCAC7C,oBAAC,YAAY,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,YAAY;oCAC5C,oBAAC,cAAc,IACb,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAClC,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,MAAM,IAEhB,WAAW,CAAC,iBAAiB,CACf;oCAEjB,oBAAC,cAAc,IACb,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EACjC,GAAG,EAAE,cAAc,EACnB,UAAU,EAAC,MAAM,IAEhB,WAAW,CAAC,gBAAgB,CACd,CACJ,CACX,CACF,CACO,CACX,CACF,CACI,CACX,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { DateRangePickerProps, Focusable } from './interfaces';\nimport Calendar from './calendar';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\nimport InternalBox from '../box/internal';\nimport SpaceBetween from '../space-between/index.js';\n\nimport styles from './styles.css.js';\nimport RelativeRangePicker from './relative-range';\nimport ModeSwitcher from './mode-switcher';\nimport clsx from 'clsx';\nimport InternalAlert from '../alert/internal';\nimport LiveRegion from '../internal/components/live-region';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { useDateRangePicker } from './use-date-range-picker';\n\nexport const VALID_RANGE: DateRangePickerProps.ValidRangeResult = { valid: true };\n\nexport interface DateRangePickerDropdownProps\n extends Pick<\n Required<DateRangePickerProps>,\n | 'locale'\n | 'isDateEnabled'\n | 'isValidRange'\n | 'value'\n | 'relativeOptions'\n | 'showClearButton'\n | 'i18nStrings'\n | 'dateOnly'\n | 'timeInputFormat'\n | 'rangeSelectorMode'\n > {\n onClear: () => void;\n onApply: (value: null | DateRangePickerProps.Value) => DateRangePickerProps.ValidationResult;\n startOfWeek: number | undefined;\n onDropdownClose: () => void;\n isSingleGrid: boolean;\n\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}\n\nexport function DateRangePickerDropdown({\n locale = '',\n startOfWeek,\n isDateEnabled,\n isValidRange,\n value,\n onClear: clearValue,\n onApply: applyValue,\n onDropdownClose,\n relativeOptions,\n showClearButton,\n isSingleGrid,\n i18nStrings,\n dateOnly,\n timeInputFormat,\n rangeSelectorMode,\n ariaLabelledby,\n ariaDescribedby,\n}: DateRangePickerDropdownProps) {\n const {\n fillMissingTime,\n rangeSelectionMode,\n setRangeSelectionMode,\n selectedAbsoluteRange,\n setSelectedAbsoluteRange,\n selectedRelativeRange,\n setSelectedRelativeRange,\n } = useDateRangePicker({\n value,\n relativeOptions,\n rangeSelectorMode,\n });\n\n const focusVisible = useFocusVisible();\n const scrollableContainerRef = useRef<HTMLDivElement | null>(null);\n const applyButtonRef = useRef<ButtonProps.Ref>(null);\n\n const [applyClicked, setApplyClicked] = useState<boolean>(false);\n\n const [validationResult, setValidationResult] = useState<\n DateRangePickerProps.ValidRangeResult | DateRangePickerProps.InvalidRangeResult\n >(VALID_RANGE);\n\n const closeDropdown = () => {\n setApplyClicked(false);\n onDropdownClose();\n };\n\n const onClear = () => {\n closeDropdown();\n clearValue();\n };\n\n const onApply = () => {\n const newValue = rangeSelectionMode === 'relative' ? selectedRelativeRange : fillMissingTime(selectedAbsoluteRange);\n const newValidationResult = applyValue(newValue);\n if (newValidationResult.valid === false) {\n setApplyClicked(true);\n setValidationResult(newValidationResult);\n } else {\n setApplyClicked(false);\n closeDropdown();\n }\n };\n\n useEffect(() => {\n if (applyClicked) {\n const visibleRange =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : fillMissingTime(selectedAbsoluteRange);\n\n const newValidationResult = isValidRange(visibleRange);\n setValidationResult(newValidationResult || VALID_RANGE);\n }\n }, [\n applyClicked,\n isValidRange,\n rangeSelectionMode,\n selectedRelativeRange,\n selectedAbsoluteRange,\n fillMissingTime,\n setValidationResult,\n ]);\n\n const focusRefs = {\n default: useRef<Focusable>(null),\n 'absolute-only': useRef<Focusable>(null),\n 'relative-only': useRef<Focusable>(null),\n };\n\n useEffect(() => scrollableContainerRef.current?.focus(), [scrollableContainerRef]);\n\n return (\n <>\n <FocusLock autoFocus={true}>\n <div\n {...focusVisible}\n ref={scrollableContainerRef}\n className={styles.dropdown}\n tabIndex={0}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={i18nStrings.ariaLabel}\n aria-labelledby={ariaLabelledby ?? i18nStrings.ariaLabelledby}\n aria-describedby={ariaDescribedby ?? i18nStrings.ariaDescribedby}\n >\n <div\n className={clsx(styles['dropdown-content'], {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <SpaceBetween size=\"l\">\n <InternalBox padding={{ top: 'm', horizontal: 'l' }}>\n <SpaceBetween direction=\"vertical\" size=\"s\">\n {rangeSelectorMode === 'default' && (\n <ModeSwitcher\n ref={focusRefs.default}\n mode={rangeSelectionMode}\n onChange={(mode: 'absolute' | 'relative') => {\n setRangeSelectionMode(mode);\n setApplyClicked(false);\n setValidationResult(VALID_RANGE);\n }}\n i18nStrings={i18nStrings}\n />\n )}\n\n {rangeSelectionMode === 'absolute' && (\n <Calendar\n ref={focusRefs['absolute-only']}\n isSingleGrid={isSingleGrid}\n initialEndDate={selectedAbsoluteRange?.endDate}\n initialStartDate={selectedAbsoluteRange?.startDate}\n locale={locale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled}\n i18nStrings={i18nStrings}\n onSelectDateRange={setSelectedAbsoluteRange}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n />\n )}\n\n {rangeSelectionMode === 'relative' && (\n <RelativeRangePicker\n ref={focusRefs['relative-only']}\n isSingleGrid={isSingleGrid}\n options={relativeOptions}\n dateOnly={dateOnly}\n initialSelection={selectedRelativeRange}\n onChange={range => setSelectedRelativeRange(range)}\n i18nStrings={i18nStrings}\n />\n )}\n </SpaceBetween>\n\n <InternalBox\n className={styles['validation-section']}\n margin={!validationResult.valid ? { top: 's' } : undefined}\n >\n {!validationResult.valid && (\n <>\n <InternalAlert type=\"error\">\n <span className={styles['validation-error']}>{validationResult.errorMessage}</span>\n </InternalAlert>\n <LiveRegion>{validationResult.errorMessage}</LiveRegion>\n </>\n )}\n </InternalBox>\n </InternalBox>\n\n <div\n className={clsx(styles.footer, {\n [styles['one-grid']]: isSingleGrid,\n [styles['has-clear-button']]: showClearButton,\n })}\n >\n {showClearButton && (\n <div className={styles['footer-button-wrapper']}>\n <InternalButton\n onClick={onClear}\n className={styles['clear-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18nStrings.clearButtonLabel}\n </InternalButton>\n </div>\n )}\n <div className={styles['footer-button-wrapper']}>\n <SpaceBetween size=\"xs\" direction=\"horizontal\">\n <InternalButton\n onClick={closeDropdown}\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18nStrings.cancelButtonLabel}\n </InternalButton>\n\n <InternalButton\n onClick={onApply}\n className={styles['apply-button']}\n ref={applyButtonRef}\n formAction=\"none\"\n >\n {i18nStrings.applyButtonLabel}\n </InternalButton>\n </SpaceBetween>\n </div>\n </div>\n </SpaceBetween>\n </div>\n </div>\n </FocusLock>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/date-range-picker/dropdown.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAErD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,mBAAmB,MAAM,kBAAkB,CAAC;AACnD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,IAAM,WAAW,GAA0C,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AA0BlF,MAAM,UAAU,uBAAuB,CAAC,EAkBT;;QAjB7B,cAAW,EAAX,MAAM,mBAAG,EAAE,KAAA,EACX,WAAW,iBAAA,EACX,aAAa,mBAAA,EACb,YAAY,kBAAA,EACZ,KAAK,WAAA,EACI,UAAU,aAAA,EACV,UAAU,aAAA,EACnB,eAAe,qBAAA,EACf,eAAe,qBAAA,EACf,eAAe,qBAAA,EACf,YAAY,kBAAA,EACZ,WAAW,iBAAA,EACX,QAAQ,cA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BAAiB,CACf;oCAEjB,oBAAC,cAAc,IACb,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EACjC,GAAG,EAAE,cAAc,EACnB,UAAU,EAAC,MAAM,IAEhB,WAAW,CAAC,gBAAgB,CACd,CACJ,CACX,CACF,CACO,CACX,CACF,CACI,CACX,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { DateRangePickerProps, Focusable } from './interfaces';\nimport Calendar from './calendar';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\nimport InternalBox from '../box/internal';\nimport SpaceBetween from '../space-between/index.js';\n\nimport styles from './styles.css.js';\nimport RelativeRangePicker from './relative-range';\nimport ModeSwitcher from './mode-switcher';\nimport clsx from 'clsx';\nimport InternalAlert from '../alert/internal';\nimport LiveRegion from '../internal/components/live-region';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { useDateRangePicker } from './use-date-range-picker';\n\nexport const VALID_RANGE: DateRangePickerProps.ValidRangeResult = { valid: true };\n\nexport interface DateRangePickerDropdownProps\n extends Pick<\n Required<DateRangePickerProps>,\n | 'locale'\n | 'isDateEnabled'\n | 'isValidRange'\n | 'value'\n | 'relativeOptions'\n | 'showClearButton'\n | 'i18nStrings'\n | 'dateOnly'\n | 'timeInputFormat'\n | 'rangeSelectorMode'\n > {\n onClear: () => void;\n onApply: (value: null | DateRangePickerProps.Value) => DateRangePickerProps.ValidationResult;\n startOfWeek: number | undefined;\n onDropdownClose: () => void;\n isSingleGrid: boolean;\n\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}\n\nexport function DateRangePickerDropdown({\n locale = '',\n startOfWeek,\n isDateEnabled,\n isValidRange,\n value,\n onClear: clearValue,\n onApply: applyValue,\n onDropdownClose,\n relativeOptions,\n showClearButton,\n isSingleGrid,\n i18nStrings,\n dateOnly,\n timeInputFormat,\n rangeSelectorMode,\n ariaLabelledby,\n ariaDescribedby,\n}: DateRangePickerDropdownProps) {\n const {\n fillMissingTime,\n rangeSelectionMode,\n setRangeSelectionMode,\n selectedAbsoluteRange,\n setSelectedAbsoluteRange,\n selectedRelativeRange,\n setSelectedRelativeRange,\n } = useDateRangePicker({\n value,\n relativeOptions,\n rangeSelectorMode,\n });\n\n const focusVisible = useFocusVisible();\n const scrollableContainerRef = useRef<HTMLDivElement | null>(null);\n const applyButtonRef = useRef<ButtonProps.Ref>(null);\n\n const [applyClicked, setApplyClicked] = useState<boolean>(false);\n\n const [validationResult, setValidationResult] = useState<\n DateRangePickerProps.ValidRangeResult | DateRangePickerProps.InvalidRangeResult\n >(VALID_RANGE);\n\n const closeDropdown = () => {\n setApplyClicked(false);\n onDropdownClose();\n };\n\n const onClear = () => {\n closeDropdown();\n clearValue();\n };\n\n const onApply = () => {\n const newValue = rangeSelectionMode === 'relative' ? selectedRelativeRange : fillMissingTime(selectedAbsoluteRange);\n const newValidationResult = applyValue(newValue);\n if (newValidationResult.valid === false) {\n setApplyClicked(true);\n setValidationResult(newValidationResult);\n } else {\n setApplyClicked(false);\n closeDropdown();\n }\n };\n\n useEffect(() => {\n if (applyClicked) {\n const visibleRange =\n rangeSelectionMode === 'relative' ? selectedRelativeRange : fillMissingTime(selectedAbsoluteRange);\n\n const newValidationResult = isValidRange(visibleRange);\n setValidationResult(newValidationResult || VALID_RANGE);\n }\n }, [\n applyClicked,\n isValidRange,\n rangeSelectionMode,\n selectedRelativeRange,\n selectedAbsoluteRange,\n fillMissingTime,\n setValidationResult,\n ]);\n\n const focusRefs = {\n default: useRef<Focusable>(null),\n 'absolute-only': useRef<Focusable>(null),\n 'relative-only': useRef<Focusable>(null),\n };\n\n useEffect(() => scrollableContainerRef.current?.focus(), [scrollableContainerRef]);\n\n return (\n <>\n <FocusLock autoFocus={true}>\n <div\n {...focusVisible}\n ref={scrollableContainerRef}\n className={styles.dropdown}\n tabIndex={0}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={i18nStrings.ariaLabel}\n aria-labelledby={ariaLabelledby ?? i18nStrings.ariaLabelledby}\n aria-describedby={ariaDescribedby ?? i18nStrings.ariaDescribedby}\n >\n <div\n className={clsx(styles['dropdown-content'], {\n [styles['one-grid']]: isSingleGrid,\n })}\n >\n <SpaceBetween size=\"l\">\n <InternalBox padding={{ top: 'm', horizontal: 'l' }}>\n <SpaceBetween direction=\"vertical\" size=\"s\">\n {rangeSelectorMode === 'default' && (\n <ModeSwitcher\n ref={focusRefs.default}\n mode={rangeSelectionMode}\n onChange={(mode: 'absolute' | 'relative') => {\n setRangeSelectionMode(mode);\n setApplyClicked(false);\n setValidationResult(VALID_RANGE);\n }}\n i18nStrings={i18nStrings}\n />\n )}\n\n {rangeSelectionMode === 'absolute' && (\n <Calendar\n ref={focusRefs['absolute-only']}\n isSingleGrid={isSingleGrid}\n initialEndDate={selectedAbsoluteRange?.endDate}\n initialStartDate={selectedAbsoluteRange?.startDate}\n locale={locale}\n startOfWeek={startOfWeek}\n isDateEnabled={isDateEnabled}\n i18nStrings={i18nStrings}\n onSelectDateRange={setSelectedAbsoluteRange}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n />\n )}\n\n {rangeSelectionMode === 'relative' && (\n <RelativeRangePicker\n ref={focusRefs['relative-only']}\n isSingleGrid={isSingleGrid}\n options={relativeOptions}\n dateOnly={dateOnly}\n initialSelection={selectedRelativeRange}\n onChange={range => setSelectedRelativeRange(range)}\n i18nStrings={i18nStrings}\n />\n )}\n </SpaceBetween>\n\n <InternalBox\n className={styles['validation-section']}\n margin={!validationResult.valid ? { top: 's' } : undefined}\n >\n {!validationResult.valid && (\n <>\n <InternalAlert type=\"error\" statusIconAriaLabel={i18nStrings.errorIconAriaLabel}>\n <span className={styles['validation-error']}>{validationResult.errorMessage}</span>\n </InternalAlert>\n <LiveRegion>{validationResult.errorMessage}</LiveRegion>\n </>\n )}\n </InternalBox>\n </InternalBox>\n\n <div\n className={clsx(styles.footer, {\n [styles['one-grid']]: isSingleGrid,\n [styles['has-clear-button']]: showClearButton,\n })}\n >\n {showClearButton && (\n <div className={styles['footer-button-wrapper']}>\n <InternalButton\n onClick={onClear}\n className={styles['clear-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18nStrings.clearButtonLabel}\n </InternalButton>\n </div>\n )}\n <div className={styles['footer-button-wrapper']}>\n <SpaceBetween size=\"xs\" direction=\"horizontal\">\n <InternalButton\n onClick={closeDropdown}\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n >\n {i18nStrings.cancelButtonLabel}\n </InternalButton>\n\n <InternalButton\n onClick={onApply}\n className={styles['apply-button']}\n ref={applyButtonRef}\n formAction=\"none\"\n >\n {i18nStrings.applyButtonLabel}\n </InternalButton>\n </SpaceBetween>\n </div>\n </div>\n </SpaceBetween>\n </div>\n </div>\n </FocusLock>\n </>\n );\n}\n"]}
|
|
@@ -282,6 +282,10 @@ export declare namespace DateRangePickerProps {
|
|
|
282
282
|
* absolute range.
|
|
283
283
|
*/
|
|
284
284
|
dateTimeConstraintText?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Provides a text alternative for the error icon in the error alert.
|
|
287
|
+
*/
|
|
288
|
+
errorIconAriaLabel?: string;
|
|
285
289
|
/**
|
|
286
290
|
* When the property is set, screen readers announce the selected range when the absolute range gets selected.
|
|
287
291
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,0B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G;QACH,oCAAoC,EAAE,MAAM,CAAC;QAE7C;;;WAGG;QACH,gCAAgC,EAAE,MAAM,CAAC;QACzC;;;WAGG;QACH,sCAAsC,EAAE,MAAM,CAAC;QAC/C;;;WAGG;QACH,4BAA4B,EAAE,MAAM,CAAC;QAErC;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC;QAEvB;;WAEG;QACH,kBAAkB,EAAE,MAAM,CAAC;QAE3B;;WAEG;QACH,sBAAsB,EAAE,MAAM,CAAC;QAE/B;;;WAGG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB;;;WAGG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB;;;WAGG;QACH,YAAY,EAAE,MAAM,CAAC;QACrB;;;WAGG;QACH,YAAY,EAAE,MAAM,CAAC;QAErB;;;WAGG;QACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAEhC;;WAEG;QACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAE5B;;WAEG;QACH,mCAAmC,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;KACtF;CACF;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { TimeInputProps } from '../time-input/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true.\n */\n timeInputFormat?: TimeInputProps.Format;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n timeOffset?: number;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Segment title of the relative range selection mode\n */\n relativeModeTitle: string;\n\n /**\n * Segment title of the absolute range selection mode\n */\n absoluteModeTitle: string;\n\n /**\n * Heading for the relative range selection area\n */\n relativeRangeSelectionHeading: string;\n\n /**\n * Visible label of the Cancel button\n */\n cancelButtonLabel: string;\n /**\n * Visible label of the Clear and dismiss button\n */\n clearButtonLabel: string;\n /**\n * Visible label of the Apply button\n */\n applyButtonLabel: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n */\n formatRelativeRange: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n */\n formatUnit: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionLabel: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionDescription: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationLabel: string;\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationPlaceholder: string;\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n */\n customRelativeRangeUnitLabel: string;\n\n /**\n * Used as part of the aria label for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * An aria label for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * An aria label for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n */\n startDateLabel: string;\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n */\n startTimeLabel: string;\n /**\n * Visible label for the End Date input for the\n * absolute range.\n */\n endDateLabel: string;\n /**\n * Visible label for the End Time input for the\n * absolute range.\n */\n endTimeLabel: string;\n\n /**\n * Constraint text for the input fields for the\n * absolute range.\n */\n dateTimeConstraintText?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n }\n}\n\nexport interface Focusable {\n focus(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { TimeInputProps } from '../time-input/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true.\n */\n timeInputFormat?: TimeInputProps.Format;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n timeOffset?: number;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Segment title of the relative range selection mode\n */\n relativeModeTitle: string;\n\n /**\n * Segment title of the absolute range selection mode\n */\n absoluteModeTitle: string;\n\n /**\n * Heading for the relative range selection area\n */\n relativeRangeSelectionHeading: string;\n\n /**\n * Visible label of the Cancel button\n */\n cancelButtonLabel: string;\n /**\n * Visible label of the Clear and dismiss button\n */\n clearButtonLabel: string;\n /**\n * Visible label of the Apply button\n */\n applyButtonLabel: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n */\n formatRelativeRange: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n */\n formatUnit: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionLabel: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionDescription: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationLabel: string;\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationPlaceholder: string;\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n */\n customRelativeRangeUnitLabel: string;\n\n /**\n * Used as part of the aria label for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * An aria label for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * An aria label for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n */\n startDateLabel: string;\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n */\n startTimeLabel: string;\n /**\n * Visible label for the End Date input for the\n * absolute range.\n */\n endDateLabel: string;\n /**\n * Visible label for the End Time input for the\n * absolute range.\n */\n endTimeLabel: string;\n\n /**\n * Constraint text for the input fields for the\n * absolute range.\n */\n dateTimeConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n }\n}\n\nexport interface Focusable {\n focus(): void;\n}\n"]}
|
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"calendar": "
|
|
5
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
6
|
-
"root": "
|
|
7
|
-
"trigger-wrapper": "awsui_trigger-
|
|
8
|
-
"trigger-flexbox": "awsui_trigger-
|
|
9
|
-
"one-grid": "awsui_one-
|
|
10
|
-
"calendar-header": "awsui_calendar-
|
|
11
|
-
"calendar-header-months-wrapper": "awsui_calendar-header-months-
|
|
12
|
-
"calendar-header-month": "awsui_calendar-header-
|
|
13
|
-
"calendar-next-month-btn": "awsui_calendar-next-month-
|
|
14
|
-
"calendar-prev-month-btn": "awsui_calendar-prev-month-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"clear-button": "awsui_clear-button_mgja0_194kz_314",
|
|
42
|
-
"apply-button": "awsui_apply-button_mgja0_194kz_318",
|
|
43
|
-
"cancel-button": "awsui_cancel-button_mgja0_194kz_322",
|
|
44
|
-
"calendar-aria-live": "awsui_calendar-aria-live_mgja0_194kz_326"
|
|
4
|
+
"calendar": "awsui_calendar_mgja0_1vo3v_93",
|
|
5
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_mgja0_1vo3v_1",
|
|
6
|
+
"root": "awsui_root_mgja0_1vo3v_120",
|
|
7
|
+
"trigger-wrapper": "awsui_trigger-wrapper_mgja0_1vo3v_132",
|
|
8
|
+
"trigger-flexbox": "awsui_trigger-flexbox_mgja0_1vo3v_136",
|
|
9
|
+
"one-grid": "awsui_one-grid_mgja0_1vo3v_144",
|
|
10
|
+
"calendar-header": "awsui_calendar-header_mgja0_1vo3v_147",
|
|
11
|
+
"calendar-header-months-wrapper": "awsui_calendar-header-months-wrapper_mgja0_1vo3v_153",
|
|
12
|
+
"calendar-header-month": "awsui_calendar-header-month_mgja0_1vo3v_153",
|
|
13
|
+
"calendar-next-month-btn": "awsui_calendar-next-month-btn_mgja0_1vo3v_173",
|
|
14
|
+
"calendar-prev-month-btn": "awsui_calendar-prev-month-btn_mgja0_1vo3v_176",
|
|
15
|
+
"first-grid": "awsui_first-grid_mgja0_1vo3v_180",
|
|
16
|
+
"second-grid": "awsui_second-grid_mgja0_1vo3v_181",
|
|
17
|
+
"date-and-time-wrapper": "awsui_date-and-time-wrapper_mgja0_1vo3v_185",
|
|
18
|
+
"date-only": "awsui_date-only_mgja0_1vo3v_189",
|
|
19
|
+
"date-and-time-constrainttext": "awsui_date-and-time-constrainttext_mgja0_1vo3v_195",
|
|
20
|
+
"footer": "awsui_footer_mgja0_1vo3v_202",
|
|
21
|
+
"has-clear-button": "awsui_has-clear-button_mgja0_1vo3v_209",
|
|
22
|
+
"footer-button-wrapper": "awsui_footer-button-wrapper_mgja0_1vo3v_216",
|
|
23
|
+
"icon-wrapper": "awsui_icon-wrapper_mgja0_1vo3v_220",
|
|
24
|
+
"label": "awsui_label_mgja0_1vo3v_225",
|
|
25
|
+
"label-enabled": "awsui_label-enabled_mgja0_1vo3v_230",
|
|
26
|
+
"label-text": "awsui_label-text_mgja0_1vo3v_234",
|
|
27
|
+
"label-token-nowrap": "awsui_label-token-nowrap_mgja0_1vo3v_239",
|
|
28
|
+
"mode-switch": "awsui_mode-switch_mgja0_1vo3v_243",
|
|
29
|
+
"dropdown": "awsui_dropdown_mgja0_1vo3v_247",
|
|
30
|
+
"dropdown-content": "awsui_dropdown-content_mgja0_1vo3v_263",
|
|
31
|
+
"start-date-input": "awsui_start-date-input_mgja0_1vo3v_272",
|
|
32
|
+
"start-time-input": "awsui_start-time-input_mgja0_1vo3v_273",
|
|
33
|
+
"end-date-input": "awsui_end-date-input_mgja0_1vo3v_274",
|
|
34
|
+
"end-time-input": "awsui_end-time-input_mgja0_1vo3v_275",
|
|
35
|
+
"validation-section": "awsui_validation-section_mgja0_1vo3v_279",
|
|
36
|
+
"validation-error": "awsui_validation-error_mgja0_1vo3v_283",
|
|
37
|
+
"clear-button": "awsui_clear-button_mgja0_1vo3v_287",
|
|
38
|
+
"apply-button": "awsui_apply-button_mgja0_1vo3v_291",
|
|
39
|
+
"cancel-button": "awsui_cancel-button_mgja0_1vo3v_295",
|
|
40
|
+
"calendar-aria-live": "awsui_calendar-aria-live_mgja0_1vo3v_299"
|
|
45
41
|
};
|
|
46
42
|
|