@cloudscape-design/components 3.0.747 → 3.0.749
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/actions-wrapper/index.d.ts +1 -1
- package/alert/actions-wrapper/index.d.ts.map +1 -1
- package/alert/actions-wrapper/index.js +2 -2
- package/alert/actions-wrapper/index.js.map +1 -1
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +15 -5
- package/alert/internal.js.map +1 -1
- package/alert/styles.css.js +27 -25
- package/alert/styles.scoped.css +45 -39
- package/alert/styles.selectors.js +27 -25
- package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +12 -12
- package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +15 -15
- package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +12 -12
- package/breadcrumb-group/implementation.d.ts.map +1 -1
- package/breadcrumb-group/implementation.js +1 -1
- package/breadcrumb-group/implementation.js.map +1 -1
- package/breadcrumb-group/interfaces.d.ts +1 -1
- package/breadcrumb-group/interfaces.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +7 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +2 -2
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.d.ts +1 -1
- package/button-dropdown/item-element/index.d.ts.map +1 -1
- package/button-dropdown/item-element/index.js +4 -4
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/item-element/styles.css.js +13 -12
- package/button-dropdown/item-element/styles.scoped.css +52 -14
- package/button-dropdown/item-element/styles.selectors.js +13 -12
- package/button-dropdown/items-list.d.ts +1 -1
- package/button-dropdown/items-list.d.ts.map +1 -1
- package/button-dropdown/items-list.js +2 -2
- package/button-dropdown/items-list.js.map +1 -1
- package/flashbar/analytics-metadata/interfaces.d.ts +36 -0
- package/flashbar/analytics-metadata/interfaces.d.ts.map +1 -0
- package/flashbar/analytics-metadata/interfaces.js +4 -0
- package/flashbar/analytics-metadata/interfaces.js.map +1 -0
- package/flashbar/analytics-metadata/styles.css.js +6 -0
- package/flashbar/analytics-metadata/styles.scoped.css +7 -0
- package/flashbar/analytics-metadata/styles.selectors.js +7 -0
- package/flashbar/analytics-metadata/utils.d.ts +7 -0
- package/flashbar/analytics-metadata/utils.d.ts.map +1 -0
- package/flashbar/analytics-metadata/utils.js +33 -0
- package/flashbar/analytics-metadata/utils.js.map +1 -0
- package/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/collapsible-flashbar.js +13 -5
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +19 -7
- package/flashbar/flash.js.map +1 -1
- package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/non-collapsible-flashbar.js +4 -2
- package/flashbar/non-collapsible-flashbar.js.map +1 -1
- package/flashbar/styles.css.js +50 -47
- package/flashbar/styles.scoped.css +152 -146
- package/flashbar/styles.selectors.js +50 -47
- package/internal/components/tooltip/index.d.ts +3 -1
- package/internal/components/tooltip/index.d.ts.map +1 -1
- package/internal/components/tooltip/index.js +2 -2
- package/internal/components/tooltip/index.js.map +1 -1
- package/internal/components/tooltip/registry.d.ts +4 -0
- package/internal/components/tooltip/registry.d.ts.map +1 -0
- package/internal/components/tooltip/registry.js +28 -0
- package/internal/components/tooltip/registry.js.map +1 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/api.d.ts +9 -0
- package/internal/plugins/api.d.ts.map +1 -1
- package/internal/plugins/api.js +7 -0
- package/internal/plugins/api.js.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.d.ts +46 -0
- package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -0
- package/internal/plugins/controllers/alert-flash-content.js +59 -0
- package/internal/plugins/controllers/alert-flash-content.js.map +1 -0
- package/internal/plugins/helpers/index.d.ts +1 -0
- package/internal/plugins/helpers/index.d.ts.map +1 -1
- package/internal/plugins/helpers/index.js +1 -0
- package/internal/plugins/helpers/index.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-action.d.ts +2 -2
- package/internal/plugins/helpers/use-discovered-action.d.ts.map +1 -1
- package/internal/plugins/helpers/use-discovered-action.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.d.ts +15 -0
- package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -0
- package/internal/plugins/helpers/use-discovered-content.js +82 -0
- package/internal/plugins/helpers/use-discovered-content.js.map +1 -0
- package/link/internal.js +1 -1
- package/link/internal.js.map +1 -1
- package/package.json +1 -1
- package/property-filter/styles.css.js +38 -38
- package/property-filter/styles.scoped.css +40 -44
- package/property-filter/styles.selectors.js +38 -38
- package/side-navigation/implementation.d.ts +1 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +2 -1
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/interfaces.d.ts +4 -0
- package/side-navigation/interfaces.d.ts.map +1 -1
- package/side-navigation/interfaces.js.map +1 -1
- package/side-navigation/styles.css.js +30 -29
- package/side-navigation/styles.scoped.css +46 -41
- package/side-navigation/styles.selectors.js +30 -29
- package/table/expandable-rows/expand-toggle-button.d.ts.map +1 -1
- package/table/expandable-rows/expand-toggle-button.js +1 -1
- package/table/expandable-rows/expand-toggle-button.js.map +1 -1
- package/test-utils/dom/side-navigation/index.d.ts +1 -0
- package/test-utils/dom/side-navigation/index.js +3 -0
- package/test-utils/dom/side-navigation/index.js.map +1 -1
- package/test-utils/selectors/side-navigation/index.d.ts +1 -0
- package/test-utils/selectors/side-navigation/index.js +3 -0
- package/test-utils/selectors/side-navigation/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
|
@@ -2,52 +2,55 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"flash-with-motion": "awsui_flash-with-
|
|
6
|
-
"enter": "
|
|
7
|
-
"flash-body": "awsui_flash-
|
|
8
|
-
"flash-message": "awsui_flash-
|
|
9
|
-
"flash-header": "awsui_flash-
|
|
10
|
-
"flash-content": "awsui_flash-
|
|
11
|
-
"action-button-wrapper": "awsui_action-button-
|
|
12
|
-
"dismiss-button-wrapper": "awsui_dismiss-button-
|
|
13
|
-
"flash-icon": "awsui_flash-
|
|
14
|
-
"entering": "
|
|
15
|
-
"entered": "
|
|
16
|
-
"exiting": "
|
|
17
|
-
"stack": "
|
|
18
|
-
"animation-running": "awsui_animation-
|
|
19
|
-
"item": "
|
|
20
|
-
"flash-list-item": "awsui_flash-list-
|
|
21
|
-
"notification-bar": "awsui_notification-
|
|
22
|
-
"collapsed": "
|
|
23
|
-
"animation-ready": "awsui_animation-
|
|
24
|
-
"expanded-only": "awsui_expanded-
|
|
25
|
-
"expanded": "
|
|
26
|
-
"flash": "
|
|
27
|
-
"collapsible": "
|
|
28
|
-
"short-list": "awsui_short-
|
|
29
|
-
"visual-refresh": "awsui_visual-
|
|
30
|
-
"status": "
|
|
31
|
-
"header": "
|
|
32
|
-
"item-count": "awsui_item-
|
|
33
|
-
"button": "
|
|
34
|
-
"type-count": "awsui_type-
|
|
35
|
-
"count-number": "awsui_count-
|
|
36
|
-
"icon": "
|
|
37
|
-
"floating": "
|
|
38
|
-
"flashbar": "
|
|
39
|
-
"flash-refresh": "awsui_flash-
|
|
40
|
-
"flash-list": "awsui_flash-
|
|
41
|
-
"flash-focus-container": "awsui_flash-focus-
|
|
42
|
-
"flash-text": "awsui_flash-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"flash-type-
|
|
51
|
-
"flash-type-
|
|
5
|
+
"flash-with-motion": "awsui_flash-with-motion_1q84n_iol8n_153",
|
|
6
|
+
"enter": "awsui_enter_1q84n_iol8n_153",
|
|
7
|
+
"flash-body": "awsui_flash-body_1q84n_iol8n_167",
|
|
8
|
+
"flash-message": "awsui_flash-message_1q84n_iol8n_167",
|
|
9
|
+
"flash-header": "awsui_flash-header_1q84n_iol8n_167",
|
|
10
|
+
"flash-content": "awsui_flash-content_1q84n_iol8n_168",
|
|
11
|
+
"action-button-wrapper": "awsui_action-button-wrapper_1q84n_iol8n_169",
|
|
12
|
+
"dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_iol8n_170",
|
|
13
|
+
"flash-icon": "awsui_flash-icon_1q84n_iol8n_193",
|
|
14
|
+
"entering": "awsui_entering_1q84n_iol8n_206",
|
|
15
|
+
"entered": "awsui_entered_1q84n_iol8n_227",
|
|
16
|
+
"exiting": "awsui_exiting_1q84n_iol8n_332",
|
|
17
|
+
"stack": "awsui_stack_1q84n_iol8n_366",
|
|
18
|
+
"animation-running": "awsui_animation-running_1q84n_iol8n_366",
|
|
19
|
+
"item": "awsui_item_1q84n_iol8n_366",
|
|
20
|
+
"flash-list-item": "awsui_flash-list-item_1q84n_iol8n_367",
|
|
21
|
+
"notification-bar": "awsui_notification-bar_1q84n_iol8n_368",
|
|
22
|
+
"collapsed": "awsui_collapsed_1q84n_iol8n_388",
|
|
23
|
+
"animation-ready": "awsui_animation-ready_1q84n_iol8n_388",
|
|
24
|
+
"expanded-only": "awsui_expanded-only_1q84n_iol8n_388",
|
|
25
|
+
"expanded": "awsui_expanded_1q84n_iol8n_388",
|
|
26
|
+
"flash": "awsui_flash_1q84n_iol8n_153",
|
|
27
|
+
"collapsible": "awsui_collapsible_1q84n_iol8n_444",
|
|
28
|
+
"short-list": "awsui_short-list_1q84n_iol8n_450",
|
|
29
|
+
"visual-refresh": "awsui_visual-refresh_1q84n_iol8n_450",
|
|
30
|
+
"status": "awsui_status_1q84n_iol8n_597",
|
|
31
|
+
"header": "awsui_header_1q84n_iol8n_597",
|
|
32
|
+
"item-count": "awsui_item-count_1q84n_iol8n_598",
|
|
33
|
+
"button": "awsui_button_1q84n_iol8n_599",
|
|
34
|
+
"type-count": "awsui_type-count_1q84n_iol8n_632",
|
|
35
|
+
"count-number": "awsui_count-number_1q84n_iol8n_632",
|
|
36
|
+
"icon": "awsui_icon_1q84n_iol8n_666",
|
|
37
|
+
"floating": "awsui_floating_1q84n_iol8n_707",
|
|
38
|
+
"flashbar": "awsui_flashbar_1q84n_iol8n_711",
|
|
39
|
+
"flash-refresh": "awsui_flash-refresh_1q84n_iol8n_786",
|
|
40
|
+
"flash-list": "awsui_flash-list_1q84n_iol8n_367",
|
|
41
|
+
"flash-focus-container": "awsui_flash-focus-container_1q84n_iol8n_807",
|
|
42
|
+
"flash-text": "awsui_flash-text_1q84n_iol8n_837",
|
|
43
|
+
"hidden": "awsui_hidden_1q84n_iol8n_856",
|
|
44
|
+
"header-replacement": "awsui_header-replacement_1q84n_iol8n_861",
|
|
45
|
+
"content-replacement": "awsui_content-replacement_1q84n_iol8n_866",
|
|
46
|
+
"dismiss-button": "awsui_dismiss-button_1q84n_iol8n_170",
|
|
47
|
+
"breakpoint-default": "awsui_breakpoint-default_1q84n_iol8n_885",
|
|
48
|
+
"action-button": "awsui_action-button_1q84n_iol8n_169",
|
|
49
|
+
"action-slot": "awsui_action-slot_1q84n_iol8n_895",
|
|
50
|
+
"flash-type-success": "awsui_flash-type-success_1q84n_iol8n_899",
|
|
51
|
+
"flash-type-error": "awsui_flash-type-error_1q84n_iol8n_903",
|
|
52
|
+
"flash-type-info": "awsui_flash-type-info_1q84n_iol8n_907",
|
|
53
|
+
"flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_iol8n_908",
|
|
54
|
+
"flash-type-warning": "awsui_flash-type-warning_1q84n_iol8n_912"
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PopoverProps } from '../../../popover/interfaces';
|
|
2
3
|
export interface TooltipProps {
|
|
3
4
|
value: React.ReactNode;
|
|
4
5
|
trackRef: React.RefObject<HTMLElement | SVGElement>;
|
|
@@ -6,6 +7,7 @@ export interface TooltipProps {
|
|
|
6
7
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
7
8
|
className?: string;
|
|
8
9
|
contentAttributes?: React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
size?: PopoverProps['size'];
|
|
9
11
|
}
|
|
10
|
-
export default function Tooltip({ value, trackRef, trackKey, className, contentAttributes, position, }: TooltipProps): JSX.Element;
|
|
12
|
+
export default function Tooltip({ value, trackRef, trackKey, className, contentAttributes, position, size, }: TooltipProps): JSX.Element;
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/tooltip/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAM3D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,iBAAsB,EACtB,QAAgB,EAChB,IAAc,GACf,EAAE,YAAY,eA4Bd"}
|
|
@@ -8,13 +8,13 @@ import PopoverContainer from '../../../popover/container';
|
|
|
8
8
|
import Portal from '../portal';
|
|
9
9
|
import { Transition } from '../transition';
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
|
-
export default function Tooltip({ value, trackRef, trackKey, className, contentAttributes = {}, position = 'top', }) {
|
|
11
|
+
export default function Tooltip({ value, trackRef, trackKey, className, contentAttributes = {}, position = 'top', size = 'small', }) {
|
|
12
12
|
if (!trackKey && (typeof value === 'string' || typeof value === 'number')) {
|
|
13
13
|
trackKey = value;
|
|
14
14
|
}
|
|
15
15
|
return (React.createElement(Portal, null,
|
|
16
16
|
React.createElement("div", Object.assign({ className: clsx(styles.root, className) }, contentAttributes, { "data-testid": trackKey }),
|
|
17
|
-
React.createElement(Transition, { in: true }, () => (React.createElement(PopoverContainer, { trackRef: trackRef, trackKey: trackKey, size:
|
|
17
|
+
React.createElement(Transition, { in: true }, () => (React.createElement(PopoverContainer, { trackRef: trackRef, trackKey: trackKey, size: size, fixedWidth: false, position: position, zIndex: 7000, arrow: position => React.createElement(PopoverArrow, { position: position }) },
|
|
18
18
|
React.createElement(PopoverBody, { dismissButton: false, dismissAriaLabel: undefined, onDismiss: undefined, header: undefined }, value)))))));
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/tooltip/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,WAAW,MAAM,uBA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Q,EAAE,QAAQ,GAAI;gBAEvD,oBAAC,WAAW,IAAC,aAAa,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,IACpG,KAAK,CACM,CACG,CACpB,CACU,CACT,CACC,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport PopoverArrow from '../../../popover/arrow';\nimport PopoverBody from '../../../popover/body';\nimport PopoverContainer from '../../../popover/container';\nimport { PopoverProps } from '../../../popover/interfaces';\nimport Portal from '../portal';\nimport { Transition } from '../transition';\n\nimport styles from './styles.css.js';\n\nexport interface TooltipProps {\n value: React.ReactNode;\n trackRef: React.RefObject<HTMLElement | SVGElement>;\n trackKey?: string | number;\n position?: 'top' | 'right' | 'bottom' | 'left';\n className?: string;\n contentAttributes?: React.HTMLAttributes<HTMLDivElement>;\n size?: PopoverProps['size'];\n}\n\nexport default function Tooltip({\n value,\n trackRef,\n trackKey,\n className,\n contentAttributes = {},\n position = 'top',\n size = 'small',\n}: TooltipProps) {\n if (!trackKey && (typeof value === 'string' || typeof value === 'number')) {\n trackKey = value;\n }\n\n return (\n <Portal>\n <div className={clsx(styles.root, className)} {...contentAttributes} data-testid={trackKey}>\n <Transition in={true}>\n {() => (\n <PopoverContainer\n trackRef={trackRef}\n trackKey={trackKey}\n size={size}\n fixedWidth={false}\n position={position}\n zIndex={7000}\n arrow={position => <PopoverArrow position={position} />}\n >\n <PopoverBody dismissButton={false} dismissAriaLabel={undefined} onDismiss={undefined} header={undefined}>\n {value}\n </PopoverBody>\n </PopoverContainer>\n )}\n </Transition>\n </div>\n </Portal>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/tooltip/registry.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG,MAAM,IAAI,CAAC;AAW1B,eAAO,MAAM,eAAe,YAAa,OAAO,eAU/C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
let callbacks = [];
|
|
4
|
+
let listenerRegistered = false;
|
|
5
|
+
const onKeyDown = (event) => {
|
|
6
|
+
if (event.key === 'Escape') {
|
|
7
|
+
callbacks.forEach(callback => callback());
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export const registerTooltip = (onClose) => {
|
|
11
|
+
callbacks.forEach(callback => callback());
|
|
12
|
+
callbacks.push(onClose);
|
|
13
|
+
if (!listenerRegistered) {
|
|
14
|
+
listenerRegistered = true;
|
|
15
|
+
document.addEventListener('keydown', onKeyDown);
|
|
16
|
+
}
|
|
17
|
+
return () => {
|
|
18
|
+
deregisterTooltip(onClose);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const deregisterTooltip = (onClose) => {
|
|
22
|
+
callbacks = callbacks.filter(callback => callback !== onClose);
|
|
23
|
+
if (listenerRegistered && callbacks.length === 0) {
|
|
24
|
+
listenerRegistered = false;
|
|
25
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../../src/internal/components/tooltip/registry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,IAAI,SAAS,GAAmB,EAAE,CAAC;AACnC,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;IACzC,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;QAC1B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC3C;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAClD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1C,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,IAAI,CAAC,kBAAkB,EAAE;QACvB,kBAAkB,GAAG,IAAI,CAAC;QAC1B,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;KACjD;IACD,OAAO,GAAG,EAAE;QACV,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC7C,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IAC/D,IAAI,kBAAkB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAChD,kBAAkB,GAAG,KAAK,CAAC;QAC3B,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;KACpD;AACH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\ntype OnClose = () => void;\n\nlet callbacks: Array<OnClose> = [];\nlet listenerRegistered = false;\n\nconst onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n callbacks.forEach(callback => callback());\n }\n};\n\nexport const registerTooltip = (onClose: OnClose) => {\n callbacks.forEach(callback => callback());\n callbacks.push(onClose);\n if (!listenerRegistered) {\n listenerRegistered = true;\n document.addEventListener('keydown', onKeyDown);\n }\n return () => {\n deregisterTooltip(onClose);\n };\n};\n\nconst deregisterTooltip = (onClose: OnClose) => {\n callbacks = callbacks.filter(callback => callback !== onClose);\n if (listenerRegistered && callbacks.length === 0) {\n listenerRegistered = false;\n document.removeEventListener('keydown', onKeyDown);\n }\n};\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';
|
|
2
2
|
import { ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';
|
|
3
|
+
import { AlertFlashContentApiInternal, AlertFlashContentApiPublic } from './controllers/alert-flash-content';
|
|
3
4
|
import { AppLayoutWidgetApiInternal } from './controllers/app-layout-widget';
|
|
4
5
|
import { BreadcrumbsApiInternal } from './controllers/breadcrumbs';
|
|
5
6
|
import { DrawersApiInternal, DrawersApiPublic } from './controllers/drawers';
|
|
@@ -7,13 +8,17 @@ interface AwsuiApi {
|
|
|
7
8
|
awsuiPlugins: {
|
|
8
9
|
appLayout: DrawersApiPublic;
|
|
9
10
|
alert: ActionsApiPublic;
|
|
11
|
+
alertContent: AlertFlashContentApiPublic;
|
|
10
12
|
flashbar: ActionsApiPublic;
|
|
13
|
+
flashContent: AlertFlashContentApiPublic;
|
|
11
14
|
};
|
|
12
15
|
awsuiPluginsInternal: {
|
|
13
16
|
appLayout: DrawersApiInternal;
|
|
14
17
|
appLayoutWidget: AppLayoutWidgetApiInternal;
|
|
15
18
|
alert: ActionsApiInternal;
|
|
19
|
+
alertContent: AlertFlashContentApiInternal;
|
|
16
20
|
flashbar: ActionsApiInternal;
|
|
21
|
+
flashContent: AlertFlashContentApiInternal;
|
|
17
22
|
breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
|
|
18
23
|
};
|
|
19
24
|
}
|
|
@@ -21,12 +26,16 @@ export declare function loadApi(): AwsuiApi;
|
|
|
21
26
|
export declare const awsuiPlugins: {
|
|
22
27
|
appLayout: DrawersApiPublic;
|
|
23
28
|
alert: ActionsApiPublic;
|
|
29
|
+
alertContent: AlertFlashContentApiPublic;
|
|
24
30
|
flashbar: ActionsApiPublic;
|
|
31
|
+
flashContent: AlertFlashContentApiPublic;
|
|
25
32
|
}, awsuiPluginsInternal: {
|
|
26
33
|
appLayout: DrawersApiInternal;
|
|
27
34
|
appLayoutWidget: AppLayoutWidgetApiInternal;
|
|
28
35
|
alert: ActionsApiInternal;
|
|
36
|
+
alertContent: AlertFlashContentApiInternal;
|
|
29
37
|
flashbar: ActionsApiInternal;
|
|
38
|
+
flashContent: AlertFlashContentApiInternal;
|
|
30
39
|
breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
|
|
31
40
|
};
|
|
32
41
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAA2B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAAE,0BAA0B,EAA6B,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAyB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAIhG,UAAU,QAAQ;IAChB,YAAY,EAAE;QACZ,SAAS,EAAE,gBAAgB,CAAC;QAC5B,KAAK,EAAE,gBAAgB,CAAC;QACxB,QAAQ,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAA2B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAE3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAA6B,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAyB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAIhG,UAAU,QAAQ;IAChB,YAAY,EAAE;QACZ,SAAS,EAAE,gBAAgB,CAAC;QAC5B,KAAK,EAAE,gBAAgB,CAAC;QACxB,YAAY,EAAE,0BAA0B,CAAC;QACzC,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,YAAY,EAAE,0BAA0B,CAAC;KAC1C,CAAC;IACF,oBAAoB,EAAE;QACpB,SAAS,EAAE,kBAAkB,CAAC;QAC9B,eAAe,EAAE,0BAA0B,CAAC;QAC5C,KAAK,EAAE,kBAAkB,CAAC;QAC1B,YAAY,EAAE,4BAA4B,CAAC;QAC3C,QAAQ,EAAE,kBAAkB,CAAC;QAC7B,YAAY,EAAE,4BAA4B,CAAC;QAC3C,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;KAC3D,CAAC;CACH;AAwBD,wBAAgB,OAAO,aAQtB;AAED,eAAO,MAAQ,YAAY;eAjDZ,gBAAgB;WACpB,gBAAgB;kBACT,0BAA0B;cAC9B,gBAAgB;kBACZ,0BAA0B;GA6Cf,oBAAoB;eA1ClC,kBAAkB;qBACZ,0BAA0B;WACpC,kBAAkB;kBACX,4BAA4B;cAChC,kBAAkB;kBACd,4BAA4B;iBAC7B,uBAAuB,oBAAoB,CAAC;CAoCE,CAAC"}
|
package/internal/plugins/api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActionButtonsController } from './controllers/action-buttons';
|
|
2
|
+
import { AlertFlashContentController, } from './controllers/alert-flash-content';
|
|
2
3
|
import { AppLayoutWidgetController } from './controllers/app-layout-widget';
|
|
3
4
|
import { BreadcrumbsController } from './controllers/breadcrumbs';
|
|
4
5
|
import { DrawersController } from './controllers/drawers';
|
|
@@ -41,6 +42,12 @@ function installApi(api) {
|
|
|
41
42
|
const alertActions = new ActionButtonsController();
|
|
42
43
|
api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);
|
|
43
44
|
api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);
|
|
45
|
+
const alertContent = new AlertFlashContentController();
|
|
46
|
+
api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);
|
|
47
|
+
api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);
|
|
48
|
+
const flashContent = new AlertFlashContentController();
|
|
49
|
+
api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);
|
|
50
|
+
api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);
|
|
44
51
|
const flashbarActions = new ActionButtonsController();
|
|
45
52
|
api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);
|
|
46
53
|
api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAA8B,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEhG,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,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,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC1F,GAAG,CAAC,oBAAoB,CAAC,YAAY,GAAG,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE5G,MAAM,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACtD,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACrF,GAAG,CAAC,oBAAoB,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEvG,MAAM,WAAW,GAAG,IAAI,qBAAqB,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n return api as AwsuiApi;\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface RefShim<T> {
|
|
2
|
+
current: T | null;
|
|
3
|
+
}
|
|
4
|
+
export interface AlertFlashContentContext {
|
|
5
|
+
type: string;
|
|
6
|
+
headerRef: RefShim<HTMLElement>;
|
|
7
|
+
contentRef: RefShim<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export type ReplacementType = 'original' | 'remove' | 'replaced';
|
|
10
|
+
export interface ReplacementApi {
|
|
11
|
+
hideHeader(): void;
|
|
12
|
+
restoreHeader(): void;
|
|
13
|
+
replaceHeader(replacer: (container: HTMLElement) => void): void;
|
|
14
|
+
hideContent(): void;
|
|
15
|
+
restoreContent(): void;
|
|
16
|
+
replaceContent(replacer: (container: HTMLElement) => void): void;
|
|
17
|
+
}
|
|
18
|
+
export interface AlertFlashContentResult {
|
|
19
|
+
update: () => void;
|
|
20
|
+
unmount: (containers: {
|
|
21
|
+
replacementHeaderContainer: HTMLElement;
|
|
22
|
+
replacementContentContainer: HTMLElement;
|
|
23
|
+
}) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface AlertFlashContentConfig {
|
|
26
|
+
id: string;
|
|
27
|
+
runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;
|
|
28
|
+
}
|
|
29
|
+
export type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;
|
|
30
|
+
export interface AlertFlashContentApiPublic {
|
|
31
|
+
registerContentReplacer(config: AlertFlashContentConfig): void;
|
|
32
|
+
}
|
|
33
|
+
export interface AlertFlashContentApiInternal {
|
|
34
|
+
clearRegisteredReplacer(): void;
|
|
35
|
+
onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare class AlertFlashContentController {
|
|
38
|
+
#private;
|
|
39
|
+
registerContentReplacer: (content: AlertFlashContentConfig) => void;
|
|
40
|
+
clearRegisteredReplacer: () => void;
|
|
41
|
+
onContentRegistered: (listener: AlertFlashContentRegistrationListener) => () => void;
|
|
42
|
+
installPublic(api?: Partial<AlertFlashContentApiPublic>): AlertFlashContentApiPublic;
|
|
43
|
+
installInternal(internalApi?: Partial<AlertFlashContentApiInternal>): AlertFlashContentApiInternal;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=alert-flash-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAMA,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,c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0,0 +1,59 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var _AlertFlashContentController_listeners, _AlertFlashContentController_cleanups, _AlertFlashContentController_provider, _AlertFlashContentController_scheduleUpdate;
|
|
4
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
5
|
+
import debounce from '../../debounce';
|
|
6
|
+
export class AlertFlashContentController {
|
|
7
|
+
constructor() {
|
|
8
|
+
_AlertFlashContentController_listeners.set(this, []);
|
|
9
|
+
_AlertFlashContentController_cleanups.set(this, new Map());
|
|
10
|
+
_AlertFlashContentController_provider.set(this, void 0);
|
|
11
|
+
_AlertFlashContentController_scheduleUpdate.set(this, debounce(() => __classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").forEach(listener => {
|
|
12
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
13
|
+
const cleanup = listener(__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f"));
|
|
14
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").set(listener, cleanup);
|
|
15
|
+
}
|
|
16
|
+
}), 0));
|
|
17
|
+
this.registerContentReplacer = (content) => {
|
|
18
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
19
|
+
console.warn(`Cannot call \`registerContentReplacer\` with new provider: provider with id "${__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f").id}" already registered.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_provider, content, "f");
|
|
23
|
+
// Notify existing components if registration happens after the components are rendered.
|
|
24
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_scheduleUpdate, "f").call(this);
|
|
25
|
+
};
|
|
26
|
+
this.clearRegisteredReplacer = () => {
|
|
27
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_provider, undefined, "f");
|
|
28
|
+
};
|
|
29
|
+
this.onContentRegistered = (listener) => {
|
|
30
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
31
|
+
const cleanup = listener(__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f"));
|
|
32
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").push(listener);
|
|
33
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").set(listener, cleanup);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").push(listener);
|
|
37
|
+
}
|
|
38
|
+
return () => {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = __classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").get(listener)) === null || _a === void 0 ? void 0 : _a();
|
|
41
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_listeners, __classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").filter(item => item !== listener), "f");
|
|
42
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").delete(listener);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
installPublic(api = {}) {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = api.registerContentReplacer) !== null && _a !== void 0 ? _a : (api.registerContentReplacer = this.registerContentReplacer);
|
|
49
|
+
return api;
|
|
50
|
+
}
|
|
51
|
+
installInternal(internalApi = {}) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_a = internalApi.clearRegisteredReplacer) !== null && _a !== void 0 ? _a : (internalApi.clearRegisteredReplacer = this.clearRegisteredReplacer);
|
|
54
|
+
(_b = internalApi.onContentRegistered) !== null && _b !== void 0 ? _b : (internalApi.onContentRegistered = this.onContentRegistered);
|
|
55
|
+
return internalApi;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_AlertFlashContentController_listeners = new WeakMap(), _AlertFlashContentController_cleanups = new WeakMap(), _AlertFlashContentController_provider = new WeakMap(), _AlertFlashContentController_scheduleUpdate = new WeakMap();
|
|
59
|
+
//# sourceMappingURL=alert-flash-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-flash-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AA6CtC,MAAM,OAAO,2BAA2B;IAAxC;QACE,iDAA2D,EAAE,EAAC;QAC9D,gDAAY,IAAI,GAAG,EAAqD,EAAC;QACzE,wDAAoC;QAEpC,sDAAkB,QAAQ,CACxB,GAAG,EAAE,CACH,uBAAA,IAAI,8CAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACjC,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAA,IAAI,6CAAU,CAAC,CAAC;gBACzC,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACvC;QACH,CAAC,CAAC,EACJ,CAAC,CACF,EAAC;QAEF,4BAAuB,GAAG,CAAC,OAAgC,EAAE,EAAE;YAC7D,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,OAAO,CAAC,IAAI,CACV,gFAAgF,uBAAA,IAAI,6CAAU,CAAC,EAAE,uBAAuB,CACzH,CAAC;gBACF,OAAO;aACR;YACD,uBAAA,IAAI,yCAAa,OAAO,MAAA,CAAC;YAEzB,wFAAwF;YACxF,uBAAA,IAAI,mDAAgB,MAApB,IAAI,CAAkB,CAAC;QACzB,CAAC,CAAC;QAEF,4BAAuB,GAAG,GAAG,EAAE;YAC7B,uBAAA,IAAI,yCAAa,SAAS,MAAA,CAAC;QAC7B,CAAC,CAAC;QAEF,wBAAmB,GAAG,CAAC,QAA+C,EAAE,EAAE;YACxE,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAA,IAAI,6CAAU,CAAC,CAAC;gBACzC,uBAAA,IAAI,8CAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC/B,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACvC;iBAAM;gBACL,uBAAA,IAAI,8CAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAChC;YACD,OAAO,GAAG,EAAE;;gBACV,MAAA,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,2CAAI,CAAC;gBACjC,uBAAA,IAAI,0CAAc,uBAAA,IAAI,8CAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAA,CAAC;gBACpE,uBAAA,IAAI,6CAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC,CAAC;IAYJ,CAAC;IAVC,aAAa,CAAC,MAA2C,EAAE;;QACzD,MAAA,GAAG,CAAC,uBAAuB,oCAA3B,GAAG,CAAC,uBAAuB,GAAK,IAAI,CAAC,uBAAuB,EAAC;QAC7D,OAAO,GAAiC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,cAAqD,EAAE;;QACrE,MAAA,WAAW,CAAC,uBAAuB,oCAAnC,WAAW,CAAC,uBAAuB,GAAK,IAAI,CAAC,uBAAuB,EAAC;QACrE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,OAAO,WAA2C,CAAC;IACrD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport debounce from '../../debounce';\n\n// this code should not depend on React typings, because it is portable between major versions\ninterface RefShim<T> {\n current: T | null;\n}\n\nexport interface AlertFlashContentContext {\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\nexport type ReplacementType = 'original' | 'remove' | 'replaced';\n\nexport interface ReplacementApi {\n hideHeader(): void;\n restoreHeader(): void;\n replaceHeader(replacer: (container: HTMLElement) => void): void;\n hideContent(): void;\n restoreContent(): void;\n replaceContent(replacer: (container: HTMLElement) => void): void;\n}\n\nexport interface AlertFlashContentResult {\n update: () => void;\n unmount: (containers: { replacementHeaderContainer: HTMLElement; replacementContentContainer: HTMLElement }) => void;\n}\n\nexport interface AlertFlashContentConfig {\n id: string;\n runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;\n}\n\nexport type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;\n\nexport interface AlertFlashContentApiPublic {\n registerContentReplacer(config: AlertFlashContentConfig): void;\n}\n\nexport interface AlertFlashContentApiInternal {\n clearRegisteredReplacer(): void;\n onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;\n}\n\nexport class AlertFlashContentController {\n #listeners: Array<AlertFlashContentRegistrationListener> = [];\n #cleanups = new Map<AlertFlashContentRegistrationListener, () => void>();\n #provider?: AlertFlashContentConfig;\n\n #scheduleUpdate = debounce(\n () =>\n this.#listeners.forEach(listener => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#cleanups.set(listener, cleanup);\n }\n }),\n 0\n );\n\n registerContentReplacer = (content: AlertFlashContentConfig) => {\n if (this.#provider) {\n console.warn(\n `Cannot call \\`registerContentReplacer\\` with new provider: provider with id \"${this.#provider.id}\" already registered.`\n );\n return;\n }\n this.#provider = content;\n\n // Notify existing components if registration happens after the components are rendered.\n this.#scheduleUpdate();\n };\n\n clearRegisteredReplacer = () => {\n this.#provider = undefined;\n };\n\n onContentRegistered = (listener: AlertFlashContentRegistrationListener) => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#listeners.push(listener);\n this.#cleanups.set(listener, cleanup);\n } else {\n this.#listeners.push(listener);\n }\n return () => {\n this.#cleanups.get(listener)?.();\n this.#listeners = this.#listeners.filter(item => item !== listener);\n this.#cleanups.delete(listener);\n };\n };\n\n installPublic(api: Partial<AlertFlashContentApiPublic> = {}): AlertFlashContentApiPublic {\n api.registerContentReplacer ??= this.registerContentReplacer;\n return api as AlertFlashContentApiPublic;\n }\n\n installInternal(internalApi: Partial<AlertFlashContentApiInternal> = {}): AlertFlashContentApiInternal {\n internalApi.clearRegisteredReplacer ??= this.clearRegisteredReplacer;\n internalApi.onContentRegistered ??= this.onContentRegistered;\n return internalApi as AlertFlashContentApiInternal;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { RuntimeContentWrapper } from './runtime-content-wrapper';
|
|
4
4
|
export { createUseDiscoveredAction } from './use-discovered-action';
|
|
5
|
+
export { createUseDiscoveredContent } from './use-discovered-content';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { RuntimeContentWrapper } from './runtime-content-wrapper';\nexport { createUseDiscoveredAction } from './use-discovered-action';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { RuntimeContentWrapper } from './runtime-content-wrapper';\nexport { createUseDiscoveredAction } from './use-discovered-action';\nexport { createUseDiscoveredContent } from './use-discovered-content';\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ActionButtonsController } from '../controllers/action-buttons';
|
|
3
3
|
export declare function createUseDiscoveredAction(onActionRegistered: ActionButtonsController['onActionRegistered']): (type: string) => {
|
|
4
4
|
discoveredActions: React.ReactNode[];
|
|
5
|
-
headerRef: React.
|
|
6
|
-
contentRef: React.
|
|
5
|
+
headerRef: React.Ref<HTMLDivElement>;
|
|
6
|
+
contentRef: React.Ref<HTMLDivElement>;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=use-discovered-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAgBrG,wBAAgB,yBAAyB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,UAC/D,MAAM
|
|
1
|
+
{"version":3,"file":"use-discovered-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAgBrG,wBAAgB,yBAAyB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,UAC/D,MAAM;uBAC3B,MAAM,SAAS,EAAE;eACzB,MAAM,GAAG,CAAC,cAAc,CAAC;gBACxB,MAAM,GAAG,CAAC,cAAc,CAAC;EAcxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-action.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,SAAS,oBAAoB,CAAC,MAA2B,EAAE,OAAsB;IAC/E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,oBAAC,qBAAqB,IACpB,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EACnC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAClE,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,GAC7D,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,kBAAiE;IACzG,OAAO,SAAS,mBAAmB,CAAC,IAAY;
|
|
1
|
+
{"version":3,"file":"use-discovered-action.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,SAAS,oBAAoB,CAAC,MAA2B,EAAE,OAAsB;IAC/E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,oBAAC,qBAAqB,IACpB,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EACnC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAClE,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,GAC7D,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,kBAAiE;IACzG,OAAO,SAAS,mBAAmB,CAAC,IAAY;QAK9C,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;QACvF,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAEhD,SAAS,CAAC,GAAG,EAAE;YACb,OAAO,kBAAkB,CAAC,OAAO,CAAC,EAAE;gBAClC,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7G,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAEX,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { ActionButtonsController, ActionConfig, ActionContext } from '../controllers/action-buttons';\nimport { RuntimeContentWrapper } from './runtime-content-wrapper';\n\nfunction convertRuntimeAction(action: ActionConfig | null, context: ActionContext) {\n if (!action) {\n return null;\n }\n return (\n <RuntimeContentWrapper\n key={action.id + '-' + context.type}\n mountContent={container => action.mountContent(container, context)}\n unmountContent={container => action.unmountContent(container)}\n />\n );\n}\n\nexport function createUseDiscoveredAction(onActionRegistered: ActionButtonsController['onActionRegistered']) {\n return function useDiscoveredAction(type: string): {\n discoveredActions: React.ReactNode[];\n headerRef: React.Ref<HTMLDivElement>;\n contentRef: React.Ref<HTMLDivElement>;\n } {\n const [discoveredActions, setDiscoveredActions] = useState<Array<React.ReactNode>>([]);\n const headerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n return onActionRegistered(actions => {\n setDiscoveredActions(actions.map(action => convertRuntimeAction(action, { type, headerRef, contentRef })));\n });\n }, [type]);\n\n return { discoveredActions, headerRef, contentRef };\n };\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AlertFlashContentController, ReplacementType } from '../controllers/alert-flash-content';
|
|
3
|
+
export declare function createUseDiscoveredContent(componentName: string, onContentRegistered: AlertFlashContentController['onContentRegistered']): ({ type, header, children, }: {
|
|
4
|
+
type: string;
|
|
5
|
+
header: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}) => {
|
|
8
|
+
headerReplacementType: ReplacementType;
|
|
9
|
+
contentReplacementType: ReplacementType;
|
|
10
|
+
headerRef: import("react").Ref<HTMLDivElement>;
|
|
11
|
+
replacementHeaderRef: import("react").Ref<HTMLDivElement>;
|
|
12
|
+
contentRef: import("react").Ref<HTMLDivElement>;
|
|
13
|
+
replacementContentRef: import("react").Ref<HTMLDivElement>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-discovered-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,2BAA2B,EAE3B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAE5C,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,2BAA2B,CAAC,qBAAqB,CAAC;UAO/D,MAAM;YACJ,SAAS;cACP,SAAS;;;;;;;;EAoFtB"}
|