@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.
Files changed (112) hide show
  1. package/build/i18n/hu.json +1 -1
  2. package/build/index.js +141 -686
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +144 -686
  5. package/build/index.mjs.map +1 -1
  6. package/build/main.css +16 -5
  7. package/build/styles/logo/Logo.css +16 -0
  8. package/build/styles/main.css +16 -5
  9. package/build/types/alert/Alert.d.ts.map +1 -1
  10. package/build/types/common/hooks/index.d.ts +0 -1
  11. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  12. package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
  13. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  14. package/build/types/index.d.ts +0 -1
  15. package/build/types/index.d.ts.map +1 -1
  16. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  17. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  18. package/build/types/inputs/_Popover.d.ts.map +1 -1
  19. package/build/types/loader/Loader.d.ts.map +1 -1
  20. package/build/types/logo/Logo.d.ts.map +1 -1
  21. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  22. package/build/types/popover/Popover.d.ts.map +1 -1
  23. package/build/types/segmentedControl/SegmentedControl.d.ts +2 -2
  24. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  25. package/build/types/select/Select.d.ts.map +1 -1
  26. package/build/types/stepper/deviceDetection.d.ts.map +1 -1
  27. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  28. package/package.json +10 -8
  29. package/src/accordion/Accordion.story.tsx +1 -1
  30. package/src/alert/Alert.tsx +2 -1
  31. package/src/avatar/colors/colors.ts +1 -1
  32. package/src/body/Body.spec.tsx +1 -1
  33. package/src/body/Body.story.tsx +8 -8
  34. package/src/checkbox/Checkbox.js +1 -1
  35. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
  36. package/src/common/Option/Option.tsx +1 -1
  37. package/src/common/deviceDetection/deviceDetection.js +1 -1
  38. package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
  39. package/src/common/hooks/index.js +0 -1
  40. package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
  41. package/src/decision/Decision.spec.js +0 -2
  42. package/src/dimmer/Dimmer.tsx +6 -2
  43. package/src/flowNavigation/FlowNavigation.spec.js +7 -22
  44. package/src/flowNavigation/FlowNavigation.tsx +20 -33
  45. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
  46. package/src/i18n/hu.json +1 -1
  47. package/src/index.ts +0 -1
  48. package/src/inlineAlert/InlineAlert.story.tsx +8 -7
  49. package/src/inputs/SelectInput.tsx +1 -0
  50. package/src/inputs/_BottomSheet.tsx +33 -28
  51. package/src/inputs/_Popover.tsx +23 -20
  52. package/src/link/Link.story.tsx +16 -16
  53. package/src/loader/Loader.tsx +0 -1
  54. package/src/logo/Logo.css +16 -0
  55. package/src/logo/Logo.js +4 -9
  56. package/src/logo/Logo.less +16 -0
  57. package/src/logo/__snapshots__/Logo.spec.js.snap +104 -8
  58. package/src/main.css +16 -5
  59. package/src/main.less +0 -1
  60. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  61. package/src/nudge/Nudge.spec.tsx +5 -5
  62. package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
  63. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
  64. package/src/popover/Popover.tsx +2 -1
  65. package/src/promoCard/PromoCard.tsx +1 -1
  66. package/src/provider/theme/ThemeProvider.story.tsx +21 -0
  67. package/src/radioGroup/RadioGroup.spec.js +1 -1
  68. package/src/section/Section.story.tsx +2 -1
  69. package/src/segmentedControl/SegmentedControl.spec.tsx +88 -2
  70. package/src/segmentedControl/SegmentedControl.story.tsx +54 -16
  71. package/src/segmentedControl/SegmentedControl.tsx +21 -33
  72. package/src/select/Select.js +2 -3
  73. package/src/stepper/deviceDetection.js +1 -2
  74. package/src/stepper/deviceDetection.spec.js +8 -3
  75. package/src/test-utils/index.js +1 -1
  76. package/src/test-utils/story-config.ts +1 -1
  77. package/src/title/Title.spec.tsx +1 -1
  78. package/src/typeahead/Typeahead.spec.js +4 -2
  79. package/src/upload/Upload.spec.js +8 -4
  80. package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
  81. package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  82. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
  83. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
  84. package/build/types/common/requirements.d.ts +0 -3
  85. package/build/types/common/requirements.d.ts.map +0 -1
  86. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts +0 -21
  87. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts.map +0 -1
  88. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts +0 -12
  89. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts.map +0 -1
  90. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts +0 -2
  91. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts.map +0 -1
  92. package/build/types/dynamicFieldDefinitionList/index.d.ts +0 -2
  93. package/build/types/dynamicFieldDefinitionList/index.d.ts.map +0 -1
  94. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts +0 -2
  95. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts.map +0 -1
  96. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts +0 -2
  97. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts.map +0 -1
  98. package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
  99. package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
  100. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +0 -41
  101. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.spec.js +0 -21
  102. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.story.js +0 -134
  103. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  104. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +0 -73
  105. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.less +0 -4
  106. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.spec.js +0 -200
  107. package/src/dynamicFieldDefinitionList/FormattedValue/index.js +0 -1
  108. package/src/dynamicFieldDefinitionList/index.js +0 -1
  109. package/src/dynamicFieldDefinitionList/utils/createDefinitions.js +0 -33
  110. package/src/dynamicFieldDefinitionList/utils/createDefinitions.spec.js +0 -83
  111. package/src/dynamicFieldDefinitionList/utils/text-format.js +0 -46
  112. package/src/dynamicFieldDefinitionList/utils/text-format.spec.js +0 -43
package/build/index.js CHANGED
@@ -14,18 +14,16 @@ var react$1 = require('@headlessui/react');
14
14
  var mergeProps = require('merge-props');
15
15
  var index_js = require('use-sync-external-store/shim/index.js');
16
16
  var react = require('@floating-ui/react');
17
+ var focus = require('@react-aria/focus');
17
18
  var overlays = require('@react-aria/overlays');
18
19
  var reactTransitionGroup = require('react-transition-group');
19
20
  var neptuneValidation = require('@transferwise/neptune-validation');
20
21
  var reactDom = require('react-dom');
21
- var focus = require('@react-aria/focus');
22
22
  var reactPopper = require('react-popper');
