@primer/react 0.0.0-20260428150519 → 0.0.0-20260428191209

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 (362) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/ActionBar/ActionBar.js +705 -502
  3. package/dist/ActionBar/ActionBar.module.css.js +5 -10
  4. package/dist/ActionBar/index.js +8 -8
  5. package/dist/ActionList/{ActionList-53389912.css → ActionList-09f5c4a8.css} +2 -2
  6. package/dist/ActionList/ActionList-09f5c4a8.css.map +1 -0
  7. package/dist/ActionList/ActionList.module.css.js +5 -31
  8. package/dist/ActionList/ActionListContainerContext.js +5 -4
  9. package/dist/ActionList/Description.js +133 -117
  10. package/dist/ActionList/Divider.js +38 -31
  11. package/dist/ActionList/Group.js +349 -292
  12. package/dist/ActionList/Group.module.css.js +5 -10
  13. package/dist/ActionList/Heading.js +106 -88
  14. package/dist/ActionList/Heading.module.css.js +5 -5
  15. package/dist/ActionList/Item.js +811 -668
  16. package/dist/ActionList/LinkItem.js +56 -36
  17. package/dist/ActionList/List.js +210 -168
  18. package/dist/ActionList/Selection.d.ts +2 -3
  19. package/dist/ActionList/Selection.d.ts.map +1 -1
  20. package/dist/ActionList/Selection.js +112 -83
  21. package/dist/ActionList/TrailingAction.js +112 -97
  22. package/dist/ActionList/Visuals.js +191 -143
  23. package/dist/ActionList/index.d.ts +7 -0
  24. package/dist/ActionList/index.d.ts.map +1 -1
  25. package/dist/ActionList/index.js +38 -33
  26. package/dist/ActionList/shared.js +9 -5
  27. package/dist/ActionMenu/ActionMenu.js +310 -223
  28. package/dist/ActionMenu/ActionMenu.module.css.js +5 -5
  29. package/dist/AnchoredOverlay/AnchoredOverlay.js +280 -206
  30. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +5 -9
  31. package/dist/Autocomplete/Autocomplete.js +141 -125
  32. package/dist/Autocomplete/AutocompleteContext.js +20 -18
  33. package/dist/Autocomplete/AutocompleteInput.js +146 -108
  34. package/dist/Autocomplete/AutocompleteMenu.js +238 -201
  35. package/dist/Autocomplete/AutocompleteMenu.module.css.js +5 -8
  36. package/dist/Autocomplete/AutocompleteOverlay.js +79 -54
  37. package/dist/Autocomplete/AutocompleteOverlay.module.css.js +5 -5
  38. package/dist/Avatar/Avatar.js +133 -106
  39. package/dist/Avatar/Avatar.module.css.js +5 -5
  40. package/dist/AvatarStack/AvatarStack.js +143 -102
  41. package/dist/AvatarStack/AvatarStack.module.css.js +5 -9
  42. package/dist/Banner/Banner.js +186 -133
  43. package/dist/Banner/Banner.module.css.js +5 -14
  44. package/dist/Banner/index.js +7 -7
  45. package/dist/BaseStyles.js +91 -74
  46. package/dist/BaseStyles.module.css.js +5 -5
  47. package/dist/Blankslate/Blankslate.js +328 -266
  48. package/dist/Blankslate/Blankslate.module.css.js +5 -12
  49. package/dist/Blankslate/BlankslateContext.js +9 -7
  50. package/dist/Blankslate/index.js +9 -9
  51. package/dist/BranchName/BranchName.js +59 -49
  52. package/dist/BranchName/BranchName.module.css.js +5 -5
  53. package/dist/Breadcrumbs/Breadcrumbs.js +431 -371
  54. package/dist/Breadcrumbs/Breadcrumbs.module.css.js +5 -15
  55. package/dist/Button/Button.js +18 -15
  56. package/dist/Button/ButtonBase.js +139 -76
  57. package/dist/Button/ButtonBase.module.css.js +5 -16
  58. package/dist/Button/IconButton.js +74 -42
  59. package/dist/Button/LinkButton.js +17 -13
  60. package/dist/ButtonGroup/ButtonGroup.js +97 -80
  61. package/dist/ButtonGroup/ButtonGroup.module.css.js +5 -5
  62. package/dist/Card/Card.js +491 -401
  63. package/dist/Card/Card.module.css.js +5 -18
  64. package/dist/Card/index.js +9 -9
  65. package/dist/Checkbox/Checkbox.js +71 -52
  66. package/dist/Checkbox/Checkbox.module.css.js +5 -9
  67. package/dist/Checkbox/shared.module.css.js +5 -5
  68. package/dist/CheckboxGroup/CheckboxGroup.js +132 -111
  69. package/dist/CheckboxGroup/CheckboxGroupContext.js +4 -4
  70. package/dist/CircleBadge/CircleBadge.js +90 -77
  71. package/dist/CircleBadge/CircleBadge.module.css.js +5 -8
  72. package/dist/ConfirmationDialog/ConfirmationDialog.js +92 -68
  73. package/dist/CounterLabel/CounterLabel.js +99 -83
  74. package/dist/CounterLabel/CounterLabel.module.css.js +5 -5
  75. package/dist/DataTable/DataTable.js +140 -100
  76. package/dist/DataTable/ErrorDialog.js +45 -33
  77. package/dist/DataTable/Pagination.js +592 -464
  78. package/dist/DataTable/Pagination.module.css.js +5 -13
  79. package/dist/DataTable/Table.js +710 -527
  80. package/dist/DataTable/Table.module.css.js +5 -26
  81. package/dist/DataTable/column.js +11 -10
  82. package/dist/DataTable/index.js +20 -22
  83. package/dist/DataTable/sorting.js +103 -65
  84. package/dist/DataTable/useTable.js +290 -207
  85. package/dist/Details/Details.js +126 -100
  86. package/dist/Details/Details.module.css.js +5 -5
  87. package/dist/Dialog/Dialog.js +351 -259
  88. package/dist/Dialog/Dialog.module.css.js +5 -22
  89. package/dist/FeatureFlags/DefaultFeatureFlags.js +7 -7
  90. package/dist/FeatureFlags/FeatureFlagContext.js +5 -5
  91. package/dist/FeatureFlags/FeatureFlagScope.js +44 -36
  92. package/dist/FeatureFlags/FeatureFlags.js +37 -29
  93. package/dist/FeatureFlags/useFeatureFlag.js +19 -17
  94. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  95. package/dist/FilteredActionList/FilteredActionList.js +559 -454
  96. package/dist/FilteredActionList/FilteredActionList.module.css.js +5 -15
  97. package/dist/FilteredActionList/FilteredActionListInput.d.ts +15 -0
  98. package/dist/FilteredActionList/FilteredActionListInput.d.ts.map +1 -0
  99. package/dist/FilteredActionList/FilteredActionListInput.js +119 -0
  100. package/dist/FilteredActionList/FilteredActionListLoaders.js +150 -119
  101. package/dist/FilteredActionList/FilteredActionListLoaders.module.css.js +5 -9
  102. package/dist/FilteredActionList/index.d.ts +9 -1
  103. package/dist/FilteredActionList/index.d.ts.map +1 -1
  104. package/dist/FilteredActionList/index.js +11 -0
  105. package/dist/FilteredActionList/useAnnouncements.js +180 -167
  106. package/dist/Flash/Flash.js +69 -57
  107. package/dist/Flash/Flash.module.css.js +5 -5
  108. package/dist/FormControl/FormControl.js +227 -211
  109. package/dist/FormControl/FormControl.module.css.js +5 -11
  110. package/dist/FormControl/FormControlCaption.js +49 -37
  111. package/dist/FormControl/FormControlCaption.module.css.js +5 -5
  112. package/dist/FormControl/FormControlLabel.js +115 -95
  113. package/dist/FormControl/FormControlLeadingVisual.js +37 -29
  114. package/dist/FormControl/FormControlLeadingVisual.module.css.js +5 -5
  115. package/dist/FormControl/_FormControlContext.js +48 -41
  116. package/dist/FormControl/_FormControlValidation.js +39 -29
  117. package/dist/Header/Header.js +165 -138
  118. package/dist/Header/Header.module.css.js +5 -9
  119. package/dist/Heading/Heading.js +37 -26
  120. package/dist/Heading/Heading.module.css.js +5 -5
  121. package/dist/Hidden/Hidden.js +77 -54
  122. package/dist/Hidden/Hidden.module.css.js +5 -5
  123. package/dist/InlineMessage/InlineMessage.js +116 -88
  124. package/dist/InlineMessage/InlineMessage.module.css.js +5 -8
  125. package/dist/KeybindingHint/KeybindingHint.js +88 -70
  126. package/dist/KeybindingHint/KeybindingHint.module.css.js +5 -5
  127. package/dist/KeybindingHint/components/Chord.js +93 -81
  128. package/dist/KeybindingHint/components/Chord.module.css.js +5 -11
  129. package/dist/KeybindingHint/components/Key.js +66 -49
  130. package/dist/KeybindingHint/components/Sequence.js +24 -12
  131. package/dist/KeybindingHint/key-names.js +114 -99
  132. package/dist/Label/Label.js +66 -56
  133. package/dist/Label/Label.module.css.js +5 -5
  134. package/dist/Label/index.js +5 -5
  135. package/dist/LabelGroup/LabelGroup.js +344 -260
  136. package/dist/LabelGroup/LabelGroup.module.css.js +5 -12
  137. package/dist/Link/Link.js +47 -31
  138. package/dist/Link/Link.module.css.js +5 -5
  139. package/dist/NavList/NavList.js +614 -424
  140. package/dist/NavList/NavList.module.css.js +5 -5
  141. package/dist/Octicon/Octicon.js +37 -35
  142. package/dist/Overlay/Overlay.js +318 -264
  143. package/dist/Overlay/Overlay.module.css.js +5 -8
  144. package/dist/PageHeader/PageHeader.js +823 -579
  145. package/dist/PageHeader/PageHeader.module.css.js +5 -21
  146. package/dist/PageLayout/PageLayout.js +913 -631
  147. package/dist/PageLayout/PageLayout.module.css.js +5 -31
  148. package/dist/PageLayout/paneUtils.js +29 -15
  149. package/dist/PageLayout/usePaneWidth.js +437 -334
  150. package/dist/Pagehead/Pagehead.js +14 -10
  151. package/dist/Pagehead/Pagehead.module.css.js +5 -5
  152. package/dist/Pagination/Pagination.js +114 -84
  153. package/dist/Pagination/Pagination.module.css.js +5 -9
  154. package/dist/Pagination/index.js +5 -5
  155. package/dist/Pagination/model.js +194 -118
  156. package/dist/Popover/Popover.js +151 -126
  157. package/dist/Popover/Popover.module.css.js +5 -8
  158. package/dist/Portal/Portal.js +85 -65
  159. package/dist/Portal/index.js +6 -5
  160. package/dist/ProgressBar/ProgressBar.js +255 -210
  161. package/dist/ProgressBar/ProgressBar.module.css.js +5 -9
  162. package/dist/ProgressBar/index.js +8 -6
  163. package/dist/Radio/Radio.js +115 -97
  164. package/dist/Radio/Radio.module.css.js +5 -5
  165. package/dist/RadioGroup/RadioGroup.js +118 -99
  166. package/dist/RelativeTime/RelativeTime.js +76 -64
  167. package/dist/ScrollableRegion/ScrollableRegion.js +79 -67
  168. package/dist/ScrollableRegion/ScrollableRegion.module.css.js +5 -5
  169. package/dist/SegmentedControl/SegmentedControl.js +287 -238
  170. package/dist/SegmentedControl/SegmentedControl.module.css.js +5 -15
  171. package/dist/SegmentedControl/SegmentedControlButton.js +187 -156
  172. package/dist/SegmentedControl/SegmentedControlIconButton.js +161 -133
  173. package/dist/Select/Select.js +234 -185
  174. package/dist/Select/Select.module.css.js +5 -10
  175. package/dist/SelectPanel/SelectPanel.d.ts +1 -0
  176. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  177. package/dist/SelectPanel/SelectPanel.js +829 -620
  178. package/dist/SelectPanel/SelectPanel.module.css.js +5 -27
  179. package/dist/SelectPanel/SelectPanelMessage.js +39 -37
  180. package/dist/SelectPanel/index.d.ts +1 -0
  181. package/dist/SelectPanel/index.d.ts.map +1 -1
  182. package/dist/SideNav.js +47 -24
  183. package/dist/SideNav.module.css.js +5 -12
  184. package/dist/Skeleton/SkeletonBox.js +111 -94
  185. package/dist/Skeleton/SkeletonBox.module.css.js +5 -8
  186. package/dist/SkeletonAvatar/SkeletonAvatar.js +120 -95
  187. package/dist/SkeletonAvatar/SkeletonAvatar.module.css.js +5 -5
  188. package/dist/SkeletonText/SkeletonText.js +137 -114
  189. package/dist/SkeletonText/SkeletonText.module.css.js +5 -8
  190. package/dist/Spinner/Spinner.js +211 -183
  191. package/dist/Spinner/Spinner.module.css.js +5 -9
  192. package/dist/SplitPageLayout/SplitPageLayout.js +276 -215
  193. package/dist/Stack/Stack.js +255 -207
  194. package/dist/Stack/Stack.module.css.js +5 -8
  195. package/dist/Stack/index.js +6 -4
  196. package/dist/StateLabel/StateLabel.js +123 -110
  197. package/dist/StateLabel/StateLabel.module.css.js +5 -8
  198. package/dist/SubNav/SubNav.js +197 -159
  199. package/dist/SubNav/SubNav.module.css.js +5 -11
  200. package/dist/TabNav/TabNav.js +199 -167
  201. package/dist/TabNav/TabNav.module.css.js +5 -10
  202. package/dist/Text/Text.js +67 -56
  203. package/dist/Text/Text.module.css.js +5 -5
  204. package/dist/TextInput/TextInput.js +228 -195
  205. package/dist/TextInput/TextInput.module.css.js +5 -8
  206. package/dist/TextInputWithTokens/TextInputWithTokens.js +673 -567
  207. package/dist/TextInputWithTokens/TextInputWithTokens.module.css.js +5 -14
  208. package/dist/Textarea/TextArea.module.css.js +5 -9
  209. package/dist/Textarea/Textarea.js +294 -264
  210. package/dist/ThemeProvider.js +257 -199
  211. package/dist/Timeline/Timeline.js +247 -204
  212. package/dist/Timeline/Timeline.module.css.js +5 -12
  213. package/dist/ToggleSwitch/ToggleSwitch.js +471 -403
  214. package/dist/ToggleSwitch/ToggleSwitch.module.css.js +5 -16
  215. package/dist/Token/IssueLabelToken.js +297 -256
  216. package/dist/Token/IssueLabelToken.module.css.js +5 -8
  217. package/dist/Token/Token.js +280 -232
  218. package/dist/Token/Token.module.css.js +5 -9
  219. package/dist/Token/TokenBase.js +126 -99
  220. package/dist/Token/TokenBase.module.css.js +5 -5
  221. package/dist/Token/_RemoveTokenButton.js +48 -27
  222. package/dist/Token/_RemoveTokenButton.module.css.js +5 -5
  223. package/dist/Token/_TokenTextContainer.js +65 -54
  224. package/dist/Token/_TokenTextContainer.module.css.js +5 -5
  225. package/dist/Tooltip/Tooltip.js +56 -49
  226. package/dist/Tooltip/Tooltip.module.css.js +5 -20
  227. package/dist/TooltipV2/Tooltip.js +305 -222
  228. package/dist/TooltipV2/Tooltip.module.css.js +5 -11
  229. package/dist/TopicTag/TopicTag.js +55 -46
  230. package/dist/TopicTag/TopicTag.module.css.js +5 -5
  231. package/dist/TopicTag/TopicTagGroup.js +48 -40
  232. package/dist/TopicTag/TopicTagGroup.module.css.js +5 -5
  233. package/dist/TopicTag/index.js +7 -5
  234. package/dist/TreeView/TreeView.js +1414 -1082
  235. package/dist/TreeView/TreeView.module.css.js +5 -24
  236. package/dist/TreeView/shared.js +9 -10
  237. package/dist/TreeView/useRovingTabIndex.js +203 -129
  238. package/dist/TreeView/useTreeItemCache.js +79 -64
  239. package/dist/TreeView/useTypeahead.js +112 -90
  240. package/dist/Truncate/Truncate.js +33 -21
  241. package/dist/Truncate/Truncate.module.css.js +5 -5
  242. package/dist/UnderlineNav/UnderlineNav.js +375 -278
  243. package/dist/UnderlineNav/UnderlineNav.module.css.js +5 -8
  244. package/dist/UnderlineNav/UnderlineNavContext.js +8 -8
  245. package/dist/UnderlineNav/UnderlineNavItem.js +72 -56
  246. package/dist/UnderlineNav/UnderlineNavItem.module.css.js +5 -5
  247. package/dist/UnderlineNav/index.js +7 -5
  248. package/dist/UnderlineNav/styles.js +15 -11
  249. package/dist/VisuallyHidden/VisuallyHidden.js +49 -51
  250. package/dist/VisuallyHidden/VisuallyHidden.module.css.js +5 -5
  251. package/dist/_VisuallyHidden.js +62 -50
  252. package/dist/_VisuallyHidden.module.css.js +5 -5
  253. package/dist/deprecated/ActionList/Divider.js +23 -23
  254. package/dist/deprecated/ActionList/Divider.module.css.js +5 -5
  255. package/dist/deprecated/ActionList/Group.js +50 -43
  256. package/dist/deprecated/ActionList/Header.js +81 -69
  257. package/dist/deprecated/ActionList/Header.module.css.js +5 -5
  258. package/dist/deprecated/ActionList/Item.js +352 -308
  259. package/dist/deprecated/ActionList/Item.module.css.js +5 -18
  260. package/dist/deprecated/ActionList/List.js +196 -157
  261. package/dist/deprecated/ActionList/List.module.css.js +5 -5
  262. package/dist/deprecated/ActionList/index.js +14 -14
  263. package/dist/deprecated/ActionMenu.js +190 -159
  264. package/dist/deprecated/DialogV1/Dialog.js +200 -166
  265. package/dist/deprecated/DialogV1/Dialog.module.css.js +5 -11
  266. package/dist/deprecated/FilteredSearch/FilteredSearch.js +51 -43
  267. package/dist/deprecated/FilteredSearch/FilteredSearch.module.css.js +5 -5
  268. package/dist/deprecated/UnderlineNav/UnderlineNav.js +160 -132
  269. package/dist/deprecated/UnderlineNav/UnderlineNav.module.css.js +5 -14
  270. package/dist/deprecated/index.js +9 -20
  271. package/dist/experimental/IssueLabel/IssueLabel.js +158 -134
  272. package/dist/experimental/IssueLabel/IssueLabel.module.css.js +5 -5
  273. package/dist/experimental/SelectPanel2/SelectPanel.js +567 -419
  274. package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +5 -32
  275. package/dist/experimental/Tabs/Tabs.js +297 -234
  276. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +215 -165
  277. package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +5 -5
  278. package/dist/experimental/index.d.ts +2 -2
  279. package/dist/experimental/index.d.ts.map +1 -1
  280. package/dist/experimental/index.js +34 -44
  281. package/dist/hooks/useAnchoredPosition.js +144 -123
  282. package/dist/hooks/useControllableState.js +59 -34
  283. package/dist/hooks/useDetails.js +99 -84
  284. package/dist/hooks/useDialog.js +178 -140
  285. package/dist/hooks/useFocusTrap.js +71 -57
  286. package/dist/hooks/useFocusZone.js +38 -32
  287. package/dist/hooks/useId.js +16 -14
  288. package/dist/hooks/useIsMacOS.js +26 -21
  289. package/dist/hooks/useMedia.js +68 -54
  290. package/dist/hooks/useMenuInitialFocus.js +62 -65
  291. package/dist/hooks/useMenuKeyboardNavigation.js +126 -129
  292. package/dist/hooks/useMergedRefs.js +78 -63
  293. package/dist/hooks/useMnemonics.js +107 -77
  294. package/dist/hooks/useOnEscapePress.js +56 -45
  295. package/dist/hooks/useOnOutsideClick.js +63 -32
  296. package/dist/hooks/useOpenAndCloseFocus.js +43 -40
  297. package/dist/hooks/useOverflow.js +36 -32
  298. package/dist/hooks/useOverlay.js +75 -56
  299. package/dist/hooks/useProvidedRefOrCreate.js +24 -24
  300. package/dist/hooks/useProvidedStateOrCreate.js +39 -33
  301. package/dist/hooks/useRefObjectAsForwardedRef.js +32 -30
  302. package/dist/hooks/useRenderForcingRef.js +46 -42
  303. package/dist/hooks/useResizeObserver.js +43 -32
  304. package/dist/hooks/useResponsiveValue.js +57 -37
  305. package/dist/hooks/useSafeTimeout.js +29 -26
  306. package/dist/hooks/useScrollFlash.js +23 -16
  307. package/dist/hooks/useSlots.js +136 -102
  308. package/dist/hooks/useSyncedState.js +37 -31
  309. package/dist/index.d.ts +2 -2
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +86 -88
  312. package/dist/internal/components/ButtonReset.js +50 -45
  313. package/dist/internal/components/ButtonReset.module.css.js +5 -5
  314. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +105 -79
  315. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.module.css.js +5 -12
  316. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +21 -16
  317. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupContext.js +4 -4
  318. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +35 -26
  319. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +19 -14
  320. package/dist/internal/components/ConditionalWrapper.js +51 -41
  321. package/dist/internal/components/InputLabel.js +113 -92
  322. package/dist/internal/components/InputLabel.module.css.js +5 -8
  323. package/dist/internal/components/InputValidation.js +87 -67
  324. package/dist/internal/components/InputValidation.module.css.js +5 -9
  325. package/dist/internal/components/TextInputInnerAction.js +173 -134
  326. package/dist/internal/components/TextInputInnerAction.module.css.js +5 -9
  327. package/dist/internal/components/TextInputInnerVisualSlot.js +110 -89
  328. package/dist/internal/components/TextInputInnerVisualSlot.module.css.js +5 -11
  329. package/dist/internal/components/TextInputWrapper.js +230 -187
  330. package/dist/internal/components/TextInputWrapper.module.css.js +5 -8
  331. package/dist/internal/components/UnderlineTabbedInterface.js +238 -191
  332. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +5 -11
  333. package/dist/internal/components/UnstyledTextInput.js +47 -40
  334. package/dist/internal/components/UnstyledTextInput.module.css.js +5 -5
  335. package/dist/internal/components/ValidationAnimationContainer.js +66 -55
  336. package/dist/internal/components/ValidationAnimationContainer.module.css.js +5 -8
  337. package/dist/internal/hooks/useEffectCallback.js +38 -35
  338. package/dist/internal/hooks/useEffectOnce.js +25 -23
  339. package/dist/internal/utils/getResponsiveAttributes.js +26 -23
  340. package/dist/internal/utils/hasInteractiveNodes.js +46 -34
  341. package/dist/legacy-theme/ts/color-schemes.js +4732 -4250
  342. package/dist/live-region/Announce.js +183 -144
  343. package/dist/live-region/AriaAlert.js +22 -20
  344. package/dist/live-region/AriaStatus.js +22 -20
  345. package/dist/next/index.js +1 -3
  346. package/dist/test-helpers.js +62 -40
  347. package/dist/theme.js +47 -83
  348. package/dist/utils/character-counter.js +63 -45
  349. package/dist/utils/create-component.js +16 -15
  350. package/dist/utils/descendant-registry.js +218 -182
  351. package/dist/utils/environment.js +7 -7
  352. package/dist/utils/getBreakpointDeclarations.js +10 -9
  353. package/dist/utils/invariant.js +23 -17
  354. package/dist/utils/is-slot.js +11 -10
  355. package/dist/utils/isNumeric.js +3 -3
  356. package/dist/utils/modern-polymorphic.js +20 -12
  357. package/dist/utils/scroll.js +11 -8
  358. package/dist/utils/theme.js +10 -5
  359. package/dist/utils/useIsomorphicLayoutEffect.js +9 -4
  360. package/dist/utils/warning.js +21 -14
  361. package/package.json +10 -5
  362. package/dist/ActionList/ActionList-53389912.css.map +0 -1
