@cloudscape-design/components 3.0.793 → 3.0.795

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/alert/internal.d.ts.map +1 -1
  2. package/alert/internal.js +3 -3
  3. package/alert/internal.js.map +1 -1
  4. package/alert/styles.css.js +28 -27
  5. package/alert/styles.scoped.css +47 -42
  6. package/alert/styles.selectors.js +28 -27
  7. package/app-layout/visual-refresh-toolbar/compute-layout.d.ts +1 -0
  8. package/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
  9. package/app-layout/visual-refresh-toolbar/compute-layout.js +2 -2
  10. package/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
  11. package/app-layout/visual-refresh-toolbar/contexts.d.ts +7 -0
  12. package/app-layout/visual-refresh-toolbar/contexts.d.ts.map +1 -0
  13. package/app-layout/visual-refresh-toolbar/contexts.js +6 -0
  14. package/app-layout/visual-refresh-toolbar/contexts.js.map +1 -0
  15. package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/index.js +56 -20
  17. package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
  18. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
  19. package/app-layout/visual-refresh-toolbar/toolbar/index.js +3 -2
  20. package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  21. package/button-dropdown/internal.js +3 -3
  22. package/button-dropdown/internal.js.map +1 -1
  23. package/flashbar/flash.d.ts.map +1 -1
  24. package/flashbar/flash.js +3 -3
  25. package/flashbar/flash.js.map +1 -1
  26. package/flashbar/styles.css.js +50 -50
  27. package/flashbar/styles.scoped.css +151 -164
  28. package/flashbar/styles.selectors.js +50 -50
  29. package/internal/environment.js +1 -1
  30. package/internal/environment.json +1 -1
  31. package/internal/manifest.json +1 -1
  32. package/internal/plugins/api.d.ts +3 -0
  33. package/internal/plugins/api.d.ts.map +1 -1
  34. package/internal/plugins/api.js +3 -0
  35. package/internal/plugins/api.js.map +1 -1
  36. package/internal/plugins/controllers/alert-flash-content.d.ts +9 -0
  37. package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
  38. package/internal/plugins/controllers/alert-flash-content.js +9 -1
  39. package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
  40. package/internal/plugins/controllers/shared-react-contexts.d.ts +10 -0
  41. package/internal/plugins/controllers/shared-react-contexts.d.ts.map +1 -0
  42. package/internal/plugins/controllers/shared-react-contexts.js +27 -0
  43. package/internal/plugins/controllers/shared-react-contexts.js.map +1 -0
  44. package/internal/plugins/helpers/use-discovered-content.d.ts +3 -2
  45. package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
  46. package/internal/plugins/helpers/use-discovered-content.js +9 -2
  47. package/internal/plugins/helpers/use-discovered-content.js.map +1 -1
  48. package/internal/plugins/helpers/use-global-breadcrumbs.d.ts.map +1 -1
  49. package/internal/plugins/helpers/use-global-breadcrumbs.js +11 -3
  50. package/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -1
  51. package/multiselect/embedded.d.ts.map +1 -1
  52. package/multiselect/embedded.js +2 -7
  53. package/multiselect/embedded.js.map +1 -1
  54. package/multiselect/use-multiselect.d.ts +1 -1
  55. package/multiselect/use-multiselect.d.ts.map +1 -1
  56. package/multiselect/use-multiselect.js.map +1 -1
  57. package/package.json +1 -1
  58. package/property-filter/i18n-utils.d.ts.map +1 -1
  59. package/property-filter/i18n-utils.js +6 -3
  60. package/property-filter/i18n-utils.js.map +1 -1
  61. package/property-filter/index.d.ts.map +1 -1
  62. package/property-filter/index.js +20 -2
  63. package/property-filter/index.js.map +1 -1
  64. package/property-filter/interfaces.d.ts +4 -2
  65. package/property-filter/interfaces.d.ts.map +1 -1
  66. package/property-filter/interfaces.js.map +1 -1
  67. package/property-filter/internal.d.ts.map +1 -1
  68. package/property-filter/internal.js +5 -3
  69. package/property-filter/internal.js.map +1 -1
  70. package/property-filter/property-editor.d.ts +13 -2
  71. package/property-filter/property-editor.d.ts.map +1 -1
  72. package/property-filter/property-editor.js +19 -1
  73. package/property-filter/property-editor.js.map +1 -1
  74. package/property-filter/styles.css.js +39 -35
  75. package/property-filter/styles.scoped.css +66 -37
  76. package/property-filter/styles.selectors.js +39 -35
  77. package/property-filter/token-editor-inputs.d.ts +3 -3
  78. package/property-filter/token-editor-inputs.d.ts.map +1 -1
  79. package/property-filter/token-editor-inputs.js +29 -4
  80. package/property-filter/token-editor-inputs.js.map +1 -1
  81. package/property-filter/token-editor.d.ts.map +1 -1
  82. package/property-filter/token-editor.js +9 -1
  83. package/property-filter/token-editor.js.map +1 -1
  84. package/property-filter/utils.d.ts.map +1 -1
  85. package/property-filter/utils.js +10 -3
  86. package/property-filter/utils.js.map +1 -1
  87. package/select/utils/use-select.d.ts.map +1 -1
  88. package/select/utils/use-select.js +14 -7
  89. package/select/utils/use-select.js.map +1 -1
  90. package/table/use-column-widths.d.ts.map +1 -1
  91. package/table/use-column-widths.js +7 -1
  92. package/table/use-column-widths.js.map +1 -1
  93. package/test-utils/tsconfig.tsbuildinfo +1 -1
  94. package/text-filter/index.d.ts.map +1 -1
  95. package/text-filter/index.js +3 -1
  96. package/text-filter/index.js.map +1 -1
  97. package/text-filter/interfaces.d.ts +2 -1
  98. package/text-filter/interfaces.d.ts.map +1 -1
  99. package/text-filter/interfaces.js.map +1 -1
  100. package/text-filter/internal.d.ts.map +1 -1
  101. package/text-filter/internal.js +2 -2
  102. package/text-filter/internal.js.map +1 -1
  103. package/tutorial-panel/components/tutorial-detail-view/styles.css.js +20 -20
  104. package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +22 -21
  105. package/tutorial-panel/components/tutorial-detail-view/styles.selectors.js +20 -20
