@primer/components 0.0.0-20211030175556 → 0.0.0-20211030175634
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 +24 -2
- package/dist/browser.esm.js +144 -137
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +128 -121
- 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/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/Dialog.d.ts +3 -2
- package/lib/Dropdown.d.ts +4 -0
- 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/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/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/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/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/Dialog.d.ts +3 -2
- package/lib-esm/Dropdown.d.ts +4 -0
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -1
- package/lib-esm/FilterList.d.ts +1 -0
- package/lib-esm/Overlay.d.ts +5 -3
- package/lib-esm/Position.d.ts +4 -4
- 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/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
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';
|
package/lib/ProgressBar.jsx
DELETED
@@ -1,39 +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 styled_system_1 = require("styled-system");
|
9
|
-
const constants_1 = require("./constants");
|
10
|
-
const sx_1 = __importDefault(require("./sx"));
|
11
|
-
const Bar = styled_components_1.default.span `
|
12
|
-
width: ${props => (props.progress ? `${props.progress}%` : 0)};
|
13
|
-
${constants_1.COMMON}
|
14
|
-
`;
|
15
|
-
const sizeMap = {
|
16
|
-
small: '5px',
|
17
|
-
large: '10px',
|
18
|
-
default: '8px'
|
19
|
-
};
|
20
|
-
const ProgressContainer = styled_components_1.default.span `
|
21
|
-
display: ${props => (props.inline ? 'inline-flex' : 'flex')};
|
22
|
-
overflow: hidden;
|
23
|
-
background-color: ${constants_1.get('colors.border.default')};
|
24
|
-
border-radius: ${constants_1.get('radii.1')};
|
25
|
-
height: ${props => sizeMap[props.barSize || 'default']};
|
26
|
-
${constants_1.COMMON}
|
27
|
-
${styled_system_1.width}
|
28
|
-
${sx_1.default};
|
29
|
-
`;
|
30
|
-
function ProgressBar({ progress, bg, theme, ...rest }) {
|
31
|
-
return (<ProgressContainer theme={theme} {...rest}>
|
32
|
-
<Bar progress={progress} bg={bg} theme={theme}/>
|
33
|
-
</ProgressContainer>);
|
34
|
-
}
|
35
|
-
ProgressBar.defaultProps = {
|
36
|
-
bg: 'success.emphasis',
|
37
|
-
barSize: 'default'
|
38
|
-
};
|
39
|
-
exports.default = ProgressBar;
|
@@ -1,112 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
-
};
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
const react_1 = __importStar(require("react"));
|
26
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
27
|
-
const sx_1 = __importDefault(require("../sx"));
|
28
|
-
const useKeyboardNav_1 = __importDefault(require("./hooks/useKeyboardNav"));
|
29
|
-
const SelectMenuContext_1 = require("./SelectMenuContext");
|
30
|
-
const SelectMenuDivider_1 = __importDefault(require("./SelectMenuDivider"));
|
31
|
-
const SelectMenuFilter_1 = __importDefault(require("./SelectMenuFilter"));
|
32
|
-
const SelectMenuFooter_1 = __importDefault(require("./SelectMenuFooter"));
|
33
|
-
const SelectMenuHeader_1 = __importDefault(require("./SelectMenuHeader"));
|
34
|
-
const SelectMenuItem_1 = __importDefault(require("./SelectMenuItem"));
|
35
|
-
const SelectMenuList_1 = __importDefault(require("./SelectMenuList"));
|
36
|
-
const SelectMenuLoadingAnimation_1 = __importDefault(require("./SelectMenuLoadingAnimation"));
|
37
|
-
const SelectMenuModal_1 = __importDefault(require("./SelectMenuModal"));
|
38
|
-
const SelectMenuTab_1 = __importDefault(require("./SelectMenuTab"));
|
39
|
-
const SelectMenuTabPanel_1 = __importDefault(require("./SelectMenuTabPanel"));
|
40
|
-
const SelectMenuTabs_1 = __importDefault(require("./SelectMenuTabs"));
|
41
|
-
const wrapperStyles = `
|
42
|
-
// Remove marker added by the display: list-item browser default
|
43
|
-
> summary {
|
44
|
-
list-style: none;
|
45
|
-
}
|
46
|
-
// Remove marker added by details polyfill
|
47
|
-
> summary::before {
|
48
|
-
display: none;
|
49
|
-
}
|
50
|
-
// Remove marker added by Chrome
|
51
|
-
> summary::-webkit-details-marker {
|
52
|
-
display: none;
|
53
|
-
}
|
54
|
-
`;
|
55
|
-
const StyledSelectMenu = styled_components_1.default.details `
|
56
|
-
${wrapperStyles}
|
57
|
-
${sx_1.default};
|
58
|
-
`;
|
59
|
-
// 'as' is spread out because we don't want users to be able to change the tag.
|
60
|
-
const SelectMenu = react_1.default.forwardRef(({ children, initialTab = '', as: _ignoredAs, ...rest }, forwardedRef) => {
|
61
|
-
const backupRef = react_1.useRef(null);
|
62
|
-
const ref = forwardedRef ?? backupRef;
|
63
|
-
const [selectedTab, setSelectedTab] = react_1.useState(initialTab);
|
64
|
-
const [open, setOpen] = react_1.useState(false);
|
65
|
-
const menuProviderValues = {
|
66
|
-
selectedTab,
|
67
|
-
setSelectedTab,
|
68
|
-
setOpen,
|
69
|
-
open,
|
70
|
-
initialTab
|
71
|
-
};
|
72
|
-
const onClickOutside = react_1.useCallback(event => {
|
73
|
-
if ('current' in ref && ref.current && !ref.current.contains(event.target)) {
|
74
|
-
if (!event.defaultPrevented) {
|
75
|
-
setOpen(false);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}, [ref, setOpen]);
|
79
|
-
// handles the overlay behavior - closing the menu when clicking outside of it
|
80
|
-
react_1.useEffect(() => {
|
81
|
-
if (open) {
|
82
|
-
document.addEventListener('click', onClickOutside);
|
83
|
-
return () => {
|
84
|
-
document.removeEventListener('click', onClickOutside);
|
85
|
-
};
|
86
|
-
}
|
87
|
-
}, [open, onClickOutside]);
|
88
|
-
function toggle(event) {
|
89
|
-
setOpen(event.target.open);
|
90
|
-
}
|
91
|
-
useKeyboardNav_1.default(ref, open, setOpen);
|
92
|
-
return (<SelectMenuContext_1.MenuContext.Provider value={menuProviderValues}>
|
93
|
-
<StyledSelectMenu ref={ref} {...rest} open={open} onToggle={toggle}>
|
94
|
-
{children}
|
95
|
-
</StyledSelectMenu>
|
96
|
-
</SelectMenuContext_1.MenuContext.Provider>);
|
97
|
-
});
|
98
|
-
SelectMenu.displayName = 'SelectMenu';
|
99
|
-
exports.default = Object.assign(SelectMenu, {
|
100
|
-
MenuContext: SelectMenuContext_1.MenuContext,
|
101
|
-
List: SelectMenuList_1.default,
|
102
|
-
Divider: SelectMenuDivider_1.default,
|
103
|
-
Filter: SelectMenuFilter_1.default,
|
104
|
-
Footer: SelectMenuFooter_1.default,
|
105
|
-
Item: SelectMenuItem_1.default,
|
106
|
-
Modal: SelectMenuModal_1.default,
|
107
|
-
Tabs: SelectMenuTabs_1.default,
|
108
|
-
Tab: SelectMenuTab_1.default,
|
109
|
-
TabPanel: SelectMenuTabPanel_1.default,
|
110
|
-
Header: SelectMenuHeader_1.default,
|
111
|
-
LoadingAnimation: SelectMenuLoadingAnimation_1.default
|
112
|
-
});
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
-
};
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
26
|
-
const constants_1 = require("../constants");
|
27
|
-
const sx_1 = __importDefault(require("../sx"));
|
28
|
-
const dividerStyles = styled_components_1.css `
|
29
|
-
padding: ${constants_1.get('space.1')} ${constants_1.get('space.3')};
|
30
|
-
margin: 0;
|
31
|
-
font-size: ${constants_1.get('fontSizes.0')};
|
32
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
33
|
-
color: ${constants_1.get('colors.fg.muted')};
|
34
|
-
background-color: ${constants_1.get('colors.canvas.subtle')};
|
35
|
-
border-bottom: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
|
36
|
-
`;
|
37
|
-
const SelectMenuDivider = styled_components_1.default.div `
|
38
|
-
${dividerStyles}
|
39
|
-
${sx_1.default};
|
40
|
-
`;
|
41
|
-
SelectMenuDivider.displayName = 'SelectMenu.Divider';
|
42
|
-
exports.default = SelectMenuDivider;
|
@@ -1,58 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
-
};
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
const react_1 = __importStar(require("react"));
|
26
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
27
|
-
const constants_1 = require("../constants");
|
28
|
-
const sx_1 = __importDefault(require("../sx"));
|
29
|
-
const TextInput_1 = __importDefault(require("../TextInput"));
|
30
|
-
const SelectMenuContext_1 = require("./SelectMenuContext");
|
31
|
-
const StyledForm = styled_components_1.default.form `
|
32
|
-
padding: ${constants_1.get('space.3')};
|
33
|
-
margin: 0;
|
34
|
-
border-bottom: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
|
35
|
-
background-color: ${constants_1.get('colors.canvas.overlay')};
|
36
|
-
|
37
|
-
@media (min-width: ${constants_1.get('breakpoints.0')}) {
|
38
|
-
padding: ${constants_1.get('space.2')};
|
39
|
-
}
|
40
|
-
|
41
|
-
${sx_1.default};
|
42
|
-
`;
|
43
|
-
const SelectMenuFilter = react_1.forwardRef(({ theme, value, sx: sxProp, ...rest }, forwardedRef) => {
|
44
|
-
const inputRef = react_1.useRef(null);
|
45
|
-
const ref = forwardedRef ?? inputRef;
|
46
|
-
const { open } = react_1.useContext(SelectMenuContext_1.MenuContext);
|
47
|
-
// puts focus on the filter input when the menu is opened
|
48
|
-
react_1.useEffect(() => {
|
49
|
-
if (open) {
|
50
|
-
inputRef.current?.focus();
|
51
|
-
}
|
52
|
-
}, [open]);
|
53
|
-
return (<StyledForm theme={theme} sx={sxProp}>
|
54
|
-
<TextInput_1.default theme={theme} ref={ref} width="100%" block value={value} contrast {...rest}/>
|
55
|
-
</StyledForm>);
|
56
|
-
});
|
57
|
-
SelectMenuFilter.displayName = 'SelectMenu.Filter';
|
58
|
-
exports.default = SelectMenuFilter;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
-
};
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
26
|
-
const constants_1 = require("../constants");
|
27
|
-
const sx_1 = __importDefault(require("../sx"));
|
28
|
-
const footerStyles = styled_components_1.css `
|
29
|
-
margin-top: -1px;
|
30
|
-
padding: ${constants_1.get('space.2')} ${constants_1.get('space.3')};
|
31
|
-
font-size: ${constants_1.get('fontSizes.0')};
|
32
|
-
color: ${constants_1.get('colors.fg.muted')};
|
33
|
-
text-align: center;
|
34
|
-
border-top: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
|
35
|
-
|
36
|
-
@media (min-width: ${constants_1.get('breakpoints.0')}) {
|
37
|
-
padding: ${constants_1.get('space.1')} ${constants_1.get('space.2')};
|
38
|
-
}
|
39
|
-
`;
|
40
|
-
const SelectMenuFooter = styled_components_1.default.footer `
|
41
|
-
${footerStyles}
|
42
|
-
${sx_1.default};
|
43
|
-
`;
|
44
|
-
SelectMenuFooter.displayName = 'SelectMenu.Footer';
|
45
|
-
exports.default = SelectMenuFooter;
|
@@ -1,42 +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 constants_1 = require("../constants");
|
9
|
-
const sx_1 = __importDefault(require("../sx"));
|
10
|
-
// SelectMenu.Header is intentionally not exported, it's an internal component used in
|
11
|
-
// SelectMenu.Modal
|
12
|
-
const SelectMenuTitle = styled_components_1.default.h3 `
|
13
|
-
color: ${constants_1.get('colors.fg.default')};
|
14
|
-
flex: auto;
|
15
|
-
font-size: ${constants_1.get('fontSizes.1')};
|
16
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
17
|
-
margin: 0;
|
18
|
-
|
19
|
-
@media (min-width: ${constants_1.get('breakpoints.0')}) {
|
20
|
-
font-size: inherit;
|
21
|
-
}
|
22
|
-
`;
|
23
|
-
const StyledHeader = styled_components_1.default.header `
|
24
|
-
display: flex;
|
25
|
-
flex: none; // fixes header from getting squeezed in Safari iOS
|
26
|
-
padding: ${constants_1.get('space.3')};
|
27
|
-
border-bottom: ${constants_1.get('borderWidths')} solid ${constants_1.get('colors.border.muted')};
|
28
|
-
|
29
|
-
@media (min-width: ${constants_1.get('breakpoints.0')}) {
|
30
|
-
padding-top: ${constants_1.get('space.2')};
|
31
|
-
padding-bottom: ${constants_1.get('space.2')};
|
32
|
-
}
|
33
|
-
|
34
|
-
${sx_1.default};
|
35
|
-
`;
|
36
|
-
const SelectMenuHeader = ({ children, theme, ...rest }) => {
|
37
|
-
return (<StyledHeader theme={theme} {...rest}>
|
38
|
-
<SelectMenuTitle theme={theme}>{children}</SelectMenuTitle>
|
39
|
-
</StyledHeader>);
|
40
|
-
};
|
41
|
-
SelectMenuHeader.displayName = 'SelectMenu.Header';
|
42
|
-
exports.default = SelectMenuHeader;
|