@primer/components 0.0.0-202191916821 → 0.0.0-2021920152952

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 (229) hide show
  1. package/CHANGELOG.md +1 -17
  2. package/codemods/deprecateUtilityComponents.js +1 -1
  3. package/dist/browser.esm.js +768 -878
  4. package/dist/browser.esm.js.map +1 -1
  5. package/dist/browser.umd.js +773 -883
  6. package/dist/browser.umd.js.map +1 -1
  7. package/lib/ActionList/Item.js +1 -1
  8. package/lib/ActionList/List.d.ts +1 -2
  9. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
  10. package/lib/AnchoredOverlay/AnchoredOverlay.js +3 -11
  11. package/lib/BaseStyles.js +1 -1
  12. package/lib/BorderBox.js +1 -1
  13. package/lib/Button/ButtonInvisible.js +1 -1
  14. package/lib/Caret.js +2 -2
  15. package/lib/DatePicker/DatePicker.d.ts +47 -0
  16. package/lib/DatePicker/DatePicker.js +76 -0
  17. package/lib/DatePicker/DatePickerAnchor.d.ts +10 -0
  18. package/lib/DatePicker/DatePickerAnchor.js +83 -0
  19. package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
  20. package/lib/DatePicker/DatePickerPanel.js +38 -0
  21. package/lib/DatePicker/Day.d.ts +13 -0
  22. package/lib/DatePicker/Day.js +136 -0
  23. package/lib/DatePicker/Month.d.ts +9 -0
  24. package/lib/DatePicker/Month.js +97 -0
  25. package/lib/DatePicker/index.d.ts +2 -0
  26. package/lib/DatePicker/index.js +13 -0
  27. package/lib/DatePicker/useDatePicker.d.ts +51 -0
  28. package/lib/DatePicker/useDatePicker.js +133 -0
  29. package/lib/Dialog.js +1 -1
  30. package/lib/FilteredActionList/FilteredActionList.js +31 -5
  31. package/lib/Flash.js +16 -16
  32. package/lib/Label.js +1 -1
  33. package/lib/Overlay.d.ts +0 -1
  34. package/lib/Overlay.js +1 -3
  35. package/lib/ProgressBar.js +1 -1
  36. package/lib/SelectMenu/SelectMenu.d.ts +10 -10
  37. package/lib/StateLabel.js +19 -13
  38. package/lib/TextInput.d.ts +13 -5
  39. package/lib/TextInput.js +46 -4
  40. package/lib/hooks/useOpenAndCloseFocus.d.ts +1 -2
  41. package/lib/hooks/useOpenAndCloseFocus.js +2 -7
  42. package/lib/hooks/useOverlay.d.ts +1 -2
  43. package/lib/hooks/useOverlay.js +2 -4
  44. package/lib/index.d.ts +0 -6
  45. package/lib/index.js +0 -44
  46. package/lib/theme-preval.js +3105 -375
  47. package/lib/utils/testing.d.ts +493 -50
  48. package/{lib-esm/utils/types/AriaRole.d.ts → lib/utils/types.d.ts} +13 -0
  49. package/lib/utils/{types/AriaRole.js → types.js} +0 -0
  50. package/lib-esm/ActionList/Item.js +1 -1
  51. package/lib-esm/ActionList/List.d.ts +1 -2
  52. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
  53. package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -11
  54. package/lib-esm/BaseStyles.js +1 -1
  55. package/lib-esm/BorderBox.js +1 -1
  56. package/lib-esm/Button/ButtonInvisible.js +1 -1
  57. package/lib-esm/Caret.js +2 -2
  58. package/lib-esm/DatePicker/DatePicker.d.ts +47 -0
  59. package/lib-esm/DatePicker/DatePicker.js +57 -0
  60. package/lib-esm/DatePicker/DatePickerAnchor.d.ts +10 -0
  61. package/lib-esm/DatePicker/DatePickerAnchor.js +59 -0
  62. package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
  63. package/lib-esm/DatePicker/DatePickerPanel.js +20 -0
  64. package/lib-esm/DatePicker/Day.d.ts +13 -0
  65. package/lib-esm/DatePicker/Day.js +113 -0
  66. package/lib-esm/DatePicker/Month.d.ts +9 -0
  67. package/lib-esm/DatePicker/Month.js +74 -0
  68. package/lib-esm/DatePicker/index.d.ts +2 -0
  69. package/lib-esm/DatePicker/index.js +1 -0
  70. package/lib-esm/DatePicker/useDatePicker.d.ts +51 -0
  71. package/lib-esm/DatePicker/useDatePicker.js +114 -0
  72. package/lib-esm/Dialog.js +1 -1
  73. package/lib-esm/FilteredActionList/FilteredActionList.js +31 -3
  74. package/lib-esm/Flash.js +16 -16
  75. package/lib-esm/Label.js +1 -1
  76. package/lib-esm/Overlay.d.ts +0 -1
  77. package/lib-esm/Overlay.js +1 -3
  78. package/lib-esm/ProgressBar.js +1 -1
  79. package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -10
  80. package/lib-esm/StateLabel.js +19 -13
  81. package/lib-esm/TextInput.d.ts +13 -5
  82. package/lib-esm/TextInput.js +37 -4
  83. package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +1 -2
  84. package/lib-esm/hooks/useOpenAndCloseFocus.js +2 -7
  85. package/lib-esm/hooks/useOverlay.d.ts +1 -2
  86. package/lib-esm/hooks/useOverlay.js +2 -4
  87. package/lib-esm/index.d.ts +0 -6
  88. package/lib-esm/index.js +0 -4
  89. package/lib-esm/theme-preval.js +3105 -375
  90. package/lib-esm/utils/testing.d.ts +493 -50
  91. package/{lib/utils/types/AriaRole.d.ts → lib-esm/utils/types.d.ts} +13 -0
  92. package/lib-esm/utils/{types/AriaRole.js → types.js} +0 -0
  93. package/package.json +4 -4
  94. package/lib/ActionList2/Description.d.ts +0 -5
  95. package/lib/ActionList2/Description.js +0 -45
  96. package/lib/ActionList2/Divider.d.ts +0 -8
  97. package/lib/ActionList2/Divider.js +0 -42
  98. package/lib/ActionList2/Group.d.ts +0 -8
  99. package/lib/ActionList2/Group.js +0 -39
  100. package/lib/ActionList2/Header.d.ts +0 -26
  101. package/lib/ActionList2/Header.js +0 -55
  102. package/lib/ActionList2/Item.d.ts +0 -52
  103. package/lib/ActionList2/Item.js +0 -171
  104. package/lib/ActionList2/List.d.ts +0 -18
  105. package/lib/ActionList2/List.js +0 -52
  106. package/lib/ActionList2/Selection.d.ts +0 -5
  107. package/lib/ActionList2/Selection.js +0 -67
  108. package/lib/ActionList2/Visuals.d.ts +0 -12
  109. package/lib/ActionList2/Visuals.js +0 -87
  110. package/lib/ActionList2/hacks.d.ts +0 -30
  111. package/lib/ActionList2/hacks.js +0 -38
  112. package/lib/ActionList2/index.d.ts +0 -26
  113. package/lib/ActionList2/index.js +0 -36
  114. package/lib/Autocomplete/Autocomplete.d.ts +0 -304
  115. package/lib/Autocomplete/Autocomplete.js +0 -145
  116. package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
  117. package/lib/Autocomplete/AutocompleteContext.js +0 -11
  118. package/lib/Autocomplete/AutocompleteInput.d.ts +0 -292
  119. package/lib/Autocomplete/AutocompleteInput.js +0 -157
  120. package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -72
  121. package/lib/Autocomplete/AutocompleteMenu.js +0 -224
  122. package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -20
  123. package/lib/Autocomplete/AutocompleteOverlay.js +0 -80
  124. package/lib/Autocomplete/index.d.ts +0 -2
  125. package/lib/Autocomplete/index.js +0 -15
  126. package/lib/TextInputWithTokens.d.ts +0 -323
  127. package/lib/TextInputWithTokens.js +0 -245
  128. package/lib/Token/AvatarToken.d.ts +0 -7
  129. package/lib/Token/AvatarToken.js +0 -64
  130. package/lib/Token/IssueLabelToken.d.ts +0 -14
  131. package/lib/Token/IssueLabelToken.js +0 -144
  132. package/lib/Token/Token.d.ts +0 -15
  133. package/lib/Token/Token.js +0 -94
  134. package/lib/Token/TokenBase.d.ts +0 -31
  135. package/lib/Token/TokenBase.js +0 -108
  136. package/lib/Token/_RemoveTokenButton.d.ts +0 -12
  137. package/lib/Token/_RemoveTokenButton.js +0 -77
  138. package/lib/Token/_TokenTextContainer.d.ts +0 -3
  139. package/lib/Token/_TokenTextContainer.js +0 -17
  140. package/lib/Token/index.d.ts +0 -3
  141. package/lib/Token/index.js +0 -31
  142. package/lib/_TextInputWrapper.d.ts +0 -10
  143. package/lib/_TextInputWrapper.js +0 -51
  144. package/lib/_UnstyledTextInput.d.ts +0 -2
  145. package/lib/_UnstyledTextInput.js +0 -20
  146. package/lib/behaviors/scrollIntoViewingArea.d.ts +0 -1
  147. package/lib/behaviors/scrollIntoViewingArea.js +0 -39
  148. package/lib/utils/create-slots.d.ts +0 -15
  149. package/lib/utils/create-slots.js +0 -101
  150. package/lib/utils/types/ComponentProps.d.ts +0 -9
  151. package/lib/utils/types/ComponentProps.js +0 -1
  152. package/lib/utils/types/Flatten.d.ts +0 -4
  153. package/lib/utils/types/Flatten.js +0 -1
  154. package/lib/utils/types/MandateProps.d.ts +0 -3
  155. package/lib/utils/types/MandateProps.js +0 -1
  156. package/lib/utils/types/Merge.d.ts +0 -19
  157. package/lib/utils/types/Merge.js +0 -1
  158. package/lib/utils/types/index.d.ts +0 -5
  159. package/lib/utils/types/index.js +0 -70
  160. package/lib/utils/use-force-update.d.ts +0 -1
  161. package/lib/utils/use-force-update.js +0 -19
  162. package/lib-esm/ActionList2/Description.d.ts +0 -5
  163. package/lib-esm/ActionList2/Description.js +0 -30
  164. package/lib-esm/ActionList2/Divider.d.ts +0 -8
  165. package/lib-esm/ActionList2/Divider.js +0 -30
  166. package/lib-esm/ActionList2/Group.d.ts +0 -8
  167. package/lib-esm/ActionList2/Group.js +0 -29
  168. package/lib-esm/ActionList2/Header.d.ts +0 -26
  169. package/lib-esm/ActionList2/Header.js +0 -45
  170. package/lib-esm/ActionList2/Item.d.ts +0 -52
  171. package/lib-esm/ActionList2/Item.js +0 -172
  172. package/lib-esm/ActionList2/List.d.ts +0 -18
  173. package/lib-esm/ActionList2/List.js +0 -42
  174. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  175. package/lib-esm/ActionList2/Selection.js +0 -50
  176. package/lib-esm/ActionList2/Visuals.d.ts +0 -12
  177. package/lib-esm/ActionList2/Visuals.js +0 -66
  178. package/lib-esm/ActionList2/hacks.d.ts +0 -30
  179. package/lib-esm/ActionList2/hacks.js +0 -30
  180. package/lib-esm/ActionList2/index.d.ts +0 -26
  181. package/lib-esm/ActionList2/index.js +0 -23
  182. package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -304
  183. package/lib-esm/Autocomplete/Autocomplete.js +0 -123
  184. package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
  185. package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
  186. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -292
  187. package/lib-esm/Autocomplete/AutocompleteInput.js +0 -138
  188. package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -72
  189. package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -205
  190. package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -20
  191. package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -62
  192. package/lib-esm/Autocomplete/index.d.ts +0 -2
  193. package/lib-esm/Autocomplete/index.js +0 -1
  194. package/lib-esm/TextInputWithTokens.d.ts +0 -323
  195. package/lib-esm/TextInputWithTokens.js +0 -220
  196. package/lib-esm/Token/AvatarToken.d.ts +0 -7
  197. package/lib-esm/Token/AvatarToken.js +0 -43
  198. package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
  199. package/lib-esm/Token/IssueLabelToken.js +0 -124
  200. package/lib-esm/Token/Token.d.ts +0 -15
  201. package/lib-esm/Token/Token.js +0 -73
  202. package/lib-esm/Token/TokenBase.d.ts +0 -31
  203. package/lib-esm/Token/TokenBase.js +0 -87
  204. package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -12
  205. package/lib-esm/Token/_RemoveTokenButton.js +0 -60
  206. package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
  207. package/lib-esm/Token/_TokenTextContainer.js +0 -6
  208. package/lib-esm/Token/index.d.ts +0 -3
  209. package/lib-esm/Token/index.js +0 -3
  210. package/lib-esm/_TextInputWrapper.d.ts +0 -10
  211. package/lib-esm/_TextInputWrapper.js +0 -31
  212. package/lib-esm/_UnstyledTextInput.d.ts +0 -2
  213. package/lib-esm/_UnstyledTextInput.js +0 -7
  214. package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +0 -1
  215. package/lib-esm/behaviors/scrollIntoViewingArea.js +0 -30
  216. package/lib-esm/utils/create-slots.d.ts +0 -15
  217. package/lib-esm/utils/create-slots.js +0 -80
  218. package/lib-esm/utils/types/ComponentProps.d.ts +0 -9
  219. package/lib-esm/utils/types/ComponentProps.js +0 -1
  220. package/lib-esm/utils/types/Flatten.d.ts +0 -4
  221. package/lib-esm/utils/types/Flatten.js +0 -1
  222. package/lib-esm/utils/types/MandateProps.d.ts +0 -3
  223. package/lib-esm/utils/types/MandateProps.js +0 -1
  224. package/lib-esm/utils/types/Merge.d.ts +0 -19
  225. package/lib-esm/utils/types/Merge.js +0 -1
  226. package/lib-esm/utils/types/index.d.ts +0 -5
  227. package/lib-esm/utils/types/index.js +0 -5
  228. package/lib-esm/utils/use-force-update.d.ts +0 -1
  229. package/lib-esm/utils/use-force-update.js +0 -6
