@primer/components 0.0.0-2021926645 → 0.0.0-202192724324

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.
package/lib/Dropdown.js CHANGED
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _styledComponents = _interopRequireDefault(require("styled-components"));
11
11
 
12
- var _Button = _interopRequireDefault(require("./Button"));
12
+ var _NewButton = _interopRequireDefault(require("./NewButton"));
13
13
 
14
14
  var _constants = require("./constants");
15
15
 
@@ -51,10 +51,11 @@ const DropdownButton = ({
51
51
  children,
52
52
  ...rest
53
53
  }) => {
54
- return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
54
+ return /*#__PURE__*/_react.default.createElement(_NewButton.default, _extends({
55
55
  as: "summary",
56
- "aria-haspopup": "true"
57
- }, rest), children, /*#__PURE__*/_react.default.createElement(DropdownCaret, null));
56
+ "aria-haspopup": "true",
57
+ caret: true
58
+ }, rest), children);
58
59
  };
59
60
 
60
61
  DropdownButton.displayName = "DropdownButton";
@@ -79,7 +80,7 @@ DropdownMenu.defaultProps = {
79
80
  };
80
81
  DropdownMenu.displayName = 'Dropdown.Menu';
81
82
  DropdownItem.displayName = 'Dropdown.Item';
82
- DropdownButton.defaultProps = _Button.default.defaultProps;
83
+ DropdownButton.defaultProps = _NewButton.default.defaultProps;
83
84
  DropdownButton.displayName = 'Dropdown.Button';
84
85
  DropdownCaret.displayName = 'Dropdown.Caret';
85
86
  Dropdown.defaultProps = _Details.default.defaultProps;
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import { List } from './ActionList/List';
4
4
  import { Item } from './ActionList/Item';
5
5
  import { Divider } from './ActionList/Divider';
6
- import Button from './Button';
6
+ import NewButton from './NewButton';
7
7
  import React, { useCallback, useMemo } from 'react';
8
8
  import { AnchoredOverlay } from './AnchoredOverlay';
9
9
  import { useProvidedStateOrCreate } from './hooks/useProvidedStateOrCreate';
@@ -18,7 +18,7 @@ ActionMenuItem.displayName = 'ActionMenu.Item';
18
18
 
19
19
  const ActionMenuBase = ({
20
20
  anchorContent,
21
- renderAnchor = props => /*#__PURE__*/React.createElement(Button, props),
21
+ renderAnchor = props => /*#__PURE__*/React.createElement(NewButton, props),
22
22
  anchorRef: externalAnchorRef,
23
23
  onAction,
24
24
  open,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ButtonProps } from '../Button';
2
+ import { ButtonProps } from '../NewButton';
3
3
  import { SxProp } from '../sx';
4
4
  /**
5
5
  * Props that characterize a button to be rendered into the footer of
@@ -9,7 +9,7 @@ export declare type DialogButtonProps = ButtonProps & {
9
9
  /**
10
10
  * The type of Button element to use
11
11
  */
12
- buttonType?: 'normal' | 'primary' | 'danger';
12
+ buttonType?: 'default' | 'primary' | 'danger' | 'invisible';
13
13
  /**
14
14
  * The Button's inner text
15
15
  */
@@ -160,8 +160,8 @@ export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & {
160
160
  Buttons: React.FC<{
161
161
  buttons: DialogButtonProps[];
162
162
  }>;
163
- CloseButton: React.FC<{
164
- onClose: () => void;
165
- }>;
163
+ CloseButton: ({ onClose }: {
164
+ onClose: any;
165
+ }) => JSX.Element;
166
166
  };
167
167
  export {};
@@ -2,13 +2,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React, { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import styled from 'styled-components';
5
- import Button, { ButtonPrimary, ButtonDanger } from '../Button';
5
+ import NewButton from '../NewButton';
6
6
  import Box from '../Box';
7
7
  import { get, COMMON, POSITION } from '../constants';
8
8
  import { useOnEscapePress, useProvidedRefOrCreate } from '../hooks';
9
9
  import { useFocusTrap } from '../hooks/useFocusTrap';
10
10
  import sx from '../sx';
11
- import StyledOcticon from '../StyledOcticon';
12
11
  import { XIcon } from '@primer/octicons-react';
13
12
  import { useFocusZone } from '../hooks/useFocusZone';
14
13
  import { FocusKeys } from '../behaviors/focusZone';
@@ -184,11 +183,7 @@ const Footer = styled(Box).attrs({
184
183
  displayName: "Dialog__Footer",
185
184
  componentId: "sc-11pkgky-6"
186
185
  })(["box-shadow:0 -1px 0 ", ";padding:", ";display:flex;flex-flow:wrap;justify-content:flex-end;z-index:1;flex-shrink:0;button{margin-left:", ";&:first-child{margin-left:0;}}"], get('colors.border.default'), get('space.3'), get('space.1'));
187
- const buttonTypes = {
188
- normal: Button,
189
- primary: ButtonPrimary,
190
- danger: ButtonDanger
191
- };
186
+ const buttonTypes = ['default', 'primary', 'danger'];
192
187
 
193
188
  const Buttons = ({
194
189
  buttons
@@ -211,33 +206,30 @@ const Buttons = ({
211
206
  return /*#__PURE__*/React.createElement(React.Fragment, null, buttons.map((dialogButtonProps, index) => {
212
207
  const {
213
208
  content,
214
- buttonType = 'normal',
209
+ buttonType = 'default',
215
210
  autoFocus = false,
216
211
  ...buttonProps
217
212
  } = dialogButtonProps;
218
- const ButtonElement = buttonTypes[buttonType];
219
- return /*#__PURE__*/React.createElement(ButtonElement, _extends({
213
+ return /*#__PURE__*/React.createElement(NewButton, _extends({
220
214
  key: index
221
215
  }, buttonProps, {
216
+ variant: buttonType,
222
217
  ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null
223
218
  }), content);
224
219
  }));
225
220
  };
226
221
 
227
- const DialogCloseButton = styled(Button).withConfig({
228
- displayName: "Dialog__DialogCloseButton",
229
- componentId: "sc-11pkgky-7"
230
- })(["border-radius:4px;background:transparent;border:0;vertical-align:middle;color:", ";padding:", ";align-self:flex-start;line-height:normal;box-shadow:none;"], get('colors.fg.muted'), get('space.2'));
231
-
232
222
  const CloseButton = ({
233
223
  onClose
234
224
  }) => {
235
- return /*#__PURE__*/React.createElement(DialogCloseButton, {
236
- "aria-label": "Close",
237
- onClick: onClose
238
- }, /*#__PURE__*/React.createElement(StyledOcticon, {
239
- icon: XIcon
240
- }));
225
+ return /*#__PURE__*/React.createElement(NewButton, {
226
+ sx: {
227
+ alignSelf: 'flex-start'
228
+ },
229
+ variant: "invisible",
230
+ onClick: onClose,
231
+ icon: () => /*#__PURE__*/React.createElement(XIcon, null)
232
+ });
241
233
  };
242
234
 
243
235
  CloseButton.displayName = "CloseButton";