@@ -1,582 +1,688 @@
1
- import { useRefObjectAsForwardedRef } from "../hooks/useRefObjectAsForwardedRef.js";
2
- import { useId as useId$1 } from "../hooks/useId.js";
3
- import Text_default from "../Text/Text.js";
4
- import VisuallyHidden from "../_VisuallyHidden.js";
5
- import { useFocusZone } from "../hooks/useFocusZone.js";
6
- import TextInputInnerVisualSlot from "../internal/components/TextInputInnerVisualSlot.js";
7
- import TextInputWrapper from "../internal/components/TextInputWrapper.js";
8
- import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
9
- import Token from "../Token/Token.js";
10
- import TextInputWithTokens_module_css_default from "./TextInputWithTokens.module.css.js";
11
- import { c } from "react-compiler-runtime";
12
- import { clsx } from "clsx";
13
- import { jsx, jsxs } from "react/jsx-runtime";
14
- import React, { useRef, useState } from "react";
15
- import { isFocusable } from "@primer/behaviors/utils";
16
- import { FocusKeys } from "@primer/behaviors";
17
- import { isValidElementType } from "react-is";
18
- //#region src/TextInputWithTokens/TextInputWithTokens.tsx
19
- /**
20
- * @deprecated
21
- */
1
+ import { c } from 'react-compiler-runtime';
2
+ import { FocusKeys } from '@primer/behaviors';
3
+ import { isFocusable } from '@primer/behaviors/utils';
4
+ import React, { useRef, useState } from 'react';
5
+ import { isValidElementType } from 'react-is';
6
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
7
+ import { useFocusZone } from '../hooks/useFocusZone.js';
8
+ import { useId } from '../hooks/useId.js';
9
+ import Token from '../Token/Token.js';
10
+ import VisuallyHidden from '../_VisuallyHidden.js';
11
+ import { TextInputWrapper } from '../internal/components/TextInputWrapper.js';
12
+ import UnstyledTextInput from '../internal/components/UnstyledTextInput.js';
13
+ import TextInputInnerVisualSlot from '../internal/components/TextInputInnerVisualSlot.js';
14
+ import styles from './TextInputWithTokens.module.css.js';
15
+ import { clsx } from 'clsx';
16
+ import { jsx, jsxs } from 'react/jsx-runtime';
17
+ import Text from '../Text/Text.js';
18
+
22
19
  const overflowCountClassMap = {
23
- small: TextInputWithTokens_module_css_default.OverflowCountSmall,
24
- medium: TextInputWithTokens_module_css_default.OverflowCountMedium,
25
- large: TextInputWithTokens_module_css_default.OverflowCountLarge,
26
- xlarge: TextInputWithTokens_module_css_default.OverflowCountXLarge
20
+ small: styles.OverflowCountSmall,
21
+ medium: styles.OverflowCountMedium,
22
+ large: styles.OverflowCountLarge,
23
+ xlarge: styles.OverflowCountXLarge
27
24
  };
