@transferwise/components 0.0.0-experimental-c9cdfe3 → 0.0.0-experimental-79c0fba
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/README.md +1 -1
- package/build/index.esm.js +49 -75
- package/build/index.esm.js.map +1 -1
- package/build/index.js +50 -76
- package/build/index.js.map +1 -1
- package/build/mocks.esm.js +33 -27
- package/build/mocks.esm.js.map +1 -1
- package/build/mocks.js +33 -27
- package/build/mocks.js.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +2 -2
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +12 -17
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/slidingPanel/index.d.ts +2 -1
- package/build/types/slidingPanel/index.d.ts.map +1 -1
- package/build/types/sticky/Sticky.d.ts +9 -14
- package/build/types/sticky/Sticky.d.ts.map +1 -1
- package/build/types/sticky/index.d.ts +2 -1
- package/build/types/sticky/index.d.ts.map +1 -1
- package/package.json +17 -1
- package/src/circularButton/CircularButton.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +47 -41
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +37 -33
- package/src/index.ts +2 -0
- package/src/select/Select.spec.js +1 -1
- package/src/slidingPanel/SlidingPanel.spec.js +9 -19
- package/src/slidingPanel/SlidingPanel.tsx +62 -0
- package/src/slidingPanel/index.ts +2 -0
- package/src/sticky/Sticky.spec.js +0 -1
- package/src/sticky/{Sticky.story.js → Sticky.story.tsx} +2 -3
- package/src/sticky/Sticky.tsx +16 -0
- package/src/sticky/index.ts +2 -0
- package/build/mocks.d.ts +0 -9
- package/build/mocks.d.ts.map +0 -1
- package/src/slidingPanel/SlidingPanel.js +0 -73
- package/src/slidingPanel/index.js +0 -1
- package/src/sticky/Sticky.js +0 -23
- package/src/sticky/index.js +0 -1
- /package/src/slidingPanel/{SlidingPanel.story.js → SlidingPanel.story.tsx} +0 -0
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Please follow [rules for JS components](https://github.com/transferwise/neptune-
|
|
|
53
53
|
We expose reusable mocks for Jest and Vitest under an isolated entry point. They can be applied by passing the testing framework as the parameter:
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
|
-
import { mockMatchMedia, mockResizeObserver } from '@transferwise/components/
|
|
56
|
+
import { mockMatchMedia, mockResizeObserver } from '@transferwise/components/mocks';
|
|
57
57
|
import { jest } from '@jest/globals';
|
|
58
58
|
import { vi } from 'vitest';
|
|
59
59
|
|
package/build/index.esm.js
CHANGED
|
@@ -1753,15 +1753,14 @@ const useLayout = () => {
|
|
|
1753
1753
|
|
|
1754
1754
|
const EXIT_ANIMATION = 350;
|
|
1755
1755
|
const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
1756
|
-
|
|
1757
|
-
className,
|
|
1756
|
+
position = 'left',
|
|
1758
1757
|
open,
|
|
1759
|
-
position,
|
|
1760
1758
|
showSlidingPanelBorder,
|
|
1761
1759
|
slidingPanelPositionFixed,
|
|
1760
|
+
className,
|
|
1761
|
+
children,
|
|
1762
1762
|
...rest
|
|
1763
1763
|
}, reference) => {
|
|
1764
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1765
1764
|
const localReference = useRef(null);
|
|
1766
1765
|
return /*#__PURE__*/createElement(CSSTransition, {
|
|
1767
1766
|
...rest,
|
|
@@ -1774,34 +1773,15 @@ const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
|
1774
1773
|
enter: 0,
|
|
1775
1774
|
exit: EXIT_ANIMATION
|
|
1776
1775
|
},
|
|
1777
|
-
classNames:
|
|
1778
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1779
|
-
}, 'sliding-panel'),
|
|
1776
|
+
classNames: "sliding-panel",
|
|
1780
1777
|
appear: true,
|
|
1781
1778
|
unmountOnExit: true
|
|
1782
1779
|
}, /*#__PURE__*/jsx("div", {
|
|
1783
1780
|
ref: mergeRefs([reference, localReference]),
|
|
1784
|
-
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1781
|
+
className: classNames('sliding-panel', `sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, slidingPanelPositionFixed && 'sliding-panel--fixed', className),
|
|
1785
1782
|
children: children
|
|
1786
1783
|
}));
|
|
1787
1784
|
});
|
|
1788
|
-
SlidingPanel.propTypes = {
|
|
1789
|
-
children: PropTypes.node,
|
|
1790
|
-
className: PropTypes.string,
|
|
1791
|
-
open: PropTypes.bool,
|
|
1792
|
-
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1793
|
-
showSlidingPanelBorder: PropTypes.bool,
|
|
1794
|
-
slidingPanelPositionFixed: PropTypes.bool
|
|
1795
|
-
};
|
|
1796
|
-
SlidingPanel.defaultProps = {
|
|
1797
|
-
children: null,
|
|
1798
|
-
className: undefined,
|
|
1799
|
-
open: false,
|
|
1800
|
-
position: 'left',
|
|
1801
|
-
showSlidingPanelBorder: false,
|
|
1802
|
-
slidingPanelPositionFixed: false
|
|
1803
|
-
};
|
|
1804
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1805
1785
|
|
|
1806
1786
|
const Drawer = ({
|
|
1807
1787
|
children,
|
|
@@ -1820,7 +1800,7 @@ const Drawer = ({
|
|
|
1820
1800
|
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
1821
1801
|
open: open,
|
|
1822
1802
|
onClose: onClose,
|
|
1823
|
-
children: /*#__PURE__*/jsx(SlidingPanel
|
|
1803
|
+
children: /*#__PURE__*/jsx(SlidingPanel, {
|
|
1824
1804
|
open: open,
|
|
1825
1805
|
position: isMobile ? Position.BOTTOM : position,
|
|
1826
1806
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -1937,15 +1917,15 @@ const BottomSheet$1 = props => {
|
|
|
1937
1917
|
props.onClose(event);
|
|
1938
1918
|
}
|
|
1939
1919
|
}
|
|
1940
|
-
const onSwipeStart =
|
|
1941
|
-
initialYCoordinate.current = (
|
|
1920
|
+
const onSwipeStart = event => {
|
|
1921
|
+
initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;
|
|
1942
1922
|
setPressed(true);
|
|
1943
1923
|
};
|
|
1944
|
-
const onSwipeMove =
|
|
1924
|
+
const onSwipeMove = event => {
|
|
1945
1925
|
if (pressed) {
|
|
1946
1926
|
const {
|
|
1947
1927
|
clientY
|
|
1948
|
-
} =
|
|
1928
|
+
} = 'touches' in event ? event.touches[0] : event;
|
|
1949
1929
|
const offset = calculateOffsetAfterMove(clientY);
|
|
1950
1930
|
// check whether move is to the bottom only and content scroll position is at the top
|
|
1951
1931
|
if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {
|
|
@@ -2014,34 +1994,37 @@ const BottomSheet$1 = props => {
|
|
|
2014
1994
|
fadeContentOnEnter: true,
|
|
2015
1995
|
fadeContentOnExit: true,
|
|
2016
1996
|
onClose: close,
|
|
2017
|
-
children: /*#__PURE__*/
|
|
1997
|
+
children: /*#__PURE__*/jsx(SlidingPanel, {
|
|
2018
1998
|
ref: bottomSheetReference,
|
|
2019
1999
|
open: props.open,
|
|
2020
2000
|
position: Position.BOTTOM,
|
|
2021
2001
|
className: classNames('np-bottom-sheet', props.className),
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
className: "np-bottom-sheet--
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2002
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
2003
|
+
role: "dialog",
|
|
2004
|
+
"aria-modal": true,
|
|
2005
|
+
onTouchStart: onSwipeStart,
|
|
2006
|
+
onTouchMove: onSwipeMove,
|
|
2007
|
+
onTouchEnd: onSwipeEnd,
|
|
2008
|
+
onMouseDown: onSwipeStart,
|
|
2009
|
+
onMouseMove: onSwipeMove,
|
|
2010
|
+
onMouseUp: onSwipeEnd,
|
|
2011
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
2012
|
+
ref: topBarReference,
|
|
2013
|
+
className: "np-bottom-sheet--top-bar",
|
|
2014
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
2015
|
+
className: "np-bottom-sheet--handler"
|
|
2016
|
+
}), /*#__PURE__*/jsx(CloseButton, {
|
|
2017
|
+
size: "sm",
|
|
2018
|
+
className: "sr-only np-bottom-sheet--close-btn",
|
|
2019
|
+
onClick: close
|
|
2020
|
+
})]
|
|
2021
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2022
|
+
ref: contentReference,
|
|
2023
|
+
style: setContentMaxHeight(),
|
|
2024
|
+
className: "np-bottom-sheet--content",
|
|
2025
|
+
children: props.children
|
|
2038
2026
|
})]
|
|
2039
|
-
})
|
|
2040
|
-
ref: contentReference,
|
|
2041
|
-
style: setContentMaxHeight(),
|
|
2042
|
-
className: "np-bottom-sheet--content",
|
|
2043
|
-
children: props.children
|
|
2044
|
-
})]
|
|
2027
|
+
})
|
|
2045
2028
|
})
|
|
2046
2029
|
});
|
|
2047
2030
|
};
|
|
@@ -10942,28 +10925,19 @@ function SnackbarProvider({
|
|
|
10942
10925
|
});
|
|
10943
10926
|
}
|
|
10944
10927
|
|
|
10945
|
-
|
|
10946
|
-
open,
|
|
10947
|
-
position,
|
|
10928
|
+
function Sticky({
|
|
10929
|
+
open = true,
|
|
10930
|
+
position = 'bottom',
|
|
10948
10931
|
children
|
|
10949
|
-
})
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
position: PropTypes.oneOf(['top', 'bottom']),
|
|
10959
|
-
children: PropTypes.node
|
|
10960
|
-
};
|
|
10961
|
-
Sticky.defaultProps = {
|
|
10962
|
-
open: true,
|
|
10963
|
-
position: 'bottom',
|
|
10964
|
-
children: null
|
|
10965
|
-
};
|
|
10966
|
-
var Sticky$1 = Sticky;
|
|
10932
|
+
}) {
|
|
10933
|
+
return /*#__PURE__*/jsx(SlidingPanel, {
|
|
10934
|
+
open: open,
|
|
10935
|
+
position: position,
|
|
10936
|
+
slidingPanelPositionFixed: true,
|
|
10937
|
+
showSlidingPanelBorder: true,
|
|
10938
|
+
children: children
|
|
10939
|
+
});
|
|
10940
|
+
}
|
|
10967
10941
|
|
|
10968
10942
|
var messages$1 = defineMessages({
|
|
10969
10943
|
statusNotDone: {
|
|
@@ -15078,5 +15052,5 @@ const translations = {
|
|
|
15078
15052
|
'zh-HK': zhHK
|
|
15079
15053
|
};
|
|
15080
15054
|
|
|
15081
|
-
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel
|
|
15055
|
+
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip$1 as Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15082
15056
|
//# sourceMappingURL=index.esm.js.map
|