@primer/components 0.0.0-202110322537 → 0.0.0-2021103231920

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.
@@ -1,25 +1,24 @@
1
1
  import * as History from 'history';
2
2
  import React from 'react';
3
+ import { SystemCommonProps, SystemFlexProps } from './constants';
3
4
  import { SxProp } from './sx';
4
5
  import { ComponentProps } from './utils/types';
5
- declare const BreadcrumbsBase: import("styled-components").StyledComponent<"nav", any, SxProp, never>;
6
- export declare type BreadcrumbsProps = React.PropsWithChildren<{
7
- className?: string;
8
- } & SxProp>;
9
- declare function Breadcrumbs({ className, children, sx: sxProp }: React.PropsWithChildren<BreadcrumbsProps>): JSX.Element;
6
+ declare const BreadcrumbsBase: import("styled-components").StyledComponent<"nav", any, SystemFlexProps & SystemCommonProps & SxProp, never>;
7
+ export declare type BreadcrumbsProps = ComponentProps<typeof BreadcrumbsBase>;
8
+ declare function Breadcrumbs({ className, children, theme, ...rest }: React.PropsWithChildren<BreadcrumbsProps>): JSX.Element;
10
9
  declare namespace Breadcrumbs {
11
10
  var displayName: string;
12
11
  }
13
12
  declare const BreadcrumbsItem: import("styled-components").StyledComponent<"a", any, {
14
13
  to?: History.LocationDescriptor<unknown> | undefined;
15
14
  selected?: boolean | undefined;
16
- } & SxProp, never>;
15
+ } & SystemCommonProps & SxProp, never>;
17
16
  export declare type BreadcrumbsItemProps = ComponentProps<typeof BreadcrumbsItem>;
18
17
  declare const _default: typeof Breadcrumbs & {
19
18
  Item: import("styled-components").StyledComponent<"a", any, {
20
19
  to?: History.LocationDescriptor<unknown> | undefined;
21
20
  selected?: boolean | undefined;
22
- } & SxProp, never>;
21
+ } & SystemCommonProps & SxProp, never>;
23
22
  };
24
23
  export default _default;
25
24
  /**
@@ -29,7 +28,7 @@ export declare const Breadcrumb: typeof Breadcrumbs & {
29
28
  Item: import("styled-components").StyledComponent<"a", any, {
30
29
  to?: History.LocationDescriptor<unknown> | undefined;
31
30
  selected?: boolean | undefined;
32
- } & SxProp, never>;
31
+ } & SystemCommonProps & SxProp, never>;
33
32
  };
34
33
  /**
35
34
  * @deprecated Use the `BreadcrumbsProps` type instead
@@ -19,6 +19,8 @@ var _sx = _interopRequireDefault(require("./sx"));
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
+ 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); }
23
+
22
24
  const SELECTED_CLASS = 'selected';
23
25
 
24
26
  const Wrapper = _styledComponents.default.li.withConfig({
@@ -29,20 +31,23 @@ const Wrapper = _styledComponents.default.li.withConfig({
29
31
  const BreadcrumbsBase = _styledComponents.default.nav.withConfig({
30
32
  displayName: "Breadcrumbs__BreadcrumbsBase",
31
33
  componentId: "hwwoo0-1"
32
- })(["display:flex;justify-content:space-between;", ";"], _sx.default);
34
+ })(["display:flex;justify-content:space-between;", ";", ";", ";"], _constants.COMMON, _constants.FLEX, _sx.default);
33
35
 
34
36
  function Breadcrumbs({
35
37
  className,
36
38
  children,
37
- sx: sxProp
39
+ theme,
40
+ ...rest
38
41
  }) {
39
- const wrappedChildren = _react.default.Children.map(children, child => /*#__PURE__*/_react.default.createElement(Wrapper, null, child));
42
+ const wrappedChildren = _react.default.Children.map(children, child => /*#__PURE__*/_react.default.createElement(Wrapper, {
43
+ theme: theme
44
+ }, child));
40
45
 
