@primer/components 0.0.0-202195193757 → 0.0.0-202195195659

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 (61) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/browser.esm.js +93 -74
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +85 -66
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/Autocomplete/AutocompleteInput.d.ts +1 -1
  7. package/lib/Autocomplete/AutocompleteInput.js +12 -12
  8. package/lib/Autocomplete/AutocompleteMenu.js +4 -6
  9. package/lib/Autocomplete/AutocompleteOverlay.js +1 -1
  10. package/lib/Autocomplete/index.d.ts +1 -1
  11. package/lib/TextInput.d.ts +1 -1
  12. package/lib/TextInputWithTokens.d.ts +298 -16
  13. package/lib/TextInputWithTokens.js +34 -26
  14. package/lib/Token/IssueLabelToken.d.ts +14 -0
  15. package/lib/Token/{TokenLabel.js → IssueLabelToken.js} +35 -28
  16. package/lib/Token/{TokenProfile.d.ts → ProfileToken.d.ts} +3 -3
  17. package/lib/Token/{TokenProfile.js → ProfileToken.js} +7 -7
  18. package/lib/Token/Token.d.ts +2 -2
  19. package/lib/Token/Token.js +34 -22
  20. package/lib/Token/TokenBase.d.ts +5 -5
  21. package/lib/Token/TokenBase.js +41 -25
  22. package/lib/Token/_RemoveTokenButton.d.ts +11 -2
  23. package/lib/Token/_RemoveTokenButton.js +53 -22
  24. package/lib/Token/_TokenTextContainer.d.ts +3 -0
  25. package/lib/Token/_TokenTextContainer.js +34 -0
  26. package/lib/Token/index.d.ts +2 -2
  27. package/lib/Token/index.js +6 -6
  28. package/lib/index.d.ts +1 -1
  29. package/lib/index.js +4 -4
  30. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +1 -1
  31. package/lib-esm/Autocomplete/AutocompleteInput.js +12 -12
  32. package/lib-esm/Autocomplete/AutocompleteMenu.js +4 -6
  33. package/lib-esm/Autocomplete/AutocompleteOverlay.js +1 -1
  34. package/lib-esm/Autocomplete/index.d.ts +1 -1
  35. package/lib-esm/TextInput.d.ts +1 -1
  36. package/lib-esm/TextInputWithTokens.d.ts +298 -16
  37. package/lib-esm/TextInputWithTokens.js +34 -26
  38. package/lib-esm/Token/IssueLabelToken.d.ts +14 -0
  39. package/lib-esm/Token/{TokenLabel.js → IssueLabelToken.js} +34 -28
  40. package/lib-esm/Token/{TokenProfile.d.ts → ProfileToken.d.ts} +3 -3
  41. package/lib-esm/Token/{TokenProfile.js → ProfileToken.js} +7 -7
  42. package/lib-esm/Token/Token.d.ts +2 -2
  43. package/lib-esm/Token/Token.js +33 -22
  44. package/lib-esm/Token/TokenBase.d.ts +5 -5
  45. package/lib-esm/Token/TokenBase.js +41 -25
  46. package/lib-esm/Token/_RemoveTokenButton.d.ts +11 -2
  47. package/lib-esm/Token/_RemoveTokenButton.js +52 -22
  48. package/lib-esm/Token/_TokenTextContainer.d.ts +3 -0
  49. package/lib-esm/Token/_TokenTextContainer.js +21 -0
  50. package/lib-esm/Token/index.d.ts +2 -2
  51. package/lib-esm/Token/index.js +2 -2
  52. package/lib-esm/_UnstyledTextInput.js +1 -1
  53. package/lib-esm/index.d.ts +1 -1
  54. package/lib-esm/index.js +1 -1
  55. package/package.json +1 -1
  56. package/lib/Token/TokenLabel.d.ts +0 -14
  57. package/lib/Token/_tokenButtonUtils.d.ts +0 -10
  58. package/lib/Token/_tokenButtonUtils.js +0 -42
  59. package/lib-esm/Token/TokenLabel.d.ts +0 -14
  60. package/lib-esm/Token/_tokenButtonUtils.d.ts +0 -10
  61. package/lib-esm/Token/_tokenButtonUtils.js +0 -26
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type * as Polymorphic from "@radix-ui/react-polymorphic";
2
+ import type * as Polymorphic from '@radix-ui/react-polymorphic';
3
3
  import { ComponentProps } from '../utils/types';
