@primer/components 0.0.0-20219151326 → 0.0.0-202191524113
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 +27 -3
- package/codemods/deprecateUtilityComponents.js +1 -1
- package/dist/browser.esm.js +874 -769
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +877 -772
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Header.js +1 -1
- package/lib/ActionList/Item.js +8 -8
- 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/BaseStyles.js +1 -1
- package/lib/BorderBox.js +1 -1
- package/lib/BranchName.js +1 -1
- package/lib/Breadcrumbs.js +1 -1
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonClose.js +1 -1
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Caret.js +2 -2
- package/lib/Dialog/ConfirmationDialog.js +1 -1
- package/lib/Dialog/Dialog.js +2 -2
- package/lib/Dialog.js +1 -1
- package/lib/FilterList.js +1 -1
- package/lib/FilteredActionList/FilteredActionList.d.ts +3 -2
- package/lib/FilteredActionList/FilteredActionList.js +8 -32
- package/lib/Flash.js +16 -16
- package/lib/Label.js +2 -2
- package/lib/Link.js +1 -1
- package/lib/Overlay.d.ts +1 -0
- package/lib/Overlay.js +3 -1
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectPanel/SelectPanel.d.ts +1 -1
- package/lib/SelectPanel/SelectPanel.js +9 -11
- package/lib/StateLabel.js +13 -19
- package/lib/SubNav.js +1 -1
- package/lib/TextInput.d.ts +5 -13
- package/lib/TextInput.js +4 -46
- package/lib/TextInputWithTokens.d.ts +323 -0
- package/lib/TextInputWithTokens.js +245 -0
- package/lib/Timeline.js +2 -2
- 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/UnderlineNav.js +1 -1
- 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/theme-preval.js +370 -3100
- package/lib/utils/testing.d.ts +50 -493
- package/lib/utils/{types.d.ts → types/AriaRole.d.ts} +0 -13
- package/lib/utils/{types.js → types/AriaRole.js} +0 -0
- package/lib/utils/types/ComponentProps.d.ts +9 -0
- package/lib/utils/types/ComponentProps.js +1 -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/Header.js +1 -1
- package/lib-esm/ActionList/Item.js +8 -8
- 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/BaseStyles.js +1 -1
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/Breadcrumbs.js +1 -1
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.js +1 -1
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/Caret.js +2 -2
- package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
- package/lib-esm/Dialog/Dialog.js +2 -2
- package/lib-esm/Dialog.js +1 -1
- package/lib-esm/FilterList.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.d.ts +3 -2
- package/lib-esm/FilteredActionList/FilteredActionList.js +6 -32
- package/lib-esm/Flash.js +16 -16
- package/lib-esm/Label.js +2 -2
- package/lib-esm/Link.js +1 -1
- package/lib-esm/Overlay.d.ts +1 -0
- package/lib-esm/Overlay.js +3 -1
- package/lib-esm/Pagination/Pagination.js +1 -1
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -10
- package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectPanel/SelectPanel.d.ts +1 -1
- package/lib-esm/SelectPanel/SelectPanel.js +9 -8
- package/lib-esm/StateLabel.js +13 -19
- package/lib-esm/SubNav.js +1 -1
- 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 +220 -0
- package/lib-esm/Timeline.js +2 -2
- 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/UnderlineNav.js +1 -1
- 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/theme-preval.js +370 -3100
- package/lib-esm/utils/testing.d.ts +50 -493
- 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 +4 -3
- package/lib/ActionList2/Description.d.ts +0 -5
- package/lib/ActionList2/Description.js +0 -54
- package/lib/ActionList2/Divider.d.ts +0 -8
- package/lib/ActionList2/Divider.js +0 -42
- package/lib/ActionList2/Group.d.ts +0 -8
- package/lib/ActionList2/Group.js +0 -39
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -52
- package/lib/ActionList2/Item.js +0 -188
- package/lib/ActionList2/List.d.ts +0 -18
- package/lib/ActionList2/List.js +0 -52
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -67
- package/lib/ActionList2/Visuals.d.ts +0 -12
- package/lib/ActionList2/Visuals.js +0 -91
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -26
- package/lib/ActionList2/index.js +0 -36
- package/lib-esm/ActionList2/Description.d.ts +0 -5
- package/lib-esm/ActionList2/Description.js +0 -38
- package/lib-esm/ActionList2/Divider.d.ts +0 -8
- package/lib-esm/ActionList2/Divider.js +0 -30
- package/lib-esm/ActionList2/Group.d.ts +0 -8
- package/lib-esm/ActionList2/Group.js +0 -29
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -52
- package/lib-esm/ActionList2/Item.js +0 -184
- package/lib-esm/ActionList2/List.d.ts +0 -18
- package/lib-esm/ActionList2/List.js +0 -42
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -50
- package/lib-esm/ActionList2/Visuals.d.ts +0 -12
- package/lib-esm/ActionList2/Visuals.js +0 -68
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -26
- package/lib-esm/ActionList2/index.js +0 -23
@@ -0,0 +1,205 @@
|
|
1
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
2
|
+
import { ActionList } from '../ActionList';
|
3
|
+
import { useFocusZone } from '../hooks/useFocusZone';
|
4
|
+
import { Box, Spinner } from '../';
|
5
|
+
import { AutocompleteContext } from './AutocompleteContext';
|
6
|
+
import { PlusIcon } from '@primer/octicons-react';
|
7
|
+
import { uniqueId } from '../utils/uniqueId';
|
8
|
+
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
9
|
+
|
10
|
+
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
11
|
+
|
12
|
+
function getDefaultItemFilter(filterValue) {
|
13
|
+
return function (item, _i) {
|
14
|
+
var _item$text;
|
15
|
+
|
16
|
+
return Boolean((_item$text = item.text) === null || _item$text === void 0 ? void 0 : _item$text.toLowerCase().startsWith(filterValue.toLowerCase()));
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
function getDefaultOnSelectionChange(setInputValueFn) {
|
21
|
+
return function (itemOrItems) {
|
22
|
+
const {
|
23
|
+
text = ''
|
24
|
+
} = Array.isArray(itemOrItems) ? itemOrItems.slice(-1)[0] : itemOrItems;
|
25
|
+
setInputValueFn(text);
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
const isItemSelected = (itemId, selectedItemIds) => selectedItemIds.includes(itemId);
|
30
|
+
|
31
|
+
function getItemById(itemId, items) {
|
32
|
+
return items.find(item => item.id === itemId);
|
33
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
34
|
+
|
35
|
+
|
36
|
+
function AutocompleteMenu(props) {
|
37
|
+
const autocompleteContext = useContext(AutocompleteContext);
|
38
|
+
|
39
|
+
if (autocompleteContext === null) {
|
40
|
+
throw new Error('AutocompleteContext returned null values');
|
41
|
+
}
|
42
|
+
|
43
|
+
const {
|
44
|
+
activeDescendantRef,
|
45
|
+
id,
|
46
|
+
inputRef,
|
47
|
+
inputValue = '',
|
48
|
+
scrollContainerRef,
|
49
|
+
setAutocompleteSuggestion,
|
50
|
+
setShowMenu,
|
51
|
+
setInputValue,
|
52
|
+
setIsMenuDirectlyActivated,
|
53
|
+
setSelectedItemLength,
|
54
|
+
showMenu
|
55
|
+
} = autocompleteContext;
|
56
|
+
const {
|
57
|
+
items,
|
58
|
+
selectedItemIds,
|
59
|
+
sortOnCloseFn,
|
60
|
+
emptyStateText,
|
61
|
+
addNewItem,
|
62
|
+
loading,
|
63
|
+
selectionVariant,
|
64
|
+
filterFn,
|
65
|
+
'aria-labelledby': ariaLabelledBy,
|
66
|
+
onOpenChange,
|
67
|
+
onSelectedChange,
|
68
|
+
customScrollContainerRef
|
69
|
+
} = props;
|
70
|
+
const listContainerRef = useRef(null);
|
71
|
+
const [highlightedItem, setHighlightedItem] = useState();
|
72
|
+
const [sortedItemIds, setSortedItemIds] = useState(items.map(({
|
73
|
+
id: itemId
|
74
|
+
}) => itemId));
|
75
|
+
const selectableItems = useMemo(() => items.map(selectableItem => {
|
76
|
+
return { ...selectableItem,
|
77
|
+
role: 'option',
|
78
|
+
id: selectableItem.id,
|
79
|
+
selected: selectionVariant === 'multiple' ? selectedItemIds.includes(selectableItem.id) : undefined,
|
80
|
+
onAction: item => {
|
81
|
+
const otherSelectedItemIds = selectedItemIds.filter(selectedItemId => selectedItemId !== item.id);
|
82
|
+
const newSelectedItemIds = selectedItemIds.includes(item.id) ? otherSelectedItemIds : [...otherSelectedItemIds, item.id];
|
83
|
+
const onSelectedChangeFn = onSelectedChange ? onSelectedChange : getDefaultOnSelectionChange(setInputValue);
|
84
|
+
onSelectedChangeFn(newSelectedItemIds.map(newSelectedItemId => getItemById(newSelectedItemId, items)));
|
85
|
+
|
86
|
+
if (selectionVariant === 'multiple') {
|
87
|
+
setInputValue('');
|
88
|
+
setAutocompleteSuggestion('');
|
89
|
+
} else {
|
90
|
+
var _inputRef$current;
|
91
|
+
|
92
|
+
setShowMenu(false);
|
93
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
};
|
97
|
+
}), [items, selectedItemIds, inputRef, onSelectedChange, selectionVariant, setAutocompleteSuggestion, setInputValue, setShowMenu]);
|
98
|
+
const itemSortOrderData = useMemo(() => sortedItemIds.reduce((acc, curr, i) => {
|
99
|
+
acc[curr] = i;
|
100
|
+
return acc;
|
101
|
+
}, {}), [sortedItemIds]);
|
102
|
+
const sortedAndFilteredItemsToRender = useMemo(() => selectableItems.filter(filterFn ? filterFn : getDefaultItemFilter(inputValue)).sort((a, b) => itemSortOrderData[a.id] - itemSortOrderData[b.id]), [selectableItems, itemSortOrderData, filterFn, inputValue]);
|
103
|
+
const allItemsToRender = useMemo(() => [// sorted and filtered selectable items
|
104
|
+
...sortedAndFilteredItemsToRender, // menu item used for creating a token from whatever is in the text input
|
105
|
+
...(addNewItem ? [{ ...addNewItem,
|
106
|
+
leadingVisual: () => /*#__PURE__*/React.createElement(PlusIcon, null),
|
107
|
+
onAction: item => {
|
108
|
+
// TODO: make it possible to pass a leadingVisual when using `addNewItem`
|
109
|
+
addNewItem.handleAddItem({ ...item,
|
110
|
+
id: item.id || uniqueId(),
|
111
|
+
leadingVisual: undefined
|
112
|
+
});
|
113
|
+
|
114
|
+
if (selectionVariant === 'multiple') {
|
115
|
+
setInputValue('');
|
116
|
+
setAutocompleteSuggestion('');
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue]);
|
120
|
+
useFocusZone({
|
121
|
+
containerRef: listContainerRef,
|
122
|
+
focusOutBehavior: 'wrap',
|
123
|
+
focusableElementFilter: element => {
|
124
|
+
return !(element instanceof HTMLInputElement);
|
125
|
+
},
|
126
|
+
activeDescendantFocus: inputRef,
|
127
|
+
onActiveDescendantChanged: (current, _previous, directlyActivated) => {
|
128
|
+
activeDescendantRef.current = current || null;
|
129
|
+
|
130
|
+
if (current) {
|
131
|
+
const selectedItem = selectableItems.find(item => item.id.toString() === current.getAttribute('data-id'));
|
132
|
+
setHighlightedItem(selectedItem);
|
133
|
+
setIsMenuDirectlyActivated(directlyActivated);
|
134
|
+
}
|
135
|
+
|
136
|
+
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) {
|
137
|
+
scrollIntoViewingArea(current, customScrollContainerRef.current);
|
138
|
+
} else if (current && scrollContainerRef.current && directlyActivated) {
|
139
|
+
scrollIntoViewingArea(current, scrollContainerRef.current);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}, [loading]);
|
143
|
+
useEffect(() => {
|
144
|
+
var _highlightedItem$text;
|
145
|
+
|
146
|
+
if (highlightedItem !== null && highlightedItem !== void 0 && (_highlightedItem$text = highlightedItem.text) !== null && _highlightedItem$text !== void 0 && _highlightedItem$text.startsWith(inputValue) && !selectedItemIds.includes(highlightedItem.id)) {
|
147
|
+
setAutocompleteSuggestion(highlightedItem.text);
|
148
|
+
} else {
|
149
|
+
setAutocompleteSuggestion('');
|
150
|
+
}
|
151
|
+
}, [highlightedItem, inputValue, selectedItemIds, setAutocompleteSuggestion]);
|
152
|
+
useEffect(() => {
|
153
|
+
const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn(itemId => isItemSelected(itemId, selectedItemIds)));
|
154
|
+
const sortResultMatchesState = itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element, index) => element === sortedItemIds[index]);
|
155
|
+
|
156
|
+
if (showMenu === false && !sortResultMatchesState) {
|
157
|
+
setSortedItemIds(itemIdSortResult);
|
158
|
+
}
|
159
|
+
|
160
|
+
onOpenChange && onOpenChange(Boolean(showMenu));
|
161
|
+
}, [showMenu, onOpenChange, selectedItemIds, sortOnCloseFn, sortedItemIds]);
|
162
|
+
useEffect(() => {
|
163
|
+
if (selectedItemIds.length) {
|
164
|
+
setSelectedItemLength(selectedItemIds.length);
|
165
|
+
}
|
166
|
+
}, [selectedItemIds, setSelectedItemLength]);
|
167
|
+
return /*#__PURE__*/React.createElement(Box, {
|
168
|
+
sx: !showMenu ? {
|
169
|
+
// visually hides this label for sighted users
|
170
|
+
position: 'absolute',
|
171
|
+
width: '1px',
|
172
|
+
height: '1px',
|
173
|
+
padding: '0',
|
174
|
+
margin: '-1px',
|
175
|
+
overflow: 'hidden',
|
176
|
+
clip: 'rect(0, 0, 0, 0)',
|
177
|
+
whiteSpace: 'nowrap',
|
178
|
+
borderWidth: '0'
|
179
|
+
} : {}
|
180
|
+
}, loading ? /*#__PURE__*/React.createElement(Box, {
|
181
|
+
p: 3,
|
182
|
+
display: "flex",
|
183
|
+
justifyContent: "center"
|
184
|
+
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement("div", {
|
185
|
+
ref: listContainerRef
|
186
|
+
}, allItemsToRender.length ? /*#__PURE__*/React.createElement(ActionList, {
|
187
|
+
selectionVariant: "multiple" // have to typecast to `ItemProps` because we have an extra property
|
188
|
+
// on `items` for Autocomplete: `metadata`
|
189
|
+
,
|
190
|
+
items: allItemsToRender,
|
191
|
+
role: "listbox",
|
192
|
+
id: `${id}-listbox`,
|
193
|
+
"aria-labelledby": ariaLabelledBy
|
194
|
+
}) : /*#__PURE__*/React.createElement(Box, {
|
195
|
+
p: 3
|
196
|
+
}, emptyStateText)));
|
197
|
+
}
|
198
|
+
|
199
|
+
AutocompleteMenu.displayName = "AutocompleteMenu";
|
200
|
+
AutocompleteMenu.defaultProps = {
|
201
|
+
emptyStateText: 'No selectable options',
|
202
|
+
selectionVariant: 'single'
|
203
|
+
};
|
204
|
+
AutocompleteMenu.displayName = 'AutocompleteMenu';
|
205
|
+
export default AutocompleteMenu;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { OverlayProps } from '../Overlay';
|
3
|
+
import { ComponentProps } from '../utils/types';
|
4
|
+
declare type AutocompleteOverlayInternalProps = {
|
5
|
+
/**
|
6
|
+
* The ref of the element that the position of the menu is based on. By default, the menu is positioned based on the text input
|
7
|
+
*/
|
8
|
+
menuAnchorRef?: React.RefObject<HTMLElement>;
|
9
|
+
/**
|
10
|
+
* Props to be spread on the internal `Overlay` component.
|
11
|
+
*/
|
12
|
+
overlayProps?: Partial<OverlayProps>;
|
13
|
+
children?: React.ReactNode;
|
14
|
+
} & Pick<React.AriaAttributes, 'aria-labelledby'>;
|
15
|
+
declare function AutocompleteOverlay({ menuAnchorRef, overlayProps, children }: AutocompleteOverlayInternalProps): JSX.Element | null;
|
16
|
+
declare namespace AutocompleteOverlay {
|
17
|
+
var displayName: string;
|
18
|
+
}
|
19
|
+
export declare type AutocompleteOverlayProps = ComponentProps<typeof AutocompleteOverlay>;
|
20
|
+
export default AutocompleteOverlay;
|
@@ -0,0 +1,62 @@
|
|
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
|
+
|
3
|
+
import React, { useCallback, useContext } from 'react';
|
4
|
+
import { useAnchoredPosition } from '../hooks';
|
5
|
+
import Overlay from '../Overlay';
|
6
|
+
import { AutocompleteContext } from './AutocompleteContext';
|
7
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs';
|
8
|
+
|
9
|
+
// TODO: consider making 'aria-labelledby' required
|
10
|
+
function AutocompleteOverlay({
|
11
|
+
menuAnchorRef,
|
12
|
+
overlayProps,
|
13
|
+
children
|
14
|
+
}) {
|
15
|
+
const autocompleteContext = useContext(AutocompleteContext);
|
16
|
+
|
17
|
+
if (autocompleteContext === null) {
|
18
|
+
throw new Error('AutocompleteContext returned null values');
|
19
|
+
}
|
20
|
+
|
21
|
+
const {
|
22
|
+
inputRef,
|
23
|
+
scrollContainerRef,
|
24
|
+
selectedItemLength,
|
25
|
+
setShowMenu,
|
26
|
+
showMenu = false
|
27
|
+
} = autocompleteContext;
|
28
|
+
const {
|
29
|
+
floatingElementRef,
|
30
|
+
position
|
31
|
+
} = useAnchoredPosition({
|
32
|
+
side: 'outside-bottom',
|
33
|
+
align: 'start',
|
34
|
+
anchorElementRef: menuAnchorRef ? menuAnchorRef : inputRef
|
35
|
+
}, [showMenu, selectedItemLength]);
|
36
|
+
const combinedOverlayRef = useCombinedRefs(scrollContainerRef, floatingElementRef);
|
37
|
+
const closeOptionList = useCallback(() => {
|
38
|
+
setShowMenu(false);
|
39
|
+
}, [setShowMenu]);
|
40
|
+
|
41
|
+
if (typeof window === 'undefined') {
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
|
45
|
+
return /*#__PURE__*/React.createElement(Overlay, _extends({
|
46
|
+
returnFocusRef: inputRef,
|
47
|
+
preventFocusOnOpen: true,
|
48
|
+
onClickOutside: closeOptionList,
|
49
|
+
onEscape: closeOptionList,
|
50
|
+
ref: combinedOverlayRef,
|
51
|
+
top: position === null || position === void 0 ? void 0 : position.top,
|
52
|
+
left: position === null || position === void 0 ? void 0 : position.left,
|
53
|
+
visibility: showMenu ? 'visible' : 'hidden',
|
54
|
+
sx: {
|
55
|
+
overflow: 'auto'
|
56
|
+
}
|
57
|
+
}, overlayProps), children);
|
58
|
+
}
|
59
|
+
|
60
|
+
AutocompleteOverlay.displayName = "AutocompleteOverlay";
|
61
|
+
AutocompleteOverlay.displayName = 'AutocompleteOverlay';
|
62
|
+
export default AutocompleteOverlay;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Autocomplete';
|
package/lib-esm/BaseStyles.js
CHANGED
package/lib-esm/BorderBox.js
CHANGED
package/lib-esm/BranchName.js
CHANGED
@@ -4,5 +4,5 @@ import sx from './sx';
|
|
4
4
|
const BranchName = styled.a.withConfig({
|
5
5
|
displayName: "BranchName",
|
6
6
|
componentId: "sc-167ouzm-0"
|
7
|
-
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.fg.
|
7
|
+
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.primer.fg.disabled'), get('colors.accent.subtle'), get('radii.2'), COMMON, sx);
|
8
8
|
export default BranchName;
|
package/lib-esm/Breadcrumbs.js
CHANGED
@@ -11,7 +11,7 @@ const SELECTED_CLASS = 'selected';
|
|
11
11
|
const Wrapper = styled.li.withConfig({
|
12
12
|
displayName: "Breadcrumbs__Wrapper",
|
13
13
|
componentId: "hwwoo0-0"
|
14
|
-
})(["display:inline-block;white-space:nowrap;list-style:none;&::after{padding-right:0.5em;padding-left:0.5em;color:", ";font-size:", ";content:'/';}&:first-child{margin-left:0;}&:last-child{&::after{content:none;}}"], get('colors.fg.
|
14
|
+
})(["display:inline-block;white-space:nowrap;list-style:none;&::after{padding-right:0.5em;padding-left:0.5em;color:", ";font-size:", ";content:'/';}&:first-child{margin-left:0;}&:last-child{&::after{content:none;}}"], get('colors.primer.fg.disabled'), get('fontSizes.1'));
|
15
15
|
const BreadcrumbsBase = styled.nav.withConfig({
|
16
16
|
displayName: "Breadcrumbs__BreadcrumbsBase",
|
17
17
|
componentId: "hwwoo0-1"
|
package/lib-esm/Button/Button.js
CHANGED
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
7
|
componentId: "xjtz72-0"
|
8
|
-
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.fg.
|
8
|
+
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
|
9
9
|
export default Button;
|
@@ -8,7 +8,7 @@ import sx from '../sx';
|
|
8
8
|
const StyledButton = styled.button.withConfig({
|
9
9
|
displayName: "ButtonClose__StyledButton",
|
10
10
|
componentId: "sc-13mzqph-0"
|
11
|
-
})(["border:none;padding:0;background:transparent;outline:none;cursor:pointer;border-radius:", ";color:", ";&:focus{box-shadow:", ";}&:hover{color:", ";}", ";", ";", ";"], get('radii.2'), get('colors.fg.
|
11
|
+
})(["border:none;padding:0;background:transparent;outline:none;cursor:pointer;border-radius:", ";color:", ";&:focus{box-shadow:", ";}&:hover{color:", ";}", ";", ";", ";"], get('radii.2'), get('colors.primer.fg.disabled'), get('shadows.btn.focusShadow'), get('colors.accent.fg'), COMMON, LAYOUT, sx);
|
12
12
|
const ButtonClose = /*#__PURE__*/forwardRef((props, ref) => {
|
13
13
|
return /*#__PURE__*/React.createElement(StyledButton, _extends({
|
14
14
|
ref: ref,
|
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const ButtonInvisible = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "ButtonInvisible",
|
7
7
|
componentId: "sc-1195tpn-0"
|
8
|
-
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}", ";", ""], get('colors.accent.fg'), get('radii.2'), get('colors.fg.
|
8
|
+
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}", ";", ""], get('colors.accent.fg'), get('radii.2'), get('colors.primer.fg.disabled'), get('shadows.btn.focusShadow'), buttonSystemProps, sx);
|
9
9
|
export default ButtonInvisible;
|
@@ -4,5 +4,5 @@ import sx from '../sx';
|
|
4
4
|
const ButtonTableList = styled.summary.withConfig({
|
5
5
|
displayName: "ButtonTableList",
|
6
6
|
componentId: "sc-1m4q8ia-0"
|
7
|
-
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:rgba(", ",0.5);cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.
|
7
|
+
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:rgba(", ",0.5);cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.primer.fg.disabled'), get('colors.primer.fg.disabled'), get('space.1'), COMMON, TYPOGRAPHY, LAYOUT, sx);
|
8
8
|
export default ButtonTableList;
|
package/lib-esm/Caret.js
CHANGED
@@ -106,8 +106,8 @@ function Caret(props) {
|
|
106
106
|
Caret.displayName = "Caret";
|
107
107
|
Caret.locations = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
|
108
108
|
Caret.defaultProps = {
|
109
|
-
bg: '
|
110
|
-
borderColor: 'border.
|
109
|
+
bg: 'canvas.default',
|
110
|
+
borderColor: 'border.default',
|
111
111
|
borderWidth: 1
|
112
112
|
};
|
113
113
|
export default Caret;
|
@@ -41,7 +41,7 @@ ConfirmationHeader.displayName = "ConfirmationHeader";
|
|
41
41
|
const StyledConfirmationBody = styled(Box).withConfig({
|
42
42
|
displayName: "ConfirmationDialog__StyledConfirmationBody",
|
43
43
|
componentId: "sc-1ub32x2-2"
|
44
|
-
})(["font-size:", ";padding:0 ", " ", " ", ";color:", ";flex-grow:1;"], get('fontSizes.1'), get('space.3'), get('space.3'), get('space.3'), get('colors.fg.
|
44
|
+
})(["font-size:", ";padding:0 ", " ", " ", ";color:", ";flex-grow:1;"], get('fontSizes.1'), get('space.3'), get('space.3'), get('space.3'), get('colors.primer.fg.disabled'));
|
45
45
|
|
46
46
|
const ConfirmationBody = ({
|
47
47
|
children
|
package/lib-esm/Dialog/Dialog.js
CHANGED
@@ -173,7 +173,7 @@ const Title = styled(Box).withConfig({
|
|
173
173
|
const Subtitle = styled(Box).withConfig({
|
174
174
|
displayName: "Dialog__Subtitle",
|
175
175
|
componentId: "sc-11pkgky-4"
|
176
|
-
})(["font-size:", ";margin-top:", ";color:", ";"], get('fontSizes.0'), get('space.1'), get('colors.fg.
|
176
|
+
})(["font-size:", ";margin-top:", ";color:", ";"], get('fontSizes.0'), get('space.1'), get('colors.primer.fg.disabled'));
|
177
177
|
const Body = styled(Box).withConfig({
|
178
178
|
displayName: "Dialog__Body",
|
179
179
|
componentId: "sc-11pkgky-5"
|
@@ -227,7 +227,7 @@ const Buttons = ({
|
|
227
227
|
const DialogCloseButton = styled(Button).withConfig({
|
228
228
|
displayName: "Dialog__DialogCloseButton",
|
229
229
|
componentId: "sc-11pkgky-7"
|
230
|
-
})(["border-radius:4px;background:transparent;border:0;vertical-align:middle;color:", ";padding:", ";align-self:flex-start;line-height:normal;box-shadow:none;"], get('colors.fg.
|
230
|
+
})(["border-radius:4px;background:transparent;border:0;vertical-align:middle;color:", ";padding:", ";align-self:flex-start;line-height:normal;box-shadow:none;"], get('colors.primer.fg.disabled'), get('space.2'));
|
231
231
|
|
232
232
|
const CloseButton = ({
|
233
233
|
onClose
|
package/lib-esm/Dialog.js
CHANGED
package/lib-esm/FilterList.js
CHANGED
@@ -21,7 +21,7 @@ FilterList.displayName = "FilterList";
|
|
21
21
|
const FilterListItemBase = styled.a.withConfig({
|
22
22
|
displayName: "FilterList__FilterListItemBase",
|
23
23
|
componentId: "sc-1l4pxmz-1"
|
24
|
-
})(["position:relative;display:block;padding:", ";margin:", ";overflow:hidden;font-size:", ";color:", ";background-color:", "!important;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:", ";&:hover{text-decoration:none;background-color:", ";}&:active{color:", ";background-color:", ";}.count{float:right;font-weight:", ";}", ";", ";"], props => props.small ? `${get('space.1')(props)} 10px` : `${get('space.2')(props)} 11px`, props => props.small ? '0 0 2px' : '0 0 5px 0', get('fontSizes.1'), props => props.selected ? get('colors.fg.onEmphasis') : get('colors.fg.
|
24
|
+
})(["position:relative;display:block;padding:", ";margin:", ";overflow:hidden;font-size:", ";color:", ";background-color:", "!important;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:", ";&:hover{text-decoration:none;background-color:", ";}&:active{color:", ";background-color:", ";}.count{float:right;font-weight:", ";}", ";", ";"], props => props.small ? `${get('space.1')(props)} 10px` : `${get('space.2')(props)} 11px`, props => props.small ? '0 0 2px' : '0 0 5px 0', get('fontSizes.1'), props => props.selected ? get('colors.fg.onEmphasis') : get('colors.primer.fg.disabled'), props => props.selected ? get('colors.accent.emphasis') : '', get('radii.1'), get('colors.canvas.subtle'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('fontWeights.bold'), COMMON, sx);
|
25
25
|
|
26
26
|
function FilterListItem({
|
27
27
|
children,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GroupedListProps, ListPropsBase } from '../ActionList/List';
|
3
3
|
import { TextInputProps } from '../TextInput';
|
4
|
-
|
4
|
+
import { SxProp } from '../sx';
|
5
|
+
export interface FilteredActionListProps extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>, ListPropsBase, SxProp {
|
5
6
|
loading?: boolean;
|
6
7
|
placeholderText: string;
|
7
8
|
filterValue?: string;
|
@@ -9,7 +10,7 @@ export interface FilteredActionListProps extends Partial<Omit<GroupedListProps,
|
|
9
10
|
textInputProps?: Partial<Omit<TextInputProps, 'onChange'>>;
|
10
11
|
inputRef?: React.RefObject<HTMLInputElement>;
|
11
12
|
}
|
12
|
-
export declare function FilteredActionList({ loading, placeholderText, filterValue: externalFilterValue, onFilterChange, items, textInputProps, inputRef: providedInputRef, ...listProps }: FilteredActionListProps): JSX.Element;
|
13
|
+
export declare function FilteredActionList({ loading, placeholderText, filterValue: externalFilterValue, onFilterChange, items, textInputProps, inputRef: providedInputRef, sx, ...listProps }: FilteredActionListProps): JSX.Element;
|
13
14
|
export declare namespace FilteredActionList {
|
14
15
|
var displayName: string;
|
15
16
|
}
|
@@ -1,6 +1,7 @@
|
|
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';
|
4
5
|
import TextInput from '../TextInput';
|
5
6
|
import Box from '../Box';
|
6
7
|
import { ActionList } from '../ActionList';
|
@@ -11,36 +12,7 @@ import styled from 'styled-components';
|
|
11
12
|
import { get } from '../constants';
|
12
13
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate';
|
13
14
|
import useScrollFlash from '../hooks/useScrollFlash';
|
14
|
-
import {
|
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
|
-
|
15
|
+
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
44
16
|
const StyledHeader = styled.div.withConfig({
|
45
17
|
displayName: "FilteredActionList__StyledHeader",
|
46
18
|
componentId: "yg3jkv-0"
|
@@ -53,6 +25,7 @@ export function FilteredActionList({
|
|
53
25
|
items,
|
54
26
|
textInputProps,
|
55
27
|
inputRef: providedInputRef,
|
28
|
+
sx,
|
56
29
|
...listProps
|
57
30
|
}) {
|
58
31
|
const [filterValue, setInternalFilterValue] = useProvidedStateOrCreate(externalFilterValue, undefined, '');
|
@@ -94,14 +67,15 @@ export function FilteredActionList({
|
|
94
67
|
useEffect(() => {
|
95
68
|
// if items changed, we want to instantly move active descendant into view
|
96
69
|
if (activeDescendantRef.current && scrollContainerRef.current) {
|
97
|
-
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, undefined, 'auto');
|
70
|
+
scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
|
98
71
|
}
|
99
72
|
}, [items]);
|
100
73
|
useScrollFlash(scrollContainerRef);
|
101
74
|
return /*#__PURE__*/React.createElement(Box, {
|
102
75
|
display: "flex",
|
103
76
|
flexDirection: "column",
|
104
|
-
overflow: "hidden"
|
77
|
+
overflow: "hidden",
|
78
|
+
sx: sx
|
105
79
|
}, /*#__PURE__*/React.createElement(StyledHeader, null, /*#__PURE__*/React.createElement(TextInput, _extends({
|
106
80
|
ref: inputRef,
|
107
81
|
block: true,
|
package/lib-esm/Flash.js
CHANGED
@@ -5,35 +5,35 @@ import sx from './sx';
|
|
5
5
|
const variants = variant({
|
6
6
|
variants: {
|
7
7
|
default: {
|
8
|
-
color: '
|
9
|
-
backgroundColor: '
|
10
|
-
borderColor: '
|
8
|
+
color: 'fg.default',
|
9
|
+
backgroundColor: 'accent.subtle',
|
10
|
+
borderColor: 'accent.muted',
|
11
11
|
svg: {
|
12
|
-
color: '
|
12
|
+
color: 'accent.fg'
|
13
13
|
}
|
14
14
|
},
|
15
15
|
success: {
|
16
|
-
color: '
|
17
|
-
backgroundColor: '
|
18
|
-
borderColor: '
|
16
|
+
color: 'fg.default',
|
17
|
+
backgroundColor: 'success.subtle',
|
18
|
+
borderColor: 'success.muted',
|
19
19
|
svg: {
|
20
|
-
color: '
|
20
|
+
color: 'success.fg'
|
21
21
|
}
|
22
22
|
},
|
23
23
|
danger: {
|
24
|
-
color: '
|
25
|
-
backgroundColor: '
|
26
|
-
borderColor: '
|
24
|
+
color: 'fg.default',
|
25
|
+
backgroundColor: 'danger.subtle',
|
26
|
+
borderColor: 'danger.muted',
|
27
27
|
svg: {
|
28
|
-
color: '
|
28
|
+
color: 'danger.fg'
|
29
29
|
}
|
30
30
|
},
|
31
31
|
warning: {
|
32
|
-
color: '
|
33
|
-
backgroundColor: '
|
34
|
-
borderColor: '
|
32
|
+
color: 'fg.default',
|
33
|
+
backgroundColor: 'attention.subtle',
|
34
|
+
borderColor: 'attention.muted',
|
35
35
|
svg: {
|
36
|
-
color: '
|
36
|
+
color: 'attention.fg'
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
package/lib-esm/Label.js
CHANGED
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components';
|
|
2
2
|
import { borderColor, variant } from 'styled-system';
|
3
3
|
import { COMMON, get } from './constants';
|
4
4
|
import sx from './sx';
|
5
|
-
const outlineStyles = css(["margin-top:-1px;margin-bottom:-1px;color:", ";border:", " solid ", ";box-shadow:none;", ";", ";background-color:transparent;"], get('colors.fg.
|
5
|
+
const outlineStyles = css(["margin-top:-1px;margin-bottom:-1px;color:", ";border:", " solid ", ";box-shadow:none;", ";", ";background-color:transparent;"], get('colors.primer.fg.disabled'), get('borderWidths.1'), get('colors.border.default'), borderColor, COMMON);
|
6
6
|
const sizeVariant = variant({
|
7
7
|
variants: {
|
8
8
|
small: {
|
@@ -33,7 +33,7 @@ const Label = styled.span.withConfig({
|
|
33
33
|
componentId: "sc-1t3ykp0-0"
|
34
34
|
})(["display:inline-block;font-weight:", ";color:", ";border-radius:", ";&:hover{text-decoration:none;}", " ", " ", " ", " ", ""], get('fontWeights.semibold'), get('colors.fg.onEmphasis'), get('radii.3'), sizeVariant, COMMON, props => props.dropshadow ? 'box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12)' : '', props => props.outline ? outlineStyles : '', sx);
|
35
35
|
Label.defaultProps = {
|
36
|
-
bg: '
|
36
|
+
bg: 'neutral.emphasis',
|
37
37
|
variant: 'medium'
|
38
38
|
};
|
39
39
|
export default Label;
|
package/lib-esm/Link.js
CHANGED
@@ -11,5 +11,5 @@ const hoverColor = system({
|
|
11
11
|
const Link = styled.a.withConfig({
|
12
12
|
displayName: "Link",
|
13
13
|
componentId: "sc-1brdqhf-0"
|
14
|
-
})(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";", ";", ";"], props => props.muted ? get('colors.fg.
|
14
|
+
})(["color:", ";text-decoration:", ";&:hover{text-decoration:", ";", ";}&:is(button){display:inline-block;padding:0;font-size:inherit;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;}", ";", ";", ";"], props => props.muted ? get('colors.primer.fg.disabled')(props) : get('colors.accent.fg')(props), props => props.underline ? 'underline' : 'none', props => props.muted ? 'none' : 'underline', props => props.hoverColor ? hoverColor : props.muted ? `color: ${get('colors.accent.fg')(props)}` : '', TYPOGRAPHY, COMMON, sx);
|
15
15
|
export default Link;
|
package/lib-esm/Overlay.d.ts
CHANGED
@@ -40,6 +40,7 @@ export declare type OverlayProps = {
|
|
40
40
|
top: number;
|
41
41
|
left: number;
|
42
42
|
portalContainerName?: string;
|
43
|
+
preventFocusOnOpen?: boolean;
|
43
44
|
} & Omit<ComponentProps<typeof StyledOverlay>, 'visibility' | keyof SystemPositionProps>;
|
44
45
|
/**
|
45
46
|
* An `Overlay` is a flexible floating surface, used to display transient content such as menus,
|
package/lib-esm/Overlay.js
CHANGED
@@ -92,6 +92,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
92
92
|
left,
|
93
93
|
anchorSide,
|
94
94
|
portalContainerName,
|
95
|
+
preventFocusOnOpen,
|
95
96
|
...rest
|
96
97
|
}, forwardedRef) => {
|
97
98
|
const overlayRef = useRef(null);
|
@@ -107,7 +108,8 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
107
108
|
onEscape,
|
108
109
|
ignoreClickRefs,
|
109
110
|
onClickOutside,
|
110
|
-
initialFocusRef
|
111
|
+
initialFocusRef,
|
112
|
+
preventFocusOnOpen
|
111
113
|
});
|
112
114
|
useEffect(() => {
|
113
115
|
var _combinedRef$current;
|