@primer/components 0.0.0-202110417386 → 0.0.0-2021108142649
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 +3 -1
- package/dist/browser.esm.js +472 -472
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +102 -102
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList2/Description.d.ts +12 -0
- package/lib/ActionList2/Description.js +53 -0
- package/lib/ActionList2/Divider.d.ts +5 -0
- package/lib/ActionList2/Divider.js +35 -0
- package/lib/ActionList2/Group.d.ts +32 -0
- package/lib/ActionList2/Group.js +104 -0
- package/lib/ActionList2/Item.d.ts +71 -0
- package/lib/ActionList2/Item.js +234 -0
- package/lib/ActionList2/LinkItem.d.ts +17 -0
- package/lib/ActionList2/LinkItem.js +57 -0
- package/lib/ActionList2/List.d.ts +26 -0
- package/lib/ActionList2/List.js +59 -0
- package/lib/ActionList2/Selection.d.ts +5 -0
- package/lib/ActionList2/Selection.js +70 -0
- package/lib/ActionList2/Visuals.d.ts +11 -0
- package/lib/ActionList2/Visuals.js +90 -0
- package/lib/ActionList2/index.d.ts +40 -0
- package/lib/ActionList2/index.js +47 -0
- package/lib/Autocomplete/Autocomplete.d.ts +28 -28
- package/lib/Autocomplete/AutocompleteInput.d.ts +28 -28
- package/lib/Button/Button.d.ts +25 -25
- package/lib/Button/ButtonClose.d.ts +45 -45
- package/lib/Button/ButtonDanger.d.ts +25 -25
- package/lib/Button/ButtonInvisible.d.ts +25 -25
- package/lib/Button/ButtonOutline.d.ts +25 -25
- package/lib/Button/ButtonPrimary.d.ts +25 -25
- package/lib/CircleOcticon.d.ts +42 -42
- package/lib/Dialog.d.ts +45 -45
- package/lib/Dropdown.d.ts +176 -176
- package/lib/DropdownMenu/DropdownButton.d.ts +46 -46
- package/lib/FilterList.d.ts +42 -42
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +246 -246
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +28 -28
- package/lib/Timeline.d.ts +43 -43
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/experiments.d.ts +1 -0
- package/lib/experiments.js +18 -0
- package/lib/sx.d.ts +2 -0
- package/lib/sx.js +8 -0
- package/lib/theme-preval.js +81 -2
- package/lib/utils/create-slots.d.ts +17 -0
- package/lib/utils/create-slots.js +105 -0
- package/lib/utils/testing.d.ts +14 -1
- package/lib/utils/use-force-update.d.ts +1 -0
- package/lib/utils/use-force-update.js +19 -0
- package/lib-esm/ActionList2/Description.d.ts +12 -0
- package/lib-esm/ActionList2/Description.js +37 -0
- package/lib-esm/ActionList2/Divider.d.ts +5 -0
- package/lib-esm/ActionList2/Divider.js +23 -0
- package/lib-esm/ActionList2/Group.d.ts +32 -0
- package/lib-esm/ActionList2/Group.js +85 -0
- package/lib-esm/ActionList2/Item.d.ts +71 -0
- package/lib-esm/ActionList2/Item.js +201 -0
- package/lib-esm/ActionList2/LinkItem.d.ts +17 -0
- package/lib-esm/ActionList2/LinkItem.js +43 -0
- package/lib-esm/ActionList2/List.d.ts +26 -0
- package/lib-esm/ActionList2/List.js +37 -0
- package/lib-esm/ActionList2/Selection.d.ts +5 -0
- package/lib-esm/ActionList2/Selection.js +52 -0
- package/lib-esm/ActionList2/Visuals.d.ts +11 -0
- package/lib-esm/ActionList2/Visuals.js +68 -0
- package/lib-esm/ActionList2/index.d.ts +40 -0
- package/lib-esm/ActionList2/index.js +33 -0
- package/lib-esm/Autocomplete/Autocomplete.d.ts +28 -28
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +28 -28
- package/lib-esm/Button/Button.d.ts +25 -25
- package/lib-esm/Button/ButtonClose.d.ts +45 -45
- package/lib-esm/Button/ButtonDanger.d.ts +25 -25
- package/lib-esm/Button/ButtonInvisible.d.ts +25 -25
- package/lib-esm/Button/ButtonOutline.d.ts +25 -25
- package/lib-esm/Button/ButtonPrimary.d.ts +25 -25
- package/lib-esm/CircleOcticon.d.ts +42 -42
- package/lib-esm/Dialog.d.ts +45 -45
- package/lib-esm/Dropdown.d.ts +176 -176
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +46 -46
- package/lib-esm/FilterList.d.ts +42 -42
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +246 -246
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +28 -28
- package/lib-esm/Timeline.d.ts +43 -43
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/experiments.d.ts +1 -0
- package/lib-esm/experiments.js +2 -0
- package/lib-esm/sx.d.ts +2 -0
- package/lib-esm/sx.js +3 -1
- package/lib-esm/theme-preval.js +81 -2
- package/lib-esm/utils/create-slots.d.ts +17 -0
- package/lib-esm/utils/create-slots.js +84 -0
- package/lib-esm/utils/testing.d.ts +14 -1
- package/lib-esm/utils/use-force-update.d.ts +1 -0
- package/lib-esm/utils/use-force-update.js +6 -0
- package/package.json +4 -2
- 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,115 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import styled, { css } from 'styled-components';
|
3
|
-
import { get } from '../constants';
|
4
|
-
import { labelVariants } from './_newLabelStyleUtils';
|
5
|
-
const labelColorMap = {
|
6
|
-
default: {
|
7
|
-
borderColor: get('colors.border.default')
|
8
|
-
},
|
9
|
-
primary: {
|
10
|
-
borderColor: get('colors.fg.default')
|
11
|
-
},
|
12
|
-
secondary: {
|
13
|
-
borderColor: get('colors.border.muted'),
|
14
|
-
textColor: get('colors.fg.muted')
|
15
|
-
},
|
16
|
-
accent: {
|
17
|
-
borderColor: get('colors.accent.emphasis'),
|
18
|
-
textColor: get('colors.accent.fg')
|
19
|
-
},
|
20
|
-
success: {
|
21
|
-
borderColor: get('colors.success.emphasis'),
|
22
|
-
textColor: get('colors.success.fg')
|
23
|
-
},
|
24
|
-
attention: {
|
25
|
-
borderColor: get('colors.attention.emphasis'),
|
26
|
-
textColor: get('colors.attention.fg')
|
27
|
-
},
|
28
|
-
severe: {
|
29
|
-
borderColor: get('colors.severe.emphasis'),
|
30
|
-
textColor: get('colors.severe.fg')
|
31
|
-
},
|
32
|
-
danger: {
|
33
|
-
borderColor: get('colors.danger.emphasis'),
|
34
|
-
textColor: get('colors.danger.fg')
|
35
|
-
},
|
36
|
-
done: {
|
37
|
-
borderColor: get('colors.done.fg'),
|
38
|
-
textColor: get('colors.done.emphasis')
|
39
|
-
},
|
40
|
-
sponsors: {
|
41
|
-
borderColor: get('colors.sponsors.fg'),
|
42
|
-
textColor: get('colors.sponsors.emphasis')
|
43
|
-
}
|
44
|
-
};
|
45
|
-
const filledLabelColorMap = {
|
46
|
-
default: {
|
47
|
-
bgColor: get('colors.neutral.muted')
|
48
|
-
},
|
49
|
-
primary: {
|
50
|
-
bgColor: get('colors.neutral.emphasis'),
|
51
|
-
textColor: get('colors.fg.onEmphasis')
|
52
|
-
},
|
53
|
-
secondary: {
|
54
|
-
bgColor: get('colors.neutral.subtle'),
|
55
|
-
textColor: get('colors.fg.muted')
|
56
|
-
},
|
57
|
-
accent: {
|
58
|
-
bgColor: get('colors.accent.emphasis'),
|
59
|
-
textColor: get('colors.fg.onEmphasis')
|
60
|
-
},
|
61
|
-
success: {
|
62
|
-
bgColor: get('colors.success.emphasis'),
|
63
|
-
textColor: get('colors.fg.onEmphasis')
|
64
|
-
},
|
65
|
-
attention: {
|
66
|
-
bgColor: get('colors.attention.emphasis'),
|
67
|
-
textColor: get('colors.fg.onEmphasis')
|
68
|
-
},
|
69
|
-
severe: {
|
70
|
-
bgColor: get('colors.severe.emphasis'),
|
71
|
-
textColor: get('colors.fg.onEmphasis')
|
72
|
-
},
|
73
|
-
danger: {
|
74
|
-
bgColor: get('colors.danger.emphasis'),
|
75
|
-
textColor: get('colors.fg.onEmphasis')
|
76
|
-
},
|
77
|
-
done: {
|
78
|
-
bgColor: get('colors.done.fg'),
|
79
|
-
textColor: get('colors.fg.onEmphasis')
|
80
|
-
},
|
81
|
-
sponsors: {
|
82
|
-
bgColor: get('colors.sponsors.fg'),
|
83
|
-
textColor: get('colors.fg.onEmphasis')
|
84
|
-
}
|
85
|
-
};
|
86
|
-
const LeadingVisualContainer = styled('span').withConfig({
|
87
|
-
displayName: "NewLabel__LeadingVisualContainer",
|
88
|
-
componentId: "sc-6osasq-0"
|
89
|
-
})(["flex-shrink:0;line-height:0;margin-right:", ";"], get('space.1'));
|
90
|
-
const LabelContainer = styled.span.withConfig({
|
91
|
-
displayName: "NewLabel__LabelContainer",
|
92
|
-
componentId: "sc-6osasq-1"
|
93
|
-
})(["align-items:center;border-width:1px;border-radius:999px;border-style:solid;display:inline-flex;font-weight:", ";line-height:1;white-space:nowrap;", ";", ""], get('fontWeights.bold'), labelVariants, ({
|
94
|
-
color = 'default',
|
95
|
-
filled
|
96
|
-
}) => {
|
97
|
-
if (filled) {
|
98
|
-
return css(["background-color:", ";border-color:transparent;color:", ";"], filledLabelColorMap[color].bgColor, filledLabelColorMap[color].textColor);
|
99
|
-
} else {
|
100
|
-
return css(["background-color:transparent;border-color:", ";color:", ";"], labelColorMap[color].borderColor, labelColorMap[color].textColor);
|
101
|
-
}
|
102
|
-
});
|
103
|
-
|
104
|
-
const NewLabel = ({
|
105
|
-
children,
|
106
|
-
leadingVisual: LeadingVisual,
|
107
|
-
...other
|
108
|
-
}) => /*#__PURE__*/React.createElement(LabelContainer, other, LeadingVisual && /*#__PURE__*/React.createElement(LeadingVisualContainer, null, /*#__PURE__*/React.createElement(LeadingVisual, null)), children);
|
109
|
-
|
110
|
-
NewLabel.displayName = "NewLabel";
|
111
|
-
NewLabel.defaultProps = {
|
112
|
-
size: 'md',
|
113
|
-
color: 'default'
|
114
|
-
};
|
115
|
-
export default NewLabel;
|
@@ -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
|
-
});
|