@cloudscape-design/components 3.0.1175 → 3.0.1176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/internal/base-component/styles.scoped.css +1 -1
  2. package/internal/do-not-use/feature-prompt/index.d.ts +5 -0
  3. package/internal/do-not-use/feature-prompt/index.d.ts.map +1 -0
  4. package/internal/do-not-use/feature-prompt/index.js +15 -0
  5. package/internal/do-not-use/feature-prompt/index.js.map +1 -0
  6. package/internal/do-not-use/feature-prompt/interfaces.d.ts +68 -0
  7. package/internal/do-not-use/feature-prompt/interfaces.d.ts.map +1 -0
  8. package/internal/do-not-use/feature-prompt/interfaces.js +4 -0
  9. package/internal/do-not-use/feature-prompt/interfaces.js.map +1 -0
  10. package/internal/do-not-use/feature-prompt/internal.d.ts +7 -0
  11. package/internal/do-not-use/feature-prompt/internal.d.ts.map +1 -0
  12. package/internal/do-not-use/feature-prompt/internal.js +43 -0
  13. package/internal/do-not-use/feature-prompt/internal.js.map +1 -0
  14. package/internal/do-not-use/feature-prompt/styles.css.js +4 -0
  15. package/internal/do-not-use/feature-prompt/styles.scoped.css +4 -0
  16. package/internal/do-not-use/feature-prompt/styles.selectors.js +5 -0
  17. package/internal/environment.js +2 -2
  18. package/internal/environment.json +2 -2
  19. package/internal/manifest.json +1 -1
  20. package/package.json +1 -1
  21. package/popover/body.d.ts +3 -12
  22. package/popover/body.d.ts.map +1 -1
  23. package/popover/body.js +4 -3
  24. package/popover/body.js.map +1 -1
  25. package/test-utils/dom/internal/feature-prompt.d.ts +7 -0
  26. package/test-utils/dom/internal/feature-prompt.js +20 -0
  27. package/test-utils/dom/internal/feature-prompt.js.map +1 -0
  28. package/test-utils/selectors/internal/feature-prompt.d.ts +7 -0
  29. package/test-utils/selectors/internal/feature-prompt.js +26 -0
  30. package/test-utils/selectors/internal/feature-prompt.js.map +1 -0
@@ -2012,5 +2012,5 @@ body {
2012
2012
  }
2013
2013
  }
2014
2014
  :root {
2015
- --awsui-version-info-15e15bbc: true;
2015
+ --awsui-version-info-0f8232fb: true;
2016
2016
  }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { FeaturePromptProps } from './interfaces';
