@primer/components 0.0.0-2021821174731 → 0.0.0-2021821193917

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/CHANGELOG.md +2 -28
  2. package/dist/browser.esm.js +619 -665
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +386 -432
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Divider.js +1 -1
  7. package/lib/ActionList/Header.js +2 -2
  8. package/lib/ActionList/Item.js +13 -13
  9. package/lib/ActionList/List.js +1 -1
  10. package/lib/AnchoredOverlay/AnchoredOverlay.js +2 -2
  11. package/lib/Autocomplete/Autocomplete.d.ts +36 -0
  12. package/lib/Autocomplete/Autocomplete.js +55 -0
  13. package/lib/Autocomplete/AutocompleteContext.d.ts +13 -0
  14. package/lib/Autocomplete/AutocompleteContext.js +14 -0
  15. package/lib/Autocomplete/AutocompleteInput.d.ts +9 -0
  16. package/lib/Autocomplete/AutocompleteInput.js +128 -0
  17. package/lib/Autocomplete/AutocompleteMenu.d.ts +54 -0
  18. package/lib/Autocomplete/AutocompleteMenu.js +268 -0
  19. package/lib/Autocomplete/index.d.ts +2 -0
  20. package/lib/Autocomplete/index.js +15 -0
  21. package/lib/Avatar.d.ts +0 -4
  22. package/lib/AvatarPair.js +1 -1
  23. package/lib/AvatarStack.js +1 -1
  24. package/lib/Badge/Badge.d.ts +8 -0
  25. package/lib/Badge/Badge.js +59 -0
  26. package/lib/Badge/BadgeState.d.ts +13 -0
  27. package/lib/Badge/BadgeState.js +51 -0
  28. package/lib/Badge/_badgeStyleUtils.d.ts +3 -0
  29. package/lib/Badge/_badgeStyleUtils.js +39 -0
  30. package/lib/BranchName.js +1 -1
  31. package/lib/Breadcrumb.js +2 -2
  32. package/lib/Button/Button.d.ts +1 -0
  33. package/lib/Button/Button.js +1 -1
  34. package/lib/Button/ButtonClose.d.ts +2 -1
  35. package/lib/Button/ButtonClose.js +1 -1
  36. package/lib/Button/ButtonDanger.d.ts +1 -0
  37. package/lib/Button/ButtonInvisible.d.ts +1 -0
  38. package/lib/Button/ButtonInvisible.js +1 -1
  39. package/lib/Button/ButtonOutline.d.ts +1 -0
  40. package/lib/Button/ButtonPrimary.d.ts +1 -0
  41. package/lib/Button/ButtonTableList.js +1 -1
  42. package/lib/CircleBadge.js +1 -1
  43. package/lib/CircleOcticon.d.ts +1 -0
  44. package/lib/CircleOcticon.js +1 -1
  45. package/lib/CounterLabel.js +2 -2
  46. package/lib/Dialog/ConfirmationDialog.js +1 -1
  47. package/lib/Dialog/Dialog.js +9 -9
  48. package/lib/Dialog.d.ts +3 -2
  49. package/lib/Dialog.js +4 -4
  50. package/lib/Dropdown.d.ts +4 -0
  51. package/lib/Dropdown.js +2 -2
  52. package/lib/DropdownMenu/DropdownButton.d.ts +2 -1
  53. package/lib/DropdownStyles.js +6 -6
  54. package/lib/FilterList.d.ts +1 -0
  55. package/lib/FilterList.js +1 -1
  56. package/lib/FilteredActionList/FilteredActionList.js +5 -5
  57. package/lib/Flash.js +1 -1
  58. package/lib/Label.js +2 -2
  59. package/lib/Link.js +1 -1
  60. package/lib/Overlay.d.ts +2 -1
  61. package/lib/Overlay.js +11 -6
  62. package/lib/Pagehead.js +1 -1
  63. package/lib/Pagination/Pagination.js +1 -1
  64. package/lib/Popover.js +1 -1
  65. package/lib/Position.d.ts +4 -4
  66. package/lib/ProgressBar.js +1 -1
  67. package/lib/SelectMenu/SelectMenu.d.ts +337 -15
  68. package/lib/SelectMenu/SelectMenuDivider.js +1 -1
  69. package/lib/SelectMenu/SelectMenuFilter.d.ts +1 -1
  70. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  71. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  72. package/lib/SelectMenu/SelectMenuHeader.js +2 -2
  73. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  74. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  75. package/lib/SelectMenu/SelectMenuList.js +1 -1
  76. package/lib/SelectMenu/SelectMenuLoadingAnimation.js +1 -1
  77. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  78. package/lib/SelectMenu/SelectMenuModal.js +2 -2
  79. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  80. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  81. package/lib/SideNav.js +5 -5
  82. package/lib/StateLabel.js +1 -1
  83. package/lib/SubNav.js +1 -1
  84. package/lib/TabNav.js +2 -2
  85. package/lib/TextInput.d.ts +6 -6
  86. package/lib/TextInput.js +16 -21
  87. package/lib/TextInputTokens.d.ts +32 -0
  88. package/lib/TextInputTokens.js +241 -0
  89. package/lib/TextInputWithTokens.d.ts +41 -0
  90. package/lib/TextInputWithTokens.js +396 -0
  91. package/lib/Timeline.d.ts +1 -0
  92. package/lib/Timeline.js +19 -16
  93. package/lib/Token/Token.d.ts +7 -0
  94. package/lib/Token/Token.js +69 -0
  95. package/lib/Token/TokenBase.d.ts +16 -0
  96. package/lib/Token/TokenBase.js +76 -0
  97. package/lib/Token/TokenLabel.d.ts +10 -0
  98. package/lib/Token/TokenLabel.js +115 -0
  99. package/lib/Token/TokenProfile.d.ts +7 -0
  100. package/lib/Token/TokenProfile.js +45 -0
  101. package/lib/Token/_AddTokenButton.d.ts +3 -0
  102. package/lib/Token/_AddTokenButton.js +42 -0
  103. package/lib/Token/_RemoveTokenButton.d.ts +3 -0
  104. package/lib/Token/_RemoveTokenButton.js +42 -0
  105. package/lib/Token/_tokenButtonUtils.d.ts +8 -0
  106. package/lib/Token/_tokenButtonUtils.js +42 -0
  107. package/lib/Tooltip.js +1 -1
  108. package/lib/UnderlineNav.js +2 -2
  109. package/lib/hooks/useOverlay.d.ts +2 -1
  110. package/lib/hooks/useOverlay.js +11 -6
  111. package/lib/index.d.ts +0 -1
  112. package/lib/index.js +0 -14
  113. package/lib/theme-preval.d.ts +6 -12
  114. package/lib/theme-preval.js +0 -940
  115. package/lib/utils/testing.d.ts +0 -1854
  116. package/lib/utils/uniqueId.js +0 -1
  117. package/lib-esm/ActionList/Divider.js +1 -1
  118. package/lib-esm/ActionList/Header.js +2 -2
  119. package/lib-esm/ActionList/Item.js +14 -14
  120. package/lib-esm/ActionList/List.js +1 -1
  121. package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -3
  122. package/lib-esm/Autocomplete/Autocomplete.d.ts +36 -0
  123. package/lib-esm/Autocomplete/Autocomplete.js +36 -0
  124. package/lib-esm/Autocomplete/AutocompleteContext.d.ts +13 -0
  125. package/lib-esm/Autocomplete/AutocompleteContext.js +5 -0
  126. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +9 -0
  127. package/lib-esm/Autocomplete/AutocompleteInput.js +109 -0
  128. package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +54 -0
  129. package/lib-esm/Autocomplete/AutocompleteMenu.js +244 -0
  130. package/lib-esm/Autocomplete/index.d.ts +2 -0
  131. package/lib-esm/Autocomplete/index.js +1 -0
  132. package/lib-esm/Avatar.d.ts +0 -4
  133. package/lib-esm/AvatarPair.js +1 -1
  134. package/lib-esm/AvatarStack.js +1 -1
  135. package/lib-esm/Badge/Badge.d.ts +8 -0
  136. package/lib-esm/Badge/Badge.js +44 -0
  137. package/lib-esm/Badge/BadgeState.d.ts +13 -0
  138. package/lib-esm/Badge/BadgeState.js +40 -0
  139. package/lib-esm/Badge/_badgeStyleUtils.d.ts +3 -0
  140. package/lib-esm/Badge/_badgeStyleUtils.js +29 -0
  141. package/lib-esm/BranchName.js +1 -1
  142. package/lib-esm/Breadcrumb.js +2 -2
  143. package/lib-esm/Button/Button.d.ts +1 -0
  144. package/lib-esm/Button/Button.js +1 -1
  145. package/lib-esm/Button/ButtonClose.d.ts +2 -1
  146. package/lib-esm/Button/ButtonClose.js +1 -1
  147. package/lib-esm/Button/ButtonDanger.d.ts +1 -0
  148. package/lib-esm/Button/ButtonInvisible.d.ts +1 -0
  149. package/lib-esm/Button/ButtonInvisible.js +1 -1
  150. package/lib-esm/Button/ButtonOutline.d.ts +1 -0
  151. package/lib-esm/Button/ButtonPrimary.d.ts +1 -0
  152. package/lib-esm/Button/ButtonTableList.js +1 -1
  153. package/lib-esm/CircleBadge.js +1 -1
  154. package/lib-esm/CircleOcticon.d.ts +1 -0
  155. package/lib-esm/CircleOcticon.js +1 -1
  156. package/lib-esm/CounterLabel.js +2 -2
  157. package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
  158. package/lib-esm/Dialog/Dialog.js +8 -8
  159. package/lib-esm/Dialog.d.ts +3 -2
  160. package/lib-esm/Dialog.js +4 -4
  161. package/lib-esm/Dropdown.d.ts +4 -0
  162. package/lib-esm/Dropdown.js +2 -2
  163. package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -1
  164. package/lib-esm/DropdownStyles.js +6 -6
  165. package/lib-esm/FilterList.d.ts +1 -0
  166. package/lib-esm/FilterList.js +1 -1
  167. package/lib-esm/FilteredActionList/FilteredActionList.js +5 -5
  168. package/lib-esm/Flash.js +1 -1
  169. package/lib-esm/Label.js +2 -2
  170. package/lib-esm/Link.js +1 -1
  171. package/lib-esm/Overlay.d.ts +2 -1
  172. package/lib-esm/Overlay.js +9 -6
  173. package/lib-esm/Pagehead.js +1 -1
  174. package/lib-esm/Pagination/Pagination.js +1 -1
  175. package/lib-esm/Popover.js +1 -1
  176. package/lib-esm/Position.d.ts +4 -4
  177. package/lib-esm/ProgressBar.js +1 -1
  178. package/lib-esm/SelectMenu/SelectMenu.d.ts +337 -15
  179. package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
  180. package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +1 -1
  181. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  182. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  183. package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
  184. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  185. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  186. package/lib-esm/SelectMenu/SelectMenuList.js +1 -1
  187. package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +1 -1
  188. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  189. package/lib-esm/SelectMenu/SelectMenuModal.js +2 -2
  190. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  191. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  192. package/lib-esm/SideNav.js +5 -5
  193. package/lib-esm/StateLabel.js +1 -1
  194. package/lib-esm/SubNav.js +1 -1
  195. package/lib-esm/TabNav.js +2 -2
  196. package/lib-esm/TextInput.d.ts +6 -6
  197. package/lib-esm/TextInput.js +16 -22
  198. package/lib-esm/TextInputTokens.d.ts +32 -0
  199. package/lib-esm/TextInputTokens.js +211 -0
  200. package/lib-esm/TextInputWithTokens.d.ts +41 -0
  201. package/lib-esm/TextInputWithTokens.js +361 -0
  202. package/lib-esm/Timeline.d.ts +1 -0
  203. package/lib-esm/Timeline.js +17 -12
  204. package/lib-esm/Token/Token.d.ts +7 -0
  205. package/lib-esm/Token/Token.js +49 -0
  206. package/lib-esm/Token/TokenBase.d.ts +16 -0
  207. package/lib-esm/Token/TokenBase.js +56 -0
  208. package/lib-esm/Token/TokenLabel.d.ts +10 -0
  209. package/lib-esm/Token/TokenLabel.js +99 -0
  210. package/lib-esm/Token/TokenProfile.d.ts +7 -0
  211. package/lib-esm/Token/TokenProfile.js +28 -0
  212. package/lib-esm/Token/_AddTokenButton.d.ts +3 -0
  213. package/lib-esm/Token/_AddTokenButton.js +27 -0
  214. package/lib-esm/Token/_RemoveTokenButton.d.ts +3 -0
  215. package/lib-esm/Token/_RemoveTokenButton.js +27 -0
  216. package/lib-esm/Token/_tokenButtonUtils.d.ts +8 -0
  217. package/lib-esm/Token/_tokenButtonUtils.js +26 -0
  218. package/lib-esm/Tooltip.js +1 -1
  219. package/lib-esm/UnderlineNav.js +2 -2
  220. package/lib-esm/hooks/useOverlay.d.ts +2 -1
  221. package/lib-esm/hooks/useOverlay.js +11 -6
  222. package/lib-esm/index.d.ts +0 -1
  223. package/lib-esm/index.js +1 -2
  224. package/lib-esm/theme-preval.d.ts +6 -12
  225. package/lib-esm/theme-preval.js +0 -940
  226. package/lib-esm/utils/testing.d.ts +0 -1854
  227. package/lib-esm/utils/uniqueId.js +0 -1
  228. package/package.json +7 -6
  229. package/lib/utils/ssr.d.ts +0 -1
  230. package/lib/utils/ssr.js +0 -19
  231. package/lib-esm/utils/ssr.d.ts +0 -1
  232. package/lib-esm/utils/ssr.js +0 -1
