@primer/components 0.0.0-2021830164741 → 0.0.0-202183017829
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 +3 -1
- package/dist/browser.esm.js +250 -290
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +318 -358
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib/Dialog/ConfirmationDialog.js +3 -3
- package/lib/Dialog/Dialog.d.ts +5 -0
- package/lib/Dialog/Dialog.js +16 -4
- package/lib/FilteredActionList/FilteredActionList.js +31 -5
- package/lib/Overlay.d.ts +1 -2
- package/lib/Overlay.js +5 -10
- package/lib/SelectMenu/SelectMenu.d.ts +2 -8
- package/lib/TextInput.d.ts +3 -6
- package/lib/TextInput.js +10 -9
- package/lib/hooks/useOverlay.d.ts +1 -2
- package/lib/hooks/useOverlay.js +6 -11
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -16
- package/lib/utils/types.d.ts +0 -3
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -11
- package/lib-esm/Dialog/ConfirmationDialog.js +3 -3
- package/lib-esm/Dialog/Dialog.d.ts +5 -0
- package/lib-esm/Dialog/Dialog.js +17 -5
- package/lib-esm/FilteredActionList/FilteredActionList.js +31 -3
- package/lib-esm/Overlay.d.ts +1 -2
- package/lib-esm/Overlay.js +5 -8
- package/lib-esm/SelectMenu/SelectMenu.d.ts +2 -8
- package/lib-esm/TextInput.d.ts +3 -6
- package/lib-esm/TextInput.js +9 -8
- package/lib-esm/hooks/useOverlay.d.ts +1 -2
- package/lib-esm/hooks/useOverlay.js +6 -11
- package/lib-esm/index.d.ts +0 -2
- package/lib-esm/index.js +0 -2
- package/lib-esm/utils/types.d.ts +0 -3
- package/package.json +6 -9
- package/lib/Autocomplete/Autocomplete.d.ts +0 -31
- package/lib/Autocomplete/Autocomplete.js +0 -60
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -14
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib/Autocomplete/AutocompleteInput.js +0 -148
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -78
- package/lib/Autocomplete/AutocompleteMenu.js +0 -257
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- package/lib/Badge/Badge.d.ts +0 -8
- package/lib/Badge/Badge.js +0 -59
- package/lib/Badge/BadgeState.d.ts +0 -13
- package/lib/Badge/BadgeState.js +0 -51
- package/lib/Badge/_badgeStyleUtils.d.ts +0 -3
- package/lib/Badge/_badgeStyleUtils.js +0 -39
- package/lib/TextInputTokens.d.ts +0 -43
- package/lib/TextInputTokens.js +0 -237
- package/lib/Token/Token.d.ts +0 -14
- package/lib/Token/Token.js +0 -76
- package/lib/Token/TokenBase.d.ts +0 -16
- package/lib/Token/TokenBase.js +0 -90
- package/lib/Token/TokenLabel.d.ts +0 -14
- package/lib/Token/TokenLabel.js +0 -141
- package/lib/Token/TokenProfile.d.ts +0 -7
- package/lib/Token/TokenProfile.js +0 -50
- package/lib/Token/_RemoveTokenButton.d.ts +0 -3
- package/lib/Token/_RemoveTokenButton.js +0 -45
- package/lib/Token/_tokenButtonUtils.d.ts +0 -10
- package/lib/Token/_tokenButtonUtils.js +0 -42
- package/lib/_UnstyledTextInput.d.ts +0 -2
- package/lib/_UnstyledTextInput.js +0 -20
- package/lib/utils/scrollIntoViewingArea.d.ts +0 -1
- package/lib/utils/scrollIntoViewingArea.js +0 -39
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -31
- package/lib-esm/Autocomplete/Autocomplete.js +0 -40
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -14
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -129
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -78
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -231
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/index.js +0 -1
- package/lib-esm/Badge/Badge.d.ts +0 -8
- package/lib-esm/Badge/Badge.js +0 -44
- package/lib-esm/Badge/BadgeState.d.ts +0 -13
- package/lib-esm/Badge/BadgeState.js +0 -40
- package/lib-esm/Badge/_badgeStyleUtils.d.ts +0 -3
- package/lib-esm/Badge/_badgeStyleUtils.js +0 -29
- package/lib-esm/TextInputTokens.d.ts +0 -43
- package/lib-esm/TextInputTokens.js +0 -210
- package/lib-esm/Token/Token.d.ts +0 -14
- package/lib-esm/Token/Token.js +0 -57
- package/lib-esm/Token/TokenBase.d.ts +0 -16
- package/lib-esm/Token/TokenBase.js +0 -70
- package/lib-esm/Token/TokenLabel.d.ts +0 -14
- package/lib-esm/Token/TokenLabel.js +0 -121
- package/lib-esm/Token/TokenProfile.d.ts +0 -7
- package/lib-esm/Token/TokenProfile.js +0 -29
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -3
- package/lib-esm/Token/_RemoveTokenButton.js +0 -30
- package/lib-esm/Token/_tokenButtonUtils.d.ts +0 -10
- package/lib-esm/Token/_tokenButtonUtils.js +0 -26
- package/lib-esm/_UnstyledTextInput.d.ts +0 -2
- package/lib-esm/_UnstyledTextInput.js +0 -7
- package/lib-esm/utils/scrollIntoViewingArea.d.ts +0 -1
- package/lib-esm/utils/scrollIntoViewingArea.js +0 -30
@@ -1,7 +1,6 @@
|
|
1
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
2
|
|
3
3
|
import React, { useCallback, useEffect, useRef } from 'react';
|
4
|
-
import { useSSRSafeId } from '@react-aria/ssr';
|
5
4
|
import TextInput from '../TextInput';
|
6
5
|
import Box from '../Box';
|
7
6
|
import { ActionList } from '../ActionList';
|
@@ -12,7 +11,36 @@ import styled from 'styled-components';
|
|
12
11
|
import { get } from '../constants';
|
13
12
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate';
|
14
13
|
import useScrollFlash from '../hooks/useScrollFlash';
|
15
|
-
import {
|
14
|
+
import { useSSRSafeId } from '@react-aria/ssr';
|
15
|
+
|
16
|
+
function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
|
17
|
+
const {
|
18
|
+
top: childTop,
|
19
|
+
bottom: childBottom
|
20
|
+
} = child.getBoundingClientRect();
|
21
|
+
const {
|
22
|
+
top: containerTop,
|
23
|
+
bottom: containerBottom
|
24
|
+
} = container.getBoundingClientRect();
|
25
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
26
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
27
|
+
|
28
|
+
if (isChildTopAboveViewingArea) {
|
29
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
30
|
+
container.scrollTo({
|
31
|
+
behavior,
|
32
|
+
top: scrollHeightToChildTop - margin
|
33
|
+
});
|
34
|
+
} else if (isChildBottomBelowViewingArea) {
|
35
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
36
|
+
container.scrollTo({
|
37
|
+
behavior,
|
38
|
+
top: scrollHeightToChildBottom + margin
|
39
|
+
});
|
40
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
41
|
+
|
42
|
+
}
|
43
|
+
|
16
44
|
const StyledHeader = styled.div.withConfig({
|
17
45
|
displayName: "FilteredActionList__StyledHeader",
|
18
46
|
componentId: "yg3jkv-0"
|
@@ -66,7 +94,7 @@ export function FilteredActionList({
|
|
66
94
|
useEffect(() => {
|
67
95
|
// if items changed, we want to instantly move active descendant into view
|
68
96
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
69
|
-
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current,
|
97
|
+
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
70
98
|
}
|
71
99
|
}, [items]);
|
72
100
|
useScrollFlash(scrollContainerRef);
|
package/lib-esm/Overlay.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { ComponentProps } from './utils/types';
|
|
4
4
|
import { TouchOrMouseEvent } from './hooks';
|
5
5
|
import { SxProp } from './sx';
|
6
6
|
import { AnchorSide } from './behaviors/anchoredPosition';
|
7
|
-
|
7
|
+
declare type StyledOverlayProps = {
|
8
8
|
width?: keyof typeof widthMap;
|
9
9
|
height?: keyof typeof heightMap;
|
10
10
|
maxHeight?: keyof Omit<typeof heightMap, 'auto' | 'initial'>;
|
@@ -40,7 +40,6 @@ export declare type OverlayProps = {
|
|
40
40
|
top: number;
|
41
41
|
left: number;
|
42
42
|
portalContainerName?: string;
|
43
|
-
preventFocusOnOpen?: boolean;
|
44
43
|
} & Omit<ComponentProps<typeof StyledOverlay>, 'visibility' | keyof SystemPositionProps>;
|
45
44
|
/**
|
46
45
|
* An `Overlay` is a flexible floating surface, used to display transient content such as menus,
|
package/lib-esm/Overlay.js
CHANGED
@@ -92,7 +92,6 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
92
92
|
left,
|
93
93
|
anchorSide,
|
94
94
|
portalContainerName,
|
95
|
-
preventFocusOnOpen,
|
96
95
|
...rest
|
97
96
|
}, forwardedRef) => {
|
98
97
|
const overlayRef = useRef(null);
|
@@ -108,8 +107,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
108
107
|
onEscape,
|
109
108
|
ignoreClickRefs,
|
110
109
|
onClickOutside,
|
111
|
-
initialFocusRef
|
112
|
-
preventFocusOnOpen
|
110
|
+
initialFocusRef
|
113
111
|
});
|
114
112
|
useEffect(() => {
|
115
113
|
var _combinedRef$current;
|
@@ -138,7 +136,9 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
138
136
|
easing: slideAnimationEasing
|
139
137
|
});
|
140
138
|
}, [anchorSide, slideAnimationDistance, slideAnimationEasing, visibility]);
|
141
|
-
|
139
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
140
|
+
containerName: portalContainerName
|
141
|
+
}, /*#__PURE__*/React.createElement(StyledOverlay, _extends({
|
142
142
|
height: height,
|
143
143
|
role: role
|
144
144
|
}, rest, {
|
@@ -149,10 +149,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
149
149
|
...rest.style,
|
150
150
|
'--styled-overlay-visibility': visibility
|
151
151
|
}
|
152
|
-
}));
|
153
|
-
return /*#__PURE__*/React.createElement(Portal, {
|
154
|
-
containerName: portalContainerName
|
155
|
-
}, styledOverlay);
|
152
|
+
})));
|
156
153
|
});
|
157
154
|
Overlay.defaultProps = {
|
158
155
|
height: 'auto',
|
@@ -32,15 +32,11 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
|
|
32
32
|
Divider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
|
33
33
|
Filter: React.ForwardRefExoticComponent<Pick<{
|
34
34
|
value?: string | undefined;
|
35
|
-
} &
|
36
|
-
ref?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined;
|
37
|
-
}, string | number | symbol> & {
|
35
|
+
} & Pick<{
|
38
36
|
className?: string | undefined;
|
39
37
|
icon?: React.ComponentType<{
|
40
38
|
className?: string | undefined;
|
41
39
|
}> | undefined;
|
42
|
-
inputComponent?: React.ComponentType<HTMLInputElement> | undefined;
|
43
|
-
wrapperRef?: React.RefObject<HTMLSpanElement> | undefined;
|
44
40
|
} & Pick<{
|
45
41
|
color?: string | undefined;
|
46
42
|
maxWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
@@ -319,9 +315,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<SelectMenuInternalP
|
|
319
315
|
} & {
|
320
316
|
as?: string | React.ComponentType<any> | undefined;
|
321
317
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
322
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast" |
|
323
|
-
as?: "input" | undefined;
|
324
|
-
}, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
318
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "className" | "block" | "icon" | "sx" | "disabled" | "variant" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
325
319
|
Footer: import("styled-components").StyledComponent<"footer", any, SystemCommonProps & SxProp, never>;
|
326
320
|
Item: React.ForwardRefExoticComponent<Pick<{
|
327
321
|
as?: React.ElementType<any> | undefined;
|
package/lib-esm/TextInput.d.ts
CHANGED
@@ -1,9 +1,8 @@
|
|
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";
|
4
3
|
import { SxProp } from './sx';
|
5
4
|
import { ComponentProps } from './utils/types';
|
6
|
-
import
|
5
|
+
declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
|
7
6
|
declare const Wrapper: import("styled-components").StyledComponent<"span", any, {
|
8
7
|
disabled?: boolean | undefined;
|
9
8
|
hasIcon?: boolean | undefined;
|
@@ -16,10 +15,8 @@ declare type NonPassthroughProps = {
|
|
16
15
|
icon?: React.ComponentType<{
|
17
16
|
className?: string;
|
18
17
|
}>;
|
19
|
-
inputComponent?: React.ComponentType<HTMLInputElement>;
|
20
|
-
wrapperRef?: React.RefObject<HTMLSpanElement>;
|
21
18
|
} & Pick<ComponentProps<typeof Wrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
|
22
|
-
declare type TextInputInternalProps = NonPassthroughProps & Omit<React.ComponentPropsWithoutRef<typeof
|
23
|
-
declare const TextInput:
|
19
|
+
declare type TextInputInternalProps = NonPassthroughProps & Omit<React.ComponentPropsWithoutRef<typeof Input>, keyof NonPassthroughProps>;
|
20
|
+
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
24
21
|
export declare type TextInputProps = ComponentProps<typeof TextInput>;
|
25
22
|
export default TextInput;
|
package/lib-esm/TextInput.js
CHANGED
@@ -6,7 +6,6 @@ import styled, { css } from 'styled-components';
|
|
6
6
|
import { maxWidth, minWidth, variant, width } from 'styled-system';
|
7
7
|
import { get } from './constants';
|
8
8
|
import sx from './sx';
|
9
|
-
import UnstyledTextInput from './_UnstyledTextInput';
|
10
9
|
const sizeVariants = variant({
|
11
10
|
variants: {
|
12
11
|
small: {
|
@@ -23,19 +22,23 @@ const sizeVariants = variant({
|
|
23
22
|
}
|
24
23
|
}
|
25
24
|
});
|
25
|
+
const Input = styled.input.withConfig({
|
26
|
+
displayName: "TextInput__Input",
|
27
|
+
componentId: "sc-1apmpmt-0"
|
28
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
|
26
29
|
const Wrapper = styled.span.withConfig({
|
27
30
|
displayName: "TextInput__Wrapper",
|
28
|
-
componentId: "sc-1apmpmt-
|
31
|
+
componentId: "sc-1apmpmt-1"
|
29
32
|
})(["display:inline-flex;align-items:stretch;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";", " .TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('radii.2'), get('shadows.primer.shadow.inset'), props => {
|
30
33
|
if (props.hasIcon) {
|
31
34
|
return css(["padding:0;"]);
|
32
35
|
} else {
|
33
36
|
return css(["padding:6px 12px;"]);
|
34
37
|
}
|
35
|
-
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.muted'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx);
|
38
|
+
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.muted'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx); // Props that are not passed through to Input:
|
39
|
+
|
36
40
|
// using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
|
37
41
|
const TextInput = /*#__PURE__*/React.forwardRef(({
|
38
|
-
inputComponent: InputComponent,
|
39
42
|
icon: IconComponent,
|
40
43
|
block,
|
41
44
|
className,
|
@@ -47,7 +50,6 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
47
50
|
minWidth: minWidthProp,
|
48
51
|
maxWidth: maxWidthProp,
|
49
52
|
variant: variantProp,
|
50
|
-
wrapperRef,
|
51
53
|
...inputProps
|
52
54
|
}, ref) => {
|
53
55
|
// this class is necessary to style FilterSearch, plz no touchy!
|
@@ -63,11 +65,10 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
63
65
|
width: widthProp,
|
64
66
|
minWidth: minWidthProp,
|
65
67
|
maxWidth: maxWidthProp,
|
66
|
-
variant: variantProp
|
67
|
-
ref: wrapperRef
|
68
|
+
variant: variantProp
|
68
69
|
}, IconComponent && /*#__PURE__*/React.createElement(IconComponent, {
|
69
70
|
className: "TextInput-icon"
|
70
|
-
}), /*#__PURE__*/React.createElement(
|
71
|
+
}), /*#__PURE__*/React.createElement(Input, _extends({
|
71
72
|
ref: ref,
|
72
73
|
disabled: disabled
|
73
74
|
}, inputProps)));
|
@@ -7,9 +7,8 @@ export declare type UseOverlaySettings = {
|
|
7
7
|
onEscape: (e: KeyboardEvent) => void;
|
8
8
|
onClickOutside: (e: TouchOrMouseEvent) => void;
|
9
9
|
overlayRef?: React.RefObject<HTMLDivElement>;
|
10
|
-
preventFocusOnOpen?: boolean;
|
11
10
|
};
|
12
11
|
export declare type OverlayReturnProps = {
|
13
12
|
ref: React.RefObject<HTMLDivElement>;
|
14
13
|
};
|
15
|
-
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside
|
14
|
+
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside }: UseOverlaySettings) => OverlayReturnProps;
|
@@ -8,19 +8,14 @@ export const useOverlay = ({
|
|
8
8
|
initialFocusRef,
|
9
9
|
onEscape,
|
10
10
|
ignoreClickRefs,
|
11
|
-
onClickOutside
|
12
|
-
preventFocusOnOpen
|
11
|
+
onClickOutside
|
13
12
|
}) => {
|
14
13
|
const overlayRef = useProvidedRefOrCreate(_overlayRef);
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
initialFocusRef
|
21
|
-
});
|
22
|
-
}
|
23
|
-
|
14
|
+
useOpenAndCloseFocus({
|
15
|
+
containerRef: overlayRef,
|
16
|
+
returnFocusRef,
|
17
|
+
initialFocusRef
|
18
|
+
});
|
24
19
|
useOnOutsideClick({
|
25
20
|
containerRef: overlayRef,
|
26
21
|
ignoreClickRefs,
|
package/lib-esm/index.d.ts
CHANGED
@@ -24,7 +24,6 @@ export { useConfirm } from './Dialog/ConfirmationDialog';
|
|
24
24
|
export { ActionList } from './ActionList';
|
25
25
|
export { ActionMenu } from './ActionMenu';
|
26
26
|
export type { ActionMenuProps } from './ActionMenu';
|
27
|
-
export { default as Autocomplete } from './Autocomplete';
|
28
27
|
export { default as Avatar } from './Avatar';
|
29
28
|
export type { AvatarProps } from './Avatar';
|
30
29
|
export { default as AvatarPair } from './AvatarPair';
|
@@ -99,7 +98,6 @@ export { default as TabNav } from './TabNav';
|
|
99
98
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
100
99
|
export { default as TextInput } from './TextInput';
|
101
100
|
export type { TextInputProps } from './TextInput';
|
102
|
-
export { default as TextInputWithTokens } from './TextInputTokens';
|
103
101
|
export { default as Text } from './Text';
|
104
102
|
export type { TextProps } from './Text';
|
105
103
|
export { default as Timeline } from './Timeline';
|
package/lib-esm/index.js
CHANGED
@@ -19,7 +19,6 @@ export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
|
|
19
19
|
|
20
20
|
export { ActionList } from './ActionList';
|
21
21
|
export { ActionMenu } from './ActionMenu';
|
22
|
-
export { default as Autocomplete } from './Autocomplete';
|
23
22
|
export { default as Avatar } from './Avatar';
|
24
23
|
export { default as AvatarPair } from './AvatarPair';
|
25
24
|
export { default as AvatarStack } from './AvatarStack';
|
@@ -62,7 +61,6 @@ export { default as StyledOcticon } from './StyledOcticon';
|
|
62
61
|
export { default as SubNav } from './SubNav';
|
63
62
|
export { default as TabNav } from './TabNav';
|
64
63
|
export { default as TextInput } from './TextInput';
|
65
|
-
export { default as TextInputWithTokens } from './TextInputTokens';
|
66
64
|
export { default as Text } from './Text';
|
67
65
|
export { default as Timeline } from './Timeline';
|
68
66
|
export { default as Tooltip } from './Tooltip';
|
package/lib-esm/utils/types.d.ts
CHANGED
@@ -12,6 +12,3 @@ export declare type ComponentProps<T> = T extends React.ComponentType<infer Prop
|
|
12
12
|
*/
|
13
13
|
export declare type Flatten<T extends unknown> = T extends (infer U)[] ? U : never;
|
14
14
|
export declare type AriaRole = 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'button' | 'cell' | 'checkbox' | 'columnheader' | 'combobox' | 'complementary' | 'contentinfo' | 'definition' | 'dialog' | 'directory' | 'document' | 'feed' | 'figure' | 'form' | 'grid' | 'gridcell' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listbox' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'menu' | 'menubar' | 'menuitem' | 'menuitemcheckbox ' | 'menuitemradio' | 'navigation' | 'none' | 'note' | 'option' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'search' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'textbox' | 'timer' | 'toolbar' | 'tooltip' | 'tree' | 'treegrid' | 'treeitem';
|
15
|
-
export declare type MandateProps<T extends {}, K extends keyof T> = Omit<T, K> & {
|
16
|
-
[MK in K]-?: NonNullable<T[MK]>;
|
17
|
-
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-202183017829",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -45,7 +45,6 @@
|
|
45
45
|
"dependencies": {
|
46
46
|
"@primer/octicons-react": "^13.0.0",
|
47
47
|
"@primer/primitives": "4.8.1",
|
48
|
-
"@radix-ui/react-polymorphic": "0.0.14",
|
49
48
|
"@react-aria/ssr": "3.1.0",
|
50
49
|
"@styled-system/css": "5.1.5",
|
51
50
|
"@styled-system/props": "5.1.5",
|
@@ -58,8 +57,7 @@
|
|
58
57
|
"classnames": "2.3.1",
|
59
58
|
"deepmerge": "4.2.2",
|
60
59
|
"focus-visible": "5.2.0",
|
61
|
-
"styled-system": "5.1.5"
|
62
|
-
"tinycolor2": "1.4.2"
|
60
|
+
"styled-system": "5.1.5"
|
63
61
|
},
|
64
62
|
"devDependencies": {
|
65
63
|
"@babel/cli": "7.14.5",
|
@@ -69,12 +67,12 @@
|
|
69
67
|
"@babel/plugin-proposal-optional-chaining": "7.14.5",
|
70
68
|
"@babel/plugin-transform-modules-commonjs": "7.14.5",
|
71
69
|
"@babel/preset-react": "7.14.5",
|
72
|
-
"@babel/preset-typescript": "7.
|
70
|
+
"@babel/preset-typescript": "7.15.0",
|
73
71
|
"@changesets/changelog-github": "0.4.0",
|
74
72
|
"@changesets/cli": "2.17.0",
|
75
73
|
"@github/prettier-config": "0.0.4",
|
76
74
|
"@rollup/plugin-commonjs": "19.0.2",
|
77
|
-
"@rollup/plugin-node-resolve": "13.0.
|
75
|
+
"@rollup/plugin-node-resolve": "13.0.5",
|
78
76
|
"@size-limit/preset-big-lib": "5.0.2",
|
79
77
|
"@storybook/addon-a11y": "6.3.4",
|
80
78
|
"@storybook/addon-actions": "^6.2.9",
|
@@ -83,7 +81,7 @@
|
|
83
81
|
"@storybook/react": "6.3.8",
|
84
82
|
"@testing-library/dom": "7.31.2",
|
85
83
|
"@testing-library/react": "11.2.7",
|
86
|
-
"@testing-library/react-hooks": "7.0.
|
84
|
+
"@testing-library/react-hooks": "7.0.2",
|
87
85
|
"@testing-library/user-event": "13.1.9",
|
88
86
|
"@types/chroma-js": "2.1.3",
|
89
87
|
"@types/enzyme": "3.10.9",
|
@@ -91,7 +89,6 @@
|
|
91
89
|
"@types/jest-axe": "3.5.3",
|
92
90
|
"@types/lodash.isempty": "4.4.6",
|
93
91
|
"@types/lodash.isobject": "3.0.6",
|
94
|
-
"@types/tinycolor2": "1.4.3",
|
95
92
|
"@typescript-eslint/eslint-plugin": "4.31.2",
|
96
93
|
"@typescript-eslint/parser": "4.26.1",
|
97
94
|
"@wojtekmaj/enzyme-adapter-react-17": "0.6.3",
|
@@ -114,7 +111,7 @@
|
|
114
111
|
"eslint-plugin-jsx-a11y": "6.4.1",
|
115
112
|
"eslint-plugin-mdx": "1.15.1",
|
116
113
|
"eslint-plugin-prettier": "3.4.0",
|
117
|
-
"eslint-plugin-primer-react": "0.
|
114
|
+
"eslint-plugin-primer-react": "0.5.0",
|
118
115
|
"eslint-plugin-react": "7.24.0",
|
119
116
|
"eslint-plugin-react-hooks": "4.2.0",
|
120
117
|
"jest": "27.0.4",
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ComponentProps } from '../utils/types';
|
3
|
-
import AutocompleteMenu from './AutocompleteMenu';
|
4
|
-
declare const Autocomplete: React.FC<{
|
5
|
-
id?: string;
|
6
|
-
}>;
|
7
|
-
export declare type AutocompleteProps = ComponentProps<typeof Autocomplete>;
|
8
|
-
export type { AutocompleteInputProps } from './AutocompleteInput';
|
9
|
-
export type { AutocompleteMenuProps } from './AutocompleteMenu';
|
10
|
-
declare const _default: React.FC<{
|
11
|
-
id?: string | undefined;
|
12
|
-
}> & {
|
13
|
-
AutocompleteContext: React.Context<{
|
14
|
-
activeDescendantRef?: React.MutableRefObject<HTMLElement | null> | undefined;
|
15
|
-
autocompleteSuggestion?: string | undefined;
|
16
|
-
id?: string | undefined;
|
17
|
-
inputRef?: React.MutableRefObject<HTMLInputElement | null> | undefined;
|
18
|
-
inputValue?: string | undefined;
|
19
|
-
isMenuDirectlyActivated?: boolean | undefined;
|
20
|
-
setAutocompleteSuggestion?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
21
|
-
setInputValue?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
22
|
-
setIsMenuDirectlyActivated?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
23
|
-
setShowMenu?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
24
|
-
showMenu?: boolean | undefined;
|
25
|
-
}>;
|
26
|
-
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<"input", {
|
27
|
-
as?: React.ComponentType<any> | undefined;
|
28
|
-
}>;
|
29
|
-
Menu: typeof AutocompleteMenu;
|
30
|
-
};
|
31
|
-
export default _default;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
var _uniqueId = require("../utils/uniqueId");
|
11
|
-
|
12
|
-
var _AutocompleteContext = require("./AutocompleteContext");
|
13
|
-
|
14
|
-
var _AutocompleteInput = _interopRequireDefault(require("./AutocompleteInput"));
|
15
|
-
|
16
|
-
var _AutocompleteMenu = _interopRequireDefault(require("./AutocompleteMenu"));
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
-
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23
|
-
|
24
|
-
const Autocomplete = ({
|
25
|
-
children,
|
26
|
-
id: idProp
|
27
|
-
}) => {
|
28
|
-
const activeDescendantRef = (0, _react.useRef)(null);
|
29
|
-
const inputRef = (0, _react.useRef)(null);
|
30
|
-
const [inputValue, setInputValue] = (0, _react.useState)('');
|
31
|
-
const [showMenu, setShowMenu] = (0, _react.useState)(false);
|
32
|
-
const [autocompleteSuggestion, setAutocompleteSuggestion] = (0, _react.useState)('');
|
33
|
-
const [isMenuDirectlyActivated, setIsMenuDirectlyActivated] = (0, _react.useState)(false);
|
34
|
-
const id = idProp || (0, _uniqueId.uniqueId)();
|
35
|
-
return /*#__PURE__*/_react.default.createElement(_AutocompleteContext.AutocompleteContext.Provider, {
|
36
|
-
value: {
|
37
|
-
activeDescendantRef,
|
38
|
-
autocompleteSuggestion,
|
39
|
-
id,
|
40
|
-
inputRef,
|
41
|
-
inputValue,
|
42
|
-
isMenuDirectlyActivated,
|
43
|
-
setAutocompleteSuggestion,
|
44
|
-
setInputValue,
|
45
|
-
setIsMenuDirectlyActivated,
|
46
|
-
setShowMenu,
|
47
|
-
showMenu
|
48
|
-
}
|
49
|
-
}, children);
|
50
|
-
};
|
51
|
-
|
52
|
-
Autocomplete.displayName = "Autocomplete";
|
53
|
-
|
54
|
-
var _default = Object.assign(Autocomplete, {
|
55
|
-
AutocompleteContext: _AutocompleteContext.AutocompleteContext,
|
56
|
-
Input: _AutocompleteInput.default,
|
57
|
-
Menu: _AutocompleteMenu.default
|
58
|
-
});
|
59
|
-
|
60
|
-
exports.default = _default;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export declare const AutocompleteContext: import("react").Context<{
|
3
|
-
activeDescendantRef?: import("react").MutableRefObject<HTMLElement | null> | undefined;
|
4
|
-
autocompleteSuggestion?: string | undefined;
|
5
|
-
id?: string | undefined;
|
6
|
-
inputRef?: import("react").MutableRefObject<HTMLInputElement | null> | undefined;
|
7
|
-
inputValue?: string | undefined;
|
8
|
-
isMenuDirectlyActivated?: boolean | undefined;
|
9
|
-
setAutocompleteSuggestion?: import("react").Dispatch<import("react").SetStateAction<string>> | undefined;
|
10
|
-
setInputValue?: import("react").Dispatch<import("react").SetStateAction<string>> | undefined;
|
11
|
-
setIsMenuDirectlyActivated?: import("react").Dispatch<import("react").SetStateAction<boolean>> | undefined;
|
12
|
-
setShowMenu?: import("react").Dispatch<import("react").SetStateAction<boolean>> | undefined;
|
13
|
-
showMenu?: boolean | undefined;
|
14
|
-
}>;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.AutocompleteContext = void 0;
|
7
|
-
|
8
|
-
var _react = require("react");
|
9
|
-
|
10
|
-
const AutocompleteContext = /*#__PURE__*/(0, _react.createContext)({});
|
11
|
-
exports.AutocompleteContext = AutocompleteContext;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import type * as Polymorphic from "@radix-ui/react-polymorphic";
|
3
|
-
import { ComponentProps } from '../utils/types';
|
4
|
-
declare type InternalAutocompleteInputProps = {
|
5
|
-
as?: React.ComponentType<any>;
|
6
|
-
};
|
7
|
-
declare const AutocompleteInput: Polymorphic.ForwardRefComponent<"input", InternalAutocompleteInputProps>;
|
8
|
-
export declare type AutocompleteInputProps = ComponentProps<typeof AutocompleteInput>;
|
9
|
-
export default AutocompleteInput;
|
@@ -1,148 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
var _AutocompleteContext = require("./AutocompleteContext");
|
11
|
-
|
12
|
-
var _TextInput = _interopRequireDefault(require("../TextInput"));
|
13
|
-
|
14
|
-
var _useCombinedRefs = require("../hooks/useCombinedRefs");
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
|
-
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21
|
-
|
22
|
-
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); }
|
23
|
-
|
24
|
-
const AutocompleteInput = /*#__PURE__*/_react.default.forwardRef(({
|
25
|
-
as: Component = _TextInput.default,
|
26
|
-
onFocus,
|
27
|
-
onBlur,
|
28
|
-
onChange,
|
29
|
-
onKeyDown,
|
30
|
-
onKeyPress,
|
31
|
-
value,
|
32
|
-
...props
|
33
|
-
}, forwardedRef) => {
|
34
|
-
const {
|
35
|
-
activeDescendantRef,
|
36
|
-
autocompleteSuggestion = '',
|
37
|
-
id,
|
38
|
-
inputRef,
|
39
|
-
inputValue = '',
|
40
|
-
isMenuDirectlyActivated,
|
41
|
-
setInputValue,
|
42
|
-
setShowMenu,
|
43
|
-
showMenu
|
44
|
-
} = (0, _react.useContext)(_AutocompleteContext.AutocompleteContext);
|
45
|
-
const combinedInputRef = (0, _useCombinedRefs.useCombinedRefs)(inputRef, forwardedRef);
|
46
|
-
const [highlightRemainingText, setHighlightRemainingText] = (0, _react.useState)(true);
|
47
|
-
|
48
|
-
const handleInputFocus = e => {
|
49
|
-
onFocus && onFocus(e);
|
50
|
-
setShowMenu && setShowMenu(true);
|
51
|
-
};
|
52
|
-
|
53
|
-
const handleInputBlur = e => {
|
54
|
-
onBlur && onBlur(e); // HACK: wait a tick and check the focused element before hiding the autocomplete menu
|
55
|
-
// this prevents the menu from hiding when the user is clicking an option in the Autoselect.Menu,
|
56
|
-
// but still hides the menu when the user blurs the input by tabbing out or clicking somewhere else on the page
|
57
|
-
// COLEHELP
|
58
|
-
|
59
|
-
setTimeout(() => {
|
60
|
-
if (document.activeElement !== combinedInputRef.current) {
|
61
|
-
setShowMenu && setShowMenu(false);
|
62
|
-
}
|
63
|
-
}, 0);
|
64
|
-
};
|
65
|
-
|
66
|
-
const handleInputChange = e => {
|
67
|
-
onChange && onChange(e);
|
68
|
-
setInputValue && setInputValue(e.currentTarget.value);
|
69
|
-
|
70
|
-
if (!showMenu) {
|
71
|
-
setShowMenu && setShowMenu(true);
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
const handleInputKeyDown = e => {
|
76
|
-
var _inputRef$current;
|
77
|
-
|
78
|
-
if (e.key === 'Backspace') {
|
79
|
-
setHighlightRemainingText(false);
|
80
|
-
}
|
81
|
-
|
82
|
-
if (e.key === 'Escape' && inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
83
|
-
setInputValue && setInputValue('');
|
84
|
-
inputRef.current.value = '';
|
85
|
-
}
|
86
|
-
};
|
87
|
-
|
88
|
-
const handleInputKeyUp = e => {
|
89
|
-
if (e.key === 'Backspace') {
|
90
|
-
setHighlightRemainingText(true);
|
91
|
-
}
|
92
|
-
};
|
93
|
-
|
94
|
-
const onInputKeyPress = (0, _react.useCallback)(event => {
|
95
|
-
if (activeDescendantRef && event.key === 'Enter' && activeDescendantRef.current) {
|
96
|
-
event.preventDefault();
|
97
|
-
event.nativeEvent.stopImmediatePropagation(); // Forward Enter key press to active descendant so that item gets activated
|
98
|
-
|
99
|
-
const activeDescendantEvent = new KeyboardEvent(event.type, event.nativeEvent);
|
100
|
-
activeDescendantRef.current.dispatchEvent(activeDescendantEvent);
|
101
|
-
}
|
102
|
-
}, [activeDescendantRef]);
|
103
|
-
(0, _react.useEffect)(() => {
|
104
|
-
if (!(inputRef !== null && inputRef !== void 0 && inputRef.current)) {
|
105
|
-
return;
|
106
|
-
} // resets input value to being empty after a selection has been made
|
107
|
-
|
108
|
-
|
109
|
-
if (!autocompleteSuggestion) {
|
110
|
-
inputRef.current.value = inputValue;
|
111
|
-
} // TODO: fix bug where this function prevents `onChange` from being triggered if the highlighted item text
|
112
|
-
// is the same as what I'm typing
|
113
|
-
// e.g.: typing 'tw' highights 'two', but when I 'two', the text input change does not get triggered
|
114
|
-
// COLEHELP
|
115
|
-
|
116
|
-
|
117
|
-
if (highlightRemainingText && autocompleteSuggestion && (inputValue || isMenuDirectlyActivated)) {
|
118
|
-
inputRef.current.value = autocompleteSuggestion;
|
119
|
-
|
120
|
-
if (autocompleteSuggestion.toLowerCase().indexOf(inputValue.toLowerCase()) === 0) {
|
121
|
-
inputRef.current.setSelectionRange(inputValue.length, autocompleteSuggestion.length);
|
122
|
-
}
|
123
|
-
}
|
124
|
-
}, [autocompleteSuggestion, inputValue]);
|
125
|
-
(0, _react.useEffect)(() => {
|
126
|
-
if (value) {
|
127
|
-
setInputValue && setInputValue(value.toString());
|
128
|
-
}
|
129
|
-
}, [value]);
|
130
|
-
return /*#__PURE__*/_react.default.createElement(Component, _extends({
|
131
|
-
onFocus: handleInputFocus,
|
132
|
-
onBlur: handleInputBlur,
|
133
|
-
onChange: handleInputChange,
|
134
|
-
onKeyDown: handleInputKeyDown,
|
135
|
-
onKeyPress: onInputKeyPress,
|
136
|
-
onKeyUp: handleInputKeyUp,
|
137
|
-
ref: combinedInputRef,
|
138
|
-
"aria-controls": `${id}-listbox`,
|
139
|
-
"aria-autocomplete": "both",
|
140
|
-
role: "combobox",
|
141
|
-
"aria-expanded": showMenu,
|
142
|
-
"aria-haspopup": "listbox",
|
143
|
-
"aria-owns": `${id}-listbox`
|
144
|
-
}, props));
|
145
|
-
});
|
146
|
-
|
147
|
-
var _default = AutocompleteInput;
|
148
|
-
exports.default = _default;
|