@cloudscape-design/components-themeable 3.0.974 → 3.0.976
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/drawer/styles.scss +14 -0
- package/lib/internal/scss/link/styles.scss +1 -1
- package/lib/internal/template/annotation-context/index.js +2 -2
- package/lib/internal/template/annotation-context/index.js.map +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts +6 -0
- package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts.map +1 -0
- package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.js +29 -0
- package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.js.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +7 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
- package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.d.ts +18 -0
- package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.d.ts.map +1 -0
- package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.js +4 -0
- package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.js.map +1 -0
- package/lib/internal/template/app-layout-toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout-toolbar/index.js +9 -1
- package/lib/internal/template/app-layout-toolbar/index.js.map +1 -1
- package/lib/internal/template/date-input/internal.d.ts.map +1 -1
- package/lib/internal/template/date-input/internal.js +3 -16
- package/lib/internal/template/date-input/internal.js.map +1 -1
- package/lib/internal/template/date-input/utils.d.ts +7 -0
- package/lib/internal/template/date-input/utils.d.ts.map +1 -0
- package/lib/internal/template/date-input/utils.js +25 -0
- package/lib/internal/template/date-input/utils.js.map +1 -0
- package/lib/internal/template/date-range-picker/calendar/grids/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/interfaces.d.ts +3 -4
- package/lib/internal/template/date-range-picker/calendar/grids/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/interfaces.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/header-button.d.ts +0 -2
- package/lib/internal/template/date-range-picker/calendar/header/header-button.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/header-button.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/index.d.ts +2 -3
- package/lib/internal/template/date-range-picker/calendar/header/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/header/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.d.ts +2 -2
- package/lib/internal/template/date-range-picker/calendar/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts +3 -3
- package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.d.ts +2 -2
- package/lib/internal/template/date-range-picker/dropdown.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.js.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts +2 -7
- package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
- package/lib/internal/template/date-range-picker/relative-range/index.d.ts +2 -2
- package/lib/internal/template/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/relative-range/index.js.map +1 -1
- package/lib/internal/template/drawer/implementation.d.ts +1 -1
- package/lib/internal/template/drawer/implementation.d.ts.map +1 -1
- package/lib/internal/template/drawer/implementation.js +4 -2
- package/lib/internal/template/drawer/implementation.js.map +1 -1
- package/lib/internal/template/drawer/interfaces.d.ts +4 -0
- package/lib/internal/template/drawer/interfaces.d.ts.map +1 -1
- package/lib/internal/template/drawer/interfaces.js.map +1 -1
- package/lib/internal/template/drawer/styles.css.js +6 -5
- package/lib/internal/template/drawer/styles.scoped.css +23 -10
- package/lib/internal/template/drawer/styles.selectors.js +6 -5
- package/lib/internal/template/i18n/provider.js +2 -2
- package/lib/internal/template/i18n/provider.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.js +2 -2
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +2 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +8 -2
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +2 -0
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +2 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/generated/theming/index.cjs +4 -0
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +18 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +18 -0
- package/lib/internal/template/internal/generated/theming/index.js +4 -0
- package/lib/internal/template/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-base-component/index.js +8 -5
- package/lib/internal/template/internal/hooks/use-base-component/index.js.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/alert-flash-content.d.ts +2 -0
- package/lib/internal/template/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/alert-flash-content.js.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +6 -0
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js +17 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
- package/lib/internal/template/internal/plugins/helpers/use-discovered-content.d.ts +7 -7
- package/lib/internal/template/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/helpers/use-discovered-content.js +5 -2
- package/lib/internal/template/internal/plugins/helpers/use-discovered-content.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +73 -71
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/popover/container.d.ts.map +1 -1
- package/lib/internal/template/popover/container.js +20 -7
- package/lib/internal/template/popover/container.js.map +1 -1
- package/lib/internal/template/table/body-cell/inline-editor.d.ts.map +1 -1
- package/lib/internal/template/table/body-cell/inline-editor.js +2 -1
- package/lib/internal/template/table/body-cell/inline-editor.js.map +1 -1
- package/lib/internal/template/test-utils/dom/drawer/index.d.ts +1 -0
- package/lib/internal/template/test-utils/dom/drawer/index.js +3 -0
- package/lib/internal/template/test-utils/dom/drawer/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/drawer/index.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/drawer/index.js +3 -0
- package/lib/internal/template/test-utils/selectors/drawer/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/internal/template/internal/hooks/use-telemetry/index.d.ts +0 -3
- package/lib/internal/template/internal/hooks/use-telemetry/index.d.ts.map +0 -1
- package/lib/internal/template/internal/hooks/use-telemetry/index.js +0 -12
- package/lib/internal/template/internal/hooks/use-telemetry/index.js.map +0 -1
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { useComponentMetadata, useFocusVisible, } from '@cloudscape-design/component-toolkit/internal';
|
|
2
|
-
import { PACKAGE_VERSION } from '../../environment';
|
|
3
|
-
import {
|
|
1
|
+
import { useComponentMetadata, useComponentMetrics, useFocusVisible, } from '@cloudscape-design/component-toolkit/internal';
|
|
2
|
+
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';
|
|
3
|
+
import { getVisualTheme } from '../../utils/get-visual-theme';
|
|
4
|
+
import { useVisualRefresh } from '../use-visual-mode';
|
|
4
5
|
/**
|
|
5
6
|
* This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
|
|
6
7
|
* attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this
|
|
7
8
|
* root DOM node and emits the telemetry for this component.
|
|
8
9
|
*/
|
|
9
10
|
export default function useBaseComponent(componentName, config, analyticsMetadata) {
|
|
10
|
-
|
|
11
|
+
const isVisualRefresh = useVisualRefresh();
|
|
12
|
+
const theme = getVisualTheme(THEME, isVisualRefresh);
|
|
13
|
+
useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
|
|
11
14
|
useFocusVisible();
|
|
12
|
-
const elementRef = useComponentMetadata(componentName, PACKAGE_VERSION,
|
|
15
|
+
const elementRef = useComponentMetadata(componentName, { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme }, analyticsMetadata);
|
|
13
16
|
return { __internalRootRef: elementRef };
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
|
|
@@ -3,11 +3,13 @@ interface RefShim<T> {
|
|
|
3
3
|
current: T | null;
|
|
4
4
|
}
|
|
5
5
|
interface AlertFlashContentContext {
|
|
6
|
+
instanceId: string;
|
|
6
7
|
type: string;
|
|
7
8
|
headerRef: RefShim<HTMLElement>;
|
|
8
9
|
contentRef: RefShim<HTMLElement>;
|
|
9
10
|
}
|
|
10
11
|
interface AlertFlashContentInitialContext {
|
|
12
|
+
instanceId: string;
|
|
11
13
|
type: string;
|
|
12
14
|
header?: ReactNode;
|
|
13
15
|
content?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,UAAU,cAAc;IACtB,UAAU,IAAI,IAAI,CAAC;IACnB,aAAa,IAAI,IAAI,CAAC;IACtB,aAAa,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,WAAW,IAAI,IAAI,CAAC;IACpB,cAAc,IAAI,IAAI,CAAC;IACvB,cAAc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,CAAC,EAAE,CAAC,OAAO,EAAE,+BAA+B,KAAK,OAAO,CAAC;CACtE;AAED,KAAK,qCAAqC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,KAAK,MAAM,IAAI,CAAC;AAE/F,MAAM,WAAW,0BAA0B;IACzC,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,4BAA4B;IAC3C,uBAAuB,IAAI,IAAI,CAAC;IAChC,mBAAmB,CAAC,QAAQ,EAAE,qCAAqC,GAAG,MAAM,IAAI,CAAC;IACjF,YAAY,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC;CACjE;AAED,qBAAa,2BAA2B;;IAgBtC,uBAAuB,YAAa,uBAAuB,UAYzD;IAEF,uBAAuB,aAErB;IAEF,YAAY,YAAa,+BAA+B,KAAG,OAAO,CAKhE;IAEF,mBAAmB,aAAc,qCAAqC,gBAapE;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAAG,0BAA0B;IAKxF,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAAG,4BAA4B;CAMvG"}
|
|
@@ -1 +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;;;AAItC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"alert-flash-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;;AAItC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAuD7D,MAAM,OAAO,2B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BACzC,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;IAaJ,CAAC;IAXC,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,MAAA,WAAW,CAAC,YAAY,oCAAxB,WAAW,CAAC,YAAY,GAAK,IAAI,CAAC,YAAY,EAAC;QAC/C,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 { ReactNode } from 'react';\n\nimport debounce from '../../debounce';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\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\ninterface AlertFlashContentContext {\n instanceId: string;\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\ninterface AlertFlashContentInitialContext {\n instanceId: string;\n type: string;\n header?: ReactNode;\n content?: ReactNode;\n}\n\nexport type ReplacementType = 'original' | 'remove' | 'replaced';\n\ninterface 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 initialCheck?: (context: AlertFlashContentInitialContext) => boolean;\n}\n\ntype 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 initialCheck(context: AlertFlashContentInitialContext): boolean;\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 reportRuntimeApiWarning(\n 'alert-flash-content',\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 initialCheck = (context: AlertFlashContentInitialContext): boolean => {\n if (this.#provider?.initialCheck) {\n return this.#provider.initialCheck(context);\n }\n return false;\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 internalApi.initialCheck ??= this.initialCheck;\n return internalApi as AlertFlashContentApiInternal;\n }\n}\n"]}
|
|
@@ -39,6 +39,7 @@ export type UpdateDrawerConfig = {
|
|
|
39
39
|
id: DrawerConfig['id'];
|
|
40
40
|
} & Partial<Pick<DrawerConfig, (typeof updatableProperties)[number]>>;
|
|
41
41
|
type DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;
|
|
42
|
+
type DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;
|
|
42
43
|
export type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;
|
|
43
44
|
interface OpenCloseDrawerParams {
|
|
44
45
|
initiatedByUserAction: boolean;
|
|
@@ -54,12 +55,15 @@ export interface DrawersApiInternal {
|
|
|
54
55
|
onDrawersRegistered(listener: DrawersRegistrationListener): () => void;
|
|
55
56
|
onDrawerOpened(listener: DrawersToggledListener): () => void;
|
|
56
57
|
onDrawerClosed(listener: DrawersToggledListener): () => void;
|
|
58
|
+
onDrawersUpdated(listener: DrawersUpdateListener): void;
|
|
59
|
+
getDrawersState(): Array<DrawerConfig>;
|
|
57
60
|
}
|
|
58
61
|
export declare class DrawersController {
|
|
59
62
|
private drawers;
|
|
60
63
|
private drawersRegistrationListener;
|
|
61
64
|
private drawerOpenedListener;
|
|
62
65
|
private drawerClosedListener;
|
|
66
|
+
private drawersUpdateListeners;
|
|
63
67
|
scheduleUpdate: () => void;
|
|
64
68
|
registerDrawer: (config: DrawerConfig) => void;
|
|
65
69
|
updateDrawer: ({ id: drawerId, ...rest }: UpdateDrawerConfig) => void;
|
|
@@ -69,6 +73,8 @@ export declare class DrawersController {
|
|
|
69
73
|
onDrawerClosed: (listener: DrawersToggledListener) => () => void;
|
|
70
74
|
openDrawer: (drawerId: string, params?: OpenCloseDrawerParams) => void;
|
|
71
75
|
closeDrawer: (drawerId: string, params?: OpenCloseDrawerParams) => void;
|
|
76
|
+
onDrawersUpdated: (listener: DrawersUpdateListener) => () => void;
|
|
77
|
+
getDrawersState: () => DrawerConfig[];
|
|
72
78
|
installPublic(api?: Partial<DrawersApiPublic>): DrawersApiPublic;
|
|
73
79
|
installInternal(internalApi?: Partial<DrawersApiInternal>): DrawersApiInternal;
|
|
74
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGzD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,O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BAAsB,GAAG,MAAM,IAAI,CAAC;IAC7D,cAAc,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;IAC7D,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACxD,eAAe,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;CACxC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,2BAA2B,CAA4C;IAC/E,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,sBAAsB,CAAoC;IAElE,cAAc,aAKR;IAEN,cAAc,WAAY,YAAY,UAMpC;IAEF,YAAY,8BAA+B,kBAAkB,UAgB3D;IAEF,mBAAmB,aAAc,2BAA2B,gBAa1D;IAEF,sBAAsB,aAEpB;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,UAAU,aAAc,MAAM,WAAW,qBAAqB,UAE5D;IAEF,WAAW,aAAc,MAAM,WAAW,qBAAqB,UAE7D;IAEF,gBAAgB,aAAc,qBAAqB,gBAMjD;IAEF,eAAe,uBAEb;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;IAQpE,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,kBAAkB;CASnF"}
|
|
@@ -17,9 +17,13 @@ export class DrawersController {
|
|
|
17
17
|
this.drawersRegistrationListener = null;
|
|
18
18
|
this.drawerOpenedListener = null;
|
|
19
19
|
this.drawerClosedListener = null;
|
|
20
|
+
this.drawersUpdateListeners = [];
|
|
20
21
|
this.scheduleUpdate = debounce(() => {
|
|
21
22
|
var _a;
|
|
22
23
|
(_a = this.drawersRegistrationListener) === null || _a === void 0 ? void 0 : _a.call(this, this.drawers);
|
|
24
|
+
this.drawersUpdateListeners.forEach(drawersUpdateListeners => {
|
|
25
|
+
drawersUpdateListeners === null || drawersUpdateListeners === void 0 ? void 0 : drawersUpdateListeners(this.drawers);
|
|
26
|
+
});
|
|
23
27
|
}, 0);
|
|
24
28
|
this.registerDrawer = (config) => {
|
|
25
29
|
if (this.drawers.find(drawer => drawer.id === config.id)) {
|
|
@@ -55,6 +59,7 @@ export class DrawersController {
|
|
|
55
59
|
this.scheduleUpdate();
|
|
56
60
|
return () => {
|
|
57
61
|
this.drawersRegistrationListener = null;
|
|
62
|
+
this.drawersUpdateListeners = [];
|
|
58
63
|
};
|
|
59
64
|
};
|
|
60
65
|
this.clearRegisteredDrawers = () => {
|
|
@@ -86,6 +91,15 @@ export class DrawersController {
|
|
|
86
91
|
var _a;
|
|
87
92
|
(_a = this.drawerClosedListener) === null || _a === void 0 ? void 0 : _a.call(this, drawerId, params);
|
|
88
93
|
};
|
|
94
|
+
this.onDrawersUpdated = (listener) => {
|
|
95
|
+
this.drawersUpdateListeners.push(listener);
|
|
96
|
+
return () => {
|
|
97
|
+
this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
this.getDrawersState = () => {
|
|
101
|
+
return this.drawers;
|
|
102
|
+
};
|
|
89
103
|
}
|
|
90
104
|
installPublic(api = {}) {
|
|
91
105
|
var _a, _b, _c, _d;
|
|
@@ -96,11 +110,13 @@ export class DrawersController {
|
|
|
96
110
|
return api;
|
|
97
111
|
}
|
|
98
112
|
installInternal(internalApi = {}) {
|
|
99
|
-
var _a, _b, _c, _d;
|
|
113
|
+
var _a, _b, _c, _d, _e, _f;
|
|
100
114
|
(_a = internalApi.clearRegisteredDrawers) !== null && _a !== void 0 ? _a : (internalApi.clearRegisteredDrawers = this.clearRegisteredDrawers);
|
|
101
115
|
(_b = internalApi.onDrawersRegistered) !== null && _b !== void 0 ? _b : (internalApi.onDrawersRegistered = this.onDrawersRegistered);
|
|
102
116
|
(_c = internalApi.onDrawerOpened) !== null && _c !== void 0 ? _c : (internalApi.onDrawerOpened = this.onDrawerOpened);
|
|
103
117
|
(_d = internalApi.onDrawerClosed) !== null && _d !== void 0 ? _d : (internalApi.onDrawerClosed = this.onDrawerClosed);
|
|
118
|
+
(_e = internalApi.onDrawersUpdated) !== null && _e !== void 0 ? _e : (internalApi.onDrawersUpdated = this.onDrawersUpdated);
|
|
119
|
+
(_f = internalApi.getDrawersState) !== null && _f !== void 0 ? _f : (internalApi.getDrawersState = this.getDrawersState);
|
|
104
120
|
return internalApi;
|
|
105
121
|
}
|
|
106
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAsC7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AA4BX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAEnE,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,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,EAAE;gBACxD,uBAAuB,CAAC,oBAAoB,EAAE,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AlB,GAAG,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QAC3C,MAAA,GAAG,CAAC,YAAY,oCAAhB,GAAG,CAAC,YAAY,GAAK,IAAI,CAAC,YAAY,EAAC;QACvC,MAAA,GAAG,CAAC,UAAU,oCAAd,GAAG,CAAC,UAAU,GAAK,IAAI,CAAC,UAAU,EAAC;QACnC,MAAA,GAAG,CAAC,WAAW,oCAAf,GAAG,CAAC,WAAW,GAAK,IAAI,CAAC,WAAW,EAAC;QACrC,OAAO,GAAuB,CAAC;IACjC,CAAC;IAED,eAAe,CAAC,cAA2C,EAAE;;QAC3D,MAAA,WAAW,CAAC,sBAAsB,oCAAlC,WAAW,CAAC,sBAAsB,GAAK,IAAI,CAAC,sBAAsB,EAAC;QACnE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\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 onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAsC7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AA+BX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,2BAAsB,GAAiC,EAAE,CAAC;QAElE,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI,CAAC,2BAA2B,qDAAG,IAAI,CAAC,OAAO,CAAC,CAAC;YACjD,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;gBAC3D,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAG,IAAI,CAAC,OAAO,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,mBAAc,GAAG,CAAC,MAAoB,EAAE,EAAE;YACxC,IA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c,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,gBAAgB,oCAA5B,WAAW,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,EAAC;QACvD,MAAA,WAAW,CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AlertFlashContentApiInternal, ReplacementType } from '../controllers/alert-flash-content';
|
|
3
3
|
export declare function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal): ({ type, header, children, }: {
|
|
4
4
|
type: string;
|
|
5
|
-
header: ReactNode;
|
|
6
|
-
children: ReactNode;
|
|
5
|
+
header: React.ReactNode;
|
|
6
|
+
children: React.ReactNode;
|
|
7
7
|
}) => {
|
|
8
8
|
initialHidden: boolean;
|
|
9
9
|
headerReplacementType: ReplacementType;
|
|
10
10
|
contentReplacementType: ReplacementType;
|
|
11
|
-
headerRef:
|
|
12
|
-
replacementHeaderRef:
|
|
13
|
-
contentRef:
|
|
14
|
-
replacementContentRef:
|
|
11
|
+
headerRef: React.Ref<HTMLDivElement>;
|
|
12
|
+
replacementHeaderRef: React.Ref<HTMLDivElement>;
|
|
13
|
+
contentRef: React.Ref<HTMLDivElement>;
|
|
14
|
+
replacementContentRef: React.Ref<HTMLDivElement>;
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=use-discovered-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EACL,4BAA4B,EAE5B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAG5C,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,4BAA4B;UAMhG,MAAM;YACJ,MAAM,SAAS;cACb,MAAM,SAAS;;;;;;;;;EAiG5B"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useUniqueId } from '../../hooks/use-unique-id';
|
|
4
5
|
import { reportRuntimeApiWarning } from './metrics';
|
|
5
6
|
export function createUseDiscoveredContent(componentName, controller) {
|
|
6
7
|
return function useDiscoveredContent({ type, header, children, }) {
|
|
8
|
+
const instanceId = useUniqueId(`${componentName}-discovered-content`);
|
|
7
9
|
const headerRef = useRef(null);
|
|
8
10
|
const contentRef = useRef(null);
|
|
9
11
|
const replacementHeaderRef = useRef(null);
|
|
10
12
|
const replacementContentRef = useRef(null);
|
|
11
13
|
const [initialHidden, setInitialHidden] = useState(() => controller.initialCheck({
|
|
14
|
+
instanceId,
|
|
12
15
|
type,
|
|
13
16
|
header,
|
|
14
17
|
content: children,
|
|
@@ -17,7 +20,7 @@ export function createUseDiscoveredContent(componentName, controller) {
|
|
|
17
20
|
const [contentReplacementType, setFoundContentReplacement] = useState('original');
|
|
18
21
|
const mountedProvider = useRef();
|
|
19
22
|
useEffect(() => {
|
|
20
|
-
const context = { type, headerRef, contentRef };
|
|
23
|
+
const context = { instanceId, type, headerRef, contentRef };
|
|
21
24
|
setInitialHidden(false);
|
|
22
25
|
return controller.onContentRegistered(provider => {
|
|
23
26
|
let mounted = true;
|
|
@@ -71,7 +74,7 @@ export function createUseDiscoveredContent(componentName, controller) {
|
|
|
71
74
|
mounted = false;
|
|
72
75
|
};
|
|
73
76
|
});
|
|
74
|
-
}, [type]);
|
|
77
|
+
}, [instanceId, type]);
|
|
75
78
|
useEffect(() => {
|
|
76
79
|
var _a;
|
|
77
80
|
(_a = mountedProvider.current) === null || _a === void 0 ? void 0 : _a.update();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAMxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,UAAU,0BAA0B,CAAC,aAAqB,EAAE,UAAwC;IACxG,OAAO,SAAS,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GAKT;QACC,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,aAAa,qBAAqB,CAAC,CAAC;QACtE,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC1D,MAAM,qBAAqB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CACtD,UAAU,CAAC,YAAY,CAAC;YACtB,UAAU;YACV,IAAI;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AAI,YAAY,CAAC,aAAa,CAAC,EAAE;4BAC/B,0BAA0B,CAAC,QAAQ,CAAC,CAAC;yBACtC;oBACH,CAAC;oBACD,cAAc;wBACZ,IAAI,YAAY,CAAC,gBAAgB,CAAC,EAAE;4BAClC,0BAA0B,CAAC,UAAU,CAAC,CAAC;yBACxC;oBACH,CAAC;oBACD,cAAc,CAAC,QAA0C;wBACvD,IAAI,YAAY,CAAC,gBAAgB,CAAC,EAAE;4BAClC,QAAQ,CAAC,qBAAqB,CAAC,OAAQ,CAAC,CAAC;4BACzC,0BAA0B,CAAC,UAAU,CAAC,CAAC;yBACxC;oBACH,CAAC;iBACF,CAAC,CAAC;gBAEH,OAAO,GAAG,EAAE;;oBACV,MAAA,eAAe,CAAC,OAAO,0CAAE,OAAO,CAAC;wBAC/B,0BAA0B,EAAE,oBAAoB,CAAC,OAAQ;wBACzD,2BAA2B,EAAE,qBAAqB,CAAC,OAAQ;qBAC5D,CAAC,CAAC;oBACH,OAAO,GAAG,KAAK,CAAC;gBAClB,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QAEvB,SAAS,CAAC,GAAG,EAAE;;YACb,MAAA,eAAe,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QACpC,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE7B,OAAO;YACL,aAAa;YACb,qBAAqB;YACrB,sBAAsB;YACtB,SAAS,EAAE,SAAsC;YACjD,oBAAoB,EAAE,oBAAiD;YACvE,UAAU,EAAE,UAAuC;YACnD,qBAAqB,EAAE,qBAAkD;SAC1E,CAAC;IACJ,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 { useUniqueId } from '../../hooks/use-unique-id';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentResult,\n ReplacementType,\n} from '../controllers/alert-flash-content';\nimport { reportRuntimeApiWarning } from './metrics';\n\nexport function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal) {\n return function useDiscoveredContent({\n type,\n header,\n children,\n }: {\n type: string;\n header: React.ReactNode;\n children: React.ReactNode;\n }) {\n const instanceId = useUniqueId(`${componentName}-discovered-content`);\n const headerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const replacementHeaderRef = useRef<HTMLDivElement>(null);\n const replacementContentRef = useRef<HTMLDivElement>(null);\n const [initialHidden, setInitialHidden] = useState(() =>\n controller.initialCheck({\n instanceId,\n type,\n header,\n content: children,\n })\n );\n const [headerReplacementType, setFoundHeaderReplacement] = useState<ReplacementType>('original');\n const [contentReplacementType, setFoundContentReplacement] = useState<ReplacementType>('original');\n const mountedProvider = useRef<AlertFlashContentResult | undefined>();\n\n useEffect(() => {\n const context = { instanceId, type, headerRef, contentRef };\n\n setInitialHidden(false);\n\n return controller.onContentRegistered(provider => {\n let mounted = true;\n\n function checkMounted(methodName: string) {\n if (!mounted) {\n reportRuntimeApiWarning(\n `${componentName}-content-replacer`,\n `\"${methodName}\" called after component unmounted`\n );\n return false;\n }\n return true;\n }\n\n mountedProvider.current = provider.runReplacer(context, {\n hideHeader() {\n if (checkMounted('hideHeader')) {\n setFoundHeaderReplacement('remove');\n }\n },\n restoreHeader() {\n if (checkMounted('restoreHeader')) {\n setFoundHeaderReplacement('original');\n }\n },\n replaceHeader(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceHeader')) {\n replacer(replacementHeaderRef.current!);\n setFoundHeaderReplacement('replaced');\n }\n },\n hideContent() {\n if (checkMounted('hideContent')) {\n setFoundContentReplacement('remove');\n }\n },\n restoreContent() {\n if (checkMounted('restoreContent')) {\n setFoundContentReplacement('original');\n }\n },\n replaceContent(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceContent')) {\n replacer(replacementContentRef.current!);\n setFoundContentReplacement('replaced');\n }\n },\n });\n\n return () => {\n mountedProvider.current?.unmount({\n replacementHeaderContainer: replacementHeaderRef.current!,\n replacementContentContainer: replacementContentRef.current!,\n });\n mounted = false;\n };\n });\n }, [instanceId, type]);\n\n useEffect(() => {\n mountedProvider.current?.update();\n }, [type, header, children]);\n\n return {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRef as React.Ref<HTMLDivElement>,\n replacementHeaderRef: replacementHeaderRef as React.Ref<HTMLDivElement>,\n contentRef: contentRef as React.Ref<HTMLDivElement>,\n replacementContentRef: replacementContentRef as React.Ref<HTMLDivElement>,\n };\n };\n}\n"]}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"link": "
|
|
5
|
-
"variant-secondary": "awsui_variant-
|
|
6
|
-
"variant-primary": "awsui_variant-
|
|
7
|
-
"variant-info": "awsui_variant-
|
|
8
|
-
"variant-value-large": "awsui_variant-value-
|
|
9
|
-
"variant-top-navigation": "awsui_variant-top-
|
|
10
|
-
"variant-recovery": "awsui_variant-
|
|
11
|
-
"button": "
|
|
12
|
-
"color-inverted": "awsui_color-
|
|
13
|
-
"font-size-body-s": "awsui_font-size-body-
|
|
14
|
-
"font-size-body-m": "awsui_font-size-body-
|
|
15
|
-
"font-size-heading-xs": "awsui_font-size-heading-
|
|
16
|
-
"font-size-heading-s": "awsui_font-size-heading-
|
|
17
|
-
"font-size-heading-m": "awsui_font-size-heading-
|
|
18
|
-
"font-size-heading-l": "awsui_font-size-heading-
|
|
19
|
-
"font-size-heading-xl": "awsui_font-size-heading-
|
|
20
|
-
"font-size-display-l": "awsui_font-size-display-
|
|
21
|
-
"font-size-inherit": "awsui_font-size-
|
|
22
|
-
"icon-wrapper": "awsui_icon-
|
|
23
|
-
"icon": "
|
|
4
|
+
"link": "awsui_link_4c84z_ula7o_145",
|
|
5
|
+
"variant-secondary": "awsui_variant-secondary_4c84z_ula7o_211",
|
|
6
|
+
"variant-primary": "awsui_variant-primary_4c84z_ula7o_246",
|
|
7
|
+
"variant-info": "awsui_variant-info_4c84z_ula7o_279",
|
|
8
|
+
"variant-value-large": "awsui_variant-value-large_4c84z_ula7o_314",
|
|
9
|
+
"variant-top-navigation": "awsui_variant-top-navigation_4c84z_ula7o_346",
|
|
10
|
+
"variant-recovery": "awsui_variant-recovery_4c84z_ula7o_381",
|
|
11
|
+
"button": "awsui_button_4c84z_ula7o_414",
|
|
12
|
+
"color-inverted": "awsui_color-inverted_4c84z_ula7o_449",
|
|
13
|
+
"font-size-body-s": "awsui_font-size-body-s_4c84z_ula7o_470",
|
|
14
|
+
"font-size-body-m": "awsui_font-size-body-m_4c84z_ula7o_477",
|
|
15
|
+
"font-size-heading-xs": "awsui_font-size-heading-xs_4c84z_ula7o_483",
|
|
16
|
+
"font-size-heading-s": "awsui_font-size-heading-s_4c84z_ula7o_489",
|
|
17
|
+
"font-size-heading-m": "awsui_font-size-heading-m_4c84z_ula7o_496",
|
|
18
|
+
"font-size-heading-l": "awsui_font-size-heading-l_4c84z_ula7o_503",
|
|
19
|
+
"font-size-heading-xl": "awsui_font-size-heading-xl_4c84z_ula7o_510",
|
|
20
|
+
"font-size-display-l": "awsui_font-size-display-l_4c84z_ula7o_517",
|
|
21
|
+
"font-size-inherit": "awsui_font-size-inherit_4c84z_ula7o_524",
|
|
22
|
+
"icon-wrapper": "awsui_icon-wrapper_4c84z_ula7o_532",
|
|
23
|
+
"icon": "awsui_icon_4c84z_ula7o_532"
|
|
24
24
|
};
|
|
25
25
|
|