@transferwise/components 0.0.0-experimental-5a9bfa5 → 0.0.0-experimental-0cfd3cc
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 +18 -1
- package/build/index.js.map +1 -1
- package/build/index.mjs +19 -2
- package/build/index.mjs.map +1 -1
- package/build/types/field/Field.d.ts +3 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/field/Field.story.tsx +16 -0
- package/src/field/Field.tsx +26 -1
- package/src/inlineAlert/InlineAlert.tsx +9 -3
package/build/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } 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,
|
|
5
|
+
import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, CheckCircleFill, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, ClockFill, Upload as Upload$2, AlertCircle, 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';
|
|
@@ -4854,7 +4854,10 @@ function InlineAlert({
|
|
|
4854
4854
|
role: "alert",
|
|
4855
4855
|
id: id,
|
|
4856
4856
|
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4857
|
-
children: [
|
|
4857
|
+
children: [type === 'positive' && /*#__PURE__*/jsx(CheckCircleFill, {}), type === 'warning' && /*#__PURE__*/jsx(StatusIcon, {
|
|
4858
|
+
sentiment: Sentiment.WARNING,
|
|
4859
|
+
size: Size.SMALL
|
|
4860
|
+
}), danger && /*#__PURE__*/jsx(CrossCircleFill, {}), /*#__PURE__*/jsx("div", {
|
|
4858
4861
|
children: children
|
|
4859
4862
|
})]
|
|
4860
4863
|
});
|
|
@@ -4878,10 +4881,14 @@ const Field = ({
|
|
|
4878
4881
|
id,
|
|
4879
4882
|
label,
|
|
4880
4883
|
hint,
|
|
4884
|
+
success,
|
|
4885
|
+
warning,
|
|
4881
4886
|
error,
|
|
4882
4887
|
className,
|
|
4883
4888
|
children
|
|
4884
4889
|
}) => {
|
|
4890
|
+
const hasSuccess = Boolean(success);
|
|
4891
|
+
const hasWarning = Boolean(warning);
|
|
4885
4892
|
const hasError = Boolean(error);
|
|
4886
4893
|
const hasHint = Boolean(hint) && !hasError;
|
|
4887
4894
|
const labelId = useId();
|
|
@@ -4898,6 +4905,8 @@ const Field = ({
|
|
|
4898
4905
|
value: hasError,
|
|
4899
4906
|
children: /*#__PURE__*/jsxs("div", {
|
|
4900
4907
|
className: classNames('form-group d-block', {
|
|
4908
|
+
'has-positive': hasSuccess,
|
|
4909
|
+
'has-warning': hasWarning,
|
|
4901
4910
|
'has-error': hasError,
|
|
4902
4911
|
'has-info': hasHint
|
|
4903
4912
|
}, className),
|
|
@@ -4909,6 +4918,14 @@ const Field = ({
|
|
|
4909
4918
|
type: Sentiment.NEUTRAL,
|
|
4910
4919
|
id: descriptionId,
|
|
4911
4920
|
children: hint
|
|
4921
|
+
}), hasSuccess && /*#__PURE__*/jsx(InlineAlert, {
|
|
4922
|
+
type: Sentiment.POSITIVE,
|
|
4923
|
+
id: descriptionId,
|
|
4924
|
+
children: success
|
|
4925
|
+
}), hasWarning && /*#__PURE__*/jsx(InlineAlert, {
|
|
4926
|
+
type: Sentiment.WARNING,
|
|
4927
|
+
id: descriptionId,
|
|
4928
|
+
children: warning
|
|
4912
4929
|
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
4913
4930
|
type: Sentiment.NEGATIVE,
|
|
4914
4931
|
id: descriptionId,
|