41
- return /*#__PURE__*/_react.default.createElement(BreadcrumbsBase, {
46
+ return /*#__PURE__*/_react.default.createElement(BreadcrumbsBase, _extends({
42
47
  className: className,
43
48
  "aria-label": "Breadcrumbs",
44
- sx: sxProp
45
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
49
+ theme: theme
50
+ }, rest), /*#__PURE__*/_react.default.createElement(_Box.default, {
46
51
  as: "ol",
47
52
  my: 0,
48
53
  pl: 0
@@ -58,7 +63,7 @@ const BreadcrumbsItem = _styledComponents.default.a.attrs(props => ({
58
63
  })).withConfig({
59
64
  displayName: "Breadcrumbs__BreadcrumbsItem",
60
65
  componentId: "hwwoo0-2"
61
- })(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", ";"], (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), _sx.default);
66
+ })(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", " ", ";"], (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), _constants.COMMON, _sx.default);
62
67
 
63
68
  Breadcrumbs.displayName = 'Breadcrumbs';
64
69
  BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
package/lib/Link.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { SystemCommonProps, SystemTypographyProps } from './constants';
2
1
  import { SxProp } from './sx';
3
2
  import { ComponentProps } from './utils/types';
4
3
  declare const Link: import("styled-components").StyledComponent<"a", any, {
5
4
  hoverColor?: string | undefined;
6
5
  muted?: boolean | undefined;
7
6
  underline?: boolean | undefined;
8
- } & SystemCommonProps & SxProp & SystemTypographyProps, never>;
7
+ } & SxProp, never>;
9
8
  export declare type LinkProps = ComponentProps<typeof Link>;
10
9
  export default Link;
package/lib/Link.js CHANGED
@@ -25,7 +25,7 @@ const hoverColor = (0, _styledSystem.system)({
25
25
  const Link = _styledComponents.default.a.withConfig({
26
26
  displayName: "Link",
27
27
  componentId: "sc-1brdqhf-0"
28
- })(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";", ";", ";"], props => props.muted ? (0, _constants.get)('colors.fg.muted')(props) : (0, _constants.get)('colors.accent.fg')(props), props => props.underline ? 'underline' : 'none', props => props.muted ? 'none' : 'underline', props => props.hoverColor ? hoverColor : props.muted ? `color: ${(0, _constants.get)('colors.accent.fg')(props)}` : '', _constants.TYPOGRAPHY, _constants.COMMON, _sx.default);
28
+ })(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";"], props => props.muted ? (0, _constants.get)('colors.fg.muted')(props) : (0, _constants.get)('colors.accent.fg')(props), props => props.underline ? 'underline' : 'none', props => props.muted ? 'none' : 'underline', props => props.hoverColor ? hoverColor : props.muted ? `color: ${(0, _constants.get)('colors.accent.fg')(props)}` : '', _sx.default);
29
29
 
30
30
  var _default = Link;
31
31
  exports.default = _default;
package/lib/SideNav.d.ts CHANGED
@@ -18,7 +18,7 @@ declare const SideNavLink: import("styled-components").StyledComponent<"a", any,
18
18
  hoverColor?: string | undefined;
19
19
  muted?: boolean | undefined;
20
20
  underline?: boolean | undefined;
21
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
21
+ } & import("./sx").SxProp & StyledSideNavLinkProps, never>;
22
22
  export declare type SideNavProps = ComponentProps<typeof SideNav>;
23
23
  export declare type SideNavLinkProps = ComponentProps<typeof SideNavLink>;
24
24
  declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, {}, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
@@ -26,6 +26,6 @@ declare const _default: string & import("styled-components").StyledComponentBase
26
26
  hoverColor?: string | undefined;
27
27
  muted?: boolean | undefined;
28
28
  underline?: boolean | undefined;
29
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
29
+ } & import("./sx").SxProp & StyledSideNavLinkProps, never>;
30
30
  };
31
31
  export default _default;
@@ -1,25 +1,24 @@
1
1
  import * as History from 'history';
2
2
  import React from 'react';
