@transferwise/components 0.0.0-experimental-3fa5a2b → 0.0.0-experimental-47ae02a
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 +163 -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/dateLookup/DateLookup.d.ts +5 -6
- package/build/types/dateLookup/DateLookup.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/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +2 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +2 -2
- package/build/types/inputs/contexts.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/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +2 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- 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 +14 -14
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/package.json +7 -11
- 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/dateLookup/DateLookup.tsx +9 -14
- package/src/drawer/Drawer.js +3 -3
- package/src/field/Field.tsx +3 -3
- package/src/index.ts +3 -2
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +2 -1
- package/src/inputs/SelectInput.story.tsx +1 -0
- package/src/inputs/SelectInput.tsx +10 -2
- package/src/inputs/contexts.tsx +4 -4
- 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 +4 -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/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +2 -1
- 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/utilities/logActionRequired.js +1 -1
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +63 -32
- package/src/withDisplayFormat/WithDisplayFormat.tsx +28 -28
- 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');
|
|
@@ -565,7 +563,7 @@ const AccordionItem = ({
|
|
|
565
563
|
const iconElement = icon ? /*#__PURE__*/React.cloneElement(icon, {
|
|
566
564
|
size: 24
|
|
567
565
|
}) : null;
|
|
568
|
-
const fallbackId =
|
|
566
|
+
const fallbackId = React.useId();
|
|
569
567
|
const accordionId = id ?? fallbackId;
|
|
570
568
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
571
569
|
id: accordionId,
|
|
@@ -826,7 +824,7 @@ function Title({
|
|
|
826
824
|
}
|
|
827
825
|
|
|
828
826
|
function logActionRequired(message) {
|
|
829
|
-
if (
|
|
827
|
+
if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {
|
|
830
828
|
// eslint-disable-next-line no-console
|
|
831
829
|
console.warn(message);
|
|
832
830
|
}
|
|
@@ -1268,68 +1266,67 @@ const radius = {
|
|
|
1268
1266
|
};
|
|
1269
1267
|
const ANIMATION_DURATION_IN_MS = 1500;
|
|
1270
1268
|
class ProcessIndicator extends React.Component {
|
|
1269
|
+
static defaultProps = {
|
|
1270
|
+
status: 'processing',
|
|
1271
|
+
size: 'sm'
|
|
1272
|
+
};
|
|
1273
|
+
interval = 0;
|
|
1274
|
+
timeout = 0;
|
|
1271
1275
|
constructor(props) {
|
|
1272
1276
|
super(props);
|
|
1273
1277
|
this.state = {
|
|
1274
1278
|
status: props.status,
|
|
1275
1279
|
size: props.size
|
|
1276
1280
|
};
|
|
1277
|
-
this.interval = null;
|
|
1278
|
-
this.timeout = null;
|
|
1279
1281
|
}
|
|
1280
|
-
|
|
1281
1282
|
/**
|
|
1282
1283
|
* Create interval for animation duration (1500ms)
|
|
1283
1284
|
* Update state only at the end of every interval
|
|
1284
1285
|
* (end of animation loop) if props changed before end of animation
|
|
1285
1286
|
*/
|
|
1286
1287
|
componentDidMount() {
|
|
1287
|
-
this.interval = setInterval(() => {
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1288
|
+
this.interval = window.setInterval(() => {
|
|
1289
|
+
const {
|
|
1290
|
+
status: targetStatus,
|
|
1291
|
+
size: targetSize,
|
|
1292
|
+
onAnimationCompleted
|
|
1293
|
+
} = this.props;
|
|
1294
|
+
const {
|
|
1295
|
+
status: currentStatus,
|
|
1296
|
+
size: currentSize
|
|
1297
|
+
} = this.state;
|
|
1298
|
+
if (currentStatus !== targetStatus) {
|
|
1293
1299
|
this.setState({
|
|
1294
|
-
status:
|
|
1295
|
-
},
|
|
1300
|
+
status: targetStatus
|
|
1301
|
+
}, () => {
|
|
1302
|
+
if (onAnimationCompleted) {
|
|
1303
|
+
this.timeout = window.setTimeout(() => {
|
|
1304
|
+
onAnimationCompleted(targetStatus);
|
|
1305
|
+
}, ANIMATION_DURATION_IN_MS);
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1296
1308
|
}
|
|
1297
|
-
if (
|
|
1309
|
+
if (currentSize !== targetSize) {
|
|
1298
1310
|
this.setState({
|
|
1299
|
-
size:
|
|
1311
|
+
size: targetSize
|
|
1300
1312
|
});
|
|
1301
1313
|
}
|
|
1302
1314
|
}, ANIMATION_DURATION_IN_MS);
|
|
1303
1315
|
}
|
|
1304
|
-
|
|
1305
1316
|
/**
|
|
1306
1317
|
* Only trigger render if comopnent's state got
|
|
1307
1318
|
* updated from interval callback
|
|
1308
|
-
*
|
|
1309
|
-
* @param nextProps
|
|
1310
|
-
* @param nextState
|
|
1311
1319
|
*/
|
|
1312
1320
|
shouldComponentUpdate(nextProps, nextState) {
|
|
1313
1321
|
const isSameStatus = nextProps.status === nextState.status;
|
|
1314
1322
|
const isSameSize = nextProps.size === nextState.size;
|
|
1315
1323
|
return isSameStatus && isSameSize;
|
|
1316
1324
|
}
|
|
1317
|
-
|
|
1318
1325
|
// Clear interval before destroying component
|
|
1319
1326
|
componentWillUnmount() {
|
|
1320
|
-
clearInterval(this.interval);
|
|
1321
|
-
clearTimeout(this.timeout);
|
|
1327
|
+
window.clearInterval(this.interval);
|
|
1328
|
+
window.clearTimeout(this.timeout);
|
|
1322
1329
|
}
|
|
1323
|
-
runCallBack = statusFromProps => {
|
|
1324
|
-
const {
|
|
1325
|
-
onAnimationCompleted
|
|
1326
|
-
} = this.props;
|
|
1327
|
-
if (onAnimationCompleted) {
|
|
1328
|
-
this.timeouts = setTimeout(() => {
|
|
1329
|
-
onAnimationCompleted(statusFromProps);
|
|
1330
|
-
}, ANIMATION_DURATION_IN_MS);
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
1330
|
render() {
|
|
1334
1331
|
const {
|
|
1335
1332
|
className,
|
|
@@ -1360,28 +1357,13 @@ class ProcessIndicator extends React.Component {
|
|
|
1360
1357
|
className: "process-circle",
|
|
1361
1358
|
cx: "50%",
|
|
1362
1359
|
cy: "50%",
|
|
1363
|
-
r: radius[
|
|
1360
|
+
r: radius[size],
|
|
1364
1361
|
fillOpacity: "0.0"
|
|
1365
1362
|
})
|
|
1366
1363
|
})]
|
|
1367
1364
|
});
|
|
1368
1365
|
}
|
|
1369
1366
|
}
|
|
1370
|
-
ProcessIndicator.propTypes = {
|
|
1371
|
-
status: PropTypes__default.default.oneOf(['processing', 'failed', 'succeeded', 'hidden']),
|
|
1372
|
-
size: PropTypes__default.default.oneOf(['xxs', 'xs', 'sm', 'xl']),
|
|
1373
|
-
onAnimationCompleted: PropTypes__default.default.func,
|
|
1374
|
-
className: PropTypes__default.default.string,
|
|
1375
|
-
'data-testid': PropTypes__default.default.string
|
|
1376
|
-
};
|
|
1377
|
-
ProcessIndicator.defaultProps = {
|
|
1378
|
-
status: exports.Status.PROCESSING,
|
|
1379
|
-
size: exports.Size.SMALL,
|
|
1380
|
-
onAnimationCompleted: null,
|
|
1381
|
-
className: undefined,
|
|
1382
|
-
'data-testid': null
|
|
1383
|
-
};
|
|
1384
|
-
var ProcessIndicator$1 = ProcessIndicator;
|
|
1385
1367
|
|
|
1386
1368
|
var messages$b = reactIntl.defineMessages({
|
|
1387
1369
|
loadingAriaLabel: {
|
|
@@ -1503,7 +1485,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
1503
1485
|
...props,
|
|
1504
1486
|
"aria-live": loading ? 'polite' : 'off',
|
|
1505
1487
|
"aria-label": loading ? intl.formatMessage(messages$b.loadingAriaLabel) : rest['aria-label'],
|
|
1506
|
-
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
1488
|
+
children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
1507
1489
|
size: processIndicatorSize(),
|
|
1508
1490
|
className: "btn-loader"
|
|
1509
1491
|
})]
|
|
@@ -2163,9 +2145,8 @@ const useHasIntersected = ({
|
|
|
2163
2145
|
return [hasIntersected];
|
|
2164
2146
|
};
|
|
2165
2147
|
|
|
2166
|
-
// eslint-disable-next-line import/extensions
|
|
2167
2148
|
function useMedia(query) {
|
|
2168
|
-
return
|
|
2149
|
+
return React.useSyncExternalStore(onStoreChange => {
|
|
2169
2150
|
const mediaQueryList = window.matchMedia(query);
|
|
2170
2151
|
mediaQueryList.addEventListener('change', onStoreChange);
|
|
2171
2152
|
return () => {
|
|
@@ -2243,7 +2224,7 @@ const Drawer = ({
|
|
|
2243
2224
|
const {
|
|
2244
2225
|
isMobile
|
|
2245
2226
|
} = useLayout();
|
|
2246
|
-
const titleId =
|
|
2227
|
+
const titleId = React.useId();
|
|
2247
2228
|
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
2248
2229
|
open: open,
|
|
2249
2230
|
onClose: onClose,
|
|
@@ -2285,12 +2266,12 @@ Drawer.propTypes = {
|
|
|
2285
2266
|
footerContent: PropTypes__default.default.node,
|
|
2286
2267
|
/** The content to appear in the drawer header. */
|
|
2287
2268
|
headerTitle: PropTypes__default.default.node,
|
|
2288
|
-
/** The action to perform on close click. */
|
|
2289
|
-
onClose: PropTypes__default.default.func,
|
|
2290
2269
|
/** The status of Drawer either open or not. */
|
|
2291
2270
|
open: PropTypes__default.default.bool,
|
|
2292
2271
|
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
2293
|
-
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom'])
|
|
2272
|
+
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom']),
|
|
2273
|
+
/** The action to perform on close click. */
|
|
2274
|
+
onClose: PropTypes__default.default.func
|
|
2294
2275
|
};
|
|
2295
2276
|
Drawer.defaultProps = {
|
|
2296
2277
|
children: null,
|
|
@@ -2998,7 +2979,7 @@ const fallbackPlacements = {
|
|
|
2998
2979
|
[exports.Position.LEFT]: [exports.Position.RIGHT, exports.Position.TOP, exports.Position.BOTTOM],
|
|
2999
2980
|
[exports.Position.RIGHT]: [exports.Position.LEFT, exports.Position.TOP, exports.Position.BOTTOM]
|
|
3000
2981
|
};
|
|
3001
|
-
const Panel = /*#__PURE__*/React.forwardRef(({
|
|
2982
|
+
const Panel = /*#__PURE__*/React.forwardRef(function Panel({
|
|
3002
2983
|
arrow = false,
|
|
3003
2984
|
flip = true,
|
|
3004
2985
|
altAxis = false,
|
|
@@ -3009,7 +2990,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3009
2990
|
anchorRef,
|
|
3010
2991
|
anchorWidth = false,
|
|
3011
2992
|
...rest
|
|
3012
|
-
}, reference)
|
|
2993
|
+
}, reference) {
|
|
3013
2994
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
3014
2995
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
3015
2996
|
const modifiers = [];
|
|
@@ -3087,7 +3068,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3087
3068
|
...attributes.popper,
|
|
3088
3069
|
className: classNames__default.default('np-panel', {
|
|
3089
3070
|
'np-panel--open': open
|
|
3090
|
-
}, rest
|
|
3071
|
+
}, rest.className),
|
|
3091
3072
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3092
3073
|
ref: reference
|
|
3093
3074
|
/* eslint-disable-next-line react/forbid-dom-props */,
|
|
@@ -3106,7 +3087,7 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3106
3087
|
});
|
|
3107
3088
|
var Panel$1 = Panel;
|
|
3108
3089
|
|
|
3109
|
-
const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
3090
|
+
const ResponsivePanel = /*#__PURE__*/React.forwardRef(function ResponsivePanel({
|
|
3110
3091
|
anchorRef,
|
|
3111
3092
|
arrow = false,
|
|
3112
3093
|
flip = true,
|
|
@@ -3115,7 +3096,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3115
3096
|
onClose,
|
|
3116
3097
|
open = false,
|
|
3117
3098
|
position = exports.Position.BOTTOM
|
|
3118
|
-
}, reference)
|
|
3099
|
+
}, reference) {
|
|
3119
3100
|
const {
|
|
3120
3101
|
isMobile
|
|
3121
3102
|
} = useLayout();
|
|
@@ -4468,6 +4449,84 @@ const Emphasis = ({
|
|
|
4468
4449
|
}) : null;
|
|
4469
4450
|
};
|
|
4470
4451
|
|
|
4452
|
+
function InlineAlert({
|
|
4453
|
+
id,
|
|
4454
|
+
type = 'neutral',
|
|
4455
|
+
className,
|
|
4456
|
+
children
|
|
4457
|
+
}) {
|
|
4458
|
+
const danger = type === 'negative' || type === 'error';
|
|
4459
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4460
|
+
role: "alert",
|
|
4461
|
+
id: id,
|
|
4462
|
+
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4463
|
+
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4464
|
+
children: children
|
|
4465
|
+
})]
|
|
4466
|
+
});
|
|
4467
|
+
}
|
|
4468
|
+
|
|
4469
|
+
const Label = ({
|
|
4470
|
+
id,
|
|
4471
|
+
htmlFor,
|
|
4472
|
+
className,
|
|
4473
|
+
children
|
|
4474
|
+
}) => {
|
|
4475
|
+
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
4476
|
+
id: id,
|
|
4477
|
+
htmlFor: htmlFor,
|
|
4478
|
+
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4479
|
+
children: children
|
|
4480
|
+
});
|
|
4481
|
+
};
|
|
4482
|
+
|
|
4483
|
+
const Field = ({
|
|
4484
|
+
id,
|
|
4485
|
+
label,
|
|
4486
|
+
hint,
|
|
4487
|
+
error,
|
|
4488
|
+
className,
|
|
4489
|
+
children
|
|
4490
|
+
}) => {
|
|
4491
|
+
const hasError = Boolean(error);
|
|
4492
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
4493
|
+
const labelId = React.useId();
|
|
4494
|
+
const fallbackInputId = React.useId();
|
|
4495
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
4496
|
+
const descriptionId = React.useId();
|
|
4497
|
+
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
4498
|
+
value: labelId,
|
|
4499
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
4500
|
+
value: inputId,
|
|
4501
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
4502
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
4503
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
4504
|
+
value: hasError,
|
|
4505
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4506
|
+
className: classNames__default.default('form-group d-block', {
|
|
4507
|
+
'has-error': hasError,
|
|
4508
|
+
'has-info': hasHint
|
|
4509
|
+
}, className),
|
|
4510
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
4511
|
+
id: labelId,
|
|
4512
|
+
htmlFor: inputId,
|
|
4513
|
+
children: [label, children]
|
|
4514
|
+
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
4515
|
+
type: exports.Sentiment.NEUTRAL,
|
|
4516
|
+
id: descriptionId,
|
|
4517
|
+
children: hint
|
|
4518
|
+
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
4519
|
+
type: exports.Sentiment.NEGATIVE,
|
|
4520
|
+
id: descriptionId,
|
|
4521
|
+
children: error
|
|
4522
|
+
})]
|
|
4523
|
+
})
|
|
4524
|
+
})
|
|
4525
|
+
})
|
|
4526
|
+
})
|
|
4527
|
+
});
|
|
4528
|
+
};
|
|
4529
|
+
|
|
4471
4530
|
const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
|
|
4472
4531
|
bottomContent,
|
|
4473
4532
|
className,
|
|
@@ -4674,7 +4733,7 @@ const Tooltip = ({
|
|
|
4674
4733
|
const anchorReference = React.useRef(null);
|
|
4675
4734
|
const [arrowElement, setArrowElement] = React.useState(null);
|
|
4676
4735
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
4677
|
-
const fallbackId =
|
|
4736
|
+
const fallbackId = React.useId();
|
|
4678
4737
|
const tooltipId = id ?? fallbackId;
|
|
4679
4738
|
const modifiers = [];
|
|
4680
4739
|
modifiers.push({
|
|
@@ -4714,42 +4773,40 @@ const Tooltip = ({
|
|
|
4714
4773
|
forceUpdate();
|
|
4715
4774
|
}
|
|
4716
4775
|
}, [open]);
|
|
4717
|
-
return /*#__PURE__*/jsxRuntime.
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
})]
|
|
4752
|
-
})
|
|
4776
|
+
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
4777
|
+
ref: anchorReference,
|
|
4778
|
+
className: "tw-tooltip-container",
|
|
4779
|
+
onMouseOver: () => setOpen(true),
|
|
4780
|
+
onFocus: () => setOpen(true),
|
|
4781
|
+
onMouseOut: () => setOpen(false),
|
|
4782
|
+
onBlur: () => setOpen(false),
|
|
4783
|
+
children: [children ? /*#__PURE__*/React.cloneElement(children, {
|
|
4784
|
+
'aria-describedby': `${tooltipId}-tooltip`
|
|
4785
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4786
|
+
// @ts-expect-error
|
|
4787
|
+
ref: setPopperElement,
|
|
4788
|
+
className: classNames__default.default('np-tooltip', 'np-panel', open ? `np-panel--open np-tooltip--open` : null, className)
|
|
4789
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
4790
|
+
,
|
|
4791
|
+
style: {
|
|
4792
|
+
...styles.popper
|
|
4793
|
+
},
|
|
4794
|
+
...attributes.popper,
|
|
4795
|
+
"aria-hidden": !open,
|
|
4796
|
+
role: "tooltip",
|
|
4797
|
+
id: `${tooltipId}-tooltip`,
|
|
4798
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4799
|
+
className: "np-panel__content tooltip-inner",
|
|
4800
|
+
children: [label, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4801
|
+
// @ts-expect-error
|
|
4802
|
+
ref: setArrowElement,
|
|
4803
|
+
className: classNames__default.default('np-panel__arrow')
|
|
4804
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
4805
|
+
,
|
|
4806
|
+
style: styles.arrow
|
|
4807
|
+
})]
|
|
4808
|
+
})
|
|
4809
|
+
})]
|
|
4753
4810
|
});
|
|
4754
4811
|
};
|
|
4755
4812
|
|
|
@@ -4947,84 +5004,6 @@ const FlowNavigation = ({
|
|
|
4947
5004
|
});
|
|
4948
5005
|
};
|
|
4949
5006
|
|
|
4950
|
-
function InlineAlert({
|
|
4951
|
-
id,
|
|
4952
|
-
type = 'neutral',
|
|
4953
|
-
className,
|
|
4954
|
-
children
|
|
4955
|
-
}) {
|
|
4956
|
-
const danger = type === 'negative' || type === 'error';
|
|
4957
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4958
|
-
role: "alert",
|
|
4959
|
-
id: id,
|
|
4960
|
-
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4961
|
-
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4962
|
-
children: children
|
|
4963
|
-
})]
|
|
4964
|
-
});
|
|
4965
|
-
}
|
|
4966
|
-
|
|
4967
|
-
const Label = ({
|
|
4968
|
-
id,
|
|
4969
|
-
htmlFor,
|
|
4970
|
-
className,
|
|
4971
|
-
children
|
|
4972
|
-
}) => {
|
|
4973
|
-
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
4974
|
-
id: id,
|
|
4975
|
-
htmlFor: htmlFor,
|
|
4976
|
-
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4977
|
-
children: children
|
|
4978
|
-
});
|
|
4979
|
-
};
|
|
4980
|
-
|
|
4981
|
-
const Field = ({
|
|
4982
|
-
id,
|
|
4983
|
-
label,
|
|
4984
|
-
hint,
|
|
4985
|
-
error,
|
|
4986
|
-
className,
|
|
4987
|
-
children
|
|
4988
|
-
}) => {
|
|
4989
|
-
const hasError = Boolean(error);
|
|
4990
|
-
const hasHint = Boolean(hint) && !hasError;
|
|
4991
|
-
const labelId = reactId.useId();
|
|
4992
|
-
const fallbackInputId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
4993
|
-
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
4994
|
-
const descriptionId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
4995
|
-
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
4996
|
-
value: labelId,
|
|
4997
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
4998
|
-
value: inputId,
|
|
4999
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5000
|
-
value: hasError || hasHint ? descriptionId : undefined,
|
|
5001
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5002
|
-
value: hasError,
|
|
5003
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5004
|
-
className: classNames__default.default('form-group d-block', {
|
|
5005
|
-
'has-error': hasError,
|
|
5006
|
-
'has-info': hasHint
|
|
5007
|
-
}, className),
|
|
5008
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
5009
|
-
id: labelId,
|
|
5010
|
-
htmlFor: inputId,
|
|
5011
|
-
children: [label, children]
|
|
5012
|
-
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5013
|
-
type: exports.Sentiment.NEUTRAL,
|
|
5014
|
-
id: descriptionId,
|
|
5015
|
-
children: hint
|
|
5016
|
-
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5017
|
-
type: exports.Sentiment.NEGATIVE,
|
|
5018
|
-
id: descriptionId,
|
|
5019
|
-
children: error
|
|
5020
|
-
})]
|
|
5021
|
-
})
|
|
5022
|
-
})
|
|
5023
|
-
})
|
|
5024
|
-
})
|
|
5025
|
-
});
|
|
5026
|
-
};
|
|
5027
|
-
|
|
5028
5007
|
const HeaderAction = ({
|
|
5029
5008
|
action
|
|
5030
5009
|
}) => {
|
|
@@ -5160,7 +5139,7 @@ const Modal = ({
|
|
|
5160
5139
|
const isCompact = checkSpecialClasses('compact');
|
|
5161
5140
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5162
5141
|
const contentReference = React.useRef(null);
|
|
5163
|
-
const titleId =
|
|
5142
|
+
const titleId = React.useId();
|
|
5164
5143
|
return !isMedium ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5165
5144
|
open: open,
|
|
5166
5145
|
headerTitle: title,
|
|
@@ -5673,10 +5652,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
5673
5652
|
return 'Backspace';
|
|
5674
5653
|
}
|
|
5675
5654
|
return triggerEvent.key;
|
|
5676
|
-
} else {
|
|
5677
|
-
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
5678
|
-
return 'Paste';
|
|
5679
5655
|
}
|
|
5656
|
+
// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
|
|
5657
|
+
return 'Paste';
|
|
5680
5658
|
};
|
|
5681
5659
|
resetEvent = () => {
|
|
5682
5660
|
this.setState({
|
|
@@ -5829,11 +5807,10 @@ class WithDisplayFormat extends React.Component {
|
|
|
5829
5807
|
selectionEnd,
|
|
5830
5808
|
pastedLength
|
|
5831
5809
|
} = this.state;
|
|
5810
|
+
const target = triggerEvent?.currentTarget;
|
|
5832
5811
|
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
5833
5812
|
setTimeout(() => {
|
|
5834
|
-
|
|
5835
|
-
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
5836
|
-
}
|
|
5813
|
+
target?.setSelectionRange(cursorPosition, cursorPosition);
|
|
5837
5814
|
this.setState({
|
|
5838
5815
|
selectionStart: cursorPosition,
|
|
5839
5816
|
selectionEnd: cursorPosition
|
|
@@ -6513,8 +6490,8 @@ function SelectInputOptions({
|
|
|
6513
6490
|
}
|
|
6514
6491
|
}, []);
|
|
6515
6492
|
const showStatus = resultsEmpty;
|
|
6516
|
-
const statusId =
|
|
6517
|
-
const listboxId =
|
|
6493
|
+
const statusId = React.useId();
|
|
6494
|
+
const listboxId = React.useId();
|
|
6518
6495
|
return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
|
|
6519
6496
|
as: SelectInputOptionsContainer,
|
|
6520
6497
|
static: true,
|
|
@@ -6641,7 +6618,7 @@ function SelectInputGroupItemView({
|
|
|
6641
6618
|
renderValue,
|
|
6642
6619
|
needle
|
|
6643
6620
|
}) {
|
|
6644
|
-
const headerId =
|
|
6621
|
+
const headerId = React.useId();
|
|
6645
6622
|
return (
|
|
6646
6623
|
/*#__PURE__*/
|
|
6647
6624
|
// An empty container may be rendered when no options match `needle`
|
|
@@ -9104,7 +9081,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
9104
9081
|
setChecked(!checked); // Update local state for checkbox
|
|
9105
9082
|
}
|
|
9106
9083
|
};
|
|
9107
|
-
const fallbackId =
|
|
9084
|
+
const fallbackId = React.useId();
|
|
9108
9085
|
const componentId = id || fallbackId;
|
|
9109
9086
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
9110
9087
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
@@ -12328,7 +12305,7 @@ const ProcessingStep = props => {
|
|
|
12328
12305
|
"aria-hidden": isComplete,
|
|
12329
12306
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12330
12307
|
className: "droppable-card-content",
|
|
12331
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
12308
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
12332
12309
|
size: exports.Size.Small,
|
|
12333
12310
|
status: processStatus,
|
|
12334
12311
|
onAnimationCompleted: status => onAnimationCompleted(status)
|
|
@@ -13151,7 +13128,7 @@ const UploadItem = ({
|
|
|
13151
13128
|
switch (status) {
|
|
13152
13129
|
case exports.Status.PROCESSING:
|
|
13153
13130
|
case exports.Status.PENDING:
|
|
13154
|
-
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13131
|
+
processIndicator = /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13155
13132
|
size: exports.Size.EXTRA_SMALL,
|
|
13156
13133
|
status: exports.Status.PROCESSING
|
|
13157
13134
|
});
|
|
@@ -13162,7 +13139,7 @@ const UploadItem = ({
|
|
|
13162
13139
|
processIndicator = isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
13163
13140
|
size: exports.Size.SMALL,
|
|
13164
13141
|
sentiment: exports.Sentiment.POSITIVE
|
|
13165
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator
|
|
13142
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator, {
|
|
13166
13143
|
size: exports.Size.EXTRA_SMALL,
|
|
13167
13144
|
status: exports.Status.SUCCEEDED
|
|
13168
13145
|
});
|
|
@@ -13177,7 +13154,7 @@ const UploadItem = ({
|
|
|
13177
13154
|
children: processIndicator
|
|
13178
13155
|
}); // Scale down ProcessIndicator to be 20px*20px to match `icons`
|
|
13179
13156
|
};
|
|
13180
|
-
const getErrorMessage = () => typeof error === 'object'
|
|
13157
|
+
const getErrorMessage = () => typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);
|
|
13181
13158
|
const getDescription = () => {
|
|
13182
13159
|
if (error || status === exports.Status.FAILED) {
|
|
13183
13160
|
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
@@ -14573,7 +14550,7 @@ exports.Option = Option$2;
|
|
|
14573
14550
|
exports.OverlayHeader = OverlayHeader$1;
|
|
14574
14551
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
14575
14552
|
exports.Popover = Popover$1;
|
|
14576
|
-
exports.ProcessIndicator = ProcessIndicator
|
|
14553
|
+
exports.ProcessIndicator = ProcessIndicator;
|
|
14577
14554
|
exports.Progress = Progress;
|
|
14578
14555
|
exports.ProgressBar = ProgressBar;
|
|
14579
14556
|
exports.PromoCard = PromoCard$1;
|