@cloudscape-design/components 3.0.750 → 3.0.752
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/actions-wrapper/index.d.ts +1 -1
- package/alert/actions-wrapper/index.d.ts.map +1 -1
- package/alert/actions-wrapper/index.js +2 -2
- package/alert/actions-wrapper/index.js.map +1 -1
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +15 -5
- package/alert/internal.js.map +1 -1
- package/alert/styles.css.js +27 -25
- package/alert/styles.scoped.css +45 -39
- package/alert/styles.selectors.js +27 -25
- package/app-layout/drawer/styles.css.js +13 -13
- package/app-layout/drawer/styles.scoped.css +22 -22
- package/app-layout/drawer/styles.selectors.js +13 -13
- package/app-layout/mobile-toolbar/styles.css.js +8 -8
- package/app-layout/mobile-toolbar/styles.scoped.css +10 -10
- package/app-layout/mobile-toolbar/styles.selectors.js +8 -8
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +16 -16
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +34 -34
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +16 -16
- package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +12 -12
- package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +17 -17
- package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +12 -12
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.css.js +6 -6
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.scoped.css +24 -24
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.selectors.js +6 -6
- package/breadcrumb-group/implementation.d.ts.map +1 -1
- package/breadcrumb-group/implementation.js +1 -1
- package/breadcrumb-group/implementation.js.map +1 -1
- package/breadcrumb-group/interfaces.d.ts +1 -1
- package/breadcrumb-group/interfaces.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +7 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +2 -2
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.d.ts +1 -1
- package/button-dropdown/item-element/index.d.ts.map +1 -1
- package/button-dropdown/item-element/index.js +4 -4
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/item-element/styles.css.js +13 -12
- package/button-dropdown/item-element/styles.scoped.css +52 -14
- package/button-dropdown/item-element/styles.selectors.js +13 -12
- package/button-dropdown/items-list.d.ts +1 -1
- package/button-dropdown/items-list.d.ts.map +1 -1
- package/button-dropdown/items-list.js +2 -2
- package/button-dropdown/items-list.js.map +1 -1
- package/flashbar/analytics-metadata/interfaces.d.ts +36 -0
- package/flashbar/analytics-metadata/interfaces.d.ts.map +1 -0
- package/flashbar/analytics-metadata/interfaces.js +4 -0
- package/flashbar/analytics-metadata/interfaces.js.map +1 -0
- package/flashbar/analytics-metadata/styles.css.js +6 -0
- package/flashbar/analytics-metadata/styles.scoped.css +7 -0
- package/flashbar/analytics-metadata/styles.selectors.js +7 -0
- package/flashbar/analytics-metadata/utils.d.ts +7 -0
- package/flashbar/analytics-metadata/utils.d.ts.map +1 -0
- package/flashbar/analytics-metadata/utils.js +33 -0
- package/flashbar/analytics-metadata/utils.js.map +1 -0
- package/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/collapsible-flashbar.js +13 -5
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +19 -7
- package/flashbar/flash.js.map +1 -1
- package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/non-collapsible-flashbar.js +4 -2
- package/flashbar/non-collapsible-flashbar.js.map +1 -1
- package/flashbar/styles.css.js +50 -47
- package/flashbar/styles.scoped.css +152 -146
- package/flashbar/styles.selectors.js +50 -47
- package/internal/base-component/styles.scoped.css +5 -10
- package/internal/components/tooltip/index.d.ts +3 -1
- package/internal/components/tooltip/index.d.ts.map +1 -1
- package/internal/components/tooltip/index.js +2 -2
- package/internal/components/tooltip/index.js.map +1 -1
- package/internal/components/tooltip/registry.d.ts +4 -0
- package/internal/components/tooltip/registry.d.ts.map +1 -0
- package/internal/components/tooltip/registry.js +28 -0
- package/internal/components/tooltip/registry.js.map +1 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.js +1 -1
- package/internal/generated/theming/index.cjs +15 -15
- package/internal/generated/theming/index.js +15 -15
- package/internal/manifest.json +1 -1
- package/internal/plugins/api.d.ts +9 -0
- package/internal/plugins/api.d.ts.map +1 -1
- package/internal/plugins/api.js +7 -0
- package/internal/plugins/api.js.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.d.ts +46 -0
- package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -0
- package/internal/plugins/controllers/alert-flash-content.js +59 -0
- package/internal/plugins/controllers/alert-flash-content.js.map +1 -0
- package/internal/plugins/helpers/index.d.ts +1 -0
- package/internal/plugins/helpers/index.d.ts.map +1 -1
- package/internal/plugins/helpers/index.js +1 -0
- package/internal/plugins/helpers/index.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-action.d.ts +2 -2
- package/internal/plugins/helpers/use-discovered-action.d.ts.map +1 -1
- package/internal/plugins/helpers/use-discovered-action.js.map +1 -1
- package/internal/plugins/helpers/use-discovered-content.d.ts +15 -0
- package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -0
- package/internal/plugins/helpers/use-discovered-content.js +82 -0
- package/internal/plugins/helpers/use-discovered-content.js.map +1 -0
- package/package.json +1 -1
- package/popover/styles.css.js +52 -52
- package/popover/styles.scoped.css +72 -72
- package/popover/styles.selectors.js +52 -52
- package/property-filter/styles.css.js +38 -38
- package/property-filter/styles.scoped.css +40 -44
- package/property-filter/styles.selectors.js +38 -38
- package/side-navigation/implementation.d.ts +1 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +2 -1
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/interfaces.d.ts +4 -0
- package/side-navigation/interfaces.d.ts.map +1 -1
- package/side-navigation/interfaces.js.map +1 -1
- package/side-navigation/styles.css.js +30 -29
- package/side-navigation/styles.scoped.css +46 -41
- package/side-navigation/styles.selectors.js +30 -29
- package/test-utils/dom/side-navigation/index.d.ts +1 -0
- package/test-utils/dom/side-navigation/index.js +3 -0
- package/test-utils/dom/side-navigation/index.js.map +1 -1
- package/test-utils/selectors/side-navigation/index.d.ts +1 -0
- package/test-utils/selectors/side-navigation/index.js +3 -0
- package/test-utils/selectors/side-navigation/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/styles.css.js +30 -30
- package/wizard/styles.scoped.css +59 -59
- package/wizard/styles.selectors.js +30 -30
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface RefShim<T> {
|
|
2
|
+
current: T | null;
|
|
3
|
+
}
|
|
4
|
+
export interface AlertFlashContentContext {
|
|
5
|
+
type: string;
|
|
6
|
+
headerRef: RefShim<HTMLElement>;
|
|
7
|
+
contentRef: RefShim<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export type ReplacementType = 'original' | 'remove' | 'replaced';
|
|
10
|
+
export interface ReplacementApi {
|
|
11
|
+
hideHeader(): void;
|
|
12
|
+
restoreHeader(): void;
|
|
13
|
+
replaceHeader(replacer: (container: HTMLElement) => void): void;
|
|
14
|
+
hideContent(): void;
|
|
15
|
+
restoreContent(): void;
|
|
16
|
+
replaceContent(replacer: (container: HTMLElement) => void): void;
|
|
17
|
+
}
|
|
18
|
+
export interface AlertFlashContentResult {
|
|
19
|
+
update: () => void;
|
|
20
|
+
unmount: (containers: {
|
|
21
|
+
replacementHeaderContainer: HTMLElement;
|
|
22
|
+
replacementContentContainer: HTMLElement;
|
|
23
|
+
}) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface AlertFlashContentConfig {
|
|
26
|
+
id: string;
|
|
27
|
+
runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;
|
|
28
|
+
}
|
|
29
|
+
export type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;
|
|
30
|
+
export interface AlertFlashContentApiPublic {
|
|
31
|
+
registerContentReplacer(config: AlertFlashContentConfig): void;
|
|
32
|
+
}
|
|
33
|
+
export interface AlertFlashContentApiInternal {
|
|
34
|
+
clearRegisteredReplacer(): void;
|
|
35
|
+
onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare class AlertFlashContentController {
|
|
38
|
+
#private;
|
|
39
|
+
registerContentReplacer: (content: AlertFlashContentConfig) => void;
|
|
40
|
+
clearRegisteredReplacer: () => void;
|
|
41
|
+
onContentRegistered: (listener: AlertFlashContentRegistrationListener) => () => void;
|
|
42
|
+
installPublic(api?: Partial<AlertFlashContentApiPublic>): AlertFlashContentApiPublic;
|
|
43
|
+
installInternal(internalApi?: Partial<AlertFlashContentApiInternal>): AlertFlashContentApiInternal;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=alert-flash-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAMA,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,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,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,CAAC,UAAU,EAAE;QAAE,0BAA0B,EAAE,WAAW,CAAC;QAAC,2BAA2B,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CACtH;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,CAAC,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,cAAc,KAAK,uBAAuB,CAAC;CAC7G;AAED,MAAM,MAAM,qCAAqC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,KAAK,MAAM,IAAI,CAAC;AAEtG,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;CAClF;AAED,qBAAa,2BAA2B;;IAgBtC,uBAAuB,YAAa,uBAAuB,UAWzD;IAEF,uBAAuB,aAErB;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;CAKvG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var _AlertFlashContentController_listeners, _AlertFlashContentController_cleanups, _AlertFlashContentController_provider, _AlertFlashContentController_scheduleUpdate;
|
|
4
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
5
|
+
import debounce from '../../debounce';
|
|
6
|
+
export class AlertFlashContentController {
|
|
7
|
+
constructor() {
|
|
8
|
+
_AlertFlashContentController_listeners.set(this, []);
|
|
9
|
+
_AlertFlashContentController_cleanups.set(this, new Map());
|
|
10
|
+
_AlertFlashContentController_provider.set(this, void 0);
|
|
11
|
+
_AlertFlashContentController_scheduleUpdate.set(this, debounce(() => __classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").forEach(listener => {
|
|
12
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
13
|
+
const cleanup = listener(__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f"));
|
|
14
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").set(listener, cleanup);
|
|
15
|
+
}
|
|
16
|
+
}), 0));
|
|
17
|
+
this.registerContentReplacer = (content) => {
|
|
18
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
19
|
+
console.warn(`Cannot call \`registerContentReplacer\` with new provider: provider with id "${__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f").id}" already registered.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_provider, content, "f");
|
|
23
|
+
// Notify existing components if registration happens after the components are rendered.
|
|
24
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_scheduleUpdate, "f").call(this);
|
|
25
|
+
};
|
|
26
|
+
this.clearRegisteredReplacer = () => {
|
|
27
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_provider, undefined, "f");
|
|
28
|
+
};
|
|
29
|
+
this.onContentRegistered = (listener) => {
|
|
30
|
+
if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
|
|
31
|
+
const cleanup = listener(__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f"));
|
|
32
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").push(listener);
|
|
33
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").set(listener, cleanup);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").push(listener);
|
|
37
|
+
}
|
|
38
|
+
return () => {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = __classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").get(listener)) === null || _a === void 0 ? void 0 : _a();
|
|
41
|
+
__classPrivateFieldSet(this, _AlertFlashContentController_listeners, __classPrivateFieldGet(this, _AlertFlashContentController_listeners, "f").filter(item => item !== listener), "f");
|
|
42
|
+
__classPrivateFieldGet(this, _AlertFlashContentController_cleanups, "f").delete(listener);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
installPublic(api = {}) {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = api.registerContentReplacer) !== null && _a !== void 0 ? _a : (api.registerContentReplacer = this.registerContentReplacer);
|
|
49
|
+
return api;
|
|
50
|
+
}
|
|
51
|
+
installInternal(internalApi = {}) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_a = internalApi.clearRegisteredReplacer) !== null && _a !== void 0 ? _a : (internalApi.clearRegisteredReplacer = this.clearRegisteredReplacer);
|
|
54
|
+
(_b = internalApi.onContentRegistered) !== null && _b !== void 0 ? _b : (internalApi.onContentRegistered = this.onContentRegistered);
|
|
55
|
+
return internalApi;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_AlertFlashContentController_listeners = new WeakMap(), _AlertFlashContentController_cleanups = new WeakMap(), _AlertFlashContentController_provider = new WeakMap(), _AlertFlashContentController_scheduleUpdate = new WeakMap();
|
|
59
|
+
//# sourceMappingURL=alert-flash-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-flash-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AA6CtC,MAAM,OAAO,2BAA2B;IAAxC;QACE,iDAA2D,EAAE,EAAC;QAC9D,gDAAY,IAAI,GAAG,EAAqD,EAAC;QACzE,wDAAoC;QAEpC,sDAAkB,QAAQ,CACxB,GAAG,EAAE,CACH,uBAAA,IAAI,8CAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACjC,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAA,IAAI,6CAAU,CAAC,CAAC;gBACzC,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACvC;QACH,CAAC,CAAC,EACJ,CAAC,CACF,EAAC;QAEF,4BAAuB,GAAG,CAAC,OAAgC,EAAE,EAAE;YAC7D,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,OAAO,CAAC,IAAI,CACV,gFAAgF,uBAAA,IAAI,6CAAU,CAAC,EAAE,uBAAuB,CACzH,CAAC;gBACF,OAAO;aACR;YACD,uBAAA,IAAI,yCAAa,OAAO,MAAA,CAAC;YAEzB,wFAAwF;YACxF,uBAAA,IAAI,mDAAgB,MAApB,IAAI,CAAkB,CAAC;QACzB,CAAC,CAAC;QAEF,4BAAuB,GAAG,GAAG,EAAE;YAC7B,uBAAA,IAAI,yCAAa,SAAS,MAAA,CAAC;QAC7B,CAAC,CAAC;QAEF,wBAAmB,GAAG,CAAC,QAA+C,EAAE,EAAE;YACxE,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAA,IAAI,6CAAU,CAAC,CAAC;gBACzC,uBAAA,IAAI,8CAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC/B,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACvC;iBAAM;gBACL,uBAAA,IAAI,8CAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAChC;YACD,OAAO,GAAG,EAAE;;gBACV,MAAA,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,2CAAI,CAAC;gBACjC,uBAAA,IAAI,0CAAc,uBAAA,IAAI,8CAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAA,CAAC;gBACpE,uBAAA,IAAI,6CAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC;QACJ,CAAC,CAAC;IAYJ,CAAC;IAVC,aAAa,CAAC,MAA2C,EAAE;;QACzD,MAAA,GAAG,CAAC,uBAAuB,oCAA3B,GAAG,CAAC,uBAAuB,GAAK,IAAI,CAAC,uBAAuB,EAAC;QAC7D,OAAO,GAAiC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,cAAqD,EAAE;;QACrE,MAAA,WAAW,CAAC,uBAAuB,oCAAnC,WAAW,CAAC,uBAAuB,GAAK,IAAI,CAAC,uBAAuB,EAAC;QACrE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,OAAO,WAA2C,CAAC;IACrD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport debounce from '../../debounce';\n\n// this code should not depend on React typings, because it is portable between major versions\ninterface RefShim<T> {\n current: T | null;\n}\n\nexport interface AlertFlashContentContext {\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\nexport type ReplacementType = 'original' | 'remove' | 'replaced';\n\nexport interface ReplacementApi {\n hideHeader(): void;\n restoreHeader(): void;\n replaceHeader(replacer: (container: HTMLElement) => void): void;\n hideContent(): void;\n restoreContent(): void;\n replaceContent(replacer: (container: HTMLElement) => void): void;\n}\n\nexport interface AlertFlashContentResult {\n update: () => void;\n unmount: (containers: { replacementHeaderContainer: HTMLElement; replacementContentContainer: HTMLElement }) => void;\n}\n\nexport interface AlertFlashContentConfig {\n id: string;\n runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;\n}\n\nexport type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;\n\nexport interface AlertFlashContentApiPublic {\n registerContentReplacer(config: AlertFlashContentConfig): void;\n}\n\nexport interface AlertFlashContentApiInternal {\n clearRegisteredReplacer(): void;\n onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;\n}\n\nexport class AlertFlashContentController {\n #listeners: Array<AlertFlashContentRegistrationListener> = [];\n #cleanups = new Map<AlertFlashContentRegistrationListener, () => void>();\n #provider?: AlertFlashContentConfig;\n\n #scheduleUpdate = debounce(\n () =>\n this.#listeners.forEach(listener => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#cleanups.set(listener, cleanup);\n }\n }),\n 0\n );\n\n registerContentReplacer = (content: AlertFlashContentConfig) => {\n if (this.#provider) {\n console.warn(\n `Cannot call \\`registerContentReplacer\\` with new provider: provider with id \"${this.#provider.id}\" already registered.`\n );\n return;\n }\n this.#provider = content;\n\n // Notify existing components if registration happens after the components are rendered.\n this.#scheduleUpdate();\n };\n\n clearRegisteredReplacer = () => {\n this.#provider = undefined;\n };\n\n onContentRegistered = (listener: AlertFlashContentRegistrationListener) => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#listeners.push(listener);\n this.#cleanups.set(listener, cleanup);\n } else {\n this.#listeners.push(listener);\n }\n return () => {\n this.#cleanups.get(listener)?.();\n this.#listeners = this.#listeners.filter(item => item !== listener);\n this.#cleanups.delete(listener);\n };\n };\n\n installPublic(api: Partial<AlertFlashContentApiPublic> = {}): AlertFlashContentApiPublic {\n api.registerContentReplacer ??= this.registerContentReplacer;\n return api as AlertFlashContentApiPublic;\n }\n\n installInternal(internalApi: Partial<AlertFlashContentApiInternal> = {}): AlertFlashContentApiInternal {\n internalApi.clearRegisteredReplacer ??= this.clearRegisteredReplacer;\n internalApi.onContentRegistered ??= this.onContentRegistered;\n return internalApi as AlertFlashContentApiInternal;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { RuntimeContentWrapper } from './runtime-content-wrapper';
|
|
4
4
|
export { createUseDiscoveredAction } from './use-discovered-action';
|
|
5
|
+
export { createUseDiscoveredContent } from './use-discovered-content';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { RuntimeContentWrapper } from './runtime-content-wrapper';\nexport { createUseDiscoveredAction } from './use-discovered-action';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { RuntimeContentWrapper } from './runtime-content-wrapper';\nexport { createUseDiscoveredAction } from './use-discovered-action';\nexport { createUseDiscoveredContent } from './use-discovered-content';\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ActionButtonsController } from '../controllers/action-buttons';
|
|
3
3
|
export declare function createUseDiscoveredAction(onActionRegistered: ActionButtonsController['onActionRegistered']): (type: string) => {
|
|
4
4
|
discoveredActions: React.ReactNode[];
|
|
5
|
-
headerRef: React.
|
|
6
|
-
contentRef: React.
|
|
5
|
+
headerRef: React.Ref<HTMLDivElement>;
|
|
6
|
+
contentRef: React.Ref<HTMLDivElement>;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=use-discovered-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAgBrG,wBAAgB,yBAAyB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,UAC/D,MAAM
|
|
1
|
+
{"version":3,"file":"use-discovered-action.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAgBrG,wBAAgB,yBAAyB,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,UAC/D,MAAM;uBAC3B,MAAM,SAAS,EAAE;eACzB,MAAM,GAAG,CAAC,cAAc,CAAC;gBACxB,MAAM,GAAG,CAAC,cAAc,CAAC;EAcxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-discovered-action.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,SAAS,oBAAoB,CAAC,MAA2B,EAAE,OAAsB;IAC/E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,oBAAC,qBAAqB,IACpB,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EACnC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAClE,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,GAC7D,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,kBAAiE;IACzG,OAAO,SAAS,mBAAmB,CAAC,IAAY;
|
|
1
|
+
{"version":3,"file":"use-discovered-action.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-action.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,SAAS,oBAAoB,CAAC,MAA2B,EAAE,OAAsB;IAC/E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,oBAAC,qBAAqB,IACpB,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EACnC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAClE,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,GAC7D,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,kBAAiE;IACzG,OAAO,SAAS,mBAAmB,CAAC,IAAY;QAK9C,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;QACvF,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAEhD,SAAS,CAAC,GAAG,EAAE;YACb,OAAO,kBAAkB,CAAC,OAAO,CAAC,EAAE;gBAClC,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7G,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAEX,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { ActionButtonsController, ActionConfig, ActionContext } from '../controllers/action-buttons';\nimport { RuntimeContentWrapper } from './runtime-content-wrapper';\n\nfunction convertRuntimeAction(action: ActionConfig | null, context: ActionContext) {\n if (!action) {\n return null;\n }\n return (\n <RuntimeContentWrapper\n key={action.id + '-' + context.type}\n mountContent={container => action.mountContent(container, context)}\n unmountContent={container => action.unmountContent(container)}\n />\n );\n}\n\nexport function createUseDiscoveredAction(onActionRegistered: ActionButtonsController['onActionRegistered']) {\n return function useDiscoveredAction(type: string): {\n discoveredActions: React.ReactNode[];\n headerRef: React.Ref<HTMLDivElement>;\n contentRef: React.Ref<HTMLDivElement>;\n } {\n const [discoveredActions, setDiscoveredActions] = useState<Array<React.ReactNode>>([]);\n const headerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n return onActionRegistered(actions => {\n setDiscoveredActions(actions.map(action => convertRuntimeAction(action, { type, headerRef, contentRef })));\n });\n }, [type]);\n\n return { discoveredActions, headerRef, contentRef };\n };\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AlertFlashContentController, ReplacementType } from '../controllers/alert-flash-content';
|
|
3
|
+
export declare function createUseDiscoveredContent(componentName: string, onContentRegistered: AlertFlashContentController['onContentRegistered']): ({ type, header, children, }: {
|
|
4
|
+
type: string;
|
|
5
|
+
header: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}) => {
|
|
8
|
+
headerReplacementType: ReplacementType;
|
|
9
|
+
contentReplacementType: ReplacementType;
|
|
10
|
+
headerRef: import("react").Ref<HTMLDivElement>;
|
|
11
|
+
replacementHeaderRef: import("react").Ref<HTMLDivElement>;
|
|
12
|
+
contentRef: import("react").Ref<HTMLDivElement>;
|
|
13
|
+
replacementContentRef: import("react").Ref<HTMLDivElement>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-discovered-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,2BAA2B,EAE3B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAE5C,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,2BAA2B,CAAC,qBAAqB,CAAC;UAO/D,MAAM;YACJ,SAAS;cACP,SAAS;;;;;;;;EAoFtB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
export function createUseDiscoveredContent(componentName, onContentRegistered) {
|
|
5
|
+
return function useDiscoveredContent({ type, header, children, }) {
|
|
6
|
+
const headerRef = useRef(null);
|
|
7
|
+
const contentRef = useRef(null);
|
|
8
|
+
const replacementHeaderRef = useRef(null);
|
|
9
|
+
const replacementContentRef = useRef(null);
|
|
10
|
+
const [headerReplacementType, setFoundHeaderReplacement] = useState('original');
|
|
11
|
+
const [contentReplacementType, setFoundContentReplacement] = useState('original');
|
|
12
|
+
const mountedProvider = useRef();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const context = { type, headerRef, contentRef };
|
|
15
|
+
return onContentRegistered(provider => {
|
|
16
|
+
let mounted = true;
|
|
17
|
+
function checkMounted(methodName) {
|
|
18
|
+
if (!mounted) {
|
|
19
|
+
console.warn(`[AwsUi] [Runtime ${componentName} content] \`${methodName}\` called after component unmounted`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
mountedProvider.current = provider.runReplacer(context, {
|
|
25
|
+
hideHeader() {
|
|
26
|
+
if (checkMounted('hideHeader')) {
|
|
27
|
+
setFoundHeaderReplacement('remove');
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
restoreHeader() {
|
|
31
|
+
if (checkMounted('restoreHeader')) {
|
|
32
|
+
setFoundHeaderReplacement('original');
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
replaceHeader(replacer) {
|
|
36
|
+
if (checkMounted('replaceHeader')) {
|
|
37
|
+
replacer(replacementHeaderRef.current);
|
|
38
|
+
setFoundHeaderReplacement('replaced');
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
hideContent() {
|
|
42
|
+
if (checkMounted('hideContent')) {
|
|
43
|
+
setFoundContentReplacement('remove');
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
restoreContent() {
|
|
47
|
+
if (checkMounted('restoreContent')) {
|
|
48
|
+
setFoundContentReplacement('original');
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
replaceContent(replacer) {
|
|
52
|
+
if (checkMounted('replaceContent')) {
|
|
53
|
+
replacer(replacementContentRef.current);
|
|
54
|
+
setFoundContentReplacement('replaced');
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = mountedProvider.current) === null || _a === void 0 ? void 0 : _a.unmount({
|
|
61
|
+
replacementHeaderContainer: replacementHeaderRef.current,
|
|
62
|
+
replacementContentContainer: replacementContentRef.current,
|
|
63
|
+
});
|
|
64
|
+
mounted = false;
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}, [type]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
var _a;
|
|
70
|
+
(_a = mountedProvider.current) === null || _a === void 0 ? void 0 : _a.update();
|
|
71
|
+
}, [type, header, children]);
|
|
72
|
+
return {
|
|
73
|
+
headerReplacementType,
|
|
74
|
+
contentReplacementType,
|
|
75
|
+
headerRef: headerRef,
|
|
76
|
+
replacementHeaderRef: replacementHeaderRef,
|
|
77
|
+
contentRef: contentRef,
|
|
78
|
+
replacementContentRef: replacementContentRef,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=use-discovered-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode, useEffect, useRef, useState } from 'react';\n\nimport {\n AlertFlashContentController,\n AlertFlashContentResult,\n ReplacementType,\n} from '../controllers/alert-flash-content';\n\nexport function createUseDiscoveredContent(\n componentName: string,\n onContentRegistered: AlertFlashContentController['onContentRegistered']\n) {\n return function useDiscoveredContent({\n type,\n header,\n children,\n }: {\n type: string;\n header: ReactNode;\n children: ReactNode;\n }) {\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 [headerReplacementType, setFoundHeaderReplacement] = useState<ReplacementType>('original');\n const [contentReplacementType, setFoundContentReplacement] = useState<ReplacementType>('original');\n const mountedProvider = useRef<AlertFlashContentResult | undefined>();\n\n useEffect(() => {\n const context = { type, headerRef, contentRef };\n\n return onContentRegistered(provider => {\n let mounted = true;\n\n function checkMounted(methodName: string) {\n if (!mounted) {\n console.warn(\n `[AwsUi] [Runtime ${componentName} content] \\`${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 }, [type]);\n\n useEffect(() => {\n mountedProvider.current?.update();\n }, [type, header, children]);\n\n return {\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"]}
|
package/package.json
CHANGED
package/popover/styles.css.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"arrow": "
|
|
5
|
-
"arrow-outer": "awsui_arrow-
|
|
6
|
-
"arrow-inner": "awsui_arrow-
|
|
7
|
-
"refresh": "
|
|
8
|
-
"arrow-position-right-top": "awsui_arrow-position-right-
|
|
9
|
-
"arrow-position-right-bottom": "awsui_arrow-position-right-
|
|
10
|
-
"arrow-position-left-top": "awsui_arrow-position-left-
|
|
11
|
-
"arrow-position-left-bottom": "awsui_arrow-position-left-
|
|
12
|
-
"arrow-position-top-center": "awsui_arrow-position-top-
|
|
13
|
-
"arrow-position-top-right": "awsui_arrow-position-top-
|
|
14
|
-
"arrow-position-top-left": "awsui_arrow-position-top-
|
|
15
|
-
"arrow-position-top-responsive": "awsui_arrow-position-top-
|
|
16
|
-
"arrow-position-bottom-center": "awsui_arrow-position-bottom-
|
|
17
|
-
"arrow-position-bottom-right": "awsui_arrow-position-bottom-
|
|
18
|
-
"arrow-position-bottom-left": "awsui_arrow-position-bottom-
|
|
19
|
-
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-
|
|
20
|
-
"body": "
|
|
21
|
-
"body-overflow-visible": "awsui_body-overflow-
|
|
22
|
-
"has-dismiss": "awsui_has-
|
|
23
|
-
"dismiss": "
|
|
24
|
-
"dismiss-control": "awsui_dismiss-
|
|
25
|
-
"header-row": "awsui_header-
|
|
26
|
-
"header": "
|
|
27
|
-
"content": "
|
|
28
|
-
"content-overflow-visible": "awsui_content-overflow-
|
|
29
|
-
"container": "
|
|
30
|
-
"container-body": "awsui_container-
|
|
31
|
-
"container-body-variant-annotation": "awsui_container-body-variant-
|
|
32
|
-
"container-body-size-small": "awsui_container-body-size-
|
|
33
|
-
"fixed-width": "awsui_fixed-
|
|
34
|
-
"container-body-size-medium": "awsui_container-body-size-
|
|
35
|
-
"container-body-size-large": "awsui_container-body-size-
|
|
36
|
-
"container-arrow": "awsui_container-
|
|
37
|
-
"container-arrow-position-right-top": "awsui_container-arrow-position-right-
|
|
38
|
-
"container-arrow-position-right-bottom": "awsui_container-arrow-position-right-
|
|
39
|
-
"container-arrow-position-left-top": "awsui_container-arrow-position-left-
|
|
40
|
-
"container-arrow-position-left-bottom": "awsui_container-arrow-position-left-
|
|
41
|
-
"container-arrow-position-top-center": "awsui_container-arrow-position-top-
|
|
42
|
-
"container-arrow-position-top-right": "awsui_container-arrow-position-top-
|
|
43
|
-
"container-arrow-position-top-left": "awsui_container-arrow-position-top-
|
|
44
|
-
"container-arrow-position-top-responsive": "awsui_container-arrow-position-top-
|
|
45
|
-
"container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-
|
|
46
|
-
"container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-
|
|
47
|
-
"container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-
|
|
48
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
49
|
-
"root": "
|
|
50
|
-
"root-filtering-token": "awsui_root-filtering-
|
|
51
|
-
"trigger": "
|
|
52
|
-
"overflow-ellipsis": "awsui_overflow-
|
|
53
|
-
"trigger-type-text": "awsui_trigger-type-
|
|
54
|
-
"trigger-type-filtering-token": "awsui_trigger-type-filtering-
|
|
55
|
-
"popover-inline-content": "awsui_popover-inline-
|
|
4
|
+
"arrow": "awsui_arrow_xjuzf_na7jp_281",
|
|
5
|
+
"arrow-outer": "awsui_arrow-outer_xjuzf_na7jp_285",
|
|
6
|
+
"arrow-inner": "awsui_arrow-inner_xjuzf_na7jp_285",
|
|
7
|
+
"refresh": "awsui_refresh_xjuzf_na7jp_320",
|
|
8
|
+
"arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_na7jp_330",
|
|
9
|
+
"arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_na7jp_330",
|
|
10
|
+
"arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_na7jp_333",
|
|
11
|
+
"arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_na7jp_333",
|
|
12
|
+
"arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_na7jp_336",
|
|
13
|
+
"arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_na7jp_336",
|
|
14
|
+
"arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_na7jp_336",
|
|
15
|
+
"arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_na7jp_336",
|
|
16
|
+
"arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_na7jp_339",
|
|
17
|
+
"arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_na7jp_339",
|
|
18
|
+
"arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_na7jp_339",
|
|
19
|
+
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_na7jp_339",
|
|
20
|
+
"body": "awsui_body_xjuzf_na7jp_483",
|
|
21
|
+
"body-overflow-visible": "awsui_body-overflow-visible_xjuzf_na7jp_522",
|
|
22
|
+
"has-dismiss": "awsui_has-dismiss_xjuzf_na7jp_526",
|
|
23
|
+
"dismiss": "awsui_dismiss_xjuzf_na7jp_531",
|
|
24
|
+
"dismiss-control": "awsui_dismiss-control_xjuzf_na7jp_539",
|
|
25
|
+
"header-row": "awsui_header-row_xjuzf_na7jp_543",
|
|
26
|
+
"header": "awsui_header_xjuzf_na7jp_543",
|
|
27
|
+
"content": "awsui_content_xjuzf_na7jp_568",
|
|
28
|
+
"content-overflow-visible": "awsui_content-overflow-visible_xjuzf_na7jp_576",
|
|
29
|
+
"container": "awsui_container_xjuzf_na7jp_720",
|
|
30
|
+
"container-body": "awsui_container-body_xjuzf_na7jp_728",
|
|
31
|
+
"container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_na7jp_771",
|
|
32
|
+
"container-body-size-small": "awsui_container-body-size-small_xjuzf_na7jp_776",
|
|
33
|
+
"fixed-width": "awsui_fixed-width_xjuzf_na7jp_779",
|
|
34
|
+
"container-body-size-medium": "awsui_container-body-size-medium_xjuzf_na7jp_783",
|
|
35
|
+
"container-body-size-large": "awsui_container-body-size-large_xjuzf_na7jp_790",
|
|
36
|
+
"container-arrow": "awsui_container-arrow_xjuzf_na7jp_802",
|
|
37
|
+
"container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_na7jp_806",
|
|
38
|
+
"container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_na7jp_806",
|
|
39
|
+
"container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_na7jp_823",
|
|
40
|
+
"container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_na7jp_823",
|
|
41
|
+
"container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_na7jp_840",
|
|
42
|
+
"container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_na7jp_840",
|
|
43
|
+
"container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_na7jp_840",
|
|
44
|
+
"container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_na7jp_840",
|
|
45
|
+
"container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_na7jp_856",
|
|
46
|
+
"container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_na7jp_860",
|
|
47
|
+
"container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_na7jp_864",
|
|
48
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_na7jp_1",
|
|
49
|
+
"root": "awsui_root_xjuzf_na7jp_1052",
|
|
50
|
+
"root-filtering-token": "awsui_root-filtering-token_xjuzf_na7jp_1088",
|
|
51
|
+
"trigger": "awsui_trigger_xjuzf_na7jp_1092",
|
|
52
|
+
"overflow-ellipsis": "awsui_overflow-ellipsis_xjuzf_na7jp_1099",
|
|
53
|
+
"trigger-type-text": "awsui_trigger-type-text_xjuzf_na7jp_1107",
|
|
54
|
+
"trigger-type-filtering-token": "awsui_trigger-type-filtering-token_xjuzf_na7jp_1143",
|
|
55
|
+
"popover-inline-content": "awsui_popover-inline-content_xjuzf_na7jp_1147"
|
|
56
56
|
};
|
|
57
57
|
|