@cloudscape-design/components-themeable 3.0.57 → 3.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/lib/internal/scss/{date-picker → calendar}/motion.scss +0 -0
  2. package/lib/internal/scss/calendar/styles.scss +170 -0
  3. package/lib/internal/scss/date-picker/styles.scss +13 -163
  4. package/lib/internal/template/autosuggest/internal.d.ts.map +1 -1
  5. package/lib/internal/template/autosuggest/internal.js +1 -5
  6. package/lib/internal/template/autosuggest/internal.js.map +1 -1
  7. package/lib/internal/template/{date-picker/calendar → calendar}/grid/day/index.d.ts +1 -1
  8. package/lib/internal/template/calendar/grid/day/index.d.ts.map +1 -0
  9. package/lib/internal/template/{date-picker/calendar → calendar}/grid/day/index.js +1 -1
  10. package/lib/internal/template/calendar/grid/day/index.js.map +1 -0
  11. package/lib/internal/template/{date-picker/calendar → calendar}/grid/index.d.ts +2 -2
  12. package/lib/internal/template/calendar/grid/index.d.ts.map +1 -0
  13. package/lib/internal/template/{date-picker/calendar → calendar}/grid/index.js +2 -2
  14. package/lib/internal/template/calendar/grid/index.js.map +1 -0
  15. package/lib/internal/template/{date-picker/calendar → calendar}/header/button/index.d.ts +0 -0
  16. package/lib/internal/template/calendar/header/button/index.d.ts.map +1 -0
  17. package/lib/internal/template/{date-picker/calendar → calendar}/header/button/index.js +2 -2
  18. package/lib/internal/template/calendar/header/button/index.js.map +1 -0
  19. package/lib/internal/template/{date-picker/calendar → calendar}/header/index.d.ts +1 -2
  20. package/lib/internal/template/calendar/header/index.d.ts.map +1 -0
  21. package/lib/internal/template/{date-picker/calendar → calendar}/header/index.js +3 -3
  22. package/lib/internal/template/calendar/header/index.js.map +1 -0
  23. package/lib/internal/template/calendar/index.d.ts +4 -0
  24. package/lib/internal/template/calendar/index.d.ts.map +1 -0
  25. package/lib/internal/template/calendar/index.js +14 -0
  26. package/lib/internal/template/calendar/index.js.map +1 -0
  27. package/lib/internal/template/calendar/interfaces.d.ts +56 -0
  28. package/lib/internal/template/calendar/interfaces.d.ts.map +1 -0
  29. package/lib/internal/template/calendar/interfaces.js +4 -0
  30. package/lib/internal/template/calendar/interfaces.js.map +1 -0
  31. package/lib/internal/template/calendar/internal.d.ts +4 -0
  32. package/lib/internal/template/calendar/internal.d.ts.map +1 -0
  33. package/lib/internal/template/{date-picker/calendar/index.js → calendar/internal.js} +9 -13
  34. package/lib/internal/template/calendar/internal.js.map +1 -0
  35. package/lib/internal/template/calendar/styles.css.js +25 -0
  36. package/lib/internal/template/calendar/styles.scoped.css +291 -0
  37. package/lib/internal/template/calendar/styles.selectors.js +26 -0
  38. package/lib/internal/template/{date-picker/calendar → calendar}/utils/intl.d.ts +2 -2
  39. package/lib/internal/template/calendar/utils/intl.d.ts.map +1 -0
  40. package/lib/internal/template/{date-picker/calendar → calendar}/utils/intl.js +2 -0
  41. package/lib/internal/template/calendar/utils/intl.js.map +1 -0
  42. package/lib/internal/template/{date-picker/calendar → calendar}/utils/locales.d.ts +1 -1
  43. package/lib/internal/template/calendar/utils/locales.d.ts.map +1 -0
  44. package/lib/internal/template/{date-picker/calendar → calendar}/utils/locales.js +1 -1
  45. package/lib/internal/template/calendar/utils/locales.js.map +1 -0
  46. package/lib/internal/template/{date-picker/calendar → calendar}/utils/memoized-date.d.ts +0 -0
  47. package/lib/internal/template/calendar/utils/memoized-date.d.ts.map +1 -0
  48. package/lib/internal/template/{date-picker/calendar → calendar}/utils/memoized-date.js +1 -1
  49. package/lib/internal/template/calendar/utils/memoized-date.js.map +1 -0
  50. package/lib/internal/template/{date-picker/calendar → calendar}/utils/move-focus-handler.d.ts +1 -1
  51. package/lib/internal/template/calendar/utils/move-focus-handler.d.ts.map +1 -0
  52. package/lib/internal/template/{date-picker/calendar → calendar}/utils/move-focus-handler.js +0 -0
  53. package/lib/internal/template/calendar/utils/move-focus-handler.js.map +1 -0
  54. package/lib/internal/template/calendar/utils/rotate-day-indexes.d.ts +3 -0
  55. package/lib/internal/template/calendar/utils/rotate-day-indexes.d.ts.map +1 -0
  56. package/lib/internal/template/{date-picker/calendar → calendar}/utils/rotate-day-indexes.js +2 -0
  57. package/lib/internal/template/calendar/utils/rotate-day-indexes.js.map +1 -0
  58. package/lib/internal/template/date-picker/index.d.ts.map +1 -1
  59. package/lib/internal/template/date-picker/index.js +16 -10
  60. package/lib/internal/template/date-picker/index.js.map +1 -1
  61. package/lib/internal/template/date-picker/interfaces.d.ts +2 -44
  62. package/lib/internal/template/date-picker/interfaces.d.ts.map +1 -1
  63. package/lib/internal/template/date-picker/interfaces.js.map +1 -1
  64. package/lib/internal/template/date-picker/styles.css.js +7 -24
  65. package/lib/internal/template/date-picker/styles.scoped.css +21 -210
  66. package/lib/internal/template/date-picker/styles.selectors.js +7 -24
  67. package/lib/internal/template/date-range-picker/calendar/get-base-date.js +1 -1
  68. package/lib/internal/template/date-range-picker/calendar/get-base-date.js.map +1 -1
  69. package/lib/internal/template/date-range-picker/calendar/grids/day/index.js +1 -1
  70. package/lib/internal/template/date-range-picker/calendar/grids/day/index.js.map +1 -1
  71. package/lib/internal/template/date-range-picker/calendar/grids/grid.js +2 -2
  72. package/lib/internal/template/date-range-picker/calendar/grids/grid.js.map +1 -1
  73. package/lib/internal/template/date-range-picker/calendar/grids/index.d.ts +1 -1
  74. package/lib/internal/template/date-range-picker/calendar/grids/index.d.ts.map +1 -1
  75. package/lib/internal/template/date-range-picker/calendar/grids/index.js.map +1 -1
  76. package/lib/internal/template/date-range-picker/calendar/header/index.js +1 -1
  77. package/lib/internal/template/date-range-picker/calendar/header/index.js.map +1 -1
  78. package/lib/internal/template/date-range-picker/calendar/index.js +3 -3
  79. package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
  80. package/lib/internal/template/date-range-picker/index.js +1 -1
  81. package/lib/internal/template/date-range-picker/index.js.map +1 -1
  82. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts +1 -1
  83. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
  84. package/lib/internal/template/internal/components/autosuggest-input/index.js +42 -6
  85. package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
  86. package/lib/internal/template/internal/environment.js +1 -1
  87. package/lib/internal/template/property-filter/property-filter-autosuggest.d.ts.map +1 -1
  88. package/lib/internal/template/property-filter/property-filter-autosuggest.js +1 -5
  89. package/lib/internal/template/property-filter/property-filter-autosuggest.js.map +1 -1
  90. package/lib/internal/template/test-utils/dom/calendar/index.d.ts +16 -0
  91. package/lib/internal/template/test-utils/dom/calendar/index.js +53 -0
  92. package/lib/internal/template/test-utils/dom/calendar/index.js.map +1 -0
  93. package/lib/internal/template/test-utils/dom/date-picker/index.d.ts +2 -14
  94. package/lib/internal/template/test-utils/dom/date-picker/index.js +4 -33
  95. package/lib/internal/template/test-utils/dom/date-picker/index.js.map +1 -1
  96. package/lib/internal/template/test-utils/selectors/calendar/index.d.ts +16 -0
  97. package/lib/internal/template/test-utils/selectors/calendar/index.js +53 -0
  98. package/lib/internal/template/test-utils/selectors/calendar/index.js.map +1 -0
  99. package/lib/internal/template/test-utils/selectors/date-picker/index.d.ts +2 -14
  100. package/lib/internal/template/test-utils/selectors/date-picker/index.js +2 -31
  101. package/lib/internal/template/test-utils/selectors/date-picker/index.js.map +1 -1
  102. package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
  103. package/package.json +1 -1
  104. package/lib/internal/template/date-picker/calendar/grid/day/index.d.ts.map +0 -1
  105. package/lib/internal/template/date-picker/calendar/grid/day/index.js.map +0 -1
  106. package/lib/internal/template/date-picker/calendar/grid/index.d.ts.map +0 -1
  107. package/lib/internal/template/date-picker/calendar/grid/index.js.map +0 -1
  108. package/lib/internal/template/date-picker/calendar/header/button/index.d.ts.map +0 -1
  109. package/lib/internal/template/date-picker/calendar/header/button/index.js.map +0 -1
  110. package/lib/internal/template/date-picker/calendar/header/index.d.ts.map +0 -1
  111. package/lib/internal/template/date-picker/calendar/header/index.js.map +0 -1
  112. package/lib/internal/template/date-picker/calendar/index.d.ts +0 -17
  113. package/lib/internal/template/date-picker/calendar/index.d.ts.map +0 -1
  114. package/lib/internal/template/date-picker/calendar/index.js.map +0 -1
  115. package/lib/internal/template/date-picker/calendar/utils/intl.d.ts.map +0 -1
  116. package/lib/internal/template/date-picker/calendar/utils/intl.js.map +0 -1
  117. package/lib/internal/template/date-picker/calendar/utils/locales.d.ts.map +0 -1
  118. package/lib/internal/template/date-picker/calendar/utils/locales.js.map +0 -1
  119. package/lib/internal/template/date-picker/calendar/utils/memoized-date.d.ts.map +0 -1
  120. package/lib/internal/template/date-picker/calendar/utils/memoized-date.js.map +0 -1
  121. package/lib/internal/template/date-picker/calendar/utils/move-focus-handler.d.ts.map +0 -1
  122. package/lib/internal/template/date-picker/calendar/utils/move-focus-handler.js.map +0 -1
  123. package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.d.ts +0 -3
  124. package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.d.ts.map +0 -1
  125. package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.js.map +0 -1