25
+
26
+ // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
28
27
  function TextInputWithTokensInnerComponent(t0, forwardedRef) {
29
- const $ = c(151);
30
- let IconComponent;
31
- let LeadingVisual;
32
- let TrailingVisual;
33
- let block;
34
- let className;
35
- let contrast;
36
- let disabled;
37
- let loading;
38
- let maxHeight;
39
- let maxWidthProp;
40
- let minWidthProp;
41
- let onTokenRemove;
42
- let rest;
43
- let style;
44
- let t1;
45
- let t2;
46
- let t3;
47
- let t4;
48
- let t5;
49
- let tokens;
50
- let validationStatus;
51
- let variantProp;
52
- let visibleTokenCount;
53
- let widthProp;
54
- if ($[0] !== t0) {
55
- ({icon: IconComponent, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, loading, loaderPosition: t1, contrast, className, block, disabled, tokens, onTokenRemove, tokenComponent: t2, preventTokenWrapping: t3, size: t4, hideTokenRemoveButtons: t5, maxHeight, width: widthProp, minWidth: minWidthProp, maxWidth: maxWidthProp, validationStatus, variant: variantProp, visibleTokenCount, style, ...rest} = t0);
56
- $[0] = t0;
57
- $[1] = IconComponent;
58
- $[2] = LeadingVisual;
59
- $[3] = TrailingVisual;
60
- $[4] = block;
61
- $[5] = className;
62
- $[6] = contrast;
63
- $[7] = disabled;
64
- $[8] = loading;
65
- $[9] = maxHeight;
66
- $[10] = maxWidthProp;
67
- $[11] = minWidthProp;
68
- $[12] = onTokenRemove;
69
- $[13] = rest;
70
- $[14] = style;
71
- $[15] = t1;
72
- $[16] = t2;
73
- $[17] = t3;
74
- $[18] = t4;
75
- $[19] = t5;
76
- $[20] = tokens;
77
- $[21] = validationStatus;
78
- $[22] = variantProp;
79
- $[23] = visibleTokenCount;
80
- $[24] = widthProp;
81
- } else {
82
- IconComponent = $[1];
83
- LeadingVisual = $[2];
84
- TrailingVisual = $[3];
85
- block = $[4];
86
- className = $[5];
87
- contrast = $[6];
88
- disabled = $[7];
89
- loading = $[8];
90
- maxHeight = $[9];
91
- maxWidthProp = $[10];
92
- minWidthProp = $[11];
93
- onTokenRemove = $[12];
94
- rest = $[13];
95
- style = $[14];
96
- t1 = $[15];
97
- t2 = $[16];
98
- t3 = $[17];
99
- t4 = $[18];
100
- t5 = $[19];
101
- tokens = $[20];
102
- validationStatus = $[21];
103
- variantProp = $[22];
104
- visibleTokenCount = $[23];
105
- widthProp = $[24];
106
- }
107
- const loaderPosition = t1 === void 0 ? "auto" : t1;
108
- const TokenComponent = t2 === void 0 ? Token : t2;
109
- const preventTokenWrapping = t3 === void 0 ? false : t3;
110
- const size = t4 === void 0 ? "xlarge" : t4;
111
- const hideTokenRemoveButtons = t5 === void 0 ? false : t5;
112
- let ariaDescribedByProp;
113
- let inputPropsRest;
114
- let onBlur;
115
- let onFocus;
116
- let onKeyDown;
117
- let role;
118
- if ($[25] !== rest) {
119
- ({onBlur, onFocus, onKeyDown, "aria-describedby": ariaDescribedByProp, role, ...inputPropsRest} = rest);
120
- $[25] = rest;
121
- $[26] = ariaDescribedByProp;
122
- $[27] = inputPropsRest;
123
- $[28] = onBlur;
124
- $[29] = onFocus;
125
- $[30] = onKeyDown;
126
- $[31] = role;
127
- } else {
128
- ariaDescribedByProp = $[26];
129
- inputPropsRest = $[27];
130
- onBlur = $[28];
131
- onFocus = $[29];
132
- onKeyDown = $[30];
133
- role = $[31];
134
- }
135
- const ref = useRef(null);
136
- const selectedValuesDescriptionId = useId$1();
137
- useRefObjectAsForwardedRef(forwardedRef, ref);
138
- const [selectedTokenIndex, setSelectedTokenIndex] = useState();
139
- const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
140
- let t6;
141
- if ($[32] !== tokens) {
142
- const selectedTokenTexts = tokens.map(_temp).filter(_temp2);
143
- t6 = selectedTokenTexts.length ? `Selected: ${selectedTokenTexts.join(", ")}` : "";
144
- $[32] = tokens;
145
- $[33] = t6;
146
- } else t6 = $[33];
147
- const selectedValuesDescription = t6;
148
- const shouldExposeSelectedValuesDescription = role === "combobox" && Boolean(selectedValuesDescription);
149
- const t7 = shouldExposeSelectedValuesDescription ? selectedValuesDescriptionId : void 0;
150
- let t8;
151
- if ($[34] !== ariaDescribedByProp || $[35] !== t7) {
152
- t8 = [ariaDescribedByProp, t7].filter(Boolean);
153
- $[34] = ariaDescribedByProp;
154
- $[35] = t7;
155
- $[36] = t8;
156
- } else t8 = $[36];
157
- const ariaDescribedBy = t8.join(" ");
158
- let t9;
159
- if ($[37] !== selectedTokenIndex) {
160
- t9 = [selectedTokenIndex];
161
- $[37] = selectedTokenIndex;
162
- $[38] = t9;
163
- } else t9 = $[38];
164
- const { containerRef: t10 } = useFocusZone({
165
- focusOutBehavior: "wrap",
166
- bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
167
- focusableElementFilter: _temp3,
168
- getNextFocusable: (direction) => {
169
- var _containerRef$current;
170
- if (!selectedTokenIndex && selectedTokenIndex !== 0) return;
171
- let nextIndex = selectedTokenIndex + 1;
172
- if (direction === "next") nextIndex = nextIndex + 1;
173
- if (direction === "previous") nextIndex = nextIndex - 1;
174
- if (nextIndex > tokens.length || nextIndex < 1) return ref.current || void 0;
175
- return (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.children[nextIndex];
176
- }
177
- }, t9);
178
- const containerRef = t10;
179
- let t11;
180
- if ($[39] !== containerRef || $[40] !== onTokenRemove || $[41] !== selectedTokenIndex) {
181
- t11 = (tokenId) => {
182
- onTokenRemove(tokenId);
183
- setTimeout(() => {
184
- var _containerRef$current2, _containerRef$current3;
185
- const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex || 0];
186
- const firstFocusable = nextElementToFocus && isFocusable(nextElementToFocus) ? nextElementToFocus : Array.from(((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []).find(_temp4);
187
- if (firstFocusable) firstFocusable.focus();
188
- else {
189
- var _ref$current;
190
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
191
- }
192
- }, 0);
193
- };
194
- $[39] = containerRef;
195
- $[40] = onTokenRemove;
196
- $[41] = selectedTokenIndex;
197
- $[42] = t11;
198
- } else t11 = $[42];
199
- const handleTokenRemove = t11;
200
- let t12;
201
- if ($[43] !== disabled) {
202
- t12 = (tokenIndex) => () => {
203
- if (!disabled) setSelectedTokenIndex(tokenIndex);
204
- };
205
- $[43] = disabled;
206
- $[44] = t12;
207
- } else t12 = $[44];
208
- const handleTokenFocus = t12;
209
- let t13;
210
- if ($[45] !== containerRef || $[46] !== visibleTokenCount) {
211
- t13 = () => {
212
- setSelectedTokenIndex(void 0);
213
- setTimeout(() => {
214
- var _containerRef$current4;
215
- if (!((_containerRef$current4 = containerRef.current) !== null && _containerRef$current4 !== void 0 && _containerRef$current4.contains(document.activeElement)) && visibleTokenCount) setTokensAreTruncated(true);
216
- }, 0);
217
- };
218
- $[45] = containerRef;
219
- $[46] = visibleTokenCount;
220
- $[47] = t13;
221
- } else t13 = $[47];
222
- const handleTokenBlur = t13;
223
- let t14;
224
- if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
225
- t14 = (event) => {
226
- if (event.key === "Escape") {
227
- var _ref$current2;
228
- (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.focus();
229
- }
230
- };
231
- $[48] = t14;
232
- } else t14 = $[48];
233
- const handleTokenKeyUp = t14;
234
- let t15;
235
- if ($[49] !== onFocus || $[50] !== visibleTokenCount) {
236
- t15 = (event_0) => {
237
- onFocus && onFocus(event_0);
238
- setSelectedTokenIndex(void 0);
239
- visibleTokenCount && setTokensAreTruncated(false);
240
- };
241
- $[49] = onFocus;
242
- $[50] = visibleTokenCount;
243
- $[51] = t15;
244
- } else t15 = $[51];
245
- const handleInputFocus = t15;
246
- let t16;
247
- if ($[52] !== containerRef || $[53] !== onBlur || $[54] !== visibleTokenCount) {
248
- t16 = (event_1) => {
249
- onBlur && onBlur(event_1);
250
- setTimeout(() => {
251
- var _containerRef$current5;
252
- if (!((_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.contains(document.activeElement)) && visibleTokenCount) setTokensAreTruncated(true);
253
- }, 0);
254
- };
255
- $[52] = containerRef;
256
- $[53] = onBlur;
257
- $[54] = visibleTokenCount;
258
- $[55] = t16;
259
- } else t16 = $[55];
260
- const handleInputBlur = t16;
261
- let t17;
262
- if ($[56] !== handleTokenRemove || $[57] !== onKeyDown || $[58] !== tokens) {
263
- t17 = (e) => {
264
- var _ref$current3;
265
- if (onKeyDown) onKeyDown(e);
266
- if ((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.value) return;
267
- const lastToken = tokens[tokens.length - 1];
268
- if (e.key === "Backspace" && lastToken) {
269
- handleTokenRemove(lastToken.id);
270
- if (ref.current) ref.current.value = `${lastToken.text} `;
271
- setTimeout(() => {
272
- var _ref$current4;
273
- (_ref$current4 = ref.current) === null || _ref$current4 === void 0 || _ref$current4.select();
274
- }, 0);
275
- }
276
- };
277
- $[56] = handleTokenRemove;
278
- $[57] = onKeyDown;
279
- $[58] = tokens;
280
- $[59] = t17;
281
- } else t17 = $[59];
282
- const handleInputKeyDown = t17;
283
- let t18;
284
- if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
285
- t18 = () => {
286
- var _ref$current5;
287
- (_ref$current5 = ref.current) === null || _ref$current5 === void 0 || _ref$current5.focus();
288
- };
289
- $[60] = t18;
290
- } else t18 = $[60];
291
- const focusInput = t18;
292
- const preventTokenClickPropagation = _temp5;
293
- let t19;
294
- if ($[61] !== tokens || $[62] !== tokensAreTruncated || $[63] !== visibleTokenCount) {
295
- t19 = tokensAreTruncated ? tokens.slice(0, visibleTokenCount) : tokens;
296
- $[61] = tokens;
297
- $[62] = tokensAreTruncated;
298
- $[63] = visibleTokenCount;
299
- $[64] = t19;
300
- } else t19 = $[64];
301
- const visibleTokens = t19;
302
- let t20;
303
- if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
304
- t20 = {
305
- small: "small",
306
- medium: "small",
307
- large: "medium",
308
- xlarge: "medium"
309
- };
310
- $[65] = t20;
311
- } else t20 = $[65];
312
- const inputSizeMap = t20;
313
- const showLeadingLoadingIndicator = loading && (loaderPosition === "leading" || Boolean(LeadingVisual && loaderPosition !== "trailing"));
314
- const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || loaderPosition === "auto" && !LeadingVisual);
315
- const t21 = Boolean(LeadingVisual || showLeadingLoadingIndicator);
316
- const t22 = Boolean(TrailingVisual || showTrailingLoadingIndicator);
317
- const t23 = inputSizeMap[size];
318
- const t24 = Boolean(preventTokenWrapping || maxHeight) || void 0;
319
- let t25;
320
- if ($[66] !== className) {
321
- t25 = clsx(className, TextInputWithTokens_module_css_default.TextInputWrapper);
322
- $[66] = className;
323
- $[67] = t25;
324
- } else t25 = $[67];
325
- let t26;
326
- if ($[68] !== maxHeight || $[69] !== style) {
327
- t26 = maxHeight ? {
328
- maxHeight,
329
- ...style
330
- } : style;
331
- $[68] = maxHeight;
332
- $[69] = style;
333
- $[70] = t26;
334
- } else t26 = $[70];
335
- let t27;
336
- if ($[71] !== IconComponent || $[72] !== LeadingVisual) {
337
- t27 = IconComponent && !LeadingVisual && /* @__PURE__ */ jsx(IconComponent, {
338
- className: "TextInput-icon",
339
- "data-component": "TextInputWithTokens.Icon"
340
- });
341
- $[71] = IconComponent;
342
- $[72] = LeadingVisual;
343
- $[73] = t27;
344
- } else t27 = $[73];
345
- const t28 = typeof loading === "boolean";
346
- let t29;
347
- if ($[74] !== LeadingVisual) {
348
- t29 = typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /* @__PURE__ */ jsx(LeadingVisual, {}) : LeadingVisual;
349
- $[74] = LeadingVisual;
350
- $[75] = t29;
351
- } else t29 = $[75];
352
- let t30;
353
- if ($[76] !== showLeadingLoadingIndicator || $[77] !== t28 || $[78] !== t29) {
354
- t30 = /* @__PURE__ */ jsx(TextInputInnerVisualSlot, {
355
- hasLoadingIndicator: t28,
356
- visualPosition: "leading",
357
- showLoadingIndicator: showLeadingLoadingIndicator,
358
- componentPrefix: "TextInputWithTokens",
359
- children: t29
360
- });
361
- $[76] = showLeadingLoadingIndicator;
362
- $[77] = t28;
363
- $[78] = t29;
364
- $[79] = t30;
365
- } else t30 = $[79];
366
- const t31 = containerRef;
367
- const t32 = validationStatus === "error" ? "true" : "false";
368
- const t33 = ariaDescribedBy || void 0;
369
- let t34;
370
- if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== role || $[86] !== t32 || $[87] !== t33) {
371
- t34 = /* @__PURE__ */ jsx(UnstyledTextInput, {
372
- ref,
373
- disabled,
374
- onFocus: handleInputFocus,
375
- onBlur: handleInputBlur,
376
- onKeyDown: handleInputKeyDown,
377
- type: "text",
378
- className: TextInputWithTokens_module_css_default.UnstyledTextInput,
379
- "aria-invalid": t32,
380
- role,
381
- "aria-describedby": t33,
382
- "data-component": "TextInputWithTokens.Input",
383
- ...inputPropsRest
384
- });
385
- $[80] = disabled;
386
- $[81] = handleInputBlur;
387
- $[82] = handleInputFocus;
388
- $[83] = handleInputKeyDown;
389
- $[84] = inputPropsRest;
390
- $[85] = role;
391
- $[86] = t32;
392
- $[87] = t33;
393
- $[88] = t34;
394
- } else t34 = $[88];
395
- let t35;
396
- if ($[89] !== selectedValuesDescription || $[90] !== selectedValuesDescriptionId || $[91] !== shouldExposeSelectedValuesDescription) {
397
- t35 = shouldExposeSelectedValuesDescription ? /* @__PURE__ */ jsx(VisuallyHidden, {
398
- id: selectedValuesDescriptionId,
399
- children: selectedValuesDescription
400
- }) : null;
401
- $[89] = selectedValuesDescription;
402
- $[90] = selectedValuesDescriptionId;
403
- $[91] = shouldExposeSelectedValuesDescription;
404
- $[92] = t35;
405
- } else t35 = $[92];
406
- let t36;
407
- if ($[93] !== t34 || $[94] !== t35) {
408
- t36 = /* @__PURE__ */ jsxs("div", {
409
- className: TextInputWithTokens_module_css_default.InputWrapper,
410
- children: [t34, t35]
411
- });
412
- $[93] = t34;
413
- $[94] = t35;
414
- $[95] = t36;
415
- } else t36 = $[95];
416
- let t37;
417
- if ($[96] !== TokenComponent || $[97] !== disabled || $[98] !== handleTokenBlur || $[99] !== handleTokenFocus || $[100] !== handleTokenRemove || $[101] !== hideTokenRemoveButtons || $[102] !== selectedTokenIndex || $[103] !== size || $[104] !== visibleTokens) {
418
- let t38;
419
- if ($[106] !== TokenComponent || $[107] !== disabled || $[108] !== handleTokenBlur || $[109] !== handleTokenFocus || $[110] !== handleTokenRemove || $[111] !== hideTokenRemoveButtons || $[112] !== selectedTokenIndex || $[113] !== size) {
420
- t38 = (t39, i) => {
421
- const { id, ...tokenRest } = t39;
422
- return /* @__PURE__ */ jsx(TokenComponent, {
423
- disabled,
424
- onFocus: handleTokenFocus(i),
425
- onBlur: handleTokenBlur,
426
- onKeyUp: handleTokenKeyUp,
427
- onClick: preventTokenClickPropagation,
428
- isSelected: selectedTokenIndex === i,
429
- onRemove: () => {
430
- handleTokenRemove(id);
431
- },
432
- hideRemoveButton: disabled || hideTokenRemoveButtons,
433
- size,
434
- tabIndex: 0,
435
- "data-component": "TextInputWithTokens.Token",
436
- ...tokenRest
437
- }, id);
438
- };
439
- $[106] = TokenComponent;
440
- $[107] = disabled;
441
- $[108] = handleTokenBlur;
442
- $[109] = handleTokenFocus;
443
- $[110] = handleTokenRemove;
444
- $[111] = hideTokenRemoveButtons;
445
- $[112] = selectedTokenIndex;
446
- $[113] = size;
447
- $[114] = t38;
448
- } else t38 = $[114];
449
- t37 = visibleTokens.map(t38);
450
- $[96] = TokenComponent;
451
- $[97] = disabled;
452
- $[98] = handleTokenBlur;
453
- $[99] = handleTokenFocus;
454
- $[100] = handleTokenRemove;
455
- $[101] = hideTokenRemoveButtons;
456
- $[102] = selectedTokenIndex;
457
- $[103] = size;
458
- $[104] = visibleTokens;
459
- $[105] = t37;
460
- } else t37 = $[105];
461
- let t38;
462
- if ($[115] !== size || $[116] !== tokens.length || $[117] !== tokensAreTruncated || $[118] !== visibleTokens.length) {
463
- t38 = tokensAreTruncated && tokens.length - visibleTokens.length ? /* @__PURE__ */ jsxs(Text_default, {
464
- className: overflowCountClassMap[size],
465
- "data-component": "TextInputWithTokens.OverflowCount",
466
- children: ["+", tokens.length - visibleTokens.length]
467
- }) : null;
468
- $[115] = size;
469
- $[116] = tokens.length;
470
- $[117] = tokensAreTruncated;
471
- $[118] = visibleTokens.length;
472
- $[119] = t38;
473
- } else t38 = $[119];
474
- let t39;
475
- if ($[120] !== preventTokenWrapping || $[121] !== t31 || $[122] !== t36 || $[123] !== t37 || $[124] !== t38) {
476
- t39 = /* @__PURE__ */ jsxs("div", {
477
- ref: t31,
478
- className: TextInputWithTokens_module_css_default.Container,
479
- "data-prevent-token-wrapping": preventTokenWrapping,
480
- children: [
481
- t36,
482
- t37,
483
- t38
484
- ]
485
- });
486
- $[120] = preventTokenWrapping;
487
- $[121] = t31;
488
- $[122] = t36;
489
- $[123] = t37;
490
- $[124] = t38;
491
- $[125] = t39;
492
- } else t39 = $[125];
493
- const t40 = typeof loading === "boolean";
494
- let t41;
495
- if ($[126] !== TrailingVisual) {
496
- t41 = typeof TrailingVisual !== "string" && isValidElementType(TrailingVisual) ? /* @__PURE__ */ jsx(TrailingVisual, {}) : TrailingVisual;
497
- $[126] = TrailingVisual;
498
- $[127] = t41;
499
- } else t41 = $[127];
500
- let t42;
501
- if ($[128] !== showTrailingLoadingIndicator || $[129] !== t40 || $[130] !== t41) {
502
- t42 = /* @__PURE__ */ jsx(TextInputInnerVisualSlot, {
503
- hasLoadingIndicator: t40,
504
- visualPosition: "trailing",
505
- showLoadingIndicator: showTrailingLoadingIndicator,
506
- componentPrefix: "TextInputWithTokens",
507
- children: t41
508
- });
509
- $[128] = showTrailingLoadingIndicator;
510
- $[129] = t40;
511
- $[130] = t41;
512
- $[131] = t42;
513
- } else t42 = $[131];
514
- let t43;
515
- if ($[132] !== block || $[133] !== contrast || $[134] !== disabled || $[135] !== maxWidthProp || $[136] !== minWidthProp || $[137] !== t21 || $[138] !== t22 || $[139] !== t23 || $[140] !== t24 || $[141] !== t25 || $[142] !== t26 || $[143] !== t27 || $[144] !== t30 || $[145] !== t39 || $[146] !== t42 || $[147] !== validationStatus || $[148] !== variantProp || $[149] !== widthProp) {
516
- t43 = /* @__PURE__ */ jsxs(TextInputWrapper, {
517
- block,
518
- contrast,
519
- disabled,
520
- hasLeadingVisual: t21,
521
- hasTrailingVisual: t22,
522
- width: widthProp,
523
- minWidth: minWidthProp,
524
- maxWidth: maxWidthProp,
525
- size: t23,
526
- validationStatus,
527
- variant: variantProp,
528
- onClick: focusInput,
529
- "data-token-wrapping": t24,
530
- className: t25,
531
- style: t26,
532
- "data-component": "TextInputWithTokens",
533
- children: [
534
- t27,
535
- t30,
536
- t39,
537
- t42
538
- ]
539
- });
540
- $[132] = block;
541
- $[133] = contrast;
542
- $[134] = disabled;
543
- $[135] = maxWidthProp;
544
- $[136] = minWidthProp;
545
- $[137] = t21;
546
- $[138] = t22;
547
- $[139] = t23;
548
- $[140] = t24;
549
- $[141] = t25;
550
- $[142] = t26;
551
- $[143] = t27;
552
- $[144] = t30;
553
- $[145] = t39;
554
- $[146] = t42;
555
- $[147] = validationStatus;
556
- $[148] = variantProp;
557
- $[149] = widthProp;
558
- $[150] = t43;
559
- } else t43 = $[150];
560
- return t43;
28
+ const $ = c(151);
29
+ let IconComponent;
30
+ let LeadingVisual;
31
+ let TrailingVisual;
32
+ let block;
33
+ let className;
34
+ let contrast;
35
+ let disabled;
36
+ let loading;
37
+ let maxHeight;
38
+ let maxWidthProp;
39
+ let minWidthProp;
40
+ let onTokenRemove;
41
+ let rest;
42
+ let style;
43
+ let t1;
44
+ let t2;
45
+ let t3;
46
+ let t4;
47
+ let t5;
48
+ let tokens;
49
+ let validationStatus;
50
+ let variantProp;
51
+ let visibleTokenCount;
52
+ let widthProp;
53
+ if ($[0] !== t0) {
54
+ ({
55
+ icon: IconComponent,
56
+ leadingVisual: LeadingVisual,
57
+ trailingVisual: TrailingVisual,
58
+ loading,
59
+ loaderPosition: t1,
60
+ contrast,
61
+ className,
62
+ block,
63
+ disabled,
64
+ tokens,
65
+ onTokenRemove,
66
+ tokenComponent: t2,
67
+ preventTokenWrapping: t3,
68
+ size: t4,
69
+ hideTokenRemoveButtons: t5,
70
+ maxHeight,
71
+ width: widthProp,
72
+ minWidth: minWidthProp,
73
+ maxWidth: maxWidthProp,
74
+ validationStatus,
75
+ variant: variantProp,
76
+ visibleTokenCount,
77
+ style,
78
+ ...rest
79
+ } = t0);
80
+ $[0] = t0;
81
+ $[1] = IconComponent;
82
+ $[2] = LeadingVisual;
83
+ $[3] = TrailingVisual;
84
+ $[4] = block;
85
+ $[5] = className;
86
+ $[6] = contrast;
87
+ $[7] = disabled;
88
+ $[8] = loading;
89
+ $[9] = maxHeight;
90
+ $[10] = maxWidthProp;
91
+ $[11] = minWidthProp;
92
+ $[12] = onTokenRemove;
93
+ $[13] = rest;
94
+ $[14] = style;
95
+ $[15] = t1;
96
+ $[16] = t2;
97
+ $[17] = t3;
98
+ $[18] = t4;
99
+ $[19] = t5;
100
+ $[20] = tokens;
101
+ $[21] = validationStatus;
102
+ $[22] = variantProp;
103
+ $[23] = visibleTokenCount;
104
+ $[24] = widthProp;
105
+ } else {
106
+ IconComponent = $[1];
107
+ LeadingVisual = $[2];
108
+ TrailingVisual = $[3];
109
+ block = $[4];
110
+ className = $[5];
111
+ contrast = $[6];
112
+ disabled = $[7];
113
+ loading = $[8];
114
+ maxHeight = $[9];
115
+ maxWidthProp = $[10];
116
+ minWidthProp = $[11];
117
+ onTokenRemove = $[12];
118
+ rest = $[13];
119
+ style = $[14];
120
+ t1 = $[15];
121
+ t2 = $[16];
122
+ t3 = $[17];
123
+ t4 = $[18];
124
+ t5 = $[19];
125
+ tokens = $[20];
126
+ validationStatus = $[21];
127
+ variantProp = $[22];
128
+ visibleTokenCount = $[23];
129
+ widthProp = $[24];
130
+ }
131
+ const loaderPosition = t1 === undefined ? "auto" : t1;
132
+ const TokenComponent = t2 === undefined ? Token : t2;
133
+ const preventTokenWrapping = t3 === undefined ? false : t3;
134
+ const size = t4 === undefined ? "xlarge" : t4;
135
+ const hideTokenRemoveButtons = t5 === undefined ? false : t5;
136
+ let ariaDescribedByProp;
137
+ let inputPropsRest;
138
+ let onBlur;
139
+ let onFocus;
140
+ let onKeyDown;
141
+ let role;
142
+ if ($[25] !== rest) {
143
+ ({
144
+ onBlur,
145
+ onFocus,
146
+ onKeyDown,
147
+ "aria-describedby": ariaDescribedByProp,
148
+ role,
149
+ ...inputPropsRest
150
+ } = rest);
151
+ $[25] = rest;
152
+ $[26] = ariaDescribedByProp;
153
+ $[27] = inputPropsRest;
154
+ $[28] = onBlur;
155
+ $[29] = onFocus;
156
+ $[30] = onKeyDown;
157
+ $[31] = role;
158
+ } else {
159
+ ariaDescribedByProp = $[26];
160
+ inputPropsRest = $[27];
161
+ onBlur = $[28];
162
+ onFocus = $[29];
163
+ onKeyDown = $[30];
164
+ role = $[31];
165
+ }
166
+ const ref = useRef(null);
167
+ const selectedValuesDescriptionId = useId();
168
+ useRefObjectAsForwardedRef(forwardedRef, ref);
169
+ const [selectedTokenIndex, setSelectedTokenIndex] = useState();
170
+ const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
171
+ let t6;
172
+ if ($[32] !== tokens) {
173
+ const selectedTokenTexts = tokens.map(_temp).filter(_temp2);
174
+ t6 = selectedTokenTexts.length ? `Selected: ${selectedTokenTexts.join(", ")}` : "";
175
+ $[32] = tokens;
176
+ $[33] = t6;
177
+ } else {
178
+ t6 = $[33];
179
+ }
180
+ const selectedValuesDescription = t6;
181
+ const shouldExposeSelectedValuesDescription = role === "combobox" && Boolean(selectedValuesDescription);
182
+ const t7 = shouldExposeSelectedValuesDescription ? selectedValuesDescriptionId : undefined;
183
+ let t8;
184
+ if ($[34] !== ariaDescribedByProp || $[35] !== t7) {
185
+ t8 = [ariaDescribedByProp, t7].filter(Boolean);
186
+ $[34] = ariaDescribedByProp;
187
+ $[35] = t7;
188
+ $[36] = t8;
189
+ } else {
190
+ t8 = $[36];
191
+ }
192
+ const ariaDescribedBy = t8.join(" ");
193
+ let t9;
194
+ if ($[37] !== selectedTokenIndex) {
195
+ t9 = [selectedTokenIndex];
196
+ $[37] = selectedTokenIndex;
197
+ $[38] = t9;
198
+ } else {
199
+ t9 = $[38];
200
+ }
201
+ const {
202
+ containerRef: t10
203
+ } = useFocusZone({
204
+ focusOutBehavior: "wrap",
205
+ bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
206
+ focusableElementFilter: _temp3,
207
+ getNextFocusable: direction => {
208
+ var _containerRef$current;
209
+ if (!selectedTokenIndex && selectedTokenIndex !== 0) {
210
+ return;
211
+ }
212
+ let nextIndex = selectedTokenIndex + 1;
213
+ if (direction === "next") {
214
+ nextIndex = nextIndex + 1;
215
+ }
216
+ if (direction === "previous") {
217
+ nextIndex = nextIndex - 1;
218
+ }
219
+ if (nextIndex > tokens.length || nextIndex < 1) {
220
+ return ref.current || undefined;
221
+ }
222
+ return (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.children[nextIndex];
223
+ }
224
+ }, t9);
225
+ const containerRef = t10;
226
+ let t11;
227
+ if ($[39] !== containerRef || $[40] !== onTokenRemove || $[41] !== selectedTokenIndex) {
228
+ t11 = tokenId => {
229
+ onTokenRemove(tokenId);
230
+ setTimeout(() => {
231
+ var _containerRef$current2, _containerRef$current3;
232
+ const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex || 0];
233
+ const firstFocusable = nextElementToFocus && isFocusable(nextElementToFocus) ? nextElementToFocus : Array.from(((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []).find(_temp4);
234
+ if (firstFocusable) {
235
+ firstFocusable.focus();
236
+ } else {
237
+ var _ref$current;
238
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
239
+ }
240
+ }, 0);
241
+ };
242
+ $[39] = containerRef;
243
+ $[40] = onTokenRemove;
244
+ $[41] = selectedTokenIndex;
245
+ $[42] = t11;
246
+ } else {
247
+ t11 = $[42];
248
+ }
249
+ const handleTokenRemove = t11;
250
+ let t12;
251
+ if ($[43] !== disabled) {
252
+ t12 = tokenIndex => () => {
253
+ if (!disabled) {
254
+ setSelectedTokenIndex(tokenIndex);
255
+ }
256
+ };
257
+ $[43] = disabled;
258
+ $[44] = t12;
259
+ } else {
260
+ t12 = $[44];
261
+ }
262
+ const handleTokenFocus = t12;
263
+ let t13;
264
+ if ($[45] !== containerRef || $[46] !== visibleTokenCount) {
265
+ t13 = () => {
266
+ setSelectedTokenIndex(undefined);
267
+ setTimeout(() => {
268
+ var _containerRef$current4;
269
+ if (!((_containerRef$current4 = containerRef.current) !== null && _containerRef$current4 !== void 0 && _containerRef$current4.contains(document.activeElement)) && visibleTokenCount) {
270
+ setTokensAreTruncated(true);
271
+ }
272
+ }, 0);
273
+ };
274
+ $[45] = containerRef;
275
+ $[46] = visibleTokenCount;
276
+ $[47] = t13;
277
+ } else {
278
+ t13 = $[47];
279
+ }
280
+ const handleTokenBlur = t13;
281
+ let t14;
282
+ if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
283
+ t14 = event => {
284
+ if (event.key === "Escape") {
285
+ var _ref$current2;
286
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
287
+ }
288
+ };
289
+ $[48] = t14;
290
+ } else {
291
+ t14 = $[48];
292
+ }
293
+ const handleTokenKeyUp = t14;
294
+ let t15;
295
+ if ($[49] !== onFocus || $[50] !== visibleTokenCount) {
296
+ t15 = event_0 => {
297
+ onFocus && onFocus(event_0);
298
+ setSelectedTokenIndex(undefined);
299
+ visibleTokenCount && setTokensAreTruncated(false);
300
+ };
301
+ $[49] = onFocus;
302
+ $[50] = visibleTokenCount;
303
+ $[51] = t15;
304
+ } else {
305
+ t15 = $[51];
306
+ }
307
+ const handleInputFocus = t15;
308
+ let t16;
309
+ if ($[52] !== containerRef || $[53] !== onBlur || $[54] !== visibleTokenCount) {
310
+ t16 = event_1 => {
311
+ onBlur && onBlur(event_1);
312
+ setTimeout(() => {
313
+ var _containerRef$current5;
314
+ if (!((_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.contains(document.activeElement)) && visibleTokenCount) {
315
+ setTokensAreTruncated(true);
316
+ }
317
+ }, 0);
318
+ };
319
+ $[52] = containerRef;
320
+ $[53] = onBlur;
321
+ $[54] = visibleTokenCount;
322
+ $[55] = t16;
323
+ } else {
324
+ t16 = $[55];
325
+ }
326
+ const handleInputBlur = t16;
327
+ let t17;
328
+ if ($[56] !== handleTokenRemove || $[57] !== onKeyDown || $[58] !== tokens) {
329
+ t17 = e => {
330
+ var _ref$current3;
331
+ if (onKeyDown) {
332
+ onKeyDown(e);
333
+ }
334
+ if ((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.value) {
335
+ return;
336
+ }
337
+ const lastToken = tokens[tokens.length - 1];
338
+ if (e.key === "Backspace" && lastToken) {
339
+ handleTokenRemove(lastToken.id);
340
+ if (ref.current) {
341
+ ref.current.value = `${lastToken.text} `;
342
+ }
343
+ setTimeout(() => {
344
+ var _ref$current4;
345
+ (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.select();
346
+ }, 0);
347
+ }
348
+ };
349
+ $[56] = handleTokenRemove;
350
+ $[57] = onKeyDown;
351
+ $[58] = tokens;
352
+ $[59] = t17;
353
+ } else {
354
+ t17 = $[59];
355
+ }
356
+ const handleInputKeyDown = t17;
357
+ let t18;
358
+ if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
359
+ t18 = () => {
360
+ var _ref$current5;
361
+ (_ref$current5 = ref.current) === null || _ref$current5 === void 0 ? void 0 : _ref$current5.focus();
362
+ };
363
+ $[60] = t18;
364
+ } else {
365
+ t18 = $[60];
366
+ }
367
+ const focusInput = t18;
368
+ const preventTokenClickPropagation = _temp5;
369
+ let t19;
370
+ if ($[61] !== tokens || $[62] !== tokensAreTruncated || $[63] !== visibleTokenCount) {
371
+ t19 = tokensAreTruncated ? tokens.slice(0, visibleTokenCount) : tokens;
372
+ $[61] = tokens;
373
+ $[62] = tokensAreTruncated;
374
+ $[63] = visibleTokenCount;
375
+ $[64] = t19;
376
+ } else {
377
+ t19 = $[64];
378
+ }
379
+ const visibleTokens = t19;
380
+ let t20;
381
+ if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
382
+ t20 = {
383
+ small: "small",
384
+ medium: "small",
385
+ large: "medium",
386
+ xlarge: "medium"
387
+ };
388
+ $[65] = t20;
389
+ } else {
390
+ t20 = $[65];
391
+ }
392
+ const inputSizeMap = t20;
393
+ const showLeadingLoadingIndicator = loading && (loaderPosition === "leading" || Boolean(LeadingVisual && loaderPosition !== "trailing"));
394
+ const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || loaderPosition === "auto" && !LeadingVisual);
395
+ const t21 = Boolean(LeadingVisual || showLeadingLoadingIndicator);
396
+ const t22 = Boolean(TrailingVisual || showTrailingLoadingIndicator);
397
+ const t23 = inputSizeMap[size];
398
+ const t24 = Boolean(preventTokenWrapping || maxHeight) || undefined;
399
+ let t25;
400
+ if ($[66] !== className) {
401
+ t25 = clsx(className, styles.TextInputWrapper);
402
+ $[66] = className;
403
+ $[67] = t25;
404
+ } else {
405
+ t25 = $[67];
406
+ }
407
+ let t26;
408
+ if ($[68] !== maxHeight || $[69] !== style) {
409
+ t26 = maxHeight ? {
410
+ maxHeight,
411
+ ...style
412
+ } : style;
413
+ $[68] = maxHeight;
414
+ $[69] = style;
415
+ $[70] = t26;
416
+ } else {
417
+ t26 = $[70];
418
+ }
419
+ let t27;
420
+ if ($[71] !== IconComponent || $[72] !== LeadingVisual) {
421
+ t27 = IconComponent && !LeadingVisual && /*#__PURE__*/jsx(IconComponent, {
422
+ className: "TextInput-icon",
423
+ "data-component": "TextInputWithTokens.Icon"
424
+ });
425
+ $[71] = IconComponent;
426
+ $[72] = LeadingVisual;
427
+ $[73] = t27;
428
+ } else {
429
+ t27 = $[73];
430
+ }
431
+ const t28 = typeof loading === "boolean";
432
+ let t29;
433
+ if ($[74] !== LeadingVisual) {
434
+ t29 = typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/jsx(LeadingVisual, {}) : LeadingVisual;
435
+ $[74] = LeadingVisual;
436
+ $[75] = t29;
437
+ } else {
438
+ t29 = $[75];
439
+ }
440
+ let t30;
441
+ if ($[76] !== showLeadingLoadingIndicator || $[77] !== t28 || $[78] !== t29) {
442
+ t30 = /*#__PURE__*/jsx(TextInputInnerVisualSlot, {
443
+ hasLoadingIndicator: t28,
444
+ visualPosition: "leading",
445
+ showLoadingIndicator: showLeadingLoadingIndicator,
446
+ componentPrefix: "TextInputWithTokens",
447
+ children: t29
448
+ });
449
+ $[76] = showLeadingLoadingIndicator;
450
+ $[77] = t28;
451
+ $[78] = t29;
452
+ $[79] = t30;
453
+ } else {
454
+ t30 = $[79];
455
+ }
456
+ const t31 = containerRef;
457
+ const t32 = validationStatus === "error" ? "true" : "false";
458
+ const t33 = ariaDescribedBy || undefined;
459
+ let t34;
460
+ if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== role || $[86] !== t32 || $[87] !== t33) {
461
+ t34 = /*#__PURE__*/jsx(UnstyledTextInput, {
462
+ ref: ref,
463
+ disabled: disabled,
464
+ onFocus: handleInputFocus,
465
+ onBlur: handleInputBlur,
466
+ onKeyDown: handleInputKeyDown,
467
+ type: "text",
468
+ className: styles.UnstyledTextInput,
469
+ "aria-invalid": t32,
470
+ role: role,
471
+ "aria-describedby": t33,
472
+ "data-component": "TextInputWithTokens.Input",
473
+ ...inputPropsRest
474
+ });
475
+ $[80] = disabled;
476
+ $[81] = handleInputBlur;
477
+ $[82] = handleInputFocus;
478
+ $[83] = handleInputKeyDown;
479
+ $[84] = inputPropsRest;
480
+ $[85] = role;
481
+ $[86] = t32;
482
+ $[87] = t33;
483
+ $[88] = t34;
484
+ } else {
485
+ t34 = $[88];
486
+ }
487
+ let t35;
488
+ if ($[89] !== selectedValuesDescription || $[90] !== selectedValuesDescriptionId || $[91] !== shouldExposeSelectedValuesDescription) {
489
+ t35 = shouldExposeSelectedValuesDescription ? /*#__PURE__*/jsx(VisuallyHidden, {
490
+ id: selectedValuesDescriptionId,
491
+ children: selectedValuesDescription
492
+ }) : null;
493
+ $[89] = selectedValuesDescription;
494
+ $[90] = selectedValuesDescriptionId;
495
+ $[91] = shouldExposeSelectedValuesDescription;
496
+ $[92] = t35;
497
+ } else {
498
+ t35 = $[92];
499
+ }
500
+ let t36;
501
+ if ($[93] !== t34 || $[94] !== t35) {
502
+ t36 = /*#__PURE__*/jsxs("div", {
503
+ className: styles.InputWrapper,
504
+ children: [t34, t35]
505
+ });
506
+ $[93] = t34;
507
+ $[94] = t35;
508
+ $[95] = t36;
509
+ } else {
510
+ t36 = $[95];
511
+ }
512
+ let t37;
513
+ if ($[96] !== TokenComponent || $[97] !== disabled || $[98] !== handleTokenBlur || $[99] !== handleTokenFocus || $[100] !== handleTokenRemove || $[101] !== hideTokenRemoveButtons || $[102] !== selectedTokenIndex || $[103] !== size || $[104] !== visibleTokens) {
514
+ let t38;
515
+ if ($[106] !== TokenComponent || $[107] !== disabled || $[108] !== handleTokenBlur || $[109] !== handleTokenFocus || $[110] !== handleTokenRemove || $[111] !== hideTokenRemoveButtons || $[112] !== selectedTokenIndex || $[113] !== size) {
516
+ t38 = (t39, i) => {
517
+ const {
518
+ id,
519
+ ...tokenRest
520
+ } = t39;
521
+ return /*#__PURE__*/jsx(TokenComponent, {
522
+ disabled: disabled,
523
+ onFocus: handleTokenFocus(i),
524
+ onBlur: handleTokenBlur,
525
+ onKeyUp: handleTokenKeyUp,
526
+ onClick: preventTokenClickPropagation,
527
+ isSelected: selectedTokenIndex === i,
528
+ onRemove: () => {
529
+ handleTokenRemove(id);
530
+ },
531
+ hideRemoveButton: disabled || hideTokenRemoveButtons,
532
+ size: size,
533
+ tabIndex: 0,
534
+ "data-component": "TextInputWithTokens.Token",
535
+ ...tokenRest
536
+ }, id);
537
+ };
538
+ $[106] = TokenComponent;
539
+ $[107] = disabled;
540
+ $[108] = handleTokenBlur;
541
+ $[109] = handleTokenFocus;
542
+ $[110] = handleTokenRemove;
543
+ $[111] = hideTokenRemoveButtons;
544
+ $[112] = selectedTokenIndex;
545
+ $[113] = size;
546
+ $[114] = t38;
547
+ } else {
548
+ t38 = $[114];
549
+ }
550
+ t37 = visibleTokens.map(t38);
551
+ $[96] = TokenComponent;
552
+ $[97] = disabled;
553
+ $[98] = handleTokenBlur;
554
+ $[99] = handleTokenFocus;
555
+ $[100] = handleTokenRemove;
556
+ $[101] = hideTokenRemoveButtons;
557
+ $[102] = selectedTokenIndex;
558
+ $[103] = size;
559
+ $[104] = visibleTokens;
560
+ $[105] = t37;
561
+ } else {
562
+ t37 = $[105];
563
+ }
564
+ let t38;
565
+ if ($[115] !== size || $[116] !== tokens.length || $[117] !== tokensAreTruncated || $[118] !== visibleTokens.length) {
566
+ t38 = tokensAreTruncated && tokens.length - visibleTokens.length ? /*#__PURE__*/jsxs(Text, {
567
+ className: overflowCountClassMap[size],
568
+ "data-component": "TextInputWithTokens.OverflowCount",
569
+ children: ["+", tokens.length - visibleTokens.length]
570
+ }) : null;
571
+ $[115] = size;
572
+ $[116] = tokens.length;
573
+ $[117] = tokensAreTruncated;
574
+ $[118] = visibleTokens.length;
575
+ $[119] = t38;
576
+ } else {
577
+ t38 = $[119];
578
+ }
579
+ let t39;
580
+ if ($[120] !== preventTokenWrapping || $[121] !== t31 || $[122] !== t36 || $[123] !== t37 || $[124] !== t38) {
581
+ t39 = /*#__PURE__*/jsxs("div", {
582
+ ref: t31,
583
+ className: styles.Container,
584
+ "data-prevent-token-wrapping": preventTokenWrapping,
585
+ children: [t36, t37, t38]
586
+ });
587
+ $[120] = preventTokenWrapping;
588
+ $[121] = t31;
589
+ $[122] = t36;
590
+ $[123] = t37;
591
+ $[124] = t38;
592
+ $[125] = t39;
593
+ } else {
594
+ t39 = $[125];
595
+ }
596
+ const t40 = typeof loading === "boolean";
597
+ let t41;
598
+ if ($[126] !== TrailingVisual) {
599
+ t41 = typeof TrailingVisual !== "string" && isValidElementType(TrailingVisual) ? /*#__PURE__*/jsx(TrailingVisual, {}) : TrailingVisual;
600
+ $[126] = TrailingVisual;
601
+ $[127] = t41;
602
+ } else {
603
+ t41 = $[127];
604
+ }
605
+ let t42;
606
+ if ($[128] !== showTrailingLoadingIndicator || $[129] !== t40 || $[130] !== t41) {
607
+ t42 = /*#__PURE__*/jsx(TextInputInnerVisualSlot, {
608
+ hasLoadingIndicator: t40,
609
+ visualPosition: "trailing",
610
+ showLoadingIndicator: showTrailingLoadingIndicator,
611
+ componentPrefix: "TextInputWithTokens",
612
+ children: t41
613
+ });
614
+ $[128] = showTrailingLoadingIndicator;
615
+ $[129] = t40;
616
+ $[130] = t41;
617
+ $[131] = t42;
618
+ } else {
619
+ t42 = $[131];
620
+ }
621
+ let t43;
622
+ if ($[132] !== block || $[133] !== contrast || $[134] !== disabled || $[135] !== maxWidthProp || $[136] !== minWidthProp || $[137] !== t21 || $[138] !== t22 || $[139] !== t23 || $[140] !== t24 || $[141] !== t25 || $[142] !== t26 || $[143] !== t27 || $[144] !== t30 || $[145] !== t39 || $[146] !== t42 || $[147] !== validationStatus || $[148] !== variantProp || $[149] !== widthProp) {
623
+ t43 = /*#__PURE__*/jsxs(TextInputWrapper, {
624
+ block: block,
625
+ contrast: contrast,
626
+ disabled: disabled,
627
+ hasLeadingVisual: t21,
628
+ hasTrailingVisual: t22,
629
+ width: widthProp,
630
+ minWidth: minWidthProp,
631
+ maxWidth: maxWidthProp,
632
+ size: t23,
633
+ validationStatus: validationStatus,
634
+ variant: variantProp,
635
+ onClick: focusInput,
636
+ "data-token-wrapping": t24,
637
+ className: t25,
638
+ style: t26,
639
+ "data-component": "TextInputWithTokens",
640
+ children: [t27, t30, t39, t42]
641
+ });
642
+ $[132] = block;
643
+ $[133] = contrast;
644
+ $[134] = disabled;
645
+ $[135] = maxWidthProp;
646
+ $[136] = minWidthProp;
647
+ $[137] = t21;
648
+ $[138] = t22;
649
+ $[139] = t23;
650
+ $[140] = t24;
651
+ $[141] = t25;
652
+ $[142] = t26;
653
+ $[143] = t27;
654
+ $[144] = t30;
655
+ $[145] = t39;
656
+ $[146] = t42;
657
+ $[147] = validationStatus;
658
+ $[148] = variantProp;
659
+ $[149] = widthProp;
660
+ $[150] = t43;
661
+ } else {
662
+ t43 = $[150];
663
+ }
664
+ return t43;
561
665
  }
