@cloudscape-design/components 3.0.999 → 3.0.1001

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 (51) hide show
  1. package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
  2. package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +35 -36
  3. package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
  4. package/app-layout/visual-refresh-toolbar/toolbar/index.js +1 -1
  5. package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  6. package/button/styles.css.js +22 -22
  7. package/button/styles.scoped.css +74 -74
  8. package/button/styles.selectors.js +22 -22
  9. package/flashbar/collapsible-flashbar.d.ts +10 -1
  10. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  11. package/flashbar/collapsible-flashbar.js +54 -8
  12. package/flashbar/collapsible-flashbar.js.map +1 -1
  13. package/flashbar/flash.d.ts +1 -0
  14. package/flashbar/flash.d.ts.map +1 -1
  15. package/flashbar/flash.js +28 -5
  16. package/flashbar/flash.js.map +1 -1
  17. package/flashbar/index.js +13 -11
  18. package/flashbar/interfaces.d.ts +70 -0
  19. package/flashbar/interfaces.d.ts.map +1 -1
  20. package/flashbar/interfaces.js.map +1 -1
  21. package/flashbar/internal-do-not-use-core.js +16 -0
  22. package/flashbar/non-collapsible-flashbar.d.ts +1 -0
  23. package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
  24. package/flashbar/non-collapsible-flashbar.js +2 -2
  25. package/flashbar/non-collapsible-flashbar.js.map +1 -1
  26. package/flashbar/styles.css.js +50 -50
  27. package/flashbar/styles.scoped.css +162 -158
  28. package/flashbar/styles.selectors.js +50 -50
  29. package/internal/base-component/styles.scoped.css +3 -0
  30. package/internal/environment.d.ts +1 -0
  31. package/internal/environment.js +2 -1
  32. package/internal/environment.json +2 -1
  33. package/internal/hooks/use-base-component/index.d.ts.map +1 -1
  34. package/internal/hooks/use-base-component/index.js +2 -0
  35. package/internal/hooks/use-base-component/index.js.map +1 -1
  36. package/internal/hooks/use-base-component/styles-check.d.ts +3 -0
  37. package/internal/hooks/use-base-component/styles-check.d.ts.map +1 -0
  38. package/internal/hooks/use-base-component/styles-check.js +46 -0
  39. package/internal/hooks/use-base-component/styles-check.js.map +1 -0
  40. package/internal/manifest.json +1 -1
  41. package/internal/metrics.d.ts.map +1 -1
  42. package/internal/metrics.js +2 -2
  43. package/internal/metrics.js.map +1 -1
  44. package/package.json +1 -1
  45. package/prompt-input/internal.d.ts.map +1 -1
  46. package/prompt-input/internal.js +3 -3
  47. package/prompt-input/internal.js.map +1 -1
  48. package/segmented-control/interfaces.d.ts +2 -1
  49. package/segmented-control/interfaces.d.ts.map +1 -1
  50. package/segmented-control/interfaces.js.map +1 -1
  51. /package/flashbar/{index.js.map → internal-do-not-use-core.js.map} +0 -0
