@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.
- package/es/ActionButton.js +16 -40
- package/es/BackButton.js +18 -26
- package/es/BaseButton.js +51 -80
- package/es/ButtonGroup.js +25 -26
- package/es/ExpandButton.js +31 -48
- package/es/InlineBaseButton.js +39 -51
- package/es/InlineExpandButton.js +33 -38
- package/es/PrimaryButton.js +17 -39
- package/es/SecondaryButton.js +17 -39
- package/es/ShortcutButton.js +18 -28
- package/es/TaskButton.js +17 -33
- package/es/TertiaryButton.js +17 -33
- package/es/fixedForwardRef.js +2 -0
- package/es/index.js +10 -10
- package/es/types.js +1 -0
- package/lib/ActionButton.js +22 -47
- package/lib/BackButton.js +23 -32
- package/lib/BaseButton.js +58 -87
- package/lib/ButtonGroup.js +32 -33
- package/lib/ExpandButton.js +37 -55
- package/lib/InlineBaseButton.js +46 -58
- package/lib/InlineExpandButton.js +39 -45
- package/lib/PrimaryButton.js +21 -44
- package/lib/SecondaryButton.js +21 -44
- package/lib/ShortcutButton.js +23 -34
- package/lib/TaskButton.js +21 -38
- package/lib/TertiaryButton.js +21 -38
- package/lib/fixedForwardRef.js +5 -0
- package/lib/index.js +22 -75
- package/lib/types.js +2 -0
- package/package.json +8 -10
- package/types/ActionButton.d.ts +4 -0
- package/types/BackButton.d.ts +4 -0
- package/types/BaseButton.d.ts +22 -0
- package/types/ButtonGroup.d.ts +8 -0
- package/types/ExpandButton.d.ts +18 -0
- package/types/InlineBaseButton.d.ts +28 -0
- package/types/InlineExpandButton.d.ts +10 -0
- package/types/PrimaryButton.d.ts +4 -0
- package/types/SecondaryButton.d.ts +4 -0
- package/types/ShortcutButton.d.ts +4 -0
- package/types/TaskButton.d.ts +10 -0
- package/types/TertiaryButton.d.ts +4 -0
- package/types/fixedForwardRef.d.ts +4 -0
- package/types/index.d.ts +10 -107
- package/types/types.d.ts +8 -0
package/es/SecondaryButton.js
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
12
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
13
|
-
buttonType: "secondary",
|
|
14
|
-
leftIcon: leftIcon,
|
|
15
|
-
rightIcon: rightIcon
|
|
16
|
-
}, rest));
|
|
17
|
-
};
|
|
18
|
-
SecondaryButton.propTypes = {
|
|
19
|
-
/** Aria label for loading indicator */
|
|
20
|
-
ariaLoadingMessage: string,
|
|
21
|
-
/** The button label */
|
|
22
|
-
children: node,
|
|
23
|
-
/** Extra class names */
|
|
24
|
-
className: string,
|
|
25
|
-
/** Disable a button in certain situations */
|
|
26
|
-
disabled: bool,
|
|
27
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
28
|
-
element: oneOfType([func, string, elementType]),
|
|
29
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
30
|
-
innerRef: oneOfType([func, shape({
|
|
31
|
-
current: object
|
|
32
|
-
})]),
|
|
33
|
-
/** Shows a loader if true */
|
|
34
|
-
isLoading: bool,
|
|
35
|
-
/** Icon shown to the left of the label */
|
|
36
|
-
leftIcon: node,
|
|
37
|
-
/** Icon shown to the right of the label */
|
|
38
|
-
rightIcon: node
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
39
11
|
};
|
|
40
|
-
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { BaseButton } from './BaseButton';
|
|
14
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
15
|
+
function SecondaryButtonWithForwardRef(props, ref) {
|
|
16
|
+
return React.createElement(BaseButton, __assign({}, props, { ref: ref, buttonType: "secondary" }));
|
|
17
|
+
}
|
|
18
|
+
export var SecondaryButton = fixedForwardRef(SecondaryButtonWithForwardRef);
|
package/es/ShortcutButton.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
2
12
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
13
|
+
import { BaseButton } from './BaseButton';
|
|
14
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
5
15
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
fileUrl: chevronRightIcon,
|
|
12
|
-
size: "md"
|
|
13
|
-
})
|
|
14
|
-
}, props));
|
|
15
|
-
};
|
|
16
|
-
ShortcutButton.propTypes = {
|
|
17
|
-
/** The button label */
|
|
18
|
-
children: node,
|
|
19
|
-
/** Extra class names */
|
|
20
|
-
className: string,
|
|
21
|
-
/** Disable a button in certain situations */
|
|
22
|
-
disabled: bool,
|
|
23
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
24
|
-
element: oneOfType([func, string, elementType]),
|
|
25
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
26
|
-
innerRef: oneOfType([func, shape({
|
|
27
|
-
current: object
|
|
28
|
-
})])
|
|
29
|
-
};
|
|
30
|
-
export default ShortcutButton;
|
|
16
|
+
function ShortcutButtonWithForwardRef(props, ref) {
|
|
17
|
+
var chevronRightIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Ik01MTcuODQ3LTQ4MCAzNTQuOTI0LTY0Mi45MjRxLTguMzA4LTguMzA3LTguNS0yMC44ODQtLjE5My0xMi41NzYgOC41LTIxLjI2OCA4LjY5Mi04LjY5MyAyMS4wNzYtOC42OTN0MjEuMDc2IDguNjkzbDE3OS43NjkgMTc5Ljc2OXE1LjYxNiA1LjYxNSA3LjkyMyAxMS44NDYgMi4zMDggNi4yMyAyLjMwOCAxMy40NjF0LTIuMzA4IDEzLjQ2MXEtMi4zMDcgNi4yMzEtNy45MjMgMTEuODQ2TDM5Ny4wNzYtMjc0LjkyNHEtOC4zMDcgOC4zMDgtMjAuODg0IDguNS0xMi41NzYuMTkzLTIxLjI2OC04LjUtOC42OTMtOC42OTItOC42OTMtMjEuMDc2dDguNjkzLTIxLjA3Nkw1MTcuODQ3LTQ4MFoiLz48L3N2Zz4=';
|
|
18
|
+
return (React.createElement(BaseButton, __assign({ rightIcon: React.createElement(Icon, { fileUrl: chevronRightIcon, size: "md" }) }, props, { ref: ref, buttonType: "shortcut" })));
|
|
19
|
+
}
|
|
20
|
+
export var ShortcutButton = fixedForwardRef(ShortcutButtonWithForwardRef);
|
package/es/TaskButton.js
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
12
|
-
buttonType: "task",
|
|
13
|
-
leftIcon: /*#__PURE__*/React.createElement("div", {
|
|
14
|
-
"aria-hidden": "true"
|
|
15
|
-
}, icon)
|
|
16
|
-
}, rest));
|
|
17
|
-
};
|
|
18
|
-
TaskButton.propTypes = {
|
|
19
|
-
/** The button label */
|
|
20
|
-
children: node,
|
|
21
|
-
/** Extra class names */
|
|
22
|
-
className: string,
|
|
23
|
-
/** Disable a button in certain situations */
|
|
24
|
-
disabled: bool,
|
|
25
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
26
|
-
element: oneOfType([func, string, elementType]),
|
|
27
|
-
/** icon element shown to the left of the label */
|
|
28
|
-
icon: node,
|
|
29
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
30
|
-
innerRef: oneOfType([func, shape({
|
|
31
|
-
current: object
|
|
32
|
-
})])
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
33
11
|
};
|
|
34
|
-
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { BaseButton } from './BaseButton';
|
|
14
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
15
|
+
function TaskButtonWithForwardRef(props, ref) {
|
|
16
|
+
return (React.createElement(BaseButton, __assign({ leftIcon: props.icon }, props, { ref: ref, buttonType: "task" })));
|
|
17
|
+
}
|
|
18
|
+
export var TaskButton = fixedForwardRef(TaskButtonWithForwardRef);
|
package/es/TertiaryButton.js
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
12
|
-
return /*#__PURE__*/React.createElement(InlineButton, _extends({
|
|
13
|
-
buttonType: "tertiary",
|
|
14
|
-
leftIcon: leftIcon,
|
|
15
|
-
rightIcon: rightIcon
|
|
16
|
-
}, rest));
|
|
17
|
-
};
|
|
18
|
-
TertiaryButton.propTypes = {
|
|
19
|
-
/** The button label */
|
|
20
|
-
children: node,
|
|
21
|
-
/** Extra class names */
|
|
22
|
-
className: string,
|
|
23
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
24
|
-
element: oneOfType([func, string, elementType]),
|
|
25
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
26
|
-
innerRef: oneOfType([func, shape({
|
|
27
|
-
current: object
|
|
28
|
-
})]),
|
|
29
|
-
/** Icon shown to the left of the label */
|
|
30
|
-
leftIcon: node,
|
|
31
|
-
/** Icon shown to the right of the label */
|
|
32
|
-
rightIcon: node
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
33
11
|
};
|
|
34
|
-
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { InlineBaseButton } from './InlineBaseButton';
|
|
14
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
15
|
+
function TertiaryButtonPropsForwardRef(props, ref) {
|
|
16
|
+
return React.createElement(InlineBaseButton, __assign({}, props, { ref: ref, buttonType: "tertiary" }));
|
|
17
|
+
}
|
|
18
|
+
export var TertiaryButton = fixedForwardRef(TertiaryButtonPropsForwardRef);
|
package/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
1
|
+
export { ActionButton } from './ActionButton';
|
|
2
|
+
export { BackButton } from './BackButton';
|
|
3
|
+
export { ButtonGroup } from './ButtonGroup';
|
|
4
|
+
export { ExpandButton } from './ExpandButton';
|
|
5
|
+
export { InlineExpandButton, } from './InlineExpandButton';
|
|
6
|
+
export { PrimaryButton } from './PrimaryButton';
|
|
7
|
+
export { SecondaryButton } from './SecondaryButton';
|
|
8
|
+
export { ShortcutButton } from './ShortcutButton';
|
|
9
|
+
export { TaskButton } from './TaskButton';
|
|
10
|
+
export { TertiaryButton } from './TertiaryButton';
|
package/es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/ActionButton.js
CHANGED
|
@@ -1,49 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
buttonType: "action"
|
|
23
|
-
className: (0, _classnames.default)(className),
|
|
24
|
-
leftIcon: leftIcon,
|
|
25
|
-
rightIcon: rightIcon
|
|
26
|
-
}, 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);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ActionButton = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var BaseButton_1 = require("./BaseButton");
|
|
20
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
21
|
+
function ActionButtonWithForwardRef(props, ref) {
|
|
22
|
+
return react_1.default.createElement(BaseButton_1.BaseButton, __assign({}, props, { ref: ref, buttonType: "action" }));
|
|
27
23
|
}
|
|
28
|
-
ActionButton
|
|
29
|
-
/** Aria label for loading indicator */
|
|
30
|
-
ariaLoadingMessage: _propTypes.string,
|
|
31
|
-
/** The button label */
|
|
32
|
-
children: _propTypes.node,
|
|
33
|
-
/** Extra class names */
|
|
34
|
-
className: _propTypes.string,
|
|
35
|
-
/** Disable a button in certain situations */
|
|
36
|
-
disabled: _propTypes.bool,
|
|
37
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
38
|
-
element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
|
|
39
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
40
|
-
innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
|
|
41
|
-
current: _propTypes.object
|
|
42
|
-
})]),
|
|
43
|
-
/** Shows a loader if true */
|
|
44
|
-
isLoading: _propTypes.bool,
|
|
45
|
-
/** Icon shown to the left of the label */
|
|
46
|
-
leftIcon: _propTypes.node,
|
|
47
|
-
/** Icon shown to the right of the label */
|
|
48
|
-
rightIcon: _propTypes.node
|
|
49
|
-
};
|
|
24
|
+
exports.ActionButton = (0, fixedForwardRef_1.fixedForwardRef)(ActionButtonWithForwardRef);
|
package/lib/BackButton.js
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
var BackButton = function BackButton(props) {
|
|
14
|
-
var chevronLeftIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Im00MTguMTUzLTQ4MCAxNjIuOTIzIDE2Mi45MjRxOC4zMDggOC4zMDcgOC41IDIwLjg4NC4xOTMgMTIuNTc2LTguNSAyMS4yNjgtOC42OTIgOC42OTMtMjEuMDc2IDguNjkzdC0yMS4wNzYtOC42OTNMMzU5LjE1NS00NTQuNjkzcS01LjYxNi01LjYxNS03LjkyMy0xMS44NDYtMi4zMDgtNi4yMy0yLjMwOC0xMy40NjF0Mi4zMDgtMTMuNDYxcTIuMzA3LTYuMjMxIDcuOTIzLTExLjg0NmwxNzkuNzY5LTE3OS43NjlxOC4zMDctOC4zMDggMjAuODg0LTguNSAxMi41NzYtLjE5MyAyMS4yNjggOC41IDguNjkzIDguNjkyIDguNjkzIDIxLjA3NnQtOC42OTMgMjEuMDc2TDQxOC4xNTMtNDgwWiIvPjwvc3ZnPg==';
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_InlineBaseButton.default, _extends({
|
|
16
|
-
buttonType: "back",
|
|
17
|
-
leftIcon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
|
|
18
|
-
fileUrl: chevronLeftIcon,
|
|
19
|
-
size: "md"
|
|
20
|
-
})
|
|
21
|
-
}, props));
|
|
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);
|
|
22
12
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: _propTypes.node,
|
|
26
|
-
/** Extra class names */
|
|
27
|
-
className: _propTypes.string,
|
|
28
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
29
|
-
element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
|
|
30
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
31
|
-
innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
|
|
32
|
-
current: _propTypes.object
|
|
33
|
-
})])
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
15
|
};
|
|
35
|
-
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.BackButton = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var InlineBaseButton_1 = require("./InlineBaseButton");
|
|
20
|
+
var ffe_icons_react_1 = require("@sb1/ffe-icons-react");
|
|
21
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
22
|
+
function BackButtonWithForwardRef(props, ref) {
|
|
23
|
+
var chevronLeftIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Im00MTguMTUzLTQ4MCAxNjIuOTIzIDE2Mi45MjRxOC4zMDggOC4zMDcgOC41IDIwLjg4NC4xOTMgMTIuNTc2LTguNSAyMS4yNjgtOC42OTIgOC42OTMtMjEuMDc2IDguNjkzdC0yMS4wNzYtOC42OTNMMzU5LjE1NS00NTQuNjkzcS01LjYxNi01LjYxNS03LjkyMy0xMS44NDYtMi4zMDgtNi4yMy0yLjMwOC0xMy40NjF0Mi4zMDgtMTMuNDYxcTIuMzA3LTYuMjMxIDcuOTIzLTExLjg0NmwxNzkuNzY5LTE3OS43NjlxOC4zMDctOC4zMDggMjAuODg0LTguNSAxMi41NzYtLjE5MyAyMS4yNjggOC41IDguNjkzIDguNjkyIDguNjkzIDIxLjA3NnQtOC42OTMgMjEuMDc2TDQxOC4xNTMtNDgwWiIvPjwvc3ZnPg==';
|
|
24
|
+
return (react_1.default.createElement(InlineBaseButton_1.InlineBaseButton, __assign({}, props, { buttonType: "back", leftIcon: react_1.default.createElement(ffe_icons_react_1.Icon, { fileUrl: chevronLeftIcon, size: "md" }), ref: ref })));
|
|
25
|
+
}
|
|
26
|
+
exports.BackButton = (0, fixedForwardRef_1.fixedForwardRef)(BackButtonWithForwardRef);
|
package/lib/BaseButton.js
CHANGED
|
@@ -1,91 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.BaseButton = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
31
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
15
32
|
/**
|
|
16
33
|
* Internal component
|
|
34
|
+
* @ignore
|
|
17
35
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_onClick(event);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, rest), /*#__PURE__*/_react.default.createElement("span", {
|
|
49
|
-
className: "ffe-button__label"
|
|
50
|
-
}, leftIcon && /*#__PURE__*/_react.default.cloneElement(leftIcon, {
|
|
51
|
-
className: 'ffe-button__icon ffe-button__icon--left',
|
|
52
|
-
size: 'md'
|
|
53
|
-
}), children, rightIcon && /*#__PURE__*/_react.default.cloneElement(rightIcon, {
|
|
54
|
-
className: 'ffe-button__icon ffe-button__icon--right',
|
|
55
|
-
size: 'md'
|
|
56
|
-
})), supportsSpinner && isLoading && /*#__PURE__*/_react.default.createElement("span", {
|
|
57
|
-
"aria-label": ariaLoadingMessage,
|
|
58
|
-
role: "img",
|
|
59
|
-
className: "ffe-button__spinner"
|
|
60
|
-
}));
|
|
61
|
-
};
|
|
62
|
-
BaseButton.propTypes = {
|
|
63
|
-
/** Aria label for loading indicator */
|
|
64
|
-
ariaLoadingMessage: _propTypes.string,
|
|
65
|
-
/**
|
|
66
|
-
* Enum of supported prop types. Used internally only.
|
|
67
|
-
* @ignore
|
|
68
|
-
*/
|
|
69
|
-
buttonType: (0, _propTypes.oneOf)(['action', 'primary', 'secondary', 'shortcut', 'task']),
|
|
70
|
-
/** The button label */
|
|
71
|
-
children: _propTypes.node,
|
|
72
|
-
/** Extra class names */
|
|
73
|
-
className: _propTypes.string,
|
|
74
|
-
/** Disable a button in certain situations */
|
|
75
|
-
disabled: _propTypes.bool,
|
|
76
|
-
/** The rendered element, like an `<a />` or `<Link />` */
|
|
77
|
-
element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
|
|
78
|
-
/** Ref-setting function, or ref created by useRef, passed to the button element */
|
|
79
|
-
innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
|
|
80
|
-
current: _propTypes.object
|
|
81
|
-
})]),
|
|
82
|
-
/** Shows a loader if true */
|
|
83
|
-
isLoading: _propTypes.bool,
|
|
84
|
-
/** Icon shown to the left of the label */
|
|
85
|
-
leftIcon: _propTypes.node,
|
|
86
|
-
/** Icon shown to the right of the label */
|
|
87
|
-
rightIcon: _propTypes.node,
|
|
88
|
-
/** Called when button is clicked if not loading or disabled */
|
|
89
|
-
onClick: _propTypes.func
|
|
90
|
-
};
|
|
91
|
-
var _default = exports.default = BaseButton;
|
|
36
|
+
function BaseButtonWithForwardRef(props, ref) {
|
|
37
|
+
var _a = props.as, Comp = _a === void 0 ? 'button' : _a, buttonType = props.buttonType, isLoading = props.isLoading, isDisabled = props.isDisabled, className = props.className, onClick = props.onClick, leftIcon = props.leftIcon, rightIcon = props.rightIcon, ariaLoadingMessage = props.ariaLoadingMessage, children = props.children, rest = __rest(props, ["as", "buttonType", "isLoading", "isDisabled", "className", "onClick", "leftIcon", "rightIcon", "ariaLoadingMessage", "children"]);
|
|
38
|
+
var supportsSpinner = ['action', 'primary', 'secondary'].includes(buttonType);
|
|
39
|
+
return (react_1.default.createElement(Comp, __assign({ "aria-busy": isLoading && supportsSpinner, "aria-disabled": isDisabled || (isLoading && supportsSpinner), className: (0, classnames_1.default)('ffe-button', "ffe-button--".concat(buttonType), { 'ffe-button--loading': isLoading && supportsSpinner }, className), onClick: function (event) {
|
|
40
|
+
if (isLoading && supportsSpinner) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
}
|
|
44
|
+
else if (onClick) {
|
|
45
|
+
onClick(event);
|
|
46
|
+
}
|
|
47
|
+
} }, rest, { ref: ref }),
|
|
48
|
+
react_1.default.createElement("span", { className: "ffe-button__label" },
|
|
49
|
+
leftIcon &&
|
|
50
|
+
react_1.default.cloneElement(leftIcon, {
|
|
51
|
+
className: 'ffe-button__icon ffe-button__icon--left',
|
|
52
|
+
size: 'md',
|
|
53
|
+
}),
|
|
54
|
+
children,
|
|
55
|
+
rightIcon &&
|
|
56
|
+
react_1.default.cloneElement(rightIcon, {
|
|
57
|
+
className: 'ffe-button__icon ffe-button__icon--right',
|
|
58
|
+
size: 'md',
|
|
59
|
+
})),
|
|
60
|
+
supportsSpinner && isLoading && (react_1.default.createElement("span", { "aria-label": ariaLoadingMessage, role: "img", className: "ffe-button__spinner" }))));
|
|
61
|
+
}
|
|
62
|
+
exports.BaseButton = (0, fixedForwardRef_1.fixedForwardRef)(BaseButtonWithForwardRef);
|
package/lib/ButtonGroup.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 ButtonGroup = function ButtonGroup(_ref) {
|
|
16
|
-
var className = _ref.className,
|
|
17
|
-
thin = _ref.thin,
|
|
18
|
-
inline = _ref.inline,
|
|
19
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
21
|
-
className: (0, _classnames.default)('ffe-button-group', {
|
|
22
|
-
'ffe-button-group--thin': thin
|
|
23
|
-
}, {
|
|
24
|
-
'ffe-button-group--inline': inline
|
|
25
|
-
}, className)
|
|
26
|
-
}, 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);
|
|
27
12
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
35
23
|
};
|
|
36
|
-
var
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ButtonGroup = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
var ButtonGroup = function (_a) {
|
|
32
|
+
var className = _a.className, thin = _a.thin, inline = _a.inline, rest = __rest(_a, ["className", "thin", "inline"]);
|
|
33
|
+
return (react_1.default.createElement("div", __assign({ "data-testid": "button-group", className: (0, classnames_1.default)('ffe-button-group', { 'ffe-button-group--thin': thin }, { 'ffe-button-group--inline': inline }, className) }, rest)));
|
|
34
|
+
};
|
|
35
|
+
exports.ButtonGroup = ButtonGroup;
|