@transferwise/components 46.42.0 → 46.43.0
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/index.js +73 -40
- package/build/index.js.map +1 -1
- package/build/index.mjs +74 -41
- package/build/index.mjs.map +1 -1
- package/build/main.css +41 -51
- package/build/styles/inputs/SelectInput.css +41 -51
- package/build/styles/main.css +41 -51
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +7 -0
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +1 -0
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +3 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/circularButton/CircularButton.story.tsx +53 -84
- package/src/common/hooks/useVirtualKeyboard.ts +21 -0
- package/src/inputs/InputGroup.spec.tsx +26 -0
- package/src/inputs/InputGroup.tsx +35 -13
- package/src/inputs/SearchInput.spec.tsx +16 -0
- package/src/inputs/SelectInput.css +41 -51
- package/src/inputs/SelectInput.spec.tsx +1 -1
- package/src/inputs/SelectInput.tsx +4 -1
- package/src/inputs/_BottomSheet.less +35 -49
- package/src/inputs/_BottomSheet.tsx +22 -27
- package/src/inputs/_Popover.less +2 -2
- package/src/main.css +41 -51
package/build/index.js
CHANGED
|
@@ -5766,25 +5766,45 @@ function InputGroup({
|
|
|
5766
5766
|
className,
|
|
5767
5767
|
children
|
|
5768
5768
|
}) {
|
|
5769
|
+
const inputAttributes = useInputAttributes({
|
|
5770
|
+
nonLabelable: true
|
|
5771
|
+
});
|
|
5769
5772
|
const [paddingStart, setPaddingStart] = React.useState(inputPaddingInitialState(addonStart));
|
|
5770
5773
|
const [paddingEnd, setPaddingEnd] = React.useState(inputPaddingInitialState(addonEnd));
|
|
5771
|
-
return
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
children:
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5774
|
+
return (
|
|
5775
|
+
/*#__PURE__*/
|
|
5776
|
+
/* Prevent nested controls from being labeled redundantly */
|
|
5777
|
+
jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
5778
|
+
value: undefined,
|
|
5779
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
5780
|
+
value: undefined,
|
|
5781
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5782
|
+
value: undefined,
|
|
5783
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5784
|
+
value: undefined,
|
|
5785
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputPaddingStartContext.Provider, {
|
|
5786
|
+
value: React.useMemo(() => [paddingStart, setPaddingStart], [paddingStart]),
|
|
5787
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputPaddingEndContext.Provider, {
|
|
5788
|
+
value: React.useMemo(() => [paddingEnd, setPaddingEnd], [paddingEnd]),
|
|
5789
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("fieldset", {
|
|
5790
|
+
...inputAttributes,
|
|
5791
|
+
disabled: disabled,
|
|
5792
|
+
className: classNames__default.default(className, 'np-input-group'),
|
|
5793
|
+
children: [addonStart != null ? /*#__PURE__*/jsxRuntime.jsx(InputAddon, {
|
|
5794
|
+
placement: "start",
|
|
5795
|
+
...addonStart
|
|
5796
|
+
}) : null, children, addonEnd != null ? /*#__PURE__*/jsxRuntime.jsx(InputAddon, {
|
|
5797
|
+
placement: "end",
|
|
5798
|
+
...addonEnd
|
|
5799
|
+
}) : null]
|
|
5800
|
+
})
|
|
5801
|
+
})
|
|
5802
|
+
})
|
|
5803
|
+
})
|
|
5804
|
+
})
|
|
5785
5805
|
})
|
|
5786
5806
|
})
|
|
5787
|
-
|
|
5807
|
+
);
|
|
5788
5808
|
}
|
|
5789
5809
|
const inputAddonContentWidthAddendByPadding = {
|
|
5790
5810
|
none: 0,
|
|
@@ -6262,6 +6282,26 @@ const PolymorphicWithOverrides = /*#__PURE__*/React.forwardRef(function Polymorp
|
|
|
6262
6282
|
});
|
|
6263
6283
|
});
|
|
6264
6284
|
|
|
6285
|
+
/**
|
|
6286
|
+
* This progressive enhancement uses an experimental API, it might change,
|
|
6287
|
+
* and at the time of authoring is not supported on iOS or mobile Firefox.
|
|
6288
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard
|
|
6289
|
+
*/
|
|
6290
|
+
function useVirtualKeyboard() {
|
|
6291
|
+
React.useEffect(() => {
|
|
6292
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6293
|
+
if ('virtualKeyboard' in navigator) {
|
|
6294
|
+
const virtualKeyboard = navigator.virtualKeyboard;
|
|
6295
|
+
const initialOverlaysContent = virtualKeyboard.overlaysContent;
|
|
6296
|
+
virtualKeyboard.overlaysContent = true;
|
|
6297
|
+
return () => {
|
|
6298
|
+
virtualKeyboard.overlaysContent = initialOverlaysContent;
|
|
6299
|
+
};
|
|
6300
|
+
}
|
|
6301
|
+
/* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6302
|
+
}, []);
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6265
6305
|
function PreventScroll() {
|
|
6266
6306
|
overlays.usePreventScroll();
|
|
6267
6307
|
return null;
|
|
@@ -6277,6 +6317,7 @@ function BottomSheet({
|
|
|
6277
6317
|
onClose,
|
|
6278
6318
|
onCloseEnd
|
|
6279
6319
|
}) {
|
|
6320
|
+
useVirtualKeyboard();
|
|
6280
6321
|
const {
|
|
6281
6322
|
refs,
|
|
6282
6323
|
context
|
|
@@ -6316,29 +6357,21 @@ function BottomSheet({
|
|
|
6316
6357
|
},
|
|
6317
6358
|
afterLeave: onCloseEnd,
|
|
6318
6359
|
children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6319
|
-
|
|
6320
|
-
enterFrom: "np-bottom-sheet-v2-backdrop
|
|
6321
|
-
|
|
6322
|
-
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6323
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6324
|
-
className: "np-bottom-sheet-v2-backdrop"
|
|
6325
|
-
})
|
|
6360
|
+
className: "np-bottom-sheet-v2-backdrop",
|
|
6361
|
+
enterFrom: "np-bottom-sheet-v2-backdrop--closed",
|
|
6362
|
+
leaveTo: "np-bottom-sheet-v2-backdrop--closed"
|
|
6326
6363
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6327
6364
|
className: "np-bottom-sheet-v2",
|
|
6328
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
|
|
6335
|
-
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6336
|
-
context: context,
|
|
6337
|
-
initialFocus: initialFocusRef,
|
|
6338
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6339
|
-
// Force inner state invalidation on open
|
|
6365
|
+
children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
|
|
6366
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6367
|
+
context: context,
|
|
6368
|
+
initialFocus: initialFocusRef,
|
|
6369
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React.Fragment, {
|
|
6370
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition.Child, {
|
|
6340
6371
|
ref: refs.setFloating,
|
|
6341
|
-
className: "np-bottom-sheet-v2-content
|
|
6372
|
+
className: "np-bottom-sheet-v2-content",
|
|
6373
|
+
enterFrom: "np-bottom-sheet-v2-content--closed",
|
|
6374
|
+
leaveTo: "np-bottom-sheet-v2-content--closed",
|
|
6342
6375
|
...getFloatingProps(),
|
|
6343
6376
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6344
6377
|
className: "np-bottom-sheet-v2-header",
|
|
@@ -6349,9 +6382,7 @@ function BottomSheet({
|
|
|
6349
6382
|
}
|
|
6350
6383
|
})
|
|
6351
6384
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6352
|
-
className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title',
|
|
6353
|
-
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6354
|
-
}),
|
|
6385
|
+
className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md'),
|
|
6355
6386
|
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6356
6387
|
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6357
6388
|
children: title
|
|
@@ -6360,8 +6391,8 @@ function BottomSheet({
|
|
|
6360
6391
|
children: children
|
|
6361
6392
|
})]
|
|
6362
6393
|
})]
|
|
6363
|
-
}
|
|
6364
|
-
})
|
|
6394
|
+
})
|
|
6395
|
+
}, floatingKey)
|
|
6365
6396
|
})
|
|
6366
6397
|
})
|
|
6367
6398
|
})]
|
|
@@ -6638,6 +6669,7 @@ function SelectInput({
|
|
|
6638
6669
|
disabled,
|
|
6639
6670
|
size = 'md',
|
|
6640
6671
|
className,
|
|
6672
|
+
UNSAFE_triggerButtonProps,
|
|
6641
6673
|
onFilterChange = noop,
|
|
6642
6674
|
onChange,
|
|
6643
6675
|
onClose,
|
|
@@ -6706,6 +6738,7 @@ function SelectInput({
|
|
|
6706
6738
|
triggerRef.current = node;
|
|
6707
6739
|
},
|
|
6708
6740
|
...inputAttributes,
|
|
6741
|
+
...UNSAFE_triggerButtonProps,
|
|
6709
6742
|
id,
|
|
6710
6743
|
...mergeProps__default.default({
|
|
6711
6744
|
onClick: () => {
|