@transferwise/components 0.0.0-experimental-94569f6 → 0.0.0-experimental-5769182
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 +58 -41
- package/build/styles/inputs/SelectInput.css +54 -39
- package/build/styles/main.css +58 -41
- package/build/styles/statusIcon/StatusIcon.css +4 -2
- package/build/types/field/Field.d.ts +6 -1
- 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/field/Field.story.tsx +17 -36
- package/src/field/Field.tests.story.tsx +33 -0
- package/src/field/Field.tsx +23 -13
- package/src/inlineAlert/InlineAlert.story.tsx +13 -5
- package/src/inlineAlert/InlineAlert.tsx +14 -7
- package/src/inputs/SelectInput.css +54 -39
- package/src/inputs/_BottomSheet.less +52 -34
- package/src/inputs/_BottomSheet.tsx +28 -22
- package/src/main.css +58 -41
- package/src/statusIcon/StatusIcon.css +4 -2
- package/src/statusIcon/StatusIcon.less +4 -2
- package/src/statusIcon/StatusIcon.tsx +1 -1
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +0 -2
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +0 -1
- package/src/common/hooks/useVirtualKeyboard.ts +0 -16
package/build/index.js
CHANGED
|
@@ -746,7 +746,7 @@ const StatusIcon = ({
|
|
|
746
746
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
747
747
|
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
748
748
|
"data-testid": "status-icon",
|
|
749
|
-
className: classNames__default.default('status-circle',
|
|
749
|
+
className: classNames__default.default('status-circle', `status-circle-${size}`, sentiment),
|
|
750
750
|
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
751
751
|
className: classNames__default.default('status-icon', iconColor)
|
|
752
752
|
})
|
|
@@ -4866,14 +4866,20 @@ function InlineAlert({
|
|
|
4866
4866
|
className,
|
|
4867
4867
|
children
|
|
4868
4868
|
}) {
|
|
4869
|
-
|
|
4870
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4869
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4871
4870
|
role: "alert",
|
|
4872
4871
|
id: id,
|
|
4873
|
-
className: classNames__default.default('alert alert-detach', `alert-${
|
|
4874
|
-
children:
|
|
4875
|
-
|
|
4876
|
-
|
|
4872
|
+
className: classNames__default.default('alert alert-detach', `alert-${[exports.Sentiment.NEGATIVE, exports.Sentiment.ERROR].includes(type) ? 'danger' : type}`, className),
|
|
4873
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4874
|
+
className: "d-inline-flex",
|
|
4875
|
+
children: [type !== exports.Sentiment.NEUTRAL && type !== exports.Sentiment.PENDING && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
4876
|
+
sentiment: type,
|
|
4877
|
+
size: exports.Size.SMALL
|
|
4878
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4879
|
+
className: "np-text-body-default",
|
|
4880
|
+
children: children
|
|
4881
|
+
})]
|
|
4882
|
+
})
|
|
4877
4883
|
});
|
|
4878
4884
|
}
|
|
4879
4885
|
|
|
@@ -4894,13 +4900,15 @@ const Label = ({
|
|
|
4894
4900
|
const Field = ({
|
|
4895
4901
|
id,
|
|
4896
4902
|
label,
|
|
4897
|
-
|
|
4898
|
-
|
|
4903
|
+
message: propMessage,
|
|
4904
|
+
sentiment: propType,
|
|
4899
4905
|
className,
|
|
4900
|
-
children
|
|
4906
|
+
children,
|
|
4907
|
+
...props
|
|
4901
4908
|
}) => {
|
|
4902
|
-
const
|
|
4903
|
-
const
|
|
4909
|
+
const sentiment = props.error ? exports.Sentiment.NEGATIVE : propType;
|
|
4910
|
+
const message = props.error || props.hint || propMessage;
|
|
4911
|
+
const hasError = sentiment === exports.Sentiment.NEGATIVE;
|
|
4904
4912
|
const labelId = React.useId();
|
|
4905
4913
|
const fallbackInputId = React.useId();
|
|
4906
4914
|
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
@@ -4910,26 +4918,24 @@ const Field = ({
|
|
|
4910
4918
|
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
4911
4919
|
value: inputId,
|
|
4912
4920
|
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
4913
|
-
value:
|
|
4921
|
+
value: message ? descriptionId : undefined,
|
|
4914
4922
|
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
4915
4923
|
value: hasError,
|
|
4916
4924
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4917
4925
|
className: classNames__default.default('form-group d-block', {
|
|
4926
|
+
'has-success': sentiment === exports.Sentiment.POSITIVE,
|
|
4927
|
+
'has-warning': sentiment === exports.Sentiment.WARNING,
|
|
4918
4928
|
'has-error': hasError,
|
|
4919
|
-
'has-info':
|
|
4929
|
+
'has-info': sentiment === exports.Sentiment.NEUTRAL
|
|
4920
4930
|
}, className),
|
|
4921
4931
|
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
4922
4932
|
id: labelId,
|
|
4923
4933
|
htmlFor: inputId,
|
|
4924
4934
|
children: [label, children]
|
|
4925
|
-
}),
|
|
4926
|
-
type:
|
|
4935
|
+
}), message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
4936
|
+
type: sentiment,
|
|
4927
4937
|
id: descriptionId,
|
|
4928
|
-
children:
|
|
4929
|
-
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
4930
|
-
type: exports.Sentiment.NEGATIVE,
|
|
4931
|
-
id: descriptionId,
|
|
4932
|
-
children: error
|
|
4938
|
+
children: message
|
|
4933
4939
|
})]
|
|
4934
4940
|
})
|
|
4935
4941
|
})
|
|
@@ -6259,21 +6265,6 @@ const PolymorphicWithOverrides = /*#__PURE__*/React.forwardRef(function Polymorp
|
|
|
6259
6265
|
});
|
|
6260
6266
|
});
|
|
6261
6267
|
|
|
6262
|
-
function useVirtualKeyboard() {
|
|
6263
|
-
React.useEffect(() => {
|
|
6264
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6265
|
-
if ('virtualKeyboard' in navigator) {
|
|
6266
|
-
navigator.virtualKeyboard.overlaysContent = true;
|
|
6267
|
-
}
|
|
6268
|
-
return () => {
|
|
6269
|
-
if ('virtualKeyboard' in navigator) {
|
|
6270
|
-
navigator.virtualKeyboard.overlaysContent = false;
|
|
6271
|
-
}
|
|
6272
|
-
};
|
|
6273
|
-
/* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
|
|
6274
|
-
}, []);
|
|
6275
|
-
}
|
|
6276
|
-
|
|
6277
6268
|
function PreventScroll() {
|
|
6278
6269
|
overlays.usePreventScroll();
|
|
6279
6270
|
return null;
|
|
@@ -6289,7 +6280,6 @@ function BottomSheet({
|
|
|
6289
6280
|
onClose,
|
|
6290
6281
|
onCloseEnd
|
|
6291
6282
|
}) {
|
|
6292
|
-
useVirtualKeyboard();
|
|
6293
6283
|
const {
|
|
6294
6284
|
refs,
|
|
6295
6285
|
context
|
|
@@ -6329,21 +6319,29 @@ function BottomSheet({
|
|
|
6329
6319
|
},
|
|
6330
6320
|
afterLeave: onCloseEnd,
|
|
6331
6321
|
children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6332
|
-
|
|
6333
|
-
enterFrom: "np-bottom-sheet-v2-backdrop--
|
|
6334
|
-
|
|
6322
|
+
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
6323
|
+
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
6324
|
+
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
6325
|
+
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6326
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6327
|
+
className: "np-bottom-sheet-v2-backdrop"
|
|
6328
|
+
})
|
|
6335
6329
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6336
6330
|
className: "np-bottom-sheet-v2",
|
|
6337
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6331
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6332
|
+
className: "np-bottom-sheet-v2-content",
|
|
6333
|
+
enter: "np-bottom-sheet-v2-content--enter",
|
|
6334
|
+
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
6335
|
+
leave: "np-bottom-sheet-v2-content--leave",
|
|
6336
|
+
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
6337
|
+
children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
|
|
6338
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6339
|
+
context: context,
|
|
6340
|
+
initialFocus: initialFocusRef,
|
|
6341
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6342
|
+
// Force inner state invalidation on open
|
|
6343
6343
|
ref: refs.setFloating,
|
|
6344
|
-
className: "np-bottom-sheet-v2-content",
|
|
6345
|
-
enterFrom: "np-bottom-sheet-v2-content--closed",
|
|
6346
|
-
leaveTo: "np-bottom-sheet-v2-content--closed",
|
|
6344
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
6347
6345
|
...getFloatingProps(),
|
|
6348
6346
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6349
6347
|
className: "np-bottom-sheet-v2-header",
|
|
@@ -6354,7 +6352,9 @@ function BottomSheet({
|
|
|
6354
6352
|
}
|
|
6355
6353
|
})
|
|
6356
6354
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6357
|
-
className: classNames__default.default('np-bottom-sheet-v2-content-inner',
|
|
6355
|
+
className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6356
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6357
|
+
}),
|
|
6358
6358
|
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6359
6359
|
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6360
6360
|
children: title
|
|
@@ -6363,8 +6363,8 @@ function BottomSheet({
|
|
|
6363
6363
|
children: children
|
|
6364
6364
|
})]
|
|
6365
6365
|
})]
|
|
6366
|
-
})
|
|
6367
|
-
}
|
|
6366
|
+
}, floatingKey)
|
|
6367
|
+
})
|
|
6368
6368
|
})
|
|
6369
6369
|
})
|
|
6370
6370
|
})]
|