@cloudscape-design/components 3.0.1140 → 3.0.1142

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 (61) hide show
  1. package/alert/interfaces.d.ts +13 -0
  2. package/alert/interfaces.d.ts.map +1 -1
  3. package/alert/interfaces.js.map +1 -1
  4. package/alert/internal.d.ts.map +1 -1
  5. package/alert/internal.js +35 -3
  6. package/alert/internal.js.map +1 -1
  7. package/autosuggest/index.js +1 -1
  8. package/autosuggest/interfaces.d.ts +47 -0
  9. package/autosuggest/interfaces.d.ts.map +1 -1
  10. package/autosuggest/interfaces.js.map +1 -1
  11. package/autosuggest/internal.d.ts.map +1 -1
  12. package/autosuggest/internal.js +2 -2
  13. package/autosuggest/internal.js.map +1 -1
  14. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  15. package/flashbar/collapsible-flashbar.js +14 -13
  16. package/flashbar/collapsible-flashbar.js.map +1 -1
  17. package/flashbar/common.d.ts +3 -2
  18. package/flashbar/common.d.ts.map +1 -1
  19. package/flashbar/common.js +67 -1
  20. package/flashbar/common.js.map +1 -1
  21. package/flashbar/flash.d.ts.map +1 -1
  22. package/flashbar/flash.js +4 -4
  23. package/flashbar/flash.js.map +1 -1
  24. package/flashbar/interfaces.d.ts +8 -0
  25. package/flashbar/interfaces.d.ts.map +1 -1
  26. package/flashbar/interfaces.js.map +1 -1
  27. package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
  28. package/flashbar/non-collapsible-flashbar.js +7 -6
  29. package/flashbar/non-collapsible-flashbar.js.map +1 -1
  30. package/input/styles.css.js +13 -13
  31. package/input/styles.d.ts.map +1 -1
  32. package/input/styles.js +26 -36
  33. package/input/styles.js.map +1 -1
  34. package/input/styles.scoped.css +34 -34
  35. package/input/styles.selectors.js +13 -13
  36. package/internal/base-component/styles.scoped.css +1 -1
  37. package/internal/components/autosuggest-input/index.d.ts +2 -1
  38. package/internal/components/autosuggest-input/index.d.ts.map +1 -1
  39. package/internal/components/autosuggest-input/index.js +2 -2
  40. package/internal/components/autosuggest-input/index.js.map +1 -1
  41. package/internal/environment.js +2 -2
  42. package/internal/environment.json +2 -2
  43. package/internal/manifest.json +1 -1
  44. package/internal/persistence/index.d.ts +14 -0
  45. package/internal/persistence/index.d.ts.map +1 -0
  46. package/internal/persistence/index.js +42 -0
  47. package/internal/persistence/index.js.map +1 -0
  48. package/package.json +1 -1
  49. package/text-filter/index.js +10 -17
  50. package/text-filter/interfaces.d.ts +47 -0
  51. package/text-filter/interfaces.d.ts.map +1 -1
  52. package/text-filter/interfaces.js.map +1 -1
  53. package/text-filter/internal-do-not-use-core.js +25 -0
  54. package/text-filter/internal.d.ts.map +1 -1
  55. package/text-filter/internal.js +2 -2
  56. package/text-filter/internal.js.map +1 -1
  57. package/text-filter/styles.d.ts +2 -0
  58. package/text-filter/styles.d.ts.map +1 -0
  59. package/text-filter/styles.js +44 -0
  60. package/text-filter/styles.js.map +1 -0
  61. /package/text-filter/{index.js.map → internal-do-not-use-core.js.map} +0 -0
@@ -49,6 +49,10 @@ export declare namespace AlertProps {
49
49
  };
50
50
  };
51
51
  }
52
+ interface PersistenceConfig {
53
+ uniqueKey: string;
54
+ crossServicePersistence?: boolean;
55
+ }
52
56
  }
