@primer/components 0.0.0-202195162314 → 0.0.0-202195163539
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 +106 -120
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +93 -107
- package/dist/browser.umd.js.map +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +8 -2
- package/lib/TextInput.d.ts +6 -3
- package/lib/TextInput.js +9 -10
- package/lib/TextInputWithTokens.d.ts +43 -0
- package/lib/TextInputWithTokens.js +236 -0
- package/lib/Token/Token.d.ts +2 -2
- package/lib/Token/Token.js +22 -34
- package/lib/Token/TokenBase.d.ts +3 -3
- package/lib/Token/TokenBase.js +20 -36
- package/lib/Token/TokenLabel.d.ts +14 -0
- package/lib/Token/{IssueLabelToken.js → TokenLabel.js} +28 -35
- package/lib/Token/{ProfileToken.d.ts → TokenProfile.d.ts} +3 -3
- package/lib/Token/{ProfileToken.js → TokenProfile.js} +7 -7
- package/lib/Token/_RemoveTokenButton.d.ts +2 -11
- package/lib/Token/_RemoveTokenButton.js +22 -53
- package/lib/Token/_tokenButtonUtils.d.ts +10 -0
- package/lib/Token/_tokenButtonUtils.js +42 -0
- package/lib/Token/index.d.ts +2 -2
- package/lib/Token/index.js +6 -6
- package/lib/_UnstyledTextInput.d.ts +2 -0
- package/lib/_UnstyledTextInput.js +20 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +12 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +8 -2
- package/lib-esm/TextInput.d.ts +6 -3
- package/lib-esm/TextInput.js +8 -9
- package/lib-esm/TextInputWithTokens.d.ts +43 -0
- package/lib-esm/TextInputWithTokens.js +209 -0
- package/lib-esm/Token/Token.d.ts +2 -2
- package/lib-esm/Token/Token.js +22 -33
- package/lib-esm/Token/TokenBase.d.ts +3 -3
- package/lib-esm/Token/TokenBase.js +20 -36
- package/lib-esm/Token/TokenLabel.d.ts +14 -0
- package/lib-esm/Token/{IssueLabelToken.js → TokenLabel.js} +28 -34
- package/lib-esm/Token/{ProfileToken.d.ts → TokenProfile.d.ts} +3 -3
- package/lib-esm/Token/{ProfileToken.js → TokenProfile.js} +7 -7
- package/lib-esm/Token/_RemoveTokenButton.d.ts +2 -11
- package/lib-esm/Token/_RemoveTokenButton.js +22 -52
- package/lib-esm/Token/_tokenButtonUtils.d.ts +10 -0
- package/lib-esm/Token/_tokenButtonUtils.js +26 -0
- package/lib-esm/Token/index.d.ts +2 -2
- package/lib-esm/Token/index.js +2 -2
- package/lib-esm/_UnstyledTextInput.d.ts +2 -0
- package/lib-esm/_UnstyledTextInput.js +7 -0
- package/lib-esm/index.d.ts +2 -1
- package/lib-esm/index.js +2 -1
- package/package.json +1 -1
- package/lib/Token/IssueLabelToken.d.ts +0 -14
- package/lib/Token/_TokenTextContainer.d.ts +0 -3
- package/lib/Token/_TokenTextContainer.js +0 -34
- package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
- package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
- package/lib-esm/Token/_TokenTextContainer.js +0 -21
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TokenBaseProps } from './TokenBase';
|
3
|
+
export interface TokenLabelProps extends TokenBaseProps {
|
4
|
+
/**
|
5
|
+
* The color that corresponds to the label
|
6
|
+
*/
|
7
|
+
fillColor?: string;
|
8
|
+
/**
|
9
|
+
* Whether the remove button should be rendered in the token
|
10
|
+
*/
|
11
|
+
hideRemoveButton?: boolean;
|
12
|
+
}
|
13
|
+
declare const TokenLabel: React.ForwardRefExoticComponent<Pick<TokenLabelProps, "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "list" | "default" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "step" | "wrap" | "open" | "max" | "media" | "method" | "min" | "target" | "crossOrigin" | "href" | "classID" | "useMap" | "wmode" | "download" | "hrefLang" | "rel" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "as" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "variant" | "handleRemove" | "isSelected" | "hideRemoveButton" | "fillColor"> & React.RefAttributes<HTMLElement>>;
|
14
|
+
export default TokenLabel;
|
@@ -6,7 +6,6 @@ import TokenBase, { isTokenInteractive } from './TokenBase';
|
|
6
6
|
import RemoveTokenButton from './_RemoveTokenButton';
|
7
7
|
import tinycolor from 'tinycolor2';
|
8
8
|
import { useTheme } from '../ThemeProvider';
|
9
|
-
import TokenTextContainer from './_TokenTextContainer';
|
10
9
|
const colorModeConfigs = {
|
11
10
|
dark: {
|
12
11
|
bgOpacity: 0.18,
|
@@ -22,34 +21,31 @@ const colorModeConfigs = {
|
|
22
21
|
}
|
23
22
|
};
|
24
23
|
const tokenBorderWidthPx = 1;
|
25
|
-
const
|
26
|
-
displayName: "
|
27
|
-
componentId: "
|
24
|
+
const StyledTokenLabel = styled(TokenBase).withConfig({
|
25
|
+
displayName: "TokenLabel__StyledTokenLabel",
|
26
|
+
componentId: "sc-1bdmgzv-0"
|
28
27
|
})(["background-color:", ";border-width:", "px;border-style:solid;border-color:", ";color:", ";padding-right:", ";position:relative;", ""], props => props.bgColor, tokenBorderWidthPx, props => props.borderColor, props => props.textColor, props => !props.hideRemoveButton ? 0 : undefined, props => {
|
29
28
|
if (props.isSelected) {
|
30
29
|
return css(["&:after{content:'';position:absolute;z-index:1;top:-2px;right:-2px;bottom:-2px;left:-2px;display:block;pointer-events:none;box-shadow:0 0 0 2px ", ";border-radius:999px;}"], props.bgColor);
|
31
30
|
}
|
32
31
|
});
|
33
|
-
const
|
32
|
+
const TokenTextContainer = styled('span').withConfig({
|
33
|
+
displayName: "TokenLabel__TokenTextContainer",
|
34
|
+
componentId: "sc-1bdmgzv-1"
|
35
|
+
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
36
|
+
const TokenLabel = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
34
37
|
const {
|
35
38
|
as,
|
36
39
|
fillColor,
|
37
|
-
|
40
|
+
handleRemove,
|
38
41
|
id,
|
39
42
|
isSelected,
|
40
43
|
ref,
|
41
44
|
text,
|
42
|
-
|
45
|
+
variant,
|
43
46
|
hideRemoveButton,
|
44
|
-
href,
|
45
|
-
onClick,
|
46
47
|
...rest
|
47
48
|
} = props;
|
48
|
-
const interactiveTokenProps = {
|
49
|
-
as,
|
50
|
-
href,
|
51
|
-
onClick
|
52
|
-
};
|
53
49
|
const {
|
54
50
|
colorScheme
|
55
51
|
} = useTheme();
|
@@ -79,49 +75,47 @@ const IssueLabelToken = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
79
75
|
}
|
80
76
|
|
81
77
|
if (isSelected) {
|
82
|
-
bgColor = isFillColorDark ? tinycolor(fillColor).lighten(10).toString()
|
78
|
+
bgColor = isFillColorDark ? tinycolor(fillColor).lighten(10).toString() // TODO: darken more than 10 if the fillColor is really bright and doesn't darken well
|
83
79
|
// Examples of colors that don't darken well:
|
84
80
|
// - #a2eeef
|
85
81
|
// - #ffd78e
|
86
82
|
// - #a4f287
|
87
|
-
tinycolor(fillColor).darken(10).toString();
|
83
|
+
: tinycolor(fillColor).darken(10).toString();
|
88
84
|
}
|
89
85
|
}
|
90
86
|
|
91
|
-
const hasMultipleActionTargets = isTokenInteractive(props) && Boolean(
|
87
|
+
const hasMultipleActionTargets = isTokenInteractive(props) && Boolean(handleRemove) && !hideRemoveButton;
|
92
88
|
|
93
|
-
const
|
89
|
+
const handleRemoveClick = e => {
|
94
90
|
e.stopPropagation();
|
95
|
-
|
91
|
+
handleRemove && handleRemove();
|
96
92
|
};
|
97
93
|
|
98
|
-
return /*#__PURE__*/React.createElement(
|
94
|
+
return /*#__PURE__*/React.createElement(StyledTokenLabel // specific to labels
|
99
95
|
, _extends({
|
100
96
|
fillColor: fillColor,
|
101
97
|
bgColor: bgColor,
|
102
98
|
borderColor: borderColor,
|
103
99
|
textColor: textColor // common token props
|
104
100
|
,
|
105
|
-
|
106
|
-
|
101
|
+
as: as,
|
102
|
+
hideRemoveButton: hideRemoveButton || !handleRemove,
|
103
|
+
handleRemove: handleRemove,
|
107
104
|
id: id === null || id === void 0 ? void 0 : id.toString(),
|
108
105
|
isSelected: isSelected,
|
109
106
|
ref: forwardedRef,
|
110
107
|
text: text,
|
111
|
-
|
112
|
-
},
|
108
|
+
variant: variant
|
109
|
+
}, rest), /*#__PURE__*/React.createElement(TokenTextContainer, null, text), !hideRemoveButton && handleRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
|
113
110
|
borderOffset: tokenBorderWidthPx,
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
position: 'relative',
|
120
|
-
zIndex: '1'
|
121
|
-
} : {}
|
111
|
+
parentTokenTag: as || 'span',
|
112
|
+
tabIndex: -1,
|
113
|
+
onClick: handleRemoveClick,
|
114
|
+
variant: variant,
|
115
|
+
"aria-hidden": hasMultipleActionTargets ? "true" : "false"
|
122
116
|
}) : null);
|
123
117
|
});
|
124
|
-
|
118
|
+
TokenLabel.defaultProps = {
|
125
119
|
fillColor: '#999'
|
126
120
|
};
|
127
|
-
export default
|
121
|
+
export default TokenLabel;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { TokenBaseProps } from './TokenBase';
|
3
|
-
export interface
|
3
|
+
export interface TokenProfileProps extends TokenBaseProps {
|
4
4
|
avatarSrc: string;
|
5
5
|
}
|
6
|
-
declare const
|
7
|
-
export default
|
6
|
+
declare const TokenProfile: React.ForwardRefExoticComponent<Pick<TokenProfileProps, "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "list" | "default" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "step" | "wrap" | "open" | "max" | "media" | "method" | "min" | "target" | "crossOrigin" | "href" | "classID" | "useMap" | "wmode" | "download" | "hrefLang" | "rel" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "as" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "variant" | "handleRemove" | "isSelected" | "avatarSrc"> & React.RefAttributes<HTMLElement>>;
|
7
|
+
export default TokenProfile;
|
@@ -8,22 +8,22 @@ import { defaultTokenSize, tokenSizes } from './TokenBase';
|
|
8
8
|
import Token from './Token';
|
9
9
|
import { Avatar } from '..';
|
10
10
|
const StyledToken = styled(Token).withConfig({
|
11
|
-
displayName: "
|
12
|
-
componentId: "
|
11
|
+
displayName: "TokenProfile__StyledToken",
|
12
|
+
componentId: "sc-1vf9jhf-0"
|
13
13
|
})(["padding-left:", ";"], get('space.1'));
|
14
|
-
const
|
14
|
+
const TokenProfile = /*#__PURE__*/forwardRef(({
|
15
15
|
avatarSrc,
|
16
16
|
id,
|
17
17
|
ref,
|
18
|
-
|
18
|
+
variant,
|
19
19
|
...rest
|
20
20
|
}, forwardedRef) => /*#__PURE__*/React.createElement(StyledToken, _extends({
|
21
21
|
leadingVisual: () => /*#__PURE__*/React.createElement(Avatar, {
|
22
22
|
src: avatarSrc,
|
23
|
-
size:
|
23
|
+
size: tokenSizes[variant || defaultTokenSize] - parseInt(primitives.spacing.normal.spacer[1], 10) * 2
|
24
24
|
}),
|
25
|
-
|
25
|
+
variant: variant,
|
26
26
|
id: id === null || id === void 0 ? void 0 : id.toString(),
|
27
27
|
ref: forwardedRef
|
28
28
|
}, rest)));
|
29
|
-
export default
|
29
|
+
export default TokenProfile;
|
@@ -1,12 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { ComponentProps } from '../utils/types';
|
4
|
-
import { TokenSizeKeys } from './TokenBase';
|
5
|
-
interface TokenButtonProps {
|
6
|
-
borderOffset?: number;
|
7
|
-
size?: TokenSizeKeys;
|
8
|
-
isParentInteractive?: boolean;
|
9
|
-
}
|
10
|
-
declare const StyledTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps & SxProp, never>;
|
11
|
-
declare const RemoveTokenButton: React.FC<ComponentProps<typeof StyledTokenButton>>;
|
1
|
+
import { TokenButtonProps } from './_tokenButtonUtils';
|
2
|
+
declare const RemoveTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps, never>;
|
12
3
|
export default RemoveTokenButton;
|
@@ -1,59 +1,29 @@
|
|
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 { XIcon } from '@primer/octicons-react';
|
4
2
|
import styled from 'styled-components';
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
sm: {
|
13
|
-
height: tokenSizes.sm,
|
14
|
-
width: tokenSizes.sm
|
15
|
-
},
|
16
|
-
md: {
|
17
|
-
height: tokenSizes.md,
|
18
|
-
width: tokenSizes.md
|
19
|
-
},
|
20
|
-
lg: {
|
21
|
-
height: tokenSizes.lg,
|
22
|
-
width: tokenSizes.lg
|
23
|
-
},
|
24
|
-
xl: {
|
25
|
-
height: tokenSizes.xl,
|
26
|
-
width: tokenSizes.xl
|
27
|
-
}
|
28
|
-
}
|
29
|
-
});
|
30
|
-
|
31
|
-
const getTokenButtonIconSize = variant => parseInt(tokenSizes[variant || defaultTokenSize], 10) * 0.75;
|
32
|
-
|
33
|
-
const StyledTokenButton = styled.span.withConfig({
|
34
|
-
displayName: "_RemoveTokenButton__StyledTokenButton",
|
35
|
-
componentId: "sc-14lvcw1-0"
|
36
|
-
})(["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)`, get('colors.fade.fg10'), get('colors.fade.fg15'), variants, sx);
|
37
|
-
|
38
|
-
const RemoveTokenButton = ({
|
39
|
-
"aria-label": ariaLabel,
|
40
|
-
isParentInteractive,
|
41
|
-
size,
|
42
|
-
children,
|
3
|
+
import { defaultTokenSize } from "./TokenBase";
|
4
|
+
import { tokenButtonStyles, variants, getTokenButtonIconSize } from './_tokenButtonUtils';
|
5
|
+
const RemoveTokenButton = styled.span.attrs(({
|
6
|
+
borderOffset,
|
7
|
+
parentTokenTag,
|
8
|
+
variant,
|
9
|
+
parentTokenIsInteractive,
|
43
10
|
...rest
|
44
11
|
}) => {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
|
12
|
+
delete rest.children;
|
13
|
+
return {
|
14
|
+
borderOffset,
|
15
|
+
as: parentTokenIsInteractive ? 'span' : 'button',
|
16
|
+
tabIndex: parentTokenIsInteractive ? -1 : undefined,
|
17
|
+
'aria-label': !parentTokenIsInteractive ? 'Remove token' : undefined,
|
18
|
+
children: /*#__PURE__*/React.createElement(XIcon, {
|
19
|
+
size: getTokenButtonIconSize(variant)
|
20
|
+
})
|
21
|
+
};
|
22
|
+
}).withConfig({
|
23
|
+
displayName: "_RemoveTokenButton__RemoveTokenButton",
|
24
|
+
componentId: "sc-14lvcw1-0"
|
25
|
+
})(["", " ", " transform:", ";"], tokenButtonStyles, variants, props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`);
|
56
26
|
RemoveTokenButton.defaultProps = {
|
57
|
-
|
27
|
+
variant: defaultTokenSize
|
58
28
|
};
|
59
29
|
export default RemoveTokenButton;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { TokenSizeKeys } from "./TokenBase";
|
2
|
+
export interface TokenButtonProps {
|
3
|
+
borderOffset?: number;
|
4
|
+
parentTokenTag: 'span' | 'button' | 'a';
|
5
|
+
variant?: TokenSizeKeys;
|
6
|
+
parentTokenIsInteractive?: boolean;
|
7
|
+
}
|
8
|
+
export declare const variants: (...args: any[]) => any;
|
9
|
+
export declare const tokenButtonStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
|
10
|
+
export declare const getTokenButtonIconSize: (variant?: TokenSizeKeys | undefined) => number;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { variant } from 'styled-system';
|
3
|
+
import { get } from '../constants';
|
4
|
+
import { tokenSizes, defaultTokenSize } from "./TokenBase";
|
5
|
+
export const variants = variant({
|
6
|
+
variants: {
|
7
|
+
sm: {
|
8
|
+
height: `${tokenSizes.sm}px`,
|
9
|
+
width: `${tokenSizes.sm}px`
|
10
|
+
},
|
11
|
+
md: {
|
12
|
+
height: `${tokenSizes.md}px`,
|
13
|
+
width: `${tokenSizes.md}px`
|
14
|
+
},
|
15
|
+
lg: {
|
16
|
+
height: `${tokenSizes.lg}px`,
|
17
|
+
width: `${tokenSizes.lg}px`
|
18
|
+
},
|
19
|
+
xl: {
|
20
|
+
height: `${tokenSizes.xl}px`,
|
21
|
+
width: `${tokenSizes.xl}px`
|
22
|
+
}
|
23
|
+
}
|
24
|
+
});
|
25
|
+
export const tokenButtonStyles = css(["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;align-self:baseline;border:0;border-radius:999px;&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}"], get('colors.fade.fg10'), get('colors.fade.fg15'));
|
26
|
+
export const getTokenButtonIconSize = variant => tokenSizes[variant || defaultTokenSize] * 0.75;
|
package/lib-esm/Token/index.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { default } from './Token';
|
2
|
-
export { default as
|
3
|
-
export { default as
|
2
|
+
export { default as TokenLabel } from './TokenLabel';
|
3
|
+
export { default as TokenProfile } from './TokenProfile';
|
package/lib-esm/Token/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { default } from './Token';
|
2
|
-
export { default as
|
3
|
-
export { default as
|
2
|
+
export { default as TokenLabel } from './TokenLabel';
|
3
|
+
export { default as TokenProfile } from './TokenProfile';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import styled from "styled-components";
|
2
|
+
import sx from './sx';
|
3
|
+
const UnstyledTextInput = styled.input.withConfig({
|
4
|
+
displayName: "_UnstyledTextInput__UnstyledTextInput",
|
5
|
+
componentId: "sc-1jgl33s-0"
|
6
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}", ";"], sx);
|
7
|
+
export default UnstyledTextInput;
|
package/lib-esm/index.d.ts
CHANGED
@@ -98,11 +98,12 @@ export { default as TabNav } from './TabNav';
|
|
98
98
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
99
99
|
export { default as TextInput } from './TextInput';
|
100
100
|
export type { TextInputProps } from './TextInput';
|
101
|
+
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
101
102
|
export { default as Text } from './Text';
|
102
103
|
export type { TextProps } from './Text';
|
103
104
|
export { default as Timeline } from './Timeline';
|
104
105
|
export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
|
105
|
-
export { default as Token,
|
106
|
+
export { default as Token, TokenLabel, TokenProfile } from './Token';
|
106
107
|
export { default as Tooltip } from './Tooltip';
|
107
108
|
export type { TooltipProps } from './Tooltip';
|
108
109
|
export { default as Truncate } from './Truncate';
|
package/lib-esm/index.js
CHANGED
@@ -61,9 +61,10 @@ export { default as StyledOcticon } from './StyledOcticon';
|
|
61
61
|
export { default as SubNav } from './SubNav';
|
62
62
|
export { default as TabNav } from './TabNav';
|
63
63
|
export { default as TextInput } from './TextInput';
|
64
|
+
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
64
65
|
export { default as Text } from './Text';
|
65
66
|
export { default as Timeline } from './Timeline';
|
66
|
-
export { default as Token,
|
67
|
+
export { default as Token, TokenLabel, TokenProfile } from './Token';
|
67
68
|
export { default as Tooltip } from './Tooltip';
|
68
69
|
export { default as Truncate } from './Truncate';
|
69
70
|
export { default as UnderlineNav } from './UnderlineNav';
|
package/package.json
CHANGED
@@ -1,14 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { TokenBaseProps } from './TokenBase';
|
3
|
-
export interface IssueLabelTokenProps extends TokenBaseProps {
|
4
|
-
/**
|
5
|
-
* The color that corresponds to the label
|
6
|
-
*/
|
7
|
-
fillColor?: string;
|
8
|
-
/**
|
9
|
-
* Whether the remove button should be rendered in the token
|
10
|
-
*/
|
11
|
-
hideRemoveButton?: boolean;
|
12
|
-
}
|
13
|
-
declare const IssueLabelToken: React.ForwardRefExoticComponent<Pick<IssueLabelTokenProps, "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "list" | "default" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "step" | "size" | "wrap" | "open" | "max" | "media" | "method" | "min" | "target" | "crossOrigin" | "href" | "classID" | "useMap" | "wmode" | "download" | "hrefLang" | "rel" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "as" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "onRemove" | "isSelected" | "hideRemoveButton" | "fillColor"> & React.RefAttributes<HTMLElement>>;
|
14
|
-
export default IssueLabelToken;
|
@@ -1,34 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
9
|
-
|
10
|
-
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); }
|
11
|
-
|
12
|
-
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; }
|
13
|
-
|
14
|
-
const TokenTextContainer = (0, _styledComponents.default)('span').withConfig({
|
15
|
-
displayName: "_TokenTextContainer__TokenTextContainer",
|
16
|
-
componentId: "sc-4t2bev-0"
|
17
|
-
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1;", ""], props => {
|
18
|
-
if (props.as === 'a') {
|
19
|
-
return (0, _styledComponents.css)(["color:currentColor;text-decoration:none;"]);
|
20
|
-
}
|
21
|
-
|
22
|
-
if (props.as === 'button') {
|
23
|
-
// reset button styles, make the cursor a pointer, and add line-height
|
24
|
-
return (0, _styledComponents.css)(["background:transparent;border:none;color:inherit;font:inherit;margin:0;overflow:visible;padding:0;width:auto;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer;line-height:1;"]);
|
25
|
-
} // position psuedo-element above text content
|
26
|
-
// so it gets the click
|
27
|
-
|
28
|
-
|
29
|
-
if (props.as !== 'span') {
|
30
|
-
return (0, _styledComponents.css)(["&:after{content:'';position:absolute;left:0;top:0;right:0;bottom:0;}"]);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
var _default = TokenTextContainer;
|
34
|
-
exports.default = _default;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { TokenBaseProps } from './TokenBase';
|
3
|
-
export interface IssueLabelTokenProps extends TokenBaseProps {
|
4
|
-
/**
|
5
|
-
* The color that corresponds to the label
|
6
|
-
*/
|
7
|
-
fillColor?: string;
|
8
|
-
/**
|
9
|
-
* Whether the remove button should be rendered in the token
|
10
|
-
*/
|
11
|
-
hideRemoveButton?: boolean;
|
12
|
-
}
|
13
|
-
declare const IssueLabelToken: React.ForwardRefExoticComponent<Pick<IssueLabelTokenProps, "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "list" | "default" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "step" | "size" | "wrap" | "open" | "max" | "media" | "method" | "min" | "target" | "crossOrigin" | "href" | "classID" | "useMap" | "wmode" | "download" | "hrefLang" | "rel" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "as" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "onRemove" | "isSelected" | "hideRemoveButton" | "fillColor"> & React.RefAttributes<HTMLElement>>;
|
14
|
-
export default IssueLabelToken;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import styled, { css } from "styled-components";
|
2
|
-
const TokenTextContainer = styled('span').withConfig({
|
3
|
-
displayName: "_TokenTextContainer__TokenTextContainer",
|
4
|
-
componentId: "sc-4t2bev-0"
|
5
|
-
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1;", ""], props => {
|
6
|
-
if (props.as === 'a') {
|
7
|
-
return css(["color:currentColor;text-decoration:none;"]);
|
8
|
-
}
|
9
|
-
|
10
|
-
if (props.as === 'button') {
|
11
|
-
// reset button styles, make the cursor a pointer, and add line-height
|
12
|
-
return css(["background:transparent;border:none;color:inherit;font:inherit;margin:0;overflow:visible;padding:0;width:auto;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer;line-height:1;"]);
|
13
|
-
} // position psuedo-element above text content
|
14
|
-
// so it gets the click
|
15
|
-
|
16
|
-
|
17
|
-
if (props.as !== 'span') {
|
18
|
-
return css(["&:after{content:'';position:absolute;left:0;top:0;right:0;bottom:0;}"]);
|
19
|
-
}
|
20
|
-
});
|
21
|
-
export default TokenTextContainer;
|