@cloudscape-design/components-themeable 3.0.1239 → 3.0.1241

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 (106) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/form-field/test-classes/styles.scss +9 -0
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/template/app-layout/index.d.ts.map +1 -1
  5. package/lib/internal/template/app-layout/index.js +3 -15
  6. package/lib/internal/template/app-layout/index.js.map +1 -1
  7. package/lib/internal/template/app-layout/utils/use-aria-labels.d.ts +3 -0
  8. package/lib/internal/template/app-layout/utils/use-aria-labels.d.ts.map +1 -0
  9. package/lib/internal/template/app-layout/utils/use-aria-labels.js +19 -0
  10. package/lib/internal/template/app-layout/utils/use-aria-labels.js.map +1 -0
  11. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +17 -9
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
  14. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts +1 -0
  15. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
  16. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js +1 -0
  17. package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js.map +1 -1
  18. package/lib/internal/template/app-layout-toolbar/index.d.ts.map +1 -1
  19. package/lib/internal/template/app-layout-toolbar/index.js +1 -16
  20. package/lib/internal/template/app-layout-toolbar/index.js.map +1 -1
  21. package/lib/internal/template/button/index.d.ts.map +1 -1
  22. package/lib/internal/template/button/index.js +2 -2
  23. package/lib/internal/template/button/index.js.map +1 -1
  24. package/lib/internal/template/button/interfaces.d.ts +4 -0
  25. package/lib/internal/template/button/interfaces.d.ts.map +1 -1
  26. package/lib/internal/template/button/interfaces.js.map +1 -1
  27. package/lib/internal/template/button/internal.d.ts.map +1 -1
  28. package/lib/internal/template/button/internal.js +2 -1
  29. package/lib/internal/template/button/internal.js.map +1 -1
  30. package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
  31. package/lib/internal/template/button-dropdown/internal.js +2 -4
  32. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  33. package/lib/internal/template/file-upload/internal.js +2 -2
  34. package/lib/internal/template/file-upload/internal.js.map +1 -1
  35. package/lib/internal/template/form-field/interfaces.d.ts +6 -0
  36. package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
  37. package/lib/internal/template/form-field/interfaces.js.map +1 -1
  38. package/lib/internal/template/form-field/internal.d.ts +2 -2
  39. package/lib/internal/template/form-field/internal.d.ts.map +1 -1
  40. package/lib/internal/template/form-field/internal.js +22 -6
  41. package/lib/internal/template/form-field/internal.js.map +1 -1
  42. package/lib/internal/template/form-field/test-classes/styles.css.js +7 -0
  43. package/lib/internal/template/form-field/test-classes/styles.scoped.css +8 -0
  44. package/lib/internal/template/form-field/test-classes/styles.selectors.js +8 -0
  45. package/lib/internal/template/form-field/util.d.ts +3 -2
  46. package/lib/internal/template/form-field/util.d.ts.map +1 -1
  47. package/lib/internal/template/form-field/util.js +4 -3
  48. package/lib/internal/template/form-field/util.js.map +1 -1
  49. package/lib/internal/template/i18n/dynamic.js +1 -1
  50. package/lib/internal/template/i18n/provider.d.ts +4 -12
  51. package/lib/internal/template/i18n/provider.d.ts.map +1 -1
  52. package/lib/internal/template/i18n/provider.js +4 -106
  53. package/lib/internal/template/i18n/provider.js.map +1 -1
  54. package/lib/internal/template/i18n/providers/local-provider.d.ts +9 -0
  55. package/lib/internal/template/i18n/providers/local-provider.d.ts.map +1 -0
  56. package/lib/internal/template/i18n/providers/local-provider.js +56 -0
  57. package/lib/internal/template/i18n/providers/local-provider.js.map +1 -0
  58. package/lib/internal/template/i18n/providers/remote-provider.d.ts +24 -0
  59. package/lib/internal/template/i18n/providers/remote-provider.d.ts.map +1 -0
  60. package/lib/internal/template/i18n/providers/remote-provider.js +42 -0
  61. package/lib/internal/template/i18n/providers/remote-provider.js.map +1 -0
  62. package/lib/internal/template/i18n/utils/i18n-formatter.d.ts +30 -0
  63. package/lib/internal/template/i18n/utils/i18n-formatter.d.ts.map +1 -0
  64. package/lib/internal/template/i18n/utils/i18n-formatter.js +61 -0
  65. package/lib/internal/template/i18n/utils/i18n-formatter.js.map +1 -0
  66. package/lib/internal/template/i18n/utils/locales.d.ts +3 -0
  67. package/lib/internal/template/i18n/utils/locales.d.ts.map +1 -0
  68. package/lib/internal/template/i18n/utils/locales.js +28 -0
  69. package/lib/internal/template/i18n/utils/locales.js.map +1 -0
  70. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  71. package/lib/internal/template/internal/components/chart-popover/index.d.ts +2 -0
  72. package/lib/internal/template/internal/components/chart-popover/index.d.ts.map +1 -1
  73. package/lib/internal/template/internal/components/chart-popover/index.js +2 -2
  74. package/lib/internal/template/internal/components/chart-popover/index.js.map +1 -1
  75. package/lib/internal/template/internal/environment.js +2 -2
  76. package/lib/internal/template/internal/environment.json +2 -2
  77. package/lib/internal/template/internal/plugins/widget/interfaces.d.ts +84 -0
  78. package/lib/internal/template/internal/plugins/widget/interfaces.d.ts.map +1 -1
  79. package/lib/internal/template/internal/plugins/widget/interfaces.js.map +1 -1
  80. package/lib/internal/template/internal/widget-exports.d.ts +1 -0
  81. package/lib/internal/template/internal/widget-exports.d.ts.map +1 -1
  82. package/lib/internal/template/internal/widget-exports.js +2 -0
  83. package/lib/internal/template/internal/widget-exports.js.map +1 -1
  84. package/lib/internal/template/popover/container.d.ts +3 -1
  85. package/lib/internal/template/popover/container.d.ts.map +1 -1
  86. package/lib/internal/template/popover/container.js +2 -1
  87. package/lib/internal/template/popover/container.js.map +1 -1
  88. package/lib/internal/template/popover/use-popover-position.d.ts +2 -1
  89. package/lib/internal/template/popover/use-popover-position.d.ts.map +1 -1
  90. package/lib/internal/template/popover/use-popover-position.js +11 -5
  91. package/lib/internal/template/popover/use-popover-position.js.map +1 -1
  92. package/lib/internal/template/popover/utils/positions.d.ts +1 -0
  93. package/lib/internal/template/popover/utils/positions.d.ts.map +1 -1
  94. package/lib/internal/template/popover/utils/positions.js +21 -0
  95. package/lib/internal/template/popover/utils/positions.js.map +1 -1
  96. package/lib/internal/template/test-utils/dom/form-field/index.d.ts +1 -0
  97. package/lib/internal/template/test-utils/dom/form-field/index.js +5 -1
  98. package/lib/internal/template/test-utils/dom/form-field/index.js.map +1 -1
  99. package/lib/internal/template/test-utils/selectors/form-field/index.d.ts +1 -0
  100. package/lib/internal/template/test-utils/selectors/form-field/index.js +5 -1
  101. package/lib/internal/template/test-utils/selectors/form-field/index.js.map +1 -1
  102. package/package.json +1 -1
  103. package/lib/internal/template/i18n/get-matchable-locales.d.ts +0 -2
  104. package/lib/internal/template/i18n/get-matchable-locales.d.ts.map +0 -1
  105. package/lib/internal/template/i18n/get-matchable-locales.js +0 -14
  106. package/lib/internal/template/i18n/get-matchable-locales.js.map +0 -1
