@cloudscape-design/components 3.0.430 → 3.0.431

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAwB1E,eAAO,MAAM,MAAM,2FAoGlB,CAAC;AA6CF,eAAO,MAAM,iBAAiB,4GAS3B,sBAAsB,gBAyFxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAwB1E,eAAO,MAAM,MAAM,2FAwGlB,CAAC;AA6CF,eAAO,MAAM,iBAAiB,4GAS3B,sBAAsB,gBAyFxB,CAAC"}
@@ -61,7 +61,7 @@ export const Drawer = React.forwardRef(({ id, contentClassName, toggleClassName,
61
61
  React.createElement("div", { style: { width: drawerContentWidth, top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName) },
62
62
  !isMobile && !hideOpenButton && regularOpenButton,
63
63
  resizeHandle,
64
- React.createElement(TagName, { "aria-label": mainLabel, "aria-hidden": !isOpen },
64
+ React.createElement(TagName, { className: clsx(resizeHandle && styles['drawer-resize-content']), "aria-label": mainLabel, "aria-hidden": !isOpen },
65
65
  React.createElement(CloseButton, { ref: toggleRefs.close, className: closeClassName, ariaLabel: closeLabel, onClick: () => {
66
66
  onToggle(false);
67
67
  } }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"A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CAAC,gBAAgB,CAAC,CAAC;oBAC5C,oBAAC,YAAY,IACX,SAAS,EACP,oBAAoB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,wBAAwB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAE3F,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,GACtD,CACE,CACP,CACG,CACA,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { ToggleButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';\nimport OverflowMenu from './overflow-menu';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\nimport { splitItems } from './drawers-helpers';\nimport { TOOLS_DRAWER_ID } from '../utils/use-drawers';\nimport { AppLayoutProps } from '../interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n id,\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n children,\n hideOpenButton,\n isOpen,\n isHidden,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = ariaLabels;\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={isOpen ? undefined : false}\n />\n </TagName>\n );\n\n return (\n <div\n id={id}\n ref={ref}\n className={clsx(styles.drawer, {\n [styles.hide]: isHidden,\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && !hideOpenButton && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => {\n onToggle(false);\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\ninterface DrawerTriggerProps {\n testUtilsClassName?: string;\n ariaLabel: string | undefined;\n ariaExpanded: boolean;\n ariaControls?: string;\n badge: boolean | undefined;\n itemId?: string;\n isActive: boolean;\n trigger: AppLayoutProps.Drawer['trigger'];\n onClick: (() => void) | undefined;\n}\n\nconst DrawerTrigger = React.forwardRef(\n (\n {\n testUtilsClassName,\n ariaLabel,\n ariaExpanded,\n ariaControls,\n badge,\n itemId,\n isActive,\n trigger,\n onClick,\n }: DrawerTriggerProps,\n ref: React.Ref<{ focus: () => void }>\n ) => (\n <div className={clsx(styles['drawer-trigger'], isActive && styles['drawer-trigger-active'])} onClick={onClick}>\n <ToggleButton\n ref={ref}\n className={testUtilsClassName}\n iconName={trigger.iconName}\n iconSvg={trigger.iconSvg}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n ariaControls={ariaControls}\n badge={badge}\n testId={itemId && `awsui-app-layout-trigger-${itemId}`}\n />\n </div>\n )\n);\n\nexport const DrawerTriggersBar = ({\n isMobile,\n topOffset,\n bottomOffset,\n activeDrawerId,\n ariaLabels,\n drawers,\n drawerRefs,\n onDrawerChange,\n}: DrawerTriggersBarProps) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerHeight, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxHeight);\n const isCompactMode = useDensityMode(containerRef) === 'compact';\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (containerHeight) {\n const ITEM_HEIGHT = isCompactMode ? 34 : 38;\n const overflowSpot = containerHeight / 1.5;\n\n const index = Math.floor(overflowSpot / ITEM_HEIGHT);\n\n return index;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n [styles.hide]: drawers.length === 1 && !!activeDrawerId,\n })}\n ref={containerRef}\n >\n <div\n ref={triggersContainerRef}\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], {\n [styles['drawer-content-clickable']]: drawers.length === 1,\n })}\n onClick={\n drawers.length === 1\n ? () => onDrawerChange(drawers[0].id !== activeDrawerId ? drawers[0].id : null)\n : undefined\n }\n >\n {!isMobile && (\n <aside aria-label={ariaLabels?.drawers} role=\"region\">\n <div className={clsx(styles['drawer-triggers-wrapper'])} role=\"toolbar\" aria-orientation=\"vertical\">\n {visibleItems.map((item, index) => {\n return (\n <DrawerTrigger\n key={index}\n testUtilsClassName={clsx(\n testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n ariaExpanded={activeDrawerId === item.id}\n ref={item.id === previousActiveDrawerId.current ? drawerRefs.toggle : undefined}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n trigger={item.trigger}\n badge={item.badge}\n itemId={item.id}\n isActive={activeDrawerId === item.id}\n onClick={\n drawers.length !== 1\n ? () => onDrawerChange(item.id !== activeDrawerId ? item.id : null)\n : undefined\n }\n />\n );\n })}\n {overflowItems.length > 0 && (\n <div className={clsx(styles['drawer-trigger'])}>\n <OverflowMenu\n ariaLabel={\n overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow\n }\n items={overflowItems}\n onItemClick={({ detail }) => onDrawerChange(detail.id)}\n />\n </div>\n )}\n </div>\n </aside>\n )}\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,0FAA0F;AAC1F,qFAAqF;AACrF,uFAAuF;AACvF,4EAA4E;AAC5E,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,wBAAwB;AACxB,0FAA0F;AAC1F,4FAA4F;AAC5F,WAAW;AACX,oBAAoB;AACpB,iDAAiD;AACjD,iDAAiD;AACjD,iDAAiD;AACjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,EAAE,EACF,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,YAAY,GACO,EACrB,GAA8B,EAC9B,EAAE;IACF,MAAM,oBAAoB,GAAG,MAAM,CAAqB,IAA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I,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;4BACnE,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;gBACJ,CAAC,CAAC;gBACD,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC3B,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;oBAC5C,oBAAC,YAAY,IACX,SAAS,EACP,oBAAoB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,wBAAwB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAE3F,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,GACtD,CACE,CACP,CACG,CACA,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { ToggleButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps } from './interfaces';\nimport OverflowMenu from './overflow-menu';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\nimport { splitItems } from './drawers-helpers';\nimport { TOOLS_DRAWER_ID } from '../utils/use-drawers';\nimport { AppLayoutProps } from '../interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n id,\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n children,\n hideOpenButton,\n isOpen,\n isHidden,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = ariaLabels;\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={isOpen ? undefined : false}\n />\n </TagName>\n );\n\n return (\n <div\n id={id}\n ref={ref}\n className={clsx(styles.drawer, {\n [styles.hide]: isHidden,\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && !hideOpenButton && regularOpenButton}\n {resizeHandle}\n <TagName\n className={clsx(resizeHandle && styles['drawer-resize-content'])}\n aria-label={mainLabel}\n aria-hidden={!isOpen}\n >\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={closeLabel}\n onClick={() => {\n onToggle(false);\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\ninterface DrawerTriggerProps {\n testUtilsClassName?: string;\n ariaLabel: string | undefined;\n ariaExpanded: boolean;\n ariaControls?: string;\n badge: boolean | undefined;\n itemId?: string;\n isActive: boolean;\n trigger: AppLayoutProps.Drawer['trigger'];\n onClick: (() => void) | undefined;\n}\n\nconst DrawerTrigger = React.forwardRef(\n (\n {\n testUtilsClassName,\n ariaLabel,\n ariaExpanded,\n ariaControls,\n badge,\n itemId,\n isActive,\n trigger,\n onClick,\n }: DrawerTriggerProps,\n ref: React.Ref<{ focus: () => void }>\n ) => (\n <div className={clsx(styles['drawer-trigger'], isActive && styles['drawer-trigger-active'])} onClick={onClick}>\n <ToggleButton\n ref={ref}\n className={testUtilsClassName}\n iconName={trigger.iconName}\n iconSvg={trigger.iconSvg}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n ariaControls={ariaControls}\n badge={badge}\n testId={itemId && `awsui-app-layout-trigger-${itemId}`}\n />\n </div>\n )\n);\n\nexport const DrawerTriggersBar = ({\n isMobile,\n topOffset,\n bottomOffset,\n activeDrawerId,\n ariaLabels,\n drawers,\n drawerRefs,\n onDrawerChange,\n}: DrawerTriggersBarProps) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerHeight, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxHeight);\n const isCompactMode = useDensityMode(containerRef) === 'compact';\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (containerHeight) {\n const ITEM_HEIGHT = isCompactMode ? 34 : 38;\n const overflowSpot = containerHeight / 1.5;\n\n const index = Math.floor(overflowSpot / ITEM_HEIGHT);\n\n return index;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n [styles.hide]: drawers.length === 1 && !!activeDrawerId,\n })}\n ref={containerRef}\n >\n <div\n ref={triggersContainerRef}\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], {\n [styles['drawer-content-clickable']]: drawers.length === 1,\n })}\n onClick={\n drawers.length === 1\n ? () => onDrawerChange(drawers[0].id !== activeDrawerId ? drawers[0].id : null)\n : undefined\n }\n >\n {!isMobile && (\n <aside aria-label={ariaLabels?.drawers} role=\"region\">\n <div className={clsx(styles['drawer-triggers-wrapper'])} role=\"toolbar\" aria-orientation=\"vertical\">\n {visibleItems.map((item, index) => {\n return (\n <DrawerTrigger\n key={index}\n testUtilsClassName={clsx(\n testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n ariaExpanded={activeDrawerId === item.id}\n ref={item.id === previousActiveDrawerId.current ? drawerRefs.toggle : undefined}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n trigger={item.trigger}\n badge={item.badge}\n itemId={item.id}\n isActive={activeDrawerId === item.id}\n onClick={\n drawers.length !== 1\n ? () => onDrawerChange(item.id !== activeDrawerId ? item.id : null)\n : undefined\n }\n />\n );\n })}\n {overflowItems.length > 0 && (\n <div className={clsx(styles['drawer-trigger'])}>\n <OverflowMenu\n ariaLabel={\n overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow\n }\n items={overflowItems}\n onItemClick={({ detail }) => onDrawerChange(detail.id)}\n />\n </div>\n )}\n </div>\n </aside>\n )}\n </div>\n </div>\n );\n};\n"]}
@@ -1,16 +1,17 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "toggle": "awsui_toggle_1uo6m_1pr3d_97",
5
- "drawer-triggers": "awsui_drawer-triggers_1uo6m_1pr3d_102",
6
- "drawer": "awsui_drawer_1uo6m_1pr3d_102",
7
- "drawer-mobile": "awsui_drawer-mobile_1uo6m_1pr3d_112",
8
- "drawer-closed": "awsui_drawer-closed_1uo6m_1pr3d_115",
9
- "drawer-content": "awsui_drawer-content_1uo6m_1pr3d_122",
10
- "drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_1pr3d_137",
11
- "drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_1pr3d_148",
12
- "drawer-trigger": "awsui_drawer-trigger_1uo6m_1pr3d_102",
13
- "drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_1pr3d_166",
14
- "hide": "awsui_hide_1uo6m_1pr3d_174"
4
+ "toggle": "awsui_toggle_1uo6m_yiwkb_97",
5
+ "drawer-triggers": "awsui_drawer-triggers_1uo6m_yiwkb_102",
6
+ "drawer": "awsui_drawer_1uo6m_yiwkb_102",
7
+ "drawer-mobile": "awsui_drawer-mobile_1uo6m_yiwkb_112",
8
+ "drawer-closed": "awsui_drawer-closed_1uo6m_yiwkb_115",
9
+ "drawer-content": "awsui_drawer-content_1uo6m_yiwkb_122",
10
+ "drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_yiwkb_137",
11
+ "drawer-resize-content": "awsui_drawer-resize-content_1uo6m_yiwkb_147",
12
+ "drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_yiwkb_153",
13
+ "drawer-trigger": "awsui_drawer-trigger_1uo6m_yiwkb_102",
14
+ "drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_yiwkb_171",
15
+ "hide": "awsui_hide_1uo6m_yiwkb_179"
15
16
  };
16
17
 
@@ -94,83 +94,88 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
94
94
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
- .awsui_toggle_1uo6m_1pr3d_97:not(#\9) {
97
+ .awsui_toggle_1uo6m_yiwkb_97:not(#\9) {
98
98
  box-sizing: border-box;
99
99
  padding: var(--space-xxs-p8yyaw, 4px) 7px;
100
100
  }
101
101
 
102
- .awsui_drawer-triggers_1uo6m_1pr3d_102:not(#\9) {
102
+ .awsui_drawer-triggers_1uo6m_yiwkb_102:not(#\9) {
103
103
  box-sizing: border-box;
104
104
  }
105
105
 
106
- .awsui_drawer_1uo6m_1pr3d_102:not(#\9) {
106
+ .awsui_drawer_1uo6m_yiwkb_102:not(#\9) {
107
107
  flex-shrink: 0;
108
108
  position: relative;
109
109
  word-wrap: break-word;
110
110
  box-shadow: var(--shadow-panel-ezyqp4, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1));
111
111
  }
112
- .awsui_drawer_1uo6m_1pr3d_102:not(#\9):not(.awsui_drawer-mobile_1uo6m_1pr3d_112) {
112
+ .awsui_drawer_1uo6m_yiwkb_102:not(#\9):not(.awsui_drawer-mobile_1uo6m_yiwkb_112) {
113
113
  z-index: 830;
114
114
  }
115
- .awsui_drawer-closed_1uo6m_1pr3d_115:not(#\9) {
115
+ .awsui_drawer-closed_1uo6m_yiwkb_115:not(#\9) {
116
116
  min-width: 40px;
117
117
  }
118
- .awsui_drawer-closed_1uo6m_1pr3d_115.awsui_drawer-mobile_1uo6m_1pr3d_112:not(#\9) {
118
+ .awsui_drawer-closed_1uo6m_yiwkb_115.awsui_drawer-mobile_1uo6m_yiwkb_112:not(#\9) {
119
119
  display: none;
120
120
  }
121
121
 
122
- .awsui_drawer-content_1uo6m_1pr3d_122:not(#\9) {
122
+ .awsui_drawer-content_1uo6m_yiwkb_122:not(#\9) {
123
123
  position: fixed;
124
124
  overflow: auto;
125
125
  background-color: var(--color-background-layout-panel-content-t82vgh, #ffffff);
126
126
  }
127
- .awsui_drawer-mobile_1uo6m_1pr3d_112 > .awsui_drawer-content_1uo6m_1pr3d_122:not(#\9) {
127
+ .awsui_drawer-mobile_1uo6m_yiwkb_112 > .awsui_drawer-content_1uo6m_yiwkb_122:not(#\9) {
128
128
  z-index: 1001;
129
129
  top: 0;
130
130
  bottom: 0;
131
131
  left: 0;
132
132
  right: 0;
133
133
  }
134
- .awsui_drawer-closed_1uo6m_1pr3d_115 > .awsui_drawer-content_1uo6m_1pr3d_122:not(#\9) {
134
+ .awsui_drawer-closed_1uo6m_yiwkb_115 > .awsui_drawer-content_1uo6m_yiwkb_122:not(#\9) {
135
135
  width: 40px;
136
136
  }
137
- .awsui_drawer-closed_1uo6m_1pr3d_115 > .awsui_drawer-content_1uo6m_1pr3d_122.awsui_drawer-content-clickable_1uo6m_1pr3d_137:not(#\9) {
137
+ .awsui_drawer-closed_1uo6m_yiwkb_115 > .awsui_drawer-content_1uo6m_yiwkb_122.awsui_drawer-content-clickable_1uo6m_yiwkb_137:not(#\9) {
138
138
  cursor: pointer;
139
139
  color: var(--color-text-interactive-default-lnx6lk, #414d5c);
140
140
  }
141
- .awsui_drawer-closed_1uo6m_1pr3d_115 > .awsui_drawer-content_1uo6m_1pr3d_122.awsui_drawer-content-clickable_1uo6m_1pr3d_137:not(#\9):hover {
141
+ .awsui_drawer-closed_1uo6m_yiwkb_115 > .awsui_drawer-content_1uo6m_yiwkb_122.awsui_drawer-content-clickable_1uo6m_yiwkb_137:not(#\9):hover {
142
142
  background: var(--color-background-layout-panel-hover-n9apd3, #e9ebed);
143
143
  }
144
- .awsui_drawer-content_1uo6m_1pr3d_122 > [aria-hidden=true]:not(#\9) {
144
+ .awsui_drawer-content_1uo6m_yiwkb_122 > [aria-hidden=true]:not(#\9) {
145
145
  display: none;
146
146
  }
147
+ .awsui_drawer-content_1uo6m_yiwkb_122 > .awsui_drawer-resize-content_1uo6m_yiwkb_147:not(#\9) {
148
+ overflow: auto;
149
+ height: 100%;
150
+ position: relative;
151
+ }
147
152
 
148
- .awsui_drawer-triggers-wrapper_1uo6m_1pr3d_148:not(#\9) {
153
+ .awsui_drawer-triggers-wrapper_1uo6m_yiwkb_153:not(#\9) {
149
154
  display: flex;
150
155
  flex-direction: column;
151
156
  text-align: center;
152
157
  align-items: stretch;
153
158
  }
154
159
 
155
- .awsui_drawer-trigger_1uo6m_1pr3d_102:not(#\9) {
160
+ .awsui_drawer-trigger_1uo6m_yiwkb_102:not(#\9) {
156
161
  padding: var(--space-xxs-p8yyaw, 4px) 7px;
157
162
  cursor: pointer;
158
163
  color: var(--color-text-interactive-default-lnx6lk, #414d5c);
159
164
  }
160
- .awsui_drawer-trigger_1uo6m_1pr3d_102:not(#\9):not(:first-child) {
165
+ .awsui_drawer-trigger_1uo6m_yiwkb_102:not(#\9):not(:first-child) {
161
166
  border-top: 1px solid var(--color-border-layout-ownedw, #d1d5db);
162
167
  }
163
- .awsui_drawer-trigger_1uo6m_1pr3d_102:not(#\9):hover {
168
+ .awsui_drawer-trigger_1uo6m_yiwkb_102:not(#\9):hover {
164
169
  color: var(--color-text-layout-toggle-hover-1r0lo8, #0972d3);
165
170
  }
166
- .awsui_drawer-trigger-active_1uo6m_1pr3d_166:not(#\9), .awsui_drawer-trigger-active_1uo6m_1pr3d_166:not(#\9):hover {
171
+ .awsui_drawer-trigger-active_1uo6m_yiwkb_171:not(#\9), .awsui_drawer-trigger-active_1uo6m_yiwkb_171:not(#\9):hover {
167
172
  background-color: var(--color-background-layout-toggle-selected-default-caco0q, #0972d3);
168
173
  color: var(--color-text-layout-toggle-active-p0m0v1, #ffffff);
169
174
  }
170
- .awsui_drawer-content-clickable_1uo6m_1pr3d_137 > .awsui_drawer-triggers-wrapper_1uo6m_1pr3d_148 > .awsui_drawer-trigger_1uo6m_1pr3d_102:not(#\9):hover {
175
+ .awsui_drawer-content-clickable_1uo6m_yiwkb_137 > .awsui_drawer-triggers-wrapper_1uo6m_yiwkb_153 > .awsui_drawer-trigger_1uo6m_yiwkb_102:not(#\9):hover {
171
176
  color: var(--color-text-interactive-default-lnx6lk, #414d5c);
172
177
  }
173
178
 
174
- .awsui_hide_1uo6m_1pr3d_174:not(#\9) {
179
+ .awsui_hide_1uo6m_yiwkb_179:not(#\9) {
175
180
  display: none;
176
181
  }
@@ -2,16 +2,17 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "toggle": "awsui_toggle_1uo6m_1pr3d_97",
6
- "drawer-triggers": "awsui_drawer-triggers_1uo6m_1pr3d_102",
7
- "drawer": "awsui_drawer_1uo6m_1pr3d_102",
8
- "drawer-mobile": "awsui_drawer-mobile_1uo6m_1pr3d_112",
9
- "drawer-closed": "awsui_drawer-closed_1uo6m_1pr3d_115",
10
- "drawer-content": "awsui_drawer-content_1uo6m_1pr3d_122",
11
- "drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_1pr3d_137",
12
- "drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_1pr3d_148",
13
- "drawer-trigger": "awsui_drawer-trigger_1uo6m_1pr3d_102",
14
- "drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_1pr3d_166",
15
- "hide": "awsui_hide_1uo6m_1pr3d_174"
5
+ "toggle": "awsui_toggle_1uo6m_yiwkb_97",
6
+ "drawer-triggers": "awsui_drawer-triggers_1uo6m_yiwkb_102",
7
+ "drawer": "awsui_drawer_1uo6m_yiwkb_102",
8
+ "drawer-mobile": "awsui_drawer-mobile_1uo6m_yiwkb_112",
9
+ "drawer-closed": "awsui_drawer-closed_1uo6m_yiwkb_115",
10
+ "drawer-content": "awsui_drawer-content_1uo6m_yiwkb_122",
11
+ "drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_yiwkb_137",
12
+ "drawer-resize-content": "awsui_drawer-resize-content_1uo6m_yiwkb_147",
13
+ "drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_yiwkb_153",
14
+ "drawer-trigger": "awsui_drawer-trigger_1uo6m_yiwkb_102",
15
+ "drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_yiwkb_171",
16
+ "hide": "awsui_hide_1uo6m_yiwkb_179"
16
17
  };
17
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["date-range-picker/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIpD,wBAAgB,WAAW,CACzB,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,EACxC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;IAAE,UAAU,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACpG,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAYnC;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,EACxC,eAAe,EAAE,SAAS,oBAAoB,CAAC,cAAc,EAAE,EAC/D,iBAAiB,EAAE,oBAAoB,CAAC,iBAAiB,2BAY1D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,aAAa,GAC/C,oBAAoB,CAAC,oBAAoB,CAQ3C;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,oBAAoB,CAAC,oBAAoB,GAC/C,oBAAoB,CAAC,aAAa,CAMpC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["date-range-picker/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,wBAAgB,WAAW,CACzB,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,EACxC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;IAAE,UAAU,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACpG,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAYnC;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,EACxC,eAAe,EAAE,SAAS,oBAAoB,CAAC,cAAc,EAAE,EAC/D,iBAAiB,EAAE,oBAAoB,CAAC,iBAAiB,2BAY1D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,aAAa,GAC/C,oBAAoB,CAAC,oBAAoB,CAQ3C;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,oBAAoB,CAAC,oBAAoB,GAC/C,oBAAoB,CAAC,aAAa,CASpC"}
@@ -1,5 +1,6 @@
1
1
  import { setTimeOffset } from './time-offset';
2
2
  import { joinDateTime, splitDateTime } from '../internal/utils/date-time';
3
+ import { normalizeTimeString } from '../internal/utils/date-time/join-date-time';
3
4
  export function formatValue(value, { timeOffset, dateOnly }) {
4
5
  if (!value || value.type === 'relative') {
5
6
  return value;
@@ -35,10 +36,12 @@ export function splitAbsoluteValue(value) {
35
36
  return { start: splitDateTime(value.startDate), end: splitDateTime(value.endDate) };
36
37
  }
37
38
  export function joinAbsoluteValue(value) {
39
+ const startTime = normalizeTimeString(value.start.time || '00:00:00');
40
+ const endTime = normalizeTimeString(value.end.time || '23:59:59');
38
41
  return {
39
42
  type: 'absolute',
40
- startDate: joinDateTime(value.start.date, value.start.time || '00:00:00'),
41
- endDate: joinDateTime(value.end.date, value.end.time || '23:59:59'),
43
+ startDate: joinDateTime(value.start.date, startTime),
44
+ endDate: joinDateTime(value.end.date, endTime),
42
45
  };
43
46
  }
44
47
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["date-range-picker/utils.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,UAAU,WAAW,CACzB,KAAwC,EACxC,EAAE,UAAU,EAAE,QAAQ,EAA+E;IAErG,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IACD,IAAI,QAAQ,EAAE;QACZ,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACrC,CAAC;KACH;IACD,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,KAAwC,EACxC,eAA+D,EAC/D,iBAAyD;IAEzD,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC;KACnB;IACD,IAAI,iBAAiB,KAAK,eAAe,EAAE;QACzC,OAAO,UAAU,CAAC;KACnB;IACD,IAAI,iBAAiB,KAAK,eAAe,EAAE;QACzC,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAgD;IAEhD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;YACL,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC7B,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;SAC5B,CAAC;KACH;IACD,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAgD;IAEhD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU,CAAC;QACzE,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,UAAU,CAAC;KACpE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DateRangePickerProps } from './interfaces';\nimport { setTimeOffset } from './time-offset';\nimport { joinDateTime, splitDateTime } from '../internal/utils/date-time';\n\nexport function formatValue(\n value: null | DateRangePickerProps.Value,\n { timeOffset, dateOnly }: { timeOffset: { startDate?: number; endDate?: number }; dateOnly: boolean }\n): null | DateRangePickerProps.Value {\n if (!value || value.type === 'relative') {\n return value;\n }\n if (dateOnly) {\n return {\n type: 'absolute',\n startDate: value.startDate.split('T')[0],\n endDate: value.endDate.split('T')[0],\n };\n }\n return setTimeOffset(value, timeOffset);\n}\n\nexport function getDefaultMode(\n value: null | DateRangePickerProps.Value,\n relativeOptions: readonly DateRangePickerProps.RelativeOption[],\n rangeSelectorMode: DateRangePickerProps.RangeSelectorMode\n) {\n if (value && value.type) {\n return value.type;\n }\n if (rangeSelectorMode === 'relative-only') {\n return 'relative';\n }\n if (rangeSelectorMode === 'absolute-only') {\n return 'absolute';\n }\n return relativeOptions.length > 0 ? 'relative' : 'absolute';\n}\n\nexport function splitAbsoluteValue(\n value: null | DateRangePickerProps.AbsoluteValue\n): DateRangePickerProps.PendingAbsoluteValue {\n if (!value) {\n return {\n start: { date: '', time: '' },\n end: { date: '', time: '' },\n };\n }\n return { start: splitDateTime(value.startDate), end: splitDateTime(value.endDate) };\n}\n\nexport function joinAbsoluteValue(\n value: DateRangePickerProps.PendingAbsoluteValue\n): DateRangePickerProps.AbsoluteValue {\n return {\n type: 'absolute',\n startDate: joinDateTime(value.start.date, value.start.time || '00:00:00'),\n endDate: joinDateTime(value.end.date, value.end.time || '23:59:59'),\n };\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["date-range-picker/utils.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,MAAM,UAAU,WAAW,CACzB,KAAwC,EACxC,EAAE,UAAU,EAAE,QAAQ,EAA+E;IAErG,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IACD,IAAI,QAAQ,EAAE;QACZ,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CA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AAS,CAAC;QACpD,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DateRangePickerProps } from './interfaces';\nimport { setTimeOffset } from './time-offset';\nimport { joinDateTime, splitDateTime } from '../internal/utils/date-time';\nimport { normalizeTimeString } from '../internal/utils/date-time/join-date-time';\n\nexport function formatValue(\n value: null | DateRangePickerProps.Value,\n { timeOffset, dateOnly }: { timeOffset: { startDate?: number; endDate?: number }; dateOnly: boolean }\n): null | DateRangePickerProps.Value {\n if (!value || value.type === 'relative') {\n return value;\n }\n if (dateOnly) {\n return {\n type: 'absolute',\n startDate: value.startDate.split('T')[0],\n endDate: value.endDate.split('T')[0],\n };\n }\n return setTimeOffset(value, timeOffset);\n}\n\nexport function getDefaultMode(\n value: null | DateRangePickerProps.Value,\n relativeOptions: readonly DateRangePickerProps.RelativeOption[],\n rangeSelectorMode: DateRangePickerProps.RangeSelectorMode\n) {\n if (value && value.type) {\n return value.type;\n }\n if (rangeSelectorMode === 'relative-only') {\n return 'relative';\n }\n if (rangeSelectorMode === 'absolute-only') {\n return 'absolute';\n }\n return relativeOptions.length > 0 ? 'relative' : 'absolute';\n}\n\nexport function splitAbsoluteValue(\n value: null | DateRangePickerProps.AbsoluteValue\n): DateRangePickerProps.PendingAbsoluteValue {\n if (!value) {\n return {\n start: { date: '', time: '' },\n end: { date: '', time: '' },\n };\n }\n return { start: splitDateTime(value.startDate), end: splitDateTime(value.endDate) };\n}\n\nexport function joinAbsoluteValue(\n value: DateRangePickerProps.PendingAbsoluteValue\n): DateRangePickerProps.AbsoluteValue {\n const startTime = normalizeTimeString(value.start.time || '00:00:00');\n const endTime = normalizeTimeString(value.end.time || '23:59:59');\n\n return {\n type: 'absolute',\n startDate: joinDateTime(value.start.date, startTime),\n endDate: joinDateTime(value.end.date, endTime),\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (07f09a86)";
2
+ export var PACKAGE_VERSION = "3.0.0 (2384c493)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (07f09a86)",
3
+ "PACKAGE_VERSION": "3.0.0 (2384c493)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "07f09a86def046070704ee2b9e4d5864fb5c3e9e"
2
+ "commit": "2384c493d709e2542292a2df3a321555e20ba290"
3
3
  }
@@ -1,3 +1,4 @@
1
+ export declare function normalizeTimeString(timeString: string): string;
1
2
  export declare function joinDateTime(dateString: string, timeString: string): string;
2
3
  export declare function splitDateTime(dateStr: string): {
3
4
  date: string;
@@ -1 +1 @@
1
- {"version":3,"file":"join-date-time.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAElE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM;;;EAG5C"}
1
+ {"version":3,"file":"join-date-time.d.ts","sourceRoot":"lib/default/","sources":["internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,UAMrD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAElE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM;;;EAG5C"}
@@ -1,5 +1,12 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export function normalizeTimeString(timeString) {
4
+ const parts = timeString.split(':');
5
+ while (parts.length < 3) {
6
+ parts.push('00');
7
+ }
8
+ return parts.join(':');
9
+ }
3
10
  export function joinDateTime(dateString, timeString) {
4
11
  return `${dateString}T${timeString}`;
5
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"join-date-time.js","sourceRoot":"lib/default/","sources":["internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,UAAkB;IACjE,OAAO,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function joinDateTime(dateString: string, timeString: string) {\n return `${dateString}T${timeString}`;\n}\n\nexport function splitDateTime(dateStr: string) {\n const [date = '', time = ''] = dateStr.split('T');\n return { date, time };\n}\n"]}
1
+ {"version":3,"file":"join-date-time.js","sourceRoot":"lib/default/","sources":["internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClB;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,UAAkB;IACjE,OAAO,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function normalizeTimeString(timeString: string) {\n const parts = timeString.split(':');\n while (parts.length < 3) {\n parts.push('00');\n }\n return parts.join(':');\n}\n\nexport function joinDateTime(dateString: string, timeString: string) {\n return `${dateString}T${timeString}`;\n}\n\nexport function splitDateTime(dateStr: string) {\n const [date = '', time = ''] = dateStr.split('T');\n return { date, time };\n}\n"]}
package/package.json CHANGED
@@ -113,7 +113,7 @@
113
113
  "./internal/base-component/index.js",
114
114
  "./internal/base-component/styles.css.js"
115
115
  ],
116
- "version": "3.0.430",
116
+ "version": "3.0.431",
117
117
  "repository": {
118
118
  "type": "git",
119
119
  "url": "https://github.com/cloudscape-design/components.git"