@primer/components 0.0.0-20219421304 → 0.0.0-202194215436

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/dist/browser.esm.js +768 -714
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +409 -355
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/List.d.ts +1 -1
  7. package/lib/Token/LabelToken.d.ts +14 -0
  8. package/lib/Token/LabelToken.js +141 -0
  9. package/lib/Token/Token.d.ts +14 -0
  10. package/lib/Token/Token.js +76 -0
  11. package/lib/Token/TokenBase.d.ts +16 -0
  12. package/lib/Token/TokenBase.js +91 -0
  13. package/lib/Token/TokenProfile.d.ts +7 -0
  14. package/lib/Token/TokenProfile.js +50 -0
  15. package/lib/Token/_RemoveTokenButton.d.ts +9 -0
  16. package/lib/Token/_RemoveTokenButton.js +73 -0
  17. package/lib/Token/index.d.ts +3 -0
  18. package/lib/Token/index.js +31 -0
  19. package/lib/index.d.ts +1 -0
  20. package/lib/index.js +20 -0
  21. package/lib/sx.js +15 -0
  22. package/lib/theme-preval.js +5677 -0
  23. package/lib/theme.js +11 -0
  24. package/lib/utils/deprecate.js +100 -0
  25. package/lib/utils/isNumeric.js +11 -0
  26. package/lib/utils/iterateFocusableElements.js +113 -0
  27. package/lib/utils/ssr.js +19 -0
  28. package/lib/utils/test-deprecations.js +23 -0
  29. package/lib/utils/test-helpers.js +9 -0
  30. package/lib/utils/test-matchers.js +119 -0
  31. package/lib/utils/testing.js +273 -0
  32. package/lib/utils/theme.js +68 -0
  33. package/lib/utils/types.js +1 -0
  34. package/lib/utils/uniqueId.js +12 -0
  35. package/lib/utils/userAgent.js +15 -0
  36. package/lib-esm/ActionList/List.d.ts +1 -1
  37. package/lib-esm/Token/LabelToken.d.ts +14 -0
  38. package/lib-esm/Token/LabelToken.js +121 -0
  39. package/lib-esm/Token/Token.d.ts +14 -0
  40. package/lib-esm/Token/Token.js +57 -0
  41. package/lib-esm/Token/TokenBase.d.ts +16 -0
  42. package/lib-esm/Token/TokenBase.js +71 -0
  43. package/lib-esm/Token/TokenProfile.d.ts +7 -0
  44. package/lib-esm/Token/TokenProfile.js +29 -0
  45. package/lib-esm/Token/_RemoveTokenButton.d.ts +9 -0
  46. package/lib-esm/Token/_RemoveTokenButton.js +55 -0
  47. package/lib-esm/Token/index.d.ts +3 -0
  48. package/lib-esm/Token/index.js +3 -0
  49. package/lib-esm/index.d.ts +1 -0
  50. package/lib-esm/index.js +1 -0
  51. package/lib-esm/sx.js +5 -0
  52. package/lib-esm/theme-preval.js +5677 -0
  53. package/lib-esm/theme.js +2 -0
  54. package/lib-esm/utils/deprecate.js +91 -0
  55. package/lib-esm/utils/isNumeric.js +4 -0
  56. package/lib-esm/utils/iterateFocusableElements.js +102 -0
  57. package/lib-esm/utils/ssr.js +1 -0
  58. package/lib-esm/utils/test-deprecations.js +17 -0
  59. package/lib-esm/utils/test-helpers.js +7 -0
  60. package/lib-esm/utils/test-matchers.js +110 -0
  61. package/lib-esm/utils/testing.js +222 -0
  62. package/lib-esm/utils/theme.js +66 -0
  63. package/lib-esm/utils/types.js +1 -0
  64. package/lib-esm/utils/uniqueId.js +5 -0
  65. package/lib-esm/utils/userAgent.js +8 -0
  66. package/package.json +4 -2
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ // Utility functions used in theme-preval.js
4
+ // This file needs to be a JavaScript file using CommonJS to be compatiable with preval
5
+ const isEmpty = require('lodash.isempty');
6
+
7
+ const isObject = require('lodash.isobject');
8
+
9
+ const chroma = require('chroma-js');
10
+
11
+ function fontStack(fonts) {
12
+ return fonts.map(font => font.includes(' ') ? `"${font}"` : font).join(', ');
13
+ } // The following functions are a temporary measure for splitting shadow values out from the colors object.
14
+ // Eventually, we will push these structural changes upstream to primer/primitives so this data manipulation
15
+ // will not be needed.
16
+
17
+
18
+ function isShadowValue(value) {
19
+ return typeof value === 'string' && /(inset\s|)([0-9.]+(\w*)\s){1,4}(rgb[a]?\(.*\)|\w+)/.test(value);
20
+ }
21
+
22
+ function isColorValue(value) {
23
+ return chroma.valid(value);
24
+ }
25
+
26
+ function filterObject(obj, predicate) {
27
+ if (Array.isArray(obj)) {
28
+ return obj.filter(predicate);
29
+ }
30
+
31
+ return Object.entries(obj).reduce((acc, [key, value]) => {
32
+ if (isObject(value)) {
33
+ const result = filterObject(value, predicate); // Don't include empty objects or arrays
34
+
35
+ if (!isEmpty(result)) {
36
+ acc[key] = result;
37
+ }
38
+ } else if (predicate(value)) {
39
+ acc[key] = value;
40
+ }
41
+
42
+ return acc;
43
+ }, {});
44
+ }
45
+
46
+ function partitionColors(colors) {
47
+ return {
48
+ colors: filterObject(colors, value => isColorValue(value)),
49
+ shadows: filterObject(colors, value => isShadowValue(value))
50
+ };
51
+ }
52
+
53
+ function omitScale(obj) {
54
+ const {
55
+ scale,
56
+ ...rest
57
+ } = obj;
58
+ return rest;
59
+ }
60
+
61
+ module.exports = {
62
+ fontStack,
63
+ isShadowValue,
64
+ isColorValue,
65
+ filterObject,
66
+ partitionColors,
67
+ omitScale
68
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.uniqueId = uniqueId;
7
+ // Note: uniqueId may be unsafe in SSR contexts if it is used create DOM IDs or otherwise cause a hydration warning. Use useSSRSafeId instead.
8
+ let idSeed = 10000;
9
+
10
+ function uniqueId() {
11
+ return `__primer_id_${idSeed++}`;
12
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isMacOS = isMacOS;
7
+ let isMac = undefined;
8
+
9
+ function isMacOS() {
10
+ if (isMac === undefined) {
11
+ isMac = /^mac/i.test(window.navigator.platform);
12
+ }
13
+
14
+ return isMac;
15
+ }
@@ -3,7 +3,7 @@ import type { AriaRole } from '../utils/types';
3
3
  import { Group, GroupProps } from './Group';
4
4
  import { ItemProps } from './Item';
5
5
  declare type RenderItemFn = (props: ItemProps) => React.ReactElement;
6
- export declare type ItemInput = (ItemProps | React.ComponentPropsWithRef<'div'>) | ((Partial<ItemProps> & {
6
+ export declare type ItemInput = ItemProps | ((Partial<ItemProps> & {
7
7
  renderItem: RenderItemFn;
8
8
  }) & {
9
9
  key?: Key;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ export interface LabelTokenProps 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 LabelToken: React.ForwardRefExoticComponent<Pick<LabelTokenProps, "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 LabelToken;
@@ -0,0 +1,121 @@
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, { forwardRef } from 'react';
4
+ import styled, { css } from 'styled-components';
5
+ import TokenBase, { isTokenInteractive } from './TokenBase';
6
+ import RemoveTokenButton from './_RemoveTokenButton';
7
+ import tinycolor from 'tinycolor2';
8
+ import { useTheme } from '../ThemeProvider';
9
+ const colorModeConfigs = {
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;
24
+ const StyledLabelToken = styled(TokenBase).withConfig({
25
+ displayName: "LabelToken__StyledLabelToken",
26
+ componentId: "sc-1udj0pr-0"
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 => {
28
+ if (props.isSelected) {
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);
30
+ }
31
+ });
32
+ const TokenTextContainer = styled('span').withConfig({
33
+ displayName: "LabelToken__TokenTextContainer",
34
+ componentId: "sc-1udj0pr-1"
35
+ })(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
36
+ const LabelToken = /*#__PURE__*/forwardRef((props, forwardedRef) => {
37
+ const {
38
+ as,
39
+ fillColor,
40
+ onRemove,
41
+ id,
42
+ isSelected,
43
+ ref,
44
+ text,
45
+ size,
46
+ hideRemoveButton,
47
+ ...rest
48
+ } = props;
49
+ const {
50
+ colorScheme
51
+ } = useTheme();
52
+ const {
53
+ bgOpacity,
54
+ borderOpacity,
55
+ borderThreshold,
56
+ lightnessThreshold
57
+ } = colorModeConfigs[colorScheme || 'light'];
58
+ let bgColor = fillColor;
59
+ let borderColor = fillColor;
60
+ let textColor = '#FFF';
61
+ const perceivedLightness = tinycolor(fillColor).getLuminance();
62
+ const isFillColorLight = perceivedLightness >= lightnessThreshold;
63
+
64
+ if (colorScheme === 'dark') {
65
+ const lightenBy = (perceivedLightness - lightnessThreshold) * 100 * (isFillColorLight ? 1 : 0);
66
+ bgColor = isSelected ? tinycolor(fillColor).setAlpha(bgOpacity * 1.2).toRgbString() : tinycolor(fillColor).setAlpha(bgOpacity).toRgbString();
67
+ textColor = isSelected ? tinycolor(fillColor).lighten(lightenBy + 10).toString() : tinycolor(fillColor).lighten(lightenBy).toString();
68
+ borderColor = isSelected ? tinycolor(fillColor).lighten(lightenBy + 5).toRgbString() : tinycolor(fillColor).lighten(lightenBy).setAlpha(borderOpacity).toRgbString();
69
+ } else {
70
+ const isFillColorDark = perceivedLightness < 0.1;
71
+ borderColor = perceivedLightness >= borderThreshold ? tinycolor(fillColor).darken(25).toString() : 'transparent';
72
+
73
+ if (isFillColorLight) {
74
+ textColor = '#000';
75
+ }
76
+
77
+ if (isSelected) {
78
+ bgColor = isFillColorDark ? tinycolor(fillColor).lighten(10).toString() : // TODO: darken more than 10 if the fillColor is really bright and doesn't darken well
79
+ // Examples of colors that don't darken well:
80
+ // - #a2eeef
81
+ // - #ffd78e
82
+ // - #a4f287
83
+ tinycolor(fillColor).darken(10).toString();
84
+ }
85
+ }
86
+
87
+ const hasMultipleActionTargets = isTokenInteractive(props) && Boolean(onRemove) && !hideRemoveButton;
88
+
89
+ const onRemoveClick = e => {
90
+ e.stopPropagation();
91
+ onRemove && onRemove();
92
+ };
93
+
94
+ return /*#__PURE__*/React.createElement(StyledLabelToken // specific to labels
95
+ , _extends({
96
+ fillColor: fillColor,
97
+ bgColor: bgColor,
98
+ borderColor: borderColor,
99
+ textColor: textColor // common token props
100
+ ,
101
+ as: as,
102
+ hideRemoveButton: hideRemoveButton || !onRemove,
103
+ onRemove: onRemove,
104
+ id: id === null || id === void 0 ? void 0 : id.toString(),
105
+ isSelected: isSelected,
106
+ ref: forwardedRef,
107
+ text: text,
108
+ size: size
109
+ }, rest), /*#__PURE__*/React.createElement(TokenTextContainer, null, text), !hideRemoveButton && onRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
110
+ borderOffset: tokenBorderWidthPx,
111
+ parentTokenTag: as || 'span',
112
+ tabIndex: -1,
113
+ onClick: onRemoveClick,
114
+ size: size,
115
+ "aria-hidden": hasMultipleActionTargets ? 'true' : 'false'
116
+ }) : null);
117
+ });
118
+ LabelToken.defaultProps = {
119
+ fillColor: '#999'
120
+ };
121
+ export default LabelToken;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ export interface TokenProps extends TokenBaseProps {
4
+ /**
5
+ * A function that renders a component before the token text
6
+ */
7
+ leadingVisual?: React.ComponentType<any>;
8
+ /**
9
+ * Whether the remove button should be rendered in the token
10
+ */
11
+ hideRemoveButton?: boolean;
12
+ }
13
+ declare const Token: React.ForwardRefExoticComponent<Pick<TokenProps, "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" | "leadingVisual" | "onRemove" | "isSelected" | "hideRemoveButton"> & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLSpanElement>>;
14
+ export default Token;
@@ -0,0 +1,57 @@
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, { forwardRef } from 'react';
4
+ import styled from 'styled-components';
5
+ import { get } from '../constants';
6
+ import TokenBase, { isTokenInteractive } from './TokenBase';
7
+ import RemoveTokenButton from './_RemoveTokenButton';
8
+ const tokenBorderWidthPx = 1;
9
+ const DefaultTokenStyled = styled(TokenBase).withConfig({
10
+ displayName: "Token__DefaultTokenStyled",
11
+ componentId: "sc-1dg52pw-0"
12
+ })(["background-color:", ";border-color:", ";border-style:solid;border-width:1px;color:", ";max-width:100%;padding-right:", ";&:hover{background-color:", ";box-shadow:", ";color:", ";}"], get('colors.neutral.subtle'), props => props.isSelected ? get('colors.fg.default') : get('colors.border.subtle'), props => props.isSelected ? get('colors.fg.default') : get('colors.fg.muted'), props => !props.hideRemoveButton ? 0 : undefined, props => isTokenInteractive(props) ? get('colors.neutral.muted') : undefined, props => isTokenInteractive(props) ? get('colors.shadow.medium') : undefined, props => isTokenInteractive(props) ? get('colors.fg.default') : undefined);
13
+ const TokenTextContainer = styled('span').withConfig({
14
+ displayName: "Token__TokenTextContainer",
15
+ componentId: "sc-1dg52pw-1"
16
+ })(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
17
+ const LeadingVisualContainer = styled('span').withConfig({
18
+ displayName: "Token__LeadingVisualContainer",
19
+ componentId: "sc-1dg52pw-2"
20
+ })(["flex-shrink:0;line-height:0;"]);
21
+ const Token = /*#__PURE__*/forwardRef((props, forwardedRef) => {
22
+ const {
23
+ as,
24
+ onRemove,
25
+ id,
26
+ leadingVisual: LeadingVisual,
27
+ ref,
28
+ text,
29
+ size,
30
+ hideRemoveButton,
31
+ ...rest
32
+ } = props;
33
+ const hasMultipleActionTargets = isTokenInteractive(props) && Boolean(onRemove) && !hideRemoveButton;
34
+
35
+ const onRemoveClick = e => {
36
+ e.stopPropagation();
37
+ onRemove && onRemove();
38
+ };
39
+
40
+ return /*#__PURE__*/React.createElement(DefaultTokenStyled, _extends({
41
+ as: as,
42
+ onRemove: onRemove,
43
+ hideRemoveButton: hideRemoveButton || !onRemove,
44
+ id: id === null || id === void 0 ? void 0 : id.toString(),
45
+ text: text,
46
+ ref: forwardedRef,
47
+ size: size
48
+ }, rest), LeadingVisual ? /*#__PURE__*/React.createElement(LeadingVisualContainer, null, /*#__PURE__*/React.createElement(LeadingVisual, null)) : null, /*#__PURE__*/React.createElement(TokenTextContainer, null, text), !hideRemoveButton && onRemove ? /*#__PURE__*/React.createElement(RemoveTokenButton, {
49
+ borderOffset: tokenBorderWidthPx,
50
+ parentTokenTag: as || 'span',
51
+ onClick: onRemoveClick,
52
+ size: size,
53
+ isParentInteractive: isTokenInteractive(props),
54
+ "aria-hidden": hasMultipleActionTargets ? 'true' : 'false'
55
+ }) : null);
56
+ });
57
+ export default Token;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ export declare type TokenSizeKeys = 'sm' | 'md' | 'lg' | 'xl';
3
+ export declare const tokenSizes: Record<TokenSizeKeys, string>;
4
+ export declare const defaultTokenSize = "md";
5
+ export interface TokenBaseProps extends Omit<React.HTMLProps<HTMLSpanElement | HTMLButtonElement | HTMLAnchorElement>, 'size' | 'id'> {
6
+ as?: 'button' | 'a' | 'span';
7
+ onRemove?: () => void;
8
+ isSelected?: boolean;
9
+ tabIndex?: number;
10
+ text: string;
11
+ id?: number | string;
12
+ size?: TokenSizeKeys;
13
+ }
14
+ export declare const isTokenInteractive: ({ as, onClick, onFocus, tabIndex }: TokenBaseProps) => boolean;
15
+ declare const TokenBase: import("styled-components").StyledComponent<"span", any, TokenBaseProps, never>;
16
+ export default TokenBase;
@@ -0,0 +1,71 @@
1
+ import styled from 'styled-components';
2
+ import { variant } from 'styled-system';
3
+ import { get } from '../constants';
4
+ export const tokenSizes = {
5
+ sm: '16px',
6
+ md: '20px',
7
+ lg: '24px',
8
+ xl: '32px'
9
+ };
10
+ export const defaultTokenSize = 'md';
11
+ export const isTokenInteractive = ({
12
+ as = 'span',
13
+ onClick,
14
+ onFocus,
15
+ tabIndex = -1
16
+ }) => Boolean(onFocus || onClick || tabIndex > -1 || ['a', 'button'].includes(as));
17
+ const variants = variant({
18
+ prop: 'size',
19
+ variants: {
20
+ sm: {
21
+ fontSize: 0,
22
+ gap: 1,
23
+ height: tokenSizes.sm,
24
+ paddingLeft: 1,
25
+ paddingRight: 1
26
+ },
27
+ md: {
28
+ fontSize: 0,
29
+ gap: 1,
30
+ height: tokenSizes.md,
31
+ paddingLeft: 2,
32
+ paddingRight: 2
33
+ },
34
+ lg: {
35
+ fontSize: 0,
36
+ gap: 2,
37
+ height: tokenSizes.lg,
38
+ paddingLeft: 2,
39
+ paddingRight: 2
40
+ },
41
+ xl: {
42
+ fontSize: 1,
43
+ gap: 2,
44
+ height: tokenSizes.xl,
45
+ paddingLeft: 3,
46
+ paddingRight: 3
47
+ }
48
+ }
49
+ });
50
+ const TokenBase = styled.span.attrs(({
51
+ text,
52
+ onRemove,
53
+ onKeyDown
54
+ }) => ({
55
+ onKeyDown: event => {
56
+ onKeyDown && onKeyDown(event);
57
+
58
+ if ((event.key === 'Backspace' || event.key === 'Delete') && onRemove) {
59
+ onRemove();
60
+ }
61
+ },
62
+ 'aria-label': onRemove ? `${text}, press backspace or delete to remove` : undefined
63
+ })).withConfig({
64
+ displayName: "TokenBase",
65
+ componentId: "opajvp-0"
66
+ })(["align-items:center;border-radius:999px;cursor:", ";display:inline-flex;font-weight:", ";text-decoration:none;white-space:nowrap;", ""], props => isTokenInteractive(props) ? 'pointer' : 'auto', get('fontWeights.bold'), variants);
67
+ TokenBase.defaultProps = {
68
+ as: 'span',
69
+ size: defaultTokenSize
70
+ };
71
+ export default TokenBase;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { TokenBaseProps } from './TokenBase';
3
+ export interface TokenProfileProps extends TokenBaseProps {
4
+ avatarSrc: string;
5
+ }
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" | "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" | "avatarSrc"> & React.RefAttributes<HTMLElement>>;
7
+ export default TokenProfile;
@@ -0,0 +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
+ import React, { forwardRef } 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'));
14
+ const TokenProfile = /*#__PURE__*/forwardRef(({
15
+ avatarSrc,
16
+ id,
17
+ ref,
18
+ size,
19
+ ...rest
20
+ }, forwardedRef) => /*#__PURE__*/React.createElement(StyledToken, _extends({
21
+ leadingVisual: () => /*#__PURE__*/React.createElement(Avatar, {
22
+ src: avatarSrc,
23
+ size: parseInt(tokenSizes[size || defaultTokenSize], 10) - parseInt(primitives.spacing.normal.spacer[1], 10) * 2
24
+ }),
25
+ size: size,
26
+ id: id === null || id === void 0 ? void 0 : id.toString(),
27
+ ref: forwardedRef
28
+ }, rest)));
29
+ export default TokenProfile;
@@ -0,0 +1,9 @@
1
+ import { TokenSizeKeys } from './TokenBase';
2
+ interface TokenButtonProps {
3
+ borderOffset?: number;
4
+ parentTokenTag: 'span' | 'button' | 'a';
5
+ size?: TokenSizeKeys;
6
+ isParentInteractive?: boolean;
7
+ }
8
+ declare const RemoveTokenButton: import("styled-components").StyledComponent<"span", any, TokenButtonProps, never>;
9
+ export default RemoveTokenButton;
@@ -0,0 +1,55 @@
1
+ import { XIcon } from '@primer/octicons-react';
2
+ import styled, { css } from 'styled-components';
3
+ import { variant } from 'styled-system';
4
+ import { get } from '../constants';
5
+ import { tokenSizes, defaultTokenSize } from './TokenBase';
6
+ const variants = variant({
7
+ prop: 'size',
8
+ variants: {
9
+ sm: {
10
+ height: tokenSizes.sm,
11
+ width: tokenSizes.sm
12
+ },
13
+ md: {
14
+ height: tokenSizes.md,
15
+ width: tokenSizes.md
16
+ },
17
+ lg: {
18
+ height: tokenSizes.lg,
19
+ width: tokenSizes.lg
20
+ },
21
+ xl: {
22
+ height: tokenSizes.xl,
23
+ width: tokenSizes.xl
24
+ }
25
+ }
26
+ });
27
+ 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'));
28
+
29
+ const getTokenButtonIconSize = variant => parseInt(tokenSizes[variant || defaultTokenSize], 10) * 0.75;
30
+
31
+ const RemoveTokenButton = styled.span.attrs(({
32
+ borderOffset,
33
+ parentTokenTag,
34
+ size,
35
+ isParentInteractive,
36
+ ...rest
37
+ }) => {
38
+ delete rest.children;
39
+ return {
40
+ borderOffset,
41
+ as: isParentInteractive ? 'span' : 'button',
42
+ tabIndex: isParentInteractive ? -1 : undefined,
43
+ 'aria-label': !isParentInteractive ? 'Remove token' : undefined,
44
+ children: /*#__PURE__*/React.createElement(XIcon, {
45
+ size: getTokenButtonIconSize(size)
46
+ })
47
+ };
48
+ }).withConfig({
49
+ displayName: "_RemoveTokenButton__RemoveTokenButton",
50
+ componentId: "sc-14lvcw1-0"
51
+ })(["", " ", " transform:", ";"], tokenButtonStyles, variants, props => `translate(${props.borderOffset}px, -${props.borderOffset}px)`);
52
+ RemoveTokenButton.defaultProps = {
53
+ size: defaultTokenSize
54
+ };
55
+ export default RemoveTokenButton;
@@ -0,0 +1,3 @@
1
+ export { default } from './Token';
2
+ export { default as LabelToken } from './LabelToken';
3
+ export { default as TokenProfile } from './TokenProfile';
@@ -0,0 +1,3 @@
1
+ export { default } from './Token';
2
+ export { default as LabelToken } from './LabelToken';
3
+ export { default as TokenProfile } from './TokenProfile';
@@ -102,6 +102,7 @@ export { default as Text } from './Text';
102
102
  export type { TextProps } from './Text';
103
103
  export { default as Timeline } from './Timeline';
104
104
  export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
105
+ export { default as Token, LabelToken, TokenProfile } from './Token';
105
106
  export { default as Tooltip } from './Tooltip';
106
107
  export type { TooltipProps } from './Tooltip';
107
108
  export { default as Truncate } from './Truncate';
package/lib-esm/index.js CHANGED
@@ -63,6 +63,7 @@ export { default as TabNav } from './TabNav';
63
63
  export { default as TextInput } from './TextInput';
64
64
  export { default as Text } from './Text';
65
65
  export { default as Timeline } from './Timeline';
66
+ export { default as Token, LabelToken, TokenProfile } from './Token';
66
67
  export { default as Tooltip } from './Tooltip';
67
68
  export { default as Truncate } from './Truncate';
68
69
  export { default as UnderlineNav } from './UnderlineNav';
package/lib-esm/sx.js ADDED
@@ -0,0 +1,5 @@
1
+ import css from '@styled-system/css';
2
+
3
+ const sx = props => css(props.sx);
4
+
5
+ export default sx;