@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,284 +1,236 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { forwardRef } from 'react';
3
- import TokenBase, { isTokenInteractive, defaultTokenSize } from './TokenBase.js';
4
- import RemoveTokenButton from './_RemoveTokenButton.js';
5
- import TokenTextContainer from './_TokenTextContainer.js';
6
- import VisuallyHidden from '../_VisuallyHidden.js';
7
- import classes from './Token.module.css.js';
8
- import { clsx } from 'clsx';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
-
1
+ import VisuallyHidden from "../_VisuallyHidden.js";
2
+ import TokenBase, { defaultTokenSize, isTokenInteractive } from "./TokenBase.js";
3
+ import RemoveTokenButton from "./_RemoveTokenButton.js";
4
+ import TokenTextContainer from "./_TokenTextContainer.js";
5
+ import Token_module_css_default from "./Token.module.css.js";
6
+ import { c } from "react-compiler-runtime";
7
+ import { clsx } from "clsx";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { forwardRef } from "react";
10
+ //#region src/Token/Token.tsx
11
11
  const tokenBorderWidthPx = 1;
12
- const LeadingVisualContainer = t0 => {
13
- const $ = c(7);
14
- const {
15
- children,
16
- size
17
- } = t0;
18
- let t1;
19
- if ($[0] !== size) {
20
- t1 = size && ["large", "xlarge"].includes(size);
21
- $[0] = size;
22
- $[1] = t1;
23
- } else {
24
- t1 = $[1];
25
- }
26
- let t2;
27
- if ($[2] !== t1) {
28
- t2 = clsx(classes.LeadingVisualContainer, {
29
- [classes.LargeLeadingVisual]: t1
30
- });
31
- $[2] = t1;
32
- $[3] = t2;
33
- } else {
34
- t2 = $[3];
35
- }
36
- let t3;
37
- if ($[4] !== children || $[5] !== t2) {
38
- t3 = /*#__PURE__*/jsx("div", {
39
- className: t2,
40
- children: children
41
- });
42
- $[4] = children;
43
- $[5] = t2;
44
- $[6] = t3;
45
- } else {
46
- t3 = $[6];
47
- }
48
- return t3;
12
+ const LeadingVisualContainer = (t0) => {
13
+ const $ = c(7);
14
+ const { children, size } = t0;
15
+ let t1;
16
+ if ($[0] !== size) {
17
+ t1 = size && ["large", "xlarge"].includes(size);
18
+ $[0] = size;
19
+ $[1] = t1;
20
+ } else t1 = $[1];
21
+ let t2;
22
+ if ($[2] !== t1) {
23
+ t2 = clsx(Token_module_css_default.LeadingVisualContainer, { [Token_module_css_default.LargeLeadingVisual]: t1 });
24
+ $[2] = t1;
25
+ $[3] = t2;
26
+ } else t2 = $[3];
27
+ let t3;
28
+ if ($[4] !== children || $[5] !== t2) {
29
+ t3 = /* @__PURE__ */ jsx("div", {
30
+ className: t2,
31
+ children
32
+ });
33
+ $[4] = children;
34
+ $[5] = t2;
35
+ $[6] = t3;
36
+ } else t3 = $[6];
37
+ return t3;
49
38
  };
50
- const Token = /*#__PURE__*/forwardRef((props, forwardedRef) => {
51
- const $ = c(66);
52
- let LeadingVisual;
53
- let as;
54
- let className;
55
- let hideRemoveButton;
56
- let href;
57
- let id;
58
- let onClick;
59
- let onRemove;
60
- let rest;
61
- let style;
62
- let t0;
63
- let text;
64
- if ($[0] !== props) {
65
- ({
66
- as,
67
- onRemove,
68
- id,
69
- leadingVisual: LeadingVisual,
70
- text,
71
- size: t0,
72
- hideRemoveButton,
73
- href,
74
- onClick,
75
- className,
76
- style,
77
- ...rest
78
- } = props);
79
- $[0] = props;
80
- $[1] = LeadingVisual;
81
- $[2] = as;
82
- $[3] = className;
83
- $[4] = hideRemoveButton;
84
- $[5] = href;
85
- $[6] = id;
86
- $[7] = onClick;
87
- $[8] = onRemove;
88
- $[9] = rest;
89
- $[10] = style;
90
- $[11] = t0;
91
- $[12] = text;
92
- } else {
93
- LeadingVisual = $[1];
94
- as = $[2];
95
- className = $[3];
96
- hideRemoveButton = $[4];
97
- href = $[5];
98
- id = $[6];
99
- onClick = $[7];
100
- onRemove = $[8];
101
- rest = $[9];
102
- style = $[10];
103
- t0 = $[11];
104
- text = $[12];
105
- }
106
- const size = t0 === undefined ? defaultTokenSize : t0;
107
- let t1;
108
- if ($[13] !== hideRemoveButton || $[14] !== onRemove || $[15] !== props) {
109
- t1 = isTokenInteractive(props) && Boolean(onRemove) && !hideRemoveButton;
110
- $[13] = hideRemoveButton;
111
- $[14] = onRemove;
112
- $[15] = props;
113
- $[16] = t1;
114
- } else {
115
- t1 = $[16];
116
- }
117
- const hasMultipleActionTargets = t1;
118
- let t2;
119
- if ($[17] !== onRemove) {
120
- t2 = e => {
121
- e.stopPropagation();
122
- onRemove && onRemove();
123
- };
124
- $[17] = onRemove;
125
- $[18] = t2;
126
- } else {
127
- t2 = $[18];
128
- }
129
- const onRemoveClick = t2;
130
- let t3;
131
- if ($[19] !== as || $[20] !== href || $[21] !== onClick) {
132
- t3 = {
133
- as,
134
- href,
135
- onClick
136
- };
137
- $[19] = as;
138
- $[20] = href;
139
- $[21] = onClick;
140
- $[22] = t3;
141
- } else {
142
- t3 = $[22];
143
- }
144
- const interactiveTokenProps = t3;
145
- let t4;
146
- if ($[23] !== id) {
147
- var _id;
148
- t4 = (_id = id) === null || _id === void 0 ? void 0 : _id.toString();
149
- $[23] = id;
150
- $[24] = t4;
151
- } else {
152
- t4 = $[24];
153
- }
154
- let t5;
155
- if ($[25] !== className) {
156
- t5 = clsx(className, classes.Token);
157
- $[25] = className;
158
- $[26] = t5;
159
- } else {
160
- t5 = $[26];
161
- }
162
- const t6 = !(hideRemoveButton || !onRemove);
163
- let t7;
164
- if ($[27] !== hasMultipleActionTargets || $[28] !== interactiveTokenProps) {
165
- t7 = !hasMultipleActionTargets ? interactiveTokenProps : {};
166
- $[27] = hasMultipleActionTargets;
167
- $[28] = interactiveTokenProps;
168
- $[29] = t7;
169
- } else {
170
- t7 = $[29];
171
- }
172
- let t8;
173
- if ($[30] !== style) {
174
- t8 = {
175
- borderWidth: `${tokenBorderWidthPx}px`,
176
- ...style
177
- };
178
- $[30] = style;
179
- $[31] = t8;
180
- } else {
181
- t8 = $[31];
182
- }
183
- let t9;
184
- if ($[32] !== LeadingVisual || $[33] !== size) {
185
- t9 = LeadingVisual && size !== "small" ? /*#__PURE__*/jsx(LeadingVisualContainer, {
186
- size: size,
187
- children: /*#__PURE__*/jsx(LeadingVisual, {})
188
- }) : null;
189
- $[32] = LeadingVisual;
190
- $[33] = size;
191
- $[34] = t9;
192
- } else {
193
- t9 = $[34];
194
- }
195
- let t10;
196
- if ($[35] !== hasMultipleActionTargets || $[36] !== interactiveTokenProps) {
197
- t10 = hasMultipleActionTargets ? interactiveTokenProps : {};
198
- $[35] = hasMultipleActionTargets;
199
- $[36] = interactiveTokenProps;
200
- $[37] = t10;
201
- } else {
202
- t10 = $[37];
203
- }
204
- let t11;
205
- if ($[38] !== onRemove) {
206
- t11 = onRemove && /*#__PURE__*/jsx(VisuallyHidden, {
207
- children: " (press backspace or delete to remove)"
208
- });
209
- $[38] = onRemove;
210
- $[39] = t11;
211
- } else {
212
- t11 = $[39];
213
- }
214
- let t12;
215
- if ($[40] !== t10 || $[41] !== t11 || $[42] !== text) {
216
- t12 = /*#__PURE__*/jsxs(TokenTextContainer, {
217
- ...t10,
218
- children: [text, t11]
219
- });
220
- $[40] = t10;
221
- $[41] = t11;
222
- $[42] = text;
223
- $[43] = t12;
224
- } else {
225
- t12 = $[43];
226
- }
227
- let t13;
228
- if ($[44] !== hasMultipleActionTargets || $[45] !== hideRemoveButton || $[46] !== onRemove || $[47] !== onRemoveClick || $[48] !== props || $[49] !== size) {
229
- t13 = !hideRemoveButton && onRemove ? /*#__PURE__*/jsx(RemoveTokenButton, {
230
- borderOffset: tokenBorderWidthPx,
231
- onClick: onRemoveClick,
232
- size: size,
233
- isParentInteractive: isTokenInteractive(props),
234
- "aria-hidden": hasMultipleActionTargets ? "true" : "false"
235
- }) : null;
236
- $[44] = hasMultipleActionTargets;
237
- $[45] = hideRemoveButton;
238
- $[46] = onRemove;
239
- $[47] = onRemoveClick;
240
- $[48] = props;
241
- $[49] = size;
242
- $[50] = t13;
243
- } else {
244
- t13 = $[50];
245
- }
246
- let t14;
247
- if ($[51] !== forwardedRef || $[52] !== onRemove || $[53] !== props.isSelected || $[54] !== rest || $[55] !== size || $[56] !== t12 || $[57] !== t13 || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7 || $[62] !== t8 || $[63] !== t9 || $[64] !== text) {
248
- t14 = /*#__PURE__*/jsxs(TokenBase, {
249
- onRemove: onRemove,
250
- id: t4,
251
- className: t5,
252
- text: text,
253
- size: size,
254
- "data-is-selected": props.isSelected,
255
- "data-is-remove-btn": t6,
256
- ...t7,
257
- ...rest,
258
- ref: forwardedRef,
259
- style: t8,
260
- children: [t9, t12, t13]
261
- });
262
- $[51] = forwardedRef;
263
- $[52] = onRemove;
264
- $[53] = props.isSelected;
265
- $[54] = rest;
266
- $[55] = size;
267
- $[56] = t12;
268
- $[57] = t13;
269
- $[58] = t4;
270
- $[59] = t5;
271
- $[60] = t6;
272
- $[61] = t7;
273
- $[62] = t8;
274
- $[63] = t9;
275
- $[64] = text;
276
- $[65] = t14;
277
- } else {
278
- t14 = $[65];
279
- }
280
- return t14;
39
+ const Token = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
40
+ const $ = c(66);
41
+ let LeadingVisual;
42
+ let as;
43
+ let className;
44
+ let hideRemoveButton;
45
+ let href;
46
+ let id;
47
+ let onClick;
48
+ let onRemove;
49
+ let rest;
50
+ let style;
51
+ let t0;
52
+ let text;
53
+ if ($[0] !== props) {
54
+ ({as, onRemove, id, leadingVisual: LeadingVisual, text, size: t0, hideRemoveButton, href, onClick, className, style, ...rest} = props);
55
+ $[0] = props;
56
+ $[1] = LeadingVisual;
57
+ $[2] = as;
58
+ $[3] = className;
59
+ $[4] = hideRemoveButton;
60
+ $[5] = href;
61
+ $[6] = id;
62
+ $[7] = onClick;
63
+ $[8] = onRemove;
64
+ $[9] = rest;
65
+ $[10] = style;
66
+ $[11] = t0;
67
+ $[12] = text;
68
+ } else {
69
+ LeadingVisual = $[1];
70
+ as = $[2];
71
+ className = $[3];
72
+ hideRemoveButton = $[4];
73
+ href = $[5];
74
+ id = $[6];
75
+ onClick = $[7];
76
+ onRemove = $[8];
77
+ rest = $[9];
78
+ style = $[10];
79
+ t0 = $[11];
80
+ text = $[12];
81
+ }
82
+ const size = t0 === void 0 ? defaultTokenSize : t0;
83
+ let t1;
84
+ if ($[13] !== hideRemoveButton || $[14] !== onRemove || $[15] !== props) {
85
+ t1 = isTokenInteractive(props) && Boolean(onRemove) && !hideRemoveButton;
86
+ $[13] = hideRemoveButton;
87
+ $[14] = onRemove;
88
+ $[15] = props;
89
+ $[16] = t1;
90
+ } else t1 = $[16];
91
+ const hasMultipleActionTargets = t1;
92
+ let t2;
93
+ if ($[17] !== onRemove) {
94
+ t2 = (e) => {
95
+ e.stopPropagation();
96
+ onRemove && onRemove();
97
+ };
98
+ $[17] = onRemove;
99
+ $[18] = t2;
100
+ } else t2 = $[18];
101
+ const onRemoveClick = t2;
102
+ let t3;
103
+ if ($[19] !== as || $[20] !== href || $[21] !== onClick) {
104
+ t3 = {
105
+ as,
106
+ href,
107
+ onClick
108
+ };
109
+ $[19] = as;
110
+ $[20] = href;
111
+ $[21] = onClick;
112
+ $[22] = t3;
113
+ } else t3 = $[22];
114
+ const interactiveTokenProps = t3;
115
+ let t4;
116
+ if ($[23] !== id) {
117
+ var _id;
118
+ t4 = (_id = id) === null || _id === void 0 ? void 0 : _id.toString();
119
+ $[23] = id;
120
+ $[24] = t4;
121
+ } else t4 = $[24];
122
+ let t5;
123
+ if ($[25] !== className) {
124
+ t5 = clsx(className, Token_module_css_default.Token);
125
+ $[25] = className;
126
+ $[26] = t5;
127
+ } else t5 = $[26];
128
+ const t6 = !(hideRemoveButton || !onRemove);
129
+ let t7;
130
+ if ($[27] !== hasMultipleActionTargets || $[28] !== interactiveTokenProps) {
131
+ t7 = !hasMultipleActionTargets ? interactiveTokenProps : {};
132
+ $[27] = hasMultipleActionTargets;
133
+ $[28] = interactiveTokenProps;
134
+ $[29] = t7;
135
+ } else t7 = $[29];
136
+ let t8;
137
+ if ($[30] !== style) {
138
+ t8 = {
139
+ borderWidth: `${tokenBorderWidthPx}px`,
140
+ ...style
141
+ };
142
+ $[30] = style;
143
+ $[31] = t8;
144
+ } else t8 = $[31];
145
+ let t9;
146
+ if ($[32] !== LeadingVisual || $[33] !== size) {
147
+ t9 = LeadingVisual && size !== "small" ? /* @__PURE__ */ jsx(LeadingVisualContainer, {
148
+ size,
149
+ children: /* @__PURE__ */ jsx(LeadingVisual, {})
150
+ }) : null;
151
+ $[32] = LeadingVisual;
152
+ $[33] = size;
153
+ $[34] = t9;
154
+ } else t9 = $[34];
155
+ let t10;
156
+ if ($[35] !== hasMultipleActionTargets || $[36] !== interactiveTokenProps) {
157
+ t10 = hasMultipleActionTargets ? interactiveTokenProps : {};
158
+ $[35] = hasMultipleActionTargets;
159
+ $[36] = interactiveTokenProps;
160
+ $[37] = t10;
161
+ } else t10 = $[37];
162
+ let t11;
163
+ if ($[38] !== onRemove) {
164
+ t11 = onRemove && /* @__PURE__ */ jsx(VisuallyHidden, { children: " (press backspace or delete to remove)" });
165
+ $[38] = onRemove;
166
+ $[39] = t11;
167
+ } else t11 = $[39];
168
+ let t12;
169
+ if ($[40] !== t10 || $[41] !== t11 || $[42] !== text) {
170
+ t12 = /* @__PURE__ */ jsxs(TokenTextContainer, {
171
+ ...t10,
172
+ children: [text, t11]
173
+ });
174
+ $[40] = t10;
175
+ $[41] = t11;
176
+ $[42] = text;
177
+ $[43] = t12;
178
+ } else t12 = $[43];
179
+ let t13;
180
+ if ($[44] !== hasMultipleActionTargets || $[45] !== hideRemoveButton || $[46] !== onRemove || $[47] !== onRemoveClick || $[48] !== props || $[49] !== size) {
181
+ t13 = !hideRemoveButton && onRemove ? /* @__PURE__ */ jsx(RemoveTokenButton, {
182
+ borderOffset: tokenBorderWidthPx,
183
+ onClick: onRemoveClick,
184
+ size,
185
+ isParentInteractive: isTokenInteractive(props),
186
+ "aria-hidden": hasMultipleActionTargets ? "true" : "false"
187
+ }) : null;
188
+ $[44] = hasMultipleActionTargets;
189
+ $[45] = hideRemoveButton;
190
+ $[46] = onRemove;
191
+ $[47] = onRemoveClick;
192
+ $[48] = props;
193
+ $[49] = size;
194
+ $[50] = t13;
195
+ } else t13 = $[50];
196
+ let t14;
197
+ if ($[51] !== forwardedRef || $[52] !== onRemove || $[53] !== props.isSelected || $[54] !== rest || $[55] !== size || $[56] !== t12 || $[57] !== t13 || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7 || $[62] !== t8 || $[63] !== t9 || $[64] !== text) {
198
+ t14 = /* @__PURE__ */ jsxs(TokenBase, {
199
+ onRemove,
200
+ id: t4,
201
+ className: t5,
202
+ text,
203
+ size,
204
+ "data-is-selected": props.isSelected,
205
+ "data-is-remove-btn": t6,
206
+ ...t7,
207
+ ...rest,
208
+ ref: forwardedRef,
209
+ style: t8,
210
+ children: [
211
+ t9,
212
+ t12,
213
+ t13
214
+ ]
215
+ });
216
+ $[51] = forwardedRef;
217
+ $[52] = onRemove;
218
+ $[53] = props.isSelected;
219
+ $[54] = rest;
220
+ $[55] = size;
221
+ $[56] = t12;
222
+ $[57] = t13;
223
+ $[58] = t4;
224
+ $[59] = t5;
225
+ $[60] = t6;
226
+ $[61] = t7;
227
+ $[62] = t8;
228
+ $[63] = t9;
229
+ $[64] = text;
230
+ $[65] = t14;
231
+ } else t14 = $[65];
232
+ return t14;
281
233
  });
282
- Token.displayName = 'Token';
283
-
234
+ Token.displayName = "Token";
235
+ //#endregion
284
236
  export { Token as default };
@@ -1,5 +1,9 @@
1
- import './Token-b3c86dc0.css';
2
-
3
- var classes = {"Token":"prc-Token-Token-A5-r7","LeadingVisualContainer":"prc-Token-LeadingVisualContainer-z-WxM","LargeLeadingVisual":"prc-Token-LargeLeadingVisual-foRMf"};
4
-
5
- export { classes as default };
1
+ import "./Token-b3c86dc0.css";
2
+ //#region src/Token/Token.module.css.js
3
+ var Token_module_css_default = {
4
+ "Token": "prc-Token-Token-A5-r7",
5
+ "LeadingVisualContainer": "prc-Token-LeadingVisualContainer-z-WxM",
6
+ "LargeLeadingVisual": "prc-Token-LargeLeadingVisual-foRMf"
7
+ };
8
+ //#endregion
9
+ export { Token_module_css_default as default };