@transferwise/components 0.0.0-experimental-82f2da8 → 0.0.0-experimental-2671b89
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/build/es/no-polyfill/common/card/Card.js +21 -0
- package/build/es/no-polyfill/common/card/Card.spec.js +6 -0
- package/build/es/no-polyfill/common/card/Card.story.js +1 -0
- package/build/es/no-polyfill/common/card/index.js +1 -0
- package/build/es/no-polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/no-polyfill/display/Display.js +1 -1
- package/build/es/no-polyfill/image/Image.js +1 -1
- package/build/es/no-polyfill/index.js +1 -1
- package/build/es/no-polyfill/loader/Loader.js +1 -1
- package/build/es/no-polyfill/promoCard/PromoCard.js +51 -0
- package/build/es/no-polyfill/promoCard/PromoCard.spec.js +13 -0
- package/build/es/no-polyfill/promoCard/PromoCard.story.js +1 -0
- package/build/es/no-polyfill/promoCard/PromoCardContext.js +19 -0
- package/build/es/no-polyfill/promoCard/PromoCardContext.spec.js +4 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.js +20 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.spec.js +5 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.story.js +1 -0
- package/build/es/no-polyfill/promoCard/PromoCardIndicator.js +16 -0
- package/build/es/no-polyfill/promoCard/index.js +1 -0
- package/build/es/polyfill/common/card/Card.js +21 -0
- package/build/es/polyfill/common/card/Card.spec.js +6 -0
- package/build/es/polyfill/common/card/Card.story.js +1 -0
- package/build/es/polyfill/common/card/index.js +1 -0
- package/build/es/polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/polyfill/display/Display.js +1 -1
- package/build/es/polyfill/image/Image.js +1 -1
- package/build/es/polyfill/index.js +1 -1
- package/build/es/polyfill/loader/Loader.js +1 -1
- package/build/es/polyfill/promoCard/PromoCard.js +51 -0
- package/build/es/polyfill/promoCard/PromoCard.spec.js +13 -0
- package/build/es/polyfill/promoCard/PromoCard.story.js +1 -0
- package/build/es/polyfill/promoCard/PromoCardContext.js +19 -0
- package/build/es/polyfill/promoCard/PromoCardContext.spec.js +4 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.js +20 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.spec.js +5 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.story.js +1 -0
- package/build/es/polyfill/promoCard/PromoCardIndicator.js +16 -0
- package/build/es/polyfill/promoCard/index.js +1 -0
- package/build/main.css +1 -1
- package/build/styles/common/card/Card.css +1 -0
- package/build/styles/main.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -0
- package/build/types/avatar/index.d.ts +1 -0
- package/build/types/common/card/Card.d.ts +40 -0
- package/build/types/common/card/Card.spec.d.ts +1 -0
- package/build/types/common/card/Card.story.d.ts +6 -0
- package/build/types/common/card/index.d.ts +1 -0
- package/build/types/common/closeButton/CloseButton.d.ts +4 -0
- package/build/types/display/Display.d.ts +1 -1
- package/build/types/image/Image.d.ts +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/promoCard/PromoCard.d.ts +123 -0
- package/build/types/promoCard/PromoCard.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCard.story.d.ts +10 -0
- package/build/types/promoCard/PromoCardContext.d.ts +45 -0
- package/build/types/promoCard/PromoCardContext.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCardGroup.d.ts +55 -0
- package/build/types/promoCard/PromoCardGroup.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCardGroup.story.d.ts +8 -0
- package/build/types/promoCard/PromoCardIndicator.d.ts +31 -0
- package/build/types/promoCard/index.d.ts +2 -0
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";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{render,screen}from"@testing-library/react";import PromoCard from"./PromoCard";import PromoCardGroup from"./PromoCardGroup";import{jsx as _jsx}from"react/jsx-runtime";describe("PromoCardGroup",function(){var a,b={title:"Test Card",description:"Test Description",imageSource:"https://via.placeholder.com/150",type:"radio"},c={testId:"test-promo-card-group",children:[/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{testId:"test-1",value:"radio-1",id:"radio-1"}),"radio-1"),/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{testId:"test-2",value:"radio-2",id:"radio-2"}),"radio-2")]};beforeEach(function(){var b=render(/*#__PURE__*/_jsx(PromoCardGroup,_objectSpread({},c))),d=b.rerender;a=function(a){d(/*#__PURE__*/_jsx(PromoCardGroup,_objectSpread(_objectSpread({},c),a)))}}),it("matches snapshot",function(){var a=render(/*#__PURE__*/_jsx(PromoCardGroup,_objectSpread({},c))),b=a.container;expect(b.firstChild).toMatchSnapshot()}),it("renders",function(){var d=_objectSpread(_objectSpread({},c),{},{children:[/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{type:"checkbox",testId:"test-3",value:"radio-3"}),"radio-3"),/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{type:"checkbox",testId:"test-4",value:"radio-4"}),"radio-4")]});// Change children
|
|
2
|
+
expect(screen.getByTestId("test-promo-card-group")).toBeInTheDocument(),expect(screen.getByTestId("test-promo-card-group")).toHaveClass("np-CardGroup"),expect(screen.getByRole("radiogroup")).toBeInTheDocument(),a(d),expect(screen.getByTestId("test-4")).toBeInTheDocument()}),it("sets the `defaultValue` for the group",function(){var b=_objectSpread(_objectSpread({},c),{},{defaultValue:"radio-1"});// Change children
|
|
3
|
+
expect(screen.getByTestId("test-1")).not.toHaveClass("is-checked"),a(b),expect(screen.getByTestId("test-1")).toHaveClass("is-checked")}),it("not to render as a `radiogroup` if we have a mix of PromoCard types",function(){var d=_objectSpread(_objectSpread({},c),{},{children:[/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{type:"checkbox",testId:"test-3",value:"radio-3"}),"radio-3"),/*#__PURE__*/_jsx(PromoCard,_objectSpread(_objectSpread({},b),{},{type:"checkbox",testId:"test-4 ",value:"radio-4"}),"radio-4")]});// Change children
|
|
4
|
+
expect(screen.getByRole("radiogroup")).toBeInTheDocument(),a(d),expect(screen.queryByRole("radiogroup")).not.toBeInTheDocument(),expect(screen.getByTestId("test-4")).toBeInTheDocument()}),it("applies `is-disabled` class to all children when isDisabled is true",function(){var b=_objectSpread(_objectSpread({},c),{},{isDisabled:!0});// Change children
|
|
5
|
+
expect(screen.getByTestId("test-1")).not.toHaveClass("is-disabled"),expect(screen.getByTestId("test-2")).not.toHaveClass("is-disabled"),a(b),expect(screen.getByTestId("test-1")).toHaveClass("is-disabled"),expect(screen.getByTestId("test-2")).toHaveClass("is-disabled")})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import PromoCard from"./PromoCard";import PromoCardGroup from"./PromoCardGroup";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var PromoCards=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(PromoCard,{title:"Digital",description:"A card that lives online and works anywhere. Easy, secure, and always on hand.",type:"radio",value:"digital",id:"digital",imageAlt:"",indicatorLabel:"Free",imageSource:"https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"}),/*#__PURE__*/_jsx(PromoCard,{title:"Standard",description:"Spend and withdraw money around the world. In your wallet and on your side.",type:"radio",value:"standard",id:"standard",imageAlt:"",indicatorLabel:"7 GBP",imageSource:"https://wise.com/web-art/assets/illustrations/personal-card-medium@2x.webp"}),/*#__PURE__*/_jsx(PromoCard,{title:"Eco",description:"A debit card made to biodegrade \u2014 no toxic gases, no toxic fees.",type:"radio",value:"eco",id:"eco",imageAlt:"",indicatorLabel:"9 GBP",imageSource:"https://wise.com/web-art/assets/illustrations/eco-card-medium@2x.webp"})]})},meta={component:PromoCardGroup,title:"Layouts/PromoCardGroup",tags:["autodocs"]};export default meta;export var Default={args:{children:/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(PromoCards,{})})}};export var DefaultValue={args:{children:/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(PromoCards,{})}),defaultValue:"standard"}};export var Disabled={args:{children:/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(PromoCards,{})}),isDisabled:!0}};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","children","label","icon","testid"];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{ArrowRight,Check,Download}from"@transferwise/icons";import classNames from"classnames";import Body from"../body";import{Typography}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";/**
|
|
2
|
+
* PromoCardIndicator component.
|
|
3
|
+
*
|
|
4
|
+
* A PromoCardIndicator is a small component that can be used to display
|
|
5
|
+
* additional information or actions related to a PromoCard. It can be
|
|
6
|
+
* customized with various props to suit different use cases.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} className - Optional class name(s) to add to the indicator container.
|
|
9
|
+
* @param {string} label - Optional label to display next to the indicator.
|
|
10
|
+
* @param {string} icon - Optional icon to display in the indicator.
|
|
11
|
+
* @param {string} testid - Optional ID to add to the indicator container for testing purposes.
|
|
12
|
+
* @param {ReactNode} children - Optional children to display inside the indicator.
|
|
13
|
+
* @returns {JSX.Element} - The PromoCardIndicator component.
|
|
14
|
+
* @example
|
|
15
|
+
* <PromoCardIndicator label="Download" icon="download" />
|
|
16
|
+
*/var PromoCardIndicator=function(a){var b=a.className,c=a.children,d=a.label,e=a.icon,f=a.testid,g=_objectWithoutProperties(a,_excluded),h=e&&{check:Check,arrow:ArrowRight,download:Download}[e];return/*#__PURE__*/_jsxs("div",_objectSpread(_objectSpread({className:classNames("np-Card-indicator",b),"data-testid":f},g),{},{children:[d&&/*#__PURE__*/_jsx(Body,{as:"span",type:Typography.BODY_LARGE_BOLD,className:"np-Card-indicatorText",children:d}),h&&/*#__PURE__*/_jsx("span",{className:"np-Card-indicatorIcon",children:/*#__PURE__*/_jsx(h,{size:24,"aria-hidden":"true"})}),c]}))};export default PromoCardIndicator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default}from"./PromoCard";export{default as PromoCardGroup}from"./PromoCardGroup";
|