@@ -2,55 +2,55 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "flash-with-motion": "awsui_flash-with-motion_1q84n_1e6ez_157",
6
- "enter": "awsui_enter_1q84n_1e6ez_157",
7
- "flash-body": "awsui_flash-body_1q84n_1e6ez_171",
8
- "flash-message": "awsui_flash-message_1q84n_1e6ez_171",
9
- "flash-header": "awsui_flash-header_1q84n_1e6ez_171",
10
- "flash-content": "awsui_flash-content_1q84n_1e6ez_172",
11
- "action-button-wrapper": "awsui_action-button-wrapper_1q84n_1e6ez_173",
12
- "dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_1e6ez_174",
13
- "flash-icon": "awsui_flash-icon_1q84n_1e6ez_197",
14
- "entering": "awsui_entering_1q84n_1e6ez_210",
15
- "entered": "awsui_entered_1q84n_1e6ez_231",
16
- "exiting": "awsui_exiting_1q84n_1e6ez_336",
17
- "stack": "awsui_stack_1q84n_1e6ez_370",
18
- "animation-running": "awsui_animation-running_1q84n_1e6ez_370",
19
- "item": "awsui_item_1q84n_1e6ez_370",
20
- "flash-list-item": "awsui_flash-list-item_1q84n_1e6ez_371",
21
- "notification-bar": "awsui_notification-bar_1q84n_1e6ez_372",
22
- "collapsed": "awsui_collapsed_1q84n_1e6ez_392",
23
- "animation-ready": "awsui_animation-ready_1q84n_1e6ez_392",
24
- "expanded-only": "awsui_expanded-only_1q84n_1e6ez_392",
25
- "expanded": "awsui_expanded_1q84n_1e6ez_392",
26
- "flash": "awsui_flash_1q84n_1e6ez_157",
27
- "collapsible": "awsui_collapsible_1q84n_1e6ez_448",
28
- "short-list": "awsui_short-list_1q84n_1e6ez_454",
29
- "visual-refresh": "awsui_visual-refresh_1q84n_1e6ez_454",
30
- "status": "awsui_status_1q84n_1e6ez_601",
31
- "header": "awsui_header_1q84n_1e6ez_601",
32
- "item-count": "awsui_item-count_1q84n_1e6ez_602",
33
- "button": "awsui_button_1q84n_1e6ez_603",
34
- "type-count": "awsui_type-count_1q84n_1e6ez_636",
35
- "count-number": "awsui_count-number_1q84n_1e6ez_636",
36
- "icon": "awsui_icon_1q84n_1e6ez_670",
37
- "floating": "awsui_floating_1q84n_1e6ez_711",
38
- "flashbar": "awsui_flashbar_1q84n_1e6ez_715",
39
- "initial-hidden": "awsui_initial-hidden_1q84n_1e6ez_773",
40
- "flash-list": "awsui_flash-list_1q84n_1e6ez_371",
41
- "flash-focus-container": "awsui_flash-focus-container_1q84n_1e6ez_797",
42
- "flash-text": "awsui_flash-text_1q84n_1e6ez_827",
43
- "hidden": "awsui_hidden_1q84n_1e6ez_846",
44
- "header-replacement": "awsui_header-replacement_1q84n_1e6ez_851",
45
- "content-replacement": "awsui_content-replacement_1q84n_1e6ez_856",
46
- "dismiss-button": "awsui_dismiss-button_1q84n_1e6ez_174",
47
- "action-wrapped": "awsui_action-wrapped_1q84n_1e6ez_874",
48
- "action-button": "awsui_action-button_1q84n_1e6ez_173",
49
- "action-slot": "awsui_action-slot_1q84n_1e6ez_881",
50
- "flash-type-success": "awsui_flash-type-success_1q84n_1e6ez_885",
51
- "flash-type-error": "awsui_flash-type-error_1q84n_1e6ez_889",
52
- "flash-type-info": "awsui_flash-type-info_1q84n_1e6ez_893",
53
- "flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_1e6ez_894",
54
- "flash-type-warning": "awsui_flash-type-warning_1q84n_1e6ez_898"
5
+ "flash-with-motion": "awsui_flash-with-motion_1q84n_12e9t_157",
6
+ "enter": "awsui_enter_1q84n_12e9t_157",
7
+ "flash-body": "awsui_flash-body_1q84n_12e9t_171",
8
+ "flash-message": "awsui_flash-message_1q84n_12e9t_171",
9
+ "flash-header": "awsui_flash-header_1q84n_12e9t_171",
10
+ "flash-content": "awsui_flash-content_1q84n_12e9t_172",
11
+ "action-button-wrapper": "awsui_action-button-wrapper_1q84n_12e9t_173",
12
+ "dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_12e9t_174",
13
+ "flash-icon": "awsui_flash-icon_1q84n_12e9t_197",
14
+ "entering": "awsui_entering_1q84n_12e9t_210",
15
+ "entered": "awsui_entered_1q84n_12e9t_231",
16
+ "exiting": "awsui_exiting_1q84n_12e9t_336",
17
+ "stack": "awsui_stack_1q84n_12e9t_370",
18
+ "animation-running": "awsui_animation-running_1q84n_12e9t_370",
19
+ "item": "awsui_item_1q84n_12e9t_370",
20
+ "flash-list-item": "awsui_flash-list-item_1q84n_12e9t_371",
21
+ "notification-bar": "awsui_notification-bar_1q84n_12e9t_372",
22
+ "collapsed": "awsui_collapsed_1q84n_12e9t_392",
23
+ "animation-ready": "awsui_animation-ready_1q84n_12e9t_392",
24
+ "expanded-only": "awsui_expanded-only_1q84n_12e9t_392",
25
+ "expanded": "awsui_expanded_1q84n_12e9t_392",
26
+ "flash": "awsui_flash_1q84n_12e9t_157",
27
+ "collapsible": "awsui_collapsible_1q84n_12e9t_448",
28
+ "short-list": "awsui_short-list_1q84n_12e9t_454",
29
+ "visual-refresh": "awsui_visual-refresh_1q84n_12e9t_454",
30
+ "status": "awsui_status_1q84n_12e9t_601",
31
+ "header": "awsui_header_1q84n_12e9t_601",
32
+ "item-count": "awsui_item-count_1q84n_12e9t_602",
33
+ "button": "awsui_button_1q84n_12e9t_603",
34
+ "type-count": "awsui_type-count_1q84n_12e9t_636",
35
+ "count-number": "awsui_count-number_1q84n_12e9t_636",
36
+ "icon": "awsui_icon_1q84n_12e9t_673",
37
+ "floating": "awsui_floating_1q84n_12e9t_714",
38
+ "flashbar": "awsui_flashbar_1q84n_12e9t_718",
39
+ "initial-hidden": "awsui_initial-hidden_1q84n_12e9t_777",
40
+ "flash-list": "awsui_flash-list_1q84n_12e9t_371",
41
+ "flash-focus-container": "awsui_flash-focus-container_1q84n_12e9t_801",
42
+ "flash-text": "awsui_flash-text_1q84n_12e9t_831",
43
+ "hidden": "awsui_hidden_1q84n_12e9t_850",
44
+ "header-replacement": "awsui_header-replacement_1q84n_12e9t_855",
45
+ "content-replacement": "awsui_content-replacement_1q84n_12e9t_860",
46
+ "dismiss-button": "awsui_dismiss-button_1q84n_12e9t_174",
47
+ "action-wrapped": "awsui_action-wrapped_1q84n_12e9t_878",
48
+ "action-button": "awsui_action-button_1q84n_12e9t_173",
49
+ "action-slot": "awsui_action-slot_1q84n_12e9t_885",
50
+ "flash-type-success": "awsui_flash-type-success_1q84n_12e9t_889",
51
+ "flash-type-error": "awsui_flash-type-error_1q84n_12e9t_893",
52
+ "flash-type-info": "awsui_flash-type-info_1q84n_12e9t_897",
53
+ "flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_12e9t_898",
54
+ "flash-type-warning": "awsui_flash-type-warning_1q84n_12e9t_902"
55
55
  };
