@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,284 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _ActionList = require("../ActionList");
|
11
|
+
|
12
|
+
var _hooks = require("../hooks");
|
13
|
+
|
14
|
+
var _useFocusZone = require("../hooks/useFocusZone");
|
15
|
+
|
16
|
+
var _Overlay = _interopRequireDefault(require("../Overlay"));
|
17
|
+
|
18
|
+
var _ = require("../");
|
19
|
+
|
20
|
+
var _Portal = require("../Portal");
|
21
|
+
|
22
|
+
var _AutocompleteContext = require("./AutocompleteContext");
|
23
|
+
|
24
|
+
var _useCombinedRefs = require("../hooks/useCombinedRefs");
|
25
|
+
|
26
|
+
var _octiconsReact = require("@primer/octicons-react");
|
27
|
+
|
28
|
+
var _uniqueId = require("../utils/uniqueId");
|
29
|
+
|
30
|
+
var _scrollIntoViewingArea = require("../utils/scrollIntoViewingArea");
|
31
|
+
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
|
+
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
35
|
+
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
37
|
+
|
38
|
+
const DROPDOWN_PORTAL_CONTAINER_NAME = '__listcontainerportal__';
|
39
|
+
|
40
|
+
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
41
|
+
|
42
|
+
function getDefaultItemFilter(filterValue) {
|
43
|
+
return function (item, _i) {
|
44
|
+
var _item$text;
|
45
|
+
|
46
|
+
return Boolean((_item$text = item.text) === null || _item$text === void 0 ? void 0 : _item$text.toLowerCase().startsWith(filterValue.toLowerCase()));
|
47
|
+
};
|
48
|
+
} // TODO: DRY this out - it's also in FilteredActionList
|
49
|
+
|
50
|
+
|
51
|
+
function scrollIntoViewingAreaTwo(child, container, margin = 8, behavior = 'smooth') {
|
52
|
+
const {
|
53
|
+
top: childTop,
|
54
|
+
bottom: childBottom
|
55
|
+
} = child.getBoundingClientRect();
|
56
|
+
const {
|
57
|
+
top: containerTop,
|
58
|
+
bottom: containerBottom
|
59
|
+
} = container.getBoundingClientRect();
|
60
|
+
const isChildTopAboveViewingArea = childTop < containerTop + margin;
|
61
|
+
const isChildBottomBelowViewingArea = childBottom > containerBottom - margin;
|
62
|
+
|
63
|
+
if (isChildTopAboveViewingArea) {
|
64
|
+
const scrollHeightToChildTop = childTop - containerTop + container.scrollTop;
|
65
|
+
container.scrollTo({
|
66
|
+
behavior,
|
67
|
+
top: scrollHeightToChildTop - margin
|
68
|
+
});
|
69
|
+
} else if (isChildBottomBelowViewingArea) {
|
70
|
+
const scrollHeightToChildBottom = childBottom - containerBottom + container.scrollTop;
|
71
|
+
container.scrollTo({
|
72
|
+
behavior,
|
73
|
+
top: scrollHeightToChildBottom + margin
|
74
|
+
});
|
75
|
+
} // either completely in view or outside viewing area on both ends, don't scroll
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
function getDefaultOnItemSelectFn(setInputValueFn) {
|
80
|
+
if (setInputValueFn) {
|
81
|
+
return function ({
|
82
|
+
text = ''
|
83
|
+
}) {
|
84
|
+
setInputValueFn(text);
|
85
|
+
};
|
86
|
+
}
|
87
|
+
|
88
|
+
return ({
|
89
|
+
text
|
90
|
+
}) => {
|
91
|
+
console.error(`getDefaultOnItemSelectFn could not be called with ${text} because a function to set the text input was undefined`);
|
92
|
+
};
|
93
|
+
}
|
94
|
+
|
95
|
+
function AutocompleteMenu(props) {
|
96
|
+
const {
|
97
|
+
activeDescendantRef,
|
98
|
+
inputRef,
|
99
|
+
inputValue = '',
|
100
|
+
setAutocompleteSuggestion,
|
101
|
+
setShowMenu,
|
102
|
+
setInputValue,
|
103
|
+
setIsMenuDirectlyActivated,
|
104
|
+
showMenu
|
105
|
+
} = (0, _react.useContext)(_AutocompleteContext.AutocompleteContext);
|
106
|
+
const {
|
107
|
+
items,
|
108
|
+
selectedItemIds,
|
109
|
+
selectedSortFn,
|
110
|
+
onItemSelect = getDefaultOnItemSelectFn(setInputValue),
|
111
|
+
onItemDeselect,
|
112
|
+
emptyStateText,
|
113
|
+
addNewItem,
|
114
|
+
loading,
|
115
|
+
selectionVariant,
|
116
|
+
filterFn = getDefaultItemFilter(inputValue),
|
117
|
+
width,
|
118
|
+
height,
|
119
|
+
maxHeight,
|
120
|
+
menuAnchorRef
|
121
|
+
} = props;
|
122
|
+
const listContainerRef = (0, _react.useRef)(null);
|
123
|
+
const scrollContainerRef = (0, _react.useRef)(null);
|
124
|
+
const [highlightedItem, setHighlightedItem] = (0, _react.useState)();
|
125
|
+
const [sortedItemIds, setSortedItemIds] = (0, _react.useState)(items.map(({
|
126
|
+
id
|
127
|
+
}) => id));
|
128
|
+
const {
|
129
|
+
floatingElementRef,
|
130
|
+
position
|
131
|
+
} = (0, _hooks.useAnchoredPosition)({
|
132
|
+
side: 'outside-bottom',
|
133
|
+
align: 'start',
|
134
|
+
anchorElementRef: menuAnchorRef ? menuAnchorRef : inputRef
|
135
|
+
}, [showMenu, selectedItemIds]);
|
136
|
+
const combinedOverlayRef = (0, _useCombinedRefs.useCombinedRefs)(scrollContainerRef, floatingElementRef);
|
137
|
+
|
138
|
+
const closeOptionList = () => {
|
139
|
+
if (setShowMenu) {
|
140
|
+
setShowMenu(false);
|
141
|
+
}
|
142
|
+
};
|
143
|
+
|
144
|
+
const isItemSelected = itemId => selectedItemIds.includes(itemId);
|
145
|
+
|
146
|
+
const selectableItems = [// selectable tokens
|
147
|
+
...items.map(selectableItem => {
|
148
|
+
return { ...selectableItem,
|
149
|
+
id: selectableItem.id,
|
150
|
+
selected: selectionVariant === 'multiple' ? isItemSelected(selectableItem.id) : undefined,
|
151
|
+
onAction: (item, e) => {
|
152
|
+
const handleItemSelection = () => {
|
153
|
+
onItemSelect(item, e);
|
154
|
+
|
155
|
+
if (selectionVariant === 'multiple') {
|
156
|
+
setInputValue && setInputValue('');
|
157
|
+
setAutocompleteSuggestion && setAutocompleteSuggestion('');
|
158
|
+
}
|
159
|
+
};
|
160
|
+
|
161
|
+
if (item.selected) {
|
162
|
+
onItemDeselect && onItemDeselect(item, e);
|
163
|
+
} else {
|
164
|
+
handleItemSelection();
|
165
|
+
}
|
166
|
+
|
167
|
+
if (selectionVariant === 'single') {
|
168
|
+
var _inputRef$current;
|
169
|
+
|
170
|
+
setShowMenu && setShowMenu(false);
|
171
|
+
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);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
};
|
175
|
+
})];
|
176
|
+
(0, _useFocusZone.useFocusZone)({
|
177
|
+
containerRef: listContainerRef,
|
178
|
+
focusOutBehavior: 'wrap',
|
179
|
+
focusableElementFilter: element => {
|
180
|
+
return !(element instanceof HTMLInputElement);
|
181
|
+
},
|
182
|
+
activeDescendantFocus: inputRef,
|
183
|
+
onActiveDescendantChanged: (current, _previous, directlyActivated) => {
|
184
|
+
if (activeDescendantRef) {
|
185
|
+
activeDescendantRef.current = current || null;
|
186
|
+
}
|
187
|
+
|
188
|
+
if (current) {
|
189
|
+
const selectedItem = selectableItems.find(item => item.id.toString() === (current === null || current === void 0 ? void 0 : current.dataset.id));
|
190
|
+
setHighlightedItem(selectedItem);
|
191
|
+
|
192
|
+
if (setIsMenuDirectlyActivated) {
|
193
|
+
setIsMenuDirectlyActivated(directlyActivated);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
if (current && scrollContainerRef.current && directlyActivated) {
|
198
|
+
(0, _scrollIntoViewingArea.scrollIntoViewingArea)(current, scrollContainerRef.current);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
});
|
202
|
+
(0, _react.useEffect)(() => {
|
203
|
+
var _highlightedItem$text;
|
204
|
+
|
205
|
+
if (!setAutocompleteSuggestion) {
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
209
|
+
if (highlightedItem !== null && highlightedItem !== void 0 && (_highlightedItem$text = highlightedItem.text) !== null && _highlightedItem$text !== void 0 && _highlightedItem$text.startsWith(inputValue)) {
|
210
|
+
setAutocompleteSuggestion(highlightedItem.text);
|
211
|
+
} else {
|
212
|
+
setAutocompleteSuggestion('');
|
213
|
+
}
|
214
|
+
}, [highlightedItem, inputValue]);
|
215
|
+
(0, _react.useEffect)(() => {
|
216
|
+
setSortedItemIds([...sortedItemIds].sort(selectedSortFn ? selectedSortFn : getDefaultSortFn(isItemSelected)));
|
217
|
+
}, [showMenu]);
|
218
|
+
|
219
|
+
if (listContainerRef.current) {
|
220
|
+
(0, _Portal.registerPortalRoot)(listContainerRef.current, DROPDOWN_PORTAL_CONTAINER_NAME);
|
221
|
+
}
|
222
|
+
|
223
|
+
const itemSortOrderData = sortedItemIds.reduce((acc, curr, i) => {
|
224
|
+
acc[curr] = i;
|
225
|
+
return acc;
|
226
|
+
}, {});
|
227
|
+
const sortedAndFilteredItemsToRender = selectableItems.filter( // TODO: get rid of typecast
|
228
|
+
// 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">'`
|
229
|
+
// COLEHELP
|
230
|
+
(item, i) => filterFn(item, i)).sort((a, b) => itemSortOrderData[a.id] - itemSortOrderData[b.id]);
|
231
|
+
const allItemsToRender = [// sorted and filtered selectable items
|
232
|
+
...sortedAndFilteredItemsToRender, // menu item used for creating a token from whatever is in the text input
|
233
|
+
...(addNewItem ? [{ ...addNewItem,
|
234
|
+
leadingVisual: () => /*#__PURE__*/_react.default.createElement(_octiconsReact.PlusIcon, null),
|
235
|
+
onAction: (item, e) => {
|
236
|
+
// TODO: clean up this hacky-ness
|
237
|
+
addNewItem.handleAddItem({ ...item,
|
238
|
+
id: item.id || (0, _uniqueId.uniqueId)(),
|
239
|
+
leadingVisual: undefined
|
240
|
+
});
|
241
|
+
|
242
|
+
if (selectionVariant === 'multiple') {
|
243
|
+
setInputValue && setInputValue('');
|
244
|
+
setAutocompleteSuggestion && setAutocompleteSuggestion('');
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}] : [])];
|
248
|
+
return /*#__PURE__*/_react.default.createElement(_Overlay.default, {
|
249
|
+
returnFocusRef: inputRef,
|
250
|
+
preventFocusOnOpen: true,
|
251
|
+
onClickOutside: closeOptionList,
|
252
|
+
onEscape: closeOptionList,
|
253
|
+
ref: combinedOverlayRef,
|
254
|
+
top: position === null || position === void 0 ? void 0 : position.top,
|
255
|
+
left: position === null || position === void 0 ? void 0 : position.left,
|
256
|
+
width: width,
|
257
|
+
height: height,
|
258
|
+
maxHeight: maxHeight,
|
259
|
+
visibility: showMenu ? 'visible' : 'hidden'
|
260
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_.Box, {
|
261
|
+
p: 3,
|
262
|
+
display: "flex",
|
263
|
+
justifyContent: "center"
|
264
|
+
}, /*#__PURE__*/_react.default.createElement(_.Spinner, null)) : /*#__PURE__*/_react.default.createElement("div", {
|
265
|
+
ref: listContainerRef
|
266
|
+
}, allItemsToRender.length ? /*#__PURE__*/_react.default.createElement(_ActionList.ActionList, {
|
267
|
+
selectionVariant: "multiple" // TODO: get rid of typecast
|
268
|
+
// COLEHELP
|
269
|
+
,
|
270
|
+
items: allItemsToRender,
|
271
|
+
role: "listbox"
|
272
|
+
}) : /*#__PURE__*/_react.default.createElement(_.Box, {
|
273
|
+
p: 3
|
274
|
+
}, emptyStateText)));
|
275
|
+
}
|
276
|
+
|
277
|
+
AutocompleteMenu.displayName = "AutocompleteMenu";
|
278
|
+
AutocompleteMenu.defaultProps = {
|
279
|
+
emptyStateText: 'No selectable options',
|
280
|
+
selectionVariant: 'single'
|
281
|
+
};
|
282
|
+
AutocompleteMenu.displayName = 'AutocompleteMenu';
|
283
|
+
var _default = AutocompleteMenu;
|
284
|
+
exports.default = _default;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "default", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _Autocomplete.default;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
14
|
+
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/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/AvatarPair.js
CHANGED
@@ -33,7 +33,7 @@ const AvatarPair = ({
|
|
33
33
|
return i === 0 ? /*#__PURE__*/_react.default.cloneElement(child, {
|
34
34
|
size: 40
|
35
35
|
}) : /*#__PURE__*/_react.default.createElement(ChildAvatar, _extends({
|
36
|
-
bg: "canvas
|
36
|
+
bg: "bg.canvas"
|
37
37
|
}, child.props, {
|
38
38
|
size: 20
|
39
39
|
}));
|
package/lib/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/AvatarStack.js
CHANGED
@@ -19,10 +19,12 @@ var _sx = _interopRequireDefault(require("./sx"));
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
+
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); }
|
23
|
+
|
22
24
|
const AvatarStackWrapper = _styledComponents.default.span.withConfig({
|
23
25
|
displayName: "AvatarStack__AvatarStackWrapper",
|
24
26
|
componentId: "sc-1qgzd2v-0"
|
25
|
-
})(["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', (0, _constants.get)('colors.canvas
|
27
|
+
})(["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', (0, _constants.get)('colors.bg.canvas'), 100 - 3 * 15, 100 - 4 * 15, 100 - 5 * 15, (0, _constants.get)('space.1'), (0, _constants.get)('space.1'), (0, _constants.get)('colors.bg.canvas'), _constants.COMMON, _sx.default);
|
26
28
|
|
27
29
|
const transformChildren = children => {
|
28
30
|
return _react.default.Children.map(children, (child, index) => {
|
@@ -40,7 +42,7 @@ const transformChildren = children => {
|
|
40
42
|
const AvatarStack = ({
|
41
43
|
children,
|
42
44
|
alignRight,
|
43
|
-
|
45
|
+
...rest
|
44
46
|
}) => {
|
45
47
|
const count = _react.default.Children.count(children);
|
46
48
|
|
@@ -49,11 +51,10 @@ const AvatarStack = ({
|
|
49
51
|
'pc-AvatarStack--three-plus': count > 2,
|
50
52
|
'pc-AvatarStack--right': alignRight
|
51
53
|
});
|
52
|
-
return /*#__PURE__*/_react.default.createElement(AvatarStackWrapper, {
|
54
|
+
return /*#__PURE__*/_react.default.createElement(AvatarStackWrapper, _extends({
|
53
55
|
count: count,
|
54
|
-
className: wrapperClassNames
|
55
|
-
|
56
|
-
}, /*#__PURE__*/_react.default.createElement(_.Box, {
|
56
|
+
className: wrapperClassNames
|
57
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_.Box, {
|
57
58
|
position: "absolute",
|
58
59
|
display: "flex",
|
59
60
|
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,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
|
+
|
10
|
+
var _constants = require("../constants");
|
11
|
+
|
12
|
+
var _badgeStyleUtils = require("./_badgeStyleUtils");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
const badgeColorMap = {
|
17
|
+
default: {
|
18
|
+
borderColor: (0, _constants.get)('colors.border.default')
|
19
|
+
},
|
20
|
+
primary: {
|
21
|
+
borderColor: (0, _constants.get)('colors.fg.default')
|
22
|
+
},
|
23
|
+
secondary: {
|
24
|
+
borderColor: (0, _constants.get)('colors.border.muted'),
|
25
|
+
textColor: (0, _constants.get)('colors.fg.muted')
|
26
|
+
},
|
27
|
+
info: {
|
28
|
+
borderColor: (0, _constants.get)('colors.accent.fg'),
|
29
|
+
textColor: (0, _constants.get)('colors.accent.fg')
|
30
|
+
},
|
31
|
+
success: {
|
32
|
+
borderColor: (0, _constants.get)('colors.success.fg'),
|
33
|
+
textColor: (0, _constants.get)('colors.success.emphasis')
|
34
|
+
},
|
35
|
+
warning: {
|
36
|
+
borderColor: (0, _constants.get)('colors.attention.fg'),
|
37
|
+
textColor: (0, _constants.get)('colors.attention.emphasis')
|
38
|
+
},
|
39
|
+
danger: {
|
40
|
+
borderColor: (0, _constants.get)('colors.danger.fg'),
|
41
|
+
textColor: (0, _constants.get)('colors.danger.emphasis')
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
45
|
+
const Badge = _styledComponents.default.span.withConfig({
|
46
|
+
displayName: "Badge",
|
47
|
+
componentId: "sc-15t9m5z-0"
|
48
|
+
})(["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;", ";"], ({
|
49
|
+
color = 'default'
|
50
|
+
}) => badgeColorMap[color].borderColor, ({
|
51
|
+
color = 'default'
|
52
|
+
}) => badgeColorMap[color].textColor, (0, _constants.get)('fontWeights.bold'), _badgeStyleUtils.badgeVariants);
|
53
|
+
|
54
|
+
Badge.defaultProps = {
|
55
|
+
variant: 'sm',
|
56
|
+
color: 'default'
|
57
|
+
};
|
58
|
+
var _default = Badge;
|
59
|
+
exports.default = _default;
|
@@ -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,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
|
+
|
10
|
+
var _constants = require("../constants");
|
11
|
+
|
12
|
+
var _badgeStyleUtils = require("./_badgeStyleUtils");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
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); }
|
17
|
+
|
18
|
+
const badgeStateColorMap = {
|
19
|
+
default: (0, _constants.get)('colors.neutral.emphasis'),
|
20
|
+
open: (0, _constants.get)('colors.success.emphasis'),
|
21
|
+
merged: (0, _constants.get)('colors.done.emphasis'),
|
22
|
+
closed: (0, _constants.get)('colors.danger.emphasis')
|
23
|
+
}; // const badgeStateIconSizeMap: Record<BadgeSizeKeys, number> = {
|
24
|
+
// 'sm':
|
25
|
+
// };
|
26
|
+
|
27
|
+
const StyledBadgeState = _styledComponents.default.span.withConfig({
|
28
|
+
displayName: "BadgeState__StyledBadgeState",
|
29
|
+
componentId: "sc-5hwzjt-0"
|
30
|
+
})(["align-items:center;background-color:", ";border-radius:999px;color:", ";display:inline-flex;font-weight:", ";gap:", ";line-height:1;white-space:nowrap;", ";"], ({
|
31
|
+
color = 'default'
|
32
|
+
}) => badgeStateColorMap[color], (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('fontWeights.bold'), (0, _constants.get)('space.1'), _badgeStyleUtils.badgeVariants);
|
33
|
+
|
34
|
+
const BadgeState = ({
|
35
|
+
children,
|
36
|
+
icon: IconComponent,
|
37
|
+
variant,
|
38
|
+
...rest
|
39
|
+
}) => /*#__PURE__*/React.createElement(StyledBadgeState, _extends({
|
40
|
+
variant: variant
|
41
|
+
}, rest), IconComponent ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconComponent, {
|
42
|
+
size: variant === 'sm' ? 12 : 'small'
|
43
|
+
}), children) : children);
|
44
|
+
|
45
|
+
BadgeState.displayName = "BadgeState";
|
46
|
+
BadgeState.defaultProps = {
|
47
|
+
variant: 'lg',
|
48
|
+
color: 'default'
|
49
|
+
};
|
50
|
+
var _default = BadgeState;
|
51
|
+
exports.default = _default;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.badgeVariants = exports.badgeSizes = void 0;
|
7
|
+
|
8
|
+
var _styledSystem = require("styled-system");
|
9
|
+
|
10
|
+
// TODO: consider moving to Primitives
|
11
|
+
const badgeSizes = {
|
12
|
+
sm: 20,
|
13
|
+
md: 24,
|
14
|
+
lg: 32
|
15
|
+
};
|
16
|
+
exports.badgeSizes = badgeSizes;
|
17
|
+
const badgeVariants = (0, _styledSystem.variant)({
|
18
|
+
variants: {
|
19
|
+
sm: {
|
20
|
+
fontSize: 0,
|
21
|
+
height: `${badgeSizes.sm}px`,
|
22
|
+
paddingLeft: 2,
|
23
|
+
paddingRight: 2
|
24
|
+
},
|
25
|
+
md: {
|
26
|
+
fontSize: 0,
|
27
|
+
height: `${badgeSizes.md}px`,
|
28
|
+
paddingLeft: 2,
|
29
|
+
paddingRight: 2
|
30
|
+
},
|
31
|
+
lg: {
|
32
|
+
fontSize: 1,
|
33
|
+
height: `${badgeSizes.lg}px`,
|
34
|
+
paddingLeft: 3,
|
35
|
+
paddingRight: 3
|
36
|
+
}
|
37
|
+
}
|
38
|
+
});
|
39
|
+
exports.badgeVariants = badgeVariants;
|
package/lib/BranchName.js
CHANGED
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
16
16
|
const BranchName = _styledComponents.default.a.withConfig({
|
17
17
|
displayName: "BranchName",
|
18
18
|
componentId: "sc-167ouzm-0"
|
19
|
-
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";", ";"], (0, _constants.get)('fontSizes.0'), (0, _constants.get)('fonts.mono'), (0, _constants.get)('colors.
|
19
|
+
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";", ";"], (0, _constants.get)('fontSizes.0'), (0, _constants.get)('fonts.mono'), (0, _constants.get)('colors.branchName.text'), (0, _constants.get)('colors.branchName.bg'), (0, _constants.get)('radii.2'), _constants.COMMON, _sx.default);
|
20
20
|
|
21
21
|
var _default = BranchName;
|
22
22
|
exports.default = _default;
|
@@ -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;
|