@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
package/lib/Dropdown.jsx
DELETED
@@ -1,131 +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 Button_1 = __importDefault(require("./Button"));
|
9
|
-
const constants_1 = require("./constants");
|
10
|
-
const Details_1 = __importDefault(require("./Details"));
|
11
|
-
const DropdownStyles_1 = __importDefault(require("./DropdownStyles"));
|
12
|
-
const useDetails_1 = __importDefault(require("./hooks/useDetails"));
|
13
|
-
const sx_1 = __importDefault(require("./sx"));
|
14
|
-
const StyledDetails = styled_components_1.default(Details_1.default) `
|
15
|
-
position: relative;
|
16
|
-
display: inline-block;
|
17
|
-
`;
|
18
|
-
const Dropdown = ({ children, className, ...rest }) => {
|
19
|
-
const { getDetailsProps } = useDetails_1.default({ closeOnOutsideClick: true });
|
20
|
-
return (<StyledDetails className={className} {...getDetailsProps()} {...rest}>
|
21
|
-
{children}
|
22
|
-
</StyledDetails>);
|
23
|
-
};
|
24
|
-
const DropdownButton = ({ children, ...rest }) => {
|
25
|
-
return (<Button_1.default as="summary" aria-haspopup="true" {...rest}>
|
26
|
-
{children}
|
27
|
-
<DropdownCaret />
|
28
|
-
</Button_1.default>);
|
29
|
-
};
|
30
|
-
const DropdownCaret = styled_components_1.default.div `
|
31
|
-
border: 4px solid transparent;
|
32
|
-
margin-left: 12px;
|
33
|
-
border-top-color: currentcolor;
|
34
|
-
border-bottom-width: 0;
|
35
|
-
content: '';
|
36
|
-
display: inline-block;
|
37
|
-
height: 0;
|
38
|
-
vertical-align: middle;
|
39
|
-
width: 0;
|
40
|
-
${sx_1.default};
|
41
|
-
`;
|
42
|
-
const DropdownMenu = styled_components_1.default.ul `
|
43
|
-
background-clip: padding-box;
|
44
|
-
background-color: ${constants_1.get('colors.canvas.overlay')};
|
45
|
-
border: 1px solid ${constants_1.get('colors.border.default')};
|
46
|
-
border-radius: ${constants_1.get('radii.2')};
|
47
|
-
box-shadow: ${constants_1.get('shadows.shadow.large')};
|
48
|
-
left: 0;
|
49
|
-
list-style: none;
|
50
|
-
margin-top: 2px;
|
51
|
-
padding: 5px 0 5px 0 !important; //TODO: fix this override on our markdown styles
|
52
|
-
position: absolute;
|
53
|
-
top: 100%;
|
54
|
-
width: 160px;
|
55
|
-
z-index: 100;
|
56
|
-
|
57
|
-
&::before {
|
58
|
-
position: absolute;
|
59
|
-
display: inline-block;
|
60
|
-
content: '';
|
61
|
-
}
|
62
|
-
|
63
|
-
&::after {
|
64
|
-
position: absolute;
|
65
|
-
display: inline-block;
|
66
|
-
content: '';
|
67
|
-
}
|
68
|
-
|
69
|
-
&::before {
|
70
|
-
border: 8px solid transparent;
|
71
|
-
border-bottom-color: ${constants_1.get('colors.canvas.overlay')};
|
72
|
-
}
|
73
|
-
|
74
|
-
&::after {
|
75
|
-
border: 7px solid transparent;
|
76
|
-
border-bottom-color: ${constants_1.get('colors.canvas.overlay')};
|
77
|
-
}
|
78
|
-
|
79
|
-
// stylelint-disable-next-line selector-max-type
|
80
|
-
> ul {
|
81
|
-
list-style: none;
|
82
|
-
}
|
83
|
-
${props => (props.direction ? DropdownStyles_1.default(props.theme, props.direction) : '')};
|
84
|
-
${sx_1.default};
|
85
|
-
`;
|
86
|
-
const DropdownItem = styled_components_1.default.li `
|
87
|
-
display: block;
|
88
|
-
padding: ${constants_1.get('space.1')} 10px ${constants_1.get('space.1')} 15px;
|
89
|
-
overflow: hidden;
|
90
|
-
color: ${constants_1.get('colors.fg.default')};
|
91
|
-
text-overflow: ellipsis;
|
92
|
-
white-space: nowrap;
|
93
|
-
a {
|
94
|
-
color: ${constants_1.get('colors.fg.default')};
|
95
|
-
text-decoration: none;
|
96
|
-
display: block;
|
97
|
-
overflow: hidden;
|
98
|
-
color: ${constants_1.get('colors.fg.default')};
|
99
|
-
text-overflow: ellipsis;
|
100
|
-
white-space: nowrap;
|
101
|
-
}
|
102
|
-
|
103
|
-
&:focus,
|
104
|
-
a:focus {
|
105
|
-
color: ${constants_1.get('colors.fg.onEmphasis')};
|
106
|
-
text-decoration: none;
|
107
|
-
background-color: ${constants_1.get('colors.accent.emphasis')};
|
108
|
-
}
|
109
|
-
|
110
|
-
&:hover,
|
111
|
-
&:hover a {
|
112
|
-
color: ${constants_1.get('colors.fg.onEmphasis')};
|
113
|
-
text-decoration: none;
|
114
|
-
background-color: ${constants_1.get('colors.accent.emphasis')};
|
115
|
-
outline: none;
|
116
|
-
}
|
117
|
-
${sx_1.default};
|
118
|
-
`;
|
119
|
-
DropdownMenu.defaultProps = { direction: 'sw' };
|
120
|
-
DropdownMenu.displayName = 'Dropdown.Menu';
|
121
|
-
DropdownItem.displayName = 'Dropdown.Item';
|
122
|
-
DropdownButton.defaultProps = Button_1.default.defaultProps;
|
123
|
-
DropdownButton.displayName = 'Dropdown.Button';
|
124
|
-
DropdownCaret.displayName = 'Dropdown.Caret';
|
125
|
-
Dropdown.defaultProps = Details_1.default.defaultProps;
|
126
|
-
exports.default = Object.assign(Dropdown, {
|
127
|
-
Caret: DropdownCaret,
|
128
|
-
Menu: DropdownMenu,
|
129
|
-
Item: DropdownItem,
|
130
|
-
Button: DropdownButton
|
131
|
-
});
|
@@ -1,14 +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.DropdownButton = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const octicons_react_1 = require("@primer/octicons-react");
|
9
|
-
const Button_1 = __importDefault(require("../Button/Button"));
|
10
|
-
const StyledOcticon_1 = __importDefault(require("../StyledOcticon"));
|
11
|
-
exports.DropdownButton = react_1.default.forwardRef(({ children, ...props }, ref) => (<Button_1.default ref={ref} type="button" {...props}>
|
12
|
-
{children}
|
13
|
-
<StyledOcticon_1.default icon={octicons_react_1.TriangleDownIcon} sx={{ ml: 1 }}/>
|
14
|
-
</Button_1.default>));
|
@@ -1,70 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
-
exports.DropdownMenu = void 0;
|
23
|
-
const react_1 = __importStar(require("react"));
|
24
|
-
const List_1 = require("../ActionList/List");
|
25
|
-
const DropdownButton_1 = require("./DropdownButton");
|
26
|
-
const AnchoredOverlay_1 = require("../AnchoredOverlay");
|
27
|
-
const useProvidedRefOrCreate_1 = require("../hooks/useProvidedRefOrCreate");
|
28
|
-
const useProvidedStateOrCreate_1 = require("../hooks/useProvidedStateOrCreate");
|
29
|
-
/**
|
30
|
-
* A `DropdownMenu` provides an anchor (button by default) that will open a floating menu of selectable items. The menu can be
|
31
|
-
* opened and navigated using keyboard or mouse. When an item is selected, the menu will close and the `onChange` callback will be called.
|
32
|
-
* If the default anchor button is used, the anchor contents will be updated with the selection.
|
33
|
-
*/
|
34
|
-
function DropdownMenu({ renderAnchor = (props) => <DropdownButton_1.DropdownButton {...props}/>, anchorRef: externalAnchorRef, placeholder, selectedItem, onChange, overlayProps, items, open, onOpenChange, ...listProps }) {
|
35
|
-
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate_1.useProvidedStateOrCreate(open, onOpenChange, false);
|
36
|
-
const onOpen = react_1.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
|
37
|
-
const onClose = react_1.useCallback(() => setCombinedOpenState(false), [setCombinedOpenState]);
|
38
|
-
const anchorRef = useProvidedRefOrCreate_1.useProvidedRefOrCreate(externalAnchorRef);
|
39
|
-
const renderMenuAnchor = react_1.useMemo(() => {
|
40
|
-
if (renderAnchor === null) {
|
41
|
-
return null;
|
42
|
-
}
|
43
|
-
return (props) => renderAnchor({
|
44
|
-
...props,
|
45
|
-
children: selectedItem?.text ?? placeholder
|
46
|
-
});
|
47
|
-
}, [placeholder, renderAnchor, selectedItem?.text]);
|
48
|
-
const itemsToRender = react_1.useMemo(() => {
|
49
|
-
return items.map(item => {
|
50
|
-
return {
|
51
|
-
...item,
|
52
|
-
role: 'option',
|
53
|
-
selected: item === selectedItem,
|
54
|
-
onAction: (itemFromAction, event) => {
|
55
|
-
item.onAction?.(itemFromAction, event);
|
56
|
-
if (event.defaultPrevented) {
|
57
|
-
return;
|
58
|
-
}
|
59
|
-
onClose();
|
60
|
-
onChange?.(item === selectedItem ? undefined : item);
|
61
|
-
}
|
62
|
-
};
|
63
|
-
});
|
64
|
-
}, [items, onChange, onClose, selectedItem]);
|
65
|
-
return (<AnchoredOverlay_1.AnchoredOverlay renderAnchor={renderMenuAnchor} anchorRef={anchorRef} open={combinedOpenState} onOpen={onOpen} onClose={onClose} overlayProps={overlayProps}>
|
66
|
-
<List_1.List {...listProps} role="listbox" items={itemsToRender}/>
|
67
|
-
</AnchoredOverlay_1.AnchoredOverlay>);
|
68
|
-
}
|
69
|
-
exports.DropdownMenu = DropdownMenu;
|
70
|
-
DropdownMenu.displayName = 'DropdownMenu';
|
package/lib/FilterList.jsx
DELETED
@@ -1,59 +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
|
-
const FilterListBase = styled_components_1.default.ul `
|
11
|
-
list-style-type: none;
|
12
|
-
margin: 0;
|
13
|
-
padding: 0;
|
14
|
-
${sx_1.default};
|
15
|
-
`;
|
16
|
-
const FilterList = ({ children, ...rest }) => {
|
17
|
-
const items = react_1.default.Children.map(children, child => {
|
18
|
-
return <li>{child}</li>;
|
19
|
-
});
|
20
|
-
return <FilterListBase {...rest}>{items}</FilterListBase>;
|
21
|
-
};
|
22
|
-
const FilterListItemBase = styled_components_1.default.a `
|
23
|
-
position: relative;
|
24
|
-
display: block;
|
25
|
-
padding: ${props => (props.small ? `${constants_1.get('space.1')(props)} 10px` : `${constants_1.get('space.2')(props)} 11px`)};
|
26
|
-
margin: ${props => (props.small ? '0 0 2px' : '0 0 5px 0')};
|
27
|
-
overflow: hidden;
|
28
|
-
font-size: ${constants_1.get('fontSizes.1')};
|
29
|
-
color: ${props => (props.selected ? constants_1.get('colors.fg.onEmphasis') : constants_1.get('colors.fg.muted'))};
|
30
|
-
background-color: ${props => (props.selected ? constants_1.get('colors.accent.emphasis') : '')}!important;
|
31
|
-
text-decoration: none;
|
32
|
-
text-overflow: ellipsis;
|
33
|
-
white-space: nowrap;
|
34
|
-
cursor: pointer;
|
35
|
-
border-radius: ${constants_1.get('radii.1')};
|
36
|
-
&:hover {
|
37
|
-
text-decoration: none;
|
38
|
-
background-color: ${constants_1.get('colors.canvas.subtle')};
|
39
|
-
}
|
40
|
-
&:active {
|
41
|
-
color: ${constants_1.get('colors.fg.onEmphasis')};
|
42
|
-
background-color: ${constants_1.get('colors.accent.emphasis')};
|
43
|
-
}
|
44
|
-
.count {
|
45
|
-
float: right;
|
46
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
47
|
-
}
|
48
|
-
${sx_1.default};
|
49
|
-
`;
|
50
|
-
function FilterListItem({ children, count, ...rest }) {
|
51
|
-
return (<FilterListItemBase {...rest}>
|
52
|
-
{count && (<span title="results" className="count">
|
53
|
-
{count}
|
54
|
-
</span>)}
|
55
|
-
{children}
|
56
|
-
</FilterListItemBase>);
|
57
|
-
}
|
58
|
-
FilterListItem.displayName = 'FilterList.Item';
|
59
|
-
exports.default = Object.assign(FilterList, { Item: FilterListItem });
|
@@ -1,100 +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
|
-
exports.FilteredActionList = void 0;
|
26
|
-
const react_1 = __importStar(require("react"));
|
27
|
-
const ssr_1 = require("@react-aria/ssr");
|
28
|
-
const TextInput_1 = __importDefault(require("../TextInput"));
|
29
|
-
const Box_1 = __importDefault(require("../Box"));
|
30
|
-
const ActionList_1 = require("../ActionList");
|
31
|
-
const Spinner_1 = __importDefault(require("../Spinner"));
|
32
|
-
const useFocusZone_1 = require("../hooks/useFocusZone");
|
33
|
-
const useProvidedStateOrCreate_1 = require("../hooks/useProvidedStateOrCreate");
|
34
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
35
|
-
const constants_1 = require("../constants");
|
36
|
-
const useProvidedRefOrCreate_1 = require("../hooks/useProvidedRefOrCreate");
|
37
|
-
const useScrollFlash_1 = __importDefault(require("../hooks/useScrollFlash"));
|
38
|
-
const scrollIntoViewingArea_1 = require("../behaviors/scrollIntoViewingArea");
|
39
|
-
const StyledHeader = styled_components_1.default.div `
|
40
|
-
box-shadow: 0 1px 0 ${constants_1.get('colors.border.default')};
|
41
|
-
z-index: 1;
|
42
|
-
`;
|
43
|
-
function FilteredActionList({ loading = false, placeholderText, filterValue: externalFilterValue, onFilterChange, items, textInputProps, inputRef: providedInputRef, sx, ...listProps }) {
|
44
|
-
const [filterValue, setInternalFilterValue] = useProvidedStateOrCreate_1.useProvidedStateOrCreate(externalFilterValue, undefined, '');
|
45
|
-
const onInputChange = react_1.useCallback((e) => {
|
46
|
-
const value = e.target.value;
|
47
|
-
onFilterChange(value, e);
|
48
|
-
setInternalFilterValue(value);
|
49
|
-
}, [onFilterChange, setInternalFilterValue]);
|
50
|
-
const scrollContainerRef = react_1.useRef(null);
|
51
|
-
const listContainerRef = react_1.useRef(null);
|
52
|
-
const inputRef = useProvidedRefOrCreate_1.useProvidedRefOrCreate(providedInputRef);
|
53
|
-
const activeDescendantRef = react_1.useRef();
|
54
|
-
const listId = ssr_1.useSSRSafeId();
|
55
|
-
const onInputKeyPress = react_1.useCallback(event => {
|
56
|
-
if (event.key === 'Enter' && activeDescendantRef.current) {
|
57
|
-
event.preventDefault();
|
58
|
-
event.nativeEvent.stopImmediatePropagation();
|
59
|
-
// Forward Enter key press to active descendant so that item gets activated
|
60
|
-
const activeDescendantEvent = new KeyboardEvent(event.type, event.nativeEvent);
|
61
|
-
activeDescendantRef.current.dispatchEvent(activeDescendantEvent);
|
62
|
-
}
|
63
|
-
}, [activeDescendantRef]);
|
64
|
-
useFocusZone_1.useFocusZone({
|
65
|
-
containerRef: listContainerRef,
|
66
|
-
focusOutBehavior: 'wrap',
|
67
|
-
focusableElementFilter: element => {
|
68
|
-
return !(element instanceof HTMLInputElement);
|
69
|
-
},
|
70
|
-
activeDescendantFocus: inputRef,
|
71
|
-
onActiveDescendantChanged: (current, previous, directlyActivated) => {
|
72
|
-
activeDescendantRef.current = current;
|
73
|
-
if (current && scrollContainerRef.current && directlyActivated) {
|
74
|
-
scrollIntoViewingArea_1.scrollIntoViewingArea(current, scrollContainerRef.current);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}, [
|
78
|
-
// List ref isn't set while loading. Need to re-bind focus zone when it changes
|
79
|
-
loading
|
80
|
-
]);
|
81
|
-
react_1.useEffect(() => {
|
82
|
-
// if items changed, we want to instantly move active descendant into view
|
83
|
-
if (activeDescendantRef.current && scrollContainerRef.current) {
|
84
|
-
scrollIntoViewingArea_1.scrollIntoViewingArea(activeDescendantRef.current, scrollContainerRef.current, 'vertical', undefined, undefined, 'auto');
|
85
|
-
}
|
86
|
-
}, [items]);
|
87
|
-
useScrollFlash_1.default(scrollContainerRef);
|
88
|
-
return (<Box_1.default display="flex" flexDirection="column" overflow="hidden" sx={sx}>
|
89
|
-
<StyledHeader>
|
90
|
-
<TextInput_1.default ref={inputRef} block width="auto" color="fg.default" value={filterValue} onChange={onInputChange} onKeyPress={onInputKeyPress} placeholder={placeholderText} aria-label={placeholderText} aria-controls={listId} {...textInputProps}/>
|
91
|
-
</StyledHeader>
|
92
|
-
<Box_1.default ref={scrollContainerRef} overflow="auto">
|
93
|
-
{loading ? (<Box_1.default width="100%" display="flex" flexDirection="row" justifyContent="center" pt={6} pb={7}>
|
94
|
-
<Spinner_1.default />
|
95
|
-
</Box_1.default>) : (<ActionList_1.ActionList ref={listContainerRef} items={items} {...listProps} role="listbox" id={listId}/>)}
|
96
|
-
</Box_1.default>
|
97
|
-
</Box_1.default>);
|
98
|
-
}
|
99
|
-
exports.FilteredActionList = FilteredActionList;
|
100
|
-
FilteredActionList.displayName = 'FilteredActionList';
|
package/lib/FilteredSearch.jsx
DELETED
@@ -1,28 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const constants_1 = require("./constants");
|
8
|
-
const sx_1 = __importDefault(require("./sx"));
|
9
|
-
const FilteredSearch = styled_components_1.default.div `
|
10
|
-
display: flex;
|
11
|
-
align-items: stretch;
|
12
|
-
|
13
|
-
summary {
|
14
|
-
border-radius: 0;
|
15
|
-
border-top-left-radius: ${constants_1.get('radii.2')};
|
16
|
-
border-bottom-left-radius: ${constants_1.get('radii.2')};
|
17
|
-
border-right: 0;
|
18
|
-
}
|
19
|
-
.TextInput-wrapper {
|
20
|
-
border-radius: 0;
|
21
|
-
border-top-right-radius: ${constants_1.get('radii.2')};
|
22
|
-
border-bottom-right-radius: ${constants_1.get('radii.2')};
|
23
|
-
z-index: 1; // Allows the focus outline to show on top of the dropdown.
|
24
|
-
}
|
25
|
-
|
26
|
-
${sx_1.default}
|
27
|
-
`;
|
28
|
-
exports.default = FilteredSearch;
|
package/lib/Flash.jsx
DELETED
@@ -1,69 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const styled_system_1 = require("styled-system");
|
8
|
-
const constants_1 = require("./constants");
|
9
|
-
const sx_1 = __importDefault(require("./sx"));
|
10
|
-
const variants = styled_system_1.variant({
|
11
|
-
variants: {
|
12
|
-
default: {
|
13
|
-
color: 'fg.default',
|
14
|
-
backgroundColor: 'accent.subtle',
|
15
|
-
borderColor: 'accent.muted',
|
16
|
-
svg: {
|
17
|
-
color: 'accent.fg'
|
18
|
-
}
|
19
|
-
},
|
20
|
-
success: {
|
21
|
-
color: 'fg.default',
|
22
|
-
backgroundColor: 'success.subtle',
|
23
|
-
borderColor: 'success.muted',
|
24
|
-
svg: {
|
25
|
-
color: 'success.fg'
|
26
|
-
}
|
27
|
-
},
|
28
|
-
danger: {
|
29
|
-
color: 'fg.default',
|
30
|
-
backgroundColor: 'danger.subtle',
|
31
|
-
borderColor: 'danger.muted',
|
32
|
-
svg: {
|
33
|
-
color: 'danger.fg'
|
34
|
-
}
|
35
|
-
},
|
36
|
-
warning: {
|
37
|
-
color: 'fg.default',
|
38
|
-
backgroundColor: 'attention.subtle',
|
39
|
-
borderColor: 'attention.muted',
|
40
|
-
svg: {
|
41
|
-
color: 'attention.fg'
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
});
|
46
|
-
const Flash = styled_components_1.default.div `
|
47
|
-
position: relative;
|
48
|
-
color: ${constants_1.get('colors.fg.default')};
|
49
|
-
padding: ${constants_1.get('space.3')};
|
50
|
-
border-style: solid;
|
51
|
-
border-width: ${props => (props.full ? '1px 0px' : '1px')};
|
52
|
-
border-radius: ${props => (props.full ? '0' : constants_1.get('radii.2'))};
|
53
|
-
margin-top: ${props => (props.full ? '-1px' : '0')};
|
54
|
-
|
55
|
-
p:last-child {
|
56
|
-
margin-bottom: 0;
|
57
|
-
}
|
58
|
-
|
59
|
-
svg {
|
60
|
-
margin-right: ${constants_1.get('space.2')};
|
61
|
-
}
|
62
|
-
|
63
|
-
${variants};
|
64
|
-
${sx_1.default};
|
65
|
-
`;
|
66
|
-
Flash.defaultProps = {
|
67
|
-
variant: 'default'
|
68
|
-
};
|
69
|
-
exports.default = Flash;
|
package/lib/Flex.jsx
DELETED
@@ -1,15 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const Box_1 = __importDefault(require("./Box"));
|
8
|
-
/**
|
9
|
-
* @deprecated Use the Box component instead (i.e. <Flex> → <Box display="flex">)
|
10
|
-
*/
|
11
|
-
const Flex = styled_components_1.default(Box_1.default) ``;
|
12
|
-
Flex.defaultProps = {
|
13
|
-
display: 'flex'
|
14
|
-
};
|
15
|
-
exports.default = Flex;
|
package/lib/FormGroup.jsx
DELETED
@@ -1,22 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const constants_1 = require("./constants");
|
8
|
-
const sx_1 = __importDefault(require("./sx"));
|
9
|
-
const FormGroup = styled_components_1.default.div `
|
10
|
-
margin: ${constants_1.get('space.3')} 0;
|
11
|
-
font-weight: ${constants_1.get('fontWeights.normal')};
|
12
|
-
${sx_1.default};
|
13
|
-
`;
|
14
|
-
const FormGroupLabel = styled_components_1.default.label `
|
15
|
-
display: block;
|
16
|
-
margin: 0 0 ${constants_1.get('space.2')};
|
17
|
-
font-size: ${constants_1.get('fontSizes.1')};
|
18
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
19
|
-
${sx_1.default};
|
20
|
-
`;
|
21
|
-
FormGroupLabel.displayName = 'FormGroup.Label';
|
22
|
-
exports.default = Object.assign(FormGroup, { Label: FormGroupLabel });
|
package/lib/Grid.jsx
DELETED
@@ -1,15 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const Box_1 = __importDefault(require("./Box"));
|
8
|
-
/**
|
9
|
-
* @deprecated Use the Box component instead (i.e. <Grid> → <Box display="grid">)
|
10
|
-
*/
|
11
|
-
const Grid = styled_components_1.default(Box_1.default) ``;
|
12
|
-
Grid.defaultProps = {
|
13
|
-
display: 'grid'
|
14
|
-
};
|
15
|
-
exports.default = Grid;
|
package/lib/Header.jsx
DELETED
@@ -1,83 +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 Header = styled_components_1.default.div `
|
29
|
-
z-index: 32;
|
30
|
-
display: flex;
|
31
|
-
padding: ${constants_1.get('space.3')};
|
32
|
-
font-size: ${constants_1.get('fontSizes.1')};
|
33
|
-
line-height: ${constants_1.get('lineHeights.default')};
|
34
|
-
color: ${constants_1.get('colors.header.text')};
|
35
|
-
background-color: ${constants_1.get('colors.header.bg')};
|
36
|
-
align-items: center;
|
37
|
-
flex-wrap: nowrap;
|
38
|
-
|
39
|
-
${sx_1.default};
|
40
|
-
`;
|
41
|
-
const HeaderItem = styled_components_1.default.div `
|
42
|
-
display: flex;
|
43
|
-
margin-right: ${constants_1.get('space.3')};
|
44
|
-
align-self: stretch;
|
45
|
-
align-items: center;
|
46
|
-
flex-wrap: nowrap;
|
47
|
-
|
48
|
-
${({ full }) => full &&
|
49
|
-
styled_components_1.css `
|
50
|
-
flex: auto;
|
51
|
-
`};
|
52
|
-
|
53
|
-
${sx_1.default};
|
54
|
-
`;
|
55
|
-
HeaderItem.displayName = 'Header.Item';
|
56
|
-
const HeaderLink = styled_components_1.default.a.attrs(({ to }) => {
|
57
|
-
const isReactRouter = typeof to === 'string';
|
58
|
-
if (isReactRouter) {
|
59
|
-
// according to their docs, NavLink supports aria-current:
|
60
|
-
// https://reacttraining.com/react-router/web/api/NavLink/aria-current-string
|
61
|
-
return { 'aria-current': 'page' };
|
62
|
-
}
|
63
|
-
else {
|
64
|
-
return {};
|
65
|
-
}
|
66
|
-
}) `
|
67
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
68
|
-
color: ${constants_1.get('colors.header.logo')};
|
69
|
-
white-space: nowrap;
|
70
|
-
cursor: pointer;
|
71
|
-
text-decoration: none;
|
72
|
-
display: flex;
|
73
|
-
align-items: center;
|
74
|
-
|
75
|
-
&:hover,
|
76
|
-
&:focus {
|
77
|
-
color: ${constants_1.get('colors.header.text')};
|
78
|
-
}
|
79
|
-
|
80
|
-
${sx_1.default};
|
81
|
-
`;
|
82
|
-
HeaderLink.displayName = 'Header.Link';
|
83
|
-
exports.default = Object.assign(Header, { Link: HeaderLink, Item: HeaderItem });
|
package/lib/Heading.jsx
DELETED
@@ -1,21 +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 styled_components_1 = __importDefault(require("styled-components"));
|
7
|
-
const constants_1 = require("./constants");
|
8
|
-
const sx_1 = __importDefault(require("./sx"));
|
9
|
-
const theme_1 = __importDefault(require("./theme"));
|
10
|
-
const Heading = styled_components_1.default.h2 `
|
11
|
-
font-weight: ${constants_1.get('fontWeights.bold')};
|
12
|
-
font-size: ${constants_1.get('fontSizes.5')};
|
13
|
-
margin: 0;
|
14
|
-
${constants_1.TYPOGRAPHY};
|
15
|
-
${constants_1.COMMON};
|
16
|
-
${sx_1.default};
|
17
|
-
`;
|
18
|
-
Heading.defaultProps = {
|
19
|
-
theme: theme_1.default
|
20
|
-
};
|
21
|
-
exports.default = Heading;
|