@primer/react 34.0.0 → 34.0.1

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 (113) hide show
  1. package/dist/browser.esm.js +2 -2
  2. package/dist/browser.esm.js.map +1 -1
  3. package/dist/browser.umd.js +2 -2
  4. package/dist/browser.umd.js.map +1 -1
  5. package/lib/ActionList/Item.js +3 -3
  6. package/lib/ActionList/List.js +2 -2
  7. package/lib/ActionList2/Selection.js +0 -1
  8. package/lib/ActionMenu2.d.ts +0 -2
  9. package/lib/ActionMenu2.js +1 -3
  10. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -1
  11. package/lib/Autocomplete/Autocomplete.d.ts +12 -3
  12. package/lib/Autocomplete/AutocompleteInput.d.ts +12 -3
  13. package/lib/Autocomplete/AutocompleteMenu.js +10 -5
  14. package/lib/Dialog/ConfirmationDialog.js +2 -2
  15. package/lib/Dialog/Dialog.js +2 -2
  16. package/lib/FilteredActionList/FilteredActionList.js +10 -3
  17. package/lib/NewButton/button-base.d.ts +6 -0
  18. package/lib/NewButton/button-base.js +69 -0
  19. package/lib/NewButton/button-link.d.ts +27 -0
  20. package/lib/NewButton/button-link.js +31 -0
  21. package/lib/NewButton/button.d.ts +2 -11
  22. package/lib/NewButton/button.js +6 -283
  23. package/lib/NewButton/icon-button.d.ts +4 -0
  24. package/lib/NewButton/icon-button.js +62 -0
  25. package/lib/NewButton/index.d.ts +6 -11
  26. package/lib/NewButton/index.js +18 -0
  27. package/lib/NewButton/styles.d.ts +204 -0
  28. package/lib/NewButton/styles.js +249 -0
  29. package/lib/NewButton/types.d.ts +28 -8
  30. package/lib/NewButton/types.js +19 -1
  31. package/lib/Overlay.d.ts +1 -1
  32. package/lib/SelectMenu/SelectMenu.d.ts +12 -3
  33. package/lib/TextInput.d.ts +8 -1
  34. package/lib/TextInput.js +19 -6
  35. package/lib/TextInputWithTokens.d.ts +12 -3
  36. package/lib/TextInputWithTokens.js +14 -11
  37. package/lib/_TextInputWrapper.d.ts +6 -1
  38. package/lib/_TextInputWrapper.js +21 -8
  39. package/lib/hooks/useAnchoredPosition.d.ts +1 -1
  40. package/lib/hooks/useAnchoredPosition.js +2 -2
  41. package/lib/hooks/useFocusTrap.js +2 -2
  42. package/lib/hooks/useFocusZone.d.ts +3 -1
  43. package/lib/hooks/useFocusZone.js +8 -2
  44. package/lib/hooks/useOpenAndCloseFocus.js +2 -2
  45. package/lib-esm/ActionList/Item.js +1 -1
  46. package/lib-esm/ActionList/List.js +1 -1
  47. package/lib-esm/ActionList2/Selection.js +0 -1
  48. package/lib-esm/ActionMenu2.d.ts +0 -2
  49. package/lib-esm/ActionMenu2.js +1 -1
  50. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -1
  51. package/lib-esm/Autocomplete/Autocomplete.d.ts +12 -3
  52. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +12 -3
  53. package/lib-esm/Autocomplete/AutocompleteMenu.js +9 -4
  54. package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
  55. package/lib-esm/Dialog/Dialog.js +1 -1
  56. package/lib-esm/FilteredActionList/FilteredActionList.js +9 -3
  57. package/lib-esm/NewButton/button-base.d.ts +6 -0
  58. package/lib-esm/NewButton/button-base.js +47 -0
  59. package/lib-esm/NewButton/button-link.d.ts +27 -0
  60. package/lib-esm/NewButton/button-link.js +15 -0
  61. package/lib-esm/NewButton/button.d.ts +2 -11
  62. package/lib-esm/NewButton/button.js +4 -275
  63. package/lib-esm/NewButton/icon-button.d.ts +4 -0
  64. package/lib-esm/NewButton/icon-button.js +39 -0
  65. package/lib-esm/NewButton/index.d.ts +6 -11
  66. package/lib-esm/NewButton/index.js +4 -1
  67. package/lib-esm/NewButton/styles.d.ts +204 -0
  68. package/lib-esm/NewButton/styles.js +230 -0
  69. package/lib-esm/NewButton/types.d.ts +28 -8
  70. package/lib-esm/NewButton/types.js +6 -1
  71. package/lib-esm/Overlay.d.ts +1 -1
  72. package/lib-esm/SelectMenu/SelectMenu.d.ts +12 -3
  73. package/lib-esm/TextInput.d.ts +8 -1
  74. package/lib-esm/TextInput.js +19 -6
  75. package/lib-esm/TextInputWithTokens.d.ts +12 -3
  76. package/lib-esm/TextInputWithTokens.js +12 -9
  77. package/lib-esm/_TextInputWrapper.d.ts +6 -1
  78. package/lib-esm/_TextInputWrapper.js +19 -7
  79. package/lib-esm/hooks/useAnchoredPosition.d.ts +1 -1
  80. package/lib-esm/hooks/useAnchoredPosition.js +1 -1
  81. package/lib-esm/hooks/useFocusTrap.js +1 -1
  82. package/lib-esm/hooks/useFocusZone.d.ts +3 -1
  83. package/lib-esm/hooks/useFocusZone.js +2 -1
  84. package/lib-esm/hooks/useOpenAndCloseFocus.js +1 -1
  85. package/package.json +6 -10
  86. package/lib/behaviors/anchoredPosition.d.ts +0 -89
  87. package/lib/behaviors/anchoredPosition.js +0 -316
  88. package/lib/behaviors/focusTrap.d.ts +0 -12
  89. package/lib/behaviors/focusTrap.js +0 -179
  90. package/lib/behaviors/focusZone.d.ts +0 -137
  91. package/lib/behaviors/focusZone.js +0 -578
  92. package/lib/behaviors/scrollIntoViewingArea.d.ts +0 -1
  93. package/lib/behaviors/scrollIntoViewingArea.js +0 -39
  94. package/lib/utils/iterateFocusableElements.d.ts +0 -42
  95. package/lib/utils/iterateFocusableElements.js +0 -113
  96. package/lib/utils/uniqueId.d.ts +0 -1
  97. package/lib/utils/uniqueId.js +0 -12
  98. package/lib/utils/userAgent.d.ts +0 -1
  99. package/lib/utils/userAgent.js +0 -15
  100. package/lib-esm/behaviors/anchoredPosition.d.ts +0 -89
  101. package/lib-esm/behaviors/anchoredPosition.js +0 -309
  102. package/lib-esm/behaviors/focusTrap.d.ts +0 -12
  103. package/lib-esm/behaviors/focusTrap.js +0 -170
  104. package/lib-esm/behaviors/focusZone.d.ts +0 -137
  105. package/lib-esm/behaviors/focusZone.js +0 -560
  106. package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +0 -1
  107. package/lib-esm/behaviors/scrollIntoViewingArea.js +0 -30
  108. package/lib-esm/utils/iterateFocusableElements.d.ts +0 -42
  109. package/lib-esm/utils/iterateFocusableElements.js +0 -102
  110. package/lib-esm/utils/uniqueId.d.ts +0 -1
  111. package/lib-esm/utils/uniqueId.js +0 -5
  112. package/lib-esm/utils/userAgent.d.ts +0 -1
  113. package/lib-esm/utils/userAgent.js +0 -8