3
+ export { FeaturePromptProps };
4
+ declare const FeaturePrompt: React.ForwardRefExoticComponent<FeaturePromptProps & React.RefAttributes<FeaturePromptProps.Ref>>;
5
+ export default FeaturePrompt;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,QAAA,MAAM,aAAa,mGAYlB,CAAC;AAGF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import useBaseComponent from '../../hooks/use-base-component';
5
+ import { applyDisplayName } from '../../utils/apply-display-name';
6
+ import { getExternalProps } from '../../utils/external-props';
7
+ import InternalFeaturePrompt from './internal';
8
+ const FeaturePrompt = React.forwardRef(({ size = 'medium', position = 'top', ...rest }, ref) => {
9
+ const baseComponentProps = useBaseComponent('FeaturePrompt', { props: { size, position } });
10
+ const externalProps = getExternalProps(rest);
11
+ return (React.createElement(InternalFeaturePrompt, { ref: ref, size: size, position: position, ...externalProps, ...baseComponentProps }));
12
+ });
13
+ applyDisplayName(FeaturePrompt, 'FeaturePrompt');
14
+ export default FeaturePrompt;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAI/C,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EAAE,IAAI,GAAG,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,IAAI,EAAsB,EAClE,GAAsC,EACzB,EAAE;IACf,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAE5F,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,CACL,oBAAC,qBAAqB,IAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,KAAM,aAAa,KAAM,kBAAkB,GAAI,CAC/G,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AACjD,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport useBaseComponent from '../../hooks/use-base-component';\nimport { applyDisplayName } from '../../utils/apply-display-name';\nimport { getExternalProps } from '../../utils/external-props';\nimport { FeaturePromptProps } from './interfaces';\nimport InternalFeaturePrompt from './internal';\n\nexport { FeaturePromptProps };\n\nconst FeaturePrompt = React.forwardRef(\n (\n { size = 'medium', position = 'top', ...rest }: FeaturePromptProps,\n ref: React.Ref<FeaturePromptProps.Ref>\n ): JSX.Element => {\n const baseComponentProps = useBaseComponent('FeaturePrompt', { props: { size, position } });\n\n const externalProps = getExternalProps(rest);\n return (\n <InternalFeaturePrompt ref={ref} size={size} position={position} {...externalProps} {...baseComponentProps} />\n );\n }\n);\n\napplyDisplayName(FeaturePrompt, 'FeaturePrompt');\nexport default FeaturePrompt;\n"]}
@@ -0,0 +1,68 @@
1
+ import { PopoverProps } from '../../../popover/interfaces';
2
+ import { NonCancelableEventHandler } from '../../events';
3
+ export interface FeaturePromptProps {
4
+ /**
5
+ * Called when the feature prompt shows.
6
+ */
7
+ onShow?: NonCancelableEventHandler<null>;
8
+ /**
9
+ * Called when a user closes the prompt by using the close icon button,
10
+ * clicking outside the prompt, shifting focus out of the prompt or pressing ESC.
11
+ */
12
+ onDismiss?: NonCancelableEventHandler<null>;
13
+ /**
14
+ * Determines where the feature prompt is displayed when opened, relative to the trigger.
15
+ * If the feature prompt doesn't have enough space to open in this direction, it
16
+ * automatically chooses a better direction based on available space.
17
+ */
18
+ position?: FeaturePromptProps.Position;
19
+ /**
20
+ * Determines the maximum width for the feature prompt.
21
+ */
22
+ size?: FeaturePromptProps.Size;
23
+ /**
24
+ * Specifies header content for the feature prompt.
25
+ */
26
+ header: React.ReactNode;
27
+ /**
28
+ * Content of the feature prompt.
29
+ */
30
+ content: React.ReactNode;
31
+ /**
32
+ * An object containing all the necessary localized strings required by the component.
33
+ * @i18n
34
+ */
35
+ i18nStrings?: FeaturePromptProps.I18nStrings;
36
+ /**
37
+ * Function that returns the element to track for positioning the prompt.
38
+ * Use this when you want to position the prompt relative to an external element.
39
+ * Cannot be used together with the children prop.
40
+ */
41
+ getTrack: () => null | HTMLElement | SVGElement;
42
+ /**
43
+ * Unique identifier for the tracked element. Used for tracking position changes
44
+ * when using getTrack.
45
+ */
46
+ trackKey?: string | number;
47
+ }
48
+ export declare namespace FeaturePromptProps {
49
+ type Position = PopoverProps.Position;
50
+ type Size = PopoverProps.Size;
51
+ interface I18nStrings {
52
+ /**
53
+ * Adds an `aria-label` to the dismiss button for accessibility.
54
+ * @i18n
55
+ */
56
+ dismissAriaLabel?: string;
57
+ }
58
+ interface Ref {
59
+ /**
60
+ * Use only if an element other than the trigger needs to be focused after dismissing the prompt.
61
+ */
62
+ dismiss(): void;
63
+ /**
64
+ * Shows the prompt and focuses its close button.
65
+ */
66
+ show(): void;
67
+ }
68
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAEzC;;;OAGG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAE5C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;IAEvC;;OAEG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAE/B;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;IAEhD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,yBAAiB,kBAAkB,CAAC;IAClC,KAAY,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;IAC7C,KAAY,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IACrC,UAAiB,WAAW;QAC1B;;;WAGG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;IACD,UAAiB,GAAG;QAClB;;WAEG;QACH,OAAO,IAAI,IAAI,CAAC;QAEhB;;WAEG;QACH,IAAI,IAAI,IAAI,CAAC;KACd;CACF"}
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PopoverProps } from '../../../popover/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\nexport interface FeaturePromptProps {\n /**\n * Called when the feature prompt shows.\n */\n onShow?: NonCancelableEventHandler<null>;\n\n /**\n * Called when a user closes the prompt by using the close icon button,\n * clicking outside the prompt, shifting focus out of the prompt or pressing ESC.\n */\n onDismiss?: NonCancelableEventHandler<null>;\n\n /**\n * Determines where the feature prompt is displayed when opened, relative to the trigger.\n * If the feature prompt doesn't have enough space to open in this direction, it\n * automatically chooses a better direction based on available space.\n */\n position?: FeaturePromptProps.Position;\n\n /**\n * Determines the maximum width for the feature prompt.\n */\n size?: FeaturePromptProps.Size;\n\n /**\n * Specifies header content for the feature prompt.\n */\n header: React.ReactNode;\n\n /**\n * Content of the feature prompt.\n */\n content: React.ReactNode;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: FeaturePromptProps.I18nStrings;\n\n /**\n * Function that returns the element to track for positioning the prompt.\n * Use this when you want to position the prompt relative to an external element.\n * Cannot be used together with the children prop.\n */\n getTrack: () => null | HTMLElement | SVGElement;\n\n /**\n * Unique identifier for the tracked element. Used for tracking position changes\n * when using getTrack.\n */\n trackKey?: string | number;\n}\n\nexport namespace FeaturePromptProps {\n export type Position = PopoverProps.Position;\n export type Size = PopoverProps.Size;\n export interface I18nStrings {\n /**\n * Adds an `aria-label` to the dismiss button for accessibility.\n * @i18n\n */\n dismissAriaLabel?: string;\n }\n export interface Ref {\n /**\n * Use only if an element other than the trigger needs to be focused after dismissing the prompt.\n */\n dismiss(): void;\n\n /**\n * Shows the prompt and focuses its close button.\n */\n show(): void;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { InternalBaseComponentProps } from '../../hooks/use-base-component';
3
+ import { SomeRequired } from '../../types';
4
+ import { FeaturePromptProps } from './interfaces';
5
+ interface InternalFeaturePromptProps extends SomeRequired<FeaturePromptProps, 'size' | 'position'>, InternalBaseComponentProps {}
6
+ declare const _default: React.ForwardRefExoticComponent<InternalFeaturePromptProps & React.RefAttributes<FeaturePromptProps.Ref>>;
7
+ export default _default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAUrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,UAAU,0BACR,SAAQ,YAAY,CAAC,kBAAkB,EAAE,MAAM,GAAG,UAAU,CAAC,EAC3D,0BAA0B;CAAG;;AAgFjC,wBAAuD"}
@@ -0,0 +1,43 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React, { useImperativeHandle, useRef, useState } from 'react';
4
+ import { Portal } from '@cloudscape-design/component-toolkit/internal';
5
+ import Arrow from '../../../popover/arrow';
6
+ import PopoverBody from '../../../popover/body';
7
+ import PopoverContainer from '../../../popover/container';
8
+ import { getBaseProps } from '../../base-component';
9
+ import ResetContextsForModal from '../../context/reset-contexts-for-modal';
10
+ import { fireNonCancelableEvent } from '../../events';
11
+ import styles from './styles.css.js';
12
+ function InternalFeaturePrompt({ onShow, onDismiss, header, content, i18nStrings, size, position, getTrack, trackKey, __internalRootRef, ...restProps }, ref) {
13
+ const baseProps = getBaseProps(restProps);
14
+ const [show, setShow] = useState(false);
15
+ const popoverBodyRef = useRef(null);
16
+ useImperativeHandle(ref, () => ({
17
+ dismiss: () => {
18
+ setShow(false);
19
+ fireNonCancelableEvent(onDismiss);
20
+ },
21
+ show: () => {
22
+ setShow(true);
23
+ fireNonCancelableEvent(onShow);
24
+ },
25
+ }));
26
+ return (React.createElement("span", { ...baseProps, className: styles.root, ref: __internalRootRef }, show && (React.createElement(Portal, null,
27
+ React.createElement(ResetContextsForModal, null,
28
+ React.createElement(PopoverContainer, { size: size, fixedWidth: false, position: position, getTrack: getTrack, trackKey: trackKey, variant: "annotation", arrow: position => React.createElement(Arrow, { position: position, variant: "info" }), zIndex: 7000, renderWithPortal: true },
29
+ React.createElement(PopoverBody, { ref: popoverBodyRef, dismissButton: true, dismissAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dismissAriaLabel, header: header, onDismiss: () => {
30
+ setShow(false);
31
+ fireNonCancelableEvent(onDismiss);
32
+ }, variant: "annotation", overflowVisible: "content", onBlur: event => {
33
+ var _a;
34
+ const relatedTarget = event.relatedTarget;
35
+ if (relatedTarget && ((_a = popoverBodyRef.current) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget))) {
36
+ return;
37
+ }
38
+ setShow(false);
39
+ fireNonCancelableEvent(onDismiss);
40
+ } }, content)))))));
41
+ }
42
+ export default React.forwardRef(InternalFeaturePrompt);
43
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../../src/internal/do-not-use/feature-prompt/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,K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AAC,MAAM;QACL,oBAAC,qBAAqB;YACpB,oBAAC,gBAAgB,IACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAC,YAAY,EACpB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,GAAG,EAC/D,MAAM,EAAE,IAAI,EACZ,gBAAgB,EAAE,IAAI;gBAEtB,oBAAC,WAAW,IACV,GAAG,EAAE,cAAc,EACnB,aAAa,EAAE,IAAI,EACnB,gBAAgB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,EAC/C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,GAAG,EAAE;wBACd,OAAO,CAAC,KAAK,CAAC,CAAC;wBACf,sBAAsB,CAAC,SAAS,CAAC,CAAC;oBACpC,CAAC,EACD,OAAO,EAAC,YAAY,EACpB,eAAe,EAAC,SAAS,EACzB,MAAM,EAAE,KAAK,CAAC,EAAE;;wBACd,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;wBAC1C,IAAI,aAAa,KAAI,MAAA,cAAc,CAAC,OAAO,0CAAE,QAAQ,CAAC,aAAa,CAAC,CAAA,EAAE,CAAC;4BACrE,OAAO;wBACT,CAAC;wBACD,OAAO,CAAC,KAAK,CAAC,CAAC;wBACf,sBAAsB,CAAC,SAAS,CAAC,CAAC;oBACpC,CAAC,IAEA,OAAO,CACI,CACG,CACG,CACjB,CACV,CACI,CACR,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useImperativeHandle, useRef, useState } from 'react';\n\nimport { Portal } from '@cloudscape-design/component-toolkit/internal';\n\nimport Arrow from '../../../popover/arrow';\nimport PopoverBody from '../../../popover/body';\nimport PopoverContainer from '../../../popover/container';\nimport { getBaseProps } from '../../base-component';\nimport ResetContextsForModal from '../../context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../../events';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component';\nimport { SomeRequired } from '../../types';\nimport { FeaturePromptProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalFeaturePromptProps\n extends SomeRequired<FeaturePromptProps, 'size' | 'position'>,\n InternalBaseComponentProps {}\n\nfunction InternalFeaturePrompt(\n {\n onShow,\n onDismiss,\n header,\n content,\n i18nStrings,\n size,\n position,\n getTrack,\n trackKey,\n __internalRootRef,\n ...restProps\n }: InternalFeaturePromptProps,\n ref: React.Ref<FeaturePromptProps.Ref>\n) {\n const baseProps = getBaseProps(restProps);\n const [show, setShow] = useState(false);\n\n const popoverBodyRef = useRef<HTMLDivElement | null>(null);\n\n useImperativeHandle(ref, () => ({\n dismiss: () => {\n setShow(false);\n fireNonCancelableEvent(onDismiss);\n },\n show: () => {\n setShow(true);\n fireNonCancelableEvent(onShow);\n },\n }));\n\n return (\n <span {...baseProps} className={styles.root} ref={__internalRootRef}>\n {show && (\n <Portal>\n <ResetContextsForModal>\n <PopoverContainer\n size={size}\n fixedWidth={false}\n position={position}\n getTrack={getTrack}\n trackKey={trackKey}\n variant=\"annotation\"\n arrow={position => <Arrow position={position} variant=\"info\" />}\n zIndex={7000}\n renderWithPortal={true}\n >\n <PopoverBody\n ref={popoverBodyRef}\n dismissButton={true}\n dismissAriaLabel={i18nStrings?.dismissAriaLabel}\n header={header}\n onDismiss={() => {\n setShow(false);\n fireNonCancelableEvent(onDismiss);\n }}\n variant=\"annotation\"\n overflowVisible=\"content\"\n onBlur={event => {\n const relatedTarget = event.relatedTarget;\n if (relatedTarget && popoverBodyRef.current?.contains(relatedTarget)) {\n return;\n }\n setShow(false);\n fireNonCancelableEvent(onDismiss);\n }}\n >\n {content}\n </PopoverBody>\n </PopoverContainer>\n </ResetContextsForModal>\n </Portal>\n )}\n </span>\n );\n}\n\nexport default React.forwardRef(InternalFeaturePrompt);\n"]}
@@ -0,0 +1,4 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {};
4
+
@@ -0,0 +1,4 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
@@ -0,0 +1,5 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {};
5
+
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (15e15bbc)";
3
- export var GIT_SHA = "15e15bbc";
2
+ export var PACKAGE_VERSION = "3.0.0 (0f8232fb)";
3
+ export var GIT_SHA = "0f8232fb";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "core";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (15e15bbc)",
4
- "GIT_SHA": "15e15bbc",
3
+ "PACKAGE_VERSION": "3.0.0 (0f8232fb)",
4
+ "GIT_SHA": "0f8232fb",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "15e15bbcd56ea57ec78430a3713b125deeeaf63a"
2
+ "commit": "0f8232fbf52ee6adfc19b91f723f80038bc97b2d"
3
3
  }
