@cloudscape-design/components-themeable 3.0.1171 → 3.0.1172

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 (89) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/app-layout/styles.scss +0 -1
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/template/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  5. package/lib/internal/template/app-layout/visual-refresh/drawers.js +2 -2
  6. package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
  7. package/lib/internal/template/app-layout/visual-refresh/main.d.ts.map +1 -1
  8. package/lib/internal/template/app-layout/visual-refresh/main.js +1 -3
  9. package/lib/internal/template/app-layout/visual-refresh/main.js.map +1 -1
  10. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
  11. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -2
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.d.ts.map +1 -1
  14. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js +1 -2
  15. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
  16. package/lib/internal/template/container/internal.d.ts +1 -6
  17. package/lib/internal/template/container/internal.d.ts.map +1 -1
  18. package/lib/internal/template/container/internal.js +28 -32
  19. package/lib/internal/template/container/internal.js.map +1 -1
  20. package/lib/internal/template/drawer/implementation.d.ts.map +1 -1
  21. package/lib/internal/template/drawer/implementation.js +3 -5
  22. package/lib/internal/template/drawer/implementation.js.map +1 -1
  23. package/lib/internal/template/form/internal.d.ts.map +1 -1
  24. package/lib/internal/template/form/internal.js +14 -20
  25. package/lib/internal/template/form/internal.js.map +1 -1
  26. package/lib/internal/template/i18n/messages-types.d.ts +4 -5
  27. package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
  28. package/lib/internal/template/i18n/messages-types.js.map +1 -1
  29. package/lib/internal/template/index.d.ts +0 -1
  30. package/lib/internal/template/index.d.ts.map +1 -1
  31. package/lib/internal/template/index.js +0 -1
  32. package/lib/internal/template/index.js.map +1 -1
  33. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  34. package/lib/internal/template/internal/environment.js +2 -2
  35. package/lib/internal/template/internal/environment.json +2 -2
  36. package/lib/internal/template/modal/internal.d.ts.map +1 -1
  37. package/lib/internal/template/modal/internal.js +5 -8
  38. package/lib/internal/template/modal/internal.js.map +1 -1
  39. package/lib/internal/template/package.json +0 -1
  40. package/lib/internal/template/popover/body.d.ts.map +1 -1
  41. package/lib/internal/template/popover/body.js +8 -10
  42. package/lib/internal/template/popover/body.js.map +1 -1
  43. package/lib/internal/template/split-panel/implementation.d.ts.map +1 -1
  44. package/lib/internal/template/split-panel/implementation.js +2 -5
  45. package/lib/internal/template/split-panel/implementation.js.map +1 -1
  46. package/lib/internal/template/tabs/index.d.ts.map +1 -1
  47. package/lib/internal/template/tabs/index.js +1 -1
  48. package/lib/internal/template/tabs/index.js.map +1 -1
  49. package/lib/internal/template/test-utils/dom/index.d.ts +0 -20
  50. package/lib/internal/template/test-utils/dom/index.js +2 -16
  51. package/lib/internal/template/test-utils/dom/index.js.map +1 -1
  52. package/lib/internal/template/test-utils/selectors/index.d.ts +0 -18
  53. package/lib/internal/template/test-utils/selectors/index.js +2 -16
  54. package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/lib/internal/scss/error-boundary/styles.scss +0 -11
  57. package/lib/internal/scss/error-boundary/test-classes/styles.scss +0 -13
  58. package/lib/internal/template/error-boundary/fallback.d.ts +0 -3
  59. package/lib/internal/template/error-boundary/fallback.d.ts.map +0 -1
  60. package/lib/internal/template/error-boundary/fallback.js +0 -61
  61. package/lib/internal/template/error-boundary/fallback.js.map +0 -1
  62. package/lib/internal/template/error-boundary/index.d.ts +0 -5
  63. package/lib/internal/template/error-boundary/index.d.ts.map +0 -1
  64. package/lib/internal/template/error-boundary/index.js +0 -22
  65. package/lib/internal/template/error-boundary/index.js.map +0 -1
  66. package/lib/internal/template/error-boundary/interfaces.d.ts +0 -85
  67. package/lib/internal/template/error-boundary/interfaces.d.ts.map +0 -1
  68. package/lib/internal/template/error-boundary/interfaces.js +0 -4
  69. package/lib/internal/template/error-boundary/interfaces.js.map +0 -1
  70. package/lib/internal/template/error-boundary/internal.d.ts +0 -23
  71. package/lib/internal/template/error-boundary/internal.d.ts.map +0 -1
  72. package/lib/internal/template/error-boundary/internal.js +0 -58
  73. package/lib/internal/template/error-boundary/internal.js.map +0 -1
  74. package/lib/internal/template/error-boundary/styles.css.js +0 -9
  75. package/lib/internal/template/error-boundary/styles.scoped.css +0 -10
  76. package/lib/internal/template/error-boundary/styles.selectors.js +0 -10
  77. package/lib/internal/template/error-boundary/test-classes/styles.css.js +0 -11
  78. package/lib/internal/template/error-boundary/test-classes/styles.scoped.css +0 -12
  79. package/lib/internal/template/error-boundary/test-classes/styles.selectors.js +0 -12
  80. package/lib/internal/template/error-boundary/utils.d.ts +0 -2
  81. package/lib/internal/template/error-boundary/utils.d.ts.map +0 -1
  82. package/lib/internal/template/error-boundary/utils.js +0 -7
  83. package/lib/internal/template/error-boundary/utils.js.map +0 -1
  84. package/lib/internal/template/test-utils/dom/error-boundary/index.d.ts +0 -9
  85. package/lib/internal/template/test-utils/dom/error-boundary/index.js +0 -26
  86. package/lib/internal/template/test-utils/dom/error-boundary/index.js.map +0 -1
  87. package/lib/internal/template/test-utils/selectors/error-boundary/index.d.ts +0 -9
  88. package/lib/internal/template/test-utils/selectors/error-boundary/index.js +0 -26
  89. package/lib/internal/template/test-utils/selectors/error-boundary/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/fallback.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMlD,wBAAgB,qBAAqB,CAAC,EACpC,WAAgB,EAChB,cAAc,GACf,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,aAAa,CAAC,eA2B5D"}
