@primer/components 0.0.0-202198182351 → 0.0.0-20219819465
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 +295 -294
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +369 -368
- package/dist/browser.umd.js.map +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib/Autocomplete/Autocomplete.d.ts +40 -0
- package/lib/Autocomplete/Autocomplete.js +68 -0
- package/lib/Autocomplete/AutocompleteContext.d.ts +17 -0
- package/lib/Autocomplete/AutocompleteContext.js +11 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +9 -0
- package/lib/Autocomplete/AutocompleteInput.js +150 -0
- package/lib/Autocomplete/AutocompleteMenu.d.ts +71 -0
- package/lib/Autocomplete/AutocompleteMenu.js +223 -0
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +17 -0
- package/lib/Autocomplete/AutocompleteOverlay.js +74 -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 +2 -1
- package/lib/Overlay.js +10 -5
- package/lib/TextInput.d.ts +4 -12
- package/lib/TextInput.js +4 -46
- package/lib/TextInputWithTokens.d.ts +323 -0
- package/lib/TextInputWithTokens.js +244 -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/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 +3 -0
- package/lib/index.js +16 -0
- package/lib/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib/utils/scrollIntoViewingArea.js +39 -0
- package/lib/utils/types/MandateProps.d.ts +3 -0
- package/lib/utils/types/MandateProps.js +1 -0
- package/lib/utils/types/index.d.ts +1 -0
- package/lib/utils/types/index.js +13 -0
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +2 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +11 -3
- package/lib-esm/Autocomplete/Autocomplete.d.ts +40 -0
- package/lib-esm/Autocomplete/Autocomplete.js +47 -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 +9 -0
- package/lib-esm/Autocomplete/AutocompleteInput.js +131 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +71 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.js +204 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +17 -0
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +56 -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 +2 -1
- package/lib-esm/Overlay.js +8 -5
- package/lib-esm/TextInput.d.ts +4 -12
- 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/_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/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 +3 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib-esm/utils/scrollIntoViewingArea.js +30 -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/index.d.ts +1 -0
- package/lib-esm/utils/types/index.js +2 -1
- package/package.json +1 -1
package/lib-esm/index.d.ts
CHANGED
@@ -24,6 +24,7 @@ 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';
|
27
28
|
export { default as Avatar } from './Avatar';
|
28
29
|
export type { AvatarProps } from './Avatar';
|
29
30
|
export { default as AvatarPair } from './AvatarPair';
|
@@ -98,6 +99,8 @@ export { default as TabNav } from './TabNav';
|
|
98
99
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
99
100
|
export { default as TextInput } from './TextInput';
|
100
101
|
export type { TextInputProps } from './TextInput';
|
102
|
+
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
103
|
+
export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
101
104
|
export { default as Text } from './Text';
|
102
105
|
export type { TextProps } from './Text';
|
103
106
|
export { default as Timeline } from './Timeline';
|
package/lib-esm/index.js
CHANGED
@@ -19,6 +19,7 @@ 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';
|
22
23
|
export { default as Avatar } from './Avatar';
|
23
24
|
export { default as AvatarPair } from './AvatarPair';
|
24
25
|
export { default as AvatarStack } from './AvatarStack';
|
@@ -61,6 +62,7 @@ export { default as StyledOcticon } from './StyledOcticon';
|
|
61
62
|
export { default as SubNav } from './SubNav';
|
62
63
|
export { default as TabNav } from './TabNav';
|
63
64
|
export { default as TextInput } from './TextInput';
|
65
|
+
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
64
66
|
export { default as Text } from './Text';
|
65
67
|
export { default as Timeline } from './Timeline';
|
66
68
|
export { default as Token, IssueLabelToken, AvatarToken } from './Token';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const scrollIntoViewingArea: (child: HTMLElement, container: HTMLElement, direction?: 'horizontal' | 'vertical', startMargin?: number, endMargin?: number, behavior?: ScrollBehavior) => void;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export const scrollIntoViewingArea = (child, container, direction = 'vertical', startMargin = 8, endMargin = 0, behavior = 'smooth') => {
|
2
|
+
const startSide = direction === 'vertical' ? 'top' : 'left';
|
3
|
+
const endSide = direction === 'vertical' ? 'bottom' : 'right';
|
4
|
+
const scrollSide = direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
5
|
+
const {
|
6
|
+
[startSide]: childStart,
|
7
|
+
[endSide]: childEnd
|
8
|
+
} = child.getBoundingClientRect();
|
9
|
+
const {
|
10
|
+
[startSide]: containerStart,
|
11
|
+
[endSide]: containerEnd
|
12
|
+
} = container.getBoundingClientRect();
|
13
|
+
const isChildStartAboveViewingArea = childStart < containerStart + endMargin;
|
14
|
+
const isChildBottomBelowViewingArea = childEnd > containerEnd - startMargin;
|
15
|
+
|
16
|
+
if (isChildStartAboveViewingArea) {
|
17
|
+
const scrollHeightToChildStart = childStart - containerStart + container[scrollSide];
|
18
|
+
container.scrollTo({
|
19
|
+
behavior,
|
20
|
+
[startSide]: scrollHeightToChildStart - endMargin
|
21
|
+
});
|
22
|
+
} else if (isChildBottomBelowViewingArea) {
|
23
|
+
const scrollHeightToChildBottom = childEnd - containerEnd + container[scrollSide];
|
24
|
+
container.scrollTo({
|
25
|
+
behavior,
|
26
|
+
[startSide]: scrollHeightToChildBottom + startMargin
|
27
|
+
});
|
28
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
29
|
+
|
30
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|