@cloudscape-design/components 3.0.831 → 3.0.833

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 (61) hide show
  1. package/app-layout/classic.js +3 -3
  2. package/app-layout/classic.js.map +1 -1
  3. package/app-layout/runtime-drawer/index.d.ts +8 -4
  4. package/app-layout/runtime-drawer/index.d.ts.map +1 -1
  5. package/app-layout/runtime-drawer/index.js.map +1 -1
  6. package/app-layout/utils/use-drawers.d.ts +7 -4
  7. package/app-layout/utils/use-drawers.d.ts.map +1 -1
  8. package/app-layout/utils/use-drawers.js +19 -10
  9. package/app-layout/utils/use-drawers.js.map +1 -1
  10. package/app-layout/visual-refresh/context.js +1 -1
  11. package/app-layout/visual-refresh/context.js.map +1 -1
  12. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +1 -1
  13. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  14. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +1 -1
  15. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
  17. package/app-layout/visual-refresh-toolbar/index.js +4 -4
  18. package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
  19. package/app-layout/visual-refresh-toolbar/interfaces.d.ts +3 -2
  20. package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
  21. package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
  22. package/app-layout/visual-refresh-toolbar/multi-layout.d.ts +3 -2
  23. package/app-layout/visual-refresh-toolbar/multi-layout.d.ts.map +1 -1
  24. package/app-layout/visual-refresh-toolbar/multi-layout.js.map +1 -1
  25. package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts +3 -2
  26. package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
  27. package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +4 -4
  28. package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
  29. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +3 -2
  30. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
  31. package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  32. package/badge/styles.css.js +10 -10
  33. package/badge/styles.scoped.css +20 -20
  34. package/badge/styles.selectors.js +10 -10
  35. package/date-range-picker/calendar/grids/grid-cell.d.ts +7 -0
  36. package/date-range-picker/calendar/grids/grid-cell.d.ts.map +1 -0
  37. package/date-range-picker/calendar/grids/grid-cell.js +51 -0
  38. package/date-range-picker/calendar/grids/grid-cell.js.map +1 -0
  39. package/date-range-picker/calendar/grids/index.js +3 -3
  40. package/date-range-picker/calendar/grids/index.js.map +1 -1
  41. package/date-range-picker/calendar/grids/{grid.d.ts → monthly-grid.d.ts} +2 -2
  42. package/date-range-picker/calendar/grids/monthly-grid.d.ts.map +1 -0
  43. package/date-range-picker/calendar/grids/{grid.js → monthly-grid.js} +4 -49
  44. package/date-range-picker/calendar/grids/monthly-grid.js.map +1 -0
  45. package/internal/base-component/styles.scoped.css +14 -26
  46. package/internal/environment.js +1 -1
  47. package/internal/environment.json +1 -1
  48. package/internal/generated/styles/tokens.d.ts +15 -10
  49. package/internal/generated/styles/tokens.js +15 -10
  50. package/internal/generated/theming/index.cjs +125 -310
  51. package/internal/generated/theming/index.cjs.d.ts +80 -0
  52. package/internal/generated/theming/index.d.ts +80 -0
  53. package/internal/generated/theming/index.js +125 -310
  54. package/internal/manifest.json +1 -1
  55. package/internal/plugins/controllers/drawers.d.ts +13 -5
  56. package/internal/plugins/controllers/drawers.d.ts.map +1 -1
  57. package/internal/plugins/controllers/drawers.js +4 -4
  58. package/internal/plugins/controllers/drawers.js.map +1 -1
  59. package/package.json +1 -1
  60. package/date-range-picker/calendar/grids/grid.d.ts.map +0 -1
  61. package/date-range-picker/calendar/grids/grid.js.map +0 -1
