@primer/react 0.0.0-20260427204434 → 0.0.0-20260428150519

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 (344) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/dist/ActionBar/ActionBar.js +502 -705
  3. package/dist/ActionBar/ActionBar.module.css.js +10 -5
  4. package/dist/ActionBar/index.js +8 -8
  5. package/dist/ActionList/ActionList.module.css.js +31 -5
  6. package/dist/ActionList/ActionListContainerContext.js +4 -5
  7. package/dist/ActionList/Description.js +117 -133
  8. package/dist/ActionList/Divider.js +31 -38
  9. package/dist/ActionList/Group.js +292 -349
  10. package/dist/ActionList/Group.module.css.js +10 -5
  11. package/dist/ActionList/Heading.js +88 -106
  12. package/dist/ActionList/Heading.module.css.js +5 -5
  13. package/dist/ActionList/Item.js +668 -811
  14. package/dist/ActionList/LinkItem.js +36 -56
  15. package/dist/ActionList/List.js +168 -210
  16. package/dist/ActionList/Selection.js +83 -112
  17. package/dist/ActionList/TrailingAction.js +97 -112
  18. package/dist/ActionList/Visuals.js +143 -191
  19. package/dist/ActionList/index.js +33 -33
  20. package/dist/ActionList/shared.js +5 -9
  21. package/dist/ActionMenu/ActionMenu.js +223 -310
  22. package/dist/ActionMenu/ActionMenu.module.css.js +5 -5
  23. package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
  24. package/dist/AnchoredOverlay/AnchoredOverlay.js +206 -298
  25. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +9 -5
  26. package/dist/Autocomplete/Autocomplete.js +125 -141
  27. package/dist/Autocomplete/AutocompleteContext.js +18 -20
  28. package/dist/Autocomplete/AutocompleteInput.js +108 -146
  29. package/dist/Autocomplete/AutocompleteMenu.js +201 -238
  30. package/dist/Autocomplete/AutocompleteMenu.module.css.js +8 -5
  31. package/dist/Autocomplete/AutocompleteOverlay.js +54 -79
  32. package/dist/Autocomplete/AutocompleteOverlay.module.css.js +5 -5
  33. package/dist/Avatar/Avatar.js +106 -133
  34. package/dist/Avatar/Avatar.module.css.js +5 -5
  35. package/dist/AvatarStack/AvatarStack.js +102 -143
  36. package/dist/AvatarStack/AvatarStack.module.css.js +9 -5
  37. package/dist/Banner/Banner.js +133 -186
  38. package/dist/Banner/Banner.module.css.js +14 -5
  39. package/dist/Banner/index.js +7 -7
  40. package/dist/BaseStyles.js +74 -91
  41. package/dist/BaseStyles.module.css.js +5 -5
  42. package/dist/Blankslate/Blankslate.js +266 -328
  43. package/dist/Blankslate/Blankslate.module.css.js +12 -5
  44. package/dist/Blankslate/BlankslateContext.js +7 -9
  45. package/dist/Blankslate/index.js +9 -9
  46. package/dist/BranchName/BranchName.js +49 -59
  47. package/dist/BranchName/BranchName.module.css.js +5 -5
  48. package/dist/Breadcrumbs/Breadcrumbs.js +371 -431
  49. package/dist/Breadcrumbs/Breadcrumbs.module.css.js +15 -5
  50. package/dist/Button/Button.js +15 -18
  51. package/dist/Button/ButtonBase.js +76 -139
  52. package/dist/Button/ButtonBase.module.css.js +16 -5
  53. package/dist/Button/IconButton.js +42 -74
  54. package/dist/Button/LinkButton.js +13 -17
  55. package/dist/ButtonGroup/ButtonGroup.js +80 -97
  56. package/dist/ButtonGroup/ButtonGroup.module.css.js +5 -5
  57. package/dist/Card/Card.js +401 -491
  58. package/dist/Card/Card.module.css.js +18 -5
  59. package/dist/Card/index.js +9 -9
  60. package/dist/Checkbox/Checkbox.js +52 -71
  61. package/dist/Checkbox/Checkbox.module.css.js +9 -5
  62. package/dist/Checkbox/shared.module.css.js +5 -5
  63. package/dist/CheckboxGroup/CheckboxGroup.js +111 -132
  64. package/dist/CheckboxGroup/CheckboxGroupContext.js +4 -4
  65. package/dist/CircleBadge/CircleBadge.js +77 -90
  66. package/dist/CircleBadge/CircleBadge.module.css.js +8 -5
  67. package/dist/ConfirmationDialog/ConfirmationDialog.js +68 -92
  68. package/dist/CounterLabel/CounterLabel.js +83 -99
  69. package/dist/CounterLabel/CounterLabel.module.css.js +5 -5
  70. package/dist/DataTable/DataTable.js +100 -140
  71. package/dist/DataTable/ErrorDialog.js +33 -45
  72. package/dist/DataTable/Pagination.js +464 -592
  73. package/dist/DataTable/Pagination.module.css.js +13 -5
  74. package/dist/DataTable/Table.js +527 -710
  75. package/dist/DataTable/Table.module.css.js +26 -5
  76. package/dist/DataTable/column.js +10 -11
  77. package/dist/DataTable/index.js +22 -20
  78. package/dist/DataTable/sorting.js +65 -103
  79. package/dist/DataTable/useTable.js +207 -290
  80. package/dist/Details/Details.js +100 -126
  81. package/dist/Details/Details.module.css.js +5 -5
  82. package/dist/Dialog/Dialog.js +259 -351
  83. package/dist/Dialog/Dialog.module.css.js +22 -5
  84. package/dist/FeatureFlags/DefaultFeatureFlags.js +7 -7
  85. package/dist/FeatureFlags/FeatureFlagContext.js +5 -5
  86. package/dist/FeatureFlags/FeatureFlagScope.js +36 -44
  87. package/dist/FeatureFlags/FeatureFlags.js +29 -37
  88. package/dist/FeatureFlags/useFeatureFlag.js +17 -19
  89. package/dist/FilteredActionList/FilteredActionList.js +454 -579
  90. package/dist/FilteredActionList/FilteredActionList.module.css.js +15 -5
  91. package/dist/FilteredActionList/FilteredActionListLoaders.js +119 -150
  92. package/dist/FilteredActionList/FilteredActionListLoaders.module.css.js +9 -5
  93. package/dist/FilteredActionList/useAnnouncements.js +167 -180
  94. package/dist/Flash/Flash.js +57 -69
  95. package/dist/Flash/Flash.module.css.js +5 -5
  96. package/dist/FormControl/FormControl.js +211 -227
  97. package/dist/FormControl/FormControl.module.css.js +11 -5
  98. package/dist/FormControl/FormControlCaption.js +37 -49
  99. package/dist/FormControl/FormControlCaption.module.css.js +5 -5
  100. package/dist/FormControl/FormControlLabel.js +95 -115
  101. package/dist/FormControl/FormControlLeadingVisual.js +29 -37
  102. package/dist/FormControl/FormControlLeadingVisual.module.css.js +5 -5
  103. package/dist/FormControl/_FormControlContext.js +41 -48
  104. package/dist/FormControl/_FormControlValidation.js +29 -39
  105. package/dist/Header/Header.js +138 -165
  106. package/dist/Header/Header.module.css.js +9 -5
  107. package/dist/Heading/Heading.js +26 -37
  108. package/dist/Heading/Heading.module.css.js +5 -5
  109. package/dist/Hidden/Hidden.js +54 -77
  110. package/dist/Hidden/Hidden.module.css.js +5 -5
  111. package/dist/InlineMessage/InlineMessage.js +88 -116
  112. package/dist/InlineMessage/InlineMessage.module.css.js +8 -5
  113. package/dist/KeybindingHint/KeybindingHint.js +70 -88
  114. package/dist/KeybindingHint/KeybindingHint.module.css.js +5 -5
  115. package/dist/KeybindingHint/components/Chord.js +81 -93
  116. package/dist/KeybindingHint/components/Chord.module.css.js +11 -5
  117. package/dist/KeybindingHint/components/Key.js +49 -66
  118. package/dist/KeybindingHint/components/Sequence.js +12 -24
  119. package/dist/KeybindingHint/key-names.js +99 -114
  120. package/dist/Label/Label.js +56 -66
  121. package/dist/Label/Label.module.css.js +5 -5
  122. package/dist/Label/index.js +5 -5
  123. package/dist/LabelGroup/LabelGroup.js +260 -344
  124. package/dist/LabelGroup/LabelGroup.module.css.js +12 -5
  125. package/dist/Link/Link.js +31 -47
  126. package/dist/Link/Link.module.css.js +5 -5
  127. package/dist/NavList/NavList.js +424 -614
  128. package/dist/NavList/NavList.module.css.js +5 -5
  129. package/dist/Octicon/Octicon.js +35 -37
  130. package/dist/Overlay/Overlay.js +264 -318
  131. package/dist/Overlay/Overlay.module.css.js +8 -5
  132. package/dist/PageHeader/PageHeader.js +579 -823
  133. package/dist/PageHeader/PageHeader.module.css.js +21 -5
  134. package/dist/PageLayout/PageLayout.js +631 -913
  135. package/dist/PageLayout/PageLayout.module.css.js +31 -5
  136. package/dist/PageLayout/paneUtils.js +15 -29
  137. package/dist/PageLayout/usePaneWidth.js +334 -437
  138. package/dist/Pagehead/Pagehead.js +10 -14
  139. package/dist/Pagehead/Pagehead.module.css.js +5 -5
  140. package/dist/Pagination/Pagination.js +84 -114
  141. package/dist/Pagination/Pagination.module.css.js +9 -5
  142. package/dist/Pagination/index.js +5 -5
  143. package/dist/Pagination/model.js +118 -194
  144. package/dist/Popover/Popover.js +126 -151
  145. package/dist/Popover/Popover.module.css.js +8 -5
  146. package/dist/Portal/Portal.js +65 -85
  147. package/dist/Portal/index.js +5 -6
  148. package/dist/ProgressBar/ProgressBar.js +210 -255
  149. package/dist/ProgressBar/ProgressBar.module.css.js +9 -5
  150. package/dist/ProgressBar/index.js +6 -8
  151. package/dist/Radio/Radio.js +97 -115
  152. package/dist/Radio/Radio.module.css.js +5 -5
  153. package/dist/RadioGroup/RadioGroup.js +99 -118
  154. package/dist/RelativeTime/RelativeTime.js +64 -76
  155. package/dist/ScrollableRegion/ScrollableRegion.js +67 -79
  156. package/dist/ScrollableRegion/ScrollableRegion.module.css.js +5 -5
  157. package/dist/SegmentedControl/SegmentedControl.js +238 -287
  158. package/dist/SegmentedControl/SegmentedControl.module.css.js +15 -5
  159. package/dist/SegmentedControl/SegmentedControlButton.js +156 -187
  160. package/dist/SegmentedControl/SegmentedControlIconButton.js +133 -161
  161. package/dist/Select/Select.js +185 -234
  162. package/dist/Select/Select.module.css.js +10 -5
  163. package/dist/SelectPanel/SelectPanel.js +620 -828
  164. package/dist/SelectPanel/SelectPanel.module.css.js +27 -5
  165. package/dist/SelectPanel/SelectPanelMessage.js +37 -39
  166. package/dist/SideNav.js +24 -47
  167. package/dist/SideNav.module.css.js +12 -5
  168. package/dist/Skeleton/SkeletonBox.js +94 -111
  169. package/dist/Skeleton/SkeletonBox.module.css.js +8 -5
  170. package/dist/SkeletonAvatar/SkeletonAvatar.js +95 -120
  171. package/dist/SkeletonAvatar/SkeletonAvatar.module.css.js +5 -5
  172. package/dist/SkeletonText/SkeletonText.js +114 -137
  173. package/dist/SkeletonText/SkeletonText.module.css.js +8 -5
  174. package/dist/Spinner/Spinner.js +183 -211
  175. package/dist/Spinner/Spinner.module.css.js +9 -5
  176. package/dist/SplitPageLayout/SplitPageLayout.js +215 -276
  177. package/dist/Stack/Stack.js +207 -255
  178. package/dist/Stack/Stack.module.css.js +8 -5
  179. package/dist/Stack/index.js +4 -6
  180. package/dist/StateLabel/StateLabel.js +110 -123
  181. package/dist/StateLabel/StateLabel.module.css.js +8 -5
  182. package/dist/SubNav/SubNav.js +159 -197
  183. package/dist/SubNav/SubNav.module.css.js +11 -5
  184. package/dist/TabNav/TabNav.js +167 -199
  185. package/dist/TabNav/TabNav.module.css.js +10 -5
  186. package/dist/Text/Text.js +56 -67
  187. package/dist/Text/Text.module.css.js +5 -5
  188. package/dist/TextInput/TextInput.js +195 -228
  189. package/dist/TextInput/TextInput.module.css.js +8 -5
  190. package/dist/TextInputWithTokens/TextInputWithTokens.js +567 -673
  191. package/dist/TextInputWithTokens/TextInputWithTokens.module.css.js +14 -5
  192. package/dist/Textarea/TextArea.module.css.js +9 -5
  193. package/dist/Textarea/Textarea.js +264 -294
  194. package/dist/ThemeProvider.js +199 -257
  195. package/dist/Timeline/Timeline.js +204 -247
  196. package/dist/Timeline/Timeline.module.css.js +12 -5
  197. package/dist/ToggleSwitch/ToggleSwitch.js +403 -471
  198. package/dist/ToggleSwitch/ToggleSwitch.module.css.js +16 -5
  199. package/dist/Token/IssueLabelToken.js +256 -297
  200. package/dist/Token/IssueLabelToken.module.css.js +8 -5
  201. package/dist/Token/Token.js +232 -280
  202. package/dist/Token/Token.module.css.js +9 -5
  203. package/dist/Token/TokenBase.js +99 -126
  204. package/dist/Token/TokenBase.module.css.js +5 -5
  205. package/dist/Token/_RemoveTokenButton.js +27 -48
  206. package/dist/Token/_RemoveTokenButton.module.css.js +5 -5
  207. package/dist/Token/_TokenTextContainer.js +54 -65
  208. package/dist/Token/_TokenTextContainer.module.css.js +5 -5
  209. package/dist/Tooltip/Tooltip.js +49 -56
  210. package/dist/Tooltip/Tooltip.module.css.js +20 -5
  211. package/dist/TooltipV2/Tooltip.js +222 -305
  212. package/dist/TooltipV2/Tooltip.module.css.js +11 -5
  213. package/dist/TopicTag/TopicTag.js +46 -55
  214. package/dist/TopicTag/TopicTag.module.css.js +5 -5
  215. package/dist/TopicTag/TopicTagGroup.js +40 -48
  216. package/dist/TopicTag/TopicTagGroup.module.css.js +5 -5
  217. package/dist/TopicTag/index.js +5 -7
  218. package/dist/TreeView/TreeView.js +1082 -1414
  219. package/dist/TreeView/TreeView.module.css.js +24 -5
  220. package/dist/TreeView/shared.js +10 -9
  221. package/dist/TreeView/useRovingTabIndex.js +129 -203
  222. package/dist/TreeView/useTreeItemCache.js +64 -79
  223. package/dist/TreeView/useTypeahead.js +90 -112
  224. package/dist/Truncate/Truncate.js +21 -33
  225. package/dist/Truncate/Truncate.module.css.js +5 -5
  226. package/dist/UnderlineNav/UnderlineNav.js +278 -375
  227. package/dist/UnderlineNav/UnderlineNav.module.css.js +8 -5
  228. package/dist/UnderlineNav/UnderlineNavContext.js +8 -8
  229. package/dist/UnderlineNav/UnderlineNavItem.js +56 -72
  230. package/dist/UnderlineNav/UnderlineNavItem.module.css.js +5 -5
  231. package/dist/UnderlineNav/index.js +5 -7
  232. package/dist/UnderlineNav/styles.js +11 -15
  233. package/dist/VisuallyHidden/VisuallyHidden.js +51 -49
  234. package/dist/VisuallyHidden/VisuallyHidden.module.css.js +5 -5
  235. package/dist/_VisuallyHidden.js +50 -62
  236. package/dist/_VisuallyHidden.module.css.js +5 -5
  237. package/dist/deprecated/ActionList/Divider.js +23 -23
  238. package/dist/deprecated/ActionList/Divider.module.css.js +5 -5
  239. package/dist/deprecated/ActionList/Group.js +43 -50
  240. package/dist/deprecated/ActionList/Header.js +69 -81
  241. package/dist/deprecated/ActionList/Header.module.css.js +5 -5
  242. package/dist/deprecated/ActionList/Item.js +308 -352
  243. package/dist/deprecated/ActionList/Item.module.css.js +18 -5
  244. package/dist/deprecated/ActionList/List.js +157 -196
  245. package/dist/deprecated/ActionList/List.module.css.js +5 -5
  246. package/dist/deprecated/ActionList/index.js +14 -14
  247. package/dist/deprecated/ActionMenu.js +159 -190
  248. package/dist/deprecated/DialogV1/Dialog.js +166 -200
  249. package/dist/deprecated/DialogV1/Dialog.module.css.js +11 -5
  250. package/dist/deprecated/FilteredSearch/FilteredSearch.js +43 -51
  251. package/dist/deprecated/FilteredSearch/FilteredSearch.module.css.js +5 -5
  252. package/dist/deprecated/UnderlineNav/UnderlineNav.js +132 -160
  253. package/dist/deprecated/UnderlineNav/UnderlineNav.module.css.js +14 -5
  254. package/dist/deprecated/index.js +20 -9
  255. package/dist/experimental/IssueLabel/IssueLabel.js +134 -158
  256. package/dist/experimental/IssueLabel/IssueLabel.module.css.js +5 -5
  257. package/dist/experimental/SelectPanel2/SelectPanel.js +419 -567
  258. package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +32 -5
  259. package/dist/experimental/Tabs/Tabs.js +234 -297
  260. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +165 -215
  261. package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +5 -5
  262. package/dist/experimental/index.js +44 -33
  263. package/dist/hooks/useAnchoredPosition.d.ts +0 -6
  264. package/dist/hooks/useAnchoredPosition.d.ts.map +1 -1
  265. package/dist/hooks/useAnchoredPosition.js +123 -130
  266. package/dist/hooks/useControllableState.js +34 -59
  267. package/dist/hooks/useDetails.js +84 -99
  268. package/dist/hooks/useDialog.js +140 -178
  269. package/dist/hooks/useFocusTrap.js +57 -71
  270. package/dist/hooks/useFocusZone.js +32 -38
  271. package/dist/hooks/useId.js +14 -16
  272. package/dist/hooks/useIsMacOS.js +21 -26
  273. package/dist/hooks/useMedia.js +54 -68
  274. package/dist/hooks/useMenuInitialFocus.js +65 -62
  275. package/dist/hooks/useMenuKeyboardNavigation.js +129 -126
  276. package/dist/hooks/useMergedRefs.js +63 -78
  277. package/dist/hooks/useMnemonics.js +77 -107
  278. package/dist/hooks/useOnEscapePress.js +45 -56
  279. package/dist/hooks/useOnOutsideClick.js +32 -63
  280. package/dist/hooks/useOpenAndCloseFocus.js +40 -43
  281. package/dist/hooks/useOverflow.js +32 -36
  282. package/dist/hooks/useOverlay.js +56 -75
  283. package/dist/hooks/useProvidedRefOrCreate.js +24 -24
  284. package/dist/hooks/useProvidedStateOrCreate.js +33 -39
  285. package/dist/hooks/useRefObjectAsForwardedRef.js +30 -32
  286. package/dist/hooks/useRenderForcingRef.js +42 -46
  287. package/dist/hooks/useResizeObserver.js +32 -43
  288. package/dist/hooks/useResponsiveValue.js +37 -57
  289. package/dist/hooks/useSafeTimeout.js +26 -29
  290. package/dist/hooks/useScrollFlash.js +16 -23
  291. package/dist/hooks/useSlots.js +102 -136
  292. package/dist/hooks/useSyncedState.js +31 -37
  293. package/dist/index.js +88 -85
  294. package/dist/internal/components/ButtonReset.js +45 -50
  295. package/dist/internal/components/ButtonReset.module.css.js +5 -5
  296. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +79 -105
  297. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.module.css.js +12 -5
  298. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +16 -21
  299. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupContext.js +4 -4
  300. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +26 -35
  301. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +14 -19
  302. package/dist/internal/components/ConditionalWrapper.js +41 -51
  303. package/dist/internal/components/InputLabel.js +92 -113
  304. package/dist/internal/components/InputLabel.module.css.js +8 -5
  305. package/dist/internal/components/InputValidation.js +67 -87
  306. package/dist/internal/components/InputValidation.module.css.js +9 -5
  307. package/dist/internal/components/TextInputInnerAction.js +134 -173
  308. package/dist/internal/components/TextInputInnerAction.module.css.js +9 -5
  309. package/dist/internal/components/TextInputInnerVisualSlot.js +89 -110
  310. package/dist/internal/components/TextInputInnerVisualSlot.module.css.js +11 -5
  311. package/dist/internal/components/TextInputWrapper.js +187 -230
  312. package/dist/internal/components/TextInputWrapper.module.css.js +8 -5
  313. package/dist/internal/components/UnderlineTabbedInterface.js +191 -238
  314. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +11 -5
  315. package/dist/internal/components/UnstyledTextInput.js +40 -47
  316. package/dist/internal/components/UnstyledTextInput.module.css.js +5 -5
  317. package/dist/internal/components/ValidationAnimationContainer.js +55 -66
  318. package/dist/internal/components/ValidationAnimationContainer.module.css.js +8 -5
  319. package/dist/internal/hooks/useEffectCallback.js +35 -38
  320. package/dist/internal/hooks/useEffectOnce.js +23 -25
  321. package/dist/internal/utils/getResponsiveAttributes.js +23 -26
  322. package/dist/internal/utils/hasInteractiveNodes.js +34 -46
  323. package/dist/legacy-theme/ts/color-schemes.js +4250 -4732
  324. package/dist/live-region/Announce.js +144 -183
  325. package/dist/live-region/AriaAlert.js +20 -22
  326. package/dist/live-region/AriaStatus.js +20 -22
  327. package/dist/next/index.js +3 -1
  328. package/dist/test-helpers.js +40 -62
  329. package/dist/theme.js +83 -47
  330. package/dist/utils/character-counter.js +45 -63
  331. package/dist/utils/create-component.js +15 -16
  332. package/dist/utils/descendant-registry.js +182 -218
  333. package/dist/utils/environment.js +7 -7
  334. package/dist/utils/getBreakpointDeclarations.js +9 -10
  335. package/dist/utils/invariant.js +17 -23
  336. package/dist/utils/is-slot.js +10 -11
  337. package/dist/utils/isNumeric.js +3 -3
  338. package/dist/utils/modern-polymorphic.js +12 -20
  339. package/dist/utils/scroll.js +8 -11
  340. package/dist/utils/theme.js +5 -10
  341. package/dist/utils/useIsomorphicLayoutEffect.js +4 -9
  342. package/dist/utils/warning.js +14 -21
  343. package/generated/components.json +9 -9
  344. package/package.json +5 -10