3
+ import { SystemCommonProps, SystemFlexProps } from './constants';
3
4
  import { SxProp } from './sx';
4
5
  import { ComponentProps } from './utils/types';
5
- declare const BreadcrumbsBase: import("styled-components").StyledComponent<"nav", any, SxProp, never>;
6
- export declare type BreadcrumbsProps = React.PropsWithChildren<{
7
- className?: string;
8
- } & SxProp>;
9
- declare function Breadcrumbs({ className, children, sx: sxProp }: React.PropsWithChildren<BreadcrumbsProps>): JSX.Element;
6
+ declare const BreadcrumbsBase: import("styled-components").StyledComponent<"nav", any, SystemFlexProps & SystemCommonProps & SxProp, never>;
7
+ export declare type BreadcrumbsProps = ComponentProps<typeof BreadcrumbsBase>;
8
+ declare function Breadcrumbs({ className, children, theme, ...rest }: React.PropsWithChildren<BreadcrumbsProps>): JSX.Element;
10
9
  declare namespace Breadcrumbs {
11
10
  var displayName: string;
12
11
  }
13
12
  declare const BreadcrumbsItem: import("styled-components").StyledComponent<"a", any, {
14
13
  to?: History.LocationDescriptor<unknown> | undefined;
15
14
  selected?: boolean | undefined;
16
- } & SxProp, never>;
15
+ } & SystemCommonProps & SxProp, never>;
17
16
  export declare type BreadcrumbsItemProps = ComponentProps<typeof BreadcrumbsItem>;
18
17
  declare const _default: typeof Breadcrumbs & {
19
18
  Item: import("styled-components").StyledComponent<"a", any, {
20
19
  to?: History.LocationDescriptor<unknown> | undefined;
21
20
  selected?: boolean | undefined;
22
- } & SxProp, never>;
21
+ } & SystemCommonProps & SxProp, never>;
23
22
  };
24
23
  export default _default;