53
57
  export interface AlertProps extends BaseComponentProps {
54
58
  /**
@@ -124,4 +128,13 @@ export interface AlertProps extends BaseComponentProps {
124
128
  /**
125
129
  * @awsuiSystem core
126
130
  */
131
+
132
+ /**
133
+ * Config to persist dismiss state for dismissable Alert
134
+ * persistenceConfig contains:
135
+ * * `uniqueKey` (string) - This key to store the persistence state, it must be unique across your console.
136
+ * * `crossServicePersistence` (boolean) - (Optional) If true, the persistence state will be shared across AWS services.
137
+ * @awsuiSystem console
138
+ */
139
+ persistenceConfig?: AlertProps.PersistenceConfig;
127
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/alert/interfaces.ts"],"names":[],"mappings":"AAEA,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B,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;IACD,UAAiB,iBAAiB;QAChC,SAAS,EAAE,MAAM,CAAC;QAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;KACnC;CACF;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC;IACrC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC;IACjD;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC;IACzB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC;CAClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/alert/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace AlertProps {\n export type Type = 'success' | 'error' | 'warning' | 'info';\n\n export interface Ref {\n /**\n * Sets focus on the alert content.\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /*\n * Specifies the ARIA label for the alert icon for type `success`.\n * @property {string} [successIconAriaLabel] - optional\n */\n successIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `error`.\n * @property {string} [errorIconAriaLabel] - optional\n */\n errorIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `warning`.\n * @property {string} [warningIconAriaLabel] - optional\n */\n warningIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `info`.\n * @property {string} [infoIconAriaLabel] - optional\n */\n infoIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the dismiss button.\n * @property {string} [dismissAriaLabel] - optional\n */\n dismissAriaLabel?: string;\n }\n\n export interface AnalyticsMetadata {\n errorContext?: ErrorContext;\n }\n\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n color?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n icon?: {\n color?: string;\n };\n dismissButton?: {\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n\nexport interface AlertProps extends BaseComponentProps {\n /**\n * Specifies the type of message you want to display.\n */\n type?: AlertProps.Type;\n\n /**\n * Provides a text alternative for the icon.\n *\n * @deprecated Use the label properties inside `i18nStrings` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n statusIconAriaLabel?: string;\n\n /**\n * Determines whether the alert is displayed.\n * @deprecated Use conditional rendering in your code instead of this prop.\n */\n visible?: boolean;\n /**\n * Adds a close button to the alert when set to `true`.\n * An `onDismiss` event is fired when a user clicks the button.\n */\n dismissible?: boolean;\n /**\n * Adds an aria-label to the dismiss button.\n * @i18n\n *\n * @deprecated Use `i18nStrings.dismissAriaLabel` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n dismissAriaLabel?: string;\n /**\n * Primary text displayed in the element.\n */\n children?: React.ReactNode;\n /**\n * Heading text.\n */\n header?: React.ReactNode;\n /**\n * Displays an action button next to the message area when set.\n * An `onButtonClick` event is fired when the user clicks it.\n * @deprecated Replaced by `action`.\n */\n buttonText?: React.ReactNode;\n /**\n * Specifies an action for the alert message.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add a button.\n */\n action?: React.ReactNode;\n /**\n * Fired when the user clicks the close icon that is displayed\n * when the `dismissible` property is set to `true`.\n */\n onDismiss?: NonCancelableEventHandler;\n /**\n * Fired when the user clicks the action button.\n * **Deprecated** Replaced by `action`.\n */\n onButtonClick?: NonCancelableEventHandler;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @property {AlertProps.I18nStrings} [i18nStrings] - optional\n * @i18n\n */\n i18nStrings?: AlertProps.I18nStrings;\n /**\n * Specifies additional analytics-related metadata.\n * * `errorContext` - Identifies the error category and sub-category.\n * @analytics\n */\n analyticsMetadata?: AlertProps.AnalyticsMetadata;\n /**\n * @awsuiSystem core\n */\n style?: AlertProps.Style;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/alert/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace AlertProps {\n export type Type = 'success' | 'error' | 'warning' | 'info';\n\n export interface Ref {\n /**\n * Sets focus on the alert content.\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /*\n * Specifies the ARIA label for the alert icon for type `success`.\n * @property {string} [successIconAriaLabel] - optional\n */\n successIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `error`.\n * @property {string} [errorIconAriaLabel] - optional\n */\n errorIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `warning`.\n * @property {string} [warningIconAriaLabel] - optional\n */\n warningIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the alert icon for type `info`.\n * @property {string} [infoIconAriaLabel] - optional\n */\n infoIconAriaLabel?: string;\n /*\n * Specifies the ARIA label for the dismiss button.\n * @property {string} [dismissAriaLabel] - optional\n */\n dismissAriaLabel?: string;\n }\n\n export interface AnalyticsMetadata {\n errorContext?: ErrorContext;\n }\n\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n color?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n icon?: {\n color?: string;\n };\n dismissButton?: {\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n export interface PersistenceConfig {\n uniqueKey: string;\n crossServicePersistence?: boolean;\n }\n}\n\nexport interface AlertProps extends BaseComponentProps {\n /**\n * Specifies the type of message you want to display.\n */\n type?: AlertProps.Type;\n\n /**\n * Provides a text alternative for the icon.\n *\n * @deprecated Use the label properties inside `i18nStrings` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n statusIconAriaLabel?: string;\n\n /**\n * Determines whether the alert is displayed.\n * @deprecated Use conditional rendering in your code instead of this prop.\n */\n visible?: boolean;\n /**\n * Adds a close button to the alert when set to `true`.\n * An `onDismiss` event is fired when a user clicks the button.\n */\n dismissible?: boolean;\n /**\n * Adds an aria-label to the dismiss button.\n * @i18n\n *\n * @deprecated Use `i18nStrings.dismissAriaLabel` instead.\n * If the label is assigned via the `i18nStrings` property, this label will be ignored.\n */\n dismissAriaLabel?: string;\n /**\n * Primary text displayed in the element.\n */\n children?: React.ReactNode;\n /**\n * Heading text.\n */\n header?: React.ReactNode;\n /**\n * Displays an action button next to the message area when set.\n * An `onButtonClick` event is fired when the user clicks it.\n * @deprecated Replaced by `action`.\n */\n buttonText?: React.ReactNode;\n /**\n * Specifies an action for the alert message.\n * Although it is technically possible to insert any content, our UX guidelines only allow you to add a button.\n */\n action?: React.ReactNode;\n /**\n * Fired when the user clicks the close icon that is displayed\n * when the `dismissible` property is set to `true`.\n */\n onDismiss?: NonCancelableEventHandler;\n /**\n * Fired when the user clicks the action button.\n * **Deprecated** Replaced by `action`.\n */\n onButtonClick?: NonCancelableEventHandler;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @property {AlertProps.I18nStrings} [i18nStrings] - optional\n * @i18n\n */\n i18nStrings?: AlertProps.I18nStrings;\n /**\n * Specifies additional analytics-related metadata.\n * * `errorContext` - Identifies the error category and sub-category.\n * @analytics\n */\n analyticsMetadata?: AlertProps.AnalyticsMetadata;\n /**\n * @awsuiSystem core\n */\n style?: AlertProps.Style;\n /**\n * Config to persist dismiss state for dismissable Alert\n * persistenceConfig contains:\n * * `uniqueKey` (string) - This key to store the persistence state, it must be unique across your console.\n * * `crossServicePersistence` (boolean) - (Optional) If true, the persistence state will be shared across AWS services.\n * @awsuiSystem console\n */\n persistenceConfig?: AlertProps.PersistenceConfig;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsB1C,QAAA,MAAM,aAAa;;;oBAPC,MAAM;YACd,UAAU,CAAC,OAAO,CAAC;wCAwL9B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAehF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsB1C,QAAA,MAAM,aAAa;;;oBAPC,MAAM;YACd,UAAU,CAAC,OAAO,CAAC;wCA8N9B,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/alert/internal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import React, { useImperativeHandle, useRef } from 'react';
3
+ import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
@@ -13,6 +13,7 @@ import VisualContext from '../internal/components/visual-context';
13
13
  import { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';
14
14
  import { fireNonCancelableEvent } from '../internal/events';
15
15
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
16
+ import { persistAlertDismiss, retrieveAlertDismiss } from '../internal/persistence';
16
17
  import { awsuiPluginsInternal } from '../internal/plugins/api';
17
18
  import { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';
18
19
  import useContainerWidth from '../internal/utils/use-container-width';
@@ -28,7 +29,7 @@ const typeToIcon = {
28
29
  };
29
30
  const useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);
30
31
  const useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);
31
- const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId, style, ...rest }, ref) => {
32
+ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dismissible, children, header, buttonText, action, onDismiss, onButtonClick, __internalRootRef, statusIconAriaLabel: deprecatedStatusIconAriaLabel, dismissAriaLabel: deprecatedDismissAriaLabel, messageSlotId, style, persistenceConfig, ...rest }, ref) => {
32
33
  var _a, _b;
33
34
  const baseProps = getBaseProps(rest);
34
35
  const i18n = useInternalI18n('alert');
@@ -52,6 +53,7 @@ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dis
52
53
  const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);
53
54
  const headerRef = useMergeRefs(headerRefAction, headerRefContent);
54
55
  const contentRef = useMergeRefs(contentRefAction, contentRefContent);
56
+ const [isPersistentlyDismissed, setIsPersistentlyDismissed] = useState(!!(persistenceConfig && persistenceConfig.uniqueKey));
55
57
  const isRefresh = useVisualRefresh();
56
58
  const size = isRefresh
57
59
  ? 'normal'
@@ -64,6 +66,36 @@ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dis
64
66
  };
65
67
  const statusIconAriaLabel = i18n(`i18nStrings.${type}IconAriaLabel`, (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings[`${type}IconAriaLabel`]) !== null && _a !== void 0 ? _a : deprecatedStatusIconAriaLabel);
66
68
  const dismissAriaLabel = i18n('i18nStrings.dismissAriaLabel', (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dismissAriaLabel) !== null && _b !== void 0 ? _b : i18n('dismissAriaLabel', deprecatedDismissAriaLabel));
69
+ useEffect(() => {
70
+ let isMounted = true;
71
+ if (persistenceConfig === null || persistenceConfig === void 0 ? void 0 : persistenceConfig.uniqueKey) {
72
+ retrieveAlertDismiss(persistenceConfig)
73
+ .then(dismissed => {
74
+ if (isMounted) {
75
+ setIsPersistentlyDismissed(!!dismissed);
76
+ }
77
+ })
78
+ .catch(() => {
79
+ if (isMounted) {
80
+ setIsPersistentlyDismissed(false);
81
+ }
82
+ });
83
+ }
84
+ return () => {
85
+ isMounted = false;
86
+ };
87
+ // Only track specific properties to avoid re-running when persistenceConfig object reference changes
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
+ }, [persistenceConfig === null || persistenceConfig === void 0 ? void 0 : persistenceConfig.uniqueKey, persistenceConfig === null || persistenceConfig === void 0 ? void 0 : persistenceConfig.crossServicePersistence]);
90
+ const dismiss = () => {
91
+ fireNonCancelableEvent(onDismiss);
92
+ if (persistenceConfig === null || persistenceConfig === void 0 ? void 0 : persistenceConfig.uniqueKey) {
93
+ persistAlertDismiss(persistenceConfig);
94
+ }
95
+ };
96
+ if (isPersistentlyDismissed) {
97
+ return null;
98
+ }
67
99
  return (React.createElement("div", { ...baseProps, ...analyticsAttributes, "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden }, baseProps.className), ref: containerRef },
68
100
  React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
69
101
  React.createElement(VisualContext, { contextName: "alert" },
@@ -84,7 +116,7 @@ const InternalAlert = React.forwardRef(({ type, i18nStrings, visible = true, dis
84
116
  dismissible && (React.createElement("div", { className: styles.dismiss, ...getAnalyticsMetadataAttribute({
85
117
  action: 'dismiss',
86
118
  }) },
87
- React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: () => fireNonCancelableEvent(onDismiss), style: getDismissButtonStyles(style) }))))))));
119
+ React.createElement(InternalButton, { className: styles['dismiss-button'], variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissAriaLabel, onClick: dismiss, style: getDismissButtonStyles(style) }))))))));
88
120
  });