562
666
  function _temp5(event_2) {
563
- event_2.stopPropagation();
667
+ event_2.stopPropagation();
564
668
  }
565
669
  function _temp4(el) {
566
- return isFocusable(el);
670
+ return isFocusable(el);
567
671
  }
568
672
  function _temp3(element) {
569
- return !element.getAttributeNames().includes("aria-hidden");
673
+ return !element.getAttributeNames().includes("aria-hidden");
570
674
  }
571
675
  function _temp2(tokenText) {
572
- return tokenText !== null;
676
+ return tokenText !== null;
573
677
  }
574
678
  function _temp(token) {
575
- if ("text" in token && typeof token.text === "string" && token.text.trim().length) return token.text;
576
- return null;
679
+ if ("text" in token && typeof token.text === "string" && token.text.trim().length) {
680
+ return token.text;
681
+ }
682
+ return null;
577
683
  }
578
- const TextInputWithTokens = /* @__PURE__ */ React.forwardRef(TextInputWithTokensInnerComponent);
579
- TextInputWithTokens.displayName = "TextInputWithTokens";
580
- TextInputWithTokens.__SLOT__ = Symbol("TextInputWithTokens");
581
- //#endregion
684
+ const TextInputWithTokens = /*#__PURE__*/React.forwardRef(TextInputWithTokensInnerComponent);
685
+ TextInputWithTokens.displayName = 'TextInputWithTokens';
686
+ TextInputWithTokens.__SLOT__ = Symbol('TextInputWithTokens');
687
+
582
688
  export { TextInputWithTokens as default };