@primer/components 0.0.0-2021816151443 → 0.0.0-2021816212749
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 +15 -1
- package/dist/browser.esm.js +667 -621
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +301 -255
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +3 -3
- package/lib/AnchoredOverlay/AnchoredOverlay.js +2 -2
- package/lib/Avatar.d.ts +4 -0
- package/lib/Dialog/Dialog.js +4 -4
- package/lib/FilteredActionList/FilteredActionList.js +3 -3
- package/lib/Overlay.d.ts +0 -1
- package/lib/Overlay.js +5 -10
- package/lib/SelectMenu/SelectMenu.d.ts +11 -327
- package/lib/SelectMenu/SelectMenuFilter.d.ts +1 -1
- package/lib/TextInput.d.ts +6 -6
- package/lib/TextInput.js +21 -16
- package/lib/Timeline.js +12 -15
- package/lib/hooks/useOverlay.d.ts +1 -2
- package/lib/hooks/useOverlay.js +6 -11
- package/lib/index.d.ts +1 -0
- package/lib/index.js +14 -0
- package/lib/theme-preval.js +1705 -1957
- package/lib/utils/ssr.d.ts +1 -0
- package/lib/utils/ssr.js +19 -0
- package/lib/utils/testing.d.ts +2431 -2929
- package/lib/utils/uniqueId.js +1 -0
- package/lib-esm/ActionList/Item.js +4 -4
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -3
- package/lib-esm/Avatar.d.ts +4 -0
- package/lib-esm/Dialog/Dialog.js +3 -3
- package/lib-esm/FilteredActionList/FilteredActionList.js +3 -3
- package/lib-esm/Overlay.d.ts +0 -1
- package/lib-esm/Overlay.js +5 -8
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -327
- package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +1 -1
- package/lib-esm/TextInput.d.ts +6 -6
- package/lib-esm/TextInput.js +22 -16
- package/lib-esm/Timeline.js +8 -13
- package/lib-esm/hooks/useOverlay.d.ts +1 -2
- package/lib-esm/hooks/useOverlay.js +6 -11
- package/lib-esm/index.d.ts +1 -0
- package/lib-esm/index.js +2 -1
- package/lib-esm/theme-preval.js +1705 -1957
- package/lib-esm/utils/ssr.d.ts +1 -0
- package/lib-esm/utils/ssr.js +1 -0
- package/lib-esm/utils/testing.d.ts +2431 -2929
- package/lib-esm/utils/uniqueId.js +1 -0
- package/package.json +5 -7
- package/lib/Autocomplete/Autocomplete.d.ts +0 -8
- package/lib/Autocomplete/Autocomplete.js +0 -49
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -13
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -7
- package/lib/Autocomplete/AutocompleteInput.js +0 -78
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -19
- package/lib/Autocomplete/AutocompleteMenu.js +0 -226
- package/lib/Badge/Badge.d.ts +0 -8
- package/lib/Badge/Badge.js +0 -59
- package/lib/Badge/BadgeState.d.ts +0 -13
- package/lib/Badge/BadgeState.js +0 -51
- package/lib/Badge/_badgeStyleUtils.d.ts +0 -3
- package/lib/Badge/_badgeStyleUtils.js +0 -39
- package/lib/TextInputTokens.d.ts +0 -32
- package/lib/TextInputTokens.js +0 -225
- package/lib/TextInputWithTokens.d.ts +0 -41
- package/lib/TextInputWithTokens.js +0 -396
- package/lib/Token/Token.d.ts +0 -7
- package/lib/Token/Token.js +0 -66
- package/lib/Token/TokenBase.d.ts +0 -16
- package/lib/Token/TokenBase.js +0 -76
- package/lib/Token/TokenLabel.d.ts +0 -8
- package/lib/Token/TokenLabel.js +0 -116
- package/lib/Token/TokenProfile.d.ts +0 -7
- package/lib/Token/TokenProfile.js +0 -45
- package/lib/Token/_AddTokenButton.d.ts +0 -3
- package/lib/Token/_AddTokenButton.js +0 -42
- package/lib/Token/_RemoveTokenButton.d.ts +0 -3
- package/lib/Token/_RemoveTokenButton.js +0 -42
- package/lib/Token/_tokenButtonUtils.d.ts +0 -8
- package/lib/Token/_tokenButtonUtils.js +0 -42
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -8
- package/lib-esm/Autocomplete/Autocomplete.js +0 -36
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -13
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -7
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -59
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -19
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -203
- package/lib-esm/Badge/Badge.d.ts +0 -8
- package/lib-esm/Badge/Badge.js +0 -44
- package/lib-esm/Badge/BadgeState.d.ts +0 -13
- package/lib-esm/Badge/BadgeState.js +0 -40
- package/lib-esm/Badge/_badgeStyleUtils.d.ts +0 -3
- package/lib-esm/Badge/_badgeStyleUtils.js +0 -29
- package/lib-esm/TextInputTokens.d.ts +0 -32
- package/lib-esm/TextInputTokens.js +0 -195
- package/lib-esm/TextInputWithTokens.d.ts +0 -41
- package/lib-esm/TextInputWithTokens.js +0 -361
- package/lib-esm/Token/Token.d.ts +0 -7
- package/lib-esm/Token/Token.js +0 -46
- package/lib-esm/Token/TokenBase.d.ts +0 -16
- package/lib-esm/Token/TokenBase.js +0 -56
- package/lib-esm/Token/TokenLabel.d.ts +0 -8
- package/lib-esm/Token/TokenLabel.js +0 -100
- package/lib-esm/Token/TokenProfile.d.ts +0 -7
- package/lib-esm/Token/TokenProfile.js +0 -28
- package/lib-esm/Token/_AddTokenButton.d.ts +0 -3
- package/lib-esm/Token/_AddTokenButton.js +0 -27
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -3
- package/lib-esm/Token/_RemoveTokenButton.js +0 -27
- package/lib-esm/Token/_tokenButtonUtils.d.ts +0 -8
- package/lib-esm/Token/_tokenButtonUtils.js +0 -26
package/lib-esm/Token/Token.d.ts
DELETED
package/lib-esm/Token/Token.js
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import styled from 'styled-components';
|
3
|
-
import { get } from '../constants';
|
4
|
-
import TokenBase, { isTokenHoverable } from './TokenBase';
|
5
|
-
import AddTokenButton from './_AddTokenButton';
|
6
|
-
import RemoveTokenButton from './_RemoveTokenButton';
|
7
|
-
const DefaultToken = styled(TokenBase).withConfig({
|
8
|
-
displayName: "Token__DefaultToken",
|
9
|
-
componentId: "sc-1dg52pw-0"
|
10
|
-
})(["background-color:", ";border-color:", ";border-style:solid;border-width:", ";color:", ";padding-right:", ";&:hover{background-color:", ";}> ._TokenButton{color:", ";}"], get('colors.accent.subtle'), props => props.isSelected ? get('colors.accent.fg') : get('colors.accent.subtle'), props => props.isSelected ? '1px' : 0, get('colors.accent.fg'), props => props.handleRemove || props.handleAdd ? 0 : undefined, props => isTokenHoverable(props) ? get('colors.accent.muted') : undefined, get('colors.accent.fg')); // TODO: make this text truncate
|
11
|
-
|
12
|
-
const TokenTextContainer = styled('span').withConfig({
|
13
|
-
displayName: "Token__TokenTextContainer",
|
14
|
-
componentId: "sc-1dg52pw-1"
|
15
|
-
})(["flex-grow:1;white-space:nowrap;"]);
|
16
|
-
const LeadingVisualContainer = styled('span').withConfig({
|
17
|
-
displayName: "Token__LeadingVisualContainer",
|
18
|
-
componentId: "sc-1dg52pw-2"
|
19
|
-
})(["flex-shrink:0;line-height:0;"]);
|
20
|
-
|
21
|
-
const Token = ({
|
22
|
-
leadingVisual: LeadingVisual,
|
23
|
-
...tokenBaseProps
|
24
|
-
}) => {
|
25
|
-
const {
|
26
|
-
handleRemove,
|
27
|
-
handleAdd,
|
28
|
-
text,
|
29
|
-
as,
|
30
|
-
variant
|
31
|
-
} = tokenBaseProps;
|
32
|
-
return /*#__PURE__*/React.createElement(DefaultToken, tokenBaseProps, LeadingVisual ? /*#__PURE__*/React.createElement(LeadingVisualContainer, null, /*#__PURE__*/React.createElement(LeadingVisual, null)) : null, /*#__PURE__*/React.createElement(TokenTextContainer, null, text), handleRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
|
33
|
-
parentTokenTag: as || 'span',
|
34
|
-
tabIndex: -1,
|
35
|
-
onClick: handleRemove,
|
36
|
-
variant: variant
|
37
|
-
}) : null, handleAdd ? /*#__PURE__*/React.createElement(AddTokenButton, {
|
38
|
-
parentTokenTag: as || 'span',
|
39
|
-
tabIndex: -1,
|
40
|
-
onClick: handleAdd,
|
41
|
-
variant: variant
|
42
|
-
}) : null);
|
43
|
-
};
|
44
|
-
|
45
|
-
Token.displayName = "Token";
|
46
|
-
export default Token;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export declare type TokenSizeKeys = 'sm' | 'md' | 'lg' | 'xl';
|
3
|
-
export declare const tokenSizes: Record<TokenSizeKeys, number>;
|
4
|
-
export declare const defaultTokenSize = "md";
|
5
|
-
export interface TokenBaseProps extends Omit<React.HTMLProps<HTMLSpanElement | HTMLButtonElement | HTMLAnchorElement>, 'size'> {
|
6
|
-
as?: 'button' | 'a' | 'span';
|
7
|
-
handleAdd?: () => void;
|
8
|
-
handleRemove?: () => void;
|
9
|
-
isSelected?: boolean;
|
10
|
-
tabIndex?: number;
|
11
|
-
text: string;
|
12
|
-
variant?: TokenSizeKeys;
|
13
|
-
}
|
14
|
-
export declare const isTokenHoverable: ({ as, onClick, onFocus }: TokenBaseProps) => boolean;
|
15
|
-
declare const TokenBase: import("styled-components").StyledComponent<"span", any, TokenBaseProps, never>;
|
16
|
-
export default TokenBase;
|
@@ -1,56 +0,0 @@
|
|
1
|
-
import styled from 'styled-components';
|
2
|
-
import { variant } from 'styled-system';
|
3
|
-
import { get } from '../constants';
|
4
|
-
export const tokenSizes = {
|
5
|
-
sm: 16,
|
6
|
-
md: 20,
|
7
|
-
lg: 24,
|
8
|
-
xl: 32
|
9
|
-
};
|
10
|
-
export const defaultTokenSize = 'md';
|
11
|
-
export const isTokenHoverable = ({
|
12
|
-
as = 'span',
|
13
|
-
onClick,
|
14
|
-
onFocus
|
15
|
-
}) => Boolean(onFocus || onClick || ['a', 'button'].includes(as));
|
16
|
-
const variants = variant({
|
17
|
-
variants: {
|
18
|
-
sm: {
|
19
|
-
fontSize: 0,
|
20
|
-
gap: 1,
|
21
|
-
height: `${tokenSizes.sm}px`,
|
22
|
-
paddingLeft: 1,
|
23
|
-
paddingRight: 1
|
24
|
-
},
|
25
|
-
md: {
|
26
|
-
fontSize: 0,
|
27
|
-
gap: 1,
|
28
|
-
height: `${tokenSizes.md}px`,
|
29
|
-
paddingLeft: 2,
|
30
|
-
paddingRight: 2
|
31
|
-
},
|
32
|
-
lg: {
|
33
|
-
fontSize: 0,
|
34
|
-
gap: 2,
|
35
|
-
height: `${tokenSizes.lg}px`,
|
36
|
-
paddingLeft: 2,
|
37
|
-
paddingRight: 2
|
38
|
-
},
|
39
|
-
xl: {
|
40
|
-
fontSize: 1,
|
41
|
-
gap: 2,
|
42
|
-
height: `${tokenSizes.xl}px`,
|
43
|
-
paddingLeft: 3,
|
44
|
-
paddingRight: 3
|
45
|
-
}
|
46
|
-
}
|
47
|
-
});
|
48
|
-
const TokenBase = styled.span.withConfig({
|
49
|
-
displayName: "TokenBase",
|
50
|
-
componentId: "opajvp-0"
|
51
|
-
})(["align-items:center;border-radius:999px;cursor:", ";display:inline-flex;font-weight:", ";text-decoration:none;white-space:nowrap;", ""], props => isTokenHoverable(props) ? 'pointer' : 'auto', get('fontWeights.bold'), variants);
|
52
|
-
TokenBase.defaultProps = {
|
53
|
-
as: 'span',
|
54
|
-
variant: defaultTokenSize
|
55
|
-
};
|
56
|
-
export default TokenBase;
|
@@ -1,100 +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 styled from 'styled-components';
|
5
|
-
import TokenBase from './TokenBase';
|
6
|
-
import RemoveTokenButton from './_RemoveTokenButton';
|
7
|
-
import tinycolor from 'tinycolor2';
|
8
|
-
import { useTheme } from '../ThemeProvider';
|
9
|
-
const colorModeConfig = {
|
10
|
-
dark: {
|
11
|
-
bgOpacity: 0.18,
|
12
|
-
borderThreshold: 0,
|
13
|
-
borderOpacity: 0.3,
|
14
|
-
lightnessThreshold: 0.6
|
15
|
-
},
|
16
|
-
light: {
|
17
|
-
bgOpacity: 1,
|
18
|
-
borderThreshold: 0.96,
|
19
|
-
borderOpacity: 1,
|
20
|
-
lightnessThreshold: 0.453
|
21
|
-
}
|
22
|
-
};
|
23
|
-
const tokenBorderWidthPx = 1; // TODO: do a nicer `isSelected` style
|
24
|
-
|
25
|
-
const StyledTokenLabel = styled(TokenBase).withConfig({
|
26
|
-
displayName: "TokenLabel__StyledTokenLabel",
|
27
|
-
componentId: "sc-1bdmgzv-0"
|
28
|
-
})(["background-color:", ";border-width:", "px;border-style:solid;border-color:", ";box-shadow:", ";color:", ";overflow:hidden;padding-right:", ";position:relative;> ._TokenButton{color:currentColor;transform:translate(", "px,-", "px);}"], props => props.bgColor, tokenBorderWidthPx, props => props.borderColor, props => props.isSelected ? `0 0 0 2px ${props.bgColor}` : undefined, props => props.textColor, props => props.handleRemove ? 0 : undefined, tokenBorderWidthPx, tokenBorderWidthPx); // TODO: make this text truncate
|
29
|
-
|
30
|
-
const TokenTextContainer = styled('span').withConfig({
|
31
|
-
displayName: "TokenLabel__TokenTextContainer",
|
32
|
-
componentId: "sc-1bdmgzv-1"
|
33
|
-
})(["white-space:nowrap;z-index:1;"]);
|
34
|
-
|
35
|
-
const TokenLabel = ({
|
36
|
-
isOutlined,
|
37
|
-
fillColor,
|
38
|
-
isSelected,
|
39
|
-
...tokenBaseProps
|
40
|
-
}) => {
|
41
|
-
const {
|
42
|
-
handleRemove,
|
43
|
-
text,
|
44
|
-
as,
|
45
|
-
variant
|
46
|
-
} = tokenBaseProps;
|
47
|
-
const {
|
48
|
-
colorScheme
|
49
|
-
} = useTheme(); // const colorScheme = 'dark';
|
50
|
-
|
51
|
-
const {
|
52
|
-
bgOpacity,
|
53
|
-
borderOpacity,
|
54
|
-
borderThreshold,
|
55
|
-
lightnessThreshold
|
56
|
-
} = colorModeConfig[colorScheme || 'light'];
|
57
|
-
let bgColor = fillColor;
|
58
|
-
let borderColor = fillColor;
|
59
|
-
let textColor = '#FFF';
|
60
|
-
const perceivedLightness = tinycolor(fillColor).getLuminance();
|
61
|
-
const isFillColorLight = perceivedLightness >= lightnessThreshold;
|
62
|
-
|
63
|
-
if (colorScheme === 'dark') {
|
64
|
-
const lightenBy = (perceivedLightness - lightnessThreshold) * 100 * (isFillColorLight ? 1 : 0);
|
65
|
-
bgColor = isSelected ? tinycolor(fillColor).setAlpha(bgOpacity * 1.2).toRgbString() : tinycolor(fillColor).setAlpha(bgOpacity).toRgbString();
|
66
|
-
textColor = isSelected ? tinycolor(fillColor).lighten(lightenBy + 8).toString() : tinycolor(fillColor).lighten(lightenBy).toString();
|
67
|
-
borderColor = isSelected ? tinycolor(fillColor).lighten(lightenBy).toRgbString() : tinycolor(fillColor).lighten(lightenBy).setAlpha(borderOpacity).toRgbString();
|
68
|
-
} else {
|
69
|
-
const isFillColorDark = perceivedLightness < 0.1;
|
70
|
-
borderColor = perceivedLightness >= borderThreshold ? tinycolor(fillColor).darken(25).toString() : 'transparent';
|
71
|
-
|
72
|
-
if (isFillColorLight) {
|
73
|
-
textColor = '#000';
|
74
|
-
}
|
75
|
-
|
76
|
-
if (isSelected) {
|
77
|
-
bgColor = isFillColorDark ? tinycolor(fillColor).lighten(10).toString() : tinycolor(fillColor).darken(10).toString();
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
return /*#__PURE__*/React.createElement(StyledTokenLabel, _extends({
|
82
|
-
fillColor: fillColor,
|
83
|
-
bgColor: bgColor,
|
84
|
-
borderColor: borderColor,
|
85
|
-
textColor: textColor,
|
86
|
-
isSelected: isSelected
|
87
|
-
}, tokenBaseProps), /*#__PURE__*/React.createElement(TokenTextContainer, null, text), handleRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
|
88
|
-
parentTokenTag: as || 'span',
|
89
|
-
tabIndex: -1,
|
90
|
-
onClick: handleRemove,
|
91
|
-
variant: variant
|
92
|
-
}) : null);
|
93
|
-
};
|
94
|
-
|
95
|
-
TokenLabel.displayName = "TokenLabel";
|
96
|
-
TokenLabel.defaultProps = {
|
97
|
-
fillColor: '#999' // TODO: pick a real color
|
98
|
-
|
99
|
-
};
|
100
|
-
export default TokenLabel;
|
@@ -1,28 +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 styled from 'styled-components';
|
5
|
-
import { get } from '../constants';
|
6
|
-
import primitives from '@primer/primitives';
|
7
|
-
import { defaultTokenSize, tokenSizes } from './TokenBase';
|
8
|
-
import Token from './Token';
|
9
|
-
import { Avatar } from '..';
|
10
|
-
const StyledToken = styled(Token).withConfig({
|
11
|
-
displayName: "TokenProfile__StyledToken",
|
12
|
-
componentId: "sc-1vf9jhf-0"
|
13
|
-
})(["padding-left:", ";"], get('space.1')); // ${get('space.1')}
|
14
|
-
|
15
|
-
const TokenProfile = ({
|
16
|
-
avatarSrc,
|
17
|
-
variant,
|
18
|
-
...rest
|
19
|
-
}) => /*#__PURE__*/React.createElement(StyledToken, _extends({
|
20
|
-
leadingVisual: () => /*#__PURE__*/React.createElement(Avatar, {
|
21
|
-
src: avatarSrc,
|
22
|
-
size: tokenSizes[variant || defaultTokenSize] - parseInt(primitives.spacing.normal.spacer[1], 10) * 2
|
23
|
-
}),
|
24
|
-
variant: variant
|
25
|
-
}, rest));
|
26
|
-
|
27
|
-
TokenProfile.displayName = "TokenProfile";
|
28
|
-
export default TokenProfile;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { PlusIcon } from '@primer/octicons-react';
|
2
|
-
import styled from 'styled-components';
|
3
|
-
import { defaultTokenSize } from "./TokenBase";
|
4
|
-
import { tokenButtonStyles, variants, getTokenButtonIconSize } from './_tokenButtonUtils';
|
5
|
-
const AddTokenButton = styled.span.attrs(({
|
6
|
-
parentTokenTag,
|
7
|
-
variant,
|
8
|
-
...rest
|
9
|
-
}) => {
|
10
|
-
delete rest.children;
|
11
|
-
return {
|
12
|
-
as: parentTokenTag === 'span' ? 'button' : 'span',
|
13
|
-
tabIndex: -1,
|
14
|
-
className: '_TokenButton',
|
15
|
-
children: /*#__PURE__*/React.createElement(PlusIcon, {
|
16
|
-
size: getTokenButtonIconSize(variant)
|
17
|
-
}) // TODO: figure out how to set `size` using `fontSizes` from Primitives
|
18
|
-
|
19
|
-
};
|
20
|
-
}).withConfig({
|
21
|
-
displayName: "_AddTokenButton__AddTokenButton",
|
22
|
-
componentId: "elcc0o-0"
|
23
|
-
})(["", " ", ""], tokenButtonStyles, variants);
|
24
|
-
AddTokenButton.defaultProps = {
|
25
|
-
variant: defaultTokenSize
|
26
|
-
};
|
27
|
-
export default AddTokenButton;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { XIcon } from '@primer/octicons-react';
|
2
|
-
import styled from 'styled-components';
|
3
|
-
import { defaultTokenSize } from "./TokenBase";
|
4
|
-
import { tokenButtonStyles, variants, getTokenButtonIconSize } from './_tokenButtonUtils';
|
5
|
-
const RemoveTokenButton = styled.span.attrs(({
|
6
|
-
parentTokenTag,
|
7
|
-
variant,
|
8
|
-
...rest
|
9
|
-
}) => {
|
10
|
-
delete rest.children;
|
11
|
-
return {
|
12
|
-
as: parentTokenTag === 'span' ? 'button' : 'span',
|
13
|
-
tabIndex: -1,
|
14
|
-
className: '_TokenButton',
|
15
|
-
children: /*#__PURE__*/React.createElement(XIcon, {
|
16
|
-
size: getTokenButtonIconSize(variant)
|
17
|
-
}) // TODO: figure out how to set `size` using `fontSizes` from Primitives
|
18
|
-
|
19
|
-
};
|
20
|
-
}).withConfig({
|
21
|
-
displayName: "_RemoveTokenButton__RemoveTokenButton",
|
22
|
-
componentId: "sc-14lvcw1-0"
|
23
|
-
})(["", " ", ""], tokenButtonStyles, variants);
|
24
|
-
RemoveTokenButton.defaultProps = {
|
25
|
-
variant: defaultTokenSize
|
26
|
-
};
|
27
|
-
export default RemoveTokenButton;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { TokenSizeKeys } from "./TokenBase";
|
2
|
-
export interface TokenButtonProps {
|
3
|
-
parentTokenTag: 'span' | 'button' | 'a';
|
4
|
-
variant?: TokenSizeKeys;
|
5
|
-
}
|
6
|
-
export declare const variants: (...args: any[]) => any;
|
7
|
-
export declare const tokenButtonStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
|
8
|
-
export declare const getTokenButtonIconSize: (variant?: TokenSizeKeys | undefined) => number;
|
@@ -1,26 +0,0 @@
|
|
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;cursor:pointer;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;
|