@@ -1,7 +1,6 @@
1
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
2
 
3
3
  import React, { useCallback, useEffect, useRef } from 'react';
4
- import { useSSRSafeId } from '@react-aria/ssr';
5
4
  import TextInput from '../TextInput';
6
5
  import Box from '../Box';
7
6
  import { ActionList } from '../ActionList';
@@ -12,7 +11,36 @@ import styled from 'styled-components';
12
11
  import { get } from '../constants';
13
12
  import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate';
14
13
  import useScrollFlash from '../hooks/useScrollFlash';
15
- import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
14
+ import { useSSRSafeId } from '@react-aria/ssr';
15
+
16
+ function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
17
+ const {
18
+ top: childTop,
19
+ bottom: childBottom
20
+ } = child.getBoundingClientRect();
21
+ const {
22
+ top: containerTop,
23
+ bottom: containerBottom
24
+ } = container.getBoundingClientRect();
25
+ const isChildTopAboveViewingArea = childTop < containerTop + margin;
26
+ const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
27
+
28
+ if (isChildTopAboveViewingArea) {
29
+ const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
30
+ container.scrollTo({
31
+ behavior,
32
+ top: scrollHeightToChildTop - margin
33
+ });
34
+ } else if (isChildBottomBelowViewingArea) {
35
+ const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
36
+ container.scrollTo({
37
+ behavior,
38
+ top: scrollHeightToChildBottom + margin
39
+ });
40
+ } // either completely in view or outside viewing area on both ends, don't scroll
41
+
42
+ }
43
+
16
44
  const StyledHeader = styled.div.withConfig({
17
45
  displayName: "FilteredActionList__StyledHeader",
18
46
  componentId: "yg3jkv-0"
@@ -67,7 +95,7 @@ export function FilteredActionList({
67
95
  useEffect(() => {
68
96
  // if items changed, we want to instantly move active descendant into view
69
97
  if (activeDescendantRef.current && scrollContainerRef.current) {
70
- scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
98
+ scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
71
99
  }
72
100
  }, [items]);
73
101
  useScrollFlash(scrollContainerRef);
package/lib-esm/Flash.js CHANGED
@@ -5,35 +5,35 @@ import sx from './sx';
5
5
  const variants = variant({
6
6
  variants: {
7
7
  default: {
8
- color: 'fg.default',
9
- backgroundColor: 'accent.subtle',
10
- borderColor: 'accent.muted',
8
+ color: 'alert.info.text',
9
+ backgroundColor: 'alert.info.bg',
10
+ borderColor: 'alert.info.border',
11
11
  svg: {
12
- color: 'accent.fg'
12
+ color: 'alert.info.icon'
13
13
  }
14
14
  },
15
15
  success: {
16
- color: 'fg.default',
17
- backgroundColor: 'success.subtle',
18
- borderColor: 'success.muted',
16
+ color: 'alert.success.text',
17
+ backgroundColor: 'alert.success.bg',
18
+ borderColor: 'alert.success.border',
19
19
  svg: {
20
- color: 'success.fg'
20
+ color: 'alert.success.icon'
21
21
  }
22
22
  },
23
23
  danger: {
24
- color: 'fg.default',
25
- backgroundColor: 'danger.subtle',
26
- borderColor: 'danger.muted',
24
+ color: 'alert.error.text',
25
+ backgroundColor: 'alert.error.bg',
26
+ borderColor: 'alert.error.border',
27
27
  svg: {
28
- color: 'danger.fg'
28
+ color: 'alert.error.icon'
29
29
  }
30
30
  },
31
31
  warning: {
32
- color: 'fg.default',
33
- backgroundColor: 'attention.subtle',
34
- borderColor: 'attention.muted',
32
+ color: 'alert.warn.text',
33
+ backgroundColor: 'alert.warn.bg',
34
+ borderColor: 'alert.warn.border',
35
35
  svg: {
36
- color: 'attention.fg'
36
+ color: 'alert.warn.icon'
37
37
  }
38
38
  }
39
39
  }
package/lib-esm/Label.js CHANGED
@@ -33,7 +33,7 @@ const Label = styled.span.withConfig({
33
33
  componentId: "sc-1t3ykp0-0"
34
34
  })(["display:inline-block;font-weight:", ";color:", ";border-radius:", ";&:hover{text-decoration:none;}", " ", " ", " ", " ", ""], get('fontWeights.semibold'), get('colors.fg.onEmphasis'), get('radii.3'), sizeVariant, COMMON, props => props.dropshadow ? 'box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12)' : '', props => props.outline ? outlineStyles : '', sx);
35
35
  Label.defaultProps = {
36
- bg: 'neutral.emphasis',
36
+ bg: 'label.primary.border',
37
37
  variant: 'medium'
38
38
  };
39
39
  export default Label;
@@ -40,7 +40,6 @@ export declare type OverlayProps = {
40
40
  top: number;
41
41
  left: number;
42
42
  portalContainerName?: string;
43
- preventFocusOnOpen?: boolean;
44
43
  } & Omit<ComponentProps<typeof StyledOverlay>, 'visibility' | keyof SystemPositionProps>;
45
44
  /**
46
45
  * An `Overlay` is a flexible floating surface, used to display transient content such as menus,
@@ -92,7 +92,6 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
92
92
  left,
93
93
  anchorSide,
94
94
  portalContainerName,
95
- preventFocusOnOpen,
96
95
  ...rest
97
96
  }, forwardedRef) => {
98
97
  const overlayRef = useRef(null);
@@ -108,8 +107,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
108
107
  onEscape,
109
108
  ignoreClickRefs,
110
109
  onClickOutside,
111
- initialFocusRef,
112
- preventFocusOnOpen
110
+ initialFocusRef
113
111
  });
114
112
  useEffect(() => {
115
113
  var _combinedRef$current;
@@ -36,7 +36,7 @@ function ProgressBar({
36
36
 
37
37
  ProgressBar.displayName = "ProgressBar";
38
38
  ProgressBar.defaultProps = {
39
- bg: 'success.emphasis',
39
+ bg: 'bg.successInverse',
40
40
  barSize: 'default'
41
41
  };
42
42
  export default ProgressBar;
@@ -32,15 +32,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
32
32
  Divider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
33
33
  Filter: React.ForwardRefExoticComponent<Pick<{
34
34
  value?: string | undefined;
35
- } & Pick<Omit<Pick<{
36
- [x: string]: any;
37
- [x: number]: any;
38
- } & {
39
- theme?: any;
40
- } & {
41
- as?: string | React.ComponentType<any> | undefined;
42
- forwardedAs?: string | React.ComponentType<any> | undefined;
43
- }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast"> & {
35
+ } & Pick<{
44
36
  className?: string | undefined;
45
37
  icon?: React.ComponentType<{
46
38
  className?: string | undefined;
@@ -315,7 +307,15 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
315
307
  contrast?: boolean | undefined;
316
308
  } & {
317
309
  theme?: any;
318
- }, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "disabled" | "variant" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
310
+ }, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "disabled" | "variant" | "contrast"> & Omit<Pick<{
311
+ [x: string]: any;
312
+ [x: number]: any;
313
+ } & {
314
+ theme?: any;
315
+ } & {
316
+ as?: string | React.ComponentType<any> | undefined;
317
+ forwardedAs?: string | React.ComponentType<any> | undefined;
318
+ }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
319
319
  Footer: import("styled-components").StyledComponent<"footer", any, SystemCommonProps & SxProp, never>;
320
320
  Item: React.ForwardRefExoticComponent<Pick<{
321
321
  as?: React.ElementType<any> | undefined;
@@ -19,28 +19,34 @@ const colorVariants = variant({
19
19
  prop: 'status',
20
20
  variants: {
21
21
  issueClosed: {
22
- backgroundColor: 'danger.emphasis',
23
- color: 'fg.onEmphasis'
22
+ backgroundColor: 'prState.closed.bg',
23
+ color: 'prState.closed.text',
24
+ borderColor: 'prState.closed.border'
24
25
  },
25
26
  pullClosed: {
26
- backgroundColor: 'danger.emphasis',
27
- color: 'fg.onEmphasis'
27
+ backgroundColor: 'prState.closed.bg',
28
+ color: 'prState.closed.text',
29
+ borderColor: 'prState.closed.border'
28
30
  },
29
31
  pullMerged: {
30
- backgroundColor: 'done.emphasis',
31
- color: 'fg.onEmphasis'
32
+ backgroundColor: 'prState.merged.bg',
33
+ color: 'prState.merged.text',
34
+ borderColor: 'prState.merged.border'
32
35
  },
33
36
  issueOpened: {
34
- backgroundColor: 'success.emphasis',
35
- color: 'fg.onEmphasis'
37
+ backgroundColor: 'prState.open.bg',
38
+ color: 'prState.open.text',
39
+ borderColor: 'prState.open.border'
36
40
  },
37
41
  pullOpened: {
38
- backgroundColor: 'success.emphasis',
39
- color: 'fg.onEmphasis'
42
+ backgroundColor: 'prState.open.bg',
43
+ color: 'prState.open.text',
44
+ borderColor: 'prState.open.border'
40
45
  },
41
46
  draft: {
42
- backgroundColor: 'neutral.emphasis',
43
- color: 'fg.onEmphasis'
47
+ backgroundColor: 'prState.draft.bg',
48
+ color: 'prState.draft.text',
49
+ borderColor: 'prState.draft.border'
44
50
  }
45
51
  }
46
52
  });
@@ -62,7 +68,7 @@ const sizeVariants = variant({
62
68
  const StateLabelBase = styled.span.withConfig({
63
69
  displayName: "StateLabel__StateLabelBase",
64
70
  componentId: "k4pd9e-0"
65
- })(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";", ";", ";", ";", ";"], get('fontWeights.bold'), get('colors.canvas.default'), get('radii.3'), colorVariants, sizeVariants, COMMON, sx);
71
+ })(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";border-width:1px;border-style:solid;", ";", ";", ";", ";"], get('fontWeights.bold'), get('colors.canvas.default'), get('radii.3'), colorVariants, sizeVariants, COMMON, sx);
66
72
 
67
73
  function StateLabel({
68
74
  children,
@@ -1,14 +1,22 @@
1
1
  import React from 'react';
2
- import { ComponentProps, Merge } from './utils/types';
3
- import UnstyledTextInput from './_UnstyledTextInput';
4
- import TextInputWrapper from './_TextInputWrapper';
2
+ import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
3
+ import { SxProp } from './sx';
4
+ import { ComponentProps } from './utils/types';
5
+ declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
6
+ declare const Wrapper: import("styled-components").StyledComponent<"span", any, {
7
+ disabled?: boolean | undefined;
8
+ hasIcon?: boolean | undefined;
9
+ block?: boolean | undefined;
10
+ contrast?: boolean | undefined;
11
+ variant?: "large" | "small" | undefined;
12
+ } & WidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>> & MinWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>> & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
5
13
  declare type NonPassthroughProps = {
6
14
  className?: string;
7
15
  icon?: React.ComponentType<{
8
16
  className?: string;
9
17
  }>;
10
- } & Pick<ComponentProps<typeof TextInputWrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
11
- declare type TextInputInternalProps = Merge<React.ComponentPropsWithoutRef<typeof UnstyledTextInput>, NonPassthroughProps>;
18
+ } & Pick<ComponentProps<typeof Wrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
19
+ declare type TextInputInternalProps = NonPassthroughProps & Omit<React.ComponentPropsWithoutRef<typeof Input>, keyof NonPassthroughProps>;
12
20
  declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
13
21
  export declare type TextInputProps = ComponentProps<typeof TextInput>;
14
22
  export default TextInput;
@@ -2,8 +2,41 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import classnames from 'classnames';
4
4
  import React from 'react';
5
- import UnstyledTextInput from './_UnstyledTextInput';
6
- import TextInputWrapper from './_TextInputWrapper';
5
+ import styled, { css } from 'styled-components';
6
+ import { maxWidth, minWidth, variant, width } from 'styled-system';
7
+ import { get } from './constants';
8
+ import sx from './sx';
9
+ const sizeVariants = variant({
10
+ variants: {
11
+ small: {
12
+ minHeight: '28px',
13
+ px: 2,
14
+ py: '3px',
15
+ fontSize: 0,
16
+ lineHeight: '20px'
17
+ },
18
+ large: {
19
+ px: 2,
20
+ py: '10px',
21
+ fontSize: 3
22
+ }
23
+ }
24
+ });
25
+ const Input = styled.input.withConfig({
26
+ displayName: "TextInput__Input",
27
+ componentId: "sc-1apmpmt-0"
28
+ })(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
29
+ const Wrapper = styled.span.withConfig({
30
+ displayName: "TextInput__Wrapper",
31
+ componentId: "sc-1apmpmt-1"
32
+ })(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
33
+ if (props.hasIcon) {
34
+ return css(["padding:0;"]);
35
+ } else {
36
+ return css(["padding:6px 12px;"]);
37
+ }
38
+ }, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.muted'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx); // Props that are not passed through to Input:
39
+
7
40
  // using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
8
41
  const TextInput = /*#__PURE__*/React.forwardRef(({
9
42
  icon: IconComponent,
@@ -21,7 +54,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
21
54
  }, ref) => {
22
55
  // this class is necessary to style FilterSearch, plz no touchy!
23
56
  const wrapperClasses = classnames(className, 'TextInput-wrapper');
24
- return /*#__PURE__*/React.createElement(TextInputWrapper, {
57
+ return /*#__PURE__*/React.createElement(Wrapper, {
25
58
  block: block,
26
59
  className: wrapperClasses,
27
60
  contrast: contrast,
@@ -35,7 +68,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
35
68
  variant: variantProp
36
69
  }, IconComponent && /*#__PURE__*/React.createElement(IconComponent, {
37
70
  className: "TextInput-icon"
38
- }), /*#__PURE__*/React.createElement(UnstyledTextInput, _extends({
71
+ }), /*#__PURE__*/React.createElement(Input, _extends({
39
72
  ref: ref,
40
73
  disabled: disabled
41
74
  }, inputProps)));
@@ -3,6 +3,5 @@ export declare type UseOpenAndCloseFocusSettings = {
3
3
  initialFocusRef?: React.RefObject<HTMLElement>;
4
4
  containerRef: React.RefObject<HTMLElement>;
5
5
  returnFocusRef: React.RefObject<HTMLElement>;
6
- preventFocusOnOpen?: boolean;
7
6
  };
8
- export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen }: UseOpenAndCloseFocusSettings): void;
7
+ export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef }: UseOpenAndCloseFocusSettings): void;
@@ -3,14 +3,9 @@ import { iterateFocusableElements } from '../utils/iterateFocusableElements';
3
3
  export function useOpenAndCloseFocus({
4
4
  initialFocusRef,
5
5
  returnFocusRef,
6
- containerRef,
7
- preventFocusOnOpen
6
+ containerRef
8
7
  }) {
9
8
  useEffect(() => {
10
- if (preventFocusOnOpen) {
11
- return;
12
- }
13
-
14
9
  const returnRef = returnFocusRef.current;
15
10
 
16
11
  if (initialFocusRef && initialFocusRef.current) {
@@ -23,5 +18,5 @@ export function useOpenAndCloseFocus({
23
18
  return function () {
24
19
  returnRef === null || returnRef === void 0 ? void 0 : returnRef.focus();
25
20
  };
26
- }, [initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen]);
21
+ }, [initialFocusRef, returnFocusRef, containerRef]);
27
22
  }
@@ -7,9 +7,8 @@ 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;
11
10
  };
12
11
  export declare type OverlayReturnProps = {
13
12
  ref: React.RefObject<HTMLDivElement>;
14
13
  };
15
- export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside, preventFocusOnOpen }: UseOverlaySettings) => OverlayReturnProps;
14
+ export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside }: UseOverlaySettings) => OverlayReturnProps;
@@ -8,15 +8,13 @@ export const useOverlay = ({
8
8
  initialFocusRef,
9
9
  onEscape,
10
10
  ignoreClickRefs,
11
- onClickOutside,
12
- preventFocusOnOpen
11
+ onClickOutside
13
12
  }) => {
14
13
  const overlayRef = useProvidedRefOrCreate(_overlayRef);
15
14
  useOpenAndCloseFocus({
16
15
  containerRef: overlayRef,
17
16
  returnFocusRef,
18
- initialFocusRef,
19
- preventFocusOnOpen
17
+ initialFocusRef
20
18
  });
21
19
  useOnOutsideClick({
22
20
  containerRef: overlayRef,
@@ -22,11 +22,8 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
22
22
  export { useOverlay } from './hooks/useOverlay';
23
23
  export { useConfirm } from './Dialog/ConfirmationDialog';
24
24
  export { ActionList } from './ActionList';
25
- export { ActionList as ActionList2 } from './ActionList2';
26
25
  export { ActionMenu } from './ActionMenu';
27
26
  export type { ActionMenuProps } from './ActionMenu';
28
- export { default as Autocomplete } from './Autocomplete';
29
- export type { AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps } from './Autocomplete';
30
27
  export { default as Avatar } from './Avatar';
31
28
  export type { AvatarProps } from './Avatar';
32
29
  export { default as AvatarPair } from './AvatarPair';
@@ -101,13 +98,10 @@ export { default as TabNav } from './TabNav';
101
98
  export type { TabNavProps, TabNavLinkProps } from './TabNav';
102
99
  export { default as TextInput } from './TextInput';
103
100
  export type { TextInputProps } from './TextInput';
104
- export { default as TextInputWithTokens } from './TextInputWithTokens';
105
- export type { TextInputWithTokensProps } from './TextInputWithTokens';
106
101
  export { default as Text } from './Text';
107
102
  export type { TextProps } from './Text';
108
103
  export { default as Timeline } from './Timeline';
109
104
  export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
110
- export { default as Token, IssueLabelToken, AvatarToken } from './Token';
111
105
  export { default as Tooltip } from './Tooltip';
112
106
  export type { TooltipProps } from './Tooltip';
113
107
  export { default as Truncate } from './Truncate';
package/lib-esm/index.js CHANGED
@@ -18,9 +18,7 @@ export { useOverlay } from './hooks/useOverlay';
18
18
  export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
19
19
 
20
20
  export { ActionList } from './ActionList';
21
- export { ActionList as ActionList2 } from './ActionList2';
22
21
  export { ActionMenu } from './ActionMenu';
23
- export { default as Autocomplete } from './Autocomplete';
24
22
  export { default as Avatar } from './Avatar';
25
23
  export { default as AvatarPair } from './AvatarPair';
26
24
  export { default as AvatarStack } from './AvatarStack';
@@ -63,10 +61,8 @@ export { default as StyledOcticon } from './StyledOcticon';
63
61
  export { default as SubNav } from './SubNav';
64
62
  export { default as TabNav } from './TabNav';
65
63
  export { default as TextInput } from './TextInput';
66
- export { default as TextInputWithTokens } from './TextInputWithTokens';
67
64
  export { default as Text } from './Text';
68
65
  export { default as Timeline } from './Timeline';
69
- export { default as Token, IssueLabelToken, AvatarToken } from './Token';
70
66
  export { default as Tooltip } from './Tooltip';
71
67
  export { default as Truncate } from './Truncate';
72
68
  export { default as UnderlineNav } from './UnderlineNav';