@primer/components 0.0.0-20211030175556 → 0.0.0-20211030182910
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 +34 -2
- package/dist/browser.esm.js +186 -183
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +190 -187
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +3 -3
- package/lib/ActionList/index.js +23 -12
- package/lib/ActionList2/Item.js +3 -1
- package/lib/ActionList2/List.js +1 -2
- package/lib/ActionList2/Selection.js +3 -1
- package/lib/ActionList2/index.js +41 -23
- package/lib/AnchoredOverlay/index.js +12 -4
- package/lib/Autocomplete/Autocomplete.d.ts +1 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +1 -0
- package/lib/Autocomplete/index.js +14 -7
- package/lib/Avatar.d.ts +1 -2
- package/lib/Avatar.js +1 -1
- package/lib/BranchName.d.ts +1 -2
- package/lib/BranchName.js +1 -1
- package/lib/Button/Button.d.ts +1 -0
- package/lib/Button/ButtonClose.d.ts +2 -1
- package/lib/Button/ButtonDanger.d.ts +1 -0
- package/lib/Button/ButtonInvisible.d.ts +1 -0
- package/lib/Button/ButtonOutline.d.ts +1 -0
- package/lib/Button/ButtonPrimary.d.ts +1 -0
- package/lib/Button/index.js +70 -21
- package/lib/Checkbox.d.ts +29 -0
- package/lib/Checkbox.js +64 -0
- package/lib/CircleOcticon.d.ts +1 -0
- package/lib/Details.d.ts +1 -2
- package/lib/Details.js +1 -3
- package/lib/Dialog.d.ts +3 -2
- package/lib/Dropdown.d.ts +6 -66
- package/lib/DropdownMenu/DropdownButton.d.ts +2 -1
- package/lib/DropdownMenu/index.js +20 -6
- package/lib/DropdownStyles.js +26 -18
- package/lib/FilterList.d.ts +1 -0
- package/lib/FilteredActionList/index.js +12 -4
- package/lib/Heading.d.ts +1 -2
- package/lib/Heading.js +1 -6
- package/lib/NewButton/index.js +12 -5
- package/lib/NewButton/types.js +1 -2
- package/lib/Overlay.d.ts +5 -3
- package/lib/Pagination/index.js +12 -6
- package/lib/Portal/index.js +16 -5
- package/lib/Position.d.ts +4 -4
- package/lib/ProgressBar.d.ts +16 -11
- package/lib/ProgressBar.js +6 -10
- package/lib/SelectMenu/SelectMenu.d.ts +10 -4
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/hooks/useKeyboardNav.js +96 -80
- package/lib/SelectMenu/index.js +14 -7
- package/lib/SelectPanel/index.js +12 -4
- package/lib/Spinner.d.ts +1 -2
- package/lib/Spinner.js +1 -3
- package/lib/TextInputWithTokens.d.ts +1 -0
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/index.js +30 -11
- package/lib/behaviors/anchoredPosition.js +234 -205
- package/lib/behaviors/focusTrap.js +157 -121
- package/lib/behaviors/focusZone.js +509 -434
- package/lib/behaviors/scrollIntoViewingArea.js +35 -18
- package/lib/constants.js +43 -39
- package/lib/drafts.js +30 -20
- package/lib/hooks/index.js +60 -16
- package/lib/hooks/useAnchoredPosition.js +40 -32
- package/lib/hooks/useCombinedRefs.js +36 -32
- package/lib/hooks/useDialog.js +96 -72
- package/lib/hooks/useFocusTrap.js +60 -43
- package/lib/hooks/useFocusZone.js +50 -54
- package/lib/hooks/useOnEscapePress.js +36 -25
- package/lib/hooks/useOpenAndCloseFocus.js +34 -22
- package/lib/hooks/useProvidedRefOrCreate.js +14 -10
- package/lib/hooks/useProvidedStateOrCreate.js +16 -13
- package/lib/hooks/useRenderForcingRef.js +17 -13
- package/lib/hooks/useResizeObserver.js +18 -15
- package/lib/hooks/useSafeTimeout.js +30 -22
- package/lib/hooks/useScrollFlash.js +23 -16
- package/lib/index.d.ts +2 -0
- package/lib/index.js +652 -163
- package/lib/polyfills/eventListenerSignal.js +45 -37
- package/lib/sx.js +22 -10
- package/lib/theme-preval.js +3169 -64
- package/lib/theme.js +12 -3
- package/lib/utils/iterateFocusableElements.js +85 -63
- package/lib/utils/testing.d.ts +2 -1
- package/lib/utils/testing.js +29 -0
- package/lib/utils/theme.js +47 -33
- package/lib/utils/types/AriaRole.js +1 -2
- package/lib/utils/types/ComponentProps.js +1 -2
- package/lib/utils/types/Flatten.js +1 -2
- package/lib/utils/types/KeyPaths.js +1 -2
- package/lib/utils/types/MandateProps.js +1 -16
- package/lib/utils/types/Merge.js +1 -2
- package/lib/utils/types/index.js +69 -16
- package/lib/utils/uniqueId.js +8 -5
- package/lib/utils/use-force-update.js +14 -8
- package/lib/utils/useIsomorphicLayoutEffect.js +11 -8
- package/lib/utils/userAgent.js +12 -8
- package/lib-esm/ActionList/Item.js +3 -3
- package/lib-esm/ActionList2/Item.js +3 -1
- package/lib-esm/ActionList2/List.js +1 -2
- package/lib-esm/ActionList2/Selection.js +3 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +1 -0
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +1 -0
- package/lib-esm/Avatar.d.ts +1 -2
- package/lib-esm/Avatar.js +2 -2
- package/lib-esm/BranchName.d.ts +1 -2
- package/lib-esm/BranchName.js +2 -2
- package/lib-esm/Button/Button.d.ts +1 -0
- package/lib-esm/Button/ButtonClose.d.ts +2 -1
- package/lib-esm/Button/ButtonDanger.d.ts +1 -0
- package/lib-esm/Button/ButtonInvisible.d.ts +1 -0
- package/lib-esm/Button/ButtonOutline.d.ts +1 -0
- package/lib-esm/Button/ButtonPrimary.d.ts +1 -0
- package/lib-esm/Checkbox.d.ts +29 -0
- package/lib-esm/Checkbox.js +44 -0
- package/lib-esm/CircleOcticon.d.ts +1 -0
- package/lib-esm/Details.d.ts +1 -2
- package/lib-esm/Details.js +1 -2
- package/lib-esm/Dialog.d.ts +3 -2
- package/lib-esm/Dropdown.d.ts +6 -66
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -1
- package/lib-esm/FilterList.d.ts +1 -0
- package/lib-esm/Heading.d.ts +1 -2
- package/lib-esm/Heading.js +2 -6
- package/lib-esm/Overlay.d.ts +5 -3
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/ProgressBar.d.ts +16 -11
- package/lib-esm/ProgressBar.js +7 -11
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -4
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/Spinner.d.ts +1 -2
- package/lib-esm/Spinner.js +1 -2
- package/lib-esm/TextInputWithTokens.d.ts +1 -0
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/theme-preval.js +446 -0
- package/lib-esm/utils/testing.d.ts +2 -1
- package/lib-esm/utils/testing.js +24 -0
- package/package.json +4 -5
- package/lib/ActionList/Divider.jsx +0 -29
- package/lib/ActionList/Group.jsx +0 -23
- package/lib/ActionList/Header.jsx +0 -66
- package/lib/ActionList/Item.jsx +0 -288
- package/lib/ActionList/List.jsx +0 -138
- package/lib/ActionList2/Description.jsx +0 -29
- package/lib/ActionList2/Divider.jsx +0 -22
- package/lib/ActionList2/Group.jsx +0 -54
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Header.jsx +0 -36
- package/lib/ActionList2/Item.jsx +0 -174
- package/lib/ActionList2/LinkItem.jsx +0 -28
- package/lib/ActionList2/List.jsx +0 -41
- package/lib/ActionList2/Selection.jsx +0 -50
- package/lib/ActionList2/Visuals.jsx +0 -48
- package/lib/ActionMenu.jsx +0 -73
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +0 -100
- package/lib/Autocomplete/Autocomplete.jsx +0 -100
- package/lib/Autocomplete/AutocompleteContext.jsx +0 -5
- package/lib/Autocomplete/AutocompleteInput.jsx +0 -113
- package/lib/Autocomplete/AutocompleteMenu.jsx +0 -190
- package/lib/Autocomplete/AutocompleteOverlay.jsx +0 -55
- package/lib/Avatar.jsx +0 -34
- package/lib/AvatarPair.jsx +0 -29
- package/lib/AvatarStack.jsx +0 -151
- package/lib/BaseStyles.jsx +0 -65
- package/lib/BorderBox.jsx +0 -18
- package/lib/Box.jsx +0 -10
- package/lib/BranchName.jsx +0 -20
- package/lib/Breadcrumbs.jsx +0 -71
- package/lib/Button/Button.jsx +0 -40
- package/lib/Button/ButtonBase.jsx +0 -33
- package/lib/Button/ButtonClose.jsx +0 -53
- package/lib/Button/ButtonDanger.jsx +0 -43
- package/lib/Button/ButtonGroup.jsx +0 -55
- package/lib/Button/ButtonInvisible.jsx +0 -32
- package/lib/Button/ButtonOutline.jsx +0 -43
- package/lib/Button/ButtonPrimary.jsx +0 -42
- package/lib/Button/ButtonStyles.jsx +0 -37
- package/lib/Button/ButtonTableList.jsx +0 -46
- package/lib/Caret.jsx +0 -93
- package/lib/CircleBadge.jsx +0 -42
- package/lib/CircleOcticon.jsx +0 -21
- package/lib/CounterLabel.jsx +0 -43
- package/lib/Details.jsx +0 -21
- package/lib/Dialog/ConfirmationDialog.jsx +0 -146
- package/lib/Dialog/Dialog.jsx +0 -279
- package/lib/Dialog.jsx +0 -129
- package/lib/Dropdown.jsx +0 -131
- package/lib/DropdownMenu/DropdownButton.jsx +0 -14
- package/lib/DropdownMenu/DropdownMenu.jsx +0 -70
- package/lib/FilterList.jsx +0 -59
- package/lib/FilteredActionList/FilteredActionList.jsx +0 -100
- package/lib/FilteredSearch.jsx +0 -28
- package/lib/Flash.jsx +0 -69
- package/lib/Flex.jsx +0 -15
- package/lib/FormGroup.jsx +0 -22
- package/lib/Grid.jsx +0 -15
- package/lib/Header.jsx +0 -83
- package/lib/Heading.jsx +0 -21
- package/lib/Label.jsx +0 -82
- package/lib/LabelGroup.jsx +0 -18
- package/lib/Link.jsx +0 -36
- package/lib/NewButton/button-counter.jsx +0 -14
- package/lib/NewButton/button.jsx +0 -279
- package/lib/Overlay.jsx +0 -154
- package/lib/Pagehead.jsx +0 -17
- package/lib/Pagination/Pagination.jsx +0 -161
- package/lib/Pagination/model.jsx +0 -174
- package/lib/PointerBox.jsx +0 -25
- package/lib/Popover.jsx +0 -202
- package/lib/Portal/Portal.jsx +0 -79
- package/lib/Position.jsx +0 -46
- package/lib/ProgressBar.jsx +0 -39
- package/lib/SelectMenu/SelectMenu.jsx +0 -112
- package/lib/SelectMenu/SelectMenuContext.jsx +0 -5
- package/lib/SelectMenu/SelectMenuDivider.jsx +0 -42
- package/lib/SelectMenu/SelectMenuFilter.jsx +0 -58
- package/lib/SelectMenu/SelectMenuFooter.jsx +0 -45
- package/lib/SelectMenu/SelectMenuHeader.jsx +0 -42
- package/lib/SelectMenu/SelectMenuItem.jsx +0 -142
- package/lib/SelectMenu/SelectMenuList.jsx +0 -59
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +0 -22
- package/lib/SelectMenu/SelectMenuModal.jsx +0 -118
- package/lib/SelectMenu/SelectMenuTab.jsx +0 -92
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +0 -42
- package/lib/SelectMenu/SelectMenuTabs.jsx +0 -57
- package/lib/SelectPanel/SelectPanel.jsx +0 -105
- package/lib/SideNav.jsx +0 -173
- package/lib/Spinner.jsx +0 -35
- package/lib/StateLabel.jsx +0 -93
- package/lib/StyledOcticon.jsx +0 -18
- package/lib/SubNav.jsx +0 -101
- package/lib/TabNav.jsx +0 -58
- package/lib/Text.jsx +0 -14
- package/lib/TextInput.jsx +0 -23
- package/lib/TextInputWithTokens.jsx +0 -218
- package/lib/ThemeProvider.jsx +0 -130
- package/lib/Timeline.jsx +0 -123
- package/lib/Token/AvatarToken.jsx +0 -54
- package/lib/Token/IssueLabelToken.jsx +0 -125
- package/lib/Token/Token.jsx +0 -103
- package/lib/Token/TokenBase.jsx +0 -88
- package/lib/Token/_RemoveTokenButton.jsx +0 -108
- package/lib/Token/_TokenTextContainer.jsx +0 -49
- package/lib/Tooltip.jsx +0 -246
- package/lib/Truncate.jsx +0 -24
- package/lib/UnderlineNav.jsx +0 -88
- package/lib/_TextInputWrapper.jsx +0 -120
- package/lib/_UnstyledTextInput.jsx +0 -22
- package/lib/hooks/useDetails.jsx +0 -39
- package/lib/hooks/useOnOutsideClick.jsx +0 -61
- package/lib/hooks/useOverlay.jsx +0 -15
- package/lib/utils/create-slots.jsx +0 -65
- package/lib/utils/deprecate.jsx +0 -59
- package/lib/utils/isNumeric.jsx +0 -7
- package/lib/utils/ssr.jsx +0 -6
- package/lib/utils/test-deprecations.jsx +0 -20
- package/lib/utils/test-helpers.jsx +0 -8
- package/lib/utils/test-matchers.jsx +0 -100
- package/lib/utils/testing.jsx +0 -206
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -44
@@ -1,161 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
8
|
-
const Box_1 = __importDefault(require("../Box"));
|
9
|
-
const constants_1 = require("../constants");
|
10
|
-
const sx_1 = __importDefault(require("../sx"));
|
11
|
-
const model_1 = require("./model");
|
12
|
-
const Page = styled_components_1.default.a `
|
13
|
-
display: inline-block;
|
14
|
-
min-width: 32px;
|
15
|
-
padding: 5px 10px;
|
16
|
-
font-style: normal;
|
17
|
-
line-height: 20px;
|
18
|
-
color: ${constants_1.get('colors.fg.default')};
|
19
|
-
text-align: center;
|
20
|
-
white-space: nowrap;
|
21
|
-
vertical-align: middle;
|
22
|
-
cursor: pointer;
|
23
|
-
user-select: none;
|
24
|
-
text-decoration: none;
|
25
|
-
|
26
|
-
margin-right: ${constants_1.get('space.1')};
|
27
|
-
|
28
|
-
&:last-child {
|
29
|
-
margin-right: 0;
|
30
|
-
}
|
31
|
-
|
32
|
-
border: ${constants_1.get('borderWidths.1')} solid transparent;
|
33
|
-
border-radius: ${constants_1.get('radii.2')};
|
34
|
-
transition: border-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
|
35
|
-
|
36
|
-
&:hover,
|
37
|
-
&:focus {
|
38
|
-
text-decoration: none;
|
39
|
-
border-color: ${constants_1.get('colors.border.default')};
|
40
|
-
outline: 0;
|
41
|
-
transition-duration: 0.1s;
|
42
|
-
}
|
43
|
-
|
44
|
-
&:active {
|
45
|
-
border-color: ${constants_1.get('colors.border.muted')};
|
46
|
-
}
|
47
|
-
|
48
|
-
&[rel='prev'],
|
49
|
-
&[rel='next'] {
|
50
|
-
color: ${constants_1.get('colors.accent.fg')};
|
51
|
-
}
|
52
|
-
|
53
|
-
&[aria-current],
|
54
|
-
&[aria-current]:hover {
|
55
|
-
color: ${constants_1.get('colors.fg.onEmphasis')};
|
56
|
-
background-color: ${constants_1.get('colors.accent.emphasis')};
|
57
|
-
border-color: transparent;
|
58
|
-
}
|
59
|
-
|
60
|
-
&[aria-disabled],
|
61
|
-
&[aria-disabled]:hover {
|
62
|
-
color: ${constants_1.get('colors.primer.fg.disabled')}; // check
|
63
|
-
cursor: default;
|
64
|
-
border-color: transparent;
|
65
|
-
}
|
66
|
-
|
67
|
-
@supports (clip-path: polygon(50% 0, 100% 50%, 50% 100%)) {
|
68
|
-
&[rel='prev']::before,
|
69
|
-
&[rel='next']::after {
|
70
|
-
display: inline-block;
|
71
|
-
width: 16px;
|
72
|
-
height: 16px;
|
73
|
-
vertical-align: text-bottom;
|
74
|
-
content: '';
|
75
|
-
background-color: currentColor;
|
76
|
-
}
|
77
|
-
|
78
|
-
// chevron-left
|
79
|
-
&[rel='prev']::before {
|
80
|
-
margin-right: ${constants_1.get('space.1')};
|
81
|
-
clip-path: polygon(
|
82
|
-
9.8px 12.8px,
|
83
|
-
8.7px 12.8px,
|
84
|
-
4.5px 8.5px,
|
85
|
-
4.5px 7.5px,
|
86
|
-
8.7px 3.2px,
|
87
|
-
9.8px 4.3px,
|
88
|
-
6.1px 8px,
|
89
|
-
9.8px 11.7px,
|
90
|
-
9.8px 12.8px
|
91
|
-
);
|
92
|
-
}
|
93
|
-
|
94
|
-
// chevron-right
|
95
|
-
&[rel='next']::after {
|
96
|
-
margin-left: ${constants_1.get('space.1')};
|
97
|
-
clip-path: polygon(
|
98
|
-
6.2px 3.2px,
|
99
|
-
7.3px 3.2px,
|
100
|
-
11.5px 7.5px,
|
101
|
-
11.5px 8.5px,
|
102
|
-
7.3px 12.8px,
|
103
|
-
6.2px 11.7px,
|
104
|
-
9.9px 8px,
|
105
|
-
6.2px 4.3px,
|
106
|
-
6.2px 3.2px
|
107
|
-
);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
`;
|
111
|
-
function usePaginationPages({ theme, pageCount, currentPage, onPageChange, hrefBuilder, marginPageCount, showPages, surroundingPageCount }) {
|
112
|
-
const pageChange = react_1.default.useCallback(n => (e) => onPageChange(e, n), [onPageChange]);
|
113
|
-
const model = react_1.default.useMemo(() => {
|
114
|
-
return model_1.buildPaginationModel(pageCount, currentPage, !!showPages, marginPageCount, surroundingPageCount);
|
115
|
-
}, [pageCount, currentPage, showPages, marginPageCount, surroundingPageCount]);
|
116
|
-
const children = react_1.default.useMemo(() => {
|
117
|
-
return model.map(page => {
|
118
|
-
const { props, key, content } = model_1.buildComponentData(page, hrefBuilder, pageChange(page.num));
|
119
|
-
return (<Page {...props} key={key} theme={theme}>
|
120
|
-
{content}
|
121
|
-
</Page>);
|
122
|
-
});
|
123
|
-
}, [model, hrefBuilder, pageChange, theme]);
|
124
|
-
return children;
|
125
|
-
}
|
126
|
-
const PaginationContainer = styled_components_1.default.nav `
|
127
|
-
margin-top: 20px;
|
128
|
-
margin-bottom: 15px;
|
129
|
-
text-align: center;
|
130
|
-
${sx_1.default};
|
131
|
-
`;
|
132
|
-
function Pagination({ theme, pageCount, currentPage, onPageChange = noop, hrefBuilder = defaultHrefBuilder, marginPageCount = 1, showPages = true, surroundingPageCount = 2, ...rest }) {
|
133
|
-
const pageElements = usePaginationPages({
|
134
|
-
theme,
|
135
|
-
pageCount,
|
136
|
-
currentPage,
|
137
|
-
onPageChange,
|
138
|
-
hrefBuilder,
|
139
|
-
marginPageCount,
|
140
|
-
showPages,
|
141
|
-
surroundingPageCount
|
142
|
-
});
|
143
|
-
return (<PaginationContainer aria-label="Pagination" {...rest} theme={theme}>
|
144
|
-
<Box_1.default display="inline-block" theme={theme}>
|
145
|
-
{pageElements}
|
146
|
-
</Box_1.default>
|
147
|
-
</PaginationContainer>);
|
148
|
-
}
|
149
|
-
function defaultHrefBuilder(pageNum) {
|
150
|
-
return `#${pageNum}`;
|
151
|
-
}
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
153
|
-
function noop() { }
|
154
|
-
Pagination.defaultProps = {
|
155
|
-
hrefBuilder: defaultHrefBuilder,
|
156
|
-
marginPageCount: 1,
|
157
|
-
onPageChange: noop,
|
158
|
-
showPages: true,
|
159
|
-
surroundingPageCount: 2
|
160
|
-
};
|
161
|
-
exports.default = Pagination;
|
package/lib/Pagination/model.jsx
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.buildComponentData = exports.buildPaginationModel = void 0;
|
4
|
-
function buildPaginationModel(pageCount, currentPage, showPages, marginPageCount, surroundingPageCount) {
|
5
|
-
const pages = [];
|
6
|
-
if (showPages) {
|
7
|
-
const pageNums = [];
|
8
|
-
const addPage = (n) => {
|
9
|
-
if (n >= 1 && n <= pageCount) {
|
10
|
-
pageNums.push(n);
|
11
|
-
}
|
12
|
-
};
|
13
|
-
// Start by defining the window of pages to show around the current page.
|
14
|
-
// If the window goes off either edge, shift it until it fits.
|
15
|
-
let extentLeft = currentPage - surroundingPageCount;
|
16
|
-
let extentRight = currentPage + surroundingPageCount;
|
17
|
-
if (extentLeft < 1 && extentRight > pageCount) {
|
18
|
-
// Our window is larger than the entire range,
|
19
|
-
// so simply display every page.
|
20
|
-
extentLeft = 1;
|
21
|
-
extentRight = pageCount;
|
22
|
-
}
|
23
|
-
else if (extentLeft < 1) {
|
24
|
-
while (extentLeft < 1) {
|
25
|
-
extentLeft++;
|
26
|
-
extentRight++;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
else if (extentRight > pageCount) {
|
30
|
-
while (extentRight > pageCount) {
|
31
|
-
extentLeft--;
|
32
|
-
extentRight--;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
// Next, include the pages in the margins.
|
36
|
-
// If a margin page is already covered in the window,
|
37
|
-
// extend the window to the other direction.
|
38
|
-
for (let i = 1; i <= marginPageCount; i++) {
|
39
|
-
const leftPage = i;
|
40
|
-
const rightPage = pageCount - (i - 1);
|
41
|
-
if (leftPage >= extentLeft) {
|
42
|
-
extentRight++;
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
addPage(leftPage);
|
46
|
-
}
|
47
|
-
if (rightPage <= extentRight) {
|
48
|
-
extentLeft--;
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
addPage(rightPage);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
for (let i = extentLeft; i <= extentRight; i++) {
|
55
|
-
addPage(i);
|
56
|
-
}
|
57
|
-
const sorted = pageNums
|
58
|
-
.slice()
|
59
|
-
.sort((a, b) => a - b)
|
60
|
-
.filter((item, idx, ary) => !idx || item !== ary[idx - 1]);
|
61
|
-
for (let idx = 0; idx < sorted.length; idx++) {
|
62
|
-
const num = sorted[idx];
|
63
|
-
const selected = num === currentPage;
|
64
|
-
if (idx === 0) {
|
65
|
-
if (num !== 1) {
|
66
|
-
// If the first page isn't page one,
|
67
|
-
// we need to add a break
|
68
|
-
pages.push({
|
69
|
-
type: 'BREAK',
|
70
|
-
num: 1
|
71
|
-
});
|
72
|
-
}
|
73
|
-
pages.push({
|
74
|
-
type: 'NUM',
|
75
|
-
num,
|
76
|
-
selected
|
77
|
-
});
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
const last = sorted[idx - 1];
|
81
|
-
const delta = num - last;
|
82
|
-
if (delta === 1) {
|
83
|
-
pages.push({
|
84
|
-
type: 'NUM',
|
85
|
-
num,
|
86
|
-
selected
|
87
|
-
});
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
// We skipped some, so add a break
|
91
|
-
pages.push({
|
92
|
-
type: 'BREAK',
|
93
|
-
num: num - 1
|
94
|
-
});
|
95
|
-
pages.push({
|
96
|
-
type: 'NUM',
|
97
|
-
num,
|
98
|
-
selected
|
99
|
-
});
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
const lastPage = pages[pages.length - 1];
|
104
|
-
if (lastPage.type === 'NUM' && lastPage.num !== pageCount) {
|
105
|
-
// The last page we rendered wasn't the actual last page,
|
106
|
-
// so we need an additional break
|
107
|
-
pages.push({
|
108
|
-
type: 'BREAK',
|
109
|
-
num: pageCount
|
110
|
-
});
|
111
|
-
}
|
112
|
-
}
|
113
|
-
const prev = { type: 'PREV', num: currentPage - 1, disabled: currentPage === 1 };
|
114
|
-
const next = { type: 'NEXT', num: currentPage + 1, disabled: currentPage === pageCount };
|
115
|
-
return [prev, ...pages, next];
|
116
|
-
}
|
117
|
-
exports.buildPaginationModel = buildPaginationModel;
|
118
|
-
function buildComponentData(page, hrefBuilder, onClick) {
|
119
|
-
const props = {};
|
120
|
-
let content = '';
|
121
|
-
let key = '';
|
122
|
-
switch (page.type) {
|
123
|
-
case 'PREV': {
|
124
|
-
key = 'page-prev';
|
125
|
-
content = 'Previous';
|
126
|
-
if (page.disabled) {
|
127
|
-
Object.assign(props, { as: 'span', 'aria-disabled': 'true' });
|
128
|
-
}
|
129
|
-
else {
|
130
|
-
Object.assign(props, {
|
131
|
-
rel: 'prev',
|
132
|
-
href: hrefBuilder(page.num),
|
133
|
-
'aria-label': 'Previous Page',
|
134
|
-
onClick
|
135
|
-
});
|
136
|
-
}
|
137
|
-
break;
|
138
|
-
}
|
139
|
-
case 'NEXT': {
|
140
|
-
key = 'page-next';
|
141
|
-
content = 'Next';
|
142
|
-
if (page.disabled) {
|
143
|
-
Object.assign(props, { as: 'span', 'aria-disabled': 'true' });
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
Object.assign(props, {
|
147
|
-
rel: 'next',
|
148
|
-
href: hrefBuilder(page.num),
|
149
|
-
'aria-label': 'Next Page',
|
150
|
-
onClick
|
151
|
-
});
|
152
|
-
}
|
153
|
-
break;
|
154
|
-
}
|
155
|
-
case 'NUM': {
|
156
|
-
key = `page-${page.num}`;
|
157
|
-
content = String(page.num);
|
158
|
-
if (page.selected) {
|
159
|
-
Object.assign(props, { as: 'em', 'aria-current': 'page' });
|
160
|
-
}
|
161
|
-
else {
|
162
|
-
Object.assign(props, { href: hrefBuilder(page.num), 'aria-label': `Page ${page.num}`, onClick });
|
163
|
-
}
|
164
|
-
break;
|
165
|
-
}
|
166
|
-
case 'BREAK': {
|
167
|
-
key = `page-${page.num}-break`;
|
168
|
-
content = '…';
|
169
|
-
Object.assign(props, { as: 'span', 'aria-disabled': true });
|
170
|
-
}
|
171
|
-
}
|
172
|
-
return { props, key, content };
|
173
|
-
}
|
174
|
-
exports.buildComponentData = buildComponentData;
|
package/lib/PointerBox.jsx
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const BorderBox_1 = __importDefault(require("./BorderBox"));
|
8
|
-
const Caret_1 = __importDefault(require("./Caret"));
|
9
|
-
function PointerBox(props) {
|
10
|
-
// don't destructure these, just grab them
|
11
|
-
const { bg, border, borderColor, theme } = props;
|
12
|
-
const { caret, children, ...boxProps } = props;
|
13
|
-
const caretProps = {
|
14
|
-
bg,
|
15
|
-
borderColor,
|
16
|
-
borderWidth: border,
|
17
|
-
location: caret,
|
18
|
-
theme
|
19
|
-
};
|
20
|
-
return (<BorderBox_1.default sx={{ position: 'relative' }} {...boxProps}>
|
21
|
-
{children}
|
22
|
-
<Caret_1.default {...caretProps}/>
|
23
|
-
</BorderBox_1.default>);
|
24
|
-
}
|
25
|
-
exports.default = PointerBox;
|
package/lib/Popover.jsx
DELETED
@@ -1,202 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const classnames_1 = __importDefault(require("classnames"));
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
8
|
-
const constants_1 = require("./constants");
|
9
|
-
const sx_1 = __importDefault(require("./sx"));
|
10
|
-
const Popover = styled_components_1.default.div.attrs(({ className, caret }) => {
|
11
|
-
return {
|
12
|
-
className: classnames_1.default(className, `caret-pos--${caret}`)
|
13
|
-
};
|
14
|
-
}) `
|
15
|
-
position: ${props => (props.relative ? 'relative' : 'absolute')};
|
16
|
-
z-index: 100;
|
17
|
-
display: ${props => (props.open ? 'block' : 'none')};
|
18
|
-
${sx_1.default};
|
19
|
-
`;
|
20
|
-
const PopoverContent = styled_components_1.default.div `
|
21
|
-
border: 1px solid ${constants_1.get('colors.border.default')};
|
22
|
-
border-radius: ${constants_1.get('radii.2')};
|
23
|
-
position: relative;
|
24
|
-
width: 232px;
|
25
|
-
margin-right: auto;
|
26
|
-
margin-left: auto;
|
27
|
-
padding: ${constants_1.get('space.4')};
|
28
|
-
background-color: ${constants_1.get('colors.canvas.overlay')};
|
29
|
-
|
30
|
-
// Carets
|
31
|
-
&::before,
|
32
|
-
&::after {
|
33
|
-
position: absolute;
|
34
|
-
left: 50%;
|
35
|
-
display: inline-block;
|
36
|
-
content: '';
|
37
|
-
}
|
38
|
-
|
39
|
-
&::before {
|
40
|
-
top: -${constants_1.get('space.3')};
|
41
|
-
margin-left: -9px;
|
42
|
-
border: ${constants_1.get('space.2')} solid transparent; // TODO: solid?
|
43
|
-
border-bottom-color: ${constants_1.get('colors.border.default')};
|
44
|
-
}
|
45
|
-
|
46
|
-
&::after {
|
47
|
-
top: -14px;
|
48
|
-
margin-left: -${constants_1.get('space.2')};
|
49
|
-
border: 7px solid transparent; // todo: solid
|
50
|
-
border-bottom-color: ${constants_1.get('colors.canvas.overlay')};
|
51
|
-
}
|
52
|
-
|
53
|
-
// Bottom-oriented carets
|
54
|
-
${Popover}.caret-pos--bottom & ,
|
55
|
-
${Popover}.caret-pos--bottom-right & ,
|
56
|
-
${Popover}.caret-pos--bottom-left & {
|
57
|
-
&::before,
|
58
|
-
&::after {
|
59
|
-
top: auto;
|
60
|
-
border-bottom-color: transparent;
|
61
|
-
}
|
62
|
-
|
63
|
-
&::before {
|
64
|
-
bottom: -${constants_1.get('space.3')};
|
65
|
-
border-top-color: ${constants_1.get('colors.border.default')};
|
66
|
-
}
|
67
|
-
|
68
|
-
&::after {
|
69
|
-
bottom: -14px;
|
70
|
-
// stylelint-disable-next-line primer/borders
|
71
|
-
border-top-color: ${constants_1.get('colors.canvas.overlay')};
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
// Top & Bottom: Right-oriented carets
|
76
|
-
${Popover}.caret-pos--top-right & ,
|
77
|
-
${Popover}.caret-pos--bottom-right & {
|
78
|
-
right: -9px;
|
79
|
-
margin-right: 0;
|
80
|
-
|
81
|
-
&::before,
|
82
|
-
&::after {
|
83
|
-
left: auto;
|
84
|
-
margin-left: 0;
|
85
|
-
}
|
86
|
-
|
87
|
-
&::before {
|
88
|
-
right: 20px;
|
89
|
-
}
|
90
|
-
|
91
|
-
&::after {
|
92
|
-
right: 21px;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
// Top & Bottom: Left-oriented carets
|
97
|
-
${Popover}.caret-pos--top-left & ,
|
98
|
-
${Popover}.caret-pos--bottom-left & {
|
99
|
-
left: -9px;
|
100
|
-
margin-left: 0;
|
101
|
-
|
102
|
-
&::before,
|
103
|
-
&::after {
|
104
|
-
left: ${constants_1.get('space.4')};
|
105
|
-
margin-left: 0;
|
106
|
-
}
|
107
|
-
|
108
|
-
&::after {
|
109
|
-
left: calc(${constants_1.get('space.4')} + 1px);
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
// Right- & Left-oriented carets
|
114
|
-
${Popover}.caret-pos--right & ,
|
115
|
-
${Popover}.caret-pos--right-top & ,
|
116
|
-
${Popover}.caret-pos--right-bottom & ,
|
117
|
-
${Popover}.caret-pos--left & ,
|
118
|
-
${Popover}.caret-pos--left-top & ,
|
119
|
-
${Popover}.caret-pos--left-bottom & {
|
120
|
-
&::before,
|
121
|
-
&::after {
|
122
|
-
top: 50%;
|
123
|
-
left: auto;
|
124
|
-
margin-left: 0;
|
125
|
-
border-bottom-color: transparent;
|
126
|
-
}
|
127
|
-
|
128
|
-
&::before {
|
129
|
-
// stylelint-disable-next-line primer/spacing
|
130
|
-
margin-top: calc((${constants_1.get('space.2')} + 1px) * -1);
|
131
|
-
}
|
132
|
-
|
133
|
-
&::after {
|
134
|
-
margin-top: -${constants_1.get('space.2')};
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
// Right-oriented carets
|
139
|
-
${Popover}.caret-pos--right & ,
|
140
|
-
${Popover}.caret-pos--right-top & ,
|
141
|
-
${Popover}.caret-pos--right-bottom & {
|
142
|
-
&::before {
|
143
|
-
right: -${constants_1.get('space.3')};
|
144
|
-
border-left-color: ${constants_1.get('colors.border.default')};
|
145
|
-
}
|
146
|
-
|
147
|
-
&::after {
|
148
|
-
right: -14px;
|
149
|
-
// stylelint-disable-next-line primer/borders
|
150
|
-
border-left-color: ${constants_1.get('colors.canvas.overlay')};
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
// Left-oriented carets
|
155
|
-
${Popover}.caret-pos--left & ,
|
156
|
-
${Popover}.caret-pos--left-top & ,
|
157
|
-
${Popover}.caret-pos--left-bottom & {
|
158
|
-
&::before {
|
159
|
-
left: -${constants_1.get('space.3')};
|
160
|
-
border-right-color: ${constants_1.get('colors.border.default')};
|
161
|
-
}
|
162
|
-
|
163
|
-
&::after {
|
164
|
-
left: -14px;
|
165
|
-
// stylelint-disable-next-line primer/borders
|
166
|
-
border-right-color: ${constants_1.get('colors.canvas.overlay')};
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
|
-
// Right & Left: Top-oriented carets
|
171
|
-
${Popover}.caret-pos--right-top & ,
|
172
|
-
${Popover}.caret-pos--left-top & {
|
173
|
-
&::before,
|
174
|
-
&::after {
|
175
|
-
top: ${constants_1.get('space.4')};
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
|
-
// Right & Left: Bottom-oriented carets
|
180
|
-
${Popover}.caret-pos--right-bottom & ,
|
181
|
-
${Popover}.caret-pos--left-bottom & {
|
182
|
-
&::before,
|
183
|
-
&::after {
|
184
|
-
top: auto;
|
185
|
-
}
|
186
|
-
|
187
|
-
&::before {
|
188
|
-
bottom: ${constants_1.get('space.3')};
|
189
|
-
}
|
190
|
-
|
191
|
-
&::after {
|
192
|
-
bottom: calc(${constants_1.get('space.3')} + 1px);
|
193
|
-
}
|
194
|
-
}
|
195
|
-
|
196
|
-
${sx_1.default};
|
197
|
-
`;
|
198
|
-
Popover.defaultProps = {
|
199
|
-
caret: 'top'
|
200
|
-
};
|
201
|
-
PopoverContent.displayName = 'Popover.Content';
|
202
|
-
exports.default = Object.assign(Popover, { Content: PopoverContent });
|
package/lib/Portal/Portal.jsx
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Portal = exports.registerPortalRoot = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const react_dom_1 = require("react-dom");
|
9
|
-
const useIsomorphicLayoutEffect_1 = __importDefault(require("../utils/useIsomorphicLayoutEffect"));
|
10
|
-
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
11
|
-
const DEFAULT_PORTAL_CONTAINER_NAME = '__default__';
|
12
|
-
const portalRootRegistry = {};
|
13
|
-
/**
|
14
|
-
* Register a container to serve as a portal root.
|
15
|
-
* @param root The element that will be the root for portals created in this container
|
16
|
-
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
17
|
-
* If name is not specified, registers the default portal root.
|
18
|
-
*/
|
19
|
-
function registerPortalRoot(root, name = DEFAULT_PORTAL_CONTAINER_NAME) {
|
20
|
-
portalRootRegistry[name] = root;
|
21
|
-
}
|
22
|
-
exports.registerPortalRoot = registerPortalRoot;
|
23
|
-
// Ensures that a default portal root exists and is registered. If a DOM element exists
|
24
|
-
// with id __primerPortalRoot__, allow that element to serve as the default portal root.
|
25
|
-
// Otherwise, create that element and attach it to the end of document.body.
|
26
|
-
function ensureDefaultPortal() {
|
27
|
-
const existingDefaultPortalContainer = portalRootRegistry[DEFAULT_PORTAL_CONTAINER_NAME];
|
28
|
-
if (!existingDefaultPortalContainer || !document.body.contains(existingDefaultPortalContainer)) {
|
29
|
-
let defaultPortalContainer = document.getElementById(PRIMER_PORTAL_ROOT_ID);
|
30
|
-
if (!(defaultPortalContainer instanceof Element)) {
|
31
|
-
defaultPortalContainer = document.createElement('div');
|
32
|
-
defaultPortalContainer.setAttribute('id', PRIMER_PORTAL_ROOT_ID);
|
33
|
-
defaultPortalContainer.style.position = 'absolute';
|
34
|
-
defaultPortalContainer.style.top = '0';
|
35
|
-
defaultPortalContainer.style.left = '0';
|
36
|
-
const suitablePortalRoot = document.querySelector('[data-portal-root]');
|
37
|
-
if (suitablePortalRoot) {
|
38
|
-
suitablePortalRoot.appendChild(defaultPortalContainer);
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
document.body.appendChild(defaultPortalContainer);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
registerPortalRoot(defaultPortalContainer);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Creates a React Portal, placing all children in a separate physical DOM root node.
|
49
|
-
* @see https://reactjs.org/docs/portals.html
|
50
|
-
*/
|
51
|
-
const Portal = ({ children, onMount, containerName: _containerName }) => {
|
52
|
-
const hostElement = document.createElement('div');
|
53
|
-
// Portaled content should get their own stacking context so they don't interfere
|
54
|
-
// with each other in unexpected ways. One should never find themselves tempted
|
55
|
-
// to change the zIndex to a value other than "1".
|
56
|
-
hostElement.style.position = 'relative';
|
57
|
-
hostElement.style.zIndex = '1';
|
58
|
-
const elementRef = react_1.default.useRef(hostElement);
|
59
|
-
useIsomorphicLayoutEffect_1.default(() => {
|
60
|
-
let containerName = _containerName;
|
61
|
-
if (containerName === undefined) {
|
62
|
-
containerName = DEFAULT_PORTAL_CONTAINER_NAME;
|
63
|
-
ensureDefaultPortal();
|
64
|
-
}
|
65
|
-
const parentElement = portalRootRegistry[containerName];
|
66
|
-
if (!parentElement) {
|
67
|
-
throw new Error(`Portal container '${_containerName}' is not yet registered. Container must be registered with registerPortal before use.`);
|
68
|
-
}
|
69
|
-
const element = elementRef.current;
|
70
|
-
parentElement.appendChild(element);
|
71
|
-
onMount?.();
|
72
|
-
return () => {
|
73
|
-
parentElement.removeChild(element);
|
74
|
-
};
|
75
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
76
|
-
}, [elementRef]);
|
77
|
-
return react_dom_1.createPortal(children, elementRef.current);
|
78
|
-
};
|
79
|
-
exports.Portal = Portal;
|
package/lib/Position.jsx
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Sticky = exports.Relative = exports.Fixed = exports.Absolute = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
9
|
-
const Box_1 = __importDefault(require("./Box"));
|
10
|
-
/**
|
11
|
-
* @deprecated Use the Box component instead (i.e. <Position> → <Box>)
|
12
|
-
*/
|
13
|
-
const Position = styled_components_1.default(Box_1.default) ``;
|
14
|
-
/**
|
15
|
-
* @deprecated Use the Box component instead (i.e. <Absolute> → <Box position="absolute">)
|
16
|
-
*/
|
17
|
-
exports.default = Position;
|
18
|
-
/**
|
19
|
-
* @deprecated Use the Box component instead (i.e. <Absolute> → <Box position="absolute">)
|
20
|
-
*/
|
21
|
-
exports.Absolute = react_1.default.forwardRef((props, ref) => {
|
22
|
-
return <Position {...props} position="absolute" ref={ref}/>;
|
23
|
-
});
|
24
|
-
exports.Absolute.displayName = 'Absolute';
|
25
|
-
/**
|
26
|
-
* @deprecated Use the Box component instead (i.e. <Fixed> → <Box position="fixed">)
|
27
|
-
*/
|
28
|
-
exports.Fixed = react_1.default.forwardRef((props, ref) => {
|
29
|
-
return <Position {...props} position="fixed" ref={ref}/>;
|
30
|
-
});
|
31
|
-
exports.Fixed.displayName = 'Fixed';
|
32
|
-
/**
|
33
|
-
* @deprecated Use the Box component instead (i.e. <Relative> → <Box position="relative">)
|
34
|
-
*/
|
35
|
-
exports.Relative = react_1.default.forwardRef((props, ref) => {
|
36
|
-
return <Position {...props} position="relative" ref={ref}/>;
|
37
|
-
});
|
38
|
-
exports.Relative.displayName = 'Relative';
|
39
|
-
/**
|
40
|
-
* @deprecated Use the Box component instead (i.e. <Sticky> → <Box position="sticky">)
|
41
|
-
*/
|
42
|
-
exports.Sticky = react_1.default.forwardRef((props, ref) => {
|
43
|
-
return <Position {...props} position="sticky" ref={ref}/>;
|
44
|
-
});
|
45
|
-
exports.Sticky.defaultProps = { top: 0, zIndex: 1 };
|
46
|
-
exports.Sticky.displayName = 'Sticky';
|