@primer/components 0.0.0-20219818220 → 0.0.0-202198182351
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 +1 -1
- package/dist/browser.esm.js +313 -297
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +387 -371
- 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/FilteredActionList/FilteredActionList.js +31 -5
- package/lib/Overlay.d.ts +1 -2
- package/lib/Overlay.js +5 -10
- package/lib/TextInput.d.ts +12 -4
- package/lib/TextInput.js +46 -4
- package/lib/Token/AvatarToken.d.ts +7 -0
- package/lib/Token/{ProfileToken.js → AvatarToken.js} +4 -4
- package/lib/Token/_TokenTextContainer.js +3 -14
- package/lib/Token/index.d.ts +1 -1
- package/lib/Token/index.js +3 -3
- package/lib/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib/hooks/useOverlay.d.ts +1 -2
- package/lib/hooks/useOverlay.js +2 -4
- package/lib/index.d.ts +1 -3
- package/lib/index.js +2 -18
- package/lib/utils/types/index.d.ts +0 -1
- package/lib/utils/types/index.js +0 -13
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +1 -2
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -11
- 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/TextInput.d.ts +12 -4
- package/lib-esm/TextInput.js +37 -4
- package/lib-esm/Token/AvatarToken.d.ts +7 -0
- package/lib-esm/Token/{ProfileToken.js → AvatarToken.js} +4 -4
- package/lib-esm/Token/_TokenTextContainer.js +2 -11
- package/lib-esm/Token/index.d.ts +1 -1
- package/lib-esm/Token/index.js +1 -1
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +1 -2
- package/lib-esm/hooks/useOpenAndCloseFocus.js +2 -7
- package/lib-esm/hooks/useOverlay.d.ts +1 -2
- package/lib-esm/hooks/useOverlay.js +2 -4
- package/lib-esm/index.d.ts +1 -3
- package/lib-esm/index.js +1 -3
- package/lib-esm/utils/types/index.d.ts +0 -1
- package/lib-esm/utils/types/index.js +1 -2
- package/package.json +1 -1
- package/lib/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib/Autocomplete/Autocomplete.js +0 -68
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib/Autocomplete/AutocompleteInput.js +0 -150
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib/Autocomplete/AutocompleteMenu.js +0 -223
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteOverlay.js +0 -69
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- package/lib/TextInputWithTokens.d.ts +0 -323
- package/lib/TextInputWithTokens.js +0 -244
- package/lib/Token/ProfileToken.d.ts +0 -7
- package/lib/_TextInputWrapper.d.ts +0 -10
- package/lib/_TextInputWrapper.js +0 -51
- 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/utils/types/MandateProps.d.ts +0 -3
- package/lib/utils/types/MandateProps.js +0 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib-esm/Autocomplete/Autocomplete.js +0 -47
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -131
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -204
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -51
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/index.js +0 -1
- package/lib-esm/TextInputWithTokens.d.ts +0 -323
- package/lib-esm/TextInputWithTokens.js +0 -219
- package/lib-esm/Token/ProfileToken.d.ts +0 -7
- package/lib-esm/_TextInputWrapper.d.ts +0 -10
- package/lib-esm/_TextInputWrapper.js +0 -31
- 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
- package/lib-esm/utils/types/MandateProps.d.ts +0 -3
- package/lib-esm/utils/types/MandateProps.js +0 -1
@@ -2,7 +2,6 @@ import React from 'react';
|
|
2
2
|
import { OverlayProps } from '../Overlay';
|
3
3
|
import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
|
4
4
|
import { FocusZoneHookSettings } from '../hooks/useFocusZone';
|
5
|
-
import { PositionSettings } from '../behaviors/anchoredPosition';
|
6
5
|
interface AnchoredOverlayPropsWithAnchor {
|
7
6
|
/**
|
8
7
|
* A custom function component used to render the anchor element.
|
@@ -53,7 +52,7 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
53
52
|
*/
|
54
53
|
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
55
54
|
}
|
56
|
-
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor)
|
55
|
+
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor);
|
57
56
|
/**
|
58
57
|
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
59
58
|
* The overlay can be opened and navigated using keyboard or mouse.
|
@@ -40,9 +40,7 @@ const AnchoredOverlay = ({
|
|
40
40
|
width,
|
41
41
|
overlayProps,
|
42
42
|
focusTrapSettings,
|
43
|
-
focusZoneSettings
|
44
|
-
side,
|
45
|
-
align
|
43
|
+
focusZoneSettings
|
46
44
|
}) => {
|
47
45
|
const anchorRef = (0, _hooks.useProvidedRefOrCreate)(externalAnchorRef);
|
48
46
|
const [overlayRef, updateOverlayRef] = (0, _hooks.useRenderForcingRef)();
|
@@ -72,9 +70,7 @@ const AnchoredOverlay = ({
|
|
72
70
|
position
|
73
71
|
} = (0, _hooks.useAnchoredPosition)({
|
74
72
|
anchorElementRef: anchorRef,
|
75
|
-
floatingElementRef: overlayRef
|
76
|
-
side,
|
77
|
-
align
|
73
|
+
floatingElementRef: overlayRef
|
78
74
|
}, [overlayRef.current]);
|
79
75
|
(0, _react.useEffect)(() => {
|
80
76
|
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
@@ -117,8 +113,4 @@ const AnchoredOverlay = ({
|
|
117
113
|
};
|
118
114
|
|
119
115
|
exports.AnchoredOverlay = AnchoredOverlay;
|
120
|
-
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
121
|
-
AnchoredOverlay.defaultProps = {
|
122
|
-
side: 'outside-bottom',
|
123
|
-
align: 'start'
|
124
|
-
};
|
116
|
+
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
@@ -7,8 +7,6 @@ exports.FilteredActionList = FilteredActionList;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var _ssr = require("@react-aria/ssr");
|
11
|
-
|
12
10
|
var _TextInput = _interopRequireDefault(require("../TextInput"));
|
13
11
|
|
14
12
|
var _Box = _interopRequireDefault(require("../Box"));
|
@@ -29,7 +27,7 @@ var _useProvidedRefOrCreate = require("../hooks/useProvidedRefOrCreate");
|
|
29
27
|
|
30
28
|
var _useScrollFlash = _interopRequireDefault(require("../hooks/useScrollFlash"));
|
31
29
|
|
32
|
-
var
|
30
|
+
var _ssr = require("@react-aria/ssr");
|
33
31
|
|
34
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
33
|
|
@@ -39,6 +37,34 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
39
37
|
|
40
38
|
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); }
|
41
39
|
|
40
|
+
function scrollIntoViewingArea(child, container, margin = 8, behavior = 'smooth') {
|
41
|
+
const {
|
42
|
+
top: childTop,
|
43
|
+
bottom: childBottom
|
44
|
+
} = child.getBoundingClientRect();
|
45
|
+
const {
|
46
|
+
top: containerTop,
|
47
|
+
bottom: containerBottom
|
48
|
+
} = container.getBoundingClientRect();
|
49
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
50
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
51
|
+
|
52
|
+
if (isChildTopAboveViewingArea) {
|
53
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
54
|
+
container.scrollTo({
|
55
|
+
behavior,
|
56
|
+
top: scrollHeightToChildTop - margin
|
57
|
+
});
|
58
|
+
} else if (isChildBottomBelowViewingArea) {
|
59
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
60
|
+
container.scrollTo({
|
61
|
+
behavior,
|
62
|
+
top: scrollHeightToChildBottom + margin
|
63
|
+
});
|
64
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
65
|
+
|
66
|
+
}
|
67
|
+
|
42
68
|
const StyledHeader = _styledComponents.default.div.withConfig({
|
43
69
|
displayName: "FilteredActionList__StyledHeader",
|
44
70
|
componentId: "yg3jkv-0"
|
@@ -86,7 +112,7 @@ function FilteredActionList({
|
|
86
112
|
activeDescendantRef.current = current;
|
87
113
|
|
88
114
|
if (current && scrollContainerRef.current && directlyActivated) {
|
89
|
-
|
115
|
+
scrollIntoViewingArea(current, scrollContainerRef.current);
|
90
116
|
}
|
91
117
|
}
|
92
118
|
}, [// List ref isn't set while loading. Need to re-bind focus zone when it changes
|
@@ -94,7 +120,7 @@ function FilteredActionList({
|
|
94
120
|
(0, _react.useEffect)(() => {
|
95
121
|
// if items changed, we want to instantly move active descendant into view
|
96
122
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
97
|
-
|
123
|
+
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
98
124
|
}
|
99
125
|
}, [items]);
|
100
126
|
(0, _useScrollFlash.default)(scrollContainerRef);
|
package/lib/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/Overlay.js
CHANGED
@@ -113,7 +113,6 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
113
113
|
left,
|
114
114
|
anchorSide,
|
115
115
|
portalContainerName,
|
116
|
-
preventFocusOnOpen,
|
117
116
|
...rest
|
118
117
|
}, forwardedRef) => {
|
119
118
|
const overlayRef = (0, _react.useRef)(null);
|
@@ -129,8 +128,7 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
129
128
|
onEscape,
|
130
129
|
ignoreClickRefs,
|
131
130
|
onClickOutside,
|
132
|
-
initialFocusRef
|
133
|
-
preventFocusOnOpen
|
131
|
+
initialFocusRef
|
134
132
|
});
|
135
133
|
(0, _react.useEffect)(() => {
|
136
134
|
var _combinedRef$current;
|
@@ -159,8 +157,9 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
159
157
|
easing: slideAnimationEasing
|
160
158
|
});
|
161
159
|
}, [anchorSide, slideAnimationDistance, slideAnimationEasing, visibility]);
|
162
|
-
|
163
|
-
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_Portal.default, {
|
161
|
+
containerName: portalContainerName
|
162
|
+
}, /*#__PURE__*/_react.default.createElement(StyledOverlay, _extends({
|
164
163
|
height: height,
|
165
164
|
role: role
|
166
165
|
}, rest, {
|
@@ -171,11 +170,7 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
|
|
171
170
|
...rest.style,
|
172
171
|
'--styled-overlay-visibility': visibility
|
173
172
|
}
|
174
|
-
}));
|
175
|
-
|
176
|
-
return /*#__PURE__*/_react.default.createElement(_Portal.default, {
|
177
|
-
containerName: portalContainerName
|
178
|
-
}, styledOverlay);
|
173
|
+
})));
|
179
174
|
});
|
180
175
|
|
181
176
|
Overlay.defaultProps = {
|
package/lib/TextInput.d.ts
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { MaxWidthProps, MinWidthProps, WidthProps } from 'styled-system';
|
3
|
+
import { SxProp } from './sx';
|
2
4
|
import { ComponentProps, Merge } from './utils/types';
|
3
|
-
import
|
4
|
-
import
|
5
|
+
declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
|
6
|
+
declare const Wrapper: import("styled-components").StyledComponent<"span", any, {
|
7
|
+
disabled?: boolean | undefined;
|
8
|
+
hasIcon?: boolean | undefined;
|
9
|
+
block?: boolean | undefined;
|
10
|
+
contrast?: boolean | undefined;
|
11
|
+
variant?: "large" | "small" | undefined;
|
12
|
+
} & WidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>> & MinWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>> & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
5
13
|
declare type NonPassthroughProps = {
|
6
14
|
className?: string;
|
7
15
|
icon?: React.ComponentType<{
|
8
16
|
className?: string;
|
9
17
|
}>;
|
10
|
-
} & Pick<ComponentProps<typeof
|
11
|
-
declare type TextInputInternalProps = Merge<React.ComponentPropsWithoutRef<typeof
|
18
|
+
} & Pick<ComponentProps<typeof Wrapper>, 'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant'>;
|
19
|
+
declare type TextInputInternalProps = Merge<React.ComponentPropsWithoutRef<typeof Input>, NonPassthroughProps>;
|
12
20
|
declare const TextInput: React.ForwardRefExoticComponent<Pick<TextInputInternalProps, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
13
21
|
export declare type TextInputProps = ComponentProps<typeof TextInput>;
|
14
22
|
export default TextInput;
|
package/lib/TextInput.js
CHANGED
@@ -9,14 +9,56 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _styledSystem = require("styled-system");
|
15
|
+
|
16
|
+
var _constants = require("./constants");
|
17
|
+
|
18
|
+
var _sx = _interopRequireDefault(require("./sx"));
|
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; }
|
15
23
|
|
16
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
25
|
|
18
26
|
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); }
|
19
27
|
|
28
|
+
const sizeVariants = (0, _styledSystem.variant)({
|
29
|
+
variants: {
|
30
|
+
small: {
|
31
|
+
minHeight: '28px',
|
32
|
+
px: 2,
|
33
|
+
py: '3px',
|
34
|
+
fontSize: 0,
|
35
|
+
lineHeight: '20px'
|
36
|
+
},
|
37
|
+
large: {
|
38
|
+
px: 2,
|
39
|
+
py: '10px',
|
40
|
+
fontSize: 3
|
41
|
+
}
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
const Input = _styledComponents.default.input.withConfig({
|
46
|
+
displayName: "TextInput__Input",
|
47
|
+
componentId: "sc-1apmpmt-0"
|
48
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}"]);
|
49
|
+
|
50
|
+
const Wrapper = _styledComponents.default.span.withConfig({
|
51
|
+
displayName: "TextInput__Wrapper",
|
52
|
+
componentId: "sc-1apmpmt-1"
|
53
|
+
})(["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:", ";}", " ", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.2'), (0, _constants.get)('shadows.primer.shadow.inset'), props => {
|
54
|
+
if (props.hasIcon) {
|
55
|
+
return (0, _styledComponents.css)(["padding:0;"]);
|
56
|
+
} else {
|
57
|
+
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
58
|
+
}
|
59
|
+
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.input.disabledBg'), (0, _constants.get)('colors.border.default')), props => props.block && (0, _styledComponents.css)(["display:block;width:100%;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeVariants, _sx.default); // Props that are not passed through to Input:
|
60
|
+
|
61
|
+
|
20
62
|
// using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input
|
21
63
|
const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
22
64
|
icon: IconComponent,
|
@@ -34,7 +76,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
34
76
|
}, ref) => {
|
35
77
|
// this class is necessary to style FilterSearch, plz no touchy!
|
36
78
|
const wrapperClasses = (0, _classnames.default)(className, 'TextInput-wrapper');
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
79
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, {
|
38
80
|
block: block,
|
39
81
|
className: wrapperClasses,
|
40
82
|
contrast: contrast,
|
@@ -48,7 +90,7 @@ const TextInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
48
90
|
variant: variantProp
|
49
91
|
}, IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, {
|
50
92
|
className: "TextInput-icon"
|
51
|
-
}), /*#__PURE__*/_react.default.createElement(
|
93
|
+
}), /*#__PURE__*/_react.default.createElement(Input, _extends({
|
52
94
|
ref: ref,
|
53
95
|
disabled: disabled
|
54
96
|
}, inputProps)));
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TokenBaseProps } from './TokenBase';
|
3
|
+
export interface AvatarTokenProps extends TokenBaseProps {
|
4
|
+
avatarSrc: string;
|
5
|
+
}
|
6
|
+
declare const AvatarToken: React.ForwardRefExoticComponent<Pick<AvatarTokenProps, "sizes" | "color" | "content" | "height" | "translate" | "width" | "hidden" | "children" | "value" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "text" | "list" | "default" | "type" | "name" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "start" | "step" | "size" | "wrap" | "open" | "max" | "media" | "method" | "min" | "target" | "crossOrigin" | "href" | "classID" | "useMap" | "wmode" | "download" | "hrefLang" | "rel" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "as" | "integrity" | "charSet" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "onRemove" | "isSelected" | "avatarSrc"> & React.RefAttributes<HTMLElement>>;
|
7
|
+
export default AvatarToken;
|
@@ -25,7 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
25
25
|
|
26
26
|
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); }
|
27
27
|
|
28
|
-
const
|
28
|
+
const AvatarToken = /*#__PURE__*/(0, _react.forwardRef)(({
|
29
29
|
avatarSrc,
|
30
30
|
id,
|
31
31
|
size,
|
@@ -45,9 +45,9 @@ const ProfileToken = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
45
45
|
ref: forwardedRef
|
46
46
|
}));
|
47
47
|
});
|
48
|
-
|
48
|
+
AvatarToken.defaultProps = {
|
49
49
|
size: _TokenBase.defaultTokenSize
|
50
50
|
};
|
51
|
-
|
52
|
-
var _default =
|
51
|
+
AvatarToken.displayName = 'AvatarToken';
|
52
|
+
var _default = AvatarToken;
|
53
53
|
exports.default = _default;
|
@@ -5,24 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
var _styledComponents =
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
9
|
|
10
|
-
function
|
11
|
-
|
12
|
-
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; }
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
11
|
|
14
12
|
const TokenTextContainer = (0, _styledComponents.default)('span').withConfig({
|
15
13
|
displayName: "_TokenTextContainer__TokenTextContainer",
|
16
14
|
componentId: "sc-4t2bev-0"
|
17
|
-
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&:after{content:'';position:absolute;left:0;top:0;right:0;bottom:0;}"
|
18
|
-
if (props.as === 'a') {
|
19
|
-
return (0, _styledComponents.css)(["color:currentColor;text-decoration:none;"]);
|
20
|
-
}
|
21
|
-
|
22
|
-
if (props.as === 'button') {
|
23
|
-
// reset button styles, make the cursor a pointer, and add line-height
|
24
|
-
return (0, _styledComponents.css)(["background:transparent;border:none;color:inherit;font:inherit;margin:0;overflow:visible;padding:0;width:auto;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer;line-height:1;"]);
|
25
|
-
}
|
26
|
-
});
|
15
|
+
})(["flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:transparent;border:none;color:inherit;font:inherit;margin:0;overflow:visible;padding:0;width:auto;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer;line-height:1;color:currentColor;text-decoration:none;&:after{content:'';position:absolute;left:0;top:0;right:0;bottom:0;}"]);
|
27
16
|
var _default = TokenTextContainer;
|
28
17
|
exports.default = _default;
|
package/lib/Token/index.d.ts
CHANGED
package/lib/Token/index.js
CHANGED
@@ -15,10 +15,10 @@ Object.defineProperty(exports, "IssueLabelToken", {
|
|
15
15
|
return _IssueLabelToken.default;
|
16
16
|
}
|
17
17
|
});
|
18
|
-
Object.defineProperty(exports, "
|
18
|
+
Object.defineProperty(exports, "AvatarToken", {
|
19
19
|
enumerable: true,
|
20
20
|
get: function () {
|
21
|
-
return
|
21
|
+
return _AvatarToken.default;
|
22
22
|
}
|
23
23
|
});
|
24
24
|
|
@@ -26,6 +26,6 @@ var _Token = _interopRequireDefault(require("./Token"));
|
|
26
26
|
|
27
27
|
var _IssueLabelToken = _interopRequireDefault(require("./IssueLabelToken"));
|
28
28
|
|
29
|
-
var
|
29
|
+
var _AvatarToken = _interopRequireDefault(require("./AvatarToken"));
|
30
30
|
|
31
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -3,6 +3,5 @@ export declare type UseOpenAndCloseFocusSettings = {
|
|
3
3
|
initialFocusRef?: React.RefObject<HTMLElement>;
|
4
4
|
containerRef: React.RefObject<HTMLElement>;
|
5
5
|
returnFocusRef: React.RefObject<HTMLElement>;
|
6
|
-
preventFocusOnOpen?: boolean;
|
7
6
|
};
|
8
|
-
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef
|
7
|
+
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef }: UseOpenAndCloseFocusSettings): void;
|
@@ -12,14 +12,9 @@ var _iterateFocusableElements = require("../utils/iterateFocusableElements");
|
|
12
12
|
function useOpenAndCloseFocus({
|
13
13
|
initialFocusRef,
|
14
14
|
returnFocusRef,
|
15
|
-
containerRef
|
16
|
-
preventFocusOnOpen
|
15
|
+
containerRef
|
17
16
|
}) {
|
18
17
|
(0, _react.useEffect)(() => {
|
19
|
-
if (preventFocusOnOpen) {
|
20
|
-
return;
|
21
|
-
}
|
22
|
-
|
23
18
|
const returnRef = returnFocusRef.current;
|
24
19
|
|
25
20
|
if (initialFocusRef && initialFocusRef.current) {
|
@@ -32,5 +27,5 @@ function useOpenAndCloseFocus({
|
|
32
27
|
return function () {
|
33
28
|
returnRef === null || returnRef === void 0 ? void 0 : returnRef.focus();
|
34
29
|
};
|
35
|
-
}, [initialFocusRef, returnFocusRef, containerRef
|
30
|
+
}, [initialFocusRef, returnFocusRef, containerRef]);
|
36
31
|
}
|
@@ -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;
|
package/lib/hooks/useOverlay.js
CHANGED
@@ -19,15 +19,13 @@ const useOverlay = ({
|
|
19
19
|
initialFocusRef,
|
20
20
|
onEscape,
|
21
21
|
ignoreClickRefs,
|
22
|
-
onClickOutside
|
23
|
-
preventFocusOnOpen
|
22
|
+
onClickOutside
|
24
23
|
}) => {
|
25
24
|
const overlayRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(_overlayRef);
|
26
25
|
(0, _useOpenAndCloseFocus.useOpenAndCloseFocus)({
|
27
26
|
containerRef: overlayRef,
|
28
27
|
returnFocusRef,
|
29
|
-
initialFocusRef
|
30
|
-
preventFocusOnOpen
|
28
|
+
initialFocusRef
|
31
29
|
});
|
32
30
|
(0, _useOnOutsideClick.useOnOutsideClick)({
|
33
31
|
containerRef: overlayRef,
|
package/lib/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,12 +98,11 @@ 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 './TextInputWithTokens';
|
103
101
|
export { default as Text } from './Text';
|
104
102
|
export type { TextProps } from './Text';
|
105
103
|
export { default as Timeline } from './Timeline';
|
106
104
|
export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
|
107
|
-
export { default as Token, IssueLabelToken,
|
105
|
+
export { default as Token, IssueLabelToken, AvatarToken } from './Token';
|
108
106
|
export { default as Tooltip } from './Tooltip';
|
109
107
|
export type { TooltipProps } from './Tooltip';
|
110
108
|
export { default as Truncate } from './Truncate';
|
package/lib/index.js
CHANGED
@@ -153,12 +153,6 @@ Object.defineProperty(exports, "ActionMenu", {
|
|
153
153
|
return _ActionMenu.ActionMenu;
|
154
154
|
}
|
155
155
|
});
|
156
|
-
Object.defineProperty(exports, "Autocomplete", {
|
157
|
-
enumerable: true,
|
158
|
-
get: function () {
|
159
|
-
return _Autocomplete.default;
|
160
|
-
}
|
161
|
-
});
|
162
156
|
Object.defineProperty(exports, "Avatar", {
|
163
157
|
enumerable: true,
|
164
158
|
get: function () {
|
@@ -435,12 +429,6 @@ Object.defineProperty(exports, "TextInput", {
|
|
435
429
|
return _TextInput.default;
|
436
430
|
}
|
437
431
|
});
|
438
|
-
Object.defineProperty(exports, "TextInputWithTokens", {
|
439
|
-
enumerable: true,
|
440
|
-
get: function () {
|
441
|
-
return _TextInputWithTokens.default;
|
442
|
-
}
|
443
|
-
});
|
444
432
|
Object.defineProperty(exports, "Text", {
|
445
433
|
enumerable: true,
|
446
434
|
get: function () {
|
@@ -465,10 +453,10 @@ Object.defineProperty(exports, "IssueLabelToken", {
|
|
465
453
|
return _Token.IssueLabelToken;
|
466
454
|
}
|
467
455
|
});
|
468
|
-
Object.defineProperty(exports, "
|
456
|
+
Object.defineProperty(exports, "AvatarToken", {
|
469
457
|
enumerable: true,
|
470
458
|
get: function () {
|
471
|
-
return _Token.
|
459
|
+
return _Token.AvatarToken;
|
472
460
|
}
|
473
461
|
});
|
474
462
|
Object.defineProperty(exports, "Tooltip", {
|
@@ -538,8 +526,6 @@ var _ActionList = require("./ActionList");
|
|
538
526
|
|
539
527
|
var _ActionMenu = require("./ActionMenu");
|
540
528
|
|
541
|
-
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
542
|
-
|
543
529
|
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
544
530
|
|
545
531
|
var _AvatarPair = _interopRequireDefault(require("./AvatarPair"));
|
@@ -614,8 +600,6 @@ var _TabNav = _interopRequireDefault(require("./TabNav"));
|
|
614
600
|
|
615
601
|
var _TextInput = _interopRequireDefault(require("./TextInput"));
|
616
602
|
|
617
|
-
var _TextInputWithTokens = _interopRequireDefault(require("./TextInputWithTokens"));
|
618
|
-
|
619
603
|
var _Text = _interopRequireDefault(require("./Text"));
|
620
604
|
|
621
605
|
var _Timeline = _interopRequireDefault(require("./Timeline"));
|
package/lib/utils/types/index.js
CHANGED
@@ -54,17 +54,4 @@ Object.keys(_Merge).forEach(function (key) {
|
|
54
54
|
return _Merge[key];
|
55
55
|
}
|
56
56
|
});
|
57
|
-
});
|
58
|
-
|
59
|
-
var _MandateProps = require("./MandateProps");
|
60
|
-
|
61
|
-
Object.keys(_MandateProps).forEach(function (key) {
|
62
|
-
if (key === "default" || key === "__esModule") return;
|
63
|
-
if (key in exports && exports[key] === _MandateProps[key]) return;
|
64
|
-
Object.defineProperty(exports, key, {
|
65
|
-
enumerable: true,
|
66
|
-
get: function () {
|
67
|
-
return _MandateProps[key];
|
68
|
-
}
|
69
|
-
});
|
70
57
|
});
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
2
2
|
import { OverlayProps } from '../Overlay';
|
3
3
|
import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
|
4
4
|
import { FocusZoneHookSettings } from '../hooks/useFocusZone';
|
5
|
-
import { PositionSettings } from '../behaviors/anchoredPosition';
|
6
5
|
interface AnchoredOverlayPropsWithAnchor {
|
7
6
|
/**
|
8
7
|
* A custom function component used to render the anchor element.
|
@@ -53,7 +52,7 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
53
52
|
*/
|
54
53
|
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
55
54
|
}
|
56
|
-
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor)
|
55
|
+
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor);
|
57
56
|
/**
|
58
57
|
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
59
58
|
* The overlay can be opened and navigated using keyboard or mouse.
|
@@ -22,9 +22,7 @@ export const AnchoredOverlay = ({
|
|
22
22
|
width,
|
23
23
|
overlayProps,
|
24
24
|
focusTrapSettings,
|
25
|
-
focusZoneSettings
|
26
|
-
side,
|
27
|
-
align
|
25
|
+
focusZoneSettings
|
28
26
|
}) => {
|
29
27
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
30
28
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
@@ -54,9 +52,7 @@ export const AnchoredOverlay = ({
|
|
54
52
|
position
|
55
53
|
} = useAnchoredPosition({
|
56
54
|
anchorElementRef: anchorRef,
|
57
|
-
floatingElementRef: overlayRef
|
58
|
-
side,
|
59
|
-
align
|
55
|
+
floatingElementRef: overlayRef
|
60
56
|
}, [overlayRef.current]);
|
61
57
|
useEffect(() => {
|
62
58
|
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
@@ -97,8 +93,4 @@ export const AnchoredOverlay = ({
|
|
97
93
|
anchorSide: position === null || position === void 0 ? void 0 : position.anchorSide
|
98
94
|
}, overlayProps), children) : null);
|
99
95
|
};
|
100
|
-
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
101
|
-
AnchoredOverlay.defaultProps = {
|
102
|
-
side: 'outside-bottom',
|
103
|
-
align: 'start'
|
104
|
-
};
|
96
|
+
AnchoredOverlay.displayName = 'AnchoredOverlay';
|