@primer/components 0.0.0-20219283497 → 0.0.0-2021929153151
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 +19 -1
- package/dist/browser.esm.js +447 -440
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +446 -439
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList2/Description.d.ts +6 -0
- package/lib/ActionList2/Description.js +53 -0
- package/lib/ActionList2/Divider.d.ts +5 -0
- package/lib/ActionList2/Divider.js +33 -0
- package/lib/ActionList2/Group.d.ts +11 -0
- package/lib/ActionList2/Group.js +55 -0
- package/lib/ActionList2/Header.d.ts +26 -0
- package/lib/ActionList2/Header.js +55 -0
- package/lib/ActionList2/Item.d.ts +48 -0
- package/lib/ActionList2/Item.js +204 -0
- package/lib/ActionList2/List.d.ts +26 -0
- package/lib/ActionList2/List.js +56 -0
- package/lib/ActionList2/Selection.d.ts +5 -0
- package/lib/ActionList2/Selection.js +73 -0
- package/lib/ActionList2/Visuals.d.ts +11 -0
- package/lib/ActionList2/Visuals.js +90 -0
- package/lib/ActionList2/hacks.d.ts +30 -0
- package/lib/ActionList2/hacks.js +38 -0
- package/lib/ActionList2/index.d.ts +28 -0
- package/lib/ActionList2/index.js +42 -0
- package/lib/ActionMenu.js +2 -2
- package/lib/Autocomplete/Autocomplete.d.ts +30 -30
- package/lib/Autocomplete/AutocompleteInput.d.ts +30 -30
- package/lib/Button/Button.d.ts +30 -30
- package/lib/Button/ButtonBase.d.ts +1 -1
- package/lib/Button/ButtonClose.d.ts +35 -35
- package/lib/Button/ButtonDanger.d.ts +30 -30
- package/lib/Button/ButtonInvisible.d.ts +30 -30
- package/lib/Button/ButtonOutline.d.ts +30 -30
- package/lib/Button/ButtonPrimary.d.ts +30 -30
- package/lib/Button/ButtonStyles.js +1 -1
- package/lib/CircleBadge.d.ts +2 -2
- package/lib/CircleOcticon.d.ts +38 -38
- package/lib/Dialog/Dialog.d.ts +4 -4
- package/lib/Dialog/Dialog.js +22 -12
- package/lib/Dialog.d.ts +41 -41
- package/lib/Dropdown.d.ts +215 -137
- package/lib/Dropdown.js +5 -6
- package/lib/DropdownMenu/DropdownButton.d.ts +37 -37
- package/lib/FilterList.d.ts +30 -30
- package/lib/Flash.d.ts +1 -1
- package/lib/Label.d.ts +1 -1
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +187 -187
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +34 -30
- package/lib/TextInputWithTokens.js +102 -29
- package/lib/Timeline.d.ts +39 -39
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/Token.js +13 -2
- package/lib/Token/TokenBase.js +0 -4
- package/lib/Token/_RemoveTokenButton.js +15 -2
- package/lib/_TextInputWrapper.js +1 -1
- package/lib/constants.js +1 -3
- package/lib/experiments.d.ts +1 -0
- package/lib/experiments.js +18 -0
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -8
- package/lib/sx.d.ts +10 -2
- package/lib/sx.js +8 -0
- package/lib/theme.d.ts +78 -0
- package/lib/theme.js +3 -1
- package/lib/utils/create-slots.d.ts +17 -0
- package/lib/utils/create-slots.js +105 -0
- package/lib/utils/testing.d.ts +1 -1
- package/lib/utils/types/KeyPaths.d.ts +3 -0
- package/lib/utils/types/KeyPaths.js +1 -0
- package/lib/utils/use-force-update.d.ts +1 -0
- package/lib/utils/use-force-update.js +19 -0
- package/lib-esm/ActionList2/Description.d.ts +6 -0
- package/lib-esm/ActionList2/Description.js +37 -0
- package/lib-esm/ActionList2/Divider.d.ts +5 -0
- package/lib-esm/ActionList2/Divider.js +21 -0
- package/lib-esm/ActionList2/Group.d.ts +11 -0
- package/lib-esm/ActionList2/Group.js +38 -0
- package/lib-esm/ActionList2/Header.d.ts +26 -0
- package/lib-esm/ActionList2/Header.js +45 -0
- package/lib-esm/ActionList2/Item.d.ts +48 -0
- package/lib-esm/ActionList2/Item.js +176 -0
- package/lib-esm/ActionList2/List.d.ts +26 -0
- package/lib-esm/ActionList2/List.js +38 -0
- package/lib-esm/ActionList2/Selection.d.ts +5 -0
- package/lib-esm/ActionList2/Selection.js +55 -0
- package/lib-esm/ActionList2/Visuals.d.ts +11 -0
- package/lib-esm/ActionList2/Visuals.js +68 -0
- package/lib-esm/ActionList2/hacks.d.ts +30 -0
- package/lib-esm/ActionList2/hacks.js +30 -0
- package/lib-esm/ActionList2/index.d.ts +28 -0
- package/lib-esm/ActionList2/index.js +29 -0
- package/lib-esm/ActionMenu.js +2 -2
- package/lib-esm/Autocomplete/Autocomplete.d.ts +30 -30
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +30 -30
- package/lib-esm/Button/Button.d.ts +30 -30
- package/lib-esm/Button/ButtonBase.d.ts +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +35 -35
- package/lib-esm/Button/ButtonDanger.d.ts +30 -30
- package/lib-esm/Button/ButtonInvisible.d.ts +30 -30
- package/lib-esm/Button/ButtonOutline.d.ts +30 -30
- package/lib-esm/Button/ButtonPrimary.d.ts +30 -30
- package/lib-esm/Button/ButtonStyles.js +1 -1
- package/lib-esm/CircleBadge.d.ts +2 -2
- package/lib-esm/CircleOcticon.d.ts +38 -38
- package/lib-esm/Dialog/Dialog.d.ts +4 -4
- package/lib-esm/Dialog/Dialog.js +21 -12
- package/lib-esm/Dialog.d.ts +41 -41
- package/lib-esm/Dropdown.d.ts +215 -137
- package/lib-esm/Dropdown.js +3 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +37 -37
- package/lib-esm/FilterList.d.ts +30 -30
- package/lib-esm/Flash.d.ts +1 -1
- package/lib-esm/Label.d.ts +1 -1
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +187 -187
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +34 -30
- package/lib-esm/TextInputWithTokens.js +101 -30
- package/lib-esm/Timeline.d.ts +39 -39
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Token/Token.js +13 -2
- package/lib-esm/Token/TokenBase.js +0 -4
- package/lib-esm/Token/_RemoveTokenButton.js +11 -2
- package/lib-esm/_TextInputWrapper.js +1 -1
- package/lib-esm/constants.js +1 -3
- package/lib-esm/experiments.d.ts +1 -0
- package/lib-esm/experiments.js +2 -0
- package/lib-esm/index.d.ts +0 -2
- package/lib-esm/index.js +0 -1
- package/lib-esm/sx.d.ts +10 -2
- package/lib-esm/sx.js +3 -1
- package/lib-esm/theme.d.ts +78 -0
- package/lib-esm/theme.js +2 -1
- package/lib-esm/utils/create-slots.d.ts +17 -0
- package/lib-esm/utils/create-slots.js +84 -0
- package/lib-esm/utils/testing.d.ts +1 -1
- package/lib-esm/utils/types/KeyPaths.d.ts +3 -0
- package/lib-esm/utils/types/KeyPaths.js +1 -0
- package/lib-esm/utils/use-force-update.d.ts +1 -0
- package/lib-esm/utils/use-force-update.js +6 -0
- package/package.json +4 -1
- package/lib/NewButton/button.d.ts +0 -581
- package/lib/NewButton/button.js +0 -297
- package/lib/NewButton/counter.d.ts +0 -6
- package/lib/NewButton/counter.js +0 -33
- package/lib/NewButton/index.d.ts +0 -4
- package/lib/NewButton/index.js +0 -21
- package/lib-esm/NewButton/button.d.ts +0 -581
- package/lib-esm/NewButton/button.js +0 -273
- package/lib-esm/NewButton/counter.d.ts +0 -6
- package/lib-esm/NewButton/counter.js +0 -21
- package/lib-esm/NewButton/index.d.ts +0 -4
- package/lib-esm/NewButton/index.js +0 -3
@@ -10,6 +10,6 @@ declare type SelectMenuItemInteralProps = {
|
|
10
10
|
as?: React.ElementType;
|
11
11
|
selected?: boolean;
|
12
12
|
} & ComponentProps<typeof StyledItem>;
|
13
|
-
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<SelectMenuItemInteralProps, "translate" | "
|
13
|
+
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<SelectMenuItemInteralProps, "translate" | "hidden" | "children" | "theme" | "slot" | "style" | "title" | "type" | "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" | "sx" | "as" | "selected" | keyof SystemCommonProps | "media" | "target" | "href" | "hrefLang" | "referrerPolicy" | "rel" | "download" | "ping"> & React.RefAttributes<HTMLAnchorElement>>;
|
14
14
|
export declare type SelectMenuItemProps = ComponentProps<typeof SelectMenuItem>;
|
15
15
|
export default SelectMenuItem;
|
@@ -10,6 +10,6 @@ declare const ModalWrapper: import("styled-components").StyledComponent<"div", a
|
|
10
10
|
align?: "left" | "right" | undefined;
|
11
11
|
} & SystemCommonProps & SxProp, never>;
|
12
12
|
declare type SelectMenuModalInternalProps = Pick<StyledModalProps, 'width'> & ComponentProps<typeof ModalWrapper>;
|
13
|
-
declare const SelectMenuModal: React.ForwardRefExoticComponent<Pick<SelectMenuModalInternalProps, "backgroundColor" | "color" | "display" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "opacity" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "translate" | "width" | "margin" | "padding" | "
|
13
|
+
declare const SelectMenuModal: React.ForwardRefExoticComponent<Pick<SelectMenuModalInternalProps, "backgroundColor" | "color" | "display" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "opacity" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "translate" | "width" | "margin" | "padding" | "hidden" | "children" | "theme" | "p" | "slot" | "style" | "title" | "bg" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "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" | "sx" | "align"> & React.RefAttributes<HTMLDivElement>>;
|
14
14
|
export declare type SelectMenuModalProps = ComponentProps<typeof SelectMenuModal>;
|
15
15
|
export default SelectMenuModal;
|
@@ -32,6 +32,10 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
32
32
|
* Whether the remove buttons should be rendered in the tokens
|
33
33
|
*/
|
34
34
|
hideTokenRemoveButtons?: boolean | undefined;
|
35
|
+
/**
|
36
|
+
* The number of tokens to display before truncating
|
37
|
+
*/
|
38
|
+
visibleTokenCount?: number | undefined;
|
35
39
|
} & Pick<Omit<Pick<{
|
36
40
|
[x: string]: any;
|
37
41
|
[x: number]: any;
|
@@ -40,7 +44,7 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
40
44
|
} & {
|
41
45
|
as?: string | React.ComponentType<any> | undefined;
|
42
46
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
43
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "
|
47
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "className" | "sx" | "variant" | "disabled" | "contrast"> & {
|
44
48
|
className?: string | undefined;
|
45
49
|
icon?: React.ComponentType<{
|
46
50
|
className?: string | undefined;
|
@@ -51,10 +55,13 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
51
55
|
minWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
52
56
|
translate?: "yes" | "no" | undefined;
|
53
57
|
width?: import("styled-system").ResponsiveValue<import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
58
|
+
hidden?: boolean | undefined;
|
59
|
+
children?: React.ReactNode;
|
60
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
54
61
|
slot?: string | undefined;
|
55
62
|
style?: React.CSSProperties | undefined;
|
56
63
|
title?: string | undefined;
|
57
|
-
|
64
|
+
block?: boolean | undefined;
|
58
65
|
key?: React.Key | null | undefined;
|
59
66
|
defaultChecked?: boolean | undefined;
|
60
67
|
defaultValue?: string | number | readonly string[] | undefined;
|
@@ -62,15 +69,14 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
62
69
|
suppressHydrationWarning?: boolean | undefined;
|
63
70
|
accessKey?: string | undefined;
|
64
71
|
className?: string | undefined;
|
65
|
-
contentEditable?:
|
72
|
+
contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
|
66
73
|
contextMenu?: string | undefined;
|
67
74
|
dir?: string | undefined;
|
68
|
-
draggable?: (boolean | "
|
69
|
-
hidden?: boolean | undefined;
|
75
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
70
76
|
id?: string | undefined;
|
71
77
|
lang?: string | undefined;
|
72
78
|
placeholder?: string | undefined;
|
73
|
-
spellCheck?: (boolean | "
|
79
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
74
80
|
tabIndex?: number | undefined;
|
75
81
|
radioGroup?: string | undefined;
|
76
82
|
role?: React.AriaRole | undefined;
|
@@ -93,57 +99,56 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
93
99
|
results?: number | undefined;
|
94
100
|
security?: string | undefined;
|
95
101
|
unselectable?: "on" | "off" | undefined;
|
96
|
-
inputMode?: "
|
102
|
+
inputMode?: "search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
97
103
|
is?: string | undefined;
|
98
104
|
'aria-activedescendant'?: string | undefined;
|
99
|
-
'aria-atomic'?: boolean | "
|
100
|
-
'aria-autocomplete'?: "
|
101
|
-
'aria-busy'?: boolean | "
|
102
|
-
'aria-checked'?: boolean | "
|
105
|
+
'aria-atomic'?: boolean | "false" | "true" | undefined;
|
106
|
+
'aria-autocomplete'?: "none" | "both" | "inline" | "list" | undefined;
|
107
|
+
'aria-busy'?: boolean | "false" | "true" | undefined;
|
108
|
+
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
103
109
|
'aria-colcount'?: number | undefined;
|
104
110
|
'aria-colindex'?: number | undefined;
|
105
111
|
'aria-colspan'?: number | undefined;
|
106
112
|
'aria-controls'?: string | undefined;
|
107
|
-
'aria-current'?: boolean | "time" | "
|
113
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
108
114
|
'aria-describedby'?: string | undefined;
|
109
115
|
'aria-details'?: string | undefined;
|
110
|
-
'aria-disabled'?: boolean | "
|
116
|
+
'aria-disabled'?: boolean | "false" | "true" | undefined;
|
111
117
|
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
112
118
|
'aria-errormessage'?: string | undefined;
|
113
|
-
'aria-expanded'?: boolean | "
|
119
|
+
'aria-expanded'?: boolean | "false" | "true" | undefined;
|
114
120
|
'aria-flowto'?: string | undefined;
|
115
|
-
'aria-grabbed'?: boolean | "
|
116
|
-
'aria-haspopup'?: boolean | "grid" | "dialog" | "
|
117
|
-
'aria-hidden'?: boolean | "
|
118
|
-
'aria-invalid'?: boolean | "
|
121
|
+
'aria-grabbed'?: boolean | "false" | "true" | undefined;
|
122
|
+
'aria-haspopup'?: boolean | "grid" | "dialog" | "menu" | "listbox" | "false" | "true" | "tree" | undefined;
|
123
|
+
'aria-hidden'?: boolean | "false" | "true" | undefined;
|
124
|
+
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
119
125
|
'aria-keyshortcuts'?: string | undefined;
|
120
126
|
'aria-label'?: string | undefined;
|
121
127
|
'aria-labelledby'?: string | undefined;
|
122
128
|
'aria-level'?: number | undefined;
|
123
129
|
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
124
|
-
'aria-modal'?: boolean | "
|
125
|
-
'aria-multiline'?: boolean | "
|
126
|
-
'aria-multiselectable'?: boolean | "
|
130
|
+
'aria-modal'?: boolean | "false" | "true" | undefined;
|
131
|
+
'aria-multiline'?: boolean | "false" | "true" | undefined;
|
132
|
+
'aria-multiselectable'?: boolean | "false" | "true" | undefined;
|
127
133
|
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
128
134
|
'aria-owns'?: string | undefined;
|
129
135
|
'aria-placeholder'?: string | undefined;
|
130
136
|
'aria-posinset'?: number | undefined;
|
131
|
-
'aria-pressed'?: boolean | "
|
132
|
-
'aria-readonly'?: boolean | "
|
137
|
+
'aria-pressed'?: boolean | "mixed" | "false" | "true" | undefined;
|
138
|
+
'aria-readonly'?: boolean | "false" | "true" | undefined;
|
133
139
|
'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
134
|
-
'aria-required'?: boolean | "
|
140
|
+
'aria-required'?: boolean | "false" | "true" | undefined;
|
135
141
|
'aria-roledescription'?: string | undefined;
|
136
142
|
'aria-rowcount'?: number | undefined;
|
137
143
|
'aria-rowindex'?: number | undefined;
|
138
144
|
'aria-rowspan'?: number | undefined;
|
139
|
-
'aria-selected'?: boolean | "
|
145
|
+
'aria-selected'?: boolean | "false" | "true" | undefined;
|
140
146
|
'aria-setsize'?: number | undefined;
|
141
147
|
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
142
148
|
'aria-valuemax'?: number | undefined;
|
143
149
|
'aria-valuemin'?: number | undefined;
|
144
150
|
'aria-valuenow'?: number | undefined;
|
145
151
|
'aria-valuetext'?: string | undefined;
|
146
|
-
children?: React.ReactNode;
|
147
152
|
dangerouslySetInnerHTML?: {
|
148
153
|
__html: string;
|
149
154
|
} | undefined;
|
@@ -307,15 +312,14 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
307
312
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLSpanElement> | undefined;
|
308
313
|
onTransitionEnd?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
|
309
314
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLSpanElement> | undefined;
|
310
|
-
|
311
|
-
sx?: import("@styled-system/css").SystemStyleObject | undefined;
|
312
|
-
disabled?: boolean | undefined;
|
315
|
+
sx?: import("./sx").BetterSystemStyleObject | undefined;
|
313
316
|
variant?: "small" | "large" | undefined;
|
317
|
+
disabled?: boolean | undefined;
|
314
318
|
hasIcon?: boolean | undefined;
|
315
319
|
contrast?: boolean | undefined;
|
316
320
|
} & {
|
317
321
|
theme?: any;
|
318
|
-
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "
|
322
|
+
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "variant" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement> & {
|
319
323
|
selectedTokenIndex: number | undefined;
|
320
324
|
setSelectedTokenIndex: React.Dispatch<React.SetStateAction<number | undefined>>;
|
321
325
|
}, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
@@ -9,9 +9,17 @@ import Token from './Token/Token';
|
|
9
9
|
import { useProvidedRefOrCreate } from './hooks';
|
10
10
|
import UnstyledTextInput from './_UnstyledTextInput';
|
11
11
|
import TextInputWrapper from './_TextInputWrapper';
|
12
|
-
import Box from './Box';
|
12
|
+
import Box from './Box';
|
13
|
+
import Text from './Text';
|
14
|
+
import { isFocusable } from './utils/iterateFocusableElements'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
15
|
+
|
16
|
+
const overflowCountFontSizeMap = {
|
17
|
+
small: 0,
|
18
|
+
medium: 1,
|
19
|
+
large: 1,
|
20
|
+
extralarge: 2
|
21
|
+
}; // using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
13
22
|
|
14
|
-
// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
15
23
|
function TextInputWithTokensInnerComponent({
|
16
24
|
icon: IconComponent,
|
17
25
|
contrast,
|
@@ -31,9 +39,11 @@ function TextInputWithTokensInnerComponent({
|
|
31
39
|
minWidth: minWidthProp,
|
32
40
|
maxWidth: maxWidthProp,
|
33
41
|
variant: variantProp,
|
42
|
+
visibleTokenCount,
|
34
43
|
...rest
|
35
44
|
}, externalRef) {
|
36
45
|
const {
|
46
|
+
onBlur,
|
37
47
|
onFocus,
|
38
48
|
onKeyDown,
|
39
49
|
...inputPropsRest
|
@@ -42,6 +52,7 @@ function TextInputWithTokensInnerComponent({
|
|
42
52
|
const localInputRef = useRef(null);
|
43
53
|
const combinedInputRef = useCombinedRefs(localInputRef, ref);
|
44
54
|
const [selectedTokenIndex, setSelectedTokenIndex] = useState();
|
55
|
+
const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
|
45
56
|
const {
|
46
57
|
containerRef
|
47
58
|
} = useFocusZone({
|
@@ -76,14 +87,25 @@ function TextInputWithTokensInnerComponent({
|
|
76
87
|
}, [selectedTokenIndex]);
|
77
88
|
|
78
89
|
const handleTokenRemove = tokenId => {
|
79
|
-
onTokenRemove(tokenId);
|
90
|
+
onTokenRemove(tokenId); // HACK: wait a tick for the the token node to be removed from the DOM
|
80
91
|
|
81
|
-
|
82
|
-
var _containerRef$current2;
|
92
|
+
setTimeout(() => {
|
93
|
+
var _containerRef$current2, _containerRef$current3;
|
83
94
|
|
84
|
-
const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex];
|
85
|
-
|
86
|
-
|
95
|
+
const nextElementToFocus = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children[selectedTokenIndex || 0]; // when removing the first token by keying "Backspace" or "Delete",
|
96
|
+
// `nextFocusableElement` is the div that wraps the input
|
97
|
+
|
98
|
+
const firstFocusable = nextElementToFocus && isFocusable(nextElementToFocus) ? nextElementToFocus : Array.from(((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []).find(el => isFocusable(el));
|
99
|
+
|
100
|
+
if (firstFocusable) {
|
101
|
+
firstFocusable.focus();
|
102
|
+
} else {
|
103
|
+
var _ref$current;
|
104
|
+
|
105
|
+
// if there are no tokens left, focus the input
|
106
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
107
|
+
}
|
108
|
+
}, 0);
|
87
109
|
};
|
88
110
|
|
89
111
|
const handleTokenFocus = tokenIndex => () => {
|
@@ -91,30 +113,55 @@ function TextInputWithTokensInnerComponent({
|
|
91
113
|
};
|
92
114
|
|
93
115
|
const handleTokenBlur = () => {
|
94
|
-
setSelectedTokenIndex(undefined);
|
116
|
+
setSelectedTokenIndex(undefined); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
117
|
+
// this prevents the tokens from hiding when the user is moving focus between tokens,
|
118
|
+
// but still hides the tokens when the user blurs the token by tabbing out or clicking somewhere else on the page
|
119
|
+
|
120
|
+
setTimeout(() => {
|
121
|
+
var _containerRef$current4;
|
122
|
+
|
123
|
+
if (!((_containerRef$current4 = containerRef.current) !== null && _containerRef$current4 !== void 0 && _containerRef$current4.contains(document.activeElement)) && visibleTokenCount) {
|
124
|
+
setTokensAreTruncated(true);
|
125
|
+
}
|
126
|
+
}, 0);
|
95
127
|
};
|
96
128
|
|
97
|
-
const handleTokenKeyUp =
|
98
|
-
if (
|
99
|
-
var _ref$
|
129
|
+
const handleTokenKeyUp = event => {
|
130
|
+
if (event.key === 'Escape') {
|
131
|
+
var _ref$current2;
|
100
132
|
|
101
|
-
(_ref$
|
133
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
|
102
134
|
}
|
103
135
|
};
|
104
136
|
|
105
|
-
const handleInputFocus =
|
106
|
-
onFocus && onFocus(
|
137
|
+
const handleInputFocus = event => {
|
138
|
+
onFocus && onFocus(event);
|
107
139
|
setSelectedTokenIndex(undefined);
|
140
|
+
visibleTokenCount && setTokensAreTruncated(false);
|
141
|
+
};
|
142
|
+
|
143
|
+
const handleInputBlur = event => {
|
144
|
+
onBlur && onBlur(event); // HACK: wait a tick and check the focused element before hiding truncated tokens
|
145
|
+
// this prevents the tokens from hiding when the user is moving focus from the input to a token,
|
146
|
+
// but still hides the tokens when the user blurs the input by tabbing out or clicking somewhere else on the page
|
147
|
+
|
148
|
+
setTimeout(() => {
|
149
|
+
var _containerRef$current5;
|
150
|
+
|
151
|
+
if (!((_containerRef$current5 = containerRef.current) !== null && _containerRef$current5 !== void 0 && _containerRef$current5.contains(document.activeElement)) && visibleTokenCount) {
|
152
|
+
setTokensAreTruncated(true);
|
153
|
+
}
|
154
|
+
}, 0);
|
108
155
|
};
|
109
156
|
|
110
157
|
const handleInputKeyDown = e => {
|
111
|
-
var _ref$
|
158
|
+
var _ref$current3;
|
112
159
|
|
113
160
|
if (onKeyDown) {
|
114
161
|
onKeyDown(e);
|
115
162
|
}
|
116
163
|
|
117
|
-
if ((_ref$
|
164
|
+
if ((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.value) {
|
118
165
|
return;
|
119
166
|
}
|
120
167
|
|
@@ -135,13 +182,24 @@ function TextInputWithTokensInnerComponent({
|
|
135
182
|
|
136
183
|
|
137
184
|
setTimeout(() => {
|
138
|
-
var _ref$
|
185
|
+
var _ref$current4;
|
139
186
|
|
140
|
-
(_ref$
|
187
|
+
(_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.select();
|
141
188
|
}, 0);
|
142
189
|
}
|
143
190
|
};
|
144
191
|
|
192
|
+
const focusInput = () => {
|
193
|
+
var _combinedInputRef$cur;
|
194
|
+
|
195
|
+
(_combinedInputRef$cur = combinedInputRef.current) === null || _combinedInputRef$cur === void 0 ? void 0 : _combinedInputRef$cur.focus();
|
196
|
+
};
|
197
|
+
|
198
|
+
const preventTokenClickPropagation = event => {
|
199
|
+
event.stopPropagation();
|
200
|
+
};
|
201
|
+
|
202
|
+
const visibleTokens = tokensAreTruncated ? tokens.slice(0, visibleTokenCount) : tokens;
|
145
203
|
return /*#__PURE__*/React.createElement(TextInputWrapper, {
|
146
204
|
block: block,
|
147
205
|
className: className,
|
@@ -153,15 +211,8 @@ function TextInputWithTokensInnerComponent({
|
|
153
211
|
minWidth: minWidthProp,
|
154
212
|
maxWidth: maxWidthProp,
|
155
213
|
variant: variantProp,
|
156
|
-
|
157
|
-
sx: {
|
158
|
-
alignItems: 'center',
|
159
|
-
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
160
|
-
gap: '0.25rem',
|
161
|
-
'> *': {
|
162
|
-
flexShrink: 0
|
163
|
-
},
|
164
|
-
...(block ? {
|
214
|
+
onClick: focusInput,
|
215
|
+
sx: { ...(block ? {
|
165
216
|
display: 'flex',
|
166
217
|
width: '100%'
|
167
218
|
} : {}),
|
@@ -174,6 +225,21 @@ function TextInputWithTokensInnerComponent({
|
|
174
225
|
} : {}),
|
175
226
|
...sxProp
|
176
227
|
}
|
228
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
229
|
+
ref: containerRef,
|
230
|
+
display: "flex",
|
231
|
+
sx: {
|
232
|
+
alignItems: 'center',
|
233
|
+
flexWrap: preventTokenWrapping ? 'nowrap' : 'wrap',
|
234
|
+
marginLeft: '-0.25rem',
|
235
|
+
marginBottom: '-0.25rem',
|
236
|
+
flexGrow: 1,
|
237
|
+
'> *': {
|
238
|
+
flexShrink: 0,
|
239
|
+
marginLeft: '0.25rem',
|
240
|
+
marginBottom: '0.25rem'
|
241
|
+
}
|
242
|
+
}
|
177
243
|
}, /*#__PURE__*/React.createElement(Box, {
|
178
244
|
sx: {
|
179
245
|
order: 1,
|
@@ -185,12 +251,13 @@ function TextInputWithTokensInnerComponent({
|
|
185
251
|
ref: combinedInputRef,
|
186
252
|
disabled: disabled,
|
187
253
|
onFocus: handleInputFocus,
|
254
|
+
onBlur: handleInputBlur,
|
188
255
|
onKeyDown: handleInputKeyDown,
|
189
256
|
type: "text",
|
190
257
|
sx: {
|
191
258
|
height: '100%'
|
192
259
|
}
|
193
|
-
}, inputPropsRest))),
|
260
|
+
}, inputPropsRest))), TokenComponent ? visibleTokens.map(({
|
194
261
|
id,
|
195
262
|
...tokenRest
|
196
263
|
}, i) => /*#__PURE__*/React.createElement(TokenComponent, _extends({
|
@@ -198,6 +265,7 @@ function TextInputWithTokensInnerComponent({
|
|
198
265
|
onFocus: handleTokenFocus(i),
|
199
266
|
onBlur: handleTokenBlur,
|
200
267
|
onKeyUp: handleTokenKeyUp,
|
268
|
+
onClick: preventTokenClickPropagation,
|
201
269
|
isSelected: selectedTokenIndex === i,
|
202
270
|
onRemove: () => {
|
203
271
|
handleTokenRemove(id);
|
@@ -205,7 +273,10 @@ function TextInputWithTokensInnerComponent({
|
|
205
273
|
hideRemoveButton: hideTokenRemoveButtons,
|
206
274
|
size: size,
|
207
275
|
tabIndex: 0
|
208
|
-
}, tokenRest))) : null
|
276
|
+
}, tokenRest))) : null, tokensAreTruncated ? /*#__PURE__*/React.createElement(Text, {
|
277
|
+
color: "fg.muted",
|
278
|
+
fontSize: size && overflowCountFontSizeMap[size]
|
279
|
+
}, "+", tokens.length - visibleTokens.length) : null));
|
209
280
|
}
|
210
281
|
|
211
282
|
TextInputWithTokensInnerComponent.displayName = "TextInputWithTokensInnerComponent";
|