@cloudscape-design/components 3.0.899 → 3.0.901
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/container/internal.d.ts.map +1 -1
- package/container/internal.js +3 -3
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +33 -32
- package/container/styles.scoped.css +59 -55
- package/container/styles.selectors.js +33 -32
- package/container/use-sticky-header.d.ts +2 -0
- package/container/use-sticky-header.d.ts.map +1 -1
- package/container/use-sticky-header.js +11 -0
- package/container/use-sticky-header.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/prompt-input/interfaces.d.ts +8 -0
- package/prompt-input/interfaces.d.ts.map +1 -1
- package/prompt-input/interfaces.js.map +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js +4 -0
- package/prompt-input/internal.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAI1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAO9C,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACzG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,S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CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IAEzE,oBAAoB,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,CAAC;IACjF,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC;CAClE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,sBAAsB,eAWvE;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAmB,EACnB,qBAA6B,EAC7B,sBAA8B,EAC9B,SAAS,EACT,KAAK,EACL,cAAc,EACd,oBAAoB,EACpB,cAAsB,EACtB,iBAAwB,EACxB,sBAA8B,EAC9B,uBAA+B,EAC/B,eAAuB,EACvB,WAAW,EACX,UAAkB,EAClB,qBAA4B,EAC5B,oBAAoB,EACpB,YAAY,EACZ,GAAG,SAAS,EACb,EAAE,sBAAsB,eAgHxB"}
|
package/container/internal.js
CHANGED
|
@@ -29,7 +29,7 @@ export default function InternalContainer(_a) {
|
|
|
29
29
|
const baseProps = getBaseProps(restProps);
|
|
30
30
|
const rootRef = useRef(null);
|
|
31
31
|
const headerRef = useRef(null);
|
|
32
|
-
const { isSticky, isStuck, stickyStyles } = useStickyHeader(rootRef, headerRef, __stickyHeader, __stickyOffset, __mobileStickyOffset, __disableStickyMobile, __fullPage && isRefresh && !isMobile);
|
|
32
|
+
const { isSticky, isStuck, isStuckAtBottom, stickyStyles } = useStickyHeader(rootRef, headerRef, __stickyHeader, __stickyOffset, __mobileStickyOffset, __disableStickyMobile, __fullPage && isRefresh && !isMobile);
|
|
33
33
|
const contentId = useUniqueId();
|
|
34
34
|
const hasDynamicHeight = isRefresh && variant === 'full-page';
|
|
35
35
|
const mergedRef = useMergeRefs(rootRef, __internalRootRef);
|
|
@@ -39,11 +39,11 @@ export default function InternalContainer(_a) {
|
|
|
39
39
|
const shouldHaveStickyStyles = isSticky && !isMobile;
|
|
40
40
|
const hasMedia = !!(media === null || media === void 0 ? void 0 : media.content);
|
|
41
41
|
const mediaPosition = (_b = media === null || media === void 0 ? void 0 : media.position) !== null && _b !== void 0 ? _b : 'top';
|
|
42
|
-
return (React.createElement("div", Object.assign({}, baseProps, __funnelSubStepProps, { className: clsx(baseProps.className, styles.root, styles[`variant-${variant}`], fitHeight && styles['fit-height'], hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']), shouldHaveStickyStyles && [styles['sticky-enabled']], isRefresh && styles.refresh), ref: mergedRef }, getAnalyticsLabelAttribute(`.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`)),
|
|
42
|
+
return (React.createElement("div", Object.assign({}, baseProps, __funnelSubStepProps, { className: clsx(baseProps.className, styles.root, styles[`variant-${variant}`], fitHeight && styles['fit-height'], hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']), shouldHaveStickyStyles && [styles['sticky-enabled']], shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']], isRefresh && styles.refresh), ref: mergedRef }, getAnalyticsLabelAttribute(`.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`)),
|
|
43
43
|
hasMedia && (React.createElement("div", { className: clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media), style: mediaPosition === 'top' ? { height: (media === null || media === void 0 ? void 0 : media.height) || '' } : { width: (media === null || media === void 0 ? void 0 : media.width) || '' } }, media.content)),
|
|
44
44
|
React.createElement("div", { id: contentId, ref: __subStepRef, className: clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height']) },
|
|
45
45
|
header && (React.createElement(ContainerHeaderContextProvider, null,
|
|
46
|
-
React.createElement(StickyHeaderContext.Provider, { value: { isStuck } },
|
|
46
|
+
React.createElement(StickyHeaderContext.Provider, { value: { isStuck, isStuckAtBottom } },
|
|
47
47
|
React.createElement("div", Object.assign({ className: clsx(isRefresh && styles.refresh, styles.header, analyticsSelectors.header, styles[`header-variant-${variant}`], {
|
|
48
48
|
[styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
|
|
49
49
|
[styles['header-sticky-enabled']]: isSticky,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/container/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,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAA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G,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsLabelAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { ContainerHeaderContextProvider } from '../internal/context/container-header';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { ContainerProps } from './interfaces';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __fullPage?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n\n __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n}\n\nexport function InternalContainerAsSubstep(props: InternalContainerProps) {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n media,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __fullPage = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile,\n __fullPage && isRefresh && !isMobile\n );\n const contentId = useUniqueId();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, __headerRef);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n const hasMedia = !!media?.content;\n const mediaPosition = media?.position ?? 'top';\n return (\n <div\n {...baseProps}\n {...__funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']),\n shouldHaveStickyStyles && [styles['sticky-enabled']],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n {...getAnalyticsLabelAttribute(\n `.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`\n )}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={mediaPosition === 'top' ? { height: media?.height || '' } : { width: media?.width || '' }}\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {header && (\n <ContainerHeaderContextProvider>\n <StickyHeaderContext.Provider value={{ isStuck }}>\n <div\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n analyticsSelectors.header,\n styles[`header-variant-${variant}`],\n {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n [styles['header-with-media']]: hasMedia,\n [styles['header-full-page']]: __fullPage && isRefresh,\n }\n )}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {isStuck && !isMobile && isRefresh && __fullPage && <div className={styles['header-cover']}></div>}\n {header}\n </div>\n </StickyHeaderContext.Provider>\n </ContainerHeaderContextProvider>\n )}\n <div className={clsx(styles.content, fitHeight && styles['content-fit-height'])}>\n <div\n className={clsx(styles['content-inner'], testStyles['content-inner'], {\n [styles['with-paddings']]: !disableContentPaddings,\n [styles['with-header']]: !!header,\n })}\n >\n {children}\n </div>\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,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C,cAAc,CAAC,GAAQ;wBACjG,MAAM,CACH,CACuB,CACA,CAClC;YACD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,IAAI,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBAC7E,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,EAAE;wBACpE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,sBAAsB;wBAClD,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM;qBAClC,CAAC,IAED,QAAQ,CACL,CACF;YACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;oBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,uBAAuB;iBACpD,CAAC,IAED,MAAM,CACH,CACP,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsLabelAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { ContainerHeaderContextProvider } from '../internal/context/container-header';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { ContainerProps } from './interfaces';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __fullPage?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n\n __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n}\n\nexport function InternalContainerAsSubstep(props: InternalContainerProps) {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n media,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __fullPage = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, isStuckAtBottom, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile,\n __fullPage && isRefresh && !isMobile\n );\n const contentId = useUniqueId();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, __headerRef);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n const hasMedia = !!media?.content;\n const mediaPosition = media?.position ?? 'top';\n return (\n <div\n {...baseProps}\n {...__funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']),\n shouldHaveStickyStyles && [styles['sticky-enabled']],\n shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n {...getAnalyticsLabelAttribute(\n `.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`\n )}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={mediaPosition === 'top' ? { height: media?.height || '' } : { width: media?.width || '' }}\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {header && (\n <ContainerHeaderContextProvider>\n <StickyHeaderContext.Provider value={{ isStuck, isStuckAtBottom }}>\n <div\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n analyticsSelectors.header,\n styles[`header-variant-${variant}`],\n {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n [styles['header-with-media']]: hasMedia,\n [styles['header-full-page']]: __fullPage && isRefresh,\n }\n )}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {isStuck && !isMobile && isRefresh && __fullPage && <div className={styles['header-cover']}></div>}\n {header}\n </div>\n </StickyHeaderContext.Provider>\n </ContainerHeaderContextProvider>\n )}\n <div className={clsx(styles.content, fitHeight && styles['content-fit-height'])}>\n <div\n className={clsx(styles['content-inner'], testStyles['content-inner'], {\n [styles['with-paddings']]: !disableContentPaddings,\n [styles['with-header']]: !!header,\n })}\n >\n {children}\n </div>\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
package/container/styles.css.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"fit-height": "awsui_fit-
|
|
6
|
-
"with-side-media": "awsui_with-side-
|
|
7
|
-
"variant-default": "awsui_variant-
|
|
8
|
-
"variant-stacked": "awsui_variant-
|
|
9
|
-
"refresh": "
|
|
10
|
-
"sticky-enabled": "awsui_sticky-
|
|
11
|
-
"with-
|
|
12
|
-
"
|
|
13
|
-
"content-wrapper
|
|
14
|
-
"
|
|
15
|
-
"media
|
|
16
|
-
"media-
|
|
17
|
-
"
|
|
18
|
-
"header
|
|
19
|
-
"header-
|
|
20
|
-
"header-
|
|
21
|
-
"header-
|
|
22
|
-
"header-
|
|
23
|
-
"header-
|
|
24
|
-
"header-
|
|
25
|
-
"header-
|
|
26
|
-
"
|
|
27
|
-
"with-
|
|
28
|
-
"
|
|
29
|
-
"header-
|
|
30
|
-
"
|
|
31
|
-
"content
|
|
32
|
-
"content-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
4
|
+
"root": "awsui_root_14iqq_emv61_189",
|
|
5
|
+
"fit-height": "awsui_fit-height_14iqq_emv61_222",
|
|
6
|
+
"with-side-media": "awsui_with-side-media_14iqq_emv61_227",
|
|
7
|
+
"variant-default": "awsui_variant-default_14iqq_emv61_230",
|
|
8
|
+
"variant-stacked": "awsui_variant-stacked_14iqq_emv61_230",
|
|
9
|
+
"refresh": "awsui_refresh_14iqq_emv61_238",
|
|
10
|
+
"sticky-enabled": "awsui_sticky-enabled_14iqq_emv61_288",
|
|
11
|
+
"with-stuck-sticky-header-at-bottom": "awsui_with-stuck-sticky-header-at-bottom_14iqq_emv61_294",
|
|
12
|
+
"with-top-media": "awsui_with-top-media_14iqq_emv61_304",
|
|
13
|
+
"content-wrapper": "awsui_content-wrapper_14iqq_emv61_309",
|
|
14
|
+
"content-wrapper-fit-height": "awsui_content-wrapper-fit-height_14iqq_emv61_314",
|
|
15
|
+
"media": "awsui_media_14iqq_emv61_321",
|
|
16
|
+
"media-top": "awsui_media-top_14iqq_emv61_339",
|
|
17
|
+
"media-side": "awsui_media-side_14iqq_emv61_344",
|
|
18
|
+
"header": "awsui_header_14iqq_emv61_350",
|
|
19
|
+
"header-full-page": "awsui_header-full-page_14iqq_emv61_355",
|
|
20
|
+
"header-variant-embedded": "awsui_header-variant-embedded_14iqq_emv61_358",
|
|
21
|
+
"header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_emv61_358",
|
|
22
|
+
"header-with-media": "awsui_header-with-media_14iqq_emv61_361",
|
|
23
|
+
"header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_emv61_367",
|
|
24
|
+
"header-stuck": "awsui_header-stuck_14iqq_emv61_377",
|
|
25
|
+
"header-variant-cards": "awsui_header-variant-cards_14iqq_emv61_387",
|
|
26
|
+
"header-dynamic-height": "awsui_header-dynamic-height_14iqq_emv61_390",
|
|
27
|
+
"with-paddings": "awsui_with-paddings_14iqq_emv61_396",
|
|
28
|
+
"with-hidden-content": "awsui_with-hidden-content_14iqq_emv61_405",
|
|
29
|
+
"header-variant-full-page": "awsui_header-variant-full-page_14iqq_emv61_463",
|
|
30
|
+
"header-cover": "awsui_header-cover_14iqq_emv61_466",
|
|
31
|
+
"content": "awsui_content_14iqq_emv61_309",
|
|
32
|
+
"content-fit-height": "awsui_content-fit-height_14iqq_emv61_494",
|
|
33
|
+
"content-inner": "awsui_content-inner_14iqq_emv61_500",
|
|
34
|
+
"with-header": "awsui_with-header_14iqq_emv61_507",
|
|
35
|
+
"footer": "awsui_footer_14iqq_emv61_511",
|
|
36
|
+
"with-divider": "awsui_with-divider_14iqq_emv61_515"
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -186,7 +186,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
187
187
|
SPDX-License-Identifier: Apache-2.0
|
|
188
188
|
*/
|
|
189
|
-
.
|
|
189
|
+
.awsui_root_14iqq_emv61_189:not(#\9) {
|
|
190
190
|
border-collapse: separate;
|
|
191
191
|
border-spacing: 0;
|
|
192
192
|
box-sizing: border-box;
|
|
@@ -220,15 +220,15 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
220
220
|
word-wrap: break-word;
|
|
221
221
|
position: relative;
|
|
222
222
|
}
|
|
223
|
-
.
|
|
223
|
+
.awsui_root_14iqq_emv61_189.awsui_fit-height_14iqq_emv61_222:not(#\9) {
|
|
224
224
|
display: flex;
|
|
225
225
|
flex-direction: column;
|
|
226
226
|
block-size: 100%;
|
|
227
227
|
}
|
|
228
|
-
.
|
|
228
|
+
.awsui_root_14iqq_emv61_189.awsui_fit-height_14iqq_emv61_222.awsui_with-side-media_14iqq_emv61_227:not(#\9) {
|
|
229
229
|
flex-direction: row;
|
|
230
230
|
}
|
|
231
|
-
.
|
|
231
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-default_14iqq_emv61_230:not(#\9), .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9) {
|
|
232
232
|
background-color: var(--color-background-container-content-z79u4u, #ffffff);
|
|
233
233
|
border-start-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
234
234
|
border-start-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
@@ -236,11 +236,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
236
236
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
237
237
|
box-sizing: border-box;
|
|
238
238
|
}
|
|
239
|
-
.
|
|
239
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-default_14iqq_emv61_230.awsui_refresh_14iqq_emv61_238:not(#\9), .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230.awsui_refresh_14iqq_emv61_238:not(#\9) {
|
|
240
240
|
border-block: solid var(--border-divider-section-width-1061zr, 1px) var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
241
241
|
border-inline: solid var(--border-divider-section-width-1061zr, 1px) var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
242
242
|
}
|
|
243
|
-
.
|
|
243
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-default_14iqq_emv61_230:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::before, .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::before {
|
|
244
244
|
content: "";
|
|
245
245
|
position: absolute;
|
|
246
246
|
inset-inline-start: 0px;
|
|
@@ -258,7 +258,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
258
258
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
259
259
|
z-index: 1;
|
|
260
260
|
}
|
|
261
|
-
.
|
|
261
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-default_14iqq_emv61_230:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::after, .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::after {
|
|
262
262
|
content: "";
|
|
263
263
|
position: absolute;
|
|
264
264
|
inset-inline-start: 0px;
|
|
@@ -274,147 +274,151 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
274
274
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
275
275
|
box-shadow: var(--shadow-container-fxmdn3, 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12));
|
|
276
276
|
}
|
|
277
|
-
.
|
|
277
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(:last-child), .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(:last-child)::before, .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(:last-child)::after {
|
|
278
278
|
border-end-end-radius: 0;
|
|
279
279
|
border-end-start-radius: 0;
|
|
280
280
|
border-block-end-width: 0;
|
|
281
281
|
}
|
|
282
|
-
.
|
|
282
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230 + .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9), .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230 + .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9)::before, .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230 + .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9)::after {
|
|
283
283
|
border-start-start-radius: 0;
|
|
284
284
|
border-start-end-radius: 0;
|
|
285
285
|
}
|
|
286
|
-
.
|
|
286
|
+
.awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230 + .awsui_root_14iqq_emv61_189.awsui_variant-stacked_14iqq_emv61_230:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::before {
|
|
287
287
|
border-block-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
288
288
|
}
|
|
289
|
-
.
|
|
289
|
+
.awsui_root_14iqq_emv61_189.awsui_sticky-enabled_14iqq_emv61_288:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::before {
|
|
290
290
|
inset-block-start: calc(-1 * var(--border-container-top-width-uugwwl, 0px));
|
|
291
291
|
}
|
|
292
|
-
.
|
|
292
|
+
.awsui_root_14iqq_emv61_189.awsui_sticky-enabled_14iqq_emv61_288:not(#\9):not(.awsui_refresh_14iqq_emv61_238).awsui_variant-stacked_14iqq_emv61_230::before {
|
|
293
293
|
inset-block-start: calc(-1 * var(--border-divider-section-width-1061zr, 1px));
|
|
294
294
|
}
|
|
295
|
+
.awsui_root_14iqq_emv61_189.awsui_with-stuck-sticky-header-at-bottom_14iqq_emv61_294:not(#\9) {
|
|
296
|
+
border-end-end-radius: 0;
|
|
297
|
+
border-end-start-radius: 0;
|
|
298
|
+
}
|
|
295
299
|
|
|
296
|
-
.awsui_with-side-
|
|
300
|
+
.awsui_with-side-media_14iqq_emv61_227:not(#\9) {
|
|
297
301
|
display: flex;
|
|
298
302
|
flex-direction: row;
|
|
299
303
|
}
|
|
300
304
|
|
|
301
|
-
.awsui_with-top-
|
|
305
|
+
.awsui_with-top-media_14iqq_emv61_304:not(#\9) {
|
|
302
306
|
display: flex;
|
|
303
307
|
flex-direction: column;
|
|
304
308
|
}
|
|
305
309
|
|
|
306
|
-
.awsui_content-
|
|
310
|
+
.awsui_content-wrapper_14iqq_emv61_309:not(#\9) {
|
|
307
311
|
display: flex;
|
|
308
312
|
flex-direction: column;
|
|
309
313
|
inline-size: 100%;
|
|
310
314
|
}
|
|
311
|
-
.awsui_content-wrapper-fit-
|
|
315
|
+
.awsui_content-wrapper-fit-height_14iqq_emv61_314:not(#\9) {
|
|
312
316
|
block-size: 100%;
|
|
313
317
|
overflow: hidden;
|
|
314
318
|
border-end-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
315
319
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
316
320
|
}
|
|
317
321
|
|
|
318
|
-
.
|
|
322
|
+
.awsui_media_14iqq_emv61_321:not(#\9) {
|
|
319
323
|
overflow: hidden;
|
|
320
324
|
flex-shrink: 0;
|
|
321
325
|
}
|
|
322
|
-
.
|
|
323
|
-
.
|
|
324
|
-
.
|
|
326
|
+
.awsui_media_14iqq_emv61_321 img:not(#\9),
|
|
327
|
+
.awsui_media_14iqq_emv61_321 video:not(#\9),
|
|
328
|
+
.awsui_media_14iqq_emv61_321 picture:not(#\9) {
|
|
325
329
|
inline-size: 100%;
|
|
326
330
|
block-size: 100%;
|
|
327
331
|
object-fit: cover;
|
|
328
332
|
object-position: center;
|
|
329
333
|
}
|
|
330
|
-
.
|
|
334
|
+
.awsui_media_14iqq_emv61_321 iframe:not(#\9) {
|
|
331
335
|
inline-size: 100%;
|
|
332
336
|
block-size: 100%;
|
|
333
337
|
border-block: 0;
|
|
334
338
|
border-inline: 0;
|
|
335
339
|
}
|
|
336
|
-
.awsui_media-
|
|
340
|
+
.awsui_media-top_14iqq_emv61_339:not(#\9) {
|
|
337
341
|
max-block-size: 66%;
|
|
338
342
|
border-start-start-radius: calc(var(--border-radius-container-wqv1zi, 16px) - 1px);
|
|
339
343
|
border-start-end-radius: calc(var(--border-radius-container-wqv1zi, 16px) - 1px);
|
|
340
344
|
}
|
|
341
|
-
.awsui_media-
|
|
345
|
+
.awsui_media-side_14iqq_emv61_344:not(#\9) {
|
|
342
346
|
max-inline-size: 66%;
|
|
343
347
|
border-start-start-radius: calc(var(--border-radius-container-wqv1zi, 16px) - 1px);
|
|
344
348
|
border-end-start-radius: calc(var(--border-radius-container-wqv1zi, 16px) - 1px);
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
.
|
|
351
|
+
.awsui_header_14iqq_emv61_350:not(#\9) {
|
|
348
352
|
background-color: var(--color-background-container-header-clzg6q, #ffffff);
|
|
349
353
|
border-start-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
350
354
|
border-start-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
351
355
|
}
|
|
352
|
-
.
|
|
356
|
+
.awsui_header_14iqq_emv61_350.awsui_header-full-page_14iqq_emv61_355:not(#\9) {
|
|
353
357
|
background-color: var(--color-background-layout-main-nqw91u, #ffffff);
|
|
354
358
|
}
|
|
355
|
-
.awsui_header-variant-
|
|
359
|
+
.awsui_header-variant-embedded_14iqq_emv61_358.awsui_refresh_14iqq_emv61_238:not(#\9):not(.awsui_header-sticky-enabled_14iqq_emv61_358) {
|
|
356
360
|
background-color: transparent;
|
|
357
361
|
}
|
|
358
|
-
.
|
|
362
|
+
.awsui_header_14iqq_emv61_350.awsui_header-with-media_14iqq_emv61_361:not(#\9) {
|
|
359
363
|
background: none;
|
|
360
364
|
}
|
|
361
|
-
.
|
|
365
|
+
.awsui_header_14iqq_emv61_350.awsui_header-with-media_14iqq_emv61_361:not(#\9):not(:empty) {
|
|
362
366
|
border-block-end: none;
|
|
363
367
|
}
|
|
364
|
-
.awsui_header-sticky-
|
|
368
|
+
.awsui_header-sticky-disabled_14iqq_emv61_367:not(#\9) {
|
|
365
369
|
position: relative;
|
|
366
370
|
z-index: 1;
|
|
367
371
|
}
|
|
368
|
-
.awsui_header-sticky-
|
|
372
|
+
.awsui_header-sticky-enabled_14iqq_emv61_358:not(#\9) {
|
|
369
373
|
inset-block-start: 0;
|
|
370
374
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
371
375
|
position: sticky;
|
|
372
376
|
z-index: 800;
|
|
373
377
|
}
|
|
374
|
-
.awsui_header-
|
|
378
|
+
.awsui_header-stuck_14iqq_emv61_377:not(#\9) {
|
|
375
379
|
border-start-start-radius: 0;
|
|
376
380
|
border-start-end-radius: 0;
|
|
377
381
|
border-end-start-radius: 0;
|
|
378
382
|
border-end-end-radius: 0;
|
|
379
383
|
}
|
|
380
|
-
.awsui_header-
|
|
384
|
+
.awsui_header-stuck_14iqq_emv61_377:not(#\9)::before {
|
|
381
385
|
border-block: 0;
|
|
382
386
|
border-inline: 0;
|
|
383
387
|
}
|
|
384
|
-
.awsui_header-
|
|
388
|
+
.awsui_header-stuck_14iqq_emv61_377:not(#\9):not(.awsui_header-variant-cards_14iqq_emv61_387) {
|
|
385
389
|
box-shadow: var(--shadow-sticky-embedded-uvh5ry, 0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.1));
|
|
386
390
|
}
|
|
387
|
-
.awsui_header-dynamic-
|
|
391
|
+
.awsui_header-dynamic-height_14iqq_emv61_390.awsui_header-stuck_14iqq_emv61_377:not(#\9) {
|
|
388
392
|
margin-block-end: calc(var(--line-height-heading-xl-avbttk, 30px) - var(--line-height-heading-l-mmm3my, 24px));
|
|
389
393
|
}
|
|
390
|
-
.
|
|
394
|
+
.awsui_header_14iqq_emv61_350:not(#\9):not(:empty) {
|
|
391
395
|
border-block-end: var(--border-container-sticky-width-6asz33, 0px) solid var(--color-border-container-divider-p2uygo, transparent);
|
|
392
396
|
}
|
|
393
|
-
.
|
|
397
|
+
.awsui_header_14iqq_emv61_350.awsui_with-paddings_14iqq_emv61_396:not(#\9) {
|
|
394
398
|
padding-block-start: var(--space-container-header-top-5qav00, 12px);
|
|
395
399
|
padding-block-end: var(--space-container-header-bottom-vj01hn, 8px);
|
|
396
400
|
padding-inline: var(--space-container-horizontal-wfukh3, 20px);
|
|
397
401
|
}
|
|
398
|
-
.
|
|
402
|
+
.awsui_header_14iqq_emv61_350.awsui_with-paddings_14iqq_emv61_396.awsui_header-variant-cards_14iqq_emv61_387:not(#\9) {
|
|
399
403
|
padding-block: var(--space-container-header-top-5qav00, 12px);
|
|
400
404
|
padding-inline: var(--space-container-horizontal-wfukh3, 20px);
|
|
401
405
|
}
|
|
402
|
-
.
|
|
406
|
+
.awsui_header_14iqq_emv61_350.awsui_with-hidden-content_14iqq_emv61_405:not(#\9) {
|
|
403
407
|
border-end-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
404
408
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
405
409
|
}
|
|
406
|
-
.awsui_header-variant-
|
|
410
|
+
.awsui_header-variant-cards_14iqq_emv61_387:not(#\9) {
|
|
407
411
|
border-start-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
408
412
|
border-start-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
409
413
|
border-end-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
410
414
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
411
415
|
box-sizing: border-box;
|
|
412
416
|
}
|
|
413
|
-
.awsui_header-variant-
|
|
417
|
+
.awsui_header-variant-cards_14iqq_emv61_387.awsui_refresh_14iqq_emv61_238:not(#\9) {
|
|
414
418
|
border-block: solid var(--border-divider-section-width-1061zr, 1px) var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
415
419
|
border-inline: solid var(--border-divider-section-width-1061zr, 1px) var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
416
420
|
}
|
|
417
|
-
.awsui_header-variant-
|
|
421
|
+
.awsui_header-variant-cards_14iqq_emv61_387:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::before {
|
|
418
422
|
content: "";
|
|
419
423
|
position: absolute;
|
|
420
424
|
inset-inline-start: 0px;
|
|
@@ -432,7 +436,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
432
436
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
433
437
|
z-index: 1;
|
|
434
438
|
}
|
|
435
|
-
.awsui_header-variant-
|
|
439
|
+
.awsui_header-variant-cards_14iqq_emv61_387:not(#\9):not(.awsui_refresh_14iqq_emv61_238)::after {
|
|
436
440
|
content: "";
|
|
437
441
|
position: absolute;
|
|
438
442
|
inset-inline-start: 0px;
|
|
@@ -448,26 +452,26 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
448
452
|
border-end-end-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
449
453
|
box-shadow: var(--shadow-container-fxmdn3, 0px 0px 1px 1px #e9ebed, 0px 1px 8px 2px rgba(0, 7, 22, 0.12));
|
|
450
454
|
}
|
|
451
|
-
.awsui_header-variant-
|
|
455
|
+
.awsui_header-variant-cards_14iqq_emv61_387:not(#\9):not(.awsui_header-sticky-enabled_14iqq_emv61_358) {
|
|
452
456
|
position: relative;
|
|
453
457
|
}
|
|
454
|
-
.awsui_header-variant-
|
|
458
|
+
.awsui_header-variant-cards_14iqq_emv61_387.awsui_header-stuck_14iqq_emv61_377:not(#\9)::after, .awsui_header-variant-cards_14iqq_emv61_387.awsui_header-stuck_14iqq_emv61_377:not(#\9)::before {
|
|
455
459
|
border-block: 0;
|
|
456
460
|
border-inline: 0;
|
|
457
461
|
border-start-start-radius: 0;
|
|
458
462
|
border-start-end-radius: 0;
|
|
459
463
|
}
|
|
460
|
-
.awsui_header-variant-full-
|
|
464
|
+
.awsui_header-variant-full-page_14iqq_emv61_463.awsui_header-stuck_14iqq_emv61_377:not(#\9) {
|
|
461
465
|
box-shadow: none;
|
|
462
466
|
}
|
|
463
|
-
.awsui_header-variant-full-
|
|
467
|
+
.awsui_header-variant-full-page_14iqq_emv61_463.awsui_header-stuck_14iqq_emv61_377 > .awsui_header-cover_14iqq_emv61_466:not(#\9) {
|
|
464
468
|
background-color: var(--color-background-layout-main-nqw91u, #ffffff);
|
|
465
469
|
inline-size: 100%;
|
|
466
470
|
position: absolute;
|
|
467
471
|
block-size: var(--space-scaled-s-aqzyko, 12px);
|
|
468
472
|
inset-block-start: calc(-1 * var(--space-scaled-s-aqzyko, 12px));
|
|
469
473
|
}
|
|
470
|
-
.awsui_header-variant-full-
|
|
474
|
+
.awsui_header-variant-full-page_14iqq_emv61_463.awsui_header-stuck_14iqq_emv61_377:not(#\9)::before {
|
|
471
475
|
content: "";
|
|
472
476
|
position: absolute;
|
|
473
477
|
pointer-events: none;
|
|
@@ -477,7 +481,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
477
481
|
inset-block-start: 0;
|
|
478
482
|
border-block-end: solid var(--border-divider-section-width-1061zr, 1px) var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
479
483
|
}
|
|
480
|
-
.awsui_header-variant-full-
|
|
484
|
+
.awsui_header-variant-full-page_14iqq_emv61_463.awsui_header-stuck_14iqq_emv61_377:not(#\9)::after {
|
|
481
485
|
content: "";
|
|
482
486
|
position: absolute;
|
|
483
487
|
inset: 0;
|
|
@@ -485,30 +489,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
485
489
|
clip-path: polygon(-999% 100%, 999% 100%, 999% 999%, -999% 999%);
|
|
486
490
|
}
|
|
487
491
|
|
|
488
|
-
.
|
|
492
|
+
.awsui_content_14iqq_emv61_309:not(#\9) {
|
|
489
493
|
flex: 1;
|
|
490
494
|
}
|
|
491
|
-
.awsui_content-fit-
|
|
495
|
+
.awsui_content-fit-height_14iqq_emv61_494:not(#\9) {
|
|
492
496
|
overflow: auto;
|
|
493
497
|
display: flex;
|
|
494
498
|
flex-direction: column;
|
|
495
499
|
}
|
|
496
500
|
|
|
497
|
-
.awsui_content-
|
|
501
|
+
.awsui_content-inner_14iqq_emv61_500:not(#\9) {
|
|
498
502
|
flex: 1;
|
|
499
503
|
}
|
|
500
|
-
.awsui_content-
|
|
504
|
+
.awsui_content-inner_14iqq_emv61_500.awsui_with-paddings_14iqq_emv61_396:not(#\9) {
|
|
501
505
|
padding-block: var(--space-scaled-l-0hpmd7, 20px);
|
|
502
506
|
padding-inline: var(--space-container-horizontal-wfukh3, 20px);
|
|
503
507
|
}
|
|
504
|
-
.awsui_content-
|
|
508
|
+
.awsui_content-inner_14iqq_emv61_500.awsui_with-paddings_14iqq_emv61_396.awsui_with-header_14iqq_emv61_507:not(#\9) {
|
|
505
509
|
padding-block-start: var(--space-container-content-top-1ae0r3, 4px);
|
|
506
510
|
}
|
|
507
511
|
|
|
508
|
-
.
|
|
512
|
+
.awsui_footer_14iqq_emv61_511.awsui_with-paddings_14iqq_emv61_396:not(#\9) {
|
|
509
513
|
padding-block: var(--space-scaled-s-aqzyko, 12px);
|
|
510
514
|
padding-inline: var(--space-container-horizontal-wfukh3, 20px);
|
|
511
515
|
}
|
|
512
|
-
.
|
|
516
|
+
.awsui_footer_14iqq_emv61_511.awsui_with-divider_14iqq_emv61_515:not(#\9) {
|
|
513
517
|
border-block-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-cx07f2, #c6c6cd);
|
|
514
518
|
}
|
|
@@ -2,37 +2,38 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"fit-height": "awsui_fit-
|
|
7
|
-
"with-side-media": "awsui_with-side-
|
|
8
|
-
"variant-default": "awsui_variant-
|
|
9
|
-
"variant-stacked": "awsui_variant-
|
|
10
|
-
"refresh": "
|
|
11
|
-
"sticky-enabled": "awsui_sticky-
|
|
12
|
-
"with-
|
|
13
|
-
"
|
|
14
|
-
"content-wrapper
|
|
15
|
-
"
|
|
16
|
-
"media
|
|
17
|
-
"media-
|
|
18
|
-
"
|
|
19
|
-
"header
|
|
20
|
-
"header-
|
|
21
|
-
"header-
|
|
22
|
-
"header-
|
|
23
|
-
"header-
|
|
24
|
-
"header-
|
|
25
|
-
"header-
|
|
26
|
-
"header-
|
|
27
|
-
"
|
|
28
|
-
"with-
|
|
29
|
-
"
|
|
30
|
-
"header-
|
|
31
|
-
"
|
|
32
|
-
"content
|
|
33
|
-
"content-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
5
|
+
"root": "awsui_root_14iqq_emv61_189",
|
|
6
|
+
"fit-height": "awsui_fit-height_14iqq_emv61_222",
|
|
7
|
+
"with-side-media": "awsui_with-side-media_14iqq_emv61_227",
|
|
8
|
+
"variant-default": "awsui_variant-default_14iqq_emv61_230",
|
|
9
|
+
"variant-stacked": "awsui_variant-stacked_14iqq_emv61_230",
|
|
10
|
+
"refresh": "awsui_refresh_14iqq_emv61_238",
|
|
11
|
+
"sticky-enabled": "awsui_sticky-enabled_14iqq_emv61_288",
|
|
12
|
+
"with-stuck-sticky-header-at-bottom": "awsui_with-stuck-sticky-header-at-bottom_14iqq_emv61_294",
|
|
13
|
+
"with-top-media": "awsui_with-top-media_14iqq_emv61_304",
|
|
14
|
+
"content-wrapper": "awsui_content-wrapper_14iqq_emv61_309",
|
|
15
|
+
"content-wrapper-fit-height": "awsui_content-wrapper-fit-height_14iqq_emv61_314",
|
|
16
|
+
"media": "awsui_media_14iqq_emv61_321",
|
|
17
|
+
"media-top": "awsui_media-top_14iqq_emv61_339",
|
|
18
|
+
"media-side": "awsui_media-side_14iqq_emv61_344",
|
|
19
|
+
"header": "awsui_header_14iqq_emv61_350",
|
|
20
|
+
"header-full-page": "awsui_header-full-page_14iqq_emv61_355",
|
|
21
|
+
"header-variant-embedded": "awsui_header-variant-embedded_14iqq_emv61_358",
|
|
22
|
+
"header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_emv61_358",
|
|
23
|
+
"header-with-media": "awsui_header-with-media_14iqq_emv61_361",
|
|
24
|
+
"header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_emv61_367",
|
|
25
|
+
"header-stuck": "awsui_header-stuck_14iqq_emv61_377",
|
|
26
|
+
"header-variant-cards": "awsui_header-variant-cards_14iqq_emv61_387",
|
|
27
|
+
"header-dynamic-height": "awsui_header-dynamic-height_14iqq_emv61_390",
|
|
28
|
+
"with-paddings": "awsui_with-paddings_14iqq_emv61_396",
|
|
29
|
+
"with-hidden-content": "awsui_with-hidden-content_14iqq_emv61_405",
|
|
30
|
+
"header-variant-full-page": "awsui_header-variant-full-page_14iqq_emv61_463",
|
|
31
|
+
"header-cover": "awsui_header-cover_14iqq_emv61_466",
|
|
32
|
+
"content": "awsui_content_14iqq_emv61_309",
|
|
33
|
+
"content-fit-height": "awsui_content-fit-height_14iqq_emv61_494",
|
|
34
|
+
"content-inner": "awsui_content-inner_14iqq_emv61_500",
|
|
35
|
+
"with-header": "awsui_with-header_14iqq_emv61_507",
|
|
36
|
+
"footer": "awsui_footer_14iqq_emv61_511",
|
|
37
|
+
"with-divider": "awsui_with-divider_14iqq_emv61_515"
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
interface StickyHeaderContextProps {
|
|
3
3
|
isStuck: boolean;
|
|
4
|
+
isStuckAtBottom: boolean;
|
|
4
5
|
}
|
|
5
6
|
interface ComputeOffsetProps {
|
|
6
7
|
isMobile: boolean;
|
|
@@ -14,6 +15,7 @@ export declare const StickyHeaderContext: import("react").Context<StickyHeaderCo
|
|
|
14
15
|
export declare const useStickyHeader: (rootRef: RefObject<HTMLDivElement>, headerRef: RefObject<HTMLDivElement>, __stickyHeader?: boolean, __stickyOffset?: number, __mobileStickyOffset?: number, __disableMobile?: boolean, __additionalOffset?: boolean) => {
|
|
15
16
|
isSticky: boolean;
|
|
16
17
|
isStuck: boolean;
|
|
18
|
+
isStuckAtBottom: boolean;
|
|
17
19
|
stickyStyles: {
|
|
18
20
|
style: {
|
|
19
21
|
top: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sticky-header.d.ts","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,SAAS,EAAqD,MAAM,OAAO,CAAC;AASpG,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-sticky-header.d.ts","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,SAAS,EAAqD,MAAM,OAAO,CAAC;AASpG,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,OAAO,CAAC;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GACnB,EAAE,kBAAkB,GAAG,MAAM,CAQ7B;AAED,eAAO,MAAM,mBAAmB,mDAG9B,CAAC;AAEH,eAAO,MAAM,eAAe,YACjB,UAAU,cAAc,CAAC,aACvB,UAAU,cAAc,CAAC,mBACnB,OAAO,mBACP,MAAM,yBACA,MAAM,oBACX,OAAO;;;;;;;;;;;CAyF1B,CAAC"}
|
|
@@ -16,6 +16,7 @@ export function computeOffset({ isMobile, __stickyOffset, __mobileStickyOffset,
|
|
|
16
16
|
}
|
|
17
17
|
export const StickyHeaderContext = createContext({
|
|
18
18
|
isStuck: false,
|
|
19
|
+
isStuckAtBottom: false,
|
|
19
20
|
});
|
|
20
21
|
export const useStickyHeader = (rootRef, headerRef, __stickyHeader, __stickyOffset, __mobileStickyOffset, __disableMobile, __additionalOffset = false) => {
|
|
21
22
|
const isMobile = useMobile();
|
|
@@ -24,6 +25,7 @@ export const useStickyHeader = (rootRef, headerRef, __stickyHeader, __stickyOffs
|
|
|
24
25
|
// If it has overflow parents inside the app layout, we shouldn't apply a sticky offset.
|
|
25
26
|
const [hasInnerOverflowParents, setHasInnerOverflowParents] = useState(false);
|
|
26
27
|
const [isStuck, setIsStuck] = useState(false);
|
|
28
|
+
const [isStuckAtBottom, setIsStuckAtBottom] = useState(false);
|
|
27
29
|
useLayoutEffect(() => {
|
|
28
30
|
if (rootRef.current) {
|
|
29
31
|
const overflowParents = getOverflowParents(rootRef.current);
|
|
@@ -67,6 +69,14 @@ export const useStickyHeader = (rootRef, headerRef, __stickyHeader, __stickyOffs
|
|
|
67
69
|
else {
|
|
68
70
|
setIsStuck(false);
|
|
69
71
|
}
|
|
72
|
+
const rootBottom = Math.round(rootRef.current.getBoundingClientRect().bottom - rootTopBorderWidth);
|
|
73
|
+
const headerBottom = Math.round(headerRef.current.getBoundingClientRect().bottom);
|
|
74
|
+
if (rootBottom <= headerBottom) {
|
|
75
|
+
setIsStuckAtBottom(true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
setIsStuckAtBottom(false);
|
|
79
|
+
}
|
|
70
80
|
}
|
|
71
81
|
}, [rootRef, headerRef]);
|
|
72
82
|
useEffect(() => {
|
|
@@ -82,6 +92,7 @@ export const useStickyHeader = (rootRef, headerRef, __stickyHeader, __stickyOffs
|
|
|
82
92
|
return {
|
|
83
93
|
isSticky,
|
|
84
94
|
isStuck,
|
|
95
|
+
isStuckAtBottom,
|
|
85
96
|
stickyStyles,
|
|
86
97
|
};
|
|
87
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sticky-header.js","sourceRoot":"","sources":["../../../src/container/use-sticky-header.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAa,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpG,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEv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,qBAAqB,EAAE,CAAC,MAAM,CAAC,CAAC;YAClF,IAAI,UAAU,IAAI,YAAY,EAAE;gBAC9B,kBAAkB,CAAC,IAAI,CAAC,CAAC;aAC1B;iBAAM;gBACL,kBAAkB,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;IACH,CAAC,EACD,CAAC,OAAO,EAAE,SAAS,CAAC,CACrB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,QAAQ,EAAE;YACZ,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;YACzC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9F,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/E,OAAO,GAAG,EAAE;gBACV,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,QAAQ;QACR,OAAO;QACP,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, RefObject, useCallback, useEffect, useLayoutEffect, useState } from 'react';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\n\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport globalVars from '../internal/styles/global-vars';\nimport { getOverflowParents } from '../internal/utils/scrollable-containers';\n\ninterface StickyHeaderContextProps {\n isStuck: boolean;\n isStuckAtBottom: boolean;\n}\n\ninterface ComputeOffsetProps {\n isMobile: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n hasInnerOverflowParents: boolean;\n __additionalOffset?: boolean;\n}\n\nexport function computeOffset({\n isMobile,\n __stickyOffset,\n __mobileStickyOffset,\n hasInnerOverflowParents,\n __additionalOffset,\n}: ComputeOffsetProps): string {\n const localOffset = isMobile ? (__stickyOffset ?? 0) - (__mobileStickyOffset ?? 0) : __stickyOffset ?? 0;\n if (hasInnerOverflowParents || __stickyOffset !== undefined) {\n return `${localOffset}px`;\n }\n const globalOffset = `var(${globalVars.stickyVerticalTopOffset}, 0px)`;\n\n return `calc(${globalOffset} + ${localOffset}px + ${__additionalOffset ? tokens.spaceScaledS : '0px'})`;\n}\n\nexport const StickyHeaderContext = createContext<StickyHeaderContextProps>({\n isStuck: false,\n isStuckAtBottom: false,\n});\n\nexport const useStickyHeader = (\n rootRef: RefObject<HTMLDivElement>,\n headerRef: RefObject<HTMLDivElement>,\n __stickyHeader?: boolean,\n __stickyOffset?: number,\n __mobileStickyOffset?: number,\n __disableMobile?: boolean,\n __additionalOffset = false\n) => {\n const isMobile = useMobile();\n const disableSticky = isMobile && __disableMobile;\n const isSticky = !disableSticky && !!__stickyHeader;\n\n // If it has overflow parents inside the app layout, we shouldn't apply a sticky offset.\n const [hasInnerOverflowParents, setHasInnerOverflowParents] = useState(false);\n const [isStuck, setIsStuck] = useState(false);\n const [isStuckAtBottom, setIsStuckAtBottom] = useState(false);\n\n useLayoutEffect(() => {\n if (rootRef.current) {\n const overflowParents = getOverflowParents(rootRef.current);\n const mainElement = findUpUntil(rootRef.current, elem => elem.tagName === 'MAIN');\n\n // In both versions of the app layout, the scrolling element for disableBodyScroll\n // is the <main>. If the closest overflow parent is also the closest <main> and we have\n // offset values, it's safe to assume that it's the app layout scroll root and we\n // should stop there.\n setHasInnerOverflowParents(overflowParents.length > 0 && overflowParents[0] !== mainElement);\n }\n }, [rootRef]);\n\n const computedOffset = computeOffset({\n isMobile,\n __stickyOffset,\n __mobileStickyOffset,\n hasInnerOverflowParents,\n __additionalOffset,\n });\n\n const stickyStyles = isSticky\n ? {\n style: {\n top: computedOffset,\n },\n }\n : {};\n\n // \"stuck\" state, when the header has moved from its original posititon has a\n // box-shadow, applied here by a \"header-stuck\" className\n const checkIfStuck = useCallback(\n ({ isTrusted, target, type }) => {\n if (type === 'resize' && target === window && !isTrusted) {\n // The window size didn't actually change, it was a synthetic event\n return;\n }\n if (rootRef.current && headerRef.current) {\n const rootTopBorderWidth = parseFloat(getComputedStyle(rootRef.current).borderTopWidth) || 0;\n\n // Using Math.round to adjust for rounding errors in floating-point arithmetic and timing issues\n const rootTop = Math.round(rootRef.current.getBoundingClientRect().top + rootTopBorderWidth);\n const headerTop = Math.round(headerRef.current.getBoundingClientRect().top);\n if (rootTop < headerTop) {\n setIsStuck(true);\n } else {\n setIsStuck(false);\n }\n\n const rootBottom = Math.round(rootRef.current.getBoundingClientRect().bottom - rootTopBorderWidth);\n const headerBottom = Math.round(headerRef.current.getBoundingClientRect().bottom);\n if (rootBottom <= headerBottom) {\n setIsStuckAtBottom(true);\n } else {\n setIsStuckAtBottom(false);\n }\n }\n },\n [rootRef, headerRef]\n );\n\n useEffect(() => {\n if (isSticky) {\n const controller = new AbortController();\n window.addEventListener('scroll', checkIfStuck, { capture: true, signal: controller.signal });\n window.addEventListener('resize', checkIfStuck, { signal: controller.signal });\n return () => {\n controller.abort();\n };\n }\n }, [isSticky, checkIfStuck]);\n return {\n isSticky,\n isStuck,\n isStuckAtBottom,\n stickyStyles,\n };\n};\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -93,6 +93,14 @@ export declare namespace PromptInputProps {
|
|
|
93
93
|
* Selects all text in the textarea control.
|
|
94
94
|
*/
|
|
95
95
|
select(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Selects a range of text in the textarea control.
|
|
98
|
+
*
|
|
99
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/setSelectionRange
|
|
100
|
+
* for more details on this method. Be aware that using this method in React has some
|
|
101
|
+
* common pitfalls: https://stackoverflow.com/questions/60129605/is-javascripts-setselectionrange-incompatible-with-react-hooks
|
|
102
|
+
*/
|
|
103
|
+
setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,gBACf,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,+BAA+B;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACpE;;OAEG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,mBAAmB,CAAC,E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AAS,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAE1C;;OAEG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;CAC3C;AAED,yBAAiB,gBAAgB,CAAC;IAChC,KAAY,SAAS,GAAG,aAAa,CAAC;IACtC,KAAY,YAAY,GAAG,gBAAgB,CAAC;IAE5C,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;QAEd;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;QAEf;;;;;;WAMG;QACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;KAChH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IconProps } from '../icon/interfaces';\nimport {\n BaseChangeDetail,\n BaseInputProps,\n InputAutoComplete,\n InputAutoCorrect,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail, NonCancelableEventHandler } from '../internal/events';\n\nexport interface PromptInputProps\n extends BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Called whenever a user clicks the action button or presses the \"Enter\" key.\n * The event `detail` contains the current value of the field.\n */\n onAction?: NonCancelableEventHandler<PromptInputProps.ActionDetail>;\n /**\n * Determines what icon to display in the action button.\n */\n actionButtonIconName?: IconProps.Name;\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `actionButtonIconSvg` will take precedence.\n */\n actionButtonIconUrl?: string;\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n actionButtonIconSvg?: React.ReactNode;\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n actionButtonIconAlt?: string;\n /**\n * Adds an aria-label to the action button.\n * @i18n\n */\n actionButtonAriaLabel?: string;\n\n /**\n * Specifies whether to disable the action button.\n */\n disableActionButton?: boolean;\n\n /**\n * Specifies the minimum number of lines of text to set the height to.\n */\n minRows?: number;\n\n /**\n * Specifies the maximum number of lines of text the textarea will expand to.\n */\n maxRows?: number;\n\n /**\n * Use this slot to add secondary actions to the prompt input.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Use this slot to add secondary content, such as file attachments, to the prompt input.\n */\n secondaryContent?: React.ReactNode;\n\n /**\n * Determines whether the secondary actions area of the input has padding. If true, removes the default padding from the secondary actions area.\n */\n disableSecondaryActionsPaddings?: boolean;\n\n /**\n * Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.\n */\n disableSecondaryContentPaddings?: boolean;\n}\n\nexport namespace PromptInputProps {\n export type KeyDetail = BaseKeyDetail;\n export type ActionDetail = BaseChangeDetail;\n\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n\n /**\n * Selects all text in the textarea control.\n */\n select(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/prompt-input/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IconProps } from '../icon/interfaces';\nimport {\n BaseChangeDetail,\n BaseInputProps,\n InputAutoComplete,\n InputAutoCorrect,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail, NonCancelableEventHandler } from '../internal/events';\n\nexport interface PromptInputProps\n extends BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Called whenever a user clicks the action button or presses the \"Enter\" key.\n * The event `detail` contains the current value of the field.\n */\n onAction?: NonCancelableEventHandler<PromptInputProps.ActionDetail>;\n /**\n * Determines what icon to display in the action button.\n */\n actionButtonIconName?: IconProps.Name;\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `actionButtonIconSvg` will take precedence.\n */\n actionButtonIconUrl?: string;\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `actionButtonIconUrl` and `actionButtonIconSvg`, `iconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n actionButtonIconSvg?: React.ReactNode;\n /**\n * Specifies alternate text for a custom icon. We recommend that you provide this for accessibility.\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `iconSvg` slot.\n */\n actionButtonIconAlt?: string;\n /**\n * Adds an aria-label to the action button.\n * @i18n\n */\n actionButtonAriaLabel?: string;\n\n /**\n * Specifies whether to disable the action button.\n */\n disableActionButton?: boolean;\n\n /**\n * Specifies the minimum number of lines of text to set the height to.\n */\n minRows?: number;\n\n /**\n * Specifies the maximum number of lines of text the textarea will expand to.\n */\n maxRows?: number;\n\n /**\n * Use this slot to add secondary actions to the prompt input.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Use this slot to add secondary content, such as file attachments, to the prompt input.\n */\n secondaryContent?: React.ReactNode;\n\n /**\n * Determines whether the secondary actions area of the input has padding. If true, removes the default padding from the secondary actions area.\n */\n disableSecondaryActionsPaddings?: boolean;\n\n /**\n * Determines whether the secondary content area of the input has padding. If true, removes the default padding from the secondary content area.\n */\n disableSecondaryContentPaddings?: boolean;\n}\n\nexport namespace PromptInputProps {\n export type KeyDetail = BaseKeyDetail;\n export type ActionDetail = BaseChangeDetail;\n\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n\n /**\n * Selects all text in the textarea control.\n */\n select(): void;\n\n /**\n * Selects a range of text in the textarea control.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/setSelectionRange\n * for more details on this method. Be aware that using this method in React has some\n * common pitfalls: https://stackoverflow.com/questions/60129605/is-javascripts-setselectionrange-incompatible-with-react-hooks\n */\n setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAyMxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/prompt-input/internal.js
CHANGED
|
@@ -31,6 +31,10 @@ const InternalPromptInput = React.forwardRef((_a, ref) => {
|
|
|
31
31
|
var _a;
|
|
32
32
|
(_a = textareaRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
33
33
|
},
|
|
34
|
+
setSelectionRange(...args) {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = textareaRef.current) === null || _a === void 0 ? void 0 : _a.setSelectionRange(...args);
|
|
37
|
+
},
|
|
34
38
|
}), [textareaRef]);
|
|
35
39
|
const handleKeyDown = (event) => {
|
|
36
40
|
fireKeyboardEvent(onKeyDown, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;A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gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAED,gBAAgB;YAChB,eAAe,IAAI,MAAM,CACtB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps extends PromptInputProps, InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows = 3,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey) {\n if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {\n (event.target.form as HTMLFormElement).requestSubmit();\n }\n\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n const maxRowsHeight = `calc(${maxRows <= 0 ? 3 : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows || 1,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAC1C,CACE,EA+B2B,EAC3B,GAA8B,EAC9B,EAAE;QAjCF,EACE,KAAK,EACL,qBAAqB,EACrB,oBAAoB,E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AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps extends PromptInputProps, InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows = 3,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey) {\n if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {\n (event.target.form as HTMLFormElement).requestSubmit();\n }\n\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n const maxRowsHeight = `calc(${maxRows <= 0 ? 3 : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows || 1,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|