@@ -23,7 +23,7 @@ var _Divider = require("./Divider");
23
23
 
24
24
  var _ThemeProvider = require("../ThemeProvider");
25
25
 
26
- var _focusZone = require("../behaviors/focusZone");
26
+ var _behaviors = require("@primer/behaviors");
27
27
 
28
28
  var _ssr = require("@react-aria/ssr");
29
29
 
@@ -98,10 +98,10 @@ const StyledItem = _styledComponents.default.div.withConfig({
98
98
  showDivider
99
99
  }) => showDivider ? `1px` : '0', DividedContent, (0, _constants.get)('colors.border.muted'), ({
100
100
  showDivider
101
- }) => showDivider ? `1px` : '0', DividedContent, DividedContent, DividedContent, DividedContent, _focusZone.isActiveDescendantAttribute, DividedContent, _focusZone.isActiveDescendantAttribute, DividedContent, _focusZone.isActiveDescendantAttribute, _focusZone.activeDescendantActivatedDirectly, ({
101
+ }) => showDivider ? `1px` : '0', DividedContent, DividedContent, DividedContent, DividedContent, _behaviors.isActiveDescendantAttribute, DividedContent, _behaviors.isActiveDescendantAttribute, DividedContent, _behaviors.isActiveDescendantAttribute, _behaviors.activeDescendantActivatedDirectly, ({
102
102
  variant,
103
103
  item
104
- }) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg, _focusZone.isActiveDescendantAttribute, _focusZone.activeDescendantActivatedIndirectly, ({
104
+ }) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg, _behaviors.isActiveDescendantAttribute, _behaviors.activeDescendantActivatedIndirectly, ({
105
105
  variant,
106
106
  item
107
107
  }) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).hoverBg, ({
@@ -17,7 +17,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
17
17
 
18
18
  var _constants = require("../constants");
19
19
 
20
- var _focusZone = require("../behaviors/focusZone");
20
+ var _behaviors = require("@primer/behaviors");
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
@@ -38,7 +38,7 @@ function isGroupedListProps(props) {
38
38
  const StyledList = _styledComponents.default.div.withConfig({
39
39
  displayName: "List__StyledList",
40
40
  componentId: "sc-1x7olzq-0"
41
- })(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], (0, _constants.get)('fontSizes.1'), _focusZone.hasActiveDescendantAttribute, (0, _constants.get)('colors.border.muted'));
41
+ })(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], (0, _constants.get)('fontSizes.1'), _behaviors.hasActiveDescendantAttribute, (0, _constants.get)('colors.border.muted'));
42
42
  /**
43
43
  * Returns `sx` prop values for `List` children matching the given `List` style variation.
44
44
  * @param variant `List` style variation.
@@ -46,7 +46,6 @@ const Selection = ({
46
46
 
47
47
  if (container === 'ActionMenu') {
48
48
  throw new Error('ActionList cannot have a selectionVariant inside ActionMenu, please use DropdownMenu or SelectPanel instead. More information: https://primer.style/design/components/action-list#application');
49
- return null;
50
49
  }
51
50
 
52
51
  if (selectionVariant === 'single') {
@@ -2,8 +2,6 @@ import { ButtonProps } from './Button';
2
2
  import React from 'react';
3
3
  import { AnchoredOverlayProps } from './AnchoredOverlay';
4
4
  import { OverlayProps } from './Overlay';
5
- declare type MenuContextProps = Pick<AnchoredOverlayProps, 'anchorRef' | 'renderAnchor' | 'open' | 'onOpen' | 'onClose'>;
6
- export declare const MenuContext: React.Context<MenuContextProps>;
7
5
  export declare type ActionMenuProps = {
8
6
  /**
9
7
  * Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ActionMenu = exports.MenuContext = void 0;
6
+ exports.ActionMenu = void 0;
7
7
 
8
8
  var _Button = _interopRequireDefault(require("./Button"));
9
9
 
@@ -24,8 +24,6 @@ const MenuContext = /*#__PURE__*/_react.default.createContext({
24
24
  open: false
25
25
  });
