@ebay/ui-core-react 3.4.0 → 3.4.1
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/ebay-button/README.md +6 -4
- package/ebay-button/button-expand.d.ts.map +1 -1
- package/ebay-button/button-expand.js +2 -2
- package/ebay-button/button.d.ts +3 -2
- package/ebay-button/button.d.ts.map +1 -1
- package/ebay-button/button.js +24 -11
- package/ebay-button/types.d.ts +2 -1
- package/ebay-button/types.d.ts.map +1 -1
- package/package.json +1 -1
package/ebay-button/README.md
CHANGED
|
@@ -51,10 +51,12 @@ Name | Type | Stateful | Required | Description | Data
|
|
|
51
51
|
`href` | String | No | No | for link that looks like a button
|
|
52
52
|
`fluid` | Boolean | No | No | takes the whole width of the parent element
|
|
53
53
|
`disabled` | Boolean | Yes | No
|
|
54
|
-
`partiallyDisabled` | Boolean | No | No | sets aria
|
|
55
|
-
`transparent` | Boolean | Yes | No |
|
|
54
|
+
`partiallyDisabled` | Boolean | No | No | sets `aria-disabled` but not `disabled` prop
|
|
55
|
+
`transparent` | Boolean | Yes | No | transparent background color (overrides `priority` prop)
|
|
56
56
|
`truncate` | Boolean | No | No | will truncate the text of the button onto a single line, and adds an ellipsis, when the button's text overflows
|
|
57
|
-
`borderless` | Boolean | No | No |
|
|
58
|
-
`fixedHeight` | Boolean | No | No |
|
|
57
|
+
`borderless` | Boolean | No | No | shows button without border
|
|
58
|
+
`fixedHeight` | Boolean | No | No | fixes the height based on `size`
|
|
59
59
|
`onClick` | Function | - | No | click or action key pressed (`Space` / `Enter`)
|
|
60
60
|
`onEscape` | Function | - | No | `Esc`-key pressed
|
|
61
|
+
`onFocus` | Function | - | No | triggered on focus
|
|
62
|
+
`onBlur` | Function | - | No | triggered on blur
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-expand.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button-expand.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAKjC,QAAA,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"button-expand.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button-expand.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAKjC,QAAA,MAAM,gBAAgB,EAAE,EAUnB,CAAA;AAEL,eAAe,gBAAgB,CAAA"}
|
|
@@ -9,8 +9,8 @@ var button_text_1 = __importDefault(require("./button-text"));
|
|
|
9
9
|
var ebay_icon_1 = require("../ebay-icon");
|
|
10
10
|
var EbayButtonExpand = function (_a) {
|
|
11
11
|
var children = _a.children;
|
|
12
|
-
return (react_1.default.createElement(button_cell_1.default, null,
|
|
12
|
+
return children ? (react_1.default.createElement(button_cell_1.default, null,
|
|
13
13
|
react_1.default.createElement(button_text_1.default, null, children),
|
|
14
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "dropdown" })));
|
|
14
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "dropdown" }))) : (react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "dropdown" }));
|
|
15
15
|
};
|
|
16
16
|
exports.default = EbayButtonExpand;
|
package/ebay-button/button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentProps, KeyboardEvent, MouseEvent, RefObject } from 'react';
|
|
2
|
-
import { Priority, Size, BodyState, Variant } from './types';
|
|
2
|
+
import { Priority, Size, BodyState, Variant, Split } from './types';
|
|
3
3
|
export declare type EbayButtonProps = {
|
|
4
4
|
fluid?: boolean;
|
|
5
5
|
partiallyDisabled?: boolean;
|
|
@@ -9,6 +9,7 @@ export declare type EbayButtonProps = {
|
|
|
9
9
|
variant?: Variant;
|
|
10
10
|
size?: Size;
|
|
11
11
|
bodyState?: BodyState;
|
|
12
|
+
split?: Split;
|
|
12
13
|
transparent?: boolean;
|
|
13
14
|
onClick?: (e: MouseEvent) => void;
|
|
14
15
|
onEscape?: (e: KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
@@ -17,6 +18,6 @@ export declare type EbayButtonProps = {
|
|
|
17
18
|
fixedHeight?: boolean;
|
|
18
19
|
};
|
|
19
20
|
declare type Props = ComponentProps<'button'> & ComponentProps<'a'> & EbayButtonProps;
|
|
20
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "type" | "download" | "key" | "name" | "className" | "forwardedRef" | "color" | "id" | "lang" | "media" | "target" | "role" | "tabIndex" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "priority" | "variant" | "bodyState" | "transparent" | "fluid" | "disabled" | "partiallyDisabled" | "onEscape" | "truncate" | "borderless" | "fixedHeight" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "hrefLang" | "ping" | "rel" | "referrerPolicy"> & React.RefAttributes<React.FC<Props>>>;
|
|
21
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "type" | "download" | "key" | "name" | "className" | "forwardedRef" | "color" | "id" | "lang" | "media" | "target" | "role" | "tabIndex" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "priority" | "variant" | "bodyState" | "split" | "transparent" | "fluid" | "disabled" | "partiallyDisabled" | "onEscape" | "truncate" | "borderless" | "fixedHeight" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "hrefLang" | "ping" | "rel" | "referrerPolicy"> & React.RefAttributes<React.FC<Props>>>;
|
|
21
22
|
export default _default;
|
|
22
23
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,aAAa,EACb,UAAU,EAGV,SAAS,EACZ,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,aAAa,EACb,UAAU,EAGV,SAAS,EACZ,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKnE,oBAAY,eAAe,GAAG;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,YAAY,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAA;AAED,aAAK,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC;;AAmH9E,wBAAyC"}
|
package/ebay-button/button.js
CHANGED
|
@@ -50,13 +50,8 @@ var component_utils_1 = require("../common/component-utils");
|
|
|
50
50
|
var ebay_icon_1 = require("../ebay-icon");
|
|
51
51
|
var button_loading_1 = __importDefault(require("./button-loading"));
|
|
52
52
|
var button_expand_1 = __importDefault(require("./button-expand"));
|
|
53
|
-
function isIconOnly(children) {
|
|
54
|
-
var childrenArray = react_1.Children.toArray(children);
|
|
55
|
-
return childrenArray.length === 1 && childrenArray[0].type === ebay_icon_1.EbayIcon;
|
|
56
|
-
}
|
|
57
53
|
var EbayButton = function (_a) {
|
|
58
|
-
var _b = _a.priority, priority = _b === void 0 ? 'secondary' : _b, _c = _a.variant, variant = _c === void 0 ? 'standard' : _c, _d = _a.size, size = _d === void 0 ? 'regular' : _d, bodyState = _a.bodyState, _e = _a.transparent, transparent = _e === void 0 ? false : _e, _f = _a.fluid, fluid = _f === void 0 ? false : _f, disabled = _a.disabled, partiallyDisabled = _a.partiallyDisabled, children = _a.children, _g = _a.onEscape, onEscape = _g === void 0 ? function () { } : _g, _h = _a.truncate, truncate = _h === void 0 ? false : _h, href = _a.href, extraClasses = _a.className, forwardedRef = _a.forwardedRef, borderless = _a.borderless, fixedHeight = _a.fixedHeight, rest = __rest(_a, ["priority", "variant", "size", "bodyState", "transparent", "fluid", "disabled", "partiallyDisabled", "children", "onEscape", "truncate", "href", "className", "forwardedRef", "borderless", "fixedHeight"]);
|
|
59
|
-
var iconOnly = isIconOnly(children);
|
|
54
|
+
var _b = _a.priority, priority = _b === void 0 ? 'secondary' : _b, _c = _a.variant, variant = _c === void 0 ? 'standard' : _c, _d = _a.size, size = _d === void 0 ? 'regular' : _d, bodyState = _a.bodyState, split = _a.split, _e = _a.transparent, transparent = _e === void 0 ? false : _e, _f = _a.fluid, fluid = _f === void 0 ? false : _f, disabled = _a.disabled, partiallyDisabled = _a.partiallyDisabled, children = _a.children, _g = _a.onEscape, onEscape = _g === void 0 ? function () { } : _g, _h = _a.truncate, truncate = _h === void 0 ? false : _h, href = _a.href, extraClasses = _a.className, forwardedRef = _a.forwardedRef, borderless = _a.borderless, fixedHeight = _a.fixedHeight, rest = __rest(_a, ["priority", "variant", "size", "bodyState", "split", "transparent", "fluid", "disabled", "partiallyDisabled", "children", "onEscape", "truncate", "href", "className", "forwardedRef", "borderless", "fixedHeight"]);
|
|
60
55
|
var classPrefix = href ? 'fake-btn' : 'btn';
|
|
61
56
|
var priorityStyles = {
|
|
62
57
|
primary: classPrefix + "--primary",
|
|
@@ -69,20 +64,38 @@ var EbayButton = function (_a) {
|
|
|
69
64
|
regular: '',
|
|
70
65
|
default: ''
|
|
71
66
|
};
|
|
67
|
+
var splitStyles = {
|
|
68
|
+
start: classPrefix + "--split-start",
|
|
69
|
+
end: classPrefix + "--split-end"
|
|
70
|
+
};
|
|
72
71
|
var isDestructive = variant === 'destructive';
|
|
73
72
|
var isForm = variant === 'form';
|
|
74
73
|
var isLoading = bodyState === 'loading';
|
|
75
|
-
var
|
|
74
|
+
var isExpand = bodyState === 'expand';
|
|
75
|
+
var isSlim = isForm && (isIconOnly(children) || (isExpand && !children));
|
|
76
|
+
var className = classnames_1.default(classPrefix, extraClasses, priorityStyles[isForm || borderless ? 'none' : priority], sizeStyles[size], splitStyles[split], isDestructive && classPrefix + "--destructive", isForm && classPrefix + "--form", isSlim && classPrefix + "--slim", transparent && classPrefix + "--transparent", fluid && classPrefix + "--fluid", truncate && classPrefix + "--truncated", borderless && classPrefix + "--borderless", fixedHeight && (sizeStyles[size] ? sizeStyles[size] + "-" + fixedHeight : classPrefix + "--fixed-height"));
|
|
76
77
|
var onKeyDown = function (e) {
|
|
77
78
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
78
79
|
onEscape(e);
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
|
-
var bodyContent = {
|
|
82
|
-
loading: react_1.default.createElement(button_loading_1.default, null),
|
|
83
|
-
expand: react_1.default.createElement(button_expand_1.default, null, children)
|
|
84
|
-
}[bodyState] || children;
|
|
82
|
+
var bodyContent = getBodyContent(children, { isLoading: isLoading, isExpand: isExpand });
|
|
85
83
|
var ariaLive = isLoading ? "polite" : null;
|
|
86
84
|
return href ? (react_1.default.createElement("a", __assign({ className: className, href: disabled ? undefined : href, ref: forwardedRef, onKeyDown: onKeyDown, "aria-live": ariaLive }, rest), bodyContent)) : (react_1.default.createElement("button", __assign({ disabled: disabled, "aria-disabled": partiallyDisabled, "aria-live": ariaLive, className: className, ref: forwardedRef, onKeyDown: onKeyDown }, rest), bodyContent));
|
|
87
85
|
};
|
|
86
|
+
function getBodyContent(children, _a) {
|
|
87
|
+
var isLoading = _a.isLoading, isExpand = _a.isExpand;
|
|
88
|
+
switch (true) {
|
|
89
|
+
case isLoading:
|
|
90
|
+
return react_1.default.createElement(button_loading_1.default, null);
|
|
91
|
+
case isExpand:
|
|
92
|
+
return react_1.default.createElement(button_expand_1.default, null, children);
|
|
93
|
+
default:
|
|
94
|
+
return children;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function isIconOnly(children) {
|
|
98
|
+
var childrenArray = react_1.Children.toArray(children);
|
|
99
|
+
return childrenArray.length === 1 && childrenArray[0].type === ebay_icon_1.EbayIcon;
|
|
100
|
+
}
|
|
88
101
|
exports.default = component_utils_1.withForwardRef(EbayButton);
|
package/ebay-button/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare type Priority = 'primary' | 'secondary' | 'tertiary' | 'none';
|
|
2
2
|
export declare type Variant = 'standard' | 'destructive' | 'form';
|
|
3
3
|
export declare type Size = 'default' | 'regular' | 'large';
|
|
4
|
-
export declare type BodyState = 'loading' | 'expand';
|
|
4
|
+
export declare type BodyState = 'loading' | 'expand' | 'reset' | 'none';
|
|
5
|
+
export declare type Split = 'start' | 'end';
|
|
5
6
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-button/types.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAEpE,oBAAY,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAA;AAEzD,oBAAY,IAAI,GAAG,SAAS,GAAoB,SAAS,GAAG,OAAO,CAAA;AAEnE,oBAAY,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-button/types.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAEpE,oBAAY,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAA;AAEzD,oBAAY,IAAI,GAAG,SAAS,GAAoB,SAAS,GAAG,OAAO,CAAA;AAEnE,oBAAY,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/D,oBAAY,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC"}
|