@transferwise/components 41.3.2 → 41.4.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [41.4.0](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.3.2...@transferwise/components@41.4.0) (2022-09-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add 'as' prop to support anchor tag buttons ([f9e3ff6](https://github.com/transferwise/neptune-web/commit/f9e3ff6c7b6263299285edd6815d731e9ab984bc))
|
|
12
|
+
* add disabled class ([a793614](https://github.com/transferwise/neptune-web/commit/a79361497f34f238b0c68582f45761aba8ce7642))
|
|
13
|
+
* update and refactor types to support anchor tags ([bcba7f1](https://github.com/transferwise/neptune-web/commit/bcba7f1c20923c48978c20a743b12b82a4353546))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [41.3.2](https://github.com/transferwise/neptune-web/compare/@transferwise/components@41.3.1...@transferwise/components@41.3.2) (2022-09-30)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @transferwise/components
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["block","children","className","disabled","
|
|
2
|
-
var s=establishNewType(q),
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","block","children","className","disabled","loading","priority","size","type"],_excluded2=["htmlType"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classNames from"classnames";import{forwardRef}from"react";import{Size,ControlType,Priority}from"../common";import{typeClassMap,priorityClassMap}from"./classMap";import{establishNewPriority,establishNewType,logDeprecationNotices}from"./legacyUtils";/** @deprecated */import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Button=/*#__PURE__*/forwardRef(function(a,b){var c,d=a.as,e=a.block,f=void 0!==e&&e,g=a.children,h=a.className,i=a.disabled,j=a.loading,k=void 0!==j&&j,l=a.priority,m=void 0===l?Priority.PRIMARY:l,n=a.size,o=void 0===n?Size.MEDIUM:n,p=a.type,q=void 0===p?ControlType.ACCENT:p,r=_objectWithoutProperties(a,_excluded);logDeprecationNotices({size:o,type:q});// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2
|
+
var s,t=establishNewType(q),u=establishNewPriority(m,q),v=classNames("btn btn-".concat(o),"np-btn np-btn-".concat(o),{"btn-loading":k,"btn-block np-btn-block":f},{disabled:i||k},// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
4
|
-
typeClassMap[
|
|
4
|
+
typeClassMap[t],// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
6
|
-
priorityClassMap[
|
|
7
|
-
return/*#__PURE__*/_jsxs(
|
|
6
|
+
priorityClassMap[u],h),w=null!==(c=d)&&void 0!==c?c:"button";// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
7
|
+
if("button"===w){var x=r,y=x.htmlType,z=void 0===y?"button":y,A=_objectWithoutProperties(x,_excluded2);s=_objectSpread(_objectSpread({},A),{},{disabled:i||k,type:z})}else s=_objectSpread({},r);return/*#__PURE__*/_jsxs(w,_objectSpread(_objectSpread({ref:b,className:v},s),{},{children:[g,k&&/*#__PURE__*/_jsx("span",{className:classNames("btn-loader",{"m-l-2":!f})})]}))});export default Button;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["block","children","className","disabled","
|
|
2
|
-
var s=establishNewType(q),
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","block","children","className","disabled","loading","priority","size","type"],_excluded2=["htmlType"];import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classNames from"classnames";import{forwardRef}from"react";import{Size,ControlType,Priority}from"../common";import{typeClassMap,priorityClassMap}from"./classMap";import{establishNewPriority,establishNewType,logDeprecationNotices}from"./legacyUtils";/** @deprecated */import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Button=/*#__PURE__*/forwardRef(function(a,b){var c,d=a.as,e=a.block,f=void 0!==e&&e,g=a.children,h=a.className,i=a.disabled,j=a.loading,k=void 0!==j&&j,l=a.priority,m=void 0===l?Priority.PRIMARY:l,n=a.size,o=void 0===n?Size.MEDIUM:n,p=a.type,q=void 0===p?ControlType.ACCENT:p,r=_objectWithoutProperties(a,_excluded);logDeprecationNotices({size:o,type:q});// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2
|
+
var s,t=establishNewType(q),u=establishNewPriority(m,q),v=classNames("btn btn-".concat(o),"np-btn np-btn-".concat(o),{"btn-loading":k,"btn-block np-btn-block":f},{disabled:i||k},// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
4
|
-
typeClassMap[
|
|
4
|
+
typeClassMap[t],// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
6
|
-
priorityClassMap[
|
|
7
|
-
return/*#__PURE__*/_jsxs(
|
|
6
|
+
priorityClassMap[u],h),w=null!==(c=d)&&void 0!==c?c:"button";// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
7
|
+
if("button"===w){var x=r,y=x.htmlType,z=void 0===y?"button":y,A=_objectWithoutProperties(x,_excluded2);s=_objectSpread(_objectSpread({},A),{},{disabled:i||k,type:z})}else s=_objectSpread({},r);return/*#__PURE__*/_jsxs(w,_objectSpread(_objectSpread({ref:b,className:v},s),{},{children:[g,k&&/*#__PURE__*/_jsx("span",{className:classNames("btn-loader",{"m-l-2":!f})})]}))});export default Button;
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
-
import { ControlTypeAccent, ControlTypeNegative, ControlTypePositive, PriorityPrimary, PrioritySecondary, PriorityTertiary, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge } from '../common';
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import { ControlTypeAccent, ControlTypeNegative, ControlTypePositive, PriorityPrimary, PrioritySecondary, PriorityTertiary, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, LinkProps } from '../common';
|
|
3
3
|
/** @deprecated */
|
|
4
4
|
declare type DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';
|
|
5
5
|
/** @deprecated */
|
|
6
6
|
declare type DeprecatedSizes = SizeExtraSmall;
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type CommonProps = {
|
|
8
|
+
as?: ElementType;
|
|
8
9
|
block?: boolean;
|
|
9
|
-
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
loading?: boolean;
|
|
11
12
|
type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes;
|
|
12
13
|
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;
|
|
13
14
|
size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;
|
|
14
|
-
}
|
|
15
|
-
declare
|
|
16
|
-
|
|
17
|
-
htmlType?:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
15
|
+
};
|
|
16
|
+
export declare type ButtonProps = CommonProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {
|
|
17
|
+
as?: 'button';
|
|
18
|
+
htmlType?: 'submit' | 'reset' | 'button';
|
|
19
|
+
};
|
|
20
|
+
export declare type AnchorProps = CommonProps & AnchorHTMLAttributes<HTMLAnchorElement> & Omit<LinkProps, 'href'> & {
|
|
21
|
+
as?: 'a';
|
|
22
|
+
href?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare type Props = ButtonProps | AnchorProps;
|
|
25
|
+
export declare type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
|
|
26
|
+
declare const Button: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<ButtonReferenceType>>;
|
|
23
27
|
export default Button;
|