@sb1/ffe-buttons-react 21.0.19 → 22.0.0

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.
Files changed (46) hide show
  1. package/es/ActionButton.js +16 -40
  2. package/es/BackButton.js +18 -26
  3. package/es/BaseButton.js +51 -80
  4. package/es/ButtonGroup.js +25 -26
  5. package/es/ExpandButton.js +31 -48
  6. package/es/InlineBaseButton.js +39 -51
  7. package/es/InlineExpandButton.js +33 -38
  8. package/es/PrimaryButton.js +17 -39
  9. package/es/SecondaryButton.js +17 -39
  10. package/es/ShortcutButton.js +18 -28
  11. package/es/TaskButton.js +17 -33
  12. package/es/TertiaryButton.js +17 -33
  13. package/es/fixedForwardRef.js +2 -0
  14. package/es/index.js +10 -10
  15. package/es/types.js +1 -0
  16. package/lib/ActionButton.js +22 -47
  17. package/lib/BackButton.js +23 -32
  18. package/lib/BaseButton.js +58 -87
  19. package/lib/ButtonGroup.js +32 -33
  20. package/lib/ExpandButton.js +37 -55
  21. package/lib/InlineBaseButton.js +46 -58
  22. package/lib/InlineExpandButton.js +39 -45
  23. package/lib/PrimaryButton.js +21 -44
  24. package/lib/SecondaryButton.js +21 -44
  25. package/lib/ShortcutButton.js +23 -34
  26. package/lib/TaskButton.js +21 -38
  27. package/lib/TertiaryButton.js +21 -38
  28. package/lib/fixedForwardRef.js +5 -0
  29. package/lib/index.js +22 -75
  30. package/lib/types.js +2 -0
  31. package/package.json +8 -10
  32. package/types/ActionButton.d.ts +4 -0
  33. package/types/BackButton.d.ts +4 -0
  34. package/types/BaseButton.d.ts +22 -0
  35. package/types/ButtonGroup.d.ts +8 -0
  36. package/types/ExpandButton.d.ts +18 -0
  37. package/types/InlineBaseButton.d.ts +28 -0
  38. package/types/InlineExpandButton.d.ts +10 -0
  39. package/types/PrimaryButton.d.ts +4 -0
  40. package/types/SecondaryButton.d.ts +4 -0
  41. package/types/ShortcutButton.d.ts +4 -0
  42. package/types/TaskButton.d.ts +10 -0
  43. package/types/TertiaryButton.d.ts +4 -0
  44. package/types/fixedForwardRef.d.ts +4 -0
  45. package/types/index.d.ts +10 -107
  46. package/types/types.d.ts +8 -0
@@ -1,41 +1,24 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = require("prop-types");
9
- var _InlineBaseButton = _interopRequireDefault(require("./InlineBaseButton"));
10
- var _excluded = ["leftIcon", "rightIcon"];
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
13
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
15
- var TertiaryButton = function TertiaryButton(props) {
16
- var leftIcon = props.leftIcon,
17
- rightIcon = props.rightIcon,
18
- rest = _objectWithoutProperties(props, _excluded);
19
- return /*#__PURE__*/_react.default.createElement(_InlineBaseButton.default, _extends({
20
- buttonType: "tertiary",
21
- leftIcon: leftIcon,
22
- rightIcon: rightIcon
23
- }, rest));
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
24
12
  };
25
- TertiaryButton.propTypes = {
26
- /** The button label */
27
- children: _propTypes.node,
28
- /** Extra class names */
29
- className: _propTypes.string,
30
- /** The rendered element, like an `<a />` or `<Link />` */
31
- element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
32
- /** Ref-setting function, or ref created by useRef, passed to the button element */
33
- innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
34
- current: _propTypes.object
35
- })]),
36
- /** Icon shown to the left of the label */
37
- leftIcon: _propTypes.node,
38
- /** Icon shown to the right of the label */
39
- rightIcon: _propTypes.node
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
15
  };
