@primer/components 0.0.0-202192711181 → 0.0.0-2021927182528
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 +16 -4
- package/dist/browser.esm.js +605 -602
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +178 -175
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +6 -0
- package/lib/ActionList/Item.js +5 -1
- package/lib/TextInputWithTokens.js +17 -10
- package/lib/Token/Token.js +13 -2
- package/lib/Token/TokenBase.js +0 -4
- package/lib/Token/_RemoveTokenButton.js +15 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -8
- package/lib/sx.d.ts +0 -2
- package/lib/sx.js +0 -8
- package/lib-esm/ActionList/Item.d.ts +6 -0
- package/lib-esm/ActionList/Item.js +5 -1
- package/lib-esm/TextInputWithTokens.js +17 -10
- package/lib-esm/Token/Token.js +13 -2
- package/lib-esm/Token/TokenBase.js +0 -4
- package/lib-esm/Token/_RemoveTokenButton.js +11 -2
- package/lib-esm/index.d.ts +0 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/sx.d.ts +0 -2
- package/lib-esm/sx.js +1 -3
- package/package.json +6 -6
- package/lib/ActionList2/Description.d.ts +0 -6
- package/lib/ActionList2/Description.js +0 -53
- package/lib/ActionList2/Divider.d.ts +0 -8
- package/lib/ActionList2/Divider.js +0 -42
- package/lib/ActionList2/Group.d.ts +0 -8
- package/lib/ActionList2/Group.js +0 -39
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -48
- package/lib/ActionList2/Item.js +0 -205
- package/lib/ActionList2/List.d.ts +0 -12
- package/lib/ActionList2/List.js +0 -55
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -67
- package/lib/ActionList2/Visuals.d.ts +0 -11
- package/lib/ActionList2/Visuals.js +0 -90
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -26
- package/lib/ActionList2/index.js +0 -36
- package/lib/utils/create-slots.d.ts +0 -17
- package/lib/utils/create-slots.js +0 -105
- package/lib/utils/use-force-update.d.ts +0 -1
- package/lib/utils/use-force-update.js +0 -19
- package/lib-esm/ActionList2/Description.d.ts +0 -6
- package/lib-esm/ActionList2/Description.js +0 -37
- package/lib-esm/ActionList2/Divider.d.ts +0 -8
- package/lib-esm/ActionList2/Divider.js +0 -30
- package/lib-esm/ActionList2/Group.d.ts +0 -8
- package/lib-esm/ActionList2/Group.js +0 -29
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -48
- package/lib-esm/ActionList2/Item.js +0 -198
- package/lib-esm/ActionList2/List.d.ts +0 -12
- package/lib-esm/ActionList2/List.js +0 -37
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -50
- package/lib-esm/ActionList2/Visuals.d.ts +0 -11
- package/lib-esm/ActionList2/Visuals.js +0 -68
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -26
- package/lib-esm/ActionList2/index.js +0 -23
- package/lib-esm/utils/create-slots.d.ts +0 -17
- package/lib-esm/utils/create-slots.js +0 -84
- package/lib-esm/utils/use-force-update.d.ts +0 -1
- package/lib-esm/utils/use-force-update.js +0 -6
package/lib/ActionList/Item.d.ts
CHANGED
@@ -28,13 +28,19 @@ export interface ItemProps extends SxProp {
|
|
28
28
|
*/
|
29
29
|
leadingVisual?: React.FunctionComponent<IconProps>;
|
30
30
|
/**
|
31
|
+
* @deprecated Use `trailingVisual` instead
|
31
32
|
* Icon (or similar) positioned after `Item` text.
|
32
33
|
*/
|
33
34
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
34
35
|
/**
|
36
|
+
* @deprecated Use `trailingVisual` instead
|
35
37
|
* Text positioned after `Item` text and optional trailing icon.
|
36
38
|
*/
|
37
39
|
trailingText?: string;
|
40
|
+
/**
|
41
|
+
* Icon or text positioned after `Item` text.
|
42
|
+
*/
|
43
|
+
trailingVisual?: React.ReactNode;
|
38
44
|
/**
|
39
45
|
* Style variations associated with various `Item` types.
|
40
46
|
*
|
package/lib/ActionList/Item.js
CHANGED
@@ -187,6 +187,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((itemProps, ref) => {
|
|
187
187
|
selectionVariant,
|
188
188
|
leadingVisual: LeadingVisual,
|
189
189
|
trailingIcon: TrailingIcon,
|
190
|
+
trailingVisual: TrailingVisual,
|
190
191
|
trailingText,
|
191
192
|
variant = 'default',
|
192
193
|
showDivider,
|
@@ -278,7 +279,10 @@ const Item = /*#__PURE__*/_react.default.forwardRef((itemProps, ref) => {
|
|
278
279
|
title: description,
|
279
280
|
inline: true,
|
280
281
|
maxWidth: "100%"
|
281
|
-
}, description)) : null),
|
282
|
+
}, description)) : null), TrailingVisual ? /*#__PURE__*/_react.default.createElement(TrailingContent, {
|
283
|
+
variant: variant,
|
284
|
+
disabled: disabled
|
285
|
+
}, typeof TrailingVisual === 'function' ? /*#__PURE__*/_react.default.createElement(TrailingVisual, null) : TrailingVisual) : TrailingIcon || trailingText ? /*#__PURE__*/_react.default.createElement(TrailingContent, {
|
282
286
|
variant: variant,
|
283
287
|
disabled: disabled
|
284
288
|
}, trailingText, TrailingIcon && /*#__PURE__*/_react.default.createElement(TrailingIcon, null)) : null));
|
@@ -175,15 +175,7 @@ function TextInputWithTokensInnerComponent({
|
|
175
175
|
minWidth: minWidthProp,
|
176
176
|
maxWidth: maxWidthProp,
|
177
177
|
variant: variantProp,
|
178
|
-
|
179
|
-
sx: {
|
180
|
-
alignItems: 'center',
|
181
|
-
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
182
|
-
gap: '0.25rem',
|
183
|
-
'> *': {
|
184
|
-
flexShrink: 0
|
185
|
-
},
|
186
|
-
...(block ? {
|
178
|
+
sx: { ...(block ? {
|
187
179
|
display: 'flex',
|
188
180
|
width: '100%'
|
189
181
|
} : {}),
|
@@ -196,6 +188,21 @@ function TextInputWithTokensInnerComponent({
|
|
196
188
|
} : {}),
|
197
189
|
...sxProp
|
198
190
|
}
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
192
|
+
ref: containerRef,
|
193
|
+
display: "flex",
|
194
|
+
sx: {
|
195
|
+
alignItems: 'center',
|
196
|
+
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
197
|
+
marginLeft: '-0.25rem',
|
198
|
+
marginBottom: '-0.25rem',
|
199
|
+
flexGrow: 1,
|
200
|
+
'> *': {
|
201
|
+
flexShrink: 0,
|
202
|
+
marginLeft: '0.25rem',
|
203
|
+
marginBottom: '0.25rem'
|
204
|
+
}
|
205
|
+
}
|
199
206
|
}, /*#__PURE__*/_react.default.createElement(_Box.default, {
|
200
207
|
sx: {
|
201
208
|
order: 1,
|
@@ -227,7 +234,7 @@ function TextInputWithTokensInnerComponent({
|
|
227
234
|
hideRemoveButton: hideTokenRemoveButtons,
|
228
235
|
size: size,
|
229
236
|
tabIndex: 0
|
230
|
-
}, tokenRest))) : null);
|
237
|
+
}, tokenRest))) : null));
|
231
238
|
}
|
232
239
|
|
233
240
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|
package/lib/Token/Token.js
CHANGED
@@ -39,7 +39,16 @@ const DefaultTokenStyled = (0, _styledComponents.default)(_TokenBase.default).wi
|
|
39
39
|
const LeadingVisualContainer = (0, _styledComponents.default)('span').withConfig({
|
40
40
|
displayName: "Token__LeadingVisualContainer",
|
41
41
|
componentId: "sc-1dg52pw-1"
|
42
|
-
})(["flex-shrink:0;line-height:0;"]
|
42
|
+
})(["flex-shrink:0;line-height:0;", ""], props => {
|
43
|
+
switch (props.size) {
|
44
|
+
case 'large':
|
45
|
+
case 'extralarge':
|
46
|
+
return (0, _styledComponents.css)(["margin-right:", ";"], (0, _constants.get)('space.2'));
|
47
|
+
|
48
|
+
default:
|
49
|
+
return (0, _styledComponents.css)(["margin-right:", ";"], (0, _constants.get)('space.1'));
|
50
|
+
}
|
51
|
+
});
|
43
52
|
const Token = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
44
53
|
const {
|
45
54
|
as,
|
@@ -74,7 +83,9 @@ const Token = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
|
74
83
|
isTokenInteractive: (0, _TokenBase.isTokenInteractive)(props)
|
75
84
|
}, !hasMultipleActionTargets ? interactiveTokenProps : {}, rest, {
|
76
85
|
ref: forwardedRef
|
77
|
-
}), LeadingVisual ? /*#__PURE__*/_react.default.createElement(LeadingVisualContainer,
|
86
|
+
}), LeadingVisual ? /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, {
|
87
|
+
size: size
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(LeadingVisual, null)) : null, /*#__PURE__*/_react.default.createElement(_TokenTextContainer.default, hasMultipleActionTargets ? interactiveTokenProps : {}, text), !hideRemoveButton && onRemove ? /*#__PURE__*/_react.default.createElement(_RemoveTokenButton.default, {
|
78
89
|
borderOffset: tokenBorderWidthPx,
|
79
90
|
onClick: onRemoveClick,
|
80
91
|
size: size,
|
package/lib/Token/TokenBase.js
CHANGED
@@ -38,7 +38,6 @@ const variants = (0, _styledSystem.variant)({
|
|
38
38
|
variants: {
|
39
39
|
small: {
|
40
40
|
fontSize: 0,
|
41
|
-
gap: 1,
|
42
41
|
height: tokenSizes.small,
|
43
42
|
// without setting lineHeight to match height, the "x" appears vertically mis-aligned
|
44
43
|
lineHeight: tokenSizes.small,
|
@@ -51,7 +50,6 @@ const variants = (0, _styledSystem.variant)({
|
|
51
50
|
},
|
52
51
|
medium: {
|
53
52
|
fontSize: 0,
|
54
|
-
gap: 1,
|
55
53
|
height: tokenSizes.medium,
|
56
54
|
lineHeight: tokenSizes.medium,
|
57
55
|
paddingLeft: 2,
|
@@ -61,7 +59,6 @@ const variants = (0, _styledSystem.variant)({
|
|
61
59
|
},
|
62
60
|
large: {
|
63
61
|
fontSize: 0,
|
64
|
-
gap: 2,
|
65
62
|
height: tokenSizes.large,
|
66
63
|
lineHeight: tokenSizes.large,
|
67
64
|
paddingLeft: 2,
|
@@ -71,7 +68,6 @@ const variants = (0, _styledSystem.variant)({
|
|
71
68
|
},
|
72
69
|
extralarge: {
|
73
70
|
fontSize: 1,
|
74
|
-
gap: 2,
|
75
71
|
height: tokenSizes.extralarge,
|
76
72
|
lineHeight: tokenSizes.extralarge,
|
77
73
|
paddingLeft: 3,
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
10
10
|
var _octiconsReact = require("@primer/octicons-react");
|
11
11
|
|
12
|
-
var _styledComponents =
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
13
13
|
|
14
14
|
var _styledSystem = require("styled-system");
|
15
15
|
|
@@ -19,6 +19,10 @@ var _sx = _interopRequireDefault(require("../sx"));
|
|
19
19
|
|
20
20
|
var _TokenBase = require("./TokenBase");
|
21
21
|
|
22
|
+
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); }
|
23
|
+
|
24
|
+
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; }
|
25
|
+
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
27
|
|
24
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); }
|
@@ -50,7 +54,16 @@ const getTokenButtonIconSize = size => parseInt(_TokenBase.tokenSizes[size || _T
|
|
50
54
|
const StyledTokenButton = _styledComponents.default.span.withConfig({
|
51
55
|
displayName: "_RemoveTokenButton__StyledTokenButton",
|
52
56
|
componentId: "sc-14lvcw1-0"
|
53
|
-
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px
|
57
|
+
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px;", " &:hover,&:focus{background-color:", ";}&:active{background-color:", ";}", " ", ""], props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`, props => {
|
58
|
+
switch (props.size) {
|
59
|
+
case 'large':
|
60
|
+
case 'extralarge':
|
61
|
+
return (0, _styledComponents.css)(["margin-left:", ";"], (0, _constants.get)('space.2'));
|
62
|
+
|
63
|
+
default:
|
64
|
+
return (0, _styledComponents.css)(["margin-left:", ";"], (0, _constants.get)('space.1'));
|
65
|
+
}
|
66
|
+
}, (0, _constants.get)('colors.neutral.muted'), (0, _constants.get)('colors.neutral.subtle'), variants, _sx.default);
|
54
67
|
|
55
68
|
const RemoveTokenButton = ({
|
56
69
|
'aria-label': ariaLabel,
|
package/lib/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib/index.js
CHANGED
@@ -147,12 +147,6 @@ Object.defineProperty(exports, "ActionList", {
|
|
147
147
|
return _ActionList.ActionList;
|
148
148
|
}
|
149
149
|
});
|
150
|
-
Object.defineProperty(exports, "ActionList2", {
|
151
|
-
enumerable: true,
|
152
|
-
get: function () {
|
153
|
-
return _ActionList2.ActionList;
|
154
|
-
}
|
155
|
-
});
|
156
150
|
Object.defineProperty(exports, "ActionMenu", {
|
157
151
|
enumerable: true,
|
158
152
|
get: function () {
|
@@ -542,8 +536,6 @@ var _ConfirmationDialog = require("./Dialog/ConfirmationDialog");
|
|
542
536
|
|
543
537
|
var _ActionList = require("./ActionList");
|
544
538
|
|
545
|
-
var _ActionList2 = require("./ActionList2");
|
546
|
-
|
547
539
|
var _ActionMenu = require("./ActionMenu");
|
548
540
|
|
549
541
|
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
package/lib/sx.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { SystemStyleObject } from '@styled-system/css';
|
2
|
-
import merge from 'deepmerge';
|
3
2
|
export interface SxProp {
|
4
3
|
sx?: SystemStyleObject;
|
5
4
|
}
|
6
5
|
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
7
6
|
export default sx;
|
8
|
-
export { merge };
|
package/lib/sx.js
CHANGED
@@ -3,18 +3,10 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "merge", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _deepmerge.default;
|
10
|
-
}
|
11
|
-
});
|
12
6
|
exports.default = void 0;
|
13
7
|
|
14
8
|
var _css = _interopRequireDefault(require("@styled-system/css"));
|
15
9
|
|
16
|
-
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
17
|
-
|
18
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
11
|
|
20
12
|
const sx = props => (0, _css.default)(props.sx);
|
@@ -28,13 +28,19 @@ export interface ItemProps extends SxProp {
|
|
28
28
|
*/
|
29
29
|
leadingVisual?: React.FunctionComponent<IconProps>;
|
30
30
|
/**
|
31
|
+
* @deprecated Use `trailingVisual` instead
|
31
32
|
* Icon (or similar) positioned after `Item` text.
|
32
33
|
*/
|
33
34
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
34
35
|
/**
|
36
|
+
* @deprecated Use `trailingVisual` instead
|
35
37
|
* Text positioned after `Item` text and optional trailing icon.
|
36
38
|
*/
|
37
39
|
trailingText?: string;
|
40
|
+
/**
|
41
|
+
* Icon or text positioned after `Item` text.
|
42
|
+
*/
|
43
|
+
trailingVisual?: React.ReactNode;
|
38
44
|
/**
|
39
45
|
* Style variations associated with various `Item` types.
|
40
46
|
*
|
@@ -154,6 +154,7 @@ export const Item = /*#__PURE__*/React.forwardRef((itemProps, ref) => {
|
|
154
154
|
selectionVariant,
|
155
155
|
leadingVisual: LeadingVisual,
|
156
156
|
trailingIcon: TrailingIcon,
|
157
|
+
trailingVisual: TrailingVisual,
|
157
158
|
trailingText,
|
158
159
|
variant = 'default',
|
159
160
|
showDivider,
|
@@ -245,7 +246,10 @@ export const Item = /*#__PURE__*/React.forwardRef((itemProps, ref) => {
|
|
245
246
|
title: description,
|
246
247
|
inline: true,
|
247
248
|
maxWidth: "100%"
|
248
|
-
}, description)) : null),
|
249
|
+
}, description)) : null), TrailingVisual ? /*#__PURE__*/React.createElement(TrailingContent, {
|
250
|
+
variant: variant,
|
251
|
+
disabled: disabled
|
252
|
+
}, typeof TrailingVisual === 'function' ? /*#__PURE__*/React.createElement(TrailingVisual, null) : TrailingVisual) : TrailingIcon || trailingText ? /*#__PURE__*/React.createElement(TrailingContent, {
|
249
253
|
variant: variant,
|
250
254
|
disabled: disabled
|
251
255
|
}, trailingText, TrailingIcon && /*#__PURE__*/React.createElement(TrailingIcon, null)) : null));
|
@@ -153,15 +153,7 @@ function TextInputWithTokensInnerComponent({
|
|
153
153
|
minWidth: minWidthProp,
|
154
154
|
maxWidth: maxWidthProp,
|
155
155
|
variant: variantProp,
|
156
|
-
|
157
|
-
sx: {
|
158
|
-
alignItems: 'center',
|
159
|
-
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
160
|
-
gap: '0.25rem',
|
161
|
-
'> *': {
|
162
|
-
flexShrink: 0
|
163
|
-
},
|
164
|
-
...(block ? {
|
156
|
+
sx: { ...(block ? {
|
165
157
|
display: 'flex',
|
166
158
|
width: '100%'
|
167
159
|
} : {}),
|
@@ -174,6 +166,21 @@ function TextInputWithTokensInnerComponent({
|
|
174
166
|
} : {}),
|
175
167
|
...sxProp
|
176
168
|
}
|
169
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
170
|
+
ref: containerRef,
|
171
|
+
display: "flex",
|
172
|
+
sx: {
|
173
|
+
alignItems: 'center',
|
174
|
+
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
175
|
+
marginLeft: '-0.25rem',
|
176
|
+
marginBottom: '-0.25rem',
|
177
|
+
flexGrow: 1,
|
178
|
+
'> *': {
|
179
|
+
flexShrink: 0,
|
180
|
+
marginLeft: '0.25rem',
|
181
|
+
marginBottom: '0.25rem'
|
182
|
+
}
|
183
|
+
}
|
177
184
|
}, /*#__PURE__*/React.createElement(Box, {
|
178
185
|
sx: {
|
179
186
|
order: 1,
|
@@ -205,7 +212,7 @@ function TextInputWithTokensInnerComponent({
|
|
205
212
|
hideRemoveButton: hideTokenRemoveButtons,
|
206
213
|
size: size,
|
207
214
|
tabIndex: 0
|
208
|
-
}, tokenRest))) : null);
|
215
|
+
}, tokenRest))) : null));
|
209
216
|
}
|
210
217
|
|
211
218
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|
package/lib-esm/Token/Token.js
CHANGED
@@ -19,7 +19,16 @@ const DefaultTokenStyled = styled(TokenBase).withConfig({
|
|
19
19
|
const LeadingVisualContainer = styled('span').withConfig({
|
20
20
|
displayName: "Token__LeadingVisualContainer",
|
21
21
|
componentId: "sc-1dg52pw-1"
|
22
|
-
})(["flex-shrink:0;line-height:0;"]
|
22
|
+
})(["flex-shrink:0;line-height:0;", ""], props => {
|
23
|
+
switch (props.size) {
|
24
|
+
case 'large':
|
25
|
+
case 'extralarge':
|
26
|
+
return css(["margin-right:", ";"], get('space.2'));
|
27
|
+
|
28
|
+
default:
|
29
|
+
return css(["margin-right:", ";"], get('space.1'));
|
30
|
+
}
|
31
|
+
});
|
23
32
|
const Token = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
24
33
|
const {
|
25
34
|
as,
|
@@ -54,7 +63,9 @@ const Token = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
54
63
|
isTokenInteractive: isTokenInteractive(props)
|
55
64
|
}, !hasMultipleActionTargets ? interactiveTokenProps : {}, rest, {
|
56
65
|
ref: forwardedRef
|
57
|
-
}), LeadingVisual ? /*#__PURE__*/React.createElement(LeadingVisualContainer,
|
66
|
+
}), LeadingVisual ? /*#__PURE__*/React.createElement(LeadingVisualContainer, {
|
67
|
+
size: size
|
68
|
+
}, /*#__PURE__*/React.createElement(LeadingVisual, null)) : null, /*#__PURE__*/React.createElement(TokenTextContainer, hasMultipleActionTargets ? interactiveTokenProps : {}, text), !hideRemoveButton && onRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
|
58
69
|
borderOffset: tokenBorderWidthPx,
|
59
70
|
onClick: onRemoveClick,
|
60
71
|
size: size,
|
@@ -20,7 +20,6 @@ const variants = variant({
|
|
20
20
|
variants: {
|
21
21
|
small: {
|
22
22
|
fontSize: 0,
|
23
|
-
gap: 1,
|
24
23
|
height: tokenSizes.small,
|
25
24
|
// without setting lineHeight to match height, the "x" appears vertically mis-aligned
|
26
25
|
lineHeight: tokenSizes.small,
|
@@ -33,7 +32,6 @@ const variants = variant({
|
|
33
32
|
},
|
34
33
|
medium: {
|
35
34
|
fontSize: 0,
|
36
|
-
gap: 1,
|
37
35
|
height: tokenSizes.medium,
|
38
36
|
lineHeight: tokenSizes.medium,
|
39
37
|
paddingLeft: 2,
|
@@ -43,7 +41,6 @@ const variants = variant({
|
|
43
41
|
},
|
44
42
|
large: {
|
45
43
|
fontSize: 0,
|
46
|
-
gap: 2,
|
47
44
|
height: tokenSizes.large,
|
48
45
|
lineHeight: tokenSizes.large,
|
49
46
|
paddingLeft: 2,
|
@@ -53,7 +50,6 @@ const variants = variant({
|
|
53
50
|
},
|
54
51
|
extralarge: {
|
55
52
|
fontSize: 1,
|
56
|
-
gap: 2,
|
57
53
|
height: tokenSizes.extralarge,
|
58
54
|
lineHeight: tokenSizes.extralarge,
|
59
55
|
paddingLeft: 3,
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
2
2
|
|
3
3
|
import React from 'react';
|
4
4
|
import { XIcon } from '@primer/octicons-react';
|
5
|
-
import styled from 'styled-components';
|
5
|
+
import styled, { css } from 'styled-components';
|
6
6
|
import { variant } from 'styled-system';
|
7
7
|
import { get } from '../constants';
|
8
8
|
import sx from '../sx';
|
@@ -34,7 +34,16 @@ const getTokenButtonIconSize = size => parseInt(tokenSizes[size || defaultTokenS
|
|
34
34
|
const StyledTokenButton = styled.span.withConfig({
|
35
35
|
displayName: "_RemoveTokenButton__StyledTokenButton",
|
36
36
|
componentId: "sc-14lvcw1-0"
|
37
|
-
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px
|
37
|
+
})(["background-color:transparent;font-family:inherit;color:currentColor;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;user-select:none;appearance:none;text-decoration:none;padding:0;transform:", ";align-self:baseline;border:0;border-radius:999px;", " &:hover,&:focus{background-color:", ";}&:active{background-color:", ";}", " ", ""], props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`, props => {
|
38
|
+
switch (props.size) {
|
39
|
+
case 'large':
|
40
|
+
case 'extralarge':
|
41
|
+
return css(["margin-left:", ";"], get('space.2'));
|
42
|
+
|
43
|
+
default:
|
44
|
+
return css(["margin-left:", ";"], get('space.1'));
|
45
|
+
}
|
46
|
+
}, get('colors.neutral.muted'), get('colors.neutral.subtle'), variants, sx);
|
38
47
|
|
39
48
|
const RemoveTokenButton = ({
|
40
49
|
'aria-label': ariaLabel,
|
package/lib-esm/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib-esm/index.js
CHANGED
@@ -18,7 +18,6 @@ export { useOverlay } from './hooks/useOverlay';
|
|
18
18
|
export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
|
19
19
|
|
20
20
|
export { ActionList } from './ActionList';
|
21
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
22
21
|
export { ActionMenu } from './ActionMenu';
|
23
22
|
export { default as Autocomplete } from './Autocomplete';
|
24
23
|
export { default as Avatar } from './Avatar';
|
package/lib-esm/sx.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { SystemStyleObject } from '@styled-system/css';
|
2
|
-
import merge from 'deepmerge';
|
3
2
|
export interface SxProp {
|
4
3
|
sx?: SystemStyleObject;
|
5
4
|
}
|
6
5
|
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
7
6
|
export default sx;
|
8
|
-
export { merge };
|
package/lib-esm/sx.js
CHANGED
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-2021927182528",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -76,11 +76,11 @@
|
|
76
76
|
"@rollup/plugin-commonjs": "19.0.2",
|
77
77
|
"@rollup/plugin-node-resolve": "13.0.5",
|
78
78
|
"@size-limit/preset-big-lib": "5.0.2",
|
79
|
-
"@storybook/addon-a11y": "6.3.
|
80
|
-
"@storybook/addon-actions": "^6.
|
81
|
-
"@storybook/addon-essentials": "6.
|
82
|
-
"@storybook/addon-links": "^6.
|
83
|
-
"@storybook/react": "6.3.
|
79
|
+
"@storybook/addon-a11y": "6.3.12",
|
80
|
+
"@storybook/addon-actions": "^6.3.12",
|
81
|
+
"@storybook/addon-essentials": "6.3.12",
|
82
|
+
"@storybook/addon-links": "^6.3.12",
|
83
|
+
"@storybook/react": "6.3.12",
|
84
84
|
"@testing-library/dom": "7.31.2",
|
85
85
|
"@testing-library/react": "11.2.7",
|
86
86
|
"@testing-library/react-hooks": "7.0.2",
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Description = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _sx = require("../sx");
|
13
|
-
|
14
|
-
var _Truncate = _interopRequireDefault(require("../Truncate"));
|
15
|
-
|
16
|
-
var _Item = require("./Item");
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
const Description = ({
|
21
|
-
variant = 'inline',
|
22
|
-
sx = {},
|
23
|
-
...props
|
24
|
-
}) => {
|
25
|
-
const styles = {
|
26
|
-
color: 'fg.muted',
|
27
|
-
fontSize: 0,
|
28
|
-
lineHeight: '16px',
|
29
|
-
flexGrow: 1,
|
30
|
-
flexBasis: 0,
|
31
|
-
minWidth: 0,
|
32
|
-
marginLeft: variant === 'block' ? 0 : 2
|
33
|
-
};
|
34
|
-
return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
|
35
|
-
name: variant === 'block' ? 'BlockDescription' : 'InlineDescription'
|
36
|
-
}, ({
|
37
|
-
blockDescriptionId,
|
38
|
-
inlineDescriptionId
|
39
|
-
}) => variant === 'block' ? /*#__PURE__*/_react.default.createElement(_Box.default, {
|
40
|
-
as: "span",
|
41
|
-
sx: (0, _sx.merge)(styles, sx),
|
42
|
-
id: blockDescriptionId
|
43
|
-
}, props.children) : /*#__PURE__*/_react.default.createElement(_Truncate.default, {
|
44
|
-
id: inlineDescriptionId,
|
45
|
-
sx: (0, _sx.merge)(styles, sx),
|
46
|
-
title: props.children,
|
47
|
-
inline: true,
|
48
|
-
maxWidth: "100%"
|
49
|
-
}, props.children));
|
50
|
-
};
|
51
|
-
|
52
|
-
exports.Description = Description;
|
53
|
-
Description.displayName = "Description";
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Divider = Divider;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _constants = require("../constants");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
18
|
-
*/
|
19
|
-
function Divider() {
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, {
|
21
|
-
as: "hr",
|
22
|
-
sx: {
|
23
|
-
border: 'none',
|
24
|
-
// override browser styles
|
25
|
-
height: 1,
|
26
|
-
backgroundColor: 'border.muted',
|
27
|
-
marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
|
28
|
-
marginBottom: 2
|
29
|
-
},
|
30
|
-
"data-component": "ActionList.Divider"
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
Divider.displayName = "Divider";
|
35
|
-
|
36
|
-
/**
|
37
|
-
* `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
|
38
|
-
* so it can be used inline in an `ActionList`’s `items` prop.
|
39
|
-
* In other words, `items={[ActionList.Divider]}` is supported as a concise
|
40
|
-
* alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
|
41
|
-
*/
|
42
|
-
Divider.renderItem = Divider;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* show item dividers
|
3
|
-
*/
|
4
|
-
/// <reference types="react" />
|
5
|
-
import { SxProp } from '../sx';
|
6
|
-
import { HeaderProps } from './Header';
|
7
|
-
export declare type GroupProps = HeaderProps & SxProp;
|
8
|
-
export declare function Group({ title, variant, auxiliaryText, sx, ...props }: GroupProps): JSX.Element;
|
package/lib/ActionList2/Group.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Group = Group;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _Header = require("./Header");
|
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
|
-
function Group({
|
19
|
-
title,
|
20
|
-
variant,
|
21
|
-
auxiliaryText,
|
22
|
-
sx = {},
|
23
|
-
...props
|
24
|
-
}) {
|
25
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
|
26
|
-
sx: {
|
27
|
-
'&:not(:first-child)': {
|
28
|
-
marginTop: 2
|
29
|
-
},
|
30
|
-
...sx
|
31
|
-
}
|
32
|
-
}, props), title && /*#__PURE__*/_react.default.createElement(_Header.Header, {
|
33
|
-
title: title,
|
34
|
-
variant: variant,
|
35
|
-
auxiliaryText: auxiliaryText
|
36
|
-
}), props.children);
|
37
|
-
}
|
38
|
-
|
39
|
-
Group.displayName = "Group";
|