@primer/components 0.0.0-20211030163410 → 0.0.0-20211030175556
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -28
- package/dist/browser.esm.js +591 -602
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +200 -211
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Divider.jsx +29 -0
- package/lib/ActionList/Group.jsx +23 -0
- package/lib/ActionList/Header.jsx +66 -0
- package/lib/ActionList/Item.js +3 -3
- package/lib/ActionList/Item.jsx +288 -0
- package/lib/ActionList/List.jsx +138 -0
- package/lib/ActionList/index.js +12 -23
- package/lib/ActionList2/Description.jsx +29 -0
- package/lib/ActionList2/Divider.jsx +22 -0
- package/lib/ActionList2/Group.jsx +54 -0
- package/lib/ActionList2/Header.d.ts +26 -0
- package/lib/ActionList2/Header.js +55 -0
- package/lib/ActionList2/Header.jsx +36 -0
- package/lib/ActionList2/Item.js +1 -3
- package/lib/ActionList2/Item.jsx +174 -0
- package/lib/ActionList2/LinkItem.jsx +28 -0
- package/lib/ActionList2/List.js +2 -1
- package/lib/ActionList2/List.jsx +41 -0
- package/lib/ActionList2/Selection.js +1 -3
- package/lib/ActionList2/Selection.jsx +50 -0
- package/lib/ActionList2/Visuals.jsx +48 -0
- package/lib/ActionList2/index.js +23 -41
- package/lib/ActionMenu.jsx +73 -0
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +100 -0
- package/lib/AnchoredOverlay/index.js +4 -12
- package/lib/Autocomplete/Autocomplete.d.ts +0 -1
- package/lib/Autocomplete/Autocomplete.jsx +100 -0
- package/lib/Autocomplete/AutocompleteContext.jsx +5 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -1
- package/lib/Autocomplete/AutocompleteInput.jsx +113 -0
- package/lib/Autocomplete/AutocompleteMenu.js +13 -6
- package/lib/Autocomplete/AutocompleteMenu.jsx +190 -0
- package/lib/Autocomplete/AutocompleteOverlay.jsx +55 -0
- package/lib/Autocomplete/index.js +7 -14
- package/lib/Avatar.jsx +34 -0
- package/lib/AvatarPair.jsx +29 -0
- package/lib/AvatarStack.jsx +151 -0
- package/lib/BaseStyles.jsx +65 -0
- package/lib/BorderBox.jsx +18 -0
- package/lib/Box.jsx +10 -0
- package/lib/BranchName.jsx +20 -0
- package/lib/Breadcrumbs.jsx +71 -0
- package/lib/Button/Button.d.ts +0 -1
- package/lib/Button/Button.jsx +40 -0
- package/lib/Button/ButtonBase.jsx +33 -0
- package/lib/Button/ButtonClose.d.ts +1 -2
- package/lib/Button/ButtonClose.jsx +53 -0
- package/lib/Button/ButtonDanger.d.ts +0 -1
- package/lib/Button/ButtonDanger.jsx +43 -0
- package/lib/Button/ButtonGroup.jsx +55 -0
- package/lib/Button/ButtonInvisible.d.ts +0 -1
- package/lib/Button/ButtonInvisible.jsx +32 -0
- package/lib/Button/ButtonOutline.d.ts +0 -1
- package/lib/Button/ButtonOutline.jsx +43 -0
- package/lib/Button/ButtonPrimary.d.ts +0 -1
- package/lib/Button/ButtonPrimary.jsx +42 -0
- package/lib/Button/ButtonStyles.jsx +37 -0
- package/lib/Button/ButtonTableList.jsx +46 -0
- package/lib/Button/index.js +21 -70
- package/lib/Caret.jsx +93 -0
- package/lib/CircleBadge.jsx +42 -0
- package/lib/CircleOcticon.d.ts +0 -1
- package/lib/CircleOcticon.jsx +21 -0
- package/lib/CounterLabel.jsx +43 -0
- package/lib/Details.jsx +21 -0
- package/lib/Dialog/ConfirmationDialog.jsx +146 -0
- package/lib/Dialog/Dialog.jsx +279 -0
- package/lib/Dialog.d.ts +2 -3
- package/lib/Dialog.jsx +129 -0
- package/lib/Dropdown.d.ts +0 -4
- package/lib/Dropdown.jsx +131 -0
- package/lib/DropdownMenu/DropdownButton.d.ts +1 -2
- package/lib/DropdownMenu/DropdownButton.jsx +14 -0
- package/lib/DropdownMenu/DropdownMenu.jsx +70 -0
- package/lib/DropdownMenu/index.js +6 -20
- package/lib/DropdownStyles.js +18 -26
- package/lib/FilterList.d.ts +0 -1
- package/lib/FilterList.jsx +59 -0
- package/lib/FilteredActionList/FilteredActionList.jsx +100 -0
- package/lib/FilteredActionList/index.js +4 -12
- package/lib/FilteredSearch.jsx +28 -0
- package/lib/Flash.jsx +69 -0
- package/lib/Flex.jsx +15 -0
- package/lib/FormGroup.jsx +22 -0
- package/lib/Grid.jsx +15 -0
- package/lib/Header.jsx +83 -0
- package/lib/Heading.jsx +21 -0
- package/lib/Label.jsx +82 -0
- package/lib/LabelGroup.jsx +18 -0
- package/lib/Link.jsx +36 -0
- package/lib/NewButton/button-counter.jsx +14 -0
- package/lib/NewButton/button.jsx +279 -0
- package/lib/NewButton/index.js +5 -12
- package/lib/NewButton/types.js +2 -1
- package/lib/Overlay.d.ts +3 -5
- package/lib/Overlay.jsx +154 -0
- package/lib/Pagehead.jsx +17 -0
- package/lib/Pagination/Pagination.jsx +161 -0
- package/lib/Pagination/index.js +6 -12
- package/lib/Pagination/model.jsx +174 -0
- package/lib/PointerBox.jsx +25 -0
- package/lib/Popover.jsx +202 -0
- package/lib/Portal/Portal.jsx +79 -0
- package/lib/Portal/index.js +5 -16
- package/lib/Position.d.ts +4 -4
- package/lib/Position.jsx +46 -0
- package/lib/ProgressBar.jsx +39 -0
- package/lib/SelectMenu/SelectMenu.d.ts +4 -10
- package/lib/SelectMenu/SelectMenu.jsx +112 -0
- package/lib/SelectMenu/SelectMenuContext.jsx +5 -0
- package/lib/SelectMenu/SelectMenuDivider.jsx +42 -0
- package/lib/SelectMenu/SelectMenuFilter.jsx +58 -0
- package/lib/SelectMenu/SelectMenuFooter.jsx +45 -0
- package/lib/SelectMenu/SelectMenuHeader.jsx +42 -0
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.jsx +142 -0
- package/lib/SelectMenu/SelectMenuList.jsx +59 -0
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +22 -0
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.jsx +118 -0
- package/lib/SelectMenu/SelectMenuTab.jsx +92 -0
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +42 -0
- package/lib/SelectMenu/SelectMenuTabs.jsx +57 -0
- package/lib/SelectMenu/hooks/useKeyboardNav.js +80 -96
- package/lib/SelectMenu/index.js +7 -14
- package/lib/SelectPanel/SelectPanel.jsx +105 -0
- package/lib/SelectPanel/index.js +4 -12
- package/lib/SideNav.jsx +173 -0
- package/lib/Spinner.jsx +35 -0
- package/lib/StateLabel.jsx +93 -0
- package/lib/StyledOcticon.jsx +18 -0
- package/lib/SubNav.jsx +101 -0
- package/lib/TabNav.jsx +58 -0
- package/lib/Text.jsx +14 -0
- package/lib/TextInput.jsx +23 -0
- package/lib/TextInputWithTokens.d.ts +0 -1
- package/lib/TextInputWithTokens.jsx +218 -0
- package/lib/ThemeProvider.jsx +130 -0
- package/lib/Timeline.jsx +123 -0
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/AvatarToken.jsx +54 -0
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.jsx +125 -0
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/Token.jsx +103 -0
- package/lib/Token/TokenBase.jsx +88 -0
- package/lib/Token/_RemoveTokenButton.jsx +108 -0
- package/lib/Token/_TokenTextContainer.jsx +49 -0
- package/lib/Token/index.js +11 -30
- package/lib/Tooltip.jsx +246 -0
- package/lib/Truncate.jsx +24 -0
- package/lib/UnderlineNav.jsx +88 -0
- package/lib/_TextInputWrapper.jsx +120 -0
- package/lib/_UnstyledTextInput.jsx +22 -0
- package/lib/behaviors/anchoredPosition.js +205 -234
- package/lib/behaviors/focusTrap.js +121 -157
- package/lib/behaviors/focusZone.js +434 -509
- package/lib/behaviors/scrollIntoViewingArea.js +18 -35
- package/lib/constants.js +39 -43
- package/lib/drafts.js +20 -30
- package/lib/hooks/index.js +16 -60
- package/lib/hooks/useAnchoredPosition.js +32 -40
- package/lib/hooks/useCombinedRefs.js +32 -36
- package/lib/hooks/useDetails.jsx +39 -0
- package/lib/hooks/useDialog.js +72 -96
- package/lib/hooks/useFocusTrap.js +43 -60
- package/lib/hooks/useFocusZone.js +54 -50
- package/lib/hooks/useOnEscapePress.js +25 -36
- package/lib/hooks/useOnOutsideClick.jsx +61 -0
- package/lib/hooks/useOpenAndCloseFocus.js +22 -34
- package/lib/hooks/useOverlay.jsx +15 -0
- package/lib/hooks/useProvidedRefOrCreate.js +10 -14
- package/lib/hooks/useProvidedStateOrCreate.js +13 -16
- package/lib/hooks/useRenderForcingRef.js +13 -17
- package/lib/hooks/useResizeObserver.js +15 -18
- package/lib/hooks/useSafeTimeout.js +22 -30
- package/lib/hooks/useScrollFlash.js +16 -23
- package/lib/index.d.ts +0 -5
- package/lib/index.js +163 -676
- package/lib/polyfills/eventListenerSignal.js +37 -45
- package/lib/sx.js +10 -22
- package/lib/theme-preval.js +64 -3169
- package/lib/theme.js +3 -12
- package/lib/utils/create-slots.jsx +65 -0
- package/lib/utils/deprecate.jsx +59 -0
- package/lib/utils/isNumeric.jsx +7 -0
- package/lib/utils/iterateFocusableElements.js +63 -85
- package/lib/utils/ssr.jsx +6 -0
- package/lib/utils/test-deprecations.jsx +20 -0
- package/lib/utils/test-helpers.jsx +8 -0
- package/lib/utils/test-matchers.jsx +100 -0
- package/lib/utils/testing.d.ts +1 -2
- package/lib/utils/testing.js +0 -29
- package/lib/utils/testing.jsx +206 -0
- package/lib/utils/theme.js +33 -47
- package/lib/utils/types/AriaRole.js +2 -1
- package/lib/utils/types/ComponentProps.js +2 -1
- package/lib/utils/types/Flatten.js +2 -1
- package/lib/utils/types/KeyPaths.js +2 -1
- package/lib/utils/types/MandateProps.js +16 -1
- package/lib/utils/types/Merge.js +2 -1
- package/lib/utils/types/index.js +16 -69
- package/lib/utils/uniqueId.js +5 -8
- package/lib/utils/use-force-update.js +8 -14
- package/lib/utils/useIsomorphicLayoutEffect.js +8 -11
- package/lib/utils/userAgent.js +8 -12
- package/lib-esm/ActionList/Item.js +3 -3
- package/lib-esm/ActionList2/Header.d.ts +26 -0
- package/lib-esm/ActionList2/Header.js +44 -0
- package/lib-esm/ActionList2/Item.js +1 -3
- package/lib-esm/ActionList2/List.js +2 -1
- package/lib-esm/ActionList2/Selection.js +1 -3
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -1
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -1
- package/lib-esm/Autocomplete/AutocompleteMenu.js +13 -3
- package/lib-esm/Button/Button.d.ts +0 -1
- package/lib-esm/Button/ButtonClose.d.ts +1 -2
- package/lib-esm/Button/ButtonDanger.d.ts +0 -1
- package/lib-esm/Button/ButtonInvisible.d.ts +0 -1
- package/lib-esm/Button/ButtonOutline.d.ts +0 -1
- package/lib-esm/Button/ButtonPrimary.d.ts +0 -1
- package/lib-esm/CircleOcticon.d.ts +0 -1
- package/lib-esm/Dialog.d.ts +2 -3
- package/lib-esm/Dropdown.d.ts +0 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +1 -2
- package/lib-esm/FilterList.d.ts +0 -1
- package/lib-esm/Overlay.d.ts +3 -5
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +4 -10
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +0 -1
- 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 +0 -5
- package/lib-esm/index.js +0 -4
- package/lib-esm/theme-preval.js +0 -446
- package/lib-esm/utils/testing.d.ts +1 -2
- package/lib-esm/utils/testing.js +0 -24
- package/package.json +6 -5
- package/lib/Checkbox.d.ts +0 -29
- package/lib/Checkbox.js +0 -64
- package/lib/CheckboxInputField.d.ts +0 -11
- package/lib/CheckboxInputField.js +0 -74
- package/lib/RadioInputField.d.ts +0 -9
- package/lib/RadioInputField.js +0 -83
- package/lib/TextInputField.d.ts +0 -581
- package/lib/TextInputField.js +0 -66
- package/lib/_InputCaption.d.ts +0 -6
- package/lib/_InputCaption.js +0 -23
- package/lib/_InputField/InputField.d.ts +0 -39
- package/lib/_InputField/InputField.js +0 -90
- package/lib/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib/_InputField/InputFieldCaption.js +0 -28
- package/lib/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib/_InputField/InputFieldLabel.js +0 -34
- package/lib/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib/_InputField/InputFieldValidation.js +0 -17
- package/lib/_InputField/ToggleInputField.d.ts +0 -13
- package/lib/_InputField/ToggleInputField.js +0 -71
- package/lib/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib/_InputField/ToggleInputLeadingVisual.js +0 -22
- package/lib/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib/_InputField/ValidationAnimationContainer.js +0 -48
- package/lib/_InputField/index.d.ts +0 -1
- package/lib/_InputField/index.js +0 -15
- package/lib/_InputField/slots.d.ts +0 -13
- package/lib/_InputField/slots.js +0 -17
- package/lib/_InputLabel.d.ts +0 -8
- package/lib/_InputLabel.js +0 -44
- package/lib/_InputValidation.d.ts +0 -8
- package/lib/_InputValidation.js +0 -56
- package/lib/_VisuallyHidden.d.ts +0 -6
- package/lib/_VisuallyHidden.js +0 -39
- package/lib/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib/utils/types/FormValidationStatus.js +0 -1
- package/lib-esm/Checkbox.d.ts +0 -29
- package/lib-esm/Checkbox.js +0 -44
- package/lib-esm/CheckboxInputField.d.ts +0 -11
- package/lib-esm/CheckboxInputField.js +0 -57
- package/lib-esm/RadioInputField.d.ts +0 -9
- package/lib-esm/RadioInputField.js +0 -66
- package/lib-esm/TextInputField.d.ts +0 -581
- package/lib-esm/TextInputField.js +0 -50
- package/lib-esm/_InputCaption.d.ts +0 -6
- package/lib-esm/_InputCaption.js +0 -12
- package/lib-esm/_InputField/InputField.d.ts +0 -39
- package/lib-esm/_InputField/InputField.js +0 -70
- package/lib-esm/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib-esm/_InputField/InputFieldCaption.js +0 -16
- package/lib-esm/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib-esm/_InputField/InputFieldLabel.js +0 -22
- package/lib-esm/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib-esm/_InputField/InputFieldValidation.js +0 -7
- package/lib-esm/_InputField/ToggleInputField.d.ts +0 -13
- package/lib-esm/_InputField/ToggleInputField.js +0 -54
- package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib-esm/_InputField/ToggleInputLeadingVisual.js +0 -11
- package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib-esm/_InputField/ValidationAnimationContainer.js +0 -33
- package/lib-esm/_InputField/index.d.ts +0 -1
- package/lib-esm/_InputField/index.js +0 -1
- package/lib-esm/_InputField/slots.d.ts +0 -13
- package/lib-esm/_InputField/slots.js +0 -5
- package/lib-esm/_InputLabel.d.ts +0 -8
- package/lib-esm/_InputLabel.js +0 -32
- package/lib-esm/_InputValidation.d.ts +0 -8
- package/lib-esm/_InputValidation.js +0 -43
- package/lib-esm/_VisuallyHidden.d.ts +0 -6
- package/lib-esm/_VisuallyHidden.js +0 -26
- package/lib-esm/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib-esm/utils/types/FormValidationStatus.js +0 -1
@@ -268,7 +268,6 @@ declare const ButtonDanger: import("styled-components").StyledComponent<"button"
|
|
268
268
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
272
271
|
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
273
272
|
disabled?: boolean | undefined;
|
274
273
|
autoFocus?: boolean | undefined;
|
@@ -0,0 +1,43 @@
|
|
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 ButtonBase_1 = __importDefault(require("./ButtonBase"));
|
10
|
+
const ButtonDanger = styled_components_1.default(ButtonBase_1.default) `
|
11
|
+
color: ${constants_1.get('colors.btn.danger.text')};
|
12
|
+
border: 1px solid ${constants_1.get('colors.btn.border')};
|
13
|
+
background-color: ${constants_1.get('colors.btn.bg')};
|
14
|
+
box-shadow: ${constants_1.get('shadows.btn.shadow')};
|
15
|
+
|
16
|
+
&:hover {
|
17
|
+
color: ${constants_1.get('colors.btn.danger.hoverText')};
|
18
|
+
background-color: ${constants_1.get('colors.btn.danger.hoverBg')};
|
19
|
+
border-color: ${constants_1.get('colors.btn.danger.hoverBorder')};
|
20
|
+
box-shadow: ${constants_1.get('shadows.btn.danger.hoverShadow')};
|
21
|
+
}
|
22
|
+
// focus must come before :active so that the active box shadow overrides
|
23
|
+
&:focus {
|
24
|
+
border-color: ${constants_1.get('colors.btn.danger.focusBorder')};
|
25
|
+
box-shadow: ${constants_1.get('shadows.btn.danger.focusShadow')};
|
26
|
+
}
|
27
|
+
|
28
|
+
&:active {
|
29
|
+
color: ${constants_1.get('colors.btn.danger.selectedText')};
|
30
|
+
background-color: ${constants_1.get('colors.btn.danger.selectedBg')};
|
31
|
+
box-shadow: ${constants_1.get('shadows.btn.danger.selectedShadow')};
|
32
|
+
border-color: ${constants_1.get('colors.btn.danger.selectedBorder')};
|
33
|
+
}
|
34
|
+
|
35
|
+
&:disabled {
|
36
|
+
color: ${constants_1.get('colors.btn.danger.disabledText')};
|
37
|
+
background-color: ${constants_1.get('colors.btn.danger.disabledBg')};
|
38
|
+
border-color: ${constants_1.get('colors.btn.danger.disabledBorder')};
|
39
|
+
}
|
40
|
+
|
41
|
+
${sx_1.default};
|
42
|
+
`;
|
43
|
+
exports.default = ButtonDanger;
|
@@ -0,0 +1,55 @@
|
|
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
|
+
const constants_1 = require("../constants");
|
9
|
+
const sx_1 = __importDefault(require("../sx"));
|
10
|
+
const ButtonGroup = styled_components_1.default(Box_1.default) `
|
11
|
+
vertical-align: middle;
|
12
|
+
|
13
|
+
&& > * {
|
14
|
+
position: relative;
|
15
|
+
border-right-width: 0;
|
16
|
+
border-radius: 0;
|
17
|
+
|
18
|
+
:first-child {
|
19
|
+
border-top-left-radius: ${constants_1.get('radii.2')};
|
20
|
+
border-bottom-left-radius: ${constants_1.get('radii.2')};
|
21
|
+
margin-right: 0;
|
22
|
+
}
|
23
|
+
|
24
|
+
:not(:first-child) {
|
25
|
+
margin-left: 0;
|
26
|
+
margin-right: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
:last-child {
|
30
|
+
border-right-width: 1px;
|
31
|
+
border-top-right-radius: ${constants_1.get('radii.2')};
|
32
|
+
border-bottom-right-radius: ${constants_1.get('radii.2')};
|
33
|
+
}
|
34
|
+
|
35
|
+
:focus,
|
36
|
+
:active,
|
37
|
+
:hover {
|
38
|
+
border-right-width: 1px;
|
39
|
+
+ * {
|
40
|
+
border-left-width: 0;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
:focus,
|
45
|
+
:active {
|
46
|
+
z-index: 1;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
${sx_1.default};
|
51
|
+
`;
|
52
|
+
ButtonGroup.defaultProps = {
|
53
|
+
display: 'inline-block'
|
54
|
+
};
|
55
|
+
exports.default = ButtonGroup;
|
@@ -268,7 +268,6 @@ declare const ButtonInvisible: import("styled-components").StyledComponent<"butt
|
|
268
268
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
272
271
|
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
273
272
|
disabled?: boolean | undefined;
|
274
273
|
autoFocus?: boolean | undefined;
|
@@ -0,0 +1,32 @@
|
|
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 ButtonBase_1 = __importDefault(require("./ButtonBase"));
|
10
|
+
const ButtonInvisible = styled_components_1.default(ButtonBase_1.default) `
|
11
|
+
color: ${constants_1.get('colors.accent.fg')};
|
12
|
+
background-color: transparent;
|
13
|
+
border: 0;
|
14
|
+
border-radius: ${constants_1.get('radii.2')};
|
15
|
+
box-shadow: none;
|
16
|
+
|
17
|
+
&:disabled {
|
18
|
+
color: ${constants_1.get('colors.primer.fg.disabled')};
|
19
|
+
}
|
20
|
+
&:focus {
|
21
|
+
box-shadow: ${constants_1.get('shadows.btn.focusShadow')};
|
22
|
+
}
|
23
|
+
&:hover {
|
24
|
+
background-color: ${constants_1.get('colors.btn.hoverBg')};
|
25
|
+
}
|
26
|
+
&:active {
|
27
|
+
background-color: ${constants_1.get('colors.btn.selectedBg')};
|
28
|
+
}
|
29
|
+
|
30
|
+
${sx_1.default}
|
31
|
+
`;
|
32
|
+
exports.default = ButtonInvisible;
|
@@ -268,7 +268,6 @@ declare const ButtonOutline: import("styled-components").StyledComponent<"button
|
|
268
268
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
272
271
|
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
273
272
|
disabled?: boolean | undefined;
|
274
273
|
autoFocus?: boolean | undefined;
|
@@ -0,0 +1,43 @@
|
|
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 ButtonBase_1 = __importDefault(require("./ButtonBase"));
|
10
|
+
const ButtonOutline = styled_components_1.default(ButtonBase_1.default) `
|
11
|
+
color: ${constants_1.get('colors.btn.outline.text')};
|
12
|
+
border: 1px solid ${constants_1.get('colors.btn.border')};
|
13
|
+
background-color: ${constants_1.get('colors.btn.bg')};
|
14
|
+
box-shadow: ${constants_1.get('shadows.btn.shadow')};
|
15
|
+
|
16
|
+
&:hover {
|
17
|
+
color: ${constants_1.get('colors.btn.outline.hoverText')};
|
18
|
+
background-color: ${constants_1.get('colors.btn.outline.hoverBg')};
|
19
|
+
border-color: ${constants_1.get('colors.btn.outline.hoverBorder')};
|
20
|
+
box-shadow: ${constants_1.get('shadows.btn.outline.hoverShadow')};
|
21
|
+
}
|
22
|
+
// focus must come before :active so that the active box shadow overrides
|
23
|
+
&:focus {
|
24
|
+
border-color: ${constants_1.get('colors.btn.outline.focusBorder')};
|
25
|
+
box-shadow: ${constants_1.get('shadows.btn.outline.focusShadow')};
|
26
|
+
}
|
27
|
+
|
28
|
+
&:active {
|
29
|
+
color: ${constants_1.get('colors.btn.outline.selectedText')};
|
30
|
+
background-color: ${constants_1.get('colors.btn.outline.selectedBg')};
|
31
|
+
box-shadow: ${constants_1.get('shadows.btn.outline.selectedShadow')};
|
32
|
+
border-color: ${constants_1.get('colors.btn.outline.selectedBorder')};
|
33
|
+
}
|
34
|
+
|
35
|
+
&:disabled {
|
36
|
+
color: ${constants_1.get('colors.btn.outline.disabledText')};
|
37
|
+
background-color: ${constants_1.get('colors.btn.outline.disabledBg')};
|
38
|
+
border-color: ${constants_1.get('colors.btn.border')};
|
39
|
+
}
|
40
|
+
|
41
|
+
${sx_1.default};
|
42
|
+
`;
|
43
|
+
exports.default = ButtonOutline;
|
@@ -268,7 +268,6 @@ export declare const ButtonPrimary: import("styled-components").StyledComponent<
|
|
268
268
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
270
270
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
271
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
272
271
|
as?: string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
|
273
272
|
disabled?: boolean | undefined;
|
274
273
|
autoFocus?: boolean | undefined;
|
@@ -0,0 +1,42 @@
|
|
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.ButtonPrimary = void 0;
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
8
|
+
const constants_1 = require("../constants");
|
9
|
+
const sx_1 = __importDefault(require("../sx"));
|
10
|
+
const ButtonBase_1 = __importDefault(require("./ButtonBase"));
|
11
|
+
exports.ButtonPrimary = styled_components_1.default(ButtonBase_1.default) `
|
12
|
+
color: ${constants_1.get('colors.btn.primary.text')};
|
13
|
+
border: 1px solid ${constants_1.get('colors.btn.primary.border')};
|
14
|
+
background-color: ${constants_1.get('colors.btn.primary.bg')};
|
15
|
+
box-shadow: ${constants_1.get('shadows.btn.primary.shadow')};
|
16
|
+
|
17
|
+
&:hover {
|
18
|
+
color: ${constants_1.get('colors.btn.primary.hoverText')};
|
19
|
+
background-color: ${constants_1.get('colors.btn.primary.hoverBg')};
|
20
|
+
border-color: ${constants_1.get('colors.btn.primary.hoverBorder')};
|
21
|
+
box-shadow: ${constants_1.get('shadows.btn.primary.hoverShadow')};
|
22
|
+
}
|
23
|
+
// focus must come before :active so that the active box shadow overrides
|
24
|
+
&:focus {
|
25
|
+
border-color: ${constants_1.get('colors.btn.primary.focusBorder')};
|
26
|
+
box-shadow: ${constants_1.get('shadows.btn.primary.focusShadow')};
|
27
|
+
}
|
28
|
+
|
29
|
+
&:active {
|
30
|
+
background-color: ${constants_1.get('colors.btn.primary.selectedBg')};
|
31
|
+
box-shadow: ${constants_1.get('shadows.btn.primary.selectedShadow')};
|
32
|
+
}
|
33
|
+
|
34
|
+
&:disabled {
|
35
|
+
color: ${constants_1.get('colors.btn.primary.disabledText')};
|
36
|
+
background-color: ${constants_1.get('colors.btn.primary.disabledBg')};
|
37
|
+
border-color: ${constants_1.get('colors.btn.primary.disabledBorder')};
|
38
|
+
}
|
39
|
+
|
40
|
+
${sx_1.default};
|
41
|
+
`;
|
42
|
+
exports.default = exports.ButtonPrimary;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const styled_components_1 = require("styled-components");
|
4
|
+
const constants_1 = require("../constants");
|
5
|
+
exports.default = styled_components_1.css `
|
6
|
+
position: relative;
|
7
|
+
display: inline-block;
|
8
|
+
padding: 6px 16px;
|
9
|
+
font-family: inherit;
|
10
|
+
font-weight: ${constants_1.get('fontWeights.bold')};
|
11
|
+
line-height: 20px;
|
12
|
+
white-space: nowrap;
|
13
|
+
vertical-align: middle;
|
14
|
+
cursor: pointer;
|
15
|
+
user-select: none;
|
16
|
+
border-radius: ${constants_1.get('radii.2')};
|
17
|
+
appearance: none;
|
18
|
+
text-decoration: none;
|
19
|
+
text-align: center;
|
20
|
+
|
21
|
+
&:hover {
|
22
|
+
// needed to override link styles
|
23
|
+
text-decoration: none;
|
24
|
+
}
|
25
|
+
|
26
|
+
&:focus {
|
27
|
+
outline: none;
|
28
|
+
}
|
29
|
+
|
30
|
+
&:disabled {
|
31
|
+
cursor: default;
|
32
|
+
}
|
33
|
+
|
34
|
+
&:disabled svg {
|
35
|
+
opacity: 0.6;
|
36
|
+
}
|
37
|
+
`;
|
@@ -0,0 +1,46 @@
|
|
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 ButtonTableList = styled_components_1.default.summary `
|
10
|
+
display: inline-block;
|
11
|
+
padding: 0;
|
12
|
+
font-size: ${constants_1.get('fontSizes.1')};
|
13
|
+
color: ${constants_1.get('colors.fg.muted')};
|
14
|
+
text-decoration: none;
|
15
|
+
white-space: nowrap;
|
16
|
+
cursor: pointer;
|
17
|
+
user-select: none;
|
18
|
+
background-color: transparent;
|
19
|
+
border: 0;
|
20
|
+
appearance: none; // Corrects inability to style clickable input types in iOS.
|
21
|
+
|
22
|
+
&:hover {
|
23
|
+
text-decoration: underline;
|
24
|
+
}
|
25
|
+
|
26
|
+
&:disabled {
|
27
|
+
&,
|
28
|
+
&:hover {
|
29
|
+
color: ${constants_1.get('colors.primer.fg.disabled')};
|
30
|
+
cursor: default;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
&:after {
|
35
|
+
display: inline-block;
|
36
|
+
margin-left: ${constants_1.get('space.1')};
|
37
|
+
width: 0;
|
38
|
+
height: 0;
|
39
|
+
vertical-align: -2px;
|
40
|
+
content: '';
|
41
|
+
border: 4px solid transparent;
|
42
|
+
border-top-color: currentcolor;
|
43
|
+
}
|
44
|
+
${sx_1.default};
|
45
|
+
`;
|
46
|
+
exports.default = ButtonTableList;
|
package/lib/Button/index.js
CHANGED
@@ -1,71 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
});
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Object.defineProperty(exports, "
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Object.defineProperty(exports, "
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
});
|
24
|
-
Object.defineProperty(exports, "ButtonOutline", {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () {
|
27
|
-
return _ButtonOutline.default;
|
28
|
-
}
|
29
|
-
});
|
30
|
-
Object.defineProperty(exports, "ButtonPrimary", {
|
31
|
-
enumerable: true,
|
32
|
-
get: function () {
|
33
|
-
return _ButtonPrimary.default;
|
34
|
-
}
|
35
|
-
});
|
36
|
-
Object.defineProperty(exports, "ButtonInvisible", {
|
37
|
-
enumerable: true,
|
38
|
-
get: function () {
|
39
|
-
return _ButtonInvisible.default;
|
40
|
-
}
|
41
|
-
});
|
42
|
-
Object.defineProperty(exports, "ButtonTableList", {
|
43
|
-
enumerable: true,
|
44
|
-
get: function () {
|
45
|
-
return _ButtonTableList.default;
|
46
|
-
}
|
47
|
-
});
|
48
|
-
Object.defineProperty(exports, "ButtonClose", {
|
49
|
-
enumerable: true,
|
50
|
-
get: function () {
|
51
|
-
return _ButtonClose.default;
|
52
|
-
}
|
53
|
-
});
|
54
|
-
|
55
|
-
var _Button = _interopRequireDefault(require("./Button"));
|
56
|
-
|
57
|
-
var _ButtonDanger = _interopRequireDefault(require("./ButtonDanger"));
|
58
|
-
|
59
|
-
var _ButtonGroup = _interopRequireDefault(require("./ButtonGroup"));
|
60
|
-
|
61
|
-
var _ButtonOutline = _interopRequireDefault(require("./ButtonOutline"));
|
62
|
-
|
63
|
-
var _ButtonPrimary = _interopRequireDefault(require("./ButtonPrimary"));
|
64
|
-
|
65
|
-
var _ButtonInvisible = _interopRequireDefault(require("./ButtonInvisible"));
|
66
|
-
|
67
|
-
var _ButtonTableList = _interopRequireDefault(require("./ButtonTableList"));
|
68
|
-
|
69
|
-
var _ButtonClose = _interopRequireDefault(require("./ButtonClose"));
|
70
|
-
|
71
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
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.ButtonClose = exports.ButtonTableList = exports.ButtonInvisible = exports.ButtonPrimary = exports.ButtonOutline = exports.ButtonGroup = exports.ButtonDanger = exports.default = void 0;
|
7
|
+
var Button_1 = require("./Button");
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Button_1).default; } });
|
9
|
+
var ButtonDanger_1 = require("./ButtonDanger");
|
10
|
+
Object.defineProperty(exports, "ButtonDanger", { enumerable: true, get: function () { return __importDefault(ButtonDanger_1).default; } });
|
11
|
+
var ButtonGroup_1 = require("./ButtonGroup");
|
12
|
+
Object.defineProperty(exports, "ButtonGroup", { enumerable: true, get: function () { return __importDefault(ButtonGroup_1).default; } });
|
13
|
+
var ButtonOutline_1 = require("./ButtonOutline");
|
14
|
+
Object.defineProperty(exports, "ButtonOutline", { enumerable: true, get: function () { return __importDefault(ButtonOutline_1).default; } });
|
15
|
+
var ButtonPrimary_1 = require("./ButtonPrimary");
|
16
|
+
Object.defineProperty(exports, "ButtonPrimary", { enumerable: true, get: function () { return __importDefault(ButtonPrimary_1).default; } });
|
17
|
+
var ButtonInvisible_1 = require("./ButtonInvisible");
|
18
|
+
Object.defineProperty(exports, "ButtonInvisible", { enumerable: true, get: function () { return __importDefault(ButtonInvisible_1).default; } });
|
19
|
+
var ButtonTableList_1 = require("./ButtonTableList");
|
20
|
+
Object.defineProperty(exports, "ButtonTableList", { enumerable: true, get: function () { return __importDefault(ButtonTableList_1).default; } });
|
21
|
+
var ButtonClose_1 = require("./ButtonClose");
|
22
|
+
Object.defineProperty(exports, "ButtonClose", { enumerable: true, get: function () { return __importDefault(ButtonClose_1).default; } });
|
package/lib/Caret.jsx
ADDED
@@ -0,0 +1,93 @@
|
|
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 = require("styled-components");
|
8
|
+
const styled_system_1 = require("styled-system");
|
9
|
+
const oppositeEdge = {
|
10
|
+
top: 'Bottom',
|
11
|
+
right: 'Left',
|
12
|
+
bottom: 'Top',
|
13
|
+
left: 'Right'
|
14
|
+
};
|
15
|
+
const perpendicularEdge = {
|
16
|
+
top: 'Left',
|
17
|
+
right: 'Top',
|
18
|
+
bottom: 'Left',
|
19
|
+
left: 'Top'
|
20
|
+
};
|
21
|
+
function getEdgeAlign(location) {
|
22
|
+
const [edge, align] = location.split('-');
|
23
|
+
return [edge, align];
|
24
|
+
}
|
25
|
+
function getPosition(edge, align, spacing) {
|
26
|
+
const opposite = oppositeEdge[edge].toLowerCase();
|
27
|
+
const perp = perpendicularEdge[edge].toLowerCase();
|
28
|
+
return {
|
29
|
+
[opposite]: '100%',
|
30
|
+
[align || perp]: align ? spacing : '50%'
|
31
|
+
};
|
32
|
+
}
|
33
|
+
const getBg = styled_system_1.style({ prop: 'bg', key: 'colors' });
|
34
|
+
const getBorderColor = styled_system_1.style({ prop: 'borderColor', key: 'colors' });
|
35
|
+
const getBorderWidth = styled_system_1.style({ prop: 'borderWidth', key: 'borderWidths', scale: [0, 1] });
|
36
|
+
function Caret(props) {
|
37
|
+
const theme = react_1.default.useContext(styled_components_1.ThemeContext);
|
38
|
+
const propsWithTheme = { ...props, theme: props.theme ?? theme };
|
39
|
+
const { bg } = getBg(propsWithTheme);
|
40
|
+
const { borderColor } = getBorderColor(propsWithTheme);
|
41
|
+
const { borderWidth } = getBorderWidth(propsWithTheme);
|
42
|
+
const { size = 8, location = 'bottom' } = props;
|
43
|
+
const [edge, align] = getEdgeAlign(location);
|
44
|
+
const perp = perpendicularEdge[edge];
|
45
|
+
// note: these arrays represent points in the form [x, y]
|
46
|
+
const a = [-size, 0];
|
47
|
+
const b = [0, size];
|
48
|
+
const c = [size, 0];
|
49
|
+
// spaces are optional in path `d` attribute, and points are
|
50
|
+
// represented in the form `x,y` -- which is what the arrays above
|
51
|
+
// become when stringified!
|
52
|
+
const triangle = `M${a}L${b}L${c}L${a}Z`;
|
53
|
+
const line = `M${a}L${b}L${c}`;
|
54
|
+
const transform = {
|
55
|
+
top: `translate(${[size, size * 2]}) rotate(180)`,
|
56
|
+
right: `translate(${[0, size]}) rotate(-90)`,
|
57
|
+
bottom: `translate(${[size, 0]})`,
|
58
|
+
left: `translate(${[size * 2, size]}) rotate(90)`
|
59
|
+
}[edge];
|
60
|
+
return (<svg width={size * 2} height={size * 2} style={{
|
61
|
+
pointerEvents: 'none',
|
62
|
+
position: 'absolute',
|
63
|
+
...getPosition(edge, align, size),
|
64
|
+
// if align is set (top|right|bottom|left),
|
65
|
+
// then we don't need an offset margin
|
66
|
+
[`margin${perp}`]: align ? null : -size
|
67
|
+
}}>
|
68
|
+
<g transform={transform}>
|
69
|
+
<path d={triangle} fill={bg}/>
|
70
|
+
<path d={line} fill="none" stroke={borderColor} strokeWidth={borderWidth}/>
|
71
|
+
</g>
|
72
|
+
</svg>);
|
73
|
+
}
|
74
|
+
Caret.locations = [
|
75
|
+
'top',
|
76
|
+
'top-left',
|
77
|
+
'top-right',
|
78
|
+
'right',
|
79
|
+
'right-top',
|
80
|
+
'right-bottom',
|
81
|
+
'bottom',
|
82
|
+
'bottom-left',
|
83
|
+
'bottom-right',
|
84
|
+
'left',
|
85
|
+
'left-top',
|
86
|
+
'left-bottom'
|
87
|
+
];
|
88
|
+
Caret.defaultProps = {
|
89
|
+
bg: 'canvas.default',
|
90
|
+
borderColor: 'border.default',
|
91
|
+
borderWidth: 1
|
92
|
+
};
|
93
|
+
exports.default = Caret;
|
@@ -0,0 +1,42 @@
|
|
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 StyledOcticon_1 = __importDefault(require("./StyledOcticon"));
|
9
|
+
const sx_1 = __importDefault(require("./sx"));
|
10
|
+
const isNumeric_1 = __importDefault(require("./utils/isNumeric"));
|
11
|
+
const variantSizes = {
|
12
|
+
small: 56,
|
13
|
+
medium: 96,
|
14
|
+
large: 128
|
15
|
+
};
|
16
|
+
const sizeStyles = ({ size, variant = 'medium' }) => {
|
17
|
+
const calc = isNumeric_1.default(size) ? size : variantSizes[variant];
|
18
|
+
return {
|
19
|
+
width: calc,
|
20
|
+
height: calc
|
21
|
+
};
|
22
|
+
};
|
23
|
+
const CircleBadge = styled_components_1.default.div `
|
24
|
+
display: ${props => (props.inline ? 'inline-flex' : 'flex')};
|
25
|
+
align-items: center;
|
26
|
+
justify-content: center;
|
27
|
+
background-color: ${constants_1.get('colors.canvas.default')};
|
28
|
+
border-radius: 50%;
|
29
|
+
box-shadow: ${constants_1.get('shadows.shadow.medium')};
|
30
|
+
${sizeStyles};
|
31
|
+
${sx_1.default};
|
32
|
+
`;
|
33
|
+
const CircleBadgeIcon = styled_components_1.default(StyledOcticon_1.default) `
|
34
|
+
height: auto;
|
35
|
+
max-width: 60%;
|
36
|
+
max-height: 55%;
|
37
|
+
`;
|
38
|
+
CircleBadge.defaultProps = {
|
39
|
+
inline: false
|
40
|
+
};
|
41
|
+
CircleBadgeIcon.displayName = 'CircleBadge.Icon';
|
42
|
+
exports.default = Object.assign(CircleBadge, { Icon: CircleBadgeIcon });
|
package/lib/CircleOcticon.d.ts
CHANGED
@@ -383,7 +383,6 @@ declare namespace CircleOcticon {
|
|
383
383
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
384
384
|
onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
385
385
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
386
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
387
386
|
borderX?: import("styled-system").ResponsiveValue<import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
388
387
|
borderY?: import("styled-system").ResponsiveValue<import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
389
388
|
theme?: any;
|
@@ -0,0 +1,21 @@
|
|
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 Box_1 = __importDefault(require("./Box"));
|
8
|
+
function CircleOcticon(props) {
|
9
|
+
const { size, as } = props;
|
10
|
+
const { icon: IconComponent, bg, ...rest } = props;
|
11
|
+
return (<Box_1.default as={as} bg={bg} overflow="hidden" borderWidth={0} size={size} borderRadius="50%" borderStyle="solid" borderColor="border.default">
|
12
|
+
<Box_1.default display="flex" {...rest} alignItems="center" justifyContent="center">
|
13
|
+
<IconComponent size={size}/>
|
14
|
+
</Box_1.default>
|
15
|
+
</Box_1.default>);
|
16
|
+
}
|
17
|
+
CircleOcticon.defaultProps = {
|
18
|
+
...Box_1.default.defaultProps,
|
19
|
+
size: 32
|
20
|
+
};
|
21
|
+
exports.default = CircleOcticon;
|
@@ -0,0 +1,43 @@
|
|
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 colorStyles = ({ scheme, ...props }) => {
|
10
|
+
return {
|
11
|
+
color: scheme === 'secondary'
|
12
|
+
? constants_1.get('colors.fg.default')(props)
|
13
|
+
: scheme === 'primary'
|
14
|
+
? constants_1.get('colors.fg.onEmphasis')(props)
|
15
|
+
: constants_1.get('colors.fg.default')(props)
|
16
|
+
};
|
17
|
+
};
|
18
|
+
const bgStyles = ({ scheme, ...props }) => {
|
19
|
+
return {
|
20
|
+
backgroundColor: scheme === 'secondary'
|
21
|
+
? constants_1.get('colors.neutral.muted')(props)
|
22
|
+
: scheme === 'primary'
|
23
|
+
? constants_1.get('colors.neutral.emphasis')(props)
|
24
|
+
: constants_1.get('colors.neutral.muted')(props)
|
25
|
+
};
|
26
|
+
};
|
27
|
+
const CounterLabel = styled_components_1.default.span `
|
28
|
+
display: inline-block;
|
29
|
+
padding: 2px 5px;
|
30
|
+
font-size: ${constants_1.get('fontSizes.0')};
|
31
|
+
font-weight: ${constants_1.get('fontWeights.bold')};
|
32
|
+
line-height: ${constants_1.get('lineHeights.condensedUltra')};
|
33
|
+
border-radius: 20px;
|
34
|
+
${colorStyles};
|
35
|
+
${bgStyles};
|
36
|
+
|
37
|
+
&:empty {
|
38
|
+
display: none;
|
39
|
+
}
|
40
|
+
|
41
|
+
${sx_1.default};
|
42
|
+
`;
|
43
|
+
exports.default = CounterLabel;
|
package/lib/Details.jsx
ADDED
@@ -0,0 +1,21 @@
|
|
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 Details = styled_components_1.default.details `
|
10
|
+
& > summary {
|
11
|
+
list-style: none;
|
12
|
+
}
|
13
|
+
& > summary::-webkit-details-marker {
|
14
|
+
display: none;
|
15
|
+
}
|
16
|
+
|
17
|
+
${constants_1.COMMON}
|
18
|
+
${sx_1.default};
|
19
|
+
`;
|
20
|
+
Details.displayName = 'Details';
|
21
|
+
exports.default = Details;
|