@cloudscape-design/components-themeable 3.0.1258 → 3.0.1260

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 (260) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/{internal/components/dropdown → dropdown}/motion.scss +2 -2
  3. package/lib/internal/scss/dropdown/styles.scss +127 -0
  4. package/lib/internal/scss/dropdown/test-classes/styles.scss +16 -0
  5. package/lib/internal/scss/internal/components/dropdown/styles.scss +2 -113
  6. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +155 -152
  7. package/lib/internal/scss/internal/styles/forms/mixins.scss +15 -11
  8. package/lib/internal/template/alert/styles.css.js +27 -27
  9. package/lib/internal/template/alert/styles.scoped.css +50 -50
  10. package/lib/internal/template/alert/styles.selectors.js +27 -27
  11. package/lib/internal/template/annotation-context/annotation/styles.css.js +13 -13
  12. package/lib/internal/template/annotation-context/annotation/styles.scoped.css +21 -21
  13. package/lib/internal/template/annotation-context/annotation/styles.selectors.js +13 -13
  14. package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
  15. package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
  16. package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
  17. package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
  18. package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
  19. package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
  20. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +32 -32
  21. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +89 -89
  22. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +32 -32
  23. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
  24. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
  25. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
  26. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -27
  27. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +54 -54
  28. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -27
  29. package/lib/internal/template/attribute-editor/styles.css.js +15 -15
  30. package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
  31. package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
  32. package/lib/internal/template/autosuggest/interfaces.d.ts +1 -1
  33. package/lib/internal/template/autosuggest/interfaces.d.ts.map +1 -1
  34. package/lib/internal/template/autosuggest/interfaces.js.map +1 -1
  35. package/lib/internal/template/autosuggest/internal.js.map +1 -1
  36. package/lib/internal/template/autosuggest/load-more-controller.d.ts +1 -1
  37. package/lib/internal/template/autosuggest/load-more-controller.d.ts.map +1 -1
  38. package/lib/internal/template/autosuggest/load-more-controller.js.map +1 -1
  39. package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
  40. package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
  41. package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
  42. package/lib/internal/template/button/styles.css.js +22 -22
  43. package/lib/internal/template/button/styles.scoped.css +256 -256
  44. package/lib/internal/template/button/styles.selectors.js +22 -22
  45. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js +1 -1
  46. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
  47. package/lib/internal/template/button-dropdown/interfaces.d.ts +1 -1
  48. package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
  49. package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
  50. package/lib/internal/template/button-dropdown/internal.js +1 -1
  51. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  52. package/lib/internal/template/button-dropdown/item-element/index.js +1 -1
  53. package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
  54. package/lib/internal/template/button-dropdown/item-element/styles.css.js +21 -21
  55. package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +37 -37
  56. package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +21 -21
  57. package/lib/internal/template/checkbox/styles.css.js +3 -3
  58. package/lib/internal/template/checkbox/styles.scoped.css +11 -11
  59. package/lib/internal/template/checkbox/styles.selectors.js +3 -3
  60. package/lib/internal/template/content-layout/styles.css.js +14 -14
  61. package/lib/internal/template/content-layout/styles.scoped.css +27 -27
  62. package/lib/internal/template/content-layout/styles.selectors.js +14 -14
  63. package/lib/internal/template/date-picker/index.js +1 -1
  64. package/lib/internal/template/date-picker/index.js.map +1 -1
  65. package/lib/internal/template/date-picker/interfaces.d.ts +1 -1
  66. package/lib/internal/template/date-picker/interfaces.d.ts.map +1 -1
  67. package/lib/internal/template/date-picker/interfaces.js.map +1 -1
  68. package/lib/internal/template/date-range-picker/index.js +1 -1
  69. package/lib/internal/template/date-range-picker/index.js.map +1 -1
  70. package/lib/internal/template/date-range-picker/interfaces.d.ts +1 -1
  71. package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
  72. package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
  73. package/lib/internal/template/dropdown/context.d.ts.map +1 -0
  74. package/lib/internal/template/dropdown/context.js.map +1 -0
  75. package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.d.ts +1 -1
  76. package/lib/internal/template/dropdown/dropdown-fit-handler.d.ts.map +1 -0
  77. package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.js +1 -1
  78. package/lib/internal/template/dropdown/dropdown-fit-handler.js.map +1 -0
  79. package/lib/internal/template/dropdown/dropdown-position.d.ts.map +1 -0
  80. package/lib/internal/template/dropdown/dropdown-position.js.map +1 -0
  81. package/lib/internal/template/dropdown/index.d.ts +7 -0
  82. package/lib/internal/template/dropdown/index.d.ts.map +1 -0
  83. package/lib/internal/template/dropdown/index.js +16 -0
  84. package/lib/internal/template/dropdown/index.js.map +1 -0
  85. package/lib/internal/template/{internal/components/dropdown → dropdown}/interfaces.d.ts +54 -82
  86. package/lib/internal/template/dropdown/interfaces.d.ts.map +1 -0
  87. package/lib/internal/template/dropdown/interfaces.js.map +1 -0
  88. package/lib/internal/template/dropdown/internal.d.ts +24 -0
  89. package/lib/internal/template/dropdown/internal.d.ts.map +1 -0
  90. package/lib/internal/template/{internal/components/dropdown/index.js → dropdown/internal.js} +29 -21
  91. package/lib/internal/template/dropdown/internal.js.map +1 -0
  92. package/lib/internal/template/dropdown/style.d.ts +9 -0
  93. package/lib/internal/template/dropdown/style.d.ts.map +1 -0
  94. package/lib/internal/template/dropdown/style.js +16 -0
  95. package/lib/internal/template/dropdown/style.js.map +1 -0
  96. package/lib/internal/template/dropdown/styles.css.js +25 -0
  97. package/lib/internal/template/dropdown/styles.scoped.css +380 -0
  98. package/lib/internal/template/dropdown/styles.selectors.js +26 -0
  99. package/lib/internal/template/dropdown/test-classes/styles.css.js +8 -0
  100. package/lib/internal/template/dropdown/test-classes/styles.scoped.css +15 -0
  101. package/lib/internal/template/dropdown/test-classes/styles.selectors.js +9 -0
  102. package/lib/internal/template/file-token-group/styles.css.js +23 -23
  103. package/lib/internal/template/file-token-group/styles.scoped.css +36 -36
  104. package/lib/internal/template/file-token-group/styles.selectors.js +23 -23
  105. package/lib/internal/template/flashbar/styles.css.js +50 -50
  106. package/lib/internal/template/flashbar/styles.scoped.css +187 -187
  107. package/lib/internal/template/flashbar/styles.selectors.js +50 -50
  108. package/lib/internal/template/help-panel/styles.css.js +6 -6
  109. package/lib/internal/template/help-panel/styles.scoped.css +73 -73
  110. package/lib/internal/template/help-panel/styles.selectors.js +6 -6
  111. package/lib/internal/template/index.d.ts +1 -0
  112. package/lib/internal/template/index.d.ts.map +1 -1
  113. package/lib/internal/template/index.js +1 -0
  114. package/lib/internal/template/index.js.map +1 -1
  115. package/lib/internal/template/input/styles.css.js +13 -13
  116. package/lib/internal/template/input/styles.scoped.css +74 -74
  117. package/lib/internal/template/input/styles.selectors.js +13 -13
  118. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  119. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts +1 -1
  120. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
  121. package/lib/internal/template/internal/components/autosuggest-input/index.js +2 -2
  122. package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
  123. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +30 -30
  124. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +58 -58
  125. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +30 -30
  126. package/lib/internal/template/internal/components/dropdown/styles.css.js +2 -20
  127. package/lib/internal/template/internal/components/dropdown/styles.scoped.css +4 -373
  128. package/lib/internal/template/internal/components/dropdown/styles.selectors.js +2 -20
  129. package/lib/internal/template/internal/components/radio-button/styles.css.js +7 -7
  130. package/lib/internal/template/internal/components/radio-button/styles.scoped.css +18 -18
  131. package/lib/internal/template/internal/components/radio-button/styles.selectors.js +7 -7
  132. package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
  133. package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
  134. package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
  135. package/lib/internal/template/internal/environment.js +2 -2
  136. package/lib/internal/template/internal/environment.json +2 -2
  137. package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +3 -0
  138. package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
  139. package/lib/internal/template/internal/generated/custom-css-properties/index.js +154 -151
  140. package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
  141. package/lib/internal/template/internal/utils/browser-scrollbar-size.js +1 -1
  142. package/lib/internal/template/internal/utils/browser-scrollbar-size.js.map +1 -1
  143. package/lib/internal/template/internal/utils/get-dropdown-min-width.d.ts +1 -1
  144. package/lib/internal/template/internal/utils/get-dropdown-min-width.d.ts.map +1 -1
  145. package/lib/internal/template/internal/utils/get-dropdown-min-width.js.map +1 -1
  146. package/lib/internal/template/link/styles.css.js +20 -20
  147. package/lib/internal/template/link/styles.scoped.css +103 -103
  148. package/lib/internal/template/link/styles.selectors.js +20 -20
  149. package/lib/internal/template/list/interfaces.d.ts +2 -2
  150. package/lib/internal/template/list/interfaces.d.ts.map +1 -1
  151. package/lib/internal/template/list/interfaces.js.map +1 -1
  152. package/lib/internal/template/modal/styles.css.js +31 -31
  153. package/lib/internal/template/modal/styles.scoped.css +48 -48
  154. package/lib/internal/template/modal/styles.selectors.js +31 -31
  155. package/lib/internal/template/multiselect/embedded.d.ts +1 -1
  156. package/lib/internal/template/multiselect/internal.d.ts +1 -1
  157. package/lib/internal/template/multiselect/internal.js +1 -1
  158. package/lib/internal/template/multiselect/internal.js.map +1 -1
  159. package/lib/internal/template/multiselect/use-multiselect.d.ts +1 -1
  160. package/lib/internal/template/package.json +1 -0
  161. package/lib/internal/template/progress-bar/styles.css.js +18 -18
  162. package/lib/internal/template/progress-bar/styles.scoped.css +48 -48
  163. package/lib/internal/template/progress-bar/styles.selectors.js +18 -18
  164. package/lib/internal/template/prompt-input/styles.css.js +17 -17
  165. package/lib/internal/template/prompt-input/styles.scoped.css +79 -79
  166. package/lib/internal/template/prompt-input/styles.selectors.js +17 -17
  167. package/lib/internal/template/property-filter/interfaces.d.ts +1 -1
  168. package/lib/internal/template/property-filter/interfaces.d.ts.map +1 -1
  169. package/lib/internal/template/property-filter/interfaces.js.map +1 -1
  170. package/lib/internal/template/property-filter/property-filter-autosuggest.d.ts.map +1 -1
  171. package/lib/internal/template/property-filter/property-filter-autosuggest.js.map +1 -1
  172. package/lib/internal/template/property-filter/use-load-items.d.ts +1 -1
  173. package/lib/internal/template/segmented-control/styles.css.js +16 -16
  174. package/lib/internal/template/segmented-control/styles.scoped.css +46 -46
  175. package/lib/internal/template/segmented-control/styles.selectors.js +16 -16
  176. package/lib/internal/template/select/interfaces.d.ts +1 -1
  177. package/lib/internal/template/select/interfaces.d.ts.map +1 -1
  178. package/lib/internal/template/select/interfaces.js.map +1 -1
  179. package/lib/internal/template/select/internal.js +1 -1
  180. package/lib/internal/template/select/internal.js.map +1 -1
  181. package/lib/internal/template/select/utils/use-select.d.ts +2 -2
  182. package/lib/internal/template/select/utils/use-select.d.ts.map +1 -1
  183. package/lib/internal/template/select/utils/use-select.js.map +1 -1
  184. package/lib/internal/template/slider/styles.css.js +26 -26
  185. package/lib/internal/template/slider/styles.scoped.css +165 -165
  186. package/lib/internal/template/slider/styles.selectors.js +26 -26
  187. package/lib/internal/template/spinner/styles.css.js +13 -13
  188. package/lib/internal/template/spinner/styles.scoped.css +39 -39
  189. package/lib/internal/template/spinner/styles.selectors.js +13 -13
  190. package/lib/internal/template/tabs/styles.css.js +30 -30
  191. package/lib/internal/template/tabs/styles.scoped.css +76 -76
  192. package/lib/internal/template/tabs/styles.selectors.js +30 -30
  193. package/lib/internal/template/tag-editor/styles.css.js +3 -3
  194. package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
  195. package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
  196. package/lib/internal/template/test-utils/dom/autosuggest/index.js +18 -17
  197. package/lib/internal/template/test-utils/dom/autosuggest/index.js.map +1 -1
  198. package/lib/internal/template/test-utils/dom/button-dropdown/index.js +3 -2
  199. package/lib/internal/template/test-utils/dom/button-dropdown/index.js.map +1 -1
  200. package/lib/internal/template/test-utils/dom/dropdown/index.d.ts +41 -0
  201. package/lib/internal/template/test-utils/dom/dropdown/index.js +65 -0
  202. package/lib/internal/template/test-utils/dom/dropdown/index.js.map +1 -0
  203. package/lib/internal/template/test-utils/dom/index.d.ts +28 -0
  204. package/lib/internal/template/test-utils/dom/index.js +21 -2
  205. package/lib/internal/template/test-utils/dom/index.js.map +1 -1
  206. package/lib/internal/template/test-utils/dom/internal/autosuggest-input.js +7 -6
  207. package/lib/internal/template/test-utils/dom/internal/autosuggest-input.js.map +1 -1
  208. package/lib/internal/template/test-utils/dom/internal/dropdown-host.d.ts +3 -3
  209. package/lib/internal/template/test-utils/dom/internal/dropdown-host.js +24 -23
  210. package/lib/internal/template/test-utils/dom/internal/dropdown-host.js.map +1 -1
  211. package/lib/internal/template/test-utils/dom/internal/dropdown.d.ts +1 -0
  212. package/lib/internal/template/test-utils/dom/internal/dropdown.js +7 -2
  213. package/lib/internal/template/test-utils/dom/internal/dropdown.js.map +1 -1
  214. package/lib/internal/template/test-utils/selectors/autosuggest/index.js +18 -17
  215. package/lib/internal/template/test-utils/selectors/autosuggest/index.js.map +1 -1
  216. package/lib/internal/template/test-utils/selectors/button-dropdown/index.js +3 -2
  217. package/lib/internal/template/test-utils/selectors/button-dropdown/index.js.map +1 -1
  218. package/lib/internal/template/test-utils/selectors/dropdown/index.d.ts +41 -0
  219. package/lib/internal/template/test-utils/selectors/dropdown/index.js +65 -0
  220. package/lib/internal/template/test-utils/selectors/dropdown/index.js.map +1 -0
  221. package/lib/internal/template/test-utils/selectors/index.d.ts +18 -0
  222. package/lib/internal/template/test-utils/selectors/index.js +16 -2
  223. package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
  224. package/lib/internal/template/test-utils/selectors/internal/autosuggest-input.js +7 -6
  225. package/lib/internal/template/test-utils/selectors/internal/autosuggest-input.js.map +1 -1
  226. package/lib/internal/template/test-utils/selectors/internal/dropdown-host.d.ts +3 -3
  227. package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js +23 -22
  228. package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js.map +1 -1
  229. package/lib/internal/template/test-utils/selectors/internal/dropdown.d.ts +1 -0
  230. package/lib/internal/template/test-utils/selectors/internal/dropdown.js +7 -2
  231. package/lib/internal/template/test-utils/selectors/internal/dropdown.js.map +1 -1
  232. package/lib/internal/template/text-content/styles.css.js +1 -1
  233. package/lib/internal/template/text-content/styles.scoped.css +66 -66
  234. package/lib/internal/template/text-content/styles.selectors.js +1 -1
  235. package/lib/internal/template/textarea/styles.css.js +5 -5
  236. package/lib/internal/template/textarea/styles.scoped.css +45 -45
  237. package/lib/internal/template/textarea/styles.selectors.js +5 -5
  238. package/lib/internal/template/toggle/styles.css.js +10 -10
  239. package/lib/internal/template/toggle/styles.scoped.css +23 -23
  240. package/lib/internal/template/toggle/styles.selectors.js +10 -10
  241. package/lib/internal/template/token/styles.css.js +14 -14
  242. package/lib/internal/template/token/styles.scoped.css +48 -48
  243. package/lib/internal/template/token/styles.selectors.js +14 -14
  244. package/package.json +1 -1
  245. package/lib/internal/template/internal/components/dropdown/context.d.ts.map +0 -1
  246. package/lib/internal/template/internal/components/dropdown/context.js.map +0 -1
  247. package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.d.ts.map +0 -1
  248. package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.js.map +0 -1
  249. package/lib/internal/template/internal/components/dropdown/dropdown-position.d.ts.map +0 -1
  250. package/lib/internal/template/internal/components/dropdown/dropdown-position.js.map +0 -1
  251. package/lib/internal/template/internal/components/dropdown/index.d.ts +0 -4
  252. package/lib/internal/template/internal/components/dropdown/index.d.ts.map +0 -1
  253. package/lib/internal/template/internal/components/dropdown/index.js.map +0 -1
  254. package/lib/internal/template/internal/components/dropdown/interfaces.d.ts.map +0 -1
  255. package/lib/internal/template/internal/components/dropdown/interfaces.js.map +0 -1
  256. /package/lib/internal/template/{internal/components/dropdown → dropdown}/context.d.ts +0 -0
  257. /package/lib/internal/template/{internal/components/dropdown → dropdown}/context.js +0 -0
  258. /package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-position.d.ts +0 -0
  259. /package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-position.js +0 -0
  260. /package/lib/internal/template/{internal/components/dropdown → dropdown}/interfaces.js +0 -0