@@ -1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GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\n\nexport type DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\nexport interface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\nexport type DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string) => void;\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string): void;\n closeDrawer(drawerId: string): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string) => {\n this.drawerOpenedListener?.(drawerId);\n };\n\n closeDrawer = (drawerId: string) => {\n this.drawerClosedListener?.(drawerId);\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
1
+ {"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAsCtC,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AA4BX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAEnE,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI,CAAC,2BAA2B,qDAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,mBAAc,GAAG,CAAC,MAAoB,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,iBAAY,GAAG,CAAC,EAA6C,EAAE,EAAE;;gBAAjD,EAAE,EAAE,EAAE,QAAQ,OAA+B,EAA1B,IAAI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AW,EAAC;QACrC,OAAO,GAAuB,CAAC;IACjC,CAAC;IAED,eAAe,CAAC,cAA2C,EAAE;;QAC3D,MAAA,WAAW,CAAC,sBAAsB,oCAAlC,WAAW,CAAC,sBAAsB,GAAK,IAAI,CAAC,sBAAsB,EAAC;QACnE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\n\nexport type DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\nexport interface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\nexport type DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\n\nexport interface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
package/package.json CHANGED
@@ -131,7 +131,7 @@
131
131
  "./internal/base-component/index.js",
132
132
  "./internal/base-component/styles.css.js"
133
133
  ],
134
- "version": "3.0.831",
134
+ "version": "3.0.833",
135
135
  "repository": {
136
136
  "type": "git",
137
137
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +0,0 @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B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,IAC7D,QAAQ;oBAEZ,8BAAM,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,iBAAc,MAAM,IACrD,IAAI,CAAC,OAAO,EAAE,CACV;oBACP,oBAAC,gBAAgB,QAAE,eAAe,CAAoB,CAC7C,CACZ,CAAC;YACJ,CAAC,CAAC,CACC,CACN,CAAC;QACJ,CAAC,CAAC,CACI,CACF,CACT,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,OAAoB,EAAE,OAAoB;IACvE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;QACvD,OAAO,KAAK,CAAC;KACd;IAED,MAAM,OAAO,GACX,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7G,OAAO,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, TdHTMLAttributes, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport {\n addDays,\n addWeeks,\n getDaysInMonth,\n isAfter,\n isBefore,\n isLastDayOfMonth,\n isSameDay,\n isSameMonth,\n isToday,\n} from 'date-fns';\nimport { getCalendarMonth } from 'mnth';\n\nimport { getDateLabel, renderDayName } from '../../../calendar/utils/intl';\nimport ScreenreaderOnly from '../../../internal/components/screenreader-only/index.js';\nimport Tooltip from '../../../internal/components/tooltip';\nimport useHiddenDescription from '../../../internal/hooks/use-hidden-description';\nimport { useMergeRefs } from '../../../internal/hooks/use-merge-refs';\nimport { applyDisplayName } from '../../../internal/utils/apply-display-name';\nimport { formatDate } from '../../../internal/utils/date-time';\nimport { DateRangePickerProps, DayIndex } from '../../interfaces';\n\nimport styles from './styles.css.js';\n\n/**\n * Calendar grid supports two mechanisms of keyboard navigation:\n * - Native screen-reader table navigation (semantic table markup);\n * - Keyboard arrow-keys navigation (a custom key-down handler).\n *\n * The implementation largely follows the w3 example (https://www.w3.org/WAI/ARIA/apg/example-index/dialog-modal/datepicker-dialog) and shares the following issues:\n * - (table navigation) Chrome+VO - weekday is announced twice when navigating to the calendar's header;\n * - (table navigation) Safari+VO - \"dimmed\" state is announced twice;\n * - (table navigation) Firefox/Chrome+NVDA - cannot use table navigation if any cell has a focus;\n * - (keyboard navigation) Firefox+NVDA - every day is announced as \"not selected\";\n * - (keyboard navigation) Safari/Chrome+VO - weekdays are not announced;\n * - (keyboard navigation) Safari/Chrome+VO - days are not announced as interactive (clickable or selectable);\n * - (keyboard navigation) Safari/Chrome+VO - day announcements are not interruptive and can be missed if navigating fast.\n */\n\nexport interface GridProps {\n baseDate: Date;\n selectedStartDate: Date | null;\n selectedEndDate: Date | null;\n\n rangeStartDate: Date | null;\n rangeEndDate: Date | null;\n\n focusedDate: Date | null;\n focusedDateRef: React.RefObject<HTMLTableCellElement>;\n\n onSelectDate: (date: Date) => void;\n onGridKeyDownHandler: (e: React.KeyboardEvent<HTMLElement>) => void;\n onFocusedDateChange: React.Dispatch<React.SetStateAction<Date | null>>;\n\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n dateDisabledReason: DateRangePickerProps.DateDisabledReasonFunction;\n\n locale: string;\n startOfWeek: DayIndex;\n todayAriaLabel?: string;\n ariaLabelledby: string;\n\n className?: string;\n}\n\ninterface GridCellProps extends TdHTMLAttributes<HTMLTableCellElement> {\n disabledReason?: string;\n}\n\nconst GridCell = forwardRef((props: GridCellProps, focusedDateRef: React.Ref<HTMLTableCellElement>) => {\n const { disabledReason, ...rest } = props;\n const isDisabledWithReason = !!disabledReason;\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n const ref = useRef<HTMLTableCellElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n\n return (\n <td\n ref={useMergeRefs(focusedDateRef, ref)}\n {...rest}\n {...(isDisabledWithReason ? targetProps : {})}\n onFocus={event => {\n if (rest.onFocus) {\n rest.onFocus(event);\n }\n\n if (isDisabledWithReason) {\n setShowTooltip(true);\n }\n }}\n onBlur={event => {\n if (rest.onBlur) {\n rest.onBlur(event);\n }\n\n if (isDisabledWithReason) {\n setShowTooltip(false);\n }\n }}\n onMouseEnter={event => {\n if (rest.onMouseEnter) {\n rest.onMouseEnter(event);\n }\n\n if (isDisabledWithReason) {\n setShowTooltip(true);\n }\n }}\n onMouseLeave={event => {\n if (rest.onMouseLeave) {\n rest.onMouseLeave(event);\n }\n\n if (isDisabledWithReason) {\n setShowTooltip(false);\n }\n }}\n >\n {props.children}\n {isDisabledWithReason && (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip className={styles['disabled-reason-tooltip']} trackRef={ref} value={disabledReason!} />\n )}\n </>\n )}\n </td>\n );\n});\n\napplyDisplayName(GridCell, 'GridCell');\n\nexport function Grid({\n baseDate,\n selectedStartDate,\n selectedEndDate,\n rangeStartDate,\n rangeEndDate,\n focusedDate,\n\n focusedDateRef,\n\n onSelectDate,\n onGridKeyDownHandler,\n onFocusedDateChange,\n\n isDateEnabled,\n dateDisabledReason,\n\n locale,\n startOfWeek,\n todayAriaLabel,\n ariaLabelledby,\n\n className,\n}: GridProps) {\n const baseDateTime = baseDate?.getTime();\n // `baseDateTime` is used as a more stable replacement for baseDate\n const weeks = useMemo<Date[][]>(\n () => getCalendarMonth(baseDate, { firstDayOfWeek: startOfWeek }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [baseDateTime, startOfWeek]\n );\n const weekdays = weeks[0].map(date => date.getDay());\n\n return (\n <table role=\"grid\" aria-labelledby={ariaLabelledby} className={clsx(styles.grid, className)}>\n <thead>\n <tr>\n {weekdays.map(dayIndex => (\n <th key={dayIndex} scope=\"col\" className={clsx(styles['grid-cell'], styles['day-header'])}>\n <span aria-hidden=\"true\">{renderDayName(locale, dayIndex, 'short')}</span>\n <ScreenreaderOnly>{renderDayName(locale, dayIndex, 'long')}</ScreenreaderOnly>\n </th>\n ))}\n </tr>\n </thead>\n <tbody onKeyDown={onGridKeyDownHandler}>\n {weeks.map((week, weekIndex) => {\n return (\n <tr key={weekIndex} className={styles.week}>\n {week.map((date, dateIndex) => {\n const isStartDate = !!selectedStartDate && isSameDay(date, selectedStartDate);\n const isEndDate = !!selectedEndDate && isSameDay(date, selectedEndDate);\n const isSelected = isStartDate || isEndDate;\n const isRangeStartDate = !!rangeStartDate && isSameDay(date, rangeStartDate);\n const isRangeEndDate = !!rangeEndDate && isSameDay(date, rangeEndDate);\n\n const isFocused = !!focusedDate && isSameDay(date, focusedDate) && isSameMonth(date, baseDate);\n\n const dateIsInRange = isStartDate || isEndDate || isInRange(date, rangeStartDate, rangeEndDate);\n const inRangeStartWeek =\n rangeStartDate && isInRange(date, rangeStartDate, addDays(addWeeks(rangeStartDate, 1), -1));\n const inRangeEndWeek =\n rangeEndDate && isInRange(date, rangeEndDate, addDays(addWeeks(rangeEndDate, -1), 1));\n const onlyOneSelected =\n !!rangeStartDate && !!rangeEndDate\n ? isSameDay(rangeStartDate, rangeEndDate)\n : !selectedStartDate || !selectedEndDate;\n\n const isEnabled = !isDateEnabled || isDateEnabled(date);\n const disabledReason = dateDisabledReason(date);\n const isDisabledWithReason = !isEnabled && !!disabledReason;\n const isFocusable = isFocused && (isEnabled || isDisabledWithReason);\n\n const baseClasses = {\n [styles.day]: true,\n [styles['grid-cell']]: true,\n [styles['in-first-row']]: weekIndex === 0,\n [styles['in-first-column']]: dateIndex === 0,\n };\n\n if (!isSameMonth(date, baseDate)) {\n return (\n <td\n key={`${weekIndex}:${dateIndex}`}\n ref={isFocused ? focusedDateRef : undefined}\n className={clsx(baseClasses, {\n [styles['in-previous-month']]: isBefore(date, baseDate),\n [styles['last-day-of-month']]: isLastDayOfMonth(date),\n [styles['in-next-month']]: isAfter(date, baseDate),\n })}\n ></td>\n );\n }\n\n const handlers: React.HTMLAttributes<HTMLDivElement> = {};\n if (isEnabled) {\n handlers.onClick = () => onSelectDate(date);\n handlers.onFocus = () => onFocusedDateChange(date);\n }\n\n // Can't be focused.\n let tabIndex = undefined;\n if (isFocusable && (isEnabled || isDisabledWithReason)) {\n // Next focus target.\n tabIndex = 0;\n } else if (isEnabled || isDisabledWithReason) {\n // Can be focused programmatically.\n tabIndex = -1;\n }\n\n // Screen-reader announcement for the focused day.\n let dayAnnouncement = getDateLabel(locale, date, 'short');\n if (isToday(date)) {\n dayAnnouncement += '. ' + todayAriaLabel;\n }\n\n return (\n <GridCell\n ref={isFocused ? focusedDateRef : undefined}\n key={`${weekIndex}:${dateIndex}`}\n className={clsx(baseClasses, {\n [styles['in-current-month']]: isSameMonth(date, baseDate),\n [styles.enabled]: isEnabled,\n [styles.selected]: isSelected,\n [styles['start-date']]: isStartDate,\n [styles['end-date']]: isEndDate,\n [styles['range-start-date']]: isRangeStartDate,\n [styles['range-end-date']]: isRangeEndDate,\n [styles['no-range']]: isSelected && onlyOneSelected,\n [styles['in-range']]: dateIsInRange,\n [styles['in-range-border-block-start']]: !!inRangeStartWeek || date.getDate() <= 7,\n [styles['in-range-border-block-end']]:\n !!inRangeEndWeek || date.getDate() > getDaysInMonth(date) - 7,\n [styles['in-range-border-inline-start']]:\n dateIndex === 0 || date.getDate() === 1 || isRangeStartDate,\n [styles['in-range-border-inline-end']]:\n dateIndex === week.length - 1 || isLastDayOfMonth(date) || isRangeEndDate,\n [styles.today]: isToday(date),\n })}\n aria-selected={isEnabled ? isSelected || dateIsInRange : undefined}\n aria-current={isToday(date) ? 'date' : undefined}\n data-date={formatDate(date)}\n aria-disabled={!isEnabled}\n tabIndex={tabIndex}\n disabledReason={isDisabledWithReason ? disabledReason : undefined}\n {...handlers}\n >\n <span className={styles['day-inner']} aria-hidden=\"true\">\n {date.getDate()}\n </span>\n <ScreenreaderOnly>{dayAnnouncement}</ScreenreaderOnly>\n </GridCell>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n}\n\nfunction isInRange(date: Date, dateOne: Date | null, dateTwo: Date | null) {\n if (!dateOne || !dateTwo || isSameDay(dateOne, dateTwo)) {\n return false;\n }\n\n const inRange =\n (isAfter(date, dateOne) && isBefore(date, dateTwo)) || (isAfter(date, dateTwo) && isBefore(date, dateOne));\n\n return inRange || isSameDay(date, dateOne) || isSameDay(date, dateTwo);\n}\n"]}