@primer/components 0.0.0-202110417386 → 0.0.0-2021108741
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 +5 -3
- package/dist/browser.esm.js +176 -176
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +187 -187
- package/dist/browser.umd.js.map +1 -1
- package/lib/Overlay.js +3 -1
- package/lib/Portal/Portal.js +4 -3
- package/lib/hooks/useAnchoredPosition.js +3 -2
- package/lib/hooks/useCombinedRefs.d.ts +2 -2
- package/lib/hooks/useCombinedRefs.js +4 -9
- package/lib/hooks/useResizeObserver.js +2 -4
- package/lib/utils/useIsomorphicLayoutEffect.d.ts +2 -0
- package/lib/utils/useIsomorphicLayoutEffect.js +14 -0
- package/lib-esm/Overlay.js +2 -1
- package/lib-esm/Portal/Portal.js +3 -2
- package/lib-esm/hooks/useAnchoredPosition.js +2 -1
- package/lib-esm/hooks/useCombinedRefs.d.ts +2 -2
- package/lib-esm/hooks/useCombinedRefs.js +4 -4
- package/lib-esm/hooks/useResizeObserver.js +2 -2
- package/lib-esm/utils/useIsomorphicLayoutEffect.d.ts +2 -0
- package/lib-esm/utils/useIsomorphicLayoutEffect.js +4 -0
- package/package.json +1 -1
- package/lib/NewLabel/NewLabel.d.ts +0 -11
- package/lib/NewLabel/NewLabel.js +0 -134
- package/lib/NewLabel/NewStateLabel.d.ts +0 -10
- package/lib/NewLabel/NewStateLabel.js +0 -49
- package/lib/NewLabel/_newLabelStyleUtils.d.ts +0 -3
- package/lib/NewLabel/_newLabelStyleUtils.js +0 -40
- package/lib-esm/NewLabel/NewLabel.d.ts +0 -11
- package/lib-esm/NewLabel/NewLabel.js +0 -115
- package/lib-esm/NewLabel/NewStateLabel.d.ts +0 -10
- package/lib-esm/NewLabel/NewStateLabel.js +0 -36
- package/lib-esm/NewLabel/_newLabelStyleUtils.d.ts +0 -3
- package/lib-esm/NewLabel/_newLabelStyleUtils.js +0 -30
@@ -1,10 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { LabelSizeKeys } from './_newLabelStyleUtils';
|
3
|
-
declare type Statuses = 'issueClosed' | 'pullClosed' | 'pullMerged' | 'issueOpened' | 'pullOpened' | 'draft';
|
4
|
-
interface Props {
|
5
|
-
status: Statuses;
|
6
|
-
size?: LabelSizeKeys;
|
7
|
-
leadingVisual?: React.ComponentType<any>;
|
8
|
-
}
|
9
|
-
declare const NewStateLabel: React.FC<Props>;
|
10
|
-
export default NewStateLabel;
|
@@ -1,36 +0,0 @@
|
|
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
|
-
import React from 'react';
|
4
|
-
import { GitMergeIcon, GitPullRequestIcon, IssueClosedIcon, IssueOpenedIcon } from '@primer/octicons-react';
|
5
|
-
import NewLabel from './NewLabel';
|
6
|
-
const colorMap = {
|
7
|
-
issueClosed: 'done',
|
8
|
-
pullClosed: 'done',
|
9
|
-
pullMerged: 'done',
|
10
|
-
issueOpened: 'success',
|
11
|
-
pullOpened: 'success',
|
12
|
-
draft: 'primary'
|
13
|
-
};
|
14
|
-
const octiconMap = {
|
15
|
-
issueOpened: IssueOpenedIcon,
|
16
|
-
pullOpened: GitPullRequestIcon,
|
17
|
-
issueClosed: IssueClosedIcon,
|
18
|
-
pullClosed: GitPullRequestIcon,
|
19
|
-
pullMerged: GitMergeIcon,
|
20
|
-
draft: GitPullRequestIcon
|
21
|
-
};
|
22
|
-
|
23
|
-
const NewStateLabel = ({
|
24
|
-
status,
|
25
|
-
...rest
|
26
|
-
}) => /*#__PURE__*/React.createElement(NewLabel, _extends({
|
27
|
-
filled: true,
|
28
|
-
color: colorMap[status],
|
29
|
-
leadingVisual: octiconMap[status]
|
30
|
-
}, rest));
|
31
|
-
|
32
|
-
NewStateLabel.displayName = "NewStateLabel";
|
33
|
-
NewStateLabel.defaultProps = {
|
34
|
-
size: 'lg'
|
35
|
-
};
|
36
|
-
export default NewStateLabel;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { variant } from 'styled-system';
|
2
|
-
// TODO: consider moving to Primitives
|
3
|
-
export const badgeSizes = {
|
4
|
-
sm: 20,
|
5
|
-
md: 24,
|
6
|
-
lg: 32
|
7
|
-
};
|
8
|
-
export const labelVariants = variant({
|
9
|
-
prop: 'size',
|
10
|
-
variants: {
|
11
|
-
sm: {
|
12
|
-
fontSize: 0,
|
13
|
-
height: `${badgeSizes.sm}px`,
|
14
|
-
paddingLeft: 2,
|
15
|
-
paddingRight: 2
|
16
|
-
},
|
17
|
-
md: {
|
18
|
-
fontSize: 0,
|
19
|
-
height: `${badgeSizes.md}px`,
|
20
|
-
paddingLeft: 2,
|
21
|
-
paddingRight: 2
|
22
|
-
},
|
23
|
-
lg: {
|
24
|
-
fontSize: 1,
|
25
|
-
height: `${badgeSizes.lg}px`,
|
26
|
-
paddingLeft: 3,
|
27
|
-
paddingRight: 3
|
28
|
-
}
|
29
|
-
}
|
30
|
-
});
|