@@ -1,6 +1,28 @@
1
1
  import React from 'react';
2
- import { NonCancelableEventHandler } from '../../events';
2
+ import { NonCancelableEventHandler } from '../internal/events';
3
3
  export type OptionsFilteringType = 'none' | 'auto' | 'manual';
4
+ export declare namespace DropdownProps {
5
+ interface Style {
6
+ dropdown?: {
7
+ /**
8
+ * Background color of the dropdown content wrapper.
9
+ */
10
+ background?: string;
11
+ /**
12
+ * Border color of the dropdown content wrapper.
13
+ */
14
+ borderColor?: string;
15
+ /**
16
+ * Border radius of the dropdown content wrapper.
17
+ */
18
+ borderRadius?: string;
19
+ /**
20
+ * Border width of the dropdown content wrapper.
21
+ */
22
+ borderWidth?: string;
23
+ };
24
+ }
25
+ }
4
26
  /**
5
27
  * Alignment of the dropdown relative to its trigger.
6
28
  */
@@ -47,7 +69,7 @@ export interface BaseDropdownHostProps extends ExpandToViewport {
47
69
  }
48
70
  export interface DropdownProps extends ExpandToViewport {
49
71
  /**
50
- * Trigger element.
72
+ * The trigger element that opens/closes the dropdown.
51
73
  */
52
74
  trigger: React.ReactNode;
53
75
  /**
@@ -62,99 +84,54 @@ export interface DropdownProps extends ExpandToViewport {
62
84
  */
63
85
  triggerId?: string;
64
86
  /**
65
- * "Sticky" header of the dropdown content
87
+ * Optional header content that stays fixed at the top while
88
+ * scrolling dropdown content.
66
89
  */
67
90
  header?: React.ReactNode;
68
91
  /**
69
- * Footer slot fixed at the bottom of the dropdown
92
+ * Optional footer content that stays fixed at the bottom while
93
+ * scrolling dropdown content.
94
+ * Typically used to display loading status or action buttons.
70
95
  */
71
96
  footer?: React.ReactNode;
72
97
  /**
73
- * Dropdown content elements.
98
+ * Main content of the dropdown.
74
99
  */
75
100
  content?: React.ReactNode;
76
- /**
77
- * Updating content key triggers dropdown position re-evaluation.
78
- */
79
- contentKey?: string;
80
101
  /**
81
102
  * Open state of the dropdown.
82
103
  */
83
104
  open?: boolean;
84
105
  /**
85
- * Called when the user clicks outside the dropdown and trigger.
86
- * The dropdown does not close automatically - the parent component
87
- * must update the `open` prop to close the dropdown.
106
+ * Called when the user clicks outside the dropdown. The dropdown does not
107
+ * close automatically - the `open` prop needs to be updated to actually close
108
+ * the dropdown.
88
109
  */
89
110
  onOutsideClick?: NonCancelableEventHandler<null>;
90
111
  /**
91
- * Called when a mouse button is pressed inside the dropdown content.
92
- */
93
- onMouseDown?: React.MouseEventHandler;
94
- /**
95
- * Dropdown id
96
- */
97
- dropdownId?: string;
98
- /**
99
- * Stretches dropdown to occupy entire height.
100
- */
101
- stretchHeight?: boolean;
102
- /**
103
- * Stretches the trigger to the height of the dropdown container.
112
+ * Minimum width for the dropdown in pixels. If no value is specified, the
113
+ * dropdown will shrink to fit its content.
104
114
  */
105
- stretchTriggerHeight?: boolean;
115
+ minWidth?: number;
106
116
  /**
107
- * Minimum width constraint for the dropdown.
108
- * - Number: minimum width in pixels
109
- * - 'trigger': dropdown will be at least as wide as the trigger
110
- * - undefined: no minimum constraint (fits content)
117
+ * Maximum width for the dropdown in pixels. If no value is specified, the
118
+ * dropdown will expand to fit its content.
111
119
  */
112
- minWidth?: DropdownWidthConstraint;
113
- /**
114
- * Maximum width constraint for the dropdown.
115
- * - Number: maximum width in pixels
116
- * - 'trigger': dropdown cannot exceed the trigger width
117
- * - undefined: fit to content width (no max constraint)
118
- */
119
- maxWidth?: DropdownWidthConstraint;
120
+ maxWidth?: number;
120
121
  /**
121
122
  * Maximum height constraint for the dropdown content in pixels.
122
123
  * When set, constrains the calculated height to not exceed this value.
123
124
  */
124
125
  maxHeight?: number;
125
126
  /**
126
- * Preferred alignment of the dropdown relative to its trigger.
127
- * The dropdown will attempt this alignment first, but will automatically
128
- * adjust if there's insufficient space on the preferred side.
129
- */
130
- preferredAlignment?: DropdownAlignment;
131
- /**
132
- * Hides the block (top/bottom) borders of the dropdown content wrapper.
133
- */
134
- hideBlockBorder?: boolean;
135
- /**
136
- * Indicates if this dropdown lies within a parent dropdown and positions itself relative to it (as a fly out).
137
- */
138
- interior?: boolean;
139
- /**
140
- * Whether the dropdown will have a scrollbar or not
141
- */
142
- scrollable?: boolean;
143
- /**
144
- * Whether the dropdown will have a focus loop including trigger, header, content and footer.
145
- */
146
- loopFocus?: boolean;
147
- /**
148
- * Called when focus enters the trigger or dropdown content.
149
- */
150
- onFocus?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
151
- /**
152
- * Called when focus leaves the trigger or dropdown content.
127
+ * Called when the user presses the Escape key while the dropdown is open.
128
+ * The dropdown does not close automatically - the `open` prop needs to be
129
+ * updated to actually close the dropdown.
153
130
  */
154
- onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
131
+ onEscape?: NonCancelableEventHandler;
155
132
  /**
156
- * Called when focus enters the dropdown content from outside.
157
- * This fires only once when focus moves into the dropdown, not when moving between elements within it.
133
+ * Called when any element inside the dropdown content gains focus.
134
+ * This includes nested interactive elements like buttons, links, or inputs.
158
135
  */
159
136
  onFocusEnter?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
160
137
  /**
@@ -162,31 +139,26 @@ export interface DropdownProps extends ExpandToViewport {
162
139
  */
163
140
  onFocusLeave?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
164
141
  /**
165
- * Called when the user presses the Escape key while the dropdown is open.
166
- * The dropdown does not close automatically - the parent component
167
- * must update the `open` prop to close the dropdown.
168
- */
169
- onEscape?: NonCancelableEventHandler;
170
- /**
171
- * ID for the dropdown content wrapper
172
- */
173
- dropdownContentId?: string;
174
- /**
175
- * HTML role for the dropdown content wrapper
142
+ * Adds `role` to the dropdown content element.
176
143
  */
177
144
  ariaRole?: string;
178
145
  /**
179
- * Aria label for the dropdown content wrapper
146
+ * Adds `aria-label` to the dropdown content element.
180
147
  */
181
148
  ariaLabel?: string;
182
149
  /**
183
- * Labelledby for the dropdown (required when role="dialog")
150
+ * Adds `aria-labelledby` to the dropdown content element.
184
151
  */
185
152
  ariaLabelledby?: string;
186
153
  /**
187
- * Describedby for the dropdown (recommended when role="dialog")
154
+ * Adds `aria-describedby` to the dropdown content element.
188
155
  */
189
156
  ariaDescribedby?: string;
157
+ /**
158
+ * An object containing CSS properties to customize the dropdown's visual appearance.
159
+ * @awsuiSystem core
160
+ */
161
+ style?: DropdownProps.Style;
190
162
  }
