@primer/components 0.0.0-202182720420 → 0.0.0-202182722258
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 +2 -40
- package/dist/browser.esm.js +627 -670
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +389 -432
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Divider.js +1 -1
- package/lib/ActionList/Header.js +2 -2
- package/lib/ActionList/Item.js +13 -13
- package/lib/ActionList/List.js +1 -1
- package/lib/AnchoredOverlay/AnchoredOverlay.js +2 -2
- package/lib/Autocomplete/Autocomplete.d.ts +26 -0
- package/lib/Autocomplete/Autocomplete.js +55 -0
- package/lib/Autocomplete/AutocompleteContext.d.ts +13 -0
- package/lib/Autocomplete/AutocompleteContext.js +15 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +9 -0
- package/lib/Autocomplete/AutocompleteInput.js +139 -0
- package/lib/Autocomplete/AutocompleteMenu.d.ts +67 -0
- package/lib/Autocomplete/AutocompleteMenu.js +284 -0
- package/lib/Autocomplete/index.d.ts +2 -0
- package/lib/Autocomplete/index.js +15 -0
- package/lib/Avatar.d.ts +0 -4
- package/lib/AvatarPair.js +1 -1
- package/lib/AvatarStack.d.ts +8 -4
- package/lib/AvatarStack.js +7 -6
- package/lib/Badge/Badge.d.ts +8 -0
- package/lib/Badge/Badge.js +59 -0
- package/lib/Badge/BadgeState.d.ts +13 -0
- package/lib/Badge/BadgeState.js +51 -0
- package/lib/Badge/_badgeStyleUtils.d.ts +3 -0
- package/lib/Badge/_badgeStyleUtils.js +39 -0
- package/lib/BranchName.js +1 -1
- package/lib/Breadcrumb.d.ts +23 -0
- package/lib/{Breadcrumbs.js → Breadcrumb.js} +23 -33
- package/lib/Button/Button.d.ts +1 -0
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonClose.d.ts +2 -1
- package/lib/Button/ButtonClose.js +1 -1
- package/lib/Button/ButtonDanger.d.ts +1 -0
- package/lib/Button/ButtonInvisible.d.ts +1 -0
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Button/ButtonOutline.d.ts +1 -0
- package/lib/Button/ButtonPrimary.d.ts +1 -0
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/CircleBadge.js +1 -1
- package/lib/CircleOcticon.d.ts +1 -0
- package/lib/CircleOcticon.js +1 -1
- package/lib/CounterLabel.js +2 -2
- package/lib/Dialog/ConfirmationDialog.js +1 -1
- package/lib/Dialog/Dialog.js +9 -9
- package/lib/Dialog.d.ts +3 -2
- package/lib/Dialog.js +4 -4
- package/lib/Dropdown.d.ts +4 -0
- package/lib/Dropdown.js +2 -2
- package/lib/DropdownMenu/DropdownButton.d.ts +2 -1
- package/lib/DropdownStyles.js +6 -6
- package/lib/FilterList.d.ts +1 -0
- package/lib/FilterList.js +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +8 -34
- package/lib/Flash.js +1 -1
- package/lib/Label.js +2 -2
- package/lib/Link.js +1 -1
- package/lib/Overlay.d.ts +2 -1
- package/lib/Overlay.js +11 -6
- package/lib/Pagehead.js +1 -1
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/Popover.js +1 -1
- package/lib/Position.d.ts +4 -4
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +344 -15
- package/lib/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuList.js +1 -1
- package/lib/SelectMenu/SelectMenuLoadingAnimation.js +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.js +2 -2
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectPanel/SelectPanel.js +2 -3
- package/lib/SideNav.js +5 -5
- package/lib/StateLabel.js +1 -1
- package/lib/SubNav.js +1 -1
- package/lib/TabNav.js +2 -2
- package/lib/TextInput.d.ts +10 -7
- package/lib/TextInput.js +24 -29
- package/lib/TextInputTokens.d.ts +43 -0
- package/lib/TextInputTokens.js +227 -0
- package/lib/TextInputWithTokens.d.ts +41 -0
- package/lib/TextInputWithTokens.js +396 -0
- package/lib/Timeline.d.ts +1 -0
- package/lib/Timeline.js +19 -16
- package/lib/Token/Token.d.ts +7 -0
- package/lib/Token/Token.js +63 -0
- package/lib/Token/TokenBase.d.ts +16 -0
- package/lib/Token/TokenBase.js +76 -0
- package/lib/Token/TokenLabel.d.ts +10 -0
- package/lib/Token/TokenLabel.js +115 -0
- package/lib/Token/TokenProfile.d.ts +7 -0
- package/lib/Token/TokenProfile.js +45 -0
- package/lib/Token/_RemoveTokenButton.d.ts +3 -0
- package/lib/Token/_RemoveTokenButton.js +43 -0
- package/lib/Token/_tokenButtonUtils.d.ts +9 -0
- package/lib/Token/_tokenButtonUtils.js +42 -0
- package/lib/Tooltip.js +1 -1
- package/lib/UnderlineNav.js +2 -2
- package/lib/_UnstyledTextInput.d.ts +2 -0
- package/lib/_UnstyledTextInput.js +20 -0
- package/lib/hooks/useOverlay.d.ts +2 -1
- package/lib/hooks/useOverlay.js +11 -6
- package/lib/index.d.ts +2 -3
- package/lib/index.js +2 -22
- package/lib/theme-preval.d.ts +6 -12
- package/lib/theme-preval.js +0 -940
- package/lib/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib/utils/scrollIntoViewingArea.js +39 -0
- package/lib/utils/testing.d.ts +0 -1854
- package/lib/utils/types.d.ts +3 -0
- package/lib/utils/uniqueId.js +0 -1
- package/lib-esm/ActionList/Divider.js +1 -1
- package/lib-esm/ActionList/Header.js +2 -2
- package/lib-esm/ActionList/Item.js +14 -14
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +3 -3
- package/lib-esm/Autocomplete/Autocomplete.d.ts +26 -0
- package/lib-esm/Autocomplete/Autocomplete.js +36 -0
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +13 -0
- package/lib-esm/Autocomplete/AutocompleteContext.js +6 -0
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +9 -0
- package/lib-esm/Autocomplete/AutocompleteInput.js +120 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +67 -0
- package/lib-esm/Autocomplete/AutocompleteMenu.js +258 -0
- package/lib-esm/Autocomplete/index.d.ts +2 -0
- package/lib-esm/Autocomplete/index.js +1 -0
- package/lib-esm/Avatar.d.ts +0 -4
- package/lib-esm/AvatarPair.js +1 -1
- package/lib-esm/AvatarStack.d.ts +8 -4
- package/lib-esm/AvatarStack.js +8 -7
- package/lib-esm/Badge/Badge.d.ts +8 -0
- package/lib-esm/Badge/Badge.js +44 -0
- package/lib-esm/Badge/BadgeState.d.ts +13 -0
- package/lib-esm/Badge/BadgeState.js +40 -0
- package/lib-esm/Badge/_badgeStyleUtils.d.ts +3 -0
- package/lib-esm/Badge/_badgeStyleUtils.js +29 -0
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/Breadcrumb.d.ts +23 -0
- package/lib-esm/{Breadcrumbs.js → Breadcrumb.js} +21 -30
- package/lib-esm/Button/Button.d.ts +1 -0
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +2 -1
- package/lib-esm/Button/ButtonClose.js +1 -1
- package/lib-esm/Button/ButtonDanger.d.ts +1 -0
- package/lib-esm/Button/ButtonInvisible.d.ts +1 -0
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonOutline.d.ts +1 -0
- package/lib-esm/Button/ButtonPrimary.d.ts +1 -0
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/CircleBadge.js +1 -1
- package/lib-esm/CircleOcticon.d.ts +1 -0
- package/lib-esm/CircleOcticon.js +1 -1
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Dialog/ConfirmationDialog.js +1 -1
- package/lib-esm/Dialog/Dialog.js +8 -8
- package/lib-esm/Dialog.d.ts +3 -2
- package/lib-esm/Dialog.js +4 -4
- package/lib-esm/Dropdown.d.ts +4 -0
- package/lib-esm/Dropdown.js +2 -2
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -1
- package/lib-esm/DropdownStyles.js +6 -6
- package/lib-esm/FilterList.d.ts +1 -0
- package/lib-esm/FilterList.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +6 -34
- package/lib-esm/Flash.js +1 -1
- package/lib-esm/Label.js +2 -2
- package/lib-esm/Link.js +1 -1
- package/lib-esm/Overlay.d.ts +2 -1
- package/lib-esm/Overlay.js +9 -6
- package/lib-esm/Pagehead.js +1 -1
- package/lib-esm/Pagination/Pagination.js +1 -1
- package/lib-esm/Popover.js +1 -1
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +344 -15
- package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuList.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectPanel/SelectPanel.js +2 -3
- package/lib-esm/SideNav.js +5 -5
- package/lib-esm/StateLabel.js +1 -1
- package/lib-esm/SubNav.js +1 -1
- package/lib-esm/TabNav.js +2 -2
- package/lib-esm/TextInput.d.ts +10 -7
- package/lib-esm/TextInput.js +23 -29
- package/lib-esm/TextInputTokens.d.ts +43 -0
- package/lib-esm/TextInputTokens.js +200 -0
- package/lib-esm/TextInputWithTokens.d.ts +41 -0
- package/lib-esm/TextInputWithTokens.js +361 -0
- package/lib-esm/Timeline.d.ts +1 -0
- package/lib-esm/Timeline.js +17 -12
- package/lib-esm/Token/Token.d.ts +7 -0
- package/lib-esm/Token/Token.js +44 -0
- package/lib-esm/Token/TokenBase.d.ts +16 -0
- package/lib-esm/Token/TokenBase.js +56 -0
- package/lib-esm/Token/TokenLabel.d.ts +10 -0
- package/lib-esm/Token/TokenLabel.js +99 -0
- package/lib-esm/Token/TokenProfile.d.ts +7 -0
- package/lib-esm/Token/TokenProfile.js +28 -0
- package/lib-esm/Token/_RemoveTokenButton.d.ts +3 -0
- package/lib-esm/Token/_RemoveTokenButton.js +28 -0
- package/lib-esm/Token/_tokenButtonUtils.d.ts +9 -0
- package/lib-esm/Token/_tokenButtonUtils.js +26 -0
- package/lib-esm/Tooltip.js +1 -1
- package/lib-esm/UnderlineNav.js +2 -2
- package/lib-esm/_UnstyledTextInput.d.ts +2 -0
- package/lib-esm/_UnstyledTextInput.js +7 -0
- package/lib-esm/hooks/useOverlay.d.ts +2 -1
- package/lib-esm/hooks/useOverlay.js +11 -6
- package/lib-esm/index.d.ts +2 -3
- package/lib-esm/index.js +2 -3
- package/lib-esm/theme-preval.d.ts +6 -12
- package/lib-esm/theme-preval.js +0 -940
- package/lib-esm/utils/scrollIntoViewingArea.d.ts +1 -0
- package/lib-esm/utils/scrollIntoViewingArea.js +30 -0
- package/lib-esm/utils/testing.d.ts +0 -1854
- package/lib-esm/utils/types.d.ts +3 -0
- package/lib-esm/utils/uniqueId.js +0 -1
- package/package.json +14 -14
- package/lib/Breadcrumbs.d.ts +0 -40
- package/lib/utils/ssr.d.ts +0 -1
- package/lib/utils/ssr.js +0 -19
- package/lib-esm/Breadcrumbs.d.ts +0 -40
- package/lib-esm/utils/ssr.d.ts +0 -1
- package/lib-esm/utils/ssr.js +0 -1
@@ -0,0 +1,258 @@
|
|
1
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
2
|
+
import { ActionList } from '../ActionList';
|
3
|
+
import { useAnchoredPosition } from '../hooks';
|
4
|
+
import { useFocusZone } from '../hooks/useFocusZone';
|
5
|
+
import Overlay from '../Overlay';
|
6
|
+
import { Box, Spinner } from '../';
|
7
|
+
import { registerPortalRoot } from '../Portal';
|
8
|
+
import { AutocompleteContext } from './AutocompleteContext';
|
9
|
+
import { useCombinedRefs } from '../hooks/useCombinedRefs';
|
10
|
+
import { PlusIcon } from '@primer/octicons-react';
|
11
|
+
import { uniqueId } from '../utils/uniqueId';
|
12
|
+
import { scrollIntoViewingArea } from '../utils/scrollIntoViewingArea';
|
13
|
+
const DROPDOWN_PORTAL_CONTAINER_NAME = '__listcontainerportal__';
|
14
|
+
|
15
|
+
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
16
|
+
|
17
|
+
function getDefaultItemFilter(filterValue) {
|
18
|
+
return function (item, _i) {
|
19
|
+
var _item$text;
|
20
|
+
|
21
|
+
return Boolean((_item$text = item.text) === null || _item$text === void 0 ? void 0 : _item$text.toLowerCase().startsWith(filterValue.toLowerCase()));
|
22
|
+
};
|
23
|
+
} // TODO: DRY this out - it's also in FilteredActionList
|
24
|
+
|
25
|
+
|
26
|
+
function scrollIntoViewingAreaTwo(child, container, margin = 8, behavior = 'smooth') {
|
27
|
+
const {
|
28
|
+
top: childTop,
|
29
|
+
bottom: childBottom
|
30
|
+
} = child.getBoundingClientRect();
|
31
|
+
const {
|
32
|
+
top: containerTop,
|
33
|
+
bottom: containerBottom
|
34
|
+
} = container.getBoundingClientRect();
|
35
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
36
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
37
|
+
|
38
|
+
if (isChildTopAboveViewingArea) {
|
39
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
40
|
+
container.scrollTo({
|
41
|
+
behavior,
|
42
|
+
top: scrollHeightToChildTop - margin
|
43
|
+
});
|
44
|
+
} else if (isChildBottomBelowViewingArea) {
|
45
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
46
|
+
container.scrollTo({
|
47
|
+
behavior,
|
48
|
+
top: scrollHeightToChildBottom + margin
|
49
|
+
});
|
50
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
51
|
+
|
52
|
+
}
|
53
|
+
|
54
|
+
function getDefaultOnItemSelectFn(setInputValueFn) {
|
55
|
+
if (setInputValueFn) {
|
56
|
+
return function ({
|
57
|
+
text = ''
|
58
|
+
}) {
|
59
|
+
setInputValueFn(text);
|
60
|
+
};
|
61
|
+
}
|
62
|
+
|
63
|
+
return ({
|
64
|
+
text
|
65
|
+
}) => {
|
66
|
+
console.error(`getDefaultOnItemSelectFn could not be called with ${text} because a function to set the text input was undefined`);
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
function AutocompleteMenu(props) {
|
71
|
+
const {
|
72
|
+
activeDescendantRef,
|
73
|
+
inputRef,
|
74
|
+
inputValue = '',
|
75
|
+
setAutocompleteSuggestion,
|
76
|
+
setShowMenu,
|
77
|
+
setInputValue,
|
78
|
+
setIsMenuDirectlyActivated,
|
79
|
+
showMenu
|
80
|
+
} = useContext(AutocompleteContext);
|
81
|
+
const {
|
82
|
+
items,
|
83
|
+
selectedItemIds,
|
84
|
+
selectedSortFn,
|
85
|
+
onItemSelect = getDefaultOnItemSelectFn(setInputValue),
|
86
|
+
onItemDeselect,
|
87
|
+
emptyStateText,
|
88
|
+
addNewItem,
|
89
|
+
loading,
|
90
|
+
selectionVariant,
|
91
|
+
filterFn = getDefaultItemFilter(inputValue),
|
92
|
+
width,
|
93
|
+
height,
|
94
|
+
maxHeight,
|
95
|
+
menuAnchorRef
|
96
|
+
} = props;
|
97
|
+
const listContainerRef = useRef(null);
|
98
|
+
const scrollContainerRef = useRef(null);
|
99
|
+
const [highlightedItem, setHighlightedItem] = useState();
|
100
|
+
const [sortedItemIds, setSortedItemIds] = useState(items.map(({
|
101
|
+
id
|
102
|
+
}) => id));
|
103
|
+
const {
|
104
|
+
floatingElementRef,
|
105
|
+
position
|
106
|
+
} = useAnchoredPosition({
|
107
|
+
side: 'outside-bottom',
|
108
|
+
align: 'start',
|
109
|
+
anchorElementRef: menuAnchorRef ? menuAnchorRef : inputRef
|
110
|
+
}, [showMenu, selectedItemIds]);
|
111
|
+
const combinedOverlayRef = useCombinedRefs(scrollContainerRef, floatingElementRef);
|
112
|
+
|
113
|
+
const closeOptionList = () => {
|
114
|
+
if (setShowMenu) {
|
115
|
+
setShowMenu(false);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
const isItemSelected = itemId => selectedItemIds.includes(itemId);
|
120
|
+
|
121
|
+
const selectableItems = [// selectable tokens
|
122
|
+
...items.map(selectableItem => {
|
123
|
+
return { ...selectableItem,
|
124
|
+
id: selectableItem.id,
|
125
|
+
selected: selectionVariant === 'multiple' ? isItemSelected(selectableItem.id) : undefined,
|
126
|
+
onAction: (item, e) => {
|
127
|
+
const handleItemSelection = () => {
|
128
|
+
onItemSelect(item, e);
|
129
|
+
|
130
|
+
if (selectionVariant === 'multiple') {
|
131
|
+
setInputValue && setInputValue('');
|
132
|
+
setAutocompleteSuggestion && setAutocompleteSuggestion('');
|
133
|
+
}
|
134
|
+
};
|
135
|
+
|
136
|
+
if (item.selected) {
|
137
|
+
onItemDeselect && onItemDeselect(item, e);
|
138
|
+
} else {
|
139
|
+
handleItemSelection();
|
140
|
+
}
|
141
|
+
|
142
|
+
if (selectionVariant === 'single') {
|
143
|
+
var _inputRef$current;
|
144
|
+
|
145
|
+
setShowMenu && setShowMenu(false);
|
146
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
};
|
150
|
+
})];
|
151
|
+
useFocusZone({
|
152
|
+
containerRef: listContainerRef,
|
153
|
+
focusOutBehavior: 'wrap',
|
154
|
+
focusableElementFilter: element => {
|
155
|
+
return !(element instanceof HTMLInputElement);
|
156
|
+
},
|
157
|
+
activeDescendantFocus: inputRef,
|
158
|
+
onActiveDescendantChanged: (current, _previous, directlyActivated) => {
|
159
|
+
if (activeDescendantRef) {
|
160
|
+
activeDescendantRef.current = current || null;
|
161
|
+
}
|
162
|
+
|
163
|
+
if (current) {
|
164
|
+
const selectedItem = selectableItems.find(item => item.id.toString() === (current === null || current === void 0 ? void 0 : current.dataset.id));
|
165
|
+
setHighlightedItem(selectedItem);
|
166
|
+
|
167
|
+
if (setIsMenuDirectlyActivated) {
|
168
|
+
setIsMenuDirectlyActivated(directlyActivated);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
if (current && scrollContainerRef.current && directlyActivated) {
|
173
|
+
scrollIntoViewingArea(current, scrollContainerRef.current);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
});
|
177
|
+
useEffect(() => {
|
178
|
+
var _highlightedItem$text;
|
179
|
+
|
180
|
+
if (!setAutocompleteSuggestion) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
if (highlightedItem !== null && highlightedItem !== void 0 && (_highlightedItem$text = highlightedItem.text) !== null && _highlightedItem$text !== void 0 && _highlightedItem$text.startsWith(inputValue)) {
|
185
|
+
setAutocompleteSuggestion(highlightedItem.text);
|
186
|
+
} else {
|
187
|
+
setAutocompleteSuggestion('');
|
188
|
+
}
|
189
|
+
}, [highlightedItem, inputValue]);
|
190
|
+
useEffect(() => {
|
191
|
+
setSortedItemIds([...sortedItemIds].sort(selectedSortFn ? selectedSortFn : getDefaultSortFn(isItemSelected)));
|
192
|
+
}, [showMenu]);
|
193
|
+
|
194
|
+
if (listContainerRef.current) {
|
195
|
+
registerPortalRoot(listContainerRef.current, DROPDOWN_PORTAL_CONTAINER_NAME);
|
196
|
+
}
|
197
|
+
|
198
|
+
const itemSortOrderData = sortedItemIds.reduce((acc, curr, i) => {
|
199
|
+
acc[curr] = i;
|
200
|
+
return acc;
|
201
|
+
}, {});
|
202
|
+
const sortedAndFilteredItemsToRender = selectableItems.filter( // TODO: get rid of typecast
|
203
|
+
// w/o it, I get error `assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MandateProps<ItemProps, "id">'`
|
204
|
+
// COLEHELP
|
205
|
+
(item, i) => filterFn(item, i)).sort((a, b) => itemSortOrderData[a.id] - itemSortOrderData[b.id]);
|
206
|
+
const allItemsToRender = [// sorted and filtered selectable items
|
207
|
+
...sortedAndFilteredItemsToRender, // menu item used for creating a token from whatever is in the text input
|
208
|
+
...(addNewItem ? [{ ...addNewItem,
|
209
|
+
leadingVisual: () => /*#__PURE__*/React.createElement(PlusIcon, null),
|
210
|
+
onAction: (item, e) => {
|
211
|
+
// TODO: clean up this hacky-ness
|
212
|
+
addNewItem.handleAddItem({ ...item,
|
213
|
+
id: item.id || uniqueId(),
|
214
|
+
leadingVisual: undefined
|
215
|
+
});
|
216
|
+
|
217
|
+
if (selectionVariant === 'multiple') {
|
218
|
+
setInputValue && setInputValue('');
|
219
|
+
setAutocompleteSuggestion && setAutocompleteSuggestion('');
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}] : [])];
|
223
|
+
return /*#__PURE__*/React.createElement(Overlay, {
|
224
|
+
returnFocusRef: inputRef,
|
225
|
+
preventFocusOnOpen: true,
|
226
|
+
onClickOutside: closeOptionList,
|
227
|
+
onEscape: closeOptionList,
|
228
|
+
ref: combinedOverlayRef,
|
229
|
+
top: position === null || position === void 0 ? void 0 : position.top,
|
230
|
+
left: position === null || position === void 0 ? void 0 : position.left,
|
231
|
+
width: width,
|
232
|
+
height: height,
|
233
|
+
maxHeight: maxHeight,
|
234
|
+
visibility: showMenu ? 'visible' : 'hidden'
|
235
|
+
}, loading ? /*#__PURE__*/React.createElement(Box, {
|
236
|
+
p: 3,
|
237
|
+
display: "flex",
|
238
|
+
justifyContent: "center"
|
239
|
+
}, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement("div", {
|
240
|
+
ref: listContainerRef
|
241
|
+
}, allItemsToRender.length ? /*#__PURE__*/React.createElement(ActionList, {
|
242
|
+
selectionVariant: "multiple" // TODO: get rid of typecast
|
243
|
+
// COLEHELP
|
244
|
+
,
|
245
|
+
items: allItemsToRender,
|
246
|
+
role: "listbox"
|
247
|
+
}) : /*#__PURE__*/React.createElement(Box, {
|
248
|
+
p: 3
|
249
|
+
}, emptyStateText)));
|
250
|
+
}
|
251
|
+
|
252
|
+
AutocompleteMenu.displayName = "AutocompleteMenu";
|
253
|
+
AutocompleteMenu.defaultProps = {
|
254
|
+
emptyStateText: 'No selectable options',
|
255
|
+
selectionVariant: 'single'
|
256
|
+
};
|
257
|
+
AutocompleteMenu.displayName = 'AutocompleteMenu';
|
258
|
+
export default AutocompleteMenu;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Autocomplete';
|
package/lib-esm/Avatar.d.ts
CHANGED
@@ -6,10 +6,6 @@ declare const Avatar: import("styled-components").StyledComponent<"img", any, {
|
|
6
6
|
size?: number | undefined;
|
7
7
|
/** Sets the shape of the avatar to a square if true. If false, the avatar will be circular. */
|
8
8
|
square?: boolean | undefined;
|
9
|
-
/** URL of the avatar image. */
|
10
|
-
src: string;
|
11
|
-
/** Provide alt text when the Avatar is used without the user's name next to it. */
|
12
|
-
alt?: string | undefined;
|
13
9
|
} & SystemCommonProps & SxProp, never>;
|
14
10
|
export declare type AvatarProps = ComponentProps<typeof Avatar>;
|
15
11
|
export default Avatar;
|
package/lib-esm/AvatarPair.js
CHANGED
package/lib-esm/AvatarStack.d.ts
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SystemCommonProps } from './constants';
|
2
3
|
import { SxProp } from './sx';
|
4
|
+
import { ComponentProps } from './utils/types';
|
5
|
+
declare const AvatarStackWrapper: import("styled-components").StyledComponent<"span", any, {
|
6
|
+
count?: number | undefined;
|
7
|
+
} & SystemCommonProps & SxProp, never>;
|
3
8
|
export declare type AvatarStackProps = {
|
4
9
|
alignRight?: boolean;
|
5
|
-
|
6
|
-
}
|
7
|
-
declare const AvatarStack: ({ children, alignRight, sx: sxProp }: AvatarStackProps) => JSX.Element;
|
10
|
+
} & ComponentProps<typeof AvatarStackWrapper>;
|
11
|
+
declare const AvatarStack: ({ children, alignRight, ...rest }: AvatarStackProps) => JSX.Element;
|
8
12
|
export default AvatarStack;
|
package/lib-esm/AvatarStack.js
CHANGED
@@ -1,13 +1,15 @@
|
|
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
|
+
|
1
3
|
import classnames from 'classnames';
|
2
4
|
import React from 'react';
|
3
5
|
import styled from 'styled-components';
|
4
|
-
import { get } from './constants';
|
6
|
+
import { COMMON, get } from './constants';
|
5
7
|
import { Box } from '.';
|
6
8
|
import sx from './sx';
|
7
9
|
const AvatarStackWrapper = styled.span.withConfig({
|
8
10
|
displayName: "AvatarStack__AvatarStackWrapper",
|
9
11
|
componentId: "sc-1qgzd2v-0"
|
10
|
-
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", ";"], props => props.count === 1 ? '20px' : props.count === 2 ? '30px' : '38px', get('colors.canvas
|
12
|
+
})(["display:flex;position:relative;height:20px;min-width:", ";.pc-AvatarItem{flex-shrink:0;height:20px;width:20px;box-shadow:0 0 0 1px ", ";margin-left:-11px;position:relative;overflow:hidden;transition:margin 0.2s ease-in-out,opacity 0.2s ease-in-out,visibility 0.2s ease-in-out,box-shadow 0.1s ease-in-out;&:first-child{margin-left:0;}&:nth-child(n + 4){display:none;}}&.pc-AvatarStack--two{min-width:30px;.pc-AvatarItem{&:nth-child(n + 3){display:none;}}}&.pc-AvatarStack--three-plus{min-width:38px;.pc-AvatarItem{&:nth-child(3){opacity:", "%;margin-left:-17px;}&:nth-child(4){opacity:", "%;margin-left:-17px;}&:nth-child(5){opacity:", "%;margin-left:-17px;}&:nth-child(n + 4){display:block;}&:nth-child(n + 6){opacity:0;visibility:hidden;}}}&.pc-AvatarStack--right{justify-content:flex-end;.pc-AvatarItem{margin-left:0 !important;margin-right:-11px;&:first-child{margin-right:0;}}.pc-AvatarStackBody{flex-direction:row-reverse;&:hover{.pc-AvatarItem{margin-right:", "!important;margin-left:0 !important;&:first-child{margin-right:0 !important;}}}}}&.pc-AvatarStack--three-plus.pc-AvatarStack--right{.pc-AvatarItem{&:nth-child(3){margin-right:-17px;}&:nth-child(4){margin-right:-17px;}&:nth-child(5){margin-right:-17px;}}}.pc-AvatarStackBody:hover{width:auto;.pc-AvatarItem{margin-left:", ";opacity:100%;visibility:visible;box-shadow:0 0 0 4px ", ";&:first-child{margin-left:0;}}}", " ", ";"], props => props.count === 1 ? '20px' : props.count === 2 ? '30px' : '38px', get('colors.bg.canvas'), 100 - 3 * 15, 100 - 4 * 15, 100 - 5 * 15, get('space.1'), get('space.1'), get('colors.bg.canvas'), COMMON, sx);
|
11
13
|
|
12
14
|
const transformChildren = children => {
|
13
15
|
return React.Children.map(children, (child, index) => {
|
@@ -25,7 +27,7 @@ const transformChildren = children => {
|
|
25
27
|
const AvatarStack = ({
|
26
28
|
children,
|
27
29
|
alignRight,
|
28
|
-
|
30
|
+
...rest
|
29
31
|
}) => {
|
30
32
|
const count = React.Children.count(children);
|
31
33
|
const wrapperClassNames = classnames({
|
@@ -33,11 +35,10 @@ const AvatarStack = ({
|
|
33
35
|
'pc-AvatarStack--three-plus': count > 2,
|
34
36
|
'pc-AvatarStack--right': alignRight
|
35
37
|
});
|
36
|
-
return /*#__PURE__*/React.createElement(AvatarStackWrapper, {
|
38
|
+
return /*#__PURE__*/React.createElement(AvatarStackWrapper, _extends({
|
37
39
|
count: count,
|
38
|
-
className: wrapperClassNames
|
39
|
-
|
40
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
40
|
+
className: wrapperClassNames
|
41
|
+
}, rest), /*#__PURE__*/React.createElement(Box, {
|
41
42
|
position: "absolute",
|
42
43
|
display: "flex",
|
43
44
|
width: "38px",
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { BadgeSizeKeys } from './_badgeStyleUtils';
|
2
|
+
declare type BadgeColorOptions = 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger';
|
3
|
+
interface Props {
|
4
|
+
color?: BadgeColorOptions;
|
5
|
+
variant?: BadgeSizeKeys;
|
6
|
+
}
|
7
|
+
declare const Badge: import("styled-components").StyledComponent<"span", any, Props, never>;
|
8
|
+
export default Badge;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { get } from '../constants';
|
3
|
+
import { badgeVariants } from './_badgeStyleUtils';
|
4
|
+
const badgeColorMap = {
|
5
|
+
default: {
|
6
|
+
borderColor: get('colors.border.default')
|
7
|
+
},
|
8
|
+
primary: {
|
9
|
+
borderColor: get('colors.fg.default')
|
10
|
+
},
|
11
|
+
secondary: {
|
12
|
+
borderColor: get('colors.border.muted'),
|
13
|
+
textColor: get('colors.fg.muted')
|
14
|
+
},
|
15
|
+
info: {
|
16
|
+
borderColor: get('colors.accent.fg'),
|
17
|
+
textColor: get('colors.accent.fg')
|
18
|
+
},
|
19
|
+
success: {
|
20
|
+
borderColor: get('colors.success.fg'),
|
21
|
+
textColor: get('colors.success.emphasis')
|
22
|
+
},
|
23
|
+
warning: {
|
24
|
+
borderColor: get('colors.attention.fg'),
|
25
|
+
textColor: get('colors.attention.emphasis')
|
26
|
+
},
|
27
|
+
danger: {
|
28
|
+
borderColor: get('colors.danger.fg'),
|
29
|
+
textColor: get('colors.danger.emphasis')
|
30
|
+
}
|
31
|
+
};
|
32
|
+
const Badge = styled.span.withConfig({
|
33
|
+
displayName: "Badge",
|
34
|
+
componentId: "sc-15t9m5z-0"
|
35
|
+
})(["align-items:center;background-color:transparent;border-width:1px;border-radius:999px;border-style:solid;border-color:", ";color:", ";display:inline-flex;font-weight:", ";line-height:1;white-space:nowrap;", ";"], ({
|
36
|
+
color = 'default'
|
37
|
+
}) => badgeColorMap[color].borderColor, ({
|
38
|
+
color = 'default'
|
39
|
+
}) => badgeColorMap[color].textColor, get('fontWeights.bold'), badgeVariants);
|
40
|
+
Badge.defaultProps = {
|
41
|
+
variant: 'sm',
|
42
|
+
color: 'default'
|
43
|
+
};
|
44
|
+
export default Badge;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { IconProps } from '@primer/octicons-react';
|
3
|
+
import { BadgeSizeKeys } from './_badgeStyleUtils';
|
4
|
+
declare type BadgeStateColorOptions = 'default' | 'open' | 'merged' | 'closed';
|
5
|
+
interface Props {
|
6
|
+
color?: BadgeStateColorOptions;
|
7
|
+
icon?: React.ComponentType<{
|
8
|
+
size?: IconProps['size'];
|
9
|
+
}>;
|
10
|
+
variant?: BadgeSizeKeys;
|
11
|
+
}
|
12
|
+
declare const BadgeState: React.FC<Props>;
|
13
|
+
export default BadgeState;
|
@@ -0,0 +1,40 @@
|
|
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 styled from 'styled-components';
|
4
|
+
import { get } from '../constants';
|
5
|
+
import { badgeVariants } from './_badgeStyleUtils'; // TODO: consider making these a little less specific by using:
|
6
|
+
// 'default' | 'success' | 'done' | 'danger'
|
7
|
+
|
8
|
+
const badgeStateColorMap = {
|
9
|
+
default: get('colors.neutral.emphasis'),
|
10
|
+
open: get('colors.success.emphasis'),
|
11
|
+
merged: get('colors.done.emphasis'),
|
12
|
+
closed: get('colors.danger.emphasis')
|
13
|
+
}; // const badgeStateIconSizeMap: Record<BadgeSizeKeys, number> = {
|
14
|
+
// 'sm':
|
15
|
+
// };
|
16
|
+
|
17
|
+
const StyledBadgeState = styled.span.withConfig({
|
18
|
+
displayName: "BadgeState__StyledBadgeState",
|
19
|
+
componentId: "sc-5hwzjt-0"
|
20
|
+
})(["align-items:center;background-color:", ";border-radius:999px;color:", ";display:inline-flex;font-weight:", ";gap:", ";line-height:1;white-space:nowrap;", ";"], ({
|
21
|
+
color = 'default'
|
22
|
+
}) => badgeStateColorMap[color], get('colors.fg.onEmphasis'), get('fontWeights.bold'), get('space.1'), badgeVariants);
|
23
|
+
|
24
|
+
const BadgeState = ({
|
25
|
+
children,
|
26
|
+
icon: IconComponent,
|
27
|
+
variant,
|
28
|
+
...rest
|
29
|
+
}) => /*#__PURE__*/React.createElement(StyledBadgeState, _extends({
|
30
|
+
variant: variant
|
31
|
+
}, rest), IconComponent ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconComponent, {
|
32
|
+
size: variant === 'sm' ? 12 : 'small'
|
33
|
+
}), children) : children);
|
34
|
+
|
35
|
+
BadgeState.displayName = "BadgeState";
|
36
|
+
BadgeState.defaultProps = {
|
37
|
+
variant: 'lg',
|
38
|
+
color: 'default'
|
39
|
+
};
|
40
|
+
export default BadgeState;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { variant } from 'styled-system';
|
2
|
+
// TODO: consider moving to Primitives
|
3
|
+
export const badgeSizes = {
|
4
|
+
sm: 20,
|
5
|
+
md: 24,
|
6
|
+
lg: 32
|
7
|
+
};
|
8
|
+
export const badgeVariants = variant({
|
9
|
+
variants: {
|
10
|
+
sm: {
|
11
|
+
fontSize: 0,
|
12
|
+
height: `${badgeSizes.sm}px`,
|
13
|
+
paddingLeft: 2,
|
14
|
+
paddingRight: 2
|
15
|
+
},
|
16
|
+
md: {
|
17
|
+
fontSize: 0,
|
18
|
+
height: `${badgeSizes.md}px`,
|
19
|
+
paddingLeft: 2,
|
20
|
+
paddingRight: 2
|
21
|
+
},
|
22
|
+
lg: {
|
23
|
+
fontSize: 1,
|
24
|
+
height: `${badgeSizes.lg}px`,
|
25
|
+
paddingLeft: 3,
|
26
|
+
paddingRight: 3
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
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.
|
7
|
+
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.branchName.text'), get('colors.branchName.bg'), get('radii.2'), COMMON, sx);
|
8
8
|
export default BranchName;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import * as History from 'history';
|
2
|
+
import React from 'react';
|
3
|
+
import { SystemCommonProps, SystemFlexProps } from './constants';
|
4
|
+
import { SxProp } from './sx';
|
5
|
+
import { ComponentProps } from './utils/types';
|
6
|
+
declare const BreadcrumbBase: import("styled-components").StyledComponent<"nav", any, SystemFlexProps & SystemCommonProps & SxProp, never>;
|
7
|
+
export declare type BreadcrumbProps = ComponentProps<typeof BreadcrumbBase>;
|
8
|
+
declare function Breadcrumb({ className, children, theme, ...rest }: React.PropsWithChildren<BreadcrumbProps>): JSX.Element;
|
9
|
+
declare namespace Breadcrumb {
|
10
|
+
var displayName: string;
|
11
|
+
}
|
12
|
+
declare const BreadcrumbItem: import("styled-components").StyledComponent<"a", any, {
|
13
|
+
to?: History.LocationDescriptor<unknown> | undefined;
|
14
|
+
selected?: boolean | undefined;
|
15
|
+
} & SystemCommonProps & SxProp, never>;
|
16
|
+
export declare type BreadcrumbItemProps = ComponentProps<typeof BreadcrumbItem>;
|
17
|
+
declare const _default: typeof Breadcrumb & {
|
18
|
+
Item: import("styled-components").StyledComponent<"a", any, {
|
19
|
+
to?: History.LocationDescriptor<unknown> | undefined;
|
20
|
+
selected?: boolean | undefined;
|
21
|
+
} & SystemCommonProps & SxProp, never>;
|
22
|
+
};
|
23
|
+
export default _default;
|
@@ -9,26 +9,27 @@ import { COMMON, FLEX, get } from './constants';
|
|
9
9
|
import sx from './sx';
|
10
10
|
const SELECTED_CLASS = 'selected';
|
11
11
|
const Wrapper = styled.li.withConfig({
|
12
|
-
displayName: "
|
13
|
-
componentId: "
|
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.
|
15
|
-
const
|
16
|
-
displayName: "
|
17
|
-
componentId: "
|
12
|
+
displayName: "Breadcrumb__Wrapper",
|
13
|
+
componentId: "c1r3ff-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.text.disabled'), get('fontSizes.1'));
|
15
|
+
const BreadcrumbBase = styled.nav.withConfig({
|
16
|
+
displayName: "Breadcrumb__BreadcrumbBase",
|
17
|
+
componentId: "c1r3ff-1"
|
18
18
|
})(["display:flex;justify-content:space-between;", ";", ";", ";"], COMMON, FLEX, sx);
|
19
19
|
|
20
|
-
function
|
20
|
+
function Breadcrumb({
|
21
21
|
className,
|
22
22
|
children,
|
23
23
|
theme,
|
24
24
|
...rest
|
25
25
|
}) {
|
26
|
+
const classes = classnames(className, 'Breadcrumb');
|
26
27
|
const wrappedChildren = React.Children.map(children, child => /*#__PURE__*/React.createElement(Wrapper, {
|
27
28
|
theme: theme
|
28
29
|
}, child));
|
29
|
-
return /*#__PURE__*/React.createElement(
|
30
|
-
className:
|
31
|
-
"aria-label": "
|
30
|
+
return /*#__PURE__*/React.createElement(BreadcrumbBase, _extends({
|
31
|
+
className: classes,
|
32
|
+
"aria-label": "breadcrumb",
|
32
33
|
theme: theme
|
33
34
|
}, rest), /*#__PURE__*/React.createElement(Box, {
|
34
35
|
as: "ol",
|
@@ -37,27 +38,17 @@ function Breadcrumbs({
|
|
37
38
|
}, wrappedChildren));
|
38
39
|
}
|
39
40
|
|
40
|
-
|
41
|
-
const
|
41
|
+
Breadcrumb.displayName = "Breadcrumb";
|
42
|
+
const BreadcrumbItem = styled.a.attrs(props => ({
|
42
43
|
activeClassName: typeof props.to === 'string' ? 'selected' : '',
|
43
44
|
className: classnames(props.selected && SELECTED_CLASS, props.className),
|
44
45
|
'aria-current': props.selected ? 'page' : null
|
45
46
|
})).withConfig({
|
46
|
-
displayName: "
|
47
|
-
componentId: "
|
48
|
-
})(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", " ", ";"], get('colors.
|
49
|
-
|
50
|
-
|
51
|
-
export default Object.assign(
|
52
|
-
Item:
|
53
|
-
});
|
54
|
-
/**
|
55
|
-
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
56
|
-
*/
|
57
|
-
|
58
|
-
export const Breadcrumb = Object.assign(Breadcrumbs, {
|
59
|
-
Item: BreadcrumbsItem
|
60
|
-
});
|
61
|
-
/**
|
62
|
-
* @deprecated Use the `BreadcrumbsProps` type instead
|
63
|
-
*/
|
47
|
+
displayName: "Breadcrumb__BreadcrumbItem",
|
48
|
+
componentId: "c1r3ff-2"
|
49
|
+
})(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", " ", ";"], get('colors.text.link'), get('fontSizes.1'), get('colors.text.primary'), COMMON, sx);
|
50
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
51
|
+
BreadcrumbItem.displayName = 'Breadcrumb.Item';
|
52
|
+
export default Object.assign(Breadcrumb, {
|
53
|
+
Item: BreadcrumbItem
|
54
|
+
});
|
@@ -268,6 +268,7 @@ declare const Button: import("styled-components").StyledComponent<"button", any,
|
|
268
268
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
|
+
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
271
272
|
autoFocus?: boolean | undefined;
|
272
273
|
disabled?: boolean | undefined;
|
273
274
|
formAction?: string | undefined;
|
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.
|
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.text.disabled'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
|
9
9
|
export default Button;
|