@primer/components 0.0.0-202111245715 → 0.0.0-2021113144816

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 (168) hide show
  1. package/dist/browser.esm.js +2 -2209
  2. package/dist/browser.esm.js.map +1 -1
  3. package/dist/browser.umd.js +2 -2209
  4. package/dist/browser.umd.js.map +1 -1
  5. package/lib/ActionList/Header.js +1 -1
  6. package/lib/ActionList/Item.js +10 -10
  7. package/lib/ActionList/List.js +1 -1
  8. package/lib/ActionList2/Divider.d.ts +3 -2
  9. package/lib/ActionList2/Divider.js +10 -5
  10. package/lib/ActionList2/Item.js +22 -6
  11. package/lib/ActionList2/List.js +12 -2
  12. package/lib/ActionList2/MenuContext.d.ts +10 -0
  13. package/lib/ActionList2/MenuContext.js +15 -0
  14. package/lib/ActionList2/Selection.js +11 -0
  15. package/lib/ActionList2/index.d.ts +1 -2
  16. package/lib/ActionMenu2.d.ts +313 -0
  17. package/lib/ActionMenu2.js +91 -0
  18. package/lib/Autocomplete/Autocomplete.d.ts +2 -1
  19. package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
  20. package/lib/BaseStyles.js +2 -20
  21. package/lib/BorderBox.js +1 -1
  22. package/lib/Box.js +1 -1
  23. package/lib/Breadcrumbs.js +3 -3
  24. package/lib/Button/Button.d.ts +2 -2
  25. package/lib/Button/Button.js +1 -1
  26. package/lib/Button/ButtonClose.d.ts +2 -2
  27. package/lib/Button/ButtonDanger.d.ts +2 -2
  28. package/lib/Button/ButtonGroup.js +1 -1
  29. package/lib/Button/ButtonInvisible.d.ts +2 -2
  30. package/lib/Button/ButtonOutline.d.ts +2 -2
  31. package/lib/Button/ButtonPrimary.d.ts +2 -2
  32. package/lib/Checkbox.js +1 -1
  33. package/lib/CircleOcticon.d.ts +35 -35
  34. package/lib/Details.js +1 -1
  35. package/lib/Dialog.d.ts +37 -37
  36. package/lib/Dropdown.d.ts +6 -6
  37. package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
  38. package/lib/FilterList.d.ts +1 -1
  39. package/lib/FilteredActionList/FilteredActionList.js +1 -1
  40. package/lib/Flex.js +1 -1
  41. package/lib/LabelGroup.js +1 -1
  42. package/lib/NewButton/button.d.ts +11 -2
  43. package/lib/NewButton/button.js +283 -6
  44. package/lib/NewButton/index.d.ts +11 -6
  45. package/lib/NewButton/index.js +0 -18
  46. package/lib/NewButton/types.d.ts +8 -28
  47. package/lib/NewButton/types.js +1 -19
  48. package/lib/Overlay.js +1 -1
  49. package/lib/Pagination/Pagination.js +2 -2
  50. package/lib/Position.d.ts +4 -4
  51. package/lib/Position.js +1 -1
  52. package/lib/SelectMenu/SelectMenu.d.ts +11 -10
  53. package/lib/SelectMenu/SelectMenu.js +1 -1
  54. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  55. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  56. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  57. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  58. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  59. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  60. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  61. package/lib/SelectMenu/SelectMenuTabs.js +1 -1
  62. package/lib/StateLabel.js +1 -1
  63. package/lib/StyledOcticon.js +1 -1
  64. package/lib/SubNav.js +3 -3
  65. package/lib/TextInputWithTokens.d.ts +2 -1
  66. package/lib/ThemeProvider.d.ts +1 -0
  67. package/lib/ThemeProvider.js +17 -4
  68. package/lib/Timeline.js +4 -4
  69. package/lib/Token/AvatarToken.d.ts +1 -1
  70. package/lib/Token/AvatarToken.js +1 -1
  71. package/lib/Token/IssueLabelToken.d.ts +1 -1
  72. package/lib/Token/Token.d.ts +1 -1
  73. package/lib/Token/TokenBase.js +1 -1
  74. package/lib/Tooltip.js +1 -1
  75. package/lib/UnderlineNav.js +2 -2
  76. package/lib/drafts.d.ts +1 -0
  77. package/lib/drafts.js +13 -0
  78. package/lib-esm/ActionList/Header.js +1 -1
  79. package/lib-esm/ActionList/Item.js +10 -10
  80. package/lib-esm/ActionList/List.js +1 -1
  81. package/lib-esm/ActionList2/Divider.d.ts +3 -2
  82. package/lib-esm/ActionList2/Divider.js +8 -5
  83. package/lib-esm/ActionList2/Item.js +20 -6
  84. package/lib-esm/ActionList2/List.js +10 -2
  85. package/lib-esm/ActionList2/MenuContext.d.ts +10 -0
  86. package/lib-esm/ActionList2/MenuContext.js +3 -0
  87. package/lib-esm/ActionList2/Selection.js +9 -0
  88. package/lib-esm/ActionList2/index.d.ts +1 -2
  89. package/lib-esm/ActionMenu2.d.ts +313 -0
  90. package/lib-esm/ActionMenu2.js +67 -0
  91. package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
  92. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
  93. package/lib-esm/BaseStyles.js +2 -20
  94. package/lib-esm/BorderBox.js +1 -1
  95. package/lib-esm/Box.js +1 -1
  96. package/lib-esm/Breadcrumbs.js +3 -3
  97. package/lib-esm/Button/Button.d.ts +2 -2
  98. package/lib-esm/Button/Button.js +1 -1
  99. package/lib-esm/Button/ButtonClose.d.ts +2 -2
  100. package/lib-esm/Button/ButtonDanger.d.ts +2 -2
  101. package/lib-esm/Button/ButtonGroup.js +1 -1
  102. package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
  103. package/lib-esm/Button/ButtonOutline.d.ts +2 -2
  104. package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
  105. package/lib-esm/Checkbox.js +1 -1
  106. package/lib-esm/CircleOcticon.d.ts +35 -35
  107. package/lib-esm/Details.js +1 -1
  108. package/lib-esm/Dialog.d.ts +37 -37
  109. package/lib-esm/Dropdown.d.ts +6 -6
  110. package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
  111. package/lib-esm/FilterList.d.ts +1 -1
  112. package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
  113. package/lib-esm/Flex.js +1 -1
  114. package/lib-esm/LabelGroup.js +1 -1
  115. package/lib-esm/NewButton/button.d.ts +11 -2
  116. package/lib-esm/NewButton/button.js +275 -4
  117. package/lib-esm/NewButton/index.d.ts +11 -6
  118. package/lib-esm/NewButton/index.js +1 -4
  119. package/lib-esm/NewButton/types.d.ts +8 -28
  120. package/lib-esm/NewButton/types.js +1 -6
  121. package/lib-esm/Overlay.js +1 -1
  122. package/lib-esm/Pagination/Pagination.js +2 -2
  123. package/lib-esm/Position.d.ts +4 -4
  124. package/lib-esm/Position.js +1 -1
  125. package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
  126. package/lib-esm/SelectMenu/SelectMenu.js +1 -1
  127. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  128. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  129. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  130. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  131. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  132. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  133. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  134. package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
  135. package/lib-esm/StateLabel.js +1 -1
  136. package/lib-esm/StyledOcticon.js +1 -1
  137. package/lib-esm/SubNav.js +3 -3
  138. package/lib-esm/TextInputWithTokens.d.ts +2 -1
  139. package/lib-esm/ThemeProvider.d.ts +1 -0
  140. package/lib-esm/ThemeProvider.js +17 -4
  141. package/lib-esm/Timeline.js +4 -4
  142. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  143. package/lib-esm/Token/AvatarToken.js +1 -1
  144. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  145. package/lib-esm/Token/Token.d.ts +1 -1
  146. package/lib-esm/Token/TokenBase.js +1 -1
  147. package/lib-esm/Tooltip.js +1 -1
  148. package/lib-esm/UnderlineNav.js +2 -2
  149. package/lib-esm/drafts.d.ts +1 -0
  150. package/lib-esm/drafts.js +2 -1
  151. package/package.json +16 -8
  152. package/CHANGELOG.md +0 -992
  153. package/lib/NewButton/button-base.d.ts +0 -6
  154. package/lib/NewButton/button-base.js +0 -69
  155. package/lib/NewButton/button-link.d.ts +0 -26
  156. package/lib/NewButton/button-link.js +0 -31
  157. package/lib/NewButton/icon-button.d.ts +0 -4
  158. package/lib/NewButton/icon-button.js +0 -57
  159. package/lib/NewButton/styles.d.ts +0 -202
  160. package/lib/NewButton/styles.js +0 -248
  161. package/lib-esm/NewButton/button-base.d.ts +0 -6
  162. package/lib-esm/NewButton/button-base.js +0 -47
  163. package/lib-esm/NewButton/button-link.d.ts +0 -26
  164. package/lib-esm/NewButton/button-link.js +0 -15
  165. package/lib-esm/NewButton/icon-button.d.ts +0 -4
  166. package/lib-esm/NewButton/icon-button.js +0 -35
  167. package/lib-esm/NewButton/styles.d.ts +0 -202
  168. package/lib-esm/NewButton/styles.js +0 -229