191
163
  export interface ExpandToViewport {
192
164
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/dropdown/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,KAAK;QACpB,QAAQ,CAAC,EAAE;YACT;;eAEG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB;;eAEG;YACH,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH;CACF;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,QAAQ,CAAC;AAEb;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;;;;;;;;;QAaI;IACJ,WAAW,CAAC,EAAE,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,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 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/dropdown/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 { NonCancelableEventHandler } from '../internal/events';\n\nexport type OptionsFilteringType = 'none' | 'auto' | 'manual';\n\nexport namespace DropdownProps {\n export interface Style {\n dropdown?: {\n /**\n * Background color of the dropdown content wrapper.\n */\n background?: string;\n /**\n * Border color of the dropdown content wrapper.\n */\n borderColor?: string;\n /**\n * Border radius of the dropdown content wrapper.\n */\n borderRadius?: string;\n /**\n * Border width of the dropdown content wrapper.\n */\n borderWidth?: string;\n };\n }\n}\n\n/**\n * Alignment of the dropdown relative to its trigger.\n */\nexport type DropdownAlignment =\n | 'start' // Aligns to the start edge of trigger (default)\n | 'center'; // Centers dropdown on trigger\n\n/**\n * Width constraint for the dropdown.\n * - 'trigger': references the trigger element's width\n * - number: width in pixels\n */\nexport type DropdownWidthConstraint = 'trigger' | number;\n\nexport interface OptionsLoadItemsDetail {\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n}\n\nexport interface BaseDropdownHostProps extends ExpandToViewport {\n /**\n * If you have more than 500 options, enable this flag to apply a performance optimization\n * that makes the filtering experience smoother. We don't recommend enabling the feature if you\n * have less than 500 options, because the improvements to performance are offset by a\n * visible scrolling lag.\n *\n * When you set this flag to `true`, it removes options that are not currently in view from the DOM.\n * If your test accesses such options, you need to first scroll the options container\n * to the correct offset, before performing any operations on them. Use the element returned\n * by the `findOptionsContainer` test utility for this.\n */\n virtualScroll?: boolean;\n\n /**\n * Use this event to implement the asynchronous behavior for the component.\n *\n * The event is called in the following situations:\n * * The user scrolls to the end of the list of options, if `statusType` is set to `pending`.\n * * The user clicks on the recovery button in the error state.\n * * The user types inside the input field.\n * * The user focuses the input field.\n *\n * The detail object contains the following properties:\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n **/\n onLoadItems?: NonCancelableEventHandler<OptionsLoadItemsDetail>;\n}\n\nexport interface DropdownProps extends ExpandToViewport {\n /**\n * The trigger element that opens/closes the dropdown.\n */\n trigger: React.ReactNode;\n\n /**\n * Optional ref to an external element used for positioning calculations.\n * When provided, the `trigger` prop is not rendered and this ref's element\n * is used as the positioning anchor for the dropdown instead.\n */\n triggerRef?: React.RefObject<HTMLElement>;\n\n /**\n * Explicit ID for the trigger element, used as the referrer ID for portal mode.\n * Use this when `triggerRef` is provided.\n */\n triggerId?: string;\n\n /**\n * Optional header content that stays fixed at the top while\n * scrolling dropdown content.\n */\n header?: React.ReactNode;\n\n /**\n * Optional footer content that stays fixed at the bottom while\n * scrolling dropdown content.\n * Typically used to display loading status or action buttons.\n */\n footer?: React.ReactNode;\n\n /**\n * Main content of the dropdown.\n */\n content?: React.ReactNode;\n\n /**\n * Open state of the dropdown.\n */\n open?: boolean;\n\n /**\n * Called when the user clicks outside the dropdown. The dropdown does not\n * close automatically - the `open` prop needs to be updated to actually close\n * the dropdown.\n */\n onOutsideClick?: NonCancelableEventHandler<null>;\n\n /**\n * Minimum width for the dropdown in pixels. If no value is specified, the\n * dropdown will shrink to fit its content.\n */\n minWidth?: number;\n\n /**\n * Maximum width for the dropdown in pixels. If no value is specified, the\n * dropdown will expand to fit its content.\n */\n maxWidth?: number;\n\n /**\n * Maximum height constraint for the dropdown content in pixels.\n * When set, constrains the calculated height to not exceed this value.\n */\n maxHeight?: number;\n\n /**\n * Called when the user presses the Escape key while the dropdown is open.\n * The dropdown does not close automatically - the `open` prop needs to be\n * updated to actually close the dropdown.\n */\n onEscape?: NonCancelableEventHandler;\n\n /**\n * Called when any element inside the dropdown content gains focus.\n * This includes nested interactive elements like buttons, links, or inputs.\n */\n onFocusEnter?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Called when focus leaves the dropdown content entirely.\n */\n onFocusLeave?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n\n /**\n * Adds `role` to the dropdown content element.\n */\n ariaRole?: string;\n\n /**\n * Adds `aria-label` to the dropdown content element.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the dropdown content element.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the dropdown content element.\n */\n ariaDescribedby?: string;\n\n /**\n * An object containing CSS properties to customize the dropdown's visual appearance.\n * @awsuiSystem core\n */\n style?: DropdownProps.Style;\n}\n\nexport interface ExpandToViewport {\n /**\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n expandToViewport?: boolean;\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { NonCancelableEventHandler } from '../internal/events';
3
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
4
+ import { DropdownAlignment, DropdownProps, DropdownWidthConstraint } from './interfaces';
5
+ export interface InternalDropdownProps extends Omit<DropdownProps, 'minWidth' | 'maxWidth'>, InternalBaseComponentProps {
6
+ onMouseDown?: React.MouseEventHandler;
7
+ contentKey?: string;
8
+ dropdownId?: string;
9
+ dropdownContentId?: string;
10
+ stretchHeight?: boolean;
11
+ stretchTriggerHeight?: boolean;
12
+ interior?: boolean;
13
+ scrollable?: boolean;
14
+ loopFocus?: boolean;
15
+ minWidth?: DropdownWidthConstraint;
16
+ maxWidth?: DropdownWidthConstraint;
17
+ preferredAlignment?: DropdownAlignment;
18
+ hideBlockBorder?: boolean;
19
+ onFocus?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
20
+ onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;
21
+ }
22
+ declare const InternalDropdown: ({ content, trigger, triggerRef: externalTriggerRef, triggerId: externalTriggerId, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight, stretchHeight, minWidth, maxWidth, maxHeight, hideBlockBorder, expandToViewport, preferredAlignment, interior, scrollable, loopFocus, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, style, __internalRootRef, ...restProps }: InternalDropdownProps) => JSX.Element;
23
+ export default InternalDropdown;
24
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/dropdown/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAW5E,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAalF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGzF,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAAC,EAClD,0BAA0B;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IACxF,MAAM,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;CACxF;AAmJD,QAAA,MAAM,gBAAgB,GAAI,meAoCvB,qBAAqB,gBA8XvB,CAAC;AAMF,eAAe,gBAAgB,CAAC"}
@@ -5,19 +5,22 @@ import { createPortal } from 'react-dom';
5
5
  import clsx from 'clsx';
6
6
  import { useMergeRefs, useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';
7
7
  import { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';
8
- import { fireNonCancelableEvent } from '../../events';
9
- import customCssProps from '../../generated/custom-css-properties';
10
- import { useMobile } from '../../hooks/use-mobile';
11
- import { usePortalModeClasses } from '../../hooks/use-portal-mode-classes';
12
- import { useVisualRefresh } from '../../hooks/use-visual-mode';
13
- import { nodeBelongs } from '../../utils/node-belongs';
14
- import { getFirstFocusable, getLastFocusable } from '../focus-lock/utils.js';
15
- import TabTrap from '../tab-trap/index.js';
16
- import { Transition } from '../transition';
8
+ import { getBaseProps } from '../internal/base-component';
9
+ import { getFirstFocusable, getLastFocusable } from '../internal/components/focus-lock/utils.js';
10
+ import TabTrap from '../internal/components/tab-trap/index.js';
11
+ import { Transition } from '../internal/components/transition';
12
+ import { fireNonCancelableEvent } from '../internal/events';
13
+ import customCssProps from '../internal/generated/custom-css-properties';
14
+ import { useMobile } from '../internal/hooks/use-mobile';
15
+ import { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';
16
+ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
17
+ import { nodeBelongs } from '../internal/utils/node-belongs';
17
18
  import { DropdownContextProvider } from './context';
18
19
  import { calculatePosition, hasEnoughSpaceForFlexibleWidth, } from './dropdown-fit-handler';
19
20
  import { applyDropdownPositionRelativeToViewport } from './dropdown-position';
21
+ import { getDropdownStyles } from './style';
20
22
  import styles from './styles.css.js';
23
+ import testUtilStyles from './test-classes/styles.css.js';
21
24
  const DropdownContainer = ({ triggerRef, children, renderWithPortal, id, referrerId, open, }) => {
22
25
  var _a, _b;
23
26
  if (!renderWithPortal) {
@@ -29,7 +32,7 @@ const DropdownContainer = ({ triggerRef, children, renderWithPortal, id, referre
29
32
  const currentDocument = (_b = (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
30
33
  return createPortal(React.createElement("div", { id: id, "data-awsui-referrer-id": referrerId }, children), currentDocument.body);
31
34
  };
32
- const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTriggerWidth, hideBlockBorder, interior, isRefresh, dropdownRef, verticalContainerRef, expandToViewport, minWidth, maxWidth, header, content, footer, position, open, onMouseDown, onFocusEnter, onFocusLeave, id, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
35
+ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTriggerWidth, hideBlockBorder, interior, isRefresh, dropdownRef, verticalContainerRef, expandToViewport, minWidth, maxWidth, header, content, footer, position, open, onMouseDown, onFocusEnter, onFocusLeave, id, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, dropdownStyle, }) => {
33
36
  const contentRef = useMergeRefs(dropdownRef, transitionRef);
34
37
  const dropdownStyles = {};
35
38
  if (minWidth) {
@@ -47,15 +50,17 @@ const TransitionContent = ({ state, transitionRef, dropdownClasses, matchTrigger
47
50
  [styles['use-portal']]: expandToViewport && !interior,
48
51
  [styles['use-flexible-width']]: !matchTriggerWidth && !interior,
49
52
  }), ref: contentRef, id: id, role: ariaRole, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-open": open, "data-animating": state !== 'exited', "aria-hidden": !open, style: dropdownStyles, onMouseDown: onMouseDown, onFocus: onFocusEnter, onBlur: onFocusLeave },
50
- React.createElement("div", { className: clsx(styles['dropdown-content-wrapper'], !header && !content && styles['is-empty'], isRefresh && styles.refresh) },
53
+ React.createElement("div", { className: clsx(styles['dropdown-content-wrapper'], !header && !content && styles['is-empty'], isRefresh && styles.refresh), style: dropdownStyle },
51
54
  React.createElement("div", { ref: verticalContainerRef, className: styles['dropdown-content'] },
52
55
  React.createElement(DropdownContextProvider, { position: position },
53
- header,
56
+ header && React.createElement("div", { className: testUtilStyles.header }, header),
54
57
  content,
55
- footer)))));
58
+ footer && React.createElement("div", { className: testUtilStyles.footer }, footer))))));
56
59
  };
57
- const Dropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId: externalTriggerId, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, maxHeight, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, }) => {
60
+ const InternalDropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId: externalTriggerId, open, onOutsideClick, onMouseDown, header, footer, dropdownId, stretchTriggerHeight = false, stretchHeight = false, minWidth, maxWidth, maxHeight, hideBlockBorder = true, expandToViewport = false, preferredAlignment = 'start', interior = false, scrollable = true, loopFocus = expandToViewport, onFocus, onBlur, onFocusEnter, onFocusLeave, onEscape, contentKey, dropdownContentId, ariaRole, ariaLabel, ariaLabelledby, ariaDescribedby, style, __internalRootRef, ...restProps }) => {
61
+ const baseProps = getBaseProps(restProps);
58
62
  const wrapperRef = useRef(null);
63
+ const mergedRef = useMergeRefs(wrapperRef, __internalRootRef);
59
64
  const internalTriggerRef = useRef(null);
60
65
  const dropdownRef = useRef(null);
61
66
  const dropdownContainerRef = useRef(null);
@@ -216,7 +221,10 @@ const Dropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId:
216
221
  // Since the listener is registered on the window, `event.target` will incorrectly point at the
217
222
  // shadow root if the component is rendered inside shadow DOM.
218
223
  const target = event.composedPath ? event.composedPath()[0] : event.target;
219
- if (!nodeBelongs(dropdownRef.current, target) && !nodeBelongs(triggerRef.current, target)) {
224
+ // For internal triggers, the wrapper div itself counts as outside — only its children are the trigger.
225
+ // For external triggers, the ref is the trigger element directly, so it counts as inside.
226
+ const isOutsideTrigger = !nodeBelongs(triggerRef.current, target) || (!externalTriggerRef && target === triggerRef.current);
227
+ if (!nodeBelongs(dropdownRef.current, target) && isOutsideTrigger) {
220
228
  fireNonCancelableEvent(onOutsideClick);
221
229
  }
222
230
  };
@@ -224,7 +232,7 @@ const Dropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId:
224
232
  return () => {
225
233
  window.removeEventListener('click', clickListener, true);
226
234
  };
227
- }, [open, onOutsideClick, triggerRef]);
235
+ }, [open, onOutsideClick, triggerRef, externalTriggerRef]);
228
236
  // subscribe to Escape key press
