@transferwise/components 0.0.0-experimental-7709e0e → 0.0.0-experimental-94569f6
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 +52 -52
- package/build/index.js.map +1 -1
- package/build/index.mjs +54 -54
- package/build/index.mjs.map +1 -1
- package/build/main.css +41 -58
- package/build/styles/inputs/SelectInput.css +39 -54
- package/build/styles/main.css +41 -58
- package/build/styles/statusIcon/StatusIcon.css +2 -4
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +2 -0
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +1 -0
- package/build/types/field/Field.d.ts +1 -6
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -2
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common/hooks/useVirtualKeyboard.ts +16 -0
- package/src/field/Field.story.tsx +36 -17
- package/src/field/Field.tsx +13 -23
- package/src/inlineAlert/InlineAlert.story.tsx +5 -13
- package/src/inlineAlert/InlineAlert.tsx +7 -14
- package/src/inputs/SelectInput.css +39 -54
- package/src/inputs/_BottomSheet.less +34 -52
- package/src/inputs/_BottomSheet.tsx +22 -28
- package/src/main.css +41 -58
- package/src/statusIcon/StatusIcon.css +2 -4
- package/src/statusIcon/StatusIcon.less +2 -4
- package/src/statusIcon/StatusIcon.tsx +1 -1
- package/src/field/Field.tests.story.tsx +0 -33
package/build/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement,
|
|
2
|
+
import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Fragment as Fragment$1, Children } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, Bin } from '@transferwise/icons';
|
|
5
|
+
import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, AlertCircle, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, Bin } from '@transferwise/icons';
|
|
6
6
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
7
7
|
import commonmark from 'commonmark';
|
|
8
8
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
@@ -717,7 +717,7 @@ const StatusIcon = ({
|
|
|
717
717
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
718
718
|
return /*#__PURE__*/jsx("span", {
|
|
719
719
|
"data-testid": "status-icon",
|
|
720
|
-
className: classNames('status-circle',
|
|
720
|
+
className: classNames('status-circle', 'status-circle-' + size, sentiment),
|
|
721
721
|
children: /*#__PURE__*/jsx(Icon, {
|
|
722
722
|
className: classNames('status-icon', iconColor)
|
|
723
723
|
})
|
|
@@ -4837,20 +4837,14 @@ function InlineAlert({
|
|
|
4837
4837
|
className,
|
|
4838
4838
|
children
|
|
4839
4839
|
}) {
|
|
4840
|
-
|
|
4840
|
+
const danger = type === 'negative' || type === 'error';
|
|
4841
|
+
return /*#__PURE__*/jsxs("div", {
|
|
4841
4842
|
role: "alert",
|
|
4842
4843
|
id: id,
|
|
4843
|
-
className: classNames('alert alert-detach', `alert-${
|
|
4844
|
-
children: /*#__PURE__*/
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
sentiment: type,
|
|
4848
|
-
size: Size.SMALL
|
|
4849
|
-
}), /*#__PURE__*/jsx("div", {
|
|
4850
|
-
className: "np-text-body-default",
|
|
4851
|
-
children: children
|
|
4852
|
-
})]
|
|
4853
|
-
})
|
|
4844
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4845
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
4846
|
+
children: children
|
|
4847
|
+
})]
|
|
4854
4848
|
});
|
|
4855
4849
|
}
|
|
4856
4850
|
|
|
@@ -4871,15 +4865,13 @@ const Label = ({
|
|
|
4871
4865
|
const Field = ({
|
|
4872
4866
|
id,
|
|
4873
4867
|
label,
|
|
4874
|
-
|
|
4875
|
-
|
|
4868
|
+
hint,
|
|
4869
|
+
error,
|
|
4876
4870
|
className,
|
|
4877
|
-
children
|
|
4878
|
-
...props
|
|
4871
|
+
children
|
|
4879
4872
|
}) => {
|
|
4880
|
-
const
|
|
4881
|
-
const
|
|
4882
|
-
const hasError = sentiment === Sentiment.NEGATIVE;
|
|
4873
|
+
const hasError = Boolean(error);
|
|
4874
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
4883
4875
|
const labelId = useId();
|
|
4884
4876
|
const fallbackInputId = useId();
|
|
4885
4877
|
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
@@ -4889,24 +4881,26 @@ const Field = ({
|
|
|
4889
4881
|
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
4890
4882
|
value: inputId,
|
|
4891
4883
|
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
4892
|
-
value:
|
|
4884
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
4893
4885
|
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
4894
4886
|
value: hasError,
|
|
4895
4887
|
children: /*#__PURE__*/jsxs("div", {
|
|
4896
4888
|
className: classNames('form-group d-block', {
|
|
4897
|
-
'has-success': sentiment === Sentiment.POSITIVE,
|
|
4898
|
-
'has-warning': sentiment === Sentiment.WARNING,
|
|
4899
4889
|
'has-error': hasError,
|
|
4900
|
-
'has-info':
|
|
4890
|
+
'has-info': hasHint
|
|
4901
4891
|
}, className),
|
|
4902
4892
|
children: [/*#__PURE__*/jsxs(Label, {
|
|
4903
4893
|
id: labelId,
|
|
4904
4894
|
htmlFor: inputId,
|
|
4905
4895
|
children: [label, children]
|
|
4906
|
-
}),
|
|
4907
|
-
type:
|
|
4896
|
+
}), hasHint && /*#__PURE__*/jsx(InlineAlert, {
|
|
4897
|
+
type: Sentiment.NEUTRAL,
|
|
4908
4898
|
id: descriptionId,
|
|
4909
|
-
children:
|
|
4899
|
+
children: hint
|
|
4900
|
+
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
4901
|
+
type: Sentiment.NEGATIVE,
|
|
4902
|
+
id: descriptionId,
|
|
4903
|
+
children: error
|
|
4910
4904
|
})]
|
|
4911
4905
|
})
|
|
4912
4906
|
})
|
|
@@ -6236,6 +6230,21 @@ const PolymorphicWithOverrides = /*#__PURE__*/forwardRef(function PolymorphicWit
|
|
|
6236
6230
|
});
|
|
6237
6231
|
});
|
|
6238
6232
|
|
|
6233
|
+
function useVirtualKeyboard() {
|
|
6234
|
+
useEffect(() => {
|
|
6235
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6236
|
+
if ('virtualKeyboard' in navigator) {
|
|
6237
|
+
navigator.virtualKeyboard.overlaysContent = true;
|
|
6238
|
+
}
|
|
6239
|
+
return () => {
|
|
6240
|
+
if ('virtualKeyboard' in navigator) {
|
|
6241
|
+
navigator.virtualKeyboard.overlaysContent = false;
|
|
6242
|
+
}
|
|
6243
|
+
};
|
|
6244
|
+
/* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6245
|
+
}, []);
|
|
6246
|
+
}
|
|
6247
|
+
|
|
6239
6248
|
function PreventScroll() {
|
|
6240
6249
|
usePreventScroll();
|
|
6241
6250
|
return null;
|
|
@@ -6251,6 +6260,7 @@ function BottomSheet({
|
|
|
6251
6260
|
onClose,
|
|
6252
6261
|
onCloseEnd
|
|
6253
6262
|
}) {
|
|
6263
|
+
useVirtualKeyboard();
|
|
6254
6264
|
const {
|
|
6255
6265
|
refs,
|
|
6256
6266
|
context
|
|
@@ -6290,29 +6300,21 @@ function BottomSheet({
|
|
|
6290
6300
|
},
|
|
6291
6301
|
afterLeave: onCloseEnd,
|
|
6292
6302
|
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
6293
|
-
|
|
6294
|
-
enterFrom: "np-bottom-sheet-v2-backdrop
|
|
6295
|
-
|
|
6296
|
-
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6297
|
-
children: /*#__PURE__*/jsx("div", {
|
|
6298
|
-
className: "np-bottom-sheet-v2-backdrop"
|
|
6299
|
-
})
|
|
6303
|
+
className: "np-bottom-sheet-v2-backdrop",
|
|
6304
|
+
enterFrom: "np-bottom-sheet-v2-backdrop--closed",
|
|
6305
|
+
leaveTo: "np-bottom-sheet-v2-backdrop--closed"
|
|
6300
6306
|
}), /*#__PURE__*/jsx("div", {
|
|
6301
6307
|
className: "np-bottom-sheet-v2",
|
|
6302
|
-
children: /*#__PURE__*/jsx(
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
children: /*#__PURE__*/jsx(FocusScope, {
|
|
6309
|
-
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6310
|
-
context: context,
|
|
6311
|
-
initialFocus: initialFocusRef,
|
|
6312
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
6313
|
-
// Force inner state invalidation on open
|
|
6308
|
+
children: /*#__PURE__*/jsx(FocusScope, {
|
|
6309
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6310
|
+
context: context,
|
|
6311
|
+
initialFocus: initialFocusRef,
|
|
6312
|
+
children: /*#__PURE__*/jsx(Fragment$1, {
|
|
6313
|
+
children: /*#__PURE__*/jsxs(Transition.Child, {
|
|
6314
6314
|
ref: refs.setFloating,
|
|
6315
|
-
className: "np-bottom-sheet-v2-content
|
|
6315
|
+
className: "np-bottom-sheet-v2-content",
|
|
6316
|
+
enterFrom: "np-bottom-sheet-v2-content--closed",
|
|
6317
|
+
leaveTo: "np-bottom-sheet-v2-content--closed",
|
|
6316
6318
|
...getFloatingProps(),
|
|
6317
6319
|
children: [/*#__PURE__*/jsx("div", {
|
|
6318
6320
|
className: "np-bottom-sheet-v2-header",
|
|
@@ -6323,9 +6325,7 @@ function BottomSheet({
|
|
|
6323
6325
|
}
|
|
6324
6326
|
})
|
|
6325
6327
|
}), /*#__PURE__*/jsxs("div", {
|
|
6326
|
-
className: classNames('np-bottom-sheet-v2-content-inner',
|
|
6327
|
-
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6328
|
-
}),
|
|
6328
|
+
className: classNames('np-bottom-sheet-v2-content-inner', padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md'),
|
|
6329
6329
|
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6330
6330
|
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6331
6331
|
children: title
|
|
@@ -6334,8 +6334,8 @@ function BottomSheet({
|
|
|
6334
6334
|
children: children
|
|
6335
6335
|
})]
|
|
6336
6336
|
})]
|
|
6337
|
-
}
|
|
6338
|
-
})
|
|
6337
|
+
})
|
|
6338
|
+
}, floatingKey)
|
|
6339
6339
|
})
|
|
6340
6340
|
})
|
|
6341
6341
|
})]
|