@transferwise/components 46.34.0 → 46.35.1
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 +170 -193
- package/build/index.js.map +1 -1
- package/build/index.mjs +162 -185
- package/build/index.mjs.map +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/common/hooks/useMedia.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts +1 -11
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +4 -4
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +36 -19
- package/build/types/processIndicator/ProcessIndicator.d.ts.map +1 -1
- package/build/types/processIndicator/index.d.ts +2 -2
- package/build/types/processIndicator/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +1 -1
- package/build/types/snackbar/Snackbar.d.ts +0 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/test-utils/wait.d.ts +2 -0
- package/build/types/test-utils/wait.d.ts.map +1 -0
- package/build/types/tooltip/Tooltip.d.ts +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/package.json +10 -14
- package/src/accordion/AccordionItem/AccordionItem.tsx +2 -4
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -3
- package/src/button/Button.tsx +1 -1
- package/src/common/hooks/useConditionalListener/useConditionalListener.spec.js +1 -1
- package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +3 -3
- package/src/common/hooks/useMedia.spec.ts +1 -1
- package/src/common/hooks/useMedia.ts +1 -2
- package/src/common/panel/Panel.tsx +90 -92
- package/src/common/responsivePanel/ResponsivePanel.tsx +34 -38
- package/src/dateLookup/DateLookup.rtl.spec.tsx +181 -5
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +171 -124
- package/src/drawer/Drawer.js +3 -3
- package/src/field/Field.tsx +3 -3
- package/src/index.ts +3 -2
- package/src/inputs/SelectInput.story.tsx +3 -2
- package/src/inputs/SelectInput.tsx +10 -2
- package/src/modal/Modal.tsx +1 -2
- package/src/processIndicator/ProcessIndicator.rtl.spec.tsx +45 -0
- package/src/processIndicator/ProcessIndicator.tsx +110 -0
- package/src/promoCard/PromoCard.tsx +1 -2
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +0 -1
- package/src/select/Select.js +1 -2
- package/src/snackbar/Snackbar.spec.js +8 -2
- package/src/snackbar/Snackbar.story.tsx +3 -1
- package/src/snackbar/Snackbar.tsx +1 -1
- package/src/tabs/Tabs.spec.js +46 -27
- package/src/test-utils/index.js +5 -7
- package/src/test-utils/jest.setup.js +9 -3
- package/src/test-utils/wait.ts +7 -0
- package/src/tooltip/Tooltip.tsx +44 -46
- package/src/tooltip/__snapshots__/Tooltip.spec.tsx.snap +2 -2
- package/src/upload/Upload.spec.js +34 -13
- package/src/uploadInput/UploadInput.spec.tsx +21 -23
- package/src/uploadInput/uploadItem/UploadItem.tsx +1 -3
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +63 -32
- package/src/withDisplayFormat/WithDisplayFormat.tsx +4 -6
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +0 -180
- package/src/processIndicator/ProcessIndicator.js +0 -117
- package/src/processIndicator/ProcessIndicator.spec.js +0 -101
- /package/src/processIndicator/{index.js → index.ts} +0 -0
package/build/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
3
|
-
import { useId } from '@radix-ui/react-id';
|
|
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';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill,
|
|
5
|
+
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, AlertCircle, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
|
|
7
6
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
8
|
import commonmark from 'commonmark';
|
|
@@ -11,7 +10,6 @@ import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
|
11
10
|
import { CSSTransition } from 'react-transition-group';
|
|
12
11
|
import { FocusScope } from '@react-aria/focus';
|
|
13
12
|
import { createPortal } from 'react-dom';
|
|
14
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
|
|
15
13
|
import { isUndefined, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
16
14
|
import { formatDate, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
17
15
|
import { Transition, Listbox } from '@headlessui/react';
|
|
@@ -1251,68 +1249,67 @@ const radius = {
|
|
|
1251
1249
|
};
|
|
1252
1250
|
const ANIMATION_DURATION_IN_MS = 1500;
|
|
1253
1251
|
class ProcessIndicator extends Component {
|
|
1252
|
+
static defaultProps = {
|
|
1253
|
+
status: 'processing',
|
|
1254
|
+
size: 'sm'
|
|
1255
|
+
};
|
|
1256
|
+
interval = 0;
|
|
1257
|
+
timeout = 0;
|
|
1254
1258
|
constructor(props) {
|
|
1255
1259
|
super(props);
|
|
1256
1260
|
this.state = {
|
|
1257
1261
|
status: props.status,
|
|
1258
1262
|
size: props.size
|
|
1259
1263
|
};
|
|
1260
|
-
this.interval = null;
|
|
1261
|
-
this.timeout = null;
|
|
1262
1264
|
}
|
|
1263
|
-
|
|
1264
1265
|
/**
|
|
1265
1266
|
* Create interval for animation duration (1500ms)
|
|
1266
1267
|
* Update state only at the end of every interval
|
|
1267
1268
|
* (end of animation loop) if props changed before end of animation
|
|
1268
1269
|
*/
|
|
1269
1270
|
componentDidMount() {
|
|
1270
|
-
this.interval = setInterval(() => {
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1271
|
+
this.interval = window.setInterval(() => {
|
|
1272
|
+
const {
|
|
1273
|
+
status: targetStatus,
|
|
1274
|
+
size: targetSize,
|
|
1275
|
+
onAnimationCompleted
|
|
1276
|
+
} = this.props;
|
|
1277
|
+
const {
|
|
1278
|
+
status: currentStatus,
|
|
1279
|
+
size: currentSize
|
|
1280
|
+
} = this.state;
|
|
1281
|
+
if (currentStatus !== targetStatus) {
|
|
1276
1282
|
this.setState({
|
|
1277
|
-
status:
|
|
1278
|
-
},
|
|
1283
|
+
status: targetStatus
|
|
1284
|
+
}, () => {
|
|
1285
|
+
if (onAnimationCompleted) {
|
|
1286
|
+
this.timeout = window.setTimeout(() => {
|
|
1287
|
+
onAnimationCompleted(targetStatus);
|
|
1288
|
+
}, ANIMATION_DURATION_IN_MS);
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1279
1291
|
}
|
|
1280
|
-
if (
|
|
1292
|
+
if (currentSize !== targetSize) {
|
|
1281
1293
|
this.setState({
|
|
1282
|
-
size:
|
|
1294
|
+
size: targetSize
|
|
1283
1295
|
});
|
|
1284
1296
|
}
|
|
1285
1297
|
}, ANIMATION_DURATION_IN_MS);
|
|
1286
1298
|
}
|
|
1287
|
-
|
|
1288
1299
|
/**
|
|
1289
1300
|
* Only trigger render if comopnent's state got
|
|
1290
1301
|
* updated from interval callback
|
|
1291
|
-
*
|
|
1292
|
-
* @param nextProps
|
|
1293
|
-
* @param nextState
|
|
1294
1302
|
*/
|
|
1295
1303
|
shouldComponentUpdate(nextProps, nextState) {
|
|
1296
1304
|
const isSameStatus = nextProps.status === nextState.status;
|
|
1297
1305
|
const isSameSize = nextProps.size === nextState.size;
|
|
1298
1306
|
return isSameStatus && isSameSize;
|
|
1299
1307
|
}
|
|
1300
|
-
|
|
1301
1308
|
// Clear interval before destroying component
|
|
1302
1309
|
componentWillUnmount() {
|
|
1303
|
-
clearInterval(this.interval);
|
|
1304
|
-
clearTimeout(this.timeout);
|
|
1310
|
+
window.clearInterval(this.interval);
|
|
1311
|
+
window.clearTimeout(this.timeout);
|
|
1305
1312
|
}
|
|
1306
|
-
runCallBack = statusFromProps => {
|
|
1307
|
-
const {
|
|
1308
|
-
onAnimationCompleted
|
|
1309
|
-
} = this.props;
|
|
1310
|
-
if (onAnimationCompleted) {
|
|
1311
|
-
this.timeouts = setTimeout(() => {
|
|
1312
|
-
onAnimationCompleted(statusFromProps);
|
|
1313
|
-
}, ANIMATION_DURATION_IN_MS);
|
|
1314
|
-
}
|
|
1315
|
-
};
|
|
1316
1313
|
render() {
|
|
1317
1314
|
const {
|
|
1318
1315
|
className,
|
|
@@ -1343,28 +1340,13 @@ class ProcessIndicator extends Component {
|
|
|
1343
1340
|
className: "process-circle",
|
|
1344
1341
|
cx: "50%",
|
|
1345
1342
|
cy: "50%",
|
|
1346
|
-
r: radius[
|
|
1343
|
+
r: radius[size],
|
|
1347
1344
|
fillOpacity: "0.0"
|
|
1348
1345
|
})
|
|
1349
1346
|
})]
|
|
1350
1347
|
});
|
|
1351
1348
|
}
|
|
1352
1349
|
}
|
|
1353
|
-
ProcessIndicator.propTypes = {
|
|
1354
|
-
status: PropTypes.oneOf(['processing', 'failed', 'succeeded', 'hidden']),
|
|
1355
|
-
size: PropTypes.oneOf(['xxs', 'xs', 'sm', 'xl']),
|
|
1356
|
-
onAnimationCompleted: PropTypes.func,
|
|
1357
|
-
className: PropTypes.string,
|
|
1358
|
-
'data-testid': PropTypes.string
|
|
1359
|
-
};
|
|
1360
|
-
ProcessIndicator.defaultProps = {
|
|
1361
|
-
status: Status.PROCESSING,
|
|
1362
|
-
size: Size.SMALL,
|
|
1363
|
-
onAnimationCompleted: null,
|
|
1364
|
-
className: undefined,
|
|
1365
|
-
'data-testid': null
|
|
1366
|
-
};
|
|
1367
|
-
var ProcessIndicator$1 = ProcessIndicator;
|
|
1368
1350
|
|
|
1369
1351
|
var messages$b = defineMessages({
|
|
1370
1352
|
loadingAriaLabel: {
|
|
@@ -1486,7 +1468,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
1486
1468
|
...props,
|
|
1487
1469
|
"aria-live": loading ? 'polite' : 'off',
|
|
1488
1470
|
"aria-label": loading ? intl.formatMessage(messages$b.loadingAriaLabel) : rest['aria-label'],
|
|
1489
|
-
children: [children, loading && /*#__PURE__*/jsx(ProcessIndicator
|
|
1471
|
+
children: [children, loading && /*#__PURE__*/jsx(ProcessIndicator, {
|
|
1490
1472
|
size: processIndicatorSize(),
|
|
1491
1473
|
className: "btn-loader"
|
|
1492
1474
|
})]
|
|
@@ -1637,7 +1619,6 @@ const useHasIntersected = ({
|
|
|
1637
1619
|
return [hasIntersected];
|
|
1638
1620
|
};
|
|
1639
1621
|
|
|
1640
|
-
// eslint-disable-next-line import/extensions
|
|
1641
1622
|
function useMedia(query) {
|
|
1642
1623
|
return useSyncExternalStore(onStoreChange => {
|
|
1643
1624
|
const mediaQueryList = window.matchMedia(query);
|
|
@@ -2849,12 +2830,12 @@ Drawer.propTypes = {
|
|
|
2849
2830
|
footerContent: PropTypes.node,
|
|
2850
2831
|
/** The content to appear in the drawer header. */
|
|
2851
2832
|
headerTitle: PropTypes.node,
|
|
2852
|
-
/** The action to perform on close click. */
|
|
2853
|
-
onClose: PropTypes.func,
|
|
2854
2833
|
/** The status of Drawer either open or not. */
|
|
2855
2834
|
open: PropTypes.bool,
|
|
2856
2835
|
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
2857
|
-
position: PropTypes.oneOf(['left', 'right', 'bottom'])
|
|
2836
|
+
position: PropTypes.oneOf(['left', 'right', 'bottom']),
|
|
2837
|
+
/** The action to perform on close click. */
|
|
2838
|
+
onClose: PropTypes.func
|
|
2858
2839
|
};
|
|
2859
2840
|
Drawer.defaultProps = {
|
|
2860
2841
|
children: null,
|
|
@@ -3529,7 +3510,7 @@ const fallbackPlacements = {
|
|
|
3529
3510
|
[Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],
|
|
3530
3511
|
[Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM]
|
|
3531
3512
|
};
|
|
3532
|
-
const Panel = /*#__PURE__*/forwardRef(({
|
|
3513
|
+
const Panel = /*#__PURE__*/forwardRef(function Panel({
|
|
3533
3514
|
arrow = false,
|
|
3534
3515
|
flip = true,
|
|
3535
3516
|
altAxis = false,
|
|
@@ -3540,7 +3521,7 @@ const Panel = /*#__PURE__*/forwardRef(({
|
|
|
3540
3521
|
anchorRef,
|
|
3541
3522
|
anchorWidth = false,
|
|
3542
3523
|
...rest
|
|
3543
|
-
}, reference)
|
|
3524
|
+
}, reference) {
|
|
3544
3525
|
const [arrowElement, setArrowElement] = useState(null);
|
|
3545
3526
|
const [popperElement, setPopperElement] = useState(null);
|
|
3546
3527
|
const modifiers = [];
|
|
@@ -3618,7 +3599,7 @@ const Panel = /*#__PURE__*/forwardRef(({
|
|
|
3618
3599
|
...attributes.popper,
|
|
3619
3600
|
className: classNames('np-panel', {
|
|
3620
3601
|
'np-panel--open': open
|
|
3621
|
-
}, rest
|
|
3602
|
+
}, rest.className),
|
|
3622
3603
|
children: /*#__PURE__*/jsxs("div", {
|
|
3623
3604
|
ref: reference
|
|
3624
3605
|
/* eslint-disable-next-line react/forbid-dom-props */,
|
|
@@ -3637,7 +3618,7 @@ const Panel = /*#__PURE__*/forwardRef(({
|
|
|
3637
3618
|
});
|
|
3638
3619
|
var Panel$1 = Panel;
|
|
3639
3620
|
|
|
3640
|
-
const ResponsivePanel = /*#__PURE__*/forwardRef(({
|
|
3621
|
+
const ResponsivePanel = /*#__PURE__*/forwardRef(function ResponsivePanel({
|
|
3641
3622
|
anchorRef,
|
|
3642
3623
|
arrow = false,
|
|
3643
3624
|
flip = true,
|
|
@@ -3646,7 +3627,7 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(({
|
|
|
3646
3627
|
onClose,
|
|
3647
3628
|
open = false,
|
|
3648
3629
|
position = Position.BOTTOM
|
|
3649
|
-
}, reference)
|
|
3630
|
+
}, reference) {
|
|
3650
3631
|
const {
|
|
3651
3632
|
isMobile
|
|
3652
3633
|
} = useLayout();
|
|
@@ -4985,6 +4966,84 @@ const Emphasis = ({
|
|
|
4985
4966
|
}) : null;
|
|
4986
4967
|
};
|
|
4987
4968
|
|
|
4969
|
+
function InlineAlert({
|
|
4970
|
+
id,
|
|
4971
|
+
type = 'neutral',
|
|
4972
|
+
className,
|
|
4973
|
+
children
|
|
4974
|
+
}) {
|
|
4975
|
+
const danger = type === 'negative' || type === 'error';
|
|
4976
|
+
return /*#__PURE__*/jsxs("div", {
|
|
4977
|
+
role: "alert",
|
|
4978
|
+
id: id,
|
|
4979
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4980
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
4981
|
+
children: children
|
|
4982
|
+
})]
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4986
|
+
const Label = ({
|
|
4987
|
+
id,
|
|
4988
|
+
htmlFor,
|
|
4989
|
+
className,
|
|
4990
|
+
children
|
|
4991
|
+
}) => {
|
|
4992
|
+
return /*#__PURE__*/jsx("label", {
|
|
4993
|
+
id: id,
|
|
4994
|
+
htmlFor: htmlFor,
|
|
4995
|
+
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4996
|
+
children: children
|
|
4997
|
+
});
|
|
4998
|
+
};
|
|
4999
|
+
|
|
5000
|
+
const Field = ({
|
|
5001
|
+
id,
|
|
5002
|
+
label,
|
|
5003
|
+
hint,
|
|
5004
|
+
error,
|
|
5005
|
+
className,
|
|
5006
|
+
children
|
|
5007
|
+
}) => {
|
|
5008
|
+
const hasError = Boolean(error);
|
|
5009
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
5010
|
+
const labelId = useId();
|
|
5011
|
+
const fallbackInputId = useId();
|
|
5012
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
5013
|
+
const descriptionId = useId();
|
|
5014
|
+
return /*#__PURE__*/jsx(FieldLabelIdContextProvider, {
|
|
5015
|
+
value: labelId,
|
|
5016
|
+
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
5017
|
+
value: inputId,
|
|
5018
|
+
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
5019
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
5020
|
+
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
5021
|
+
value: hasError,
|
|
5022
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5023
|
+
className: classNames('form-group d-block', {
|
|
5024
|
+
'has-error': hasError,
|
|
5025
|
+
'has-info': hasHint
|
|
5026
|
+
}, className),
|
|
5027
|
+
children: [/*#__PURE__*/jsxs(Label, {
|
|
5028
|
+
id: labelId,
|
|
5029
|
+
htmlFor: inputId,
|
|
5030
|
+
children: [label, children]
|
|
5031
|
+
}), hasHint && /*#__PURE__*/jsx(InlineAlert, {
|
|
5032
|
+
type: Sentiment.NEUTRAL,
|
|
5033
|
+
id: descriptionId,
|
|
5034
|
+
children: hint
|
|
5035
|
+
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
5036
|
+
type: Sentiment.NEGATIVE,
|
|
5037
|
+
id: descriptionId,
|
|
5038
|
+
children: error
|
|
5039
|
+
})]
|
|
5040
|
+
})
|
|
5041
|
+
})
|
|
5042
|
+
})
|
|
5043
|
+
})
|
|
5044
|
+
});
|
|
5045
|
+
};
|
|
5046
|
+
|
|
4988
5047
|
const FlowHeader = /*#__PURE__*/React.forwardRef(({
|
|
4989
5048
|
bottomContent,
|
|
4990
5049
|
className,
|
|
@@ -5231,42 +5290,40 @@ const Tooltip = ({
|
|
|
5231
5290
|
forceUpdate();
|
|
5232
5291
|
}
|
|
5233
5292
|
}, [open]);
|
|
5234
|
-
return /*#__PURE__*/
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
})]
|
|
5269
|
-
})
|
|
5293
|
+
return /*#__PURE__*/jsxs("span", {
|
|
5294
|
+
ref: anchorReference,
|
|
5295
|
+
className: "tw-tooltip-container",
|
|
5296
|
+
onMouseOver: () => setOpen(true),
|
|
5297
|
+
onFocus: () => setOpen(true),
|
|
5298
|
+
onMouseOut: () => setOpen(false),
|
|
5299
|
+
onBlur: () => setOpen(false),
|
|
5300
|
+
children: [children ? /*#__PURE__*/cloneElement(children, {
|
|
5301
|
+
'aria-describedby': `${tooltipId}-tooltip`
|
|
5302
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
5303
|
+
// @ts-expect-error
|
|
5304
|
+
ref: setPopperElement,
|
|
5305
|
+
className: classNames('np-tooltip', 'np-panel', open ? `np-panel--open np-tooltip--open` : null, className)
|
|
5306
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5307
|
+
,
|
|
5308
|
+
style: {
|
|
5309
|
+
...styles.popper
|
|
5310
|
+
},
|
|
5311
|
+
...attributes.popper,
|
|
5312
|
+
"aria-hidden": !open,
|
|
5313
|
+
role: "tooltip",
|
|
5314
|
+
id: `${tooltipId}-tooltip`,
|
|
5315
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5316
|
+
className: "np-panel__content tooltip-inner",
|
|
5317
|
+
children: [label, /*#__PURE__*/jsx("div", {
|
|
5318
|
+
// @ts-expect-error
|
|
5319
|
+
ref: setArrowElement,
|
|
5320
|
+
className: classNames('np-panel__arrow')
|
|
5321
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5322
|
+
,
|
|
5323
|
+
style: styles.arrow
|
|
5324
|
+
})]
|
|
5325
|
+
})
|
|
5326
|
+
})]
|
|
5270
5327
|
});
|
|
5271
5328
|
};
|
|
5272
5329
|
|
|
@@ -5464,84 +5521,6 @@ const FlowNavigation = ({
|
|
|
5464
5521
|
});
|
|
5465
5522
|
};
|
|
5466
5523
|
|
|
5467
|
-
function InlineAlert({
|
|
5468
|
-
id,
|
|
5469
|
-
type = 'neutral',
|
|
5470
|
-
className,
|
|
5471
|
-
children
|
|
5472
|
-
}) {
|
|
5473
|
-
const danger = type === 'negative' || type === 'error';
|
|
5474
|
-
return /*#__PURE__*/jsxs("div", {
|
|
5475
|
-
role: "alert",
|
|
5476
|
-
id: id,
|
|
5477
|
-
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5478
|
-
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
5479
|
-
children: children
|
|
5480
|
-
})]
|
|
5481
|
-
});
|
|
5482
|
-
}
|
|
5483
|
-
|
|
5484
|
-
const Label = ({
|
|
5485
|
-
id,
|
|
5486
|
-
htmlFor,
|
|
5487
|
-
className,
|
|
5488
|
-
children
|
|
5489
|
-
}) => {
|
|
5490
|
-
return /*#__PURE__*/jsx("label", {
|
|
5491
|
-
id: id,
|
|
5492
|
-
htmlFor: htmlFor,
|
|
5493
|
-
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
5494
|
-
children: children
|
|
5495
|
-
});
|
|
5496
|
-
};
|
|
5497
|
-
|
|
5498
|
-
const Field = ({
|
|
5499
|
-
id,
|
|
5500
|
-
label,
|
|
5501
|
-
hint,
|
|
5502
|
-
error,
|
|
5503
|
-
className,
|
|
5504
|
-
children
|
|
5505
|
-
}) => {
|
|
5506
|
-
const hasError = Boolean(error);
|
|
5507
|
-
const hasHint = Boolean(hint) && !hasError;
|
|
5508
|
-
const labelId = useId();
|
|
5509
|
-
const fallbackInputId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
5510
|
-
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
5511
|
-
const descriptionId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
5512
|
-
return /*#__PURE__*/jsx(FieldLabelIdContextProvider, {
|
|
5513
|
-
value: labelId,
|
|
5514
|
-
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
5515
|
-
value: inputId,
|
|
5516
|
-
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
5517
|
-
value: hasError || hasHint ? descriptionId : undefined,
|
|
5518
|
-
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
5519
|
-
value: hasError,
|
|
5520
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
5521
|
-
className: classNames('form-group d-block', {
|
|
5522
|
-
'has-error': hasError,
|
|
5523
|
-
'has-info': hasHint
|
|
5524
|
-
}, className),
|
|
5525
|
-
children: [/*#__PURE__*/jsxs(Label, {
|
|
5526
|
-
id: labelId,
|
|
5527
|
-
htmlFor: inputId,
|
|
5528
|
-
children: [label, children]
|
|
5529
|
-
}), hasHint && /*#__PURE__*/jsx(InlineAlert, {
|
|
5530
|
-
type: Sentiment.NEUTRAL,
|
|
5531
|
-
id: descriptionId,
|
|
5532
|
-
children: hint
|
|
5533
|
-
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
5534
|
-
type: Sentiment.NEGATIVE,
|
|
5535
|
-
id: descriptionId,
|
|
5536
|
-
children: error
|
|
5537
|
-
})]
|
|
5538
|
-
})
|
|
5539
|
-
})
|
|
5540
|
-
})
|
|
5541
|
-
})
|
|
5542
|
-
});
|
|
5543
|
-
};
|
|
5544
|
-
|
|
5545
5524
|
const HeaderAction = ({
|
|
5546
5525
|
action
|
|
5547
5526
|
}) => {
|
|
@@ -6151,10 +6130,9 @@ class WithDisplayFormat extends Component {
|
|
|
6151
6130
|
return 'Backspace';
|
|
6152
6131
|
}
|
|
6153
6132
|
return triggerEvent.key;
|
|
6154
|
-
} else {
|
|
6155
|
-
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
6156
|
-
return 'Paste';
|
|
6157
6133
|
}
|
|
6134
|
+
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
6135
|
+
return 'Paste';
|
|
6158
6136
|
};
|
|
6159
6137
|
resetEvent = () => {
|
|
6160
6138
|
this.setState({
|
|
@@ -6307,11 +6285,10 @@ class WithDisplayFormat extends Component {
|
|
|
6307
6285
|
selectionEnd,
|
|
6308
6286
|
pastedLength
|
|
6309
6287
|
} = this.state;
|
|
6288
|
+
const target = triggerEvent?.currentTarget;
|
|
6310
6289
|
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
6311
6290
|
setTimeout(() => {
|
|
6312
|
-
|
|
6313
|
-
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
6314
|
-
}
|
|
6291
|
+
target?.setSelectionRange(cursorPosition, cursorPosition);
|
|
6315
6292
|
this.setState({
|
|
6316
6293
|
selectionStart: cursorPosition,
|
|
6317
6294
|
selectionEnd: cursorPosition
|
|
@@ -12604,7 +12581,7 @@ const ProcessingStep = props => {
|
|
|
12604
12581
|
"aria-hidden": isComplete,
|
|
12605
12582
|
children: /*#__PURE__*/jsxs("div", {
|
|
12606
12583
|
className: "droppable-card-content",
|
|
12607
|
-
children: [/*#__PURE__*/jsx(ProcessIndicator
|
|
12584
|
+
children: [/*#__PURE__*/jsx(ProcessIndicator, {
|
|
12608
12585
|
size: Size.Small,
|
|
12609
12586
|
status: processStatus,
|
|
12610
12587
|
onAnimationCompleted: status => onAnimationCompleted(status)
|
|
@@ -13427,7 +13404,7 @@ const UploadItem = ({
|
|
|
13427
13404
|
switch (status) {
|
|
13428
13405
|
case Status.PROCESSING:
|
|
13429
13406
|
case Status.PENDING:
|
|
13430
|
-
processIndicator = /*#__PURE__*/jsx(ProcessIndicator
|
|
13407
|
+
processIndicator = /*#__PURE__*/jsx(ProcessIndicator, {
|
|
13431
13408
|
size: Size.EXTRA_SMALL,
|
|
13432
13409
|
status: Status.PROCESSING
|
|
13433
13410
|
});
|
|
@@ -13438,7 +13415,7 @@ const UploadItem = ({
|
|
|
13438
13415
|
processIndicator = isModern ? /*#__PURE__*/jsx(StatusIcon, {
|
|
13439
13416
|
size: Size.SMALL,
|
|
13440
13417
|
sentiment: Sentiment.POSITIVE
|
|
13441
|
-
}) : /*#__PURE__*/jsx(ProcessIndicator
|
|
13418
|
+
}) : /*#__PURE__*/jsx(ProcessIndicator, {
|
|
13442
13419
|
size: Size.EXTRA_SMALL,
|
|
13443
13420
|
status: Status.SUCCEEDED
|
|
13444
13421
|
});
|
|
@@ -13453,7 +13430,7 @@ const UploadItem = ({
|
|
|
13453
13430
|
children: processIndicator
|
|
13454
13431
|
}); // Scale down ProcessIndicator to be 20px*20px to match `icons`
|
|
13455
13432
|
};
|
|
13456
|
-
const getErrorMessage = () => typeof error === 'object'
|
|
13433
|
+
const getErrorMessage = () => typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);
|
|
13457
13434
|
const getDescription = () => {
|
|
13458
13435
|
if (error || status === Status.FAILED) {
|
|
13459
13436
|
return /*#__PURE__*/jsx(Body, {
|
|
@@ -14790,5 +14767,5 @@ const translations = {
|
|
|
14790
14767
|
'zh-HK': zhHK
|
|
14791
14768
|
};
|
|
14792
14769
|
|
|
14793
|
-
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator
|
|
14770
|
+
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead$1 as Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
14794
14771
|
//# sourceMappingURL=index.mjs.map
|