229
237
  useEffect(() => {
230
238
  // Only add the listener if onEscape callback is provided
@@ -290,15 +298,15 @@ const Dropdown = ({ content, trigger, triggerRef: externalTriggerRef, triggerId:
290
298
  // 'trigger' maps to 100% (relative to parent)
291
299
  return '100%';
292
300
  };
293
- return (React.createElement("div", { className: clsx(styles.root, interior && styles.interior, stretchTriggerHeight && styles['stretch-trigger-height']), ref: wrapperRef, onFocus: focusHandler, onBlur: blurHandler },
294
- !externalTriggerRef && (React.createElement("div", { id: referrerId, className: clsx(stretchTriggerHeight && styles['stretch-trigger-height']), ref: internalTriggerRef }, trigger)),
301
+ return (React.createElement("div", { ...baseProps, className: clsx(styles.root, interior && styles.interior, stretchTriggerHeight && styles['stretch-trigger-height'], baseProps.className), ref: mergedRef, onFocus: focusHandler, onBlur: blurHandler },
302
+ !externalTriggerRef && (React.createElement("div", { id: referrerId, className: clsx(stretchTriggerHeight && styles['stretch-trigger-height'], testUtilStyles.trigger), ref: internalTriggerRef }, trigger)),
295
303
  React.createElement(TabTrap, { focusNextCallback: () => { var _a; return dropdownRef.current && ((_a = getFirstFocusable(dropdownRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus }),
296
304
  React.createElement(DropdownContainer, { triggerRef: triggerRef, renderWithPortal: expandToViewport && !interior, id: dropdownId, referrerId: referrerId, open: open },
297
305
  React.createElement(Transition, { in: open !== null && open !== void 0 ? open : false, exit: false }, (state, ref) => (React.createElement("div", { ref: dropdownContainerRef },
298
306
  React.createElement(TabTrap, { focusNextCallback: () => { var _a; return triggerRef.current && ((_a = getLastFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus }),
299
- React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, matchTriggerWidth: matchTriggerWidth, hideBlockBorder: hideBlockBorder, interior: interior, header: header, content: content, expandToViewport: expandToViewport, minWidth: getMinWidthCssValue(), maxWidth: getMaxWidthCssValue(), footer: footer, onMouseDown: onMouseDown, onFocusEnter: focusEnterHandler, onFocusLeave: focusLeaveHandler, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position, id: dropdownContentId, ariaRole: ariaRole, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby }),
307
+ React.createElement(TransitionContent, { state: state, transitionRef: ref, dropdownClasses: dropdownClasses, open: open, matchTriggerWidth: matchTriggerWidth, hideBlockBorder: hideBlockBorder, interior: interior, header: header, content: content, expandToViewport: expandToViewport, minWidth: getMinWidthCssValue(), maxWidth: getMaxWidthCssValue(), footer: footer, onMouseDown: onMouseDown, onFocusEnter: focusEnterHandler, onFocusLeave: focusLeaveHandler, isRefresh: isRefresh, dropdownRef: dropdownRef, verticalContainerRef: verticalContainerRef, position: position, id: dropdownContentId, ariaRole: ariaRole, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, dropdownStyle: getDropdownStyles(style) }),
300
308
  React.createElement(TabTrap, { focusNextCallback: () => { var _a; return triggerRef.current && ((_a = getFirstFocusable(triggerRef.current)) === null || _a === void 0 ? void 0 : _a.focus()); }, disabled: !open || !loopFocus })))))));
301
309
  };
302
310
  const isInteriorPosition = (position) => position.insetBlockEnd !== undefined;
303
- export default Dropdown;
304
- //# sourceMappingURL=index.js.map
311
+ export default InternalDropdown;
312
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/dropdown/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC7G,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,OAAO,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAoB,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AACvF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE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AI,EACV,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,iBAAiB,EAC/B,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,GACvC;gBAEF,oBAAC,OAAO,IACN,iBAAiB,EAAE,GAAG,EAAE,WAAC,OAAA,UAAU,CAAC,OAAO,KAAI,MAAA,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAA,CAAA,EAAA,EAC7F,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAC7B,CACE,CACP,CACU,CACK,CAChB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,QAAqD,EACf,EAAE,CAAE,QAAqC,CAAC,aAAa,KAAK,SAAS,CAAC;AAE9G,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { getFirstFocusable, getLastFocusable } from '../internal/components/focus-lock/utils.js';\nimport TabTrap from '../internal/components/tab-trap/index.js';\nimport { Transition, TransitionStatus } from '../internal/components/transition';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport { DropdownContextProvider, DropdownContextProviderProps } from './context';\nimport {\n calculatePosition,\n DropdownPosition,\n hasEnoughSpaceForFlexibleWidth,\n InteriorDropdownPosition,\n} from './dropdown-fit-handler';\nimport { applyDropdownPositionRelativeToViewport, LogicalDOMRect } from './dropdown-position';\nimport { DropdownAlignment, DropdownProps, DropdownWidthConstraint } from './interfaces';\nimport { getDropdownStyles } from './style';\n\nexport interface InternalDropdownProps\n extends Omit<DropdownProps, 'minWidth' | 'maxWidth'>,\n InternalBaseComponentProps {\n onMouseDown?: React.MouseEventHandler;\n contentKey?: string;\n dropdownId?: string;\n dropdownContentId?: string;\n stretchHeight?: boolean;\n stretchTriggerHeight?: boolean;\n interior?: boolean;\n scrollable?: boolean;\n loopFocus?: boolean;\n minWidth?: DropdownWidthConstraint;\n maxWidth?: DropdownWidthConstraint;\n preferredAlignment?: DropdownAlignment;\n hideBlockBorder?: boolean;\n onFocus?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n onBlur?: NonCancelableEventHandler<Pick<React.FocusEvent, 'target' | 'relatedTarget'>>;\n}\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface DropdownContainerProps {\n triggerRef: React.RefObject<HTMLElement>;\n children?: React.ReactNode;\n renderWithPortal: boolean;\n id?: string;\n referrerId?: string;\n open?: boolean;\n}\n\nconst DropdownContainer = ({\n triggerRef,\n children,\n renderWithPortal,\n id,\n referrerId,\n open,\n}: DropdownContainerProps) => {\n if (!renderWithPortal) {\n return <>{children}</>;\n }\n if (!open) {\n return null;\n }\n const currentDocument = triggerRef.current?.ownerDocument ?? document;\n return createPortal(\n <div id={id} data-awsui-referrer-id={referrerId}>\n {children}\n </div>,\n currentDocument.body\n );\n};\n\ninterface TransitionContentProps {\n state: TransitionStatus;\n transitionRef: React.MutableRefObject<any>;\n dropdownClasses: string;\n matchTriggerWidth: boolean;\n hideBlockBorder: boolean;\n interior: boolean;\n isRefresh: boolean;\n dropdownRef: React.RefObject<HTMLDivElement>;\n verticalContainerRef: React.RefObject<HTMLDivElement>;\n expandToViewport?: boolean;\n minWidth?: string;\n maxWidth?: string;\n header?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n position?: DropdownContextProviderProps['position'];\n open?: boolean;\n onMouseDown?: React.MouseEventHandler<Element>;\n onFocusEnter?: React.FocusEventHandler<Element>;\n onFocusLeave?: React.FocusEventHandler<Element>;\n id?: string;\n ariaRole?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n dropdownStyle?: React.CSSProperties;\n}\n\nconst TransitionContent = ({\n state,\n transitionRef,\n dropdownClasses,\n matchTriggerWidth,\n hideBlockBorder,\n interior,\n isRefresh,\n dropdownRef,\n verticalContainerRef,\n expandToViewport,\n minWidth,\n maxWidth,\n header,\n content,\n footer,\n position,\n open,\n onMouseDown,\n onFocusEnter,\n onFocusLeave,\n id,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n dropdownStyle,\n}: TransitionContentProps) => {\n const contentRef = useMergeRefs(dropdownRef, transitionRef);\n const dropdownStyles: Record<string, string> = {};\n if (minWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMinWidth] = minWidth;\n }\n if (maxWidth) {\n dropdownStyles[customCssProps.dropdownDefaultMaxWidth] = maxWidth;\n }\n return (\n <div\n className={clsx(styles.dropdown, dropdownClasses, {\n [styles.open]: open,\n [styles['with-limited-width']]: !matchTriggerWidth,\n [styles['hide-block-border']]: hideBlockBorder,\n [styles.interior]: interior,\n [styles.refresh]: isRefresh,\n [styles['use-portal']]: expandToViewport && !interior,\n [styles['use-flexible-width']]: !matchTriggerWidth && !interior,\n })}\n ref={contentRef}\n id={id}\n role={ariaRole}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n data-open={open}\n data-animating={state !== 'exited'}\n aria-hidden={!open}\n style={dropdownStyles}\n onMouseDown={onMouseDown}\n onFocus={onFocusEnter}\n onBlur={onFocusLeave}\n >\n <div\n className={clsx(\n styles['dropdown-content-wrapper'],\n !header && !content && styles['is-empty'],\n isRefresh && styles.refresh\n )}\n style={dropdownStyle}\n >\n <div ref={verticalContainerRef} className={styles['dropdown-content']}>\n <DropdownContextProvider position={position}>\n {header && <div className={testUtilStyles.header}>{header}</div>}\n {content}\n {footer && <div className={testUtilStyles.footer}>{footer}</div>}\n </DropdownContextProvider>\n </div>\n </div>\n </div>\n );\n};\n\nconst InternalDropdown = ({\n content,\n trigger,\n triggerRef: externalTriggerRef,\n triggerId: externalTriggerId,\n open,\n onOutsideClick,\n onMouseDown,\n header,\n footer,\n dropdownId,\n stretchTriggerHeight = false,\n stretchHeight = false,\n minWidth,\n maxWidth,\n maxHeight,\n hideBlockBorder = true,\n expandToViewport = false,\n preferredAlignment = 'start',\n interior = false,\n scrollable = true,\n loopFocus = expandToViewport,\n onFocus,\n onBlur,\n onFocusEnter,\n onFocusLeave,\n onEscape,\n contentKey,\n dropdownContentId,\n ariaRole,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n style,\n __internalRootRef,\n ...restProps\n}: InternalDropdownProps) => {\n const baseProps = getBaseProps(restProps);\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const mergedRef = useMergeRefs(wrapperRef, __internalRootRef);\n const internalTriggerRef = useRef<HTMLDivElement | null>(null);\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n const dropdownContainerRef = useRef<HTMLDivElement | null>(null);\n const verticalContainerRef = useRef<HTMLDivElement>(null);\n // To keep track of the initial position (drop up/down) which is kept the same during fixed repositioning\n const fixedPosition = useRef<DropdownPosition | null>(null);\n\n // Use external trigger ref if provided, otherwise use internal ref\n const triggerRef = externalTriggerRef || internalTriggerRef;\n\n const isRefresh = useVisualRefresh();\n\n const dropdownClasses = usePortalModeClasses(triggerRef);\n const [position, setPosition] = useState<DropdownContextProviderProps['position']>('bottom-right');\n\n const isMobile = useMobile();\n\n // Derive if dropdown should match trigger width exactly\n // This happens when both minWidth and maxWidth are explicitly set to 'trigger'\n const matchTriggerWidth = minWidth === 'trigger' && maxWidth === 'trigger';\n\n // Convert preferredAlignment to boolean for internal positioning logic\n const preferCenter = preferredAlignment === 'center';\n\n const setDropdownPosition = (\n position: DropdownPosition | InteriorDropdownPosition,\n triggerBox: LogicalDOMRect,\n target: HTMLDivElement,\n verticalContainer: HTMLDivElement\n ) => {\n verticalContainer.style.maxBlockSize = position.blockSize;\n\n // Only apply occupy-entire-width when matching trigger width exactly and not in portal mode\n if (!interior && matchTriggerWidth && !expandToViewport) {\n target.classList.add(styles['occupy-entire-width']);\n } else {\n target.style.inlineSize = position.inlineSize;\n }\n\n // Using styles for main dropdown to adjust its position as preferred alternative\n if (position.dropBlockStart && !interior) {\n target.classList.add(styles['dropdown-drop-up']);\n if (!expandToViewport) {\n target.style.insetBlockEnd = '100%';\n }\n } else {\n target.classList.remove(styles['dropdown-drop-up']);\n }\n target.classList.add(position.dropInlineStart ? styles['dropdown-drop-left'] : styles['dropdown-drop-right']);\n\n if (position.insetInlineStart && position.insetInlineStart !== 'auto') {\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n // Position normal overflow dropdowns with fixed positioning relative to viewport\n if (expandToViewport && !interior) {\n applyDropdownPositionRelativeToViewport({\n position,\n dropdownElement: target,\n triggerRect: triggerBox,\n isMobile,\n });\n // Keep track of the initial dropdown position and direction.\n // Dropdown direction doesn't need to change as the user scrolls, just needs to stay attached to the trigger.\n fixedPosition.current = position;\n return;\n }\n\n // For an interior dropdown (the fly out) we need exact values for positioning\n // and classes are not enough\n // usage of relative position is impossible due to overwrite of overflow-x\n if (interior && isInteriorPosition(position)) {\n if (position.dropBlockStart) {\n target.style.insetBlockEnd = position.insetBlockEnd;\n } else {\n target.style.insetBlockStart = position.insetBlockStart;\n }\n target.style.insetInlineStart = position.insetInlineStart;\n }\n\n if (position.dropBlockStart && position.dropInlineStart) {\n setPosition('top-left');\n } else if (position.dropBlockStart) {\n setPosition('top-right');\n } else if (position.dropInlineStart) {\n setPosition('bottom-left');\n } else {\n setPosition('bottom-right');\n }\n };\n\n const isOutsideDropdown = (element: Element) =>\n (!wrapperRef.current || !nodeBelongs(wrapperRef.current, element)) &&\n (!dropdownContainerRef.current || !nodeBelongs(dropdownContainerRef.current, element));\n\n const focusHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onFocus, event);\n }\n };\n\n const blurHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdown(event.relatedTarget)) {\n fireNonCancelableEvent(onBlur, event);\n }\n };\n\n const isOutsideDropdownContent = (element: Element) =>\n !dropdownRef.current || !nodeBelongs(dropdownRef.current, element);\n\n const focusEnterHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {\n fireNonCancelableEvent(onFocusEnter, event);\n }\n };\n\n const focusLeaveHandler = (event: React.FocusEvent) => {\n if (!event.relatedTarget || isOutsideDropdownContent(event.relatedTarget)) {\n fireNonCancelableEvent(onFocusLeave, event);\n }\n };\n\n // Check if the dropdown has enough space to fit with its desired width constraints\n // If not, remove the class that allows flexible width sizing\n const fixStretching = () => {\n const classNameToRemove = styles['use-flexible-width'];\n if (\n open &&\n dropdownRef.current &&\n triggerRef.current &&\n dropdownRef.current.classList.contains(classNameToRemove) &&\n !hasEnoughSpaceForFlexibleWidth({\n triggerElement: triggerRef.current,\n dropdownElement: dropdownRef.current,\n minWidthConstraint: minWidth,\n maxWidthConstraint: maxWidth,\n expandToViewport,\n stretchHeight,\n isMobile,\n })\n ) {\n dropdownRef.current.classList.remove(classNameToRemove);\n }\n };\n\n useResizeObserver(() => dropdownRef.current, fixStretching);\n\n useLayoutEffect(() => {\n const onDropdownOpen = () => {\n if (open && dropdownRef.current && triggerRef.current && verticalContainerRef.current) {\n if (scrollable) {\n dropdownRef.current.classList.add(styles.nowrap);\n }\n\n setDropdownPosition(\n ...calculatePosition(\n dropdownRef.current,\n triggerRef.current,\n verticalContainerRef.current,\n interior,\n expandToViewport,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n minWidth,\n maxWidth,\n maxHeight\n ),\n dropdownRef.current,\n verticalContainerRef.current\n );\n\n if (scrollable) {\n dropdownRef.current.classList.remove(styles.nowrap);\n }\n }\n };\n onDropdownOpen();\n\n if (open) {\n // window may scroll when dropdown opens, for example when soft keyboard shows up\n window.addEventListener('scroll', onDropdownOpen);\n // only listen to window scroll within very short time after the dropdown opens\n // do not want to interfere dropdown position on scroll afterwards\n const timeoutId = setTimeout(() => {\n window.removeEventListener('scroll', onDropdownOpen);\n }, 500);\n\n return () => {\n clearTimeout(timeoutId);\n window.removeEventListener('scroll', onDropdownOpen);\n };\n }\n // See AWSUI-13040\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, dropdownRef, triggerRef, verticalContainerRef, interior, matchTriggerWidth, isMobile, contentKey]);\n\n // subscribe to outside click\n useEffect(() => {\n if (!open) {\n return;\n }\n const clickListener = (event: MouseEvent) => {\n // Since the listener is registered on the window, `event.target` will incorrectly point at the\n // shadow root if the component is rendered inside shadow DOM.\n const target = event.composedPath ? event.composedPath()[0] : event.target;\n // For internal triggers, the wrapper div itself counts as outside — only its children are the trigger.\n // For external triggers, the ref is the trigger element directly, so it counts as inside.\n const isOutsideTrigger =\n !nodeBelongs(triggerRef.current, target) || (!externalTriggerRef && target === triggerRef.current);\n\n if (!nodeBelongs(dropdownRef.current, target) && isOutsideTrigger) {\n fireNonCancelableEvent(onOutsideClick);\n }\n };\n window.addEventListener('click', clickListener, true);\n\n return () => {\n window.removeEventListener('click', clickListener, true);\n };\n }, [open, onOutsideClick, triggerRef, externalTriggerRef]);\n\n // subscribe to Escape key press\n useEffect(() => {\n // Only add the listener if onEscape callback is provided\n if (!open || !onEscape) {\n return;\n }\n const keydownListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n // Prevent any surrounding modals or dialogs from acting on this Escape key\n event.stopPropagation();\n fireNonCancelableEvent(onEscape);\n }\n };\n window.addEventListener('keydown', keydownListener, true);\n\n return () => {\n window.removeEventListener('keydown', keydownListener, true);\n };\n }, [open, onEscape]);\n\n // sync dropdown position on scroll and resize\n useLayoutEffect(() => {\n if (!expandToViewport || !open) {\n return;\n }\n const updateDropdownPosition = () => {\n if (triggerRef.current && dropdownRef.current && verticalContainerRef.current && fixedPosition.current) {\n applyDropdownPositionRelativeToViewport({\n position: fixedPosition.current,\n dropdownElement: dropdownRef.current,\n triggerRect: getLogicalBoundingClientRect(triggerRef.current),\n isMobile,\n });\n }\n };\n\n updateDropdownPosition();\n\n const controller = new AbortController();\n window.addEventListener('scroll', updateDropdownPosition, { capture: true, signal: controller.signal });\n window.addEventListener('resize', updateDropdownPosition, { capture: true, signal: controller.signal });\n return () => {\n controller.abort();\n };\n }, [open, expandToViewport, isMobile, triggerRef]);\n\n const generatedReferrerId = useUniqueId();\n const referrerId = externalTriggerId || generatedReferrerId;\n\n // Compute CSS variable values for min/max width\n // These will be used by the use-flexible-width CSS class\n const getMinWidthCssValue = (): string | undefined => {\n if (minWidth === undefined) {\n return undefined;\n }\n if (typeof minWidth === 'number') {\n return `${minWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n const getMaxWidthCssValue = (): string | undefined => {\n if (maxWidth === undefined) {\n return 'none';\n }\n if (typeof maxWidth === 'number') {\n return `${maxWidth}px`;\n }\n // 'trigger' maps to 100% (relative to parent)\n return '100%';\n };\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n interior && styles.interior,\n stretchTriggerHeight && styles['stretch-trigger-height'],\n baseProps.className\n )}\n ref={mergedRef}\n onFocus={focusHandler}\n onBlur={blurHandler}\n >\n {!externalTriggerRef && (\n <div\n id={referrerId}\n className={clsx(stretchTriggerHeight && styles['stretch-trigger-height'], testUtilStyles.trigger)}\n ref={internalTriggerRef}\n >\n {trigger}\n </div>\n )}\n\n <TabTrap\n focusNextCallback={() => dropdownRef.current && getFirstFocusable(dropdownRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <DropdownContainer\n triggerRef={triggerRef}\n renderWithPortal={expandToViewport && !interior}\n id={dropdownId}\n referrerId={referrerId}\n open={open}\n >\n <Transition in={open ?? false} exit={false}>\n {(state, ref) => (\n <div ref={dropdownContainerRef}>\n <TabTrap\n focusNextCallback={() => triggerRef.current && getLastFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n\n <TransitionContent\n state={state}\n transitionRef={ref}\n dropdownClasses={dropdownClasses}\n open={open}\n matchTriggerWidth={matchTriggerWidth}\n hideBlockBorder={hideBlockBorder}\n interior={interior}\n header={header}\n content={content}\n expandToViewport={expandToViewport}\n minWidth={getMinWidthCssValue()}\n maxWidth={getMaxWidthCssValue()}\n footer={footer}\n onMouseDown={onMouseDown}\n onFocusEnter={focusEnterHandler}\n onFocusLeave={focusLeaveHandler}\n isRefresh={isRefresh}\n dropdownRef={dropdownRef}\n verticalContainerRef={verticalContainerRef}\n position={position}\n id={dropdownContentId}\n ariaRole={ariaRole}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n dropdownStyle={getDropdownStyles(style)}\n />\n\n <TabTrap\n focusNextCallback={() => triggerRef.current && getFirstFocusable(triggerRef.current)?.focus()}\n disabled={!open || !loopFocus}\n />\n </div>\n )}\n </Transition>\n </DropdownContainer>\n </div>\n );\n};\n\nconst isInteriorPosition = (\n position: DropdownPosition | InteriorDropdownPosition\n): position is InteriorDropdownPosition => (position as InteriorDropdownPosition).insetBlockEnd !== undefined;\n\nexport default InternalDropdown;\n"]}
@@ -0,0 +1,9 @@
1
+ import customCssProps from '../internal/generated/custom-css-properties';
2
+ import { DropdownProps } from './interfaces';
3
+ export declare function getDropdownStyles(style: DropdownProps['style']): {
4
+ [customCssProps.dropdownContentBorderColor]: string | undefined;
5
+ [customCssProps.dropdownContentBorderWidth]: string | undefined;
6
+ [customCssProps.dropdownContentBorderRadius]: string | undefined;
7
+ background: string | undefined;
8
+ } | undefined;
9
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/dropdown/style.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAO3D,CAAC,cAAc,CAAC,0BAA0B,CAAC,qBAA4B;IACvE,CAAC,cAAc,CAAC,0BAA0B,CAAC,qBAA4B;IACvE,CAAC,cAAc,CAAC,2BAA2B,CAAC,qBAA6B;;cAE5E"}
@@ -0,0 +1,16 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { SYSTEM } from '../internal/environment';
4
+ import customCssProps from '../internal/generated/custom-css-properties';
5
+ export function getDropdownStyles(style) {
6
+ if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.dropdown)) {
7
+ return undefined;
8
+ }
9
+ return {
10
+ background: style.dropdown.background,
11
+ [customCssProps.dropdownContentBorderColor]: style.dropdown.borderColor,
12
+ [customCssProps.dropdownContentBorderWidth]: style.dropdown.borderWidth,
13
+ [customCssProps.dropdownContentBorderRadius]: style.dropdown.borderRadius,
14
+ };
15
+ }
16
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/dropdown/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAGzE,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAA,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU;QACrC,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW;QACvE,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW;QACvE,CAAC,cAAc,CAAC,2BAA2B,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,YAAY;KAC1E,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../internal/environment';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { DropdownProps } from './interfaces';\n\nexport function getDropdownStyles(style: DropdownProps['style']) {\n if (SYSTEM !== 'core' || !style?.dropdown) {\n return undefined;\n }\n\n return {\n background: style.dropdown.background,\n [customCssProps.dropdownContentBorderColor]: style.dropdown.borderColor,\n [customCssProps.dropdownContentBorderWidth]: style.dropdown.borderWidth,\n [customCssProps.dropdownContentBorderRadius]: style.dropdown.borderRadius,\n };\n}\n"]}
@@ -0,0 +1,25 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "dropdown-content-wrapper": "awsui_dropdown-content-wrapper_9duf6_1a14x_153",
5
+ "awsui-motion-fade-in-dropdown": "awsui_awsui-motion-fade-in-dropdown_9duf6_1a14x_1",
6
+ "refresh": "awsui_refresh_9duf6_1a14x_174",
7
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_9duf6_1a14x_1",
8
+ "root": "awsui_root_9duf6_1a14x_199",
9
+ "interior": "awsui_interior_9duf6_1a14x_232",
10
+ "dropdown": "awsui_dropdown_9duf6_1a14x_153",
11
+ "use-portal": "awsui_use-portal_9duf6_1a14x_242",
12
+ "is-empty": "awsui_is-empty_9duf6_1a14x_318",
13
+ "dropdown-drop-up": "awsui_dropdown-drop-up_9duf6_1a14x_325",
14
+ "with-limited-width": "awsui_with-limited-width_9duf6_1a14x_329",
15
+ "dropdown-drop-left": "awsui_dropdown-drop-left_9duf6_1a14x_332",
16
+ "dropdown-drop-right": "awsui_dropdown-drop-right_9duf6_1a14x_335",
17
+ "occupy-entire-width": "awsui_occupy-entire-width_9duf6_1a14x_338",
18
+ "use-flexible-width": "awsui_use-flexible-width_9duf6_1a14x_341",
19
+ "hide-block-border": "awsui_hide-block-border_9duf6_1a14x_349",
20
+ "open": "awsui_open_9duf6_1a14x_358",
21
+ "nowrap": "awsui_nowrap_9duf6_1a14x_367",
22
+ "dropdown-content": "awsui_dropdown-content_9duf6_1a14x_153",
23
+ "stretch-trigger-height": "awsui_stretch-trigger-height_9duf6_1a14x_378"
24
+ };
25
+