@primer/components 0.0.0-2021103211630 → 0.0.0-202110322927

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.
@@ -24,7 +24,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
24
24
  const Page = _styledComponents.default.a.withConfig({
25
25
  displayName: "Pagination__Page",
26
26
  componentId: "b80nss-0"
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'));
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'), _constants.COMMON);
28
28
 
29
29
  function usePaginationPages({
30
30
  theme,
package/lib/SideNav.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  /// <reference types="hoist-non-react-statics" />
2
- /// <reference types="react" />
3
2
  import * as History from 'history';
4
- import Box from './Box';
5
3
  import { ComponentProps } from './utils/types';
4
+ import React from 'react';
5
+ import { SxProp } from './sx';
6
6
  declare type SideNavBaseProps = {
7
7
  variant?: 'lightweight' | 'normal';
8
8
  bordered?: boolean;
9
- } & ComponentProps<typeof Box>;
10
- declare function SideNavBase({ variant, className, bordered, children, ...props }: SideNavBaseProps): JSX.Element;
11
- declare const SideNav: import("styled-components").StyledComponent<typeof SideNavBase, any, {}, never>;
9
+ className?: string;
10
+ children?: React.ReactNode;
11
+ };
12
+ declare function SideNavBase({ variant, className, bordered, children }: SideNavBaseProps): JSX.Element;
13
+ declare const SideNav: import("styled-components").StyledComponent<typeof SideNavBase, any, SxProp, never>;
12
14
  declare type StyledSideNavLinkProps = {
13
15
  to?: History.LocationDescriptor;
14
16
  selected?: boolean;
@@ -18,14 +20,14 @@ declare const SideNavLink: import("styled-components").StyledComponent<"a", any,
18
20
  hoverColor?: string | undefined;
19
21
  muted?: boolean | undefined;
20
22
  underline?: boolean | undefined;
21
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
23
+ } & import("./constants").SystemCommonProps & SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
22
24
  export declare type SideNavProps = ComponentProps<typeof SideNav>;
23
25
  export declare type SideNavLinkProps = ComponentProps<typeof SideNavLink>;
24
- declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, {}, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
26
+ declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, SxProp, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
25
27
  Link: import("styled-components").StyledComponent<"a", any, {
26
28
  hoverColor?: string | undefined;
27
29
  muted?: boolean | undefined;
28
30
  underline?: boolean | undefined;
29
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
31
+ } & import("./constants").SystemCommonProps & SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
30
32
  };
31
33
  export default _default;
package/lib/SideNav.js CHANGED
@@ -25,39 +25,30 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
25
 
26
26
  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; }
27
27
 
28
- 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); }
29
-
28
+ // eslint-disable-next-line import/no-namespace
30
29
  function SideNavBase({
31
30
  variant,
32
31
  className,
33
32
  bordered,
34
- children,
35
- ...props
33
+ children
36
34
  }) {
37
35
  const variantClassName = variant === 'lightweight' ? 'lightweight' : 'normal';
38
36
  const newClassName = (0, _classnames.default)(className, `variant-${variantClassName}`);
39
-
40
- if (!bordered) {
41
- props = { ...props,
42
- borderWidth: 0
43
- };
44
- }
45
-
46
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
47
- borderWidth: "1px",
37
+ return /*#__PURE__*/_react.default.createElement(_Box.default, {
38
+ borderWidth: bordered ? '1px' : 0,
48
39
  borderStyle: "solid",
49
40
  borderColor: "border.default",
50
41
  borderRadius: 2,
51
42
  as: "nav",
52
43
  className: newClassName
53
- }, props), children);
44
+ }, children);
54
45
  }
55
46
 
56
47
  SideNavBase.displayName = "SideNavBase";
57
48
  const SideNav = (0, _styledComponents.default)(SideNavBase).withConfig({
58
49
  displayName: "SideNav",
59
50
  componentId: "sc-15k667c-0"
60
- })(["background-color:", ";", " ", ";", ";"], (0, _constants.get)('colors.canvas.subtle'), props => props.bordered && (0, _styledComponents.css)(["& > &{border-left:0;border-right:0;border-bottom:0;}"]), _constants.COMMON, _sx.default);
51
+ })(["background-color:", ";", " ", ";"], (0, _constants.get)('colors.canvas.subtle'), props => props.bordered && (0, _styledComponents.css)(["& > &{border-left:0;border-right:0;border-bottom:0;}"]), _sx.default);
61
52
  // used for variant normal hover, focus pseudo selectors
62
53
  const CommonAccessibilityVariantNormalStyles = (0, _styledComponents.css)(["background-color:", ";outline:none;text-decoration:none;"], (0, _constants.get)('colors.neutral.subtle')); // used for light weight hover, focus pseudo selectors
63
54
 
@@ -3,13 +3,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
5
5
  import Box from '../Box';
6
- import { get } from '../constants';
6
+ import { COMMON, get } from '../constants';
7
7
  import sx from '../sx';
8
8
  import { buildComponentData, buildPaginationModel } from './model';