@@ -1,3 +1,5 @@
1
+ import _styled from "styled-components";
2
+
1
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
4
 
3
5
  import classnames from 'classnames';
@@ -15,22 +17,23 @@ const TimelineItem = styled(Box).attrs(props => ({
15
17
  })).withConfig({
16
18
  displayName: "Timeline__TimelineItem",
17
19
  componentId: "c4dq2e-1"
18
- })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";", ";"], get('space.3'), get('space.3'), get('colors.border.muted'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.fg.muted'), get('colors.canvas.default')), COMMON, sx);
20
+ })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";", ";"], get('space.3'), get('space.3'), get('colors.border.secondary'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.icon.tertiary'), get('colors.bg.canvas')), COMMON, sx);
21
+
22
+ var _StyledBox = styled(Box).withConfig({
23
+ displayName: "Timeline___StyledBox",
24
+ componentId: "c4dq2e-2"
25
+ })(["border-radius:50%;border:2px solid ", ";"], p => p._css);
19
26
 
20
27
  const TimelineBadge = props => {
21
28
  return /*#__PURE__*/React.createElement(Box, {
22
29
  position: "relative",
23
30
  zIndex: 1
24
- }, /*#__PURE__*/React.createElement(Box, _extends({
31
+ }, /*#__PURE__*/React.createElement(_StyledBox, _extends({
25
32
  display: "flex",
26
33
  className: classnames(props.className, 'TimelineItem-Badge'),
27
34
  flexShrink: 0,
28
- borderRadius: "50%",
29
- borderWidth: "2px",
30
- borderStyle: "solid",
31
- borderColor: "canvas.default",
32
35
  overflow: "hidden",
33
- color: "fg.muted",
36
+ color: "icon.secondary",
34
37
  bg: "timeline.badgeBg",
35
38
  width: "32px",
36
39
  height: "32px",
@@ -38,18 +41,20 @@ const TimelineBadge = props => {
38
41
  ml: "-15px",
39
42
  alignItems: "center",
40
43
  justifyContent: "center"
41
- }, props), props.children));
44
+ }, props, {
45
+ _css: get('colors.bg.canvas')
46
+ }), props.children));
42
47
  };