4
4
  declare type InternalAutocompleteInputProps = {
5
5
  as?: React.ComponentType<any>;
@@ -44,12 +44,12 @@ const AutocompleteInput = /*#__PURE__*/_react.default.forwardRef(({
44
44
  } = (0, _react.useContext)(_AutocompleteContext.AutocompleteContext);
45
45
  const combinedInputRef = (0, _useCombinedRefs.useCombinedRefs)(inputRef, forwardedRef);
46
46
  const [highlightRemainingText, setHighlightRemainingText] = (0, _react.useState)(true);
47
- const handleInputFocus = (0, _react.useCallback)(e => {
48
- onFocus && onFocus(e);
47
+ const handleInputFocus = (0, _react.useCallback)(event => {
48
+ onFocus && onFocus(event);
49
49
  setShowMenu && setShowMenu(true);
50
50
  }, [onFocus, setShowMenu]);
51
- const handleInputBlur = (0, _react.useCallback)(e => {
52
- onBlur && onBlur(e); // HACK: wait a tick and check the focused element before hiding the autocomplete menu
51
+ const handleInputBlur = (0, _react.useCallback)(event => {
52
+ onBlur && onBlur(event); // HACK: wait a tick and check the focused element before hiding the autocomplete menu
53
53
  // this prevents the menu from hiding when the user is clicking an option in the Autoselect.Menu,
54
54
  // but still hides the menu when the user blurs the input by tabbing out or clicking somewhere else on the page
55
55
 
@@ -59,28 +59,28 @@ const AutocompleteInput = /*#__PURE__*/_react.default.forwardRef(({
59
59
  }
60
60
  }, 0);
61
61
  }, [onBlur, setShowMenu]);
62
- const handleInputChange = (0, _react.useCallback)(e => {
63
- onChange && onChange(e);
64
- setInputValue && setInputValue(e.currentTarget.value);
62
+ const handleInputChange = (0, _react.useCallback)(event => {
63
+ onChange && onChange(event);
64
+ setInputValue && setInputValue(event.currentTarget.value);
65
65
 
66
66
  if (!showMenu) {
67
67
  setShowMenu && setShowMenu(true);
68
68
  }
69
69
  }, [onChange, setInputValue, setShowMenu, showMenu]);
70
- const handleInputKeyDown = (0, _react.useCallback)(e => {
70
+ const handleInputKeyDown = (0, _react.useCallback)(event => {
71
71
  var _inputRef$current;
72
72
 
73
- if (e.key === 'Backspace') {
73
+ if (event.key === 'Backspace') {
74
74
  setHighlightRemainingText(false);
75
75
  }
76
76
 
77
- if (e.key === 'Escape' && inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
77
+ if (event.key === 'Escape' && inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
78
78
  setInputValue && setInputValue('');
79
79
  inputRef.current.value = '';
80
80
  }
81
81
  }, [inputRef, setInputValue, setHighlightRemainingText]);
82
- const handleInputKeyUp = (0, _react.useCallback)(e => {
83
- if (e.key === 'Backspace') {
82
+ const handleInputKeyUp = (0, _react.useCallback)(event => {
83
+ if (event.key === 'Backspace') {
84
84
  setHighlightRemainingText(true);
85
85
  }
86
86
  }, [setHighlightRemainingText]);
@@ -50,8 +50,6 @@ function getItemById(itemId, items) {
50
50
  return items.find(item => item.id === itemId);
51
51
  }
52
52
 
53
- ;
54
-
55
53
  // TODO: consider making 'aria-labelledby' required
56
54
  function AutocompleteMenu(props) {
57
55
  const {
@@ -76,7 +74,7 @@ function AutocompleteMenu(props) {
76
74
  loading,
77
75
  selectionVariant,
78
76
  filterFn = getDefaultItemFilter(inputValue),
79
- "aria-labelledby": ariaLabelledBy,
77
+ 'aria-labelledby': ariaLabelledBy,
80
78
  onOpenChange,
81
79
  onSelectedChange = getDefaultOnSelectionChange(setInputValue),
82
80
  customScrollContainerRef
@@ -88,7 +86,7 @@ function AutocompleteMenu(props) {
88
86
  }) => id));
89
87
  const selectableItems = (0, _react.useMemo)(() => items.map(selectableItem => {
90
88
  return { ...selectableItem,
91
- role: "option",
89
+ role: 'option',
92
90
  id: selectableItem.id,
93
91
  selected: selectionVariant === 'multiple' ? selectedItemIds.includes(selectableItem.id) : undefined,
94
92
  onAction: item => {
@@ -143,7 +141,7 @@ function AutocompleteMenu(props) {
143
141
  }
144
142
 
145
143
  if (current) {
146
- const selectedItem = selectableItems.find(item => item.id.toString() === (current === null || current === void 0 ? void 0 : current.dataset.id));
144
+ const selectedItem = selectableItems.find(item => item.id.toString() === current.dataset.id);
147
145
  setHighlightedItem(selectedItem);
148
146
  setIsMenuDirectlyActivated && setIsMenuDirectlyActivated(directlyActivated);
149
147
  }
@@ -200,7 +198,7 @@ function AutocompleteMenu(props) {
200
198
  }, /*#__PURE__*/_react.default.createElement(_.Spinner, null)) : /*#__PURE__*/_react.default.createElement("div", {
201
199
  ref: listContainerRef
202
200
  }, allItemsToRender.length ? /*#__PURE__*/_react.default.createElement(_ActionList.ActionList, {
203
- selectionVariant: "multiple" // have to typecast to `ItemProps` because we have an extra property
201
+ selectionVariant: "multiple" // have to typecast to `ItemProps` because we have an extra property
204
202
  // on `items` for Autocomplete: `metadata`
205
203
  ,
206
204
  items: allItemsToRender,
@@ -58,7 +58,7 @@ const AutocompleteOverlay = ({
58
58
  left: position === null || position === void 0 ? void 0 : position.left,
59
59
  visibility: showMenu ? 'visible' : 'hidden',
60
60
  sx: {
61
- overflow: "auto"
61
+ overflow: 'auto'
62
62
  }
63
63
  }, overlayProps), children);
64
64
  };
@@ -1,2 +1,2 @@
1
1
  export { default } from './Autocomplete';
2
- export type { AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps, } from './Autocomplete';
2
+ export type { AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps } from './Autocomplete';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
3
- import type * as Polymorphic from "@radix-ui/react-polymorphic";
3
+ import type * as Polymorphic from '@radix-ui/react-polymorphic';
4
4
  import { SxProp } from './sx';
5
5
  import { ComponentProps } from './utils/types';
6
6
  import UnstyledTextInput from './_UnstyledTextInput';
@@ -1,17 +1,11 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
2
- import { ComponentProps, MandateProps } from './utils/types';
3
- import Token, { TokenProps } from './Token/Token';
4
- import TokenLabel, { TokenLabelProps } from './Token/TokenLabel';
5
- import TokenProfile, { TokenProfileProps } from './Token/TokenProfile';
1
+ import React from 'react';
2
+ import { ComponentProps } from './utils/types';
6
3
  import { TokenSizeKeys } from './Token/TokenBase';
7
- import { TextInputProps } from './TextInput';
8
- declare type AnyTokenProps = Partial<TokenProps & TokenLabelProps & TokenProfileProps>;
9
- declare type TokenDatum = MandateProps<AnyTokenProps, 'id' | 'text'>;
10
- declare type TextInputWithTokensInternalProps = {
4
+ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
11
5
  /**
12
6
  * The array of tokens to render
13
7
  */
14
- tokens: TokenDatum[];
8
+ tokens: any[];
15
9
  /**
16
10
  * The function that gets called when a token is removed
17
11
  */
@@ -19,7 +13,7 @@ declare type TextInputWithTokensInternalProps = {
19
13
  /**
20
14
  * The component used to render each token
21
15
  */
22
- tokenComponent?: React.ComponentType<ComponentPropsWithoutRef<typeof Token> | ComponentPropsWithoutRef<typeof TokenLabel> | ComponentPropsWithoutRef<typeof TokenProfile>>;
16
+ tokenComponent?: React.ComponentType<any> | undefined;
23
17
  /**
24
18
  * The maximum height of the component. If the content in the input exceeds this height,
25
19
  * it will scroll vertically
@@ -28,16 +22,304 @@ declare type TextInputWithTokensInternalProps = {
28
22
  /**
29
23
  * Whether tokens should render inline horizontally. By default, tokens wrap to new lines.
30
24
  */
31
- preventTokenWrapping?: boolean;
25
+ preventTokenWrapping?: boolean | undefined;
32
26
  /**
33
27
  * The size of the tokens
34
28
  */
35
- tokenSizeVariant?: TokenSizeKeys;
29
+ size?: TokenSizeKeys | undefined;
36
30
  /**
37
31
  * Whether the remove buttons should be rendered in the tokens
38
32
  */
39
- hideTokenRemoveButtons?: boolean;
40
- } & TextInputProps;
41
- declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<TextInputWithTokensInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
33
+ hideTokenRemoveButtons?: boolean | undefined;
34
+ } & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
35
+ ref?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined;
36
+ }, string | number | symbol> & {
37
+ className?: string | undefined;
38
+ icon?: React.ComponentType<{
39
+ className?: string | undefined;
40
+ }> | undefined;
41
+ inputComponent?: React.ComponentType<HTMLInputElement> | undefined;
42
+ wrapperRef?: React.RefObject<HTMLSpanElement> | undefined;
43
+ } & Pick<{
44
+ color?: string | undefined;
45
+ maxWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
46
+ minWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
47
+ translate?: "yes" | "no" | undefined;
48
+ width?: import("styled-system").ResponsiveValue<import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
49
+ hidden?: boolean | undefined;
50
+ children?: React.ReactNode;
51
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
52
+ slot?: string | undefined;
53
+ style?: React.CSSProperties | undefined;
54
+ title?: string | undefined;
55
+ key?: React.Key | null | undefined;
56
+ defaultChecked?: boolean | undefined;
57
+ defaultValue?: string | number | readonly string[] | undefined;
58
+ suppressContentEditableWarning?: boolean | undefined;
59
+ suppressHydrationWarning?: boolean | undefined;
60
+ accessKey?: string | undefined;
61
+ className?: string | undefined;
62
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
63
+ contextMenu?: string | undefined;
64
+ dir?: string | undefined;
65
+ draggable?: (boolean | "true" | "false") | undefined;
66
+ id?: string | undefined;
67
+ lang?: string | undefined;
68
+ placeholder?: string | undefined;
69
+ spellCheck?: (boolean | "true" | "false") | undefined;
70
+ tabIndex?: number | undefined;
71
+ radioGroup?: string | undefined;
72
+ role?: React.AriaRole | undefined;
73
+ about?: string | undefined;
74
+ datatype?: string | undefined;
75
+ inlist?: any;
76
+ prefix?: string | undefined;
77
+ property?: string | undefined;
78
+ resource?: string | undefined;
79
+ typeof?: string | undefined;
80
+ vocab?: string | undefined;
81
+ autoCapitalize?: string | undefined;
82
+ autoCorrect?: string | undefined;
83
+ autoSave?: string | undefined;
84
+ itemProp?: string | undefined;
85
+ itemScope?: boolean | undefined;
86
+ itemType?: string | undefined;
87
+ itemID?: string | undefined;
88
+ itemRef?: string | undefined;
89
+ results?: number | undefined;
90
+ security?: string | undefined;
91
+ unselectable?: "on" | "off" | undefined;
92
+ inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
93
+ is?: string | undefined;
94
+ 'aria-activedescendant'?: string | undefined;
95
+ 'aria-atomic'?: boolean | "true" | "false" | undefined;
96
+ 'aria-autocomplete'?: "none" | "list" | "inline" | "both" | undefined;
97
+ 'aria-busy'?: boolean | "true" | "false" | undefined;
98
+ 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
99
+ 'aria-colcount'?: number | undefined;
100
+ 'aria-colindex'?: number | undefined;
101
+ 'aria-colspan'?: number | undefined;
102
+ 'aria-controls'?: string | undefined;
103
+ 'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
104
+ 'aria-describedby'?: string | undefined;
105
+ 'aria-details'?: string | undefined;
106
+ 'aria-disabled'?: boolean | "true" | "false" | undefined;
107
+ 'aria-dropeffect'?: "none" | "link" | "copy" | "execute" | "move" | "popup" | undefined;
108
+ 'aria-errormessage'?: string | undefined;
109
+ 'aria-expanded'?: boolean | "true" | "false" | undefined;
110
+ 'aria-flowto'?: string | undefined;
111
+ 'aria-grabbed'?: boolean | "true" | "false" | undefined;
112
+ 'aria-haspopup'?: boolean | "grid" | "dialog" | "menu" | "listbox" | "tree" | "true" | "false" | undefined;
113
+ 'aria-hidden'?: boolean | "true" | "false" | undefined;
114
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
115
+ 'aria-keyshortcuts'?: string | undefined;
116
+ 'aria-label'?: string | undefined;
117
+ 'aria-labelledby'?: string | undefined;
118
+ 'aria-level'?: number | undefined;
119
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
120
+ 'aria-modal'?: boolean | "true" | "false" | undefined;
121
+ 'aria-multiline'?: boolean | "true" | "false" | undefined;
122
+ 'aria-multiselectable'?: boolean | "true" | "false" | undefined;
123
+ 'aria-orientation'?: "horizontal" | "vertical" | undefined;
124
+ 'aria-owns'?: string | undefined;
125
+ 'aria-placeholder'?: string | undefined;
126
+ 'aria-posinset'?: number | undefined;
127
+ 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
128
+ 'aria-readonly'?: boolean | "true" | "false" | undefined;
129
+ 'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
130
+ 'aria-required'?: boolean | "true" | "false" | undefined;
131
+ 'aria-roledescription'?: string | undefined;
132
+ 'aria-rowcount'?: number | undefined;
133
+ 'aria-rowindex'?: number | undefined;
134
+ 'aria-rowspan'?: number | undefined;
135
+ 'aria-selected'?: boolean | "true" | "false" | undefined;
136
+ 'aria-setsize'?: number | undefined;
137
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
138
+ 'aria-valuemax'?: number | undefined;
139
+ 'aria-valuemin'?: number | undefined;
140
+ 'aria-valuenow'?: number | undefined;
141
+ 'aria-valuetext'?: string | undefined;
142
+ dangerouslySetInnerHTML?: {
143
+ __html: string;
144
+ } | undefined;
145
+ onCopy?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
146
+ onCopyCapture?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
147
+ onCut?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
148
+ onCutCapture?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
149
+ onPaste?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
150
+ onPasteCapture?: React.ClipboardEventHandler<HTMLSpanElement> | undefined;
151
+ onCompositionEnd?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
152
+ onCompositionEndCapture?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
153
+ onCompositionStart?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
154
+ onCompositionStartCapture?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
155
+ onCompositionUpdate?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
156
+ onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLSpanElement> | undefined;
157
+ onFocus?: React.FocusEventHandler<HTMLSpanElement> | undefined;
158
+ onFocusCapture?: React.FocusEventHandler<HTMLSpanElement> | undefined;
159
+ onBlur?: React.FocusEventHandler<HTMLSpanElement> | undefined;
160
+ onBlurCapture?: React.FocusEventHandler<HTMLSpanElement> | undefined;
161
+ onChange?: React.FormEventHandler<HTMLSpanElement> | undefined;
162
+ onChangeCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
163
+ onBeforeInput?: React.FormEventHandler<HTMLSpanElement> | undefined;
164
+ onBeforeInputCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
165
+ onInput?: React.FormEventHandler<HTMLSpanElement> | undefined;
166
+ onInputCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
167
+ onReset?: React.FormEventHandler<HTMLSpanElement> | undefined;
168
+ onResetCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
169
+ onSubmit?: React.FormEventHandler<HTMLSpanElement> | undefined;
170
+ onSubmitCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
171
+ onInvalid?: React.FormEventHandler<HTMLSpanElement> | undefined;
172
+ onInvalidCapture?: React.FormEventHandler<HTMLSpanElement> | undefined;
173
+ onLoad?: React.ReactEventHandler<HTMLSpanElement> | undefined;
174
+ onLoadCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
175
+ onError?: React.ReactEventHandler<HTMLSpanElement> | undefined;
176
+ onErrorCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
177
+ onKeyDown?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
178
+ onKeyDownCapture?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
179
+ onKeyPress?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
180
+ onKeyPressCapture?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
181
+ onKeyUp?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
182
+ onKeyUpCapture?: React.KeyboardEventHandler<HTMLSpanElement> | undefined;
183
+ onAbort?: React.ReactEventHandler<HTMLSpanElement> | undefined;
184
+ onAbortCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
185
+ onCanPlay?: React.ReactEventHandler<HTMLSpanElement> | undefined;
186
+ onCanPlayCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
187
+ onCanPlayThrough?: React.ReactEventHandler<HTMLSpanElement> | undefined;
188
+ onCanPlayThroughCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
189
+ onDurationChange?: React.ReactEventHandler<HTMLSpanElement> | undefined;
190
+ onDurationChangeCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
191
+ onEmptied?: React.ReactEventHandler<HTMLSpanElement> | undefined;
192
+ onEmptiedCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
193
+ onEncrypted?: React.ReactEventHandler<HTMLSpanElement> | undefined;
194
+ onEncryptedCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
195
+ onEnded?: React.ReactEventHandler<HTMLSpanElement> | undefined;
196
+ onEndedCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
197
+ onLoadedData?: React.ReactEventHandler<HTMLSpanElement> | undefined;
198
+ onLoadedDataCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
199
+ onLoadedMetadata?: React.ReactEventHandler<HTMLSpanElement> | undefined;
200
+ onLoadedMetadataCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
201
+ onLoadStart?: React.ReactEventHandler<HTMLSpanElement> | undefined;
202
+ onLoadStartCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
203
+ onPause?: React.ReactEventHandler<HTMLSpanElement> | undefined;
204
+ onPauseCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
205
+ onPlay?: React.ReactEventHandler<HTMLSpanElement> | undefined;
206
+ onPlayCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
207
+ onPlaying?: React.ReactEventHandler<HTMLSpanElement> | undefined;
208
+ onPlayingCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
209
+ onProgress?: React.ReactEventHandler<HTMLSpanElement> | undefined;
210
+ onProgressCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
211
+ onRateChange?: React.ReactEventHandler<HTMLSpanElement> | undefined;
212
+ onRateChangeCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
213
+ onSeeked?: React.ReactEventHandler<HTMLSpanElement> | undefined;
214
+ onSeekedCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
215
+ onSeeking?: React.ReactEventHandler<HTMLSpanElement> | undefined;
216
+ onSeekingCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
217
+ onStalled?: React.ReactEventHandler<HTMLSpanElement> | undefined;
218
+ onStalledCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
219
+ onSuspend?: React.ReactEventHandler<HTMLSpanElement> | undefined;
220
+ onSuspendCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
221
+ onTimeUpdate?: React.ReactEventHandler<HTMLSpanElement> | undefined;
222
+ onTimeUpdateCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
223
+ onVolumeChange?: React.ReactEventHandler<HTMLSpanElement> | undefined;
224
+ onVolumeChangeCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
225
+ onWaiting?: React.ReactEventHandler<HTMLSpanElement> | undefined;
226
+ onWaitingCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
227
+ onAuxClick?: React.MouseEventHandler<HTMLSpanElement> | undefined;
228
+ onAuxClickCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
229
+ onClick?: React.MouseEventHandler<HTMLSpanElement> | undefined;
230
+ onClickCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
231
+ onContextMenu?: React.MouseEventHandler<HTMLSpanElement> | undefined;
232
+ onContextMenuCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
233
+ onDoubleClick?: React.MouseEventHandler<HTMLSpanElement> | undefined;
234
+ onDoubleClickCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
235
+ onDrag?: React.DragEventHandler<HTMLSpanElement> | undefined;
236
+ onDragCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
237
+ onDragEnd?: React.DragEventHandler<HTMLSpanElement> | undefined;
238
+ onDragEndCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
239
+ onDragEnter?: React.DragEventHandler<HTMLSpanElement> | undefined;
240
+ onDragEnterCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
241
+ onDragExit?: React.DragEventHandler<HTMLSpanElement> | undefined;
242
+ onDragExitCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
243
+ onDragLeave?: React.DragEventHandler<HTMLSpanElement> | undefined;
244
+ onDragLeaveCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
245
+ onDragOver?: React.DragEventHandler<HTMLSpanElement> | undefined;
246
+ onDragOverCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
247
+ onDragStart?: React.DragEventHandler<HTMLSpanElement> | undefined;
248
+ onDragStartCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
249
+ onDrop?: React.DragEventHandler<HTMLSpanElement> | undefined;
250
+ onDropCapture?: React.DragEventHandler<HTMLSpanElement> | undefined;
251
+ onMouseDown?: React.MouseEventHandler<HTMLSpanElement> | undefined;
252
+ onMouseDownCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
253
+ onMouseEnter?: React.MouseEventHandler<HTMLSpanElement> | undefined;
254
+ onMouseLeave?: React.MouseEventHandler<HTMLSpanElement> | undefined;
255
+ onMouseMove?: React.MouseEventHandler<HTMLSpanElement> | undefined;
256
+ onMouseMoveCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
257
+ onMouseOut?: React.MouseEventHandler<HTMLSpanElement> | undefined;
258
+ onMouseOutCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
259
+ onMouseOver?: React.MouseEventHandler<HTMLSpanElement> | undefined;
260
+ onMouseOverCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
261
+ onMouseUp?: React.MouseEventHandler<HTMLSpanElement> | undefined;
262
+ onMouseUpCapture?: React.MouseEventHandler<HTMLSpanElement> | undefined;
263
+ onSelect?: React.ReactEventHandler<HTMLSpanElement> | undefined;
264
+ onSelectCapture?: React.ReactEventHandler<HTMLSpanElement> | undefined;
265
+ onTouchCancel?: React.TouchEventHandler<HTMLSpanElement> | undefined;
266
+ onTouchCancelCapture?: React.TouchEventHandler<HTMLSpanElement> | undefined;
267
+ onTouchEnd?: React.TouchEventHandler<HTMLSpanElement> | undefined;
268
+ onTouchEndCapture?: React.TouchEventHandler<HTMLSpanElement> | undefined;
269
+ onTouchMove?: React.TouchEventHandler<HTMLSpanElement> | undefined;
270
+ onTouchMoveCapture?: React.TouchEventHandler<HTMLSpanElement> | undefined;
271
+ onTouchStart?: React.TouchEventHandler<HTMLSpanElement> | undefined;
272
+ onTouchStartCapture?: React.TouchEventHandler<HTMLSpanElement> | undefined;
273
+ onPointerDown?: React.PointerEventHandler<HTMLSpanElement> | undefined;
274
+ onPointerDownCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
275
+ onPointerMove?: React.PointerEventHandler<HTMLSpanElement> | undefined;
276
+ onPointerMoveCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
277
+ onPointerUp?: React.PointerEventHandler<HTMLSpanElement> | undefined;
278
+ onPointerUpCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
279
+ onPointerCancel?: React.PointerEventHandler<HTMLSpanElement> | undefined;
280
+ onPointerCancelCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
281
+ onPointerEnter?: React.PointerEventHandler<HTMLSpanElement> | undefined;
282
+ onPointerEnterCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
283
+ onPointerLeave?: React.PointerEventHandler<HTMLSpanElement> | undefined;
284
+ onPointerLeaveCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
285
+ onPointerOver?: React.PointerEventHandler<HTMLSpanElement> | undefined;
286
+ onPointerOverCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
287
+ onPointerOut?: React.PointerEventHandler<HTMLSpanElement> | undefined;
288
+ onPointerOutCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
289
+ onGotPointerCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
290
+ onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
291
+ onLostPointerCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
292
+ onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLSpanElement> | undefined;
293
+ onScroll?: React.UIEventHandler<HTMLSpanElement> | undefined;
294
+ onScrollCapture?: React.UIEventHandler<HTMLSpanElement> | undefined;
295
+ onWheel?: React.WheelEventHandler<HTMLSpanElement> | undefined;
296
+ onWheelCapture?: React.WheelEventHandler<HTMLSpanElement> | undefined;
297
+ onAnimationStart?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
298
+ onAnimationStartCapture?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
299
+ onAnimationEnd?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
300
+ onAnimationEndCapture?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
301
+ onAnimationIteration?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
302
+ onAnimationIterationCapture?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
303
+ onTransitionEnd?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
304
+ onTransitionEndCapture?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
305
+ block?: boolean | undefined;
306
+ sx?: import("@styled-system/css").SystemStyleObject | undefined;
307
+ disabled?: boolean | undefined;
308
+ variant?: "large" | "small" | undefined;
309
+ hasIcon?: boolean | undefined;
310
+ contrast?: boolean | undefined;
311
+ } & {
312
+ theme?: any;
313
+ }, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "disabled" | "variant" | "contrast"> & Omit<Pick<{
314
+ [x: string]: any;
315
+ [x: number]: any;
316
+ } & {
317
+ theme?: any;
318
+ } & {
319
+ as?: string | React.ComponentType<any> | undefined;
320
+ forwardedAs?: string | React.ComponentType<any> | undefined;
321
+ }, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast" | "inputComponent" | "wrapperRef"> & {
322
+ as?: "input" | undefined;
323
+ }, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
42
324
  export declare type TextInputWithTokensProps = ComponentProps<typeof TextInputWithTokens>;
43
325
  export default TextInputWithTokens;
@@ -36,10 +36,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
36
36
  const InputWrapper = _styledComponents.default.div.withConfig({
37
37
  displayName: "TextInputWithTokens__InputWrapper",
38
38
  componentId: "sc-8z94t5-0"
39
- })(["order:1;flex-grow:1;"]);
39
+ })(["order:1;flex-grow:1;"]); // type AnyTokenProps = Partial<TokenProps & IssueLabelTokenProps & ProfileTokenProps>
40
+ // type TokenDatum = MandateProps<AnyTokenProps, 'id' | 'text'>
41
+
40
42
 
41
43
  // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
42
- const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
44
+ function TextInputWithTokensInnerComponent({
43
45
  icon: IconComponent,
44
46
  contrast,
45
47
  className,
@@ -51,12 +53,12 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
51
53
  onTokenRemove,
52
54
  tokenComponent: TokenComponent,
53
55
  preventTokenWrapping,
54
- tokenSizeVariant,
56
+ size,
55
57
  hideTokenRemoveButtons,
56
58
  selectedTokenIdx,
57
59
  setSelectedTokenIdx,
58
60
  ...rest
59
- }, externalRef) => {
61
+ }, externalRef) {
60
62
  const ref = (0, _hooks.useProvidedRefOrCreate)(externalRef);
61
63
  const {
62
64
  onFocus,
@@ -64,8 +66,8 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
64
66
  ...inputPropsRest
65
67
  } = (0, _props.omit)(rest);
66
68
 
67
- const handleTokenFocus = tokenIdx => () => {
68
- setSelectedTokenIdx(tokenIdx);
69
+ const handleTokenFocus = tokenIndex => () => {
70
+ setSelectedTokenIdx(tokenIndex);
69
71
  };
70
72
 
71
73
  const handleTokenBlur = () => {
@@ -76,7 +78,7 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
76
78
  if (e.key === 'Escape') {
77
79
  var _ref$current;
78
80
 
79
- ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
81
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
80
82
  }
81
83
  };
82
84
 
@@ -92,7 +94,7 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
92
94
  onKeyDown(e);
93
95
  }
94
96
 
95
- if (ref !== null && ref !== void 0 && (_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.value) {
97
+ if ((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.value) {
96
98
  return;
97
99
  }
98
100
 
@@ -101,11 +103,11 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
101
103
  if (e.key === 'Backspace' && lastToken) {
102
104
  onTokenRemove(lastToken.id);
103
105
 
104
- if (ref !== null && ref !== void 0 && ref.current) {
106
+ if (ref.current) {
105
107
  // TODO: eliminate the first hack by making changes to the Autocomplete component
106
108
  //
107
109
  // HACKS:
108
- // 1. Directly setting `ref.current.value` instead of updating state because the autocomplete
110
+ // 1. Directly setting `ref.current.value` instead of updating state because the autocomplete
109
111
  // highlight behavior doesn't work correctly if we update the value with a setState action in onChange
110
112
  // 2. Adding an extra space so that when I backspace, it doesn't delete the last letter
111
113
  ref.current.value = `${lastToken.text} `;
@@ -115,7 +117,7 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
115
117
  setTimeout(() => {
116
118
  var _ref$current3;
117
119
 
118
- ref === null || ref === void 0 ? void 0 : (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.select();
120
+ (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.select();
119
121
  }, 1);
120
122
  }
121
123
  };
@@ -131,7 +133,7 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
131
133
  sx: {
132
134
  height: '100%'
133
135
  }
134
- }, inputPropsRest))), tokens !== null && tokens !== void 0 && tokens.length && TokenComponent ? tokens.map(({
136
+ }, inputPropsRest))), tokens.length && TokenComponent ? tokens.map(({
135
137
  id,
136
138
  ...tokenRest
137
139
  }, i) => /*#__PURE__*/_react.default.createElement(TokenComponent, _extends({
@@ -140,21 +142,23 @@ const TextInputWithTokensComponent = /*#__PURE__*/_react.default.forwardRef(({
140
142
  onBlur: handleTokenBlur,
141
143
  onKeyUp: handleTokenKeyUp,
142
144
  isSelected: selectedTokenIdx === i,
143
- handleRemove: () => {
145
+ onRemove: () => {
144
146
  onTokenRemove(id);
145
147
  },
146
148
  hideRemoveButton: hideTokenRemoveButtons,
147
- variant: tokenSizeVariant,
149
+ size: size,
148
150
  tabIndex: 0
149
151
  }, tokenRest))) : null);
150
- });
152
+ }
153
+
154
+ const TextInputWithTokensInnerComponentWithRef = /*#__PURE__*/_react.default.forwardRef(TextInputWithTokensInnerComponent);
151
155
 
152
- const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(({
156
+ function TextInputWithTokensComponent({
153
157
  tokens,
154
158
  onTokenRemove,
155
159
  sx: sxProp,
156
160
  ...props
157
- }, ref) => {
161
+ }, ref) {
158
162
  const localInputRef = (0, _react.useRef)(null);
159
163
  const combinedInputRef = (0, _useCombinedRefs.useCombinedRefs)(localInputRef, ref);
160
164
  const [selectedTokenIdx, setSelectedTokenIdx] = (0, _react.useState)();
@@ -187,7 +191,7 @@ const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(({
187
191
  return combinedInputRef.current || undefined;
188
192
  }
189
193
 
190
- return containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.children[nextIndex];
194
+ return (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.children[nextIndex];
191
195
  }
192
196
  }, [selectedTokenIdx]);
193
197
 
@@ -197,7 +201,7 @@ const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(({
197
201
  if (selectedTokenIdx) {
198
202
  var _containerRef$current2;
199
203
 
200
- const nextElementToFocus = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIdx];
204
+ const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIdx];
201
205
  nextElementToFocus.focus();
202
206
  }
203
207
  };
@@ -205,17 +209,17 @@ const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(({
205
209
  return /*#__PURE__*/_react.default.createElement(_TextInput.default, _extends({
206
210
  ref: combinedInputRef,
207
211
  wrapperRef: containerRef,
208
- as: TextInputWithTokensComponent,
212
+ as: TextInputWithTokensInnerComponentWithRef,
209
213
  selectedTokenIdx: selectedTokenIdx,
210
214
  setSelectedTokenIdx: setSelectedTokenIdx,
211
215
  tokens: tokens,
212
216
  onTokenRemove: handleTokenRemove,
213
217
  sx: {
214
- 'alignItems': 'center',
215
- 'flexWrap': props.preventTokenWrapping ? 'nowrap' : 'wrap',
216
- 'gap': '0.25rem',
218
+ alignItems: 'center',
219
+ flexWrap: props.preventTokenWrapping ? 'nowrap' : 'wrap',
220
+ gap: '0.25rem',
217
221
  '> *': {
218
- 'flexShrink': 0
222
+ flexShrink: 0
219
223
  },
220
224
  ...(props.block ? {
221
225
  display: 'flex',
@@ -224,11 +228,15 @@ const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(({
224
228
  ...sxProp
225
229
  }
226
230
  }, props));
227
- });
231
+ }
232
+
233
+ TextInputWithTokensComponent.displayName = "TextInputWithTokensComponent";
234
+
235
+ const TextInputWithTokens = /*#__PURE__*/_react.default.forwardRef(TextInputWithTokensComponent);
228
236
 
229
237
  TextInputWithTokens.defaultProps = {
230
238
  tokenComponent: _Token.default,
231
- tokenSizeVariant: "xl",
239
+ size: 'xlarge',
232
240
  hideTokenRemoveButtons: false
233
241
  };
234
242
  TextInputWithTokens.displayName = 'TextInputWithTokens';