@cloudscape-design/components 3.0.98 → 3.0.99

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.
@@ -0,0 +1,9 @@
1
+ interface HeaderButtonProps {
2
+ ariaLabel: string;
3
+ baseDate: Date;
4
+ onChangeMonth: (date: Date) => void;
5
+ }
6
+ export declare function PrevMonthButton({ ariaLabel, baseDate, onChangeMonth }: HeaderButtonProps): JSX.Element;
7
+ export declare function NextMonthButton({ ariaLabel, baseDate, onChangeMonth }: HeaderButtonProps): JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=header-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-button.d.ts","sourceRoot":"","sources":["../../../../src/calendar/header/header-button.tsx"],"names":[],"mappings":"AAQA,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,IAAI,CAAC;IACf,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,iBAAiB,eAWxF;AAED,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,iBAAiB,eAWxF"}
@@ -0,0 +1,15 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import { InternalButton } from '../../button/internal';
5
+ import styles from '../styles.css.js';
6
+ import { addMonths } from 'date-fns';
7
+ export function PrevMonthButton(_a) {
8
+ var ariaLabel = _a.ariaLabel, baseDate = _a.baseDate, onChangeMonth = _a.onChangeMonth;
9
+ return (React.createElement(InternalButton, { iconName: "angle-left", ariaLabel: ariaLabel, variant: "icon", onClick: function () { return onChangeMonth(addMonths(baseDate, -1)); }, formAction: "none", className: styles['calendar-prev-month-btn'] }));
10
+ }
11
+ export function NextMonthButton(_a) {
12
+ var ariaLabel = _a.ariaLabel, baseDate = _a.baseDate, onChangeMonth = _a.onChangeMonth;
13
+ return (React.createElement(InternalButton, { iconName: "angle-right", ariaLabel: ariaLabel, variant: "icon", onClick: function () { return onChangeMonth(addMonths(baseDate, 1)); }, formAction: "none", className: styles['calendar-next-month-btn'] }));
14
+ }
15
+ //# sourceMappingURL=header-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-button.js","sourceRoot":"","sources":["../../../../src/calendar/header/header-button.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQrC,MAAM,UAAU,eAAe,CAAC,EAAyD;QAAvD,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,aAAa,mBAAA;IAClE,OAAO,CACL,oBAAC,cAAc,IACb,QAAQ,EAAC,YAAY,EACrB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,cAAM,OAAA,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAtC,CAAsC,EACrD,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,MAAM,CAAC,yBAAyB,CAAC,GAC5C,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAAyD;QAAvD,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,aAAa,mBAAA;IAClE,OAAO,CACL,oBAAC,cAAc,IACb,QAAQ,EAAC,aAAa,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,cAAM,OAAA,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAArC,CAAqC,EACpD,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,MAAM,CAAC,yBAAyB,CAAC,GAC5C,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { InternalButton } from '../../button/internal';\nimport styles from '../styles.css.js';\nimport { addMonths } from 'date-fns';\n\ninterface HeaderButtonProps {\n ariaLabel: string;\n baseDate: Date;\n onChangeMonth: (date: Date) => void;\n}\n\nexport function PrevMonthButton({ ariaLabel, baseDate, onChangeMonth }: HeaderButtonProps) {\n return (\n <InternalButton\n iconName=\"angle-left\"\n ariaLabel={ariaLabel}\n variant=\"icon\"\n onClick={() => onChangeMonth(addMonths(baseDate, -1))}\n formAction=\"none\"\n className={styles['calendar-prev-month-btn']}\n />\n );\n}\n\nexport function NextMonthButton({ ariaLabel, baseDate, onChangeMonth }: HeaderButtonProps) {\n return (\n <InternalButton\n iconName=\"angle-right\"\n ariaLabel={ariaLabel}\n variant=\"icon\"\n onClick={() => onChangeMonth(addMonths(baseDate, 1))}\n formAction=\"none\"\n className={styles['calendar-next-month-btn']}\n />\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  interface CalendarHeaderProps {
2
2
  baseDate: Date;
3
3
  locale: string;
4
- onChangeMonth: (prev?: boolean) => void;
4
+ onChangeMonth: (date: Date) => void;
5
5
  previousMonthLabel: string;
6
6
  nextMonthLabel: string;
7
7
  headingId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendar/header/index.tsx"],"names":[],"mappings":"AAOA,UAAU,mBAAmB;IAC3B,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;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,wFAOjB,mBAAmB,gBAUrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendar/header/index.tsx"],"names":[],"mappings":"AAOA,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,wFAOjB,mBAAmB,gBAUrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -3,13 +3,13 @@
3
3
  import React from 'react';
4
4
  import styles from '../styles.css.js';
5
5
  import { renderMonthAndYear } from '../utils/intl';