25
24
  /**
@@ -29,7 +28,7 @@ export declare const Breadcrumb: typeof Breadcrumbs & {
29
28
  Item: import("styled-components").StyledComponent<"a", any, {
30
29
  to?: History.LocationDescriptor<unknown> | undefined;
31
30
  selected?: boolean | undefined;
32
- } & SxProp, never>;
31
+ } & SystemCommonProps & SxProp, never>;
33
32
  };
34
33
  /**
35
34
  * @deprecated Use the `BreadcrumbsProps` type instead
@@ -1,9 +1,11 @@
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
+
1
3
  import classnames from 'classnames'; // eslint-disable-next-line import/no-namespace
2
4
 
3
5
  import React from 'react';
4
6
  import styled from 'styled-components';
5
7
  import Box from './Box';
6
- import { get } from './constants';
8
+ import { COMMON, FLEX, get } from './constants';
7
9
  import sx from './sx';
8
10
  const SELECTED_CLASS = 'selected';
9
11
  const Wrapper = styled.li.withConfig({
@@ -13,19 +15,22 @@ const Wrapper = styled.li.withConfig({
13
15
  const BreadcrumbsBase = styled.nav.withConfig({
14
16
  displayName: "Breadcrumbs__BreadcrumbsBase",
15
17
  componentId: "hwwoo0-1"
16
- })(["display:flex;justify-content:space-between;", ";"], sx);
18
+ })(["display:flex;justify-content:space-between;", ";", ";", ";"], COMMON, FLEX, sx);
17
19
 
18
20
  function Breadcrumbs({
19
21
  className,
20
22
  children,
21
- sx: sxProp
23
+ theme,
24
+ ...rest
22
25
  }) {
23
- const wrappedChildren = React.Children.map(children, child => /*#__PURE__*/React.createElement(Wrapper, null, child));
24
- return /*#__PURE__*/React.createElement(BreadcrumbsBase, {
26
+ const wrappedChildren = React.Children.map(children, child => /*#__PURE__*/React.createElement(Wrapper, {
27
+ theme: theme
28
+ }, child));
29
+ return /*#__PURE__*/React.createElement(BreadcrumbsBase, _extends({
25
30
  className: className,
26
31
  "aria-label": "Breadcrumbs",
27
- sx: sxProp
28
- }, /*#__PURE__*/React.createElement(Box, {
32
+ theme: theme
33
+ }, rest), /*#__PURE__*/React.createElement(Box, {
29
34
  as: "ol",
30
35
  my: 0,
31
36
  pl: 0
@@ -40,7 +45,7 @@ const BreadcrumbsItem = styled.a.attrs(props => ({
40
45
  })).withConfig({
41
46
  displayName: "Breadcrumbs__BreadcrumbsItem",
42
47
  componentId: "hwwoo0-2"
43
- })(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", ";"], get('colors.accent.fg'), get('fontSizes.1'), get('colors.fg.default'), sx);
48
+ })(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", " ", ";"], get('colors.accent.fg'), get('fontSizes.1'), get('colors.fg.default'), COMMON, sx);
44
49
  Breadcrumbs.displayName = 'Breadcrumbs';
45
50
  BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
46
51
  export default Object.assign(Breadcrumbs, {
package/lib-esm/Link.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { SystemCommonProps, SystemTypographyProps } from './constants';
2
1
  import { SxProp } from './sx';
3
2
  import { ComponentProps } from './utils/types';
4
3
  declare const Link: import("styled-components").StyledComponent<"a", any, {
5
4
  hoverColor?: string | undefined;
6
5
  muted?: boolean | undefined;
7
6
  underline?: boolean | undefined;
8
- } & SystemCommonProps & SxProp & SystemTypographyProps, never>;
7
+ } & SxProp, never>;
9
8
  export declare type LinkProps = ComponentProps<typeof Link>;
10
9
  export default Link;
package/lib-esm/Link.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { system } from 'styled-system';
3
- import { COMMON, get, TYPOGRAPHY } from './constants';
3
+ import { get } from './constants';
4
4
  import sx from './sx';
5
5
  const hoverColor = system({
6
6
  hoverColor: {
@@ -11,5 +11,5 @@ const hoverColor = system({
11
11
  const Link = styled.a.withConfig({
12
12
  displayName: "Link",
13
13
  componentId: "sc-1brdqhf-0"
14
- })(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";", ";", ";"], props => props.muted ? get('colors.fg.muted')(props) : get('colors.accent.fg')(props), props => props.underline ? 'underline' : 'none', props => props.muted ? 'none' : 'underline', props => props.hoverColor ? hoverColor : props.muted ? `color: ${get('colors.accent.fg')(props)}` : '', TYPOGRAPHY, COMMON, sx);
14
+ })(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";"], props => props.muted ? get('colors.fg.muted')(props) : get('colors.accent.fg')(props), props => props.underline ? 'underline' : 'none', props => props.muted ? 'none' : 'underline', props => props.hoverColor ? hoverColor : props.muted ? `color: ${get('colors.accent.fg')(props)}` : '', sx);
15
15
  export default Link;
@@ -18,7 +18,7 @@ declare const SideNavLink: import("styled-components").StyledComponent<"a", any,
18
18
  hoverColor?: string | undefined;
19
19
  muted?: boolean | undefined;
20
20
  underline?: boolean | undefined;
21
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
21
+ } & import("./sx").SxProp & StyledSideNavLinkProps, never>;
22
22
  export declare type SideNavProps = ComponentProps<typeof SideNav>;
23
23
  export declare type SideNavLinkProps = ComponentProps<typeof SideNavLink>;
24
24
  declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, {}, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
@@ -26,6 +26,6 @@ declare const _default: string & import("styled-components").StyledComponentBase
26
26
  hoverColor?: string | undefined;
27
27
  muted?: boolean | undefined;
28
28
  underline?: boolean | undefined;
29
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
29
+ } & import("./sx").SxProp & StyledSideNavLinkProps, never>;
30
30
  };
31
31
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-202110322537",
3
+ "version": "0.0.0-2021103231920",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",