@transferwise/components 0.0.0-experimental-756c861 → 0.0.0-experimental-2ce5185
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.js +20 -48
- package/build/index.js.map +1 -1
- package/build/index.mjs +19 -46
- package/build/index.mjs.map +1 -1
- package/build/types/button/Button.messages.d.ts +3 -3
- package/build/types/button/classMap.d.ts +6 -6
- package/build/types/card/Card.d.ts +17 -20
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/card/index.d.ts +2 -1
- package/build/types/card/index.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +3 -3
- package/build/types/flowNavigation/backButton/index.d.ts +1 -1
- package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/select/index.d.ts +1 -1
- package/build/types/select/index.d.ts.map +1 -1
- package/build/types/select/option/index.d.ts +1 -1
- package/build/types/select/option/index.d.ts.map +1 -1
- package/build/types/tabs/TabList.d.ts +1 -1
- package/build/types/tabs/TabPanel.d.ts +4 -4
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +20 -20
- package/build/types/upload/steps/completeStep/completeStep.d.ts +10 -10
- package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts +8 -8
- package/build/types/upload/steps/processingStep/processingStep.d.ts +8 -8
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts +9 -9
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/accordion/Accordion.spec.js +5 -5
- package/src/accordion/AccordionItem/AccordionItem.spec.js +2 -2
- package/src/actionButton/ActionButton.spec.tsx +4 -4
- package/src/alert/Alert.spec.tsx +4 -4
- package/src/button/Button.spec.js +4 -4
- package/src/card/{Card.spec.js → Card.spec.tsx} +4 -4
- package/src/card/{Card.story.js → Card.story.tsx} +6 -15
- package/src/card/{Card.js → Card.tsx} +23 -34
- package/src/card/index.ts +2 -0
- package/src/carousel/Carousel.spec.tsx +17 -17
- package/src/circularButton/CircularButton.spec.tsx +4 -4
- package/src/common/RadioButton/RadioButton.spec.tsx +2 -2
- package/src/dateLookup/DateLookup.rtl.spec.tsx +16 -18
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +43 -47
- package/src/dimmer/Dimmer.rtl.spec.js +10 -10
- package/src/drawer/Drawer.rtl.spec.js +4 -4
- package/src/field/Field.spec.tsx +2 -2
- package/src/header/Header.spec.tsx +6 -6
- package/src/index.ts +1 -0
- package/src/inputs/SelectInput.spec.tsx +47 -26
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +2 -2
- package/src/popover/Popover.spec.tsx +10 -10
- package/src/section/Section.story.tsx +0 -2
- package/src/segmentedControl/SegmentedControl.spec.tsx +10 -10
- package/src/select/Select.spec.js +71 -71
- package/src/test-utils/index.js +1 -1
- package/src/tooltip/Tooltip.spec.tsx +16 -15
- package/src/uploadInput/UploadInput.spec.tsx +10 -9
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +4 -4
- package/src/uploadInput/uploadItem/UploadItem.spec.tsx +4 -4
- package/src/card/index.js +0 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ export default function Hello() {
|
|
|
44
44
|
|
|
45
45
|
This package exposes [type declarations](https://www.typescriptlang.org/docs/handbook/2/type-declarations.html) for all components.
|
|
46
46
|
|
|
47
|
-
Note: types for some of components are not 100% accurate (some of them will be just [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)), this is due to fact that many of components written on JavaScript and types generated by [react-to-typescript-definitions](https://www.npmjs.com/package/react-to-typescript-definitions) based of components `PropTypes` and unfortunatly the library doesn't resolve all `PropTypes` features and use cases (e.g custom validators, `PropTypes.objectOf`,
|
|
47
|
+
Note: types for some of components are not 100% accurate (some of them will be just [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)), this is due to fact that many of components written on JavaScript and types generated by [react-to-typescript-definitions](https://www.npmjs.com/package/react-to-typescript-definitions) based of components `PropTypes` and unfortunatly the library doesn't resolve all `PropTypes` features and use cases (e.g custom validators, `PropTypes.objectOf`, etc). But bear with us as eventually it would be fully on TypeScript.
|
|
48
48
|
|
|
49
49
|
Please follow [rules for JS components](https://github.com/transferwise/neptune-web/blob/main/packages/components/CONTRIBUTING.md#js-component-rules) in order to generate accurate types for them.
|
|
50
50
|
|
package/build/index.js
CHANGED
|
@@ -21,7 +21,6 @@ var reactPopper = require('react-popper');
|
|
|
21
21
|
var art = require('@wise/art');
|
|
22
22
|
var clamp$2 = require('lodash.clamp');
|
|
23
23
|
var debounce = require('lodash.debounce');
|
|
24
|
-
var requiredIf = require('react-required-if');
|
|
25
24
|
var web = require('@react-spring/web');
|
|
26
25
|
|
|
27
26
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -51,7 +50,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
|
51
50
|
var mergeProps__default = /*#__PURE__*/_interopDefault(mergeProps);
|
|
52
51
|
var clamp__default = /*#__PURE__*/_interopDefault(clamp$2);
|
|
53
52
|
var debounce__default = /*#__PURE__*/_interopDefault(debounce);
|
|
54
|
-
var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
|
|
55
53
|
|
|
56
54
|
exports.Typography = void 0;
|
|
57
55
|
(function (Typography) {
|
|
@@ -1501,7 +1499,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
1501
1499
|
});
|
|
1502
1500
|
});
|
|
1503
1501
|
|
|
1504
|
-
const Card$
|
|
1502
|
+
const Card$1 = /*#__PURE__*/React.forwardRef(({
|
|
1505
1503
|
className,
|
|
1506
1504
|
children = null,
|
|
1507
1505
|
id,
|
|
@@ -1534,7 +1532,7 @@ const Card$2 = /*#__PURE__*/React.forwardRef(({
|
|
|
1534
1532
|
}), children]
|
|
1535
1533
|
});
|
|
1536
1534
|
});
|
|
1537
|
-
Card$
|
|
1535
|
+
Card$1.displayName = 'Card';
|
|
1538
1536
|
|
|
1539
1537
|
function Display({
|
|
1540
1538
|
as: Heading = 'h1',
|
|
@@ -1913,7 +1911,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
1913
1911
|
React.useEffect(() => {
|
|
1914
1912
|
setChecked(defaultChecked ?? isChecked ?? false);
|
|
1915
1913
|
}, [defaultChecked, isChecked]);
|
|
1916
|
-
return /*#__PURE__*/jsxRuntime.jsxs(Card$
|
|
1914
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Card$1, {
|
|
1917
1915
|
...commonProps,
|
|
1918
1916
|
...checkedProps,
|
|
1919
1917
|
...props,
|
|
@@ -2210,20 +2208,19 @@ const isVisible = (container, el) => {
|
|
|
2210
2208
|
return elemLeft >= cScrollOffset && elemRight <= cScrollOffset + cWidth;
|
|
2211
2209
|
};
|
|
2212
2210
|
|
|
2213
|
-
const Card = /*#__PURE__*/React.forwardRef((
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
} = props;
|
|
2211
|
+
const Card = /*#__PURE__*/React.forwardRef(function Card({
|
|
2212
|
+
'aria-label': ariaLabel,
|
|
2213
|
+
as: Element = 'div',
|
|
2214
|
+
isExpanded,
|
|
2215
|
+
title,
|
|
2216
|
+
details,
|
|
2217
|
+
children,
|
|
2218
|
+
onClick,
|
|
2219
|
+
icon,
|
|
2220
|
+
id,
|
|
2221
|
+
className,
|
|
2222
|
+
'data-testid': dataTestId
|
|
2223
|
+
}, reference) {
|
|
2227
2224
|
const isOpen = !!(isExpanded && children);
|
|
2228
2225
|
return /*#__PURE__*/jsxRuntime.jsxs(Element, {
|
|
2229
2226
|
ref: reference,
|
|
@@ -2233,7 +2230,7 @@ const Card = /*#__PURE__*/React.forwardRef((props, reference) => {
|
|
|
2233
2230
|
'np-card--has-icon': !!icon
|
|
2234
2231
|
}),
|
|
2235
2232
|
id: id,
|
|
2236
|
-
"data-testid":
|
|
2233
|
+
"data-testid": dataTestId,
|
|
2237
2234
|
children: [/*#__PURE__*/jsxRuntime.jsx(Option$2, {
|
|
2238
2235
|
"aria-label": ariaLabel,
|
|
2239
2236
|
as: children ? 'button' : 'div',
|
|
@@ -2245,7 +2242,7 @@ const Card = /*#__PURE__*/React.forwardRef((props, reference) => {
|
|
|
2245
2242
|
button: children && /*#__PURE__*/jsxRuntime.jsx(Chevron, {
|
|
2246
2243
|
orientation: isOpen ? exports.Position.TOP : exports.Position.BOTTOM
|
|
2247
2244
|
}),
|
|
2248
|
-
onClick: () =>
|
|
2245
|
+
onClick: children ? () => onClick?.(!isExpanded) : undefined
|
|
2249
2246
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2250
2247
|
className: classNames__default.default('np-card__divider', {
|
|
2251
2248
|
'np-card__divider--expanded': isOpen
|
|
@@ -2258,31 +2255,6 @@ const Card = /*#__PURE__*/React.forwardRef((props, reference) => {
|
|
|
2258
2255
|
})]
|
|
2259
2256
|
});
|
|
2260
2257
|
});
|
|
2261
|
-
const hasChildren = ({
|
|
2262
|
-
children
|
|
2263
|
-
}) => children;
|
|
2264
|
-
Card.propTypes = {
|
|
2265
|
-
'aria-label': PropTypes__default.default.string,
|
|
2266
|
-
as: PropTypes__default.default.string,
|
|
2267
|
-
isExpanded: requiredIf__default.default(PropTypes__default.default.bool, hasChildren),
|
|
2268
|
-
title: PropTypes__default.default.node.isRequired,
|
|
2269
|
-
details: PropTypes__default.default.node.isRequired,
|
|
2270
|
-
onClick: requiredIf__default.default(PropTypes__default.default.func, hasChildren),
|
|
2271
|
-
icon: PropTypes__default.default.node,
|
|
2272
|
-
children: PropTypes__default.default.node,
|
|
2273
|
-
id: PropTypes__default.default.string,
|
|
2274
|
-
className: PropTypes__default.default.string,
|
|
2275
|
-
'data-testid': PropTypes__default.default.string
|
|
2276
|
-
};
|
|
2277
|
-
Card.defaultProps = {
|
|
2278
|
-
'aria-label': undefined,
|
|
2279
|
-
as: 'div',
|
|
2280
|
-
children: null,
|
|
2281
|
-
id: null,
|
|
2282
|
-
className: null,
|
|
2283
|
-
'data-testid': null
|
|
2284
|
-
};
|
|
2285
|
-
var Card$1 = Card;
|
|
2286
2258
|
|
|
2287
2259
|
const CheckboxButton = /*#__PURE__*/React.forwardRef(({
|
|
2288
2260
|
checked,
|
|
@@ -14695,11 +14667,11 @@ exports.Alert = Alert;
|
|
|
14695
14667
|
exports.Avatar = Avatar;
|
|
14696
14668
|
exports.AvatarWrapper = AvatarWrapper;
|
|
14697
14669
|
exports.Badge = Badge;
|
|
14698
|
-
exports.BaseCard = Card$
|
|
14670
|
+
exports.BaseCard = Card$1;
|
|
14699
14671
|
exports.Body = Body;
|
|
14700
14672
|
exports.BottomSheet = BottomSheet$1;
|
|
14701
14673
|
exports.Button = Button;
|
|
14702
|
-
exports.Card = Card
|
|
14674
|
+
exports.Card = Card;
|
|
14703
14675
|
exports.Carousel = Carousel;
|
|
14704
14676
|
exports.Checkbox = Checkbox;
|
|
14705
14677
|
exports.CheckboxButton = CheckboxButton;
|