23
- var throttle = require('lodash.throttle');
24
23
  var art = require('@wise/art');
25
24
  var clamp$2 = require('lodash.clamp');
26
25
  var debounce = require('lodash.debounce');
27
26
  var requiredIf = require('react-required-if');
28
- var toPairs = require('lodash.topairs');
29
27
  var web = require('@react-spring/web');
30
28
 
31
29
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -53,11 +51,9 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
53
51
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
54
52
  var commonmark__default = /*#__PURE__*/_interopDefault(commonmark);
55
53
  var mergeProps__default = /*#__PURE__*/_interopDefault(mergeProps);
56
- var throttle__default = /*#__PURE__*/_interopDefault(throttle);
57
54
  var clamp__default = /*#__PURE__*/_interopDefault(clamp$2);
58
55
  var debounce__default = /*#__PURE__*/_interopDefault(debounce);
59
56
  var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
60
- var toPairs__default = /*#__PURE__*/_interopDefault(toPairs);
61
57
 
62
58
  class HistoryNavigator {
63
59
  constructor(history = [], historyLimit = null) {
@@ -95,7 +91,7 @@ var HistoryNavigator$1 = HistoryNavigator;
95
91
  function isIosDevice() {
96
92
  const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
97
93
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
98
- const regex = new RegExp(matchString, 'ig');
94
+ const regex = new RegExp(matchString, 'gi');
99
95
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
100
96
  }
101
97
 
@@ -941,8 +937,9 @@ function resolveType(type) {
941
937
  return 'neutral';
942
938
  case 'error':
943
939
  return 'negative';
940
+ default:
941
+ return type;
944
942
  }
945
- return type;
946
943
  }
947
944
  function Alert({
948
945
  arrow,
@@ -1088,7 +1085,7 @@ const hashSeed = seed => {
1088
1085
  const modulo = avatarColors.length;
1089
1086
  let hashValue = 0;
1090
1087
  let basePow = 1;
1091
- for (let i = 0; i < seed.length; i++) {
1088
+ for (let i = 0; i < seed.length; i += 1) {
1092
1089
  hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
1093
1090
  basePow = basePow * base % modulo;
1094
1091
  }
@@ -1380,11 +1377,15 @@ const Dimmer = ({
1380
1377
  }, [onClose]);
1381
1378
  const onEnter = () => {
1382
1379
  setHasNotExited(true);
1383
- dimmerReference.current && dimmerManager.add(dimmerReference.current);
1380
+ if (dimmerReference.current) {
1381
+ dimmerManager.add(dimmerReference.current);
1382
+ }
1384
1383
  };
1385
1384
  const onExited = () => {
1386
1385
  setHasNotExited(false);
1387
- dimmerReference.current && dimmerManager.remove(dimmerReference.current);
1386
+ if (dimmerReference.current) {
1387
+ dimmerManager.remove(dimmerReference.current);
1388
+ }
1388
1389
  };
1389
1390
  React.useEffect(() => {
1390
1391
  const localReferenceCopy = dimmerReference.current;
@@ -1487,41 +1488,6 @@ const DimmerContentWrapper = ({
1487
1488
  };
1488
1489
  var Dimmer$1 = withNextPortalWrapper(Dimmer);
1489
1490
 
1490
- const THROTTLE_MS = 100;
1491
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1492
- const useClientWidth = ({
1493
- ref,
1494
- throttleMs = THROTTLE_MS
1495
- }) => {
1496
- const [clientWidth, setClientWidth] = React.useState(null);
1497
- useIsomorphicLayoutEffect(() => {
1498
- // eslint-disable-next-line unicorn/consistent-function-scoping
1499
- const updateClientWidth = () => {
1500
- if (ref) {
1501
- // when `ref` is a window
1502
- if ('innerWidth' in ref) {
1503
- setClientWidth(ref.innerWidth);
1504
- }
1505
- // when `ref` is an element
1506
- else if (ref.current) {
1507
- setClientWidth(ref.current.clientWidth);
1508
- }
1509
- }
1510
- };
1511
- // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1512
- // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
1513
- // won't get removed even if the component is unmounted.
1514
- const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
1515
- window.addEventListener('resize', attachedFunction, true);
1516
- // using requestAnimationFrame to perform the calculation before the next repaint
1517
- // getting width earlier causes issues in animations when used with react-transition-group
1518
- window.requestAnimationFrame(updateClientWidth);
1519
- return () => window.removeEventListener('resize', attachedFunction, true);
1520
- }, []);
1521
- return [clientWidth];
1522
- };
1523
- useClientWidth.THROTTLE_MS = THROTTLE_MS;
1524
-
1525
1491
  const useConditionalListener = ({
1526
1492
  attachListener,
1527
1493
  callback,
@@ -4359,508 +4325,6 @@ const DropFade = ({
4359
4325
  });
4360
4326
  };
4361
4327
 
4362
- /* eslint-disable no-unused-vars */
4363
- /* eslint-disable no-param-reassign */
4364
-
4365
- const prepFields = (fields, model, validationMessages) => {
4366
- if (!fields) {
4367
- return {};
4368
- }
4369
- let preparedFields = copyOf(fields);
4370
- preparedFields = flattenFieldsWithGroups(preparedFields);
4371
- preparedFields = transformFieldArrayToMap(preparedFields);
4372
- preparedFields = transformNestedKeysToNestedSpecs(preparedFields);
4373
- Object.keys(preparedFields).forEach(key => {
4374
- preparedFields[key] = prepField(preparedFields[key], model, validationMessages);
4375
- });
4376
- return preparedFields;
4377
- };
4378
- const prepField = (field, model, validationMessages) => {
4379
- const preparedField = copyOf(field);
4380
- prepLegacyProps(preparedField);
4381
- prepType(preparedField);
4382
- prepPattern(preparedField);
4383
- prepValidationMessages(preparedField, validationMessages);
4384
- return preparedField;
4385
- };
4386
-
4387
- /**
4388
- * In an older format we had an extra fieldGroup level, here we flatten that out
4389
- * So the inner arrays of fields within the different field groups are flattened
4390
- * to a single array, which is returned.
4391
- *
4392
- * @param fields
4393
- */
4394
- const flattenFieldsWithGroups = fields => {
4395
- if (Array.isArray(fields)) {
4396
- let flattenedFields = [];
4397
- fields.forEach(field => {
4398
- // If we've been given a group with nested fields, break them out.
4399
- if (field.fields) {
4400
- flattenedFields = flattenedFields.concat(flattenFieldWithGroup(field, field.fields));
4401
- } else if (field.group) {
4402
- flattenedFields = flattenedFields.concat(flattenFieldWithGroup(field, field.group));
4403
- } else {
4404
- // Otherwise it's a regular field, just add it.
4405
- flattenedFields.push(field);
4406
- }
4407
- });
4408
- return flattenedFields;
4409
- }
4410
- return fields;
4411
- };
4412
- const flattenFieldWithGroup = (field, subFields) => {
4413
- // If first field doesn't have a label, use the one from the group
4414
- if (field.name && subFields.length > 0 && !subFields[0].name) {
4415
- subFields[0].name = field.name;
4416
- }
4417
- if (field.width && subFields.length > 0 && !subFields[0].width) {
4418
- subFields[0].width = field.width;
4419
- }
4420
-
4421
- // If there was a tooltip at fieldGroup level move it to first field.
4422
- if (field.tooltip && subFields.length > 0 && !subFields[0].help) {
4423
- subFields[0].help = {
4424
- message: field.tooltip
4425
- };
4426
- }
4427
- if (field.info && subFields.length > 0 && !subFields[0].help) {
4428
- subFields[0].help = {
4429
- message: field.info
4430
- };
4431
- }
4432
-
4433
- // If there are two parts of this group, render them side by side
4434
- if (subFields.length === 2) {
4435
- subFields.forEach(nestedField => {
4436
- nestedField.width = 'md';
4437
- });
4438
- }
4439
-
4440
- // If there are three parts, render the first two side by side
4441
- if (subFields.length === 3) {
4442
- subFields[0].width = 'md';
4443
- subFields[1].width = 'md';
4444
- }
4445
- return subFields;
4446
- };
4447
-
4448
- /*
4449
- * Some older requirements return an array of fields, where it should be a map
4450
- * from the property name to the spec. This converts arrays to maps.
4451
- */
4452
- const transformFieldArrayToMap = fields => {
4453
- if (Array.isArray(fields)) {
4454
- const fieldMap = {};
4455
- fields.forEach(field => {
4456
- const key = field.key || field.name;
4457
- delete field.key;
4458
- fieldMap[key] = copyOf(field);
4459
- });
4460
- return fieldMap;
4461
- }
4462
- return fields;
4463
- };
4464
-
4465
- /*
4466
- * Some older format return keys like 'address.city', expecting the value of
4467
- * city to be nested inside an address object. This function creates a spec of
4468
- * type 'object', and nests such fields inside of it. When we render we pass
4469
- * this object spec to a nested fieldset.
4470
- */
4471
- const transformNestedKeysToNestedSpecs = fieldMap => {
4472
- if (Array.isArray(fieldMap)) {
4473
- throw new TypeError('Expecting a map of fields, not an array');
4474
- }
4475
- const nestedFields = {};
4476
- Object.keys(fieldMap).forEach(key => {
4477
- if (key.indexOf('.') > 0) {
4478
- // If the key contains a period we need to nest the fields in another object
4479
- const pathSections = key.split('.');
4480
- const nestedKey = pathSections[0];
4481
-
4482
- // If this sub object doesn't exist yet, create it
4483
- if (!nestedFields[nestedKey]) {
4484
- nestedFields[nestedKey] = {
4485
- type: 'object',
4486
- properties: {}
4487
- };
4488
- }
4489
- nestedFields[nestedKey].properties[pathSections[1]] = fieldMap[key];
4490
- } else {
4491
- nestedFields[key] = fieldMap[key];
4492
- }
4493
- });
4494
- return nestedFields;
4495
- };
4496
- const prepType = field => {
4497
- const type = field.type && field.type.toLowerCase && field.type.toLowerCase();
4498
- switch (type) {
4499
- case 'text':
4500
- field.type = 'string';
4501
- break;
4502
- case 'date':
4503
- field.type = 'string';
4504
- field.format = 'date';
4505
- break;
4506
- case 'password':
4507
- field.type = 'string';
4508
- field.control = 'password';
4509
- break;
4510
- case 'checkbox':
4511
- field.type = 'boolean';
4512
- break;
4513
- case 'select':
4514
- if (!field.control) {
4515
- field.control = 'select';
4516
- }
4517
- delete field.type;
4518
- break;
4519
- case 'radio':
4520
- field.control = 'radio';
4521
- delete field.type;
4522
- break;
4523
- case 'upload':
4524
- field.type = 'string';
4525
- field.format = 'base64url';
4526
- break;
4527
- case 'tel':
4528
- field.type = 'string';
4529
- field.format = 'phone';
4530
- break;
4531
- case 'textarea':
4532
- field.type = 'string';
4533
- field.control = 'textarea';
4534
- break;
4535
- }
4536
- if (!field.control && field.type !== 'object') {
4537
- field.control = getControlType(field);
4538
- }
4539
- };
4540
- const prepLegacyProps = field => {
4541
- if (field.name && !field.title) {
4542
- field.title = field.name;
4543
- delete field.name;
4544
- }
4545
- if (field.validationRegexp) {
4546
- field.pattern = field.validationRegexp;
4547
- delete field.validationRegexp;
4548
- }
4549
- if (field.min) {
4550
- field.minimum = field.min;
4551
- delete field.min;
4552
- }
4553
- if (field.max) {
4554
- field.maximum = field.max;
4555
- delete field.max;
4556
- }
4557
- if (field.example && !field.placeholder) {
4558
- field.placeholder = field.example;
4559
- delete field.example;
4560
- }
4561
- if (field.tooltip && !field.help) {
4562
- field.help = {
4563
- message: field.tooltip
4564
- };
4565
- delete field.tooltip;
4566
- }
4567
- if (field.valuesAllowed && !field.values) {
4568
- field.values = field.valuesAllowed;
4569
- delete field.valuesAllowed;
4570
- }
4571
- if (field.values && field.values.map) {
4572
- field.values = prepLegacyValues(field.values);
4573
- }
4574
- if (field.value && !field.default) {
4575
- field.default = field.value;
4576
- delete field.value;
4577
- }
4578
- if (field.values) {
4579
- // In some legacy arrays the first value is a placeholder, extract it.
4580
- if (field.values && field.values.length > 0 && field.values[0] && !field.values[0].value && field.values[0].label && !field.placeholder) {
4581
- field.placeholder = field.values[0].label;
4582
- field.values = field.values.slice(1);
4583
- }
4584
- }
4585
- };
4586
- const prepLegacyValues = values => values.map(prepLegacyValue);
4587
- const prepLegacyValue = value => {
4588
- if (!value.label && value.title) {
4589
- value.label = value.title;
4590
- delete value.title;
4591
- }
4592
- if (!value.label && value.name) {
4593
- value.label = value.name;
4594
- delete value.name;
4595
- }
4596
- if (!value.value && value.code) {
4597
- value.value = value.code;
4598
- delete value.code;
4599
- }
4600
- if (!value.value && value.key) {
4601
- value.value = value.key;
4602
- delete value.key;
4603
- }
4604
- return value;
4605
- };
4606
- const prepPattern = field => {
4607
- if (field.pattern) {
4608
- try {
4609
- new RegExp(field.pattern);
4610
- } catch {
4611
- // eslint-disable-next-line no-console
4612
- console.warn('API regexp is invalid');
4613
- delete field.pattern;
4614
- }
4615
- } else {
4616
- delete field.pattern;
4617
- }
4618
- };
4619
- const prepValidationMessages = (field, validationMessages) => {
4620
- field.validationMessages = field.validationMessages ? field.validationMessages : validationMessages;
4621
- if (!field.validationMessages) {
4622
- delete field.validationMessages;
4623
- return;
4624
- }
4625
- if (field.validationMessages.minimum) {
4626
- field.validationMessages.min = field.validationMessages.minimum;
4627
- delete field.validationMessages.minimum;
4628
- }
4629
- if (field.validationMessages.maximum) {
4630
- field.validationMessages.max = field.validationMessages.maximum;
4631
- delete field.validationMessages.maximum;
4632
- }
4633
- };
4634
- const getControlType = field => {
4635
- if (field.control) {
4636
- return field.control.toLowerCase();
4637
- }
4638
- if (field.hidden) {
4639
- return 'hidden';
4640
- }
4641
- if (field.values && field.values.length > 0) {
4642
- return getSelectionType(field);
4643
- }
4644
- switch (field.type) {
4645
- case 'string':
4646
- return getControlForStringFormat(field.format);
4647
- case 'number':
4648
- case 'integer':
4649
- return 'number';
4650
- case 'boolean':
4651
- return 'checkbox';
4652
- default:
4653
- return 'text';
4654
- }
4655
- };
4656
- const getControlForStringFormat = format => {
4657
- switch (format) {
4658
- case 'date':
4659
- return 'date';
4660
- case 'base64url':
4661
- return 'file';
4662
- case 'password':
4663
- return 'password';
4664
- case 'uri':
4665
- return 'text';
4666
- // 'url'; - not implemented
4667
- case 'email':
4668
- return 'text';
4669
- // 'email'; - not implemented
4670
- case 'phone':
4671
- return 'tel';
4672
- default:
4673
- return 'text';
4674
- }
4675
- };
4676
- const getSelectionType = field => {
4677
- if (field.control) {
4678
- return field.control;
4679
- }
4680
- if (field.type === 'select') {
4681
- return 'select';
4682
- }
4683
- if (field.type === 'radio') {
4684
- return 'radio';
4685
- }
4686
- if (field.values) {
4687
- return field.values.length > 3 ? 'select' : 'radio';
4688
- }
4689
- return 'select';
4690
- };
4691
- const copyOf = object => JSON.parse(JSON.stringify(object));
4692
-
4693
- const formatUsingPattern = (value = '', pattern) => {
4694
- if (typeof pattern !== 'string') {
4695
- return value;
4696
- }
4697
- let newPattern = pattern;
4698
- if (newPattern.indexOf('||') > 0) {
4699
- newPattern = newPattern.slice(0, Math.max(0, pattern.indexOf('||')));
4700
- }
4701
- let newValue = '';
4702
- let separators = 0;
4703
- let charactersToAllocate = value.length;
4704
- let position = 0;
4705
- while (charactersToAllocate) {
4706
- if (positionIsSeparator(newPattern, position)) {
4707
- newValue += newPattern[position];
4708
- separators += 1;
4709
- } else {
4710
- newValue += value[position - separators];
4711
- charactersToAllocate -= 1;
4712
- }
4713
- position += 1;
4714
- }
4715
- const separatorsAfterCursor = countSeparatorsAfterCursor(newPattern, position);
4716
- if (separatorsAfterCursor) {
4717
- newValue += newPattern.slice(position, separatorsAfterCursor);
4718
- }
4719
- return newValue;
4720
- };
4721
- const countSeparatorsAfterCursor = (newPattern, position) => {
4722
- let separators = 0;
4723
- while (positionIsSeparator(newPattern, position + separators)) {
4724
- separators += 1;
4725
- }
4726
- return separators;
4727
- };
4728
- const positionIsSeparator = (newPattern, position) => newPattern[position] && newPattern[position] !== '*';
4729
-
4730
- const getValueLabel = (options, value) => {
4731
- const option = options.find(currentOption => currentOption.value === value);
4732
- return option && option.label ? option.label : value;
4733
- };
4734
-
4735
- /**
4736
- *
4737
- * @param {string} value
4738
- */
4739
- const mask = value => new Array(value.length + 1).join('*');
4740
- const FormattedValue = ({
4741
- field,
4742
- value
4743
- }) => {
4744
- const {
4745
- locale
4746
- } = reactIntl.useIntl();
4747
- const style = [];
4748
- if (field.tagClassName && field.tagClassName.h3) {
4749
- style.push('np-text-body-large-bold');
4750
- style.push('formatted-value__h3-custom-alignment');
4751
- }
4752
- switch (field.control) {
4753
- case 'select':
4754
- case 'radio':
4755
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4756
- children: getValueLabel(field.values, value)
4757
- });
4758
- case 'date':
4759
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4760
- children: formatting.formatDate(value instanceof Date ? value : new Date(value), locale)
4761
- });
4762
- case 'number':
4763
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4764
- children: formatting.formatNumber(value, locale)
4765
- });
4766
- case 'password':
4767
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4768
- children: mask(value)
4769
- });
4770
- case 'file':
4771
- return /*#__PURE__*/jsxRuntime.jsx("div", {
4772
- className: "thumbnail",
4773
- children: /*#__PURE__*/jsxRuntime.jsx("img", {
4774
- alt: field.title,
4775
- src: value
4776
- })
4777
- });
4778
- case 'checkbox':
4779
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4780
- children: JSON.stringify(value)
4781
- });
4782
- default:
4783
- return /*#__PURE__*/jsxRuntime.jsx("span", {
4784
- className: classNames__default.default(style),
4785
- children: formatUsingPattern(value, field.displayFormat)
4786
- });
4787
- }
4788
- };
4789
- FormattedValue.propTypes = {
4790
- field: PropTypes__default.default.shape({
4791
- control: PropTypes__default.default.string.isRequired,
4792
- displayFormat: PropTypes__default.default.string,
4793
- refreshRequirementsOnChange: PropTypes__default.default.bool,
4794
- title: PropTypes__default.default.string.isRequired,
4795
- type: PropTypes__default.default.string.isRequired,
4796
- width: PropTypes__default.default.string,
4797
- tagClassName: PropTypes__default.default.shape({
4798
- h3: PropTypes__default.default.bool
4799
- }),
4800
- values: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
4801
- value: PropTypes__default.default.any
4802
- }))
4803
- }).isRequired,
4804
- value: PropTypes__default.default.any.isRequired
4805
- };
4806
- var FormattedValue$1 = FormattedValue;
4807
-
4808
- function createDefinitions(fields, model) {
4809
- return toPairs__default.default(fields).map(([name, field]) => createDefinition(name, field, model)).filter(definition => !!definition);
4810
- }
4811
- function createDefinition(name, field, model) {
4812
- const {
4813
- title,
4814
- group,
4815
- hidden
4816
- } = field;
4817
- if (!model[name] || hidden) {
4818
- return null;
4819
- }
4820
- return {
4821
- title,
4822
- value: group ? group.map((groupField, groupFieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FormattedValue$1, {
4823
- // eslint-disable-line react/no-array-index-key
4824
- field: groupField,
4825
- value: model[name]
4826
- }, groupFieldIndex)) : /*#__PURE__*/jsxRuntime.jsx(FormattedValue$1, {
4827
- field: field,
4828
- value: model[name]
4829
- }),
4830
- key: name
4831
- };
4832
- }
4833
-
4834
- const DynamicFieldDefinitionList = ({
4835
- model,
4836
- title,
4837
- layout,
4838
- fields
4839
- }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
4840
- children: [title && /*#__PURE__*/jsxRuntime.jsx("div", {
4841
- className: "m-t-1 m-b-3",
4842
- children: /*#__PURE__*/jsxRuntime.jsx(Title, {
4843
- type: exports.Typography.TITLE_BODY,
4844
- className: "p-t-3",
4845
- children: title
4846
- })
4847
- }), /*#__PURE__*/jsxRuntime.jsx(DefinitionList$1, {
4848
- layout: layout,
4849
- definitions: createDefinitions(prepFields(fields), model)
4850
- })]
4851
- });
4852
- DynamicFieldDefinitionList.propTypes = {
4853
- model: PropTypes__default.default.shape({}).isRequired,
4854
- fields: PropTypes__default.default.shape({}).isRequired,
4855
- title: PropTypes__default.default.string,
4856
- layout: PropTypes__default.default.oneOf(['VERTICAL_TWO_COLUMN', 'VERTICAL_ONE_COLUMN', 'HORIZONTAL_JUSTIFIED', 'HORIZONTAL_LEFT_ALIGNED'])
4857
- };
4858
- DynamicFieldDefinitionList.defaultProps = {
4859
- title: null,
4860
- layout: exports.Layout.VERTICAL_TWO_COLUMN
4861
- };
4862
- var DynamicFieldDefinitionList$1 = DynamicFieldDefinitionList;
4863
-
4864
4328
  const ESCAPED_OPENING_CHEVRON = '&lt;';
