@primer/components 0.0.0-202111245715 → 0.0.0-2021113144816
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/dist/browser.esm.js +2 -2209
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2209
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Header.js +1 -1
- package/lib/ActionList/Item.js +10 -10
- package/lib/ActionList/List.js +1 -1
- package/lib/ActionList2/Divider.d.ts +3 -2
- package/lib/ActionList2/Divider.js +10 -5
- package/lib/ActionList2/Item.js +22 -6
- package/lib/ActionList2/List.js +12 -2
- package/lib/ActionList2/MenuContext.d.ts +10 -0
- package/lib/ActionList2/MenuContext.js +15 -0
- package/lib/ActionList2/Selection.js +11 -0
- package/lib/ActionList2/index.d.ts +1 -2
- package/lib/ActionMenu2.d.ts +313 -0
- package/lib/ActionMenu2.js +91 -0
- package/lib/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib/BaseStyles.js +2 -20
- package/lib/BorderBox.js +1 -1
- package/lib/Box.js +1 -1
- package/lib/Breadcrumbs.js +3 -3
- package/lib/Button/Button.d.ts +2 -2
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonClose.d.ts +2 -2
- package/lib/Button/ButtonDanger.d.ts +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Button/ButtonInvisible.d.ts +2 -2
- package/lib/Button/ButtonOutline.d.ts +2 -2
- package/lib/Button/ButtonPrimary.d.ts +2 -2
- package/lib/Checkbox.js +1 -1
- package/lib/CircleOcticon.d.ts +35 -35
- package/lib/Details.js +1 -1
- package/lib/Dialog.d.ts +37 -37
- package/lib/Dropdown.d.ts +6 -6
- package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib/FilterList.d.ts +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +1 -1
- package/lib/Flex.js +1 -1
- package/lib/LabelGroup.js +1 -1
- package/lib/NewButton/button.d.ts +11 -2
- package/lib/NewButton/button.js +283 -6
- package/lib/NewButton/index.d.ts +11 -6
- package/lib/NewButton/index.js +0 -18
- package/lib/NewButton/types.d.ts +8 -28
- package/lib/NewButton/types.js +1 -19
- package/lib/Overlay.js +1 -1
- package/lib/Pagination/Pagination.js +2 -2
- package/lib/Position.d.ts +4 -4
- package/lib/Position.js +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib/SelectMenu/SelectMenu.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/StateLabel.js +1 -1
- package/lib/StyledOcticon.js +1 -1
- package/lib/SubNav.js +3 -3
- package/lib/TextInputWithTokens.d.ts +2 -1
- package/lib/ThemeProvider.d.ts +1 -0
- package/lib/ThemeProvider.js +17 -4
- package/lib/Timeline.js +4 -4
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/AvatarToken.js +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/TokenBase.js +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/UnderlineNav.js +2 -2
- package/lib/drafts.d.ts +1 -0
- package/lib/drafts.js +13 -0
- package/lib-esm/ActionList/Header.js +1 -1
- package/lib-esm/ActionList/Item.js +10 -10
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/ActionList2/Divider.d.ts +3 -2
- package/lib-esm/ActionList2/Divider.js +8 -5
- package/lib-esm/ActionList2/Item.js +20 -6
- package/lib-esm/ActionList2/List.js +10 -2
- package/lib-esm/ActionList2/MenuContext.d.ts +10 -0
- package/lib-esm/ActionList2/MenuContext.js +3 -0
- package/lib-esm/ActionList2/Selection.js +9 -0
- package/lib-esm/ActionList2/index.d.ts +1 -2
- package/lib-esm/ActionMenu2.d.ts +313 -0
- package/lib-esm/ActionMenu2.js +67 -0
- package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib-esm/BaseStyles.js +2 -20
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Box.js +1 -1
- package/lib-esm/Breadcrumbs.js +3 -3
- package/lib-esm/Button/Button.d.ts +2 -2
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +2 -2
- package/lib-esm/Button/ButtonGroup.js +1 -1
- package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
- package/lib-esm/Checkbox.js +1 -1
- package/lib-esm/CircleOcticon.d.ts +35 -35
- package/lib-esm/Details.js +1 -1
- package/lib-esm/Dialog.d.ts +37 -37
- package/lib-esm/Dropdown.d.ts +6 -6
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib-esm/FilterList.d.ts +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
- package/lib-esm/Flex.js +1 -1
- package/lib-esm/LabelGroup.js +1 -1
- package/lib-esm/NewButton/button.d.ts +11 -2
- package/lib-esm/NewButton/button.js +275 -4
- package/lib-esm/NewButton/index.d.ts +11 -6
- package/lib-esm/NewButton/index.js +1 -4
- package/lib-esm/NewButton/types.d.ts +8 -28
- package/lib-esm/NewButton/types.js +1 -6
- package/lib-esm/Overlay.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/Position.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib-esm/SelectMenu/SelectMenu.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib-esm/StateLabel.js +1 -1
- package/lib-esm/StyledOcticon.js +1 -1
- package/lib-esm/SubNav.js +3 -3
- package/lib-esm/TextInputWithTokens.d.ts +2 -1
- package/lib-esm/ThemeProvider.d.ts +1 -0
- package/lib-esm/ThemeProvider.js +17 -4
- package/lib-esm/Timeline.js +4 -4
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/AvatarToken.js +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Token/TokenBase.js +1 -1
- package/lib-esm/Tooltip.js +1 -1
- package/lib-esm/UnderlineNav.js +2 -2
- package/lib-esm/drafts.d.ts +1 -0
- package/lib-esm/drafts.js +2 -1
- package/package.json +16 -8
- package/CHANGELOG.md +0 -992
- package/lib/NewButton/button-base.d.ts +0 -6
- package/lib/NewButton/button-base.js +0 -69
- package/lib/NewButton/button-link.d.ts +0 -26
- package/lib/NewButton/button-link.js +0 -31
- package/lib/NewButton/icon-button.d.ts +0 -4
- package/lib/NewButton/icon-button.js +0 -57
- package/lib/NewButton/styles.d.ts +0 -202
- package/lib/NewButton/styles.js +0 -248
- package/lib-esm/NewButton/button-base.d.ts +0 -6
- package/lib-esm/NewButton/button-base.js +0 -47
- package/lib-esm/NewButton/button-link.d.ts +0 -26
- package/lib-esm/NewButton/button-link.js +0 -15
- package/lib-esm/NewButton/icon-button.d.ts +0 -4
- package/lib-esm/NewButton/icon-button.js +0 -35
- package/lib-esm/NewButton/styles.d.ts +0 -202
- package/lib-esm/NewButton/styles.js +0 -229
package/lib-esm/Dropdown.d.ts
CHANGED
@@ -16,6 +16,7 @@ export declare type DropdownItemProps = ComponentProps<typeof DropdownItem>;
|
|
16
16
|
declare const _default: {
|
17
17
|
({ children, className, ...rest }: {
|
18
18
|
color?: string | undefined;
|
19
|
+
property?: string | undefined;
|
19
20
|
translate?: "yes" | "no" | undefined;
|
20
21
|
hidden?: boolean | undefined;
|
21
22
|
children?: React.ReactNode;
|
@@ -47,7 +48,6 @@ declare const _default: {
|
|
47
48
|
datatype?: string | undefined;
|
48
49
|
inlist?: any;
|
49
50
|
prefix?: string | undefined;
|
50
|
-
property?: string | undefined;
|
51
51
|
resource?: string | undefined;
|
52
52
|
typeof?: string | undefined;
|
53
53
|
vocab?: string | undefined;
|
@@ -282,6 +282,7 @@ declare const _default: {
|
|
282
282
|
}): JSX.Element;
|
283
283
|
defaultProps: Partial<{
|
284
284
|
color?: string | undefined;
|
285
|
+
property?: string | undefined;
|
285
286
|
translate?: "yes" | "no" | undefined;
|
286
287
|
hidden?: boolean | undefined;
|
287
288
|
children?: React.ReactNode;
|
@@ -313,7 +314,6 @@ declare const _default: {
|
|
313
314
|
datatype?: string | undefined;
|
314
315
|
inlist?: any;
|
315
316
|
prefix?: string | undefined;
|
316
|
-
property?: string | undefined;
|
317
317
|
resource?: string | undefined;
|
318
318
|
typeof?: string | undefined;
|
319
319
|
vocab?: string | undefined;
|
@@ -555,6 +555,7 @@ declare const _default: {
|
|
555
555
|
Button: {
|
556
556
|
({ children, ...rest }: {
|
557
557
|
color?: string | undefined;
|
558
|
+
property?: string | undefined;
|
558
559
|
translate?: "yes" | "no" | undefined;
|
559
560
|
hidden?: boolean | undefined;
|
560
561
|
children?: React.ReactNode;
|
@@ -590,7 +591,6 @@ declare const _default: {
|
|
590
591
|
datatype?: string | undefined;
|
591
592
|
inlist?: any;
|
592
593
|
prefix?: string | undefined;
|
593
|
-
property?: string | undefined;
|
594
594
|
resource?: string | undefined;
|
595
595
|
typeof?: string | undefined;
|
596
596
|
vocab?: string | undefined;
|
@@ -819,8 +819,8 @@ declare const _default: {
|
|
819
819
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
820
820
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
821
821
|
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
822
|
-
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
823
822
|
disabled?: boolean | undefined;
|
823
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
824
824
|
autoFocus?: boolean | undefined;
|
825
825
|
formAction?: string | undefined;
|
826
826
|
formEncType?: string | undefined;
|
@@ -832,6 +832,7 @@ declare const _default: {
|
|
832
832
|
}): JSX.Element;
|
833
833
|
defaultProps: Partial<{
|
834
834
|
color?: string | undefined;
|
835
|
+
property?: string | undefined;
|
835
836
|
translate?: "yes" | "no" | undefined;
|
836
837
|
hidden?: boolean | undefined;
|
837
838
|
children?: React.ReactNode;
|
@@ -867,7 +868,6 @@ declare const _default: {
|
|
867
868
|
datatype?: string | undefined;
|
868
869
|
inlist?: any;
|
869
870
|
prefix?: string | undefined;
|
870
|
-
property?: string | undefined;
|
871
871
|
resource?: string | undefined;
|
872
872
|
typeof?: string | undefined;
|
873
873
|
vocab?: string | undefined;
|
@@ -1096,8 +1096,8 @@ declare const _default: {
|
|
1096
1096
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
1097
1097
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
1098
1098
|
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
1099
|
-
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
1100
1099
|
disabled?: boolean | undefined;
|
1100
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
1101
1101
|
autoFocus?: boolean | undefined;
|
1102
1102
|
formAction?: string | undefined;
|
1103
1103
|
formEncType?: string | undefined;
|
@@ -3,6 +3,7 @@ import { ButtonProps } from '../Button/Button';
|
|
3
3
|
export declare type DropdownButtonProps = ButtonProps;
|
4
4
|
export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<{
|
5
5
|
color?: string | undefined;
|
6
|
+
property?: string | undefined;
|
6
7
|
translate?: "yes" | "no" | undefined;
|
7
8
|
hidden?: boolean | undefined;
|
8
9
|
children?: React.ReactNode;
|
@@ -38,7 +39,6 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
|
|
38
39
|
datatype?: string | undefined;
|
39
40
|
inlist?: any;
|
40
41
|
prefix?: string | undefined;
|
41
|
-
property?: string | undefined;
|
42
42
|
resource?: string | undefined;
|
43
43
|
typeof?: string | undefined;
|
44
44
|
vocab?: string | undefined;
|
@@ -267,8 +267,8 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
|
|
267
267
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
268
268
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
269
269
|
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
270
|
-
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
271
270
|
disabled?: boolean | undefined;
|
271
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
272
272
|
autoFocus?: boolean | undefined;
|
273
273
|
formAction?: string | undefined;
|
274
274
|
formEncType?: string | undefined;
|
@@ -277,4 +277,7 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<Pick<React.
|
|
277
277
|
formTarget?: string | undefined;
|
278
278
|
} & {
|
279
279
|
theme?: any;
|
280
|
-
}>, "
|
280
|
+
}>, "theme" | "sx" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement> | keyof {
|
281
|
+
as?: string | React.ComponentClass<any, any> | React.FunctionComponent<any> | undefined;
|
282
|
+
variant?: "small" | "medium" | "large" | undefined;
|
283
|
+
}> & React.RefAttributes<HTMLElement>>;
|
package/lib-esm/FilterList.d.ts
CHANGED
@@ -16,6 +16,7 @@ declare namespace FilterListItem {
|
|
16
16
|
}
|
17
17
|
declare const _default: (({ children, ...rest }: React.PropsWithChildren<{
|
18
18
|
color?: string | undefined;
|
19
|
+
property?: string | undefined;
|
19
20
|
translate?: "yes" | "no" | undefined;
|
20
21
|
hidden?: boolean | undefined;
|
21
22
|
children?: React.ReactNode;
|
@@ -46,7 +47,6 @@ declare const _default: (({ children, ...rest }: React.PropsWithChildren<{
|
|
46
47
|
datatype?: string | undefined;
|
47
48
|
inlist?: any;
|
48
49
|
prefix?: string | undefined;
|
49
|
-
property?: string | undefined;
|
50
50
|
resource?: string | undefined;
|
51
51
|
typeof?: string | undefined;
|
52
52
|
vocab?: string | undefined;
|
@@ -15,7 +15,7 @@ import useScrollFlash from '../hooks/useScrollFlash';
|
|
15
15
|
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
16
16
|
const StyledHeader = styled.div.withConfig({
|
17
17
|
displayName: "FilteredActionList__StyledHeader",
|
18
|
-
componentId: "yg3jkv-0"
|
18
|
+
componentId: "sc-yg3jkv-0"
|
19
19
|
})(["box-shadow:0 1px 0 ", ";z-index:1;"], get('colors.border.default'));
|
20
20
|
export function FilteredActionList({
|
21
21
|
loading = false,
|
package/lib-esm/Flex.js
CHANGED
package/lib-esm/LabelGroup.js
CHANGED
@@ -3,6 +3,6 @@ import { get } from './constants';
|
|
3
3
|
import sx from './sx';
|
4
4
|
const LabelGroup = styled.span.withConfig({
|
5
5
|
displayName: "LabelGroup",
|
6
|
-
componentId: "k6k3qa-0"
|
6
|
+
componentId: "sc-k6k3qa-0"
|
7
7
|
})(["& *{margin-right:", ";}& *:last-child{margin-right:0;}", ";"], get('space.1'), sx);
|
8
8
|
export default LabelGroup;
|
@@ -1,4 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
|
2
|
+
import { SxProp } from '../sx';
|
3
|
+
import { VariantType } from './types';
|
4
|
+
declare const Button: React.ForwardRefExoticComponent<{
|
5
|
+
variant?: VariantType | undefined;
|
6
|
+
size?: import("./types").Size | undefined;
|
7
|
+
icon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
8
|
+
leadingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
9
|
+
trailingIcon?: React.FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
10
|
+
disabled?: boolean | undefined;
|
11
|
+
children: React.ReactNode;
|
12
|
+
} & SxProp & React.HTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
4
13
|
export { Button };
|
@@ -1,16 +1,287 @@
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
2
|
|
3
3
|
import React, { forwardRef } from 'react';
|
4
|
-
import
|
4
|
+
import Box from '../Box';
|
5
|
+
import styled from 'styled-components';
|
6
|
+
import sx, { merge } from '../sx';
|
7
|
+
import { useTheme } from '../ThemeProvider';
|
8
|
+
const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
|
9
|
+
|
10
|
+
const getVariantStyles = (variant = 'default', theme) => {
|
11
|
+
const style = {
|
12
|
+
default: {
|
13
|
+
color: 'btn.text',
|
14
|
+
backgroundColor: 'btn.bg',
|
15
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}, ${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.insetShadow}`,
|
16
|
+
'&:hover:not([disabled])': {
|
17
|
+
backgroundColor: 'btn.hoverBg'
|
18
|
+
},
|
19
|
+
// focus must come before :active so that the active box shadow overrides
|
20
|
+
'&:focus:not([disabled])': {
|
21
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
22
|
+
},
|
23
|
+
'&:active:not([disabled])': {
|
24
|
+
backgroundColor: 'btn.selectedBg',
|
25
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadowActive}`
|
26
|
+
},
|
27
|
+
'&:disabled': {
|
28
|
+
color: 'primer.fg.disabled',
|
29
|
+
backgroundColor: 'btn.disabledBg'
|
30
|
+
}
|
31
|
+
},
|
32
|
+
primary: {
|
33
|
+
color: 'btn.primary.text',
|
34
|
+
backgroundColor: 'btn.primary.bg',
|
35
|
+
borderColor: 'border.subtle',
|
36
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.shadow}`,
|
37
|
+
'&:hover:not([disabled])': {
|
38
|
+
color: 'btn.primary.hoverText',
|
39
|
+
backgroundColor: 'btn.primary.hoverBg'
|
40
|
+
},
|
41
|
+
// focus must come before :active so that the active box shadow overrides
|
42
|
+
'&:focus:not([disabled])': {
|
43
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.focusShadow}`
|
44
|
+
},
|
45
|
+
'&:active:not([disabled])': {
|
46
|
+
backgroundColor: 'btn.primary.selectedBg',
|
47
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.selectedShadow}`
|
48
|
+
},
|
49
|
+
'&:disabled': {
|
50
|
+
color: 'btn.primary.disabledText',
|
51
|
+
backgroundColor: 'btn.primary.disabledBg'
|
52
|
+
},
|
53
|
+
'[data-component="ButtonCounter"]': {
|
54
|
+
backgroundColor: 'btn.primary.counterBg',
|
55
|
+
color: 'btn.primary.text'
|
56
|
+
}
|
57
|
+
},
|
58
|
+
danger: {
|
59
|
+
color: 'btn.danger.text',
|
60
|
+
backgroundColor: 'btn.bg',
|
61
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
62
|
+
'&:hover:not([disabled])': {
|
63
|
+
color: 'btn.danger.hoverText',
|
64
|
+
backgroundColor: 'btn.danger.hoverBg',
|
65
|
+
borderColor: 'btn.danger.hoverBorder',
|
66
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.hoverShadow}`,
|
67
|
+
'[data-component="ButtonCounter"]': {
|
68
|
+
backgroundColor: 'btn.danger.hoverCounterBg',
|
69
|
+
color: 'btn.danger.hoverText'
|
70
|
+
}
|
71
|
+
},
|
72
|
+
// focus must come before :active so that the active box shadow overrides
|
73
|
+
'&:focus:not([disabled])': {
|
74
|
+
borderColor: 'btn.danger.focusBorder',
|
75
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.focusShadow}`
|
76
|
+
},
|
77
|
+
'&:active:not([disabled])': {
|
78
|
+
color: 'btn.danger.selectedText',
|
79
|
+
backgroundColor: 'btn.danger.selectedBg',
|
80
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.selectedShadow}`,
|
81
|
+
borderColor: 'btn.danger.selectedBorder'
|
82
|
+
},
|
83
|
+
'&:disabled': {
|
84
|
+
color: 'btn.danger.disabledText',
|
85
|
+
backgroundColor: 'btn.danger.disabledBg',
|
86
|
+
borderColor: 'btn.danger.disabledBorder',
|
87
|
+
'[data-component="ButtonCounter"]': {
|
88
|
+
backgroundColor: 'btn.danger.disabledCounterBg'
|
89
|
+
}
|
90
|
+
},
|
91
|
+
'[data-component="ButtonCounter"]': {
|
92
|
+
color: 'btn.danger.text',
|
93
|
+
backgroundColor: 'btn.danger.counterBg'
|
94
|
+
}
|
95
|
+
},
|
96
|
+
invisible: {
|
97
|
+
color: 'accent.fg',
|
98
|
+
backgroundColor: 'transparent',
|
99
|
+
border: '0',
|
100
|
+
boxShadow: 'none',
|
101
|
+
'&:hover:not([disabled])': {
|
102
|
+
backgroundColor: 'btn.hoverBg'
|
103
|
+
},
|
104
|
+
// focus must come before :active so that the active box shadow overrides
|
105
|
+
'&:focus:not([disabled])': {
|
106
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
107
|
+
},
|
108
|
+
'&:active:not([disabled])': {
|
109
|
+
backgroundColor: 'btn.selectedBg'
|
110
|
+
},
|
111
|
+
'&:disabled': {
|
112
|
+
color: 'primer.fg.disabled'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
outline: {
|
116
|
+
color: 'btn.outline.text',
|
117
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
118
|
+
'&:hover': {
|
119
|
+
color: 'btn.outline.hoverText',
|
120
|
+
backgroundColor: 'btn.outline.hoverBg',
|
121
|
+
borderColor: 'outline.hoverBorder',
|
122
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.hoverShadow}`,
|
123
|
+
'[data-component="ButtonCounter"]': {
|
124
|
+
backgroundColor: 'btn.outline.hoverCounterBg',
|
125
|
+
color: 'btn.outline.hoverText'
|
126
|
+
}
|
127
|
+
},
|
128
|
+
// focus must come before :active so that the active box shadow overrides
|
129
|
+
'&:focus': {
|
130
|
+
borderColor: 'btn.outline.focusBorder',
|
131
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.focusShadow}`
|
132
|
+
},
|
133
|
+
'&:active:not([disabled])': {
|
134
|
+
color: 'btn.outline.selectedText',
|
135
|
+
backgroundColor: 'btn.outline.selectedBg',
|
136
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.selectedShadow}`,
|
137
|
+
borderColor: 'btn.outline.selectedBorder'
|
138
|
+
},
|
139
|
+
'&:disabled': {
|
140
|
+
color: 'btn.outline.disabledText',
|
141
|
+
backgroundColor: 'btn.outline.disabledBg',
|
142
|
+
borderColor: 'btn.border',
|
143
|
+
'[data-component="ButtonCounter"]': {
|
144
|
+
backgroundColor: 'btn.outline.disabledCounterBg'
|
145
|
+
}
|
146
|
+
},
|
147
|
+
'[data-component="ButtonCounter"]': {
|
148
|
+
backgroundColor: 'btn.outline.counterBg',
|
149
|
+
color: 'btn.outline.text'
|
150
|
+
}
|
151
|
+
}
|
152
|
+
};
|
153
|
+
return style[variant];
|
154
|
+
};
|
155
|
+
|
156
|
+
const getSizeStyles = (size = 'medium', variant = 'default', iconOnly) => {
|
157
|
+
let paddingY, paddingX, fontSize;
|
158
|
+
|
159
|
+
switch (size) {
|
160
|
+
case 'small':
|
161
|
+
paddingY = 3;
|
162
|
+
paddingX = 12;
|
163
|
+
fontSize = 0;
|
164
|
+
break;
|
165
|
+
|
166
|
+
case 'large':
|
167
|
+
paddingY = 9;
|
168
|
+
paddingX = 20;
|
169
|
+
fontSize = 2;
|
170
|
+
break;
|
171
|
+
|
172
|
+
case 'medium':
|
173
|
+
default:
|
174
|
+
paddingY = 5;
|
175
|
+
paddingX = 16;
|
176
|
+
fontSize = 1;
|
177
|
+
}
|
178
|
+
|
179
|
+
if (iconOnly) {
|
180
|
+
paddingX = paddingY + 2;
|
181
|
+
}
|
182
|
+
|
183
|
+
if (variant === 'invisible') {
|
184
|
+
paddingY = paddingY + 1;
|
185
|
+
}
|
186
|
+
|
187
|
+
return {
|
188
|
+
paddingY: `${paddingY}px`,
|
189
|
+
paddingX: `${paddingX}px`,
|
190
|
+
fontSize,
|
191
|
+
'[data-component="ButtonCounter"]': {
|
192
|
+
fontSize
|
193
|
+
}
|
194
|
+
};
|
195
|
+
};
|
196
|
+
|
197
|
+
const ButtonBase = styled.button.withConfig({
|
198
|
+
displayName: "button__ButtonBase",
|
199
|
+
componentId: "sc-15k5iqk-0"
|
200
|
+
})(sx);
|
5
201
|
const Button = /*#__PURE__*/forwardRef(({
|
6
202
|
children,
|
203
|
+
sx: sxProp = {},
|
7
204
|
...props
|
8
205
|
}, forwardedRef) => {
|
206
|
+
const {
|
207
|
+
icon: Icon,
|
208
|
+
leadingIcon: LeadingIcon,
|
209
|
+
trailingIcon: TrailingIcon,
|
210
|
+
variant = 'default',
|
211
|
+
size = 'medium'
|
212
|
+
} = props;
|
213
|
+
const iconOnly = !!Icon;
|
214
|
+
const {
|
215
|
+
theme
|
216
|
+
} = useTheme();
|
217
|
+
const styles = {
|
218
|
+
borderRadius: '2',
|
219
|
+
border: '1px solid',
|
220
|
+
borderColor: theme === null || theme === void 0 ? void 0 : theme.colors.btn.border,
|
221
|
+
display: 'grid',
|
222
|
+
gridTemplateAreas: '"leadingIcon text trailingIcon"',
|
223
|
+
fontWeight: 'bold',
|
224
|
+
lineHeight: TEXT_ROW_HEIGHT,
|
225
|
+
whiteSpace: 'nowrap',
|
226
|
+
verticalAlign: 'middle',
|
227
|
+
cursor: 'pointer',
|
228
|
+
appearance: 'none',
|
229
|
+
userSelect: 'none',
|
230
|
+
textDecoration: 'none',
|
231
|
+
textAlign: 'center',
|
232
|
+
'& > :not(:last-child)': {
|
233
|
+
mr: '2'
|
234
|
+
},
|
235
|
+
'&:focus': {
|
236
|
+
outline: 'none'
|
237
|
+
},
|
238
|
+
'&:disabled': {
|
239
|
+
cursor: 'default'
|
240
|
+
},
|
241
|
+
'&:disabled svg': {
|
242
|
+
opacity: '0.6'
|
243
|
+
},
|
244
|
+
'[data-component="leadingIcon"]': {
|
245
|
+
gridArea: 'leadingIcon'
|
246
|
+
},
|
247
|
+
'[data-component="text"]': {
|
248
|
+
gridArea: 'text'
|
249
|
+
},
|
250
|
+
'[data-component="trailingIcon"]': {
|
251
|
+
gridArea: 'trailingIcon'
|
252
|
+
}
|
253
|
+
};
|
254
|
+
const iconWrapStyles = {
|
255
|
+
display: 'inline-block'
|
256
|
+
};
|
257
|
+
const sxStyles = merge.all([styles, getSizeStyles(size, variant, iconOnly), getVariantStyles(variant, theme), sxProp]);
|
9
258
|
return /*#__PURE__*/React.createElement(ButtonBase, _extends({
|
259
|
+
sx: sxStyles,
|
10
260
|
ref: forwardedRef
|
11
|
-
}, props, {
|
12
|
-
as: "
|
13
|
-
|
261
|
+
}, props), LeadingIcon && /*#__PURE__*/React.createElement(Box, {
|
262
|
+
as: "span",
|
263
|
+
"data-component": "leadingIcon",
|
264
|
+
sx: iconWrapStyles,
|
265
|
+
"aria-hidden": !iconOnly
|
266
|
+
}, /*#__PURE__*/React.createElement(LeadingIcon, null)), /*#__PURE__*/React.createElement("span", {
|
267
|
+
"data-component": "text",
|
268
|
+
hidden: Icon ? true : false
|
269
|
+
}, children), Icon && /*#__PURE__*/React.createElement(Box, {
|
270
|
+
"data-component": "icon-only",
|
271
|
+
as: "span",
|
272
|
+
sx: {
|
273
|
+
display: 'inline-block'
|
274
|
+
},
|
275
|
+
"aria-hidden": !iconOnly
|
276
|
+
}, /*#__PURE__*/React.createElement(Icon, null)), TrailingIcon && /*#__PURE__*/React.createElement(Box, {
|
277
|
+
as: "span",
|
278
|
+
"data-component": "trailingIcon",
|
279
|
+
sx: { ...iconWrapStyles,
|
280
|
+
ml: 2
|
281
|
+
},
|
282
|
+
"aria-hidden": !iconOnly
|
283
|
+
}, /*#__PURE__*/React.createElement(TrailingIcon, null)));
|
14
284
|
});
|
15
285
|
Button.displayName = 'Button';
|
286
|
+
Object.assign(Button, {});
|
16
287
|
export { Button };
|
@@ -1,9 +1,14 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
import { ButtonProps } from './types';
|
3
|
+
export type { ButtonProps as NewButtonProps };
|
4
|
+
export declare const NewButton: import("react").ForwardRefExoticComponent<{
|
5
|
+
variant?: import("./types").VariantType | undefined;
|
6
|
+
size?: import("./types").Size | undefined;
|
7
|
+
icon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
8
|
+
leadingIcon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
9
|
+
trailingIcon?: import("react").FunctionComponent<import("@primer/octicons-react/dist/icons").IconProps> | undefined;
|
10
|
+
disabled?: boolean | undefined;
|
11
|
+
children: import("react").ReactNode;
|
12
|
+
} & import("../sx").SxProp & import("react").HTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>> & {
|
7
13
|
Counter: ({ children, sx: sxProp, ...props }: import("./button-counter").CounterProps) => JSX.Element;
|
8
14
|
};
|
9
|
-
export { IconButton, ButtonLink };
|
@@ -1,8 +1,5 @@
|
|
1
1
|
import { Button } from './button';
|
2
2
|
import { Counter } from './button-counter';
|
3
|
-
import IconButton from './icon-button';
|
4
|
-
import ButtonLink from './button-link';
|
5
3
|
export const NewButton = Object.assign(Button, {
|
6
4
|
Counter
|
7
|
-
});
|
8
|
-
export { IconButton, ButtonLink };
|
5
|
+
});
|
@@ -1,11 +1,9 @@
|
|
1
|
-
import React, { HTMLAttributes
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
2
2
|
import { IconProps } from '@primer/octicons-react';
|
3
3
|
import { SxProp } from '../sx';
|
4
|
-
export declare const StyledButton: import("styled-components").StyledComponent<"button", any, SxProp, never>;
|
5
4
|
export declare type VariantType = 'default' | 'primary' | 'invisible' | 'danger' | 'outline';
|
6
5
|
export declare type Size = 'small' | 'medium' | 'large';
|
7
|
-
declare type
|
8
|
-
export declare type ButtonBaseProps = {
|
6
|
+
export declare type ButtonProps = {
|
9
7
|
/**
|
10
8
|
* Determine's the styles on a button one of 'default' | 'primary' | 'invisible' | 'danger'
|
11
9
|
*/
|
@@ -15,11 +13,9 @@ export declare type ButtonBaseProps = {
|
|
15
13
|
*/
|
16
14
|
size?: Size;
|
17
15
|
/**
|
18
|
-
*
|
16
|
+
* This is to be used if it is an icon-only button. Will make text visually hidden
|
19
17
|
*/
|
20
|
-
|
21
|
-
} & SxProp & HTMLAttributes<HTMLButtonElement> & StyledButtonProps;
|
22
|
-
export declare type ButtonProps = {
|
18
|
+
icon?: React.FunctionComponent<IconProps>;
|
23
19
|
/**
|
24
20
|
* The leading icon comes before button content
|
25
21
|
*/
|
@@ -28,25 +24,9 @@ export declare type ButtonProps = {
|
|
28
24
|
* The trailing icon comes after button content
|
29
25
|
*/
|
30
26
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
31
|
-
children: React.ReactNode;
|
32
|
-
} & ButtonBaseProps;
|
33
|
-
export declare type IconButtonProps = {
|
34
27
|
/**
|
35
|
-
*
|
28
|
+
* Items that are disabled can not be clicked, selected, or navigated through.
|
36
29
|
*/
|
37
|
-
|
38
|
-
|
39
|
-
} &
|
40
|
-
export declare type LinkButtonProps = {
|
41
|
-
underline?: boolean;
|
42
|
-
download?: string;
|
43
|
-
href?: string;
|
44
|
-
hrefLang?: string;
|
45
|
-
media?: string;
|
46
|
-
ping?: string;
|
47
|
-
rel?: string;
|
48
|
-
target?: string;
|
49
|
-
type?: string;
|
50
|
-
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
|
51
|
-
};
|
52
|
-
export {};
|
30
|
+
disabled?: boolean;
|
31
|
+
children: React.ReactNode;
|
32
|
+
} & SxProp & HTMLAttributes<HTMLButtonElement>;
|
package/lib-esm/Overlay.js
CHANGED
@@ -60,7 +60,7 @@ function getSlideAnimationStartingVector(anchorSide) {
|
|
60
60
|
|
61
61
|
const StyledOverlay = styled.div.withConfig({
|
62
62
|
displayName: "Overlay__StyledOverlay",
|
63
|
-
componentId: "jhwkzw-0"
|
63
|
+
componentId: "sc-jhwkzw-0"
|
64
64
|
})(["background-color:", ";box-shadow:", ";position:absolute;min-width:192px;max-width:640px;height:", ";max-height:", ";width:", ";border-radius:12px;overflow:hidden;animation:overlay-appear ", "ms ", ";@keyframes overlay-appear{0%{opacity:0;}100%{opacity:1;}}visibility:var(--styled-overlay-visibility);:focus{outline:none;}", ";"], get('colors.canvas.overlay'), get('shadows.overlay.shadow'), props => heightMap[props.height || 'auto'], props => props.maxHeight && heightMap[props.maxHeight], props => widthMap[props.width || 'auto'], animationDuration, get('animation.easeOutCubic'), sx);
|
65
65
|
|
66
66
|
/**
|
@@ -8,7 +8,7 @@ import sx from '../sx';
|
|
8
8
|
import { buildComponentData, buildPaginationModel } from './model';
|
9
9
|
const Page = styled.a.withConfig({
|
10
10
|
displayName: "Pagination__Page",
|
11
|
-
componentId: "b80nss-0"
|
11
|
+
componentId: "sc-b80nss-0"
|
12
12
|
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'));
|
13
13
|
|
14
14
|
function usePaginationPages({
|
@@ -43,7 +43,7 @@ function usePaginationPages({
|
|
43
43
|
|
44
44
|
const PaginationContainer = styled.nav.withConfig({
|
45
45
|
displayName: "Pagination__PaginationContainer",
|
46
|
-
componentId: "b80nss-1"
|
46
|
+
componentId: "sc-b80nss-1"
|
47
47
|
})(["margin-top:20px;margin-bottom:15px;text-align:center;", ";"], sx);
|
48
48
|
|
49
49
|
function Pagination({
|