56
56
 
@@ -2035,4 +2035,7 @@
2035
2035
  100% {
2036
2036
  transform: scale(1);
2037
2037
  }
2038
+ }
2039
+ :root {
2040
+ --awsui-version-info-f06998b8: true;
2038
2041
  }
@@ -1,4 +1,5 @@
1
1
  export const PACKAGE_SOURCE: string;
2
2
  export const PACKAGE_VERSION: string;
3
+ export const GIT_SHA: string;
3
4
  export const THEME: string;
4
5
  export const ALWAYS_VISUAL_REFRESH: string;
@@ -1,4 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (9ccb2618)";
2
+ export var PACKAGE_VERSION = "3.0.0 (f06998b8)";
3
+ export var GIT_SHA = "f06998b8";
3
4
  export var THEME = "open-source-visual-refresh";
4
5
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (9ccb2618)",
3
+ "PACKAGE_VERSION": "3.0.0 (f06998b8)",
4
+ "GIT_SHA": "f06998b8",
4
5
  "THEME": "open-source-visual-refresh",
5
6
  "ALWAYS_VISUAL_REFRESH": true
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAYtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAatC"}
@@ -2,6 +2,7 @@ import { useComponentMetadata, useComponentMetrics, useFocusVisible, } from '@cl
2
2
  import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';
3
3
  import { getVisualTheme } from '../../utils/get-visual-theme';
4
4
  import { useVisualRefresh } from '../use-visual-mode';
