@transferwise/components 45.1.0 → 45.1.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.
Files changed (50) hide show
  1. package/build/es/no-polyfill/actionButton/ActionButton.story.js +1 -1
  2. package/build/es/no-polyfill/actionOption/ActionOption.story.js +1 -1
  3. package/build/es/no-polyfill/alert/Alert.story.js +1 -0
  4. package/build/es/no-polyfill/avatar/Avatar.story.js +1 -0
  5. package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.story.js +1 -0
  6. package/build/es/no-polyfill/chevron/Chevron.story.js +1 -0
  7. package/build/es/no-polyfill/dimmer/Dimmer.story.js +2 -1
  8. package/build/es/no-polyfill/loader/Loader.story.js +1 -0
  9. package/build/es/no-polyfill/logo/Logo.story.js +1 -0
  10. package/build/es/no-polyfill/money/Money.story.js +1 -0
  11. package/build/es/no-polyfill/moneyInput/MoneyInput.story.js +1 -0
  12. package/build/es/no-polyfill/progress/Progress.story.js +1 -0
  13. package/build/es/no-polyfill/progressBar/ProgressBar.story.js +1 -1
  14. package/build/es/no-polyfill/provider/Provider.story.js +1 -1
  15. package/build/es/no-polyfill/statusIcon/StatusIcon.story.js +1 -0
  16. package/build/es/no-polyfill/tabs/Tabs.js +1 -1
  17. package/build/es/polyfill/actionButton/ActionButton.story.js +1 -1
  18. package/build/es/polyfill/actionOption/ActionOption.story.js +1 -1
  19. package/build/es/polyfill/alert/Alert.story.js +1 -0
  20. package/build/es/polyfill/avatar/Avatar.story.js +1 -0
  21. package/build/es/polyfill/avatarWrapper/AvatarWrapper.story.js +1 -0
  22. package/build/es/polyfill/chevron/Chevron.story.js +1 -0
  23. package/build/es/polyfill/dimmer/Dimmer.story.js +2 -1
  24. package/build/es/polyfill/loader/Loader.story.js +1 -0
  25. package/build/es/polyfill/logo/Logo.story.js +1 -0
  26. package/build/es/polyfill/money/Money.story.js +1 -0
  27. package/build/es/polyfill/moneyInput/MoneyInput.story.js +1 -0
  28. package/build/es/polyfill/progress/Progress.story.js +1 -0
  29. package/build/es/polyfill/progressBar/ProgressBar.story.js +1 -1
  30. package/build/es/polyfill/provider/Provider.story.js +1 -1
  31. package/build/es/polyfill/statusIcon/StatusIcon.story.js +1 -0
  32. package/build/es/polyfill/tabs/Tabs.js +1 -1
  33. package/build/types/actionButton/ActionButton.story.d.ts +6 -2
  34. package/build/types/actionOption/ActionOption.story.d.ts +28 -6
  35. package/build/types/alert/Alert.story.d.ts +56 -0
  36. package/build/types/avatar/Avatar.story.d.ts +42 -0
  37. package/build/types/avatarWrapper/AvatarWrapper.story.d.ts +59 -0
  38. package/build/types/chevron/Chevron.story.d.ts +44 -0
  39. package/build/types/dimmer/Dimmer.story.d.ts +9 -1
  40. package/build/types/loader/Loader.story.d.ts +28 -0
  41. package/build/types/logo/Logo.story.d.ts +32 -0
  42. package/build/types/money/Money.story.d.ts +19 -0
  43. package/build/types/moneyInput/MoneyInput.story.d.ts +35 -0
  44. package/build/types/progress/Progress.story.d.ts +17 -0
  45. package/build/types/progressBar/ProgressBar.story.d.ts +8 -3
  46. package/build/types/provider/Provider.story.d.ts +4 -1
  47. package/build/types/statusIcon/StatusIcon.story.d.ts +15 -0
  48. package/build/umd/no-polyfill/main.js +1 -1
  49. package/build/umd/polyfill/main.js +1 -1
  50. package/package.json +3 -3