43
48
 
44
49
  TimelineBadge.displayName = "TimelineBadge";
45
50
  const TimelineBody = styled(Box).withConfig({
46
51
  displayName: "Timeline__TimelineBody",
47
- componentId: "c4dq2e-2"
48
- })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.fg.muted'), get('fontSizes.1'), sx);
52
+ componentId: "c4dq2e-3"
53
+ })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.timeline.text'), get('fontSizes.1'), sx);
49
54
  const TimelineBreak = styled(Box).withConfig({
50
55
  displayName: "Timeline__TimelineBreak",
51
- componentId: "c4dq2e-3"
52
- })(["position:relative z-index:1;height:24px;margin:0;margin-bottom:-", ";margin-left:0;background-color:", ";border:0;border-top:", " solid ", ";", ";"], get('space.3'), get('colors.canvas.default'), get('space.1'), get('colors.border.default'), sx);
56
+ componentId: "c4dq2e-4"
57
+ })(["position:relative z-index:1;height:24px;margin:0;margin-bottom:-", ";margin-left:0;background-color:", ";border:0;border-top:", " solid ", ";", ";"], get('space.3'), get('colors.bg.canvas'), get('space.1'), get('colors.border.primary'), sx);
53
58
  TimelineItem.displayName = 'Timeline.Item';
54
59
  TimelineBadge.displayName = 'Timeline.Badge';