89
121
  export default Intern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W,IAAI,CACd,6BACE,SAAS,EAAE,MAAM,CAAC,OAAO,KACrB,6BAA6B,CAAC;4BAChC,MAAM,EAAE,SAAS;yBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAChD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GACpC,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\nimport { getAlertStyles, getDismissButtonStyles, getIconStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps & {\n messageSlotId?: string;\n style?: AlertProps['style'];\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n style,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => ({\n focus: () => {\n if (focusRef.current) {\n focusRef.current.tabIndex = -1;\n focusRef.current.focus();\n }\n },\n }));\n const handleBlur = () => {\n if (focusRef.current) {\n focusRef.current.removeAttribute('tabindex');\n }\n };\n\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n style={getAlertStyles(style)}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} ref={focusRef} role=\"group\" onBlur={handleBlur}>\n <div className={clsx(styles.icon, styles.text)} style={getIconStyles(style)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n style={getDismissButtonStyles(style)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/alert/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OA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,oBAAoB,GACpB;gCACP,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,sBAAsB,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,EACvF,GAAG,EAAE,UAAU,IAEd,QAAQ,CACL;gCACN,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,qBAAqB,CAAC,EAC7B,sBAAsB,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CACvD,EACD,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;wBACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,eAAe,EAAE;gCACf,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC;gCACjC,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC;6BACtC,EACD,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAC1D,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;oBACL,WAAW,IAAI,CACd,6BACE,SAAS,EAAE,MAAM,CAAC,OAAO,KACrB,6BAA6B,CAAC;4BAChC,MAAM,EAAE,SAAS;yBACiC,CAAC;wBAErD,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GACpC,CACE,CACP,CACG,CACQ,CACmB,CACjC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { persistAlertDismiss, retrieveAlertDismiss } from '../internal/persistence';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { SomeRequired } from '../internal/types';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { ActionsWrapper } from './actions-wrapper';\nimport { GeneratedAnalyticsMetadataAlertDismiss } from './analytics-metadata/interfaces';\nimport { AlertProps } from './interfaces';\nimport { getAlertStyles, getDismissButtonStyles, getIconStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> &\n InternalBaseComponentProps & {\n messageSlotId?: string;\n style?: AlertProps['style'];\n };\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent);\n\nconst InternalAlert = React.forwardRef(\n (\n {\n type,\n i18nStrings,\n visible = true,\n dismissible,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef,\n statusIconAriaLabel: deprecatedStatusIconAriaLabel,\n dismissAriaLabel: deprecatedDismissAriaLabel,\n messageSlotId,\n style,\n persistenceConfig,\n ...rest\n }: InternalAlertProps,\n ref: React.Ref<AlertProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const focusRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => ({\n focus: () => {\n if (focusRef.current) {\n focusRef.current.tabIndex = -1;\n focusRef.current.focus();\n }\n },\n }));\n const handleBlur = () => {\n if (focusRef.current) {\n focusRef.current.removeAttribute('tabindex');\n }\n };\n\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children });\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n const containerRef = useMergeRefs(containerMeasureRef, __internalRootRef);\n const headerRef = useMergeRefs(headerRefAction, headerRefContent);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent);\n const [isPersistentlyDismissed, setIsPersistentlyDismissed] = useState(\n !!(persistenceConfig && persistenceConfig.uniqueKey)\n );\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh\n ? 'normal'\n : headerReplacementType !== 'remove' && header && contentReplacementType !== 'remove' && children\n ? 'big'\n : 'normal';\n\n const hasAction = Boolean(action || buttonText || discoveredActions.length);\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n const statusIconAriaLabel = i18n(\n `i18nStrings.${type}IconAriaLabel`,\n i18nStrings?.[`${type}IconAriaLabel`] ?? deprecatedStatusIconAriaLabel\n );\n\n const dismissAriaLabel = i18n(\n 'i18nStrings.dismissAriaLabel',\n i18nStrings?.dismissAriaLabel ?? i18n('dismissAriaLabel', deprecatedDismissAriaLabel)\n );\n\n useEffect(() => {\n let isMounted = true;\n if (persistenceConfig?.uniqueKey) {\n retrieveAlertDismiss(persistenceConfig)\n .then(dismissed => {\n if (isMounted) {\n setIsPersistentlyDismissed(!!dismissed);\n }\n })\n .catch(() => {\n if (isMounted) {\n setIsPersistentlyDismissed(false);\n }\n });\n }\n return () => {\n isMounted = false;\n };\n\n // Only track specific properties to avoid re-running when persistenceConfig object reference changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [persistenceConfig?.uniqueKey, persistenceConfig?.crossServicePersistence]);\n\n const dismiss = () => {\n fireNonCancelableEvent(onDismiss);\n if (persistenceConfig?.uniqueKey) {\n persistAlertDismiss(persistenceConfig);\n }\n };\n\n if (isPersistentlyDismissed) {\n return null;\n }\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible, [styles['initial-hidden']]: initialHidden },\n baseProps.className\n )}\n ref={containerRef}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <VisualContext contextName=\"alert\">\n <div\n className={clsx(\n styles.alert,\n styles[`type-${type}`],\n styles[`icon-size-${size}`],\n hasAction && styles['with-action'],\n dismissible && styles['with-dismiss']\n )}\n style={getAlertStyles(style)}\n >\n <div className={styles['alert-wrapper']}>\n <div className={styles['alert-focus-wrapper']} ref={focusRef} role=\"group\" onBlur={handleBlur}>\n <div className={clsx(styles.icon, styles.text)} style={getIconStyles(style)}>\n <InternalIcon name={typeToIcon[type]} size={size} ariaLabel={statusIconAriaLabel} />\n </div>\n <div className={clsx(styles.message, styles.text)} id={messageSlotId}>\n <div\n className={clsx(\n header && styles.header,\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors.header\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(\n styles['header-replacement'],\n headerReplacementType !== 'replaced' ? styles.hidden : analyticsSelectors.header\n )}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(styles.content, contentReplacementType !== 'original' && styles.hidden)}\n ref={contentRef}\n >\n {children}\n </div>\n <div\n className={clsx(\n styles['content-replacement'],\n contentReplacementType !== 'replaced' && styles.hidden\n )}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles.action}\n testUtilClasses={{\n actionSlot: styles['action-slot'],\n actionButton: styles['action-button'],\n }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={() => fireNonCancelableEvent(onButtonClick)}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible && (\n <div\n className={styles.dismiss}\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataAlertDismiss>)}\n >\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissAriaLabel}\n onClick={dismiss}\n style={getDismissButtonStyles(style)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </LinkDefaultVariantContext.Provider>\n </div>\n );\n }\n);\n\nexport default InternalAlert;\n"]}