@@ -2,55 +2,55 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "flash-with-motion": "awsui_flash-with-motion_1q84n_lsqkq_153",
6
- "enter": "awsui_enter_1q84n_lsqkq_153",
7
- "flash-body": "awsui_flash-body_1q84n_lsqkq_167",
8
- "flash-message": "awsui_flash-message_1q84n_lsqkq_167",
9
- "flash-header": "awsui_flash-header_1q84n_lsqkq_167",
10
- "flash-content": "awsui_flash-content_1q84n_lsqkq_168",
11
- "action-button-wrapper": "awsui_action-button-wrapper_1q84n_lsqkq_169",
12
- "dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_lsqkq_170",
13
- "flash-icon": "awsui_flash-icon_1q84n_lsqkq_193",
14
- "entering": "awsui_entering_1q84n_lsqkq_206",
15
- "entered": "awsui_entered_1q84n_lsqkq_227",
16
- "exiting": "awsui_exiting_1q84n_lsqkq_332",
17
- "stack": "awsui_stack_1q84n_lsqkq_366",
18
- "animation-running": "awsui_animation-running_1q84n_lsqkq_366",
19
- "item": "awsui_item_1q84n_lsqkq_366",
20
- "flash-list-item": "awsui_flash-list-item_1q84n_lsqkq_367",
21
- "notification-bar": "awsui_notification-bar_1q84n_lsqkq_368",
22
- "collapsed": "awsui_collapsed_1q84n_lsqkq_388",
23
- "animation-ready": "awsui_animation-ready_1q84n_lsqkq_388",
24
- "expanded-only": "awsui_expanded-only_1q84n_lsqkq_388",
25
- "expanded": "awsui_expanded_1q84n_lsqkq_388",
26
- "flash": "awsui_flash_1q84n_lsqkq_153",
27
- "collapsible": "awsui_collapsible_1q84n_lsqkq_444",
28
- "short-list": "awsui_short-list_1q84n_lsqkq_450",
29
- "visual-refresh": "awsui_visual-refresh_1q84n_lsqkq_450",
30
- "status": "awsui_status_1q84n_lsqkq_597",
31
- "header": "awsui_header_1q84n_lsqkq_597",
32
- "item-count": "awsui_item-count_1q84n_lsqkq_598",
33
- "button": "awsui_button_1q84n_lsqkq_599",
34
- "type-count": "awsui_type-count_1q84n_lsqkq_632",
35
- "count-number": "awsui_count-number_1q84n_lsqkq_632",
36
- "icon": "awsui_icon_1q84n_lsqkq_666",
37
- "floating": "awsui_floating_1q84n_lsqkq_707",
38
- "flashbar": "awsui_flashbar_1q84n_lsqkq_711",
39
- "flash-refresh": "awsui_flash-refresh_1q84n_lsqkq_786",
40
- "flash-list": "awsui_flash-list_1q84n_lsqkq_367",
41
- "flash-focus-container": "awsui_flash-focus-container_1q84n_lsqkq_807",
42
- "flash-text": "awsui_flash-text_1q84n_lsqkq_837",
43
- "hidden": "awsui_hidden_1q84n_lsqkq_856",
44
- "header-replacement": "awsui_header-replacement_1q84n_lsqkq_861",
45
- "content-replacement": "awsui_content-replacement_1q84n_lsqkq_866",
46
- "dismiss-button": "awsui_dismiss-button_1q84n_lsqkq_170",
47
- "breakpoint-default": "awsui_breakpoint-default_1q84n_lsqkq_885",
48
- "action-button": "awsui_action-button_1q84n_lsqkq_169",
49
- "action-slot": "awsui_action-slot_1q84n_lsqkq_895",
50
- "flash-type-success": "awsui_flash-type-success_1q84n_lsqkq_899",
51
- "flash-type-error": "awsui_flash-type-error_1q84n_lsqkq_903",
52
- "flash-type-info": "awsui_flash-type-info_1q84n_lsqkq_907",
53
- "flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_lsqkq_908",
54
- "flash-type-warning": "awsui_flash-type-warning_1q84n_lsqkq_912"
5
+ "flash-with-motion": "awsui_flash-with-motion_1q84n_bc0gz_153",
6
+ "enter": "awsui_enter_1q84n_bc0gz_153",
7
+ "flash-body": "awsui_flash-body_1q84n_bc0gz_167",
8
+ "flash-message": "awsui_flash-message_1q84n_bc0gz_167",
9
+ "flash-header": "awsui_flash-header_1q84n_bc0gz_167",
10
+ "flash-content": "awsui_flash-content_1q84n_bc0gz_168",
11
+ "action-button-wrapper": "awsui_action-button-wrapper_1q84n_bc0gz_169",
12
+ "dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_bc0gz_170",
13
+ "flash-icon": "awsui_flash-icon_1q84n_bc0gz_193",
14
+ "entering": "awsui_entering_1q84n_bc0gz_206",
15
+ "entered": "awsui_entered_1q84n_bc0gz_227",
16
+ "exiting": "awsui_exiting_1q84n_bc0gz_332",
17
+ "stack": "awsui_stack_1q84n_bc0gz_366",
18
+ "animation-running": "awsui_animation-running_1q84n_bc0gz_366",
19
+ "item": "awsui_item_1q84n_bc0gz_366",
20
+ "flash-list-item": "awsui_flash-list-item_1q84n_bc0gz_367",
21
+ "notification-bar": "awsui_notification-bar_1q84n_bc0gz_368",
22
+ "collapsed": "awsui_collapsed_1q84n_bc0gz_388",
23
+ "animation-ready": "awsui_animation-ready_1q84n_bc0gz_388",
24
+ "expanded-only": "awsui_expanded-only_1q84n_bc0gz_388",
25
+ "expanded": "awsui_expanded_1q84n_bc0gz_388",
26
+ "flash": "awsui_flash_1q84n_bc0gz_153",
27
+ "collapsible": "awsui_collapsible_1q84n_bc0gz_444",
28
+ "short-list": "awsui_short-list_1q84n_bc0gz_450",
29
+ "visual-refresh": "awsui_visual-refresh_1q84n_bc0gz_450",
30
+ "status": "awsui_status_1q84n_bc0gz_597",
31
+ "header": "awsui_header_1q84n_bc0gz_597",
32
+ "item-count": "awsui_item-count_1q84n_bc0gz_598",
33
+ "button": "awsui_button_1q84n_bc0gz_599",
34
+ "type-count": "awsui_type-count_1q84n_bc0gz_632",
35
+ "count-number": "awsui_count-number_1q84n_bc0gz_632",
36
+ "icon": "awsui_icon_1q84n_bc0gz_666",
37
+ "floating": "awsui_floating_1q84n_bc0gz_707",
38
+ "flashbar": "awsui_flashbar_1q84n_bc0gz_711",
39
+ "initial-hidden": "awsui_initial-hidden_1q84n_bc0gz_772",
40
+ "flash-list": "awsui_flash-list_1q84n_bc0gz_367",
41
+ "flash-focus-container": "awsui_flash-focus-container_1q84n_bc0gz_794",
42
+ "flash-text": "awsui_flash-text_1q84n_bc0gz_824",
43
+ "hidden": "awsui_hidden_1q84n_bc0gz_843",
44
+ "header-replacement": "awsui_header-replacement_1q84n_bc0gz_848",
45
+ "content-replacement": "awsui_content-replacement_1q84n_bc0gz_853",
46
+ "dismiss-button": "awsui_dismiss-button_1q84n_bc0gz_170",
47
+ "breakpoint-default": "awsui_breakpoint-default_1q84n_bc0gz_872",
48
+ "action-button": "awsui_action-button_1q84n_bc0gz_169",
49
+ "action-slot": "awsui_action-slot_1q84n_bc0gz_882",
50
+ "flash-type-success": "awsui_flash-type-success_1q84n_bc0gz_886",
51
+ "flash-type-error": "awsui_flash-type-error_1q84n_bc0gz_890",
52
+ "flash-type-info": "awsui_flash-type-info_1q84n_bc0gz_894",
53
+ "flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_bc0gz_895",
54
+ "flash-type-warning": "awsui_flash-type-warning_1q84n_bc0gz_899"
55
55
  };
