@transferwise/components 0.0.0-experimental-7709e0e → 0.0.0-experimental-f0d96b7

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 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', `status-circle-${size}`, sentiment),
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,20 +4866,14 @@ function InlineAlert({
4866
4866
  className,
4867
4867
  children
4868
4868
  }) {
4869
- return /*#__PURE__*/jsxRuntime.jsx("div", {
4869
+ const danger = type === 'negative' || type === 'error';
4870
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
4870
4871
  role: "alert",
4871
4872
  id: id,
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
- })
4873
+ className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
4874
+ children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
4875
+ children: children
4876
+ })]
4883
4877
  });
4884
4878
  }
4885
4879
 
@@ -4900,15 +4894,13 @@ const Label = ({
4900
4894
  const Field = ({
4901
4895
  id,
4902
4896
  label,
4903
- message: propMessage,
4904
- sentiment: propType,
4897
+ hint,
4898
+ error,
4905
4899
  className,
4906
- children,
4907
- ...props
4900
+ children
4908
4901
  }) => {
4909
- const sentiment = props.error ? exports.Sentiment.NEGATIVE : propType;
4910
- const message = props.error || props.hint || propMessage;
4911
- const hasError = sentiment === exports.Sentiment.NEGATIVE;
4902
+ const hasError = Boolean(error);
4903
+ const hasHint = Boolean(hint) && !hasError;
4912
4904
  const labelId = React.useId();
4913
4905
  const fallbackInputId = React.useId();
4914
4906
  const inputId = id !== null ? id ?? fallbackInputId : undefined;
@@ -4918,24 +4910,26 @@ const Field = ({
4918
4910
  children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
4919
4911
  value: inputId,
4920
4912
  children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
4921
- value: message ? descriptionId : undefined,
4913
+ value: hasError || hasHint ? descriptionId : undefined,
4922
4914
  children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
4923
4915
  value: hasError,
4924
4916
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
4925
4917
  className: classNames__default.default('form-group d-block', {
4926
- 'has-success': sentiment === exports.Sentiment.POSITIVE,
4927
- 'has-warning': sentiment === exports.Sentiment.WARNING,
4928
4918
  'has-error': hasError,
4929
- 'has-info': sentiment === exports.Sentiment.NEUTRAL
4919
+ 'has-info': hasHint
4930
4920
  }, className),
4931
4921
  children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
4932
4922
  id: labelId,
4933
4923
  htmlFor: inputId,
4934
4924
  children: [label, children]
4935
- }), message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4936
- type: sentiment,
4925
+ }), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4926
+ type: exports.Sentiment.NEUTRAL,
4937
4927
  id: descriptionId,
4938
- children: message
4928
+ children: hint
4929
+ }), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4930
+ type: exports.Sentiment.NEGATIVE,
4931
+ id: descriptionId,
4932
+ children: error
4939
4933
  })]
4940
4934
  })
4941
4935
  })
@@ -6319,29 +6313,21 @@ function BottomSheet({
6319
6313
  },
6320
6314
  afterLeave: onCloseEnd,
6321
6315
  children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
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
- })
6316
+ className: "np-bottom-sheet-v2-backdrop",
6317
+ enterFrom: "np-bottom-sheet-v2-backdrop--closed",
6318
+ leaveTo: "np-bottom-sheet-v2-backdrop--closed"
6329
6319
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
6330
6320
  className: "np-bottom-sheet-v2",
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
6321
+ children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
6322
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6323
+ context: context,
6324
+ initialFocus: initialFocusRef,
6325
+ children: /*#__PURE__*/jsxRuntime.jsx(React.Fragment, {
6326
+ children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition.Child, {
6343
6327
  ref: refs.setFloating,
6344
- className: "np-bottom-sheet-v2-content-inner-container",
6328
+ className: "np-bottom-sheet-v2-content",
6329
+ enterFrom: "np-bottom-sheet-v2-content--closed",
6330
+ leaveTo: "np-bottom-sheet-v2-content--closed",
6345
6331
  ...getFloatingProps(),
6346
6332
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6347
6333
  className: "np-bottom-sheet-v2-header",
@@ -6352,9 +6338,7 @@ function BottomSheet({
6352
6338
  }
6353
6339
  })
6354
6340
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
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
- }),
6341
+ className: classNames__default.default('np-bottom-sheet-v2-content-inner', padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md'),
6358
6342
  children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6359
6343
  className: "np-bottom-sheet-v2-title np-text-title-body",
6360
6344
  children: title
@@ -6363,8 +6347,8 @@ function BottomSheet({
6363
6347
  children: children
6364
6348
  })]
6365
6349
  })]
6366
- }, floatingKey)
6367
- })
6350
+ })
6351
+ }, floatingKey)
6368
6352
  })
6369
6353
  })
6370
6354
  })]