@@ -0,0 +1,61 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import IntlMessageFormat from 'intl-messageformat';
4
+ import { getMatchableLocales } from './locales';
5
+ /**
6
+ * A stateful container for formatting internal strings. Caches formatters
7
+ * where possible; a new instance must be created if locale or messages may
8
+ * have changed.
9
+ */
10
+ export class I18nFormatter {
11
+ constructor(locale, messages) {
12
+ // Create a per-render cache of messages and IntlMessageFormat instances.
13
+ // Not memoizing it allows us to reset the cache when the component rerenders
14
+ // with potentially different locale or messages. We expect this component to
15
+ // be placed above AppLayout and therefore rerender very infrequently.
16
+ this._localeFormatterCache = new Map();
17
+ this._locale = locale;
18
+ this._messages = messages;
19
+ }
20
+ format(namespace, component, key, provided, customHandler) {
21
+ var _a, _b, _c, _d;
22
+ // A general rule in this library is that undefined is basically
23
+ // treated as "not provided". So even if a user explicitly provides an
24
+ // undefined value, it will default to i18n provider values.
25
+ if (provided !== undefined) {
26
+ return provided;
27
+ }
28
+ const cacheKey = `${namespace}.${component}.${key}`;
29
+ let intlMessageFormat;
30
+ const cachedFormatter = this._localeFormatterCache.get(cacheKey);
31
+ if (cachedFormatter) {
32
+ // If an IntlMessageFormat instance was cached for this locale, just use that.
33
+ intlMessageFormat = cachedFormatter;
34
+ }
35
+ else {
36
+ // Widen the locale string (e.g. en-GB -> en) until we find a locale
37
+ // that contains the message we need.
38
+ let message;
39
+ const matchableLocales = getMatchableLocales(this._locale);
40
+ for (const matchableLocale of matchableLocales) {
41
+ message = (_d = (_c = (_b = (_a = this._messages) === null || _a === void 0 ? void 0 : _a[namespace]) === null || _b === void 0 ? void 0 : _b[matchableLocale]) === null || _c === void 0 ? void 0 : _c[component]) === null || _d === void 0 ? void 0 : _d[key];
42
+ if (message !== undefined) {
43
+ break;
44
+ }
45
+ }
46
+ // If a message wasn't found, exit early.
47
+ if (message === undefined) {
48
+ return provided;
49
+ }
50
+ // Lazily create an IntlMessageFormat object for this key.
51
+ intlMessageFormat = new IntlMessageFormat(message, this._locale);
52
+ this._localeFormatterCache.set(cacheKey, intlMessageFormat);
53
+ }
54
+ if (customHandler) {
55
+ return customHandler(args => intlMessageFormat.format(args));
56
+ }
57
+ // Assuming `ReturnValue extends string` since a customHandler wasn't provided.
58
+ return intlMessageFormat.format();
59
+ }
60
+ }
61
+ //# sourceMappingURL=i18n-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-formatter.js","sourceRoot":"","sources":["../../../../src/i18n/utils/i18n-formatter.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAkBhD;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAUxB,YAAY,MAAc,EAAE,QAAsB;QANlD,yEAAyE;QACzE,6EAA6E;QAC7E,6EAA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AO,CAAC,CAAC;YACjE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAW,CAAC,CAAC;QACzE,CAAC;QACD,+EAA+E;QAC/E,OAAO,iBAAiB,CAAC,MAAM,EAAiB,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MessageFormatElement } from '@formatjs/icu-messageformat-parser';\nimport IntlMessageFormat from 'intl-messageformat';\n\nimport { CustomHandler } from '../context';\nimport { getMatchableLocales } from './locales';\n\n/**\n * The expected shape of the fully resolved messages object.\n * Typescript ensures any static imports are properly typed, but since this\n * depends on types from formatjs, it should not be included in any files that\n * need to support older versions of TypeScript (3.7 and up).\n */\nexport interface I18nMessages {\n [namespace: string]: {\n [locale: string]: {\n [component: string]: {\n [key: string]: string | MessageFormatElement[];\n };\n };\n };\n}\n\n/**\n * A stateful container for formatting internal strings. Caches formatters\n * where possible; a new instance must be created if locale or messages may\n * have changed.\n */\nexport class I18nFormatter {\n private _locale: string;\n private _messages: I18nMessages;\n\n // Create a per-render cache of messages and IntlMessageFormat instances.\n // Not memoizing it allows us to reset the cache when the component rerenders\n // with potentially different locale or messages. We expect this component to\n // be placed above AppLayout and therefore rerender very infrequently.\n private _localeFormatterCache = new Map<string, IntlMessageFormat>();\n\n constructor(locale: string, messages: I18nMessages) {\n this._locale = locale;\n this._messages = messages;\n }\n\n format<ReturnValue, FormatFnArgs extends Record<string, string | number>>(\n namespace: string,\n component: string,\n key: string,\n provided: ReturnValue,\n customHandler?: CustomHandler<ReturnValue, FormatFnArgs>\n ): ReturnValue {\n // A general rule in this library is that undefined is basically\n // treated as \"not provided\". So even if a user explicitly provides an\n // undefined value, it will default to i18n provider values.\n if (provided !== undefined) {\n return provided;\n }\n\n const cacheKey = `${namespace}.${component}.${key}`;\n let intlMessageFormat: IntlMessageFormat;\n\n const cachedFormatter = this._localeFormatterCache.get(cacheKey);\n if (cachedFormatter) {\n // If an IntlMessageFormat instance was cached for this locale, just use that.\n intlMessageFormat = cachedFormatter;\n } else {\n // Widen the locale string (e.g. en-GB -> en) until we find a locale\n // that contains the message we need.\n let message: string | MessageFormatElement[] | undefined;\n const matchableLocales = getMatchableLocales(this._locale);\n for (const matchableLocale of matchableLocales) {\n message = this._messages?.[namespace]?.[matchableLocale]?.[component]?.[key];\n if (message !== undefined) {\n break;\n }\n }\n\n // If a message wasn't found, exit early.\n if (message === undefined) {\n return provided;\n }\n\n // Lazily create an IntlMessageFormat object for this key.\n intlMessageFormat = new IntlMessageFormat(message, this._locale);\n this._localeFormatterCache.set(cacheKey, intlMessageFormat);\n }\n\n if (customHandler) {\n return customHandler(args => intlMessageFormat.format(args) as string);\n }\n // Assuming `ReturnValue extends string` since a customHandler wasn't provided.\n return intlMessageFormat.format() as ReturnValue;\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function getMatchableLocales(ietfLanguageTag: string): string[];
2
+ export declare function determineAppLocale(providedLocale?: string): string;
3
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../src/i18n/utils/locales.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAWrE;AAED,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAelE"}
@@ -0,0 +1,28 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export function getMatchableLocales(ietfLanguageTag) {
4
+ const parts = ietfLanguageTag.split('-');
5
+ if (parts.length === 1) {
6
+ return [ietfLanguageTag];
7
+ }
8
+ const localeStrings = [];
9
+ for (let i = parts.length; i > 0; i--) {
10
+ localeStrings.push(parts.slice(0, i).join('-'));
11
+ }
12
+ return localeStrings;
13
+ }
14
+ export function determineAppLocale(providedLocale) {
15
+ // If a locale is explicitly provided, use the string directly.
16
+ // Locales have a recommended case, but are matched case-insensitively,
17
+ // so we lowercase it internally.
18
+ if (providedLocale) {
19
+ return providedLocale.toLowerCase();
20
+ }
21
+ if (typeof document !== 'undefined' && document.documentElement.lang) {
22
+ // Otherwise, use the value provided in the HTML tag.
23
+ return document.documentElement.lang.toLowerCase();
24
+ }
25
+ // Lastly, fall back to English.
26
+ return 'en';
27
+ }
28
+ //# sourceMappingURL=locales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../../src/i18n/utils/locales.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,mBAAmB,CAAC,eAAuB;IACzD,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,cAAuB;IACxD,+DAA+D;IAC/D,uEAAuE;IACvE,iCAAiC;IACjC,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QACrE,qDAAqD;QACrD,OAAO,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC;IAED,gCAAgC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getMatchableLocales(ietfLanguageTag: string): string[] {\n const parts = ietfLanguageTag.split('-');\n if (parts.length === 1) {\n return [ietfLanguageTag];\n }\n\n const localeStrings: string[] = [];\n for (let i = parts.length; i > 0; i--) {\n localeStrings.push(parts.slice(0, i).join('-'));\n }\n return localeStrings;\n}\n\nexport function determineAppLocale(providedLocale?: string): string {\n // If a locale is explicitly provided, use the string directly.\n // Locales have a recommended case, but are matched case-insensitively,\n // so we lowercase it internally.\n if (providedLocale) {\n return providedLocale.toLowerCase();\n }\n\n if (typeof document !== 'undefined' && document.documentElement.lang) {\n // Otherwise, use the value provided in the HTML tag.\n return document.documentElement.lang.toLowerCase();\n }\n\n // Lastly, fall back to English.\n return 'en';\n}\n"]}
@@ -3816,5 +3816,5 @@ body {
3816
3816
  }
3817
3817
  }
3818
3818
  :root {
3819
- --awsui-version-info-b398201a: true;
3819
+ --awsui-version-info-a3d7548f: true;
3820
3820
  }
