@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.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');
|
|
@@ -561,7 +559,7 @@ const AccordionItem = ({
|
|
|
561
559
|
const iconElement = icon ? /*#__PURE__*/React.cloneElement(icon, {
|
|
562
560
|
size: 24
|
|
563
561
|
}) : null;
|
|
564
|
-
const fallbackId =
|
|
562
|
+
const fallbackId = React.useId();
|
|
565
563
|
const accordionId = id ?? fallbackId;
|
|
566
564
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
567
565
|
id: accordionId,
|
|
@@ -1281,68 +1279,67 @@ const radius = {
|
|
|
1281
1279
|
};
|
|
1282
1280
|
const ANIMATION_DURATION_IN_MS = 1500;
|
|
1283
1281
|
class ProcessIndicator extends React.Component {
|
|
1282
|
+
static defaultProps = {
|
|
1283
|
+
status: 'processing',
|
|
1284
|
+
size: 'sm'
|
|
1285
|
+
};
|
|
1286
|
+
interval = 0;
|
|
1287
|
+
timeout = 0;
|
|
1284
1288
|
constructor(props) {
|
|
1285
1289
|
super(props);
|
|
1286
1290
|
this.state = {
|
|
1287
1291
|
status: props.status,
|
|
1288
1292
|
size: props.size
|
|
1289
1293
|
};
|
|
1290
|
-
this.interval = null;
|
|
1291
|
-
this.timeout = null;
|
|
1292
1294
|
}
|
|
1293
|
-
|
|
1294
1295
|
/**
|
|
1295
1296
|
* Create interval for animation duration (1500ms)
|
|
1296
1297
|
* Update state only at the end of every interval
|
|
1297
1298
|
* (end of animation loop) if props changed before end of animation
|
|
1298
1299
|
*/
|
|
1299
1300
|
componentDidMount() {
|
|
1300
|
-
this.interval = setInterval(() => {
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1301
|
+
this.interval = window.setInterval(() => {
|
|
1302
|
+
const {
|
|
1303
|
+
status: targetStatus,
|
|
1304
|
+
size: targetSize,
|
|
1305
|
+
onAnimationCompleted
|
|
1306
|
+
} = this.props;
|
|
1307
|
+
const {
|
|
1308
|
+
status: currentStatus,
|
|
1309
|
+
size: currentSize
|
|
1310
|
+
} = this.state;
|
|
1311
|
+
if (currentStatus !== targetStatus) {
|
|
1306
1312
|
this.setState({
|
|
1307
|
-
status:
|
|
1308
|
-
},
|
|
1313
|
+
status: targetStatus
|
|
1314
|
+
}, () => {
|
|
1315
|
+
if (onAnimationCompleted) {
|
|
1316
|
+
this.timeout = window.setTimeout(() => {
|
|
1317
|
+
onAnimationCompleted(targetStatus);
|
|
1318
|
+
}, ANIMATION_DURATION_IN_MS);
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1309
1321
|
}
|
|
1310
|
-
if (
|
|
1322
|
+
if (currentSize !== targetSize) {
|
|
1311
1323
|
this.setState({
|
|
1312
|
-
size:
|
|
1324
|
+
size: targetSize
|
|
1313
1325
|
});
|
|
1314
1326
|
}
|
|
1315
1327
|
}, ANIMATION_DURATION_IN_MS);
|
|
1316
1328
|
}
|
|
1317
|
-
|
|
1318
1329
|
/**
|
|
1319
1330
|
* Only trigger render if comopnent's state got
|
|
1320
1331
|
* updated from interval callback
|
|
1321
|
-
*
|
|
1322
|
-
* @param nextProps
|
|
1323
|
-
* @param nextState
|
|
1324
1332
|
*/
|
|
1325
1333
|
shouldComponentUpdate(nextProps, nextState) {
|
|
1326
1334
|
const isSameStatus = nextProps.status === nextState.status;
|
|
1327
1335
|
const isSameSize = nextProps.size === nextState.size;
|
|
1328
1336
|
return isSameStatus && isSameSize;
|
|
1329
1337
|
}
|
|
1330
|
-
|
|
1331
1338
|
// Clear interval before destroying component
|
|
1332
1339
|
componentWillUnmount() {
|
|
1333
|
-
clearInterval(this.interval);
|
|
1334
|
-
clearTimeout(this.timeout);
|
|
1340
|
+
window.clearInterval(this.interval);
|
|
1341
|
+
window.clearTimeout(this.timeout);
|
|
1335
1342
|
}
|
|
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
1343
|
render() {
|
|
1347
1344
|
const {
|
|
1348
1345
|
className,
|
|
@@ -1373,28 +1370,13 @@ class ProcessIndicator extends React.Component {
|
|
|
1373
1370
|
className: "process-circle",
|
|
1374
1371
|
cx: "50%",
|
|
1375
1372
|
cy: "50%",
|
|
1376
|
-
r: radius[
|
|
1373
|
+
r: radius[size],
|
|
1377
1374
|
fillOpacity: "0.0"
|
|
1378
1375
|
})
|
|
1379
1376
|
})]
|
|
1380
1377
|
});
|
|
1381
1378
|
}
|
|
1382
1379
|
}
|
|
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
1380
|
|
|
1399
1381
|
var messages$b = reactIntl.defineMessages({
|
|
1400
1382
|
loadingAriaLabel: {
|
|
@@ -1516,7 +1498,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
1516
1498
|
...props,
|
|
1517
1499
|
"aria-live": loading ? 'polite' : 'off',
|
|
1518
1500
|
"aria-label": loading ? intl.formatMessage(messages$b.loadingAriaLabel) : rest['aria-label'],
|
|
1519
|
-
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
1501
|
+
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
1520
1502
|
size: processIndicatorSize(),
|
|
1521
1503
|
className: "btn-loader"
|
|
1522
1504
|
})]
|
|
@@ -1667,9 +1649,8 @@ const useHasIntersected = ({
|
|
|
1667
1649
|
return [hasIntersected];
|
|
1668
1650
|
};
|
|
1669
1651
|
|
|
1670
|
-
// eslint-disable-next-line import/extensions
|
|
1671
1652
|
function useMedia(query) {
|
|
1672
|
-
return
|
|
1653
|
+
return React.useSyncExternalStore(onStoreChange => {
|
|
1673
1654
|
const mediaQueryList = window.matchMedia(query);
|
|
1674
1655
|
mediaQueryList.addEventListener('change', onStoreChange);
|
|
1675
1656
|
return () => {
|
|
@@ -1847,7 +1828,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
1847
1828
|
setChecked(!checked); // Update local state for checkbox
|
|
1848
1829
|
}
|
|
1849
1830
|
};
|
|
1850
|
-
const fallbackId =
|
|
1831
|
+
const fallbackId = React.useId();
|
|
1851
1832
|
const componentId = id || fallbackId;
|
|
1852
1833
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
1853
1834
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
@@ -2837,7 +2818,7 @@ const Drawer = ({
|
|
|
2837
2818
|
const {
|
|
2838
2819
|
isMobile
|
|
2839
2820
|
} = useLayout();
|
|
2840
|
-
const titleId =
|
|
2821
|
+
const titleId = React.useId();
|
|
2841
2822
|
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
2842
2823
|
open: open,
|
|
2843
2824
|
onClose: onClose,
|
|
@@ -2879,12 +2860,12 @@ Drawer.propTypes = {
|
|
|
2879
2860
|
footerContent: PropTypes__default.default.node,
|
|
2880
2861
|
/** The content to appear in the drawer header. */
|
|
2881
2862
|
headerTitle: PropTypes__default.default.node,
|
|
2882
|
-
/** The action to perform on close click. */
|
|
2883
|
-
onClose: PropTypes__default.default.func,
|
|
2884
2863
|
/** The status of Drawer either open or not. */
|
|
2885
2864
|
open: PropTypes__default.default.bool,
|
|
2886
2865
|
/** 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'])
|
|
2866
|
+
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom']),
|
|
2867
|
+
/** The action to perform on close click. */
|
|
2868
|
+
onClose: PropTypes__default.default.func
|
|
2888
2869
|
};
|
|
2889
2870
|
Drawer.defaultProps = {
|
|
2890
2871
|
children: null,
|
|
@@ -3559,7 +3540,7 @@ const fallbackPlacements = {
|
|
|
3559
3540
|
[exports.Position.LEFT]: [exports.Position.RIGHT, exports.Position.TOP, exports.Position.BOTTOM],
|
|
3560
3541
|
[exports.Position.RIGHT]: [exports.Position.LEFT, exports.Position.TOP, exports.Position.BOTTOM]
|
|
3561
3542
|
};
|
|
3562
|
-
const Panel = /*#__PURE__*/React.forwardRef(({
|
|
3543
|
+
const Panel = /*#__PURE__*/React.forwardRef(function Panel({
|
|
3563
3544
|
arrow = false,
|
|
3564
3545
|
flip = true,
|
|
3565
3546
|
altAxis = false,
|
|
@@ -3570,7 +3551,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3570
3551
|
anchorRef,
|
|
3571
3552
|
anchorWidth = false,
|
|
3572
3553
|
...rest
|
|
3573
|
-
}, reference)
|
|
3554
|
+
}, reference) {
|
|
3574
3555
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
3575
3556
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
3576
3557
|
const modifiers = [];
|
|
@@ -3648,7 +3629,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3648
3629
|
...attributes.popper,
|
|
3649
3630
|
className: classNames__default.default('np-panel', {
|
|
3650
3631
|
'np-panel--open': open
|
|
3651
|
-
}, rest
|
|
3632
|
+
}, rest.className),
|
|
3652
3633
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3653
3634
|
ref: reference
|
|
3654
3635
|
/* eslint-disable-next-line react/forbid-dom-props */,
|
|
@@ -3667,7 +3648,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3667
3648
|
});
|
|
3668
3649
|
var Panel$1 = Panel;
|
|
3669
3650
|
|
|
3670
|
-
const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
3651
|
+
const ResponsivePanel = /*#__PURE__*/React.forwardRef(function ResponsivePanel({
|
|
3671
3652
|
anchorRef,
|
|
3672
3653
|
arrow = false,
|
|
3673
3654
|
flip = true,
|
|
@@ -3676,7 +3657,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3676
3657
|
onClose,
|
|
3677
3658
|
open = false,
|
|
3678
3659
|
position = exports.Position.BOTTOM
|
|
3679
|
-
}, reference)
|
|
3660
|
+
}, reference) {
|
|
3680
3661
|
const {
|
|
3681
3662
|
isMobile
|
|
3682
3663
|
} = useLayout();
|
|
@@ -5015,6 +4996,84 @@ const Emphasis = ({
|
|
|
5015
4996
|
}) : null;
|
|
5016
4997
|
};
|
|
5017
4998
|
|
|
4999
|
+
function InlineAlert({
|
|
5000
|
+
id,
|
|
5001
|
+
type = 'neutral',
|
|
5002
|
+
className,
|
|
5003
|
+
children
|
|
5004
|
+
}) {
|
|
5005
|
+
const danger = type === 'negative' || type === 'error';
|
|
5006
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5007
|
+
role: "alert",
|
|
5008
|
+
id: id,
|
|
5009
|
+
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5010
|
+
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5011
|
+
children: children
|
|
5012
|
+
})]
|
|
5013
|
+
});
|
|
5014
|
+
}
|
|
5015
|
+
|
|
5016
|
+
const Label = ({
|
|
5017
|
+
id,
|
|
5018
|
+
htmlFor,
|
|
5019
|
+
className,
|
|
5020
|
+
children
|
|
5021
|
+
}) => {
|
|
5022
|
+
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
5023
|
+
id: id,
|
|
5024
|
+
htmlFor: htmlFor,
|
|
5025
|
+
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
5026
|
+
children: children
|
|
5027
|
+
});
|
|
5028
|
+
};
|
|
5029
|
+
|
|
5030
|
+
const Field = ({
|
|
5031
|
+
id,
|
|
5032
|
+
label,
|
|
5033
|
+
hint,
|
|
5034
|
+
error,
|
|
5035
|
+
className,
|
|
5036
|
+
children
|
|
5037
|
+
}) => {
|
|
5038
|
+
const hasError = Boolean(error);
|
|
5039
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
5040
|
+
const labelId = React.useId();
|
|
5041
|
+
const fallbackInputId = React.useId();
|
|
5042
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
5043
|
+
const descriptionId = React.useId();
|
|
5044
|
+
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
5045
|
+
value: labelId,
|
|
5046
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
5047
|
+
value: inputId,
|
|
5048
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5049
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
5050
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5051
|
+
value: hasError,
|
|
5052
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5053
|
+
className: classNames__default.default('form-group d-block', {
|
|
5054
|
+
'has-error': hasError,
|
|
5055
|
+
'has-info': hasHint
|
|
5056
|
+
}, className),
|
|
5057
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
5058
|
+
id: labelId,
|
|
5059
|
+
htmlFor: inputId,
|
|
5060
|
+
children: [label, children]
|
|
5061
|
+
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5062
|
+
type: exports.Sentiment.NEUTRAL,
|
|
5063
|
+
id: descriptionId,
|
|
5064
|
+
children: hint
|
|
5065
|
+
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5066
|
+
type: exports.Sentiment.NEGATIVE,
|
|
5067
|
+
id: descriptionId,
|
|
5068
|
+
children: error
|
|
5069
|
+
})]
|
|
5070
|
+
})
|
|
5071
|
+
})
|
|
5072
|
+
})
|
|
5073
|
+
})
|
|
5074
|
+
});
|
|
5075
|
+
};
|
|
5076
|
+
|
|
5018
5077
|
const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
|
|
5019
5078
|
bottomContent,
|
|
5020
5079
|
className,
|
|
@@ -5221,7 +5280,7 @@ const Tooltip = ({
|
|
|
5221
5280
|
const anchorReference = React.useRef(null);
|
|
5222
5281
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
5223
5282
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
5224
|
-
const fallbackId =
|
|
5283
|
+
const fallbackId = React.useId();
|
|
5225
5284
|
const tooltipId = id ?? fallbackId;
|
|
5226
5285
|
const modifiers = [];
|
|
5227
5286
|
modifiers.push({
|
|
@@ -5261,42 +5320,40 @@ const Tooltip = ({
|
|
|
5261
5320
|
forceUpdate();
|
|
5262
5321
|
}
|
|
5263
5322
|
}, [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
|
-
})
|
|
5323
|
+
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5324
|
+
ref: anchorReference,
|
|
5325
|
+
className: "tw-tooltip-container",
|
|
5326
|
+
onMouseOver: () => setOpen(true),
|
|
5327
|
+
onFocus: () => setOpen(true),
|
|
5328
|
+
onMouseOut: () => setOpen(false),
|
|
5329
|
+
onBlur: () => setOpen(false),
|
|
5330
|
+
children: [children ? /*#__PURE__*/React.cloneElement(children, {
|
|
5331
|
+
'aria-describedby': `${tooltipId}-tooltip`
|
|
5332
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5333
|
+
// @ts-expect-error
|
|
5334
|
+
ref: setPopperElement,
|
|
5335
|
+
className: classNames__default.default('np-tooltip', 'np-panel', open ? `np-panel--open np-tooltip--open` : null, className)
|
|
5336
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5337
|
+
,
|
|
5338
|
+
style: {
|
|
5339
|
+
...styles.popper
|
|
5340
|
+
},
|
|
5341
|
+
...attributes.popper,
|
|
5342
|
+
"aria-hidden": !open,
|
|
5343
|
+
role: "tooltip",
|
|
5344
|
+
id: `${tooltipId}-tooltip`,
|
|
5345
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5346
|
+
className: "np-panel__content tooltip-inner",
|
|
5347
|
+
children: [label, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5348
|
+
// @ts-expect-error
|
|
5349
|
+
ref: setArrowElement,
|
|
5350
|
+
className: classNames__default.default('np-panel__arrow')
|
|
5351
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5352
|
+
,
|
|
5353
|
+
style: styles.arrow
|
|
5354
|
+
})]
|
|
5355
|
+
})
|
|
5356
|
+
})]
|
|
5300
5357
|
});
|
|
5301
5358
|
};
|
|
5302
5359
|
|
|
@@ -5494,84 +5551,6 @@ const FlowNavigation = ({
|
|
|
5494
5551
|
});
|
|
5495
5552
|
};
|
|
5496
5553
|
|
|
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
5554
|
const HeaderAction = ({
|
|
5576
5555
|
action
|
|
5577
5556
|
}) => {
|
|
@@ -5668,7 +5647,7 @@ const Modal = ({
|
|
|
5668
5647
|
const isCompact = checkSpecialClasses('compact');
|
|
5669
5648
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5670
5649
|
const contentReference = React.useRef(null);
|
|
5671
|
-
const titleId =
|
|
5650
|
+
const titleId = React.useId();
|
|
5672
5651
|
return !isMedium ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5673
5652
|
open: open,
|
|
5674
5653
|
headerTitle: title,
|
|
@@ -6181,10 +6160,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
6181
6160
|
return 'Backspace';
|
|
6182
6161
|
}
|
|
6183
6162
|
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
6163
|
}
|
|
6164
|
+
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
6165
|
+
return 'Paste';
|
|
6188
6166
|
};
|
|
6189
6167
|
resetEvent = () => {
|
|
6190
6168
|
this.setState({
|
|
@@ -6337,11 +6315,10 @@ class WithDisplayFormat extends React.Component {
|
|
|
6337
6315
|
selectionEnd,
|
|
6338
6316
|
pastedLength
|
|
6339
6317
|
} = this.state;
|
|
6318
|
+
const target = triggerEvent?.currentTarget;
|
|
6340
6319
|
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
6341
6320
|
setTimeout(() => {
|
|
6342
|
-
|
|
6343
|
-
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
6344
|
-
}
|
|
6321
|
+
target?.setSelectionRange(cursorPosition, cursorPosition);
|
|
6345
6322
|
this.setState({
|
|
6346
6323
|
selectionStart: cursorPosition,
|
|
6347
6324
|
selectionEnd: cursorPosition
|
|
@@ -7021,8 +6998,8 @@ function SelectInputOptions({
|
|
|
7021
6998
|
}
|
|
7022
6999
|
}, []);
|
|
7023
7000
|
const showStatus = resultsEmpty;
|
|
7024
|
-
const statusId =
|
|
7025
|
-
const listboxId =
|
|
7001
|
+
const statusId = React.useId();
|
|
7002
|
+
const listboxId = React.useId();
|
|
7026
7003
|
return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
|
|
7027
7004
|
as: SelectInputOptionsContainer,
|
|
7028
7005
|
static: true,
|
|
@@ -7149,7 +7126,7 @@ function SelectInputGroupItemView({
|
|
|
7149
7126
|
renderValue,
|
|
7150
7127
|
needle
|
|
7151
7128
|
}) {
|
|
7152
|
-
const headerId =
|
|
7129
|
+
const headerId = React.useId();
|
|
7153
7130
|
return (
|
|
7154
7131
|
/*#__PURE__*/
|
|
7155
7132
|
// An empty container may be rendered when no options match `needle`
|
|
@@ -10172,7 +10149,7 @@ function Select({
|
|
|
10172
10149
|
}, [defaultOptions, search, searchValue]);
|
|
10173
10150
|
const selectableOptions = React.useMemo(() => options.filter(isActionableOption), [options]);
|
|
10174
10151
|
const focusedOption = selectableOptions[keyboardFocusedOptionIndex];
|
|
10175
|
-
const fallbackButtonId =
|
|
10152
|
+
const fallbackButtonId = React.useId();
|
|
10176
10153
|
const computedId = id || inputAttributes.id || fallbackButtonId;
|
|
10177
10154
|
const listboxId = `${computedId}-listbox`;
|
|
10178
10155
|
const searchBoxId = `${computedId}-searchbox`;
|
|
@@ -12634,7 +12611,7 @@ const ProcessingStep = props => {
|
|
|
12634
12611
|
"aria-hidden": isComplete,
|
|
12635
12612
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12636
12613
|
className: "droppable-card-content",
|
|
12637
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
12614
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
12638
12615
|
size: exports.Size.Small,
|
|
12639
12616
|
status: processStatus,
|
|
12640
12617
|
onAnimationCompleted: status => onAnimationCompleted(status)
|
|
@@ -13457,7 +13434,7 @@ const UploadItem = ({
|
|
|
13457
13434
|
switch (status) {
|
|
13458
13435
|
case exports.Status.PROCESSING:
|
|
13459
13436
|
case exports.Status.PENDING:
|
|
13460
|
-
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13437
|
+
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13461
13438
|
size: exports.Size.EXTRA_SMALL,
|
|
13462
13439
|
status: exports.Status.PROCESSING
|
|
13463
13440
|
});
|
|
@@ -13468,7 +13445,7 @@ const UploadItem = ({
|
|
|
13468
13445
|
processIndicator = isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
13469
13446
|
size: exports.Size.SMALL,
|
|
13470
13447
|
sentiment: exports.Sentiment.POSITIVE
|
|
13471
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13448
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13472
13449
|
size: exports.Size.EXTRA_SMALL,
|
|
13473
13450
|
status: exports.Status.SUCCEEDED
|
|
13474
13451
|
});
|
|
@@ -13483,7 +13460,7 @@ const UploadItem = ({
|
|
|
13483
13460
|
children: processIndicator
|
|
13484
13461
|
}); // Scale down ProcessIndicator to be 20px*20px to match `icons`
|
|
13485
13462
|
};
|
|
13486
|
-
const getErrorMessage = () => typeof error === 'object'
|
|
13463
|
+
const getErrorMessage = () => typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);
|
|
13487
13464
|
const getDescription = () => {
|
|
13488
13465
|
if (error || status === exports.Status.FAILED) {
|
|
13489
13466
|
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
@@ -14880,7 +14857,7 @@ exports.Option = Option$2;
|
|
|
14880
14857
|
exports.OverlayHeader = OverlayHeader$1;
|
|
14881
14858
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
14882
14859
|
exports.Popover = Popover$1;
|
|
14883
|
-
exports.ProcessIndicator = ProcessIndicator
|
|
14860
|
+
exports.ProcessIndicator = ProcessIndicator;
|
|
14884
14861
|
exports.Progress = Progress;
|
|
14885
14862
|
exports.ProgressBar = ProgressBar;
|
|
14886
14863
|
exports.PromoCard = PromoCard$1;
|