5
+ import { useMissingStylesCheck } from './styles-check';
5
6
  /**
6
7
  * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
7
8
  * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this
@@ -12,6 +13,7 @@ export default function useBaseComponent(componentName, config, analyticsMetadat
12
13
  const theme = getVisualTheme(THEME, isVisualRefresh);
13
14
  useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
14
15
  useFocusVisible();
16
+ useMissingStylesCheck();
15
17
  const elementRef = useComponentMetadata(componentName, { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme }, analyticsMetadata);
16
18
  return { __internalRootRef: elementRef };
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,qBAAqB,EAAE,CAAC;IACxB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\nimport { useMissingStylesCheck } from './styles-check';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n useMissingStylesCheck();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function checkMissingStyles(): void;
2
+ export declare function idleWithDelay(cb: () => void): (() => void) | undefined;
3
+ export declare function useMissingStylesCheck(): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-check.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,SAMjC;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,IAAI,4BAsB3C;AAUD,wBAAgB,qBAAqB,SAIpC"}
@@ -0,0 +1,46 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect } from 'react';
4
+ import { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';
5
+ import { metrics } from '../../metrics';
6
+ export function checkMissingStyles() {
7
+ const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);
8
+ if (!result) {
9
+ console.error(`Missing AWS-UI CSS for theme "${THEME}", version "${PACKAGE_VERSION}", and git sha "${GIT_SHA}".`);
10
+ metrics.sendOpsMetricObject('awsui-missing-css-asset', {});
11
+ }
12
+ }
13
+ export function idleWithDelay(cb) {
14
+ // if idle callbacks not supported, we simply do not collect the metric
15
+ if (typeof requestIdleCallback !== 'function') {
16
+ return;
17
+ }
18
+ let aborted = false;
19
+ setTimeout(() => {
20
+ if (aborted) {
21
+ return;
22
+ }
23
+ requestIdleCallback(() => {
24
+ if (aborted) {
25
+ return;
26
+ }
27
+ cb();
28
+ });
29
+ }, 1000);
30
+ return () => {
31
+ aborted = true;
32
+ };
33
+ }
34
+ let checked = false;
35
+ const checkMissingStylesOnce = () => {
36
+ if (!checked) {
37
+ checkMissingStyles();
38
+ checked = true;
39
+ }
40
+ };
41
+ export function useMissingStylesCheck() {
42
+ useEffect(() => {
43
+ return idleWithDelay(() => checkMissingStylesOnce());
44
+ }, []);
45
+ }
46
+ //# sourceMappingURL=styles-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-check.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,K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cesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect } from 'react';\n\nimport { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';\nimport { metrics } from '../../metrics';\n\nexport function checkMissingStyles() {\n const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);\n if (!result) {\n console.error(`Missing AWS-UI CSS for theme \"${THEME}\", version \"${PACKAGE_VERSION}\", and git sha \"${GIT_SHA}\".`);\n metrics.sendOpsMetricObject('awsui-missing-css-asset', {});\n }\n}\n\nexport function idleWithDelay(cb: () => void) {\n // if idle callbacks not supported, we simply do not collect the metric\n if (typeof requestIdleCallback !== 'function') {\n return;\n }\n let aborted = false;\n\n setTimeout(() => {\n if (aborted) {\n return;\n }\n requestIdleCallback(() => {\n if (aborted) {\n return;\n }\n cb();\n });\n }, 1000);\n\n return () => {\n aborted = true;\n };\n}\n\nlet checked = false;\nconst checkMissingStylesOnce = () => {\n if (!checked) {\n checkMissingStyles();\n checked = true;\n }\n};\n\nexport function useMissingStylesCheck() {\n useEffect(() => {\n return idleWithDelay(() => checkMissingStylesOnce());\n }, []);\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "9ccb26180fdcacb11aafa7742a0c5a022a77427a"
2
+ "commit": "f06998b8cae07766b6e6af104f801928cfec0c90"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,SAA+C,CAAC"}
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,SAAgG,CAAC"}
@@ -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
3
  import { Metrics } from '@cloudscape-design/component-toolkit/internal';
4
- import { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';
5
- export const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);
4
+ import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';
5
+ export const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });
6
6
  //# sourceMappingURL=metrics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';\n\nexport const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);\n"]}
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';\n\nexport const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });\n"]}
package/package.json CHANGED
@@ -149,7 +149,7 @@
149
149
  "./internal/base-component/index.js",
150
150
  "./internal/base-component/styles.css.js"
151
151
  ],
152
- "version": "3.0.999",
152
+ "version": "3.0.1001",
153
153
  "repository": {
154
154
  "type": "git",
155
155
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,uGAmNxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,uGAkNxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -39,9 +39,9 @@ const InternalPromptInput = React.forwardRef((_a, ref) => {
39
39
  }), [textareaRef]);
40
40
  const handleKeyDown = (event) => {
41
41
  fireKeyboardEvent(onKeyDown, event);
42
- if (event.key === 'Enter' && !event.shiftKey) {
43
- if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {
44
- event.target.form.requestSubmit();
42
+ if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {
43
+ if (event.currentTarget.form && !event.isDefaultPrevented()) {
44
+ event.currentTarget.form.requestSubmit();
45
45
  }
46
46
  event.preventDefault();
47
47
  fireNonCancelableEvent(onAction, { value });
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAIrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC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;YAC5D,eAAe,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAC3C;QACL,gBAAgB,IAAI,CACnB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAAE;gBAChF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,+BAA+B;gBAC3D,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAED,gBAAgB;YACjB,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,EAAA,GAAI;YAC7E,eAAe,IAAI,MAAM,CACtB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey) {\n if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {\n (event.target.form as HTMLFormElement).requestSubmit();\n }\n\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.ts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e,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n if (event.currentTarget.form && !event.isDefaultPrevented()) {\n event.currentTarget.form.requestSubmit();\n }\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
@@ -8,7 +8,8 @@ export interface SegmentedControlProps extends BaseComponentProps {
8
8
  */
9
9
  selectedId: string | null;
10
10
  /**
11
- * An array of objects representing options. Each segment has the following properties:
11
+ * An array of objects representing options. Only up to 6 options are supported.
12
+ * Each segment has the following properties:
12
13
  *
13
14
  * - `id` (string) - The ID of the segment.
14
15
  * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1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;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;CAC1E;AAED,yBAAiB,qBAAqB,CAAC;IACrC,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,YAAY;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/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 { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/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 { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Only up to 6 options are supported.\n * Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}