6
- import HeaderButton from './button';
6
+ import { PrevMonthButton, NextMonthButton } from './header-button';
7
7
  var CalendarHeader = function (_a) {
8
8
  var baseDate = _a.baseDate, locale = _a.locale, onChangeMonth = _a.onChangeMonth, previousMonthLabel = _a.previousMonthLabel, nextMonthLabel = _a.nextMonthLabel, headingId = _a.headingId;
9
9
  return (React.createElement("div", { className: styles['calendar-header'] },
10
- React.createElement(HeaderButton, { ariaLabel: previousMonthLabel, isPrevious: true, onChangeMonth: onChangeMonth }),
10
+ React.createElement(PrevMonthButton, { ariaLabel: previousMonthLabel, baseDate: baseDate, onChangeMonth: onChangeMonth }),
11
11
  React.createElement("h2", { className: styles['calendar-header-month'], id: headingId }, renderMonthAndYear(locale, baseDate)),
12
- React.createElement(HeaderButton, { ariaLabel: nextMonthLabel, isPrevious: false, onChangeMonth: onChangeMonth })));
12
+ React.createElement(NextMonthButton, { ariaLabel: nextMonthLabel, baseDate: baseDate, onChangeMonth: onChangeMonth })));
13
13
  };
14
14
  export default CalendarHeader;
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/calendar/header/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,YAAY,MAAM,UAAU,CAAC;AAWpC,IAAM,cAAc,GAAG,UAAC,EAOF;QANpB,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,kBAAkB,wBAAA,EAClB,cAAc,oBAAA,EACd,SAAS,eAAA;IAET,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,4BAAI,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,SAAS,IAC1D,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAClC;QACL,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 baseDate: Date;\n locale: string;\n onChangeMonth: (prev?: boolean) => void;\n previousMonthLabel: string;\n nextMonthLabel: string;\n headingId: string;\n}\n\nconst CalendarHeader = ({\n baseDate,\n locale,\n onChangeMonth,\n previousMonthLabel,\n nextMonthLabel,\n headingId,\n}: CalendarHeaderProps) => {\n return (\n <div className={styles['calendar-header']}>\n <HeaderButton ariaLabel={previousMonthLabel} isPrevious={true} onChangeMonth={onChangeMonth} />\n <h2 className={styles['calendar-header-month']} id={headingId}>\n {renderMonthAndYear(locale, baseDate)}\n </h2>\n <HeaderButton ariaLabel={nextMonthLabel} isPrevious={false} onChangeMonth={onChangeMonth} />\n </div>\n );\n};\n\nexport default CalendarHeader;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/calendar/header/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAWnE,IAAM,cAAc,GAAG,UAAC,EAOF;QANpB,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,kBAAkB,wBAAA,EAClB,cAAc,oBAAA,EACd,SAAS,eAAA;IAET,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC;QACvC,oBAAC,eAAe,IAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAI;QACpG,4BAAI,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,SAAS,IAC1D,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAClC;QACL,oBAAC,eAAe,IAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAI,CAC5F,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 { PrevMonthButton, NextMonthButton } from './header-button';\n\ninterface CalendarHeaderProps {\n baseDate: Date;\n locale: string;\n onChangeMonth: (date: Date) => void;\n previousMonthLabel: string;\n nextMonthLabel: string;\n headingId: string;\n}\n\nconst CalendarHeader = ({\n baseDate,\n locale,\n onChangeMonth,\n previousMonthLabel,\n nextMonthLabel,\n headingId,\n}: CalendarHeaderProps) => {\n return (\n <div className={styles['calendar-header']}>\n <PrevMonthButton ariaLabel={previousMonthLabel} baseDate={baseDate} onChangeMonth={onChangeMonth} />\n <h2 className={styles['calendar-header-month']} id={headingId}>\n {renderMonthAndYear(locale, baseDate)}\n </h2>\n <NextMonthButton ariaLabel={nextMonthLabel} baseDate={baseDate} onChangeMonth={onChangeMonth} />\n </div>\n );\n};\n\nexport default CalendarHeader;\n"]}
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { __assign, __rest } from "tslib";
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
- import { addMonths, isSameMonth } from 'date-fns';
5
+ import { isSameMonth } from 'date-fns';
6
6
  import styles from './styles.css.js';
7
7
  import CalendarHeader from './header';
8
8
  import Grid from './grid';
@@ -50,8 +50,8 @@ export default function Calendar(_a) {
50
50
  };
51
51
  var baseDate = getBaseDate(displayedDate, isDateEnabled);
52
52
  var focusableDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);
53
- var onHeaderChangeMonthHandler = function (isPreviousButtonClick) {
54
- setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));
53
+ var onHeaderChangeMonthHandler = function (date) {
54
+ setDisplayedDate(date);
55
55
  setFocusedDate(null);
56
56
  };