package/package.json CHANGED
@@ -158,7 +158,7 @@
158
158
  "./internal/base-component/index.js",
159
159
  "./internal/base-component/styles.css.js"
160
160
  ],
161
- "version": "3.0.1175",
161
+ "version": "3.0.1176",
162
162
  "repository": {
163
163
  "type": "git",
164
164
  "url": "https://github.com/cloudscape-design/components.git"
package/popover/body.d.ts CHANGED
@@ -3,6 +3,7 @@ export interface PopoverBodyProps {
3
3
  dismissButton: boolean;
4
4
  dismissAriaLabel: string | undefined;
5
5
  onDismiss: (() => void) | undefined;
6
+ onBlur?: (event: React.FocusEvent) => void;
6
7
  header: React.ReactNode | undefined;
7
8
  children: React.ReactNode;
8
9
  variant?: 'annotation' | 'chart';
@@ -11,15 +12,5 @@ export interface PopoverBodyProps {
11
12
  ariaLabelledby?: string;
12
13
  closeAnalyticsAction?: string;
13
14
  }
14
- export default function PopoverBody({
15
- dismissButton: showDismissButton,
16
- dismissAriaLabel,
17
- header,
18
- children,
19
- onDismiss,
20
- variant,
21
- overflowVisible,
22
- className,
23
- ariaLabelledby,
24
- closeAnalyticsAction
25
- }: PopoverBodyProps): JSX.Element;
15
+ declare const PopoverBody: React.ForwardRefExoticComponent<PopoverBodyProps & React.RefAttributes<HTMLDivElement>>;
16
+ export default PopoverBody;
@@ -1 +1 @@
1
- {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAe9D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAEpC,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,aAAa,EAAE,iBAAiB,EAChC,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,eAAe,EACf,SAAS,EACT,cAAc,EACd,oBAAoB,GACrB,EAAE,gBAAgB,eAiFlB"}
1
+ {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAe9D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAE3C,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,QAAA,MAAM,WAAW,yFAoGhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/popover/body.js CHANGED
@@ -10,7 +10,7 @@ import { useInternalI18n } from '../i18n/context';
10
10
  import FocusLock from '../internal/components/focus-lock';
11
11
  import { KeyCode } from '../internal/keycode';
12
12
  import styles from './styles.css.js';
13
- export default function PopoverBody({ dismissButton: showDismissButton, dismissAriaLabel, header, children, onDismiss, variant, overflowVisible, className, ariaLabelledby, closeAnalyticsAction, }) {
13
+ const PopoverBody = React.forwardRef(({ dismissButton: showDismissButton, dismissAriaLabel, header, children, onDismiss, onBlur, variant, overflowVisible, className, ariaLabelledby, closeAnalyticsAction, }, ref) => {
14
14
  const i18n = useInternalI18n('popover');
15
15
  const labelledById = useUniqueId('awsui-popover-');
16
16
  const dismissButtonFocused = useRef(false);
@@ -43,7 +43,7 @@ export default function PopoverBody({ dismissButton: showDismissButton, dismissA
43
43
  : {};
44
44
  return (React.createElement("div", { className: clsx(styles.body, styles[`body-variant-${variant}`], className, {
45
45
  [styles['body-overflow-visible']]: overflowVisible === 'both',
46
- }), onKeyDown: onKeyDown, ...dialogProps },
46
+ }), onKeyDown: onKeyDown, ref: ref, onBlur: onBlur, ...dialogProps },
47
47
  React.createElement(BuiltInErrorBoundary, null,
48
48
  React.createElement(FocusLock, { disabled: !shouldTrapFocus, autoFocus: false },
49
49
  header && (React.createElement("div", { className: clsx(styles['header-row'], showDismissButton && styles['has-dismiss']) },
@@ -53,5 +53,6 @@ export default function PopoverBody({ dismissButton: showDismissButton, dismissA
53
53
  React.createElement("div", { className: !header && showDismissButton ? styles['has-dismiss'] : undefined },
54
54
  !header && dismissButton,
55
55
  React.createElement("div", { className: clsx(styles.content, { [styles['content-overflow-visible']]: !!overflowVisible }) }, children))))));
56
- }
56
+ });
57
+ export default PopoverBody;
57
58
  //# sourceMappingURL=body.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAGjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EA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T,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,iBAAiB,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;oBACnF,aAAa;oBACd,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,YAAY;wBAC7C,gCAAK,MAAM,CAAM,CACb,CACF,CACP;gBACD,6BAAK,SAAS,EAAE,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;oBAC7E,CAAC,MAAM,IAAI,aAAa;oBACzB,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,IAC9F,QAAQ,CACL,CACF,CACI,CACS,CACnB,CACP,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, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport FocusLock from '../internal/components/focus-lock';\nimport { KeyCode } from '../internal/keycode';\n\nimport styles from './styles.css.js';\n\nexport interface PopoverBodyProps {\n dismissButton: boolean;\n dismissAriaLabel: string | undefined;\n onDismiss: (() => void) | undefined;\n\n header: React.ReactNode | undefined;\n children: React.ReactNode;\n variant?: 'annotation' | 'chart';\n overflowVisible?: 'content' | 'both';\n\n className?: string;\n ariaLabelledby?: string;\n\n closeAnalyticsAction?: string;\n}\n\nexport default function PopoverBody({\n dismissButton: showDismissButton,\n dismissAriaLabel,\n header,\n children,\n onDismiss,\n variant,\n overflowVisible,\n className,\n ariaLabelledby,\n closeAnalyticsAction,\n}: PopoverBodyProps) {\n const i18n = useInternalI18n('popover');\n const labelledById = useUniqueId('awsui-popover-');\n const dismissButtonFocused = useRef(false);\n const dismissButtonRef = useRef<ButtonProps.Ref>(null);\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.stopPropagation();\n onDismiss?.();\n }\n },\n [onDismiss]\n );\n\n // Implement our own auto-focus rather than using FocusLock's,\n // because we also want to focus the dismiss button when it\n // is added dynamically (e.g. in chart popovers)\n useEffect(() => {\n if (showDismissButton && !dismissButtonFocused.current) {\n dismissButtonRef.current?.focus({ preventScroll: true });\n }\n dismissButtonFocused.current = showDismissButton;\n }, [showDismissButton]);\n\n const dismissButton = (showDismissButton ?? null) && (\n <div\n className={styles.dismiss}\n {...(closeAnalyticsAction ? getAnalyticsMetadataAttribute({ action: closeAnalyticsAction }) : {})}\n >\n <InternalButton\n variant=\"icon\"\n formAction=\"none\"\n iconName=\"close\"\n className={styles['dismiss-control']}\n ariaLabel={i18n('dismissAriaLabel', dismissAriaLabel)}\n onClick={() => onDismiss?.()}\n ref={dismissButtonRef}\n />\n </div>\n );\n\n const isDialog = showDismissButton;\n const shouldTrapFocus = showDismissButton && variant !== 'annotation';\n\n const dialogProps = isDialog\n ? {\n role: 'dialog',\n 'aria-labelledby': ariaLabelledby ?? (header ? labelledById : undefined),\n }\n : {};\n\n return (\n <div\n className={clsx(styles.body, styles[`body-variant-${variant}`], className, {\n [styles['body-overflow-visible']]: overflowVisible === 'both',\n })}\n onKeyDown={onKeyDown}\n {...dialogProps}\n >\n <BuiltInErrorBoundary>\n <FocusLock disabled={!shouldTrapFocus} autoFocus={false}>\n {header && (\n <div className={clsx(styles['header-row'], showDismissButton && styles['has-dismiss'])}>\n {dismissButton}\n <div className={styles.header} id={labelledById}>\n <h2>{header}</h2>\n </div>\n </div>\n )}\n <div className={!header && showDismissButton ? styles['has-dismiss'] : undefined}>\n {!header && dismissButton}\n <div className={clsx(styles.content, { [styles['content-overflow-visible']]: !!overflowVisible })}>\n {children}\n </div>\n </div>\n </FocusLock>\n </BuiltInErrorBoundary>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAGjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAmBrC,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CACE,EACE,aAAa,EAAE,iBAAiB,EAChC,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,eAAe,EACf,SAAS,EACT,cAAc,EACd,oBAAoB,GACH,EACnB,GAA8B,EAC9B,EAAE;IACF,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,oBAAoB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,gBAAgB,GAAG,M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C,CAAC,eAAe,EAAE,CAAC,IAC9F,QAAQ,CACL,CACF,CACI,CACS,CACnB,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport FocusLock from '../internal/components/focus-lock';\nimport { KeyCode } from '../internal/keycode';\n\nimport styles from './styles.css.js';\n\nexport interface PopoverBodyProps {\n dismissButton: boolean;\n dismissAriaLabel: string | undefined;\n onDismiss: (() => void) | undefined;\n onBlur?: (event: React.FocusEvent) => void;\n\n header: React.ReactNode | undefined;\n children: React.ReactNode;\n variant?: 'annotation' | 'chart';\n overflowVisible?: 'content' | 'both';\n\n className?: string;\n ariaLabelledby?: string;\n\n closeAnalyticsAction?: string;\n}\n\nconst PopoverBody = React.forwardRef(\n (\n {\n dismissButton: showDismissButton,\n dismissAriaLabel,\n header,\n children,\n onDismiss,\n onBlur,\n variant,\n overflowVisible,\n className,\n ariaLabelledby,\n closeAnalyticsAction,\n }: PopoverBodyProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const i18n = useInternalI18n('popover');\n const labelledById = useUniqueId('awsui-popover-');\n const dismissButtonFocused = useRef(false);\n const dismissButtonRef = useRef<ButtonProps.Ref>(null);\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n event.stopPropagation();\n onDismiss?.();\n }\n },\n [onDismiss]\n );\n\n // Implement our own auto-focus rather than using FocusLock's,\n // because we also want to focus the dismiss button when it\n // is added dynamically (e.g. in chart popovers)\n useEffect(() => {\n if (showDismissButton && !dismissButtonFocused.current) {\n dismissButtonRef.current?.focus({ preventScroll: true });\n }\n dismissButtonFocused.current = showDismissButton;\n }, [showDismissButton]);\n\n const dismissButton = (showDismissButton ?? null) && (\n <div\n className={styles.dismiss}\n {...(closeAnalyticsAction ? getAnalyticsMetadataAttribute({ action: closeAnalyticsAction }) : {})}\n >\n <InternalButton\n variant=\"icon\"\n formAction=\"none\"\n iconName=\"close\"\n className={styles['dismiss-control']}\n ariaLabel={i18n('dismissAriaLabel', dismissAriaLabel)}\n onClick={() => onDismiss?.()}\n ref={dismissButtonRef}\n />\n </div>\n );\n\n const isDialog = showDismissButton;\n const shouldTrapFocus = showDismissButton && variant !== 'annotation';\n\n const dialogProps = isDialog\n ? {\n role: 'dialog',\n 'aria-labelledby': ariaLabelledby ?? (header ? labelledById : undefined),\n }\n : {};\n\n return (\n <div\n className={clsx(styles.body, styles[`body-variant-${variant}`], className, {\n [styles['body-overflow-visible']]: overflowVisible === 'both',\n })}\n onKeyDown={onKeyDown}\n ref={ref}\n onBlur={onBlur}\n {...dialogProps}\n >\n <BuiltInErrorBoundary>\n <FocusLock disabled={!shouldTrapFocus} autoFocus={false}>\n {header && (\n <div className={clsx(styles['header-row'], showDismissButton && styles['has-dismiss'])}>\n {dismissButton}\n <div className={styles.header} id={labelledById}>\n <h2>{header}</h2>\n </div>\n </div>\n )}\n <div className={!header && showDismissButton ? styles['has-dismiss'] : undefined}>\n {!header && dismissButton}\n <div className={clsx(styles.content, { [styles['content-overflow-visible']]: !!overflowVisible })}>\n {children}\n </div>\n </div>\n </FocusLock>\n </BuiltInErrorBoundary>\n </div>\n );\n }\n);\n\nexport default PopoverBody;\n"]}
@@ -0,0 +1,7 @@
1
+ import PopoverWrapper from '../popover';
2
+ export default class FeaturePromptWrapper extends PopoverWrapper {
3
+ static rootSelector: string;
4
+ findHeader(): import("@cloudscape-design/test-utils-core/dom").ElementWrapper<HTMLElement> | null;
5
+ findContent(): import("@cloudscape-design/test-utils-core/dom").ElementWrapper<HTMLElement> | null;
6
+ findDismissButton(): import("..").ButtonWrapper | null;
7
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ const popover_1 = require("../popover");
6
+ const styles_selectors_js_1 = require("../../../internal/do-not-use/feature-prompt/styles.selectors.js");
7
+ class FeaturePromptWrapper extends popover_1.default {
8
+ findHeader() {
9
+ return super.findHeader({ renderWithPortal: true });
10
+ }
11
+ findContent() {
12
+ return super.findContent({ renderWithPortal: true });
13
+ }
14
+ findDismissButton() {
15
+ return super.findDismissButton({ renderWithPortal: true });
16
+ }
17
+ }
18
+ FeaturePromptWrapper.rootSelector = styles_selectors_js_1.default.root;
19
+ exports.default = FeaturePromptWrapper;
20
+ //# sourceMappingURL=feature-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-prompt.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/internal/feature-prompt.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,wCAAwC;AAExC,yGAAqF;AAErF,MAAqB,oBAAqB,SAAQ,iBAAc;IAG9D,UAAU;QACR,OAAO,KAAK,CAAC,UAAU,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC,WAAW,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,iBAAiB;QACf,OAAO,KAAK,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;;AAZM,iCAAY,GAAW,6BAAM,CAAC,IAAI,CAAC;kBADvB,oBAAoB"}
@@ -0,0 +1,7 @@
1
+ import PopoverWrapper from '../popover';
2
+ export default class FeaturePromptWrapper extends PopoverWrapper {
3
+ static rootSelector: string;
4
+ findHeader(): import("@cloudscape-design/test-utils-core/selectors").ElementWrapper;
5
+ findContent(): import("@cloudscape-design/test-utils-core/selectors").ElementWrapper;
6
+ findDismissButton(): import("..").ButtonWrapper;
7
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ const popover_1 = require("../popover");
6
+ const styles_selectors_js_1 = require("../../../internal/do-not-use/feature-prompt/styles.selectors.js");
7
+ class FeaturePromptWrapper extends popover_1.default {
8
+ findHeader() {
9
+ return super.findHeader({
10
+ renderWithPortal: true
11
+ });
12
+ }
13
+ findContent() {
14
+ return super.findContent({
15
+ renderWithPortal: true
16
+ });
17
+ }
18
+ findDismissButton() {
19
+ return super.findDismissButton({
20
+ renderWithPortal: true
21
+ });
22
+ }
23
+ }
24
+ FeaturePromptWrapper.rootSelector = styles_selectors_js_1.default.root;
25
+ exports.default = FeaturePromptWrapper;
26
+ //# sourceMappingURL=feature-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-prompt.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/internal/feature-prompt.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,wCAAwC;AACxC,yGAAqF;AACrF,MAAqB,oBAAqB,SAAQ,iBAAc;IAE9D,UAAU;QACR,OAAO,KAAK,CAAC,UAAU,CAAC;YACtB,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IACD,WAAW;QACT,OAAO,KAAK,CAAC,WAAW,CAAC;YACvB,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IACD,iBAAiB;QACf,OAAO,KAAK,CAAC,iBAAiB,CAAC;YAC7B,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;;AAfM,iCAAY,GAAW,6BAAM,CAAC,IAAI,CAAC;kBADvB,oBAAoB"}