9
9
  const Page = styled.a.withConfig({
10
10
  displayName: "Pagination__Page",
11
11
  componentId: "b80nss-0"
12
- })(["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 );}}"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'));
12
+ })(["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 );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'), COMMON);
13
13
 
14
14
  function usePaginationPages({
15
15
  theme,
@@ -1,14 +1,16 @@
1
1
  /// <reference types="hoist-non-react-statics" />
2
- /// <reference types="react" />
3
2
  import * as History from 'history';
4
- import Box from './Box';
5
3
  import { ComponentProps } from './utils/types';
4
+ import React from 'react';
5
+ import { SxProp } from './sx';
6
6
  declare type SideNavBaseProps = {
7
7
  variant?: 'lightweight' | 'normal';
8
8
  bordered?: boolean;
9
- } & ComponentProps<typeof Box>;
10
- declare function SideNavBase({ variant, className, bordered, children, ...props }: SideNavBaseProps): JSX.Element;
11
- declare const SideNav: import("styled-components").StyledComponent<typeof SideNavBase, any, {}, never>;
9
+ className?: string;
10
+ children?: React.ReactNode;
11
+ };
12
+ declare function SideNavBase({ variant, className, bordered, children }: SideNavBaseProps): JSX.Element;
13
+ declare const SideNav: import("styled-components").StyledComponent<typeof SideNavBase, any, SxProp, never>;
12
14
  declare type StyledSideNavLinkProps = {
13
15
  to?: History.LocationDescriptor;
14
16
  selected?: boolean;
@@ -18,14 +20,14 @@ declare const SideNavLink: import("styled-components").StyledComponent<"a", any,
18
20
  hoverColor?: string | undefined;
19
21
  muted?: boolean | undefined;
20
22
  underline?: boolean | undefined;
21
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
23
+ } & import("./constants").SystemCommonProps & SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
22
24
  export declare type SideNavProps = ComponentProps<typeof SideNav>;
23
25
  export declare type SideNavLinkProps = ComponentProps<typeof SideNavLink>;
24
- declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, {}, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
26
+ declare const _default: string & import("styled-components").StyledComponentBase<typeof SideNavBase, any, SxProp, never> & import("hoist-non-react-statics").NonReactStatics<typeof SideNavBase, {}> & {
25
27
  Link: import("styled-components").StyledComponent<"a", any, {
26
28
  hoverColor?: string | undefined;
27
29
  muted?: boolean | undefined;
28
30
  underline?: boolean | undefined;
29
- } & import("./constants").SystemCommonProps & import("./sx").SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
31
+ } & import("./constants").SystemCommonProps & SxProp & import("./constants").SystemTypographyProps & StyledSideNavLinkProps, never>;
30
32
  };
31
33
  export default _default;
@@ -1,7 +1,5 @@
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
-
3
1
  // eslint-disable-next-line import/no-namespace
4
- import { COMMON, get } from './constants';
2
+ import { get } from './constants';
5
3
  import styled, { css } from 'styled-components';
6
4
  import Box from './Box';
7
5
  import Link from './Link';
@@ -13,33 +11,25 @@ function SideNavBase({
13
11
  variant,
14
12
  className,
15
13
  bordered,
16
- children,
17
- ...props
14
+ children
18
15
  }) {
19
16
  const variantClassName = variant === 'lightweight' ? 'lightweight' : 'normal';
20
17
  const newClassName = classnames(className, `variant-${variantClassName}`);
21
-
22
- if (!bordered) {
23
- props = { ...props,
24
- borderWidth: 0
25
- };
26
- }
27
-
28
- return /*#__PURE__*/React.createElement(Box, _extends({
29
- borderWidth: "1px",
18
+ return /*#__PURE__*/React.createElement(Box, {
19
+ borderWidth: bordered ? '1px' : 0,
30
20
  borderStyle: "solid",
31
21
  borderColor: "border.default",
32
22
  borderRadius: 2,
33
23
  as: "nav",
34
24
  className: newClassName
35
- }, props), children);
25
+ }, children);
36
26
  }
37
27
 
38
28
  SideNavBase.displayName = "SideNavBase";
39
29
  const SideNav = styled(SideNavBase).withConfig({
40
30
  displayName: "SideNav",
41
31
  componentId: "sc-15k667c-0"
42
- })(["background-color:", ";", " ", ";", ";"], get('colors.canvas.subtle'), props => props.bordered && css(["& > &{border-left:0;border-right:0;border-bottom:0;}"]), COMMON, sx);
32
+ })(["background-color:", ";", " ", ";"], get('colors.canvas.subtle'), props => props.bordered && css(["& > &{border-left:0;border-right:0;border-bottom:0;}"]), sx);
43
33
  // used for variant normal hover, focus pseudo selectors
44
34
  const CommonAccessibilityVariantNormalStyles = css(["background-color:", ";outline:none;text-decoration:none;"], get('colors.neutral.subtle')); // used for light weight hover, focus pseudo selectors
45
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-2021103211630",
3
+ "version": "0.0.0-202110322927",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",