@cloudscape-design/components-themeable 3.0.56 → 3.0.58
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/lib/internal/scss/{date-picker → calendar}/motion.scss +0 -0
- package/lib/internal/scss/calendar/styles.scss +170 -0
- package/lib/internal/scss/date-picker/styles.scss +13 -163
- package/lib/internal/template/{date-picker/calendar → calendar}/grid/day/index.d.ts +1 -1
- package/lib/internal/template/calendar/grid/day/index.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/grid/day/index.js +1 -1
- package/lib/internal/template/calendar/grid/day/index.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/grid/index.d.ts +2 -2
- package/lib/internal/template/calendar/grid/index.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/grid/index.js +2 -2
- package/lib/internal/template/calendar/grid/index.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/header/button/index.d.ts +0 -0
- package/lib/internal/template/calendar/header/button/index.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/header/button/index.js +2 -2
- package/lib/internal/template/calendar/header/button/index.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/header/index.d.ts +1 -2
- package/lib/internal/template/calendar/header/index.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/header/index.js +3 -3
- package/lib/internal/template/calendar/header/index.js.map +1 -0
- package/lib/internal/template/calendar/index.d.ts +4 -0
- package/lib/internal/template/calendar/index.d.ts.map +1 -0
- package/lib/internal/template/calendar/index.js +14 -0
- package/lib/internal/template/calendar/index.js.map +1 -0
- package/lib/internal/template/calendar/interfaces.d.ts +56 -0
- package/lib/internal/template/calendar/interfaces.d.ts.map +1 -0
- package/lib/internal/template/calendar/interfaces.js +4 -0
- package/lib/internal/template/calendar/interfaces.js.map +1 -0
- package/lib/internal/template/calendar/internal.d.ts +4 -0
- package/lib/internal/template/calendar/internal.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar/index.js → calendar/internal.js} +9 -13
- package/lib/internal/template/calendar/internal.js.map +1 -0
- package/lib/internal/template/calendar/styles.css.js +25 -0
- package/lib/internal/template/calendar/styles.scoped.css +291 -0
- package/lib/internal/template/calendar/styles.selectors.js +26 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/intl.d.ts +2 -2
- package/lib/internal/template/calendar/utils/intl.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/intl.js +2 -0
- package/lib/internal/template/calendar/utils/intl.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/locales.d.ts +1 -1
- package/lib/internal/template/calendar/utils/locales.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/locales.js +1 -1
- package/lib/internal/template/calendar/utils/locales.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/memoized-date.d.ts +0 -0
- package/lib/internal/template/calendar/utils/memoized-date.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/memoized-date.js +1 -1
- package/lib/internal/template/calendar/utils/memoized-date.js.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/move-focus-handler.d.ts +1 -1
- package/lib/internal/template/calendar/utils/move-focus-handler.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/move-focus-handler.js +0 -0
- package/lib/internal/template/calendar/utils/move-focus-handler.js.map +1 -0
- package/lib/internal/template/calendar/utils/rotate-day-indexes.d.ts +3 -0
- package/lib/internal/template/calendar/utils/rotate-day-indexes.d.ts.map +1 -0
- package/lib/internal/template/{date-picker/calendar → calendar}/utils/rotate-day-indexes.js +2 -0
- package/lib/internal/template/calendar/utils/rotate-day-indexes.js.map +1 -0
- package/lib/internal/template/date-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-picker/index.js +16 -10
- package/lib/internal/template/date-picker/index.js.map +1 -1
- package/lib/internal/template/date-picker/interfaces.d.ts +2 -44
- package/lib/internal/template/date-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-picker/interfaces.js.map +1 -1
- package/lib/internal/template/date-picker/styles.css.js +7 -24
- package/lib/internal/template/date-picker/styles.scoped.css +21 -210
- package/lib/internal/template/date-picker/styles.selectors.js +7 -24
- package/lib/internal/template/date-range-picker/calendar/get-base-date.js +1 -1
- package/lib/internal/template/date-range-picker/calendar/get-base-date.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/day/index.js +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/day/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/grid.js +2 -2
- package/lib/internal/template/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/index.d.ts +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/index.js +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.js +3 -3
- package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +1 -1
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/input/internal.js +1 -1
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/test-utils/dom/calendar/index.d.ts +16 -0
- package/lib/internal/template/test-utils/dom/calendar/index.js +53 -0
- package/lib/internal/template/test-utils/dom/calendar/index.js.map +1 -0
- package/lib/internal/template/test-utils/dom/date-picker/index.d.ts +2 -14
- package/lib/internal/template/test-utils/dom/date-picker/index.js +4 -33
- package/lib/internal/template/test-utils/dom/date-picker/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/calendar/index.d.ts +16 -0
- package/lib/internal/template/test-utils/selectors/calendar/index.js +53 -0
- package/lib/internal/template/test-utils/selectors/calendar/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/date-picker/index.d.ts +2 -14
- package/lib/internal/template/test-utils/selectors/date-picker/index.js +2 -31
- package/lib/internal/template/test-utils/selectors/date-picker/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/internal/template/date-picker/calendar/grid/day/index.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/grid/day/index.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/grid/index.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/grid/index.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/header/button/index.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/header/button/index.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/header/index.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/header/index.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/index.d.ts +0 -17
- package/lib/internal/template/date-picker/calendar/index.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/index.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/intl.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/intl.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/locales.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/locales.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/memoized-date.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/memoized-date.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/move-focus-handler.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/move-focus-handler.js.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.d.ts +0 -3
- package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.d.ts.map +0 -1
- package/lib/internal/template/date-picker/calendar/utils/rotate-day-indexes.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/date-picker/calendar/header/button/index.tsx"],"names":[],"mappings":"AAQA,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,QAAA,MAAM,YAAY,6CAA8C,iBAAiB,gBAoBhF,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/date-picker/calendar/header/button/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAQ5C,IAAM,YAAY,GAAG,UAAC,EAA2D;QAAzD,SAAS,eAAA,EAAE,UAAU,gBAAA,EAAE,aAAa,mBAAA;IAC1D,IAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC;IAC3D,IAAM,oBAAoB,GAA4C;QACpE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC;KAC9F,CAAC;IAEF,IAAM,OAAO,GAAoD,UAAA,CAAC;QAChE,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,aAAa,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,cAAc,eACT,oBAAoB,IACxB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,IAChB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { CancelableEventHandler } from '../../../../internal/events';\nimport { ButtonProps } from '../../../../button/interfaces';\nimport { InternalButton } from '../../../../button/internal';\nimport styles from '../../../styles.css.js';\n\ninterface HeaderButtonProps {\n ariaLabel: string;\n isPrevious: boolean;\n onChangeMonth: (isPrevious: boolean) => void;\n}\n\nconst HeaderButton = ({ ariaLabel, isPrevious, onChangeMonth }: HeaderButtonProps) => {\n const iconName = isPrevious ? 'angle-left' : 'angle-right';\n const additionalAttributes: React.HTMLAttributes<HTMLButtonElement> = {\n className: isPrevious ? styles['calendar-prev-month-btn'] : styles['calendar-next-month-btn'],\n };\n\n const onClick: CancelableEventHandler<ButtonProps.ClickDetail> = e => {\n e.preventDefault();\n onChangeMonth(isPrevious);\n };\n\n return (\n <InternalButton\n {...additionalAttributes}\n iconName={iconName}\n ariaLabel={ariaLabel}\n variant={'icon'}\n onClick={onClick}\n />\n );\n};\n\nexport default HeaderButton;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/header/index.tsx"],"names":[],"mappings":"AAOA,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,uFAOjB,mBAAmB,gBAUrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/header/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,YAAY,MAAM,UAAU,CAAC;AAWpC,IAAM,cAAc,GAAG,UAAC,EAOF;QANpB,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,kBAAkB,wBAAA,EAClB,cAAc,oBAAA;IAEd,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QACvC,oBAAC,YAAY,IAAC,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,GAAI;QAC/F,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,QAAQ,eAAY,QAAQ,IAC9E,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CACjC;QACN,oBAAC,YAAY,IAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAI,CACxF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport styles from '../../styles.css.js';\nimport { renderMonthAndYear } from '../utils/intl';\nimport HeaderButton from './button';\n\ninterface CalendarHeaderProps {\n headerId: string;\n baseDate: Date;\n locale: string;\n onChangeMonth: (prev?: boolean) => void;\n previousMonthLabel: string;\n nextMonthLabel: string;\n}\n\nconst CalendarHeader = ({\n headerId,\n baseDate,\n locale,\n onChangeMonth,\n previousMonthLabel,\n nextMonthLabel,\n}: CalendarHeaderProps) => {\n return (\n <div className={styles['calendar-header']}>\n <HeaderButton ariaLabel={previousMonthLabel} isPrevious={true} onChangeMonth={onChangeMonth} />\n <div className={styles['calendar-header-month']} id={headerId} aria-live=\"polite\">\n {renderMonthAndYear(locale, baseDate)}\n </div>\n <HeaderButton ariaLabel={nextMonthLabel} isPrevious={false} onChangeMonth={onChangeMonth} />\n </div>\n );\n};\n\nexport default CalendarHeader;\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseComponentProps } from '../../internal/base-component';
|
|
2
|
-
import { NonCancelableEventHandler } from '../../internal/events/index.js';
|
|
3
|
-
import { DatePickerProps } from '../interfaces.js';
|
|
4
|
-
export declare type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
-
interface CalendarProps extends BaseComponentProps {
|
|
6
|
-
value: string;
|
|
7
|
-
onChange?: NonCancelableEventHandler<DatePickerProps.ChangeDetail>;
|
|
8
|
-
locale?: string;
|
|
9
|
-
startOfWeek?: number;
|
|
10
|
-
isDateEnabled?: (date: Date) => boolean;
|
|
11
|
-
todayAriaLabel: string;
|
|
12
|
-
nextMonthAriaLabel: string;
|
|
13
|
-
previousMonthAriaLabel: string;
|
|
14
|
-
}
|
|
15
|
-
export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, }: CalendarProps): JSX.Element;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/date-picker/calendar/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAUnE,OAAO,EAA0B,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,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AC,aAAa,KAAI,MAAA,cAAc,CAAC,OAAO,0CAAE,QAAQ,CAAC,KAAK,CAAC,aAAqB,CAAC,CAAA,CAAC;QACpH,IAAI,CAAC,sBAAsB,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,CAAC;SACtB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,wCACM,YAAY,IAChB,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,aAAa,sBACA,QAAQ,EAC1B,GAAG,EAAE,UAAU;QAEf,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC;YACtC,oBAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,0BAA0B,EACzC,kBAAkB,EAAE,sBAAsB,EAC1C,cAAc,EAAE,kBAAkB,GAClC;YACF,6BAAK,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc;gBAC1C,oBAAC,IAAI,IACH,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,qBAAqB,EAClC,YAAY,EAAE,uBAAuB,EACrC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,qBAAqB,EAClC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,gBAAgB,GACjC,CACE,CACF,CACF,CACP,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 { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport useFocusVisible from '../../internal/hooks/focus-visible/index.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id/index.js';\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, NonCancelableEventHandler } from '../../internal/events/index.js';\nimport { DatePickerProps } from '../interfaces.js';\nimport checkControlled from '../../internal/hooks/check-controlled/index.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface CalendarProps extends BaseComponentProps {\n value: string;\n onChange?: NonCancelableEventHandler<DatePickerProps.ChangeDetail>;\n locale?: string;\n startOfWeek?: number;\n isDateEnabled?: (date: Date) => boolean;\n todayAriaLabel: string;\n nextMonthAriaLabel: string;\n previousMonthAriaLabel: string;\n}\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 focusVisible = useFocusVisible();\n const headerId = useUniqueId('calendar-dialog-title-');\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\n {...focusVisible}\n className={styles.calendar}\n tabIndex={0}\n role=\"application\"\n aria-describedby={headerId}\n ref={elementRef}\n >\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n headerId={headerId}\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intl.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/intl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAOhE,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intl.js","sourceRoot":"","sources":["../../../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AC,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\nimport { DayIndex } from '../index';\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAwB9B,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,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,EAA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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 '..';\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memoized-date.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/memoized-date.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,QAAS,MAAM,QAAQ,MAAM,GAAG,IAAI,KAAG,IAAI,GAAG,IAMtE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memoized-date.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/memoized-date.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-focus-handler.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/move-focus-handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-focus-handler.js","sourceRoot":"","sources":["../../../../../src/date-picker/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 '../../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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rotate-day-indexes.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/rotate-day-indexes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKpC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAM1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rotate-day-indexes.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/rotate-day-indexes.ts"],"names":[],"mappings":"AAIA,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\nimport { DayIndex } from '../index';\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"]}
|