55
60
  TimelineBody.displayName = 'Timeline.Body';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ interface Props extends TokenBaseProps {
4
+ leadingVisual?: React.FunctionComponent<any>;
5
+ }
6
+ declare const Token: React.FC<Props>;
7
+ export default Token;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { get } from '../constants';
4
+ import TokenBase, { isTokenHoverable } from './TokenBase';
5
+ import AddTokenButton from './_AddTokenButton';
6
+ import RemoveTokenButton from './_RemoveTokenButton';
7
+ const DefaultToken = styled(TokenBase).withConfig({
8
+ displayName: "Token__DefaultToken",
9
+ componentId: "sc-1dg52pw-0"
10
+ })(["background-color:", ";border-color:", ";border-style:solid;border-width:", ";color:", ";padding-right:", ";&:hover{background-color:", ";}> ._TokenButton{color:", ";}"], get('colors.accent.subtle'), props => props.isSelected ? get('colors.accent.fg') : get('colors.accent.subtle'), props => props.isSelected ? '1px' : 0, get('colors.accent.fg'), props => props.handleRemove || props.handleAdd ? 0 : undefined, props => isTokenHoverable(props) ? get('colors.accent.muted') : undefined, get('colors.accent.fg')); // TODO: make this text truncate
11
+
12
+ const TokenTextContainer = styled('span').withConfig({
13
+ displayName: "Token__TokenTextContainer",
14
+ componentId: "sc-1dg52pw-1"
15
+ })(["flex-grow:1;white-space:nowrap;"]);
16
+ const LeadingVisualContainer = styled('span').withConfig({
17
+ displayName: "Token__LeadingVisualContainer",
18
+ componentId: "sc-1dg52pw-2"
19
+ })(["flex-shrink:0;line-height:0;"]);
20
+
21
+ const Token = ({
22
+ /**
23
+ * A function that renders a component before the token text
24
+ */
25
+ leadingVisual: LeadingVisual,
26
+ ...tokenBaseProps
27
+ }) => {
28
+ const {
29
+ handleRemove,
30
+ handleAdd,
31
+ text,
32
+ as,
33
+ variant
34
+ } = tokenBaseProps;
35
+ return /*#__PURE__*/React.createElement(DefaultToken, tokenBaseProps, LeadingVisual ? /*#__PURE__*/React.createElement(LeadingVisualContainer, null, /*#__PURE__*/React.createElement(LeadingVisual, null)) : null, /*#__PURE__*/React.createElement(TokenTextContainer, null, text), handleRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
36
+ parentTokenTag: as || 'span',
37
+ tabIndex: -1,
38
+ onClick: handleRemove,
39
+ variant: variant
40
+ }) : null, handleAdd ? /*#__PURE__*/React.createElement(AddTokenButton, {
41
+ parentTokenTag: as || 'span',
42
+ tabIndex: -1,
43
+ onClick: handleAdd,
44
+ variant: variant
45
+ }) : null);
46
+ };
47
+
48
+ Token.displayName = "Token";
49
+ export default Token;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ export declare type TokenSizeKeys = 'sm' | 'md' | 'lg' | 'xl';
3
+ export declare const tokenSizes: Record<TokenSizeKeys, number>;
4
+ export declare const defaultTokenSize = "md";
5
+ export interface TokenBaseProps extends Omit<React.HTMLProps<HTMLSpanElement | HTMLButtonElement | HTMLAnchorElement>, 'size'> {
6
+ as?: 'button' | 'a' | 'span';
7
+ handleAdd?: () => void;
8
+ handleRemove?: () => void;
9
+ isSelected?: boolean;
10
+ tabIndex?: number;
11
+ text: string;
12
+ variant?: TokenSizeKeys;
13
+ }
14
+ export declare const isTokenHoverable: ({ as, onClick, onFocus }: TokenBaseProps) => boolean;
15
+ declare const TokenBase: import("styled-components").StyledComponent<"span", any, TokenBaseProps, never>;
16
+ export default TokenBase;
@@ -0,0 +1,56 @@
1
+ import styled from 'styled-components';
2
+ import { variant } from 'styled-system';
3
+ import { get } from '../constants';
4
+ export const tokenSizes = {
5
+ sm: 16,
6
+ md: 20,
7
+ lg: 24,
8
+ xl: 32
9
+ };
10
+ export const defaultTokenSize = 'md';
11
+ export const isTokenHoverable = ({
12
+ as = 'span',
13
+ onClick,
14
+ onFocus
15
+ }) => Boolean(onFocus || onClick || ['a', 'button'].includes(as));
16
+ const variants = variant({
17
+ variants: {
18
+ sm: {
19
+ fontSize: 0,
20
+ gap: 1,
21
+ height: `${tokenSizes.sm}px`,
22
+ paddingLeft: 1,
23
+ paddingRight: 1
24
+ },
25
+ md: {
26
+ fontSize: 0,
27
+ gap: 1,
28
+ height: `${tokenSizes.md}px`,
29
+ paddingLeft: 2,
30
+ paddingRight: 2
31
+ },
32
+ lg: {
33
+ fontSize: 0,
34
+ gap: 2,
35
+ height: `${tokenSizes.lg}px`,
36
+ paddingLeft: 2,
37
+ paddingRight: 2
38
+ },
39
+ xl: {
40
+ fontSize: 1,
41
+ gap: 2,
42
+ height: `${tokenSizes.xl}px`,
43
+ paddingLeft: 3,
44
+ paddingRight: 3
45
+ }
46
+ }
47
+ });
48
+ const TokenBase = styled.span.withConfig({
49
+ displayName: "TokenBase",
50
+ componentId: "opajvp-0"
51
+ })(["align-items:center;border-radius:999px;cursor:", ";display:inline-flex;font-weight:", ";text-decoration:none;white-space:nowrap;", ""], props => isTokenHoverable(props) ? 'pointer' : 'auto', get('fontWeights.bold'), variants);
52
+ TokenBase.defaultProps = {
53
+ as: 'span',
54
+ variant: defaultTokenSize
55
+ };
56
+ export default TokenBase;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ interface Props extends TokenBaseProps {
4
+ /**
5
+ * The color that corresponds to the label
6
+ */
7
+ fillColor?: string;
8
+ }
9
+ declare const TokenLabel: React.FC<Props>;
10
+ export default TokenLabel;
@@ -0,0 +1,99 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import styled from 'styled-components';
5
+ import TokenBase from './TokenBase';
6
+ import RemoveTokenButton from './_RemoveTokenButton';
7
+ import tinycolor from 'tinycolor2';
8
+ import { useTheme } from '../ThemeProvider';
9
+ const colorModeConfig = {
10
+ dark: {
11
+ bgOpacity: 0.18,
12
+ borderThreshold: 0,
13
+ borderOpacity: 0.3,
14
+ lightnessThreshold: 0.6
15
+ },
16
+ light: {
17
+ bgOpacity: 1,
18
+ borderThreshold: 0.96,
19
+ borderOpacity: 1,
20
+ lightnessThreshold: 0.453
21
+ }
22
+ };
23
+ const tokenBorderWidthPx = 1; // TODO: do a nicer `isSelected` style
24
+
25
+ const StyledTokenLabel = styled(TokenBase).withConfig({
26
+ displayName: "TokenLabel__StyledTokenLabel",
27
+ componentId: "sc-1bdmgzv-0"
28
+ })(["background-color:", ";border-width:", "px;border-style:solid;border-color:", ";box-shadow:", ";color:", ";overflow:hidden;padding-right:", ";position:relative;> ._TokenButton{color:currentColor;transform:translate(", "px,-", "px);}"], props => props.bgColor, tokenBorderWidthPx, props => props.borderColor, props => props.isSelected ? `0 0 0 2px ${props.bgColor}` : undefined, props => props.textColor, props => props.handleRemove ? 0 : undefined, tokenBorderWidthPx, tokenBorderWidthPx); // TODO: make this text truncate
29
+
30
+ const TokenTextContainer = styled('span').withConfig({
31
+ displayName: "TokenLabel__TokenTextContainer",
32
+ componentId: "sc-1bdmgzv-1"
33
+ })(["white-space:nowrap;z-index:1;"]);
34
+
35
+ const TokenLabel = ({
36
+ fillColor,
37
+ isSelected,
38
+ ...tokenBaseProps
39
+ }) => {
40
+ const {
41
+ handleRemove,
42
+ text,
43
+ as,
44
+ variant
45
+ } = tokenBaseProps;
46
+ const {
47
+ colorScheme
48
+ } = useTheme(); // const colorScheme = 'dark';
49
+
50
+ const {
51
+ bgOpacity,
52
+ borderOpacity,
53
+ borderThreshold,
54
+ lightnessThreshold
55
+ } = colorModeConfig[colorScheme || 'light'];
56
+ let bgColor = fillColor;
57
+ let borderColor = fillColor;
58
+ let textColor = '#FFF';
59
+ const perceivedLightness = tinycolor(fillColor).getLuminance();
60
+ const isFillColorLight = perceivedLightness >= lightnessThreshold;
61
+
62
+ if (colorScheme === 'dark') {
63
+ const lightenBy = (perceivedLightness - lightnessThreshold) * 100 * (isFillColorLight ? 1 : 0);
64
+ bgColor = isSelected ? tinycolor(fillColor).setAlpha(bgOpacity * 1.2).toRgbString() : tinycolor(fillColor).setAlpha(bgOpacity).toRgbString();
65
+ textColor = isSelected ? tinycolor(fillColor).lighten(lightenBy + 8).toString() : tinycolor(fillColor).lighten(lightenBy).toString();
66
+ borderColor = isSelected ? tinycolor(fillColor).lighten(lightenBy).toRgbString() : tinycolor(fillColor).lighten(lightenBy).setAlpha(borderOpacity).toRgbString();
67
+ } else {
68
+ const isFillColorDark = perceivedLightness < 0.1;
69
+ borderColor = perceivedLightness >= borderThreshold ? tinycolor(fillColor).darken(25).toString() : 'transparent';
70
+
71
+ if (isFillColorLight) {
72
+ textColor = '#000';
73
+ }
74
+
75
+ if (isSelected) {
76
+ bgColor = isFillColorDark ? tinycolor(fillColor).lighten(10).toString() : tinycolor(fillColor).darken(10).toString();
77
+ }
78
+ }
79
+
80
+ return /*#__PURE__*/React.createElement(StyledTokenLabel, _extends({
81
+ fillColor: fillColor,
82
+ bgColor: bgColor,
83
+ borderColor: borderColor,
84
+ textColor: textColor,
85
+ isSelected: isSelected
86
+ }, tokenBaseProps), /*#__PURE__*/React.createElement(TokenTextContainer, null, text), handleRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
87
+ parentTokenTag: as || 'span',
88
+ tabIndex: -1,
89
+ onClick: handleRemove,
90
+ variant: variant
91
+ }) : null);
92
+ };
93
+
94
+ TokenLabel.displayName = "TokenLabel";
95
+ TokenLabel.defaultProps = {
96
+ fillColor: '#999' // TODO: pick a real color
97
+
98
+ };
99
+ export default TokenLabel;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ interface Props extends TokenBaseProps {
4
+ avatarSrc: string;
5
+ }
6
+ declare const TokenProfile: React.FC<Props>;
7
+ export default TokenProfile;
@@ -0,0 +1,28 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import styled from 'styled-components';
5
+ import { get } from '../constants';
6
+ import primitives from '@primer/primitives';
7
+ import { defaultTokenSize, tokenSizes } from './TokenBase';
8
+ import Token from './Token';
9
+ import { Avatar } from '..';
10
+ const StyledToken = styled(Token).withConfig({
11
+ displayName: "TokenProfile__StyledToken",
12
+ componentId: "sc-1vf9jhf-0"
13
+ })(["padding-left:", ";"], get('space.1')); // ${get('space.1')}
14
+
15
+ const TokenProfile = ({
16
+ avatarSrc,
17
+ variant,
18
+ ...rest
19
+ }) => /*#__PURE__*/React.createElement(StyledToken, _extends({
20
+ leadingVisual: () => /*#__PURE__*/React.createElement(Avatar, {
21
+ src: avatarSrc,
22
+ size: tokenSizes[variant || defaultTokenSize] - parseInt(primitives.spacing.normal.spacer[1], 10) * 2
23
+ }),
24
+ variant: variant
25
+ }, rest));
26
+
27
+ TokenProfile.displayName = "TokenProfile";
28
+ export default TokenProfile;
@@ -0,0 +1,3 @@
1
+ import { TokenButtonProps } from './_tokenButtonUtils';
2
+ declare const AddTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps, never>;
3
+ export default AddTokenButton;
@@ -0,0 +1,27 @@
1
+ import { PlusIcon } from '@primer/octicons-react';
2
+ import styled from 'styled-components';
3
+ import { defaultTokenSize } from "./TokenBase";
4
+ import { tokenButtonStyles, variants, getTokenButtonIconSize } from './_tokenButtonUtils';
5
+ const AddTokenButton = styled.span.attrs(({
6
+ parentTokenTag,
7
+ variant,
8
+ ...rest
9
+ }) => {
10
+ delete rest.children;
11
+ return {
12
+ as: parentTokenTag === 'span' ? 'button' : 'span',
13
+ tabIndex: -1,
14
+ className: '_TokenButton',
15
+ children: /*#__PURE__*/React.createElement(PlusIcon, {
16
+ size: getTokenButtonIconSize(variant)
17
+ }) // TODO: figure out how to set `size` using `fontSizes` from Primitives
18
+
19
+ };
20
+ }).withConfig({
21
+ displayName: "_AddTokenButton__AddTokenButton",
22
+ componentId: "elcc0o-0"
23
+ })(["", " ", ""], tokenButtonStyles, variants);
24
+ AddTokenButton.defaultProps = {
25
+ variant: defaultTokenSize
26
+ };
27
+ export default AddTokenButton;
@@ -0,0 +1,3 @@
1
+ import { TokenButtonProps } from './_tokenButtonUtils';
2
+ declare const RemoveTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps, never>;
3
+ export default RemoveTokenButton;
@@ -0,0 +1,27 @@
1
+ import { XIcon } from '@primer/octicons-react';
2
+ import styled from 'styled-components';
3
+ import { defaultTokenSize } from "./TokenBase";
4
+ import { tokenButtonStyles, variants, getTokenButtonIconSize } from './_tokenButtonUtils';
5
+ const RemoveTokenButton = styled.span.attrs(({
6
+ parentTokenTag,
7
+ variant,
8
+ ...rest
9
+ }) => {
10
+ delete rest.children;
11
+ return {
12
+ as: parentTokenTag === 'span' ? 'button' : 'span',
13
+ tabIndex: -1,
14
+ className: '_TokenButton',
15
+ children: /*#__PURE__*/React.createElement(XIcon, {
16
+ size: getTokenButtonIconSize(variant)
17
+ }) // TODO: figure out how to set `size` using `fontSizes` from Primitives
18
+
19
+ };
20
+ }).withConfig({
21
+ displayName: "_RemoveTokenButton__RemoveTokenButton",
22
+ componentId: "sc-14lvcw1-0"
23
+ })(["", " ", ""], tokenButtonStyles, variants);
24
+ RemoveTokenButton.defaultProps = {
25
+ variant: defaultTokenSize
26
+ };
27
+ export default RemoveTokenButton;
@@ -0,0 +1,8 @@
1
+ import { TokenSizeKeys } from "./TokenBase";
2
+ export interface TokenButtonProps {
3
+ parentTokenTag: 'span' | 'button' | 'a';
4
+ variant?: TokenSizeKeys;
5
+ }
6
+ export declare const variants: (...args: any[]) => any;
7
+ export declare const tokenButtonStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
8
+ export declare const getTokenButtonIconSize: (variant?: TokenSizeKeys | undefined) => number;
@@ -0,0 +1,26 @@
1
+ import { css } from 'styled-components';
2
+ import { variant } from 'styled-system';
3
+ import { get } from '../constants';
4
+ import { tokenSizes, defaultTokenSize } from "./TokenBase";
5
+ export const variants = variant({
6
+ variants: {
7
+ sm: {
8
+ height: `${tokenSizes.sm}px`,
9
+ width: `${tokenSizes.sm}px`
10
+ },
11
+ md: {
12
+ height: `${tokenSizes.md}px`,
13
+ width: `${tokenSizes.md}px`
14
+ },
15
+ lg: {
16
+ height: `${tokenSizes.lg}px`,
17
+ width: `${tokenSizes.lg}px`
18
+ },
19
+ xl: {
20
+ height: `${tokenSizes.xl}px`,
21
+ width: `${tokenSizes.xl}px`
22
+ }
23
+ }
24
+ });
25
+ export const tokenButtonStyles = css(["background-color:transparent;font-family:inherit;cursor:pointer;user-select:none;appearance:none;text-decoration:none;padding:0;align-self:baseline;border:0;border-radius:999px;&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}"], get('colors.fade.fg10'), get('colors.fade.fg15'));
26
+ export const getTokenButtonIconSize = variant => tokenSizes[variant || defaultTokenSize] * 0.75;
@@ -8,7 +8,7 @@ import sx from './sx';
8
8
  const TooltipBase = styled.span.withConfig({
9
9
  displayName: "Tooltip__TooltipBase",
10
10
  componentId: "kp39nc-0"
11
- })(["position:relative;&::before{position:absolute;z-index:1000001;display:none;width:0px;height:0px;color:", ";pointer-events:none;content:'';border:6px solid transparent;opacity:0;}&::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 ", ";-webkit-font-smoothing:subpixel-antialiased;color:", ";text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:", ";border-radius:", ";opacity:0;}@keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}&:hover,&:active,&:focus{&::before,&::after{display:inline-block;text-decoration:none;animation-name:tooltip-appear;animation-duration:0.1s;animation-fill-mode:forwards;animation-timing-function:ease-in;animation-delay:0.4s;}}&.tooltipped-no-delay:hover,&.tooltipped-no-delay:active,&.tooltipped-no-delay:focus{&::before,&::after{animation-delay:0s;}}&.tooltipped-multiline:hover,&.tooltipped-multiline:active,&.tooltipped-multiline:focus{&::after{display:table-cell;}}&.tooltipped-s,&.tooltipped-se,&.tooltipped-sw{&::after{top:100%;right:50%;margin-top:6px;}&::before{top:auto;right:50%;bottom:-7px;margin-right:-6px;border-bottom-color:", ";}}&.tooltipped-se{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-sw::after{margin-right:-", ";}&.tooltipped-n,&.tooltipped-ne,&.tooltipped-nw{&::after{right:50%;bottom:100%;margin-bottom:6px;}&::before{top:-7px;right:50%;bottom:auto;margin-right:-6px;border-top-color:", ";}}&.tooltipped-ne{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-nw::after{margin-right:-", ";}&.tooltipped-s::after,&.tooltipped-n::after{transform:translateX(50%);}&.tooltipped-w{&::after{right:100%;bottom:50%;margin-right:6px;transform:translateY(50%);}&::before{top:50%;bottom:50%;left:-7px;margin-top:-6px;border-left-color:", ";}}&.tooltipped-e{&::after{bottom:50%;left:100%;margin-left:6px;transform:translateY(50%);}&::before{top:50%;right:-7px;bottom:50%;margin-top:-6px;border-right-color:", ";}}&.tooltipped-multiline{&::after{width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}&.tooltipped-s::after,&.tooltipped-n::after{right:auto;left:50%;transform:translateX(-50%);}&.tooltipped-w::after,&.tooltipped-e::after{right:100%;}}&.tooltipped-align-right-2::after{right:0;margin-right:0;}&.tooltipped-align-right-2::before{right:15px;}&.tooltipped-align-left-2::after{left:0;margin-left:0;}&.tooltipped-align-left-2::before{left:10px;}", ";", ";"], get('colors.neutral.emphasisPlus'), get('fonts.normal'), get('colors.fg.onEmphasis'), get('colors.neutral.emphasisPlus'), get('radii.1'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('colors.neutral.emphasisPlus'), COMMON, sx);
11
+ })(["position:relative;&::before{position:absolute;z-index:1000001;display:none;width:0px;height:0px;color:", ";pointer-events:none;content:'';border:6px solid transparent;opacity:0;}&::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 ", ";-webkit-font-smoothing:subpixel-antialiased;color:", ";text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:", ";border-radius:", ";opacity:0;}@keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}&:hover,&:active,&:focus{&::before,&::after{display:inline-block;text-decoration:none;animation-name:tooltip-appear;animation-duration:0.1s;animation-fill-mode:forwards;animation-timing-function:ease-in;animation-delay:0.4s;}}&.tooltipped-no-delay:hover,&.tooltipped-no-delay:active,&.tooltipped-no-delay:focus{&::before,&::after{animation-delay:0s;}}&.tooltipped-multiline:hover,&.tooltipped-multiline:active,&.tooltipped-multiline:focus{&::after{display:table-cell;}}&.tooltipped-s,&.tooltipped-se,&.tooltipped-sw{&::after{top:100%;right:50%;margin-top:6px;}&::before{top:auto;right:50%;bottom:-7px;margin-right:-6px;border-bottom-color:", ";}}&.tooltipped-se{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-sw::after{margin-right:-", ";}&.tooltipped-n,&.tooltipped-ne,&.tooltipped-nw{&::after{right:50%;bottom:100%;margin-bottom:6px;}&::before{top:-7px;right:50%;bottom:auto;margin-right:-6px;border-top-color:", ";}}&.tooltipped-ne{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-nw::after{margin-right:-", ";}&.tooltipped-s::after,&.tooltipped-n::after{transform:translateX(50%);}&.tooltipped-w{&::after{right:100%;bottom:50%;margin-right:6px;transform:translateY(50%);}&::before{top:50%;bottom:50%;left:-7px;margin-top:-6px;border-left-color:", ";}}&.tooltipped-e{&::after{bottom:50%;left:100%;margin-left:6px;transform:translateY(50%);}&::before{top:50%;right:-7px;bottom:50%;margin-top:-6px;border-right-color:", ";}}&.tooltipped-multiline{&::after{width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}&.tooltipped-s::after,&.tooltipped-n::after{right:auto;left:50%;transform:translateX(-50%);}&.tooltipped-w::after,&.tooltipped-e::after{right:100%;}}&.tooltipped-align-right-2::after{right:0;margin-right:0;}&.tooltipped-align-right-2::before{right:15px;}&.tooltipped-align-left-2::after{left:0;margin-left:0;}&.tooltipped-align-left-2::before{left:10px;}", ";", ";"], get('colors.tooltip.bg'), get('fonts.normal'), get('colors.tooltip.text'), get('colors.tooltip.bg'), get('radii.1'), get('colors.tooltip.bg'), get('space.3'), get('space.3'), get('colors.tooltip.bg'), get('space.3'), get('space.3'), get('colors.tooltip.bg'), get('colors.tooltip.bg'), COMMON, sx);
12
12
 