@@ -1,61 +0,0 @@
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 clsx from 'clsx';
5
- import IntlMessageFormat from 'intl-messageformat';
6
- import InternalAlert from '../alert/internal';
7
- import InternalButton from '../button/internal';
8
- import { useInternalI18n } from '../i18n/context';
9
- import { refreshPage } from './utils';
10
- import styles from './styles.css.js';
11
- import testUtilStyles from './test-classes/styles.css.js';
12
- export function ErrorBoundaryFallback({ i18nStrings = {}, renderFallback, }) {
13
- var _a;
14
- const defaultSlots = {
15
- header: (React.createElement("div", { className: clsx(styles.header, testUtilStyles.header) },
16
- React.createElement(DefaultHeaderContent, { i18nStrings: i18nStrings }))),
17
- description: (React.createElement("div", { className: clsx(styles.description, testUtilStyles.description) },
18
- React.createElement(DefaultDescriptionContent, { i18nStrings: i18nStrings }))),
19
- action: (React.createElement("div", { className: clsx(styles.action, testUtilStyles.action) },
20
- React.createElement(DefaultActionContent, { i18nStrings: i18nStrings }))),
21
- };
22
- return (React.createElement("div", { className: testUtilStyles.fallback }, (_a = renderFallback === null || renderFallback === void 0 ? void 0 : renderFallback(defaultSlots)) !== null && _a !== void 0 ? _a : (React.createElement(InternalAlert, { type: "error", header: defaultSlots.header, action: defaultSlots.action }, defaultSlots.description))));
23
- }
24
- function DefaultHeaderContent({ i18nStrings }) {
25
- const i18n = useInternalI18n('error-boundary');
26
- return React.createElement(React.Fragment, null, i18n('i18nStrings.headerText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.headerText));
27
- }
28
- function DefaultDescriptionContent({ i18nStrings: { descriptionText, components: { Feedback } = {} } = {}, }) {
29
- const i18n = useInternalI18n('error-boundary');
30
- // Dependencies for the intl-format function, where the pseudo-tags are declared as functions from parsed chunks.
31
- const formatArgs = Feedback
32
- ? {
33
- hasFeedback: true,
34
- Feedback: (chunks) => {
35
- var _a;
36
- return (React.createElement("span", { className: testUtilStyles['feedback-action'] },
37
- React.createElement(Feedback, null, (_a = chunks[0]) !== null && _a !== void 0 ? _a : '')));
38
- },
39
- }
40
- : { hasFeedback: false, Feedback: () => React.createElement(React.Fragment, null) };
41
- // This ensures that the description string provided via i18nStrings also supports the <Feedback> injection,
42
- // because the i18n() helper propagates the second argument as is, without applying intl-format to it.
43
- // We wrap the format with try-catch to avoid intl errors caused by incorrectly referenced components.
44
- function safeFormat(descriptionText) {
45
- try {
46
- return descriptionText ? new IntlMessageFormat(descriptionText).format(formatArgs) : undefined;
47
- }
48
- catch {
49
- return descriptionText;
50
- }
51
- }
52
- const message = i18n('i18nStrings.descriptionText', safeFormat(descriptionText), format => format(formatArgs));
53
- // When the description includes <Feedback>, then the translated message is represented as an array of strings and
54
- // React elements that require keys when rendering to avoid React warnings.
55
- return (React.createElement(React.Fragment, null, Array.isArray(message) ? message.map((chunk, i) => React.createElement(React.Fragment, { key: i }, chunk)) : message));
56
- }
57
- function DefaultActionContent({ i18nStrings }) {
58
- const i18n = useInternalI18n('error-boundary');
59
- return (React.createElement(InternalButton, { iconName: "refresh", onClick: refreshPage, className: testUtilStyles['refresh-action'] }, i18n('i18nStrings.refreshActionText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.refreshActionText)));
60
- }
61
- //# sourceMappingURL=fallback.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../src/error-boundary/fallback.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAEnD,OAA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AC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,CAAC,IAAG,KAAK,CAAkB,CAAC,CAAC,CAAC,CAAC,OAAO,CAC9G,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,EAAE,WAAW,EAAoD;IAC7F,MAAM,IAAI,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC/C,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAC,SAAS,EAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,CAAC,gBAAgB,CAAC,IACjG,IAAI,CAAC,+BAA+B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,iBAAiB,CAAC,CACvD,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport clsx from 'clsx';\nimport IntlMessageFormat from 'intl-messageformat';\n\nimport InternalAlert from '../alert/internal';\nimport InternalButton from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { ErrorBoundaryProps } from './interfaces';\nimport { refreshPage } from './utils';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport function ErrorBoundaryFallback({\n i18nStrings = {},\n renderFallback,\n}: Pick<ErrorBoundaryProps, 'renderFallback' | 'i18nStrings'>) {\n const defaultSlots = {\n header: (\n <div className={clsx(styles.header, testUtilStyles.header)}>\n <DefaultHeaderContent i18nStrings={i18nStrings} />\n </div>\n ),\n description: (\n <div className={clsx(styles.description, testUtilStyles.description)}>\n <DefaultDescriptionContent i18nStrings={i18nStrings} />\n </div>\n ),\n action: (\n <div className={clsx(styles.action, testUtilStyles.action)}>\n <DefaultActionContent i18nStrings={i18nStrings} />\n </div>\n ),\n };\n return (\n <div className={testUtilStyles.fallback}>\n {renderFallback?.(defaultSlots) ?? (\n <InternalAlert type=\"error\" header={defaultSlots.header} action={defaultSlots.action}>\n {defaultSlots.description}\n </InternalAlert>\n )}\n </div>\n );\n}\n\nfunction DefaultHeaderContent({ i18nStrings }: { i18nStrings: ErrorBoundaryProps.I18nStrings }) {\n const i18n = useInternalI18n('error-boundary');\n return <>{i18n('i18nStrings.headerText', i18nStrings?.headerText)}</>;\n}\n\nfunction DefaultDescriptionContent({\n i18nStrings: { descriptionText, components: { Feedback } = {} } = {},\n}: {\n i18nStrings: ErrorBoundaryProps.I18nStrings;\n}) {\n const i18n = useInternalI18n('error-boundary');\n\n // Dependencies for the intl-format function, where the pseudo-tags are declared as functions from parsed chunks.\n const formatArgs = Feedback\n ? {\n hasFeedback: true,\n Feedback: (chunks: React.ReactNode[]) => (\n <span className={testUtilStyles['feedback-action']}>\n <Feedback>{chunks[0] ?? ''}</Feedback>\n </span>\n ),\n }\n : { hasFeedback: false, Feedback: () => <></> };\n\n // This ensures that the description string provided via i18nStrings also supports the <Feedback> injection,\n // because the i18n() helper propagates the second argument as is, without applying intl-format to it.\n // We wrap the format with try-catch to avoid intl errors caused by incorrectly referenced components.\n function safeFormat(descriptionText?: string) {\n try {\n return descriptionText ? new IntlMessageFormat(descriptionText).format(formatArgs) : undefined;\n } catch {\n return descriptionText;\n }\n }\n const message = i18n('i18nStrings.descriptionText', safeFormat(descriptionText), format => format(formatArgs));\n\n // When the description includes <Feedback>, then the translated message is represented as an array of strings and\n // React elements that require keys when rendering to avoid React warnings.\n return (\n <>\n {Array.isArray(message) ? message.map((chunk, i) => <React.Fragment key={i}>{chunk}</React.Fragment>) : message}\n </>\n );\n}\n\nfunction DefaultActionContent({ i18nStrings }: { i18nStrings?: ErrorBoundaryProps.I18nStrings }) {\n const i18n = useInternalI18n('error-boundary');\n return (\n <InternalButton iconName=\"refresh\" onClick={refreshPage} className={testUtilStyles['refresh-action']}>\n {i18n('i18nStrings.refreshActionText', i18nStrings?.refreshActionText)}\n </InternalButton>\n );\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { ErrorBoundaryProps } from './interfaces';
2
- export { ErrorBoundaryProps };
3
- declare function ErrorBoundary({ suppressNested, ...props }: ErrorBoundaryProps): JSX.Element;
4
- export default ErrorBoundary;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,iBAAS,aAAa,CAAC,EAAE,cAAsB,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,eAU9E;AAID,eAAe,aAAa,CAAC"}
@@ -1,22 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- 'use client';
4
- import React from 'react';
5
- import useBaseComponent from '../internal/hooks/use-base-component';
6
- import { applyDisplayName } from '../internal/utils/apply-display-name';
7
- import { InternalErrorBoundary } from './internal';
8
- function ErrorBoundary({ suppressNested = false, ...props }) {
9
- var _a, _b;
10
- const baseComponentProps = useBaseComponent('ErrorBoundary', {
11
- props: { suppressNested },
12
- metadata: {
13
- hasBoundaryId: !!props.errorBoundaryId,
14
- hasFeedbackAction: !!((_b = (_a = props.i18nStrings) === null || _a === void 0 ? void 0 : _a.components) === null || _b === void 0 ? void 0 : _b.Feedback),
15
- hasRenderFallback: !!props.renderFallback,
16
- },
17
- });
18
- return React.createElement(InternalErrorBoundary, { ...baseComponentProps, ...props, suppressNested: suppressNested });
19
- }
20
- applyDisplayName(ErrorBoundary, 'ErrorBoundary');
21
- export default ErrorBoundary;
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/error-boundary/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAInD,SAAS,aAAa,CAAC,EAAE,cAAc,GAAG,KAAK,EAAE,GAAG,KAAK,EAAsB;;IAC7E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,eAAe,EAAE;QAC3D,KAAK,EAAE,EAAE,cAAc,EAAE;QACzB,QAAQ,EAAE;YACR,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe;YACtC,iBAAiB,EAAE,CAAC,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,WAAW,0CAAE,UAAU,0CAAE,QAAQ,CAAA;YAC5D,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc;SAC1C;KACF,CAAC,CAAC;IACH,OAAO,oBAAC,qBAAqB,OAAK,kBAAkB,KAAM,KAAK,EAAE,cAAc,EAAE,cAAc,GAAI,CAAC;AACtG,CAAC;AAED,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAEjD,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ErrorBoundaryProps } from './interfaces';\nimport { InternalErrorBoundary } from './internal';\n\nexport { ErrorBoundaryProps };\n\nfunction ErrorBoundary({ suppressNested = false, ...props }: ErrorBoundaryProps) {\n const baseComponentProps = useBaseComponent('ErrorBoundary', {\n props: { suppressNested },\n metadata: {\n hasBoundaryId: !!props.errorBoundaryId,\n hasFeedbackAction: !!props.i18nStrings?.components?.Feedback,\n hasRenderFallback: !!props.renderFallback,\n },\n });\n return <InternalErrorBoundary {...baseComponentProps} {...props} suppressNested={suppressNested} />;\n}\n\napplyDisplayName(ErrorBoundary, 'ErrorBoundary');\n\nexport default ErrorBoundary;\n"]}
@@ -1,85 +0,0 @@
1
- import { ErrorInfo } from 'react';
2
- export interface ErrorBoundaryProps {
3
- /**
4
- * Optional identifier for the error boundary instance.
5
- *
6
- * When provided, the identifier is included in the `onError` callback payload.
7
- * In the rendered output, the boundary wraps its content in a `<div>` with the
8
- * attribute `data-awsui-boundary-id={errorBoundaryId}` to support debugging.
9
- */
10
- errorBoundaryId?: string;
11
- /**
12
- * Callback invoked when an error is intercepted by the boundary.
13
- * Use this function to record, log, or report errors (for example, to telemetry or monitoring systems).
14
- *
15
- * The callback receives a `detail` object containing:
16
- * * `error` (Error): The thrown error instance.
17
- * * `errorInfo` (React.ErrorInfo): Additional metadata captured by React.
18
- * * `errorBoundaryId` (optional, string): The boundary identifier, if defined.
19
- */
20
- onError: (detail: ErrorBoundaryProps.OnErrorDetail) => void;
21
- /**
22
- * Controls how nested error boundaries behave.
23
- *
24
- * Several components—such as app layout, container, and modal include built-in
25
- * error boundaries. These boundaries activate automatically when they detect
26
- * an ancestor boundary, inheriting configuration from the closest one.
27
- *
28
- * When `suppressNested` is set to `true`, nested built-in or standalone
29
- * boundaries are disabled. In this mode, all errors originating from within
30
- * the boundary’s content are captured exclusively by this boundary.
31
- */
32
- suppressNested?: boolean;
33
- /**
34
- * Optional custom renderer for the fallback UI displayed when an error occurs.
35
- *
36
- * The function receives the default slots derived from i18n configuration:
37
- * * `header` (ReactNode): The fallback header text.
38
- * * `description` (ReactNode): The fallback description text.
39
- * * `action` (ReactNode): The fallback action element (a refresh button by default).
40
- *
41
- * Return a React node to fully override the default fallback presentation.
42
- */
43
- renderFallback?: (props: ErrorBoundaryProps.FallbackProps) => React.ReactNode;
44
- /**
45
- * Localized strings and components used in the fallback UI.
46
- *
47
- * * `headerText` (string): Header text displayed in the fallback view.
48
- * * `descriptionText` (string): Description text displayed in the fallback view. Supports embedding inline
49
- * feedback actions by including `<Feedback>` pseudo-tags when `components.Feedback` is provided.
50
- * * `refreshActionText` (string): Text for the default refresh action button.
51
- * * `components.Feedback` (React.ComponentType<I18nFeedbackProps>): A component used to render
52
- * inline feedback actions within the description text.
53
- *
54
- * @i18n
55
- */
56
- i18nStrings?: ErrorBoundaryProps.I18nStrings;
57
- /**
58
- * Child content rendered when no error has been captured.
59
- */
60
- children: React.ReactNode;
61
- }
62
- export declare namespace ErrorBoundaryProps {
63
- interface FallbackProps {
64
- header?: React.ReactNode;
65
- description?: React.ReactNode;
66
- action?: React.ReactNode;
67
- }
68
- interface I18nStrings {
69
- headerText?: string;
70
- descriptionText?: string;
71
- refreshActionText?: string;
72
- components?: {
73
- Feedback?: React.ComponentType<I18nFeedbackProps>;
74
- };
75
- }
76
- interface I18nFeedbackProps {
77
- children: React.ReactNode;
78
- }
79
- interface OnErrorDetail {
80
- error: Error;
81
- errorInfo: ErrorInfo;
82
- errorBoundaryId?: string;
83
- }
84
- }
85
- //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;OAQG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,aAAa,KAAK,IAAI,CAAC;IAE5D;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,aAAa,KAAK,KAAK,CAAC,SAAS,CAAC;IAE9E;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,yBAAiB,kBAAkB,CAAC;IAClC,UAAiB,aAAa;QAC5B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KAC1B;IAED,UAAiB,WAAW;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE;YACX,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;SACnD,CAAC;KACH;IAED,UAAiB,iBAAiB;QAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;KAC3B;IAED,UAAiB,aAAa;QAC5B,KAAK,EAAE,KAAK,CAAC;QACb,SAAS,EAAE,SAAS,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;CACF"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/error-boundary/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 { ErrorInfo } from 'react';\n\nexport interface ErrorBoundaryProps {\n /**\n * Optional identifier for the error boundary instance.\n *\n * When provided, the identifier is included in the `onError` callback payload.\n * In the rendered output, the boundary wraps its content in a `<div>` with the\n * attribute `data-awsui-boundary-id={errorBoundaryId}` to support debugging.\n */\n errorBoundaryId?: string;\n\n /**\n * Callback invoked when an error is intercepted by the boundary.\n * Use this function to record, log, or report errors (for example, to telemetry or monitoring systems).\n *\n * The callback receives a `detail` object containing:\n * * `error` (Error): The thrown error instance.\n * * `errorInfo` (React.ErrorInfo): Additional metadata captured by React.\n * * `errorBoundaryId` (optional, string): The boundary identifier, if defined.\n */\n onError: (detail: ErrorBoundaryProps.OnErrorDetail) => void;\n\n /**\n * Controls how nested error boundaries behave.\n *\n * Several components—such as app layout, container, and modal include built-in\n * error boundaries. These boundaries activate automatically when they detect\n * an ancestor boundary, inheriting configuration from the closest one.\n *\n * When `suppressNested` is set to `true`, nested built-in or standalone\n * boundaries are disabled. In this mode, all errors originating from within\n * the boundary’s content are captured exclusively by this boundary.\n */\n suppressNested?: boolean;\n\n /**\n * Optional custom renderer for the fallback UI displayed when an error occurs.\n *\n * The function receives the default slots derived from i18n configuration:\n * * `header` (ReactNode): The fallback header text.\n * * `description` (ReactNode): The fallback description text.\n * * `action` (ReactNode): The fallback action element (a refresh button by default).\n *\n * Return a React node to fully override the default fallback presentation.\n */\n renderFallback?: (props: ErrorBoundaryProps.FallbackProps) => React.ReactNode;\n\n /**\n * Localized strings and components used in the fallback UI.\n *\n * * `headerText` (string): Header text displayed in the fallback view.\n * * `descriptionText` (string): Description text displayed in the fallback view. Supports embedding inline\n * feedback actions by including `<Feedback>` pseudo-tags when `components.Feedback` is provided.\n * * `refreshActionText` (string): Text for the default refresh action button.\n * * `components.Feedback` (React.ComponentType<I18nFeedbackProps>): A component used to render\n * inline feedback actions within the description text.\n *\n * @i18n\n */\n i18nStrings?: ErrorBoundaryProps.I18nStrings;\n\n /**\n * Child content rendered when no error has been captured.\n */\n children: React.ReactNode;\n}\n\nexport namespace ErrorBoundaryProps {\n export interface FallbackProps {\n header?: React.ReactNode;\n description?: React.ReactNode;\n action?: React.ReactNode;\n }\n\n export interface I18nStrings {\n headerText?: string;\n descriptionText?: string;\n refreshActionText?: string;\n components?: {\n Feedback?: React.ComponentType<I18nFeedbackProps>;\n };\n }\n\n export interface I18nFeedbackProps {\n children: React.ReactNode;\n }\n\n export interface OnErrorDetail {\n error: Error;\n errorInfo: ErrorInfo;\n errorBoundaryId?: string;\n }\n}\n"]}
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
- import { SomeRequired } from '../internal/types';
4
- import { ErrorBoundaryProps } from './interfaces';
5
- declare global {
6
- interface HTMLElement {
7
- __awsui__?: {
8
- forceError?(): void;
9
- clearForcedError?(): void;
10
- };
11
- }
12
- }
13
- interface InternalErrorBoundaryProps extends SomeRequired<ErrorBoundaryProps, 'suppressNested'>, InternalBaseComponentProps {
14
- }
15
- export declare function InternalErrorBoundary({ children, suppressNested, __internalRootRef, ...props }: InternalErrorBoundaryProps): JSX.Element;
16
- interface BuiltInErrorBoundaryProps {
17
- children: React.ReactNode;
18
- wrapper?: (content: React.ReactNode) => React.ReactNode;
19
- suppressNested?: boolean;
20
- }
21
- export declare function BuiltInErrorBoundary({ wrapper, suppressNested, children }: BuiltInErrorBoundaryProps): JSX.Element;
22
- export {};
23
- //# sourceMappingURL=internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,SAAS,CAAC,EAAE;YAAE,UAAU,CAAC,IAAI,IAAI,CAAC;YAAC,gBAAgB,CAAC,IAAI,IAAI,CAAA;SAAE,CAAC;KAChE;CACF;AAaD,UAAU,0BACR,SAAQ,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACxD,0BAA0B;CAAG;AAEjC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,0BAA0B,eA8B5B;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC;IACxD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,cAAsB,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAa5G"}
@@ -1,58 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import React, { Component, createContext, useContext, useState } from 'react';
4
- import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
5
- import { ErrorBoundaryFallback } from './fallback';
6
- import styles from './styles.css.js';
7
- const RootSuppressed = Symbol();
8
- const ErrorBoundariesContext = createContext({
9
- onError: () => { },
10
- suppressed: RootSuppressed,
11
- });
12
- export function InternalErrorBoundary({ children, suppressNested, __internalRootRef, ...props }) {
13
- const context = useContext(ErrorBoundariesContext);
14
- const thisSuppressed = context.suppressed === true;
15
- const nextSuppressed = suppressNested || thisSuppressed;
16
- const [forcedError, setForcedError] = useState(false);
17
- const setElement = (node) => {
18
- if (node) {
19
- if (!node.__awsui__) {
20
- node.__awsui__ = {};
21
- }
22
- node.__awsui__.forceError = () => setForcedError(true);
23
- node.__awsui__.clearForcedError = () => setForcedError(false);
24
- }
25
- };
26
- const mergedRef = useMergeRefs(setElement, __internalRootRef);
27
- return (React.createElement("div", { ref: mergedRef, className: styles['error-boundary'], "data-awsui-boundary-id": props.errorBoundaryId }, !thisSuppressed ? (React.createElement(ErrorBoundaryImpl, { ...props, forcedError: forcedError },
28
- React.createElement(ErrorBoundariesContext.Provider, { value: { ...props, suppressed: nextSuppressed } }, children))) : (React.createElement(React.Fragment, null, children))));
29
- }
30
- export function BuiltInErrorBoundary({ wrapper, suppressNested = false, children }) {
31
- const context = useContext(ErrorBoundariesContext);
32
- const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;
33
- const nextSuppressed = suppressNested || thisSuppressed;
34
- return !thisSuppressed ? (React.createElement(ErrorBoundaryImpl, { ...context, wrapper: wrapper },
35
- React.createElement(ErrorBoundariesContext.Provider, { value: { ...context, suppressed: nextSuppressed } }, children))) : (React.createElement(React.Fragment, null, children));
36
- }
37
- class ErrorBoundaryImpl extends Component {
38
- constructor(props) {
39
- super(props);
40
- this.state = { hasError: false };
41
- }
42
- static getDerivedStateFromError() {
43
- return { hasError: true };
44
- }
45
- componentDidCatch(error, errorInfo) {
46
- var _a, _b;
47
- (_b = (_a = this.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, { error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });
48
- }
49
- render() {
50
- var _a, _b, _c;
51
- if (this.state.hasError || this.props.forcedError) {
52
- const fallback = React.createElement(ErrorBoundaryFallback, { ...this.props });
53
- return (_c = (_b = (_a = this.props).wrapper) === null || _b === void 0 ? void 0 : _b.call(_a, fallback)) !== null && _c !== void 0 ? _c : fallback;
54
- }
55
- return this.props.children;
56
- }
57
- }
58
- //# sourceMappingURL=internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAI7E,OAAO,EAAE,qBAAq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eAAe,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM;;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAG,oBAAC,qBAAqB,OAAK,IAAI,CAAC,KAAK,GAAI,CAAC;YAC3D,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,OAAO,mDAAG,QAAQ,CAAC,mCAAI,QAAQ,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Component, createContext, useContext, useState } from 'react';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\nimport { ErrorBoundaryFallback } from './fallback';\nimport { ErrorBoundaryProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\n// Helper methods attached to the component's root node for e2e testing.\ndeclare global {\n interface HTMLElement {\n __awsui__?: { forceError?(): void; clearForcedError?(): void };\n }\n}\n\nconst RootSuppressed = Symbol();\n\nconst ErrorBoundariesContext = createContext<\n Pick<ErrorBoundaryProps, 'renderFallback' | 'i18nStrings' | 'onError' | 'errorBoundaryId'> & {\n suppressed: boolean | typeof RootSuppressed;\n }\n>({\n onError: () => {},\n suppressed: RootSuppressed,\n});\n\ninterface InternalErrorBoundaryProps\n extends SomeRequired<ErrorBoundaryProps, 'suppressNested'>,\n InternalBaseComponentProps {}\n\nexport function InternalErrorBoundary({\n children,\n suppressNested,\n __internalRootRef,\n ...props\n}: InternalErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true;\n const nextSuppressed = suppressNested || thisSuppressed;\n\n const [forcedError, setForcedError] = useState(false);\n const setElement = (node: null | HTMLDivElement) => {\n if (node) {\n if (!node.__awsui__) {\n node.__awsui__ = {};\n }\n node.__awsui__.forceError = () => setForcedError(true);\n node.__awsui__.clearForcedError = () => setForcedError(false);\n }\n };\n const mergedRef = useMergeRefs(setElement, __internalRootRef);\n\n return (\n <div ref={mergedRef} className={styles['error-boundary']} data-awsui-boundary-id={props.errorBoundaryId}>\n {!thisSuppressed ? (\n <ErrorBoundaryImpl {...props} forcedError={forcedError}>\n <ErrorBoundariesContext.Provider value={{ ...props, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n )}\n </div>\n );\n}\n\ninterface BuiltInErrorBoundaryProps {\n children: React.ReactNode;\n wrapper?: (content: React.ReactNode) => React.ReactNode;\n suppressNested?: boolean;\n}\n\nexport function BuiltInErrorBoundary({ wrapper, suppressNested = false, children }: BuiltInErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;\n const nextSuppressed = suppressNested || thisSuppressed;\n return !thisSuppressed ? (\n <ErrorBoundaryImpl {...context} wrapper={wrapper}>\n <ErrorBoundariesContext.Provider value={{ ...context, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n );\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\ninterface ErrorBoundaryImplProps extends ErrorBoundaryProps {\n wrapper?: (content: React.ReactNode) => React.ReactNode;\n forcedError?: boolean;\n}\n\nclass ErrorBoundaryImpl extends Component<ErrorBoundaryImplProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryImplProps) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n this.props.onError?.({ error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });\n }\n\n render() {\n if (this.state.hasError || this.props.forcedError) {\n const fallback = <ErrorBoundaryFallback {...this.props} />;\n return this.props.wrapper?.(fallback) ?? fallback;\n }\n return this.props.children;\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
-
2
- import './styles.scoped.css';
3
- export default {
4
- "error-boundary": "awsui_error-boundary_9pwoq_r5exj_5",
5
- "header": "awsui_header_9pwoq_r5exj_6",
6
- "description": "awsui_description_9pwoq_r5exj_7",
7
- "action": "awsui_action_9pwoq_r5exj_8"
8
- };
9
-
@@ -1,10 +0,0 @@
1
- /*
2
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
- .awsui_error-boundary_9pwoq_r5exj_5:not(#\9),
6
- .awsui_header_9pwoq_r5exj_6:not(#\9),
7
- .awsui_description_9pwoq_r5exj_7:not(#\9),
8
- .awsui_action_9pwoq_r5exj_8:not(#\9) {
9
- display: contents;
10
- }
@@ -1,10 +0,0 @@
1
-
2
- // es-module interop with Babel and Typescript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- module.exports.default = {
5
- "error-boundary": "awsui_error-boundary_9pwoq_r5exj_5",
6
- "header": "awsui_header_9pwoq_r5exj_6",
7
- "description": "awsui_description_9pwoq_r5exj_7",
8
- "action": "awsui_action_9pwoq_r5exj_8"
9
- };
10
-
@@ -1,11 +0,0 @@
1
-
2
- import './styles.scoped.css';
3
- export default {
4
- "fallback": "awsui_fallback_11u4a_1e43p_5",
5
- "feedback-action": "awsui_feedback-action_11u4a_1e43p_6",
6
- "refresh-action": "awsui_refresh-action_11u4a_1e43p_7",
7
- "header": "awsui_header_11u4a_1e43p_8",
8
- "description": "awsui_description_11u4a_1e43p_9",
9
- "action": "awsui_action_11u4a_1e43p_10"
10
- };
11
-
@@ -1,12 +0,0 @@
1
- /*
2
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
- .awsui_fallback_11u4a_1e43p_5:not(#\9),
6
- .awsui_feedback-action_11u4a_1e43p_6:not(#\9),
7
- .awsui_refresh-action_11u4a_1e43p_7:not(#\9),
8
- .awsui_header_11u4a_1e43p_8:not(#\9),
9
- .awsui_description_11u4a_1e43p_9:not(#\9),
10
- .awsui_action_11u4a_1e43p_10:not(#\9) {
11
- /* used in test-utils */
12
- }
@@ -1,12 +0,0 @@
1
-
2
- // es-module interop with Babel and Typescript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- module.exports.default = {
5
- "fallback": "awsui_fallback_11u4a_1e43p_5",
6
- "feedback-action": "awsui_feedback-action_11u4a_1e43p_6",
7
- "refresh-action": "awsui_refresh-action_11u4a_1e43p_7",
8
- "header": "awsui_header_11u4a_1e43p_8",
9
- "description": "awsui_description_11u4a_1e43p_9",
10
- "action": "awsui_action_11u4a_1e43p_10"
11
- };
12
-
@@ -1,2 +0,0 @@
1
- export declare function refreshPage(): void;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/utils.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,SAE1B"}
@@ -1,7 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- /* istanbul ignore next */
4
- export function refreshPage() {
5
- window.location.reload();
6
- }
7
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/error-boundary/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,0BAA0B;AAC1B,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* istanbul ignore next */\nexport function refreshPage() {\n window.location.reload();\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom';
2
- export default class ErrorBoundaryWrapper extends ComponentWrapper<HTMLButtonElement> {
3
- static rootSelector: string;
4
- findHeader(): ElementWrapper;
5
- findDescription(): ElementWrapper;
6
- findAction(): null | ElementWrapper;
7
- findFeedbackAction(): null | ElementWrapper;
8
- findRefreshAction(): null | ElementWrapper;
9
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const dom_1 = require("@cloudscape-design/test-utils-core/dom");
6
- const styles_selectors_js_1 = require("../../../error-boundary/test-classes/styles.selectors.js");
7
- class ErrorBoundaryWrapper extends dom_1.ComponentWrapper {
8
- findHeader() {
9
- return this.findByClassName(styles_selectors_js_1.default.header);
10
- }
11
- findDescription() {
12
- return this.findByClassName(styles_selectors_js_1.default.description);
13
- }
14
- findAction() {
15
- return this.findByClassName(styles_selectors_js_1.default.action);
16
- }
17
- findFeedbackAction() {
18
- return this.findByClassName(styles_selectors_js_1.default['feedback-action']);
19
- }
20
- findRefreshAction() {
21
- return this.findByClassName(styles_selectors_js_1.default['refresh-action']);
22
- }
23
- }
24
- ErrorBoundaryWrapper.rootSelector = styles_selectors_js_1.default.fallback;
25
- exports.default = ErrorBoundaryWrapper;
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/error-boundary/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,gEAA0F;AAE1F,kGAAmF;AAEnF,MAAqB,oBAAqB,SAAQ,sBAAmC;IAGnF,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,MAAM,CAAE,CAAC;IACnD,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,WAAW,CAAE,CAAC;IACxD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC7D,CAAC;;AApBM,iCAAY,GAAW,6BAAW,CAAC,QAAQ,CAAC;kBADhC,oBAAoB"}
@@ -1,9 +0,0 @@
1
- import { ComponentWrapper, ElementWrapper } from "@cloudscape-design/test-utils-core/selectors";
2
- export default class ErrorBoundaryWrapper extends ComponentWrapper {
3
- static rootSelector: string;
4
- findHeader(): ElementWrapper;
5
- findDescription(): ElementWrapper;
6
- findAction(): ElementWrapper;
7
- findFeedbackAction(): ElementWrapper;
8
- findRefreshAction(): ElementWrapper;
9
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const selectors_1 = require("@cloudscape-design/test-utils-core/selectors");
6
- const styles_selectors_js_1 = require("../../../error-boundary/test-classes/styles.selectors.js");
7
- class ErrorBoundaryWrapper extends selectors_1.ComponentWrapper {
8
- findHeader() {
9
- return this.findByClassName(styles_selectors_js_1.default.header);
10
- }
11
- findDescription() {
12
- return this.findByClassName(styles_selectors_js_1.default.description);
13
- }
14
- findAction() {
15
- return this.findByClassName(styles_selectors_js_1.default.action);
16
- }
17
- findFeedbackAction() {
18
- return this.findByClassName(styles_selectors_js_1.default['feedback-action']);
19
- }
20
- findRefreshAction() {
21
- return this.findByClassName(styles_selectors_js_1.default['refresh-action']);
22
- }
23
- }
24
- ErrorBoundaryWrapper.rootSelector = styles_selectors_js_1.default.fallback;
25
- exports.default = ErrorBoundaryWrapper;
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/error-boundary/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,4EAAgG;AAChG,kGAAmF;AACnF,MAAqB,oBAAqB,SAAQ,4BAAgB;IAEhE,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,MAAM,CAAE,CAAC;IACnD,CAAC;IACD,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,WAAW,CAAE,CAAC;IACxD,CAAC;IACD,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IACD,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,iBAAiB;QACf,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC7D,CAAC;;AAfM,iCAAY,GAAW,6BAAW,CAAC,QAAQ,CAAC;kBADhC,oBAAoB"}