@@ -3,6 +3,7 @@ import { ButtonProps } from '../Button/Button';
3
3
  export declare type DropdownButtonProps = ButtonProps;
4
4
  export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<{
5
5
  color?: string | undefined;
6
+ property?: string | undefined;
6
7
  translate?: "yes" | "no" | undefined;
7
8
  hidden?: boolean | undefined;
8
9
  children?: React.ReactNode;
@@ -38,7 +39,6 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
38
39
  datatype?: string | undefined;
39
40
  inlist?: any;
40
41
  prefix?: string | undefined;
41
- property?: string | undefined;
42
42
  resource?: string | undefined;
43
43
  typeof?: string | undefined;
44
44
  vocab?: string | undefined;
@@ -267,8 +267,8 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
267
267
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
268
268
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
269
269
  css?: import("@emotion/core").InterpolationWithTheme<any>;
270
- as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
271
270
  disabled?: boolean | undefined;
271
+ as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
272
272
  autoFocus?: boolean | undefined;
273
273
  formAction?: string | undefined;
274
274
  formEncType?: string | undefined;
@@ -277,4 +277,7 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
277
277
  formTarget?: string | undefined;
278
278
  } & {
279
279
  theme?: any;
280
- }>, "color" | "translate" | "hidden" | "children" | "theme" | "value" | "form" | "slot" | "style" | "title" | "variant" | "role" | "sx" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "as" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<HTMLElement>>;
280
+ }>, "theme" | "sx" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement> | keyof {
281
+ as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
282
+ variant?: "small" | "medium" | "large" | undefined;
283
+ }> & React.RefAttributes<HTMLElement>>;
@@ -16,6 +16,7 @@ declare namespace FilterListItem {
16
16
  }
