@primer/components 0.0.0-202110417386 → 0.0.0-2021104181937
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 +5 -4
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +30 -29
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib/Autocomplete/Autocomplete.d.ts +4 -2
- package/lib/Autocomplete/AutocompleteInput.d.ts +4 -2
- package/lib/Button/Button.js +1 -1
- package/lib/DatePicker/DatePicker.d.ts +52 -0
- package/lib/DatePicker/DatePicker.js +109 -0
- package/lib/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib/DatePicker/DatePickerAnchor.js +202 -0
- package/lib/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib/DatePicker/DatePickerOverlay.js +55 -0
- package/lib/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib/DatePicker/DatePickerPanel.js +363 -0
- package/lib/DatePicker/Day.d.ts +15 -0
- package/lib/DatePicker/Day.js +204 -0
- package/lib/DatePicker/Month.d.ts +8 -0
- package/lib/DatePicker/Month.js +122 -0
- package/lib/DatePicker/dateParser.d.ts +12 -0
- package/lib/DatePicker/dateParser.js +193 -0
- package/lib/DatePicker/index.d.ts +2 -0
- package/lib/DatePicker/index.js +13 -0
- package/lib/DatePicker/useDatePicker.d.ts +107 -0
- package/lib/DatePicker/useDatePicker.js +561 -0
- package/lib/SelectMenu/SelectMenu.d.ts +4 -2
- package/lib/TextInputWithTokens.d.ts +4 -2
- package/lib/hooks/useDebounce.d.ts +2 -0
- package/lib/hooks/useDebounce.js +24 -0
- package/lib/hooks/useResizeObserver.d.ts +1 -1
- package/lib/hooks/useResizeObserver.js +1 -1
- package/lib/theme-preval.js +2 -2
- package/lib/utils/testing.d.ts +1 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +4 -2
- package/lib-esm/Autocomplete/Autocomplete.d.ts +4 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +4 -2
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/DatePicker/DatePicker.d.ts +52 -0
- package/lib-esm/DatePicker/DatePicker.js +92 -0
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +5 -0
- package/lib-esm/DatePicker/DatePickerAnchor.js +174 -0
- package/lib-esm/DatePicker/DatePickerOverlay.d.ts +3 -0
- package/lib-esm/DatePicker/DatePickerOverlay.js +40 -0
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +2 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +332 -0
- package/lib-esm/DatePicker/Day.d.ts +15 -0
- package/lib-esm/DatePicker/Day.js +180 -0
- package/lib-esm/DatePicker/Month.d.ts +8 -0
- package/lib-esm/DatePicker/Month.js +98 -0
- package/lib-esm/DatePicker/dateParser.d.ts +12 -0
- package/lib-esm/DatePicker/dateParser.js +179 -0
- package/lib-esm/DatePicker/index.d.ts +2 -0
- package/lib-esm/DatePicker/index.js +1 -0
- package/lib-esm/DatePicker/useDatePicker.d.ts +107 -0
- package/lib-esm/DatePicker/useDatePicker.js +526 -0
- package/lib-esm/SelectMenu/SelectMenu.d.ts +4 -2
- package/lib-esm/TextInputWithTokens.d.ts +4 -2
- package/lib-esm/hooks/useDebounce.d.ts +2 -0
- package/lib-esm/hooks/useDebounce.js +16 -0
- package/lib-esm/hooks/useResizeObserver.d.ts +1 -1
- package/lib-esm/hooks/useResizeObserver.js +1 -1
- package/lib-esm/theme-preval.js +2 -2
- package/lib-esm/utils/testing.d.ts +1 -1
- package/package.json +9 -8
- 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
package/lib/NewLabel/NewLabel.js
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
11
|
-
|
12
|
-
var _constants = require("../constants");
|
13
|
-
|
14
|
-
var _newLabelStyleUtils = require("./_newLabelStyleUtils");
|
15
|
-
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
|
-
|
18
|
-
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; }
|
19
|
-
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
|
-
const labelColorMap = {
|
23
|
-
default: {
|
24
|
-
borderColor: (0, _constants.get)('colors.border.default')
|
25
|
-
},
|
26
|
-
primary: {
|
27
|
-
borderColor: (0, _constants.get)('colors.fg.default')
|
28
|
-
},
|
29
|
-
secondary: {
|
30
|
-
borderColor: (0, _constants.get)('colors.border.muted'),
|
31
|
-
textColor: (0, _constants.get)('colors.fg.muted')
|
32
|
-
},
|
33
|
-
accent: {
|
34
|
-
borderColor: (0, _constants.get)('colors.accent.emphasis'),
|
35
|
-
textColor: (0, _constants.get)('colors.accent.fg')
|
36
|
-
},
|
37
|
-
success: {
|
38
|
-
borderColor: (0, _constants.get)('colors.success.emphasis'),
|
39
|
-
textColor: (0, _constants.get)('colors.success.fg')
|
40
|
-
},
|
41
|
-
attention: {
|
42
|
-
borderColor: (0, _constants.get)('colors.attention.emphasis'),
|
43
|
-
textColor: (0, _constants.get)('colors.attention.fg')
|
44
|
-
},
|
45
|
-
severe: {
|
46
|
-
borderColor: (0, _constants.get)('colors.severe.emphasis'),
|
47
|
-
textColor: (0, _constants.get)('colors.severe.fg')
|
48
|
-
},
|
49
|
-
danger: {
|
50
|
-
borderColor: (0, _constants.get)('colors.danger.emphasis'),
|
51
|
-
textColor: (0, _constants.get)('colors.danger.fg')
|
52
|
-
},
|
53
|
-
done: {
|
54
|
-
borderColor: (0, _constants.get)('colors.done.fg'),
|
55
|
-
textColor: (0, _constants.get)('colors.done.emphasis')
|
56
|
-
},
|
57
|
-
sponsors: {
|
58
|
-
borderColor: (0, _constants.get)('colors.sponsors.fg'),
|
59
|
-
textColor: (0, _constants.get)('colors.sponsors.emphasis')
|
60
|
-
}
|
61
|
-
};
|
62
|
-
const filledLabelColorMap = {
|
63
|
-
default: {
|
64
|
-
bgColor: (0, _constants.get)('colors.neutral.muted')
|
65
|
-
},
|
66
|
-
primary: {
|
67
|
-
bgColor: (0, _constants.get)('colors.neutral.emphasis'),
|
68
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
69
|
-
},
|
70
|
-
secondary: {
|
71
|
-
bgColor: (0, _constants.get)('colors.neutral.subtle'),
|
72
|
-
textColor: (0, _constants.get)('colors.fg.muted')
|
73
|
-
},
|
74
|
-
accent: {
|
75
|
-
bgColor: (0, _constants.get)('colors.accent.emphasis'),
|
76
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
77
|
-
},
|
78
|
-
success: {
|
79
|
-
bgColor: (0, _constants.get)('colors.success.emphasis'),
|
80
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
81
|
-
},
|
82
|
-
attention: {
|
83
|
-
bgColor: (0, _constants.get)('colors.attention.emphasis'),
|
84
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
85
|
-
},
|
86
|
-
severe: {
|
87
|
-
bgColor: (0, _constants.get)('colors.severe.emphasis'),
|
88
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
89
|
-
},
|
90
|
-
danger: {
|
91
|
-
bgColor: (0, _constants.get)('colors.danger.emphasis'),
|
92
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
93
|
-
},
|
94
|
-
done: {
|
95
|
-
bgColor: (0, _constants.get)('colors.done.fg'),
|
96
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
97
|
-
},
|
98
|
-
sponsors: {
|
99
|
-
bgColor: (0, _constants.get)('colors.sponsors.fg'),
|
100
|
-
textColor: (0, _constants.get)('colors.fg.onEmphasis')
|
101
|
-
}
|
102
|
-
};
|
103
|
-
const LeadingVisualContainer = (0, _styledComponents.default)('span').withConfig({
|
104
|
-
displayName: "NewLabel__LeadingVisualContainer",
|
105
|
-
componentId: "sc-6osasq-0"
|
106
|
-
})(["flex-shrink:0;line-height:0;margin-right:", ";"], (0, _constants.get)('space.1'));
|
107
|
-
|
108
|
-
const LabelContainer = _styledComponents.default.span.withConfig({
|
109
|
-
displayName: "NewLabel__LabelContainer",
|
110
|
-
componentId: "sc-6osasq-1"
|
111
|
-
})(["align-items:center;border-width:1px;border-radius:999px;border-style:solid;display:inline-flex;font-weight:", ";line-height:1;white-space:nowrap;", ";", ""], (0, _constants.get)('fontWeights.bold'), _newLabelStyleUtils.labelVariants, ({
|
112
|
-
color = 'default',
|
113
|
-
filled
|
114
|
-
}) => {
|
115
|
-
if (filled) {
|
116
|
-
return (0, _styledComponents.css)(["background-color:", ";border-color:transparent;color:", ";"], filledLabelColorMap[color].bgColor, filledLabelColorMap[color].textColor);
|
117
|
-
} else {
|
118
|
-
return (0, _styledComponents.css)(["background-color:transparent;border-color:", ";color:", ";"], labelColorMap[color].borderColor, labelColorMap[color].textColor);
|
119
|
-
}
|
120
|
-
});
|
121
|
-
|
122
|
-
const NewLabel = ({
|
123
|
-
children,
|
124
|
-
leadingVisual: LeadingVisual,
|
125
|
-
...other
|
126
|
-
}) => /*#__PURE__*/_react.default.createElement(LabelContainer, other, LeadingVisual && /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, null, /*#__PURE__*/_react.default.createElement(LeadingVisual, null)), children);
|
127
|
-
|
128
|
-
NewLabel.displayName = "NewLabel";
|
129
|
-
NewLabel.defaultProps = {
|
130
|
-
size: 'md',
|
131
|
-
color: 'default'
|
132
|
-
};
|
133
|
-
var _default = NewLabel;
|
134
|
-
exports.default = _default;
|
@@ -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,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _octiconsReact = require("@primer/octicons-react");
|
11
|
-
|
12
|
-
var _NewLabel = _interopRequireDefault(require("./NewLabel"));
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
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); }
|
17
|
-
|
18
|
-
const colorMap = {
|
19
|
-
issueClosed: 'done',
|
20
|
-
pullClosed: 'done',
|
21
|
-
pullMerged: 'done',
|
22
|
-
issueOpened: 'success',
|
23
|
-
pullOpened: 'success',
|
24
|
-
draft: 'primary'
|
25
|
-
};
|
26
|
-
const octiconMap = {
|
27
|
-
issueOpened: _octiconsReact.IssueOpenedIcon,
|
28
|
-
pullOpened: _octiconsReact.GitPullRequestIcon,
|
29
|
-
issueClosed: _octiconsReact.IssueClosedIcon,
|
30
|
-
pullClosed: _octiconsReact.GitPullRequestIcon,
|
31
|
-
pullMerged: _octiconsReact.GitMergeIcon,
|
32
|
-
draft: _octiconsReact.GitPullRequestIcon
|
33
|
-
};
|
34
|
-
|
35
|
-
const NewStateLabel = ({
|
36
|
-
status,
|
37
|
-
...rest
|
38
|
-
}) => /*#__PURE__*/_react.default.createElement(_NewLabel.default, _extends({
|
39
|
-
filled: true,
|
40
|
-
color: colorMap[status],
|
41
|
-
leadingVisual: octiconMap[status]
|
42
|
-
}, rest));
|
43
|
-
|
44
|
-
NewStateLabel.displayName = "NewStateLabel";
|
45
|
-
NewStateLabel.defaultProps = {
|
46
|
-
size: 'lg'
|
47
|
-
};
|
48
|
-
var _default = NewStateLabel;
|
49
|
-
exports.default = _default;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.labelVariants = exports.badgeSizes = void 0;
|
7
|
-
|
8
|
-
var _styledSystem = require("styled-system");
|
9
|
-
|
10
|
-
// TODO: consider moving to Primitives
|
11
|
-
const badgeSizes = {
|
12
|
-
sm: 20,
|
13
|
-
md: 24,
|
14
|
-
lg: 32
|
15
|
-
};
|
16
|
-
exports.badgeSizes = badgeSizes;
|
17
|
-
const labelVariants = (0, _styledSystem.variant)({
|
18
|
-
prop: 'size',
|
19
|
-
variants: {
|
20
|
-
sm: {
|
21
|
-
fontSize: 0,
|
22
|
-
height: `${badgeSizes.sm}px`,
|
23
|
-
paddingLeft: 2,
|
24
|
-
paddingRight: 2
|
25
|
-
},
|
26
|
-
md: {
|
27
|
-
fontSize: 0,
|
28
|
-
height: `${badgeSizes.md}px`,
|
29
|
-
paddingLeft: 2,
|
30
|
-
paddingRight: 2
|
31
|
-
},
|
32
|
-
lg: {
|
33
|
-
fontSize: 1,
|
34
|
-
height: `${badgeSizes.lg}px`,
|
35
|
-
paddingLeft: 3,
|
36
|
-
paddingRight: 3
|
37
|
-
}
|
38
|
-
}
|
39
|
-
});
|
40
|
-
exports.labelVariants = labelVariants;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { LabelSizeKeys } from './_newLabelStyleUtils';
|
3
|
-
export declare type LabelColorOptions = 'default' | 'primary' | 'secondary' | 'accent' | 'success' | 'attention' | 'severe' | 'danger' | 'done' | 'sponsors';
|
4
|
-
interface Props {
|
5
|
-
color?: LabelColorOptions;
|
6
|
-
size?: LabelSizeKeys;
|
7
|
-
filled?: boolean;
|
8
|
-
leadingVisual?: React.ComponentType<any>;
|
9
|
-
}
|
10
|
-
declare const NewLabel: React.FC<Props>;
|
11
|
-
export default NewLabel;
|
@@ -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
|
-
});
|