@transferwise/components 46.34.0 → 46.35.0
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 -192
- package/build/index.js.map +1 -1
- package/build/index.mjs +164 -186
- 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/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 +11 -15
- 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/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.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var reactId = require('@radix-ui/react-id');
|
|
5
4
|
var classNames = require('classnames');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var icons = require('@transferwise/icons');
|
|
@@ -12,7 +11,6 @@ var componentsTheming = require('@wise/components-theming');
|
|
|
12
11
|
var reactTransitionGroup = require('react-transition-group');
|
|
13
12
|
var focus = require('@react-aria/focus');
|
|
14
13
|
var reactDom = require('react-dom');
|
|
15
|
-
var index_js = require('use-sync-external-store/shim/index.js');
|
|
16
14
|
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
17
15
|
var formatting = require('@transferwise/formatting');
|
|
18
16
|
var react$1 = require('@headlessui/react');
|
|
@@ -21,6 +19,7 @@ var react = require('@floating-ui/react');
|
|
|
21
19
|
var overlays = require('@react-aria/overlays');
|
|
22
20
|
var reactPopper = require('react-popper');
|
|
23
21
|
var art = require('@wise/art');
|
|
22
|
+
var reactId = require('@radix-ui/react-id');
|
|
24
23
|
var clamp$2 = require('lodash.clamp');
|
|
25
24
|
var debounce = require('lodash.debounce');
|
|
26
25
|
var requiredIf = require('react-required-if');
|
|
@@ -561,7 +560,7 @@ const AccordionItem = ({
|
|
|
561
560
|
const iconElement = icon ? /*#__PURE__*/React.cloneElement(icon, {
|
|
562
561
|
size: 24
|
|
563
562
|
}) : null;
|
|
564
|
-
const fallbackId =
|
|
563
|
+
const fallbackId = React.useId();
|
|
565
564
|
const accordionId = id ?? fallbackId;
|
|
566
565
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
567
566
|
id: accordionId,
|
|
@@ -1281,68 +1280,67 @@ const radius = {
|
|
|
1281
1280
|
};
|
|
1282
1281
|
const ANIMATION_DURATION_IN_MS = 1500;
|
|
1283
1282
|
class ProcessIndicator extends React.Component {
|
|
1283
|
+
static defaultProps = {
|
|
1284
|
+
status: 'processing',
|
|
1285
|
+
size: 'sm'
|
|
1286
|
+
};
|
|
1287
|
+
interval = 0;
|
|
1288
|
+
timeout = 0;
|
|
1284
1289
|
constructor(props) {
|
|
1285
1290
|
super(props);
|
|
1286
1291
|
this.state = {
|
|
1287
1292
|
status: props.status,
|
|
1288
1293
|
size: props.size
|
|
1289
1294
|
};
|
|
1290
|
-
this.interval = null;
|
|
1291
|
-
this.timeout = null;
|
|
1292
1295
|
}
|
|
1293
|
-
|
|
1294
1296
|
/**
|
|
1295
1297
|
* Create interval for animation duration (1500ms)
|
|
1296
1298
|
* Update state only at the end of every interval
|
|
1297
1299
|
* (end of animation loop) if props changed before end of animation
|
|
1298
1300
|
*/
|
|
1299
1301
|
componentDidMount() {
|
|
1300
|
-
this.interval = setInterval(() => {
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1302
|
+
this.interval = window.setInterval(() => {
|
|
1303
|
+
const {
|
|
1304
|
+
status: targetStatus,
|
|
1305
|
+
size: targetSize,
|
|
1306
|
+
onAnimationCompleted
|
|
1307
|
+
} = this.props;
|
|
1308
|
+
const {
|
|
1309
|
+
status: currentStatus,
|
|
1310
|
+
size: currentSize
|
|
1311
|
+
} = this.state;
|
|
1312
|
+
if (currentStatus !== targetStatus) {
|
|
1306
1313
|
this.setState({
|
|
1307
|
-
status:
|
|
1308
|
-
},
|
|
1314
|
+
status: targetStatus
|
|
1315
|
+
}, () => {
|
|
1316
|
+
if (onAnimationCompleted) {
|
|
1317
|
+
this.timeout = window.setTimeout(() => {
|
|
1318
|
+
onAnimationCompleted(targetStatus);
|
|
1319
|
+
}, ANIMATION_DURATION_IN_MS);
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1309
1322
|
}
|
|
1310
|
-
if (
|
|
1323
|
+
if (currentSize !== targetSize) {
|
|
1311
1324
|
this.setState({
|
|
1312
|
-
size:
|
|
1325
|
+
size: targetSize
|
|
1313
1326
|
});
|
|
1314
1327
|
}
|
|
1315
1328
|
}, ANIMATION_DURATION_IN_MS);
|
|
1316
1329
|
}
|
|
1317
|
-
|
|
1318
1330
|
/**
|
|
1319
1331
|
* Only trigger render if comopnent's state got
|
|
1320
1332
|
* updated from interval callback
|
|
1321
|
-
*
|
|
1322
|
-
* @param nextProps
|
|
1323
|
-
* @param nextState
|
|
1324
1333
|
*/
|
|
1325
1334
|
shouldComponentUpdate(nextProps, nextState) {
|
|
1326
1335
|
const isSameStatus = nextProps.status === nextState.status;
|
|
1327
1336
|
const isSameSize = nextProps.size === nextState.size;
|
|
1328
1337
|
return isSameStatus && isSameSize;
|
|
1329
1338
|
}
|
|
1330
|
-
|
|
1331
1339
|
// Clear interval before destroying component
|
|
1332
1340
|
componentWillUnmount() {
|
|
1333
|
-
clearInterval(this.interval);
|
|
1334
|
-
clearTimeout(this.timeout);
|
|
1341
|
+
window.clearInterval(this.interval);
|
|
1342
|
+
window.clearTimeout(this.timeout);
|
|
1335
1343
|
}
|
|
1336
|
-
runCallBack = statusFromProps => {
|
|
1337
|
-
const {
|
|
1338
|
-
onAnimationCompleted
|
|
1339
|
-
} = this.props;
|
|
1340
|
-
if (onAnimationCompleted) {
|
|
1341
|
-
this.timeouts = setTimeout(() => {
|
|
1342
|
-
onAnimationCompleted(statusFromProps);
|
|
1343
|
-
}, ANIMATION_DURATION_IN_MS);
|
|
1344
|
-
}
|
|
1345
|
-
};
|
|
1346
1344
|
render() {
|
|
1347
1345
|
const {
|
|
1348
1346
|
className,
|
|
@@ -1373,28 +1371,13 @@ class ProcessIndicator extends React.Component {
|
|
|
1373
1371
|
className: "process-circle",
|
|
1374
1372
|
cx: "50%",
|
|
1375
1373
|
cy: "50%",
|
|
1376
|
-
r: radius[
|
|
1374
|
+
r: radius[size],
|
|
1377
1375
|
fillOpacity: "0.0"
|
|
1378
1376
|
})
|
|
1379
1377
|
})]
|
|
1380
1378
|
});
|
|
1381
1379
|
}
|
|
1382
1380
|
}
|
|
1383
|
-
ProcessIndicator.propTypes = {
|
|
1384
|
-
status: PropTypes__default.default.oneOf(['processing', 'failed', 'succeeded', 'hidden']),
|
|
1385
|
-
size: PropTypes__default.default.oneOf(['xxs', 'xs', 'sm', 'xl']),
|
|
1386
|
-
onAnimationCompleted: PropTypes__default.default.func,
|
|
1387
|
-
className: PropTypes__default.default.string,
|
|
1388
|
-
'data-testid': PropTypes__default.default.string
|
|
1389
|
-
};
|
|
1390
|
-
ProcessIndicator.defaultProps = {
|
|
1391
|
-
status: exports.Status.PROCESSING,
|
|
1392
|
-
size: exports.Size.SMALL,
|
|
1393
|
-
onAnimationCompleted: null,
|
|
1394
|
-
className: undefined,
|
|
1395
|
-
'data-testid': null
|
|
1396
|
-
};
|
|
1397
|
-
var ProcessIndicator$1 = ProcessIndicator;
|
|
1398
1381
|
|
|
1399
1382
|
var messages$b = reactIntl.defineMessages({
|
|
1400
1383
|
loadingAriaLabel: {
|
|
@@ -1516,7 +1499,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
1516
1499
|
...props,
|
|
1517
1500
|
"aria-live": loading ? 'polite' : 'off',
|
|
1518
1501
|
"aria-label": loading ? intl.formatMessage(messages$b.loadingAriaLabel) : rest['aria-label'],
|
|
1519
|
-
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
1502
|
+
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
1520
1503
|
size: processIndicatorSize(),
|
|
1521
1504
|
className: "btn-loader"
|
|
1522
1505
|
})]
|
|
@@ -1667,9 +1650,8 @@ const useHasIntersected = ({
|
|
|
1667
1650
|
return [hasIntersected];
|
|
1668
1651
|
};
|
|
1669
1652
|
|
|
1670
|
-
// eslint-disable-next-line import/extensions
|
|
1671
1653
|
function useMedia(query) {
|
|
1672
|
-
return
|
|
1654
|
+
return React.useSyncExternalStore(onStoreChange => {
|
|
1673
1655
|
const mediaQueryList = window.matchMedia(query);
|
|
1674
1656
|
mediaQueryList.addEventListener('change', onStoreChange);
|
|
1675
1657
|
return () => {
|
|
@@ -1847,7 +1829,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
1847
1829
|
setChecked(!checked); // Update local state for checkbox
|
|
1848
1830
|
}
|
|
1849
1831
|
};
|
|
1850
|
-
const fallbackId =
|
|
1832
|
+
const fallbackId = React.useId();
|
|
1851
1833
|
const componentId = id || fallbackId;
|
|
1852
1834
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
1853
1835
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
@@ -2837,7 +2819,7 @@ const Drawer = ({
|
|
|
2837
2819
|
const {
|
|
2838
2820
|
isMobile
|
|
2839
2821
|
} = useLayout();
|
|
2840
|
-
const titleId =
|
|
2822
|
+
const titleId = React.useId();
|
|
2841
2823
|
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
2842
2824
|
open: open,
|
|
2843
2825
|
onClose: onClose,
|
|
@@ -2879,12 +2861,12 @@ Drawer.propTypes = {
|
|
|
2879
2861
|
footerContent: PropTypes__default.default.node,
|
|
2880
2862
|
/** The content to appear in the drawer header. */
|
|
2881
2863
|
headerTitle: PropTypes__default.default.node,
|
|
2882
|
-
/** The action to perform on close click. */
|
|
2883
|
-
onClose: PropTypes__default.default.func,
|
|
2884
2864
|
/** The status of Drawer either open or not. */
|
|
2885
2865
|
open: PropTypes__default.default.bool,
|
|
2886
2866
|
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
2887
|
-
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom'])
|
|
2867
|
+
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom']),
|
|
2868
|
+
/** The action to perform on close click. */
|
|
2869
|
+
onClose: PropTypes__default.default.func
|
|
2888
2870
|
};
|
|
2889
2871
|
Drawer.defaultProps = {
|
|
2890
2872
|
children: null,
|
|
@@ -3559,7 +3541,7 @@ const fallbackPlacements = {
|
|
|
3559
3541
|
[exports.Position.LEFT]: [exports.Position.RIGHT, exports.Position.TOP, exports.Position.BOTTOM],
|
|
3560
3542
|
[exports.Position.RIGHT]: [exports.Position.LEFT, exports.Position.TOP, exports.Position.BOTTOM]
|
|
3561
3543
|
};
|
|
3562
|
-
const Panel = /*#__PURE__*/React.forwardRef(({
|
|
3544
|
+
const Panel = /*#__PURE__*/React.forwardRef(function Panel({
|
|
3563
3545
|
arrow = false,
|
|
3564
3546
|
flip = true,
|
|
3565
3547
|
altAxis = false,
|
|
@@ -3570,7 +3552,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3570
3552
|
anchorRef,
|
|
3571
3553
|
anchorWidth = false,
|
|
3572
3554
|
...rest
|
|
3573
|
-
}, reference)
|
|
3555
|
+
}, reference) {
|
|
3574
3556
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
3575
3557
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
3576
3558
|
const modifiers = [];
|
|
@@ -3648,7 +3630,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3648
3630
|
...attributes.popper,
|
|
3649
3631
|
className: classNames__default.default('np-panel', {
|
|
3650
3632
|
'np-panel--open': open
|
|
3651
|
-
}, rest
|
|
3633
|
+
}, rest.className),
|
|
3652
3634
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3653
3635
|
ref: reference
|
|
3654
3636
|
/* eslint-disable-next-line react/forbid-dom-props */,
|
|
@@ -3667,7 +3649,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3667
3649
|
});
|
|
3668
3650
|
var Panel$1 = Panel;
|
|
3669
3651
|
|
|
3670
|
-
const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
3652
|
+
const ResponsivePanel = /*#__PURE__*/React.forwardRef(function ResponsivePanel({
|
|
3671
3653
|
anchorRef,
|
|
3672
3654
|
arrow = false,
|
|
3673
3655
|
flip = true,
|
|
@@ -3676,7 +3658,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3676
3658
|
onClose,
|
|
3677
3659
|
open = false,
|
|
3678
3660
|
position = exports.Position.BOTTOM
|
|
3679
|
-
}, reference)
|
|
3661
|
+
}, reference) {
|
|
3680
3662
|
const {
|
|
3681
3663
|
isMobile
|
|
3682
3664
|
} = useLayout();
|
|
@@ -5015,6 +4997,84 @@ const Emphasis = ({
|
|
|
5015
4997
|
}) : null;
|
|
5016
4998
|
};
|
|
5017
4999
|
|
|
5000
|
+
function InlineAlert({
|
|
5001
|
+
id,
|
|
5002
|
+
type = 'neutral',
|
|
5003
|
+
className,
|
|
5004
|
+
children
|
|
5005
|
+
}) {
|
|
5006
|
+
const danger = type === 'negative' || type === 'error';
|
|
5007
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5008
|
+
role: "alert",
|
|
5009
|
+
id: id,
|
|
5010
|
+
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5011
|
+
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5012
|
+
children: children
|
|
5013
|
+
})]
|
|
5014
|
+
});
|
|
5015
|
+
}
|
|
5016
|
+
|
|
5017
|
+
const Label = ({
|
|
5018
|
+
id,
|
|
5019
|
+
htmlFor,
|
|
5020
|
+
className,
|
|
5021
|
+
children
|
|
5022
|
+
}) => {
|
|
5023
|
+
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
5024
|
+
id: id,
|
|
5025
|
+
htmlFor: htmlFor,
|
|
5026
|
+
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
5027
|
+
children: children
|
|
5028
|
+
});
|
|
5029
|
+
};
|
|
5030
|
+
|
|
5031
|
+
const Field = ({
|
|
5032
|
+
id,
|
|
5033
|
+
label,
|
|
5034
|
+
hint,
|
|
5035
|
+
error,
|
|
5036
|
+
className,
|
|
5037
|
+
children
|
|
5038
|
+
}) => {
|
|
5039
|
+
const hasError = Boolean(error);
|
|
5040
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
5041
|
+
const labelId = React.useId();
|
|
5042
|
+
const fallbackInputId = React.useId();
|
|
5043
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
5044
|
+
const descriptionId = React.useId();
|
|
5045
|
+
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
5046
|
+
value: labelId,
|
|
5047
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
5048
|
+
value: inputId,
|
|
5049
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5050
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
5051
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5052
|
+
value: hasError,
|
|
5053
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5054
|
+
className: classNames__default.default('form-group d-block', {
|
|
5055
|
+
'has-error': hasError,
|
|
5056
|
+
'has-info': hasHint
|
|
5057
|
+
}, className),
|
|
5058
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
5059
|
+
id: labelId,
|
|
5060
|
+
htmlFor: inputId,
|
|
5061
|
+
children: [label, children]
|
|
5062
|
+
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5063
|
+
type: exports.Sentiment.NEUTRAL,
|
|
5064
|
+
id: descriptionId,
|
|
5065
|
+
children: hint
|
|
5066
|
+
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5067
|
+
type: exports.Sentiment.NEGATIVE,
|
|
5068
|
+
id: descriptionId,
|
|
5069
|
+
children: error
|
|
5070
|
+
})]
|
|
5071
|
+
})
|
|
5072
|
+
})
|
|
5073
|
+
})
|
|
5074
|
+
})
|
|
5075
|
+
});
|
|
5076
|
+
};
|
|
5077
|
+
|
|
5018
5078
|
const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
|
|
5019
5079
|
bottomContent,
|
|
5020
5080
|
className,
|
|
@@ -5221,7 +5281,7 @@ const Tooltip = ({
|
|
|
5221
5281
|
const anchorReference = React.useRef(null);
|
|
5222
5282
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
5223
5283
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
5224
|
-
const fallbackId =
|
|
5284
|
+
const fallbackId = React.useId();
|
|
5225
5285
|
const tooltipId = id ?? fallbackId;
|
|
5226
5286
|
const modifiers = [];
|
|
5227
5287
|
modifiers.push({
|
|
@@ -5261,42 +5321,40 @@ const Tooltip = ({
|
|
|
5261
5321
|
forceUpdate();
|
|
5262
5322
|
}
|
|
5263
5323
|
}, [open]);
|
|
5264
|
-
return /*#__PURE__*/jsxRuntime.
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
})]
|
|
5299
|
-
})
|
|
5324
|
+
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5325
|
+
ref: anchorReference,
|
|
5326
|
+
className: "tw-tooltip-container",
|
|
5327
|
+
onMouseOver: () => setOpen(true),
|
|
5328
|
+
onFocus: () => setOpen(true),
|
|
5329
|
+
onMouseOut: () => setOpen(false),
|
|
5330
|
+
onBlur: () => setOpen(false),
|
|
5331
|
+
children: [children ? /*#__PURE__*/React.cloneElement(children, {
|
|
5332
|
+
'aria-describedby': `${tooltipId}-tooltip`
|
|
5333
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5334
|
+
// @ts-expect-error
|
|
5335
|
+
ref: setPopperElement,
|
|
5336
|
+
className: classNames__default.default('np-tooltip', 'np-panel', open ? `np-panel--open np-tooltip--open` : null, className)
|
|
5337
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5338
|
+
,
|
|
5339
|
+
style: {
|
|
5340
|
+
...styles.popper
|
|
5341
|
+
},
|
|
5342
|
+
...attributes.popper,
|
|
5343
|
+
"aria-hidden": !open,
|
|
5344
|
+
role: "tooltip",
|
|
5345
|
+
id: `${tooltipId}-tooltip`,
|
|
5346
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5347
|
+
className: "np-panel__content tooltip-inner",
|
|
5348
|
+
children: [label, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5349
|
+
// @ts-expect-error
|
|
5350
|
+
ref: setArrowElement,
|
|
5351
|
+
className: classNames__default.default('np-panel__arrow')
|
|
5352
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5353
|
+
,
|
|
5354
|
+
style: styles.arrow
|
|
5355
|
+
})]
|
|
5356
|
+
})
|
|
5357
|
+
})]
|
|
5300
5358
|
});
|
|
5301
5359
|
};
|
|
5302
5360
|
|
|
@@ -5494,84 +5552,6 @@ const FlowNavigation = ({
|
|
|
5494
5552
|
});
|
|
5495
5553
|
};
|
|
5496
5554
|
|
|
5497
|
-
function InlineAlert({
|
|
5498
|
-
id,
|
|
5499
|
-
type = 'neutral',
|
|
5500
|
-
className,
|
|
5501
|
-
children
|
|
5502
|
-
}) {
|
|
5503
|
-
const danger = type === 'negative' || type === 'error';
|
|
5504
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5505
|
-
role: "alert",
|
|
5506
|
-
id: id,
|
|
5507
|
-
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5508
|
-
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5509
|
-
children: children
|
|
5510
|
-
})]
|
|
5511
|
-
});
|
|
5512
|
-
}
|
|
5513
|
-
|
|
5514
|
-
const Label = ({
|
|
5515
|
-
id,
|
|
5516
|
-
htmlFor,
|
|
5517
|
-
className,
|
|
5518
|
-
children
|
|
5519
|
-
}) => {
|
|
5520
|
-
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
5521
|
-
id: id,
|
|
5522
|
-
htmlFor: htmlFor,
|
|
5523
|
-
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
5524
|
-
children: children
|
|
5525
|
-
});
|
|
5526
|
-
};
|
|
5527
|
-
|
|
5528
|
-
const Field = ({
|
|
5529
|
-
id,
|
|
5530
|
-
label,
|
|
5531
|
-
hint,
|
|
5532
|
-
error,
|
|
5533
|
-
className,
|
|
5534
|
-
children
|
|
5535
|
-
}) => {
|
|
5536
|
-
const hasError = Boolean(error);
|
|
5537
|
-
const hasHint = Boolean(hint) && !hasError;
|
|
5538
|
-
const labelId = reactId.useId();
|
|
5539
|
-
const fallbackInputId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
5540
|
-
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
5541
|
-
const descriptionId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
5542
|
-
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
5543
|
-
value: labelId,
|
|
5544
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
5545
|
-
value: inputId,
|
|
5546
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5547
|
-
value: hasError || hasHint ? descriptionId : undefined,
|
|
5548
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5549
|
-
value: hasError,
|
|
5550
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5551
|
-
className: classNames__default.default('form-group d-block', {
|
|
5552
|
-
'has-error': hasError,
|
|
5553
|
-
'has-info': hasHint
|
|
5554
|
-
}, className),
|
|
5555
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
5556
|
-
id: labelId,
|
|
5557
|
-
htmlFor: inputId,
|
|
5558
|
-
children: [label, children]
|
|
5559
|
-
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5560
|
-
type: exports.Sentiment.NEUTRAL,
|
|
5561
|
-
id: descriptionId,
|
|
5562
|
-
children: hint
|
|
5563
|
-
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5564
|
-
type: exports.Sentiment.NEGATIVE,
|
|
5565
|
-
id: descriptionId,
|
|
5566
|
-
children: error
|
|
5567
|
-
})]
|
|
5568
|
-
})
|
|
5569
|
-
})
|
|
5570
|
-
})
|
|
5571
|
-
})
|
|
5572
|
-
});
|
|
5573
|
-
};
|
|
5574
|
-
|
|
5575
5555
|
const HeaderAction = ({
|
|
5576
5556
|
action
|
|
5577
5557
|
}) => {
|
|
@@ -5668,7 +5648,7 @@ const Modal = ({
|
|
|
5668
5648
|
const isCompact = checkSpecialClasses('compact');
|
|
5669
5649
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5670
5650
|
const contentReference = React.useRef(null);
|
|
5671
|
-
const titleId =
|
|
5651
|
+
const titleId = React.useId();
|
|
5672
5652
|
return !isMedium ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5673
5653
|
open: open,
|
|
5674
5654
|
headerTitle: title,
|
|
@@ -6181,10 +6161,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
6181
6161
|
return 'Backspace';
|
|
6182
6162
|
}
|
|
6183
6163
|
return triggerEvent.key;
|
|
6184
|
-
} else {
|
|
6185
|
-
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
6186
|
-
return 'Paste';
|
|
6187
6164
|
}
|
|
6165
|
+
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
6166
|
+
return 'Paste';
|
|
6188
6167
|
};
|
|
6189
6168
|
resetEvent = () => {
|
|
6190
6169
|
this.setState({
|
|
@@ -6337,11 +6316,10 @@ class WithDisplayFormat extends React.Component {
|
|
|
6337
6316
|
selectionEnd,
|
|
6338
6317
|
pastedLength
|
|
6339
6318
|
} = this.state;
|
|
6319
|
+
const target = triggerEvent?.currentTarget;
|
|
6340
6320
|
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
6341
6321
|
setTimeout(() => {
|
|
6342
|
-
|
|
6343
|
-
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
6344
|
-
}
|
|
6322
|
+
target?.setSelectionRange(cursorPosition, cursorPosition);
|
|
6345
6323
|
this.setState({
|
|
6346
6324
|
selectionStart: cursorPosition,
|
|
6347
6325
|
selectionEnd: cursorPosition
|
|
@@ -7021,8 +6999,8 @@ function SelectInputOptions({
|
|
|
7021
6999
|
}
|
|
7022
7000
|
}, []);
|
|
7023
7001
|
const showStatus = resultsEmpty;
|
|
7024
|
-
const statusId =
|
|
7025
|
-
const listboxId =
|
|
7002
|
+
const statusId = React.useId();
|
|
7003
|
+
const listboxId = React.useId();
|
|
7026
7004
|
return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
|
|
7027
7005
|
as: SelectInputOptionsContainer,
|
|
7028
7006
|
static: true,
|
|
@@ -7149,7 +7127,7 @@ function SelectInputGroupItemView({
|
|
|
7149
7127
|
renderValue,
|
|
7150
7128
|
needle
|
|
7151
7129
|
}) {
|
|
7152
|
-
const headerId =
|
|
7130
|
+
const headerId = React.useId();
|
|
7153
7131
|
return (
|
|
7154
7132
|
/*#__PURE__*/
|
|
7155
7133
|
// An empty container may be rendered when no options match `needle`
|
|
@@ -12634,7 +12612,7 @@ const ProcessingStep = props => {
|
|
|
12634
12612
|
"aria-hidden": isComplete,
|
|
12635
12613
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12636
12614
|
className: "droppable-card-content",
|
|
12637
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
12615
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
12638
12616
|
size: exports.Size.Small,
|
|
12639
12617
|
status: processStatus,
|
|
12640
12618
|
onAnimationCompleted: status => onAnimationCompleted(status)
|
|
@@ -13457,7 +13435,7 @@ const UploadItem = ({
|
|
|
13457
13435
|
switch (status) {
|
|
13458
13436
|
case exports.Status.PROCESSING:
|
|
13459
13437
|
case exports.Status.PENDING:
|
|
13460
|
-
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13438
|
+
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13461
13439
|
size: exports.Size.EXTRA_SMALL,
|
|
13462
13440
|
status: exports.Status.PROCESSING
|
|
13463
13441
|
});
|
|
@@ -13468,7 +13446,7 @@ const UploadItem = ({
|
|
|
13468
13446
|
processIndicator = isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
13469
13447
|
size: exports.Size.SMALL,
|
|
13470
13448
|
sentiment: exports.Sentiment.POSITIVE
|
|
13471
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13449
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13472
13450
|
size: exports.Size.EXTRA_SMALL,
|
|
13473
13451
|
status: exports.Status.SUCCEEDED
|
|
13474
13452
|
});
|
|
@@ -13483,7 +13461,7 @@ const UploadItem = ({
|
|
|
13483
13461
|
children: processIndicator
|
|
13484
13462
|
}); // Scale down ProcessIndicator to be 20px*20px to match `icons`
|
|
13485
13463
|
};
|
|
13486
|
-
const getErrorMessage = () => typeof error === 'object'
|
|
13464
|
+
const getErrorMessage = () => typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);
|
|
13487
13465
|
const getDescription = () => {
|
|
13488
13466
|
if (error || status === exports.Status.FAILED) {
|
|
13489
13467
|
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
@@ -14880,7 +14858,7 @@ exports.Option = Option$2;
|
|
|
14880
14858
|
exports.OverlayHeader = OverlayHeader$1;
|
|
14881
14859
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
14882
14860
|
exports.Popover = Popover$1;
|
|
14883
|
-
exports.ProcessIndicator = ProcessIndicator
|
|
14861
|
+
exports.ProcessIndicator = ProcessIndicator;
|
|
14884
14862
|
exports.Progress = Progress;
|
|
14885
14863
|
exports.ProgressBar = ProgressBar;
|
|
14886
14864
|
exports.PromoCard = PromoCard$1;
|