4865
4329
  const ESCAPED_CLOSING_CHEVRON = '&gt;';
4866
4330
  class EmphasisHtmlTransformer {
@@ -5081,15 +4545,14 @@ const Logo = ({
5081
4545
  }) => {
5082
4546
  const LogoSm = svgPaths[`WISE_FLAG${type === exports.LogoType.WISE_PLATFORM ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
5083
4547
  const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5084
- const screenMd = useScreenSize(exports.Breakpoint.MEDIUM);
5085
4548
  return /*#__PURE__*/jsxRuntime.jsxs("span", {
5086
4549
  "aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise Business' | type === exports.LogoType.WISE_PLATFORM ? 'Wise Platform' : 'Wise Business',
5087
4550
  role: "img",
5088
4551
  className: classNames__default.default(className, 'np-logo'),
5089
- children: [!screenMd && /*#__PURE__*/jsxRuntime.jsx(LogoSm, {
5090
- className: "np-logo-svg"
5091
- }), screenMd && /*#__PURE__*/jsxRuntime.jsx(LogoMd, {
5092
- className: "np-logo-svg"
4552
+ children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
4553
+ className: "np-logo-svg np-logo-svg--size-sm"
4554
+ }), /*#__PURE__*/jsxRuntime.jsx(LogoMd, {
4555
+ className: "np-logo-svg np-logo-svg--size-md"
5093
4556
  })]
5094
4557
  });
5095
4558
  };
@@ -5201,7 +4664,6 @@ const Tooltip = ({
5201
4664
 
5202
4665
  function supportsTouchEvents() {
5203
4666
  const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
5204
- // eslint-disable-next-line compat/compat
5205
4667
  const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
5206
4668
  const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
5207
4669
  return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
@@ -5209,7 +4671,7 @@ function supportsTouchEvents() {
5209
4671
  function userAgentSuggestsTouchDevice() {
5210
4672
  const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
5211
4673
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
5212
- const regex = new RegExp(matchString, 'ig');
4674
+ const regex = new RegExp(matchString, 'gi');
5213
4675
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
5214
4676
  }
5215
4677
  // Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
@@ -5346,49 +4808,41 @@ const FlowNavigation = ({
5346
4808
  onGoBack,
5347
4809
  steps
5348
4810
  }) => {
5349
- const reference = React.useRef(null);
5350
4811
  const intl = reactIntl.useIntl();
5351
- const [clientWidth] = useClientWidth({
5352
- ref: reference
5353
- });
5354
4812
  const closeButton = onClose != null && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
5355
4813
  size: "lg",
5356
4814
  onClick: onClose
5357
4815
  });
5358
- const isSmall = clientWidth != null && clientWidth < exports.Breakpoint.SMALL;
5359
- const isLarge = clientWidth != null && clientWidth >= exports.Breakpoint.LARGE;
4816
+ const screenSm = useScreenSize(exports.Breakpoint.SMALL);
4817
+ const screenLg = useScreenSize(exports.Breakpoint.LARGE);
5360
4818
  const newAvatar = done ? null : avatar;
5361
4819
  const displayGoBack = onGoBack != null && activeStep > 0;
5362
4820
  return /*#__PURE__*/jsxRuntime.jsx("div", {
5363
- ref: reference,
5364
4821
  className: classNames__default.default('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
5365
4822
  'np-flow-navigation--border-bottom': !done
5366
4823
  }),
5367
4824
  children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
5368
- className: classNames__default.default('np-flow-navigation__content p-x-3', {
5369
- 'np-flow-navigation--hidden': !clientWidth,
5370
- 'np-flow-navigation--xs-max': isSmall,
4825
+ className: classNames__default.default('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
4826
+ 'np-flow-navigation--xs-max': !screenSm,
5371
4827
  // Size switches on parent container which may or may not have the same size as the window.
5372
- 'np-flow-navigation--sm': clientWidth != null && clientWidth >= exports.Breakpoint.SMALL,
5373
- 'np-flow-navigation--lg': isLarge
4828
+ 'np-flow-navigation--sm': screenSm,
4829
+ 'np-flow-navigation--lg': screenLg
5374
4830
  }),
5375
4831
  leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5376
- children: [isSmall && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
4832
+ children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5377
4833
  "aria-label": intl.formatMessage(messages$7.back),
5378
4834
  onClick: onGoBack
5379
4835
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
5380
4836
  className: "np-flow-header__left",
5381
4837
  children: logo
5382
- }), isSmall && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
4838
+ }), !screenSm && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5383
4839
  className: "m-x-1",
5384
4840
  labels: steps.map(step => step.label),
5385
4841
  activeLabel: activeStep
5386
4842
  })]
5387
4843
  }),
5388
4844
  rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
5389
- className: classNames__default.default('np-flow-header__right', 'd-flex', 'align-items-center', 'justify-content-end', {
5390
- 'order-2': isLarge
5391
- }),
4845
+ className: "np-flow-header__right d-flex align-items-center justify-content-end order-2--lg",
5392
4846
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
5393
4847
  className: "m-x-1"
5394
4848
  }), closeButton]
@@ -5398,7 +4852,7 @@ const FlowNavigation = ({
5398
4852
  steps: steps,
5399
4853
  className: classNames__default.default('np-flow-navigation__stepper')
5400
4854
  }),
5401
- layout: clientWidth != null && clientWidth < exports.Breakpoint.LARGE ? exports.Layout.VERTICAL : exports.Layout.HORIZONTAL
4855
+ layout: !screenLg ? exports.Layout.VERTICAL : exports.Layout.HORIZONTAL
5402
4856
  })
5403
4857
  });
5404
4858
  };
@@ -5615,8 +5069,9 @@ function resolvePlacement(preferredPlacement) {
5615
5069
  case 'bottom-left':
5616
5070
  case 'bottom-right':
5617
5071
  return 'bottom';
5072
+ default:
5073
+ return preferredPlacement;
5618
5074
  }
5619
- return preferredPlacement;
5620
5075
  }
5621
5076
  function Popover$1({
5622
5077
  children,
@@ -6020,35 +5475,37 @@ function BottomSheet({
6020
5475
  enterFrom: "np-bottom-sheet-v2-content--enter-from",
6021
5476
  leave: "np-bottom-sheet-v2-content--leave",
6022
5477
  leaveTo: "np-bottom-sheet-v2-content--leave-to",
6023
- children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6024
- context: context,
6025
- initialFocus: initialFocusRef,
6026
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6027
- // Force inner state invalidation on open
6028
- ref: refs.setFloating,
6029
- className: "np-bottom-sheet-v2-content-inner-container",
6030
- ...getFloatingProps(),
6031
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6032
- className: "np-bottom-sheet-v2-header",
6033
- children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
6034
- size: exports.Size.SMALL,
6035
- onClick: () => {
6036
- onClose?.();
6037
- }
6038
- })
6039
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6040
- className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6041
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6042
- }),
6043
- children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6044
- className: "np-bottom-sheet-v2-title np-text-title-body",
6045
- children: title
6046
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6047
- className: "np-bottom-sheet-v2-body np-text-body-default",
6048
- children: children
5478
+ children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
5479
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
5480
+ context: context,
5481
+ initialFocus: initialFocusRef,
5482
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5483
+ // Force inner state invalidation on open
5484
+ ref: refs.setFloating,
5485
+ className: "np-bottom-sheet-v2-content-inner-container",
5486
+ ...getFloatingProps(),
5487
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
5488
+ className: "np-bottom-sheet-v2-header",
5489
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
5490
+ size: exports.Size.SMALL,
5491
+ onClick: () => {
5492
+ onClose?.();
5493
+ }
5494
+ })
5495
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
5496
+ className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
5497
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
5498
+ }),
5499
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
5500
+ className: "np-bottom-sheet-v2-title np-text-title-body",
5501
+ children: title
5502
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
5503
+ className: "np-bottom-sheet-v2-body np-text-body-default",
5504
+ children: children
5505
+ })]
6049
5506
  })]
6050
- })]
6051
- }, floatingKey)
5507
+ }, floatingKey)
5508
+ })
6052
5509
  })
6053
5510
  })
6054
5511
  })]
@@ -6149,32 +5606,34 @@ function Popover({
6149
5606
  setFloatingKey(prev => prev + 1);
6150
5607
  },
6151
5608
  afterLeave: onCloseEnd,
6152
- children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6153
- context: context,
6154
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6155
- // Force inner state invalidation on open
6156
- ref: refs.setFloating,
6157
- className: classNames__default.default('np-popover-v2-container', {
6158
- 'np-popover-v2-container--size-md': size === 'md',
6159
- 'np-popover-v2-container--size-lg': size === 'lg'
6160
- })
6161
- // eslint-disable-next-line react/forbid-dom-props
6162
- ,
6163
- style: floatingStyles,
6164
- ...getFloatingProps(),
6165
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6166
- className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
6167
- 'np-popover-v2--padding-md': padding === 'md'
6168
- }),
6169
- children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
6170
- className: "np-popover-v2-title np-text-title-body",
6171
- children: title
6172
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6173
- className: "np-popover-v2-content np-text-body-default",
6174
- children: children
6175
- })]
6176
- })
6177
- }, floatingKey)
5609
+ children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
5610
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
5611
+ context: context,
5612
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
5613
+ // Force inner state invalidation on open
5614
+ ref: refs.setFloating,
5615
+ className: classNames__default.default('np-popover-v2-container', {
5616
+ 'np-popover-v2-container--size-md': size === 'md',
5617
+ 'np-popover-v2-container--size-lg': size === 'lg'
5618
+ })
5619
+ // eslint-disable-next-line react/forbid-dom-props
5620
+ ,
5621
+ style: floatingStyles,
5622
+ ...getFloatingProps(),
5623
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5624
+ className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
5625
+ 'np-popover-v2--padding-md': padding === 'md'
5626
+ }),
5627
+ children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
5628
+ className: "np-popover-v2-title np-text-title-body",
5629
+ children: title
5630
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
5631
+ className: "np-popover-v2-content np-text-body-default",
5632
+ children: children
5633
+ })]
5634
+ })
5635
+ }, floatingKey)
5636
+ })
6178
5637
  })
6179
5638
  })
6180
5639
  })
@@ -6270,6 +5729,7 @@ const defaultRenderTrigger = ({
6270
5729
  })
6271
5730
  })]
6272
5731
  }),
5732
+ initialContentWidth: 24 + 4,
6273
5733
  padding: 'sm'
6274
5734
  },
6275
5735
  disabled: disabled,
@@ -7179,7 +6639,6 @@ const Loader = ({
7179
6639
  }, 1000);
7180
6640
  }
7181
6641
  return () => {
7182
- // eslint-disable-next-line fp/no-mutation
7183
6642
  cancelled = true;
7184
6643
  clearTimeout(timeout);
7185
6644
  };
@@ -9116,7 +8575,7 @@ const explodeNumberModel = number => {
9116
8575
  };
9117
8576
  };
9118
8577
 
9119
- const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
8578
+ const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
9120
8579
  const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
9121
8580
 
9122
8581
  function sortArrayByProperty(arrayToSort, property) {
@@ -9202,7 +8661,8 @@ const PhoneNumberInput = ({
9202
8661
  };
9203
8662
  React.useEffect(() => {
9204
8663
  if (broadcastedValue === null) {
9205
- return setBroadcastedValue(internalValue);
8664
+ setBroadcastedValue(internalValue);
8665
+ return;
9206
8666
  }
9207
8667
  const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
9208
8668
  const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
@@ -9475,7 +8935,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
9475
8935
  const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
9476
8936
  ...commonProps,
9477
8937
  'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
9478
- 'aria-describedby': `${componentId}-title` || undefined,
8938
+ 'aria-describedby': `${componentId}-title`,
9479
8939
  'aria-disabled': isDisabled,
9480
8940
  'data-value': value ?? undefined,
9481
8941
  role: type === 'checkbox' || type === 'radio' ? type : undefined,
@@ -10128,8 +9588,8 @@ function Select({
10128
9588
  }
10129
9589
  };
10130
9590
  function selectKeyboardFocusedOption() {
10131
- if (keyboardFocusedOptionIndex != null) {
10132
- selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9591
+ if (keyboardFocusedOptionIndex != null && selectableOptions.length > 0) {
9592
+ selectOption(selectableOptions[keyboardFocusedOptionIndex]);
10133
9593
  }
10134
9594
  }
10135
9595
  function moveFocusWithDifference(difference) {
@@ -10356,7 +9816,6 @@ function Select({
10356
9816
  disabled: disabled,
10357
9817
  "aria-controls": listboxId,
10358
9818
  "aria-expanded": open,
10359
- "aria-autocomplete": "none",
10360
9819
  onClick: handleOnClick,
10361
9820
  ...buttonProps,
10362
9821
  children: [selected ? /*#__PURE__*/jsxRuntime.jsx(Option$1, {
@@ -10472,12 +9931,11 @@ Select.defaultProps = {
10472
9931
 
10473
9932
  const SegmentedControl = ({
10474
9933
  name,
10475
- defaultValue,
9934
+ value,
10476
9935
  mode = 'input',
10477
9936
  segments,
10478
9937
  onChange
10479
9938
  }) => {
10480
- const [selectedValue, setSelectedValue] = React.useState(defaultValue || segments[0].value);
10481
9939
  const [animate, setAnimate] = React.useState(false);
10482
9940
  const segmentsRef = React.useRef(null);
10483
9941
  if (segments.length > 3) {
@@ -10488,7 +9946,7 @@ const SegmentedControl = ({
10488
9946
  ref: /*#__PURE__*/React.createRef()
10489
9947
  }));
10490
9948
  const updateSegmentPosition = () => {
10491
- const selectedSegmentRef = segmentsWithRefs.find(segment => segment.value === selectedValue)?.ref;
9949
+ const selectedSegmentRef = segmentsWithRefs.find(segment => segment.value === value)?.ref;
10492
9950
  // We grab the active segments style object from the ref
10493
9951
  // and set the css variables to the selected segments width and x position.
10494
9952
  // This is so we can animate the highlight to the selected segment
@@ -10501,6 +9959,7 @@ const SegmentedControl = ({
10501
9959
  }
10502
9960
  };
10503
9961
  React.useEffect(() => {
9962
+ setAnimate(true);
10504
9963
  updateSegmentPosition();
10505
9964
  const handleWindowSizeChange = () => {
10506
9965
  setAnimate(false);
@@ -10511,10 +9970,7 @@ const SegmentedControl = ({
10511
9970
  window.removeEventListener('resize', handleWindowSizeChange);
10512
9971
  };
10513
9972
  // eslint-disable-next-line react-hooks/exhaustive-deps
10514
- }, [segmentsWithRefs, selectedValue]);
10515
- React.useEffect(() => {
10516
- onChange(selectedValue);
10517
- }, [onChange, selectedValue]);
9973
+ }, [segmentsWithRefs, value]);
10518
9974
  return /*#__PURE__*/jsxRuntime.jsx("div", {
10519
9975
  ref: segmentsRef,
10520
9976
  "data-testid": "segmented-control",
@@ -10526,50 +9982,50 @@ const SegmentedControl = ({
10526
9982
  'segmented-control__segments--no-animate': !animate
10527
9983
  }),
10528
9984
  role: mode !== 'input' ? 'tablist' : undefined,
10529
- children: segmentsWithRefs.map(segment => mode === 'input' ? /*#__PURE__*/jsxRuntime.jsxs("label", {
10530
- ref: segment.ref,
10531
- htmlFor: segment.id,
10532
- className: classNames__default.default('segmented-control__segment', {
10533
- 'segmented-control__selected-segment': selectedValue === segment.value
10534
- }),
10535
- children: [/*#__PURE__*/jsxRuntime.jsx("input", {
10536
- type: "radio",
10537
- className: "segmented-control__radio-input",
10538
- id: segment.id,
10539
- name: name,
10540
- value: segment.value,
10541
- checked: selectedValue === segment.value,
10542
- onChange: () => {
10543
- setAnimate(true);
10544
- setSelectedValue(segment.value);
10545
- }
10546
- }), /*#__PURE__*/jsxRuntime.jsx(Body, {
10547
- className: "segmented-control__text",
10548
- as: "span",
10549
- type: selectedValue === segment.value ? exports.Typography.BODY_DEFAULT_BOLD : exports.Typography.BODY_DEFAULT,
10550
- children: segment.label
10551
- })]
10552
- }, segment.id) : /*#__PURE__*/jsxRuntime.jsx("button", {
10553
- ref: segment.ref,
10554
- type: "button",
10555
- role: "tab",
10556
- id: segment.id,
10557
- "aria-controls": segment.controls,
10558
- "aria-selected": selectedValue === segment.value,
10559
- className: classNames__default.default('segmented-control__segment', 'segmented-control__button', {
10560
- 'segmented-control__selected-segment': selectedValue === segment.value
10561
- }),
10562
- onClick: () => {
9985
+ children: segmentsWithRefs.map(segment => {
9986
+ const onSelect = () => {
10563
9987
  setAnimate(true);
10564
- setSelectedValue(segment.value);
10565
- },
10566
- children: /*#__PURE__*/jsxRuntime.jsx(Body, {
10567
- as: "span",
10568
- className: "segmented-control__text",
10569
- type: selectedValue === segment.value ? exports.Typography.BODY_DEFAULT_BOLD : exports.Typography.BODY_DEFAULT,
10570
- children: segment.label
10571
- })
10572
- }, segment.id))
9988
+ onChange(segment.value);
9989
+ };
9990
+ return mode === 'input' ? /*#__PURE__*/jsxRuntime.jsxs("label", {
9991
+ ref: segment.ref,
9992
+ htmlFor: segment.id,
9993
+ className: classNames__default.default('segmented-control__segment', {
9994
+ 'segmented-control__selected-segment': value === segment.value
9995
+ }),
9996
+ children: [/*#__PURE__*/jsxRuntime.jsx("input", {
9997
+ type: "radio",
9998
+ className: "segmented-control__radio-input",
9999
+ id: segment.id,
10000
+ name: name,
10001
+ value: segment.value,
10002
+ checked: value === segment.value,
10003
+ onChange: onSelect
10004
+ }), /*#__PURE__*/jsxRuntime.jsx(Body, {
10005
+ className: "segmented-control__text",
10006
+ as: "span",
10007
+ type: value === segment.value ? exports.Typography.BODY_DEFAULT_BOLD : exports.Typography.BODY_DEFAULT,
10008
+ children: segment.label
10009
+ })]
10010
+ }, segment.id) : /*#__PURE__*/jsxRuntime.jsx("button", {
10011
+ ref: segment.ref,
10012
+ type: "button",
10013
+ role: "tab",
10014
+ id: segment.id,
10015
+ "aria-controls": segment.controls,
10016
+ "aria-selected": value === segment.value,
10017
+ className: classNames__default.default('segmented-control__segment', 'segmented-control__button', {
10018
+ 'segmented-control__selected-segment': value === segment.value
10019
+ }),
10020
+ onClick: onSelect,
10021
+ children: /*#__PURE__*/jsxRuntime.jsx(Body, {
10022
+ as: "span",
10023
+ className: "segmented-control__text",
10024
+ type: value === segment.value ? exports.Typography.BODY_DEFAULT_BOLD : exports.Typography.BODY_DEFAULT,
10025
+ children: segment.label
10026
+ })
10027
+ }, segment.id);
10028
+ })
10573
10029
  })
10574
10030
  });
10575
10031
  };
@@ -14130,7 +13586,7 @@ var hu = {
14130
13586
  "neptune.Upload.psProcessingText": "Feltöltés...",
14131
13587
  "neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
14132
13588
  "neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
14133
- "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize} MB méretű fájlt",
13589
+ "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
14134
13590
  "neptune.UploadButton.allFileTypes": "Összes fájltípus",
14135
13591
  "neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
14136
13592
  "neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
@@ -14899,7 +14355,6 @@ exports.DirectionProvider = DirectionProvider;
14899
14355
  exports.Display = Display;
14900
14356
  exports.Drawer = Drawer$1;
14901
14357
  exports.DropFade = DropFade;
14902
- exports.DynamicFieldDefinitionList = DynamicFieldDefinitionList$1;
14903
14358
  exports.Emphasis = Emphasis;
14904
14359
  exports.FlowNavigation = FlowNavigation;
14905
14360
  exports.Header = Header;