@@ -0,0 +1,56 @@
1
+ import { NonCancelableEventHandler } from '../internal/events';
2
+ export interface CalendarProps {
3
+ /**
4
+ * The current input value, in YYYY-MM-DD format.
5
+ */
6
+ value: string;
7
+ /**
8
+ * Defines whether a particular date is enabled in the calendar or not.
9
+ * If you disable a date in the calendar, users can still enter this date using a keyboard.
10
+ * We recommend that you also validate these constraints on the client-side and server-side
11
+ * as you would for other form elements.
12
+ * @param date
13
+ */
14
+ isDateEnabled?: CalendarProps.IsDateEnabledFunction;
15
+ /**
16
+ * Specifies the locale to use to render month names and determine the starting day of the week.
17
+ * If you don't provide this, the locale is determined by the page and browser locales.
18
+ * Supported values and formats are listed in the
19
+ * [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
20
+ */
21
+ locale?: string;
22
+ /**
23
+ * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.
24
+ * By default the starting day of the week is defined by the locale, but you can use this property to override it.
25
+ */
26
+ startOfWeek?: number;
27
+ /**
28
+ * Used as part of the `aria-label` for today's date in the calendar.
29
+ */
30
+ todayAriaLabel: string;
31
+ /**
32
+ * Specifies an `aria-label` for the 'next month' button.
33
+ */
34
+ nextMonthAriaLabel: string;
35
+ /**
36
+ * Specifies an `aria-label` for the 'previous month' button.
37
+ */
38
+ previousMonthAriaLabel: string;
39
+ /**
40
+ * Called whenever a user changes the input value (by typing, pasting, or selecting a value).
41
+ * The event `detail` contains the current value of the field.
42
+ */
43
+ onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;
44
+ }
45
+ export declare namespace CalendarProps {
46
+ interface ChangeDetail {
47
+ /**
48
+ * The new value of this component.
49
+ */
50
+ value: string;
51
+ }
52
+ interface IsDateEnabledFunction {
53
+ (date: Date): boolean;
54
+ }
55
+ }
56
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAClE;AAED,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,qBAAqB;QACpC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;KACvB;CACF"}
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CalendarProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n\n /**\n * Defines whether a particular date is enabled in the calendar or not.\n * If you disable a date in the calendar, users can still enter this date using a keyboard.\n * We recommend that you also validate these constraints on the client-side and server-side\n * as you would for other form elements.\n * @param date\n */\n isDateEnabled?: CalendarProps.IsDateEnabledFunction;\n\n /**\n * Specifies the locale to use to render month names and determine the starting day of the week.\n * If you don't provide this, the locale is determined by the page and browser locales.\n * Supported values and formats are listed in the\n * [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 * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.\n * By default the starting day of the week is defined by the locale, but you can use this property to override it.\n */\n startOfWeek?: number;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Called whenever a user changes the input value (by typing, pasting, or selecting a value).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;\n}\n\nexport namespace CalendarProps {\n export interface ChangeDetail {\n /**\n * The new value of this component.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { CalendarProps } from './interfaces.js';
2
+ export declare type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
3
+ export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, }: CalendarProps): JSX.Element;
4
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,MAAW,EACX,WAAW,EACX,aAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,GACT,EAAE,aAAa,eAkHf"}
@@ -1,27 +1,23 @@
1
- import { __assign } from "tslib";
2
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
2
  // SPDX-License-Identifier: Apache-2.0
4
3
  import React, { useEffect, useRef, useState } from 'react';
5
4
  import { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';
6
- import styles from '../styles.css.js';
7
- import useFocusVisible from '../../internal/hooks/focus-visible/index.js';
5
+ import styles from './styles.css.js';
8
6
  import CalendarHeader from './header';
9
7
  import Grid from './grid';
10
8
  import moveFocusHandler from './utils/move-focus-handler';
11
- import { useUniqueId } from '../../internal/hooks/use-unique-id/index.js';
12
9
  import { memoizedDate } from './utils/memoized-date.js';
13
- import { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update.js';
10
+ import { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';
14
11
  import { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';
15
- import { formatDate } from '../../internal/utils/date-time';
16
- import { fireNonCancelableEvent } from '../../internal/events/index.js';
17
- import checkControlled from '../../internal/hooks/check-controlled/index.js';
12
+ import { formatDate } from '../internal/utils/date-time';
13
+ import { fireNonCancelableEvent } from '../internal/events/index.js';
14
+ import checkControlled from '../internal/hooks/check-controlled/index.js';
15
+ import clsx from 'clsx';
18
16
  export default function Calendar(_a) {
19
17
  var value = _a.value, _b = _a.locale, locale = _b === void 0 ? '' : _b, startOfWeek = _a.startOfWeek, _c = _a.isDateEnabled, isDateEnabled = _c === void 0 ? function () { return true; } : _c, todayAriaLabel = _a.todayAriaLabel, nextMonthAriaLabel = _a.nextMonthAriaLabel, previousMonthAriaLabel = _a.previousMonthAriaLabel, onChange = _a.onChange;
20
18
  checkControlled('Calendar', 'value', value, 'onChange', onChange);
21
19
  var normalizedLocale = normalizeLocale('Calendar', locale);
22
20
  var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);
23
- var focusVisible = useFocusVisible();
24
- var headerId = useUniqueId('calendar-dialog-title-');
25
21
  var elementRef = useRef(null);
26
22
  var gridWrapperRef = useRef(null);
27
23
  var _d = useState(null), focusedDate = _d[0], setFocusedDate = _d[1];
@@ -93,10 +89,10 @@ export default function Calendar(_a) {
93
89
  setFocusedDate(null);
94
90
  }
95
91
  };
96
- return (React.createElement("div", __assign({}, focusVisible, { className: styles.calendar, tabIndex: 0, role: "application", "aria-describedby": headerId, ref: elementRef }),
92
+ return (React.createElement("div", { className: clsx(styles.root, styles.calendar), ref: elementRef },
97
93
  React.createElement("div", { className: styles['calendar-inner'] },
98
- React.createElement(CalendarHeader, { headerId: headerId, baseDate: baseDate, locale: normalizedLocale, onChangeMonth: onHeaderChangeMonthHandler, previousMonthLabel: previousMonthAriaLabel, nextMonthLabel: nextMonthAriaLabel }),
94
+ React.createElement(CalendarHeader, { baseDate: baseDate, locale: normalizedLocale, onChangeMonth: onHeaderChangeMonthHandler, previousMonthLabel: previousMonthAriaLabel, nextMonthLabel: nextMonthAriaLabel }),
99
95
  React.createElement("div", { onBlur: onGridBlur, ref: gridWrapperRef },
100
96
  React.createElement(Grid, { locale: normalizedLocale, baseDate: baseDate, isDateEnabled: isDateEnabled, focusedDate: focusedOrSelectedDate, onSelectDate: onGridSelectDateHandler, onFocusDate: onGridFocusDateHandler, onChangeMonth: onGridChangeMonthHandler, startOfWeek: normalizedStartOfWeek, todayAriaLabel: todayAriaLabel, selectedDate: memoizedValue, handleFocusMove: moveFocusHandler })))));
101
97
  }
102
- //# sourceMappingURL=index.js.map
98
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { memoizedDate } from './utils/memoized-date.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';\nimport { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';\nimport { formatDate } from '../internal/utils/date-time';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport checkControlled from '../internal/hooks/check-controlled/index.js';\nimport clsx from 'clsx';\nimport { CalendarProps } from './interfaces.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport default function Calendar({\n value,\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n}: CalendarProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n const elementRef = useRef<HTMLDivElement>(null);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n\n // Set displayed date to value if defined or to current date otherwise.\n const memoizedValue = memoizedDate('value', value);\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n // Update displayed date if value changes.\n useEffect(() => {\n memoizedValue && setDisplayedDate(prev => (prev.getTime() !== memoizedValue.getTime() ? memoizedValue : prev));\n }, [memoizedValue]);\n\n const selectFocusedDate = (selected: Date | null, baseDate: Date): Date | null => {\n if (selected && isDateEnabled(selected) && isSameMonth(selected, baseDate)) {\n return selected;\n }\n const today = new Date();\n if (isDateEnabled(today) && isSameMonth(today, baseDate)) {\n return today;\n }\n if (isDateEnabled(baseDate)) {\n return baseDate;\n }\n return null;\n };\n\n // Get the first enabled date of the month. If no day is enabled in the given month, return the first day of the month.\n // This is needed because `baseDate` is used as the first focusable date, for example when navigating to the calendar area.\n const getBaseDate = (date: Date) => {\n const startDate = startOfMonth(date);\n for (let i = 0; i < getDaysInMonth(date); i++) {\n const currentDate = addDays(startDate, i);\n if (isDateEnabled(currentDate)) {\n return currentDate;\n }\n }\n return startDate;\n };\n\n const baseDate: Date = getBaseDate(displayedDate);\n const focusedOrSelectedDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (isPreviousButtonClick?: boolean) => {\n setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));\n setFocusedDate(null);\n };\n\n const onGridChangeMonthHandler = (newMonth: Date) => {\n setDisplayedDate(newMonth);\n setFocusedDate(null);\n };\n\n const onGridFocusDateHandler = (date: null | Date) => {\n if (date) {\n const value = memoizedDate('focused', formatDate(date));\n setFocusedDate(value);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\n\n // The focused date changes as a feedback to keyboard navigation in the grid.\n // Once changed, the corresponding day button needs to receive the actual focus.\n useEffectOnUpdate(() => {\n if (focusedDate) {\n (elementRef.current?.querySelector(`.${styles['calendar-day-focusable']}`) as HTMLDivElement)?.focus();\n }\n }, [focusedDate]);\n\n const onGridBlur = (event: React.FocusEvent) => {\n const newFocusTargetIsInGrid = event.relatedTarget && gridWrapperRef.current?.contains(event.relatedTarget as Node);\n if (!newFocusTargetIsInGrid) {\n setFocusedDate(null);\n }\n };\n\n return (\n <div className={clsx(styles.root, styles.calendar)} ref={elementRef}>\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedOrSelectedDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,25 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "calendar": "awsui_calendar_1ykar_1lht6_93",
5
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1ykar_1lht6_1",
6
+ "root": "awsui_root_1ykar_1lht6_120",
7
+ "calendar-inner": "awsui_calendar-inner_1ykar_1lht6_137",
8
+ "calendar-header": "awsui_calendar-header_1ykar_1lht6_140",
9
+ "calendar-header-month": "awsui_calendar-header-month_1ykar_1lht6_145",
10
+ "calendar-next-month-btn": "awsui_calendar-next-month-btn_1ykar_1lht6_151",
11
+ "calendar-prev-month-btn": "awsui_calendar-prev-month-btn_1ykar_1lht6_154",
12
+ "calendar-day-names": "awsui_calendar-day-names_1ykar_1lht6_157",
13
+ "calendar-day-name": "awsui_calendar-day-name_1ykar_1lht6_157",
14
+ "calendar-dates": "awsui_calendar-dates_1ykar_1lht6_172",
15
+ "calendar-week": "awsui_calendar-week_1ykar_1lht6_175",
16
+ "calendar-day": "awsui_calendar-day_1ykar_1lht6_157",
17
+ "calendar-day-in-last-week": "awsui_calendar-day-in-last-week_1ykar_1lht6_194",
18
+ "calendar-day-focusable": "awsui_calendar-day-focusable_1ykar_1lht6_197",
19
+ "calendar-day-enabled": "awsui_calendar-day-enabled_1ykar_1lht6_200",
20
+ "calendar-day-current-month": "awsui_calendar-day-current-month_1ykar_1lht6_204",
21
+ "calendar-day-selected": "awsui_calendar-day-selected_1ykar_1lht6_211",
22
+ "calendar-day-today": "awsui_calendar-day-today_1ykar_1lht6_215",
23
+ "day-inner": "awsui_day-inner_1ykar_1lht6_227"
24
+ };
25
+
@@ -0,0 +1,291 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /*
6
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ /*
10
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
+ SPDX-License-Identifier: Apache-2.0
12
+ */
13
+ /*
14
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
15
+ SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ /*
18
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
+ SPDX-License-Identifier: Apache-2.0
20
+ */
21
+ /*
22
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
+ SPDX-License-Identifier: Apache-2.0
24
+ */
25
+ /*
26
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
27
+ SPDX-License-Identifier: Apache-2.0
28
+ */
29
+ /*
30
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
+ SPDX-License-Identifier: Apache-2.0
32
+ */
33
+ /*
34
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
35
+ SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ /*
38
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
39
+ SPDX-License-Identifier: Apache-2.0
40
+ */
41
+ /*
42
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
+ SPDX-License-Identifier: Apache-2.0
44
+ */
45
+ /*
46
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
47
+ SPDX-License-Identifier: Apache-2.0
48
+ */
49
+ /*
50
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
51
+ SPDX-License-Identifier: Apache-2.0
52
+ */
53
+ /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
54
+ /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
55
+ /*
56
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
57
+ SPDX-License-Identifier: Apache-2.0
58
+ */
59
+ /*
60
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
61
+ SPDX-License-Identifier: Apache-2.0
62
+ */
63
+ /*
64
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
65
+ SPDX-License-Identifier: Apache-2.0
66
+ */
67
+ /*
68
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
69
+ SPDX-License-Identifier: Apache-2.0
70
+ */
71
+ /*
72
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
73
+ SPDX-License-Identifier: Apache-2.0
74
+ */
75
+ /*
76
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
77
+ SPDX-License-Identifier: Apache-2.0
78
+ */
79
+ /*
80
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
81
+ SPDX-License-Identifier: Apache-2.0
82
+ */
83
+ /* Style used for links in slots/components that are text heavy, to help links stand out among
84
+ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
85
+ /*
86
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
+ SPDX-License-Identifier: Apache-2.0
88
+ */
89
+ /*
90
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
+ SPDX-License-Identifier: Apache-2.0
92
+ */
93
+ .awsui_calendar_1ykar_1lht6_93:not(#\9) {
94
+ animation: awsui_awsui-motion-fade-in-0_1ykar_1lht6_1 var(--motion-duration-show-quick-tyaalm, 135ms) var(--motion-easing-show-quick-1fcgbv, ease-out);
95
+ animation-fill-mode: both;
96
+ }
97
+ @keyframes awsui_awsui-motion-fade-in-0_1ykar_1lht6_1 {
98
+ from {
99
+ opacity: 0;
100
+ }
101
+ to {
102
+ opacity: 1;
103
+ }
104
+ }
105
+ @media (prefers-reduced-motion: reduce) {
106
+ .awsui_calendar_1ykar_1lht6_93:not(#\9) {
107
+ animation: none;
108
+ transition: none;
109
+ }
110
+ }
111
+ .awsui-motion-disabled .awsui_calendar_1ykar_1lht6_93:not(#\9), .awsui-mode-entering .awsui_calendar_1ykar_1lht6_93:not(#\9) {
112
+ animation: none;
113
+ transition: none;
114
+ }
115
+
116
+ /*
117
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
118
+ SPDX-License-Identifier: Apache-2.0
119
+ */
120
+ .awsui_root_1ykar_1lht6_120:not(#\9) {
121
+ /* used in test-utils */
122
+ }
123
+
124
+ .awsui_calendar_1ykar_1lht6_93:not(#\9) {
125
+ display: block;
126
+ width: 234px;
127
+ overflow: auto;
128
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
129
+ border-collapse: separate;
130
+ border-spacing: 0;
131
+ caption-side: top;
132
+ cursor: auto;
133
+ direction: ltr;
134
+ empty-cells: show;
135
+ font-family: serif;
136
+ font-size: medium;
137
+ font-style: normal;
138
+ font-variant: normal;
139
+ font-weight: normal;
140
+ font-stretch: normal;
141
+ line-height: normal;
142
+ -webkit-hyphens: none;
143
+ hyphens: none;
144
+ letter-spacing: normal;
145
+ list-style: disc outside none;
146
+ tab-size: 8;
147
+ text-align: left;
148
+ text-align-last: auto;
149
+ text-indent: 0;
150
+ text-shadow: none;
151
+ text-transform: none;
152
+ visibility: visible;
153
+ white-space: normal;
154
+ widows: 2;
155
+ word-spacing: normal;
156
+ box-sizing: border-box;
157
+ font-size: var(--font-body-m-size-sregvd, 14px);
158
+ line-height: var(--font-body-m-line-height-i7xxvv, 22px);
159
+ color: var(--color-text-body-default-7m2b3r, #16191f);
160
+ font-weight: 400;
161
+ font-family: var(--font-family-base-mylvzb, "Noto Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
162
+ }
163
+ .awsui_calendar-inner_1ykar_1lht6_137:not(#\9) {
164
+ margin: var(--space-xs-rsr2qu, 8px);
165
+ }
166
+ .awsui_calendar-header_1ykar_1lht6_140:not(#\9) {
167
+ display: flex;
168
+ justify-content: space-between;
169
+ align-items: center;
170
+ }
171
+ .awsui_calendar-header-month_1ykar_1lht6_145:not(#\9) {
172
+ font-size: var(--font-body-m-size-sregvd, 14px);
173
+ line-height: var(--font-body-m-line-height-i7xxvv, 22px);
174
+ font-weight: 700;
175
+ color: var(--color-text-dropdown-item-default-ki8ao1, #16191f);
176
+ }
177
+ .awsui_calendar-next-month-btn_1ykar_1lht6_151:not(#\9) {
178
+ /* used for identifying element */
179
+ }
180
+ .awsui_calendar-prev-month-btn_1ykar_1lht6_154:not(#\9) {
181
+ /* used for identifying element */
182
+ }
183
+ .awsui_calendar-day-names_1ykar_1lht6_157:not(#\9) {
184
+ display: flex;
185
+ justify-content: stretch;
186
+ }
187
+ .awsui_calendar-day-name_1ykar_1lht6_157:not(#\9) {
188
+ flex: 1 1 0%;
189
+ width: 0;
190
+ word-break: break-word;
191
+ text-align: center;
192
+ padding: var(--space-s-hv8c1d, 12px) 0 var(--space-xxs-ynfts5, 4px);
193
+ color: var(--color-text-calendar-month-cx7jxx, #545b64);
194
+ font-size: var(--font-body-s-size-ukw2p9, 12px);
195
+ line-height: var(--font-body-s-line-height-kdsbrl, 16px);
196
+ letter-spacing: var(--font-body-s-letter-spacing-p88gax, normal);
197
+ }
198
+ .awsui_calendar-dates_1ykar_1lht6_172:not(#\9) {
199
+ border: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
200
+ }
201
+ .awsui_calendar-week_1ykar_1lht6_175:not(#\9) {
202
+ display: flex;
203
+ justify-content: stretch;
204
+ }
205
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9) {
206
+ flex: 1 1 0%;
207
+ width: 0;
208
+ word-break: break-word;
209
+ text-align: center;
210
+ border-bottom: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
211
+ border-right: 1px solid var(--color-border-calendar-grid-54zscx, #eaeded);
212
+ border-radius: var(--border-radius-item-wjpc1f, 0px);
213
+ padding: var(--space-xxs-ynfts5, 4px) 0;
214
+ color: var(--color-text-dropdown-item-disabled-dgi2f4, #aab7b8);
215
+ position: relative;
216
+ }
217
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9):last-child {
218
+ border-right: none;
219
+ }
220
+ .awsui_calendar-day-in-last-week_1ykar_1lht6_194:not(#\9) {
221
+ border-bottom: none;
222
+ }
223
+ .awsui_calendar-day-focusable_1ykar_1lht6_197:not(#\9) {
224
+ /* used for identifying element */
225
+ }
226
+ .awsui_calendar-day-enabled_1ykar_1lht6_200:not(#\9) {
227
+ cursor: pointer;
228
+ color: var(--color-text-dropdown-item-secondary-8hw5go, #687078);
229
+ }
230
+ .awsui_calendar-day-enabled_1ykar_1lht6_200.awsui_calendar-day-current-month_1ykar_1lht6_204:not(#\9) {
231
+ color: var(--color-text-dropdown-item-default-ki8ao1, #16191f);
232
+ }
233
+ .awsui_calendar-day-enabled_1ykar_1lht6_200.awsui_calendar-day-current-month_1ykar_1lht6_204:not(#\9):hover {
234
+ color: var(--color-text-calendar-day-hover-p7s945, #16191f);
235
+ background-color: var(--color-background-dropdown-item-hover-hgdj8r, #f2f3f3);
236
+ }
237
+ .awsui_calendar-day-enabled_1ykar_1lht6_200.awsui_calendar-day-current-month_1ykar_1lht6_204:not(#\9):hover:not(.awsui_calendar-day-selected_1ykar_1lht6_211)::after {
238
+ border: var(--border-item-width-yvnixs, 1px) solid var(--color-border-dropdown-item-hover-d32f3f, #879596);
239
+ border-radius: var(--border-radius-item-wjpc1f, 0px);
240
+ }
241
+ .awsui_calendar-day-today_1ykar_1lht6_215:not(#\9) {
242
+ background-color: var(--color-background-calendar-today-wm2baz, #f2f3f3);
243
+ }
244
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9)::after {
245
+ content: "";
246
+ position: absolute;
247
+ top: -1px;
248
+ left: -1px;
249
+ bottom: -1px;
250
+ right: -1px;
251
+ background-color: transparent;
252
+ }
253
+ .awsui_calendar-day_1ykar_1lht6_157 > .awsui_day-inner_1ykar_1lht6_227:not(#\9) {
254
+ position: relative;
255
+ z-index: 1;
256
+ }
257
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9):focus {
258
+ outline: none;
259
+ position: relative;
260
+ }
261
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9):focus {
262
+ outline: 2px dotted transparent;
263
+ outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px) - 1px);
264
+ }
265
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9):focus::before {
266
+ content: " ";
267
+ display: block;
268
+ position: absolute;
269
+ left: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
270
+ top: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
271
+ width: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
272
+ height: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-lbmex4, 0px));
273
+ border-radius: var(--border-radius-calendar-day-focus-ring-16ha5s, 2px);
274
+ box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
275
+ }
276
+ .awsui_calendar-day_1ykar_1lht6_157:not(#\9):focus::before {
277
+ z-index: 2;
278
+ }
279
+ .awsui_calendar-day-selected_1ykar_1lht6_211:not(#\9) {
280
+ border-color: transparent;
281
+ position: relative;
282
+ }
283
+ .awsui_calendar-day-selected_1ykar_1lht6_211:not(#\9)::after {
284
+ background-color: var(--color-background-dropdown-item-selected-w7iegd, #f1faff);
285
+ border: var(--border-item-width-yvnixs, 1px) solid var(--color-border-dropdown-item-selected-bzuxys, #00a1c9);
286
+ border-radius: var(--border-radius-item-wjpc1f, 0px);
287
+ }
288
+ .awsui_calendar-day-selected_1ykar_1lht6_211 > .awsui_day-inner_1ykar_1lht6_227:not(#\9) {
289
+ color: var(--color-text-calendar-day-selected-fr68ny, #16191f);
290
+ position: relative;
291
+ }
@@ -0,0 +1,26 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {
5
+ "calendar": "awsui_calendar_1ykar_1lht6_93",
6
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1ykar_1lht6_1",
7
+ "root": "awsui_root_1ykar_1lht6_120",
8
+ "calendar-inner": "awsui_calendar-inner_1ykar_1lht6_137",
9
+ "calendar-header": "awsui_calendar-header_1ykar_1lht6_140",
10
+ "calendar-header-month": "awsui_calendar-header-month_1ykar_1lht6_145",
11
+ "calendar-next-month-btn": "awsui_calendar-next-month-btn_1ykar_1lht6_151",
12
+ "calendar-prev-month-btn": "awsui_calendar-prev-month-btn_1ykar_1lht6_154",
13
+ "calendar-day-names": "awsui_calendar-day-names_1ykar_1lht6_157",
14
+ "calendar-day-name": "awsui_calendar-day-name_1ykar_1lht6_157",
15
+ "calendar-dates": "awsui_calendar-dates_1ykar_1lht6_172",
16
+ "calendar-week": "awsui_calendar-week_1ykar_1lht6_175",
17
+ "calendar-day": "awsui_calendar-day_1ykar_1lht6_157",
18
+ "calendar-day-in-last-week": "awsui_calendar-day-in-last-week_1ykar_1lht6_194",
19
+ "calendar-day-focusable": "awsui_calendar-day-focusable_1ykar_1lht6_197",
20
+ "calendar-day-enabled": "awsui_calendar-day-enabled_1ykar_1lht6_200",
21
+ "calendar-day-current-month": "awsui_calendar-day-current-month_1ykar_1lht6_204",
22
+ "calendar-day-selected": "awsui_calendar-day-selected_1ykar_1lht6_211",
23
+ "calendar-day-today": "awsui_calendar-day-today_1ykar_1lht6_215",
24
+ "day-inner": "awsui_day-inner_1ykar_1lht6_227"
25
+ };
26
+
@@ -1,5 +1,5 @@
1
- import { DayIndex } from '../index';
2
- import { TimeInputProps } from '../../../time-input/interfaces';
1
+ import { DayIndex } from '../internal';
2
+ import { TimeInputProps } from '../../time-input/interfaces';
3
3
  export declare function renderDayName(locale: string, dayIndex: DayIndex): string;
4
4
  export declare function renderMonthAndYear(locale: string, baseDate: Date): string;
5
5
  export declare function getDateLabel(locale: string, date: Date): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intl.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/intl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO7D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAIxE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,CAOzE;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAc/D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,GAAG,MAAM,CAUlG"}
@@ -1,3 +1,5 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
1
3
  function setDayIndex(date, dayIndex) {
2
4
  var diff = dayIndex - date.getDay();
3
5
  date.setDate(date.getDate() + diff);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intl.js","sourceRoot":"","sources":["../../../../src/calendar/utils/intl.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,SAAS,WAAW,CAAC,IAAU,EAAE,QAAkB;IACjD,IAAM,IAAI,GAAG,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IACtC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,QAAkB;IAC9D,IAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;IAC5B,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAChC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,QAAc;IAC/D,IAAM,MAAM,GAAG,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACjD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;EAEE;AACF,IAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAChD,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,IAAU;IACrD,IAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IACzC,IAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;IACD,IAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC5C,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC;IACH,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,IAAU,EAAE,MAA8B;IACxF,IAAI,OAAO,GAA+B,EAAE,CAAC;IAC7C,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,OAAO,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KAC/B;IACD,IAAI,MAAM,KAAK,OAAO,EAAE;QACtB,OAAO,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;KAClD;IACD,IAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DayIndex } from '../internal';\nimport { TimeInputProps } from '../../time-input/interfaces';\n\nfunction setDayIndex(date: Date, dayIndex: DayIndex): void {\n const diff = dayIndex - date.getDay();\n date.setDate(date.getDate() + diff);\n}\n\nexport function renderDayName(locale: string, dayIndex: DayIndex): string {\n const tempDate = new Date();\n setDayIndex(tempDate, dayIndex);\n return tempDate.toLocaleDateString(locale, { weekday: 'short' });\n}\n\nexport function renderMonthAndYear(locale: string, baseDate: Date): string {\n const result = baseDate.toLocaleDateString(locale, {\n year: 'numeric',\n month: 'long',\n });\n\n return result;\n}\n\n/*\n `toLocaleDateString` is expensive (10+ ms) to calculate in IE11.\n*/\nconst dayLabelCache = new Map<string, string>();\nexport function getDateLabel(locale: string, date: Date): string {\n const cacheKey = locale + date.getTime();\n const cachedValue = dayLabelCache.get(cacheKey);\n if (cachedValue) {\n return cachedValue;\n }\n const value = date.toLocaleDateString(locale, {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n });\n dayLabelCache.set(cacheKey, value);\n return value;\n}\n\nexport function renderTimeLabel(locale: string, date: Date, format?: TimeInputProps.Format): string {\n let options: Intl.DateTimeFormatOptions = {};\n if (format === 'hh') {\n options = { hour: '2-digit' };\n }\n if (format === 'hh:mm') {\n options = { hour: '2-digit', minute: '2-digit' };\n }\n const value = date.toLocaleTimeString(locale, options);\n return value;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { DayIndex } from '..';
1
+ import { DayIndex } from '../internal';
2
2
  export declare function mergeLocales(locale: string, fullLocale: string): string;
3
3
  export declare function normalizeLocale(component: string, locale: string | null): string;
4
4
  export declare function normalizeStartOfWeek(startOfWeek: number | undefined, locale: string): DayIndex;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/locales.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAwBvC,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAM9D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWhF;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,YAEnF"}
@@ -1,6 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { warnOnce } from '../../../internal/logging';
3
+ import { warnOnce } from '../../internal/logging';
4
4
  import { getWeekStartByLocale } from 'weekstart';
5
5
  var getHtmlElement = function () { return (typeof document !== 'undefined' ? document.querySelector('html') : null); };
6
6
  function getBrowserLocale() {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../../src/calendar/utils/locales.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGjD,IAAM,cAAc,GAAG,cAAM,OAAA,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAzE,CAAyE,CAAC;AAEvG,SAAS,gBAAgB;IACvB,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB,EAAE,MAAiC;IACvE,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,EAAE,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,uCAAuC;IACvC,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACzD,6CAA6C;IAC7C,kCAAkC;IAClC,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,EAAE;QACrD,QAAQ,CAAC,SAAS,EAAE,mCAA4B,MAAM,8BAA2B,CAAC,CAAC;QACnF,MAAM,GAAG,EAAE,CAAC;KACb;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,UAAkB;IAC7D,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,IAAI,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/C,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,MAAqB;;IACtE,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACxC,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAI,MAAM,EAAE;QACV,OAAO,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;KAC5C;IACD,IAAM,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,MAAA,cAAc,EAAE,0CAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAClF,IAAI,UAAU,EAAE;QACd,OAAO,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;KAChD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,WAA+B,EAAE,MAAc;IAClF,OAAO,CAAC,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAa,CAAC;AACxG,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '../../internal/logging';\nimport { getWeekStartByLocale } from 'weekstart';\nimport { DayIndex } from '../internal';\n\nconst getHtmlElement = () => (typeof document !== 'undefined' ? document.querySelector('html') : null);\n\nfunction getBrowserLocale() {\n return new Intl.DateTimeFormat().resolvedOptions().locale;\n}\n\nfunction checkLocale(component: string, locale: string | null | undefined): string {\n if (!locale || locale === '') {\n return '';\n }\n\n // Support underscore-delimited locales\n locale = locale && locale.replace(/^([a-z]{2})_/, '$1-');\n // Check that the value matches aa-BB pattern\n // TODO: support full BCP 47 spec?\n if (locale && !locale.match(/^[a-z]{2}(-[A-Z]{2})?$/)) {\n warnOnce(component, `Invalid locale provided: ${locale}. Falling back to default`);\n locale = '';\n }\n return locale;\n}\n\nexport function mergeLocales(locale: string, fullLocale: string) {\n const isShort = locale.length === 2;\n if (isShort && fullLocale.indexOf(locale) === 0) {\n return fullLocale;\n }\n return locale;\n}\n\nexport function normalizeLocale(component: string, locale: string | null): string {\n locale = checkLocale(component, locale);\n const browserLocale = getBrowserLocale();\n if (locale) {\n return mergeLocales(locale, browserLocale);\n }\n const htmlLocale = checkLocale(component, getHtmlElement()?.getAttribute('lang'));\n if (htmlLocale) {\n return mergeLocales(htmlLocale, browserLocale);\n }\n return browserLocale;\n}\n\nexport function normalizeStartOfWeek(startOfWeek: number | undefined, locale: string) {\n return (typeof startOfWeek === 'number' ? startOfWeek % 7 : getWeekStartByLocale(locale)) as DayIndex;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoized-date.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/memoized-date.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,QAAS,MAAM,QAAQ,MAAM,GAAG,IAAI,KAAG,IAAI,GAAG,IAMtE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { parseDate } from '../../../internal/utils/date-time';
3
+ import { parseDate } from '../../internal/utils/date-time';
4
4
  // reuse date instances, to allow shallow equality checking
5
5
  var memoCache = {};
6
6
  export var memoizedDate = function (key, date) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoized-date.js","sourceRoot":"","sources":["../../../../src/calendar/utils/memoized-date.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,2DAA2D;AAC3D,IAAM,SAAS,GAAyB,EAAE,CAAC;AAC3C,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,GAAW,EAAE,IAAmB;IAC3D,IAAM,MAAM,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE;QAChF,SAAS,CAAC,GAAG,CAAC,GAAG,MAAc,CAAC;KACjC;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseDate } from '../../internal/utils/date-time';\n\n// reuse date instances, to allow shallow equality checking\nconst memoCache: Record<string, Date> = {};\nexport const memoizedDate = (key: string, date: string | null): null | Date => {\n const parsed = date && date.length >= 4 ? parseDate(date) : null;\n if (!(memoCache[key] && parsed && memoCache[key].getTime() === parsed.getTime())) {\n memoCache[key] = parsed as Date;\n }\n return memoCache[key];\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { DatePickerProps } from '../../interfaces';
1
+ import { DatePickerProps } from '../../date-picker/interfaces';
2
2
  export interface MoveFocusHandler {
3
3
  (focusedDate: Date, isDateEnabled: DatePickerProps.IsDateEnabledFunction, moveHandler: (date: Date) => Date): Date;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-focus-handler.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/move-focus-handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,CAAC,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,eAAe,CAAC,qBAAqB,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;CACpH;AAMD,QAAA,MAAM,gBAAgB,EAAE,gBAevB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-focus-handler.js","sourceRoot":"","sources":["../../../../src/calendar/utils/move-focus-handler.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAO7C,uEAAuE;AACvE,8EAA8E;AAC9E,uEAAuE;AACvE,yCAAyC;AACzC,IAAM,gBAAgB,GAAqB,UAAC,QAAc,EAAE,aAAa,EAAE,YAAkC;IAC3G,IAAI,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QAC9B,sDAAsD;QACtD,wDAAwD;QACxD,IAAI,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE;YACtD,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { differenceInYears } from 'date-fns';\nimport { DatePickerProps } from '../../date-picker/interfaces';\n\nexport interface MoveFocusHandler {\n (focusedDate: Date, isDateEnabled: DatePickerProps.IsDateEnabledFunction, moveHandler: (date: Date) => Date): Date;\n}\n\n// Helper to move the focus to the given moveCallback's date. It checks\n// the availability of that date and moves forward until this date is enabled.\n// If the entire month in the requested direction has no enabled dates,\n// it returns the currently focused date.\nconst moveFocusHandler: MoveFocusHandler = (focussed: Date, isDateEnabled, moveCallback: (date: Date) => Date) => {\n let current = moveCallback(focussed);\n if (!isDateEnabled) {\n return current;\n }\n\n while (!isDateEnabled(current)) {\n // Get the first enabled date within the one year max.\n // Used when using keyboard navigation on calendar days.\n if (Math.abs(differenceInYears(focussed, current)) > 1) {\n return focussed;\n }\n current = moveCallback(current);\n }\n return current;\n};\n\nexport default moveFocusHandler;\n"]}
@@ -0,0 +1,3 @@
1
+ import { DayIndex } from '../internal';
2
+ export default function rotateDayIndexes(startOfWeek: DayIndex): DayIndex[];
3
+ //# sourceMappingURL=rotate-day-indexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotate-day-indexes.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/rotate-day-indexes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKvC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAM1E"}
@@ -1,3 +1,5 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
1
3
  var days = [0, 1, 2, 3, 4, 5, 6];
2
4
  // Given a start day of week, return an array of day indexes starting at that given day.
3
5
  export default function rotateDayIndexes(startOfWeek) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotate-day-indexes.js","sourceRoot":"","sources":["../../../../src/calendar/utils/rotate-day-indexes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,IAAM,IAAI,GAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/C,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,WAAqB;IAC5D,SAAS,MAAM,CAAC,CAAW,EAAE,CAAS;QACpC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DayIndex } from '../internal';\n\nconst days: DayIndex[] = [0, 1, 2, 3, 4, 5, 6];\n\n// Given a start day of week, return an array of day indexes starting at that given day.\nexport default function rotateDayIndexes(startOfWeek: DayIndex): DayIndex[] {\n function mapDay(_: DayIndex, i: number): DayIndex {\n return days[(i + startOfWeek) % 7];\n }\n\n return days.map(mapDay);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAsB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FA8Jf,CAAC;AAGF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAuB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FA4Kf,CAAC;AAGF,eAAe,UAAU,CAAC"}