@@ -9,7 +9,7 @@ import { validateProps } from '@cloudscape-design/component-toolkit/internal';
9
9
 
10
10
 
11
11
  const Autosuggest = React.forwardRef((props, ref) => {
12
- validateProps('Autosuggest', props, ["nativeInputAttributes"], {}, 'console');
12
+ validateProps('Autosuggest', props, ["nativeInputAttributes","style"], {}, 'console');
13
13
  return React.createElement(CoreComponent, {ref,...props});
14
14
  });
15
15
 
@@ -103,6 +103,9 @@ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, In
103
103
  * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).
104
104
  */
105
105
  renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;
106
+ /**
107
+ * @awsuiSystem core
108
+ */
106
109
  }
107
110
  export declare namespace AutosuggestProps {
108
111
  type ChangeDetail = InputProps.ChangeDetail;
@@ -134,6 +137,50 @@ export declare namespace AutosuggestProps {
134
137
  */
135
138
  select(): void;
136
139
  }
140
+ interface Style {
141
+ root?: {
142
+ backgroundColor?: {
143
+ default?: string;
144
+ disabled?: string;
145
+ focus?: string;
146
+ hover?: string;
147
+ readonly?: string;
148
+ };
149
+ borderColor?: {
150
+ default?: string;
151
+ disabled?: string;
152
+ focus?: string;
153
+ hover?: string;
154
+ readonly?: string;
155
+ };
156
+ borderRadius?: string;
157
+ borderWidth?: string;
158
+ boxShadow?: {
159
+ default?: string;
160
+ disabled?: string;
161
+ focus?: string;
162
+ hover?: string;
163
+ readonly?: string;
164
+ };
165
+ color?: {
166
+ default?: string;
167
+ disabled?: string;
168
+ focus?: string;
169
+ hover?: string;
170
+ readonly?: string;
171
+ };
172
+ fontSize?: string;
173
+ fontWeight?: string;
174
+ paddingBlock?: string;
175
+ paddingInline?: string;
176
+ };
177
+ placeholder?: {
178
+ color?: string;
179
+ fontSize?: string;
180
+ fontStyle?: string;
181
+ fontWeight?: string;
182
+ };
183
+ }
137
184
  }
