@primer/components 0.0.0-202191252016 → 0.0.0-2021913173522
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 +5 -1
- package/dist/browser.esm.js +851 -747
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +484 -380
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/List.d.ts +2 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib/Autocomplete/Autocomplete.d.ts +304 -0
- package/lib/Autocomplete/Autocomplete.js +145 -0
- package/lib/Autocomplete/AutocompleteContext.d.ts +17 -0
- package/lib/Autocomplete/AutocompleteContext.js +11 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +292 -0
- package/lib/Autocomplete/AutocompleteInput.js +157 -0
- package/lib/Autocomplete/AutocompleteMenu.d.ts +72 -0
- package/lib/Autocomplete/AutocompleteMenu.js +224 -0
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +20 -0
- package/lib/Autocomplete/AutocompleteOverlay.js +80 -0
- package/lib/Autocomplete/index.d.ts +2 -0
- package/lib/Autocomplete/index.js +15 -0
- package/lib/FilteredActionList/FilteredActionList.js +5 -31
- package/lib/Overlay.d.ts +1 -0
- package/lib/Overlay.js +3 -1
- package/lib/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib/TextInput.d.ts +5 -13
- package/lib/TextInput.js +4 -46
- package/lib/TextInputWithTokens.d.ts +323 -0
- package/lib/TextInputWithTokens.js +244 -0
- package/lib/Token/AvatarToken.d.ts +7 -0
- package/lib/Token/AvatarToken.js +64 -0
- package/lib/Token/IssueLabelToken.d.ts +14 -0
- package/lib/Token/IssueLabelToken.js +144 -0
- package/lib/Token/Token.d.ts +15 -0
- package/lib/Token/Token.js +94 -0
- package/lib/Token/TokenBase.d.ts +31 -0
- package/lib/Token/TokenBase.js +108 -0
- package/lib/Token/_RemoveTokenButton.d.ts +12 -0
- package/lib/Token/_RemoveTokenButton.js +77 -0
- package/lib/Token/_TokenTextContainer.d.ts +3 -0
- package/lib/Token/_TokenTextContainer.js +17 -0
- package/lib/Token/index.d.ts +3 -0
- package/lib/Token/index.js +31 -0
- package/lib/_TextInputWrapper.d.ts +10 -0
- package/lib/_TextInputWrapper.js +51 -0
- package/lib/_UnstyledTextInput.d.ts +2 -0
- package/lib/_UnstyledTextInput.js +20 -0
- package/lib/behaviors/scrollIntoViewingArea.d.ts +1 -0
- package/lib/behaviors/scrollIntoViewingArea.js +39 -0
- package/lib/hooks/useOpenAndCloseFocus.d.ts +2 -1
- package/lib/hooks/useOpenAndCloseFocus.js +7 -2
- package/lib/hooks/useOverlay.d.ts +2 -1
- package/lib/hooks/useOverlay.js +4 -2
- package/lib/index.d.ts +5 -0
- package/lib/index.js +36 -0
- package/lib/utils/{types.d.ts → types/AriaRole.d.ts} +0 -13
- package/lib/{DatePicker/DatePickerPanel.js → utils/types/AriaRole.js} +0 -0
- package/lib/utils/types/ComponentProps.d.ts +9 -0
- package/lib/utils/{types.js → types/ComponentProps.js} +0 -0
- package/lib/utils/types/Flatten.d.ts +4 -0
- package/lib/utils/types/Flatten.js +1 -0
- package/lib/utils/types/MandateProps.d.ts +3 -0
- package/lib/utils/types/MandateProps.js +1 -0
- package/lib/utils/types/Merge.d.ts +19 -0
- package/lib/utils/types/Merge.js +1 -0
- package/lib/utils/types/index.d.ts +5 -0
- package/lib/utils/types/index.js +70 -0
- package/lib-esm/ActionList/List.d.ts +2 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib-esm/Autocomplete/Autocomplete.d.ts +304 -0
- package/lib-esm/Autocomplete/Autocomplete.js +123 -0
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +17 -0
- package/lib-esm/Autocomplete/AutocompleteContext.js +2 -0
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +292 -0
- package/lib-esm/Autocomplete/AutocompleteInput.js +138 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +72 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.js +205 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +20 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +62 -0
- package/lib-esm/Autocomplete/index.d.ts +2 -0
- package/lib-esm/Autocomplete/index.js +1 -0
- package/lib-esm/FilteredActionList/FilteredActionList.js +3 -31
- package/lib-esm/Overlay.d.ts +1 -0
- package/lib-esm/Overlay.js +3 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib-esm/TextInput.d.ts +5 -13
- package/lib-esm/TextInput.js +4 -37
- package/lib-esm/TextInputWithTokens.d.ts +323 -0
- package/lib-esm/TextInputWithTokens.js +219 -0
- package/lib-esm/Token/AvatarToken.d.ts +7 -0
- package/lib-esm/Token/AvatarToken.js +43 -0
- package/lib-esm/Token/IssueLabelToken.d.ts +14 -0
- package/lib-esm/Token/IssueLabelToken.js +124 -0
- package/lib-esm/Token/Token.d.ts +15 -0
- package/lib-esm/Token/Token.js +73 -0
- package/lib-esm/Token/TokenBase.d.ts +31 -0
- package/lib-esm/Token/TokenBase.js +87 -0
- package/lib-esm/Token/_RemoveTokenButton.d.ts +12 -0
- package/lib-esm/Token/_RemoveTokenButton.js +60 -0
- package/lib-esm/Token/_TokenTextContainer.d.ts +3 -0
- package/lib-esm/Token/_TokenTextContainer.js +6 -0
- package/lib-esm/Token/index.d.ts +3 -0
- package/lib-esm/Token/index.js +3 -0
- package/lib-esm/_TextInputWrapper.d.ts +10 -0
- package/lib-esm/_TextInputWrapper.js +31 -0
- package/lib-esm/_UnstyledTextInput.d.ts +2 -0
- package/lib-esm/_UnstyledTextInput.js +7 -0
- package/lib-esm/behaviors/scrollIntoViewingArea.d.ts +1 -0
- package/lib-esm/behaviors/scrollIntoViewingArea.js +30 -0
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +2 -1
- package/lib-esm/hooks/useOpenAndCloseFocus.js +7 -2
- package/lib-esm/hooks/useOverlay.d.ts +2 -1
- package/lib-esm/hooks/useOverlay.js +4 -2
- package/lib-esm/index.d.ts +5 -0
- package/lib-esm/index.js +3 -0
- package/lib-esm/utils/{types.d.ts → types/AriaRole.d.ts} +0 -13
- package/lib-esm/utils/{types.js → types/AriaRole.js} +0 -0
- package/lib-esm/utils/types/ComponentProps.d.ts +9 -0
- package/lib-esm/utils/types/ComponentProps.js +1 -0
- package/lib-esm/utils/types/Flatten.d.ts +4 -0
- package/lib-esm/utils/types/Flatten.js +1 -0
- package/lib-esm/utils/types/MandateProps.d.ts +3 -0
- package/lib-esm/utils/types/MandateProps.js +1 -0
- package/lib-esm/utils/types/Merge.d.ts +19 -0
- package/lib-esm/utils/types/Merge.js +1 -0
- package/lib-esm/utils/types/index.d.ts +5 -0
- package/lib-esm/utils/types/index.js +5 -0
- package/package.json +2 -2
- package/lib/DatePicker/DatePicker.d.ts +0 -44
- package/lib/DatePicker/DatePicker.js +0 -72
- package/lib/DatePicker/DatePickerAnchor.d.ts +0 -10
- package/lib/DatePicker/DatePickerAnchor.js +0 -83
- package/lib/DatePicker/DatePickerPanel.d.ts +0 -0
- package/lib/DatePicker/Day.d.ts +0 -13
- package/lib/DatePicker/Day.js +0 -126
- package/lib/DatePicker/Month.d.ts +0 -9
- package/lib/DatePicker/Month.js +0 -97
- package/lib/DatePicker/index.d.ts +0 -2
- package/lib/DatePicker/index.js +0 -13
- package/lib-esm/DatePicker/DatePicker.d.ts +0 -44
- package/lib-esm/DatePicker/DatePicker.js +0 -55
- package/lib-esm/DatePicker/DatePickerAnchor.d.ts +0 -10
- package/lib-esm/DatePicker/DatePickerAnchor.js +0 -59
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +0 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +0 -0
- package/lib-esm/DatePicker/Day.d.ts +0 -13
- package/lib-esm/DatePicker/Day.js +0 -104
- package/lib-esm/DatePicker/Month.d.ts +0 -9
- package/lib-esm/DatePicker/Month.js +0 -74
- package/lib-esm/DatePicker/index.d.ts +0 -2
- package/lib-esm/DatePicker/index.js +0 -1
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
9
|
+
|
10
|
+
var _styledSystem = require("styled-system");
|
11
|
+
|
12
|
+
var _constants = require("./constants");
|
13
|
+
|
14
|
+
var _sx = _interopRequireDefault(require("./sx"));
|
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
|
+
const sizeVariants = (0, _styledSystem.variant)({
|
23
|
+
variants: {
|
24
|
+
small: {
|
25
|
+
minHeight: '28px',
|
26
|
+
px: 2,
|
27
|
+
py: '3px',
|
28
|
+
fontSize: 0,
|
29
|
+
lineHeight: '20px'
|
30
|
+
},
|
31
|
+
large: {
|
32
|
+
px: 2,
|
33
|
+
py: '10px',
|
34
|
+
fontSize: 3
|
35
|
+
}
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
const TextInputWrapper = _styledComponents.default.span.withConfig({
|
40
|
+
displayName: "_TextInputWrapper__TextInputWrapper",
|
41
|
+
componentId: "sc-5vfcis-0"
|
42
|
+
})(["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 => {
|
43
|
+
if (props.hasIcon) {
|
44
|
+
return (0, _styledComponents.css)(["padding:0;"]);
|
45
|
+
} else {
|
46
|
+
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
47
|
+
}
|
48
|
+
}, (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);
|
49
|
+
|
50
|
+
var _default = TextInputWrapper;
|
51
|
+
exports.default = _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
|
+
|
10
|
+
var _sx = _interopRequireDefault(require("./sx"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const UnstyledTextInput = _styledComponents.default.input.withConfig({
|
15
|
+
displayName: "_UnstyledTextInput__UnstyledTextInput",
|
16
|
+
componentId: "sc-1jgl33s-0"
|
17
|
+
})(["border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;&:focus{outline:0;}", ";"], _sx.default);
|
18
|
+
|
19
|
+
var _default = UnstyledTextInput;
|
20
|
+
exports.default = _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const scrollIntoViewingArea: (child: HTMLElement, viewingArea: HTMLElement, direction?: 'horizontal' | 'vertical', startMargin?: number, endMargin?: number, behavior?: ScrollBehavior) => void;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.scrollIntoViewingArea = void 0;
|
7
|
+
|
8
|
+
const scrollIntoViewingArea = (child, viewingArea, direction = 'vertical', startMargin = 8, endMargin = 0, behavior = 'smooth') => {
|
9
|
+
const startSide = direction === 'vertical' ? 'top' : 'left';
|
10
|
+
const endSide = direction === 'vertical' ? 'bottom' : 'right';
|
11
|
+
const scrollSide = direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
12
|
+
const {
|
13
|
+
[startSide]: childStart,
|
14
|
+
[endSide]: childEnd
|
15
|
+
} = child.getBoundingClientRect();
|
16
|
+
const {
|
17
|
+
[startSide]: viewingAreaStart,
|
18
|
+
[endSide]: viewingAreaEnd
|
19
|
+
} = viewingArea.getBoundingClientRect();
|
20
|
+
const isChildStartAboveViewingArea = childStart < viewingAreaStart + endMargin;
|
21
|
+
const isChildBottomBelowViewingArea = childEnd > viewingAreaEnd - startMargin;
|
22
|
+
|
23
|
+
if (isChildStartAboveViewingArea) {
|
24
|
+
const scrollHeightToChildStart = childStart - viewingAreaStart + viewingArea[scrollSide];
|
25
|
+
viewingArea.scrollTo({
|
26
|
+
behavior,
|
27
|
+
[startSide]: scrollHeightToChildStart - endMargin
|
28
|
+
});
|
29
|
+
} else if (isChildBottomBelowViewingArea) {
|
30
|
+
const scrollHeightToChildBottom = childEnd - viewingAreaEnd + viewingArea[scrollSide];
|
31
|
+
viewingArea.scrollTo({
|
32
|
+
behavior,
|
33
|
+
[startSide]: scrollHeightToChildBottom + startMargin
|
34
|
+
});
|
35
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
36
|
+
|
37
|
+
};
|
38
|
+
|
39
|
+
exports.scrollIntoViewingArea = scrollIntoViewingArea;
|
@@ -3,5 +3,6 @@ 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;
|
6
7
|
};
|
7
|
-
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef }: UseOpenAndCloseFocusSettings): void;
|
8
|
+
export declare function useOpenAndCloseFocus({ initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen }: UseOpenAndCloseFocusSettings): void;
|
@@ -12,9 +12,14 @@ var _iterateFocusableElements = require("../utils/iterateFocusableElements");
|
|
12
12
|
function useOpenAndCloseFocus({
|
13
13
|
initialFocusRef,
|
14
14
|
returnFocusRef,
|
15
|
-
containerRef
|
15
|
+
containerRef,
|
16
|
+
preventFocusOnOpen
|
16
17
|
}) {
|
17
18
|
(0, _react.useEffect)(() => {
|
19
|
+
if (preventFocusOnOpen) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
18
23
|
const returnRef = returnFocusRef.current;
|
19
24
|
|
20
25
|
if (initialFocusRef && initialFocusRef.current) {
|
@@ -27,5 +32,5 @@ function useOpenAndCloseFocus({
|
|
27
32
|
return function () {
|
28
33
|
returnRef === null || returnRef === void 0 ? void 0 : returnRef.focus();
|
29
34
|
};
|
30
|
-
}, [initialFocusRef, returnFocusRef, containerRef]);
|
35
|
+
}, [initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen]);
|
31
36
|
}
|
@@ -7,8 +7,9 @@ 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;
|
10
11
|
};
|
11
12
|
export declare type OverlayReturnProps = {
|
12
13
|
ref: React.RefObject<HTMLDivElement>;
|
13
14
|
};
|
14
|
-
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside }: UseOverlaySettings) => OverlayReturnProps;
|
15
|
+
export declare const useOverlay: ({ overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside, preventFocusOnOpen }: UseOverlaySettings) => OverlayReturnProps;
|
package/lib/hooks/useOverlay.js
CHANGED
@@ -19,13 +19,15 @@ const useOverlay = ({
|
|
19
19
|
initialFocusRef,
|
20
20
|
onEscape,
|
21
21
|
ignoreClickRefs,
|
22
|
-
onClickOutside
|
22
|
+
onClickOutside,
|
23
|
+
preventFocusOnOpen
|
23
24
|
}) => {
|
24
25
|
const overlayRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(_overlayRef);
|
25
26
|
(0, _useOpenAndCloseFocus.useOpenAndCloseFocus)({
|
26
27
|
containerRef: overlayRef,
|
27
28
|
returnFocusRef,
|
28
|
-
initialFocusRef
|
29
|
+
initialFocusRef,
|
30
|
+
preventFocusOnOpen
|
29
31
|
});
|
30
32
|
(0, _useOnOutsideClick.useOnOutsideClick)({
|
31
33
|
containerRef: overlayRef,
|
package/lib/index.d.ts
CHANGED
@@ -24,6 +24,8 @@ 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
|
+
export type { AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps } from './Autocomplete';
|
27
29
|
export { default as Avatar } from './Avatar';
|
28
30
|
export type { AvatarProps } from './Avatar';
|
29
31
|
export { default as AvatarPair } from './AvatarPair';
|
@@ -98,10 +100,13 @@ export { default as TabNav } from './TabNav';
|
|
98
100
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
99
101
|
export { default as TextInput } from './TextInput';
|
100
102
|
export type { TextInputProps } from './TextInput';
|
103
|
+
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
104
|
+
export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
101
105
|
export { default as Text } from './Text';
|
102
106
|
export type { TextProps } from './Text';
|
103
107
|
export { default as Timeline } from './Timeline';
|
104
108
|
export type { TimelineProps, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps } from './Timeline';
|
109
|
+
export { default as Token, IssueLabelToken, AvatarToken } from './Token';
|
105
110
|
export { default as Tooltip } from './Tooltip';
|
106
111
|
export type { TooltipProps } from './Tooltip';
|
107
112
|
export { default as Truncate } from './Truncate';
|
package/lib/index.js
CHANGED
@@ -153,6 +153,12 @@ 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
|
+
});
|
156
162
|
Object.defineProperty(exports, "Avatar", {
|
157
163
|
enumerable: true,
|
158
164
|
get: function () {
|
@@ -429,6 +435,12 @@ Object.defineProperty(exports, "TextInput", {
|
|
429
435
|
return _TextInput.default;
|
430
436
|
}
|
431
437
|
});
|
438
|
+
Object.defineProperty(exports, "TextInputWithTokens", {
|
439
|
+
enumerable: true,
|
440
|
+
get: function () {
|
441
|
+
return _TextInputWithTokens.default;
|
442
|
+
}
|
443
|
+
});
|
432
444
|
Object.defineProperty(exports, "Text", {
|
433
445
|
enumerable: true,
|
434
446
|
get: function () {
|
@@ -441,6 +453,24 @@ Object.defineProperty(exports, "Timeline", {
|
|
441
453
|
return _Timeline.default;
|
442
454
|
}
|
443
455
|
});
|
456
|
+
Object.defineProperty(exports, "Token", {
|
457
|
+
enumerable: true,
|
458
|
+
get: function () {
|
459
|
+
return _Token.default;
|
460
|
+
}
|
461
|
+
});
|
462
|
+
Object.defineProperty(exports, "IssueLabelToken", {
|
463
|
+
enumerable: true,
|
464
|
+
get: function () {
|
465
|
+
return _Token.IssueLabelToken;
|
466
|
+
}
|
467
|
+
});
|
468
|
+
Object.defineProperty(exports, "AvatarToken", {
|
469
|
+
enumerable: true,
|
470
|
+
get: function () {
|
471
|
+
return _Token.AvatarToken;
|
472
|
+
}
|
473
|
+
});
|
444
474
|
Object.defineProperty(exports, "Tooltip", {
|
445
475
|
enumerable: true,
|
446
476
|
get: function () {
|
@@ -508,6 +538,8 @@ var _ActionList = require("./ActionList");
|
|
508
538
|
|
509
539
|
var _ActionMenu = require("./ActionMenu");
|
510
540
|
|
541
|
+
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
542
|
+
|
511
543
|
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
512
544
|
|
513
545
|
var _AvatarPair = _interopRequireDefault(require("./AvatarPair"));
|
@@ -582,10 +614,14 @@ var _TabNav = _interopRequireDefault(require("./TabNav"));
|
|
582
614
|
|
583
615
|
var _TextInput = _interopRequireDefault(require("./TextInput"));
|
584
616
|
|
617
|
+
var _TextInputWithTokens = _interopRequireDefault(require("./TextInputWithTokens"));
|
618
|
+
|
585
619
|
var _Text = _interopRequireDefault(require("./Text"));
|
586
620
|
|
587
621
|
var _Timeline = _interopRequireDefault(require("./Timeline"));
|
588
622
|
|
623
|
+
var _Token = _interopRequireWildcard(require("./Token"));
|
624
|
+
|
589
625
|
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
590
626
|
|
591
627
|
var _Truncate = _interopRequireDefault(require("./Truncate"));
|
@@ -1,14 +1 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
/**
|
3
|
-
* Extract a component's props
|
4
|
-
*
|
5
|
-
* Source: https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_usecase#wrappingmirroring-a-component
|
6
|
-
*
|
7
|
-
* @example ComponentProps<typeof MyComponent>
|
8
|
-
*/
|
9
|
-
export declare type ComponentProps<T> = T extends React.ComponentType<infer Props> ? Props extends object ? Props : never : never;
|
10
|
-
/**
|
11
|
-
* Contruct a type describing the items in `T`, if `T` is an array.
|
12
|
-
*/
|
13
|
-
export declare type Flatten<T extends unknown> = T extends (infer U)[] ? U : never;
|
14
1
|
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';
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
/**
|
3
|
+
* Extract a component's props
|
4
|
+
*
|
5
|
+
* Source: https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_usecase#wrappingmirroring-a-component
|
6
|
+
*
|
7
|
+
* @example ComponentProps<typeof MyComponent>
|
8
|
+
*/
|
9
|
+
export declare type ComponentProps<T> = T extends React.ComponentType<infer Props> ? Props extends object ? Props : never : never;
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Given two object types A and B, return a type with all the properties of A that aren't also
|
3
|
+
* properties of B, and all the properties of B.
|
4
|
+
*
|
5
|
+
* Useful when we have a component that spreads a "rest" of its props on a subcomponent:
|
6
|
+
*
|
7
|
+
* ```ts
|
8
|
+
* interface OwnProps {
|
9
|
+
* foo: string
|
10
|
+
* }
|
11
|
+
*
|
12
|
+
* type MyComponentProps = Merge<SubcomponentProps, OwnProps>
|
13
|
+
* const MyComponent = ({foo, ...rest}: MyComponentProps) => {
|
14
|
+
* // ...
|
15
|
+
* return <SubComponent {...rest} />
|
16
|
+
* }
|
17
|
+
* ```
|
18
|
+
*/
|
19
|
+
export declare type Merge<A = {}, B = {}> = Omit<A, keyof B> & B;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
var _AriaRole = require("./AriaRole");
|
8
|
+
|
9
|
+
Object.keys(_AriaRole).forEach(function (key) {
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
11
|
+
if (key in exports && exports[key] === _AriaRole[key]) return;
|
12
|
+
Object.defineProperty(exports, key, {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _AriaRole[key];
|
16
|
+
}
|
17
|
+
});
|
18
|
+
});
|
19
|
+
|
20
|
+
var _ComponentProps = require("./ComponentProps");
|
21
|
+
|
22
|
+
Object.keys(_ComponentProps).forEach(function (key) {
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
24
|
+
if (key in exports && exports[key] === _ComponentProps[key]) return;
|
25
|
+
Object.defineProperty(exports, key, {
|
26
|
+
enumerable: true,
|
27
|
+
get: function () {
|
28
|
+
return _ComponentProps[key];
|
29
|
+
}
|
30
|
+
});
|
31
|
+
});
|
32
|
+
|
33
|
+
var _Flatten = require("./Flatten");
|
34
|
+
|
35
|
+
Object.keys(_Flatten).forEach(function (key) {
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
37
|
+
if (key in exports && exports[key] === _Flatten[key]) return;
|
38
|
+
Object.defineProperty(exports, key, {
|
39
|
+
enumerable: true,
|
40
|
+
get: function () {
|
41
|
+
return _Flatten[key];
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
45
|
+
|
46
|
+
var _Merge = require("./Merge");
|
47
|
+
|
48
|
+
Object.keys(_Merge).forEach(function (key) {
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
50
|
+
if (key in exports && exports[key] === _Merge[key]) return;
|
51
|
+
Object.defineProperty(exports, key, {
|
52
|
+
enumerable: true,
|
53
|
+
get: function () {
|
54
|
+
return _Merge[key];
|
55
|
+
}
|
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
|
+
});
|
@@ -2,8 +2,9 @@ import React, { Key } from 'react';
|
|
2
2
|
import type { AriaRole } from '../utils/types';
|
3
3
|
import { Group, GroupProps } from './Group';
|
4
4
|
import { ItemProps } from './Item';
|
5
|
+
import { Merge } from '../utils/types/Merge';
|
5
6
|
declare type RenderItemFn = (props: ItemProps) => React.ReactElement;
|
6
|
-
export declare type ItemInput =
|
7
|
+
export declare type ItemInput = Merge<React.ComponentPropsWithoutRef<'div'>, ItemProps> | ((Partial<ItemProps> & {
|
7
8
|
renderItem: RenderItemFn;
|
8
9
|
}) & {
|
9
10
|
key?: Key;
|
@@ -2,6 +2,7 @@ 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';
|
5
6
|
interface AnchoredOverlayPropsWithAnchor {
|
6
7
|
/**
|
7
8
|
* A custom function component used to render the anchor element.
|
@@ -52,7 +53,7 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
52
53
|
*/
|
53
54
|
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
54
55
|
}
|
55
|
-
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor)
|
56
|
+
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor) & Partial<Pick<PositionSettings, 'align' | 'side'>>;
|
56
57
|
/**
|
57
58
|
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
58
59
|
* The overlay can be opened and navigated using keyboard or mouse.
|
@@ -22,7 +22,9 @@ export const AnchoredOverlay = ({
|
|
22
22
|
width,
|
23
23
|
overlayProps,
|
24
24
|
focusTrapSettings,
|
25
|
-
focusZoneSettings
|
25
|
+
focusZoneSettings,
|
26
|
+
side,
|
27
|
+
align
|
26
28
|
}) => {
|
27
29
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
28
30
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
@@ -52,7 +54,9 @@ export const AnchoredOverlay = ({
|
|
52
54
|
position
|
53
55
|
} = useAnchoredPosition({
|
54
56
|
anchorElementRef: anchorRef,
|
55
|
-
floatingElementRef: overlayRef
|
57
|
+
floatingElementRef: overlayRef,
|
58
|
+
side,
|
59
|
+
align
|
56
60
|
}, [overlayRef.current]);
|
57
61
|
useEffect(() => {
|
58
62
|
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
@@ -93,4 +97,8 @@ export const AnchoredOverlay = ({
|
|
93
97
|
anchorSide: position === null || position === void 0 ? void 0 : position.anchorSide
|
94
98
|
}, overlayProps), children) : null);
|
95
99
|
};
|
96
|
-
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
100
|
+
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
101
|
+
AnchoredOverlay.defaultProps = {
|
102
|
+
side: 'outside-bottom',
|
103
|
+
align: 'start'
|
104
|
+
};
|