@primer/components 0.0.0-2021111225614 → 0.0.0-202111136954
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/{MenuContext.d.ts → ActionListContainerContext.d.ts} +3 -3
- package/lib/ActionList2/{MenuContext.js → ActionListContainerContext.js} +3 -3
- package/lib/ActionList2/Item.js +5 -7
- package/lib/ActionList2/List.js +3 -3
- package/lib/ActionList2/Selection.js +4 -4
- package/lib/ActionMenu2.d.ts +19 -12
- package/lib/ActionMenu2.js +63 -29
- 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/BranchName.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.d.ts +1 -1
- 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-base.d.ts +6 -0
- package/lib/NewButton/button-base.js +69 -0
- package/lib/NewButton/button-link.d.ts +27 -0
- package/lib/NewButton/button-link.js +31 -0
- package/lib/NewButton/button.d.ts +2 -11
- package/lib/NewButton/button.js +6 -283
- package/lib/NewButton/icon-button.d.ts +4 -0
- package/lib/NewButton/icon-button.js +62 -0
- package/lib/NewButton/index.d.ts +6 -11
- package/lib/NewButton/index.js +18 -0
- package/lib/NewButton/styles.d.ts +202 -0
- package/lib/NewButton/styles.js +248 -0
- package/lib/NewButton/types.d.ts +28 -8
- package/lib/NewButton/types.js +19 -1
- 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/Radio.d.ts +38 -0
- package/lib/Radio.js +55 -0
- 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/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +9 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -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/{MenuContext.d.ts → ActionListContainerContext.d.ts} +3 -3
- package/lib-esm/ActionList2/{MenuContext.js → ActionListContainerContext.js} +1 -1
- package/lib-esm/ActionList2/Item.js +5 -7
- package/lib-esm/ActionList2/List.js +3 -3
- package/lib-esm/ActionList2/Selection.js +4 -4
- package/lib-esm/ActionMenu2.d.ts +19 -12
- package/lib-esm/ActionMenu2.js +60 -27
- 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/BranchName.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.d.ts +1 -1
- 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-base.d.ts +6 -0
- package/lib-esm/NewButton/button-base.js +47 -0
- package/lib-esm/NewButton/button-link.d.ts +27 -0
- package/lib-esm/NewButton/button-link.js +15 -0
- package/lib-esm/NewButton/button.d.ts +2 -11
- package/lib-esm/NewButton/button.js +4 -275
- package/lib-esm/NewButton/icon-button.d.ts +4 -0
- package/lib-esm/NewButton/icon-button.js +39 -0
- package/lib-esm/NewButton/index.d.ts +6 -11
- package/lib-esm/NewButton/index.js +4 -1
- package/lib-esm/NewButton/styles.d.ts +202 -0
- package/lib-esm/NewButton/styles.js +229 -0
- package/lib-esm/NewButton/types.d.ts +28 -8
- package/lib-esm/NewButton/types.js +6 -1
- 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/Radio.d.ts +38 -0
- package/lib-esm/Radio.js +40 -0
- 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/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +2 -1
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +1 -0
- package/package.json +14 -8
- package/CHANGELOG.md +0 -996
package/lib/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/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;
|
@@ -41,7 +41,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
41
41
|
|
42
42
|
const StyledHeader = _styledComponents.default.div.withConfig({
|
43
43
|
displayName: "FilteredActionList__StyledHeader",
|
44
|
-
componentId: "yg3jkv-0"
|
44
|
+
componentId: "sc-yg3jkv-0"
|
45
45
|
})(["box-shadow:0 1px 0 ", ";z-index:1;"], (0, _constants.get)('colors.border.default'));
|
46
46
|
|
47
47
|
function FilteredActionList({
|
package/lib/Flex.js
CHANGED
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
16
16
|
*/
|
17
17
|
const Flex = (0, _styledComponents.default)(_Box.default).withConfig({
|
18
18
|
displayName: "Flex",
|
19
|
-
componentId: "arghxi-0"
|
19
|
+
componentId: "sc-arghxi-0"
|
20
20
|
})([""]);
|
21
21
|
Flex.defaultProps = {
|
22
22
|
display: 'flex'
|
package/lib/LabelGroup.js
CHANGED
@@ -15,7 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
15
15
|
|
16
16
|
const LabelGroup = _styledComponents.default.span.withConfig({
|
17
17
|
displayName: "LabelGroup",
|
18
|
-
componentId: "k6k3qa-0"
|
18
|
+
componentId: "sc-k6k3qa-0"
|
19
19
|
})(["& *{margin-right:", ";}& *:last-child{margin-right:0;}", ";"], (0, _constants.get)('space.1'), _sx.default);
|
20
20
|
|
21
21
|
var _default = LabelGroup;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
2
|
+
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
|
3
|
+
import { ButtonProps } from './types';
|
4
|
+
declare const ButtonBase: PolymorphicForwardRefComponent<"a" | "button", ButtonProps>;
|
5
|
+
export declare type ButtonBaseProps = ComponentPropsWithRef<typeof ButtonBase>;
|
6
|
+
export default ButtonBase;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
+
|
12
|
+
var _sx = require("../sx");
|
13
|
+
|
14
|
+
var _ThemeProvider = require("../ThemeProvider");
|
15
|
+
|
16
|
+
var _types = require("./types");
|
17
|
+
|
18
|
+
var _styles = require("./styles");
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
|
26
|
+
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); }
|
27
|
+
|
28
|
+
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)(({
|
29
|
+
children,
|
30
|
+
as: Component = 'button',
|
31
|
+
sx: sxProp = {},
|
32
|
+
...props
|
33
|
+
}, forwardedRef) => {
|
34
|
+
const {
|
35
|
+
leadingIcon: LeadingIcon,
|
36
|
+
trailingIcon: TrailingIcon,
|
37
|
+
variant = 'default',
|
38
|
+
size = 'medium'
|
39
|
+
} = props;
|
40
|
+
const {
|
41
|
+
theme
|
42
|
+
} = (0, _ThemeProvider.useTheme)();
|
43
|
+
const iconWrapStyles = {
|
44
|
+
display: 'inline-block'
|
45
|
+
};
|
46
|
+
|
47
|
+
const sxStyles = _sx.merge.all([(0, _styles.getButtonStyles)(theme), (0, _styles.getSizeStyles)(size, variant, false), (0, _styles.getVariantStyles)(variant, theme), sxProp]);
|
48
|
+
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_types.StyledButton, _extends({
|
50
|
+
as: Component,
|
51
|
+
sx: sxStyles
|
52
|
+
}, props, {
|
53
|
+
ref: forwardedRef
|
54
|
+
}), LeadingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
|
55
|
+
as: "span",
|
56
|
+
"data-component": "leadingIcon",
|
57
|
+
sx: iconWrapStyles
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(LeadingIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
|
59
|
+
"data-component": "text"
|
60
|
+
}, children), TrailingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
|
61
|
+
as: "span",
|
62
|
+
"data-component": "trailingIcon",
|
63
|
+
sx: { ...iconWrapStyles,
|
64
|
+
ml: 2
|
65
|
+
}
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(TrailingIcon, null)));
|
67
|
+
});
|
68
|
+
var _default = ButtonBase;
|
69
|
+
exports.default = _default;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
|
3
|
+
declare const LinkButton: PolymorphicForwardRefComponent<"a", Omit<(Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & {
|
4
|
+
ref?: ((instance: HTMLAnchorElement | null) => void) | React.RefObject<HTMLAnchorElement> | null | undefined;
|
5
|
+
}) | (Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
6
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
7
|
+
}), string | number | symbol> & {
|
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
|
+
children: React.ReactNode;
|
11
|
+
} & {
|
12
|
+
variant?: import("./types").VariantType | undefined;
|
13
|
+
size?: import("./types").Size | undefined;
|
14
|
+
disabled?: boolean | undefined;
|
15
|
+
} & import("../sx").SxProp & React.HTMLAttributes<HTMLButtonElement> & {
|
16
|
+
[x: string]: any;
|
17
|
+
[x: number]: any;
|
18
|
+
[x: symbol]: any;
|
19
|
+
} & {
|
20
|
+
theme?: any;
|
21
|
+
} & {
|
22
|
+
as?: string | React.ComponentType<any> | undefined;
|
23
|
+
forwardedAs?: string | React.ComponentType<any> | undefined;
|
24
|
+
} & {
|
25
|
+
as?: "a" | "button" | undefined;
|
26
|
+
}>;
|
27
|
+
export default LinkButton;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _buttonBase = _interopRequireDefault(require("./button-base"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
+
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
|
+
|
18
|
+
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); }
|
19
|
+
|
20
|
+
const LinkButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
21
|
+
children,
|
22
|
+
as: Component = 'a',
|
23
|
+
...props
|
24
|
+
}, forwardedRef) => {
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_buttonBase.default, _extends({
|
26
|
+
as: Component,
|
27
|
+
ref: forwardedRef
|
28
|
+
}, props), children);
|
29
|
+
});
|
30
|
+
var _default = LinkButton;
|
31
|
+
exports.default = _default;
|
@@ -1,13 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
|
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>>;
|
2
|
+
import { ButtonProps } from './types';
|
3
|
+
declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, string | number | symbol> & React.RefAttributes<HTMLButtonElement>>;
|
13
4
|
export { Button };
|
package/lib/NewButton/button.js
CHANGED
@@ -7,13 +7,7 @@ exports.Button = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var
|
11
|
-
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
13
|
-
|
14
|
-
var _sx = _interopRequireWildcard(require("../sx"));
|
15
|
-
|
16
|
-
var _ThemeProvider = require("../ThemeProvider");
|
10
|
+
var _buttonBase = _interopRequireDefault(require("./button-base"));
|
17
11
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
13
|
|
@@ -23,286 +17,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
23
17
|
|
24
18
|
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); }
|
25
19
|
|
26
|
-
const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
|
27
|
-
|
28
|
-
const getVariantStyles = (variant = 'default', theme) => {
|
29
|
-
const style = {
|
30
|
-
default: {
|
31
|
-
color: 'btn.text',
|
32
|
-
backgroundColor: 'btn.bg',
|
33
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}, ${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.insetShadow}`,
|
34
|
-
'&:hover:not([disabled])': {
|
35
|
-
backgroundColor: 'btn.hoverBg'
|
36
|
-
},
|
37
|
-
// focus must come before :active so that the active box shadow overrides
|
38
|
-
'&:focus:not([disabled])': {
|
39
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
40
|
-
},
|
41
|
-
'&:active:not([disabled])': {
|
42
|
-
backgroundColor: 'btn.selectedBg',
|
43
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadowActive}`
|
44
|
-
},
|
45
|
-
'&:disabled': {
|
46
|
-
color: 'primer.fg.disabled',
|
47
|
-
backgroundColor: 'btn.disabledBg'
|
48
|
-
}
|
49
|
-
},
|
50
|
-
primary: {
|
51
|
-
color: 'btn.primary.text',
|
52
|
-
backgroundColor: 'btn.primary.bg',
|
53
|
-
borderColor: 'border.subtle',
|
54
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.shadow}`,
|
55
|
-
'&:hover:not([disabled])': {
|
56
|
-
color: 'btn.primary.hoverText',
|
57
|
-
backgroundColor: 'btn.primary.hoverBg'
|
58
|
-
},
|
59
|
-
// focus must come before :active so that the active box shadow overrides
|
60
|
-
'&:focus:not([disabled])': {
|
61
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.focusShadow}`
|
62
|
-
},
|
63
|
-
'&:active:not([disabled])': {
|
64
|
-
backgroundColor: 'btn.primary.selectedBg',
|
65
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.selectedShadow}`
|
66
|
-
},
|
67
|
-
'&:disabled': {
|
68
|
-
color: 'btn.primary.disabledText',
|
69
|
-
backgroundColor: 'btn.primary.disabledBg'
|
70
|
-
},
|
71
|
-
'[data-component="ButtonCounter"]': {
|
72
|
-
backgroundColor: 'btn.primary.counterBg',
|
73
|
-
color: 'btn.primary.text'
|
74
|
-
}
|
75
|
-
},
|
76
|
-
danger: {
|
77
|
-
color: 'btn.danger.text',
|
78
|
-
backgroundColor: 'btn.bg',
|
79
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
80
|
-
'&:hover:not([disabled])': {
|
81
|
-
color: 'btn.danger.hoverText',
|
82
|
-
backgroundColor: 'btn.danger.hoverBg',
|
83
|
-
borderColor: 'btn.danger.hoverBorder',
|
84
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.hoverShadow}`,
|
85
|
-
'[data-component="ButtonCounter"]': {
|
86
|
-
backgroundColor: 'btn.danger.hoverCounterBg',
|
87
|
-
color: 'btn.danger.hoverText'
|
88
|
-
}
|
89
|
-
},
|
90
|
-
// focus must come before :active so that the active box shadow overrides
|
91
|
-
'&:focus:not([disabled])': {
|
92
|
-
borderColor: 'btn.danger.focusBorder',
|
93
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.focusShadow}`
|
94
|
-
},
|
95
|
-
'&:active:not([disabled])': {
|
96
|
-
color: 'btn.danger.selectedText',
|
97
|
-
backgroundColor: 'btn.danger.selectedBg',
|
98
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.selectedShadow}`,
|
99
|
-
borderColor: 'btn.danger.selectedBorder'
|
100
|
-
},
|
101
|
-
'&:disabled': {
|
102
|
-
color: 'btn.danger.disabledText',
|
103
|
-
backgroundColor: 'btn.danger.disabledBg',
|
104
|
-
borderColor: 'btn.danger.disabledBorder',
|
105
|
-
'[data-component="ButtonCounter"]': {
|
106
|
-
backgroundColor: 'btn.danger.disabledCounterBg'
|
107
|
-
}
|
108
|
-
},
|
109
|
-
'[data-component="ButtonCounter"]': {
|
110
|
-
color: 'btn.danger.text',
|
111
|
-
backgroundColor: 'btn.danger.counterBg'
|
112
|
-
}
|
113
|
-
},
|
114
|
-
invisible: {
|
115
|
-
color: 'accent.fg',
|
116
|
-
backgroundColor: 'transparent',
|
117
|
-
border: '0',
|
118
|
-
boxShadow: 'none',
|
119
|
-
'&:hover:not([disabled])': {
|
120
|
-
backgroundColor: 'btn.hoverBg'
|
121
|
-
},
|
122
|
-
// focus must come before :active so that the active box shadow overrides
|
123
|
-
'&:focus:not([disabled])': {
|
124
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
125
|
-
},
|
126
|
-
'&:active:not([disabled])': {
|
127
|
-
backgroundColor: 'btn.selectedBg'
|
128
|
-
},
|
129
|
-
'&:disabled': {
|
130
|
-
color: 'primer.fg.disabled'
|
131
|
-
}
|
132
|
-
},
|
133
|
-
outline: {
|
134
|
-
color: 'btn.outline.text',
|
135
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
136
|
-
'&:hover': {
|
137
|
-
color: 'btn.outline.hoverText',
|
138
|
-
backgroundColor: 'btn.outline.hoverBg',
|
139
|
-
borderColor: 'outline.hoverBorder',
|
140
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.hoverShadow}`,
|
141
|
-
'[data-component="ButtonCounter"]': {
|
142
|
-
backgroundColor: 'btn.outline.hoverCounterBg',
|
143
|
-
color: 'btn.outline.hoverText'
|
144
|
-
}
|
145
|
-
},
|
146
|
-
// focus must come before :active so that the active box shadow overrides
|
147
|
-
'&:focus': {
|
148
|
-
borderColor: 'btn.outline.focusBorder',
|
149
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.focusShadow}`
|
150
|
-
},
|
151
|
-
'&:active:not([disabled])': {
|
152
|
-
color: 'btn.outline.selectedText',
|
153
|
-
backgroundColor: 'btn.outline.selectedBg',
|
154
|
-
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.selectedShadow}`,
|
155
|
-
borderColor: 'btn.outline.selectedBorder'
|
156
|
-
},
|
157
|
-
'&:disabled': {
|
158
|
-
color: 'btn.outline.disabledText',
|
159
|
-
backgroundColor: 'btn.outline.disabledBg',
|
160
|
-
borderColor: 'btn.border',
|
161
|
-
'[data-component="ButtonCounter"]': {
|
162
|
-
backgroundColor: 'btn.outline.disabledCounterBg'
|
163
|
-
}
|
164
|
-
},
|
165
|
-
'[data-component="ButtonCounter"]': {
|
166
|
-
backgroundColor: 'btn.outline.counterBg',
|
167
|
-
color: 'btn.outline.text'
|
168
|
-
}
|
169
|
-
}
|
170
|
-
};
|
171
|
-
return style[variant];
|
172
|
-
};
|
173
|
-
|
174
|
-
const getSizeStyles = (size = 'medium', variant = 'default', iconOnly) => {
|
175
|
-
let paddingY, paddingX, fontSize;
|
176
|
-
|
177
|
-
switch (size) {
|
178
|
-
case 'small':
|
179
|
-
paddingY = 3;
|
180
|
-
paddingX = 12;
|
181
|
-
fontSize = 0;
|
182
|
-
break;
|
183
|
-
|
184
|
-
case 'large':
|
185
|
-
paddingY = 9;
|
186
|
-
paddingX = 20;
|
187
|
-
fontSize = 2;
|
188
|
-
break;
|
189
|
-
|
190
|
-
case 'medium':
|
191
|
-
default:
|
192
|
-
paddingY = 5;
|
193
|
-
paddingX = 16;
|
194
|
-
fontSize = 1;
|
195
|
-
}
|
196
|
-
|
197
|
-
if (iconOnly) {
|
198
|
-
paddingX = paddingY + 2;
|
199
|
-
}
|
200
|
-
|
201
|
-
if (variant === 'invisible') {
|
202
|
-
paddingY = paddingY + 1;
|
203
|
-
}
|
204
|
-
|
205
|
-
return {
|
206
|
-
paddingY: `${paddingY}px`,
|
207
|
-
paddingX: `${paddingX}px`,
|
208
|
-
fontSize,
|
209
|
-
'[data-component="ButtonCounter"]': {
|
210
|
-
fontSize
|
211
|
-
}
|
212
|
-
};
|
213
|
-
};
|
214
|
-
|
215
|
-
const ButtonBase = _styledComponents.default.button.withConfig({
|
216
|
-
displayName: "button__ButtonBase",
|
217
|
-
componentId: "sc-15k5iqk-0"
|
218
|
-
})(_sx.default);
|
219
|
-
|
220
20
|
const Button = /*#__PURE__*/(0, _react.forwardRef)(({
|
221
21
|
children,
|
222
|
-
sx: sxProp = {},
|
223
22
|
...props
|
224
23
|
}, forwardedRef) => {
|
225
|
-
|
226
|
-
icon: Icon,
|
227
|
-
leadingIcon: LeadingIcon,
|
228
|
-
trailingIcon: TrailingIcon,
|
229
|
-
variant = 'default',
|
230
|
-
size = 'medium'
|
231
|
-
} = props;
|
232
|
-
const iconOnly = !!Icon;
|
233
|
-
const {
|
234
|
-
theme
|
235
|
-
} = (0, _ThemeProvider.useTheme)();
|
236
|
-
const styles = {
|
237
|
-
borderRadius: '2',
|
238
|
-
border: '1px solid',
|
239
|
-
borderColor: theme === null || theme === void 0 ? void 0 : theme.colors.btn.border,
|
240
|
-
display: 'grid',
|
241
|
-
gridTemplateAreas: '"leadingIcon text trailingIcon"',
|
242
|
-
fontWeight: 'bold',
|
243
|
-
lineHeight: TEXT_ROW_HEIGHT,
|
244
|
-
whiteSpace: 'nowrap',
|
245
|
-
verticalAlign: 'middle',
|
246
|
-
cursor: 'pointer',
|
247
|
-
appearance: 'none',
|
248
|
-
userSelect: 'none',
|
249
|
-
textDecoration: 'none',
|
250
|
-
textAlign: 'center',
|
251
|
-
'& > :not(:last-child)': {
|
252
|
-
mr: '2'
|
253
|
-
},
|
254
|
-
'&:focus': {
|
255
|
-
outline: 'none'
|
256
|
-
},
|
257
|
-
'&:disabled': {
|
258
|
-
cursor: 'default'
|
259
|
-
},
|
260
|
-
'&:disabled svg': {
|
261
|
-
opacity: '0.6'
|
262
|
-
},
|
263
|
-
'[data-component="leadingIcon"]': {
|
264
|
-
gridArea: 'leadingIcon'
|
265
|
-
},
|
266
|
-
'[data-component="text"]': {
|
267
|
-
gridArea: 'text'
|
268
|
-
},
|
269
|
-
'[data-component="trailingIcon"]': {
|
270
|
-
gridArea: 'trailingIcon'
|
271
|
-
}
|
272
|
-
};
|
273
|
-
const iconWrapStyles = {
|
274
|
-
display: 'inline-block'
|
275
|
-
};
|
276
|
-
|
277
|
-
const sxStyles = _sx.merge.all([styles, getSizeStyles(size, variant, iconOnly), getVariantStyles(variant, theme), sxProp]);
|
278
|
-
|
279
|
-
return /*#__PURE__*/_react.default.createElement(ButtonBase, _extends({
|
280
|
-
sx: sxStyles,
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_buttonBase.default, _extends({
|
281
25
|
ref: forwardedRef
|
282
|
-
}, props
|
283
|
-
as: "
|
284
|
-
|
285
|
-
sx: iconWrapStyles,
|
286
|
-
"aria-hidden": !iconOnly
|
287
|
-
}, /*#__PURE__*/_react.default.createElement(LeadingIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
|
288
|
-
"data-component": "text",
|
289
|
-
hidden: Icon ? true : false
|
290
|
-
}, children), Icon && /*#__PURE__*/_react.default.createElement(_Box.default, {
|
291
|
-
"data-component": "icon-only",
|
292
|
-
as: "span",
|
293
|
-
sx: {
|
294
|
-
display: 'inline-block'
|
295
|
-
},
|
296
|
-
"aria-hidden": !iconOnly
|
297
|
-
}, /*#__PURE__*/_react.default.createElement(Icon, null)), TrailingIcon && /*#__PURE__*/_react.default.createElement(_Box.default, {
|
298
|
-
as: "span",
|
299
|
-
"data-component": "trailingIcon",
|
300
|
-
sx: { ...iconWrapStyles,
|
301
|
-
ml: 2
|
302
|
-
},
|
303
|
-
"aria-hidden": !iconOnly
|
304
|
-
}, /*#__PURE__*/_react.default.createElement(TrailingIcon, null)));
|
26
|
+
}, props, {
|
27
|
+
as: "button"
|
28
|
+
}), children);
|
305
29
|
});
|
306
30
|
exports.Button = Button;
|
307
|
-
Button.displayName = 'Button';
|
308
|
-
Object.assign(Button, {});
|
31
|
+
Button.displayName = 'Button';
|