26
26
 
27
- exports.MenuContext = MenuContext;
28
-
29
27
  const Menu = ({
30
28
  anchorRef: externalAnchorRef,
31
29
  open,
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { OverlayProps } from '../Overlay';
3
3
  import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
4
4
  import { FocusZoneHookSettings } from '../hooks/useFocusZone';
5
- import { PositionSettings } from '../behaviors/anchoredPosition';
5
+ import type { PositionSettings } from '@primer/behaviors';
6
6
  interface AnchoredOverlayPropsWithAnchor {
7
7
  /**
8
8
  * A custom function component used to render the anchor element.
@@ -21,11 +21,17 @@ declare const _default: React.FC<{
21
21
  } & {
22
22
  as?: string | React.ComponentType<any> | undefined;
23
23
  forwardedAs?: string | React.ComponentType<any> | undefined;
24
- }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "variant" | "sx" | "className" | "disabled" | "contrast"> & {
24
+ }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "size" | "block" | "icon" | "variant" | "sx" | "className" | "disabled" | "leadingVisual" | "trailingVisual" | "contrast"> & {
25
25
  className?: string | undefined;
26
26
  icon?: React.ComponentType<{
27
27
  className?: string | undefined;
28
28
  }> | undefined;
29
+ leadingVisual?: string | React.ComponentType<{
30
+ className?: string | undefined;
31
+ }> | undefined;
32
+ trailingVisual?: string | React.ComponentType<{
33
+ className?: string | undefined;
34
+ }> | undefined;
29
35
  } & Pick<{
30
36
  color?: string | undefined;
31
37
  property?: string | undefined;
@@ -39,6 +45,7 @@ declare const _default: React.FC<{
39
45
  slot?: string | undefined;
40
46
  style?: React.CSSProperties | undefined;
41
47
  title?: string | undefined;
48
+ size?: "small" | "large" | undefined;
42
49
  block?: boolean | undefined;
43
50
  variant?: "small" | "large" | undefined;
44
51
  role?: React.AriaRole | undefined;
@@ -293,11 +300,13 @@ declare const _default: React.FC<{
293
300
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
294
301
  css?: import("@emotion/core").InterpolationWithTheme<any>;
295
302
  disabled?: boolean | undefined;
296
- hasIcon?: boolean | undefined;
303
+ validationStatus?: "error" | "warning" | undefined;
304
+ hasLeadingVisual?: boolean | undefined;
305
+ hasTrailingVisual?: boolean | undefined;
297
306
  contrast?: boolean | undefined;
298
307
  } & {
299
308
  theme?: any;
300
- }, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "variant" | "sx" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, {
309
+ }, "maxWidth" | "minWidth" | "width" | "size" | "block" | "variant" | "sx" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, {
301
310
  as?: React.ComponentType<any> | undefined;
302
311
  }>;
303
312
  Menu: typeof AutocompleteMenu;
@@ -13,11 +13,17 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
13
13
  } & {
14
14
  as?: string | React.ComponentType<any> | undefined;
15
15
  forwardedAs?: string | React.ComponentType<any> | undefined;
16
- }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "variant" | "sx" | "className" | "disabled" | "contrast"> & {
16
+ }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "size" | "block" | "icon" | "variant" | "sx" | "className" | "disabled" | "leadingVisual" | "trailingVisual" | "contrast"> & {
17
17
  className?: string | undefined;
18
18
  icon?: React.ComponentType<{
19
19
  className?: string | undefined;
20
20
  }> | undefined;
21
+ leadingVisual?: string | React.ComponentType<{
22
+ className?: string | undefined;
23
+ }> | undefined;
24
+ trailingVisual?: string | React.ComponentType<{
25
+ className?: string | undefined;
26
+ }> | undefined;
21
27
  } & Pick<{
22
28
  color?: string | undefined;
23
29
  property?: string | undefined;
@@ -31,6 +37,7 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
31
37
  slot?: string | undefined;
32
38
  style?: React.CSSProperties | undefined;
33
39
  title?: string | undefined;
40
+ size?: "small" | "large" | undefined;
34
41
  block?: boolean | undefined;
35
42
  variant?: "small" | "large" | undefined;
36
43
  role?: React.AriaRole | undefined;
@@ -285,10 +292,12 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
285
292
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
286
293
  css?: import("@emotion/core").InterpolationWithTheme<any>;
287
294
  disabled?: boolean | undefined;
288
- hasIcon?: boolean | undefined;
295
+ validationStatus?: "error" | "warning" | undefined;
296
+ hasLeadingVisual?: boolean | undefined;
297
+ hasTrailingVisual?: boolean | undefined;
289
298
  contrast?: boolean | undefined;
290
299
  } & {
291
300
  theme?: any;
292
- }, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "variant" | "sx" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, InternalAutocompleteInputProps>;
301
+ }, "maxWidth" | "minWidth" | "width" | "size" | "block" | "variant" | "sx" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, InternalAutocompleteInputProps>;
293
302
  export declare type AutocompleteInputProps = ComponentProps<typeof AutocompleteInput>;
294
303
  export default AutocompleteInput;
@@ -17,9 +17,9 @@ var _AutocompleteContext = require("./AutocompleteContext");
17
17
 
18
18
  var _octiconsReact = require("@primer/octicons-react");
19
19
 
20
- var _uniqueId = require("../utils/uniqueId");
20
+ var _utils = require("@primer/behaviors/utils");
21
21
 
22
- var _scrollIntoViewingArea = require("../behaviors/scrollIntoViewingArea");
22
+ var _behaviors = require("@primer/behaviors");
23
23
 
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
 
@@ -27,6 +27,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
27
27
 
28
28
  const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
29
29
 
30
+ const menuScrollMargins = {
31
+ startMargin: 0,
32
+ endMargin: 8
33
+ };
34
+
30
35
  function getDefaultItemFilter(filterValue) {
31
36
  return function (item, _i) {
32
37
  var _item$text;
@@ -125,7 +130,7 @@ function AutocompleteMenu(props) {
125
130
  onAction: item => {
126
131
  // TODO: make it possible to pass a leadingVisual when using `addNewItem`
127
132
  addNewItem.handleAddItem({ ...item,
128
- id: item.id || (0, _uniqueId.uniqueId)(),
133
+ id: item.id || (0, _utils.uniqueId)(),
129
134
  leadingVisual: undefined
130
135
  });
131
136
 
@@ -152,9 +157,9 @@ function AutocompleteMenu(props) {
152
157
  }
153
158
 
154
159
  if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) {
155
- (0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, customScrollContainerRef.current);
160
+ (0, _behaviors.scrollIntoView)(current, customScrollContainerRef.current, menuScrollMargins);
156
161
  } else if (current && scrollContainerRef.current && directlyActivated) {
157
- (0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
162
+ (0, _behaviors.scrollIntoView)(current, scrollContainerRef.current, menuScrollMargins);
158
163
  }
159
164
  }
160
165
  }, [loading]);
@@ -16,7 +16,7 @@ var _Box = _interopRequireDefault(require("../Box"));
16
16
 
17
17
  var _ThemeProvider = require("../ThemeProvider");
18
18
 
19
- var _focusZone = require("../behaviors/focusZone");
19
+ var _behaviors = require("@primer/behaviors");
20
20
 
21
21
  var _constants = require("../constants");
22
22
 
@@ -81,7 +81,7 @@ const ConfirmationFooter = ({
81
81
  const {
82
82
  containerRef: footerRef
83
83
  } = (0, _useFocusZone.useFocusZone)({
84
- bindKeys: _focusZone.FocusKeys.ArrowHorizontal | _focusZone.FocusKeys.Tab,
84
+ bindKeys: _behaviors.FocusKeys.ArrowHorizontal | _behaviors.FocusKeys.Tab,
85
85
  focusInStrategy: 'closest'
86
86
  }); // Must have exactly 2 buttons!
87
87
 
@@ -27,7 +27,7 @@ var _octiconsReact = require("@primer/octicons-react");
27
27
 
28
28
  var _useFocusZone = require("../hooks/useFocusZone");
29
29
 
30
- var _focusZone = require("../behaviors/focusZone");
30
+ var _behaviors = require("@primer/behaviors");
31
31
 
32
32
  var _Portal = _interopRequireDefault(require("../Portal"));
33
33
 
@@ -121,7 +121,7 @@ const DefaultFooter = ({
121
121
  const {
122
122
  containerRef: footerRef
123
123
  } = (0, _useFocusZone.useFocusZone)({
124
- bindKeys: _focusZone.FocusKeys.ArrowHorizontal | _focusZone.FocusKeys.Tab,
124
+ bindKeys: _behaviors.FocusKeys.ArrowHorizontal | _behaviors.FocusKeys.Tab,
125
125
  focusInStrategy: 'closest'
126
126
  });
127
127
  return footerButtons ? /*#__PURE__*/_react.default.createElement(Dialog.Footer, {
@@ -29,7 +29,7 @@ var _useProvidedRefOrCreate = require("../hooks/useProvidedRefOrCreate");
29
29
 
30
30
  var _useScrollFlash = _interopRequireDefault(require("../hooks/useScrollFlash"));
31
31
 
32
- var _scrollIntoViewingArea = require("../behaviors/scrollIntoViewingArea");
32
+ var _behaviors = require("@primer/behaviors");
33
33
 
34
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
35
 
@@ -39,6 +39,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
39
39
 
40
40
  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); }
41
41
 
42
+ const menuScrollMargins = {
43
+ startMargin: 0,
44
+ endMargin: 8
45
+ };
46
+
42
47
  const StyledHeader = _styledComponents.default.div.withConfig({
43
48
  displayName: "FilteredActionList__StyledHeader",
44
49
  componentId: "sc-1oqgb0s-0"
@@ -86,7 +91,7 @@ function FilteredActionList({
86
91
  activeDescendantRef.current = current;
87
92
 
88
93
  if (current && scrollContainerRef.current && directlyActivated) {
89
- (0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
94
+ (0, _behaviors.scrollIntoView)(current, scrollContainerRef.current, menuScrollMargins);
90
95
  }
91
96
  }
92
97
  }, [// List ref isn't set while loading. Need to re-bind focus zone when it changes
@@ -94,7 +99,9 @@ function FilteredActionList({
94
99
  (0, _react.useEffect)(() => {
95
100
  // if items changed, we want to instantly move active descendant into view
96
101
  if (activeDescendantRef.current && scrollContainerRef.current) {
97
- (0, _scrollIntoViewingArea.scrollIntoViewingArea)(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
102
+ (0, _behaviors.scrollIntoView)(activeDescendantRef.current, scrollContainerRef.current, { ...menuScrollMargins,
103
+ behavior: 'auto'
104
+ });
98
105
  }
99
106
  }, [items]);
100
107
  (0, _useScrollFlash.default)(scrollContainerRef);
@@ -0,0 +1,6 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
3
+ import { ButtonProps } from './types';
4
+ declare const ButtonBase: PolymorphicForwardRefComponent<"a" | "button", ButtonProps>;
5
+ export declare type ButtonBaseProps = ComponentPropsWithRef<typeof ButtonBase>;
6
+ export default ButtonBase;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _Box = _interopRequireDefault(require("../Box"));
11
+
12
+ var _sx = require("../sx");
13
+
14
+ var _ThemeProvider = require("../ThemeProvider");
15
+
16
+ var _types = require("./types");
17
+
18
+ var _styles = require("./styles");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ 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); }
27
+
28
+ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)(({
29
+ children,
30
+ as: Component = 'button',
31
+ sx: sxProp = {},
32
+ ...props
33
+ }, forwardedRef) => {
34
+ const {
35
+ leadingIcon: LeadingIcon,
36
+ trailingIcon: TrailingIcon,
37
+ variant = 'default',
38
+ size = 'medium'
39
+ } = props;
40
+ const {
41
+ theme
42
+ } = (0, _ThemeProvider.useTheme)();
43
+ const iconWrapStyles = {
44
+ display: 'inline-block'
45
+ };
46
+
47
+ const sxStyles = _sx.merge.all([(0, _styles.getButtonStyles)(theme), (0, _styles.getSizeStyles)(size, variant, false), (0, _styles.getVariantStyles)(variant, theme), sxProp]);
48
+
49
+ return /*#__PURE__*/_react.default.createElement(_types.StyledButton, _extends({
50
+ as: Component,
51
+ sx: sxStyles
52
+ }, props, {
53
+ ref: forwardedRef
54
+ }), LeadingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
55
+ as: "span",
56
+ "data-component": "leadingIcon",
57
+ sx: iconWrapStyles
58
+ }, /*#__PURE__*/_react.default.createElement(LeadingIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
59
+ "data-component": "text"
60
+ }, children), TrailingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
61
+ as: "span",
62
+ "data-component": "trailingIcon",
63
+ sx: { ...iconWrapStyles,
64
+ ml: 2
65
+ }
66
+ }, /*#__PURE__*/_react.default.createElement(TrailingIcon, null)));
67
+ });
68
+ var _default = ButtonBase;
69
+ exports.default = _default;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
3
+ declare const LinkButton: PolymorphicForwardRefComponent<"a", Omit<(Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & {
4
+ ref?: ((instance: HTMLAnchorElement | null) => void) | React.RefObject<HTMLAnchorElement> | null | undefined;
5
+ }) | (Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
6
+ ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
7
+ }), string | number | symbol> & {
8
+ leadingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
9
+ trailingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
10
+ children: React.ReactNode;
11
+ } & {
12
+ variant?: import("./types").VariantType | undefined;
13
+ size?: import("./types").Size | undefined;
14
+ disabled?: boolean | undefined;
15
+ } & import("../sx").SxProp & React.HTMLAttributes<HTMLButtonElement> & {
16
+ [x: string]: any;
17
+ [x: number]: any;
18
+ [x: symbol]: any;
19
+ } & {
20
+ theme?: any;
21
+ } & {
22
+ as?: string | React.ComponentType<any> | undefined;
23
+ forwardedAs?: string | React.ComponentType<any> | undefined;
24
+ } & {
25
+ as?: "a" | "button" | undefined;
26
+ }>;
27
+ export default LinkButton;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _buttonBase = _interopRequireDefault(require("./button-base"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ 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); }
19
+
20
+ const LinkButton = /*#__PURE__*/(0, _react.forwardRef)(({
21
+ children,
22
+ as: Component = 'a',
23
+ ...props
24
+ }, forwardedRef) => {
25
+ return /*#__PURE__*/_react.default.createElement(_buttonBase.default, _extends({
26
+ as: Component,
27
+ ref: forwardedRef
28
+ }, props), children);
29
+ });
30
+ var _default = LinkButton;
31
+ exports.default = _default;
@@ -1,13 +1,4 @@
1
1
  import React from 'react';
2
- import { SxProp } from '../sx';
3
- import { VariantType } from './types';
4
- declare const Button: React.ForwardRefExoticComponent<{
5
- variant?: VariantType | undefined;
6
- size?: import("./types").Size | undefined;
7
- icon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
8
- leadingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
9
- trailingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
10
- disabled?: boolean | undefined;
11
- children: React.ReactNode;
12
- } & SxProp & React.HTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
2
+ import { ButtonProps } from './types';
3
+ declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, string | number | symbol> & React.RefAttributes<HTMLButtonElement>>;
13
4
  export { Button };