56
56
 
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (b69c9b27)";
2
+ export var PACKAGE_VERSION = "3.0.0 (17570645)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (b69c9b27)",
3
+ "PACKAGE_VERSION": "3.0.0 (17570645)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "b69c9b27102544ac0bcffca849df80d3812c89c3"
2
+ "commit": "17570645c814a2971dae801d2011f471f0536108"
3
3
  }
@@ -4,6 +4,7 @@ import { AlertFlashContentApiInternal, AlertFlashContentApiPublic } from './cont
4
4
  import { AppLayoutWidgetApiInternal } from './controllers/app-layout-widget';
5
5
  import { BreadcrumbsApiInternal } from './controllers/breadcrumbs';
6
6
  import { DrawersApiInternal, DrawersApiPublic } from './controllers/drawers';
7
+ import { SharedReactContextsApiInternal } from './controllers/shared-react-contexts';
7
8
  interface AwsuiApi {
8
9
  awsuiPlugins: {
9
10
  appLayout: DrawersApiPublic;
@@ -20,6 +21,7 @@ interface AwsuiApi {
20
21
  flashbar: ActionsApiInternal;
21
22
  flashContent: AlertFlashContentApiInternal;
22
23
  breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
24
+ sharedReactContexts: SharedReactContextsApiInternal;
23
25
  };
24
26
  }
25
27
  export declare function loadApi(): AwsuiApi;
@@ -37,6 +39,7 @@ export declare const awsuiPlugins: {
37
39
  flashbar: ActionsApiInternal;
38
40
  flashContent: AlertFlashContentApiInternal;
39
41
  breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
42
+ sharedReactContexts: SharedReactContextsApiInternal;
40
43
  };
41
44
  export {};
42
45
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAA2B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAE3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAA6B,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAyB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAIhG,UAAU,QAAQ;IAChB,YAAY,EAAE;QACZ,SAAS,EAAE,gBAAgB,CAAC;QAC5B,KAAK,EAAE,gBAAgB,CAAC;QACxB,YAAY,EAAE,0BAA0B,CAAC;QACzC,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,YAAY,EAAE,0BAA0B,CAAC;KAC1C,CAAC;IACF,oBAAoB,EAAE;QACpB,SAAS,EAAE,kBAAkB,CAAC;QAC9B,eAAe,EAAE,0BAA0B,CAAC;QAC5C,KAAK,EAAE,kBAAkB,CAAC;QAC1B,YAAY,EAAE,4BAA4B,CAAC;QAC3C,QAAQ,EAA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BAAkB,CAAC;QAC1B,YAAY,EAAE,4BAA4B,CAAC;QAC3C,QAAQ,EAAE,kBAAkB,CAAC;QAC7B,YAAY,EAAE,4BAA4B,CAAC;QAC3C,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;QAC1D,mBAAmB,EAAE,8BAA8B,CAAC;KACrD,CAAC;CACH;AAwBD,wBAAgB,OAAO,aAQtB;AAED,eAAO,MAAQ,YAAY;eAlDZ,gBAAgB;WACpB,gBAAgB;kBACT,0BAA0B;cAC9B,gBAAgB;kBACZ,0BAA0B;GA8Cf,oBAAoB;eA3ClC,kBAAkB;qBACZ,0BAA0B;WACpC,kBAAkB;kBACX,4BAA4B;cAChC,kBAAkB;kBACd,4BAA4B;iBAC7B,uBAAuB,oBAAoB,CAAC;yBACpC,8BAA8B;CAoCQ,CAAC"}
@@ -3,6 +3,7 @@ import { AlertFlashContentController, } from './controllers/alert-flash-content'
3
3
  import { AppLayoutWidgetController } from './controllers/app-layout-widget';
4
4
  import { BreadcrumbsController } from './controllers/breadcrumbs';
5
5
  import { DrawersController } from './controllers/drawers';
6
+ import { SharedReactContexts } from './controllers/shared-react-contexts';
6
7
  const storageKey = Symbol.for('awsui-plugin-api');
7
8
  function findUpApi(currentWindow) {
8
9
  try {
@@ -53,6 +54,8 @@ function installApi(api) {
53
54
  api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);
54
55
  const breadcrumbs = new BreadcrumbsController();
55
56
  api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);
57
+ const sharedReactContexts = new SharedReactContexts();
58
+ api.awsuiPluginsInternal.sharedReactContexts = sharedReactContexts.installInternal(api.awsuiPluginsInternal.sharedReactContexts);
56
59
  return api;
57
60
  }
58
61
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mapp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Y,CAAC,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC1F,GAAG,CAAC,oBAAoB,CAAC,YAAY,GAAG,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAE5G,MAAM,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACtD,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACrF,GAAG,CAAC,oBAAoB,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEvG,MAAM,WAAW,GAAG,IAAI,qBAAqB,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n return api as AwsuiApi;\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAGL,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAkC,MAAM,qCAAqC,CAAC;AAE1G,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AA0BlD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,I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B,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,eAAe,CAChF,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,CAC7C,CAAC;IAEF,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\nimport { SharedReactContexts, SharedReactContextsApiInternal } from './controllers/shared-react-contexts';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n sharedReactContexts: SharedReactContextsApiInternal;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n const sharedReactContexts = new SharedReactContexts();\n api.awsuiPluginsInternal.sharedReactContexts = sharedReactContexts.installInternal(\n api.awsuiPluginsInternal.sharedReactContexts\n );\n\n return api as AwsuiApi;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  interface RefShim<T> {
2
3
  current: T | null;
3
4
  }
@@ -6,6 +7,11 @@ export interface AlertFlashContentContext {
6
7
  headerRef: RefShim<HTMLElement>;
7
8
  contentRef: RefShim<HTMLElement>;
8
9
  }
10
+ interface AlertFlashContentInitialContext {
11
+ type: string;
12
+ header?: ReactNode;
13
+ content?: ReactNode;
14
+ }
9
15
  export type ReplacementType = 'original' | 'remove' | 'replaced';
10
16
  export interface ReplacementApi {
11
17
  hideHeader(): void;
@@ -25,6 +31,7 @@ export interface AlertFlashContentResult {
25
31
  export interface AlertFlashContentConfig {
26
32
  id: string;
27
33
  runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;
34
+ initialCheck?: (context: AlertFlashContentInitialContext) => boolean;
28
35
  }
29
36
  export type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;
30
37
  export interface AlertFlashContentApiPublic {
@@ -33,11 +40,13 @@ export interface AlertFlashContentApiPublic {
33
40
  export interface AlertFlashContentApiInternal {
34
41
  clearRegisteredReplacer(): void;
35
42
  onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;
43
+ initialCheck(context: AlertFlashContentInitialContext): boolean;
36
44
  }
37
45
  export declare class AlertFlashContentController {
38
46
  #private;
39
47
  registerContentReplacer: (content: AlertFlashContentConfig) => void;
40
48
  clearRegisteredReplacer: () => void;
49
+ initialCheck: (context: AlertFlashContentInitialContext) => boolean;
41
50
  onContentRegistered: (listener: AlertFlashContentRegistrationListener) => () => void;
42
51
  installPublic(api?: Partial<AlertFlashContentApiPublic>): AlertFlashContentApiPublic;
43
52
  installInternal(internalApi?: Partial<AlertFlashContentApiInternal>): AlertFlashContentApiInternal;
@@ -1 +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"}
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;AAKlC,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,UAAU,+BAA+B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;CAC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F,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"}
@@ -26,6 +26,13 @@ export class AlertFlashContentController {
26
26
  this.clearRegisteredReplacer = () => {
27
27
  __classPrivateFieldSet(this, _AlertFlashContentController_provider, undefined, "f");
28
28
  };
29
+ this.initialCheck = (context) => {
30
+ var _a;
31
+ if ((_a = __classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) === null || _a === void 0 ? void 0 : _a.initialCheck) {
32
+ return __classPrivateFieldGet(this, _AlertFlashContentController_provider, "f").initialCheck(context);
33
+ }
34
+ return false;
35
+ };
29
36
  this.onContentRegistered = (listener) => {
30
37
  if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
31
38
  const cleanup = listener(__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f"));
@@ -49,9 +56,10 @@ export class AlertFlashContentController {
49
56
  return api;
50
57
  }
51
58
  installInternal(internalApi = {}) {
52
- var _a, _b;
59
+ var _a, _b, _c;
53
60
  (_a = internalApi.clearRegisteredReplacer) !== null && _a !== void 0 ? _a : (internalApi.clearRegisteredReplacer = this.clearRegisteredReplacer);
54
61
  (_b = internalApi.onContentRegistered) !== null && _b !== void 0 ? _b : (internalApi.onContentRegistered = this.onContentRegistered);
62
+ (_c = internalApi.initialCheck) !== null && _c !== void 0 ? _c : (internalApi.initialCheck = this.initialCheck);
55
63
  return internalApi;
56
64
  }
57
65
  }
@@ -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;;;AAEtC,OAAO,QAA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W,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
+ {"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;AAqDtC,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,iBAAY,GAAG,CAAC,OAAwC,EAAW,EAA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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';\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\ninterface AlertFlashContentInitialContext {\n type: string;\n header?: ReactNode;\n content?: ReactNode;\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 initialCheck?: (context: AlertFlashContentInitialContext) => boolean;\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 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 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 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"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface SharedReactContextsApiInternal {
3
+ createContext: <T>(ReactInstance: typeof React, contextName: string) => React.Context<T | undefined>;
4
+ }
5
+ export declare class SharedReactContexts {
6
+ #private;
7
+ createContext: <T>(ReactInstance: typeof React, contextName: string) => React.Context<any>;
8
+ installInternal(internalApi?: Partial<SharedReactContextsApiInternal>): SharedReactContextsApiInternal;
9
+ }
10
+ //# sourceMappingURL=shared-react-contexts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-react-contexts.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/shared-react-contexts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACtG;AAED,qBAAa,mBAAmB;;IAG9B,aAAa,qBAAsB,YAAY,eAAe,MAAM,wBAelE;IAEF,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,8BAA8B,CAAM,GAAG,8BAA8B;CAI3G"}
@@ -0,0 +1,27 @@
1
+ var _SharedReactContexts_registeredContexts;
2
+ import { __classPrivateFieldGet } from "tslib";
3
+ export class SharedReactContexts {
4
+ constructor() {
5
+ _SharedReactContexts_registeredContexts.set(this, new WeakMap());
6
+ this.createContext = (ReactInstance, contextName) => {
7
+ let contexts = __classPrivateFieldGet(this, _SharedReactContexts_registeredContexts, "f").get(ReactInstance);
8
+ if (!contexts) {
9
+ contexts = new Map();
10
+ __classPrivateFieldGet(this, _SharedReactContexts_registeredContexts, "f").set(ReactInstance, contexts);
11
+ }
12
+ let cachedContext = contexts.get(contextName);
13
+ if (!cachedContext) {
14
+ cachedContext = ReactInstance.createContext(undefined);
15
+ contexts.set(contextName, cachedContext);
16
+ }
17
+ return cachedContext;
18
+ };
19
+ }
20
+ installInternal(internalApi = {}) {
21
+ var _a;
22
+ (_a = internalApi.createContext) !== null && _a !== void 0 ? _a : (internalApi.createContext = this.createContext);
23
+ return internalApi;
24
+ }
25
+ }
26
+ _SharedReactContexts_registeredContexts = new WeakMap();
27
+ //# sourceMappingURL=shared-react-contexts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-react-contexts.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/shared-react-contexts.ts"],"names":[],"mappings":";;AAQA,MAAM,OAAO,mBAAmB;IAAhC;QACE,kDAAsB,IAAI,OAAO,EAAiD,EAAC;QAEnF,kBAAa,GAAG,CAAI,aAA2B,EAAE,WAAmB,EAAE,EAAE;YACtE,IAAI,QAAQ,GAAG,uBAAA,IAAI,+CAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,EAAE;gBACb,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;gBACrB,uBAAA,IAAI,+CAAoB,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;aACvD;YAED,IAAI,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAE9C,IAAI,CAAC,aAAa,EAAE;gBAClB,aAAa,GAAG,aAAa,CAAC,aAAa,CAAI,SAAc,CAAC,CAAC;gBAC/D,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;aAC1C;YAED,OAAO,aAAa,CAAC;QACvB,CAAC,CAAC;IAMJ,CAAC;IAJC,eAAe,CAAC,cAAuD,EAAE;;QACvE,MAAA,WAAW,CAAC,aAAa,oCAAzB,WAAW,CAAC,aAAa,GAAK,IAAI,CAAC,aAAa,EAAC;QACjD,OAAO,WAA6C,CAAC;IACvD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nexport interface SharedReactContextsApiInternal {\n createContext: <T>(ReactInstance: typeof React, contextName: string) => React.Context<T | undefined>;\n}\n\nexport class SharedReactContexts {\n #registeredContexts = new WeakMap<typeof React, Map<string, React.Context<any>>>();\n\n createContext = <T>(ReactInstance: typeof React, contextName: string) => {\n let contexts = this.#registeredContexts.get(ReactInstance);\n if (!contexts) {\n contexts = new Map();\n this.#registeredContexts.set(ReactInstance, contexts);\n }\n\n let cachedContext = contexts.get(contextName);\n\n if (!cachedContext) {\n cachedContext = ReactInstance.createContext<T>(undefined as T);\n contexts.set(contextName, cachedContext);\n }\n\n return cachedContext;\n };\n\n installInternal(internalApi: Partial<SharedReactContextsApiInternal> = {}): SharedReactContextsApiInternal {\n internalApi.createContext ??= this.createContext;\n return internalApi as SharedReactContextsApiInternal;\n }\n}\n"]}
@@ -1,10 +1,11 @@
1
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, }: {
2
+ import { AlertFlashContentApiInternal, ReplacementType } from '../controllers/alert-flash-content';
3
+ export declare function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal): ({ type, header, children, }: {
4
4
  type: string;
5
5
  header: ReactNode;
6
6
  children: ReactNode;
7
7
  }) => {
8
+ initialHidden: boolean;
8
9
  headerReplacementType: ReplacementType;
9
10
  contentReplacementType: ReplacementType;
10
11
  headerRef: import("react").Ref<HTMLDivElement>;
@@ -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,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"}
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,4BAA4B,EAE5B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAE5C,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,4BAA4B;UAMhG,MAAM;YACJ,SAAS;cACP,SAAS;;;;;;;;;EA8FtB"}
@@ -1,18 +1,24 @@
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
- export function createUseDiscoveredContent(componentName, onContentRegistered) {
4
+ export function createUseDiscoveredContent(componentName, controller) {
5
5
  return function useDiscoveredContent({ type, header, children, }) {
6
6
  const headerRef = useRef(null);
7
7
  const contentRef = useRef(null);
8
8
  const replacementHeaderRef = useRef(null);
9
9
  const replacementContentRef = useRef(null);
10
+ const [initialHidden, setInitialHidden] = useState(() => controller.initialCheck({
11
+ type,
12
+ header,
13
+ content: children,
14
+ }));
10
15
  const [headerReplacementType, setFoundHeaderReplacement] = useState('original');
11
16
  const [contentReplacementType, setFoundContentReplacement] = useState('original');
12
17
  const mountedProvider = useRef();
13
18
  useEffect(() => {
14
19
  const context = { type, headerRef, contentRef };
15
- return onContentRegistered(provider => {
20
+ setInitialHidden(false);
21
+ return controller.onContentRegistered(provider => {
16
22
  let mounted = true;
17
23
  function checkMounted(methodName) {
18
24
  if (!mounted) {
@@ -70,6 +76,7 @@ export function createUseDiscoveredContent(componentName, onContentRegistered) {
70
76
  (_a = mountedProvider.current) === null || _a === void 0 ? void 0 : _a.update();
71
77
  }, [type, header, children]);
72
78
  return {
79
+ initialHidden,
73
80
  headerReplacementType,
74
81
  contentReplacementType,
75
82
  headerRef: headerRef,
@@ -1 +1 @@
1
- {"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],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AAO;YACL,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 { 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"]}
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,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ/D,MAAM,UAAU,0BAA0B,CAAC,aAAqB,EAAE,UAAwC;IACxG,OAAO,SAAS,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GAKT;QACC,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,IAAI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C,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,IAAI,CAAC,CAAC,CAAC;QAEX,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 { ReactNode, useEffect, useRef, useState } from 'react';\n\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentResult,\n ReplacementType,\n} from '../controllers/alert-flash-content';\n\nexport function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal) {\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 [initialHidden, setInitialHidden] = useState(() =>\n controller.initialCheck({\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 = { 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 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 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 +1 @@
1
- {"version":3,"file":"use-global-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AA0B5E,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,WAQ1G;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,oCAavD"}
1
+ {"version":3,"file":"use-global-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAiC5E,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,WAQ1G;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,oCAavD"}
@@ -1,12 +1,20 @@
1
+ import { __rest } from "tslib";
1
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
3
  // SPDX-License-Identifier: Apache-2.0
3
- import { useEffect, useLayoutEffect, useRef, useState } from 'react';
4
+ import { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
5
  import { useAppLayoutToolbarEnabled } from '../../../app-layout/utils/feature-flags';
6
+ import { BreadcrumbsSlotContext } from '../../../app-layout/visual-refresh-toolbar/contexts';
5
7
  import { awsuiPluginsInternal } from '../api';
6
- function useSetGlobalBreadcrumbsImplementation(props) {
8
+ function useSetGlobalBreadcrumbsImplementation(_a) {
9
+ var _b;
10
+ var { __disableGlobalization } = _a, props = __rest(_a, ["__disableGlobalization"]);
11
+ const { isInToolbar } = (_b = useContext(BreadcrumbsSlotContext)) !== null && _b !== void 0 ? _b : {};
7
12
  const registrationRef = useRef();
8
13
  const [registered, setRegistered] = useState(false);
9
14
  useEffect(() => {
15
+ if (isInToolbar || __disableGlobalization) {
16
+ return;
17
+ }
10
18
  const registration = awsuiPluginsInternal.breadcrumbs.registerBreadcrumbs(props, () => setRegistered(true));
11
19
  registrationRef.current = registration;
12
20
  return () => {
@@ -14,7 +22,7 @@ function useSetGlobalBreadcrumbsImplementation(props) {
14
22
  };
15
23
  // subsequent prop changes are handled by another effect
16
24
  // eslint-disable-next-line react-hooks/exhaustive-deps
17
- }, []);
25
+ }, [isInToolbar, __disableGlobalization]);
18
26
  useLayoutEffect(() => {
19
27
  var _a;
20
28
  (_a = registrationRef.current) === null || _a === void 0 ? void 0 : _a.update(props);
@@ -1 +1 @@
1
- {"version":3,"file":"use-global-breadcrumbs.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAG9C,SAAS,qCAAqC,CAAC,KAAgC;IAC7E,MAAM,eAAe,GAAG,MAAM,EAA8D,CAAC;IAC7F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,oBAAoB,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5G,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;QAEvC,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC,CAAC;QACF,wDAAwD;QACxD,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,eAAe,CAAC,GAAG,EAAE;;QACnB,MAAA,eAAe,CAAC,OAAO,0CAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAsC,KAA8B;IACzG,gEAAgE;IAChE,IAAI,CAAC,0BAA0B,EAAE,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;IACD,iEAAiE;IACjE,sDAAsD;IACtD,OAAO,qCAAqC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAmC,IAAI,CAAC,CAAC;IAE3G,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QACD,OAAO,oBAAoB,CAAC,WAAW,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;YACtE,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { useAppLayoutToolbarEnabled } from '../../../app-layout/utils/feature-flags';\nimport { BreadcrumbGroupProps } from '../../../breadcrumb-group/interfaces';\nimport { awsuiPluginsInternal } from '../api';\nimport { BreadcrumbsGlobalRegistration } from '../controllers/breadcrumbs';\n\nfunction useSetGlobalBreadcrumbsImplementation(props: BreadcrumbGroupProps<any>) {\n const registrationRef = useRef<BreadcrumbsGlobalRegistration<BreadcrumbGroupProps> | null>();\n const [registered, setRegistered] = useState(false);\n\n useEffect(() => {\n const registration = awsuiPluginsInternal.breadcrumbs.registerBreadcrumbs(props, () => setRegistered(true));\n registrationRef.current = registration;\n\n return () => {\n registration.cleanup();\n };\n // subsequent prop changes are handled by another effect\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n registrationRef.current?.update(props);\n });\n\n return registered;\n}\n\nexport function useSetGlobalBreadcrumbs<T extends BreadcrumbGroupProps.Item>(props: BreadcrumbGroupProps<T>) {\n // avoid additional side effects when this feature is not active\n if (!useAppLayoutToolbarEnabled()) {\n return false;\n }\n // getGlobalFlag() value does not change without full page reload\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSetGlobalBreadcrumbsImplementation(props);\n}\n\nexport function useGetGlobalBreadcrumbs(enabled: boolean) {\n const [discoveredBreadcrumbs, setDiscoveredBreadcrumbs] = useState<BreadcrumbGroupProps<any> | null>(null);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n return awsuiPluginsInternal.breadcrumbs.registerAppLayout(breadcrumbs => {\n setDiscoveredBreadcrumbs(breadcrumbs);\n });\n }, [enabled]);\n\n return discoveredBreadcrumbs;\n}\n"]}
1
+ {"version":3,"file":"use-global-breadcrumbs.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ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;IACtD,OAAO,qCAAqC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAmC,IAAI,CAAC,CAAC;IAE3G,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QACD,OAAO,oBAAoB,CAAC,WAAW,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;YACtE,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,qBAAqB,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { useAppLayoutToolbarEnabled } from '../../../app-layout/utils/feature-flags';\nimport { BreadcrumbsSlotContext } from '../../../app-layout/visual-refresh-toolbar/contexts';\nimport { BreadcrumbGroupProps } from '../../../breadcrumb-group/interfaces';\nimport { awsuiPluginsInternal } from '../api';\nimport { BreadcrumbsGlobalRegistration } from '../controllers/breadcrumbs';\n\nfunction useSetGlobalBreadcrumbsImplementation({\n __disableGlobalization,\n ...props\n}: BreadcrumbGroupProps<any> & { __disableGlobalization?: boolean }) {\n const { isInToolbar } = useContext(BreadcrumbsSlotContext) ?? {};\n const registrationRef = useRef<BreadcrumbsGlobalRegistration<BreadcrumbGroupProps> | null>();\n const [registered, setRegistered] = useState(false);\n\n useEffect(() => {\n if (isInToolbar || __disableGlobalization) {\n return;\n }\n const registration = awsuiPluginsInternal.breadcrumbs.registerBreadcrumbs(props, () => setRegistered(true));\n registrationRef.current = registration;\n\n return () => {\n registration.cleanup();\n };\n // subsequent prop changes are handled by another effect\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isInToolbar, __disableGlobalization]);\n\n useLayoutEffect(() => {\n registrationRef.current?.update(props);\n });\n\n return registered;\n}\n\nexport function useSetGlobalBreadcrumbs<T extends BreadcrumbGroupProps.Item>(props: BreadcrumbGroupProps<T>) {\n // avoid additional side effects when this feature is not active\n if (!useAppLayoutToolbarEnabled()) {\n return false;\n }\n // getGlobalFlag() value does not change without full page reload\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSetGlobalBreadcrumbsImplementation(props);\n}\n\nexport function useGetGlobalBreadcrumbs(enabled: boolean) {\n const [discoveredBreadcrumbs, setDiscoveredBreadcrumbs] = useState<BreadcrumbGroupProps<any> | null>(null);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n return awsuiPluginsInternal.breadcrumbs.registerAppLayout(breadcrumbs => {\n setDiscoveredBreadcrumbs(breadcrumbs);\n });\n }, [enabled]);\n\n return discoveredBreadcrumbs;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../../../src/multiselect/embedded.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,MAAM,MAAM,wBAAwB,GAAG,YAAY,CACjD,IAAI,CACF,gBAAgB,EACd,SAAS,GACT,iBAAiB,GACjB,WAAW,GACX,eAAe,GACf,mBAAmB,GACnB,eAAe,GACf,YAAY,GACZ,WAAW,GACX,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,GACd,WAAW,GACX,cAAc,GACd,OAAO,GACP,SAAS,CACZ,EACD,SAAS,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,CAC/D,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B,QAAA,MAAM,mBAAmB;;;;;;;8CAiExB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../../../src/multiselect/embedded.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,MAAM,MAAM,wBAAwB,GAAG,YAAY,CACjD,IAAI,CACF,gBAAgB,EACd,SAAS,GACT,iBAAiB,GACjB,WAAW,GACX,eAAe,GACf,mBAAmB,GACnB,eAAe,GACf,YAAY,GACZ,WAAW,GACX,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,GACd,WAAW,GACX,cAAc,GACd,OAAO,GACP,SAAS,CACZ,EACD,SAAS,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,CAC/D,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B,QAAA,MAAM,mBAAmB;;;;;;;8CAyDxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -11,22 +11,17 @@ import VirtualList from '../select/parts/virtual-list';
11
11
  import { useMultiselect } from './use-multiselect';
12
12
  import styles from './styles.css.js';
13
13
  const EmbeddedMultiselect = React.forwardRef((_a, externalRef) => {
14
- var _b;
15
14
  var { options, filteringType, ariaLabel, selectedOptions, deselectAriaLabel, virtualScroll, filteringText = '' } = _a, restProps = __rest(_a, ["options", "filteringType", "ariaLabel", "selectedOptions", "deselectAriaLabel", "virtualScroll", "filteringText"]);
16
15
  const formFieldContext = useFormFieldContext(restProps);
17
16
  const ariaLabelId = useUniqueId('multiselect-ariaLabel-');
18
17
  const footerId = useUniqueId('multiselect-footer-');
19
- const selfControlId = useUniqueId('multiselect-trigger-');
20
- const controlId = (_b = formFieldContext.controlId) !== null && _b !== void 0 ? _b : selfControlId;
21
18
  const multiselectProps = useMultiselect(Object.assign({ options,
22
19
  selectedOptions,
23
- filteringType, disabled: false, deselectAriaLabel,
24
- controlId,
25
- ariaLabelId,
20
+ filteringType, disabled: false, deselectAriaLabel, controlId: formFieldContext.controlId, ariaLabelId,
26
21
  footerId, filteringValue: filteringText, externalRef, keepOpen: true, embedded: true }, restProps));
27
22
  const ListComponent = virtualScroll ? VirtualList : PlainList;
28
23
  const status = multiselectProps.dropdownStatus;
29
- return (React.createElement("div", { role: "group", className: styles.embedded, "aria-labelledby": ariaLabelId, "aria-describedby": status.content ? footerId : undefined },
24
+ return (React.createElement("div", { className: styles.embedded },
30
25
  React.createElement(ListComponent, { menuProps: multiselectProps.getMenuProps(), getOptionProps: multiselectProps.getOptionProps, filteredOptions: multiselectProps.filteredOptions, filteringValue: filteringText, ref: multiselectProps.scrollToIndex, hasDropdownStatus: status.content !== null, checkboxes: true, useInteractiveGroups: true, screenReaderContent: multiselectProps.announcement, highlightType: multiselectProps.highlightType }),
31
26
  status.content && React.createElement(DropdownFooter, { content: status.content, id: footerId }),
32
27
  React.createElement(ScreenreaderOnly, { id: ariaLabelId }, ariaLabel)));
@@ -1 +1 @@
1
- {"version":3,"file":"embedded.js","sourceRoot":"","sources":["../../../src/multiselect/embedded.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAyBrC,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAC1C,CACE,EAS2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B,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,EAC1C,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,IAAI,EAC1B,mBAAmB,EAAE,gBAAgB,CAAC,YAAY,EAClD,aAAa,EAAE,gBAAgB,CAAC,aAAa,GAC7C;QAED,MAAM,CAAC,OAAO,IAAI,oBAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,GAAI;QAE5E,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,CAAoB,CAC7D,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SomeRequired } from '../internal/types';\nimport PlainList from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\nexport type EmbeddedMultiselectProps = SomeRequired<\n Pick<\n MultiselectProps,\n | 'options'\n | 'selectedOptions'\n | 'ariaLabel'\n | 'filteringType'\n | 'deselectAriaLabel'\n | 'virtualScroll'\n | 'statusType'\n | 'controlId'\n | 'onChange'\n | 'onLoadItems'\n | 'loadingText'\n | 'finishedText'\n | 'errorText'\n | 'recoveryText'\n | 'empty'\n | 'noMatch'\n >,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType'\n> & { filteringText?: string };\n\nconst EmbeddedMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n ariaLabel,\n selectedOptions,\n deselectAriaLabel,\n virtualScroll,\n filteringText = '',\n ...restProps\n }: EmbeddedMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const formFieldContext = useFormFieldContext(restProps);\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n const selfControlId = useUniqueId('multiselect-trigger-');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled: false,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue: filteringText,\n externalRef,\n keepOpen: true,\n embedded: true,\n ...restProps,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n const status = multiselectProps.dropdownStatus;\n\n return (\n <div\n role=\"group\"\n className={styles.embedded}\n aria-labelledby={ariaLabelId}\n aria-describedby={status.content ? footerId : undefined}\n >\n <ListComponent\n menuProps={multiselectProps.getMenuProps()}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringText}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={status.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n />\n\n {status.content && <DropdownFooter content={status.content} id={footerId} />}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default EmbeddedMultiselect;\n"]}
1
+ {"version":3,"file":"embedded.js","sourceRoot":"","sources":["../../../src/multiselect/embedded.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,SAAS,MAAM,4BA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E,MAAM,CAAC,OAAO,KAAK,IAAI,EAC1C,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,IAAI,EAC1B,mBAAmB,EAAE,gBAAgB,CAAC,YAAY,EAClD,aAAa,EAAE,gBAAgB,CAAC,aAAa,GAC7C;QAED,MAAM,CAAC,OAAO,IAAI,oBAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,GAAI;QAE5E,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,CAAoB,CAC7D,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { SomeRequired } from '../internal/types';\nimport PlainList from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\nexport type EmbeddedMultiselectProps = SomeRequired<\n Pick<\n MultiselectProps,\n | 'options'\n | 'selectedOptions'\n | 'ariaLabel'\n | 'filteringType'\n | 'deselectAriaLabel'\n | 'virtualScroll'\n | 'statusType'\n | 'controlId'\n | 'onChange'\n | 'onLoadItems'\n | 'loadingText'\n | 'finishedText'\n | 'errorText'\n | 'recoveryText'\n | 'empty'\n | 'noMatch'\n >,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType'\n> & { filteringText?: string };\n\nconst EmbeddedMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n ariaLabel,\n selectedOptions,\n deselectAriaLabel,\n virtualScroll,\n filteringText = '',\n ...restProps\n }: EmbeddedMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const formFieldContext = useFormFieldContext(restProps);\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled: false,\n deselectAriaLabel,\n controlId: formFieldContext.controlId,\n ariaLabelId,\n footerId,\n filteringValue: filteringText,\n externalRef,\n keepOpen: true,\n embedded: true,\n ...restProps,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n const status = multiselectProps.dropdownStatus;\n\n return (\n <div className={styles.embedded}>\n <ListComponent\n menuProps={multiselectProps.getMenuProps()}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringText}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={status.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n />\n\n {status.content && <DropdownFooter content={status.content} id={footerId} />}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default EmbeddedMultiselect;\n"]}