13
13
  function Tooltip({
14
14
  direction = 'n',
@@ -11,7 +11,7 @@ const SELECTED_CLASS = 'selected';
11
11
  const UnderlineNavBase = styled.nav.withConfig({
12
12
  displayName: "UnderlineNav__UnderlineNavBase",
13
13
  componentId: "zrnxqt-0"
14
- })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.UnderlineNav--right{justify-content:flex-end;.UnderlineNav-item{margin-right:0;margin-left:", ";}.UnderlineNav-actions{flex:1 1 auto;}}&.UnderlineNav--full{display:block;}.UnderlineNav-body{display:flex;margin-bottom:-1px;}.UnderlineNav-actions{align-self:center;}", ";", ";"], get('colors.border.muted'), get('space.3'), COMMON, sx);
14
+ })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.UnderlineNav--right{justify-content:flex-end;.UnderlineNav-item{margin-right:0;margin-left:", ";}.UnderlineNav-actions{flex:1 1 auto;}}&.UnderlineNav--full{display:block;}.UnderlineNav-body{display:flex;margin-bottom:-1px;}.UnderlineNav-actions{align-self:center;}", ";", ";"], get('colors.border.secondary'), get('space.3'), COMMON, sx);
15
15
 
16
16
  function UnderlineNav({
17
17
  actions,
@@ -42,7 +42,7 @@ const UnderlineNavLink = styled.a.attrs(props => ({
42
42
  })).withConfig({
43
43
  displayName: "UnderlineNav__UnderlineNavLink",
44
44
  componentId: "zrnxqt-1"
45
- })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), COMMON, sx);
45
+ })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.underlinenav.text'), get('colors.underlinenav.textHover'), get('colors.border.tertiary'), get('colors.text.tertiary'), get('colors.underlinenav.textActive'), get('colors.underlinenav.borderActive'), get('colors.underlinenav.iconActive'), COMMON, sx);
46
46
  UnderlineNavLink.displayName = 'UnderlineNav.Link';
