@cloudscape-design/components 3.0.358 → 3.0.359
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 +16 -0
- package/alert/actions-wrapper/index.d.ts.map +1 -0
- package/alert/actions-wrapper/index.js +22 -0
- package/alert/actions-wrapper/index.js.map +1 -0
- package/alert/actions-wrapper/styles.css.js +6 -0
- package/alert/actions-wrapper/styles.scoped.css +17 -0
- package/alert/actions-wrapper/styles.selectors.js +7 -0
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +11 -5
- package/alert/internal.js.map +1 -1
- package/alert/styles.css.js +25 -24
- package/alert/styles.scoped.css +40 -39
- package/alert/styles.selectors.js +25 -24
- package/app-layout/runtime-api.d.ts +1 -1
- package/app-layout/runtime-api.d.ts.map +1 -1
- package/app-layout/runtime-api.js +6 -20
- package/app-layout/runtime-api.js.map +1 -1
- package/cards/index.d.ts.map +1 -1
- package/cards/index.js +10 -7
- package/cards/index.js.map +1 -1
- package/container/internal.d.ts +1 -2
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +2 -3
- package/container/internal.js.map +1 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +11 -7
- package/flashbar/flash.js.map +1 -1
- package/flashbar/styles.css.js +47 -46
- package/flashbar/styles.scoped.css +146 -145
- package/flashbar/styles.selectors.js +47 -46
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +5 -0
- package/header/internal.js.map +1 -1
- package/internal/context/collection-label-context.d.ts +7 -0
- package/internal/context/collection-label-context.d.ts.map +1 -0
- package/internal/context/collection-label-context.js +5 -0
- package/internal/context/collection-label-context.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 +16 -1
- package/internal/plugins/api.d.ts.map +1 -1
- package/internal/plugins/api.js +22 -5
- package/internal/plugins/api.js.map +1 -1
- package/internal/plugins/controllers/action-buttons.d.ts +25 -0
- package/internal/plugins/controllers/action-buttons.d.ts.map +1 -0
- package/internal/plugins/controllers/action-buttons.js +29 -0
- package/internal/plugins/controllers/action-buttons.js.map +1 -0
- package/internal/plugins/{drawers-controller.d.ts → controllers/drawers.d.ts} +3 -4
- package/internal/plugins/controllers/drawers.d.ts.map +1 -0
- package/internal/plugins/{drawers-controller.js → controllers/drawers.js} +7 -12
- package/internal/plugins/controllers/drawers.js.map +1 -0
- package/internal/plugins/helpers/index.d.ts +3 -0
- package/internal/plugins/helpers/index.d.ts.map +1 -0
- package/internal/plugins/helpers/index.js +5 -0
- package/internal/plugins/helpers/index.js.map +1 -0
- package/internal/plugins/helpers/runtime-content-wrapper.d.ts +8 -0
- package/internal/plugins/helpers/runtime-content-wrapper.d.ts.map +1 -0
- package/internal/plugins/helpers/runtime-content-wrapper.js +14 -0
- package/internal/plugins/helpers/runtime-content-wrapper.js.map +1 -0
- package/internal/plugins/helpers/use-discovered-action.d.ts +8 -0
- package/internal/plugins/helpers/use-discovered-action.d.ts.map +1 -0
- package/internal/plugins/helpers/use-discovered-action.js +24 -0
- package/internal/plugins/helpers/use-discovered-action.js.map +1 -0
- package/internal/plugins/helpers/utils.d.ts +5 -0
- package/internal/plugins/helpers/utils.d.ts.map +1 -0
- package/internal/plugins/helpers/utils.js +12 -0
- package/internal/plugins/helpers/utils.js.map +1 -0
- package/package.json +1 -1
- package/split-panel/styles.css.js +56 -56
- package/split-panel/styles.scoped.css +80 -78
- package/split-panel/styles.selectors.js +56 -56
- package/table/interfaces.d.ts +2 -3
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +15 -3
- package/table/internal.js.map +1 -1
- package/table/table-role/table-role-helper.d.ts +1 -0
- package/table/table-role/table-role-helper.d.ts.map +1 -1
- package/table/table-role/table-role-helper.js +1 -0
- package/table/table-role/table-role-helper.js.map +1 -1
- package/table/tools-header.d.ts.map +1 -1
- package/table/tools-header.js +10 -2
- package/table/tools-header.js.map +1 -1
- package/test-utils/dom/alert/index.js +1 -1
- package/test-utils/dom/alert/index.js.map +1 -1
- package/test-utils/dom/flashbar/flash.js +1 -1
- package/test-utils/dom/flashbar/flash.js.map +1 -1
- package/test-utils/selectors/alert/index.js +1 -1
- package/test-utils/selectors/alert/index.js.map +1 -1
- package/test-utils/selectors/flashbar/flash.js +1 -1
- package/test-utils/selectors/flashbar/flash.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/internal/plugins/drawers-controller.d.ts.map +0 -1
- package/internal/plugins/drawers-controller.js.map +0 -1
|
@@ -2,51 +2,52 @@
|
|
|
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
|
-
"dismiss-button": "awsui_dismiss-
|
|
44
|
-
"breakpoint-default": "awsui_breakpoint-
|
|
45
|
-
"action-button": "awsui_action-
|
|
46
|
-
"
|
|
47
|
-
"flash-type-
|
|
48
|
-
"flash-type-
|
|
49
|
-
"flash-type-
|
|
50
|
-
"flash-type-
|
|
5
|
+
"flash-with-motion": "awsui_flash-with-motion_1q84n_128gc_93",
|
|
6
|
+
"enter": "awsui_enter_1q84n_128gc_93",
|
|
7
|
+
"flash-body": "awsui_flash-body_1q84n_128gc_107",
|
|
8
|
+
"flash-message": "awsui_flash-message_1q84n_128gc_107",
|
|
9
|
+
"flash-header": "awsui_flash-header_1q84n_128gc_107",
|
|
10
|
+
"flash-content": "awsui_flash-content_1q84n_128gc_108",
|
|
11
|
+
"action-button-wrapper": "awsui_action-button-wrapper_1q84n_128gc_109",
|
|
12
|
+
"dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_128gc_110",
|
|
13
|
+
"flash-icon": "awsui_flash-icon_1q84n_128gc_133",
|
|
14
|
+
"entering": "awsui_entering_1q84n_128gc_146",
|
|
15
|
+
"entered": "awsui_entered_1q84n_128gc_167",
|
|
16
|
+
"exiting": "awsui_exiting_1q84n_128gc_272",
|
|
17
|
+
"stack": "awsui_stack_1q84n_128gc_294",
|
|
18
|
+
"animation-running": "awsui_animation-running_1q84n_128gc_294",
|
|
19
|
+
"item": "awsui_item_1q84n_128gc_294",
|
|
20
|
+
"flash-list-item": "awsui_flash-list-item_1q84n_128gc_295",
|
|
21
|
+
"notification-bar": "awsui_notification-bar_1q84n_128gc_296",
|
|
22
|
+
"collapsed": "awsui_collapsed_1q84n_128gc_316",
|
|
23
|
+
"animation-ready": "awsui_animation-ready_1q84n_128gc_316",
|
|
24
|
+
"expanded-only": "awsui_expanded-only_1q84n_128gc_316",
|
|
25
|
+
"expanded": "awsui_expanded_1q84n_128gc_316",
|
|
26
|
+
"flash": "awsui_flash_1q84n_128gc_93",
|
|
27
|
+
"collapsible": "awsui_collapsible_1q84n_128gc_380",
|
|
28
|
+
"short-list": "awsui_short-list_1q84n_128gc_386",
|
|
29
|
+
"visual-refresh": "awsui_visual-refresh_1q84n_128gc_386",
|
|
30
|
+
"status": "awsui_status_1q84n_128gc_603",
|
|
31
|
+
"header": "awsui_header_1q84n_128gc_603",
|
|
32
|
+
"item-count": "awsui_item-count_1q84n_128gc_604",
|
|
33
|
+
"button": "awsui_button_1q84n_128gc_605",
|
|
34
|
+
"type-count": "awsui_type-count_1q84n_128gc_640",
|
|
35
|
+
"count-number": "awsui_count-number_1q84n_128gc_640",
|
|
36
|
+
"icon": "awsui_icon_1q84n_128gc_674",
|
|
37
|
+
"floating": "awsui_floating_1q84n_128gc_712",
|
|
38
|
+
"flashbar": "awsui_flashbar_1q84n_128gc_720",
|
|
39
|
+
"flash-refresh": "awsui_flash-refresh_1q84n_128gc_766",
|
|
40
|
+
"flash-list": "awsui_flash-list_1q84n_128gc_295",
|
|
41
|
+
"flash-focus-container": "awsui_flash-focus-container_1q84n_128gc_785",
|
|
42
|
+
"flash-text": "awsui_flash-text_1q84n_128gc_812",
|
|
43
|
+
"dismiss-button": "awsui_dismiss-button_1q84n_128gc_110",
|
|
44
|
+
"breakpoint-default": "awsui_breakpoint-default_1q84n_128gc_853",
|
|
45
|
+
"action-button": "awsui_action-button_1q84n_128gc_109",
|
|
46
|
+
"action-slot": "awsui_action-slot_1q84n_128gc_863",
|
|
47
|
+
"flash-type-success": "awsui_flash-type-success_1q84n_128gc_867",
|
|
48
|
+
"flash-type-error": "awsui_flash-type-error_1q84n_128gc_871",
|
|
49
|
+
"flash-type-info": "awsui_flash-type-info_1q84n_128gc_875",
|
|
50
|
+
"flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_128gc_876",
|
|
51
|
+
"flash-type-warning": "awsui_flash-type-warning_1q84n_128gc_880"
|
|
51
52
|
};
|
|
52
53
|
|
package/header/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eAwDrB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,sBAgBhH"}
|
package/header/internal.js
CHANGED
|
@@ -9,6 +9,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
|
9
9
|
import styles from './styles.css.js';
|
|
10
10
|
import { useMobile } from '../internal/hooks/use-mobile';
|
|
11
11
|
import { InfoLinkLabelContext } from '../internal/context/info-link-label-context';
|
|
12
|
+
import { CollectionLabelContext } from '../internal/context/collection-label-context';
|
|
12
13
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
13
14
|
import { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';
|
|
14
15
|
export default function InternalHeader(_a) {
|
|
@@ -18,7 +19,11 @@ export default function InternalHeader(_a) {
|
|
|
18
19
|
const { isStuck } = useContext(StickyHeaderContext);
|
|
19
20
|
const baseProps = getBaseProps(restProps);
|
|
20
21
|
const isRefresh = useVisualRefresh();
|
|
22
|
+
const assignHeaderId = useContext(CollectionLabelContext).assignId;
|
|
21
23
|
const headingId = useUniqueId('heading');
|
|
24
|
+
if (assignHeaderId !== undefined) {
|
|
25
|
+
assignHeaderId(headingId);
|
|
26
|
+
}
|
|
22
27
|
// If is mobile there is no need to have the dynamic variant because it's scrolled out of view
|
|
23
28
|
const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';
|
|
24
29
|
const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;
|
package/header/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAA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AS,IAC5C,IAAI,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI,IAAG,IAAI,CAAQ,CACtB,CAC5B;YACN,oBAAC,WAAW,IAAC,eAAe,EAAE,eAAe,IAAG,WAAW,CAAe,CACtE;QACL,OAAO,IAAI,CACV,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,mBAAmB,eAAe,EAAE,CAAC,EAAE,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,IAEzG,OAAO,CACJ,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAA0D;IAC/G,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IACrC,OAAO,CACL,CAAC,QAAQ,IAAI,CACX,2BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,uBAAuB,eAAe,EAAE,CAAC,EAChD,SAAS,IAAI,MAAM,CAAC,OAAO,CAC5B,IAEA,QAAQ,CACP,CACL,CAAC;QACF,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const headingId = useUniqueId('heading');\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div className={clsx(styles.main, styles[`main-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <div className={clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n <InfoLinkLabelContext.Provider value={headingId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n <Description variantOverride={variantOverride}>{description}</Description>\n </div>\n {actions && (\n <div\n className={clsx(styles.actions, styles[`actions-variant-${variantOverride}`], isRefresh && styles.refresh)}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n\nexport function Description({ children, variantOverride }: { children: React.ReactNode; variantOverride: string }) {\n const isRefresh = useVisualRefresh();\n return (\n (children && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles.refresh\n )}\n >\n {children}\n </p>\n )) ||\n null\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAMhG,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAWjB;QAXiB,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAiB,GAAG,IAAI,EACxB,wBAAwB,OAEJ,EADjB,SAAS,cAVyB,2IAWtC,CADa;IAEZ,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI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M,CAAC,uBAAuB,eAAe,EAAE,CAAC,EAChD,SAAS,IAAI,MAAM,CAAC,OAAO,CAC5B,IAEA,QAAQ,CACP,CACL,CAAC;QACF,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const assignHeaderId = useContext(CollectionLabelContext).assignId;\n const headingId = useUniqueId('heading');\n if (assignHeaderId !== undefined) {\n assignHeaderId(headingId);\n }\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div className={clsx(styles.main, styles[`main-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <div className={clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n <InfoLinkLabelContext.Provider value={headingId}>\n {info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n <Description variantOverride={variantOverride}>{description}</Description>\n </div>\n {actions && (\n <div\n className={clsx(styles.actions, styles[`actions-variant-${variantOverride}`], isRefresh && styles.refresh)}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n\nexport function Description({ children, variantOverride }: { children: React.ReactNode; variantOverride: string }) {\n const isRefresh = useVisualRefresh();\n return (\n (children && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles.refresh\n )}\n >\n {children}\n </p>\n )) ||\n null\n );\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CollectionLabellingInterface {
|
|
3
|
+
assignId?: (id: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const CollectionLabelContext: import("react").Context<CollectionLabellingInterface>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=collection-label-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-label-context.d.ts","sourceRoot":"lib/default/","sources":["internal/context/collection-label-context.ts"],"names":[],"mappings":";AAIA,UAAU,4BAA4B;IACpC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,sBAAsB,uDAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-label-context.js","sourceRoot":"lib/default/","sources":["internal/context/collection-label-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAMtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAA+B,EAAE,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext } from 'react';\n\ninterface CollectionLabellingInterface {\n assignId?: (id: string) => void;\n}\n\nexport const CollectionLabelContext = createContext<CollectionLabellingInterface>({});\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { DrawerConfig, DrawersRegistrationListener } from './drawers
|
|
1
|
+
import { DrawerConfig, DrawersRegistrationListener } from './controllers/drawers';
|
|
2
|
+
import { ActionConfig, ActionRegistrationListener } from './controllers/action-buttons';
|
|
2
3
|
interface AwsuiPluginApiPublic {
|
|
3
4
|
appLayout: {
|
|
4
5
|
registerDrawer(config: DrawerConfig): void;
|
|
5
6
|
};
|
|
7
|
+
alert: {
|
|
8
|
+
registerAction(config: ActionConfig): void;
|
|
9
|
+
};
|
|
10
|
+
flashbar: {
|
|
11
|
+
registerAction(config: ActionConfig): void;
|
|
12
|
+
};
|
|
6
13
|
}
|
|
7
14
|
interface AwsuiPluginApiInternal {
|
|
8
15
|
appLayout: {
|
|
9
16
|
clearRegisteredDrawers(): void;
|
|
10
17
|
onDrawersRegistered(listener: DrawersRegistrationListener): () => void;
|
|
11
18
|
};
|
|
19
|
+
alert: {
|
|
20
|
+
clearRegisteredActions: () => void;
|
|
21
|
+
onActionRegistered(listener: ActionRegistrationListener): () => void;
|
|
22
|
+
};
|
|
23
|
+
flashbar: {
|
|
24
|
+
clearRegisteredActions: () => void;
|
|
25
|
+
onActionRegistered(listener: ActionRegistrationListener): () => void;
|
|
26
|
+
};
|
|
12
27
|
}
|
|
13
28
|
export declare const awsuiPlugins: AwsuiPluginApiPublic, awsuiPluginsInternal: AwsuiPluginApiInternal;
|
|
14
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAqB,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAqB,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAA2B,YAAY,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAIjH,UAAU,oBAAoB;IAC5B,SAAS,EAAE;QACT,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;KAC5C,CAAC;IACF,KAAK,EAAE;QACL,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;KAC5C,CAAC;IACF,QAAQ,EAAE;QACR,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;KAC5C,CAAC;CACH;AACD,UAAU,sBAAsB;IAC9B,SAAS,EAAE;QACT,sBAAsB,IAAI,IAAI,CAAC;QAC/B,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM,IAAI,CAAC;KACxE,CAAC;IACF,KAAK,EAAE;QACL,sBAAsB,EAAE,MAAM,IAAI,CAAC;QACnC,kBAAkB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,IAAI,CAAC;KACtE,CAAC;IACF,QAAQ,EAAE;QACR,sBAAsB,EAAE,MAAM,IAAI,CAAC;QACnC,kBAAkB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,IAAI,CAAC;KACtE,CAAC;CACH;AA0CD,eAAO,MAAQ,YAAY,wBAAE,oBAAoB,wBAAc,CAAC"}
|
package/internal/plugins/api.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { DrawersController } from './drawers
|
|
3
|
+
import { DrawersController } from './controllers/drawers';
|
|
4
|
+
import { ActionButtonsController } from './controllers/action-buttons';
|
|
4
5
|
const storageKey = Symbol.for('awsui-plugin-api');
|
|
5
6
|
function findUpApi(currentWindow) {
|
|
6
7
|
try {
|
|
@@ -32,17 +33,33 @@ function loadApi() {
|
|
|
32
33
|
}
|
|
33
34
|
export const { awsuiPlugins, awsuiPluginsInternal } = loadApi();
|
|
34
35
|
function createApi() {
|
|
35
|
-
const
|
|
36
|
+
const appLayoutDrawers = new DrawersController();
|
|
37
|
+
const alertActions = new ActionButtonsController();
|
|
38
|
+
const flashbarActions = new ActionButtonsController();
|
|
36
39
|
return {
|
|
37
40
|
awsuiPlugins: {
|
|
38
41
|
appLayout: {
|
|
39
|
-
registerDrawer:
|
|
42
|
+
registerDrawer: appLayoutDrawers.registerDrawer,
|
|
43
|
+
},
|
|
44
|
+
alert: {
|
|
45
|
+
registerAction: alertActions.registerAction,
|
|
46
|
+
},
|
|
47
|
+
flashbar: {
|
|
48
|
+
registerAction: flashbarActions.registerAction,
|
|
40
49
|
},
|
|
41
50
|
},
|
|
42
51
|
awsuiPluginsInternal: {
|
|
43
52
|
appLayout: {
|
|
44
|
-
clearRegisteredDrawers:
|
|
45
|
-
onDrawersRegistered:
|
|
53
|
+
clearRegisteredDrawers: appLayoutDrawers.clearRegisteredDrawers,
|
|
54
|
+
onDrawersRegistered: appLayoutDrawers.onDrawersRegistered,
|
|
55
|
+
},
|
|
56
|
+
alert: {
|
|
57
|
+
clearRegisteredActions: alertActions.clearRegisteredActions,
|
|
58
|
+
onActionRegistered: alertActions.onActionRegistered,
|
|
59
|
+
},
|
|
60
|
+
flashbar: {
|
|
61
|
+
clearRegisteredActions: flashbarActions.clearRegisteredActions,
|
|
62
|
+
onActionRegistered: flashbarActions.onActionRegistered,
|
|
46
63
|
},
|
|
47
64
|
},
|
|
48
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"lib/default/","sources":["internal/plugins/api.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAgB,iBAAiB,EAA+B,MAAM,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"lib/default/","sources":["internal/plugins/api.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAgB,iBAAiB,EAA+B,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAAE,uBAAuB,EAA4C,MAAM,8BAA8B,CAAC;AAEjH,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAqClD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,aAAa,EAAE;YAC5D,4DAA4D;YAC5D,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,SAAS,CAAC,aAAa,CAAC,MAAuB,CAAC,CAAC;KACzD;IAAC,OAAO,EAAE,EAAE;QACX,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C;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DrawerConfig, DrawersController, DrawersRegistrationListener } from './controllers/drawers';\nimport { ActionButtonsController, ActionConfig, ActionRegistrationListener } from './controllers/action-buttons';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiPluginApiPublic {\n appLayout: {\n registerDrawer(config: DrawerConfig): void;\n };\n alert: {\n registerAction(config: ActionConfig): void;\n };\n flashbar: {\n registerAction(config: ActionConfig): void;\n };\n}\ninterface AwsuiPluginApiInternal {\n appLayout: {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n };\n alert: {\n clearRegisteredActions: () => void;\n onActionRegistered(listener: ActionRegistrationListener): () => void;\n };\n flashbar: {\n clearRegisteredActions: () => void;\n onActionRegistered(listener: ActionRegistrationListener): () => void;\n };\n}\n\ninterface AwsuiApi {\n awsuiPlugins: AwsuiPluginApiPublic;\n awsuiPluginsInternal: AwsuiPluginApiInternal;\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\nfunction loadApi() {\n if (typeof window === 'undefined') {\n return createApi();\n }\n const win = window as unknown as WindowWithApi;\n const api = findUpApi(win);\n if (api) {\n return api;\n }\n win[storageKey] = createApi();\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\nfunction createApi(): AwsuiApi {\n const appLayoutDrawers = new DrawersController();\n const alertActions = new ActionButtonsController();\n const flashbarActions = new ActionButtonsController();\n\n return {\n awsuiPlugins: {\n appLayout: {\n registerDrawer: appLayoutDrawers.registerDrawer,\n },\n alert: {\n registerAction: alertActions.registerAction,\n },\n flashbar: {\n registerAction: flashbarActions.registerAction,\n },\n },\n awsuiPluginsInternal: {\n appLayout: {\n clearRegisteredDrawers: appLayoutDrawers.clearRegisteredDrawers,\n onDrawersRegistered: appLayoutDrawers.onDrawersRegistered,\n },\n alert: {\n clearRegisteredActions: alertActions.clearRegisteredActions,\n onActionRegistered: alertActions.onActionRegistered,\n },\n flashbar: {\n clearRegisteredActions: flashbarActions.clearRegisteredActions,\n onActionRegistered: flashbarActions.onActionRegistered,\n },\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface RefShim<T> {
|
|
2
|
+
current: T | null;
|
|
3
|
+
}
|
|
4
|
+
export interface ActionContext {
|
|
5
|
+
type: string;
|
|
6
|
+
headerRef: RefShim<HTMLElement>;
|
|
7
|
+
contentRef: RefShim<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
orderPriority?: number;
|
|
12
|
+
mountContent: (container: HTMLElement, context: ActionContext) => void;
|
|
13
|
+
unmountContent: (container: HTMLElement) => void;
|
|
14
|
+
}
|
|
15
|
+
export type ActionRegistrationListener = (action: Array<ActionConfig>) => void;
|
|
16
|
+
export declare class ActionButtonsController {
|
|
17
|
+
private listeners;
|
|
18
|
+
private actions;
|
|
19
|
+
private scheduleUpdate;
|
|
20
|
+
registerAction: (action: ActionConfig) => void;
|
|
21
|
+
clearRegisteredActions: () => void;
|
|
22
|
+
onActionRegistered: (listener: ActionRegistrationListener) => () => void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=action-buttons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-buttons.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/controllers/action-buttons.ts"],"names":[],"mappings":"AAMA,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IACvE,cAAc,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AAE/E,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,OAAO,CAA2B;IAE1C,OAAO,CAAC,cAAc,CAEhB;IAEN,cAAc,WAAY,YAAY,UAIpC;IAEF,sBAAsB,aAEpB;IAEF,kBAAkB,aAAc,0BAA0B,gBAMxD;CACH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import debounce from '../../debounce';
|
|
4
|
+
import { sortByPriority } from '../helpers/utils';
|
|
5
|
+
export class ActionButtonsController {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.listeners = [];
|
|
8
|
+
this.actions = [];
|
|
9
|
+
this.scheduleUpdate = debounce(() => {
|
|
10
|
+
this.listeners.forEach(listener => listener(this.actions));
|
|
11
|
+
}, 0);
|
|
12
|
+
this.registerAction = (action) => {
|
|
13
|
+
this.actions.push(action);
|
|
14
|
+
this.actions = sortByPriority(this.actions);
|
|
15
|
+
this.scheduleUpdate();
|
|
16
|
+
};
|
|
17
|
+
this.clearRegisteredActions = () => {
|
|
18
|
+
this.actions = [];
|
|
19
|
+
};
|
|
20
|
+
this.onActionRegistered = (listener) => {
|
|
21
|
+
this.listeners.push(listener);
|
|
22
|
+
this.scheduleUpdate();
|
|
23
|
+
return () => {
|
|
24
|
+
this.listeners = this.listeners.filter(item => item !== listener);
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=action-buttons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-buttons.js","sourceRoot":"lib/default/","sources":["internal/plugins/controllers/action-buttons.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAsBlD,MAAM,OAAO,uBAAuB;IAApC;QACU,cAAS,GAAsC,EAAE,CAAC;QAClD,YAAO,GAAwB,EAAE,CAAC;QAElC,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,mBAAc,GAAG,CAAC,MAAoB,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,2BAAsB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,CAAC,CAAC;QAEF,uBAAkB,GAAG,CAAC,QAAoC,EAAE,EAAE;YAC5D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YACpE,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { sortByPriority } from '../helpers/utils';\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 ActionContext {\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\nexport interface ActionConfig {\n id: string;\n orderPriority?: number;\n mountContent: (container: HTMLElement, context: ActionContext) => void;\n unmountContent: (container: HTMLElement) => void;\n}\n\nexport type ActionRegistrationListener = (action: Array<ActionConfig>) => void;\n\nexport class ActionButtonsController {\n private listeners: Array<ActionRegistrationListener> = [];\n private actions: Array<ActionConfig> = [];\n\n private scheduleUpdate = debounce(() => {\n this.listeners.forEach(listener => listener(this.actions));\n }, 0);\n\n registerAction = (action: ActionConfig) => {\n this.actions.push(action);\n this.actions = sortByPriority(this.actions);\n this.scheduleUpdate();\n };\n\n clearRegisteredActions = () => {\n this.actions = [];\n };\n\n onActionRegistered = (listener: ActionRegistrationListener) => {\n this.listeners.push(listener);\n this.scheduleUpdate();\n return () => {\n this.listeners = this.listeners.filter(item => item !== listener);\n };\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DrawerItem } from '
|
|
1
|
+
import { DrawerItem } from '../../../app-layout/drawer/interfaces';
|
|
2
2
|
export type DrawerConfig = Omit<DrawerItem, 'content' | 'trigger'> & {
|
|
3
3
|
orderPriority?: number;
|
|
4
4
|
trigger: {
|
|
@@ -11,10 +11,9 @@ export type DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void
|
|
|
11
11
|
export declare class DrawersController {
|
|
12
12
|
private drawers;
|
|
13
13
|
private drawersRegistrationListener;
|
|
14
|
-
|
|
15
|
-
private scheduleUpdate;
|
|
14
|
+
scheduleUpdate: () => void;
|
|
16
15
|
registerDrawer: (config: DrawerConfig) => void;
|
|
17
16
|
onDrawersRegistered: (listener: DrawersRegistrationListener) => () => void;
|
|
18
17
|
clearRegisteredDrawers: () => void;
|
|
19
18
|
}
|
|
20
|
-
//# sourceMappingURL=drawers
|
|
19
|
+
//# sourceMappingURL=drawers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawers.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAGnE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,cAAc,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;CAClD,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;AAEjF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,2BAA2B,CAA4C;IAE/E,cAAc,aAER;IAEN,cAAc,WAAY,YAAY,UAGpC;IAEF,mBAAmB,aAAc,2BAA2B,gBAS1D;IAEF,sBAAsB,aAEpB;CACH"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import debounce from '../../debounce';
|
|
1
2
|
export class DrawersController {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.drawers = [];
|
|
4
5
|
this.drawersRegistrationListener = null;
|
|
5
|
-
this.
|
|
6
|
+
this.scheduleUpdate = debounce(() => {
|
|
7
|
+
var _a;
|
|
8
|
+
(_a = this.drawersRegistrationListener) === null || _a === void 0 ? void 0 : _a.call(this, this.drawers);
|
|
9
|
+
}, 0);
|
|
6
10
|
this.registerDrawer = (config) => {
|
|
7
11
|
this.drawers = this.drawers.concat(config);
|
|
8
12
|
this.scheduleUpdate();
|
|
9
13
|
};
|
|
10
14
|
this.onDrawersRegistered = (listener) => {
|
|
11
15
|
if (this.drawersRegistrationListener !== null) {
|
|
12
|
-
console.warn('[AwsUi] [runtime
|
|
16
|
+
console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');
|
|
13
17
|
}
|
|
14
18
|
this.drawersRegistrationListener = listener;
|
|
15
19
|
this.scheduleUpdate();
|
|
@@ -21,14 +25,5 @@ export class DrawersController {
|
|
|
21
25
|
this.drawers = [];
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
|
-
scheduleUpdate() {
|
|
25
|
-
if (this.updateTimeout) {
|
|
26
|
-
clearTimeout(this.updateTimeout);
|
|
27
|
-
}
|
|
28
|
-
this.updateTimeout = setTimeout(() => {
|
|
29
|
-
var _a;
|
|
30
|
-
(_a = this.drawersRegistrationListener) === null || _a === void 0 ? void 0 : _a.call(this, this.drawers);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
28
|
}
|
|
34
|
-
//# sourceMappingURL=drawers
|
|
29
|
+
//# sourceMappingURL=drawers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawers.js","sourceRoot":"lib/default/","sources":["internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAYtC,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QAE/E,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI,CAAC,2BAA2B,qDAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,mBAAc,GAAG,CAAC,MAAoB,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,wBAAmB,GAAG,CAAC,QAAqC,EAAE,EAAE;YAC9D,IAAI,IAAI,CAAC,2BAA2B,KAAK,IAAI,EAAE;gBAC7C,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;aAClF;YACD,IAAI,CAAC,2BAA2B,GAAG,QAAQ,CAAC;YAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;YAC1C,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,2BAAsB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;CAAA","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DrawerItem } from '../../../app-layout/drawer/interfaces';\nimport debounce from '../../debounce';\n\nexport type DrawerConfig = Omit<DrawerItem, 'content' | 'trigger'> & {\n orderPriority?: number;\n trigger: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement) => void;\n unmountContent: (container: HTMLElement) => void;\n};\nexport type DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { RuntimeContentWrapper } from './runtime-content-wrapper';
|
|
4
|
+
export { createUseDiscoveredAction } from './use-discovered-action';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface RuntimeContentWrapperProps {
|
|
3
|
+
mountContent: (container: HTMLElement) => void;
|
|
4
|
+
unmountContent: (container: HTMLElement) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function RuntimeContentWrapper({ mountContent, unmountContent }: RuntimeContentWrapperProps): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=runtime-content-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-content-wrapper.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/runtime-content-wrapper.tsx"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,cAAc,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,qBAAqB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,0BAA0B,eAWjG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
export function RuntimeContentWrapper({ mountContent, unmountContent }) {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const container = ref.current;
|
|
8
|
+
mountContent(container);
|
|
9
|
+
return () => unmountContent(container);
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
+
}, []);
|
|
12
|
+
return React.createElement("div", { ref: ref });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=runtime-content-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-content-wrapper.js","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/runtime-content-wrapper.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAOjD,MAAM,UAAU,qBAAqB,CAAC,EAAE,YAAY,EAAE,cAAc,EAA8B;IAChG,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,GAAG,CAAC,OAAQ,CAAC;QAC/B,YAAY,CAAC,SAAS,CAAC,CAAC;QACxB,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,6BAAK,GAAG,EAAE,GAAG,GAAQ,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\n\ninterface RuntimeContentWrapperProps {\n mountContent: (container: HTMLElement) => void;\n unmountContent: (container: HTMLElement) => void;\n}\n\nexport function RuntimeContentWrapper({ mountContent, unmountContent }: RuntimeContentWrapperProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const container = ref.current!;\n mountContent(container);\n return () => unmountContent(container);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return <div ref={ref}></div>;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActionButtonsController } from '../controllers/action-buttons';
|
|
3
|
+
export declare function createUseDiscoveredAction(onActionRegistered: ActionButtonsController['onActionRegistered']): (type: string) => {
|
|
4
|
+
discoveredActions: React.ReactNode[];
|
|
5
|
+
headerRef: React.RefObject<HTMLDivElement>;
|
|
6
|
+
contentRef: React.RefObject<HTMLDivElement>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use-discovered-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-discovered-action.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAgBrG,wBAAgB,yBAAyB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,UAC/D,MAAM;;;;EAajD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { RuntimeContentWrapper } from './runtime-content-wrapper';
|
|
5
|
+
function convertRuntimeAction(action, context) {
|
|
6
|
+
if (!action) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (React.createElement(RuntimeContentWrapper, { key: action.id + '-' + context.type, mountContent: container => action.mountContent(container, context), unmountContent: container => action.unmountContent(container) }));
|
|
10
|
+
}
|
|
11
|
+
export function createUseDiscoveredAction(onActionRegistered) {
|
|
12
|
+
return function useDiscoveredAction(type) {
|
|
13
|
+
const [discoveredActions, setDiscoveredActions] = useState([]);
|
|
14
|
+
const headerRef = useRef(null);
|
|
15
|
+
const contentRef = useRef(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
return onActionRegistered(actions => {
|
|
18
|
+
setDiscoveredActions(actions.map(action => convertRuntimeAction(action, { type, headerRef, contentRef })));
|
|
19
|
+
});
|
|
20
|
+
}, [type]);
|
|
21
|
+
return { discoveredActions, headerRef, contentRef };
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=use-discovered-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-discovered-action.js","sourceRoot":"lib/default/","sources":["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;AAE3D,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;QAC9C,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';\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 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 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,OAO/F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function sortByPriority(items) {
|
|
4
|
+
return items.slice().sort((a, b) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if (b.orderPriority !== a.orderPriority) {
|
|
7
|
+
return Math.sign(((_a = b.orderPriority) !== null && _a !== void 0 ? _a : 0) - ((_b = a.orderPriority) !== null && _b !== void 0 ? _b : 0));
|
|
8
|
+
}
|
|
9
|
+
return b.id < a.id ? 1 : -1;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["internal/plugins/helpers/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,UAAU,cAAc,CAAmD,KAAe;IAC9F,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;QACjC,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC,aAAa,EAAE;YACvC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC,CAAC,CAAC;SACnE;QACD,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function sortByPriority<T extends { orderPriority?: number; id: string }>(items: Array<T>) {\n return items.slice().sort((a, b) => {\n if (b.orderPriority !== a.orderPriority) {\n return Math.sign((b.orderPriority ?? 0) - (a.orderPriority ?? 0));\n }\n return b.id < a.id ? 1 : -1;\n });\n}\n"]}
|
package/package.json
CHANGED