@transferwise/components 0.0.0-experimental-9e15bd6 → 0.0.0-experimental-86d6d5d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es/no-polyfill/common/deviceDetection/deviceDetection.js +4 -1
- package/build/es/no-polyfill/common/deviceDetection/index.js +1 -1
- package/build/es/no-polyfill/index.js +1 -1
- package/build/es/no-polyfill/stepper/Stepper.js +1 -1
- package/build/es/no-polyfill/tabs/NewTabs.js +1 -0
- package/build/es/no-polyfill/tabs/TabPanel.js +1 -1
- package/build/es/no-polyfill/tabs/index.js +1 -1
- package/build/es/polyfill/common/deviceDetection/deviceDetection.js +4 -1
- package/build/es/polyfill/common/deviceDetection/index.js +1 -1
- package/build/es/polyfill/index.js +1 -1
- package/build/es/polyfill/stepper/Stepper.js +1 -1
- package/build/es/polyfill/tabs/NewTabs.js +1 -0
- package/build/es/polyfill/tabs/TabPanel.js +1 -1
- package/build/es/polyfill/tabs/index.js +1 -1
- package/build/main.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/tabs/Tabs.css +1 -1
- package/build/types/common/deviceDetection/deviceDetection.d.ts +1 -0
- package/build/types/common/deviceDetection/index.d.ts +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/tabs/NewTabs.d.ts +18 -0
- package/build/types/tabs/TabPanel.d.ts +1 -14
- package/build/types/tabs/index.d.ts +1 -0
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +1 -1
- package/build/es/no-polyfill/stepper/deviceDetection.js +0 -4
- package/build/es/polyfill/stepper/deviceDetection.js +0 -4
- package/build/types/stepper/deviceDetection.d.ts +0 -1
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export function isIosDevice(){var a=["iphone","ipad","ipod"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}
|
|
1
|
+
export function isIosDevice(){var a=["iphone","ipad","ipod"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}function supportsTouchEvents(){var a="undefined"!=typeof window&&window.ontouchstart!==void 0,b="undefined"!=typeof navigator&&navigator.maxTouchPoints,c="undefined"!=typeof window&&window.DocumentTouch&&document instanceof window.DocumentTouch;// eslint-disable-next-line compat/compat
|
|
2
|
+
return!!(a||b||c)}function userAgentSuggestsTouchDevice(){var a=["android","iemobile","iphone","ipad","ipod","blackberry","bada"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
3
|
+
// Only use this for small vanity changes where it still works either way.
|
|
4
|
+
export function isTouchDevice(){return supportsTouchEvents()||userAgentSuggestsTouchDevice()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{isIosDevice}from"./deviceDetection";
|
|
1
|
+
export{isIosDevice,isTouchDevice}from"./deviceDetection";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Types
|
|
3
3
|
*/ /**
|
|
4
4
|
* Components
|
|
5
|
-
*/export{default as Title}from"./title";export{default as Body}from"./body";export{default as Accordion}from"./accordion";export{default as ActionButton}from"./actionButton";export{default as ActionOption}from"./actionOption";export{default as Alert}from"./alert";export{default as Avatar}from"./avatar";export{default as AvatarWrapper}from"./avatarWrapper";export{default as Badge}from"./badge";export{default as BottomSheet}from"./common/bottomSheet";export{default as Button}from"./button";export{default as Card}from"./card";export{default as Checkbox}from"./checkbox";export{default as CheckboxButton}from"./checkboxButton";export{default as CheckboxOption}from"./checkboxOption";export{default as Chevron}from"./chevron";export{default as Chips,Chip}from"./chips";export{default as CircularButton}from"./circularButton";export{default as DateInput}from"./dateInput";export{default as DateLookup}from"./dateLookup";export{default as Decision}from"./decision";export{default as DefinitionList}from"./definitionList";export{default as Dimmer}from"./dimmer";export{default as Display}from"./display";export{default as Drawer}from"./drawer";export{default as DropFade}from"./dropFade";export{default as DynamicFieldDefinitionList}from"./dynamicFieldDefinitionList";export{default as Emphasis}from"./emphasis";export{default as FlowNavigation}from"./flowNavigation";export{default as Header}from"./header";export{default as Image}from"./image";export{default as Info}from"./info";export{default as InlineAlert}from"./inlineAlert";export{Input}from"./inputs/Input";export{TextArea}from"./inputs/TextArea";export{default as InputWithDisplayFormat}from"./inputWithDisplayFormat";export{default as InstructionsList}from"./instructionsList";export{default as Link}from"./link";export{default as Loader}from"./loader";export{default as Logo}from"./logo";export{default as Markdown}from"./markdown";export{default as Modal}from"./modal";export{default as Money}from"./money";export{default as MoneyInput}from"./moneyInput";export{default as NavigationOption}from"./navigationOption";export{default as NavigationOptionsList}from"./navigationOptionsList";export{default as Nudge}from"./nudge";export{default as Option}from"./common/Option";export{default as OverlayHeader}from"./overlayHeader";export{default as PhoneNumberInput}from"./phoneNumberInput";export{default as Popover}from"./popover";export{default as ProcessIndicator}from"./processIndicator";export{default as ProgressBar}from"./progressBar";export{default as Progress}from"./progress";export{default as Provider,DirectionProvider,LanguageProvider}from"./provider";export{default as Radio}from"./radio";export{default as RadioGroup}from"./radioGroup";export{default as RadioOption}from"./radioOption";export{default as Section}from"./section";export{default as Select}from"./select";export{default as SlidingPanel}from"./slidingPanel";export{default as SnackbarPortal}from"./snackbar/Snackbar";export{default as SnackbarProvider}from"./snackbar/SnackbarProvider";export{default as StatusIcon}from"./statusIcon/StatusIcon";export{default as Stepper}from"./stepper";export{default as Sticky}from"./sticky";export{default as Summary}from"./summary";export{default as Switch}from"./switch";export{default as SwitchOption}from"./switchOption";export{default as Tabs}from"./tabs";export{default as TextareaWithDisplayFormat}from"./textareaWithDisplayFormat";export{default as Tooltip}from"./tooltip";export{default as Typeahead}from"./typeahead";export{default as Upload}from"./upload";export{default as UploadInput}from"./uploadInput";export{SnackbarConsumer,SnackbarContext}from"./snackbar/SnackbarContext";export{default as CriticalCommsBanner}from"./criticalBanner";export{default as ListItem}from"./listItem";/**
|
|
5
|
+
*/export{default as Title}from"./title";export{default as Body}from"./body";export{default as Accordion}from"./accordion";export{default as ActionButton}from"./actionButton";export{default as ActionOption}from"./actionOption";export{default as Alert}from"./alert";export{default as Avatar}from"./avatar";export{default as AvatarWrapper}from"./avatarWrapper";export{default as Badge}from"./badge";export{default as BottomSheet}from"./common/bottomSheet";export{default as Button}from"./button";export{default as Card}from"./card";export{default as Checkbox}from"./checkbox";export{default as CheckboxButton}from"./checkboxButton";export{default as CheckboxOption}from"./checkboxOption";export{default as Chevron}from"./chevron";export{default as Chips,Chip}from"./chips";export{default as CircularButton}from"./circularButton";export{default as DateInput}from"./dateInput";export{default as DateLookup}from"./dateLookup";export{default as Decision}from"./decision";export{default as DefinitionList}from"./definitionList";export{default as Dimmer}from"./dimmer";export{default as Display}from"./display";export{default as Drawer}from"./drawer";export{default as DropFade}from"./dropFade";export{default as DynamicFieldDefinitionList}from"./dynamicFieldDefinitionList";export{default as Emphasis}from"./emphasis";export{default as FlowNavigation}from"./flowNavigation";export{default as Header}from"./header";export{default as Image}from"./image";export{default as Info}from"./info";export{default as InlineAlert}from"./inlineAlert";export{Input}from"./inputs/Input";export{TextArea}from"./inputs/TextArea";export{default as InputWithDisplayFormat}from"./inputWithDisplayFormat";export{default as InstructionsList}from"./instructionsList";export{default as Link}from"./link";export{default as Loader}from"./loader";export{default as Logo}from"./logo";export{default as Markdown}from"./markdown";export{default as Modal}from"./modal";export{default as Money}from"./money";export{default as MoneyInput}from"./moneyInput";export{default as NavigationOption}from"./navigationOption";export{default as NavigationOptionsList}from"./navigationOptionsList";export{default as Nudge}from"./nudge";export{default as Option}from"./common/Option";export{default as OverlayHeader}from"./overlayHeader";export{default as PhoneNumberInput}from"./phoneNumberInput";export{default as Popover}from"./popover";export{default as ProcessIndicator}from"./processIndicator";export{default as ProgressBar}from"./progressBar";export{default as Progress}from"./progress";export{default as Provider,DirectionProvider,LanguageProvider}from"./provider";export{default as Radio}from"./radio";export{default as RadioGroup}from"./radioGroup";export{default as RadioOption}from"./radioOption";export{default as Section}from"./section";export{default as Select}from"./select";export{default as SlidingPanel}from"./slidingPanel";export{default as SnackbarPortal}from"./snackbar/Snackbar";export{default as SnackbarProvider}from"./snackbar/SnackbarProvider";export{default as StatusIcon}from"./statusIcon/StatusIcon";export{default as Stepper}from"./stepper";export{default as Sticky}from"./sticky";export{default as Summary}from"./summary";export{default as Switch}from"./switch";export{default as SwitchOption}from"./switchOption";export{default as Tabs}from"./tabs";export{NewTabs}from"./tabs";export{default as TextareaWithDisplayFormat}from"./textareaWithDisplayFormat";export{default as Tooltip}from"./tooltip";export{default as Typeahead}from"./typeahead";export{default as Upload}from"./upload";export{default as UploadInput}from"./uploadInput";export{SnackbarConsumer,SnackbarContext}from"./snackbar/SnackbarContext";export{default as CriticalCommsBanner}from"./criticalBanner";export{default as ListItem}from"./listItem";/**
|
|
6
6
|
* Hooks
|
|
7
7
|
*/export{default as useSnackbar}from"./snackbar/useSnackbar";export{useDirection,useLayout}from"./common/hooks";/**
|
|
8
8
|
* Enums
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import classNames from"classnames";import PropTypes from"prop-types";import Body from"../body/Body";import{Position}from"../common";import{useDirection}from"../common/hooks";import Tooltip from"../tooltip";import{
|
|
1
|
+
import classNames from"classnames";import PropTypes from"prop-types";import Body from"../body/Body";import{Position}from"../common";import{isTouchDevice}from"../common/deviceDetection";import{useDirection}from"../common/hooks";import Tooltip from"../tooltip";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";function clamp(a,b,c){return Math.max(Math.min(b,c),a)}/* eslint-disable react/no-array-index-key */var Stepper=function(a){var b=a.steps,c=a.activeStep,d=a.className,e=useDirection(),f=e.isRTL;if(0===b.length)return null;var g=clamp(0,b.length-1,c),h=1/(b.length-1),i=g/(b.length-1),j=Math.max(i-h,0),k=Math.min(g,1)*h;return/*#__PURE__*/_jsxs("div",{className:classNames("tw-stepper",d),children:[/*#__PURE__*/_jsxs("div",{className:"progress",children:[/*#__PURE__*/_jsx("div",{className:"progress-bar-filler",style:{width:"".concat(100*j,"%")}}),/*#__PURE__*/_jsx("div",{className:"progress-bar-ending",style:{width:"".concat(100*k,"%")}})]}),/*#__PURE__*/_jsx("ul",{className:"tw-stepper-steps p-t-1 m-b-0",children:b.map(function renderStep(a,b){var c=b===g,d=a.onClick&&!c,e=d?/*#__PURE__*/_jsx("button",{type:"button",className:"btn-unstyled tw-stepper__step-label",onClick:function onClick(){return d&&a.onClick()},children:/*#__PURE__*/_jsx("small",{children:a.label})}):/*#__PURE__*/_jsx(Body,{as:"span",className:"tw-stepper__step-label small",children:a.label});return/*#__PURE__*/_jsx("li",{className:classNames("hidden-xs","tw-stepper__step",c&&"tw-stepper__step--active",d&&"tw-stepper__step--clickable",a.hoverLabel&&"tw-stepper__step--has-tooltip"),style:f?{right:"".concat(100*(b*h),"%")}:{left:"".concat(100*(b*h),"%")},children:a.hoverLabel&&!isTouchDevice()?/*#__PURE__*/_jsx(Tooltip,{position:Position.BOTTOM,label:a.hoverLabel,children:e}):e},b)})})]})};/* eslint-enable react/no-array-index-key */Stepper.propTypes={steps:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,onClick:PropTypes.func,hoverLabel:PropTypes.node})).isRequired,activeStep:PropTypes.number,className:PropTypes.string},Stepper.defaultProps={activeStep:0,className:void 0};export default Stepper;
|
|
@@ -0,0 +1 @@
|
|
|
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}/* eslint-disable react/forbid-dom-props */import classNames from"classnames";import{Fragment,useEffect,useRef,useState}from"react";import{Direction,Width}from"../common";import{isTouchDevice as getIsTouchDevice}from"../common/deviceDetection";import keyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var NewTabs=function(a){var b=a.className,c=a.headerWidth,d=void 0===c?Width.BLOCK:c,e=a.tabs,f=a.name,g=a.selected,h=a.onTabSelect,i=a.animatePanelsOnClick,j=a.changeTabOnSwipe,k=void 0!==i&&i?"smooth":"auto",l=useState({translateLineX:void 0,fullWidthTabs:d===Width.BLOCK}),m=_slicedToArray(l,2),n=m[0],o=m[1],p=useRef(),q=useRef([]),r=useRef([]),s=useState(0),t=_slicedToArray(s,2),u=t[0],v=t[1],w=useState(g||0),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useRef(!1),B=useRef(),C=useState(!1),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useRef(!0);useEffect(function(){F(getIsTouchDevice())},[]),useEffect(function(){y!==g&&h(y)},[y]),useEffect(function(){g!==y&&z(g)},[g]),useEffect(function(){return window.addEventListener("resize",H),function(){window.removeEventListener("resize",H)}},[]);var H=function(){p.current&&v(getContainerWidth(p.current))};useEffect(function(){var a=q.current.map(function(a){return a?getContainerWidth(a):0}).reduce(function(c,a){return c+a},0);!n.fullWidthTabs&&(d===Width.BLOCK||u<a)?o({fullWidthTabs:!0,translateLineX:"".concat(100*y,"%")}):n.fullWidthTabs&&d===Width.AUTO&&u>=a?o({fullWidthTabs:!1,translateLineX:"".concat(N(y),"px")}):o(function(a){return _objectSpread(_objectSpread({},a),{},{translateLineX:"".concat(N(y),"px")})})},[u,d,y,n.fullWidthTabs]),useEffect(function(){A.current||requestAnimationFrame(function(){r.current[y].scrollIntoView(G.current?void 0:{behavior:k}),G.current=!1})},[y,k]);var I=function(a){if(!A.current){var b;null===(b=r.current[a])||void 0===b?void 0:b.scrollIntoView({behavior:k})}},J=function(a,b){a&&a.keyCode===keyCodes.ENTER&&I(b)},K=function(a){return a-e.slice(0,a).filter(function(a){return a.disabled}).length},L=function(a){if(A.current=!0,clearTimeout(B.current),B.current=setTimeout(function(){A.current=!1},50),!!p.current){var b=K(Math.round(a.currentTarget.scrollLeft/a.currentTarget.offsetWidth));b!==y&&z(b)}},M=function(){var a=q.current[y],b=a?a.getBoundingClientRect().width:0;return"".concat(b,"px")},N=function(a){return q.current.filter(function(b,c){return c<a}).map(function(a){return a?getContainerWidth(a):0}).reduce(function(c,a){return c+a},0)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(a){var c=a===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:function ref(a){return p.current=a},className:classNames("tabs",b,{"tabs--auto-width":d===Width.AUTO,"tabs--touch-device":E,"tabs--no-drag":!(!(void 0!==j)||j)}),children:[/*#__PURE__*/_jsxs(TabList,{children:[e.map(function(a,b){var c=a.title,d=a.disabled;return/*#__PURE__*/ (/* @ts-expect-error Tab is not typescript */_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(a){q.current[b]=a},id:"".concat(f,"-tab-").concat(b),panelId:"".concat(f,"-panel-").concat(b),selected:y===b,disabled:d,focusTab:function focusTab(){var a;if(null!==(a=p.current)&&void 0!==a&&a.contains(document.activeElement)){var c;null===(c=q.current[b])||void 0===c?void 0:c.focus()}},onClick:d?null:function(){return I(b)},onKeyDown:function onKeyDown(a){return J(a,b)}},n.fullWidthTabs?{style:{width:"".concat(100*(1/e.length),"%")}}:{}),{},{children:c}),c))}),n.translateLineX?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:M(),transform:c?"translateX(-".concat(n.translateLineX,")"):"translateX(".concat(n.translateLineX,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:function ref(a){a&&(p.current=a,v(getContainerWidth(a)))},className:"tabs__panel-container",onScroll:L,children:e.filter(function(a){return!a.disabled}).map(function(a,b){var c=a.content;return/*#__PURE__*/_jsx(Fragment,{children:/*#__PURE__*/_jsx(TabPanel,{ref:function ref(a){r.current[b]=a},tabId:"".concat(f,"-tab-").concat(b),id:"".concat(f,"-panel-").concat(b),style:{width:"undefined"==typeof u?void 0:"".concat(u,"px")},children:c},e[b].title)},"".concat(e[b].title,"-fragment"))})})]})}})},getContainerWidth=function(a){var b=a.getBoundingClientRect(),c=b.width;return c};export default NewTabs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import{jsx as _jsx}from"react/jsx-runtime";var TabPanel
|
|
1
|
+
import PropTypes from"prop-types";import{forwardRef}from"react";import{jsx as _jsx}from"react/jsx-runtime";var TabPanel=/*#__PURE__*/forwardRef(function(a,b){var c=a.children,d=a.id,e=a.tabId,f=a.style;return/*#__PURE__*/_jsx("div",{ref:b,className:"tabs__panel",role:"tabpanel",id:d,"aria-labelledby":e,style:f,children:c})});TabPanel.propTypes={children:PropTypes.node.isRequired,id:PropTypes.string.isRequired,tabId:PropTypes.string.isRequired,style:PropTypes.shape({width:PropTypes.string.isRequired}).isRequired};export default TabPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default}from"./Tabs";
|
|
1
|
+
export{default}from"./Tabs";export{default as NewTabs}from"./NewTabs";
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.string.match.js";export function isIosDevice(){var a=["iphone","ipad","ipod"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}
|
|
1
|
+
import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.string.match.js";export function isIosDevice(){var a=["iphone","ipad","ipod"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}function supportsTouchEvents(){var a="undefined"!=typeof window&&window.ontouchstart!==void 0,b="undefined"!=typeof navigator&&navigator.maxTouchPoints,c="undefined"!=typeof window&&window.DocumentTouch&&document instanceof window.DocumentTouch;// eslint-disable-next-line compat/compat
|
|
2
|
+
return!!(a||b||c)}function userAgentSuggestsTouchDevice(){var a=["android","iemobile","iphone","ipad","ipod","blackberry","bada"].map(function(a){return"(".concat(a,")")}).join("|"),b=new RegExp(a,"ig");return"undefined"!=typeof navigator&&!!navigator.userAgent.match(b)}// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
3
|
+
// Only use this for small vanity changes where it still works either way.
|
|
4
|
+
export function isTouchDevice(){return supportsTouchEvents()||userAgentSuggestsTouchDevice()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{isIosDevice}from"./deviceDetection";
|
|
1
|
+
export{isIosDevice,isTouchDevice}from"./deviceDetection";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Types
|
|
3
3
|
*/ /**
|
|
4
4
|
* Components
|
|
5
|
-
*/export{default as Title}from"./title";export{default as Body}from"./body";export{default as Accordion}from"./accordion";export{default as ActionButton}from"./actionButton";export{default as ActionOption}from"./actionOption";export{default as Alert}from"./alert";export{default as Avatar}from"./avatar";export{default as AvatarWrapper}from"./avatarWrapper";export{default as Badge}from"./badge";export{default as BottomSheet}from"./common/bottomSheet";export{default as Button}from"./button";export{default as Card}from"./card";export{default as Checkbox}from"./checkbox";export{default as CheckboxButton}from"./checkboxButton";export{default as CheckboxOption}from"./checkboxOption";export{default as Chevron}from"./chevron";export{default as Chips,Chip}from"./chips";export{default as CircularButton}from"./circularButton";export{default as DateInput}from"./dateInput";export{default as DateLookup}from"./dateLookup";export{default as Decision}from"./decision";export{default as DefinitionList}from"./definitionList";export{default as Dimmer}from"./dimmer";export{default as Display}from"./display";export{default as Drawer}from"./drawer";export{default as DropFade}from"./dropFade";export{default as DynamicFieldDefinitionList}from"./dynamicFieldDefinitionList";export{default as Emphasis}from"./emphasis";export{default as FlowNavigation}from"./flowNavigation";export{default as Header}from"./header";export{default as Image}from"./image";export{default as Info}from"./info";export{default as InlineAlert}from"./inlineAlert";export{Input}from"./inputs/Input";export{TextArea}from"./inputs/TextArea";export{default as InputWithDisplayFormat}from"./inputWithDisplayFormat";export{default as InstructionsList}from"./instructionsList";export{default as Link}from"./link";export{default as Loader}from"./loader";export{default as Logo}from"./logo";export{default as Markdown}from"./markdown";export{default as Modal}from"./modal";export{default as Money}from"./money";export{default as MoneyInput}from"./moneyInput";export{default as NavigationOption}from"./navigationOption";export{default as NavigationOptionsList}from"./navigationOptionsList";export{default as Nudge}from"./nudge";export{default as Option}from"./common/Option";export{default as OverlayHeader}from"./overlayHeader";export{default as PhoneNumberInput}from"./phoneNumberInput";export{default as Popover}from"./popover";export{default as ProcessIndicator}from"./processIndicator";export{default as ProgressBar}from"./progressBar";export{default as Progress}from"./progress";export{default as Provider,DirectionProvider,LanguageProvider}from"./provider";export{default as Radio}from"./radio";export{default as RadioGroup}from"./radioGroup";export{default as RadioOption}from"./radioOption";export{default as Section}from"./section";export{default as Select}from"./select";export{default as SlidingPanel}from"./slidingPanel";export{default as SnackbarPortal}from"./snackbar/Snackbar";export{default as SnackbarProvider}from"./snackbar/SnackbarProvider";export{default as StatusIcon}from"./statusIcon/StatusIcon";export{default as Stepper}from"./stepper";export{default as Sticky}from"./sticky";export{default as Summary}from"./summary";export{default as Switch}from"./switch";export{default as SwitchOption}from"./switchOption";export{default as Tabs}from"./tabs";export{default as TextareaWithDisplayFormat}from"./textareaWithDisplayFormat";export{default as Tooltip}from"./tooltip";export{default as Typeahead}from"./typeahead";export{default as Upload}from"./upload";export{default as UploadInput}from"./uploadInput";export{SnackbarConsumer,SnackbarContext}from"./snackbar/SnackbarContext";export{default as CriticalCommsBanner}from"./criticalBanner";export{default as ListItem}from"./listItem";/**
|
|
5
|
+
*/export{default as Title}from"./title";export{default as Body}from"./body";export{default as Accordion}from"./accordion";export{default as ActionButton}from"./actionButton";export{default as ActionOption}from"./actionOption";export{default as Alert}from"./alert";export{default as Avatar}from"./avatar";export{default as AvatarWrapper}from"./avatarWrapper";export{default as Badge}from"./badge";export{default as BottomSheet}from"./common/bottomSheet";export{default as Button}from"./button";export{default as Card}from"./card";export{default as Checkbox}from"./checkbox";export{default as CheckboxButton}from"./checkboxButton";export{default as CheckboxOption}from"./checkboxOption";export{default as Chevron}from"./chevron";export{default as Chips,Chip}from"./chips";export{default as CircularButton}from"./circularButton";export{default as DateInput}from"./dateInput";export{default as DateLookup}from"./dateLookup";export{default as Decision}from"./decision";export{default as DefinitionList}from"./definitionList";export{default as Dimmer}from"./dimmer";export{default as Display}from"./display";export{default as Drawer}from"./drawer";export{default as DropFade}from"./dropFade";export{default as DynamicFieldDefinitionList}from"./dynamicFieldDefinitionList";export{default as Emphasis}from"./emphasis";export{default as FlowNavigation}from"./flowNavigation";export{default as Header}from"./header";export{default as Image}from"./image";export{default as Info}from"./info";export{default as InlineAlert}from"./inlineAlert";export{Input}from"./inputs/Input";export{TextArea}from"./inputs/TextArea";export{default as InputWithDisplayFormat}from"./inputWithDisplayFormat";export{default as InstructionsList}from"./instructionsList";export{default as Link}from"./link";export{default as Loader}from"./loader";export{default as Logo}from"./logo";export{default as Markdown}from"./markdown";export{default as Modal}from"./modal";export{default as Money}from"./money";export{default as MoneyInput}from"./moneyInput";export{default as NavigationOption}from"./navigationOption";export{default as NavigationOptionsList}from"./navigationOptionsList";export{default as Nudge}from"./nudge";export{default as Option}from"./common/Option";export{default as OverlayHeader}from"./overlayHeader";export{default as PhoneNumberInput}from"./phoneNumberInput";export{default as Popover}from"./popover";export{default as ProcessIndicator}from"./processIndicator";export{default as ProgressBar}from"./progressBar";export{default as Progress}from"./progress";export{default as Provider,DirectionProvider,LanguageProvider}from"./provider";export{default as Radio}from"./radio";export{default as RadioGroup}from"./radioGroup";export{default as RadioOption}from"./radioOption";export{default as Section}from"./section";export{default as Select}from"./select";export{default as SlidingPanel}from"./slidingPanel";export{default as SnackbarPortal}from"./snackbar/Snackbar";export{default as SnackbarProvider}from"./snackbar/SnackbarProvider";export{default as StatusIcon}from"./statusIcon/StatusIcon";export{default as Stepper}from"./stepper";export{default as Sticky}from"./sticky";export{default as Summary}from"./summary";export{default as Switch}from"./switch";export{default as SwitchOption}from"./switchOption";export{default as Tabs}from"./tabs";export{NewTabs}from"./tabs";export{default as TextareaWithDisplayFormat}from"./textareaWithDisplayFormat";export{default as Tooltip}from"./tooltip";export{default as Typeahead}from"./typeahead";export{default as Upload}from"./upload";export{default as UploadInput}from"./uploadInput";export{SnackbarConsumer,SnackbarContext}from"./snackbar/SnackbarContext";export{default as CriticalCommsBanner}from"./criticalBanner";export{default as ListItem}from"./listItem";/**
|
|
6
6
|
* Hooks
|
|
7
7
|
*/export{default as useSnackbar}from"./snackbar/useSnackbar";export{useDirection,useLayout}from"./common/hooks";/**
|
|
8
8
|
* Enums
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"core-js/modules/es.array.map.js";import classNames from"classnames";import PropTypes from"prop-types";import Body from"../body/Body";import{Position}from"../common";import{useDirection}from"../common/hooks";import Tooltip from"../tooltip";import{
|
|
1
|
+
import"core-js/modules/es.array.map.js";import classNames from"classnames";import PropTypes from"prop-types";import Body from"../body/Body";import{Position}from"../common";import{isTouchDevice}from"../common/deviceDetection";import{useDirection}from"../common/hooks";import Tooltip from"../tooltip";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";function clamp(a,b,c){return Math.max(Math.min(b,c),a)}/* eslint-disable react/no-array-index-key */var Stepper=function(a){var b=a.steps,c=a.activeStep,d=a.className,e=useDirection(),f=e.isRTL;if(0===b.length)return null;var g=clamp(0,b.length-1,c),h=1/(b.length-1),i=g/(b.length-1),j=Math.max(i-h,0),k=Math.min(g,1)*h;return/*#__PURE__*/_jsxs("div",{className:classNames("tw-stepper",d),children:[/*#__PURE__*/_jsxs("div",{className:"progress",children:[/*#__PURE__*/_jsx("div",{className:"progress-bar-filler",style:{width:"".concat(100*j,"%")}}),/*#__PURE__*/_jsx("div",{className:"progress-bar-ending",style:{width:"".concat(100*k,"%")}})]}),/*#__PURE__*/_jsx("ul",{className:"tw-stepper-steps p-t-1 m-b-0",children:b.map(function renderStep(a,b){var c=b===g,d=a.onClick&&!c,e=d?/*#__PURE__*/_jsx("button",{type:"button",className:"btn-unstyled tw-stepper__step-label",onClick:function onClick(){return d&&a.onClick()},children:/*#__PURE__*/_jsx("small",{children:a.label})}):/*#__PURE__*/_jsx(Body,{as:"span",className:"tw-stepper__step-label small",children:a.label});return/*#__PURE__*/_jsx("li",{className:classNames("hidden-xs","tw-stepper__step",c&&"tw-stepper__step--active",d&&"tw-stepper__step--clickable",a.hoverLabel&&"tw-stepper__step--has-tooltip"),style:f?{right:"".concat(100*(b*h),"%")}:{left:"".concat(100*(b*h),"%")},children:a.hoverLabel&&!isTouchDevice()?/*#__PURE__*/_jsx(Tooltip,{position:Position.BOTTOM,label:a.hoverLabel,children:e}):e},b)})})]})};/* eslint-enable react/no-array-index-key */Stepper.propTypes={steps:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,onClick:PropTypes.func,hoverLabel:PropTypes.node})).isRequired,activeStep:PropTypes.number,className:PropTypes.string},Stepper.defaultProps={activeStep:0,className:void 0};export default Stepper;
|
|
@@ -0,0 +1 @@
|
|
|
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.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.function.name.js";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.slice.js";import"core-js/modules/es.array.concat.js";/* eslint-disable react/forbid-dom-props */import classNames from"classnames";import{Fragment,useEffect,useRef,useState}from"react";import{Direction,Width}from"../common";import{isTouchDevice as getIsTouchDevice}from"../common/deviceDetection";import keyCodes from"../common/keyCodes";import{DirectionContext}from"../provider/direction";import Tab from"./Tab";import TabList from"./TabList";import TabPanel from"./TabPanel";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var NewTabs=function(a){var b=a.className,c=a.headerWidth,d=void 0===c?Width.BLOCK:c,e=a.tabs,f=a.name,g=a.selected,h=a.onTabSelect,i=a.animatePanelsOnClick,j=a.changeTabOnSwipe,k=void 0!==i&&i?"smooth":"auto",l=useState({translateLineX:void 0,fullWidthTabs:d===Width.BLOCK}),m=_slicedToArray(l,2),n=m[0],o=m[1],p=useRef(),q=useRef([]),r=useRef([]),s=useState(0),t=_slicedToArray(s,2),u=t[0],v=t[1],w=useState(g||0),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useRef(!1),B=useRef(),C=useState(!1),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useRef(!0);useEffect(function(){F(getIsTouchDevice())},[]),useEffect(function(){y!==g&&h(y)},[y]),useEffect(function(){g!==y&&z(g)},[g]),useEffect(function(){return window.addEventListener("resize",H),function(){window.removeEventListener("resize",H)}},[]);var H=function(){p.current&&v(getContainerWidth(p.current))};useEffect(function(){var a=q.current.map(function(a){return a?getContainerWidth(a):0}).reduce(function(c,a){return c+a},0);!n.fullWidthTabs&&(d===Width.BLOCK||u<a)?o({fullWidthTabs:!0,translateLineX:"".concat(100*y,"%")}):n.fullWidthTabs&&d===Width.AUTO&&u>=a?o({fullWidthTabs:!1,translateLineX:"".concat(N(y),"px")}):o(function(a){return _objectSpread(_objectSpread({},a),{},{translateLineX:"".concat(N(y),"px")})})},[u,d,y,n.fullWidthTabs]),useEffect(function(){A.current||requestAnimationFrame(function(){r.current[y].scrollIntoView(G.current?void 0:{behavior:k}),G.current=!1})},[y,k]);var I=function(a){if(!A.current){var b;null===(b=r.current[a])||void 0===b?void 0:b.scrollIntoView({behavior:k})}},J=function(a,b){a&&a.keyCode===keyCodes.ENTER&&I(b)},K=function(a){return a-e.slice(0,a).filter(function(a){return a.disabled}).length},L=function(a){if(A.current=!0,clearTimeout(B.current),B.current=setTimeout(function(){A.current=!1},50),!!p.current){var b=K(Math.round(a.currentTarget.scrollLeft/a.currentTarget.offsetWidth));b!==y&&z(b)}},M=function(){var a=q.current[y],b=a?a.getBoundingClientRect().width:0;return"".concat(b,"px")},N=function(a){return q.current.filter(function(b,c){return c<a}).map(function(a){return a?getContainerWidth(a):0}).reduce(function(c,a){return c+a},0)};return/*#__PURE__*/_jsx(DirectionContext.Consumer,{children:function children(a){var c=a===Direction.RTL;return/*#__PURE__*/_jsxs("div",{ref:function ref(a){return p.current=a},className:classNames("tabs",b,{"tabs--auto-width":d===Width.AUTO,"tabs--touch-device":E,"tabs--no-drag":!(!(void 0!==j)||j)}),children:[/*#__PURE__*/_jsxs(TabList,{children:[e.map(function(a,b){var c=a.title,d=a.disabled;return/*#__PURE__*/ (/* @ts-expect-error Tab is not typescript */_jsx(Tab,_objectSpread(_objectSpread({ref:function ref(a){q.current[b]=a},id:"".concat(f,"-tab-").concat(b),panelId:"".concat(f,"-panel-").concat(b),selected:y===b,disabled:d,focusTab:function focusTab(){var a;if(null!==(a=p.current)&&void 0!==a&&a.contains(document.activeElement)){var c;null===(c=q.current[b])||void 0===c?void 0:c.focus()}},onClick:d?null:function(){return I(b)},onKeyDown:function onKeyDown(a){return J(a,b)}},n.fullWidthTabs?{style:{width:"".concat(100*(1/e.length),"%")}}:{}),{},{children:c}),c))}),n.translateLineX?/*#__PURE__*/_jsx("li",{className:classNames("tabs__line"),style:{width:M(),transform:c?"translateX(-".concat(n.translateLineX,")"):"translateX(".concat(n.translateLineX,")")}}):null]}),/*#__PURE__*/_jsx("div",{ref:function ref(a){a&&(p.current=a,v(getContainerWidth(a)))},className:"tabs__panel-container",onScroll:L,children:e.filter(function(a){return!a.disabled}).map(function(a,b){var c=a.content;return/*#__PURE__*/_jsx(Fragment,{children:/*#__PURE__*/_jsx(TabPanel,{ref:function ref(a){r.current[b]=a},tabId:"".concat(f,"-tab-").concat(b),id:"".concat(f,"-panel-").concat(b),style:{width:"undefined"==typeof u?void 0:"".concat(u,"px")},children:c},e[b].title)},"".concat(e[b].title,"-fragment"))})})]})}})},getContainerWidth=function(a){var b=a.getBoundingClientRect(),c=b.width;return c};export default NewTabs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import{jsx as _jsx}from"react/jsx-runtime";var TabPanel
|
|
1
|
+
import PropTypes from"prop-types";import{forwardRef}from"react";import{jsx as _jsx}from"react/jsx-runtime";var TabPanel=/*#__PURE__*/forwardRef(function(a,b){var c=a.children,d=a.id,e=a.tabId,f=a.style;return/*#__PURE__*/_jsx("div",{ref:b,className:"tabs__panel",role:"tabpanel",id:d,"aria-labelledby":e,style:f,children:c})});TabPanel.propTypes={children:PropTypes.node.isRequired,id:PropTypes.string.isRequired,tabId:PropTypes.string.isRequired,style:PropTypes.shape({width:PropTypes.string.isRequired}).isRequired};export default TabPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default}from"./Tabs";
|
|
1
|
+
export{default}from"./Tabs";export{default as NewTabs}from"./NewTabs";
|