57
57
  var onGridChangeMonthHandler = function (newMonth) {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[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AAC","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 { addMonths, isSameMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport { normalizeLocale, normalizeStartOfWeek } from '../internal/utils/locale';\nimport { formatDate, parseDate } 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';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { getBaseDate } from './utils/navigation';\nimport { useDateCache } from '../internal/hooks/use-date-cache/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index.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 ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n __internalRootRef,\n ...rest\n}: CalendarProps & InternalBaseComponentProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n\n const valueDateCache = useDateCache();\n const focusedDateCache = useDateCache();\n\n // Set displayed date to value if defined or to current date otherwise.\n const parsedValue = value && value.length >= 4 ? parseDate(value) : null;\n const memoizedValue = parsedValue ? valueDateCache(parsedValue) : null;\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n const headingId = useUniqueId('calendar-heading');\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 const baseDate = getBaseDate(displayedDate, isDateEnabled);\n const focusableDate = 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 setFocusedDate(date ? focusedDateCache(date) : null);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\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 ref={__internalRootRef}\n {...baseProps}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n className={clsx(styles.root, styles.calendar, baseProps.className)}\n >\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n headingId={headingId}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedDate}\n focusableDate={focusableDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n ariaLabelledby={headingId}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,eAAe,MAAM,6CAA6C,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAIvE,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAcY;IAb3C,IAAA,KAAK,WAAA,EACL,cAAW,EAAX,MAAM,m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a,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,uBAAuB,EACrC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,qBAAqB,EAClC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,aAAa,EAC3B,cAAc,EAAE,SAAS,GACzB,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\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { isSameMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport { normalizeLocale, normalizeStartOfWeek } from '../internal/utils/locale';\nimport { formatDate, parseDate } 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';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { getBaseDate } from './utils/navigation';\nimport { useDateCache } from '../internal/hooks/use-date-cache/index.js';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index.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 ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n __internalRootRef,\n ...rest\n}: CalendarProps & InternalBaseComponentProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n\n const valueDateCache = useDateCache();\n const focusedDateCache = useDateCache();\n\n // Set displayed date to value if defined or to current date otherwise.\n const parsedValue = value && value.length >= 4 ? parseDate(value) : null;\n const memoizedValue = parsedValue ? valueDateCache(parsedValue) : null;\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n const headingId = useUniqueId('calendar-heading');\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 const baseDate = getBaseDate(displayedDate, isDateEnabled);\n const focusableDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (date: Date) => {\n setDisplayedDate(date);\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 setFocusedDate(date ? focusedDateCache(date) : null);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\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 ref={__internalRootRef}\n {...baseProps}\n role=\"group\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n className={clsx(styles.root, styles.calendar, baseProps.className)}\n >\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n headingId={headingId}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedDate}\n focusableDate={focusableDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n ariaLabelledby={headingId}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (0ec1556)';
2
+ export var PACKAGE_VERSION = '3.0.0 (e5807d9)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
package/package.json CHANGED
@@ -112,6 +112,6 @@
112
112
  "./internal/base-component/index.js",
113
113
  "./internal/base-component/styles.css.js"
114
114
  ],
115
- "version": "3.0.98",
115
+ "version": "3.0.99",
116
116
  "license": "Apache-2.0"
117
117
  }
@@ -1,8 +0,0 @@
1
- interface HeaderButtonProps {
2
- ariaLabel: string;
3
- isPrevious: boolean;
4
- onChangeMonth: (isPrevious: boolean) => void;
5
- }
6
- declare const HeaderButton: ({ ariaLabel, isPrevious, onChangeMonth }: HeaderButtonProps) => JSX.Element;
7
- export default HeaderButton;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/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,20 +0,0 @@
1
- import { __assign } from "tslib";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- import React from 'react';
5
- import { InternalButton } from '../../../button/internal';
6
- import styles from '../../styles.css.js';
7
- var HeaderButton = function (_a) {
8
- var ariaLabel = _a.ariaLabel, isPrevious = _a.isPrevious, onChangeMonth = _a.onChangeMonth;
9
- var iconName = isPrevious ? 'angle-left' : 'angle-right';
10
- var additionalAttributes = {
11
- className: isPrevious ? styles['calendar-prev-month-btn'] : styles['calendar-next-month-btn']
12
- };
13
- var onClick = function (e) {
14
- e.preventDefault();
15
- onChangeMonth(isPrevious);
16
- };
17
- return (React.createElement(InternalButton, __assign({}, additionalAttributes, { iconName: iconName, ariaLabel: ariaLabel, variant: 'icon', onClick: onClick })));
18
- };
19
- export default HeaderButton;
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/calendar/header/button/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAQzC,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"]}