@cloudscape-design/components 3.0.1040 → 3.0.1042
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/internal.js +1 -1
- package/alert/internal.js.map +1 -1
- package/app-layout/utils/use-global-scroll-padding.d.ts +1 -0
- package/app-layout/utils/use-global-scroll-padding.d.ts.map +1 -0
- package/app-layout/utils/use-global-scroll-padding.js +14 -0
- package/app-layout/utils/use-global-scroll-padding.js.map +1 -0
- package/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/app-layout/visual-refresh/layout.js +2 -0
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +2 -0
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js +2 -4
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js.map +1 -1
- package/button-dropdown/index.d.ts.map +1 -1
- package/button-dropdown/index.js +11 -29
- package/button-dropdown/interfaces.d.ts +28 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal-do-not-use-core.js +36 -0
- package/button-dropdown/internal-do-not-use-core.js.map +1 -0
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +7 -9
- package/button-dropdown/internal.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/popover/conditional-live-region.d.ts +10 -0
- package/popover/conditional-live-region.d.ts.map +1 -0
- package/popover/conditional-live-region.js +12 -0
- package/popover/conditional-live-region.js.map +1 -0
- package/popover/internal.d.ts.map +1 -1
- package/popover/internal.js +4 -2
- package/popover/internal.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.css.js +0 -7
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.scoped.css +0 -7
- package/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.selectors.js +0 -8
- package/button-dropdown/index.js.map +0 -1
package/alert/internal.js
CHANGED
|
@@ -59,7 +59,7 @@ const InternalAlert = React.forwardRef((_a, ref) => {
|
|
|
59
59
|
React.createElement(VisualContext, { contextName: "alert" },
|
|
60
60
|
React.createElement("div", { className: clsx(styles.alert, styles[`type-${type}`], styles[`icon-size-${size}`], hasAction && styles['with-action'], dismissible && styles['with-dismiss']) },
|
|
61
61
|
React.createElement("div", { className: styles['alert-wrapper'] },
|
|
62
|
-
React.createElement("div", { className: styles['alert-focus-wrapper'], tabIndex: -1, ref: focusRef },
|
|
62
|
+
React.createElement("div", { className: styles['alert-focus-wrapper'], tabIndex: -1, ref: focusRef, role: "group" },
|
|
63
63
|
React.createElement("div", { className: clsx(styles.icon, styles.text) },
|
|
64
64
|
React.createElement(InternalIcon, { name: typeToIcon[type], size: size, ariaLabel: statusIconAriaLabel })),
|
|
65
65
|
React.createElement("div", { className: clsx(styles.message, styles.text), id: messageSlotId },
|
package/alert/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,C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AAC,eAAe,CAAC;6BACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAC1D,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;oBACL,WAAW,IAAI,CACd,2CACE,SAAS,EAAE,MAAM,CAAC,OAAO,IACrB,6BAA6B,CAAC;wBAChC,MAAM,EAAE,SAAS;qBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAChD,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps<HTMLDivElement> & {\n messageSlotId?: string;\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useForwardFocus(ref, focusRef);\n\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} tabIndex={-1} ref={focusRef}>\n <div className={clsx(styles.icon, styles.text)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E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,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAC1D,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;oBACL,WAAW,IAAI,CACd,2CACE,SAAS,EAAE,MAAM,CAAC,OAAO,IACrB,6BAA6B,CAAC;wBAChC,MAAM,EAAE,SAAS;qBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAChD,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps<HTMLDivElement> & {\n messageSlotId?: string;\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useForwardFocus(ref, focusRef);\n\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} tabIndex={-1} ref={focusRef} role=\"group\">\n <div className={clsx(styles.icon, styles.text)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGlobalScrollPadding(headerHeight: number): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-global-scroll-padding.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-global-scroll-padding.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,QAO1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
// Sets scroll padding to the scrolling element (`html` or `body`).
|
|
5
|
+
// This prevents the focused element to be hidden under the sticky headers.
|
|
6
|
+
export function useGlobalScrollPadding(headerHeight) {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const scrollingElement = document.scrollingElement;
|
|
9
|
+
if (scrollingElement instanceof HTMLElement) {
|
|
10
|
+
scrollingElement.style.scrollPaddingTop = `${headerHeight}px`;
|
|
11
|
+
}
|
|
12
|
+
}, [headerHeight]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=use-global-scroll-padding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-global-scroll-padding.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-global-scroll-padding.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,mEAAmE;AACnE,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB,CAAC,YAAoB;IACzD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QACnD,IAAI,gBAAgB,YAAY,WAAW,EAAE;YAC3C,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,YAAY,IAAI,CAAC;SAC/D;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACrB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect } from 'react';\n\n// Sets scroll padding to the scrolling element (`html` or `body`).\n// This prevents the focused element to be hidden under the sticky headers.\nexport function useGlobalScrollPadding(headerHeight: number) {\n useEffect(() => {\n const scrollingElement = document.scrollingElement;\n if (scrollingElement instanceof HTMLElement) {\n scrollingElement.style.scrollPaddingTop = `${headerHeight}px`;\n }\n }, [headerHeight]);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,UAAU,WAAW;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,eA0EvD"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import customCssProps from '../../internal/generated/custom-css-properties';
|
|
6
|
+
import { useGlobalScrollPadding } from '../utils/use-global-scroll-padding';
|
|
6
7
|
import { useAppLayoutInternals } from './context';
|
|
7
8
|
import testutilStyles from '../test-classes/styles.css.js';
|
|
8
9
|
import styles from './styles.css.js';
|
|
@@ -14,6 +15,7 @@ import styles from './styles.css.js';
|
|
|
14
15
|
*/
|
|
15
16
|
export default function Layout({ children }) {
|
|
16
17
|
const { breadcrumbs, contentHeader, contentType, disableBodyScroll, disableContentPaddings, drawersTriggerCount, footerHeight, hasNotificationsContent, hasOpenDrawer, headerHeight, isBackgroundOverlapDisabled, isMobile, navigationOpen, layoutElement, layoutWidth, mainOffsetLeft, maxContentWidth, minContentWidth, navigationHide, notificationsHeight, __embeddedViewMode, splitPanelPosition, splitPanelDisplayed, } = useAppLayoutInternals();
|
|
18
|
+
useGlobalScrollPadding(headerHeight);
|
|
17
19
|
// Determine the first content child so the gap will vertically align with the trigger buttons
|
|
18
20
|
const contentFirstChild = getContentFirstChild(breadcrumbs, contentHeader, hasNotificationsContent, isMobile);
|
|
19
21
|
// Content gaps on the left and right are used with the minmax function in the CSS grid column definition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC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eAAe,IAAI,EAAE,CAAC,KACpF,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,GAAG,mBAAmB,IAAI,OAGjE,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC;AAED;;;;;EAKE;AACF,SAAS,oBAAoB,CAC3B,WAA4B,EAC5B,aAA8B,EAC9B,uBAAgC,EAChC,QAAiB;IAEjB,IAAI,iBAAiB,GAAG,MAAM,CAAC;IAE/B,IAAI,uBAAuB,EAAE;QAC3B,iBAAiB,GAAG,eAAe,CAAC;KACrC;SAAM,IAAI,WAAW,IAAI,CAAC,QAAQ,EAAE;QACnC,iBAAiB,GAAG,aAAa,CAAC;KACnC;SAAM,IAAI,aAAa,EAAE;QACxB,iBAAiB,GAAG,QAAQ,CAAC;KAC9B;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport customCssProps from '../../internal/generated/custom-css-properties';\nimport { useAppLayoutInternals } from './context';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n breadcrumbs,\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentPaddings,\n drawersTriggerCount,\n footerHeight,\n hasNotificationsContent,\n hasOpenDrawer,\n headerHeight,\n isBackgroundOverlapDisabled,\n isMobile,\n navigationOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n __embeddedViewMode,\n splitPanelPosition,\n splitPanelDisplayed,\n } = useAppLayoutInternals();\n\n // Determine the first content child so the gap will vertically align with the trigger buttons\n const contentFirstChild = getContentFirstChild(breadcrumbs, contentHeader, hasNotificationsContent, isMobile);\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = navigationOpen || navigationHide;\n const hasContentGapRight = drawersTriggerCount === 0 || hasOpenDrawer;\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-first-child-${contentFirstChild}`],\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [testutilStyles['disable-body-scroll-root']]: disableBodyScroll,\n [styles['disable-content-paddings']]: disableContentPaddings,\n [styles['has-breadcrumbs']]: breadcrumbs && !isMobile,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-header']]: contentHeader,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanelDisplayed,\n [styles['is-overlap-disabled']]: isBackgroundOverlapDisabled,\n [styles['is-hide-mobile-toolbar']]: __embeddedViewMode,\n [styles['has-left-toggles-gutter']]: !(isMobile || navigationHide || navigationOpen),\n [styles['has-right-toggles-gutter']]: !isMobile && !hasContentGapRight,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n }}\n >\n {children}\n </main>\n );\n}\n\n/*\nThe Notifications, Breadcrumbs, Header, and Main are all rendered in the center\ncolumn of the grid layout. Any of these could be the first child to render in the\ncontent area if the previous siblings do not exist. The grid gap before the first\nchild will be different to ensure vertical alignment with the trigger buttons.\n*/\nfunction getContentFirstChild(\n breadcrumbs: React.ReactNode,\n contentHeader: React.ReactNode,\n hasNotificationsContent: boolean,\n isMobile: boolean\n) {\n let contentFirstChild = 'main';\n\n if (hasNotificationsContent) {\n contentFirstChild = 'notifications';\n } else if (breadcrumbs && !isMobile) {\n contentFirstChild = 'breadcrumbs';\n } else if (contentHeader) {\n contentFirstChild = 'header';\n }\n\n return contentFirstChild;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/layout.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAe;IACtD,MAAM,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,2BAA2B,EAC3B,QAAQ,EACR,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,GAAG,qBAAqB,EAAE,CAAC;IAE5B,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAErC,8FAA8F;IAC9F,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,W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CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,CAAC,kBAAkB;SACvE,EACD,cAAc,CAAC,IAAI,CACpB,EACD,GAAG,EAAE,aAAa,EAClB,KAAK,8CACH,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,GAAG,YAAY,IAAI,EAClD,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,GAAG,YAAY,IAAI,EAClD,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,IAAI,EAChD,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,cAAc,IAAI,IACnD,CAAC,eAAe,IAAI,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,GAAG,eAAe,IAAI,EAAE,CAAC,GACjF,CAAC,eAAe,IAAI,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,GAAG,eAAe,IAAI,EAAE,CAAC,KACpF,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,GAAG,mBAAmB,IAAI,OAGjE,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC;AAED;;;;;EAKE;AACF,SAAS,oBAAoB,CAC3B,WAA4B,EAC5B,aAA8B,EAC9B,uBAAgC,EAChC,QAAiB;IAEjB,IAAI,iBAAiB,GAAG,MAAM,CAAC;IAE/B,IAAI,uBAAuB,EAAE;QAC3B,iBAAiB,GAAG,eAAe,CAAC;KACrC;SAAM,IAAI,WAAW,IAAI,CAAC,QAAQ,EAAE;QACnC,iBAAiB,GAAG,aAAa,CAAC;KACnC;SAAM,IAAI,aAAa,EAAE;QACxB,iBAAiB,GAAG,QAAQ,CAAC;KAC9B;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport customCssProps from '../../internal/generated/custom-css-properties';\nimport { useGlobalScrollPadding } from '../utils/use-global-scroll-padding';\nimport { useAppLayoutInternals } from './context';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface LayoutProps {\n children: React.ReactNode;\n}\n\n/**\n * The layoutElement ref will be used by the resize observers to calculate the offset from\n * the top and bottom of the viewport based on the header and footer elements. This is to\n * ensure the Layout component minimum height will fill 100% of the viewport less those\n * cumulative heights.\n */\nexport default function Layout({ children }: LayoutProps) {\n const {\n breadcrumbs,\n contentHeader,\n contentType,\n disableBodyScroll,\n disableContentPaddings,\n drawersTriggerCount,\n footerHeight,\n hasNotificationsContent,\n hasOpenDrawer,\n headerHeight,\n isBackgroundOverlapDisabled,\n isMobile,\n navigationOpen,\n layoutElement,\n layoutWidth,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsHeight,\n __embeddedViewMode,\n splitPanelPosition,\n splitPanelDisplayed,\n } = useAppLayoutInternals();\n\n useGlobalScrollPadding(headerHeight);\n\n // Determine the first content child so the gap will vertically align with the trigger buttons\n const contentFirstChild = getContentFirstChild(breadcrumbs, contentHeader, hasNotificationsContent, isMobile);\n\n // Content gaps on the left and right are used with the minmax function in the CSS grid column definition\n const hasContentGapLeft = navigationOpen || navigationHide;\n const hasContentGapRight = drawersTriggerCount === 0 || hasOpenDrawer;\n\n return (\n <main\n className={clsx(\n styles.layout,\n styles[`content-first-child-${contentFirstChild}`],\n styles[`content-type-${contentType}`],\n styles[`split-panel-position-${splitPanelPosition ?? 'bottom'}`],\n {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [testutilStyles['disable-body-scroll-root']]: disableBodyScroll,\n [styles['disable-content-paddings']]: disableContentPaddings,\n [styles['has-breadcrumbs']]: breadcrumbs && !isMobile,\n [styles['has-content-gap-left']]: hasContentGapLeft,\n [styles['has-content-gap-right']]: hasContentGapRight,\n [styles['has-header']]: contentHeader,\n [styles['has-max-content-width']]: maxContentWidth && maxContentWidth > 0,\n [styles['has-split-panel']]: splitPanelDisplayed,\n [styles['is-overlap-disabled']]: isBackgroundOverlapDisabled,\n [styles['is-hide-mobile-toolbar']]: __embeddedViewMode,\n [styles['has-left-toggles-gutter']]: !(isMobile || navigationHide || navigationOpen),\n [styles['has-right-toggles-gutter']]: !isMobile && !hasContentGapRight,\n },\n testutilStyles.root\n )}\n ref={layoutElement}\n style={{\n [customCssProps.headerHeight]: `${headerHeight}px`,\n [customCssProps.footerHeight]: `${footerHeight}px`,\n [customCssProps.layoutWidth]: `${layoutWidth}px`,\n [customCssProps.mainOffsetLeft]: `${mainOffsetLeft}px`,\n ...(maxContentWidth && { [customCssProps.maxContentWidth]: `${maxContentWidth}px` }),\n ...(minContentWidth && { [customCssProps.minContentWidth]: `${minContentWidth}px` }),\n [customCssProps.notificationsHeight]: `${notificationsHeight}px`,\n }}\n >\n {children}\n </main>\n );\n}\n\n/*\nThe Notifications, Breadcrumbs, Header, and Main are all rendered in the center\ncolumn of the grid layout. Any of these could be the first child to render in the\ncontent area if the previous siblings do not exist. The grid gap before the first\nchild will be different to ensure vertical alignment with the trigger buttons.\n*/\nfunction getContentFirstChild(\n breadcrumbs: React.ReactNode,\n contentHeader: React.ReactNode,\n hasNotificationsContent: boolean,\n isMobile: boolean\n) {\n let contentFirstChild = 'main';\n\n if (hasNotificationsContent) {\n contentFirstChild = 'notifications';\n } else if (breadcrumbs && !isMobile) {\n contentFirstChild = 'breadcrumbs';\n } else if (contentHeader) {\n contentFirstChild = 'header';\n }\n\n return contentFirstChild;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4E,MAAM,OAAO,CAAC;AAajG,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4E,MAAM,OAAO,CAAC;AAajG,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAc/C,OAAO,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAa1E,QAAA,MAAM,6BAA6B,mGAwgBlC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -13,6 +13,7 @@ import globalVars from '../../internal/styles/global-vars';
|
|
|
13
13
|
import { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';
|
|
14
14
|
import { MIN_DRAWER_SIZE, useDrawers } from '../utils/use-drawers';
|
|
15
15
|
import { useFocusControl, useMultipleFocusControl } from '../utils/use-focus-control';
|
|
16
|
+
import { useGlobalScrollPadding } from '../utils/use-global-scroll-padding';
|
|
16
17
|
import { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';
|
|
17
18
|
import { ActiveDrawersContext } from '../utils/visibility-context';
|
|
18
19
|
import { computeHorizontalLayout, computeSplitPanelOffsets, computeVerticalLayout, CONTENT_PADDING, } from './compute-layout';
|
|
@@ -184,6 +185,7 @@ const AppLayoutVisualRefreshToolbar = React.forwardRef((_a, forwardRef) => {
|
|
|
184
185
|
toolbarHeight: toolbarHeight !== null && toolbarHeight !== void 0 ? toolbarHeight : 0,
|
|
185
186
|
stickyNotifications: resolvedStickyNotifications,
|
|
186
187
|
});
|
|
188
|
+
useGlobalScrollPadding(verticalOffsets.header);
|
|
187
189
|
const appLayoutInternals = {
|
|
188
190
|
ariaLabels: ariaLabelsWithDrawers,
|
|
189
191
|
headerVariant,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;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H,gBAAgB,EACd,kBAAkB,KAAK,QAAQ,IAAI,CACjC,oBAAC,yBAAyB,IACxB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,IAEvC,UAAU,CACe,CAC7B,EAEH,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,GAC9C,CACkC,CACvC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';\n\nimport { useMergeRefs, useStableCallback, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport ScreenreaderOnly from '../../internal/components/screenreader-only';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useIntersectionObserver } from '../../internal/hooks/use-intersection-observer';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useGetGlobalBreadcrumbs } from '../../internal/plugins/helpers/use-global-breadcrumbs';\nimport globalVars from '../../internal/styles/global-vars';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { AppLayoutProps } from '../interfaces';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { MIN_DRAWER_SIZE, OnChangeParams, useDrawers } from '../utils/use-drawers';\nimport { useFocusControl, useMultipleFocusControl } from '../utils/use-focus-control';\nimport { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { ActiveDrawersContext } from '../utils/visibility-context';\nimport {\n computeHorizontalLayout,\n computeSplitPanelOffsets,\n computeVerticalLayout,\n CONTENT_PADDING,\n} from './compute-layout';\nimport { AppLayoutVisibilityContext } from './contexts';\nimport { AppLayoutInternalProps, AppLayoutInternals } from './interfaces';\nimport {\n AppLayoutDrawer,\n AppLayoutGlobalDrawers,\n AppLayoutNavigation,\n AppLayoutNotifications,\n AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelSide,\n AppLayoutToolbar,\n} from './internal';\nimport { useMultiAppLayout } from './multi-layout';\nimport { SkeletonLayout } from './skeleton';\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef<AppLayoutProps.Ref, AppLayoutInternalProps>(\n (\n {\n ariaLabels,\n contentHeader,\n content,\n navigationOpen,\n navigationWidth,\n navigation,\n navigationHide,\n onNavigationChange,\n tools,\n toolsOpen: controlledToolsOpen,\n onToolsChange,\n toolsHide,\n toolsWidth,\n contentType,\n headerVariant,\n breadcrumbs,\n notifications,\n stickyNotifications,\n splitPanelPreferences: controlledSplitPanelPreferences,\n splitPanelOpen: controlledSplitPanelOpen,\n splitPanel,\n splitPanelSize: controlledSplitPanelSize,\n onSplitPanelToggle,\n onSplitPanelResize,\n onSplitPanelPreferencesChange,\n disableContentPaddings,\n minContentWidth,\n maxContentWidth,\n placement,\n navigationTriggerHide,\n ...rest\n },\n forwardRef\n ) => {\n const isMobile = useMobile();\n const { __embeddedViewMode: embeddedViewMode, __forceDeduplicationType: forceDeduplicationType } = rest as any;\n const splitPanelControlId = useUniqueId('split-panel');\n const [toolbarState, setToolbarState] = useState<'show' | 'hide'>('show');\n const [toolbarHeight, setToolbarHeight] = useState(0);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [navigationAnimationDisabled, setNavigationAnimationDisabled] = useState(true);\n const [splitPanelAnimationDisabled, setSplitPanelAnimationDisabled] = useState(true);\n const [isNested, setIsNested] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const [toolsOpen = false, setToolsOpen] = useControllable(controlledToolsOpen, onToolsChange, false, {\n componentName: 'AppLayout',\n controlledProp: 'toolsOpen',\n changeHandler: 'onToolsChange',\n });\n const onToolsToggle = (open: boolean) => {\n setToolsOpen(open);\n drawersFocusControl.setFocus();\n fireNonCancelableEvent(onToolsChange, { open });\n };\n\n const onGlobalDrawerFocus = (drawerId: string, open: boolean) => {\n globalDrawersFocusControl.setFocus({ force: true, drawerId, open });\n };\n\n const onAddNewActiveDrawer = (drawerId: string) => {\n // If a local drawer is already open, and we attempt to open a new one,\n // it will replace the existing one instead of opening an additional drawer,\n // since only one local drawer is supported. Therefore, layout calculations are not necessary.\n if (activeDrawer && drawers?.find(drawer => drawer.id === drawerId)) {\n return;\n }\n // get the size of drawerId. it could be either local or global drawer\n const combinedDrawers = [...(drawers || []), ...globalDrawers];\n const newDrawer = combinedDrawers.find(drawer => drawer.id === drawerId);\n if (!newDrawer) {\n return;\n }\n const newDrawerSize = Math.min(\n newDrawer.defaultSize ?? drawerSizes[drawerId] ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n );\n // check if the active drawers could be resized to fit the new drawers\n // to do this, we need to take all active drawers, sum up their min sizes, truncate it from resizableSpaceAvailable\n // and compare a given number with the new drawer id min size\n\n // the total size of all global drawers resized to their min size\n const availableSpaceForNewDrawer = resizableSpaceAvailable - totalActiveDrawersMinSize;\n if (availableSpaceForNewDrawer >= newDrawerSize) {\n return;\n }\n\n // now we made sure we cannot accommodate the new drawer with existing ones\n closeFirstDrawer();\n };\n\n const {\n drawers,\n activeDrawer,\n minDrawerSize,\n minGlobalDrawersSizes,\n activeDrawerSize,\n ariaLabelsWithDrawers,\n globalDrawers,\n activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n drawerSizes,\n drawersOpenQueue,\n onActiveDrawerChange,\n onActiveDrawerResize,\n onActiveGlobalDrawersChange,\n expandedDrawerId,\n setExpandedDrawerId,\n } = useDrawers({ ...rest, onGlobalDrawerFocus, onAddNewActiveDrawer }, ariaLabels, {\n ariaLabels,\n toolsHide,\n toolsOpen,\n tools,\n toolsWidth,\n onToolsToggle,\n });\n\n const onActiveDrawerChangeHandler = (\n drawerId: string | null,\n params: OnChangeParams = { initiatedByUserAction: true }\n ) => {\n onActiveDrawerChange(drawerId, params);\n drawersFocusControl.setFocus();\n };\n\n const [splitPanelOpen = false, setSplitPanelOpen] = useControllable(\n controlledSplitPanelOpen,\n onSplitPanelToggle,\n false,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelOpen',\n changeHandler: 'onSplitPanelToggle',\n }\n );\n\n const onSplitPanelToggleHandler = () => {\n setSplitPanelAnimationDisabled(false);\n setSplitPanelOpen(!splitPanelOpen);\n splitPanelFocusControl.setLastInteraction({ type: splitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(onSplitPanelToggle, { open: !splitPanelOpen });\n };\n\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n controlledSplitPanelPreferences,\n onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const onSplitPanelPreferencesChangeHandler = (detail: AppLayoutProps.SplitPanelPreferences) => {\n setSplitPanelPreferences(detail);\n splitPanelFocusControl.setLastInteraction({ type: 'position' });\n fireNonCancelableEvent(onSplitPanelPreferencesChange, detail);\n };\n\n const [splitPanelSize = 0, setSplitPanelSize] = useControllable(\n controlledSplitPanelSize,\n onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPreferences?.position ?? 'bottom'),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelHeaderBlockSize, setSplitPanelHeaderBlockSize] = useState(0);\n\n const onSplitPanelResizeHandler = (size: number) => {\n setSplitPanelSize(size);\n fireNonCancelableEvent(onSplitPanelResize, { size });\n };\n\n const [splitPanelToggleConfig, setSplitPanelToggleConfig] = useState<SplitPanelSideToggleProps>({\n ariaLabel: undefined,\n displayed: false,\n });\n\n const globalDrawersFocusControl = useMultipleFocusControl(true, activeGlobalDrawersIds);\n const drawersFocusControl = useFocusControl(!!activeDrawer?.id, true, activeDrawer?.id);\n const navigationFocusControl = useFocusControl(navigationOpen, navigationTriggerHide);\n const splitPanelFocusControl = useSplitPanelFocusControl([splitPanelPreferences, splitPanelOpen]);\n\n const onNavigationToggle = useStableCallback((open: boolean) => {\n setNavigationAnimationDisabled(false);\n navigationFocusControl.setFocus();\n fireNonCancelableEvent(onNavigationChange, { open });\n });\n\n useImperativeHandle(forwardRef, () => ({\n closeNavigationIfNecessary: () => isMobile && onNavigationToggle(false),\n openTools: () => onToolsToggle(true),\n focusToolsClose: () => drawersFocusControl.setFocus(true),\n focusActiveDrawer: () => drawersFocusControl.setFocus(true),\n focusSplitPanel: () => splitPanelFocusControl.refs.slider.current?.focus(),\n focusNavigation: () => navigationFocusControl.setFocus(true),\n }));\n\n const resolvedStickyNotifications = !!stickyNotifications && !isMobile;\n //navigation must be null if hidden so toolbar knows to hide the toggle button\n const resolvedNavigation = navigationHide ? null : navigation || <></>;\n //navigation must not be open if navigationHide is true\n const resolvedNavigationOpen = !!resolvedNavigation && navigationOpen;\n const {\n maxDrawerSize,\n maxSplitPanelSize,\n splitPanelForcedPosition,\n splitPanelPosition,\n maxGlobalDrawersSizes,\n resizableSpaceAvailable,\n } = computeHorizontalLayout({\n activeDrawerSize: activeDrawer ? activeDrawerSize : 0,\n splitPanelSize,\n minContentWidth,\n navigationOpen: resolvedNavigationOpen,\n navigationWidth,\n placement,\n splitPanelOpen,\n splitPanelPosition: splitPanelPreferences?.position,\n isMobile,\n activeGlobalDrawersSizes,\n });\n\n const { ref: intersectionObserverRef, isIntersecting } = useIntersectionObserver({ initialState: true });\n const { registered, toolbarProps } = useMultiAppLayout(\n {\n forceDeduplicationType,\n ariaLabels: ariaLabelsWithDrawers,\n navigation: resolvedNavigation && !navigationTriggerHide,\n navigationOpen: resolvedNavigationOpen,\n onNavigationToggle,\n navigationFocusRef: navigationFocusControl.refs.toggle,\n breadcrumbs,\n activeDrawerId: activeDrawer?.id ?? null,\n // only pass it down if there are non-empty drawers or tools\n drawers: drawers?.length || !toolsHide ? drawers : undefined,\n globalDrawersFocusControl,\n globalDrawers: globalDrawers?.length ? globalDrawers : undefined,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange,\n onActiveDrawerChange: onActiveDrawerChangeHandler,\n drawersFocusRef: drawersFocusControl.refs.toggle,\n splitPanel,\n splitPanelToggleProps: {\n ...splitPanelToggleConfig,\n active: splitPanelOpen,\n controlId: splitPanelControlId,\n position: splitPanelPosition,\n },\n splitPanelFocusRef: splitPanelFocusControl.refs.toggle,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n expandedDrawerId,\n setExpandedDrawerId,\n },\n isIntersecting\n );\n\n const hasToolbar = !embeddedViewMode && !!toolbarProps;\n const discoveredBreadcrumbs = useGetGlobalBreadcrumbs(hasToolbar && !breadcrumbs);\n\n const verticalOffsets = computeVerticalLayout({\n topOffset: placement.insetBlockStart,\n hasVisibleToolbar: hasToolbar && toolbarState !== 'hide',\n notificationsHeight: notificationsHeight ?? 0,\n toolbarHeight: toolbarHeight ?? 0,\n stickyNotifications: resolvedStickyNotifications,\n });\n\n const appLayoutInternals: AppLayoutInternals = {\n ariaLabels: ariaLabelsWithDrawers,\n headerVariant,\n isMobile,\n breadcrumbs,\n discoveredBreadcrumbs,\n stickyNotifications: resolvedStickyNotifications,\n navigationOpen: resolvedNavigationOpen,\n navigation: resolvedNavigation,\n navigationFocusControl,\n activeDrawer,\n activeDrawerSize,\n minDrawerSize,\n maxDrawerSize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n drawers: drawers!,\n globalDrawers,\n activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n onActiveGlobalDrawersChange,\n drawersFocusControl,\n globalDrawersFocusControl,\n splitPanelPosition,\n splitPanelToggleConfig,\n splitPanelOpen,\n splitPanelControlId,\n splitPanelFocusControl,\n placement,\n toolbarState,\n setToolbarState,\n verticalOffsets,\n drawersOpenQueue,\n setToolbarHeight,\n setNotificationsHeight,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n onNavigationToggle,\n onActiveDrawerChange: onActiveDrawerChangeHandler,\n onActiveDrawerResize,\n splitPanelAnimationDisabled,\n expandedDrawerId,\n setExpandedDrawerId,\n };\n\n const splitPanelInternals: SplitPanelProviderProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight =\n document.documentElement.clientHeight - placement.insetBlockStart - placement.insetBlockEnd;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n maxWidth: maxSplitPanelSize,\n isForcedPosition: splitPanelForcedPosition,\n isOpen: splitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: onSplitPanelPreferencesChangeHandler,\n onResize: onSplitPanelResizeHandler,\n onToggle: onSplitPanelToggleHandler,\n position: splitPanelPosition,\n reportSize: size => setSplitPanelReportedSize(size),\n reportHeaderHeight: size => setSplitPanelHeaderBlockSize(size),\n headerHeight: splitPanelHeaderBlockSize,\n rightOffset: 0,\n size: splitPanelSize,\n topOffset: 0,\n setSplitPanelToggle: setSplitPanelToggleConfig,\n refs: splitPanelFocusControl.refs,\n };\n\n const closeFirstDrawer = useStableCallback(() => {\n const drawerToClose = drawersOpenQueue[drawersOpenQueue.length - 1];\n if (activeDrawer && activeDrawer?.id === drawerToClose) {\n onActiveDrawerChange(null, { initiatedByUserAction: true });\n } else if (activeGlobalDrawersIds.includes(drawerToClose)) {\n onActiveGlobalDrawersChange(drawerToClose, { initiatedByUserAction: true });\n }\n });\n\n useEffect(() => {\n // Close navigation drawer on mobile so that the main content is visible\n if (isMobile) {\n onNavigationToggle(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMobile]);\n\n const getTotalActiveDrawersMinSize = () => {\n const combinedDrawers = [...(drawers || []), ...globalDrawers];\n let result = activeGlobalDrawersIds\n .map(activeDrawerId =>\n Math.min(\n combinedDrawers.find(drawer => drawer.id === activeDrawerId)?.defaultSize ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n )\n )\n .reduce((acc, curr) => acc + curr, 0);\n if (activeDrawer) {\n result += Math.min(activeDrawer?.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE);\n }\n\n return result;\n };\n\n const totalActiveDrawersMinSize = getTotalActiveDrawersMinSize();\n\n useEffect(() => {\n if (isMobile) {\n return;\n }\n\n const activeNavigationWidth = !navigationHide && navigationOpen ? navigationWidth : 0;\n const scrollWidth = activeNavigationWidth + CONTENT_PADDING + totalActiveDrawersMinSize;\n const hasHorizontalScroll = scrollWidth > placement.inlineSize;\n if (hasHorizontalScroll) {\n if (!navigationHide && navigationOpen) {\n onNavigationToggle(false);\n return;\n }\n\n closeFirstDrawer();\n }\n }, [\n totalActiveDrawersMinSize,\n closeFirstDrawer,\n isMobile,\n navigationHide,\n navigationOpen,\n navigationWidth,\n onNavigationToggle,\n placement.inlineSize,\n ]);\n\n /**\n * Returns true if the AppLayout is nested\n * Does not apply to iframe\n */\n const getIsNestedInAppLayout = (element: HTMLElement | null): boolean => {\n let currentElement: Element | null = element?.parentElement ?? null;\n\n // this traverse is needed only for JSDOM\n // in real browsers the globalVar will be propagated to all descendants and this loops exits after initial iteration\n while (currentElement) {\n if (getComputedStyle(currentElement).getPropertyValue(globalVars.stickyVerticalTopOffset)) {\n return true;\n }\n currentElement = currentElement.parentElement;\n }\n\n return false;\n };\n\n useLayoutEffect(() => {\n if (!hasToolbar) {\n setIsNested(getIsNestedInAppLayout(rootRef.current));\n }\n }, [hasToolbar]);\n\n const splitPanelOffsets = computeSplitPanelOffsets({\n placement,\n hasSplitPanel: !!splitPanel,\n splitPanelOpen,\n splitPanelPosition,\n splitPanelFullHeight: splitPanelReportedSize,\n splitPanelHeaderHeight: splitPanelHeaderBlockSize,\n });\n\n return (\n <AppLayoutVisibilityContext.Provider value={isIntersecting}>\n {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */}\n {!hasToolbar && breadcrumbs ? <ScreenreaderOnly>{breadcrumbs}</ScreenreaderOnly> : null}\n <SkeletonLayout\n ref={useMergeRefs(intersectionObserverRef, rootRef)}\n isNested={isNested}\n // Why not use drawerExpandedMode={!!expandedDrawerId || !!toolbarProps?.expandedDrawerId} instead?\n // Because in nested layouts, the parent layout hides its main content area,\n // which means the child layout isn't rendered at all in that case\n drawerExpandedModeInChildLayout={!!toolbarProps?.expandedDrawerId}\n drawerExpandedMode={!!expandedDrawerId}\n style={{\n paddingBlockEnd: splitPanelOffsets.mainContentPaddingBlockEnd,\n ...(hasToolbar || !isNested\n ? {\n [globalVars.stickyVerticalTopOffset]: `${verticalOffsets.header}px`,\n [globalVars.stickyVerticalBottomOffset]: `${splitPanelOffsets.stickyVerticalBottomOffset}px`,\n }\n : {}),\n ...(!isMobile ? { minWidth: `${minContentWidth}px` } : {}),\n }}\n toolbar={\n hasToolbar && <AppLayoutToolbar appLayoutInternals={appLayoutInternals} toolbarProps={toolbarProps} />\n }\n notifications={\n notifications && (\n <AppLayoutNotifications appLayoutInternals={appLayoutInternals}>{notifications}</AppLayoutNotifications>\n )\n }\n headerVariant={headerVariant}\n contentHeader={contentHeader}\n // delay rendering the content until registration of this instance is complete\n content={registered ? content : null}\n navigation={resolvedNavigation && <AppLayoutNavigation appLayoutInternals={appLayoutInternals} />}\n navigationOpen={resolvedNavigationOpen}\n navigationWidth={navigationWidth}\n navigationAnimationDisabled={navigationAnimationDisabled}\n tools={drawers && drawers.length > 0 && <AppLayoutDrawer appLayoutInternals={appLayoutInternals} />}\n globalTools={\n <ActiveDrawersContext.Provider value={activeGlobalDrawersIds}>\n <AppLayoutGlobalDrawers appLayoutInternals={appLayoutInternals} />\n </ActiveDrawersContext.Provider>\n }\n globalToolsOpen={!!activeGlobalDrawersIds.length}\n toolsOpen={!!activeDrawer}\n toolsWidth={activeDrawerSize}\n sideSplitPanel={\n splitPanelPosition === 'side' && (\n <AppLayoutSplitPanelSide\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelSide>\n )\n }\n bottomSplitPanel={\n splitPanelPosition === 'bottom' && (\n <AppLayoutSplitPanelBottom\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelBottom>\n )\n }\n splitPanelOpen={splitPanelOpen}\n placement={placement}\n contentType={contentType}\n maxContentWidth={maxContentWidth}\n disableContentPaddings={disableContentPaddings}\n />\n </AppLayoutVisibilityContext.Provider>\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE7G,OAAO,gBAAgB,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAkB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE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C9E,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EACpC,UAAU,EAAE,kBAAkB,IAAI,oBAAC,mBAAmB,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,EACjG,cAAc,EAAE,sBAAsB,EACtC,eAAe,EAAE,eAAe,EAChC,2BAA2B,EAAE,2BAA2B,EACxD,KAAK,EAAE,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAC,eAAe,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,EACnG,WAAW,EACT,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB;gBAC1D,oBAAC,sBAAsB,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,CACpC,EAElC,eAAe,EAAE,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAChD,SAAS,EAAE,CAAC,CAAC,YAAY,EACzB,UAAU,EAAE,gBAAgB,EAC5B,cAAc,EACZ,kBAAkB,KAAK,MAAM,IAAI,CAC/B,oBAAC,uBAAuB,IACtB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,IAEvC,UAAU,CACa,CAC3B,EAEH,gBAAgB,EACd,kBAAkB,KAAK,QAAQ,IAAI,CACjC,oBAAC,yBAAyB,IACxB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,IAEvC,UAAU,CACe,CAC7B,EAEH,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,GAC9C,CACkC,CACvC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';\n\nimport { useMergeRefs, useStableCallback, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport ScreenreaderOnly from '../../internal/components/screenreader-only';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useIntersectionObserver } from '../../internal/hooks/use-intersection-observer';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useGetGlobalBreadcrumbs } from '../../internal/plugins/helpers/use-global-breadcrumbs';\nimport globalVars from '../../internal/styles/global-vars';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { AppLayoutProps } from '../interfaces';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { MIN_DRAWER_SIZE, OnChangeParams, useDrawers } from '../utils/use-drawers';\nimport { useFocusControl, useMultipleFocusControl } from '../utils/use-focus-control';\nimport { useGlobalScrollPadding } from '../utils/use-global-scroll-padding';\nimport { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { ActiveDrawersContext } from '../utils/visibility-context';\nimport {\n computeHorizontalLayout,\n computeSplitPanelOffsets,\n computeVerticalLayout,\n CONTENT_PADDING,\n} from './compute-layout';\nimport { AppLayoutVisibilityContext } from './contexts';\nimport { AppLayoutInternalProps, AppLayoutInternals } from './interfaces';\nimport {\n AppLayoutDrawer,\n AppLayoutGlobalDrawers,\n AppLayoutNavigation,\n AppLayoutNotifications,\n AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelSide,\n AppLayoutToolbar,\n} from './internal';\nimport { useMultiAppLayout } from './multi-layout';\nimport { SkeletonLayout } from './skeleton';\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef<AppLayoutProps.Ref, AppLayoutInternalProps>(\n (\n {\n ariaLabels,\n contentHeader,\n content,\n navigationOpen,\n navigationWidth,\n navigation,\n navigationHide,\n onNavigationChange,\n tools,\n toolsOpen: controlledToolsOpen,\n onToolsChange,\n toolsHide,\n toolsWidth,\n contentType,\n headerVariant,\n breadcrumbs,\n notifications,\n stickyNotifications,\n splitPanelPreferences: controlledSplitPanelPreferences,\n splitPanelOpen: controlledSplitPanelOpen,\n splitPanel,\n splitPanelSize: controlledSplitPanelSize,\n onSplitPanelToggle,\n onSplitPanelResize,\n onSplitPanelPreferencesChange,\n disableContentPaddings,\n minContentWidth,\n maxContentWidth,\n placement,\n navigationTriggerHide,\n ...rest\n },\n forwardRef\n ) => {\n const isMobile = useMobile();\n const { __embeddedViewMode: embeddedViewMode, __forceDeduplicationType: forceDeduplicationType } = rest as any;\n const splitPanelControlId = useUniqueId('split-panel');\n const [toolbarState, setToolbarState] = useState<'show' | 'hide'>('show');\n const [toolbarHeight, setToolbarHeight] = useState(0);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [navigationAnimationDisabled, setNavigationAnimationDisabled] = useState(true);\n const [splitPanelAnimationDisabled, setSplitPanelAnimationDisabled] = useState(true);\n const [isNested, setIsNested] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const [toolsOpen = false, setToolsOpen] = useControllable(controlledToolsOpen, onToolsChange, false, {\n componentName: 'AppLayout',\n controlledProp: 'toolsOpen',\n changeHandler: 'onToolsChange',\n });\n const onToolsToggle = (open: boolean) => {\n setToolsOpen(open);\n drawersFocusControl.setFocus();\n fireNonCancelableEvent(onToolsChange, { open });\n };\n\n const onGlobalDrawerFocus = (drawerId: string, open: boolean) => {\n globalDrawersFocusControl.setFocus({ force: true, drawerId, open });\n };\n\n const onAddNewActiveDrawer = (drawerId: string) => {\n // If a local drawer is already open, and we attempt to open a new one,\n // it will replace the existing one instead of opening an additional drawer,\n // since only one local drawer is supported. Therefore, layout calculations are not necessary.\n if (activeDrawer && drawers?.find(drawer => drawer.id === drawerId)) {\n return;\n }\n // get the size of drawerId. it could be either local or global drawer\n const combinedDrawers = [...(drawers || []), ...globalDrawers];\n const newDrawer = combinedDrawers.find(drawer => drawer.id === drawerId);\n if (!newDrawer) {\n return;\n }\n const newDrawerSize = Math.min(\n newDrawer.defaultSize ?? drawerSizes[drawerId] ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n );\n // check if the active drawers could be resized to fit the new drawers\n // to do this, we need to take all active drawers, sum up their min sizes, truncate it from resizableSpaceAvailable\n // and compare a given number with the new drawer id min size\n\n // the total size of all global drawers resized to their min size\n const availableSpaceForNewDrawer = resizableSpaceAvailable - totalActiveDrawersMinSize;\n if (availableSpaceForNewDrawer >= newDrawerSize) {\n return;\n }\n\n // now we made sure we cannot accommodate the new drawer with existing ones\n closeFirstDrawer();\n };\n\n const {\n drawers,\n activeDrawer,\n minDrawerSize,\n minGlobalDrawersSizes,\n activeDrawerSize,\n ariaLabelsWithDrawers,\n globalDrawers,\n activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n drawerSizes,\n drawersOpenQueue,\n onActiveDrawerChange,\n onActiveDrawerResize,\n onActiveGlobalDrawersChange,\n expandedDrawerId,\n setExpandedDrawerId,\n } = useDrawers({ ...rest, onGlobalDrawerFocus, onAddNewActiveDrawer }, ariaLabels, {\n ariaLabels,\n toolsHide,\n toolsOpen,\n tools,\n toolsWidth,\n onToolsToggle,\n });\n\n const onActiveDrawerChangeHandler = (\n drawerId: string | null,\n params: OnChangeParams = { initiatedByUserAction: true }\n ) => {\n onActiveDrawerChange(drawerId, params);\n drawersFocusControl.setFocus();\n };\n\n const [splitPanelOpen = false, setSplitPanelOpen] = useControllable(\n controlledSplitPanelOpen,\n onSplitPanelToggle,\n false,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelOpen',\n changeHandler: 'onSplitPanelToggle',\n }\n );\n\n const onSplitPanelToggleHandler = () => {\n setSplitPanelAnimationDisabled(false);\n setSplitPanelOpen(!splitPanelOpen);\n splitPanelFocusControl.setLastInteraction({ type: splitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(onSplitPanelToggle, { open: !splitPanelOpen });\n };\n\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n controlledSplitPanelPreferences,\n onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const onSplitPanelPreferencesChangeHandler = (detail: AppLayoutProps.SplitPanelPreferences) => {\n setSplitPanelPreferences(detail);\n splitPanelFocusControl.setLastInteraction({ type: 'position' });\n fireNonCancelableEvent(onSplitPanelPreferencesChange, detail);\n };\n\n const [splitPanelSize = 0, setSplitPanelSize] = useControllable(\n controlledSplitPanelSize,\n onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPreferences?.position ?? 'bottom'),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelHeaderBlockSize, setSplitPanelHeaderBlockSize] = useState(0);\n\n const onSplitPanelResizeHandler = (size: number) => {\n setSplitPanelSize(size);\n fireNonCancelableEvent(onSplitPanelResize, { size });\n };\n\n const [splitPanelToggleConfig, setSplitPanelToggleConfig] = useState<SplitPanelSideToggleProps>({\n ariaLabel: undefined,\n displayed: false,\n });\n\n const globalDrawersFocusControl = useMultipleFocusControl(true, activeGlobalDrawersIds);\n const drawersFocusControl = useFocusControl(!!activeDrawer?.id, true, activeDrawer?.id);\n const navigationFocusControl = useFocusControl(navigationOpen, navigationTriggerHide);\n const splitPanelFocusControl = useSplitPanelFocusControl([splitPanelPreferences, splitPanelOpen]);\n\n const onNavigationToggle = useStableCallback((open: boolean) => {\n setNavigationAnimationDisabled(false);\n navigationFocusControl.setFocus();\n fireNonCancelableEvent(onNavigationChange, { open });\n });\n\n useImperativeHandle(forwardRef, () => ({\n closeNavigationIfNecessary: () => isMobile && onNavigationToggle(false),\n openTools: () => onToolsToggle(true),\n focusToolsClose: () => drawersFocusControl.setFocus(true),\n focusActiveDrawer: () => drawersFocusControl.setFocus(true),\n focusSplitPanel: () => splitPanelFocusControl.refs.slider.current?.focus(),\n focusNavigation: () => navigationFocusControl.setFocus(true),\n }));\n\n const resolvedStickyNotifications = !!stickyNotifications && !isMobile;\n //navigation must be null if hidden so toolbar knows to hide the toggle button\n const resolvedNavigation = navigationHide ? null : navigation || <></>;\n //navigation must not be open if navigationHide is true\n const resolvedNavigationOpen = !!resolvedNavigation && navigationOpen;\n const {\n maxDrawerSize,\n maxSplitPanelSize,\n splitPanelForcedPosition,\n splitPanelPosition,\n maxGlobalDrawersSizes,\n resizableSpaceAvailable,\n } = computeHorizontalLayout({\n activeDrawerSize: activeDrawer ? activeDrawerSize : 0,\n splitPanelSize,\n minContentWidth,\n navigationOpen: resolvedNavigationOpen,\n navigationWidth,\n placement,\n splitPanelOpen,\n splitPanelPosition: splitPanelPreferences?.position,\n isMobile,\n activeGlobalDrawersSizes,\n });\n\n const { ref: intersectionObserverRef, isIntersecting } = useIntersectionObserver({ initialState: true });\n const { registered, toolbarProps } = useMultiAppLayout(\n {\n forceDeduplicationType,\n ariaLabels: ariaLabelsWithDrawers,\n navigation: resolvedNavigation && !navigationTriggerHide,\n navigationOpen: resolvedNavigationOpen,\n onNavigationToggle,\n navigationFocusRef: navigationFocusControl.refs.toggle,\n breadcrumbs,\n activeDrawerId: activeDrawer?.id ?? null,\n // only pass it down if there are non-empty drawers or tools\n drawers: drawers?.length || !toolsHide ? drawers : undefined,\n globalDrawersFocusControl,\n globalDrawers: globalDrawers?.length ? globalDrawers : undefined,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange,\n onActiveDrawerChange: onActiveDrawerChangeHandler,\n drawersFocusRef: drawersFocusControl.refs.toggle,\n splitPanel,\n splitPanelToggleProps: {\n ...splitPanelToggleConfig,\n active: splitPanelOpen,\n controlId: splitPanelControlId,\n position: splitPanelPosition,\n },\n splitPanelFocusRef: splitPanelFocusControl.refs.toggle,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n expandedDrawerId,\n setExpandedDrawerId,\n },\n isIntersecting\n );\n\n const hasToolbar = !embeddedViewMode && !!toolbarProps;\n const discoveredBreadcrumbs = useGetGlobalBreadcrumbs(hasToolbar && !breadcrumbs);\n\n const verticalOffsets = computeVerticalLayout({\n topOffset: placement.insetBlockStart,\n hasVisibleToolbar: hasToolbar && toolbarState !== 'hide',\n notificationsHeight: notificationsHeight ?? 0,\n toolbarHeight: toolbarHeight ?? 0,\n stickyNotifications: resolvedStickyNotifications,\n });\n\n useGlobalScrollPadding(verticalOffsets.header);\n\n const appLayoutInternals: AppLayoutInternals = {\n ariaLabels: ariaLabelsWithDrawers,\n headerVariant,\n isMobile,\n breadcrumbs,\n discoveredBreadcrumbs,\n stickyNotifications: resolvedStickyNotifications,\n navigationOpen: resolvedNavigationOpen,\n navigation: resolvedNavigation,\n navigationFocusControl,\n activeDrawer,\n activeDrawerSize,\n minDrawerSize,\n maxDrawerSize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n drawers: drawers!,\n globalDrawers,\n activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n onActiveGlobalDrawersChange,\n drawersFocusControl,\n globalDrawersFocusControl,\n splitPanelPosition,\n splitPanelToggleConfig,\n splitPanelOpen,\n splitPanelControlId,\n splitPanelFocusControl,\n placement,\n toolbarState,\n setToolbarState,\n verticalOffsets,\n drawersOpenQueue,\n setToolbarHeight,\n setNotificationsHeight,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n onNavigationToggle,\n onActiveDrawerChange: onActiveDrawerChangeHandler,\n onActiveDrawerResize,\n splitPanelAnimationDisabled,\n expandedDrawerId,\n setExpandedDrawerId,\n };\n\n const splitPanelInternals: SplitPanelProviderProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight =\n document.documentElement.clientHeight - placement.insetBlockStart - placement.insetBlockEnd;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n maxWidth: maxSplitPanelSize,\n isForcedPosition: splitPanelForcedPosition,\n isOpen: splitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: onSplitPanelPreferencesChangeHandler,\n onResize: onSplitPanelResizeHandler,\n onToggle: onSplitPanelToggleHandler,\n position: splitPanelPosition,\n reportSize: size => setSplitPanelReportedSize(size),\n reportHeaderHeight: size => setSplitPanelHeaderBlockSize(size),\n headerHeight: splitPanelHeaderBlockSize,\n rightOffset: 0,\n size: splitPanelSize,\n topOffset: 0,\n setSplitPanelToggle: setSplitPanelToggleConfig,\n refs: splitPanelFocusControl.refs,\n };\n\n const closeFirstDrawer = useStableCallback(() => {\n const drawerToClose = drawersOpenQueue[drawersOpenQueue.length - 1];\n if (activeDrawer && activeDrawer?.id === drawerToClose) {\n onActiveDrawerChange(null, { initiatedByUserAction: true });\n } else if (activeGlobalDrawersIds.includes(drawerToClose)) {\n onActiveGlobalDrawersChange(drawerToClose, { initiatedByUserAction: true });\n }\n });\n\n useEffect(() => {\n // Close navigation drawer on mobile so that the main content is visible\n if (isMobile) {\n onNavigationToggle(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMobile]);\n\n const getTotalActiveDrawersMinSize = () => {\n const combinedDrawers = [...(drawers || []), ...globalDrawers];\n let result = activeGlobalDrawersIds\n .map(activeDrawerId =>\n Math.min(\n combinedDrawers.find(drawer => drawer.id === activeDrawerId)?.defaultSize ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n )\n )\n .reduce((acc, curr) => acc + curr, 0);\n if (activeDrawer) {\n result += Math.min(activeDrawer?.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE);\n }\n\n return result;\n };\n\n const totalActiveDrawersMinSize = getTotalActiveDrawersMinSize();\n\n useEffect(() => {\n if (isMobile) {\n return;\n }\n\n const activeNavigationWidth = !navigationHide && navigationOpen ? navigationWidth : 0;\n const scrollWidth = activeNavigationWidth + CONTENT_PADDING + totalActiveDrawersMinSize;\n const hasHorizontalScroll = scrollWidth > placement.inlineSize;\n if (hasHorizontalScroll) {\n if (!navigationHide && navigationOpen) {\n onNavigationToggle(false);\n return;\n }\n\n closeFirstDrawer();\n }\n }, [\n totalActiveDrawersMinSize,\n closeFirstDrawer,\n isMobile,\n navigationHide,\n navigationOpen,\n navigationWidth,\n onNavigationToggle,\n placement.inlineSize,\n ]);\n\n /**\n * Returns true if the AppLayout is nested\n * Does not apply to iframe\n */\n const getIsNestedInAppLayout = (element: HTMLElement | null): boolean => {\n let currentElement: Element | null = element?.parentElement ?? null;\n\n // this traverse is needed only for JSDOM\n // in real browsers the globalVar will be propagated to all descendants and this loops exits after initial iteration\n while (currentElement) {\n if (getComputedStyle(currentElement).getPropertyValue(globalVars.stickyVerticalTopOffset)) {\n return true;\n }\n currentElement = currentElement.parentElement;\n }\n\n return false;\n };\n\n useLayoutEffect(() => {\n if (!hasToolbar) {\n setIsNested(getIsNestedInAppLayout(rootRef.current));\n }\n }, [hasToolbar]);\n\n const splitPanelOffsets = computeSplitPanelOffsets({\n placement,\n hasSplitPanel: !!splitPanel,\n splitPanelOpen,\n splitPanelPosition,\n splitPanelFullHeight: splitPanelReportedSize,\n splitPanelHeaderHeight: splitPanelHeaderBlockSize,\n });\n\n return (\n <AppLayoutVisibilityContext.Provider value={isIntersecting}>\n {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */}\n {!hasToolbar && breadcrumbs ? <ScreenreaderOnly>{breadcrumbs}</ScreenreaderOnly> : null}\n <SkeletonLayout\n ref={useMergeRefs(intersectionObserverRef, rootRef)}\n isNested={isNested}\n // Why not use drawerExpandedMode={!!expandedDrawerId || !!toolbarProps?.expandedDrawerId} instead?\n // Because in nested layouts, the parent layout hides its main content area,\n // which means the child layout isn't rendered at all in that case\n drawerExpandedModeInChildLayout={!!toolbarProps?.expandedDrawerId}\n drawerExpandedMode={!!expandedDrawerId}\n style={{\n paddingBlockEnd: splitPanelOffsets.mainContentPaddingBlockEnd,\n ...(hasToolbar || !isNested\n ? {\n [globalVars.stickyVerticalTopOffset]: `${verticalOffsets.header}px`,\n [globalVars.stickyVerticalBottomOffset]: `${splitPanelOffsets.stickyVerticalBottomOffset}px`,\n }\n : {}),\n ...(!isMobile ? { minWidth: `${minContentWidth}px` } : {}),\n }}\n toolbar={\n hasToolbar && <AppLayoutToolbar appLayoutInternals={appLayoutInternals} toolbarProps={toolbarProps} />\n }\n notifications={\n notifications && (\n <AppLayoutNotifications appLayoutInternals={appLayoutInternals}>{notifications}</AppLayoutNotifications>\n )\n }\n headerVariant={headerVariant}\n contentHeader={contentHeader}\n // delay rendering the content until registration of this instance is complete\n content={registered ? content : null}\n navigation={resolvedNavigation && <AppLayoutNavigation appLayoutInternals={appLayoutInternals} />}\n navigationOpen={resolvedNavigationOpen}\n navigationWidth={navigationWidth}\n navigationAnimationDisabled={navigationAnimationDisabled}\n tools={drawers && drawers.length > 0 && <AppLayoutDrawer appLayoutInternals={appLayoutInternals} />}\n globalTools={\n <ActiveDrawersContext.Provider value={activeGlobalDrawersIds}>\n <AppLayoutGlobalDrawers appLayoutInternals={appLayoutInternals} />\n </ActiveDrawersContext.Provider>\n }\n globalToolsOpen={!!activeGlobalDrawersIds.length}\n toolsOpen={!!activeDrawer}\n toolsWidth={activeDrawerSize}\n sideSplitPanel={\n splitPanelPosition === 'side' && (\n <AppLayoutSplitPanelSide\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelSide>\n )\n }\n bottomSplitPanel={\n splitPanelPosition === 'bottom' && (\n <AppLayoutSplitPanelBottom\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelBottom>\n )\n }\n splitPanelOpen={splitPanelOpen}\n placement={placement}\n contentType={contentType}\n maxContentWidth={maxContentWidth}\n disableContentPaddings={disableContentPaddings}\n />\n </AppLayoutVisibilityContext.Provider>\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAG/E,UAAU,oBAAoB;IAC5B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,qBAAqB,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD;AAED,wBAAgB,eAAe,CAAC,EAAE,cAAc,EAAE,qBAAqB,EAAE,EAAE,oBAAoB,eAa9F"}
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { BreadcrumbGroupImplementation } from '../../../../breadcrumb-group/implementation';
|
|
5
5
|
import { BreadcrumbsSlotContext } from '../../contexts';
|
|
6
|
-
import styles from './styles.css.js';
|
|
7
6
|
export function BreadcrumbsSlot({ ownBreadcrumbs, discoveredBreadcrumbs }) {
|
|
8
7
|
return (React.createElement(BreadcrumbsSlotContext.Provider, { value: { isInToolbar: true } },
|
|
9
|
-
|
|
10
|
-
discoveredBreadcrumbs && (React.createElement(
|
|
11
|
-
React.createElement(BreadcrumbGroupImplementation, Object.assign({}, discoveredBreadcrumbs, { "data-awsui-discovered-breadcrumbs": true, __injectAnalyticsComponentMetadata: true }))))));
|
|
8
|
+
ownBreadcrumbs,
|
|
9
|
+
discoveredBreadcrumbs && (React.createElement(BreadcrumbGroupImplementation, Object.assign({}, discoveredBreadcrumbs, { "data-awsui-discovered-breadcrumbs": true, __injectAnalyticsComponentMetadata: true })))));
|
|
12
10
|
}
|
|
13
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,MAAM,UAAU,eAAe,CAAC,EAAE,cAAc,EAAE,qBAAqB,EAAwB;IAC7F,OAAO,CACL,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;QAC1D,cAAc;QACd,qBAAqB,IAAI,CACxB,oBAAC,6BAA6B,oBACxB,qBAAqB,yCACU,IAAI,EACvC,kCAAkC,EAAE,IAAI,IACxC,CACH,CAC+B,CACnC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BreadcrumbGroupImplementation } from '../../../../breadcrumb-group/implementation';\nimport { BreadcrumbGroupProps } from '../../../../breadcrumb-group/interfaces';\nimport { BreadcrumbsSlotContext } from '../../contexts';\n\ninterface BreadcrumbsSlotProps {\n ownBreadcrumbs: React.ReactNode;\n discoveredBreadcrumbs: BreadcrumbGroupProps | null;\n}\n\nexport function BreadcrumbsSlot({ ownBreadcrumbs, discoveredBreadcrumbs }: BreadcrumbsSlotProps) {\n return (\n <BreadcrumbsSlotContext.Provider value={{ isInToolbar: true }}>\n {ownBreadcrumbs}\n {discoveredBreadcrumbs && (\n <BreadcrumbGroupImplementation\n {...discoveredBreadcrumbs}\n data-awsui-discovered-breadcrumbs={true}\n __injectAnalyticsComponentMetadata={true}\n />\n )}\n </BreadcrumbsSlotContext.Provider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAoEnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
|
package/button-dropdown/index.js
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
'use client';
|
|
4
|
-
import { __rest } from "tslib";
|
|
5
3
|
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
4
|
+
|
|
5
|
+
import CoreComponent from './internal-do-not-use-core';
|
|
9
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
metadata: {
|
|
18
|
-
mainAction: !!mainAction,
|
|
19
|
-
checkboxItems: hasCheckboxItems(items),
|
|
20
|
-
hasDisabledReason: Boolean(disabledReason),
|
|
21
|
-
hasDisabledReasons: hasDisabledReasonItems(items),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
const baseProps = getBaseProps(props);
|
|
25
|
-
const analyticsComponentMetadata = {
|
|
26
|
-
name: 'awsui.ButtonDropdown',
|
|
27
|
-
label: `.${analyticsSelectors['trigger-label']}`,
|
|
28
|
-
properties: { variant, disabled: `${disabled}` },
|
|
29
|
-
};
|
|
30
|
-
return (React.createElement(InternalButtonDropdown, Object.assign({}, baseProps, baseComponentProps, { ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth }, getAnalyticsMetadataAttribute({
|
|
31
|
-
component: analyticsComponentMetadata,
|
|
32
|
-
})), children));
|
|
7
|
+
import { validateProps } from '../internal/base-component';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ButtonDropdown = React.forwardRef((props, ref) => {
|
|
12
|
+
validateProps('ButtonDropdown', props, ["nativeMainActionAttributes","nativeTriggerAttributes"], {});
|
|
13
|
+
return React.createElement(CoreComponent, {ref,...props});
|
|
33
14
|
});
|
|
15
|
+
|
|
16
|
+
|
|
34
17
|
applyDisplayName(ButtonDropdown, 'ButtonDropdown');
|
|
35
18
|
export default ButtonDropdown;
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -6,6 +6,10 @@ import { BaseComponentProps } from '../internal/base-component';
|
|
|
6
6
|
import { ExpandToViewport } from '../internal/components/dropdown/interfaces';
|
|
7
7
|
import { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';
|
|
8
8
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
9
|
+
/**
|
|
10
|
+
* @awsuiSystem core
|
|
11
|
+
*/
|
|
12
|
+
|
|
9
13
|
export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {
|
|
10
14
|
/**
|
|
11
15
|
* Array of objects with a number of supported types.
|
|
@@ -113,6 +117,30 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
113
117
|
* Sets the button width to be 100% of the parent container width. Button content is centered.
|
|
114
118
|
*/
|
|
115
119
|
fullWidth?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Attributes to add to the native `button` element.
|
|
122
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
123
|
+
* - `className` will be appended.
|
|
124
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
125
|
+
*
|
|
126
|
+
* We do not support using this attribute to apply custom styling.
|
|
127
|
+
*
|
|
128
|
+
* @awsuiSystem core
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Attributes to add to the native element of the `mainAction`.
|
|
133
|
+
*
|
|
134
|
+
* Specify either `button` for a standard main action, or `anchor` if `html` is set.
|
|
135
|
+
*
|
|
136
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
137
|
+
* - `className` will be appended.
|
|
138
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
139
|
+
*
|
|
140
|
+
* We do not support using this attribute to apply custom styling.
|
|
141
|
+
*
|
|
142
|
+
* @awsuiSystem core
|
|
143
|
+
*/
|
|
116
144
|
}
|
|
117
145
|
export declare namespace ButtonDropdownProps {
|
|
118
146
|
type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-d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["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n description?: string;\n href?: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface CategoryProps extends HighlightProps {\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native element of the `mainAction`.\n *\n * Specify either `button` for a standard main action, or `anchor` if `html` is set.\n *\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeMainActionAttributes?: {\n button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n };\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n description?: string;\n href?: string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface CategoryProps extends HighlightProps {\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import { __rest } from "tslib";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
7
|
+
import { getBaseProps } from '../internal/base-component';
|
|
8
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
9
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
10
|
+
import InternalButtonDropdown from './internal';
|
|
11
|
+
import { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';
|
|
12
|
+
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
13
|
+
const ButtonDropdown = React.forwardRef((_a, ref) => {
|
|
14
|
+
var { items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, expandToViewport = false, ariaLabel, children, onItemClick, onItemFollow, mainAction, fullWidth, nativeMainActionAttributes, nativeTriggerAttributes } = _a, props = __rest(_a, ["items", "variant", "loading", "loadingText", "disabled", "disabledReason", "expandableGroups", "expandToViewport", "ariaLabel", "children", "onItemClick", "onItemFollow", "mainAction", "fullWidth", "nativeMainActionAttributes", "nativeTriggerAttributes"]);
|
|
15
|
+
const baseComponentProps = useBaseComponent('ButtonDropdown', {
|
|
16
|
+
props: { expandToViewport, expandableGroups, variant },
|
|
17
|
+
metadata: {
|
|
18
|
+
mainAction: !!mainAction,
|
|
19
|
+
checkboxItems: hasCheckboxItems(items),
|
|
20
|
+
hasDisabledReason: Boolean(disabledReason),
|
|
21
|
+
hasDisabledReasons: hasDisabledReasonItems(items),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const baseProps = getBaseProps(props);
|
|
25
|
+
const analyticsComponentMetadata = {
|
|
26
|
+
name: 'awsui.ButtonDropdown',
|
|
27
|
+
label: `.${analyticsSelectors['trigger-label']}`,
|
|
28
|
+
properties: { variant, disabled: `${disabled}` },
|
|
29
|
+
};
|
|
30
|
+
return (React.createElement(InternalButtonDropdown, Object.assign({}, baseProps, baseComponentProps, { ref: ref, items: items, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, expandableGroups: expandableGroups, expandToViewport: expandToViewport, ariaLabel: ariaLabel, onItemClick: onItemClick, onItemFollow: onItemFollow, mainAction: mainAction, fullWidth: fullWidth, nativeMainActionAttributes: nativeMainActionAttributes, nativeTriggerAttributes: nativeTriggerAttributes }, getAnalyticsMetadataAttribute({
|
|
31
|
+
component: analyticsComponentMetadata,
|
|
32
|
+
})), children));
|
|
33
|
+
});
|
|
34
|
+
applyDisplayName(ButtonDropdown, 'ButtonDropdown');
|
|
35
|
+
export default ButtonDropdown;
|
|
36
|
+
//# sourceMappingURL=internal-do-not-use-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["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AAC,CAAC;IAEtC,MAAM,0BAA0B,GAAsD;QACpF,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,IAAI,kBAAkB,CAAC,eAAe,CAAC,EAAE;QAChD,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,EAAE;KACjD,CAAC;IAEF,OAAO,CACL,oBAAC,sBAAsB,oBACjB,SAAS,EACT,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,0BAA0B,EAAE,0BAA0B,EACtD,uBAAuB,EAAE,uBAAuB,IAC5C,6BAA6B,CAAC;QAChC,SAAS,EAAE,0BAA0B;KACtC,CAAC,GAED,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataButtonDropdownComponent } from './analytics-metadata/interfaces';\nimport { ButtonDropdownProps } from './interfaces';\nimport InternalButtonDropdown from './internal';\nimport { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { ButtonDropdownProps };\n\nconst ButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n expandToViewport = false,\n ariaLabel,\n children,\n onItemClick,\n onItemFollow,\n mainAction,\n fullWidth,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n hasDisabledReason: Boolean(disabledReason),\n hasDisabledReasons: hasDisabledReasonItems(items),\n },\n });\n const baseProps = getBaseProps(props);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataButtonDropdownComponent = {\n name: 'awsui.ButtonDropdown',\n label: `.${analyticsSelectors['trigger-label']}`,\n properties: { variant, disabled: `${disabled}` },\n };\n\n return (\n <InternalButtonDropdown\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n items={items}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n expandableGroups={expandableGroups}\n expandToViewport={expandToViewport}\n ariaLabel={ariaLabel}\n onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n fullWidth={fullWidth}\n nativeMainActionAttributes={nativeMainActionAttributes}\n nativeTriggerAttributes={nativeTriggerAttributes}\n {...getAnalyticsMetadataAttribute({\n component: analyticsComponentMetadata,\n })}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAsBtE,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAQhF,QAAA,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAsBtE,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAQhF,QAAA,MAAM,sBAAsB,6GAuY3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -23,7 +23,7 @@ import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
|
23
23
|
import styles from './styles.css.js';
|
|
24
24
|
const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
25
25
|
var _b;
|
|
26
|
-
var { items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, children, onItemClick, onItemFollow, customTriggerBuilder, expandToViewport, ariaLabel, title, description, preferCenter, mainAction, showMainActionOnly, __internalRootRef, analyticsMetadataTransformer, linkStyle, fullWidth, position } = _a, props = __rest(_a, ["items", "variant", "loading", "loadingText", "disabled", "disabledReason", "expandableGroups", "children", "onItemClick", "onItemFollow", "customTriggerBuilder", "expandToViewport", "ariaLabel", "title", "description", "preferCenter", "mainAction", "showMainActionOnly", "__internalRootRef", "analyticsMetadataTransformer", "linkStyle", "fullWidth", "position"]);
|
|
26
|
+
var { items, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, expandableGroups = false, children, onItemClick, onItemFollow, customTriggerBuilder, expandToViewport, ariaLabel, title, description, preferCenter, mainAction, showMainActionOnly, __internalRootRef, analyticsMetadataTransformer, linkStyle, fullWidth, position, nativeMainActionAttributes, nativeTriggerAttributes } = _a, props = __rest(_a, ["items", "variant", "loading", "loadingText", "disabled", "disabledReason", "expandableGroups", "children", "onItemClick", "onItemFollow", "customTriggerBuilder", "expandToViewport", "ariaLabel", "title", "description", "preferCenter", "mainAction", "showMainActionOnly", "__internalRootRef", "analyticsMetadataTransformer", "linkStyle", "fullWidth", "position", "nativeMainActionAttributes", "nativeTriggerAttributes"]);
|
|
27
27
|
const isInRestrictedView = useMobile();
|
|
28
28
|
const dropdownId = useUniqueId('dropdown');
|
|
29
29
|
for (const item of items) {
|
|
@@ -39,7 +39,7 @@ const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
|
39
39
|
warnOnce('ButtonDropdown', 'Main action is only supported for "primary" and "normal" component variant.');
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const hasMainAction = mainAction && (variant === 'primary' || variant === 'normal');
|
|
43
43
|
const isVisualRefresh = useVisualRefresh();
|
|
44
44
|
const { isOpen, targetItem, isHighlighted, isKeyboardHighlight, isExpanded, highlightItem, onKeyDown, onKeyUp, onItemActivate, onGroupToggle, toggleDropdown, closeDropdown, setIsUsingMouse, } = useButtonDropdown({
|
|
45
45
|
items,
|
|
@@ -60,13 +60,13 @@ const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
|
60
60
|
useImperativeHandle(ref, () => ({
|
|
61
61
|
focus(...args) {
|
|
62
62
|
var _a;
|
|
63
|
-
(_a = (
|
|
63
|
+
(_a = (hasMainAction ? mainActionRef : triggerRef).current) === null || _a === void 0 ? void 0 : _a.focus(...args);
|
|
64
64
|
},
|
|
65
65
|
focusDropdownTrigger(...args) {
|
|
66
66
|
var _a;
|
|
67
67
|
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus(...args);
|
|
68
68
|
},
|
|
69
|
-
}), [mainActionRef, triggerRef,
|
|
69
|
+
}), [mainActionRef, triggerRef, hasMainAction]);
|
|
70
70
|
const clickHandler = () => {
|
|
71
71
|
if (!loading && !disabled) {
|
|
72
72
|
// Prevent moving highlight on mobiles to avoid disabled state reason popup if defined.
|
|
@@ -91,9 +91,7 @@ const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
|
91
91
|
disabledReason, onClick: (event) => {
|
|
92
92
|
event.preventDefault();
|
|
93
93
|
clickHandler();
|
|
94
|
-
}, ariaLabel, ariaExpanded: canBeOpened && isOpen, formAction: 'none', nativeButtonAttributes: {
|
|
95
|
-
'aria-haspopup': true,
|
|
96
|
-
} });
|
|
94
|
+
}, ariaLabel, ariaExpanded: canBeOpened && isOpen, formAction: 'none', nativeButtonAttributes: Object.assign({ 'aria-haspopup': true }, nativeTriggerAttributes) });
|
|
97
95
|
const triggerId = useUniqueId('awsui-button-dropdown__trigger');
|
|
98
96
|
const triggerHasBadge = () => {
|
|
99
97
|
const flatItems = items.flatMap(item => {
|
|
@@ -130,7 +128,7 @@ const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
|
130
128
|
isOpen,
|
|
131
129
|
})));
|
|
132
130
|
}
|
|
133
|
-
else if (
|
|
131
|
+
else if (hasMainAction) {
|
|
134
132
|
const { text, iconName, iconAlt, iconSvg, iconUrl, external, externalIconAriaLabel } = mainAction, mainActionProps = __rest(mainAction, ["text", "iconName", "iconAlt", "iconSvg", "iconUrl", "external", "externalIconAriaLabel"]);
|
|
135
133
|
const mainActionIconProps = external
|
|
136
134
|
? { iconName: 'external', iconAlign: 'right', target: '_blank', rel: 'noopener noreferrer' }
|
|
@@ -139,7 +137,7 @@ const InternalButtonDropdown = React.forwardRef((_a, ref) => {
|
|
|
139
137
|
? `${(_b = mainAction.ariaLabel) !== null && _b !== void 0 ? _b : mainAction.text} ${mainAction.externalIconAriaLabel}`
|
|
140
138
|
: mainAction.ariaLabel;
|
|
141
139
|
const hasNoText = !text;
|
|
142
|
-
const mainActionButton = (React.createElement(InternalButton, Object.assign({ ref: mainActionRef }, mainActionProps, mainActionIconProps, { fullWidth: canBeFullWidth, className: clsx(styles['trigger-button'], hasNoText && styles['has-no-text'], isVisualRefresh && styles['visual-refresh'], canBeFullWidth && styles['main-action-full-width']), variant: variant, ariaLabel: mainActionAriaLabel, formAction: "none" }), text));
|
|
140
|
+
const mainActionButton = (React.createElement(InternalButton, Object.assign({ ref: mainActionRef }, mainActionProps, mainActionIconProps, { fullWidth: canBeFullWidth, className: clsx(styles['trigger-button'], hasNoText && styles['has-no-text'], isVisualRefresh && styles['visual-refresh'], canBeFullWidth && styles['main-action-full-width']), variant: variant, ariaLabel: mainActionAriaLabel, formAction: "none", nativeAnchorAttributes: nativeMainActionAttributes === null || nativeMainActionAttributes === void 0 ? void 0 : nativeMainActionAttributes.anchor, nativeButtonAttributes: nativeMainActionAttributes === null || nativeMainActionAttributes === void 0 ? void 0 : nativeMainActionAttributes.button }), text));
|
|
143
141
|
trigger = (React.createElement("div", { role: "group", "aria-label": ariaLabel, className: styles['split-trigger-wrapper'] },
|
|
144
142
|
React.createElement("div", Object.assign({ className: clsx(styles['trigger-item'], styles['split-trigger'], styles[`variant-${variant}`], mainActionProps.disabled && styles.disabled, mainActionProps.loading && styles.loading),
|
|
145
143
|
// Close dropdown upon main action click unless event is cancelled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button-dropdown/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,O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,WAAW,IAAI,MAAM,EAC3B,QAAQ,EAAC,QAAQ,EACjB,IAAI,EAAC,MAAM,EACX,mBAAmB,EAAE,IAAI,EACzB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACrF,UAAU,EAAC,UAAU;gBAErB,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,gBAAgB,EACrC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,IAAI,EACpB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GAClB,CACU,CACL,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton, InternalButtonProps } from '../button/internal';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport OptionsList from '../internal/components/options-list';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode/index.js';\nimport { isDevelopment } from '../internal/is-development';\nimport { spinWhenOpen } from '../internal/styles/motion/utils';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport {\n GeneratedAnalyticsMetadataButtonDropdownCollapse,\n GeneratedAnalyticsMetadataButtonDropdownExpand,\n} from './analytics-metadata/interfaces.js';\nimport { ButtonDropdownProps, InternalButtonDropdownProps } from './interfaces';\nimport ItemsList from './items-list';\nimport { useButtonDropdown } from './utils/use-button-dropdown';\nimport { isLinkItem } from './utils/utils.js';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst InternalButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n children,\n onItemClick,\n onItemFollow,\n customTriggerBuilder,\n expandToViewport,\n ariaLabel,\n title,\n description,\n preferCenter,\n mainAction,\n showMainActionOnly,\n __internalRootRef,\n analyticsMetadataTransformer,\n linkStyle,\n fullWidth,\n position,\n ...props\n }: InternalButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const isInRestrictedView = useMobile();\n const dropdownId = useUniqueId('dropdown');\n for (const item of items) {\n if (isLinkItem(item)) {\n checkSafeUrl('ButtonDropdown', item.href);\n }\n }\n if (mainAction) {\n checkSafeUrl('ButtonDropdown', mainAction.href);\n }\n\n if (isDevelopment) {\n if (mainAction && variant !== 'primary' && variant !== 'normal') {\n warnOnce('ButtonDropdown', 'Main action is only supported for \"primary\" and \"normal\" component variant.');\n }\n }\n const isMainAction = mainAction && (variant === 'primary' || variant === 'normal');\n const isVisualRefresh = useVisualRefresh();\n\n const {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n } = useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n // Scroll is unnecessary when moving focus back to the dropdown trigger.\n onReturnFocus: () => triggerRef.current?.focus({ preventScroll: true }),\n expandToViewport,\n hasExpandableGroups: expandableGroups,\n isInRestrictedView,\n });\n\n const handleMouseEvent = () => {\n setIsUsingMouse(true);\n };\n\n const baseProps = getBaseProps(props);\n\n const mainActionRef = useRef<HTMLElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args) {\n (isMainAction ? mainActionRef : triggerRef).current?.focus(...args);\n },\n focusDropdownTrigger(...args) {\n triggerRef.current?.focus(...args);\n },\n }),\n [mainActionRef, triggerRef, isMainAction]\n );\n\n const clickHandler = () => {\n if (!loading && !disabled) {\n // Prevent moving highlight on mobiles to avoid disabled state reason popup if defined.\n toggleDropdown({ moveHighlightOnOpen: !isInRestrictedView });\n }\n };\n\n const canBeOpened = !loading && !disabled;\n\n const canBeFullWidth = !!fullWidth && (variant === 'primary' || variant === 'normal');\n\n const triggerVariant = variant === 'navigation' ? undefined : variant === 'inline-icon' ? 'inline-icon' : variant;\n const iconProps: Partial<ButtonProps & { __iconClass?: string }> =\n variant === 'icon' || variant === 'inline-icon'\n ? {\n iconName: 'ellipsis',\n }\n : {\n iconName: 'caret-down-filled',\n iconAlign: 'right',\n __iconClass: spinWhenOpen(styles, 'rotate', canBeOpened && isOpen),\n };\n\n const baseTriggerProps: InternalButtonProps = {\n className: clsx(\n styles['trigger-button'],\n styles['test-utils-button-trigger'],\n analyticsSelectors['trigger-label']\n ),\n ...iconProps,\n variant: triggerVariant,\n loading,\n loadingText,\n disabled,\n disabledReason,\n onClick: (event: Event) => {\n event.preventDefault();\n clickHandler();\n },\n ariaLabel,\n ariaExpanded: canBeOpened && isOpen,\n formAction: 'none',\n nativeButtonAttributes: {\n 'aria-haspopup': true,\n },\n };\n\n const triggerId = useUniqueId('awsui-button-dropdown__trigger');\n\n const triggerHasBadge = () => {\n const flatItems = items.flatMap(item => {\n if ('items' in item) {\n return item.items;\n }\n return item;\n });\n\n return (\n variant === 'icon' &&\n !!flatItems?.find(item => {\n if ('badge' in item) {\n return item.badge;\n }\n })\n );\n };\n\n let trigger: React.ReactNode = null;\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonDropdownExpand\n | GeneratedAnalyticsMetadataButtonDropdownCollapse\n | Record<string, never> = disabled\n ? {}\n : {\n action: !isOpen ? 'expand' : 'collapse',\n detail: {\n label: `.${analyticsSelectors['trigger-label']}`,\n },\n };\n\n if (customTriggerBuilder) {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n {customTriggerBuilder({\n testUtilsClass: styles['test-utils-button-trigger'],\n ariaExpanded: canBeOpened && isOpen,\n onClick: clickHandler,\n triggerRef,\n ariaLabel,\n disabled,\n disabledReason,\n isOpen,\n })}\n </div>\n );\n } else if (isMainAction) {\n const { text, iconName, iconAlt, iconSvg, iconUrl, external, externalIconAriaLabel, ...mainActionProps } =\n mainAction;\n const mainActionIconProps = external\n ? ({ iconName: 'external', iconAlign: 'right', target: '_blank', rel: 'noopener noreferrer' } as const)\n : ({ iconName, iconAlt, iconSvg, iconUrl } as const);\n const mainActionAriaLabel = externalIconAriaLabel\n ? `${mainAction.ariaLabel ?? mainAction.text} ${mainAction.externalIconAriaLabel}`\n : mainAction.ariaLabel;\n const hasNoText = !text;\n const mainActionButton = (\n <InternalButton\n ref={mainActionRef}\n {...mainActionProps}\n {...mainActionIconProps}\n fullWidth={canBeFullWidth}\n className={clsx(\n styles['trigger-button'],\n hasNoText && styles['has-no-text'],\n isVisualRefresh && styles['visual-refresh'],\n canBeFullWidth && styles['main-action-full-width']\n )}\n variant={variant}\n ariaLabel={mainActionAriaLabel}\n formAction=\"none\"\n >\n {text}\n </InternalButton>\n );\n trigger = (\n <div role=\"group\" aria-label={ariaLabel} className={styles['split-trigger-wrapper']}>\n <div\n className={clsx(\n styles['trigger-item'],\n styles['split-trigger'],\n styles[`variant-${variant}`],\n mainActionProps.disabled && styles.disabled,\n mainActionProps.loading && styles.loading\n )}\n // Close dropdown upon main action click unless event is cancelled.\n onClick={closeDropdown}\n // Prevent keyboard events from propagation to the button dropdown handler.\n onKeyDown={e => e.stopPropagation()}\n onKeyUp={e => e.stopPropagation()}\n {...getAnalyticsMetadataAttribute({\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['main-action-label']}`,\n },\n })}\n >\n {mainActionButton}\n </div>\n {!showMainActionOnly && (\n <div\n className={clsx(\n styles['trigger-item'],\n styles['dropdown-trigger'],\n isVisualRefresh && styles['visual-refresh'],\n styles[`variant-${variant}`],\n baseTriggerProps.disabled && styles.disabled,\n baseTriggerProps.loading && styles.loading\n )}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n <InternalButton\n ref={triggerRef}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['main-action-trigger-full-width']]: canBeFullWidth,\n })}\n __emitPerformanceMarks={false}\n >\n {children}\n </InternalButton>\n </div>\n )}\n </div>\n );\n } else {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n <InternalButton\n ref={triggerRef}\n id={triggerId}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['full-width']]: canBeFullWidth,\n [styles.loading]: canBeFullWidth && !!loading,\n })}\n badge={triggerHasBadge()}\n fullWidth={fullWidth}\n >\n {children}\n </InternalButton>\n </div>\n );\n }\n\n const hasHeader = title || description;\n const headerId = useUniqueId('awsui-button-dropdown__header');\n\n const shouldLabelWithTrigger = !ariaLabel && !mainAction && variant !== 'icon' && variant !== 'inline-icon';\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n return (\n <div\n {...baseProps}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onMouseDown={handleMouseEvent}\n onMouseMove={handleMouseEvent}\n className={clsx(\n styles['button-dropdown'],\n styles[`variant-${variant}`],\n canBeFullWidth && styles['full-width'],\n baseProps.className\n )}\n aria-owns={expandToViewport && isOpen ? dropdownId : undefined}\n ref={__internalRootRef}\n >\n <Dropdown\n open={canBeOpened && isOpen}\n stretchWidth={false}\n stretchTriggerHeight={variant === 'navigation'}\n expandToViewport={expandToViewport}\n preferCenter={preferCenter}\n onDropdownClose={() => toggleDropdown()}\n trigger={trigger}\n dropdownId={dropdownId}\n >\n {hasHeader && (\n <div className={styles.header} id={headerId}>\n {title && (\n <div className={styles.title}>\n <InternalBox\n fontSize=\"heading-s\"\n fontWeight=\"bold\"\n color=\"inherit\"\n tagOverride=\"h2\"\n margin={{ vertical: 'n', horizontal: 'n' }}\n >\n {title}\n </InternalBox>\n </div>\n )}\n {description && (\n <InternalBox fontSize=\"body-s\">\n <span className={styles.description}>{description}</span>\n </InternalBox>\n )}\n </div>\n )}\n <OptionsList\n open={canBeOpened && isOpen}\n position=\"static\"\n role=\"menu\"\n decreaseBlockMargin={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={hasHeader ? headerId : shouldLabelWithTrigger ? triggerId : undefined}\n statusType=\"finished\"\n >\n <ItemsList\n items={items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n hasExpandableGroups={expandableGroups}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n lastInDropdown={true}\n highlightItem={highlightItem}\n expandToViewport={expandToViewport}\n variant={variant}\n analyticsMetadataTransformer={analyticsMetadataTransformer}\n linkStyle={linkStyle}\n position={position}\n />\n </OptionsList>\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default InternalButtonDropdown;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button-dropdown/internal.t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,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GAClB,CACU,CACL,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton, InternalButtonProps } from '../button/internal';\nimport { useFunnel } from '../internal/analytics/hooks/use-funnel.js';\nimport { getBaseProps } from '../internal/base-component';\nimport Dropdown from '../internal/components/dropdown';\nimport OptionsList from '../internal/components/options-list';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode/index.js';\nimport { isDevelopment } from '../internal/is-development';\nimport { spinWhenOpen } from '../internal/styles/motion/utils';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport {\n GeneratedAnalyticsMetadataButtonDropdownCollapse,\n GeneratedAnalyticsMetadataButtonDropdownExpand,\n} from './analytics-metadata/interfaces.js';\nimport { ButtonDropdownProps, InternalButtonDropdownProps } from './interfaces';\nimport ItemsList from './items-list';\nimport { useButtonDropdown } from './utils/use-button-dropdown';\nimport { isLinkItem } from './utils/utils.js';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst InternalButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n children,\n onItemClick,\n onItemFollow,\n customTriggerBuilder,\n expandToViewport,\n ariaLabel,\n title,\n description,\n preferCenter,\n mainAction,\n showMainActionOnly,\n __internalRootRef,\n analyticsMetadataTransformer,\n linkStyle,\n fullWidth,\n position,\n nativeMainActionAttributes,\n nativeTriggerAttributes,\n ...props\n }: InternalButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const isInRestrictedView = useMobile();\n const dropdownId = useUniqueId('dropdown');\n for (const item of items) {\n if (isLinkItem(item)) {\n checkSafeUrl('ButtonDropdown', item.href);\n }\n }\n if (mainAction) {\n checkSafeUrl('ButtonDropdown', mainAction.href);\n }\n\n if (isDevelopment) {\n if (mainAction && variant !== 'primary' && variant !== 'normal') {\n warnOnce('ButtonDropdown', 'Main action is only supported for \"primary\" and \"normal\" component variant.');\n }\n }\n const hasMainAction = mainAction && (variant === 'primary' || variant === 'normal');\n const isVisualRefresh = useVisualRefresh();\n\n const {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n } = useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n // Scroll is unnecessary when moving focus back to the dropdown trigger.\n onReturnFocus: () => triggerRef.current?.focus({ preventScroll: true }),\n expandToViewport,\n hasExpandableGroups: expandableGroups,\n isInRestrictedView,\n });\n\n const handleMouseEvent = () => {\n setIsUsingMouse(true);\n };\n\n const baseProps = getBaseProps(props);\n\n const mainActionRef = useRef<HTMLElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args) {\n (hasMainAction ? mainActionRef : triggerRef).current?.focus(...args);\n },\n focusDropdownTrigger(...args) {\n triggerRef.current?.focus(...args);\n },\n }),\n [mainActionRef, triggerRef, hasMainAction]\n );\n\n const clickHandler = () => {\n if (!loading && !disabled) {\n // Prevent moving highlight on mobiles to avoid disabled state reason popup if defined.\n toggleDropdown({ moveHighlightOnOpen: !isInRestrictedView });\n }\n };\n\n const canBeOpened = !loading && !disabled;\n\n const canBeFullWidth = !!fullWidth && (variant === 'primary' || variant === 'normal');\n\n const triggerVariant = variant === 'navigation' ? undefined : variant === 'inline-icon' ? 'inline-icon' : variant;\n const iconProps: Partial<ButtonProps & { __iconClass?: string }> =\n variant === 'icon' || variant === 'inline-icon'\n ? {\n iconName: 'ellipsis',\n }\n : {\n iconName: 'caret-down-filled',\n iconAlign: 'right',\n __iconClass: spinWhenOpen(styles, 'rotate', canBeOpened && isOpen),\n };\n\n const baseTriggerProps: InternalButtonProps = {\n className: clsx(\n styles['trigger-button'],\n styles['test-utils-button-trigger'],\n analyticsSelectors['trigger-label']\n ),\n ...iconProps,\n variant: triggerVariant,\n loading,\n loadingText,\n disabled,\n disabledReason,\n onClick: (event: Event) => {\n event.preventDefault();\n clickHandler();\n },\n ariaLabel,\n ariaExpanded: canBeOpened && isOpen,\n formAction: 'none',\n nativeButtonAttributes: {\n 'aria-haspopup': true,\n ...nativeTriggerAttributes,\n },\n };\n\n const triggerId = useUniqueId('awsui-button-dropdown__trigger');\n\n const triggerHasBadge = () => {\n const flatItems = items.flatMap(item => {\n if ('items' in item) {\n return item.items;\n }\n return item;\n });\n\n return (\n variant === 'icon' &&\n !!flatItems?.find(item => {\n if ('badge' in item) {\n return item.badge;\n }\n })\n );\n };\n\n let trigger: React.ReactNode = null;\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonDropdownExpand\n | GeneratedAnalyticsMetadataButtonDropdownCollapse\n | Record<string, never> = disabled\n ? {}\n : {\n action: !isOpen ? 'expand' : 'collapse',\n detail: {\n label: `.${analyticsSelectors['trigger-label']}`,\n },\n };\n\n if (customTriggerBuilder) {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n {customTriggerBuilder({\n testUtilsClass: styles['test-utils-button-trigger'],\n ariaExpanded: canBeOpened && isOpen,\n onClick: clickHandler,\n triggerRef,\n ariaLabel,\n disabled,\n disabledReason,\n isOpen,\n })}\n </div>\n );\n } else if (hasMainAction) {\n const { text, iconName, iconAlt, iconSvg, iconUrl, external, externalIconAriaLabel, ...mainActionProps } =\n mainAction;\n const mainActionIconProps = external\n ? ({ iconName: 'external', iconAlign: 'right', target: '_blank', rel: 'noopener noreferrer' } as const)\n : ({ iconName, iconAlt, iconSvg, iconUrl } as const);\n const mainActionAriaLabel = externalIconAriaLabel\n ? `${mainAction.ariaLabel ?? mainAction.text} ${mainAction.externalIconAriaLabel}`\n : mainAction.ariaLabel;\n const hasNoText = !text;\n const mainActionButton = (\n <InternalButton\n ref={mainActionRef}\n {...mainActionProps}\n {...mainActionIconProps}\n fullWidth={canBeFullWidth}\n className={clsx(\n styles['trigger-button'],\n hasNoText && styles['has-no-text'],\n isVisualRefresh && styles['visual-refresh'],\n canBeFullWidth && styles['main-action-full-width']\n )}\n variant={variant}\n ariaLabel={mainActionAriaLabel}\n formAction=\"none\"\n nativeAnchorAttributes={nativeMainActionAttributes?.anchor}\n nativeButtonAttributes={nativeMainActionAttributes?.button}\n >\n {text}\n </InternalButton>\n );\n trigger = (\n <div role=\"group\" aria-label={ariaLabel} className={styles['split-trigger-wrapper']}>\n <div\n className={clsx(\n styles['trigger-item'],\n styles['split-trigger'],\n styles[`variant-${variant}`],\n mainActionProps.disabled && styles.disabled,\n mainActionProps.loading && styles.loading\n )}\n // Close dropdown upon main action click unless event is cancelled.\n onClick={closeDropdown}\n // Prevent keyboard events from propagation to the button dropdown handler.\n onKeyDown={e => e.stopPropagation()}\n onKeyUp={e => e.stopPropagation()}\n {...getAnalyticsMetadataAttribute({\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['main-action-label']}`,\n },\n })}\n >\n {mainActionButton}\n </div>\n {!showMainActionOnly && (\n <div\n className={clsx(\n styles['trigger-item'],\n styles['dropdown-trigger'],\n isVisualRefresh && styles['visual-refresh'],\n styles[`variant-${variant}`],\n baseTriggerProps.disabled && styles.disabled,\n baseTriggerProps.loading && styles.loading\n )}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n <InternalButton\n ref={triggerRef}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['main-action-trigger-full-width']]: canBeFullWidth,\n })}\n __emitPerformanceMarks={false}\n >\n {children}\n </InternalButton>\n </div>\n )}\n </div>\n );\n } else {\n trigger = (\n <div className={styles['dropdown-trigger']} {...getAnalyticsMetadataAttribute(analyticsMetadata)}>\n <InternalButton\n ref={triggerRef}\n id={triggerId}\n {...baseTriggerProps}\n className={clsx(baseTriggerProps.className, {\n [styles['full-width']]: canBeFullWidth,\n [styles.loading]: canBeFullWidth && !!loading,\n })}\n badge={triggerHasBadge()}\n fullWidth={fullWidth}\n >\n {children}\n </InternalButton>\n </div>\n );\n }\n\n const hasHeader = title || description;\n const headerId = useUniqueId('awsui-button-dropdown__header');\n\n const shouldLabelWithTrigger = !ariaLabel && !mainAction && variant !== 'icon' && variant !== 'inline-icon';\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n return (\n <div\n {...baseProps}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onMouseDown={handleMouseEvent}\n onMouseMove={handleMouseEvent}\n className={clsx(\n styles['button-dropdown'],\n styles[`variant-${variant}`],\n canBeFullWidth && styles['full-width'],\n baseProps.className\n )}\n aria-owns={expandToViewport && isOpen ? dropdownId : undefined}\n ref={__internalRootRef}\n >\n <Dropdown\n open={canBeOpened && isOpen}\n stretchWidth={false}\n stretchTriggerHeight={variant === 'navigation'}\n expandToViewport={expandToViewport}\n preferCenter={preferCenter}\n onDropdownClose={() => toggleDropdown()}\n trigger={trigger}\n dropdownId={dropdownId}\n >\n {hasHeader && (\n <div className={styles.header} id={headerId}>\n {title && (\n <div className={styles.title}>\n <InternalBox\n fontSize=\"heading-s\"\n fontWeight=\"bold\"\n color=\"inherit\"\n tagOverride=\"h2\"\n margin={{ vertical: 'n', horizontal: 'n' }}\n >\n {title}\n </InternalBox>\n </div>\n )}\n {description && (\n <InternalBox fontSize=\"body-s\">\n <span className={styles.description}>{description}</span>\n </InternalBox>\n )}\n </div>\n )}\n <OptionsList\n open={canBeOpened && isOpen}\n position=\"static\"\n role=\"menu\"\n decreaseBlockMargin={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={hasHeader ? headerId : shouldLabelWithTrigger ? triggerId : undefined}\n statusType=\"finished\"\n >\n <ItemsList\n items={items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n hasExpandableGroups={expandableGroups}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n lastInDropdown={true}\n highlightItem={highlightItem}\n expandToViewport={expandToViewport}\n variant={variant}\n analyticsMetadataTransformer={analyticsMetadataTransformer}\n linkStyle={linkStyle}\n position={position}\n />\n </OptionsList>\n </Dropdown>\n </div>\n );\n }\n);\n\nexport default InternalButtonDropdown;\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (bb84fa6e)";
|
|
3
|
+
export var GIT_SHA = "bb84fa6e";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"./internal/base-component/index.js",
|
|
152
152
|
"./internal/base-component/styles.css.js"
|
|
153
153
|
],
|
|
154
|
-
"version": "3.0.
|
|
154
|
+
"version": "3.0.1042",
|
|
155
155
|
"repository": {
|
|
156
156
|
"type": "git",
|
|
157
157
|
"url": "https://github.com/cloudscape-design/components.git"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ConditionalLiveRegionProps {
|
|
3
|
+
condition: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const ConditionalLiveRegion: ({
|
|
7
|
+
condition,
|
|
8
|
+
children
|
|
9
|
+
}: ConditionalLiveRegionProps) => JSX.Element;
|
|
10
|
+
export default ConditionalLiveRegion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-live-region.d.ts","sourceRoot":"","sources":["../../../src/popover/conditional-live-region.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,UAAU,0BAA0B;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,QAAA,MAAM,qBAAqB,4BAA6B,0BAA0B,gBAKjF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 InternalLiveRegion from '../live-region/internal';
|
|
5
|
+
const ConditionalLiveRegion = ({ condition, children }) => {
|
|
6
|
+
if (condition) {
|
|
7
|
+
return React.createElement(InternalLiveRegion, null, children);
|
|
8
|
+
}
|
|
9
|
+
return React.createElement(React.Fragment, null, children);
|
|
10
|
+
};
|
|
11
|
+
export default ConditionalLiveRegion;
|
|
12
|
+
//# sourceMappingURL=conditional-live-region.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-live-region.js","sourceRoot":"","sources":["../../../src/popover/conditional-live-region.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAOzD,MAAM,qBAAqB,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAA8B,EAAE,EAAE;IACpF,IAAI,SAAS,EAAE;QACb,OAAO,oBAAC,kBAAkB,QAAE,QAAQ,CAAsB,CAAC;KAC5D;IACD,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport InternalLiveRegion from '../live-region/internal';\n\ninterface ConditionalLiveRegionProps {\n condition: boolean;\n children: ReactNode;\n}\n\nconst ConditionalLiveRegion = ({ condition, children }: ConditionalLiveRegionProps) => {\n if (condition) {\n return <InternalLiveRegion>{children}</InternalLiveRegion>;\n }\n return <>{children}</>;\n};\n\nexport default ConditionalLiveRegion;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAW7F,OAAO,EAA0B,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAW7F,OAAO,EAA0B,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAOlF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,MAAM,CAAC,EAAE,0BAA0B;IAClH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,YAAY,CAAC,WAAW,GAAG,iBAAiB,CAAC;IAC3D,IAAI,EAAE,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;AAED,wBAAiD"}
|
package/popover/internal.js
CHANGED
|
@@ -15,6 +15,7 @@ import { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes'
|
|
|
15
15
|
import { KeyCode } from '../internal/keycode';
|
|
16
16
|
import Arrow from './arrow';
|
|
17
17
|
import PopoverBody from './body';
|
|
18
|
+
import ConditionalLiveRegion from './conditional-live-region';
|
|
18
19
|
import PopoverContainer from './container';
|
|
19
20
|
import styles from './styles.css.js';
|
|
20
21
|
export default React.forwardRef(InternalPopover);
|
|
@@ -89,10 +90,11 @@ function InternalPopover(_a, ref) {
|
|
|
89
90
|
};
|
|
90
91
|
const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);
|
|
91
92
|
const referrerId = useUniqueId();
|
|
92
|
-
const popoverContent = (React.createElement("div", {
|
|
93
|
+
const popoverContent = (React.createElement("div", { className: clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content']), "data-awsui-referrer-id": referrerId },
|
|
93
94
|
React.createElement(PopoverContainer, { size: size, fixedWidth: fixedWidth, position: position, trackRef: triggerRef, arrow: position => React.createElement(Arrow, { position: position }), renderWithPortal: renderWithPortal, zIndex: renderWithPortal ? 7000 : undefined },
|
|
94
95
|
React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
|
|
95
|
-
React.createElement(PopoverBody, { dismissButton: dismissButton, dismissAriaLabel: dismissAriaLabel, header: header, onDismiss: onDismiss, overflowVisible: "both", closeAnalyticsAction: __closeAnalyticsAction },
|
|
96
|
+
React.createElement(PopoverBody, { dismissButton: dismissButton, dismissAriaLabel: dismissAriaLabel, header: header, onDismiss: onDismiss, overflowVisible: "both", closeAnalyticsAction: __closeAnalyticsAction },
|
|
97
|
+
React.createElement(ConditionalLiveRegion, { condition: !dismissButton }, content))))));
|
|
96
98
|
const mergedRef = useMergeRefs(popoverRef, __internalRootRef);
|
|
97
99
|
return (React.createElement("span", Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className, triggerType === 'filtering-token' && styles['root-filtering-token'], isInline && styles['no-wrap']), ref: mergedRef, onMouseDown: () => {
|
|
98
100
|
// Indicate there was a click inside popover recently, including nested portals.
|
package/popover/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CA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I,MAAM,CAAC,mBAAmB,CAAC,CAAC,EACjG,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAC,QAAQ,mBACC,QAAQ,EACtB,EAAE,EAAE,UAAU,gBACF,gBAAgB,KAE3B,QAAQ,CACF,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACA,OAAO,IAAI,CACV,oBAAC,qBAAqB,QACnB,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACzB,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { Portal, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<PopoverProps.Ref>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (['text', 'text-inline'].includes(triggerType)) {\n triggerRef.current?.focus();\n } else if (triggerRef.current) {\n getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismiss: () => {\n setVisible(false);\n },\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n closeAnalyticsAction={__closeAnalyticsAction}\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {['text', 'text-inline'].includes(triggerType) ? (\n <button\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n {visible && (\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n )}\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,WAAW,MAAM,QAAQ,CAAC;AACjC,OAAO,qBAAqB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAG3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,e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B,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACzB,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { Portal, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { KeyCode } from '../internal/keycode';\nimport Arrow from './arrow';\nimport PopoverBody from './body';\nimport ConditionalLiveRegion from './conditional-live-region';\nimport PopoverContainer from './container';\nimport { PopoverProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalPopoverProps extends Omit<PopoverProps, 'triggerType' | 'size'>, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n triggerType?: PopoverProps.TriggerType | 'filtering-token';\n size: PopoverProps.Size | 'content';\n __closeAnalyticsAction?: string;\n isInline?: boolean;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n wrapTriggerText = true,\n isInline = false,\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n __closeAnalyticsAction,\n\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<PopoverProps.Ref>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (['text', 'text-inline'].includes(triggerType)) {\n triggerRef.current?.focus();\n } else if (triggerRef.current) {\n getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismiss: () => {\n setVisible(false);\n },\n focus: () => {\n setVisible(false);\n focusTrigger();\n },\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n closeAnalyticsAction={__closeAnalyticsAction}\n >\n <ConditionalLiveRegion condition={!dismissButton}>{content}</ConditionalLiveRegion>\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n triggerType === 'filtering-token' && styles['root-filtering-token'],\n isInline && styles['no-wrap']\n )}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {['text', 'text-inline'].includes(triggerType) ? (\n <button\n {...triggerProps}\n className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n {visible && (\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n )}\n </span>\n );\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// es-module interop with Babel and Typescript
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
module.exports.default = {
|
|
5
|
-
"breadcrumbs-own": "awsui_breadcrumbs-own_ete58_yonx9_5",
|
|
6
|
-
"breadcrumbs-discovered": "awsui_breadcrumbs-discovered_ete58_yonx9_5"
|
|
7
|
-
};
|
|
8
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button-dropdown/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,sBAAsB,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AAIpE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EAgBsB,EACtB,GAAuC,EACvC,EAAE;QAlBF,EACE,KAAK,EACL,OAAO,GAAG,QAAQ,EAClB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,EACxB,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,OAEW,EADjB,KAAK,cAfV,uMAgBC,CADS;IAIV,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,gBAAgB,EAAE;QAC5D,KAAK,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE;QACtD,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,aAAa,EAAE,gBAAgB,CAAC,KAAK,CAAC;YACtC,iBAAiB,EAAE,OAAO,CAAC,cAAc,CAAC;YAC1C,kBAAkB,EAAE,sBAAsB,CAAC,KAAK,CAAC;SAClD;KACF,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAEtC,MAAM,0BAA0B,GAAsD;QACpF,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,IAAI,kBAAkB,CAAC,eAAe,CAAC,EAAE;QAChD,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,EAAE;KACjD,CAAC;IAEF,OAAO,CACL,oBAAC,sBAAsB,oBACjB,SAAS,EACT,kBAAkB,IACtB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,IAChB,6BAA6B,CAAC;QAChC,SAAS,EAAE,0BAA0B;KACtC,CAAC,GAED,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { GeneratedAnalyticsMetadataButtonDropdownComponent } from './analytics-metadata/interfaces';\nimport { ButtonDropdownProps } from './interfaces';\nimport InternalButtonDropdown from './internal';\nimport { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\n\nexport { ButtonDropdownProps };\n\nconst ButtonDropdown = React.forwardRef(\n (\n {\n items,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n expandableGroups = false,\n expandToViewport = false,\n ariaLabel,\n children,\n onItemClick,\n onItemFollow,\n mainAction,\n fullWidth,\n ...props\n }: ButtonDropdownProps,\n ref: React.Ref<ButtonDropdownProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ButtonDropdown', {\n props: { expandToViewport, expandableGroups, variant },\n metadata: {\n mainAction: !!mainAction,\n checkboxItems: hasCheckboxItems(items),\n hasDisabledReason: Boolean(disabledReason),\n hasDisabledReasons: hasDisabledReasonItems(items),\n },\n });\n const baseProps = getBaseProps(props);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataButtonDropdownComponent = {\n name: 'awsui.ButtonDropdown',\n label: `.${analyticsSelectors['trigger-label']}`,\n properties: { variant, disabled: `${disabled}` },\n };\n\n return (\n <InternalButtonDropdown\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n items={items}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n expandableGroups={expandableGroups}\n expandToViewport={expandToViewport}\n ariaLabel={ariaLabel}\n onItemClick={onItemClick}\n onItemFollow={onItemFollow}\n mainAction={mainAction}\n fullWidth={fullWidth}\n {...getAnalyticsMetadataAttribute({\n component: analyticsComponentMetadata,\n })}\n >\n {children}\n </InternalButtonDropdown>\n );\n }\n);\n\napplyDisplayName(ButtonDropdown, 'ButtonDropdown');\nexport default ButtonDropdown;\n"]}
|