@@ -1 +1 @@
1
- import{action}from"@storybook/addon-actions";import{boolean,text}from"@storybook/addon-knobs";import{Settings}from"@transferwise/icons";import ActionButton from"./ActionButton";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";export default{component:ActionButton,title:"Actions/ActionButton",tags:["autodocs"]};export var Variants=function(){var a=text("text","Button label");return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("p",{children:"Basic"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center m-b-1",children:/*#__PURE__*/_jsx(ActionButton,{disabled:!1,onClick:function onClick(){return action("Clicked!")},children:a})}),/*#__PURE__*/_jsx("p",{children:"With Icon"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:!1,onClick:function onClick(){return action("Clicked!")},children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),a]})}),/*#__PURE__*/_jsx("p",{children:"Disabled"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:!0,onClick:function onClick(){return action("Clicked!")},children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),a]})})]})};export var Basic=function(){var a=boolean("disabled",!1),b=text("text","Button label"),c=boolean("with icon",!1);return/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:a,onClick:function onClick(){return action("Clicked!")},children:[c&&/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),b]})})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{Settings}from"@transferwise/icons";import ActionButton from"./ActionButton";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:ActionButton,title:"Actions/ActionButton",tags:["autodocs"]};export var Basic={render:function render(a){return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(ActionButton,_objectSpread(_objectSpread({},a),{},{children:"Button label"}))})}};export var WithIcon={render:function render(a){return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsxs(ActionButton,_objectSpread(_objectSpread({},a),{},{children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),"Button label"]}))})}};export var Disabled={render:WithIcon.render,args:{disabled:!0}};
@@ -1 +1 @@
1
- import{action}from"@storybook/addon-actions";import{text,boolean}from"@storybook/addon-knobs";import{FastFlag as FastFlagIcon}from"@transferwise/icons";import{Nudge}from"..";import ActionOption from"./ActionOption";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 meta={component:ActionOption,title:"Option/ActionOption",tags:["autodocs"]};export default meta;var Template=function(){var a=text("title","Action option"),b=text("content","Normally, the button and icon are vertically centered."),c=text("action","Action"),d=boolean("disabled",!1),e=boolean("showMediaAtAllSizes",!1),f=boolean("showMediaCircle",!1),g=boolean("isContainerAligned",!1);return/*#__PURE__*/_jsx(ActionOption,{action:c,media:/*#__PURE__*/_jsx(FastFlagIcon,{}),title:a,content:b,complex:!1,disabled:d,showMediaAtAllSizes:e,showMediaCircle:f,isContainerAligned:g,onClick:action("Button Clicked")})};export var Basic=function(){return/*#__PURE__*/_jsx(Template,{})};export var Multiple=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{})]})};export var WithContainerContent=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("h2",{className:"m-b-2",children:"Choose how to pay"}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Nudge,{className:"m-t-2",mediaName:"globe",title:"Text that is no longer than two lines.",link:"Link",href:"#",onClick:action("action clicked"),onDismiss:action("dismissed")})]})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{action}from"@storybook/addon-actions";import{FastFlag as FastFlagIcon}from"@transferwise/icons";import{Nudge}from"..";import ActionOption from"./ActionOption";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:ActionOption,title:"Option/ActionOption",args:{title:"Action option",content:"Normally, the button and icon are vertically centered.",action:"Action",media:/*#__PURE__*/_jsx(FastFlagIcon,{}),showMediaCircle:!1},tags:["autodocs"]};export var Basic={render:function render(a){return/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a))}};export var WithContainerContent={render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("h2",{className:"m-b-2",children:"Choose how to pay"}),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(Nudge,{className:"m-t-2",mediaName:"globe",title:"Text that is no longer than two lines.",link:"Link",href:"#",onClick:action("action clicked"),onDismiss:action("dismissed")})]})}};
@@ -0,0 +1 @@
1
+ /* eslint-disable no-alert */import{Sentiment}from"../common";import Alert from"./Alert";import{AlertArrowPosition}from"./withArrow";export default{component:Alert,title:"Feedback/Alert",args:{type:Sentiment.POSITIVE,message:"Payments sent to your bank details **today** might not arrive in time for the holidays."},argTypes:{arrow:{name:"arrow (deprecated)",type:{name:"enum",value:Object.keys(AlertArrowPosition)}},type:{type:{name:"enum",value:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING]}}},tags:["autodocs"]};export var Basic={args:{onDismiss:void 0}};export var WithAction={args:{action:{href:"/",text:"Read more"}}};export var WithArrow={args:{arrow:AlertArrowPosition.TOP_LEFT}};
@@ -0,0 +1 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{Size,Theme}from"../common";import Avatar,{AvatarType}from".";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Avatar,title:"Content/Avatar",tags:["autodocs"]};export var Emoji={render:function render(a){return/*#__PURE__*/_jsx(Avatar,_objectSpread(_objectSpread({},a),{},{children:"\u2708\uFE0F"}))},args:{type:AvatarType.EMOJI,size:Size.MEDIUM,theme:Theme.LIGHT}};export var Flag={render:function render(a){return/*#__PURE__*/_jsx(Avatar,_objectSpread(_objectSpread({},a),{},{children:/*#__PURE__*/_jsx("img",{src:"https://wise.com/public-resources/assets/flags/square/gbp.svg",alt:""})}))},args:{type:AvatarType.THUMBNAIL,size:Size.MEDIUM,outlined:!0}};export var Table={render:function render(a){var b=a.theme,c="https://wise.com/public-resources/assets/flags/square/gbp.svg";return/*#__PURE__*/_jsx("div",{style:{padding:"50px",backgroundColor:b===Theme.DARK?"#37517e":"white"},children:/*#__PURE__*/_jsxs("table",{style:{background:"transparent"},children:[/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:44,height:44},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:36,height:36},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:32,height:32},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:26,height:26},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:16,height:16},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:44,height:44},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:36,height:36},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:32,height:32},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:26,height:26},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:16,height:16},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})})]})]})})}};
@@ -0,0 +1 @@
1
+ import{ProfileType,Sentiment}from"../common";import AvatarWrapper from"./AvatarWrapper";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:AvatarWrapper,title:"Content/AvatarWrapper",argTypes:{profileType:{type:{name:"enum",value:Object.keys(ProfileType)}},badgeStatusIcon:{type:{name:"enum",value:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING]}}},tags:["autodocs"]};export var WithBadgeUrl={args:{badgeUrl:"https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg",avatarProps:{outlined:!0}}};export var WithBadgeStatus={args:{profileType:ProfileType.BUSINESS,badgeStatusIcon:Sentiment.PENDING,avatarProps:{outlined:!1}}};export var All={args:{avatarProps:{outlined:!0}},render:function render(a){var b=a.avatarProps;return/*#__PURE__*/_jsxs("div",{style:{maxWidth:"300px",display:"flex",justifyContent:"space-between"},children:[/*#__PURE__*/_jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("b",{children:"No Badges"})})," ","Personal",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{profileType:ProfileType.PERSONAL,avatarProps:b})}),"Business",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{profileType:ProfileType.BUSINESS,avatarProps:b})}),"Avatar",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{url:"https://wise.com/public-resources/assets/flags/square/gbp.svg",profileType:ProfileType.BUSINESS,avatarProps:b})}),"Initials",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{name:"A A",avatarProps:b})}),"Default",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{avatarProps:b})})]}),/*#__PURE__*/_jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("b",{children:"Badges"})}),"Personal",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeUrl:"https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg",badgeAltText:"wise fast flag badge",profileType:ProfileType.PERSONAL,avatarProps:b})}),"Business",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.POSITIVE,profileType:ProfileType.BUSINESS,avatarProps:b})}),"Avatar",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.NEGATIVE,url:"https://wise.com/public-resources/assets/flags/square/gbp.svg",profileType:ProfileType.BUSINESS,avatarProps:b})}),"Initials",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.NEUTRAL,name:"A A",avatarProps:b})}),"Default",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.PENDING,avatarProps:b})})]})]})}};
@@ -0,0 +1 @@
1
+ import Chevron from"./Chevron";export default{component:Chevron,title:"Other/Chevron",argTypes:{orientation:{type:{name:"enum",value:["top","bottom","left","right"]}},size:{type:{name:"enum",value:["xs","sm","md"]}}},tags:["autodocs"]};export var Basic={args:{orientation:"top",size:"md"}};
@@ -1 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{action}from"@storybook/addon-actions";import{boolean}from"@storybook/addon-knobs";import{useState}from"react";import{Button,Dimmer}from"..";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Dimmer,title:"Layouts/Dimmer"};export var Basic=function(){var a=useState(!1),b=_slicedToArray(a,2),c=b[0],d=b[1],e=boolean("fadeContentOnExit",!1),f=boolean("fadeContentOnEnter",!1);return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Button,{onClick:function onClick(){return d(function(a){return!a})},children:"Toggle dimmer"}),/*#__PURE__*/_jsx(Dimmer,{open:c,fadeContentOnExit:e,fadeContentOnEnter:f,onClose:function handleClose(){d(!1),action("closed")}})]})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";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{action}from"@storybook/addon-actions";import{useState}from"react";import{Button,Dimmer}from"..";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Dimmer,title:"Layouts/Dimmer",args:{fadeContentOnEnter:!1,fadeContentOnExit:!1,disableClickToClose:!1}};export var Basic={render:function render(a){// eslint-disable-next-line react-hooks/rules-of-hooks
2
+ var b=useState(!1),c=_slicedToArray(b,2),d=c[0],e=c[1];return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Button,{onClick:function onClick(){return e(function(a){return!a})},children:"Toggle dimmer"}),/*#__PURE__*/_jsx(Dimmer,_objectSpread(_objectSpread({},a),{},{open:d,onClose:function onClose(a){e(!1),action("closed")(a)}}))]})}};
@@ -0,0 +1 @@
1
+ import Loader from"./Loader";export default{component:Loader,title:"Loading/Loader",args:{size:"md"},argTypes:{size:{type:{name:"enum",value:["sm","md"]}}},tags:["autodocs"]};export var Basic={};
@@ -0,0 +1 @@
1
+ import Logo,{LogoType}from".";import{jsx as _jsx}from"react/jsx-runtime";export default{component:Logo,title:"Content/Logo",render:function render(a){var b=a.type,c=a.inverse;return/*#__PURE__*/_jsx("div",{className:"".concat(c?"bg--dark":""," p-a-3"),children:/*#__PURE__*/_jsx(Logo,{type:b,inverse:c})})},tags:["autodocs"]};export var Basic={args:{type:LogoType.WISE,inverse:!1}};
@@ -0,0 +1 @@
1
+ import Money from"./Money";export default{component:Money,title:"Typography/Money"};export var Basic={args:{amount:1234.5678,currency:"GBP"}};
@@ -0,0 +1 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{within,userEvent}from"@storybook/testing-library";import MoneyInput from".";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:MoneyInput,title:"Forms/MoneyInput",render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Editable money input label"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread({},a))]})},args:{id:"money-input",amount:1e3,selectProps:{buttonProps:{"aria-label":"Select currency"},dropdownProps:{"aria-label":"Currency options"}}},tags:["autodocs"]};var exampleCurrency={eur:{value:"EUR",label:"EUR",note:"Euro",currency:"eur",searchable:"Spain, Germany, France, Austria"},gbp:{value:"GBP",label:"GBP",note:"British pound",currency:"gbp",searchable:"England, Scotland, Wales"}};export var SingleCurrency={args:{currencies:[],selectedCurrency:exampleCurrency.eur,onCurrencyChange:null}};export var MultipleCurrencies={args:{currencies:[{header:"Popular currencies"},exampleCurrency.eur,exampleCurrency.gbp],selectedCurrency:exampleCurrency.eur}};export var OpenedInput=_objectSpread(_objectSpread({},MultipleCurrencies),{},{play:function play(a){var b=a.canvasElement,c=within(b);userEvent.click(c.getByRole("combobox"))}});export var SmallInput={render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Money inputs"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),SingleCurrency.args)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),MultipleCurrencies.args)),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsxs("div",{className:"has-error",children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Error states"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),SingleCurrency.args)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),MultipleCurrencies.args))]})]})},args:{size:"sm"}};export var MediumInput={render:SmallInput.render,args:{size:"md"}};export var LargeInput={render:SmallInput.render,args:{size:"lg"}};
@@ -0,0 +1 @@
1
+ import Progress from"./Progress";export default{component:Progress,title:"Other/Progress"};export var Basic={args:{progress:{value:50,max:100}}};
@@ -1 +1 @@
1
- import ProgressBar from"./ProgressBar";var meta={component:ProgressBar,title:"Content/ProgressBar",tags:["autodocs"]};export default meta;export var Basic={args:{description:"You have 3 days to reach your goal.",id:"progress-bar-id",title:"Send 5,550 GBP",progress:{value:50,max:100},textEnd:"200 GBP to go"}};
1
+ import ProgressBar from"./ProgressBar";export default{component:ProgressBar,title:"Content/ProgressBar",tags:["autodocs"]};export var Basic={args:{description:"You have 3 days to reach your goal.",id:"progress-bar-id",title:"Send 5,550 GBP",progress:{value:50,max:100},textEnd:"200 GBP to go"}};
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";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{FormattedMessage}from"react-intl";import{Provider,Money}from"..";import closeButtonMessages from"../common/closeButton/CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Provider,title:"Other/Provider"};export var Basic=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:["Translated message: ",/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx("br",{}),"Formatting example: ",/*#__PURE__*/_jsx(Money,{amount:1234.5678,currency:"GBP"})]})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{FormattedMessage}from"react-intl";import{Provider}from"..";import closeButtonMessages from"../common/closeButton/CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Provider,title:"Other/Provider"};export var Basic={render:function render(){return/*#__PURE__*/_jsxs(_Fragment,{children:["Translated message: ",/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel))]})}};
@@ -0,0 +1 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";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{Size,Sentiment}from"../common";import StatusIcon from"./StatusIcon";import{jsx as _jsx}from"react/jsx-runtime";export default{component:StatusIcon,title:"Other/StatusIcon"};export var Basic={render:function render(a){return/*#__PURE__*/_jsx("span",{style:{display:"flex"},children:/*#__PURE__*/_jsx(StatusIcon,_objectSpread({},a))})}};export var Variants={render:function render(){return/*#__PURE__*/_jsx("span",{style:{display:"flex",justifyContent:"space-between",maxWidth:"400px"},children:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING].map(function(a){return/*#__PURE__*/_jsx("span",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column",minHeight:"150px",alignItems:"center"},children:[Size.SMALL,Size.MEDIUM,Size.LARGE].map(function(b){return/*#__PURE__*/_jsx(StatusIcon,{size:b,sentiment:a},b)})},a)})})}};
@@ -1 +1 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";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}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{Spring}from"@react-spring/web";import classNames from"classnames";import clamp from"lodash.clamp";import PropTypes from"prop-types";import{Component,createRef,Fragment}from"react";import{Size,Width,Direction}from"../common";import KeyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{getElasticDragDifference,getSwipeDifference,swipedLeftToRight,swipedRightToLeft,swipeShouldChangeTab,getVelocity}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MIN_INDEX=0,enabledTabsFilter=function(a){return!a.disabled},SpacerWidth={default:0,xs:8,sm:16,md:24,lg:32},Tabs=/*#__PURE__*/function(a){/** @type {RefObject<HTMLDivElement>} */function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"containerReference",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"container",null),_defineProperty(_assertThisInitialized(d),"containerWidth",0),_defineProperty(_assertThisInitialized(d),"tabRefs",[]),_defineProperty(_assertThisInitialized(d),"handleResize",function(){d.setContainerWidth(d.container),d.setState(function(a){var b=a.selectedTabIndex;return{translateTo:-(d.containerWidth*b)}})}),_defineProperty(_assertThisInitialized(d),"setContainerRefAndWidth",function(a){d.container=a,d.setContainerWidth(a)}),_defineProperty(_assertThisInitialized(d),"setContainerWidth",function(a){if(a){var b=a.getBoundingClientRect(),c=b.width;d.containerWidth=c}}),_defineProperty(_assertThisInitialized(d),"isTabDisabled",function(a){var b=d.props.tabs;return b[a]&&b[a].disabled}),_defineProperty(_assertThisInitialized(d),"getAllTabsWidth",function(){return d.tabRefs.map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"getDistanceToSelectedTab",function(a){return d.tabRefs.filter(function(b,c){return c<a}).map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"setTabWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.headerWidth,e=b.selected,f=d.getAllTabsWidth();!a&&(c===Width.BLOCK||d.containerWidth<f)&&d.setState({fullWidthTabs:!0,translateLineX:"".concat(100*e,"%")}),a&&c===Width.AUTO&&d.containerWidth>=f&&d.setState({fullWidthTabs:!1,translateLineX:"".concat(d.getDistanceToSelectedTab(e),"px")})}),_defineProperty(_assertThisInitialized(d),"getTabLineWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.selected,e=b.tabs;if(a)return"".concat(100*(1/e.length),"%");var f=d.tabRefs[c]||d.tabRefs[d.tabRefs.length-1],g=f?f.getBoundingClientRect().width:0;return"".concat(g,"px")}),_defineProperty(_assertThisInitialized(d),"getTabToSelect",function(a,b,c){var e=a;if(swipedLeftToRight(b,c)){if(e-=1,e>MIN_INDEX&&d.isTabDisabled(e))return d.getTabToSelect(e,b,c);}else if(swipedRightToLeft(b,c)&&(e+=1,e<d.MAX_INDEX&&d.isTabDisabled(e)))return d.getTabToSelect(e,b,c);return e=clamp(e,Math.max(a-1,MIN_INDEX),Math.min(a+1,d.MAX_INDEX)),d.isTabDisabled(e)?a:e}),_defineProperty(_assertThisInitialized(d),"swipedOverHalfOfContainer",function(a){return .5<=a/d.containerWidth}),_defineProperty(_assertThisInitialized(d),"calculateApplicableDragDifference",function(a){var b=a.currentSelected,c=a.nextSelected,e=a.start,f=a.end,g=getSwipeDifference(e,f),h=getElasticDragDifference(g);return swipedLeftToRight(e,f)?b>MIN_INDEX&&b!==c?Math.min(g,d.containerWidth):h:!!swipedRightToLeft(e,f)&&(b<d.MAX_INDEX&&b!==c?-Math.min(g,d.containerWidth):-h)}),_defineProperty(_assertThisInitialized(d),"switchTab",function(a){var b=d.props.onTabSelect;b(a)}),_defineProperty(_assertThisInitialized(d),"animateToTab",function(a,b){d.animateLine(a),d.animatePanel(d.getTabIndexWithoutDisabledTabs(a),b)}),_defineProperty(_assertThisInitialized(d),"animateLine",function(a){d.setState(function(b){return{translateLineX:b.fullWidthTabs?"".concat(100*a,"%"):"".concat(d.getDistanceToSelectedTab(a),"px")}})}),_defineProperty(_assertThisInitialized(d),"animatePanel",function(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=d.state.translateTo,e=c,f=-(d.containerWidth*a);d.setState({selectedTabIndex:a,isAnimating:!b&&e!==f,translateFrom:e,translateTo:f})}),_defineProperty(_assertThisInitialized(d),"disableScroll",function(a){var b=d.state.isSwiping;b&&a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handleTabClick",function(a){return function(){d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"onKeyDown",function(a){return function(b){b&&b.keyCode===KeyCodes.ENTER&&d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"handleTouchStart",function(a){var b={x:a.nativeEvent.touches[0].clientX,y:a.nativeEvent.touches[0].clientY,time:Date.now()};d.setState({start:b,currentSwipe:[b]}),a.persist()}),_defineProperty(_assertThisInitialized(d),"handleTouchMove",function(a){var b=d.state.start,c=d.props.selected,e=d.getTabIndexWithoutDisabledTabs(c),f={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},g=getSwipeDifference(b,f),h=getSwipeDifference(b,f,"y"),i=d.state,j=i.isScrolling,k=i.isSwiping;if(a.persist(),j||k||(g>h?k=!0:j=!0),d.setState({isScrolling:j,isSwiping:k}),k){var l=d.getTabToSelect(c,b,f);d.animateLine(d.swipedOverHalfOfContainer(g)?l:c);var m=d.calculateApplicableDragDifference({currentSelected:c,nextSelected:l,start:b,end:f}),n=!!m&&-(d.containerWidth*e)+m;d.setState(function(a){return{currentSwipe:[].concat(_toConsumableArray(a.currentSwipe),[f]),translateFrom:n||a.translateFrom,translateTo:n||a.translateTo}})}}),_defineProperty(_assertThisInitialized(d),"handleTouchEnd",function(a){var b=d.state,c=b.start,e=b.isSwiping,f=d.props.selected,g={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},h=getSwipeDifference(c,g),i=getVelocity([].concat(_toConsumableArray(d.state.currentSwipe),[g]));d.setState({currentSwipe:[]});var j=f;a.persist(),e&&((swipeShouldChangeTab(c,g)||d.swipedOverHalfOfContainer(h))&&(j=d.getTabToSelect(j,c,g)),j===f?d.animateToTab(j):(d.switchTab(j),d.setState({lastSwipeVelocity:i}))),d.setState({isSwiping:!1,isScrolling:!1})}),d.state={start:null,translateX:0,translateFrom:0,translateTo:0,translateLineX:null,isAnimating:!1,isSwiping:!1,isScrolling:!1,lastSwipeVelocity:0,fullWidthTabs:a.headerWidth===Width.BLOCK},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"filteredTabsLength",get:function get(){return this.props.tabs.filter(enabledTabsFilter).length}},{key:"MAX_INDEX",get:function get(){return this.props.tabs.length-1}},{key:"componentDidMount",value:function componentDidMount(){var a=this.props.selected;this.setTabWidth(),this.switchTab(clamp(a,MIN_INDEX,this.MAX_INDEX)),this.animateToTab(clamp(a,MIN_INDEX,this.MAX_INDEX),!0),document.body.addEventListener("touchmove",this.disableScroll,{passive:!1}),document.body.addEventListener("touchforcechange",this.disableScroll,{passive:!1}),window.addEventListener("resize",this.handleResize)}},{key:"componentDidUpdate",value:function componentDidUpdate(a,b){var c=this.props.selected,d=a.selected,e=this.props.tabs[c],f=e&&e.disabled,g=a.tabs[d],h=g&&g.disabled,i=this.props.tabs.length,j=a.tabs.length,k=this.props.tabs.filter(enabledTabsFilter).length,l=a.tabs.filter(enabledTabsFilter).length,m=this.props.headerWidth,n=a.headerWidth,o=this.props.animatePanelsOnClick,p=!o&&!b.isSwiping;(m!==n||i!==j)&&this.setTabWidth(),(c!==d||k!==l||f!==h)&&this.animateToTab(clamp(c,MIN_INDEX,this.MAX_INDEX),c===d||p)}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.body.removeEventListener("touchmove",this.disableScroll),document.body.removeEventListener("touchforcechange",this.disableScroll),window.removeEventListener("resize",this.handleResize)}},{key:"getTabIndexWithoutDisabledTabs",value:function getTabIndexWithoutDisabledTabs(a){return a-this.props.tabs.slice(0,a).filter(function(a){return!enabledTabsFilter(a)}).length}},{key:"render",value:function render(){var a=this,b=this.props,c=b.tabs,d=b.changeTabOnSwipe,e=b.name,f=b.selected,g=b.className,h=b.transitionSpacing,i=b.headerWidth,j=this.state,k=j.isSwiping,l=j.translateLineX,m=j.isAnimating,n=j.translateFrom,o=j.translateTo,p=j.lastSwipeVelocity,q=j.fullWidthTabs,r=SpacerWidth[h],s=this.filteredTabsLength,t=Math.abs(-n-this.containerWidth*f),u=k?1-t/this.containerWidth:1-Math.abs(t/this.containerWidth-1),v=(Number.isNaN(u)?0:u)*Math.min(10*Math.E,10*p*Math.E),w=m||k,x=s*this.containerWidth+2*r,y=function(a){var b=a.id;return 0<r&&/*#__PURE__*/_jsx("div",{style:{width:r,display:w?"block":"none"}},b)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(b){var h=b===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:a.containerReference,className:classNames("tabs",g,{"tabs--auto-width":i===Width.AUTO}),onTouchStart:d?a.handleTouchStart:void 0,onTouchEnd:d?a.handleTouchEnd:void 0,onTouchMove:d?a.handleTouchMove:void 0,children:[/*#__PURE__*/_jsxs(TabList,{children:[c.map(function(b,d){var g=b.title,h=b.disabled;return/*#__PURE__*/_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(b){a.tabRefs[d]=b},id:"".concat(e,"-tab-").concat(d),panelId:"".concat(e,"-panel-").concat(d),selected:f===d,disabled:h,focusTab:function focusTab(){var b;null!==(b=a.containerReference.current)&&void 0!==b&&b.contains(document.activeElement)&&a.tabRefs[d].focus()},onClick:h?null:a.handleTabClick(d),onKeyDown:a.onKeyDown(d)},q?{style:{width:"".concat(100*(1/c.length),"%")}}:{}),{},{children:g}),g)}),l?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:a.getTabLineWidth(),transform:h?"translateX(-".concat(l,")"):"translateX(".concat(l,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:a.setContainerRefAndWidth,className:"tabs__panel-container",style:{overflow:w?"hidden":"visible"},children:/*#__PURE__*/_jsx(Spring,{from:{transform:"translateX(".concat(n-r,"px)")},to:{transform:"translateX(".concat(o-r,"px)")},config:{precision:k?1:.01,velocity:k?0:v,clamp:!0},onRest:function onRest(){m&&a.setState({isAnimating:!1,lastSwipeVelocity:0})},children:function children(b){return/*#__PURE__*/_jsx("div",{className:"tabs__slider",style:{width:w?"".concat(x,"px"):"100%",transform:w?b.transform:"translateX(0px)"},children:c.map(function(b,d){var g=b.content,h=b.disabled;return h?null:/*#__PURE__*/_jsxs(Fragment,{children:[d===f&&/*#__PURE__*/_jsx(y,{id:"left-spacer"}),/*#__PURE__*/_jsx(TabPanel,{tabId:"".concat(e,"-tab-").concat(d),id:"".concat(e,"-panel-").concat(d),style:{width:w?"".concat(a.containerWidth,"px"):"100%",display:w||d===f?"block":"none"},children:g},c[d].title),d===f&&/*#__PURE__*/_jsx(y,{id:"right-spacer"})]},"".concat(c[d].title,"-fragment"))})})}})})]})}})}}]),b}(Component),SpacerSizes=_objectSpread(_objectSpread({},Size),{},{NONE:"default"});Tabs.propTypes={tabs:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.string.isRequired,content:PropTypes.node.isRequired,disabled:PropTypes.bool.isRequired})).isRequired,selected:PropTypes.number.isRequired,onTabSelect:PropTypes.func.isRequired,name:PropTypes.string.isRequired,animatePanelsOnClick:PropTypes.bool,changeTabOnSwipe:PropTypes.bool,className:PropTypes.string,transitionSpacing:PropTypes.oneOf(["default","xs","sm","md","lg"]),headerWidth:PropTypes.oneOf(["auto","block"]),id:PropTypes.string},Tabs.defaultProps={animatePanelsOnClick:!1,changeTabOnSwipe:!0,className:"",transitionSpacing:SpacerSizes.NONE,headerWidth:Width.BLOCK};export default Tabs;
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";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}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}/* eslint-disable react/forbid-dom-props */import{Spring,animated}from"@react-spring/web";import classNames from"classnames";import clamp from"lodash.clamp";import PropTypes from"prop-types";import{Component,createRef,Fragment}from"react";import{Size,Width,Direction}from"../common";import KeyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{getElasticDragDifference,getSwipeDifference,swipedLeftToRight,swipedRightToLeft,swipeShouldChangeTab,getVelocity}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MIN_INDEX=0,enabledTabsFilter=function(a){return!a.disabled},SpacerWidth={default:0,xs:8,sm:16,md:24,lg:32},Tabs=/*#__PURE__*/function(a){/** @type {RefObject<HTMLDivElement>} */function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"containerReference",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"container",null),_defineProperty(_assertThisInitialized(d),"containerWidth",0),_defineProperty(_assertThisInitialized(d),"tabRefs",[]),_defineProperty(_assertThisInitialized(d),"handleResize",function(){d.setContainerWidth(d.container),d.setState(function(a){var b=a.selectedTabIndex;return{translateTo:-(d.containerWidth*b)}})}),_defineProperty(_assertThisInitialized(d),"setContainerRefAndWidth",function(a){d.container=a,d.setContainerWidth(a)}),_defineProperty(_assertThisInitialized(d),"setContainerWidth",function(a){if(a){var b=a.getBoundingClientRect(),c=b.width;d.containerWidth=c}}),_defineProperty(_assertThisInitialized(d),"isTabDisabled",function(a){var b=d.props.tabs;return b[a]&&b[a].disabled}),_defineProperty(_assertThisInitialized(d),"getAllTabsWidth",function(){return d.tabRefs.map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"getDistanceToSelectedTab",function(a){return d.tabRefs.filter(function(b,c){return c<a}).map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"setTabWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.headerWidth,e=b.selected,f=d.getAllTabsWidth();!a&&(c===Width.BLOCK||d.containerWidth<f)&&d.setState({fullWidthTabs:!0,translateLineX:"".concat(100*e,"%")}),a&&c===Width.AUTO&&d.containerWidth>=f&&d.setState({fullWidthTabs:!1,translateLineX:"".concat(d.getDistanceToSelectedTab(e),"px")})}),_defineProperty(_assertThisInitialized(d),"getTabLineWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.selected,e=b.tabs;if(a)return"".concat(100*(1/e.length),"%");var f=d.tabRefs[c]||d.tabRefs[d.tabRefs.length-1],g=f?f.getBoundingClientRect().width:0;return"".concat(g,"px")}),_defineProperty(_assertThisInitialized(d),"getTabToSelect",function(a,b,c){var e=a;if(swipedLeftToRight(b,c)){if(e-=1,e>MIN_INDEX&&d.isTabDisabled(e))return d.getTabToSelect(e,b,c);}else if(swipedRightToLeft(b,c)&&(e+=1,e<d.MAX_INDEX&&d.isTabDisabled(e)))return d.getTabToSelect(e,b,c);return e=clamp(e,Math.max(a-1,MIN_INDEX),Math.min(a+1,d.MAX_INDEX)),d.isTabDisabled(e)?a:e}),_defineProperty(_assertThisInitialized(d),"swipedOverHalfOfContainer",function(a){return .5<=a/d.containerWidth}),_defineProperty(_assertThisInitialized(d),"calculateApplicableDragDifference",function(a){var b=a.currentSelected,c=a.nextSelected,e=a.start,f=a.end,g=getSwipeDifference(e,f),h=getElasticDragDifference(g);return swipedLeftToRight(e,f)?b>MIN_INDEX&&b!==c?Math.min(g,d.containerWidth):h:!!swipedRightToLeft(e,f)&&(b<d.MAX_INDEX&&b!==c?-Math.min(g,d.containerWidth):-h)}),_defineProperty(_assertThisInitialized(d),"switchTab",function(a){var b=d.props.onTabSelect;b(a)}),_defineProperty(_assertThisInitialized(d),"animateToTab",function(a,b){d.animateLine(a),d.animatePanel(d.getTabIndexWithoutDisabledTabs(a),b)}),_defineProperty(_assertThisInitialized(d),"animateLine",function(a){d.setState(function(b){return{translateLineX:b.fullWidthTabs?"".concat(100*a,"%"):"".concat(d.getDistanceToSelectedTab(a),"px")}})}),_defineProperty(_assertThisInitialized(d),"animatePanel",function(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=d.state.translateTo,e=c,f=-(d.containerWidth*a);d.setState({selectedTabIndex:a,isAnimating:!b&&e!==f,translateFrom:e,translateTo:f})}),_defineProperty(_assertThisInitialized(d),"disableScroll",function(a){var b=d.state.isSwiping;b&&a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handleTabClick",function(a){return function(){d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"onKeyDown",function(a){return function(b){b&&b.keyCode===KeyCodes.ENTER&&d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"handleTouchStart",function(a){var b={x:a.nativeEvent.touches[0].clientX,y:a.nativeEvent.touches[0].clientY,time:Date.now()};d.setState({start:b,currentSwipe:[b]}),a.persist()}),_defineProperty(_assertThisInitialized(d),"handleTouchMove",function(a){var b=d.state.start,c=d.props.selected,e=d.getTabIndexWithoutDisabledTabs(c),f={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},g=getSwipeDifference(b,f),h=getSwipeDifference(b,f,"y"),i=d.state,j=i.isScrolling,k=i.isSwiping;if(a.persist(),j||k||(g>h?k=!0:j=!0),d.setState({isScrolling:j,isSwiping:k}),k){var l=d.getTabToSelect(c,b,f);d.animateLine(d.swipedOverHalfOfContainer(g)?l:c);var m=d.calculateApplicableDragDifference({currentSelected:c,nextSelected:l,start:b,end:f}),n=!!m&&-(d.containerWidth*e)+m;d.setState(function(a){return{currentSwipe:[].concat(_toConsumableArray(a.currentSwipe),[f]),translateFrom:n||a.translateFrom,translateTo:n||a.translateTo}})}}),_defineProperty(_assertThisInitialized(d),"handleTouchEnd",function(a){var b=d.state,c=b.start,e=b.isSwiping,f=d.props.selected,g={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},h=getSwipeDifference(c,g),i=getVelocity([].concat(_toConsumableArray(d.state.currentSwipe),[g]));d.setState({currentSwipe:[]});var j=f;a.persist(),e&&((swipeShouldChangeTab(c,g)||d.swipedOverHalfOfContainer(h))&&(j=d.getTabToSelect(j,c,g)),j===f?d.animateToTab(j):(d.switchTab(j),d.setState({lastSwipeVelocity:i}))),d.setState({isSwiping:!1,isScrolling:!1})}),d.state={start:null,translateX:0,translateFrom:0,translateTo:0,translateLineX:null,isAnimating:!1,isSwiping:!1,isScrolling:!1,lastSwipeVelocity:0,fullWidthTabs:a.headerWidth===Width.BLOCK},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"filteredTabsLength",get:function get(){return this.props.tabs.filter(enabledTabsFilter).length}},{key:"MAX_INDEX",get:function get(){return this.props.tabs.length-1}},{key:"componentDidMount",value:function componentDidMount(){var a=this.props.selected;this.setTabWidth(),this.switchTab(clamp(a,MIN_INDEX,this.MAX_INDEX)),this.animateToTab(clamp(a,MIN_INDEX,this.MAX_INDEX),!0),document.body.addEventListener("touchmove",this.disableScroll,{passive:!1}),document.body.addEventListener("touchforcechange",this.disableScroll,{passive:!1}),window.addEventListener("resize",this.handleResize)}},{key:"componentDidUpdate",value:function componentDidUpdate(a,b){var c=this.props.selected,d=a.selected,e=this.props.tabs[c],f=e&&e.disabled,g=a.tabs[d],h=g&&g.disabled,i=this.props.tabs.length,j=a.tabs.length,k=this.props.tabs.filter(enabledTabsFilter).length,l=a.tabs.filter(enabledTabsFilter).length,m=this.props.headerWidth,n=a.headerWidth,o=this.props.animatePanelsOnClick,p=!o&&!b.isSwiping;(m!==n||i!==j)&&this.setTabWidth(),(c!==d||k!==l||f!==h)&&this.animateToTab(clamp(c,MIN_INDEX,this.MAX_INDEX),c===d||p)}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.body.removeEventListener("touchmove",this.disableScroll),document.body.removeEventListener("touchforcechange",this.disableScroll),window.removeEventListener("resize",this.handleResize)}},{key:"getTabIndexWithoutDisabledTabs",value:function getTabIndexWithoutDisabledTabs(a){return a-this.props.tabs.slice(0,a).filter(function(a){return!enabledTabsFilter(a)}).length}},{key:"render",value:function render(){var a=this,b=this.props,c=b.tabs,d=b.changeTabOnSwipe,e=b.name,f=b.selected,g=b.className,h=b.transitionSpacing,i=b.headerWidth,j=this.state,k=j.isSwiping,l=j.translateLineX,m=j.isAnimating,n=j.translateFrom,o=j.translateTo,p=j.lastSwipeVelocity,q=j.fullWidthTabs,r=SpacerWidth[h],s=this.filteredTabsLength,t=Math.abs(-n-this.containerWidth*f),u=k?1-t/this.containerWidth:1-Math.abs(t/this.containerWidth-1),v=(Number.isNaN(u)?0:u)*Math.min(10*Math.E,10*p*Math.E),w=m||k,x=s*this.containerWidth+2*r,y=function(a){var b=a.id;return 0<r&&/*#__PURE__*/_jsx("div",{style:{width:r,display:w?"block":"none"}},b)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(b){var h=b===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:a.containerReference,className:classNames("tabs",g,{"tabs--auto-width":i===Width.AUTO}),onTouchStart:d?a.handleTouchStart:void 0,onTouchEnd:d?a.handleTouchEnd:void 0,onTouchMove:d?a.handleTouchMove:void 0,children:[/*#__PURE__*/_jsxs(TabList,{children:[c.map(function(b,d){var g=b.title,h=b.disabled;return/*#__PURE__*/_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(b){a.tabRefs[d]=b},id:"".concat(e,"-tab-").concat(d),panelId:"".concat(e,"-panel-").concat(d),selected:f===d,disabled:h,focusTab:function focusTab(){var b;null!==(b=a.containerReference.current)&&void 0!==b&&b.contains(document.activeElement)&&a.tabRefs[d].focus()},onClick:h?null:a.handleTabClick(d),onKeyDown:a.onKeyDown(d)},q?{style:{width:"".concat(100*(1/c.length),"%")}}:{}),{},{children:g}),g)}),l?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:a.getTabLineWidth(),transform:h?"translateX(-".concat(l,")"):"translateX(".concat(l,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:a.setContainerRefAndWidth,className:"tabs__panel-container",style:{overflow:w?"hidden":"visible"},children:/*#__PURE__*/_jsx(Spring,{from:{transform:"translateX(".concat(n-r,"px)")},to:{transform:"translateX(".concat(o-r,"px)")},config:{precision:k?1:.01,velocity:k?0:v,clamp:!0},onRest:function onRest(){m&&a.setState({isAnimating:!1,lastSwipeVelocity:0})},children:function children(b){return/*#__PURE__*/_jsx(animated.div,{className:"tabs__slider",style:{width:w?"".concat(x,"px"):"100%",transform:w?b.transform:"translateX(0px)"},children:c.map(function(b,d){var g=b.content,h=b.disabled;return h?null:/*#__PURE__*/_jsxs(Fragment,{children:[d===f&&/*#__PURE__*/_jsx(y,{id:"left-spacer"}),/*#__PURE__*/_jsx(TabPanel,{tabId:"".concat(e,"-tab-").concat(d),id:"".concat(e,"-panel-").concat(d),style:{width:w?"".concat(a.containerWidth,"px"):"100%",display:w||d===f?"block":"none"},children:g},c[d].title),d===f&&/*#__PURE__*/_jsx(y,{id:"right-spacer"})]},"".concat(c[d].title,"-fragment"))})})}})})]})}})}}]),b}(Component),SpacerSizes=_objectSpread(_objectSpread({},Size),{},{NONE:"default"});Tabs.propTypes={tabs:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.string.isRequired,content:PropTypes.node.isRequired,disabled:PropTypes.bool.isRequired})).isRequired,selected:PropTypes.number.isRequired,onTabSelect:PropTypes.func.isRequired,name:PropTypes.string.isRequired,animatePanelsOnClick:PropTypes.bool,changeTabOnSwipe:PropTypes.bool,className:PropTypes.string,transitionSpacing:PropTypes.oneOf(["default","xs","sm","md","lg"]),headerWidth:PropTypes.oneOf(["auto","block"]),id:PropTypes.string},Tabs.defaultProps={animatePanelsOnClick:!1,changeTabOnSwipe:!0,className:"",transitionSpacing:SpacerSizes.NONE,headerWidth:Width.BLOCK};export default Tabs;
@@ -1 +1 @@
1
- import{action}from"@storybook/addon-actions";import{boolean,text}from"@storybook/addon-knobs";import{Settings}from"@transferwise/icons";import ActionButton from"./ActionButton";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";export default{component:ActionButton,title:"Actions/ActionButton",tags:["autodocs"]};export var Variants=function(){var a=text("text","Button label");return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("p",{children:"Basic"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center m-b-1",children:/*#__PURE__*/_jsx(ActionButton,{disabled:!1,onClick:function onClick(){return action("Clicked!")},children:a})}),/*#__PURE__*/_jsx("p",{children:"With Icon"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:!1,onClick:function onClick(){return action("Clicked!")},children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),a]})}),/*#__PURE__*/_jsx("p",{children:"Disabled"}),/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:!0,onClick:function onClick(){return action("Clicked!")},children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),a]})})]})};export var Basic=function(){var a=boolean("disabled",!1),b=text("text","Button label"),c=boolean("with icon",!1);return/*#__PURE__*/_jsx("div",{className:"text-xs-center",children:/*#__PURE__*/_jsxs(ActionButton,{disabled:a,onClick:function onClick(){return action("Clicked!")},children:[c&&/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),b]})})};
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{Settings}from"@transferwise/icons";import ActionButton from"./ActionButton";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:ActionButton,title:"Actions/ActionButton",tags:["autodocs"]};export var Basic={render:function render(a){return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(ActionButton,_objectSpread(_objectSpread({},a),{},{children:"Button label"}))})}};export var WithIcon={render:function render(a){return/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsxs(ActionButton,_objectSpread(_objectSpread({},a),{},{children:[/*#__PURE__*/_jsx(Settings,{className:"m-r-1"}),"Button label"]}))})}};export var Disabled={render:WithIcon.render,args:{disabled:!0}};
@@ -1 +1 @@
1
- import{action}from"@storybook/addon-actions";import{text,boolean}from"@storybook/addon-knobs";import{FastFlag as FastFlagIcon}from"@transferwise/icons";import{Nudge}from"..";import ActionOption from"./ActionOption";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 meta={component:ActionOption,title:"Option/ActionOption",tags:["autodocs"]};export default meta;var Template=function(){var a=text("title","Action option"),b=text("content","Normally, the button and icon are vertically centered."),c=text("action","Action"),d=boolean("disabled",!1),e=boolean("showMediaAtAllSizes",!1),f=boolean("showMediaCircle",!1),g=boolean("isContainerAligned",!1);return/*#__PURE__*/_jsx(ActionOption,{action:c,media:/*#__PURE__*/_jsx(FastFlagIcon,{}),title:a,content:b,complex:!1,disabled:d,showMediaAtAllSizes:e,showMediaCircle:f,isContainerAligned:g,onClick:action("Button Clicked")})};export var Basic=function(){return/*#__PURE__*/_jsx(Template,{})};export var Multiple=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{})]})};export var WithContainerContent=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("h2",{className:"m-b-2",children:"Choose how to pay"}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Template,{}),/*#__PURE__*/_jsx(Nudge,{className:"m-t-2",mediaName:"globe",title:"Text that is no longer than two lines.",link:"Link",href:"#",onClick:action("action clicked"),onDismiss:action("dismissed")})]})};
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{action}from"@storybook/addon-actions";import{FastFlag as FastFlagIcon}from"@transferwise/icons";import{Nudge}from"..";import ActionOption from"./ActionOption";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:ActionOption,title:"Option/ActionOption",args:{title:"Action option",content:"Normally, the button and icon are vertically centered.",action:"Action",media:/*#__PURE__*/_jsx(FastFlagIcon,{}),showMediaCircle:!1},tags:["autodocs"]};export var Basic={render:function render(a){return/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a))}};export var WithContainerContent={render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("h2",{className:"m-b-2",children:"Choose how to pay"}),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(ActionOption,_objectSpread({},a)),/*#__PURE__*/_jsx(Nudge,{className:"m-t-2",mediaName:"globe",title:"Text that is no longer than two lines.",link:"Link",href:"#",onClick:action("action clicked"),onDismiss:action("dismissed")})]})}};
@@ -0,0 +1 @@
1
+ import"core-js/modules/es.object.keys.js";/* eslint-disable no-alert */import{Sentiment}from"../common";import Alert from"./Alert";import{AlertArrowPosition}from"./withArrow";export default{component:Alert,title:"Feedback/Alert",args:{type:Sentiment.POSITIVE,message:"Payments sent to your bank details **today** might not arrive in time for the holidays."},argTypes:{arrow:{name:"arrow (deprecated)",type:{name:"enum",value:Object.keys(AlertArrowPosition)}},type:{type:{name:"enum",value:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING]}}},tags:["autodocs"]};export var Basic={args:{onDismiss:void 0}};export var WithAction={args:{action:{href:"/",text:"Read more"}}};export var WithArrow={args:{arrow:AlertArrowPosition.TOP_LEFT}};
@@ -0,0 +1 @@
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{Size,Theme}from"../common";import Avatar,{AvatarType}from".";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Avatar,title:"Content/Avatar",tags:["autodocs"]};export var Emoji={render:function render(a){return/*#__PURE__*/_jsx(Avatar,_objectSpread(_objectSpread({},a),{},{children:"\u2708\uFE0F"}))},args:{type:AvatarType.EMOJI,size:Size.MEDIUM,theme:Theme.LIGHT}};export var Flag={render:function render(a){return/*#__PURE__*/_jsx(Avatar,_objectSpread(_objectSpread({},a),{},{children:/*#__PURE__*/_jsx("img",{src:"https://wise.com/public-resources/assets/flags/square/gbp.svg",alt:""})}))},args:{type:AvatarType.THUMBNAIL,size:Size.MEDIUM,outlined:!0}};export var Table={render:function render(a){var b=a.theme,c="https://wise.com/public-resources/assets/flags/square/gbp.svg";return/*#__PURE__*/_jsx("div",{style:{padding:"50px",backgroundColor:b===Theme.DARK?"#37517e":"white"},children:/*#__PURE__*/_jsxs("table",{style:{background:"transparent"},children:[/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.THUMBNAIL,outlined:!0,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.THUMBNAIL,theme:b,children:/*#__PURE__*/_jsx("img",{src:c,alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:44,height:44},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:36,height:36},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:32,height:32},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:26,height:26},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.EMOJI,theme:b,children:/*#__PURE__*/_jsx("img",{style:{width:16,height:16},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\u2708\uFE0F.png",alt:""})})})]}),/*#__PURE__*/_jsxs("tr",{children:[/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.LARGE,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:44,height:44},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:56,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:36,height:36},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.MEDIUM,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:32,height:32},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:40,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:26,height:26},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})}),/*#__PURE__*/_jsx("td",{children:/*#__PURE__*/_jsx(Avatar,{size:Size.SMALL,type:AvatarType.EMOJI,theme:b,backgroundColor:"#D6F5E3",children:/*#__PURE__*/_jsx("img",{style:{width:16,height:16},src:"https://wise.com/public-resources/assets/balances/savings-emoji/google/\uD83C\uDF31.png",alt:""})})})]})]})})}};
@@ -0,0 +1 @@
1
+ import"core-js/modules/es.object.keys.js";import{ProfileType,Sentiment}from"../common";import AvatarWrapper from"./AvatarWrapper";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:AvatarWrapper,title:"Content/AvatarWrapper",argTypes:{profileType:{type:{name:"enum",value:Object.keys(ProfileType)}},badgeStatusIcon:{type:{name:"enum",value:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING]}}},tags:["autodocs"]};export var WithBadgeUrl={args:{badgeUrl:"https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg",avatarProps:{outlined:!0}}};export var WithBadgeStatus={args:{profileType:ProfileType.BUSINESS,badgeStatusIcon:Sentiment.PENDING,avatarProps:{outlined:!1}}};export var All={args:{avatarProps:{outlined:!0}},render:function render(a){var b=a.avatarProps;return/*#__PURE__*/_jsxs("div",{style:{maxWidth:"300px",display:"flex",justifyContent:"space-between"},children:[/*#__PURE__*/_jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("b",{children:"No Badges"})})," ","Personal",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{profileType:ProfileType.PERSONAL,avatarProps:b})}),"Business",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{profileType:ProfileType.BUSINESS,avatarProps:b})}),"Avatar",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{url:"https://wise.com/public-resources/assets/flags/square/gbp.svg",profileType:ProfileType.BUSINESS,avatarProps:b})}),"Initials",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{name:"A A",avatarProps:b})}),"Default",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{avatarProps:b})})]}),/*#__PURE__*/_jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("b",{children:"Badges"})}),"Personal",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeUrl:"https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg",badgeAltText:"wise fast flag badge",profileType:ProfileType.PERSONAL,avatarProps:b})}),"Business",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.POSITIVE,profileType:ProfileType.BUSINESS,avatarProps:b})}),"Avatar",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.NEGATIVE,url:"https://wise.com/public-resources/assets/flags/square/gbp.svg",profileType:ProfileType.BUSINESS,avatarProps:b})}),"Initials",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.NEUTRAL,name:"A A",avatarProps:b})}),"Default",/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx(AvatarWrapper,{badgeStatusIcon:Sentiment.PENDING,avatarProps:b})})]})]})}};
@@ -0,0 +1 @@
1
+ import Chevron from"./Chevron";export default{component:Chevron,title:"Other/Chevron",argTypes:{orientation:{type:{name:"enum",value:["top","bottom","left","right"]}},size:{type:{name:"enum",value:["xs","sm","md"]}}},tags:["autodocs"]};export var Basic={args:{orientation:"top",size:"md"}};
@@ -1 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{action}from"@storybook/addon-actions";import{boolean}from"@storybook/addon-knobs";import{useState}from"react";import{Button,Dimmer}from"..";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Dimmer,title:"Layouts/Dimmer"};export var Basic=function(){var a=useState(!1),b=_slicedToArray(a,2),c=b[0],d=b[1],e=boolean("fadeContentOnExit",!1),f=boolean("fadeContentOnEnter",!1);return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Button,{onClick:function onClick(){return d(function(a){return!a})},children:"Toggle dimmer"}),/*#__PURE__*/_jsx(Dimmer,{open:c,fadeContentOnExit:e,fadeContentOnEnter:f,onClose:function handleClose(){d(!1),action("closed")}})]})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";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{action}from"@storybook/addon-actions";import{useState}from"react";import{Button,Dimmer}from"..";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Dimmer,title:"Layouts/Dimmer",args:{fadeContentOnEnter:!1,fadeContentOnExit:!1,disableClickToClose:!1}};export var Basic={render:function render(a){// eslint-disable-next-line react-hooks/rules-of-hooks
2
+ var b=useState(!1),c=_slicedToArray(b,2),d=c[0],e=c[1];return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Button,{onClick:function onClick(){return e(function(a){return!a})},children:"Toggle dimmer"}),/*#__PURE__*/_jsx(Dimmer,_objectSpread(_objectSpread({},a),{},{open:d,onClose:function onClose(a){e(!1),action("closed")(a)}}))]})}};
@@ -0,0 +1 @@
1
+ import Loader from"./Loader";export default{component:Loader,title:"Loading/Loader",args:{size:"md"},argTypes:{size:{type:{name:"enum",value:["sm","md"]}}},tags:["autodocs"]};export var Basic={};
@@ -0,0 +1 @@
1
+ import Logo,{LogoType}from".";import{jsx as _jsx}from"react/jsx-runtime";export default{component:Logo,title:"Content/Logo",render:function render(a){var b=a.type,c=a.inverse;return/*#__PURE__*/_jsx("div",{className:"".concat(c?"bg--dark":""," p-a-3"),children:/*#__PURE__*/_jsx(Logo,{type:b,inverse:c})})},tags:["autodocs"]};export var Basic={args:{type:LogoType.WISE,inverse:!1}};
@@ -0,0 +1 @@
1
+ import Money from"./Money";export default{component:Money,title:"Typography/Money"};export var Basic={args:{amount:1234.5678,currency:"GBP"}};
@@ -0,0 +1 @@
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{within,userEvent}from"@storybook/testing-library";import MoneyInput from".";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:MoneyInput,title:"Forms/MoneyInput",render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Editable money input label"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread({},a))]})},args:{id:"money-input",amount:1e3,selectProps:{buttonProps:{"aria-label":"Select currency"},dropdownProps:{"aria-label":"Currency options"}}},tags:["autodocs"]};var exampleCurrency={eur:{value:"EUR",label:"EUR",note:"Euro",currency:"eur",searchable:"Spain, Germany, France, Austria"},gbp:{value:"GBP",label:"GBP",note:"British pound",currency:"gbp",searchable:"England, Scotland, Wales"}};export var SingleCurrency={args:{currencies:[],selectedCurrency:exampleCurrency.eur,onCurrencyChange:null}};export var MultipleCurrencies={args:{currencies:[{header:"Popular currencies"},exampleCurrency.eur,exampleCurrency.gbp],selectedCurrency:exampleCurrency.eur}};export var OpenedInput=_objectSpread(_objectSpread({},MultipleCurrencies),{},{play:function play(a){var b=a.canvasElement,c=within(b);userEvent.click(c.getByRole("combobox"))}});export var SmallInput={render:function render(a){return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Money inputs"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),SingleCurrency.args)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),MultipleCurrencies.args)),/*#__PURE__*/_jsx("hr",{}),/*#__PURE__*/_jsxs("div",{className:"has-error",children:[/*#__PURE__*/_jsx("label",{htmlFor:a.id,children:"Error states"}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),SingleCurrency.args)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx(MoneyInput,_objectSpread(_objectSpread({},a),MultipleCurrencies.args))]})]})},args:{size:"sm"}};export var MediumInput={render:SmallInput.render,args:{size:"md"}};export var LargeInput={render:SmallInput.render,args:{size:"lg"}};
@@ -0,0 +1 @@
1
+ import Progress from"./Progress";export default{component:Progress,title:"Other/Progress"};export var Basic={args:{progress:{value:50,max:100}}};
@@ -1 +1 @@
1
- import ProgressBar from"./ProgressBar";var meta={component:ProgressBar,title:"Content/ProgressBar",tags:["autodocs"]};export default meta;export var Basic={args:{description:"You have 3 days to reach your goal.",id:"progress-bar-id",title:"Send 5,550 GBP",progress:{value:50,max:100},textEnd:"200 GBP to go"}};
1
+ import ProgressBar from"./ProgressBar";export default{component:ProgressBar,title:"Content/ProgressBar",tags:["autodocs"]};export var Basic={args:{description:"You have 3 days to reach your goal.",id:"progress-bar-id",title:"Send 5,550 GBP",progress:{value:50,max:100},textEnd:"200 GBP to go"}};
@@ -1 +1 @@
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{FormattedMessage}from"react-intl";import{Provider,Money}from"..";import closeButtonMessages from"../common/closeButton/CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Provider,title:"Other/Provider"};export var Basic=function(){return/*#__PURE__*/_jsxs(_Fragment,{children:["Translated message: ",/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel)),/*#__PURE__*/_jsx("br",{}),/*#__PURE__*/_jsx("br",{}),"Formatting example: ",/*#__PURE__*/_jsx(Money,{amount:1234.5678,currency:"GBP"})]})};
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{FormattedMessage}from"react-intl";import{Provider}from"..";import closeButtonMessages from"../common/closeButton/CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export default{component:Provider,title:"Other/Provider"};export var Basic={render:function render(){return/*#__PURE__*/_jsxs(_Fragment,{children:["Translated message: ",/*#__PURE__*/_jsx(FormattedMessage,_objectSpread({},closeButtonMessages.ariaLabel))]})}};
@@ -0,0 +1 @@
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";import"core-js/modules/es.array.map.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{Size,Sentiment}from"../common";import StatusIcon from"./StatusIcon";import{jsx as _jsx}from"react/jsx-runtime";export default{component:StatusIcon,title:"Other/StatusIcon"};export var Basic={render:function render(a){return/*#__PURE__*/_jsx("span",{style:{display:"flex"},children:/*#__PURE__*/_jsx(StatusIcon,_objectSpread({},a))})}};export var Variants={render:function render(){return/*#__PURE__*/_jsx("span",{style:{display:"flex",justifyContent:"space-between",maxWidth:"400px"},children:[Sentiment.POSITIVE,Sentiment.NEGATIVE,Sentiment.NEUTRAL,Sentiment.WARNING,Sentiment.PENDING].map(function(a){return/*#__PURE__*/_jsx("span",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column",minHeight:"150px",alignItems:"center"},children:[Size.SMALL,Size.MEDIUM,Size.LARGE].map(function(b){return/*#__PURE__*/_jsx(StatusIcon,{size:b,sentiment:a},b)})},a)})})}};
@@ -1 +1 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.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"core-js/modules/es.array.reduce.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.number.is-nan.js";import"core-js/modules/es.number.constructor.js";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{Spring}from"@react-spring/web";import classNames from"classnames";import clamp from"lodash.clamp";import PropTypes from"prop-types";import{Component,createRef,Fragment}from"react";import{Size,Width,Direction}from"../common";import KeyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{getElasticDragDifference,getSwipeDifference,swipedLeftToRight,swipedRightToLeft,swipeShouldChangeTab,getVelocity}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MIN_INDEX=0,enabledTabsFilter=function(a){return!a.disabled},SpacerWidth={default:0,xs:8,sm:16,md:24,lg:32},Tabs=/*#__PURE__*/function(a){/** @type {RefObject<HTMLDivElement>} */function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"containerReference",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"container",null),_defineProperty(_assertThisInitialized(d),"containerWidth",0),_defineProperty(_assertThisInitialized(d),"tabRefs",[]),_defineProperty(_assertThisInitialized(d),"handleResize",function(){d.setContainerWidth(d.container),d.setState(function(a){var b=a.selectedTabIndex;return{translateTo:-(d.containerWidth*b)}})}),_defineProperty(_assertThisInitialized(d),"setContainerRefAndWidth",function(a){d.container=a,d.setContainerWidth(a)}),_defineProperty(_assertThisInitialized(d),"setContainerWidth",function(a){if(a){var b=a.getBoundingClientRect(),c=b.width;d.containerWidth=c}}),_defineProperty(_assertThisInitialized(d),"isTabDisabled",function(a){var b=d.props.tabs;return b[a]&&b[a].disabled}),_defineProperty(_assertThisInitialized(d),"getAllTabsWidth",function(){return d.tabRefs.map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"getDistanceToSelectedTab",function(a){return d.tabRefs.filter(function(b,c){return c<a}).map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"setTabWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.headerWidth,e=b.selected,f=d.getAllTabsWidth();!a&&(c===Width.BLOCK||d.containerWidth<f)&&d.setState({fullWidthTabs:!0,translateLineX:"".concat(100*e,"%")}),a&&c===Width.AUTO&&d.containerWidth>=f&&d.setState({fullWidthTabs:!1,translateLineX:"".concat(d.getDistanceToSelectedTab(e),"px")})}),_defineProperty(_assertThisInitialized(d),"getTabLineWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.selected,e=b.tabs;if(a)return"".concat(100*(1/e.length),"%");var f=d.tabRefs[c]||d.tabRefs[d.tabRefs.length-1],g=f?f.getBoundingClientRect().width:0;return"".concat(g,"px")}),_defineProperty(_assertThisInitialized(d),"getTabToSelect",function(a,b,c){var e=a;if(swipedLeftToRight(b,c)){if(e-=1,e>MIN_INDEX&&d.isTabDisabled(e))return d.getTabToSelect(e,b,c);}else if(swipedRightToLeft(b,c)&&(e+=1,e<d.MAX_INDEX&&d.isTabDisabled(e)))return d.getTabToSelect(e,b,c);return e=clamp(e,Math.max(a-1,MIN_INDEX),Math.min(a+1,d.MAX_INDEX)),d.isTabDisabled(e)?a:e}),_defineProperty(_assertThisInitialized(d),"swipedOverHalfOfContainer",function(a){return .5<=a/d.containerWidth}),_defineProperty(_assertThisInitialized(d),"calculateApplicableDragDifference",function(a){var b=a.currentSelected,c=a.nextSelected,e=a.start,f=a.end,g=getSwipeDifference(e,f),h=getElasticDragDifference(g);return swipedLeftToRight(e,f)?b>MIN_INDEX&&b!==c?Math.min(g,d.containerWidth):h:!!swipedRightToLeft(e,f)&&(b<d.MAX_INDEX&&b!==c?-Math.min(g,d.containerWidth):-h)}),_defineProperty(_assertThisInitialized(d),"switchTab",function(a){var b=d.props.onTabSelect;b(a)}),_defineProperty(_assertThisInitialized(d),"animateToTab",function(a,b){d.animateLine(a),d.animatePanel(d.getTabIndexWithoutDisabledTabs(a),b)}),_defineProperty(_assertThisInitialized(d),"animateLine",function(a){d.setState(function(b){return{translateLineX:b.fullWidthTabs?"".concat(100*a,"%"):"".concat(d.getDistanceToSelectedTab(a),"px")}})}),_defineProperty(_assertThisInitialized(d),"animatePanel",function(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=d.state.translateTo,e=c,f=-(d.containerWidth*a);d.setState({selectedTabIndex:a,isAnimating:!b&&e!==f,translateFrom:e,translateTo:f})}),_defineProperty(_assertThisInitialized(d),"disableScroll",function(a){var b=d.state.isSwiping;b&&a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handleTabClick",function(a){return function(){d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"onKeyDown",function(a){return function(b){b&&b.keyCode===KeyCodes.ENTER&&d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"handleTouchStart",function(a){var b={x:a.nativeEvent.touches[0].clientX,y:a.nativeEvent.touches[0].clientY,time:Date.now()};d.setState({start:b,currentSwipe:[b]}),a.persist()}),_defineProperty(_assertThisInitialized(d),"handleTouchMove",function(a){var b=d.state.start,c=d.props.selected,e=d.getTabIndexWithoutDisabledTabs(c),f={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},g=getSwipeDifference(b,f),h=getSwipeDifference(b,f,"y"),i=d.state,j=i.isScrolling,k=i.isSwiping;if(a.persist(),j||k||(g>h?k=!0:j=!0),d.setState({isScrolling:j,isSwiping:k}),k){var l=d.getTabToSelect(c,b,f);d.animateLine(d.swipedOverHalfOfContainer(g)?l:c);var m=d.calculateApplicableDragDifference({currentSelected:c,nextSelected:l,start:b,end:f}),n=!!m&&-(d.containerWidth*e)+m;d.setState(function(a){return{currentSwipe:[].concat(_toConsumableArray(a.currentSwipe),[f]),translateFrom:n||a.translateFrom,translateTo:n||a.translateTo}})}}),_defineProperty(_assertThisInitialized(d),"handleTouchEnd",function(a){var b=d.state,c=b.start,e=b.isSwiping,f=d.props.selected,g={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},h=getSwipeDifference(c,g),i=getVelocity([].concat(_toConsumableArray(d.state.currentSwipe),[g]));d.setState({currentSwipe:[]});var j=f;a.persist(),e&&((swipeShouldChangeTab(c,g)||d.swipedOverHalfOfContainer(h))&&(j=d.getTabToSelect(j,c,g)),j===f?d.animateToTab(j):(d.switchTab(j),d.setState({lastSwipeVelocity:i}))),d.setState({isSwiping:!1,isScrolling:!1})}),d.state={start:null,translateX:0,translateFrom:0,translateTo:0,translateLineX:null,isAnimating:!1,isSwiping:!1,isScrolling:!1,lastSwipeVelocity:0,fullWidthTabs:a.headerWidth===Width.BLOCK},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"filteredTabsLength",get:function get(){return this.props.tabs.filter(enabledTabsFilter).length}},{key:"MAX_INDEX",get:function get(){return this.props.tabs.length-1}},{key:"componentDidMount",value:function componentDidMount(){var a=this.props.selected;this.setTabWidth(),this.switchTab(clamp(a,MIN_INDEX,this.MAX_INDEX)),this.animateToTab(clamp(a,MIN_INDEX,this.MAX_INDEX),!0),document.body.addEventListener("touchmove",this.disableScroll,{passive:!1}),document.body.addEventListener("touchforcechange",this.disableScroll,{passive:!1}),window.addEventListener("resize",this.handleResize)}},{key:"componentDidUpdate",value:function componentDidUpdate(a,b){var c=this.props.selected,d=a.selected,e=this.props.tabs[c],f=e&&e.disabled,g=a.tabs[d],h=g&&g.disabled,i=this.props.tabs.length,j=a.tabs.length,k=this.props.tabs.filter(enabledTabsFilter).length,l=a.tabs.filter(enabledTabsFilter).length,m=this.props.headerWidth,n=a.headerWidth,o=this.props.animatePanelsOnClick,p=!o&&!b.isSwiping;(m!==n||i!==j)&&this.setTabWidth(),(c!==d||k!==l||f!==h)&&this.animateToTab(clamp(c,MIN_INDEX,this.MAX_INDEX),c===d||p)}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.body.removeEventListener("touchmove",this.disableScroll),document.body.removeEventListener("touchforcechange",this.disableScroll),window.removeEventListener("resize",this.handleResize)}},{key:"getTabIndexWithoutDisabledTabs",value:function getTabIndexWithoutDisabledTabs(a){return a-this.props.tabs.slice(0,a).filter(function(a){return!enabledTabsFilter(a)}).length}},{key:"render",value:function render(){var a=this,b=this.props,c=b.tabs,d=b.changeTabOnSwipe,e=b.name,f=b.selected,g=b.className,h=b.transitionSpacing,i=b.headerWidth,j=this.state,k=j.isSwiping,l=j.translateLineX,m=j.isAnimating,n=j.translateFrom,o=j.translateTo,p=j.lastSwipeVelocity,q=j.fullWidthTabs,r=SpacerWidth[h],s=this.filteredTabsLength,t=Math.abs(-n-this.containerWidth*f),u=k?1-t/this.containerWidth:1-Math.abs(t/this.containerWidth-1),v=(Number.isNaN(u)?0:u)*Math.min(10*Math.E,10*p*Math.E),w=m||k,x=s*this.containerWidth+2*r,y=function(a){var b=a.id;return 0<r&&/*#__PURE__*/_jsx("div",{style:{width:r,display:w?"block":"none"}},b)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(b){var h=b===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:a.containerReference,className:classNames("tabs",g,{"tabs--auto-width":i===Width.AUTO}),onTouchStart:d?a.handleTouchStart:void 0,onTouchEnd:d?a.handleTouchEnd:void 0,onTouchMove:d?a.handleTouchMove:void 0,children:[/*#__PURE__*/_jsxs(TabList,{children:[c.map(function(b,d){var g=b.title,h=b.disabled;return/*#__PURE__*/_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(b){a.tabRefs[d]=b},id:"".concat(e,"-tab-").concat(d),panelId:"".concat(e,"-panel-").concat(d),selected:f===d,disabled:h,focusTab:function focusTab(){var b;null!==(b=a.containerReference.current)&&void 0!==b&&b.contains(document.activeElement)&&a.tabRefs[d].focus()},onClick:h?null:a.handleTabClick(d),onKeyDown:a.onKeyDown(d)},q?{style:{width:"".concat(100*(1/c.length),"%")}}:{}),{},{children:g}),g)}),l?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:a.getTabLineWidth(),transform:h?"translateX(-".concat(l,")"):"translateX(".concat(l,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:a.setContainerRefAndWidth,className:"tabs__panel-container",style:{overflow:w?"hidden":"visible"},children:/*#__PURE__*/_jsx(Spring,{from:{transform:"translateX(".concat(n-r,"px)")},to:{transform:"translateX(".concat(o-r,"px)")},config:{precision:k?1:.01,velocity:k?0:v,clamp:!0},onRest:function onRest(){m&&a.setState({isAnimating:!1,lastSwipeVelocity:0})},children:function children(b){return/*#__PURE__*/_jsx("div",{className:"tabs__slider",style:{width:w?"".concat(x,"px"):"100%",transform:w?b.transform:"translateX(0px)"},children:c.map(function(b,d){var g=b.content,h=b.disabled;return h?null:/*#__PURE__*/_jsxs(Fragment,{children:[d===f&&/*#__PURE__*/_jsx(y,{id:"left-spacer"}),/*#__PURE__*/_jsx(TabPanel,{tabId:"".concat(e,"-tab-").concat(d),id:"".concat(e,"-panel-").concat(d),style:{width:w?"".concat(a.containerWidth,"px"):"100%",display:w||d===f?"block":"none"},children:g},c[d].title),d===f&&/*#__PURE__*/_jsx(y,{id:"right-spacer"})]},"".concat(c[d].title,"-fragment"))})})}})})]})}})}}]),b}(Component),SpacerSizes=_objectSpread(_objectSpread({},Size),{},{NONE:"default"});Tabs.propTypes={tabs:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.string.isRequired,content:PropTypes.node.isRequired,disabled:PropTypes.bool.isRequired})).isRequired,selected:PropTypes.number.isRequired,onTabSelect:PropTypes.func.isRequired,name:PropTypes.string.isRequired,animatePanelsOnClick:PropTypes.bool,changeTabOnSwipe:PropTypes.bool,className:PropTypes.string,transitionSpacing:PropTypes.oneOf(["default","xs","sm","md","lg"]),headerWidth:PropTypes.oneOf(["auto","block"]),id:PropTypes.string},Tabs.defaultProps={animatePanelsOnClick:!1,changeTabOnSwipe:!0,className:"",transitionSpacing:SpacerSizes.NONE,headerWidth:Width.BLOCK};export default Tabs;
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.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"core-js/modules/es.array.reduce.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.number.is-nan.js";import"core-js/modules/es.number.constructor.js";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}/* eslint-disable react/forbid-dom-props */import{Spring,animated}from"@react-spring/web";import classNames from"classnames";import clamp from"lodash.clamp";import PropTypes from"prop-types";import{Component,createRef,Fragment}from"react";import{Size,Width,Direction}from"../common";import KeyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{getElasticDragDifference,getSwipeDifference,swipedLeftToRight,swipedRightToLeft,swipeShouldChangeTab,getVelocity}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MIN_INDEX=0,enabledTabsFilter=function(a){return!a.disabled},SpacerWidth={default:0,xs:8,sm:16,md:24,lg:32},Tabs=/*#__PURE__*/function(a){/** @type {RefObject<HTMLDivElement>} */function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"containerReference",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"container",null),_defineProperty(_assertThisInitialized(d),"containerWidth",0),_defineProperty(_assertThisInitialized(d),"tabRefs",[]),_defineProperty(_assertThisInitialized(d),"handleResize",function(){d.setContainerWidth(d.container),d.setState(function(a){var b=a.selectedTabIndex;return{translateTo:-(d.containerWidth*b)}})}),_defineProperty(_assertThisInitialized(d),"setContainerRefAndWidth",function(a){d.container=a,d.setContainerWidth(a)}),_defineProperty(_assertThisInitialized(d),"setContainerWidth",function(a){if(a){var b=a.getBoundingClientRect(),c=b.width;d.containerWidth=c}}),_defineProperty(_assertThisInitialized(d),"isTabDisabled",function(a){var b=d.props.tabs;return b[a]&&b[a].disabled}),_defineProperty(_assertThisInitialized(d),"getAllTabsWidth",function(){return d.tabRefs.map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"getDistanceToSelectedTab",function(a){return d.tabRefs.filter(function(b,c){return c<a}).map(function(a){return a?a.getBoundingClientRect().width:0}).reduce(function(c,a){return c+a},0)}),_defineProperty(_assertThisInitialized(d),"setTabWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.headerWidth,e=b.selected,f=d.getAllTabsWidth();!a&&(c===Width.BLOCK||d.containerWidth<f)&&d.setState({fullWidthTabs:!0,translateLineX:"".concat(100*e,"%")}),a&&c===Width.AUTO&&d.containerWidth>=f&&d.setState({fullWidthTabs:!1,translateLineX:"".concat(d.getDistanceToSelectedTab(e),"px")})}),_defineProperty(_assertThisInitialized(d),"getTabLineWidth",function(){var a=d.state.fullWidthTabs,b=d.props,c=b.selected,e=b.tabs;if(a)return"".concat(100*(1/e.length),"%");var f=d.tabRefs[c]||d.tabRefs[d.tabRefs.length-1],g=f?f.getBoundingClientRect().width:0;return"".concat(g,"px")}),_defineProperty(_assertThisInitialized(d),"getTabToSelect",function(a,b,c){var e=a;if(swipedLeftToRight(b,c)){if(e-=1,e>MIN_INDEX&&d.isTabDisabled(e))return d.getTabToSelect(e,b,c);}else if(swipedRightToLeft(b,c)&&(e+=1,e<d.MAX_INDEX&&d.isTabDisabled(e)))return d.getTabToSelect(e,b,c);return e=clamp(e,Math.max(a-1,MIN_INDEX),Math.min(a+1,d.MAX_INDEX)),d.isTabDisabled(e)?a:e}),_defineProperty(_assertThisInitialized(d),"swipedOverHalfOfContainer",function(a){return .5<=a/d.containerWidth}),_defineProperty(_assertThisInitialized(d),"calculateApplicableDragDifference",function(a){var b=a.currentSelected,c=a.nextSelected,e=a.start,f=a.end,g=getSwipeDifference(e,f),h=getElasticDragDifference(g);return swipedLeftToRight(e,f)?b>MIN_INDEX&&b!==c?Math.min(g,d.containerWidth):h:!!swipedRightToLeft(e,f)&&(b<d.MAX_INDEX&&b!==c?-Math.min(g,d.containerWidth):-h)}),_defineProperty(_assertThisInitialized(d),"switchTab",function(a){var b=d.props.onTabSelect;b(a)}),_defineProperty(_assertThisInitialized(d),"animateToTab",function(a,b){d.animateLine(a),d.animatePanel(d.getTabIndexWithoutDisabledTabs(a),b)}),_defineProperty(_assertThisInitialized(d),"animateLine",function(a){d.setState(function(b){return{translateLineX:b.fullWidthTabs?"".concat(100*a,"%"):"".concat(d.getDistanceToSelectedTab(a),"px")}})}),_defineProperty(_assertThisInitialized(d),"animatePanel",function(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],c=d.state.translateTo,e=c,f=-(d.containerWidth*a);d.setState({selectedTabIndex:a,isAnimating:!b&&e!==f,translateFrom:e,translateTo:f})}),_defineProperty(_assertThisInitialized(d),"disableScroll",function(a){var b=d.state.isSwiping;b&&a.preventDefault()}),_defineProperty(_assertThisInitialized(d),"handleTabClick",function(a){return function(){d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"onKeyDown",function(a){return function(b){b&&b.keyCode===KeyCodes.ENTER&&d.switchTab(a)}}),_defineProperty(_assertThisInitialized(d),"handleTouchStart",function(a){var b={x:a.nativeEvent.touches[0].clientX,y:a.nativeEvent.touches[0].clientY,time:Date.now()};d.setState({start:b,currentSwipe:[b]}),a.persist()}),_defineProperty(_assertThisInitialized(d),"handleTouchMove",function(a){var b=d.state.start,c=d.props.selected,e=d.getTabIndexWithoutDisabledTabs(c),f={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},g=getSwipeDifference(b,f),h=getSwipeDifference(b,f,"y"),i=d.state,j=i.isScrolling,k=i.isSwiping;if(a.persist(),j||k||(g>h?k=!0:j=!0),d.setState({isScrolling:j,isSwiping:k}),k){var l=d.getTabToSelect(c,b,f);d.animateLine(d.swipedOverHalfOfContainer(g)?l:c);var m=d.calculateApplicableDragDifference({currentSelected:c,nextSelected:l,start:b,end:f}),n=!!m&&-(d.containerWidth*e)+m;d.setState(function(a){return{currentSwipe:[].concat(_toConsumableArray(a.currentSwipe),[f]),translateFrom:n||a.translateFrom,translateTo:n||a.translateTo}})}}),_defineProperty(_assertThisInitialized(d),"handleTouchEnd",function(a){var b=d.state,c=b.start,e=b.isSwiping,f=d.props.selected,g={x:a.nativeEvent.changedTouches[0].clientX,y:a.nativeEvent.changedTouches[0].clientY,time:Date.now()},h=getSwipeDifference(c,g),i=getVelocity([].concat(_toConsumableArray(d.state.currentSwipe),[g]));d.setState({currentSwipe:[]});var j=f;a.persist(),e&&((swipeShouldChangeTab(c,g)||d.swipedOverHalfOfContainer(h))&&(j=d.getTabToSelect(j,c,g)),j===f?d.animateToTab(j):(d.switchTab(j),d.setState({lastSwipeVelocity:i}))),d.setState({isSwiping:!1,isScrolling:!1})}),d.state={start:null,translateX:0,translateFrom:0,translateTo:0,translateLineX:null,isAnimating:!1,isSwiping:!1,isScrolling:!1,lastSwipeVelocity:0,fullWidthTabs:a.headerWidth===Width.BLOCK},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"filteredTabsLength",get:function get(){return this.props.tabs.filter(enabledTabsFilter).length}},{key:"MAX_INDEX",get:function get(){return this.props.tabs.length-1}},{key:"componentDidMount",value:function componentDidMount(){var a=this.props.selected;this.setTabWidth(),this.switchTab(clamp(a,MIN_INDEX,this.MAX_INDEX)),this.animateToTab(clamp(a,MIN_INDEX,this.MAX_INDEX),!0),document.body.addEventListener("touchmove",this.disableScroll,{passive:!1}),document.body.addEventListener("touchforcechange",this.disableScroll,{passive:!1}),window.addEventListener("resize",this.handleResize)}},{key:"componentDidUpdate",value:function componentDidUpdate(a,b){var c=this.props.selected,d=a.selected,e=this.props.tabs[c],f=e&&e.disabled,g=a.tabs[d],h=g&&g.disabled,i=this.props.tabs.length,j=a.tabs.length,k=this.props.tabs.filter(enabledTabsFilter).length,l=a.tabs.filter(enabledTabsFilter).length,m=this.props.headerWidth,n=a.headerWidth,o=this.props.animatePanelsOnClick,p=!o&&!b.isSwiping;(m!==n||i!==j)&&this.setTabWidth(),(c!==d||k!==l||f!==h)&&this.animateToTab(clamp(c,MIN_INDEX,this.MAX_INDEX),c===d||p)}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.body.removeEventListener("touchmove",this.disableScroll),document.body.removeEventListener("touchforcechange",this.disableScroll),window.removeEventListener("resize",this.handleResize)}},{key:"getTabIndexWithoutDisabledTabs",value:function getTabIndexWithoutDisabledTabs(a){return a-this.props.tabs.slice(0,a).filter(function(a){return!enabledTabsFilter(a)}).length}},{key:"render",value:function render(){var a=this,b=this.props,c=b.tabs,d=b.changeTabOnSwipe,e=b.name,f=b.selected,g=b.className,h=b.transitionSpacing,i=b.headerWidth,j=this.state,k=j.isSwiping,l=j.translateLineX,m=j.isAnimating,n=j.translateFrom,o=j.translateTo,p=j.lastSwipeVelocity,q=j.fullWidthTabs,r=SpacerWidth[h],s=this.filteredTabsLength,t=Math.abs(-n-this.containerWidth*f),u=k?1-t/this.containerWidth:1-Math.abs(t/this.containerWidth-1),v=(Number.isNaN(u)?0:u)*Math.min(10*Math.E,10*p*Math.E),w=m||k,x=s*this.containerWidth+2*r,y=function(a){var b=a.id;return 0<r&&/*#__PURE__*/_jsx("div",{style:{width:r,display:w?"block":"none"}},b)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(b){var h=b===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:a.containerReference,className:classNames("tabs",g,{"tabs--auto-width":i===Width.AUTO}),onTouchStart:d?a.handleTouchStart:void 0,onTouchEnd:d?a.handleTouchEnd:void 0,onTouchMove:d?a.handleTouchMove:void 0,children:[/*#__PURE__*/_jsxs(TabList,{children:[c.map(function(b,d){var g=b.title,h=b.disabled;return/*#__PURE__*/_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(b){a.tabRefs[d]=b},id:"".concat(e,"-tab-").concat(d),panelId:"".concat(e,"-panel-").concat(d),selected:f===d,disabled:h,focusTab:function focusTab(){var b;null!==(b=a.containerReference.current)&&void 0!==b&&b.contains(document.activeElement)&&a.tabRefs[d].focus()},onClick:h?null:a.handleTabClick(d),onKeyDown:a.onKeyDown(d)},q?{style:{width:"".concat(100*(1/c.length),"%")}}:{}),{},{children:g}),g)}),l?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:a.getTabLineWidth(),transform:h?"translateX(-".concat(l,")"):"translateX(".concat(l,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:a.setContainerRefAndWidth,className:"tabs__panel-container",style:{overflow:w?"hidden":"visible"},children:/*#__PURE__*/_jsx(Spring,{from:{transform:"translateX(".concat(n-r,"px)")},to:{transform:"translateX(".concat(o-r,"px)")},config:{precision:k?1:.01,velocity:k?0:v,clamp:!0},onRest:function onRest(){m&&a.setState({isAnimating:!1,lastSwipeVelocity:0})},children:function children(b){return/*#__PURE__*/_jsx(animated.div,{className:"tabs__slider",style:{width:w?"".concat(x,"px"):"100%",transform:w?b.transform:"translateX(0px)"},children:c.map(function(b,d){var g=b.content,h=b.disabled;return h?null:/*#__PURE__*/_jsxs(Fragment,{children:[d===f&&/*#__PURE__*/_jsx(y,{id:"left-spacer"}),/*#__PURE__*/_jsx(TabPanel,{tabId:"".concat(e,"-tab-").concat(d),id:"".concat(e,"-panel-").concat(d),style:{width:w?"".concat(a.containerWidth,"px"):"100%",display:w||d===f?"block":"none"},children:g},c[d].title),d===f&&/*#__PURE__*/_jsx(y,{id:"right-spacer"})]},"".concat(c[d].title,"-fragment"))})})}})})]})}})}}]),b}(Component),SpacerSizes=_objectSpread(_objectSpread({},Size),{},{NONE:"default"});Tabs.propTypes={tabs:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.string.isRequired,content:PropTypes.node.isRequired,disabled:PropTypes.bool.isRequired})).isRequired,selected:PropTypes.number.isRequired,onTabSelect:PropTypes.func.isRequired,name:PropTypes.string.isRequired,animatePanelsOnClick:PropTypes.bool,changeTabOnSwipe:PropTypes.bool,className:PropTypes.string,transitionSpacing:PropTypes.oneOf(["default","xs","sm","md","lg"]),headerWidth:PropTypes.oneOf(["auto","block"]),id:PropTypes.string},Tabs.defaultProps={animatePanelsOnClick:!1,changeTabOnSwipe:!0,className:"",transitionSpacing:SpacerSizes.NONE,headerWidth:Width.BLOCK};export default Tabs;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import ActionButton from './ActionButton';
2
4
  declare const _default: {
3
5
  component: import("react").ForwardRefExoticComponent<{
4
6
  text?: string | undefined;
@@ -7,5 +9,7 @@ declare const _default: {
7
9
  tags: string[];
8
10
  };
9
11
  export default _default;
10
- export declare const Variants: () => JSX.Element;
11
- export declare const Basic: () => JSX.Element;
12
+ type Story = StoryObj<typeof ActionButton>;
13
+ export declare const Basic: Story;
14
+ export declare const WithIcon: Story;
15
+ export declare const Disabled: Story;
@@ -1,8 +1,30 @@
1
1
  /// <reference types="react" />
2
- import { Meta } from '@storybook/react';
2
+ import { StoryObj } from '@storybook/react';
3
3
  import ActionOption from './ActionOption';
4
- declare const meta: Meta<typeof ActionOption>;
5
- export default meta;
6
- export declare const Basic: () => JSX.Element;
7
- export declare const Multiple: () => JSX.Element;
8
- export declare const WithContainerContent: () => JSX.Element;
4
+ declare const _default: {
5
+ component: ({ action, disabled, onClick, media, title, content, complex, className, showMediaAtAllSizes, showMediaCircle, isContainerAligned, }: {
6
+ complex?: boolean | undefined;
7
+ content?: import("react").ReactChild | undefined;
8
+ disabled?: boolean | undefined;
9
+ media?: import("react").ReactChild | undefined;
10
+ showMediaAtAllSizes?: boolean | undefined;
11
+ onClick: () => void;
12
+ title: import("react").ReactChild;
13
+ action: import("react").ReactChild;
14
+ showMediaCircle?: boolean | undefined;
15
+ isContainerAligned?: boolean | undefined;
16
+ } & import("../common").CommonProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
17
+ title: string;
18
+ args: {
19
+ title: string;
20
+ content: string;
21
+ action: string;
22
+ media: JSX.Element;
23
+ showMediaCircle: false;
24
+ };
25
+ tags: string[];
26
+ };
27
+ export default _default;
28
+ type Story = StoryObj<typeof ActionOption>;
29
+ export declare const Basic: Story;
30
+ export declare const WithContainerContent: Story;
@@ -0,0 +1,56 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import { Sentiment } from '../common';
4
+ import Alert from './Alert';
5
+ declare const _default: {
6
+ component: {
7
+ (props: any): JSX.Element;
8
+ propTypes: {
9
+ action: any;
10
+ className: any;
11
+ icon: any;
12
+ message: any;
13
+ onDismiss: any;
14
+ type: any;
15
+ variant: any;
16
+ arrow: (props: any, propertyName: any, ...rest: any[]) => any;
17
+ children: (props: any, propertyName: any, ...rest: any[]) => any;
18
+ dismissible: (props: any, propertyName: any, ...rest: any[]) => any;
19
+ };
20
+ defaultProps: {
21
+ action: undefined;
22
+ arrow: undefined;
23
+ className: undefined;
24
+ dismissible: undefined;
25
+ icon: undefined;
26
+ type: Sentiment;
27
+ variant: import("../common").Variant;
28
+ };
29
+ };
30
+ title: string;
31
+ args: {
32
+ type: Sentiment;
33
+ message: string;
34
+ };
35
+ argTypes: {
36
+ arrow: {
37
+ name: string;
38
+ type: {
39
+ name: "enum";
40
+ value: string[];
41
+ };
42
+ };
43
+ type: {
44
+ type: {
45
+ name: "enum";
46
+ value: Sentiment[];
47
+ };
48
+ };
49
+ };
50
+ tags: string[];
51
+ };
52
+ export default _default;
53
+ type Story = StoryObj<typeof Alert>;
54
+ export declare const Basic: Story;
55
+ export declare const WithAction: Story;
56
+ export declare const WithArrow: Story;
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import { Size, Theme } from '../common';
4
+ import Avatar, { AvatarType } from '.';
5
+ declare const _default: {
6
+ component: {
7
+ ({ backgroundColor, children, className, outlined, size, theme, type }: {
8
+ backgroundColor: any;
9
+ children: any;
10
+ className: any;
11
+ outlined: any;
12
+ size: any;
13
+ theme: any;
14
+ type: any;
15
+ }): JSX.Element;
16
+ propTypes: {
17
+ backgroundColor: any;
18
+ children: any;
19
+ className: any;
20
+ outlined: any;
21
+ size: any;
22
+ theme: any;
23
+ type: any;
24
+ };
25
+ defaultProps: {
26
+ backgroundColor: null;
27
+ children: null;
28
+ className: null;
29
+ outlined: boolean;
30
+ size: Size;
31
+ theme: Theme;
32
+ type: AvatarType;
33
+ };
34
+ };
35
+ title: string;
36
+ tags: string[];
37
+ };
38
+ export default _default;
39
+ type Story = StoryObj<typeof Avatar>;
40
+ export declare const Emoji: Story;
41
+ export declare const Flag: Story;
42
+ export declare const Table: Story;