@transferwise/components 46.28.0 → 46.29.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/i18n/hu.json +1 -1
- package/build/index.js +141 -686
- package/build/index.js.map +1 -1
- package/build/index.mjs +144 -686
- package/build/index.mjs.map +1 -1
- package/build/main.css +16 -5
- package/build/styles/logo/Logo.css +16 -0
- package/build/styles/main.css +16 -5
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/common/hooks/index.d.ts +0 -1
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts +2 -2
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/stepper/deviceDetection.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/package.json +10 -8
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/alert/Alert.tsx +2 -1
- package/src/avatar/colors/colors.ts +1 -1
- package/src/body/Body.spec.tsx +1 -1
- package/src/body/Body.story.tsx +8 -8
- package/src/checkbox/Checkbox.js +1 -1
- package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
- package/src/common/Option/Option.tsx +1 -1
- package/src/common/deviceDetection/deviceDetection.js +1 -1
- package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
- package/src/common/hooks/index.js +0 -1
- package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
- package/src/decision/Decision.spec.js +0 -2
- package/src/dimmer/Dimmer.tsx +6 -2
- package/src/flowNavigation/FlowNavigation.spec.js +7 -22
- package/src/flowNavigation/FlowNavigation.tsx +20 -33
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
- package/src/i18n/hu.json +1 -1
- package/src/index.ts +0 -1
- package/src/inlineAlert/InlineAlert.story.tsx +8 -7
- package/src/inputs/SelectInput.tsx +1 -0
- package/src/inputs/_BottomSheet.tsx +33 -28
- package/src/inputs/_Popover.tsx +23 -20
- package/src/link/Link.story.tsx +16 -16
- package/src/loader/Loader.tsx +0 -1
- package/src/logo/Logo.css +16 -0
- package/src/logo/Logo.js +4 -9
- package/src/logo/Logo.less +16 -0
- package/src/logo/__snapshots__/Logo.spec.js.snap +104 -8
- package/src/main.css +16 -5
- package/src/main.less +0 -1
- package/src/moneyInput/MoneyInput.story.tsx +3 -3
- package/src/nudge/Nudge.spec.tsx +5 -5
- package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
- package/src/popover/Popover.tsx +2 -1
- package/src/promoCard/PromoCard.tsx +1 -1
- package/src/provider/theme/ThemeProvider.story.tsx +21 -0
- package/src/radioGroup/RadioGroup.spec.js +1 -1
- package/src/section/Section.story.tsx +2 -1
- package/src/segmentedControl/SegmentedControl.spec.tsx +88 -2
- package/src/segmentedControl/SegmentedControl.story.tsx +54 -16
- package/src/segmentedControl/SegmentedControl.tsx +21 -33
- package/src/select/Select.js +2 -3
- package/src/stepper/deviceDetection.js +1 -2
- package/src/stepper/deviceDetection.spec.js +8 -3
- package/src/test-utils/index.js +1 -1
- package/src/test-utils/story-config.ts +1 -1
- package/src/title/Title.spec.tsx +1 -1
- package/src/typeahead/Typeahead.spec.js +4 -2
- package/src/upload/Upload.spec.js +8 -4
- package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
- package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
- package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
- package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
- package/build/types/common/requirements.d.ts +0 -3
- package/build/types/common/requirements.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts +0 -21
- package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts +0 -12
- package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts +0 -2
- package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/index.d.ts +0 -2
- package/build/types/dynamicFieldDefinitionList/index.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts +0 -2
- package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts.map +0 -1
- package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts +0 -2
- package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts.map +0 -1
- package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
- package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
- package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +0 -41
- package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.spec.js +0 -21
- package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.story.js +0 -134
- package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
- package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +0 -73
- package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.less +0 -4
- package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.spec.js +0 -200
- package/src/dynamicFieldDefinitionList/FormattedValue/index.js +0 -1
- package/src/dynamicFieldDefinitionList/index.js +0 -1
- package/src/dynamicFieldDefinitionList/utils/createDefinitions.js +0 -33
- package/src/dynamicFieldDefinitionList/utils/createDefinitions.spec.js +0 -83
- package/src/dynamicFieldDefinitionList/utils/text-format.js +0 -46
- package/src/dynamicFieldDefinitionList/utils/text-format.spec.js +0 -43
package/build/index.mjs
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback, createContext, useContext, useImperativeHandle, createElement, Component, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useId } from '@radix-ui/react-id';
|
|
6
6
|
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import commonmark from 'commonmark';
|
|
10
10
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
11
|
-
import { formatDate,
|
|
11
|
+
import { formatDate, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
12
12
|
import { Transition, Listbox } from '@headlessui/react';
|
|
13
13
|
import mergeProps from 'merge-props';
|
|
14
14
|
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
|
|
15
15
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
16
|
+
import { FocusScope } from '@react-aria/focus';
|
|
16
17
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
17
18
|
import { CSSTransition } from 'react-transition-group';
|
|
18
19
|
import { isUndefined, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
19
20
|
import { createPortal } from 'react-dom';
|
|
20
|
-
import { FocusScope } from '@react-aria/focus';
|
|
21
21
|
import { usePopper } from 'react-popper';
|
|
22
|
-
import throttle from 'lodash.throttle';
|
|
23
22
|
import { Flag, Illustration } from '@wise/art';
|
|
24
23
|
import clamp$2 from 'lodash.clamp';
|
|
25
24
|
import debounce from 'lodash.debounce';
|
|
26
25
|
import requiredIf from 'react-required-if';
|
|
27
|
-
import toPairs from 'lodash.topairs';
|
|
28
26
|
import { Spring, animated } from '@react-spring/web';
|
|
29
27
|
|
|
30
28
|
class HistoryNavigator {
|
|
@@ -63,7 +61,7 @@ var HistoryNavigator$1 = HistoryNavigator;
|
|
|
63
61
|
function isIosDevice() {
|
|
64
62
|
const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
|
|
65
63
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
66
|
-
const regex = new RegExp(matchString, '
|
|
64
|
+
const regex = new RegExp(matchString, 'gi');
|
|
67
65
|
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
68
66
|
}
|
|
69
67
|
|
|
@@ -909,8 +907,9 @@ function resolveType(type) {
|
|
|
909
907
|
return 'neutral';
|
|
910
908
|
case 'error':
|
|
911
909
|
return 'negative';
|
|
910
|
+
default:
|
|
911
|
+
return type;
|
|
912
912
|
}
|
|
913
|
-
return type;
|
|
914
913
|
}
|
|
915
914
|
function Alert({
|
|
916
915
|
arrow,
|
|
@@ -1056,7 +1055,7 @@ const hashSeed = seed => {
|
|
|
1056
1055
|
const modulo = avatarColors.length;
|
|
1057
1056
|
let hashValue = 0;
|
|
1058
1057
|
let basePow = 1;
|
|
1059
|
-
for (let i = 0; i < seed.length; i
|
|
1058
|
+
for (let i = 0; i < seed.length; i += 1) {
|
|
1060
1059
|
hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
|
|
1061
1060
|
basePow = basePow * base % modulo;
|
|
1062
1061
|
}
|
|
@@ -1348,11 +1347,15 @@ const Dimmer = ({
|
|
|
1348
1347
|
}, [onClose]);
|
|
1349
1348
|
const onEnter = () => {
|
|
1350
1349
|
setHasNotExited(true);
|
|
1351
|
-
|
|
1350
|
+
if (dimmerReference.current) {
|
|
1351
|
+
dimmerManager.add(dimmerReference.current);
|
|
1352
|
+
}
|
|
1352
1353
|
};
|
|
1353
1354
|
const onExited = () => {
|
|
1354
1355
|
setHasNotExited(false);
|
|
1355
|
-
|
|
1356
|
+
if (dimmerReference.current) {
|
|
1357
|
+
dimmerManager.remove(dimmerReference.current);
|
|
1358
|
+
}
|
|
1356
1359
|
};
|
|
1357
1360
|
useEffect(() => {
|
|
1358
1361
|
const localReferenceCopy = dimmerReference.current;
|
|
@@ -1455,41 +1458,6 @@ const DimmerContentWrapper = ({
|
|
|
1455
1458
|
};
|
|
1456
1459
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1457
1460
|
|
|
1458
|
-
const THROTTLE_MS = 100;
|
|
1459
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1460
|
-
const useClientWidth = ({
|
|
1461
|
-
ref,
|
|
1462
|
-
throttleMs = THROTTLE_MS
|
|
1463
|
-
}) => {
|
|
1464
|
-
const [clientWidth, setClientWidth] = useState(null);
|
|
1465
|
-
useIsomorphicLayoutEffect(() => {
|
|
1466
|
-
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1467
|
-
const updateClientWidth = () => {
|
|
1468
|
-
if (ref) {
|
|
1469
|
-
// when `ref` is a window
|
|
1470
|
-
if ('innerWidth' in ref) {
|
|
1471
|
-
setClientWidth(ref.innerWidth);
|
|
1472
|
-
}
|
|
1473
|
-
// when `ref` is an element
|
|
1474
|
-
else if (ref.current) {
|
|
1475
|
-
setClientWidth(ref.current.clientWidth);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
};
|
|
1479
|
-
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1480
|
-
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1481
|
-
// won't get removed even if the component is unmounted.
|
|
1482
|
-
const attachedFunction = throttle(updateClientWidth, throttleMs);
|
|
1483
|
-
window.addEventListener('resize', attachedFunction, true);
|
|
1484
|
-
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1485
|
-
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1486
|
-
window.requestAnimationFrame(updateClientWidth);
|
|
1487
|
-
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1488
|
-
}, []);
|
|
1489
|
-
return [clientWidth];
|
|
1490
|
-
};
|
|
1491
|
-
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1492
|
-
|
|
1493
1461
|
const useConditionalListener = ({
|
|
1494
1462
|
attachListener,
|
|
1495
1463
|
callback,
|
|
@@ -4327,508 +4295,6 @@ const DropFade = ({
|
|
|
4327
4295
|
});
|
|
4328
4296
|
};
|
|
4329
4297
|
|
|
4330
|
-
/* eslint-disable no-unused-vars */
|
|
4331
|
-
/* eslint-disable no-param-reassign */
|
|
4332
|
-
|
|
4333
|
-
const prepFields = (fields, model, validationMessages) => {
|
|
4334
|
-
if (!fields) {
|
|
4335
|
-
return {};
|
|
4336
|
-
}
|
|
4337
|
-
let preparedFields = copyOf(fields);
|
|
4338
|
-
preparedFields = flattenFieldsWithGroups(preparedFields);
|
|
4339
|
-
preparedFields = transformFieldArrayToMap(preparedFields);
|
|
4340
|
-
preparedFields = transformNestedKeysToNestedSpecs(preparedFields);
|
|
4341
|
-
Object.keys(preparedFields).forEach(key => {
|
|
4342
|
-
preparedFields[key] = prepField(preparedFields[key], model, validationMessages);
|
|
4343
|
-
});
|
|
4344
|
-
return preparedFields;
|
|
4345
|
-
};
|
|
4346
|
-
const prepField = (field, model, validationMessages) => {
|
|
4347
|
-
const preparedField = copyOf(field);
|
|
4348
|
-
prepLegacyProps(preparedField);
|
|
4349
|
-
prepType(preparedField);
|
|
4350
|
-
prepPattern(preparedField);
|
|
4351
|
-
prepValidationMessages(preparedField, validationMessages);
|
|
4352
|
-
return preparedField;
|
|
4353
|
-
};
|
|
4354
|
-
|
|
4355
|
-
/**
|
|
4356
|
-
* In an older format we had an extra fieldGroup level, here we flatten that out
|
|
4357
|
-
* So the inner arrays of fields within the different field groups are flattened
|
|
4358
|
-
* to a single array, which is returned.
|
|
4359
|
-
*
|
|
4360
|
-
* @param fields
|
|
4361
|
-
*/
|
|
4362
|
-
const flattenFieldsWithGroups = fields => {
|
|
4363
|
-
if (Array.isArray(fields)) {
|
|
4364
|
-
let flattenedFields = [];
|
|
4365
|
-
fields.forEach(field => {
|
|
4366
|
-
// If we've been given a group with nested fields, break them out.
|
|
4367
|
-
if (field.fields) {
|
|
4368
|
-
flattenedFields = flattenedFields.concat(flattenFieldWithGroup(field, field.fields));
|
|
4369
|
-
} else if (field.group) {
|
|
4370
|
-
flattenedFields = flattenedFields.concat(flattenFieldWithGroup(field, field.group));
|
|
4371
|
-
} else {
|
|
4372
|
-
// Otherwise it's a regular field, just add it.
|
|
4373
|
-
flattenedFields.push(field);
|
|
4374
|
-
}
|
|
4375
|
-
});
|
|
4376
|
-
return flattenedFields;
|
|
4377
|
-
}
|
|
4378
|
-
return fields;
|
|
4379
|
-
};
|
|
4380
|
-
const flattenFieldWithGroup = (field, subFields) => {
|
|
4381
|
-
// If first field doesn't have a label, use the one from the group
|
|
4382
|
-
if (field.name && subFields.length > 0 && !subFields[0].name) {
|
|
4383
|
-
subFields[0].name = field.name;
|
|
4384
|
-
}
|
|
4385
|
-
if (field.width && subFields.length > 0 && !subFields[0].width) {
|
|
4386
|
-
subFields[0].width = field.width;
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
|
-
// If there was a tooltip at fieldGroup level move it to first field.
|
|
4390
|
-
if (field.tooltip && subFields.length > 0 && !subFields[0].help) {
|
|
4391
|
-
subFields[0].help = {
|
|
4392
|
-
message: field.tooltip
|
|
4393
|
-
};
|
|
4394
|
-
}
|
|
4395
|
-
if (field.info && subFields.length > 0 && !subFields[0].help) {
|
|
4396
|
-
subFields[0].help = {
|
|
4397
|
-
message: field.info
|
|
4398
|
-
};
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
// If there are two parts of this group, render them side by side
|
|
4402
|
-
if (subFields.length === 2) {
|
|
4403
|
-
subFields.forEach(nestedField => {
|
|
4404
|
-
nestedField.width = 'md';
|
|
4405
|
-
});
|
|
4406
|
-
}
|
|
4407
|
-
|
|
4408
|
-
// If there are three parts, render the first two side by side
|
|
4409
|
-
if (subFields.length === 3) {
|
|
4410
|
-
subFields[0].width = 'md';
|
|
4411
|
-
subFields[1].width = 'md';
|
|
4412
|
-
}
|
|
4413
|
-
return subFields;
|
|
4414
|
-
};
|
|
4415
|
-
|
|
4416
|
-
/*
|
|
4417
|
-
* Some older requirements return an array of fields, where it should be a map
|
|
4418
|
-
* from the property name to the spec. This converts arrays to maps.
|
|
4419
|
-
*/
|
|
4420
|
-
const transformFieldArrayToMap = fields => {
|
|
4421
|
-
if (Array.isArray(fields)) {
|
|
4422
|
-
const fieldMap = {};
|
|
4423
|
-
fields.forEach(field => {
|
|
4424
|
-
const key = field.key || field.name;
|
|
4425
|
-
delete field.key;
|
|
4426
|
-
fieldMap[key] = copyOf(field);
|
|
4427
|
-
});
|
|
4428
|
-
return fieldMap;
|
|
4429
|
-
}
|
|
4430
|
-
return fields;
|
|
4431
|
-
};
|
|
4432
|
-
|
|
4433
|
-
/*
|
|
4434
|
-
* Some older format return keys like 'address.city', expecting the value of
|
|
4435
|
-
* city to be nested inside an address object. This function creates a spec of
|
|
4436
|
-
* type 'object', and nests such fields inside of it. When we render we pass
|
|
4437
|
-
* this object spec to a nested fieldset.
|
|
4438
|
-
*/
|
|
4439
|
-
const transformNestedKeysToNestedSpecs = fieldMap => {
|
|
4440
|
-
if (Array.isArray(fieldMap)) {
|
|
4441
|
-
throw new TypeError('Expecting a map of fields, not an array');
|
|
4442
|
-
}
|
|
4443
|
-
const nestedFields = {};
|
|
4444
|
-
Object.keys(fieldMap).forEach(key => {
|
|
4445
|
-
if (key.indexOf('.') > 0) {
|
|
4446
|
-
// If the key contains a period we need to nest the fields in another object
|
|
4447
|
-
const pathSections = key.split('.');
|
|
4448
|
-
const nestedKey = pathSections[0];
|
|
4449
|
-
|
|
4450
|
-
// If this sub object doesn't exist yet, create it
|
|
4451
|
-
if (!nestedFields[nestedKey]) {
|
|
4452
|
-
nestedFields[nestedKey] = {
|
|
4453
|
-
type: 'object',
|
|
4454
|
-
properties: {}
|
|
4455
|
-
};
|
|
4456
|
-
}
|
|
4457
|
-
nestedFields[nestedKey].properties[pathSections[1]] = fieldMap[key];
|
|
4458
|
-
} else {
|
|
4459
|
-
nestedFields[key] = fieldMap[key];
|
|
4460
|
-
}
|
|
4461
|
-
});
|
|
4462
|
-
return nestedFields;
|
|
4463
|
-
};
|
|
4464
|
-
const prepType = field => {
|
|
4465
|
-
const type = field.type && field.type.toLowerCase && field.type.toLowerCase();
|
|
4466
|
-
switch (type) {
|
|
4467
|
-
case 'text':
|
|
4468
|
-
field.type = 'string';
|
|
4469
|
-
break;
|
|
4470
|
-
case 'date':
|
|
4471
|
-
field.type = 'string';
|
|
4472
|
-
field.format = 'date';
|
|
4473
|
-
break;
|
|
4474
|
-
case 'password':
|
|
4475
|
-
field.type = 'string';
|
|
4476
|
-
field.control = 'password';
|
|
4477
|
-
break;
|
|
4478
|
-
case 'checkbox':
|
|
4479
|
-
field.type = 'boolean';
|
|
4480
|
-
break;
|
|
4481
|
-
case 'select':
|
|
4482
|
-
if (!field.control) {
|
|
4483
|
-
field.control = 'select';
|
|
4484
|
-
}
|
|
4485
|
-
delete field.type;
|
|
4486
|
-
break;
|
|
4487
|
-
case 'radio':
|
|
4488
|
-
field.control = 'radio';
|
|
4489
|
-
delete field.type;
|
|
4490
|
-
break;
|
|
4491
|
-
case 'upload':
|
|
4492
|
-
field.type = 'string';
|
|
4493
|
-
field.format = 'base64url';
|
|
4494
|
-
break;
|
|
4495
|
-
case 'tel':
|
|
4496
|
-
field.type = 'string';
|
|
4497
|
-
field.format = 'phone';
|
|
4498
|
-
break;
|
|
4499
|
-
case 'textarea':
|
|
4500
|
-
field.type = 'string';
|
|
4501
|
-
field.control = 'textarea';
|
|
4502
|
-
break;
|
|
4503
|
-
}
|
|
4504
|
-
if (!field.control && field.type !== 'object') {
|
|
4505
|
-
field.control = getControlType(field);
|
|
4506
|
-
}
|
|
4507
|
-
};
|
|
4508
|
-
const prepLegacyProps = field => {
|
|
4509
|
-
if (field.name && !field.title) {
|
|
4510
|
-
field.title = field.name;
|
|
4511
|
-
delete field.name;
|
|
4512
|
-
}
|
|
4513
|
-
if (field.validationRegexp) {
|
|
4514
|
-
field.pattern = field.validationRegexp;
|
|
4515
|
-
delete field.validationRegexp;
|
|
4516
|
-
}
|
|
4517
|
-
if (field.min) {
|
|
4518
|
-
field.minimum = field.min;
|
|
4519
|
-
delete field.min;
|
|
4520
|
-
}
|
|
4521
|
-
if (field.max) {
|
|
4522
|
-
field.maximum = field.max;
|
|
4523
|
-
delete field.max;
|
|
4524
|
-
}
|
|
4525
|
-
if (field.example && !field.placeholder) {
|
|
4526
|
-
field.placeholder = field.example;
|
|
4527
|
-
delete field.example;
|
|
4528
|
-
}
|
|
4529
|
-
if (field.tooltip && !field.help) {
|
|
4530
|
-
field.help = {
|
|
4531
|
-
message: field.tooltip
|
|
4532
|
-
};
|
|
4533
|
-
delete field.tooltip;
|
|
4534
|
-
}
|
|
4535
|
-
if (field.valuesAllowed && !field.values) {
|
|
4536
|
-
field.values = field.valuesAllowed;
|
|
4537
|
-
delete field.valuesAllowed;
|
|
4538
|
-
}
|
|
4539
|
-
if (field.values && field.values.map) {
|
|
4540
|
-
field.values = prepLegacyValues(field.values);
|
|
4541
|
-
}
|
|
4542
|
-
if (field.value && !field.default) {
|
|
4543
|
-
field.default = field.value;
|
|
4544
|
-
delete field.value;
|
|
4545
|
-
}
|
|
4546
|
-
if (field.values) {
|
|
4547
|
-
// In some legacy arrays the first value is a placeholder, extract it.
|
|
4548
|
-
if (field.values && field.values.length > 0 && field.values[0] && !field.values[0].value && field.values[0].label && !field.placeholder) {
|
|
4549
|
-
field.placeholder = field.values[0].label;
|
|
4550
|
-
field.values = field.values.slice(1);
|
|
4551
|
-
}
|
|
4552
|
-
}
|
|
4553
|
-
};
|
|
4554
|
-
const prepLegacyValues = values => values.map(prepLegacyValue);
|
|
4555
|
-
const prepLegacyValue = value => {
|
|
4556
|
-
if (!value.label && value.title) {
|
|
4557
|
-
value.label = value.title;
|
|
4558
|
-
delete value.title;
|
|
4559
|
-
}
|
|
4560
|
-
if (!value.label && value.name) {
|
|
4561
|
-
value.label = value.name;
|
|
4562
|
-
delete value.name;
|
|
4563
|
-
}
|
|
4564
|
-
if (!value.value && value.code) {
|
|
4565
|
-
value.value = value.code;
|
|
4566
|
-
delete value.code;
|
|
4567
|
-
}
|
|
4568
|
-
if (!value.value && value.key) {
|
|
4569
|
-
value.value = value.key;
|
|
4570
|
-
delete value.key;
|
|
4571
|
-
}
|
|
4572
|
-
return value;
|
|
4573
|
-
};
|
|
4574
|
-
const prepPattern = field => {
|
|
4575
|
-
if (field.pattern) {
|
|
4576
|
-
try {
|
|
4577
|
-
new RegExp(field.pattern);
|
|
4578
|
-
} catch {
|
|
4579
|
-
// eslint-disable-next-line no-console
|
|
4580
|
-
console.warn('API regexp is invalid');
|
|
4581
|
-
delete field.pattern;
|
|
4582
|
-
}
|
|
4583
|
-
} else {
|
|
4584
|
-
delete field.pattern;
|
|
4585
|
-
}
|
|
4586
|
-
};
|
|
4587
|
-
const prepValidationMessages = (field, validationMessages) => {
|
|
4588
|
-
field.validationMessages = field.validationMessages ? field.validationMessages : validationMessages;
|
|
4589
|
-
if (!field.validationMessages) {
|
|
4590
|
-
delete field.validationMessages;
|
|
4591
|
-
return;
|
|
4592
|
-
}
|
|
4593
|
-
if (field.validationMessages.minimum) {
|
|
4594
|
-
field.validationMessages.min = field.validationMessages.minimum;
|
|
4595
|
-
delete field.validationMessages.minimum;
|
|
4596
|
-
}
|
|
4597
|
-
if (field.validationMessages.maximum) {
|
|
4598
|
-
field.validationMessages.max = field.validationMessages.maximum;
|
|
4599
|
-
delete field.validationMessages.maximum;
|
|
4600
|
-
}
|
|
4601
|
-
};
|
|
4602
|
-
const getControlType = field => {
|
|
4603
|
-
if (field.control) {
|
|
4604
|
-
return field.control.toLowerCase();
|
|
4605
|
-
}
|
|
4606
|
-
if (field.hidden) {
|
|
4607
|
-
return 'hidden';
|
|
4608
|
-
}
|
|
4609
|
-
if (field.values && field.values.length > 0) {
|
|
4610
|
-
return getSelectionType(field);
|
|
4611
|
-
}
|
|
4612
|
-
switch (field.type) {
|
|
4613
|
-
case 'string':
|
|
4614
|
-
return getControlForStringFormat(field.format);
|
|
4615
|
-
case 'number':
|
|
4616
|
-
case 'integer':
|
|
4617
|
-
return 'number';
|
|
4618
|
-
case 'boolean':
|
|
4619
|
-
return 'checkbox';
|
|
4620
|
-
default:
|
|
4621
|
-
return 'text';
|
|
4622
|
-
}
|
|
4623
|
-
};
|
|
4624
|
-
const getControlForStringFormat = format => {
|
|
4625
|
-
switch (format) {
|
|
4626
|
-
case 'date':
|
|
4627
|
-
return 'date';
|
|
4628
|
-
case 'base64url':
|
|
4629
|
-
return 'file';
|
|
4630
|
-
case 'password':
|
|
4631
|
-
return 'password';
|
|
4632
|
-
case 'uri':
|
|
4633
|
-
return 'text';
|
|
4634
|
-
// 'url'; - not implemented
|
|
4635
|
-
case 'email':
|
|
4636
|
-
return 'text';
|
|
4637
|
-
// 'email'; - not implemented
|
|
4638
|
-
case 'phone':
|
|
4639
|
-
return 'tel';
|
|
4640
|
-
default:
|
|
4641
|
-
return 'text';
|
|
4642
|
-
}
|
|
4643
|
-
};
|
|
4644
|
-
const getSelectionType = field => {
|
|
4645
|
-
if (field.control) {
|
|
4646
|
-
return field.control;
|
|
4647
|
-
}
|
|
4648
|
-
if (field.type === 'select') {
|
|
4649
|
-
return 'select';
|
|
4650
|
-
}
|
|
4651
|
-
if (field.type === 'radio') {
|
|
4652
|
-
return 'radio';
|
|
4653
|
-
}
|
|
4654
|
-
if (field.values) {
|
|
4655
|
-
return field.values.length > 3 ? 'select' : 'radio';
|
|
4656
|
-
}
|
|
4657
|
-
return 'select';
|
|
4658
|
-
};
|
|
4659
|
-
const copyOf = object => JSON.parse(JSON.stringify(object));
|
|
4660
|
-
|
|
4661
|
-
const formatUsingPattern = (value = '', pattern) => {
|
|
4662
|
-
if (typeof pattern !== 'string') {
|
|
4663
|
-
return value;
|
|
4664
|
-
}
|
|
4665
|
-
let newPattern = pattern;
|
|
4666
|
-
if (newPattern.indexOf('||') > 0) {
|
|
4667
|
-
newPattern = newPattern.slice(0, Math.max(0, pattern.indexOf('||')));
|
|
4668
|
-
}
|
|
4669
|
-
let newValue = '';
|
|
4670
|
-
let separators = 0;
|
|
4671
|
-
let charactersToAllocate = value.length;
|
|
4672
|
-
let position = 0;
|
|
4673
|
-
while (charactersToAllocate) {
|
|
4674
|
-
if (positionIsSeparator(newPattern, position)) {
|
|
4675
|
-
newValue += newPattern[position];
|
|
4676
|
-
separators += 1;
|
|
4677
|
-
} else {
|
|
4678
|
-
newValue += value[position - separators];
|
|
4679
|
-
charactersToAllocate -= 1;
|
|
4680
|
-
}
|
|
4681
|
-
position += 1;
|
|
4682
|
-
}
|
|
4683
|
-
const separatorsAfterCursor = countSeparatorsAfterCursor(newPattern, position);
|
|
4684
|
-
if (separatorsAfterCursor) {
|
|
4685
|
-
newValue += newPattern.slice(position, separatorsAfterCursor);
|
|
4686
|
-
}
|
|
4687
|
-
return newValue;
|
|
4688
|
-
};
|
|
4689
|
-
const countSeparatorsAfterCursor = (newPattern, position) => {
|
|
4690
|
-
let separators = 0;
|
|
4691
|
-
while (positionIsSeparator(newPattern, position + separators)) {
|
|
4692
|
-
separators += 1;
|
|
4693
|
-
}
|
|
4694
|
-
return separators;
|
|
4695
|
-
};
|
|
4696
|
-
const positionIsSeparator = (newPattern, position) => newPattern[position] && newPattern[position] !== '*';
|
|
4697
|
-
|
|
4698
|
-
const getValueLabel = (options, value) => {
|
|
4699
|
-
const option = options.find(currentOption => currentOption.value === value);
|
|
4700
|
-
return option && option.label ? option.label : value;
|
|
4701
|
-
};
|
|
4702
|
-
|
|
4703
|
-
/**
|
|
4704
|
-
*
|
|
4705
|
-
* @param {string} value
|
|
4706
|
-
*/
|
|
4707
|
-
const mask = value => new Array(value.length + 1).join('*');
|
|
4708
|
-
const FormattedValue = ({
|
|
4709
|
-
field,
|
|
4710
|
-
value
|
|
4711
|
-
}) => {
|
|
4712
|
-
const {
|
|
4713
|
-
locale
|
|
4714
|
-
} = useIntl();
|
|
4715
|
-
const style = [];
|
|
4716
|
-
if (field.tagClassName && field.tagClassName.h3) {
|
|
4717
|
-
style.push('np-text-body-large-bold');
|
|
4718
|
-
style.push('formatted-value__h3-custom-alignment');
|
|
4719
|
-
}
|
|
4720
|
-
switch (field.control) {
|
|
4721
|
-
case 'select':
|
|
4722
|
-
case 'radio':
|
|
4723
|
-
return /*#__PURE__*/jsx("span", {
|
|
4724
|
-
children: getValueLabel(field.values, value)
|
|
4725
|
-
});
|
|
4726
|
-
case 'date':
|
|
4727
|
-
return /*#__PURE__*/jsx("span", {
|
|
4728
|
-
children: formatDate(value instanceof Date ? value : new Date(value), locale)
|
|
4729
|
-
});
|
|
4730
|
-
case 'number':
|
|
4731
|
-
return /*#__PURE__*/jsx("span", {
|
|
4732
|
-
children: formatNumber(value, locale)
|
|
4733
|
-
});
|
|
4734
|
-
case 'password':
|
|
4735
|
-
return /*#__PURE__*/jsx("span", {
|
|
4736
|
-
children: mask(value)
|
|
4737
|
-
});
|
|
4738
|
-
case 'file':
|
|
4739
|
-
return /*#__PURE__*/jsx("div", {
|
|
4740
|
-
className: "thumbnail",
|
|
4741
|
-
children: /*#__PURE__*/jsx("img", {
|
|
4742
|
-
alt: field.title,
|
|
4743
|
-
src: value
|
|
4744
|
-
})
|
|
4745
|
-
});
|
|
4746
|
-
case 'checkbox':
|
|
4747
|
-
return /*#__PURE__*/jsx("span", {
|
|
4748
|
-
children: JSON.stringify(value)
|
|
4749
|
-
});
|
|
4750
|
-
default:
|
|
4751
|
-
return /*#__PURE__*/jsx("span", {
|
|
4752
|
-
className: classNames(style),
|
|
4753
|
-
children: formatUsingPattern(value, field.displayFormat)
|
|
4754
|
-
});
|
|
4755
|
-
}
|
|
4756
|
-
};
|
|
4757
|
-
FormattedValue.propTypes = {
|
|
4758
|
-
field: PropTypes.shape({
|
|
4759
|
-
control: PropTypes.string.isRequired,
|
|
4760
|
-
displayFormat: PropTypes.string,
|
|
4761
|
-
refreshRequirementsOnChange: PropTypes.bool,
|
|
4762
|
-
title: PropTypes.string.isRequired,
|
|
4763
|
-
type: PropTypes.string.isRequired,
|
|
4764
|
-
width: PropTypes.string,
|
|
4765
|
-
tagClassName: PropTypes.shape({
|
|
4766
|
-
h3: PropTypes.bool
|
|
4767
|
-
}),
|
|
4768
|
-
values: PropTypes.arrayOf(PropTypes.shape({
|
|
4769
|
-
value: PropTypes.any
|
|
4770
|
-
}))
|
|
4771
|
-
}).isRequired,
|
|
4772
|
-
value: PropTypes.any.isRequired
|
|
4773
|
-
};
|
|
4774
|
-
var FormattedValue$1 = FormattedValue;
|
|
4775
|
-
|
|
4776
|
-
function createDefinitions(fields, model) {
|
|
4777
|
-
return toPairs(fields).map(([name, field]) => createDefinition(name, field, model)).filter(definition => !!definition);
|
|
4778
|
-
}
|
|
4779
|
-
function createDefinition(name, field, model) {
|
|
4780
|
-
const {
|
|
4781
|
-
title,
|
|
4782
|
-
group,
|
|
4783
|
-
hidden
|
|
4784
|
-
} = field;
|
|
4785
|
-
if (!model[name] || hidden) {
|
|
4786
|
-
return null;
|
|
4787
|
-
}
|
|
4788
|
-
return {
|
|
4789
|
-
title,
|
|
4790
|
-
value: group ? group.map((groupField, groupFieldIndex) => /*#__PURE__*/jsx(FormattedValue$1, {
|
|
4791
|
-
// eslint-disable-line react/no-array-index-key
|
|
4792
|
-
field: groupField,
|
|
4793
|
-
value: model[name]
|
|
4794
|
-
}, groupFieldIndex)) : /*#__PURE__*/jsx(FormattedValue$1, {
|
|
4795
|
-
field: field,
|
|
4796
|
-
value: model[name]
|
|
4797
|
-
}),
|
|
4798
|
-
key: name
|
|
4799
|
-
};
|
|
4800
|
-
}
|
|
4801
|
-
|
|
4802
|
-
const DynamicFieldDefinitionList = ({
|
|
4803
|
-
model,
|
|
4804
|
-
title,
|
|
4805
|
-
layout,
|
|
4806
|
-
fields
|
|
4807
|
-
}) => /*#__PURE__*/jsxs(Fragment, {
|
|
4808
|
-
children: [title && /*#__PURE__*/jsx("div", {
|
|
4809
|
-
className: "m-t-1 m-b-3",
|
|
4810
|
-
children: /*#__PURE__*/jsx(Title, {
|
|
4811
|
-
type: Typography.TITLE_BODY,
|
|
4812
|
-
className: "p-t-3",
|
|
4813
|
-
children: title
|
|
4814
|
-
})
|
|
4815
|
-
}), /*#__PURE__*/jsx(DefinitionList$1, {
|
|
4816
|
-
layout: layout,
|
|
4817
|
-
definitions: createDefinitions(prepFields(fields), model)
|
|
4818
|
-
})]
|
|
4819
|
-
});
|
|
4820
|
-
DynamicFieldDefinitionList.propTypes = {
|
|
4821
|
-
model: PropTypes.shape({}).isRequired,
|
|
4822
|
-
fields: PropTypes.shape({}).isRequired,
|
|
4823
|
-
title: PropTypes.string,
|
|
4824
|
-
layout: PropTypes.oneOf(['VERTICAL_TWO_COLUMN', 'VERTICAL_ONE_COLUMN', 'HORIZONTAL_JUSTIFIED', 'HORIZONTAL_LEFT_ALIGNED'])
|
|
4825
|
-
};
|
|
4826
|
-
DynamicFieldDefinitionList.defaultProps = {
|
|
4827
|
-
title: null,
|
|
4828
|
-
layout: Layout.VERTICAL_TWO_COLUMN
|
|
4829
|
-
};
|
|
4830
|
-
var DynamicFieldDefinitionList$1 = DynamicFieldDefinitionList;
|
|
4831
|
-
|
|
4832
4298
|
const ESCAPED_OPENING_CHEVRON = '<';
|
|
4833
4299
|
const ESCAPED_CLOSING_CHEVRON = '>';
|
|
4834
4300
|
class EmphasisHtmlTransformer {
|
|
@@ -5049,15 +4515,14 @@ const Logo = ({
|
|
|
5049
4515
|
}) => {
|
|
5050
4516
|
const LogoSm = svgPaths[`WISE_FLAG${type === LogoType.WISE_PLATFORM ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
|
|
5051
4517
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5052
|
-
const screenMd = useScreenSize(Breakpoint.MEDIUM);
|
|
5053
4518
|
return /*#__PURE__*/jsxs("span", {
|
|
5054
4519
|
"aria-label": type === LogoType.WISE ? 'Wise' : 'Wise Business' | type === LogoType.WISE_PLATFORM ? 'Wise Platform' : 'Wise Business',
|
|
5055
4520
|
role: "img",
|
|
5056
4521
|
className: classNames(className, 'np-logo'),
|
|
5057
|
-
children: [
|
|
5058
|
-
className: "np-logo-svg"
|
|
5059
|
-
}),
|
|
5060
|
-
className: "np-logo-svg"
|
|
4522
|
+
children: [/*#__PURE__*/jsx(LogoSm, {
|
|
4523
|
+
className: "np-logo-svg np-logo-svg--size-sm"
|
|
4524
|
+
}), /*#__PURE__*/jsx(LogoMd, {
|
|
4525
|
+
className: "np-logo-svg np-logo-svg--size-md"
|
|
5061
4526
|
})]
|
|
5062
4527
|
});
|
|
5063
4528
|
};
|
|
@@ -5169,7 +4634,6 @@ const Tooltip = ({
|
|
|
5169
4634
|
|
|
5170
4635
|
function supportsTouchEvents() {
|
|
5171
4636
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
5172
|
-
// eslint-disable-next-line compat/compat
|
|
5173
4637
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
5174
4638
|
const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
|
|
5175
4639
|
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
@@ -5177,7 +4641,7 @@ function supportsTouchEvents() {
|
|
|
5177
4641
|
function userAgentSuggestsTouchDevice() {
|
|
5178
4642
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
5179
4643
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
5180
|
-
const regex = new RegExp(matchString, '
|
|
4644
|
+
const regex = new RegExp(matchString, 'gi');
|
|
5181
4645
|
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
5182
4646
|
}
|
|
5183
4647
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
@@ -5314,49 +4778,41 @@ const FlowNavigation = ({
|
|
|
5314
4778
|
onGoBack,
|
|
5315
4779
|
steps
|
|
5316
4780
|
}) => {
|
|
5317
|
-
const reference = useRef(null);
|
|
5318
4781
|
const intl = useIntl();
|
|
5319
|
-
const [clientWidth] = useClientWidth({
|
|
5320
|
-
ref: reference
|
|
5321
|
-
});
|
|
5322
4782
|
const closeButton = onClose != null && /*#__PURE__*/jsx(CloseButton, {
|
|
5323
4783
|
size: "lg",
|
|
5324
4784
|
onClick: onClose
|
|
5325
4785
|
});
|
|
5326
|
-
const
|
|
5327
|
-
const
|
|
4786
|
+
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
4787
|
+
const screenLg = useScreenSize(Breakpoint.LARGE);
|
|
5328
4788
|
const newAvatar = done ? null : avatar;
|
|
5329
4789
|
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
5330
4790
|
return /*#__PURE__*/jsx("div", {
|
|
5331
|
-
ref: reference,
|
|
5332
4791
|
className: classNames('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
|
|
5333
4792
|
'np-flow-navigation--border-bottom': !done
|
|
5334
4793
|
}),
|
|
5335
4794
|
children: /*#__PURE__*/jsx(FlowHeader, {
|
|
5336
|
-
className: classNames('np-flow-navigation__content p-x-3', {
|
|
5337
|
-
'np-flow-navigation--
|
|
5338
|
-
'np-flow-navigation--xs-max': isSmall,
|
|
4795
|
+
className: classNames('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
|
|
4796
|
+
'np-flow-navigation--xs-max': !screenSm,
|
|
5339
4797
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
5340
|
-
'np-flow-navigation--sm':
|
|
5341
|
-
'np-flow-navigation--lg':
|
|
4798
|
+
'np-flow-navigation--sm': screenSm,
|
|
4799
|
+
'np-flow-navigation--lg': screenLg
|
|
5342
4800
|
}),
|
|
5343
4801
|
leftContent: /*#__PURE__*/jsxs(Fragment, {
|
|
5344
|
-
children: [
|
|
4802
|
+
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
|
|
5345
4803
|
"aria-label": intl.formatMessage(messages$7.back),
|
|
5346
4804
|
onClick: onGoBack
|
|
5347
4805
|
}) : /*#__PURE__*/jsx("div", {
|
|
5348
4806
|
className: "np-flow-header__left",
|
|
5349
4807
|
children: logo
|
|
5350
|
-
}),
|
|
4808
|
+
}), !screenSm && /*#__PURE__*/jsx(AnimatedLabel, {
|
|
5351
4809
|
className: "m-x-1",
|
|
5352
4810
|
labels: steps.map(step => step.label),
|
|
5353
4811
|
activeLabel: activeStep
|
|
5354
4812
|
})]
|
|
5355
4813
|
}),
|
|
5356
4814
|
rightContent: /*#__PURE__*/jsxs("div", {
|
|
5357
|
-
className:
|
|
5358
|
-
'order-2': isLarge
|
|
5359
|
-
}),
|
|
4815
|
+
className: "np-flow-header__right d-flex align-items-center justify-content-end order-2--lg",
|
|
5360
4816
|
children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
|
|
5361
4817
|
className: "m-x-1"
|
|
5362
4818
|
}), closeButton]
|
|
@@ -5366,7 +4822,7 @@ const FlowNavigation = ({
|
|
|
5366
4822
|
steps: steps,
|
|
5367
4823
|
className: classNames('np-flow-navigation__stepper')
|
|
5368
4824
|
}),
|
|
5369
|
-
layout:
|
|
4825
|
+
layout: !screenLg ? Layout.VERTICAL : Layout.HORIZONTAL
|
|
5370
4826
|
})
|
|
5371
4827
|
});
|
|
5372
4828
|
};
|
|
@@ -5583,8 +5039,9 @@ function resolvePlacement(preferredPlacement) {
|
|
|
5583
5039
|
case 'bottom-left':
|
|
5584
5040
|
case 'bottom-right':
|
|
5585
5041
|
return 'bottom';
|
|
5042
|
+
default:
|
|
5043
|
+
return preferredPlacement;
|
|
5586
5044
|
}
|
|
5587
|
-
return preferredPlacement;
|
|
5588
5045
|
}
|
|
5589
5046
|
function Popover$1({
|
|
5590
5047
|
children,
|
|
@@ -5988,35 +5445,37 @@ function BottomSheet({
|
|
|
5988
5445
|
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
5989
5446
|
leave: "np-bottom-sheet-v2-content--leave",
|
|
5990
5447
|
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
5991
|
-
children: /*#__PURE__*/jsx(
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
'np-bottom-sheet-v2-content-inner
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
5448
|
+
children: /*#__PURE__*/jsx(FocusScope, {
|
|
5449
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
5450
|
+
context: context,
|
|
5451
|
+
initialFocus: initialFocusRef,
|
|
5452
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5453
|
+
// Force inner state invalidation on open
|
|
5454
|
+
ref: refs.setFloating,
|
|
5455
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
5456
|
+
...getFloatingProps(),
|
|
5457
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
5458
|
+
className: "np-bottom-sheet-v2-header",
|
|
5459
|
+
children: /*#__PURE__*/jsx(CloseButton, {
|
|
5460
|
+
size: Size.SMALL,
|
|
5461
|
+
onClick: () => {
|
|
5462
|
+
onClose?.();
|
|
5463
|
+
}
|
|
5464
|
+
})
|
|
5465
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
5466
|
+
className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
5467
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
5468
|
+
}),
|
|
5469
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
5470
|
+
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
5471
|
+
children: title
|
|
5472
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
5473
|
+
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
5474
|
+
children: children
|
|
5475
|
+
})]
|
|
6017
5476
|
})]
|
|
6018
|
-
})
|
|
6019
|
-
}
|
|
5477
|
+
}, floatingKey)
|
|
5478
|
+
})
|
|
6020
5479
|
})
|
|
6021
5480
|
})
|
|
6022
5481
|
})]
|
|
@@ -6117,32 +5576,34 @@ function Popover({
|
|
|
6117
5576
|
setFloatingKey(prev => prev + 1);
|
|
6118
5577
|
},
|
|
6119
5578
|
afterLeave: onCloseEnd,
|
|
6120
|
-
children: /*#__PURE__*/jsx(
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
'np-popover-v2-container
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
'np-popover-v2
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
5579
|
+
children: /*#__PURE__*/jsx(FocusScope, {
|
|
5580
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
5581
|
+
context: context,
|
|
5582
|
+
children: /*#__PURE__*/jsx("div", {
|
|
5583
|
+
// Force inner state invalidation on open
|
|
5584
|
+
ref: refs.setFloating,
|
|
5585
|
+
className: classNames('np-popover-v2-container', {
|
|
5586
|
+
'np-popover-v2-container--size-md': size$1 === 'md',
|
|
5587
|
+
'np-popover-v2-container--size-lg': size$1 === 'lg'
|
|
5588
|
+
})
|
|
5589
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
5590
|
+
,
|
|
5591
|
+
style: floatingStyles,
|
|
5592
|
+
...getFloatingProps(),
|
|
5593
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5594
|
+
className: classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
5595
|
+
'np-popover-v2--padding-md': padding === 'md'
|
|
5596
|
+
}),
|
|
5597
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
5598
|
+
className: "np-popover-v2-title np-text-title-body",
|
|
5599
|
+
children: title
|
|
5600
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
5601
|
+
className: "np-popover-v2-content np-text-body-default",
|
|
5602
|
+
children: children
|
|
5603
|
+
})]
|
|
5604
|
+
})
|
|
5605
|
+
}, floatingKey)
|
|
5606
|
+
})
|
|
6146
5607
|
})
|
|
6147
5608
|
})
|
|
6148
5609
|
})
|
|
@@ -6238,6 +5699,7 @@ const defaultRenderTrigger = ({
|
|
|
6238
5699
|
})
|
|
6239
5700
|
})]
|
|
6240
5701
|
}),
|
|
5702
|
+
initialContentWidth: 24 + 4,
|
|
6241
5703
|
padding: 'sm'
|
|
6242
5704
|
},
|
|
6243
5705
|
disabled: disabled,
|
|
@@ -7147,7 +6609,6 @@ const Loader = ({
|
|
|
7147
6609
|
}, 1000);
|
|
7148
6610
|
}
|
|
7149
6611
|
return () => {
|
|
7150
|
-
// eslint-disable-next-line fp/no-mutation
|
|
7151
6612
|
cancelled = true;
|
|
7152
6613
|
clearTimeout(timeout);
|
|
7153
6614
|
};
|
|
@@ -9084,7 +8545,7 @@ const explodeNumberModel = number => {
|
|
|
9084
8545
|
};
|
|
9085
8546
|
};
|
|
9086
8547
|
|
|
9087
|
-
const DIGITS_MATCH = /^$|^(\+)|(
|
|
8548
|
+
const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
|
|
9088
8549
|
const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
|
|
9089
8550
|
|
|
9090
8551
|
function sortArrayByProperty(arrayToSort, property) {
|
|
@@ -9170,7 +8631,8 @@ const PhoneNumberInput = ({
|
|
|
9170
8631
|
};
|
|
9171
8632
|
useEffect(() => {
|
|
9172
8633
|
if (broadcastedValue === null) {
|
|
9173
|
-
|
|
8634
|
+
setBroadcastedValue(internalValue);
|
|
8635
|
+
return;
|
|
9174
8636
|
}
|
|
9175
8637
|
const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
|
|
9176
8638
|
const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
|
|
@@ -9443,7 +8905,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
9443
8905
|
const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
|
|
9444
8906
|
...commonProps,
|
|
9445
8907
|
'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
|
|
9446
|
-
'aria-describedby': `${componentId}-title
|
|
8908
|
+
'aria-describedby': `${componentId}-title`,
|
|
9447
8909
|
'aria-disabled': isDisabled,
|
|
9448
8910
|
'data-value': value ?? undefined,
|
|
9449
8911
|
role: type === 'checkbox' || type === 'radio' ? type : undefined,
|
|
@@ -10096,8 +9558,8 @@ function Select({
|
|
|
10096
9558
|
}
|
|
10097
9559
|
};
|
|
10098
9560
|
function selectKeyboardFocusedOption() {
|
|
10099
|
-
if (keyboardFocusedOptionIndex != null) {
|
|
10100
|
-
|
|
9561
|
+
if (keyboardFocusedOptionIndex != null && selectableOptions.length > 0) {
|
|
9562
|
+
selectOption(selectableOptions[keyboardFocusedOptionIndex]);
|
|
10101
9563
|
}
|
|
10102
9564
|
}
|
|
10103
9565
|
function moveFocusWithDifference(difference) {
|
|
@@ -10324,7 +9786,6 @@ function Select({
|
|
|
10324
9786
|
disabled: disabled,
|
|
10325
9787
|
"aria-controls": listboxId,
|
|
10326
9788
|
"aria-expanded": open,
|
|
10327
|
-
"aria-autocomplete": "none",
|
|
10328
9789
|
onClick: handleOnClick,
|
|
10329
9790
|
...buttonProps,
|
|
10330
9791
|
children: [selected ? /*#__PURE__*/jsx(Option$1, {
|
|
@@ -10440,12 +9901,11 @@ Select.defaultProps = {
|
|
|
10440
9901
|
|
|
10441
9902
|
const SegmentedControl = ({
|
|
10442
9903
|
name,
|
|
10443
|
-
|
|
9904
|
+
value,
|
|
10444
9905
|
mode = 'input',
|
|
10445
9906
|
segments,
|
|
10446
9907
|
onChange
|
|
10447
9908
|
}) => {
|
|
10448
|
-
const [selectedValue, setSelectedValue] = useState(defaultValue || segments[0].value);
|
|
10449
9909
|
const [animate, setAnimate] = useState(false);
|
|
10450
9910
|
const segmentsRef = useRef(null);
|
|
10451
9911
|
if (segments.length > 3) {
|
|
@@ -10456,7 +9916,7 @@ const SegmentedControl = ({
|
|
|
10456
9916
|
ref: /*#__PURE__*/createRef()
|
|
10457
9917
|
}));
|
|
10458
9918
|
const updateSegmentPosition = () => {
|
|
10459
|
-
const selectedSegmentRef = segmentsWithRefs.find(segment => segment.value ===
|
|
9919
|
+
const selectedSegmentRef = segmentsWithRefs.find(segment => segment.value === value)?.ref;
|
|
10460
9920
|
// We grab the active segments style object from the ref
|
|
10461
9921
|
// and set the css variables to the selected segments width and x position.
|
|
10462
9922
|
// This is so we can animate the highlight to the selected segment
|
|
@@ -10469,6 +9929,7 @@ const SegmentedControl = ({
|
|
|
10469
9929
|
}
|
|
10470
9930
|
};
|
|
10471
9931
|
useEffect(() => {
|
|
9932
|
+
setAnimate(true);
|
|
10472
9933
|
updateSegmentPosition();
|
|
10473
9934
|
const handleWindowSizeChange = () => {
|
|
10474
9935
|
setAnimate(false);
|
|
@@ -10479,10 +9940,7 @@ const SegmentedControl = ({
|
|
|
10479
9940
|
window.removeEventListener('resize', handleWindowSizeChange);
|
|
10480
9941
|
};
|
|
10481
9942
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10482
|
-
}, [segmentsWithRefs,
|
|
10483
|
-
useEffect(() => {
|
|
10484
|
-
onChange(selectedValue);
|
|
10485
|
-
}, [onChange, selectedValue]);
|
|
9943
|
+
}, [segmentsWithRefs, value]);
|
|
10486
9944
|
return /*#__PURE__*/jsx("div", {
|
|
10487
9945
|
ref: segmentsRef,
|
|
10488
9946
|
"data-testid": "segmented-control",
|
|
@@ -10494,50 +9952,50 @@ const SegmentedControl = ({
|
|
|
10494
9952
|
'segmented-control__segments--no-animate': !animate
|
|
10495
9953
|
}),
|
|
10496
9954
|
role: mode !== 'input' ? 'tablist' : undefined,
|
|
10497
|
-
children: segmentsWithRefs.map(segment =>
|
|
10498
|
-
|
|
10499
|
-
htmlFor: segment.id,
|
|
10500
|
-
className: classNames('segmented-control__segment', {
|
|
10501
|
-
'segmented-control__selected-segment': selectedValue === segment.value
|
|
10502
|
-
}),
|
|
10503
|
-
children: [/*#__PURE__*/jsx("input", {
|
|
10504
|
-
type: "radio",
|
|
10505
|
-
className: "segmented-control__radio-input",
|
|
10506
|
-
id: segment.id,
|
|
10507
|
-
name: name,
|
|
10508
|
-
value: segment.value,
|
|
10509
|
-
checked: selectedValue === segment.value,
|
|
10510
|
-
onChange: () => {
|
|
10511
|
-
setAnimate(true);
|
|
10512
|
-
setSelectedValue(segment.value);
|
|
10513
|
-
}
|
|
10514
|
-
}), /*#__PURE__*/jsx(Body, {
|
|
10515
|
-
className: "segmented-control__text",
|
|
10516
|
-
as: "span",
|
|
10517
|
-
type: selectedValue === segment.value ? Typography.BODY_DEFAULT_BOLD : Typography.BODY_DEFAULT,
|
|
10518
|
-
children: segment.label
|
|
10519
|
-
})]
|
|
10520
|
-
}, segment.id) : /*#__PURE__*/jsx("button", {
|
|
10521
|
-
ref: segment.ref,
|
|
10522
|
-
type: "button",
|
|
10523
|
-
role: "tab",
|
|
10524
|
-
id: segment.id,
|
|
10525
|
-
"aria-controls": segment.controls,
|
|
10526
|
-
"aria-selected": selectedValue === segment.value,
|
|
10527
|
-
className: classNames('segmented-control__segment', 'segmented-control__button', {
|
|
10528
|
-
'segmented-control__selected-segment': selectedValue === segment.value
|
|
10529
|
-
}),
|
|
10530
|
-
onClick: () => {
|
|
9955
|
+
children: segmentsWithRefs.map(segment => {
|
|
9956
|
+
const onSelect = () => {
|
|
10531
9957
|
setAnimate(true);
|
|
10532
|
-
|
|
10533
|
-
}
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
9958
|
+
onChange(segment.value);
|
|
9959
|
+
};
|
|
9960
|
+
return mode === 'input' ? /*#__PURE__*/jsxs("label", {
|
|
9961
|
+
ref: segment.ref,
|
|
9962
|
+
htmlFor: segment.id,
|
|
9963
|
+
className: classNames('segmented-control__segment', {
|
|
9964
|
+
'segmented-control__selected-segment': value === segment.value
|
|
9965
|
+
}),
|
|
9966
|
+
children: [/*#__PURE__*/jsx("input", {
|
|
9967
|
+
type: "radio",
|
|
9968
|
+
className: "segmented-control__radio-input",
|
|
9969
|
+
id: segment.id,
|
|
9970
|
+
name: name,
|
|
9971
|
+
value: segment.value,
|
|
9972
|
+
checked: value === segment.value,
|
|
9973
|
+
onChange: onSelect
|
|
9974
|
+
}), /*#__PURE__*/jsx(Body, {
|
|
9975
|
+
className: "segmented-control__text",
|
|
9976
|
+
as: "span",
|
|
9977
|
+
type: value === segment.value ? Typography.BODY_DEFAULT_BOLD : Typography.BODY_DEFAULT,
|
|
9978
|
+
children: segment.label
|
|
9979
|
+
})]
|
|
9980
|
+
}, segment.id) : /*#__PURE__*/jsx("button", {
|
|
9981
|
+
ref: segment.ref,
|
|
9982
|
+
type: "button",
|
|
9983
|
+
role: "tab",
|
|
9984
|
+
id: segment.id,
|
|
9985
|
+
"aria-controls": segment.controls,
|
|
9986
|
+
"aria-selected": value === segment.value,
|
|
9987
|
+
className: classNames('segmented-control__segment', 'segmented-control__button', {
|
|
9988
|
+
'segmented-control__selected-segment': value === segment.value
|
|
9989
|
+
}),
|
|
9990
|
+
onClick: onSelect,
|
|
9991
|
+
children: /*#__PURE__*/jsx(Body, {
|
|
9992
|
+
as: "span",
|
|
9993
|
+
className: "segmented-control__text",
|
|
9994
|
+
type: value === segment.value ? Typography.BODY_DEFAULT_BOLD : Typography.BODY_DEFAULT,
|
|
9995
|
+
children: segment.label
|
|
9996
|
+
})
|
|
9997
|
+
}, segment.id);
|
|
9998
|
+
})
|
|
10541
9999
|
})
|
|
10542
10000
|
});
|
|
10543
10001
|
};
|
|
@@ -14098,7 +13556,7 @@ var hu = {
|
|
|
14098
13556
|
"neptune.Upload.psProcessingText": "Feltöltés...",
|
|
14099
13557
|
"neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
|
|
14100
13558
|
"neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
|
|
14101
|
-
"neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}
|
|
13559
|
+
"neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
|
|
14102
13560
|
"neptune.UploadButton.allFileTypes": "Összes fájltípus",
|
|
14103
13561
|
"neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
|
|
14104
13562
|
"neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
|
|
@@ -14836,5 +14294,5 @@ const translations = {
|
|
|
14836
14294
|
'zh-HK': zhHK
|
|
14837
14295
|
};
|
|
14838
14296
|
|
|
14839
|
-
export { Accordion, ActionButton, ActionOption, Alert, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade,
|
|
14297
|
+
export { Accordion, ActionButton, ActionOption, Alert, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, 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$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$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, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
14840
14298
|
//# sourceMappingURL=index.mjs.map
|