47
47
  export default Object.assign(UnderlineNav, {
48
48
  Link: UnderlineNavLink
@@ -7,8 +7,9 @@ export declare type UseOverlaySettings = {
7
7
  onEscape: (e: KeyboardEvent) => void;
8
8
  onClickOutside: (e: TouchOrMouseEvent) => void;
9
9
  overlayRef?: React.RefObject<HTMLDivElement>;
10
+ preventFocusOnOpen?: boolean;
10
11
  };
11
12
  export declare type OverlayReturnProps = {
12
13
  ref: React.RefObject<HTMLDivElement>;
13
14
  };
14
- export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside }: UseOverlaySettings) => OverlayReturnProps;
15
+ export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside, preventFocusOnOpen }: UseOverlaySettings) => OverlayReturnProps;
@@ -8,14 +8,19 @@ export const useOverlay = ({
8
8
  initialFocusRef,
9
9
  onEscape,
10
10
  ignoreClickRefs,
11
- onClickOutside
11
+ onClickOutside,
12
+ preventFocusOnOpen
12
13
  }) => {
13
14
  const overlayRef = useProvidedRefOrCreate(_overlayRef);
14
- useOpenAndCloseFocus({
15
- containerRef: overlayRef,
16
- returnFocusRef,
17
- initialFocusRef
18
- });
15
+
16
+ if (!preventFocusOnOpen) {
17
+ useOpenAndCloseFocus({
18
+ containerRef: overlayRef,
19
+ returnFocusRef,
20
+ initialFocusRef
21
+ });
22
+ }
23
+
19
24
  useOnOutsideClick({
20
25
  containerRef: overlayRef,
21
26
  ignoreClickRefs,
@@ -108,4 +108,3 @@ export { default as Truncate } from './Truncate';
108
108
  export type { TruncateProps } from './Truncate';
109
109
  export { default as UnderlineNav } from './UnderlineNav';
110
110
  export type { UnderlineNavProps, UnderlineNavLinkProps } from './UnderlineNav';
111
- export { SSRProvider, useSSRSafeId } from './utils/ssr';
package/lib-esm/index.js CHANGED
@@ -65,5 +65,4 @@ export { default as Text } from './Text';
65
65
  export { default as Timeline } from './Timeline';
66
66
  export { default as Tooltip } from './Tooltip';
67
67
  export { default as Truncate } from './Truncate';
68
- export { default as UnderlineNav } from './UnderlineNav';
69
- export { SSRProvider, useSSRSafeId } from './utils/ssr';
68
+ export { default as UnderlineNav } from './UnderlineNav';
@@ -22,10 +22,6 @@ export namespace theme {
22
22
  export { darkDimmedColors as colors };
23
23
  export { darkDimmedShadows as shadows };
24
24
  }
25
- namespace dark_high_contrast {
26
- export { darkHighContrastColors as colors };
27
- export { darkHighContrastShadows as shadows };
28
- }
29
25
  }
30
26
  }
31
27
  declare namespace animation {
@@ -83,21 +79,19 @@ declare const darkDimmedColors: Partial<typeof primitives.colors.dark_dimmed>;
83
79
  * @type Partial<typeof primitives.colors.dark_dimmed>
84
80
  */
85
81
  declare const darkDimmedShadows: Partial<typeof primitives.colors.dark_dimmed>;
86
- /**
87
- * @type Partial<typeof primitives.colors.dark_dimmed>
88
- */
89
- declare const darkHighContrastColors: Partial<typeof primitives.colors.dark_dimmed>;
90
- /**
91
- * @type Partial<typeof primitives.colors.dark_high_contrast>
92
- */
93
- declare const darkHighContrastShadows: Partial<typeof primitives.colors.dark_high_contrast>;
94
82
  import { default as primitives } from "@primer/primitives";
95
83
  declare const light_2: {
96
84
  colors: {};
85
+ /**
86
+ * @type Partial<typeof primitives.colors.light>
87
+ */
97
88
  shadows: {};
98
89
  };
99
90
  declare const dark_1: {
100
91
  colors: {};
92
+ /**
93
+ * @type Partial<typeof primitives.colors.light>
94
+ */
101
95
  shadows: {};
102
96
  };
103
97
  export {};