17
17
  declare const _default: (({ children, ...rest }: React.PropsWithChildren<{
18
18
  color?: string | undefined;
19
+ property?: string | undefined;
19
20
  translate?: "yes" | "no" | undefined;
20
21
  hidden?: boolean | undefined;
21
22
  children?: React.ReactNode;
@@ -46,7 +47,6 @@ declare const _default: (({ children, ...rest }: React.PropsWithChildren<{
46
47
  datatype?: string | undefined;
47
48
  inlist?: any;
48
49
  prefix?: string | undefined;
49
- property?: string | undefined;
50
50
  resource?: string | undefined;
51
51
  typeof?: string | undefined;
52
52
  vocab?: string | undefined;
@@ -41,7 +41,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
41
41
 
42
42
  const StyledHeader = _styledComponents.default.div.withConfig({
43
43
  displayName: "FilteredActionList__StyledHeader",
44
- componentId: "yg3jkv-0"
44
+ componentId: "sc-yg3jkv-0"
45
45
  })(["box-shadow:0 1px 0 ", ";z-index:1;"], (0, _constants.get)('colors.border.default'));
46
46
 
47
47
  function FilteredActionList({
package/lib/Flex.js CHANGED
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
  */
17
17
  const Flex = (0, _styledComponents.default)(_Box.default).withConfig({
18
18
  displayName: "Flex",
19
- componentId: "arghxi-0"
19
+ componentId: "sc-arghxi-0"
20
20
  })([""]);
21
21
  Flex.defaultProps = {
22
22
  display: 'flex'
package/lib/LabelGroup.js CHANGED
@@ -15,7 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
 
16
16
  const LabelGroup = _styledComponents.default.span.withConfig({
17
17
  displayName: "LabelGroup",
18
- componentId: "k6k3qa-0"
18
+ componentId: "sc-k6k3qa-0"
19
19
  })(["& *{margin-right:", ";}& *:last-child{margin-right:0;}", ";"], (0, _constants.get)('space.1'), _sx.default);
20
20
 
21
21
  var _default = LabelGroup;
@@ -1,4 +1,13 @@
1
1
  import React from 'react';
2
- import { ButtonProps } from './types';
3
- declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, string | number | symbol> & React.RefAttributes<HTMLButtonElement>>;
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>>;
4
13
  export { Button };
@@ -7,7 +7,13 @@ exports.Button = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _buttonBase = _interopRequireDefault(require("./button-base"));
10
+ var _Box = _interopRequireDefault(require("../Box"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _sx = _interopRequireWildcard(require("../sx"));
15
+
16
+ var _ThemeProvider = require("../ThemeProvider");
11
17
 
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
19
 
@@ -17,15 +23,286 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
23
 
18
24
  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
25
 
26
+ const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
27
+
28
+ const getVariantStyles = (variant = 'default', theme) => {
29
+ const style = {
30
+ default: {
31
+ color: 'btn.text',
32
+ backgroundColor: 'btn.bg',
33
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}, ${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.insetShadow}`,
34
+ '&:hover:not([disabled])': {
35
+ backgroundColor: 'btn.hoverBg'
36
+ },
37
+ // focus must come before :active so that the active box shadow overrides
38
+ '&:focus:not([disabled])': {
39
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
40
+ },
41
+ '&:active:not([disabled])': {
42
+ backgroundColor: 'btn.selectedBg',
43
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadowActive}`
44
+ },
45
+ '&:disabled': {
46
+ color: 'primer.fg.disabled',
47
+ backgroundColor: 'btn.disabledBg'
48
+ }
49
+ },
50
+ primary: {
51
+ color: 'btn.primary.text',
52
+ backgroundColor: 'btn.primary.bg',
53
+ borderColor: 'border.subtle',
54
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.shadow}`,
55
+ '&:hover:not([disabled])': {
56
+ color: 'btn.primary.hoverText',
57
+ backgroundColor: 'btn.primary.hoverBg'
58
+ },
59
+ // focus must come before :active so that the active box shadow overrides
60
+ '&:focus:not([disabled])': {
61
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.focusShadow}`
62
+ },
63
+ '&:active:not([disabled])': {
64
+ backgroundColor: 'btn.primary.selectedBg',
65
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.selectedShadow}`
66
+ },
67
+ '&:disabled': {
68
+ color: 'btn.primary.disabledText',
69
+ backgroundColor: 'btn.primary.disabledBg'
70
+ },
71
+ '[data-component="ButtonCounter"]': {
72
+ backgroundColor: 'btn.primary.counterBg',
73
+ color: 'btn.primary.text'
74
+ }
75
+ },
76
+ danger: {
77
+ color: 'btn.danger.text',
78
+ backgroundColor: 'btn.bg',
79
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
80
+ '&:hover:not([disabled])': {
81
+ color: 'btn.danger.hoverText',
82
+ backgroundColor: 'btn.danger.hoverBg',
83
+ borderColor: 'btn.danger.hoverBorder',
84
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.hoverShadow}`,
85
+ '[data-component="ButtonCounter"]': {
86
+ backgroundColor: 'btn.danger.hoverCounterBg',
87
+ color: 'btn.danger.hoverText'
88
+ }
89
+ },
90
+ // focus must come before :active so that the active box shadow overrides
91
+ '&:focus:not([disabled])': {
92
+ borderColor: 'btn.danger.focusBorder',
93
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.focusShadow}`
94
+ },
95
+ '&:active:not([disabled])': {
96
+ color: 'btn.danger.selectedText',
97
+ backgroundColor: 'btn.danger.selectedBg',
98
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.selectedShadow}`,
99
+ borderColor: 'btn.danger.selectedBorder'
100
+ },
101
+ '&:disabled': {
102
+ color: 'btn.danger.disabledText',
103
+ backgroundColor: 'btn.danger.disabledBg',
104
+ borderColor: 'btn.danger.disabledBorder',
105
+ '[data-component="ButtonCounter"]': {
106
+ backgroundColor: 'btn.danger.disabledCounterBg'
107
+ }
108
+ },
109
+ '[data-component="ButtonCounter"]': {
110
+ color: 'btn.danger.text',
111
+ backgroundColor: 'btn.danger.counterBg'
112
+ }
113
+ },
114
+ invisible: {
115
+ color: 'accent.fg',
116
+ backgroundColor: 'transparent',
117
+ border: '0',
118
+ boxShadow: 'none',
119
+ '&:hover:not([disabled])': {
120
+ backgroundColor: 'btn.hoverBg'
121
+ },
122
+ // focus must come before :active so that the active box shadow overrides
123
+ '&:focus:not([disabled])': {
124
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
125
+ },
126
+ '&:active:not([disabled])': {
127
+ backgroundColor: 'btn.selectedBg'
128
+ },
129
+ '&:disabled': {
130
+ color: 'primer.fg.disabled'
131
+ }
132
+ },
133
+ outline: {
134
+ color: 'btn.outline.text',
135
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
136
+ '&:hover': {
137
+ color: 'btn.outline.hoverText',
138
+ backgroundColor: 'btn.outline.hoverBg',
139
+ borderColor: 'outline.hoverBorder',
140
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.hoverShadow}`,
141
+ '[data-component="ButtonCounter"]': {
142
+ backgroundColor: 'btn.outline.hoverCounterBg',
143
+ color: 'btn.outline.hoverText'
144
+ }
145
+ },
146
+ // focus must come before :active so that the active box shadow overrides
147
+ '&:focus': {
148
+ borderColor: 'btn.outline.focusBorder',
149
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.focusShadow}`
150
+ },
151
+ '&:active:not([disabled])': {
152
+ color: 'btn.outline.selectedText',
153
+ backgroundColor: 'btn.outline.selectedBg',
154
+ boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.selectedShadow}`,
155
+ borderColor: 'btn.outline.selectedBorder'
156
+ },
157
+ '&:disabled': {
158
+ color: 'btn.outline.disabledText',
159
+ backgroundColor: 'btn.outline.disabledBg',
160
+ borderColor: 'btn.border',
161
+ '[data-component="ButtonCounter"]': {
162
+ backgroundColor: 'btn.outline.disabledCounterBg'
163
+ }
164
+ },
165
+ '[data-component="ButtonCounter"]': {
166
+ backgroundColor: 'btn.outline.counterBg',
167
+ color: 'btn.outline.text'
168
+ }
169
+ }
170
+ };
171
+ return style[variant];
172
+ };
173
+
174
+ const getSizeStyles = (size = 'medium', variant = 'default', iconOnly) => {
175
+ let paddingY, paddingX, fontSize;
176
+
177
+ switch (size) {
178
+ case 'small':
179
+ paddingY = 3;
180
+ paddingX = 12;
181
+ fontSize = 0;
182
+ break;
183
+
184
+ case 'large':
185
+ paddingY = 9;
186
+ paddingX = 20;
187
+ fontSize = 2;
188
+ break;
189
+
190
+ case 'medium':
191
+ default:
192
+ paddingY = 5;
193
+ paddingX = 16;
194
+ fontSize = 1;
195
+ }
196
+
197
+ if (iconOnly) {
198
+ paddingX = paddingY + 2;
199
+ }
200
+
201
+ if (variant === 'invisible') {
202
+ paddingY = paddingY + 1;
203
+ }
204
+
205
+ return {
206
+ paddingY: `${paddingY}px`,
207
+ paddingX: `${paddingX}px`,
208
+ fontSize,
209
+ '[data-component="ButtonCounter"]': {
210
+ fontSize
211
+ }
212
+ };
213
+ };
214
+
215
+ const ButtonBase = _styledComponents.default.button.withConfig({
216
+ displayName: "button__ButtonBase",
217
+ componentId: "sc-15k5iqk-0"
218
+ })(_sx.default);
219
+
20
220
  const Button = /*#__PURE__*/(0, _react.forwardRef)(({
21
221
  children,
222
+ sx: sxProp = {},
22
223
  ...props
23
224
  }, forwardedRef) => {
24
- return /*#__PURE__*/_react.default.createElement(_buttonBase.default, _extends({
225
+ const {
226
+ icon: Icon,
227
+ leadingIcon: LeadingIcon,
228
+ trailingIcon: TrailingIcon,
229
+ variant = 'default',
230
+ size = 'medium'
231
+ } = props;
232
+ const iconOnly = !!Icon;
233
+ const {
234
+ theme
235
+ } = (0, _ThemeProvider.useTheme)();
236
+ const styles = {
237
+ borderRadius: '2',
238
+ border: '1px solid',
239
+ borderColor: theme === null || theme === void 0 ? void 0 : theme.colors.btn.border,
240
+ display: 'grid',
241
+ gridTemplateAreas: '"leadingIcon text trailingIcon"',
242
+ fontWeight: 'bold',
243
+ lineHeight: TEXT_ROW_HEIGHT,
244
+ whiteSpace: 'nowrap',
245
+ verticalAlign: 'middle',
246
+ cursor: 'pointer',
247
+ appearance: 'none',
248
+ userSelect: 'none',
249
+ textDecoration: 'none',
250
+ textAlign: 'center',
251
+ '& > :not(:last-child)': {
252
+ mr: '2'
253
+ },
254
+ '&:focus': {
255
+ outline: 'none'
256
+ },
257
+ '&:disabled': {
258
+ cursor: 'default'
259
+ },
260
+ '&:disabled svg': {
261
+ opacity: '0.6'
262
+ },
263
+ '[data-component="leadingIcon"]': {
264
+ gridArea: 'leadingIcon'
265
+ },
266
+ '[data-component="text"]': {
267
+ gridArea: 'text'
268
+ },
269
+ '[data-component="trailingIcon"]': {
270
+ gridArea: 'trailingIcon'
271
+ }
272
+ };
273
+ const iconWrapStyles = {
274
+ display: 'inline-block'
275
+ };
276
+
277
+ const sxStyles = _sx.merge.all([styles, getSizeStyles(size, variant, iconOnly), getVariantStyles(variant, theme), sxProp]);
278
+
279
+ return /*#__PURE__*/_react.default.createElement(ButtonBase, _extends({
280
+ sx: sxStyles,
25
281
  ref: forwardedRef
26
- }, props, {
27
- as: "button"
28
- }), children);
282
+ }, props), LeadingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
283
+ as: "span",
284
+ "data-component": "leadingIcon",
285
+ sx: iconWrapStyles,
286
+ "aria-hidden": !iconOnly
287
+ }, /*#__PURE__*/_react.default.createElement(LeadingIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
288
+ "data-component": "text",
289
+ hidden: Icon ? true : false
290
+ }, children), Icon && /*#__PURE__*/_react.default.createElement(_Box.default, {
291
+ "data-component": "icon-only",
292
+ as: "span",
293
+ sx: {
294
+ display: 'inline-block'
295
+ },
296
+ "aria-hidden": !iconOnly
297
+ }, /*#__PURE__*/_react.default.createElement(Icon, null)), TrailingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
298
+ as: "span",
299
+ "data-component": "trailingIcon",
300
+ sx: { ...iconWrapStyles,
301
+ ml: 2
302
+ },
303
+ "aria-hidden": !iconOnly
304
+ }, /*#__PURE__*/_react.default.createElement(TrailingIcon, null)));
29
305
  });
30
306
  exports.Button = Button;
31
- Button.displayName = 'Button';
307
+ Button.displayName = 'Button';
308
+ Object.assign(Button, {});
@@ -1,9 +1,14 @@
1
1
  /// <reference types="react" />
2
- import IconButton from './icon-button';
3
- import ButtonLink from './button-link';
4
- import { ButtonProps, IconButtonProps } from './types';
5
- export type { ButtonProps as NewButtonProps, IconButtonProps };
6
- export declare const NewButton: import("react").ForwardRefExoticComponent<Pick<ButtonProps, string | number | symbol> & import("react").RefAttributes<HTMLButtonElement>> & {
2
+ import { ButtonProps } from './types';
3
+ export type { ButtonProps as NewButtonProps };
4
+ export declare const NewButton: import("react").ForwardRefExoticComponent<{
5
+ variant?: import("./types").VariantType | undefined;
6
+ size?: import("./types").Size | undefined;
7
+ icon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
8
+ leadingIcon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
9
+ trailingIcon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
10
+ disabled?: boolean | undefined;
11
+ children: import("react").ReactNode;
12
+ } & import("../sx").SxProp & import("react").HTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>> & {
7
13
  Counter: ({ children, sx: sxProp, ...props }: import("./button-counter").CounterProps) => JSX.Element;
8
14
  };
9
- export { IconButton, ButtonLink };
@@ -3,30 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "IconButton", {
7
- enumerable: true,
8
- get: function () {
9
- return _iconButton.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "ButtonLink", {
13
- enumerable: true,
14
- get: function () {
15
- return _buttonLink.default;
16
- }
17
- });
18
6
  exports.NewButton = void 0;
19
7
 
20
8
  var _button = require("./button");
21
9
 
22
10
  var _buttonCounter = require("./button-counter");
23
11
 
24
- var _iconButton = _interopRequireDefault(require("./icon-button"));
25
-
26
- var _buttonLink = _interopRequireDefault(require("./button-link"));
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
12
  const NewButton = Object.assign(_button.Button, {
31
13
  Counter: _buttonCounter.Counter
32
14
  });
@@ -1,11 +1,9 @@
1
- import React, { HTMLAttributes, ComponentPropsWithRef } from 'react';
1
+ import React, { HTMLAttributes } from 'react';
2
2
  import { IconProps } from '@primer/octicons-react';
3
3
  import { SxProp } from '../sx';
4
- export declare const StyledButton: import("styled-components").StyledComponent<"button", any, SxProp, never>;
5
4
  export declare type VariantType = 'default' | 'primary' | 'invisible' | 'danger' | 'outline';
6
5
  export declare type Size = 'small' | 'medium' | 'large';
7
- declare type StyledButtonProps = ComponentPropsWithRef<typeof StyledButton>;
8
- export declare type ButtonBaseProps = {
6
+ export declare type ButtonProps = {
9
7
  /**
10
8
  * Determine's the styles on a button one of 'default' | 'primary' | 'invisible' | 'danger'
11
9
  */
@@ -15,11 +13,9 @@ export declare type ButtonBaseProps = {
15
13
  */
16
14
  size?: Size;
17
15
  /**
18
- * Items that are disabled can not be clicked, selected, or navigated through.
16
+ * This is to be used if it is an icon-only button. Will make text visually hidden
19
17
  */
20
- disabled?: boolean;
21
- } & SxProp & HTMLAttributes<HTMLButtonElement> & StyledButtonProps;
22
- export declare type ButtonProps = {
18
+ icon?: React.FunctionComponent<IconProps>;
23
19
  /**
24
20
  * The leading icon comes before button content
25
21
  */
@@ -28,25 +24,9 @@ export declare type ButtonProps = {
28
24
  * The trailing icon comes after button content
29
25
  */
30
26
  trailingIcon?: React.FunctionComponent<IconProps>;
31
- children: React.ReactNode;
32
- } & ButtonBaseProps;
33
- export declare type IconButtonProps = {
34
27
  /**
35
- * This is to be used if it is an icon-only button. Will make text visually hidden
28
+ * Items that are disabled can not be clicked, selected, or navigated through.
36
29
  */
37
- icon: React.FunctionComponent<IconProps>;
38
- iconLabel: string;
39
- } & ButtonBaseProps;
40
- export declare type LinkButtonProps = {
41
- underline?: boolean;
42
- download?: string;
43
- href?: string;
44
- hrefLang?: string;
45
- media?: string;
46
- ping?: string;
47
- rel?: string;
48
- target?: string;
49
- type?: string;
50
- referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
51
- };
52
- export {};
30
+ disabled?: boolean;
31
+ children: React.ReactNode;
32
+ } & SxProp & HTMLAttributes<HTMLButtonElement>;
@@ -1,19 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StyledButton = void 0;
7
-
8
- var _styledComponents = _interopRequireDefault(require("styled-components"));
9
-
10
- var _sx = _interopRequireDefault(require("../sx"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const StyledButton = _styledComponents.default.button.withConfig({
15
- displayName: "types__StyledButton",
16
- componentId: "sc-1sm8kx1-0"
17
- })(_sx.default);
18
-
19
- exports.StyledButton = StyledButton;
1
+ "use strict";
package/lib/Overlay.js CHANGED
@@ -82,7 +82,7 @@ function getSlideAnimationStartingVector(anchorSide) {
82
82
 
83
83
  const StyledOverlay = _styledComponents.default.div.withConfig({
84
84
  displayName: "Overlay__StyledOverlay",
85
- componentId: "jhwkzw-0"
85
+ componentId: "sc-jhwkzw-0"
86
86
  })(["background-color:", ";box-shadow:", ";position:absolute;min-width:192px;max-width:640px;height:", ";max-height:", ";width:", ";border-radius:12px;overflow:hidden;animation:overlay-appear ", "ms ", ";@keyframes overlay-appear{0%{opacity:0;}100%{opacity:1;}}visibility:var(--styled-overlay-visibility);:focus{outline:none;}", ";"], (0, _constants.get)('colors.canvas.overlay'), (0, _constants.get)('shadows.overlay.shadow'), props => heightMap[props.height || 'auto'], props => props.maxHeight && heightMap[props.maxHeight], props => widthMap[props.width || 'auto'], animationDuration, (0, _constants.get)('animation.easeOutCubic'), _sx.default);
87
87
 
88
88
  /**
@@ -23,7 +23,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
23
23
 
24
24
  const Page = _styledComponents.default.a.withConfig({
25
25
  displayName: "Pagination__Page",
26
- componentId: "b80nss-0"
26
+ componentId: "sc-b80nss-0"
27
27
  })(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}"], (0, _constants.get)('colors.fg.default'), (0, _constants.get)('space.1'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('space.1'), (0, _constants.get)('space.1'));
28
28
 
29
29
  function usePaginationPages({
@@ -61,7 +61,7 @@ function usePaginationPages({
61
61
 
62
62
  const PaginationContainer = _styledComponents.default.nav.withConfig({
63
63
  displayName: "Pagination__PaginationContainer",
64
- componentId: "b80nss-1"
64
+ componentId: "sc-b80nss-1"
65
65
  })(["margin-top:20px;margin-bottom:15px;text-align:center;", ";"], _sx.default);
66
66
 
67
67
  function Pagination({