41
- var _default = exports.default = TertiaryButton;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TertiaryButton = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var InlineBaseButton_1 = require("./InlineBaseButton");
20
+ var fixedForwardRef_1 = require("./fixedForwardRef");
21
+ function TertiaryButtonPropsForwardRef(props, ref) {
22
+ return react_1.default.createElement(InlineBaseButton_1.InlineBaseButton, __assign({}, props, { ref: ref, buttonType: "tertiary" }));
23
+ }
24
+ exports.TertiaryButton = (0, fixedForwardRef_1.fixedForwardRef)(TertiaryButtonPropsForwardRef);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixedForwardRef = void 0;
4
+ var react_1 = require("react");
5
+ exports.fixedForwardRef = react_1.forwardRef;
package/lib/index.js CHANGED
@@ -1,76 +1,23 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ActionButton", {
7
- enumerable: true,
8
- get: function get() {
9
- return _ActionButton.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "BackButton", {
13
- enumerable: true,
14
- get: function get() {
15
- return _BackButton.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "ButtonGroup", {
19
- enumerable: true,
20
- get: function get() {
21
- return _ButtonGroup.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "ExpandButton", {
25
- enumerable: true,
26
- get: function get() {
27
- return _ExpandButton.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "InlineExpandButton", {
31
- enumerable: true,
32
- get: function get() {
33
- return _InlineExpandButton.default;
34
- }
35
- });
36
- Object.defineProperty(exports, "PrimaryButton", {
37
- enumerable: true,
38
- get: function get() {
39
- return _PrimaryButton.default;
40
- }
41
- });
42
- Object.defineProperty(exports, "SecondaryButton", {
43
- enumerable: true,
44
- get: function get() {
45
- return _SecondaryButton.default;
46
- }
47
- });
48
- Object.defineProperty(exports, "ShortcutButton", {
49
- enumerable: true,
50
- get: function get() {
51
- return _ShortcutButton.default;
52
- }
53
- });
54
- Object.defineProperty(exports, "TaskButton", {
55
- enumerable: true,
56
- get: function get() {
57
- return _TaskButton.default;
58
- }
59
- });
60
- Object.defineProperty(exports, "TertiaryButton", {
61
- enumerable: true,
62
- get: function get() {
63
- return _TertiaryButton.default;
64
- }
65
- });
66
- var _ActionButton = _interopRequireDefault(require("./ActionButton"));
67
- var _BackButton = _interopRequireDefault(require("./BackButton"));
68
- var _ButtonGroup = _interopRequireDefault(require("./ButtonGroup"));
69
- var _ExpandButton = _interopRequireDefault(require("./ExpandButton"));
70
- var _InlineExpandButton = _interopRequireDefault(require("./InlineExpandButton"));
71
- var _PrimaryButton = _interopRequireDefault(require("./PrimaryButton"));
72
- var _SecondaryButton = _interopRequireDefault(require("./SecondaryButton"));
73
- var _ShortcutButton = _interopRequireDefault(require("./ShortcutButton"));
74
- var _TaskButton = _interopRequireDefault(require("./TaskButton"));
75
- var _TertiaryButton = _interopRequireDefault(require("./TertiaryButton"));
76
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TertiaryButton = exports.TaskButton = exports.ShortcutButton = exports.SecondaryButton = exports.PrimaryButton = exports.InlineExpandButton = exports.ExpandButton = exports.ButtonGroup = exports.BackButton = exports.ActionButton = void 0;
4
+ var ActionButton_1 = require("./ActionButton");
5
+ Object.defineProperty(exports, "ActionButton", { enumerable: true, get: function () { return ActionButton_1.ActionButton; } });
6
+ var BackButton_1 = require("./BackButton");
7
+ Object.defineProperty(exports, "BackButton", { enumerable: true, get: function () { return BackButton_1.BackButton; } });
8
+ var ButtonGroup_1 = require("./ButtonGroup");
9
+ Object.defineProperty(exports, "ButtonGroup", { enumerable: true, get: function () { return ButtonGroup_1.ButtonGroup; } });
10
+ var ExpandButton_1 = require("./ExpandButton");
11
+ Object.defineProperty(exports, "ExpandButton", { enumerable: true, get: function () { return ExpandButton_1.ExpandButton; } });
12
+ var InlineExpandButton_1 = require("./InlineExpandButton");
13
+ Object.defineProperty(exports, "InlineExpandButton", { enumerable: true, get: function () { return InlineExpandButton_1.InlineExpandButton; } });
14
+ var PrimaryButton_1 = require("./PrimaryButton");
15
+ Object.defineProperty(exports, "PrimaryButton", { enumerable: true, get: function () { return PrimaryButton_1.PrimaryButton; } });
16
+ var SecondaryButton_1 = require("./SecondaryButton");
17
+ Object.defineProperty(exports, "SecondaryButton", { enumerable: true, get: function () { return SecondaryButton_1.SecondaryButton; } });
18
+ var ShortcutButton_1 = require("./ShortcutButton");
19
+ Object.defineProperty(exports, "ShortcutButton", { enumerable: true, get: function () { return ShortcutButton_1.ShortcutButton; } });
20
+ var TaskButton_1 = require("./TaskButton");
21
+ Object.defineProperty(exports, "TaskButton", { enumerable: true, get: function () { return TaskButton_1.TaskButton; } });
22
+ var TertiaryButton_1 = require("./TertiaryButton");
23
+ Object.defineProperty(exports, "TertiaryButton", { enumerable: true, get: function () { return TertiaryButton_1.TertiaryButton; } });
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-buttons-react",
3
- "version": "21.0.19",
3
+ "version": "22.0.0",
4
4
  "description": "React implementation of ffe-buttons",
5
5
  "keywords": [
6
6
  "ffe"
@@ -21,24 +21,22 @@
21
21
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
22
22
  },
23
23
  "scripts": {
24
- "build": "ffe-buildtool babel",
25
- "watch": "ffe-buildtool babel-watch",
24
+ "build": "ffe-buildtool tsc",
25
+ "watch": "ffe-buildtool tsc-watch",
26
26
  "lint": "eslint src",
27
27
  "lint:fix": "eslint src --fix",
28
28
  "test": "ffe-buildtool jest",
29
29
  "test:watch": "ffe-buildtool jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "@sb1/ffe-buttons": "^18.0.19",
33
- "@sb1/ffe-icons-react": "^9.0.9",
34
- "classnames": "^2.3.1",
35
- "prop-types": "^15.7.2"
32
+ "@sb1/ffe-buttons": "^18.0.21",
33
+ "@sb1/ffe-icons-react": "^9.0.11",
34
+ "classnames": "^2.3.1"
36
35
  },
37
36
  "devDependencies": {
38
- "@sb1/ffe-buildtool": "^0.5.2",
37
+ "@sb1/ffe-buildtool": "^0.6.0",
39
38
  "eslint": "^8.57.0",
40
39
  "react": "^16.9.0",
41
- "react-collapse": "^4.0.3",
42
40
  "react-dom": "^16.9.0"
43
41
  },
44
42
  "peerDependencies": {
@@ -47,5 +45,5 @@
47
45
  "publishConfig": {
48
46
  "access": "public"
49
47
  },
50
- "gitHead": "c2e7c509b580bc205ca92d91b7e2e2c0503a0087"
48
+ "gitHead": "9ad9c4e14ec0db89189e0daaebace3028bf667d9"
51
49
  }
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseButtonProps } from './BaseButton';
3
+ export type ActionButtonProps<As extends ElementType = 'button'> = Omit<BaseButtonProps<As>, 'buttonType'>;
4
+ export declare const ActionButton: <As extends React.ElementType>(props: ActionButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { InlineBaseButtonProps } from './InlineBaseButton';
3
+ export type BackButtonProps<As extends ElementType = 'button'> = Omit<InlineBaseButtonProps<As>, 'buttonType' | 'leftIcon'>;
4
+ export declare const BackButton: <As extends React.ElementType>(props: BackButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ import React, { ElementType, ReactElement } from 'react';
2
+ import { ComponentAsPropParams } from './types';
3
+ export type BaseButtonProps<As extends ElementType = 'button'> = ComponentAsPropParams<As> & {
4
+ ariaLoadingMessage?: string;
5
+ buttonType: 'action' | 'primary' | 'secondary' | 'shortcut' | 'task';
6
+ isDisabled?: boolean;
7
+ isLoading?: boolean;
8
+ leftIcon?: ReactElement;
9
+ rightIcon?: ReactElement;
10
+ };
11
+ export declare const BaseButton: <As extends React.ElementType>(props: {
12
+ as?: As | undefined;
13
+ } & import("./types").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "button" : As>, "as" & {
14
+ ref: React.ForwardedRef<any>;
15
+ }> & {
16
+ ariaLoadingMessage?: string | undefined;
17
+ buttonType: 'action' | 'primary' | 'secondary' | 'shortcut' | 'task';
18
+ isDisabled?: boolean | undefined;
19
+ isLoading?: boolean | undefined;
20
+ leftIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
21
+ rightIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
22
+ } & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ButtonGroupProps extends React.ComponentProps<'div'> {
3
+ /** Applies the thin modifier to remove margins */
4
+ thin?: boolean;
5
+ /** Applies the inline modifier to make all child buttons inline */
6
+ inline?: boolean;
7
+ }
8
+ export declare const ButtonGroup: React.FC<ButtonGroupProps>;
@@ -0,0 +1,18 @@
1
+ import React, { ElementType } from 'react';
2
+ import { ComponentAsPropParams } from './types';
3
+ export type ExpandButtonProps<As extends ElementType = 'button'> = ComponentAsPropParams<As> & {
4
+ /** An accessible label for the close-button, only shown in the "isExpanded" state */
5
+ closeLabel?: string;
6
+ /** When true the component will render a circle with an X indicating whatever is controlled is in an expanded state. */
7
+ isExpanded: boolean;
8
+ };
9
+ export declare const ExpandButton: <As extends React.ElementType>(props: {
10
+ as?: As | undefined;
11
+ } & import("./types").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "button" : As>, "as" & {
12
+ ref: React.ForwardedRef<any>;
13
+ }> & {
14
+ /** An accessible label for the close-button, only shown in the "isExpanded" state */
15
+ closeLabel?: string | undefined;
16
+ /** When true the component will render a circle with an X indicating whatever is controlled is in an expanded state. */
17
+ isExpanded: boolean;
18
+ } & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import React, { ElementType, ReactElement } from 'react';
2
+ import { ComponentAsPropParams } from './types';
3
+ export type InlineBaseButtonProps<As extends ElementType = 'button'> = ComponentAsPropParams<As> & {
4
+ /**
5
+ * Enum of supported prop types. Used internally only.
6
+ * @ignore
7
+ */
8
+ buttonType: 'tertiary' | 'back' | 'expand';
9
+ /** Icon shown to the left of the label */
10
+ leftIcon?: ReactElement;
11
+ /** Icon shown to the right of the label */
12
+ rightIcon?: ReactElement;
13
+ };
14
+ export declare const InlineBaseButton: <As extends React.ElementType>(props: {
15
+ as?: As | undefined;
16
+ } & import("./types").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "button" : As>, "as" & {
17
+ ref: React.ForwardedRef<any>;
18
+ }> & {
19
+ /**
20
+ * Enum of supported prop types. Used internally only.
21
+ * @ignore
22
+ */
23
+ buttonType: 'tertiary' | 'back' | 'expand';
24
+ /** Icon shown to the left of the label */
25
+ leftIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
26
+ /** Icon shown to the right of the label */
27
+ rightIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
28
+ } & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React, { ElementType } from 'react';
2
+ import { InlineBaseButtonProps } from './InlineBaseButton';
3
+ export type InlineExpandButtonProps<As extends ElementType = 'button'> = Omit<InlineBaseButtonProps<As>, 'buttonType' | 'rightIcon'> & {
4
+ /** When true it will indicate the button is in its open state */
5
+ isExpanded: boolean;
6
+ };
7
+ export declare const InlineExpandButton: <As extends React.ElementType>(props: Omit<InlineBaseButtonProps<As>, "buttonType" | "rightIcon"> & {
8
+ /** When true it will indicate the button is in its open state */
9
+ isExpanded: boolean;
10
+ } & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseButtonProps } from './BaseButton';
3
+ export type PrimaryButtonProps<As extends ElementType = 'button'> = Omit<BaseButtonProps<As>, 'buttonType'>;
4
+ export declare const PrimaryButton: <As extends React.ElementType>(props: PrimaryButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseButtonProps } from './BaseButton';
3
+ export type SecondaryButtonProps<As extends ElementType = 'button'> = Omit<BaseButtonProps<As>, 'buttonType'>;
4
+ export declare const SecondaryButton: <As extends React.ElementType>(props: SecondaryButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { BaseButtonProps } from './BaseButton';
3
+ export type ShortcutButtonProps<As extends ElementType = 'button'> = Omit<BaseButtonProps<As>, 'buttonType' | 'rightIcon'>;
4
+ export declare const ShortcutButton: <As extends React.ElementType>(props: ShortcutButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React, { ElementType, ReactElement } from 'react';
2
+ import { BaseButtonProps } from './BaseButton';
3
+ export type TaskButtonProps<As extends ElementType = 'button'> = Omit<BaseButtonProps<As>, 'buttonType' | 'leftIcon' | 'rightIcon'> & {
4
+ /** icon element shown to the left of the label */
5
+ icon: ReactElement;
6
+ };
7
+ export declare const TaskButton: <As extends React.ElementType>(props: Omit<BaseButtonProps<As>, "buttonType" | "leftIcon" | "rightIcon"> & {
8
+ /** icon element shown to the left of the label */
9
+ icon: ReactElement;
10
+ } & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React, { ElementType } from 'react';
2
+ import { InlineBaseButtonProps } from './InlineBaseButton';
3
+ export type TertiaryButtonProps<As extends ElementType = 'button'> = Omit<InlineBaseButtonProps<As>, 'buttonType'>;
4
+ export declare const TertiaryButton: <As extends React.ElementType>(props: TertiaryButtonProps<As> & React.RefAttributes<any>) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ type FixedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.JSX.Element) => (props: P & React.RefAttributes<T>) => React.JSX.Element;
3
+ export declare const fixedForwardRef: FixedForwardRef;
4
+ export {};
package/types/index.d.ts CHANGED
@@ -1,107 +1,10 @@
1
- import * as React from 'react';
2
-
3
- export type MinimalBaseButtonProps = {
4
- className?: string;
5
- element?: HTMLElement | string | React.ElementType;
6
- innerRef?: React.Ref<HTMLElement>;
7
- } & (React.ComponentProps<'button'> | React.ComponentProps<'a'>);
8
-
9
- export type BaseButtonProps = {
10
- children?: React.ReactNode;
11
- ariaLoadingMessage?: string;
12
- disabled?: boolean;
13
- isLoading?: boolean;
14
- leftIcon?: React.ReactNode;
15
- rightIcon?: React.ReactNode;
16
- } & MinimalBaseButtonProps;
17
-
18
- type ActionButtonProps = BaseButtonProps;
19
-
20
- export type BackButtonProps = {
21
- children?: React.ReactNode;
22
- } & MinimalBaseButtonProps;
23
-
24
- export interface ButtonGroupProps {
25
- className?: string;
26
- thin?: boolean;
27
- inline?: boolean;
28
- children: React.ReactNode;
29
- }
30
-
31
- export type ExpandButtonProps = {
32
- children: React.ReactNode;
33
- closeLabel?: string;
34
- isExpanded: boolean;
35
- onClick: (e: React.MouseEvent | undefined) => void;
36
- } & MinimalBaseButtonProps;
37
-
38
- export type InlineExpandButtonProps = {
39
- children?: React.ReactNode;
40
- innerRef?: React.Ref<HTMLElement>;
41
- isExpanded: boolean;
42
- onClick: (e: React.MouseEvent | undefined) => void;
43
- } & MinimalBaseButtonProps;
44
-
45
- export type PrimaryButtonProps = BaseButtonProps;
46
-
47
- export type SecondaryButtonProps = BaseButtonProps;
48
-
49
- export type ShortcutButtonProps = {
50
- children?: React.ReactNode;
51
- disabled?: boolean;
52
- } & MinimalBaseButtonProps;
53
-
54
- export type TaskButtonProps = {
55
- children?: React.ReactNode;
56
- disabled?: boolean;
57
- icon: React.ReactNode;
58
- } & MinimalBaseButtonProps;
59
-
60
- export type TertiaryButtonProps = {
61
- children?: React.ReactNode;
62
- leftIcon?: React.ReactNode;
63
- rightIcon?: React.ReactNode;
64
- } & MinimalBaseButtonProps;
65
-
66
- type NoInfer<T> = [T][T extends any ? 0 : never];
67
-
68
- declare class ActionButton<T = {}> extends React.Component<
69
- NoInfer<T> & ActionButtonProps,
70
- any
71
- > {}
72
- declare class BackButton<T = {}> extends React.Component<
73
- NoInfer<T> & BackButtonProps,
74
- any
75
- > {}
76
- declare class ButtonGroup<T = {}> extends React.Component<
77
- NoInfer<T> & ButtonGroupProps,
78
- any
79
- > {}
80
- declare class ExpandButton<T = {}> extends React.Component<
81
- NoInfer<T> & ExpandButtonProps,
82
- any
83
- > {}
84
- declare class InlineExpandButton<T = {}> extends React.Component<
85
- NoInfer<T> & InlineExpandButtonProps,
86
- any
87
- > {}
88
- declare class PrimaryButton<T = {}> extends React.Component<
89
- NoInfer<T> & PrimaryButtonProps,
90
- any
91
- > {}
92
- declare class SecondaryButton<T = {}> extends React.Component<
93
- NoInfer<T> & SecondaryButtonProps,
94
- any
95
- > {}
96
- declare class ShortcutButton<T = {}> extends React.Component<
97
- NoInfer<T> & ShortcutButtonProps,
98
- any
99
- > {}
100
- declare class TaskButton<T = {}> extends React.Component<
101
- NoInfer<T> & TaskButtonProps,
102
- any
103
- > {}
104
- declare class TertiaryButton<T = {}> extends React.Component<
105
- NoInfer<T> & TertiaryButtonProps,
106
- any
107
- > {}
1
+ export { ActionButton, ActionButtonProps } from './ActionButton';
2
+ export { BackButton, BackButtonProps } from './BackButton';
3
+ export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
4
+ export { ExpandButton, ExpandButtonProps } from './ExpandButton';
5
+ export { InlineExpandButton, InlineExpandButtonProps, } from './InlineExpandButton';
6
+ export { PrimaryButton, PrimaryButtonProps } from './PrimaryButton';
7
+ export { SecondaryButton, SecondaryButtonProps } from './SecondaryButton';
8
+ export { ShortcutButton, ShortcutButtonProps } from './ShortcutButton';
9
+ export { TaskButton, TaskButtonProps } from './TaskButton';
10
+ export { TertiaryButton, TertiaryButtonProps } from './TertiaryButton';
@@ -0,0 +1,8 @@
1
+ import { ComponentPropsWithRef, ElementType, ForwardedRef } from 'react';
2
+ export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
3
+ export type ComponentAsPropParams<As extends ElementType> = {
4
+ as?: As;
5
+ } & DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? 'button' : As>, 'as' & {
6
+ ref: ForwardedRef<any>;
7
+ }>;
8
+ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;