@@ -1,688 +1,582 @@
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
-
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
+ */
19
22
  const overflowCountClassMap = {
20
- small: styles.OverflowCountSmall,
21
- medium: styles.OverflowCountMedium,
22
- large: styles.OverflowCountLarge,
23
- xlarge: styles.OverflowCountXLarge
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
24
27
  };
25
-
26
- // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
27
28
  function TextInputWithTokensInnerComponent(t0, forwardedRef) {
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;
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;
665
561
  }
666
562
  function _temp5(event_2) {
667
- event_2.stopPropagation();
563
+ event_2.stopPropagation();
668
564
  }
669
565
  function _temp4(el) {
670
- return isFocusable(el);
566
+ return isFocusable(el);
671
567
  }
672
568
  function _temp3(element) {
673
- return !element.getAttributeNames().includes("aria-hidden");
569
+ return !element.getAttributeNames().includes("aria-hidden");
674
570
  }
675
571
  function _temp2(tokenText) {
676
- return tokenText !== null;
572
+ return tokenText !== null;
677
573
  }
678
574
  function _temp(token) {
679
- if ("text" in token && typeof token.text === "string" && token.text.trim().length) {
680
- return token.text;
681
- }
682
- return null;
575
+ if ("text" in token && typeof token.text === "string" && token.text.trim().length) return token.text;
576
+ return null;
683
577
  }
684
- const TextInputWithTokens = /*#__PURE__*/React.forwardRef(TextInputWithTokensInnerComponent);
685
- TextInputWithTokens.displayName = 'TextInputWithTokens';
686
- TextInputWithTokens.__SLOT__ = Symbol('TextInputWithTokens');
687
-
578
+ const TextInputWithTokens = /* @__PURE__ */ React.forwardRef(TextInputWithTokensInnerComponent);
579
+ TextInputWithTokens.displayName = "TextInputWithTokens";
580
+ TextInputWithTokens.__SLOT__ = Symbol("TextInputWithTokens");
581
+ //#endregion
688
582
  export { TextInputWithTokens as default };