@@ -17,6 +17,8 @@ export interface ChartPopoverProps extends PopoverProps {
17
17
  */
18
18
  trackKey?: string | number;
19
19
  minVisibleBlockSize?: number;
20
+ /** Optional element to clamp the popover trigger position within its bounds */
21
+ triggerClampRef?: React.RefObject<HTMLElement>;
20
22
  /** Optional container element that prevents any clicks in there from dismissing the popover */
21
23
  container: Element | null;
22
24
  /** Event that is fired when the popover is dismissed */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAQjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAO3D,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;IACjD;;;;;;;;MAQE;IACF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,+FAA+F;IAC/F,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1B,wDAAwD;IACxD,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C,0EAA0E;IAC1E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAEjD,0EAA0E;IAC1E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAEjD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAE3C,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;;AAED,wBAA8C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAQjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAO3D,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;IACjD;;;;;;;;MAQE;IACF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,+EAA+E;IAC/E,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE/C,+FAA+F;IAC/F,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1B,wDAAwD;IACxD,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C,0EAA0E;IAC1E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAEjD,0EAA0E;IAC1E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAEjD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAE3C,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;;AAED,wBAA8C"}
@@ -11,7 +11,7 @@ import popoverStyles from '../../../popover/styles.css.js';
11
11
  import styles from './styles.css.js';
12
12
  import testClasses from './test-classes/styles.css.js';
13
13
  export default React.forwardRef(ChartPopover);
14
- function ChartPopover({ position = 'right', size = 'medium', fixedWidth = false, dismissButton = false, dismissAriaLabel, children, footer, title, trackRef, getTrack, trackKey, onDismiss, container, minVisibleBlockSize, onMouseEnter, onMouseLeave, onBlur, ...restProps }, ref) {
14
+ function ChartPopover({ position = 'right', size = 'medium', fixedWidth = false, dismissButton = false, dismissAriaLabel, children, footer, title, trackRef, getTrack, trackKey, onDismiss, container, triggerClampRef, minVisibleBlockSize, onMouseEnter, onMouseLeave, onBlur, ...restProps }, ref) {
15
15
  const baseProps = getBaseProps(restProps);
16
16
  const popoverObjectRef = useRef(null);
17
17
  const popoverRef = useMergeRefs(popoverObjectRef, ref);
@@ -42,7 +42,7 @@ function ChartPopover({ position = 'right', size = 'medium', fixedWidth = false,
42
42
  // The tabIndex makes it so that clicking inside popover assigns this element as blur target.
43
43
  // That is necessary in charts to ensure the blur target is within the chart and no cleanup is needed.
44
44
  tabIndex: -1 },
45
- React.createElement(PopoverContainer, { size: size, fixedWidth: fixedWidth, position: position, trackRef: trackRef, getTrack: getTrack, trackKey: trackKey, minVisibleBlockSize: minVisibleBlockSize, arrow: position => (React.createElement("div", { className: clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`]) },
45
+ React.createElement(PopoverContainer, { size: size, fixedWidth: fixedWidth, position: position, trackRef: trackRef, getTrack: getTrack, trackKey: trackKey, triggerClampRef: triggerClampRef, minVisibleBlockSize: minVisibleBlockSize, arrow: position => (React.createElement("div", { className: clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`]) },
46
46
  React.createElement("div", { className: popoverStyles['arrow-outer'] }),
47
47
  React.createElement("div", { className: popoverStyles['arrow-inner'] }))), keepPosition: true, allowVerticalOverflow: true, allowScrollToFit: isPinned, hoverArea: true },
48
48
  React.createElement(PopoverBody, { dismissButton: dismissButton, dismissAriaLabel: dismissAriaLabel, header: React.createElement("span", { className: testClasses.header }, title), onDismiss: () => onDismiss(), overflowVisible: "content", className: styles['popover-body'], variant: "chart" },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":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AAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CACjB,6BAAK,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;gBACpF,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI;gBAChD,6BAAK,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,GAAI,CAC5C,CACP,EACD,YAAY,EAAE,IAAI,EAClB,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,EAAE,QAAQ,EAC1B,SAAS,EAAE,IAAI;YAEf,oBAAC,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,8BAAM,SAAS,EAAE,WAAW,CAAC,MAAM,IAAG,KAAK,CAAQ,EAC3D,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAC5B,eAAe,EAAC,SAAS,EACzB,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EACjC,OAAO,EAAC,OAAO;gBAEf,6BAAK,SAAS,EAAE,WAAW,CAAC,IAAI,IAAG,QAAQ,CAAO;gBACjD,MAAM,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAG,MAAM,CAAO,CACtE,CACG,CACf,CACP,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 } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport PopoverBody from '../../../popover/body';\nimport PopoverContainer from '../../../popover/container';\nimport { PopoverProps } from '../../../popover/interfaces';\nimport { getBaseProps } from '../../base-component';\n\nimport popoverStyles from '../../../popover/styles.css.js';\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\nexport interface ChartPopoverProps extends PopoverProps {\n /** Title of the popover */\n title?: React.ReactNode;\n\n /** References the element the container is positioned against. */\n trackRef?: React.RefObject<HTMLElement | SVGElement>;\n getTrack?: () => null | HTMLElement | SVGElement;\n /**\n Used to update the container position in case track or track position changes:\n\n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n minVisibleBlockSize?: number;\n\n /** Optional container element that prevents any clicks in there from dismissing the popover */\n container: Element | null;\n\n /** Event that is fired when the popover is dismissed */\n onDismiss: (outsideClick?: boolean) => void;\n\n /** Fired when the pointer enters the hoverable area around the popover */\n onMouseEnter?: (event: React.MouseEvent) => void;\n\n /** Fired when the pointer leaves the hoverable area around the popover */\n onMouseLeave?: (event: React.MouseEvent) => void;\n\n onBlur?: (event: React.FocusEvent) => void;\n\n /** Popover content */\n children?: React.ReactNode;\n\n /** Popover footer */\n footer?: React.ReactNode;\n}\n\nexport default React.forwardRef(ChartPopover);\n\nfunction ChartPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n dismissButton = false,\n dismissAriaLabel,\n\n children,\n footer,\n\n title,\n trackRef,\n getTrack,\n trackKey,\n onDismiss,\n container,\n minVisibleBlockSize,\n\n onMouseEnter,\n onMouseLeave,\n onBlur,\n\n ...restProps\n }: ChartPopoverProps,\n ref: React.Ref<HTMLElement>\n) {\n const baseProps = getBaseProps(restProps);\n const popoverObjectRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useMergeRefs(popoverObjectRef, ref);\n\n const clickFrameId = useRef<number | null>(null);\n const onMouseDown = () => {\n // Indicate there was a click inside popover recently.\n clickFrameId.current = requestAnimationFrame(() => (clickFrameId.current = null));\n };\n\n useEffect(() => {\n if (popoverObjectRef.current) {\n const document = popoverObjectRef.current.ownerDocument;\n const onDocumentClick = (event: MouseEvent) => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n // Ignore clicks inside the chart as those are handled separately.\n if (clickFrameId.current === null && !nodeContains(container, event.target as Element)) {\n onDismiss(true);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }\n }, [container, onDismiss]);\n\n // In chart popovers, dismiss button is present when they are pinned, so both values are equivalent.\n const isPinned = dismissButton;\n\n return (\n <div\n {...baseProps}\n role={!dismissButton ? 'tooltip' : undefined}\n className={clsx(popoverStyles.root, styles.root, baseProps.className)}\n ref={popoverRef}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseDown={onMouseDown}\n onBlur={onBlur}\n // The tabIndex makes it so that clicking inside popover assigns this element as blur target.\n // That is necessary in charts to ensure the blur target is within the chart and no cleanup is needed.\n tabIndex={-1}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={trackRef}\n getTrack={getTrack}\n trackKey={trackKey}\n minVisibleBlockSize={minVisibleBlockSize}\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n keepPosition={true}\n allowVerticalOverflow={true}\n allowScrollToFit={isPinned}\n hoverArea={true}\n >\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={<span className={testClasses.header}>{title}</span>}\n onDismiss={() => onDismiss()}\n overflowVisible=\"content\"\n className={styles['popover-body']}\n variant=\"chart\"\n >\n <div className={testClasses.body}>{children}</div>\n {footer && <div className={clsx(testClasses.footer, styles.footer)}>{footer}</div>}\n </PopoverBody>\n </PopoverContainer>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-popover/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,8BAA8B,CAAC;AA6CvD,eAAe,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAE9C,SAAS,YAAY,CACnB,EACE,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK,EAClB,aAAa,GAAG,KAAK,EACrB,gBAAgB,EAEhB,QAAQ,EACR,MAAM,EAEN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,eAAe,EACf,mBAAmB,EAEnB,YAAY,EACZ,YAAY,EACZ,MAAM,EAEN,GAAG,SAAS,EACM,EACpB,GAA2B;IAE3B,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,gBAAgB,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,YAAY,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAEvD,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACjD,MAAM,WA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useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport PopoverBody from '../../../popover/body';\nimport PopoverContainer from '../../../popover/container';\nimport { PopoverProps } from '../../../popover/interfaces';\nimport { getBaseProps } from '../../base-component';\n\nimport popoverStyles from '../../../popover/styles.css.js';\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\nexport interface ChartPopoverProps extends PopoverProps {\n /** Title of the popover */\n title?: React.ReactNode;\n\n /** References the element the container is positioned against. */\n trackRef?: React.RefObject<HTMLElement | SVGElement>;\n getTrack?: () => null | HTMLElement | SVGElement;\n /**\n Used to update the container position in case track or track position changes:\n\n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n minVisibleBlockSize?: number;\n\n /** Optional element to clamp the popover trigger position within its bounds */\n triggerClampRef?: React.RefObject<HTMLElement>;\n\n /** Optional container element that prevents any clicks in there from dismissing the popover */\n container: Element | null;\n\n /** Event that is fired when the popover is dismissed */\n onDismiss: (outsideClick?: boolean) => void;\n\n /** Fired when the pointer enters the hoverable area around the popover */\n onMouseEnter?: (event: React.MouseEvent) => void;\n\n /** Fired when the pointer leaves the hoverable area around the popover */\n onMouseLeave?: (event: React.MouseEvent) => void;\n\n onBlur?: (event: React.FocusEvent) => void;\n\n /** Popover content */\n children?: React.ReactNode;\n\n /** Popover footer */\n footer?: React.ReactNode;\n}\n\nexport default React.forwardRef(ChartPopover);\n\nfunction ChartPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n dismissButton = false,\n dismissAriaLabel,\n\n children,\n footer,\n\n title,\n trackRef,\n getTrack,\n trackKey,\n onDismiss,\n container,\n triggerClampRef,\n minVisibleBlockSize,\n\n onMouseEnter,\n onMouseLeave,\n onBlur,\n\n ...restProps\n }: ChartPopoverProps,\n ref: React.Ref<HTMLElement>\n) {\n const baseProps = getBaseProps(restProps);\n const popoverObjectRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useMergeRefs(popoverObjectRef, ref);\n\n const clickFrameId = useRef<number | null>(null);\n const onMouseDown = () => {\n // Indicate there was a click inside popover recently.\n clickFrameId.current = requestAnimationFrame(() => (clickFrameId.current = null));\n };\n\n useEffect(() => {\n if (popoverObjectRef.current) {\n const document = popoverObjectRef.current.ownerDocument;\n const onDocumentClick = (event: MouseEvent) => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n // Ignore clicks inside the chart as those are handled separately.\n if (clickFrameId.current === null && !nodeContains(container, event.target as Element)) {\n onDismiss(true);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }\n }, [container, onDismiss]);\n\n // In chart popovers, dismiss button is present when they are pinned, so both values are equivalent.\n const isPinned = dismissButton;\n\n return (\n <div\n {...baseProps}\n role={!dismissButton ? 'tooltip' : undefined}\n className={clsx(popoverStyles.root, styles.root, baseProps.className)}\n ref={popoverRef}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseDown={onMouseDown}\n onBlur={onBlur}\n // The tabIndex makes it so that clicking inside popover assigns this element as blur target.\n // That is necessary in charts to ensure the blur target is within the chart and no cleanup is needed.\n tabIndex={-1}\n >\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={trackRef}\n getTrack={getTrack}\n trackKey={trackKey}\n triggerClampRef={triggerClampRef}\n minVisibleBlockSize={minVisibleBlockSize}\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n keepPosition={true}\n allowVerticalOverflow={true}\n allowScrollToFit={isPinned}\n hoverArea={true}\n >\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={<span className={testClasses.header}>{title}</span>}\n onDismiss={() => onDismiss()}\n overflowVisible=\"content\"\n className={styles['popover-body']}\n variant=\"chart\"\n >\n <div className={testClasses.body}>{children}</div>\n {footer && <div className={clsx(testClasses.footer, styles.footer)}>{footer}</div>}\n </PopoverBody>\n </PopoverContainer>\n </div>\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (b398201a)";
3
- export var GIT_SHA = "b398201a";
2
+ export var PACKAGE_VERSION = "3.0.0 (a3d7548f)";
3
+ export var GIT_SHA = "a3d7548f";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "core";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (b398201a)",
4
- "GIT_SHA": "b398201a",
3
+ "PACKAGE_VERSION": "3.0.0 (a3d7548f)",
4
+ "GIT_SHA": "a3d7548f",
5
5
  "THEME": "default",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": false
@@ -53,11 +53,25 @@ export interface DrawerPayload {
53
53
  }
54
54
  type Destructor = () => void;
55
55
  export type MountContentPart<T> = (container: HTMLElement, data: T) => Destructor | void;
56
+ /**
57
+ * Describes a single feature entry in the notification drawer.
58
+ *
59
+ * The generic type `T` determines how feature text content is provided:
60
+ * - When `T` is `string`, the values are rendered as plain text.
61
+ * - When `T` is `ReactNode`, you must also provide `mountItem` on the parent
62
+ * `FeatureNotificationsPayload` so the framework can mount the React content
63
+ * into the DOM container.
64
+ */
56
65
  export interface Feature<T> {
66
+ /** Unique identifier used for persistence tracking (seen/unseen state) and list keying. */
57
67
  id: string;
68
+ /** Primary title displayed as the feature heading in both the notification drawer and the feature prompt popover. */
58
69
  header: T;
70
+ /** Descriptive body rendered below the header in the notification drawer and the feature prompt popover. */
59
71
  content: T;
72
+ /** Optional category label rendered between the release date and the content in the notification drawer. */
60
73
  contentCategory?: T;
74
+ /** Publication date of the feature. Used for default filtering (last 90 days), descending sort order, and display formatting. */
61
75
  releaseDate: Date;
62
76
  }
63
77
  export interface FeatureNotificationsPersistenceConfig {
@@ -69,14 +83,84 @@ export type PersistedFeaturesDict = Record<FeatureId, FeatureReleaseDateString>;
69
83
  export type PersistFeatureNotifications = (persistenceConfig: FeatureNotificationsPersistenceConfig, value: PersistedFeaturesDict) => Promise<void>;
70
84
  export type RetrieveFeatureNotifications = (persistenceConfig: FeatureNotificationsPersistenceConfig) => Promise<PersistedFeaturesDict>;
71
85
  export interface FeatureNotificationsPayload<T> {
86
+ /**
87
+ * Unique identifier for the feature notifications.
88
+ */
72
89
  id: string;
90
+ /**
91
+ * When set to `true`, prevents the feature prompt from automatically appearing
92
+ * when unseen features are detected during registration. The prompt can still
93
+ * be shown programmatically via the `showFeaturePromptIfPossible` message.
94
+ *
95
+ * @default false
96
+ */
73
97
  suppressFeaturePrompt?: boolean;
98
+ /**
99
+ * List of features to display in the notification drawer. Each feature is filtered
100
+ * by `filterFeatures` (or a default 90-day recency filter), sorted by `releaseDate`
101
+ * in descending order, and tracked for seen/unseen state via persistence. The latest
102
+ * unseen feature is used to populate the feature prompt, and opening the drawer marks
103
+ * all features as seen.
104
+ */
74
105
  features: Array<Feature<T>>;
106
+ /**
107
+ * Mounting function used to render each feature's `header`, `content`, and
108
+ * `contentCategory` values into the DOM. Required when `T` is `ReactNode`
109
+ * (or any non-string type) so the framework can mount the content into the
110
+ * provided container element. When `T` is `string`, this can be omitted and
111
+ * values are rendered as plain text.
112
+ *
113
+ * The function receives the target `container` element and the `data` value
114
+ * (one of the feature's text fields), and should return an optional destructor
115
+ * that will be called on unmount to clean up resources (e.g. `root.unmount()`).
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * import { createRoot } from 'react-dom/client';
120
+ *
121
+ * mountItem: (container, data) => {
122
+ * const root = createRoot(container);
123
+ * root.render(data);
124
+ * return () => root.unmount();
125
+ * }
126
+ * ```
127
+ */
75
128
  mountItem?: MountContentPart<T>;
129
+ /**
130
+ * Optional URL rendered as a "View all feature releases" link at the bottom of the notification
131
+ * drawer, allowing users to navigate to a dedicated page with the full list of
132
+ * features.
133
+ */
76
134
  featuresPageLink?: string;
135
+ /**
136
+ * Optional predicate to control which features are displayed. Applied to each
137
+ * feature before sorting. When omitted, a default filter is used that only
138
+ * keeps features with a `releaseDate` within the last 90 days.
139
+ */
77
140
  filterFeatures?: (item: Feature<T>) => boolean;
141
+ /**
142
+ * Configuration for persisting seen/unseen state of features. The `uniqueKey`
143
+ * is used as the storage key when saving and retrieving which features the user
144
+ * has already viewed. When omitted, a default key (`'awsui-feature-notifications'`)
145
+ * is used.
146
+ */
78
147
  persistenceConfig?: FeatureNotificationsPersistenceConfig;
148
+ /**
149
+ * @internal
150
+ * Optional override for saving the seen/unseen state of features. When provided,
151
+ * this function is called instead of the built-in persistence mechanism when the
152
+ * user opens the notification drawer and all features are marked as seen.
153
+ * Receives the `persistenceConfig` and a dictionary mapping feature IDs to their
154
+ * release date strings.
155
+ */
79
156
  __persistFeatureNotifications?: PersistFeatureNotifications;
157
+ /**
158
+ * @internal
159
+ * Optional override for retrieving the previously persisted seen/unseen state of
160
+ * features. When provided, this function is called instead of the built-in retrieval
161
+ * mechanism during registration to determine which features the user has already viewed.
162
+ * Should return a dictionary mapping feature IDs to their release date strings.
163
+ */
80
164
  __retrieveFeatureNotifications?: RetrieveFeatureNotifications;
81
165
  }
82
166
  export type FeatureNotificationsPayloadPublic<T> = Omit<FeatureNotificationsPayload<T>, '__persistFeatureNotifications' | '__retrieveFeatureNotifications'>;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,E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cAAc,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n exitExpandedModeTrigger?: {\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<ItemRuntime>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n onToggleFocusMode?: NonCancelableEventHandler<{ isExpanded: boolean }>;\n position?: 'side' | 'bottom';\n}\n\ntype Destructor = () => void;\nexport type MountContentPart<T> = (container: HTMLElement, data: T) => Destructor | void;\n\nexport interface Feature<T> {\n id: string;\n header: T;\n content: T;\n contentCategory?: T;\n releaseDate: Date;\n}\n\nexport interface FeatureNotificationsPersistenceConfig {\n uniqueKey: string;\n}\n\ntype FeatureId = string;\ntype FeatureReleaseDateString = string;\nexport type PersistedFeaturesDict = Record<FeatureId, FeatureReleaseDateString>;\nexport type PersistFeatureNotifications = (\n persistenceConfig: FeatureNotificationsPersistenceConfig,\n value: PersistedFeaturesDict\n) => Promise<void>;\nexport type RetrieveFeatureNotifications = (\n persistenceConfig: FeatureNotificationsPersistenceConfig\n) => Promise<PersistedFeaturesDict>;\n\nexport interface FeatureNotificationsPayload<T> {\n id: string;\n suppressFeaturePrompt?: boolean;\n features: Array<Feature<T>>;\n mountItem?: MountContentPart<T>;\n featuresPageLink?: string;\n filterFeatures?: (item: Feature<T>) => boolean;\n persistenceConfig?: FeatureNotificationsPersistenceConfig;\n __persistFeatureNotifications?: PersistFeatureNotifications;\n __retrieveFeatureNotifications?: RetrieveFeatureNotifications;\n}\n\nexport type FeatureNotificationsPayloadPublic<T> = Omit<\n FeatureNotificationsPayload<T>,\n '__persistFeatureNotifications' | '__retrieveFeatureNotifications'\n>;\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer' | 'registerBottomDrawer', DrawerPayload>;\nexport type RegisterFeatureNotificationsMessage<T> = Message<\n 'registerFeatureNotifications',\n FeatureNotificationsPayload<T>\n>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Pick<DrawerPayload, 'id'> &\n Partial<Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\nexport type ExpandDrawerMessage = Message<'expandDrawer', { id: string }>;\nexport interface ExitExpandedModeMessage {\n type: 'exitExpandedMode';\n}\nexport interface ShowFeaturePromptIfPossible {\n type: 'showFeaturePromptIfPossible';\n}\nexport interface ClearFeatureNotifications {\n type: 'clearFeatureNotifications';\n}\n\nexport type AppLayoutUpdateMessage<T = unknown> =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage\n | ExpandDrawerMessage\n | ExitExpandedModeMessage\n | RegisterFeatureNotificationsMessage<T>\n | ShowFeaturePromptIfPossible\n | ClearFeatureNotifications;\n\nexport type InitialMessage<T> = RegisterDrawerMessage | RegisterFeatureNotificationsMessage<T>;\n\nexport type WidgetMessage<T = unknown> = InitialMessage<T> | AppLayoutUpdateMessage<T>;\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps, ItemRuntime } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n exitExpandedModeTrigger?: {\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<ItemRuntime>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n onToggleFocusMode?: NonCancelableEventHandler<{ isExpanded: boolean }>;\n position?: 'side' | 'bottom';\n}\n\ntype Destructor = () => void;\nexport type MountContentPart<T> = (container: HTMLElement, data: T) => Destructor | void;\n\n/**\n * Describes a single feature entry in the notification drawer.\n *\n * The generic type `T` determines how feature text content is provided:\n * - When `T` is `string`, the values are rendered as plain text.\n * - When `T` is `ReactNode`, you must also provide `mountItem` on the parent\n * `FeatureNotificationsPayload` so the framework can mount the React content\n * into the DOM container.\n */\nexport interface Feature<T> {\n /** Unique identifier used for persistence tracking (seen/unseen state) and list keying. */\n id: string;\n /** Primary title displayed as the feature heading in both the notification drawer and the feature prompt popover. */\n header: T;\n /** Descriptive body rendered below the header in the notification drawer and the feature prompt popover. */\n content: T;\n /** Optional category label rendered between the release date and the content in the notification drawer. */\n contentCategory?: T;\n /** Publication date of the feature. Used for default filtering (last 90 days), descending sort order, and display formatting. */\n releaseDate: Date;\n}\n\nexport interface FeatureNotificationsPersistenceConfig {\n uniqueKey: string;\n}\n\ntype FeatureId = string;\ntype FeatureReleaseDateString = string;\nexport type PersistedFeaturesDict = Record<FeatureId, FeatureReleaseDateString>;\nexport type PersistFeatureNotifications = (\n persistenceConfig: FeatureNotificationsPersistenceConfig,\n value: PersistedFeaturesDict\n) => Promise<void>;\nexport type RetrieveFeatureNotifications = (\n persistenceConfig: FeatureNotificationsPersistenceConfig\n) => Promise<PersistedFeaturesDict>;\n\nexport interface FeatureNotificationsPayload<T> {\n /**\n * Unique identifier for the feature notifications.\n */\n id: string;\n /**\n * When set to `true`, prevents the feature prompt from automatically appearing\n * when unseen features are detected during registration. The prompt can still\n * be shown programmatically via the `showFeaturePromptIfPossible` message.\n *\n * @default false\n */\n suppressFeaturePrompt?: boolean;\n /**\n * List of features to display in the notification drawer. Each feature is filtered\n * by `filterFeatures` (or a default 90-day recency filter), sorted by `releaseDate`\n * in descending order, and tracked for seen/unseen state via persistence. The latest\n * unseen feature is used to populate the feature prompt, and opening the drawer marks\n * all features as seen.\n */\n features: Array<Feature<T>>;\n /**\n * Mounting function used to render each feature's `header`, `content`, and\n * `contentCategory` values into the DOM. Required when `T` is `ReactNode`\n * (or any non-string type) so the framework can mount the content into the\n * provided container element. When `T` is `string`, this can be omitted and\n * values are rendered as plain text.\n *\n * The function receives the target `container` element and the `data` value\n * (one of the feature's text fields), and should return an optional destructor\n * that will be called on unmount to clean up resources (e.g. `root.unmount()`).\n *\n * @example\n * ```ts\n * import { createRoot } from 'react-dom/client';\n *\n * mountItem: (container, data) => {\n * const root = createRoot(container);\n * root.render(data);\n * return () => root.unmount();\n * }\n * ```\n */\n mountItem?: MountContentPart<T>;\n /**\n * Optional URL rendered as a \"View all feature releases\" link at the bottom of the notification\n * drawer, allowing users to navigate to a dedicated page with the full list of\n * features.\n */\n featuresPageLink?: string;\n /**\n * Optional predicate to control which features are displayed. Applied to each\n * feature before sorting. When omitted, a default filter is used that only\n * keeps features with a `releaseDate` within the last 90 days.\n */\n filterFeatures?: (item: Feature<T>) => boolean;\n /**\n * Configuration for persisting seen/unseen state of features. The `uniqueKey`\n * is used as the storage key when saving and retrieving which features the user\n * has already viewed. When omitted, a default key (`'awsui-feature-notifications'`)\n * is used.\n */\n persistenceConfig?: FeatureNotificationsPersistenceConfig;\n /**\n * @internal\n * Optional override for saving the seen/unseen state of features. When provided,\n * this function is called instead of the built-in persistence mechanism when the\n * user opens the notification drawer and all features are marked as seen.\n * Receives the `persistenceConfig` and a dictionary mapping feature IDs to their\n * release date strings.\n */\n __persistFeatureNotifications?: PersistFeatureNotifications;\n /**\n * @internal\n * Optional override for retrieving the previously persisted seen/unseen state of\n * features. When provided, this function is called instead of the built-in retrieval\n * mechanism during registration to determine which features the user has already viewed.\n * Should return a dictionary mapping feature IDs to their release date strings.\n */\n __retrieveFeatureNotifications?: RetrieveFeatureNotifications;\n}\n\nexport type FeatureNotificationsPayloadPublic<T> = Omit<\n FeatureNotificationsPayload<T>,\n '__persistFeatureNotifications' | '__retrieveFeatureNotifications'\n>;\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer' | 'registerBottomDrawer', DrawerPayload>;\nexport type RegisterFeatureNotificationsMessage<T> = Message<\n 'registerFeatureNotifications',\n FeatureNotificationsPayload<T>\n>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Pick<DrawerPayload, 'id'> &\n Partial<Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\nexport type ExpandDrawerMessage = Message<'expandDrawer', { id: string }>;\nexport interface ExitExpandedModeMessage {\n type: 'exitExpandedMode';\n}\nexport interface ShowFeaturePromptIfPossible {\n type: 'showFeaturePromptIfPossible';\n}\nexport interface ClearFeatureNotifications {\n type: 'clearFeatureNotifications';\n}\n\nexport type AppLayoutUpdateMessage<T = unknown> =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage\n | ExpandDrawerMessage\n | ExitExpandedModeMessage\n | RegisterFeatureNotificationsMessage<T>\n | ShowFeaturePromptIfPossible\n | ClearFeatureNotifications;\n\nexport type InitialMessage<T> = RegisterDrawerMessage | RegisterFeatureNotificationsMessage<T>;\n\nexport type WidgetMessage<T = unknown> = InitialMessage<T> | AppLayoutUpdateMessage<T>;\n"]}
@@ -15,4 +15,5 @@ export { DrawerImplementation as Drawer } from '../drawer/implementation';
15
15
  export { FlashbarImplementation as Flashbar } from '../flashbar/implementation';
16
16
  export { SideNavigationImplementation as SideNavigation } from '../side-navigation/implementation';
17
17
  export { HelpPanelImplementation as HelpPanel } from '../help-panel/implementation';
18
+ export { I18nFormatter } from '../i18n/utils/i18n-formatter';
18
19
  //# sourceMappingURL=widget-exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-exports.d.ts","sourceRoot":"","sources":["../../../src/internal/widget-exports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EACL,6BAA6B,IAAI,eAAe,EAChD,oCAAoC,IAAI,sBAAsB,GAC/D,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iCAAiC,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3H,OAAO,EAAE,oCAAoC,IAAI,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AACpI,OAAO,EACL,6CAA6C,IAAI,yBAAyB,EAC1E,2CAA2C,IAAI,uBAAuB,GACvE,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,8BAA8B,IAAI,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAGlH,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,2BAA2B,IAAI,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAC1I,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,+BAA+B,IAAI,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACtJ,OAAO,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEhH,OAAO,EAAE,wBAAwB,IAAI,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,6BAA6B,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAE,oBAAoB,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC1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EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,4BAA4B,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,uBAAuB,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
@@ -19,4 +19,6 @@ export { DrawerImplementation as Drawer } from '../drawer/implementation';
19
19
  export { FlashbarImplementation as Flashbar } from '../flashbar/implementation';
20
20
  export { SideNavigationImplementation as SideNavigation } from '../side-navigation/implementation';
21
21
  export { HelpPanelImplementation as HelpPanel } from '../help-panel/implementation';
22
+ // Widgetized non-component exports
23
+ export { I18nFormatter } from '../i18n/utils/i18n-formatter';
22
24
  //# sourceMappingURL=widget-exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-exports.js","sourceRoot":"","sources":["../../../src/internal/widget-exports.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,0BAA0B;AAC1B,OAAO,EACL,6BAA6B,IAAI,eAAe,EAChD,oCAAoC,IAAI,sBAAsB,GAC/D,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iCAAiC,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3H,OAAO,EAAE,oCAAoC,IAAI,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AACpI,OAAO,EACL,6CAA6C,IAAI,yBAAyB,EAC1E,2CAA2C,IAAI,uBAAuB,GACvE,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,8BAA8B,IAAI,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAElH,8BAA8B;AAC9B,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,2BAA2B,IAAI,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAC1I,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,+BAA+B,IAAI,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACtJ,OAAO,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEhH,OAAO,EAAE,wBAAwB,IAAI,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,6BAA6B,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAE,oBAAoB,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,4BAA4B,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,uBAAuB,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { PACKAGE_VERSION } from './environment';\n\n// Legacy widgetized parts\nexport {\n AppLayoutDrawerImplementation as AppLayoutDrawer,\n AppLayoutGlobalDrawersImplementation as AppLayoutGlobalDrawers,\n} from '../app-layout/visual-refresh-toolbar/drawer';\nexport { AppLayoutNavigationImplementation as AppLayoutNavigation } from '../app-layout/visual-refresh-toolbar/navigation';\nexport { AppLayoutNotificationsImplementation as AppLayoutNotifications } from '../app-layout/visual-refresh-toolbar/notifications';\nexport {\n AppLayoutSplitPanelDrawerBottomImplementation as AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelDrawerSideImplementation as AppLayoutSplitPanelSide,\n} from '../app-layout/visual-refresh-toolbar/split-panel';\nexport { AppLayoutToolbarImplementation as AppLayoutToolbar } from '../app-layout/visual-refresh-toolbar/toolbar';\n\n// Refactored widgetized parts\nexport { BeforeMainSlotImplementation as AppLayoutBeforeMainSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/before-main-slot';\nexport { AfterMainSlotImplementation as AppLayoutAfterMainSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/after-main-slot';\nexport { TopContentSlotImplementation as AppLayoutTopContentSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/top-content-slot';\nexport { BottomContentSlotImplementation as AppLayoutBottomContentSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot';\nexport { AppLayoutStateProvider as AppLayoutWidgetizedState } from '../app-layout/visual-refresh-toolbar/state';\n\nexport { SplitPanelImplementation as SplitPanel } from '../split-panel/implementation';\nexport { BreadcrumbGroupImplementation as BreadcrumbGroup } from '../breadcrumb-group/implementation';\nexport { DrawerImplementation as Drawer } from '../drawer/implementation';\nexport { FlashbarImplementation as Flashbar } from '../flashbar/implementation';\nexport { SideNavigationImplementation as SideNavigation } from '../side-navigation/implementation';\nexport { HelpPanelImplementation as HelpPanel } from '../help-panel/implementation';\n"]}
1
+ {"version":3,"file":"widget-exports.js","sourceRoot":"","sources":["../../../src/internal/widget-exports.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,0BAA0B;AAC1B,OAAO,EACL,6BAA6B,IAAI,eAAe,EAChD,oCAAoC,IAAI,sBAAsB,GAC/D,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iCAAiC,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3H,OAAO,EAAE,oCAAoC,IAAI,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AACpI,OAAO,EACL,6CAA6C,IAAI,yBAAyB,EAC1E,2CAA2C,IAAI,uBAAuB,GACvE,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,8BAA8B,IAAI,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAElH,8BAA8B;AAC9B,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,2BAA2B,IAAI,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAC1I,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,MAAM,oEAAoE,CAAC;AAC7I,OAAO,EAAE,+BAA+B,IAAI,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACtJ,OAAO,EAAE,sBAAsB,IAAI,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEhH,OAAO,EAAE,wBAAwB,IAAI,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,6BAA6B,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAE,oBAAoB,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,4BAA4B,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,uBAAuB,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEpF,mCAAmC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport { PACKAGE_VERSION } from './environment';\n\n// Legacy widgetized parts\nexport {\n AppLayoutDrawerImplementation as AppLayoutDrawer,\n AppLayoutGlobalDrawersImplementation as AppLayoutGlobalDrawers,\n} from '../app-layout/visual-refresh-toolbar/drawer';\nexport { AppLayoutNavigationImplementation as AppLayoutNavigation } from '../app-layout/visual-refresh-toolbar/navigation';\nexport { AppLayoutNotificationsImplementation as AppLayoutNotifications } from '../app-layout/visual-refresh-toolbar/notifications';\nexport {\n AppLayoutSplitPanelDrawerBottomImplementation as AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelDrawerSideImplementation as AppLayoutSplitPanelSide,\n} from '../app-layout/visual-refresh-toolbar/split-panel';\nexport { AppLayoutToolbarImplementation as AppLayoutToolbar } from '../app-layout/visual-refresh-toolbar/toolbar';\n\n// Refactored widgetized parts\nexport { BeforeMainSlotImplementation as AppLayoutBeforeMainSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/before-main-slot';\nexport { AfterMainSlotImplementation as AppLayoutAfterMainSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/after-main-slot';\nexport { TopContentSlotImplementation as AppLayoutTopContentSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/top-content-slot';\nexport { BottomContentSlotImplementation as AppLayoutBottomContentSlot } from '../app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot';\nexport { AppLayoutStateProvider as AppLayoutWidgetizedState } from '../app-layout/visual-refresh-toolbar/state';\n\nexport { SplitPanelImplementation as SplitPanel } from '../split-panel/implementation';\nexport { BreadcrumbGroupImplementation as BreadcrumbGroup } from '../breadcrumb-group/implementation';\nexport { DrawerImplementation as Drawer } from '../drawer/implementation';\nexport { FlashbarImplementation as Flashbar } from '../flashbar/implementation';\nexport { SideNavigationImplementation as SideNavigation } from '../side-navigation/implementation';\nexport { HelpPanelImplementation as HelpPanel } from '../help-panel/implementation';\n\n// Widgetized non-component exports\nexport { I18nFormatter } from '../i18n/utils/i18n-formatter';\n"]}
@@ -15,6 +15,8 @@ interface PopoverContainerProps {
15
15
  */
16
16
  trackKey?: string | number;
17
17
  minVisibleBlockSize?: number;
18
+ /** Optional parent element to clamp popover position within its bounds */
19
+ triggerClampRef?: React.RefObject<HTMLElement>;
18
20
  position: PopoverProps.Position;
19
21
  zIndex?: React.CSSProperties['zIndex'];
20
22
  arrow: (position: InternalPosition | null) => React.ReactNode;
@@ -30,6 +32,6 @@ interface PopoverContainerProps {
30
32
  hoverArea?: boolean;
31
33
  className?: string;
32
34
  }
33
- export default function PopoverContainer({ position, trackRef, getTrack: externalGetTrack, trackKey, minVisibleBlockSize, arrow, children, zIndex, renderWithPortal, size, fixedWidth, variant, keepPosition, allowScrollToFit, allowVerticalOverflow, hideOnOverscroll, hoverArea, className, }: PopoverContainerProps): JSX.Element | null;
35
+ export default function PopoverContainer({ position, trackRef, getTrack: externalGetTrack, trackKey, triggerClampRef, minVisibleBlockSize, arrow, children, zIndex, renderWithPortal, size, fixedWidth, variant, keepPosition, allowScrollToFit, allowVerticalOverflow, hideOnOverscroll, hoverArea, className, }: PopoverContainerProps): JSX.Element | null;
34
36
  export {};
35
37
  //# sourceMappingURL=container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/popover/container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM9D,UAAU,qBAAqB;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;IACjD;;;;;;;;MAQE;IACF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;IAC9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC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AQ,CAAC,CAAC;IACvC,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;IAC9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,QAAQ,EACR,QAAQ,EACR,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,sBAuGvB"}
@@ -7,7 +7,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
7
7
  import usePopoverPosition from './use-popover-position.js';
8
8
  import usePositionObserver from './use-position-observer';
9
9
  import styles from './styles.css.js';
10
- export default function PopoverContainer({ position, trackRef, getTrack: externalGetTrack, trackKey, minVisibleBlockSize, arrow, children, zIndex, renderWithPortal, size, fixedWidth, variant, keepPosition, allowScrollToFit, allowVerticalOverflow, hideOnOverscroll, hoverArea, className, }) {
10
+ export default function PopoverContainer({ position, trackRef, getTrack: externalGetTrack, trackKey, triggerClampRef, minVisibleBlockSize, arrow, children, zIndex, renderWithPortal, size, fixedWidth, variant, keepPosition, allowScrollToFit, allowVerticalOverflow, hideOnOverscroll, hoverArea, className, }) {
11
11
  const bodyRef = useRef(null);
12
12
  const contentRef = useRef(null);
13
13
  const popoverRef = useRef(null);
@@ -27,6 +27,7 @@ export default function PopoverContainer({ position, trackRef, getTrack: externa
27
27
  popoverRef,
28
28
  bodyRef,
29
29
  arrowRef,
30
+ triggerClampRef,
30
31
  getTrack: getTrack.current,
31
32
  contentRef,
32
33
  allowScrollToFit,
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../src/popover/container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEhH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAqCrC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,QAAQ,EACR,QAAQ,EACR,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EACR,mBAAmB,EACnB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,SAAS,GACa;IACtB,MAAM,OAAO,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,MAAM,CAAwB,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AE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,4BAA4B,gBAAgB,EAAE,CAAC,CAAC,iBACrF,IAAI,IAEhB,KAAK,CAAC,gBAAgB,CAAC,CACpB;QAEN,6BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,uBAAuB,IAAI,EAAE,CAAC,EAAE;gBAC/E,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU;gBACnC,CAAC,MAAM,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO;aACvD,CAAC,IAED,SAAS,CAAC,CAAC,CAAC,CACX,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;YAClC,6BAAK,GAAG,EAAE,UAAU,IAAG,QAAQ,CAAO,CAClC,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,GAAG,EAAE,UAAU,IAAG,QAAQ,CAAO,CACvC,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getLogicalBoundingClientRect, useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalPosition, PopoverProps } from './interfaces';\nimport usePopoverPosition from './use-popover-position.js';\nimport usePositionObserver from './use-position-observer';\n\nimport styles from './styles.css.js';\n\ninterface PopoverContainerProps {\n /** References the element the container is positioned against. */\n trackRef?: React.RefObject<HTMLElement | SVGElement>;\n getTrack?: () => null | HTMLElement | SVGElement;\n /**\n Used to update the container position in case track or track position changes:\n\n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n minVisibleBlockSize?: number;\n position: PopoverProps.Position;\n zIndex?: React.CSSProperties['zIndex'];\n arrow: (position: InternalPosition | null) => React.ReactNode;\n children: React.ReactNode;\n renderWithPortal?: boolean;\n size: PopoverProps.Size | 'content';\n fixedWidth: boolean;\n variant?: 'annotation';\n // When keepPosition is true, the popover will not recalculate its position when it resizes nor when it receives clicks.\n keepPosition?: boolean;\n // When allowScrollToFit is true, we will scroll to the the popover if it overflows the viewport even when choosing the best possible position for it.\n // Do not use this if the popover is open on hover, in order to avoid unexpected movement.\n allowScrollToFit?: boolean;\n allowVerticalOverflow?: boolean;\n // Whether the popover should be hidden when the trigger is scrolled away.\n hideOnOverscroll?: boolean;\n hoverArea?: boolean;\n className?: string;\n}\n\nexport default function PopoverContainer({\n position,\n trackRef,\n getTrack: externalGetTrack,\n trackKey,\n minVisibleBlockSize,\n arrow,\n children,\n zIndex,\n renderWithPortal,\n size,\n fixedWidth,\n variant,\n keepPosition,\n allowScrollToFit,\n allowVerticalOverflow,\n hideOnOverscroll,\n hoverArea,\n className,\n}: PopoverContainerProps) {\n const bodyRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const arrowRef = useRef<HTMLDivElement | null>(null);\n\n const isRefresh = useVisualRefresh();\n\n const getTrack = useRef(() => {\n if (trackRef) {\n return trackRef.current;\n }\n if (externalGetTrack) {\n return externalGetTrack();\n }\n throw new Error('Invariant violation: must provide either trackRef or getTrack.');\n });\n\n // Updates the position handler.\n const { updatePositionHandler, popoverStyle, internalPosition, positionHandlerRef, isOverscrolling } =\n usePopoverPosition({\n popoverRef,\n bodyRef,\n arrowRef,\n getTrack: getTrack.current,\n contentRef,\n allowScrollToFit,\n allowVerticalOverflow,\n preferredPosition: position,\n renderWithPortal,\n keepPosition,\n hideOnOverscroll,\n minVisibleBlockSize,\n });\n\n // Recalculate position when properties change.\n useLayoutEffect(() => {\n updatePositionHandler();\n }, [updatePositionHandler, trackKey]);\n\n // Recalculate position when content size changes.\n useResizeObserver(contentRef, () => {\n updatePositionHandler(true);\n });\n\n // Recalculate position when the DOM changes.\n // istanbul ignore next - tested via integration tests\n usePositionObserver(getTrack.current, trackKey, () => {\n // Do not update position if popover moved offscreen\n const popoverOffset = popoverRef.current && getLogicalBoundingClientRect(popoverRef.current);\n if (!popoverOffset || popoverOffset.insetBlockStart < 0 || popoverOffset.insetBlockEnd > window.innerHeight) {\n return;\n }\n positionHandlerRef.current();\n });\n\n // Recalculate position on resize or scroll events.\n useLayoutEffect(() => {\n const controller = new AbortController();\n\n const updatePositionOnResize = () => requestAnimationFrame(() => updatePositionHandler(true));\n const refreshPosition = () => requestAnimationFrame(() => positionHandlerRef.current());\n\n window.addEventListener('resize', updatePositionOnResize, { signal: controller.signal });\n window.addEventListener('scroll', refreshPosition, { capture: true, signal: controller.signal });\n\n return () => {\n controller.abort();\n };\n }, [hideOnOverscroll, keepPosition, positionHandlerRef, trackRef, updatePositionHandler]);\n\n return isOverscrolling ? null : (\n <div\n ref={popoverRef}\n style={{ ...popoverStyle, zIndex }}\n className={clsx(styles.container, isRefresh && styles.refresh, className)}\n >\n <div\n ref={arrowRef}\n className={clsx(styles[`container-arrow`], styles[`container-arrow-position-${internalPosition}`])}\n aria-hidden={true}\n >\n {arrow(internalPosition)}\n </div>\n\n <div\n ref={bodyRef}\n className={clsx(styles['container-body'], styles[`container-body-size-${size}`], {\n [styles['fixed-width']]: fixedWidth,\n [styles[`container-body-variant-${variant}`]]: variant,\n })}\n >\n {hoverArea ? (\n <div className={styles['hover-area']}>\n <div ref={contentRef}>{children}</div>\n </div>\n ) : (\n <div ref={contentRef}>{children}</div>\n )}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../src/popover/container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAA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CAAC,CACX,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;YAClC,6BAAK,GAAG,EAAE,UAAU,IAAG,QAAQ,CAAO,CAClC,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,GAAG,EAAE,UAAU,IAAG,QAAQ,CAAO,CACvC,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useLayoutEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getLogicalBoundingClientRect, useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalPosition, PopoverProps } from './interfaces';\nimport usePopoverPosition from './use-popover-position.js';\nimport usePositionObserver from './use-position-observer';\n\nimport styles from './styles.css.js';\n\ninterface PopoverContainerProps {\n /** References the element the container is positioned against. */\n trackRef?: React.RefObject<HTMLElement | SVGElement>;\n getTrack?: () => null | HTMLElement | SVGElement;\n /**\n Used to update the container position in case track or track position changes:\n\n const trackRef = useRef<Element>(null)\n return (<>\n <Track style={getPosition(selectedItemId)} ref={trackRef} />\n <PopoverContainer trackRef={trackRef} trackKey={selectedItemId} .../>\n </>)\n */\n trackKey?: string | number;\n minVisibleBlockSize?: number;\n /** Optional parent element to clamp popover position within its bounds */\n triggerClampRef?: React.RefObject<HTMLElement>;\n position: PopoverProps.Position;\n zIndex?: React.CSSProperties['zIndex'];\n arrow: (position: InternalPosition | null) => React.ReactNode;\n children: React.ReactNode;\n renderWithPortal?: boolean;\n size: PopoverProps.Size | 'content';\n fixedWidth: boolean;\n variant?: 'annotation';\n // When keepPosition is true, the popover will not recalculate its position when it resizes nor when it receives clicks.\n keepPosition?: boolean;\n // When allowScrollToFit is true, we will scroll to the the popover if it overflows the viewport even when choosing the best possible position for it.\n // Do not use this if the popover is open on hover, in order to avoid unexpected movement.\n allowScrollToFit?: boolean;\n allowVerticalOverflow?: boolean;\n // Whether the popover should be hidden when the trigger is scrolled away.\n hideOnOverscroll?: boolean;\n hoverArea?: boolean;\n className?: string;\n}\n\nexport default function PopoverContainer({\n position,\n trackRef,\n getTrack: externalGetTrack,\n trackKey,\n triggerClampRef,\n minVisibleBlockSize,\n arrow,\n children,\n zIndex,\n renderWithPortal,\n size,\n fixedWidth,\n variant,\n keepPosition,\n allowScrollToFit,\n allowVerticalOverflow,\n hideOnOverscroll,\n hoverArea,\n className,\n}: PopoverContainerProps) {\n const bodyRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const arrowRef = useRef<HTMLDivElement | null>(null);\n\n const isRefresh = useVisualRefresh();\n\n const getTrack = useRef(() => {\n if (trackRef) {\n return trackRef.current;\n }\n if (externalGetTrack) {\n return externalGetTrack();\n }\n throw new Error('Invariant violation: must provide either trackRef or getTrack.');\n });\n\n // Updates the position handler.\n const { updatePositionHandler, popoverStyle, internalPosition, positionHandlerRef, isOverscrolling } =\n usePopoverPosition({\n popoverRef,\n bodyRef,\n arrowRef,\n triggerClampRef,\n getTrack: getTrack.current,\n contentRef,\n allowScrollToFit,\n allowVerticalOverflow,\n preferredPosition: position,\n renderWithPortal,\n keepPosition,\n hideOnOverscroll,\n minVisibleBlockSize,\n });\n\n // Recalculate position when properties change.\n useLayoutEffect(() => {\n updatePositionHandler();\n }, [updatePositionHandler, trackKey]);\n\n // Recalculate position when content size changes.\n useResizeObserver(contentRef, () => {\n updatePositionHandler(true);\n });\n\n // Recalculate position when the DOM changes.\n // istanbul ignore next - tested via integration tests\n usePositionObserver(getTrack.current, trackKey, () => {\n // Do not update position if popover moved offscreen\n const popoverOffset = popoverRef.current && getLogicalBoundingClientRect(popoverRef.current);\n if (!popoverOffset || popoverOffset.insetBlockStart < 0 || popoverOffset.insetBlockEnd > window.innerHeight) {\n return;\n }\n positionHandlerRef.current();\n });\n\n // Recalculate position on resize or scroll events.\n useLayoutEffect(() => {\n const controller = new AbortController();\n\n const updatePositionOnResize = () => requestAnimationFrame(() => updatePositionHandler(true));\n const refreshPosition = () => requestAnimationFrame(() => positionHandlerRef.current());\n\n window.addEventListener('resize', updatePositionOnResize, { signal: controller.signal });\n window.addEventListener('scroll', refreshPosition, { capture: true, signal: controller.signal });\n\n return () => {\n controller.abort();\n };\n }, [hideOnOverscroll, keepPosition, positionHandlerRef, trackRef, updatePositionHandler]);\n\n return isOverscrolling ? null : (\n <div\n ref={popoverRef}\n style={{ ...popoverStyle, zIndex }}\n className={clsx(styles.container, isRefresh && styles.refresh, className)}\n >\n <div\n ref={arrowRef}\n className={clsx(styles[`container-arrow`], styles[`container-arrow-position-${internalPosition}`])}\n aria-hidden={true}\n >\n {arrow(internalPosition)}\n </div>\n\n <div\n ref={bodyRef}\n className={clsx(styles['container-body'], styles[`container-body-size-${size}`], {\n [styles['fixed-width']]: fixedWidth,\n [styles[`container-body-variant-${variant}`]]: variant,\n })}\n >\n {hoverArea ? (\n <div className={styles['hover-area']}>\n <div ref={contentRef}>{children}</div>\n </div>\n ) : (\n <div ref={contentRef}>{children}</div>\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { InternalPosition, Offset, PopoverProps } from './interfaces';
3
- export default function usePopoverPosition({ popoverRef, bodyRef, arrowRef, getTrack, contentRef, allowScrollToFit, allowVerticalOverflow, preferredPosition, renderWithPortal, keepPosition, hideOnOverscroll, minVisibleBlockSize, }: {
3
+ export default function usePopoverPosition({ popoverRef, bodyRef, arrowRef, getTrack, triggerClampRef, contentRef, allowScrollToFit, allowVerticalOverflow, preferredPosition, renderWithPortal, keepPosition, hideOnOverscroll, minVisibleBlockSize, }: {
4
4
  popoverRef: React.RefObject<HTMLDivElement | null>;
5
5
  bodyRef: React.RefObject<HTMLDivElement | null>;
6
6
  arrowRef: React.RefObject<HTMLDivElement | null>;
7
7
  getTrack: () => null | HTMLElement | SVGElement;
8
8
  contentRef: React.RefObject<HTMLDivElement | null>;
9
+ triggerClampRef?: React.RefObject<HTMLElement>;
9
10
  allowScrollToFit?: boolean;
10
11
  allowVerticalOverflow?: boolean;
11
12
  preferredPosition: PopoverProps.Position;
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-position.d.ts","sourceRoot":"","sources":["../../../src/popover/use-popover-position.ts"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAW7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAQ,MAAM,cAAc,CAAC;AAGzF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,EAAE;IACD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjD,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;IAChD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;;;;qDAOyC,IAAI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