@primer/components 0.0.0-202182493810 → 0.0.0-202182720420
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/CHANGELOG.md +1 -1
- package/dist/browser.esm.js +1 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +1 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/AvatarStack.d.ts +4 -8
- package/lib/AvatarStack.js +6 -7
- package/lib-esm/AvatarStack.d.ts +4 -8
- package/lib-esm/AvatarStack.js +7 -8
- package/package.json +3 -3
package/lib/AvatarStack.d.ts
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
import { SystemCommonProps } from './constants';
|
1
|
+
import React from 'react';
|
3
2
|
import { SxProp } from './sx';
|
4
|
-
import { ComponentProps } from './utils/types';
|
5
|
-
declare const AvatarStackWrapper: import("styled-components").StyledComponent<"span", any, {
|
6
|
-
count?: number | undefined;
|
7
|
-
} & SystemCommonProps & SxProp, never>;
|
8
3
|
export declare type AvatarStackProps = {
|
9
4
|
alignRight?: boolean;
|
10
|
-
|
11
|
-
|
5
|
+
children: React.ReactNode;
|
6
|
+
} & SxProp;
|
7
|
+
declare const AvatarStack: ({ children, alignRight, sx: sxProp }: AvatarStackProps) => JSX.Element;
|
12
8
|
export default AvatarStack;
|
package/lib/AvatarStack.js
CHANGED
@@ -19,12 +19,10 @@ 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
|
-
|
24
22
|
const AvatarStackWrapper = _styledComponents.default.span.withConfig({
|
25
23
|
displayName: "AvatarStack__AvatarStackWrapper",
|
26
24
|
componentId: "sc-1qgzd2v-0"
|
27
|
-
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", "
|
25
|
+
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", ";"], props => props.count === 1 ? '20px' : props.count === 2 ? '30px' : '38px', (0, _constants.get)('colors.canvas.default'), 100 - 3 * 15, 100 - 4 * 15, 100 - 5 * 15, (0, _constants.get)('space.1'), (0, _constants.get)('space.1'), (0, _constants.get)('colors.canvas.default'), _sx.default);
|
28
26
|
|
29
27
|
const transformChildren = children => {
|
30
28
|
return _react.default.Children.map(children, (child, index) => {
|
@@ -42,7 +40,7 @@ const transformChildren = children => {
|
|
42
40
|
const AvatarStack = ({
|
43
41
|
children,
|
44
42
|
alignRight,
|
45
|
-
|
43
|
+
sx: sxProp
|
46
44
|
}) => {
|
47
45
|
const count = _react.default.Children.count(children);
|
48
46
|
|
@@ -51,10 +49,11 @@ const AvatarStack = ({
|
|
51
49
|
'pc-AvatarStack--three-plus': count > 2,
|
52
50
|
'pc-AvatarStack--right': alignRight
|
53
51
|
});
|
54
|
-
return /*#__PURE__*/_react.default.createElement(AvatarStackWrapper,
|
52
|
+
return /*#__PURE__*/_react.default.createElement(AvatarStackWrapper, {
|
55
53
|
count: count,
|
56
|
-
className: wrapperClassNames
|
57
|
-
|
54
|
+
className: wrapperClassNames,
|
55
|
+
sx: sxProp
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_.Box, {
|
58
57
|
position: "absolute",
|
59
58
|
display: "flex",
|
60
59
|
width: "38px",
|
package/lib-esm/AvatarStack.d.ts
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
import { SystemCommonProps } from './constants';
|
1
|
+
import React from 'react';
|
3
2
|
import { SxProp } from './sx';
|
4
|
-
import { ComponentProps } from './utils/types';
|
5
|
-
declare const AvatarStackWrapper: import("styled-components").StyledComponent<"span", any, {
|
6
|
-
count?: number | undefined;
|
7
|
-
} & SystemCommonProps & SxProp, never>;
|
8
3
|
export declare type AvatarStackProps = {
|
9
4
|
alignRight?: boolean;
|
10
|
-
|
11
|
-
|
5
|
+
children: React.ReactNode;
|
6
|
+
} & SxProp;
|
7
|
+
declare const AvatarStack: ({ children, alignRight, sx: sxProp }: AvatarStackProps) => JSX.Element;
|
12
8
|
export default AvatarStack;
|
package/lib-esm/AvatarStack.js
CHANGED
@@ -1,15 +1,13 @@
|
|
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
|
import classnames from 'classnames';
|
4
2
|
import React from 'react';
|
5
3
|
import styled from 'styled-components';
|
6
|
-
import {
|
4
|
+
import { get } from './constants';
|
7
5
|
import { Box } from '.';
|
8
6
|
import sx from './sx';
|
9
7
|
const AvatarStackWrapper = styled.span.withConfig({
|
10
8
|
displayName: "AvatarStack__AvatarStackWrapper",
|
11
9
|
componentId: "sc-1qgzd2v-0"
|
12
|
-
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", "
|
10
|
+
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", ";"], props => props.count === 1 ? '20px' : props.count === 2 ? '30px' : '38px', get('colors.canvas.default'), 100 - 3 * 15, 100 - 4 * 15, 100 - 5 * 15, get('space.1'), get('space.1'), get('colors.canvas.default'), sx);
|
13
11
|
|
14
12
|
const transformChildren = children => {
|
15
13
|
return React.Children.map(children, (child, index) => {
|
@@ -27,7 +25,7 @@ const transformChildren = children => {
|
|
27
25
|
const AvatarStack = ({
|
28
26
|
children,
|
29
27
|
alignRight,
|
30
|
-
|
28
|
+
sx: sxProp
|
31
29
|
}) => {
|
32
30
|
const count = React.Children.count(children);
|
33
31
|
const wrapperClassNames = classnames({
|
@@ -35,10 +33,11 @@ const AvatarStack = ({
|
|
35
33
|
'pc-AvatarStack--three-plus': count > 2,
|
36
34
|
'pc-AvatarStack--right': alignRight
|
37
35
|
});
|
38
|
-
return /*#__PURE__*/React.createElement(AvatarStackWrapper,
|
36
|
+
return /*#__PURE__*/React.createElement(AvatarStackWrapper, {
|
39
37
|
count: count,
|
40
|
-
className: wrapperClassNames
|
41
|
-
|
38
|
+
className: wrapperClassNames,
|
39
|
+
sx: sxProp
|
40
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
42
41
|
position: "absolute",
|
43
42
|
display: "flex",
|
44
43
|
width: "38px",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-202182720420",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -86,10 +86,10 @@
|
|
86
86
|
"@types/chroma-js": "2.1.3",
|
87
87
|
"@types/enzyme": "3.10.9",
|
88
88
|
"@types/jest": "26.0.23",
|
89
|
-
"@types/jest-axe": "3.5.
|
89
|
+
"@types/jest-axe": "3.5.3",
|
90
90
|
"@types/lodash.isempty": "4.4.6",
|
91
91
|
"@types/lodash.isobject": "3.0.6",
|
92
|
-
"@typescript-eslint/eslint-plugin": "4.
|
92
|
+
"@typescript-eslint/eslint-plugin": "4.31.2",
|
93
93
|
"@typescript-eslint/parser": "4.26.1",
|
94
94
|
"@wojtekmaj/enzyme-adapter-react-17": "0.6.3",
|
95
95
|
"babel-core": "7.0.0-bridge.0",
|