138
185
  export type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {
139
186
  type?: 'parent' | 'child' | 'use-entered';
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;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AM,CAAC;YACrB,SAAS,CAAC,EAAE;gBACV,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;YACF,KAAK,CAAC,EAAE;gBACN,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,CAAC,EAAE,MAAM,CAAC;aACnB,CAAC;YACF,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH;CACF;AAGD,MAAM,MAAM,eAAe,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Defines whether entered text option is shown as the first option in the dropdown when value is non-empty.\n */\n hideEnteredTextOption?: boolean;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n *\n * Note that the `matchesCount` includes the `enteredTextLabel` (\"Use ${value}\") item, so in most cases you\n * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n selectedOption?: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseInputProps, InputAutoCorrect, InputClearLabel, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n InputClearLabel,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n * @i18n\n */\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Defines whether entered text option is shown as the first option in the dropdown when value is non-empty.\n */\n hideEnteredTextOption?: boolean;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n *\n * Note that the `matchesCount` includes the `enteredTextLabel` (\"Use ${value}\") item, so in most cases you\n * should subtract 1 from `matchesCount`. If using manual filtering, you should provide your own value for `totalCount`.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n\n /**\n * @awsuiSystem core\n */\n style?: AutosuggestProps.Style;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n selectedOption?: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n\n export interface Style {\n root?: {\n backgroundColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n color?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n fontSize?: string;\n fontWeight?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n placeholder?: {\n color?: string;\n fontSize?: string;\n fontStyle?: string;\n fontWeight?: string;\n };\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAmBhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOjE,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAuOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAmBhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOjE,UAAU,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAE1F,QAAA,MAAM,mBAAmB,uGAyOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -17,7 +17,7 @@ import AutosuggestOptionsList from './options-list';
17
17
  import styles from './styles.css.js';
18
18
  const InternalAutosuggest = React.forwardRef((props, ref) => {
19
19
  var _a, _b;
20
- const { value, onChange, onBlur, onFocus, onKeyUp, onLoadItems, options, filteringType = 'auto', statusType = 'finished', placeholder, clearAriaLabel, name, disabled, disableBrowserAutocorrect = false, autoFocus, readOnly, ariaLabel, ariaRequired, enteredTextLabel, hideEnteredTextOption, filteringResultsText, onKeyDown, virtualScroll, expandToViewport, onSelect, renderHighlightedAriaLive, __internalRootRef, ...restProps } = props;
20
+ const { value, onChange, onBlur, onFocus, onKeyUp, onLoadItems, options, filteringType = 'auto', statusType = 'finished', placeholder, clearAriaLabel, name, disabled, disableBrowserAutocorrect = false, autoFocus, readOnly, ariaLabel, ariaRequired, enteredTextLabel, hideEnteredTextOption, filteringResultsText, onKeyDown, virtualScroll, expandToViewport, onSelect, renderHighlightedAriaLive, style, __internalRootRef, ...restProps } = props;
21
21
  checkControlled('Autosuggest', 'value', value, 'onChange', onChange);
22
22
  checkOptionValueField('Autosuggest', 'options', options);
23
23
  const autosuggestInputRef = useRef(null);
@@ -126,7 +126,7 @@ const InternalAutosuggest = React.forwardRef((props, ref) => {
126
126
  hasRecoveryCallback: !!onLoadItems,
127
127
  });
128
128
  const shouldRenderDropdownContent = autosuggestItemsState.items.length !== 0 || !!dropdownStatus.content || (!hideEnteredTextOption && !!value);
129
- return (React.createElement(AutosuggestInput, { ...restProps, className: clsx(styles.root, restProps.className), ref: autosuggestInputRef, __internalRootRef: __internalRootRef, value: value, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, name: name, controlId: controlId, placeholder: placeholder, disabled: disabled, readOnly: readOnly, autoFocus: autoFocus, ariaLabel: ariaLabel, ariaRequired: ariaRequired, clearAriaLabel: clearAriaLabel, disableBrowserAutocorrect: disableBrowserAutocorrect, expandToViewport: expandToViewport, ariaControls: listId, ariaActivedescendant: highlightedOptionId, dropdownExpanded: shouldRenderDropdownContent, dropdownContent: shouldRenderDropdownContent && (React.createElement(AutosuggestOptionsList, { statusType: statusType, autosuggestItemsState: autosuggestItemsState, autosuggestItemsHandlers: autosuggestItemsHandlers, highlightedOptionId: highlightedOptionId, highlightText: value, listId: listId, controlId: controlId, handleLoadMore: autosuggestLoadMoreHandlers.fireLoadMoreOnScroll, hasDropdownStatus: dropdownStatus.content !== null, virtualScroll: virtualScroll, selectedAriaLabel: selectedAriaLabel, renderHighlightedAriaLive: renderHighlightedAriaLive, listBottom: !dropdownStatus.isSticky ? React.createElement(DropdownFooter, { content: dropdownStatus.content, id: footerControlId }) : null, ariaDescribedby: dropdownStatus.content ? footerControlId : undefined })), dropdownFooter: dropdownStatus.isSticky && dropdownStatus.content ? (React.createElement(DropdownFooter, { id: footerControlId, content: dropdownStatus.content, hasItems: autosuggestItemsState.items.length >= 1 })) : null, loopFocus: dropdownStatus.hasRecoveryButton, onCloseDropdown: handleCloseDropdown, onDelayedInput: handleDelayedInput, onPressArrowDown: handlePressArrowDown, onPressArrowUp: handlePressArrowUp, onPressEnter: handlePressEnter }));
129
+ return (React.createElement(AutosuggestInput, { ...restProps, className: clsx(styles.root, restProps.className), ref: autosuggestInputRef, __internalRootRef: __internalRootRef, value: value, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, name: name, controlId: controlId, placeholder: placeholder, disabled: disabled, readOnly: readOnly, autoFocus: autoFocus, ariaLabel: ariaLabel, ariaRequired: ariaRequired, clearAriaLabel: clearAriaLabel, disableBrowserAutocorrect: disableBrowserAutocorrect, expandToViewport: expandToViewport, ariaControls: listId, ariaActivedescendant: highlightedOptionId, dropdownExpanded: shouldRenderDropdownContent, style: style, dropdownContent: shouldRenderDropdownContent && (React.createElement(AutosuggestOptionsList, { statusType: statusType, autosuggestItemsState: autosuggestItemsState, autosuggestItemsHandlers: autosuggestItemsHandlers, highlightedOptionId: highlightedOptionId, highlightText: value, listId: listId, controlId: controlId, handleLoadMore: autosuggestLoadMoreHandlers.fireLoadMoreOnScroll, hasDropdownStatus: dropdownStatus.content !== null, virtualScroll: virtualScroll, selectedAriaLabel: selectedAriaLabel, renderHighlightedAriaLive: renderHighlightedAriaLive, listBottom: !dropdownStatus.isSticky ? React.createElement(DropdownFooter, { content: dropdownStatus.content, id: footerControlId }) : null, ariaDescribedby: dropdownStatus.content ? footerControlId : undefined })), dropdownFooter: dropdownStatus.isSticky && dropdownStatus.content ? (React.createElement(DropdownFooter, { id: footerControlId, content: dropdownStatus.content, hasItems: autosuggestItemsState.items.length >= 1 })) : null, loopFocus: dropdownStatus.hasRecoveryButton, onCloseDropdown: handleCloseDropdown, onDelayedInput: handleDelayedInput, onPressArrowDown: handlePressArrowDown, onPressArrowUp: handlePressArrowUp, onPressEnter: handlePressEnter }));
130
130
  });
131
131
  export default InternalAutosuggest;
132
132
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,gBAAyC,MAAM,0CAA0C,CAAC;AAEjG,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,sBAAsB,MAAM,gBAAgB,CAAC;AAEpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA+B,EAAE,GAA8B,EAAE,EAAE;;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tB,qBAAqB,EAAE,qBAAqB,EAC5C,wBAAwB,EAAE,wBAAwB,EAClD,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,KAAK,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,2BAA2B,CAAC,oBAAoB,EAChE,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EACR,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,GAAI,CAAC,CAAC,CAAC,IAAI,EAE5G,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,GACrE,CACH,EAEH,cAAc,EACZ,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAClD,oBAAC,cAAc,IACb,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GACjD,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,cAAc,CAAC,iBAAiB,EAC3C,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { useAutosuggestItems } from './options-controller';\nimport AutosuggestOptionsList from './options-list';\n\nimport styles from './styles.css.js';\n\ninterface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n hideEnteredTextOption,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: hideEnteredTextOption,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0 && !(filteringType === 'auto' && autosuggestItemsState.showAll);\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent =\n autosuggestItemsState.items.length !== 0 || !!dropdownStatus.content || (!hideEnteredTextOption && !!value);\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={shouldRenderDropdownContent}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={dropdownStatus.hasRecoveryButton}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings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,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EACR,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,GAAI,CAAC,CAAC,CAAC,IAAI,EAE5G,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,GACrE,CACH,EAEH,cAAc,EACZ,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAClD,oBAAC,cAAc,IACb,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GACjD,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,cAAc,CAAC,iBAAiB,EAC3C,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { useAutosuggestItems } from './options-controller';\nimport AutosuggestOptionsList from './options-list';\n\nimport styles from './styles.css.js';\n\ninterface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n hideEnteredTextOption,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n style,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: hideEnteredTextOption,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0 && !(filteringType === 'auto' && autosuggestItemsState.showAll);\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent =\n autosuggestItemsState.items.length !== 0 || !!dropdownStatus.content || (!hideEnteredTextOption && !!value);\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={shouldRenderDropdownContent}\n style={style}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={dropdownStatus.hasRecoveryButton}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-flashbar.d.ts","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAmBpE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,qBAAqB,eAqVhG"}
1
+ {"version":3,"file":"collapsible-flashbar.d.ts","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAmBpE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,qBAAqB,eAwVhG"}
@@ -17,7 +17,7 @@ import { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';
17
17
  import { scrollElementIntoView } from '../internal/utils/scrollable-containers';
18
18
  import { throttle } from '../internal/utils/throttle';
19
19
  import { getComponentsAnalyticsMetadata, getItemAnalyticsMetadata } from './analytics-metadata/utils';
20
- import { useFlashbar } from './common';
20
+ import { useFlashbar, useFlashbarVisibility } from './common';
21
21
  import { Flash, focusFlashById } from './flash';
22
22
  import { getCollapsibleFlashStyles, getNotificationBarStyles } from './style';
23
23
  import { counterTypes, FOCUS_DEBOUNCE_DELAY, getFlashTypeCount, getItemColor, getVisibleCollapsedItems, } from './utils';
@@ -27,6 +27,7 @@ import styles from './styles.css.js';
27
27
  const maxNonCollapsibleItems = 1;
28
28
  const resizeListenerThrottleDelay = 100;
29
29
  export default function CollapsibleFlashbar({ items, style, ...restProps }) {
30
+ const visibleItems = useFlashbarVisibility(items);
30
31
  const [enteringItems, setEnteringItems] = useState([]);
31
32
  const [exitingItems, setExitingItems] = useState([]);
32
33
  const [isFlashbarStackExpanded, setIsFlashbarStackExpanded] = useState(false);
@@ -47,7 +48,7 @@ export default function CollapsibleFlashbar({ items, style, ...restProps }) {
47
48
  const flashbarElementId = useUniqueId('flashbar');
48
49
  const itemCountElementId = useUniqueId('item-count');
49
50
  const { baseProps, isReducedMotion, isVisualRefresh, mergedRef, ref, flashRefs, handleFlashDismissed } = useFlashbar({
50
- items,
51
+ items: visibleItems,
51
52
  ...restProps,
52
53
  onItemsAdded: newItems => {
53
54
  setEnteringItems([...enteringItems, ...newItems]);
@@ -64,7 +65,7 @@ export default function CollapsibleFlashbar({ items, style, ...restProps }) {
64
65
  setExitingItems([...exitingItems, ...removedItems]);
65
66
  },
66
67
  });
67
- if (items.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {
68
+ if (visibleItems.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {
68
69
  setIsFlashbarStackExpanded(false);
69
70
  }
70
71
  const animateFlash = !isReducedMotion;
@@ -76,8 +77,8 @@ export default function CollapsibleFlashbar({ items, style, ...restProps }) {
76
77
  }
77
78
  const debouncedFocus = useDebounceCallback(focusFlashById, FOCUS_DEBOUNCE_DELAY);
78
79
  useLayoutEffect(() => {
79
- if (isFlashbarStackExpanded && (items === null || items === void 0 ? void 0 : items.length)) {
80
- const mostRecentItem = items[0];
80
+ if (isFlashbarStackExpanded && (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length)) {
81
+ const mostRecentItem = visibleItems[0];
81
82
  if (mostRecentItem.id !== undefined) {
82
83
  debouncedFocus(ref.current, mostRecentItem.id);
83
84
  }
@@ -146,14 +147,14 @@ export default function CollapsibleFlashbar({ items, style, ...restProps }) {
146
147
  setInitialAnimationState(null);
147
148
  }
148
149
  }, [updateBottomSpacing, getElementsToAnimate, initialAnimationState, isFlashbarStackExpanded]);
149
- const isCollapsible = items.length > maxNonCollapsibleItems;
150
- const countByType = getFlashTypeCount(items);
151
- const numberOfColorsInStack = new Set(items.map(getItemColor)).size;
150
+ const isCollapsible = visibleItems.length > maxNonCollapsibleItems;
151
+ const countByType = getFlashTypeCount(visibleItems);
152
+ const numberOfColorsInStack = new Set(visibleItems.map(getItemColor)).size;
152
153
  const maxSlots = Math.max(numberOfColorsInStack, 3);
153
- const stackDepth = Math.min(maxSlots, items.length);
154
+ const stackDepth = Math.min(maxSlots, visibleItems.length);
154
155
  const itemsToShow = isFlashbarStackExpanded
155
- ? items.map((item, index) => ({ ...item, expandedIndex: index }))
156
- : getVisibleCollapsedItems(items, stackDepth).map((item, index) => ({
156
+ ? visibleItems.map((item, index) => ({ ...item, expandedIndex: index }))
157
+ : getVisibleCollapsedItems(visibleItems, stackDepth).map((item, index) => ({
157
158
  ...item,
158
159
  collapsedIndex: index,
159
160
  }));
@@ -211,9 +212,9 @@ export default function CollapsibleFlashbar({ items, style, ...restProps }) {
211
212
  }
212
213
  }, transitionState: shouldUseStandardAnimation(item, index) ? state : undefined, i18nStrings: iconAriaLabels, style: style, onDismissed: handleFlashDismissed, ...item }))));
213
214
  }))))));
214
- return (React.createElement("div", { ...baseProps, className: clsx(baseProps.className, styles.flashbar, styles.stack, isCollapsible && styles.collapsible, items.length === 2 && styles['short-list'], isFlashbarStackExpanded && styles.expanded, isVisualRefresh && styles['visual-refresh']), ref: mergedRef, ...getAnalyticsMetadataAttribute(getComponentsAnalyticsMetadata(items.length, true, isFlashbarStackExpanded)) },
215
+ return (React.createElement("div", { ...baseProps, className: clsx(baseProps.className, styles.flashbar, styles.stack, isCollapsible && styles.collapsible, visibleItems.length === 2 && styles['short-list'], isFlashbarStackExpanded && styles.expanded, isVisualRefresh && styles['visual-refresh']), ref: mergedRef, ...getAnalyticsMetadataAttribute(getComponentsAnalyticsMetadata(visibleItems.length, true, isFlashbarStackExpanded)) },
215
216
  isFlashbarStackExpanded && renderList(),
216
- isCollapsible && (React.createElement("div", { className: clsx(styles['notification-bar'], isVisualRefresh && styles['visual-refresh'], isFlashbarStackExpanded ? styles.expanded : styles.collapsed, transitioning && styles['animation-running'], items.length === 2 && styles['short-list'], getVisualContextClassname('flashbar') // Visual context is needed for focus ring to be white
217
+ isCollapsible && (React.createElement("div", { className: clsx(styles['notification-bar'], isVisualRefresh && styles['visual-refresh'], isFlashbarStackExpanded ? styles.expanded : styles.collapsed, transitioning && styles['animation-running'], visibleItems.length === 2 && styles['short-list'], getVisualContextClassname('flashbar') // Visual context is needed for focus ring to be white
217
218
  ), onClick: toggleCollapseExpand, ref: notificationBarRef, style: getNotificationBarStyles(style), ...getAnalyticsMetadataAttribute({
218
219
  action: !isFlashbarStackExpanded ? 'expand' : 'collapse',
219
220
  detail: {