@transferwise/components 45.15.0 → 45.15.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/en.json +8 -0
- package/build/index.esm.js +322 -318
- package/build/index.esm.js.map +1 -1
- package/build/index.js +321 -317
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +14 -5
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/common/Option/Option.d.ts.map +1 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
- package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +2 -0
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
- package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
- package/src/avatarWrapper/AvatarWrapper.tsx +20 -8
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +1 -1
- package/src/card/Card.spec.js +2 -2
- package/src/common/Option/Option.tsx +1 -7
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -1
- package/src/common/focusBoundary/FocusBoundary.tsx +9 -32
- package/src/dateInput/DateInput.js +6 -0
- package/src/dateInput/DateInput.story.tsx +2 -0
- package/src/dateLookup/DateLookup.css +1 -1
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
- package/src/dateLookup/DateLookup.less +4 -0
- package/src/dateLookup/DateLookup.messages.js +44 -0
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
- package/src/dateLookup/dateHeader/DateHeader.js +48 -26
- package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
- package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
- package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
- package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
- package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
- package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
- package/src/dateLookup/tableLink/TableLink.js +24 -3
- package/src/dateLookup/tableLink/TableLink.spec.js +60 -4
- package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
- package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
- package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
- package/src/i18n/en.json +8 -0
- package/src/inputs/SelectInput.story.tsx +14 -9
- package/src/main.css +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
- package/src/snackbar/Snackbar.js +6 -1
- package/src/snackbar/Snackbar.spec.js +1 -3
- package/src/tabs/Tabs.js +2 -1
- package/src/upload/Upload.js +1 -1
- package/src/upload/steps/completeStep/completeStep.js +4 -1
- package/src/upload/steps/processingStep/processingStep.js +1 -0
- package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
- package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +0 -2
- package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +0 -1
- package/build/types/common/focusBoundary/utils/index.d.ts +0 -3
- package/build/types/common/focusBoundary/utils/index.d.ts.map +0 -1
- package/build/types/common/focusBoundary/utils/resetFocus.d.ts +0 -2
- package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +0 -1
- package/src/common/focusBoundary/FocusBoundary.spec.tsx +0 -66
- package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +0 -16
- package/src/common/focusBoundary/utils/getFocusableElements.js +0 -25
- package/src/common/focusBoundary/utils/getFocusableElements.spec.js +0 -51
- package/src/common/focusBoundary/utils/index.js +0 -2
- package/src/common/focusBoundary/utils/resetFocus.js +0 -23
- package/src/common/focusBoundary/utils/resetFocus.spec.js +0 -103
- package/src/snackbar/__snapshots__/Snackbar.spec.js.snap +0 -5
package/build/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, useRef, useMemo, useEffect, useLayoutEffect, createContext, useContext,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect, createContext, useContext, PureComponent, createRef, Component, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$2, ClockBorderless, CheckCircle, InfoCircle, Warning, CrossCircle, Clock, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
@@ -10,8 +10,9 @@ import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwi
|
|
|
10
10
|
import throttle from 'lodash.throttle';
|
|
11
11
|
import { CSSTransition } from 'react-transition-group';
|
|
12
12
|
import { createPortal } from 'react-dom';
|
|
13
|
-
import {
|
|
13
|
+
import { FocusScope } from '@react-aria/focus';
|
|
14
14
|
import mergeRefs from 'react-merge-refs';
|
|
15
|
+
import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
|
|
15
16
|
import { usePopper } from 'react-popper';
|
|
16
17
|
import { Transition, Listbox } from '@headlessui/react';
|
|
17
18
|
import { useId } from '@radix-ui/react-id';
|
|
@@ -611,10 +612,8 @@ const Option$2 = /*#__PURE__*/forwardRef(({
|
|
|
611
612
|
})
|
|
612
613
|
}), /*#__PURE__*/jsxs("div", {
|
|
613
614
|
className: "media-body",
|
|
614
|
-
children: [/*#__PURE__*/jsx(
|
|
615
|
-
|
|
616
|
-
type: Typography.BODY_LARGE_BOLD,
|
|
617
|
-
className: "text-primary np-option__title d-block",
|
|
615
|
+
children: [/*#__PURE__*/jsx("h4", {
|
|
616
|
+
className: "np-text-body-large-bold text-primary np-option__title",
|
|
618
617
|
children: title
|
|
619
618
|
}), content && /*#__PURE__*/jsx(Body, {
|
|
620
619
|
className: "d-block np-option__body",
|
|
@@ -764,7 +763,7 @@ const ActionOption = ({
|
|
|
764
763
|
});
|
|
765
764
|
};
|
|
766
765
|
|
|
767
|
-
var messages$
|
|
766
|
+
var messages$9 = defineMessages({
|
|
768
767
|
ariaLabel: {
|
|
769
768
|
id: "neptune.CloseButton.ariaLabel"
|
|
770
769
|
}
|
|
@@ -780,7 +779,7 @@ const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
|
|
|
780
779
|
testId
|
|
781
780
|
}, reference) {
|
|
782
781
|
const intl = useIntl();
|
|
783
|
-
ariaLabel ??= intl.formatMessage(messages$
|
|
782
|
+
ariaLabel ??= intl.formatMessage(messages$9.ariaLabel);
|
|
784
783
|
const Icon = filled ? CrossCircleFill : Cross;
|
|
785
784
|
return /*#__PURE__*/jsx("button", {
|
|
786
785
|
ref: reference,
|
|
@@ -800,7 +799,7 @@ const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
|
|
|
800
799
|
});
|
|
801
800
|
});
|
|
802
801
|
|
|
803
|
-
var messages$
|
|
802
|
+
var messages$8 = defineMessages({
|
|
804
803
|
opensInNewTab: {
|
|
805
804
|
id: "neptune.Link.opensInNewTab"
|
|
806
805
|
}
|
|
@@ -829,7 +828,7 @@ const Link = ({
|
|
|
829
828
|
onClick: onClick,
|
|
830
829
|
...props,
|
|
831
830
|
children: [children, " ", isBlank && /*#__PURE__*/jsx(NavigateAway, {
|
|
832
|
-
title: formatMessage(messages$
|
|
831
|
+
title: formatMessage(messages$8.opensInNewTab)
|
|
833
832
|
})]
|
|
834
833
|
});
|
|
835
834
|
};
|
|
@@ -1405,7 +1404,7 @@ const AvatarWrapper = ({
|
|
|
1405
1404
|
type: AvatarType.THUMBNAIL,
|
|
1406
1405
|
children: /*#__PURE__*/jsx("img", {
|
|
1407
1406
|
src: url,
|
|
1408
|
-
alt: "
|
|
1407
|
+
alt: "",
|
|
1409
1408
|
onError: () => setImageLoadError(true)
|
|
1410
1409
|
}),
|
|
1411
1410
|
...avatarProps
|
|
@@ -1459,268 +1458,23 @@ function getInitials(name) {
|
|
|
1459
1458
|
return allInitials[0] + allInitials.slice(-1);
|
|
1460
1459
|
}
|
|
1461
1460
|
|
|
1462
|
-
const THROTTLE_MS = 100;
|
|
1463
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1464
|
-
const useClientWidth = ({
|
|
1465
|
-
ref,
|
|
1466
|
-
throttleMs = THROTTLE_MS
|
|
1467
|
-
}) => {
|
|
1468
|
-
const [clientWidth, setClientWidth] = useState(null);
|
|
1469
|
-
useIsomorphicLayoutEffect(() => {
|
|
1470
|
-
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1471
|
-
const updateClientWidth = () => {
|
|
1472
|
-
if (ref) {
|
|
1473
|
-
// when `ref` is a window
|
|
1474
|
-
if ('innerWidth' in ref) {
|
|
1475
|
-
setClientWidth(ref.innerWidth);
|
|
1476
|
-
}
|
|
1477
|
-
// when `ref` is an element
|
|
1478
|
-
else if (ref.current) {
|
|
1479
|
-
setClientWidth(ref.current.clientWidth);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
};
|
|
1483
|
-
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1484
|
-
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1485
|
-
// won't get removed even if the component is unmounted.
|
|
1486
|
-
const attachedFunction = throttle(updateClientWidth, throttleMs);
|
|
1487
|
-
window.addEventListener('resize', attachedFunction, true);
|
|
1488
|
-
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1489
|
-
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1490
|
-
window.requestAnimationFrame(updateClientWidth);
|
|
1491
|
-
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1492
|
-
}, []);
|
|
1493
|
-
return [clientWidth];
|
|
1494
|
-
};
|
|
1495
|
-
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1496
|
-
|
|
1497
|
-
const useConditionalListener = ({
|
|
1498
|
-
attachListener,
|
|
1499
|
-
callback,
|
|
1500
|
-
eventType,
|
|
1501
|
-
parent
|
|
1502
|
-
}) => {
|
|
1503
|
-
useEffect(() => {
|
|
1504
|
-
if (attachListener && !isUndefined(parent)) {
|
|
1505
|
-
parent.addEventListener(eventType, callback, true);
|
|
1506
|
-
}
|
|
1507
|
-
return () => {
|
|
1508
|
-
if (!isUndefined(parent)) {
|
|
1509
|
-
parent.removeEventListener(eventType, callback, true);
|
|
1510
|
-
}
|
|
1511
|
-
};
|
|
1512
|
-
}, [attachListener, callback, eventType, parent]);
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
|
-
const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
|
|
1516
|
-
const DirectionProvider = ({
|
|
1517
|
-
direction,
|
|
1518
|
-
children
|
|
1519
|
-
}) => {
|
|
1520
|
-
return /*#__PURE__*/jsx(DirectionContext.Provider, {
|
|
1521
|
-
value: direction,
|
|
1522
|
-
children: children
|
|
1523
|
-
});
|
|
1524
|
-
};
|
|
1525
|
-
|
|
1526
|
-
const useDirection = () => {
|
|
1527
|
-
const direction = useContext(DirectionContext);
|
|
1528
|
-
return {
|
|
1529
|
-
direction,
|
|
1530
|
-
isRTL: direction === 'rtl'
|
|
1531
|
-
};
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
const ObserverParams = {
|
|
1535
|
-
threshold: 0.1
|
|
1536
|
-
};
|
|
1537
|
-
|
|
1538
|
-
/**
|
|
1539
|
-
* useHasIntersected.
|
|
1540
|
-
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1541
|
-
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1542
|
-
*
|
|
1543
|
-
* @param elRef.elRef
|
|
1544
|
-
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1545
|
-
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1546
|
-
* @param elRef.loading
|
|
1547
|
-
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1548
|
-
*/
|
|
1549
|
-
const useHasIntersected = ({
|
|
1550
|
-
elRef,
|
|
1551
|
-
loading
|
|
1552
|
-
}) => {
|
|
1553
|
-
const [hasIntersected, setHasIntersected] = useState(false);
|
|
1554
|
-
const {
|
|
1555
|
-
current
|
|
1556
|
-
} = elRef || {};
|
|
1557
|
-
const isValidReference = () => {
|
|
1558
|
-
return elRef && current;
|
|
1559
|
-
};
|
|
1560
|
-
const handleOnIntersect = (entries, observer) => {
|
|
1561
|
-
entries.forEach(entry => {
|
|
1562
|
-
if (entry.isIntersecting) {
|
|
1563
|
-
setHasIntersected(true);
|
|
1564
|
-
observer.unobserve(current);
|
|
1565
|
-
}
|
|
1566
|
-
});
|
|
1567
|
-
};
|
|
1568
|
-
useEffect(() => {
|
|
1569
|
-
let observer;
|
|
1570
|
-
let didCancel = false;
|
|
1571
|
-
|
|
1572
|
-
// Check if window is define for SSR and Old browsers fallback
|
|
1573
|
-
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1574
|
-
setHasIntersected(true);
|
|
1575
|
-
} else if (!didCancel) {
|
|
1576
|
-
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1577
|
-
observer.observe(current);
|
|
1578
|
-
}
|
|
1579
|
-
return () => {
|
|
1580
|
-
didCancel = true;
|
|
1581
|
-
if (observer) {
|
|
1582
|
-
observer.unobserve(current);
|
|
1583
|
-
}
|
|
1584
|
-
};
|
|
1585
|
-
}, [elRef]);
|
|
1586
|
-
if (loading === 'eager') {
|
|
1587
|
-
return [false];
|
|
1588
|
-
}
|
|
1589
|
-
return [hasIntersected];
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
const useLayout = () => {
|
|
1593
|
-
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1594
|
-
const [breakpoint, setBreakpoint] = useState();
|
|
1595
|
-
const [clientWidth] = useClientWidth({
|
|
1596
|
-
ref: windowReference
|
|
1597
|
-
});
|
|
1598
|
-
useEffect(() => {
|
|
1599
|
-
if (!clientWidth) {
|
|
1600
|
-
return;
|
|
1601
|
-
}
|
|
1602
|
-
if (clientWidth <= Breakpoint.EXTRA_SMALL) {
|
|
1603
|
-
setBreakpoint(Breakpoint.EXTRA_SMALL);
|
|
1604
|
-
return;
|
|
1605
|
-
}
|
|
1606
|
-
if (Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= Breakpoint.SMALL) {
|
|
1607
|
-
setBreakpoint(Breakpoint.SMALL);
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
if (Breakpoint.SMALL < clientWidth && clientWidth <= Breakpoint.MEDIUM) {
|
|
1611
|
-
setBreakpoint(Breakpoint.MEDIUM);
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
if (Breakpoint.MEDIUM < clientWidth && clientWidth <= Breakpoint.LARGE) {
|
|
1615
|
-
setBreakpoint(Breakpoint.LARGE);
|
|
1616
|
-
return;
|
|
1617
|
-
}
|
|
1618
|
-
if (Breakpoint.LARGE < clientWidth) {
|
|
1619
|
-
setBreakpoint(Breakpoint.EXTRA_LARGE);
|
|
1620
|
-
}
|
|
1621
|
-
}, [clientWidth]);
|
|
1622
|
-
return {
|
|
1623
|
-
isMobile: !!breakpoint && [Breakpoint.EXTRA_SMALL, Breakpoint.SMALL].includes(breakpoint),
|
|
1624
|
-
isExtraSmall: breakpoint === Breakpoint.EXTRA_SMALL,
|
|
1625
|
-
isSmall: breakpoint === Breakpoint.SMALL,
|
|
1626
|
-
isMedium: breakpoint === Breakpoint.MEDIUM,
|
|
1627
|
-
isLarge: breakpoint === Breakpoint.LARGE,
|
|
1628
|
-
isExtraLarge: breakpoint === Breakpoint.EXTRA_LARGE
|
|
1629
|
-
};
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
|
-
/**
|
|
1633
|
-
* This function returns the first and the last focusable elements within a node.
|
|
1634
|
-
*
|
|
1635
|
-
* @param {Node} focusBoundaryContainer - the area that contains focused elements.
|
|
1636
|
-
* @returns {object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
|
|
1637
|
-
*/
|
|
1638
|
-
|
|
1639
|
-
const getFocusableElements = focusBoundaryContainer => {
|
|
1640
|
-
const focusableEls = {
|
|
1641
|
-
first: focusBoundaryContainer,
|
|
1642
|
-
last: focusBoundaryContainer
|
|
1643
|
-
};
|
|
1644
|
-
if (focusBoundaryContainer?.querySelectorAll) {
|
|
1645
|
-
const allEls = [...focusBoundaryContainer.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(element => !element.hasAttribute('disabled'));
|
|
1646
|
-
if (allEls.length > 0) {
|
|
1647
|
-
[focusableEls.first] = allEls;
|
|
1648
|
-
focusableEls.last = allEls[allEls.length - 1];
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
return focusableEls;
|
|
1652
|
-
};
|
|
1653
|
-
|
|
1654
|
-
/**
|
|
1655
|
-
* This function resets the focus to either last of first focusable elements within a node.
|
|
1656
|
-
*
|
|
1657
|
-
* @param {object} focusableEls - contains the first last of first focusable elements within a node.
|
|
1658
|
-
* @param {object} event - the triggered event
|
|
1659
|
-
*/
|
|
1660
|
-
|
|
1661
|
-
const resetFocus = ({
|
|
1662
|
-
focusableEls: {
|
|
1663
|
-
first,
|
|
1664
|
-
last
|
|
1665
|
-
},
|
|
1666
|
-
event
|
|
1667
|
-
}) => {
|
|
1668
|
-
const {
|
|
1669
|
-
activeElement
|
|
1670
|
-
} = document;
|
|
1671
|
-
if (event.shiftKey && activeElement === first) {
|
|
1672
|
-
if (last) {
|
|
1673
|
-
last.focus();
|
|
1674
|
-
}
|
|
1675
|
-
event.preventDefault();
|
|
1676
|
-
}
|
|
1677
|
-
if (!event.shiftKey && activeElement === last) {
|
|
1678
|
-
if (first) {
|
|
1679
|
-
first.focus();
|
|
1680
|
-
}
|
|
1681
|
-
event.preventDefault();
|
|
1682
|
-
}
|
|
1683
|
-
};
|
|
1684
|
-
|
|
1685
|
-
const {
|
|
1686
|
-
TAB
|
|
1687
|
-
} = Key;
|
|
1688
1461
|
const FocusBoundary = ({
|
|
1689
1462
|
children
|
|
1690
1463
|
}) => {
|
|
1691
|
-
const
|
|
1692
|
-
const parent = isUndefined(document) ? undefined : document;
|
|
1693
|
-
const [focusableEls, setFocusableEls] = useState({});
|
|
1464
|
+
const wrapperReference = useRef(null);
|
|
1694
1465
|
useEffect(() => {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
});
|
|
1699
|
-
setFocusableEls(getFocusableElements(boundaryReference.current));
|
|
1700
|
-
}
|
|
1466
|
+
wrapperReference.current?.focus({
|
|
1467
|
+
preventScroll: true
|
|
1468
|
+
});
|
|
1701
1469
|
}, []);
|
|
1702
|
-
// If event type is Tab the resetFocus will force the focus to either the first focusable or last in boundaryRef .
|
|
1703
|
-
useConditionalListener({
|
|
1704
|
-
eventType: 'keydown',
|
|
1705
|
-
callback: event => {
|
|
1706
|
-
if (isKey({
|
|
1707
|
-
keyType: TAB,
|
|
1708
|
-
event
|
|
1709
|
-
})) {
|
|
1710
|
-
resetFocus({
|
|
1711
|
-
event,
|
|
1712
|
-
focusableEls
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
},
|
|
1716
|
-
attachListener: true,
|
|
1717
|
-
parent
|
|
1718
|
-
});
|
|
1719
1470
|
return /*#__PURE__*/jsx("div", {
|
|
1720
|
-
ref:
|
|
1471
|
+
ref: wrapperReference,
|
|
1721
1472
|
tabIndex: -1,
|
|
1722
|
-
|
|
1723
|
-
|
|
1473
|
+
children: /*#__PURE__*/jsx(FocusScope, {
|
|
1474
|
+
contain: true,
|
|
1475
|
+
restoreFocus: true,
|
|
1476
|
+
children: children
|
|
1477
|
+
})
|
|
1724
1478
|
});
|
|
1725
1479
|
};
|
|
1726
1480
|
var FocusBoundary$1 = FocusBoundary;
|
|
@@ -1976,6 +1730,176 @@ SlidingPanel.defaultProps = {
|
|
|
1976
1730
|
};
|
|
1977
1731
|
var SlidingPanel$1 = SlidingPanel;
|
|
1978
1732
|
|
|
1733
|
+
const THROTTLE_MS = 100;
|
|
1734
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1735
|
+
const useClientWidth = ({
|
|
1736
|
+
ref,
|
|
1737
|
+
throttleMs = THROTTLE_MS
|
|
1738
|
+
}) => {
|
|
1739
|
+
const [clientWidth, setClientWidth] = useState(null);
|
|
1740
|
+
useIsomorphicLayoutEffect(() => {
|
|
1741
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1742
|
+
const updateClientWidth = () => {
|
|
1743
|
+
if (ref) {
|
|
1744
|
+
// when `ref` is a window
|
|
1745
|
+
if ('innerWidth' in ref) {
|
|
1746
|
+
setClientWidth(ref.innerWidth);
|
|
1747
|
+
}
|
|
1748
|
+
// when `ref` is an element
|
|
1749
|
+
else if (ref.current) {
|
|
1750
|
+
setClientWidth(ref.current.clientWidth);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1755
|
+
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1756
|
+
// won't get removed even if the component is unmounted.
|
|
1757
|
+
const attachedFunction = throttle(updateClientWidth, throttleMs);
|
|
1758
|
+
window.addEventListener('resize', attachedFunction, true);
|
|
1759
|
+
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1760
|
+
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1761
|
+
window.requestAnimationFrame(updateClientWidth);
|
|
1762
|
+
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1763
|
+
}, []);
|
|
1764
|
+
return [clientWidth];
|
|
1765
|
+
};
|
|
1766
|
+
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1767
|
+
|
|
1768
|
+
const useConditionalListener = ({
|
|
1769
|
+
attachListener,
|
|
1770
|
+
callback,
|
|
1771
|
+
eventType,
|
|
1772
|
+
parent
|
|
1773
|
+
}) => {
|
|
1774
|
+
useEffect(() => {
|
|
1775
|
+
if (attachListener && !isUndefined(parent)) {
|
|
1776
|
+
parent.addEventListener(eventType, callback, true);
|
|
1777
|
+
}
|
|
1778
|
+
return () => {
|
|
1779
|
+
if (!isUndefined(parent)) {
|
|
1780
|
+
parent.removeEventListener(eventType, callback, true);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
}, [attachListener, callback, eventType, parent]);
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
|
|
1787
|
+
const DirectionProvider = ({
|
|
1788
|
+
direction,
|
|
1789
|
+
children
|
|
1790
|
+
}) => {
|
|
1791
|
+
return /*#__PURE__*/jsx(DirectionContext.Provider, {
|
|
1792
|
+
value: direction,
|
|
1793
|
+
children: children
|
|
1794
|
+
});
|
|
1795
|
+
};
|
|
1796
|
+
|
|
1797
|
+
const useDirection = () => {
|
|
1798
|
+
const direction = useContext(DirectionContext);
|
|
1799
|
+
return {
|
|
1800
|
+
direction,
|
|
1801
|
+
isRTL: direction === 'rtl'
|
|
1802
|
+
};
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
const ObserverParams = {
|
|
1806
|
+
threshold: 0.1
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* useHasIntersected.
|
|
1811
|
+
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1812
|
+
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1813
|
+
*
|
|
1814
|
+
* @param elRef.elRef
|
|
1815
|
+
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1816
|
+
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1817
|
+
* @param elRef.loading
|
|
1818
|
+
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1819
|
+
*/
|
|
1820
|
+
const useHasIntersected = ({
|
|
1821
|
+
elRef,
|
|
1822
|
+
loading
|
|
1823
|
+
}) => {
|
|
1824
|
+
const [hasIntersected, setHasIntersected] = useState(false);
|
|
1825
|
+
const {
|
|
1826
|
+
current
|
|
1827
|
+
} = elRef || {};
|
|
1828
|
+
const isValidReference = () => {
|
|
1829
|
+
return elRef && current;
|
|
1830
|
+
};
|
|
1831
|
+
const handleOnIntersect = (entries, observer) => {
|
|
1832
|
+
entries.forEach(entry => {
|
|
1833
|
+
if (entry.isIntersecting) {
|
|
1834
|
+
setHasIntersected(true);
|
|
1835
|
+
observer.unobserve(current);
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
};
|
|
1839
|
+
useEffect(() => {
|
|
1840
|
+
let observer;
|
|
1841
|
+
let didCancel = false;
|
|
1842
|
+
|
|
1843
|
+
// Check if window is define for SSR and Old browsers fallback
|
|
1844
|
+
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1845
|
+
setHasIntersected(true);
|
|
1846
|
+
} else if (!didCancel) {
|
|
1847
|
+
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1848
|
+
observer.observe(current);
|
|
1849
|
+
}
|
|
1850
|
+
return () => {
|
|
1851
|
+
didCancel = true;
|
|
1852
|
+
if (observer) {
|
|
1853
|
+
observer.unobserve(current);
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
}, [elRef]);
|
|
1857
|
+
if (loading === 'eager') {
|
|
1858
|
+
return [false];
|
|
1859
|
+
}
|
|
1860
|
+
return [hasIntersected];
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
const useLayout = () => {
|
|
1864
|
+
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1865
|
+
const [breakpoint, setBreakpoint] = useState();
|
|
1866
|
+
const [clientWidth] = useClientWidth({
|
|
1867
|
+
ref: windowReference
|
|
1868
|
+
});
|
|
1869
|
+
useEffect(() => {
|
|
1870
|
+
if (!clientWidth) {
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (clientWidth <= Breakpoint.EXTRA_SMALL) {
|
|
1874
|
+
setBreakpoint(Breakpoint.EXTRA_SMALL);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
if (Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= Breakpoint.SMALL) {
|
|
1878
|
+
setBreakpoint(Breakpoint.SMALL);
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
if (Breakpoint.SMALL < clientWidth && clientWidth <= Breakpoint.MEDIUM) {
|
|
1882
|
+
setBreakpoint(Breakpoint.MEDIUM);
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
if (Breakpoint.MEDIUM < clientWidth && clientWidth <= Breakpoint.LARGE) {
|
|
1886
|
+
setBreakpoint(Breakpoint.LARGE);
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
if (Breakpoint.LARGE < clientWidth) {
|
|
1890
|
+
setBreakpoint(Breakpoint.EXTRA_LARGE);
|
|
1891
|
+
}
|
|
1892
|
+
}, [clientWidth]);
|
|
1893
|
+
return {
|
|
1894
|
+
isMobile: !!breakpoint && [Breakpoint.EXTRA_SMALL, Breakpoint.SMALL].includes(breakpoint),
|
|
1895
|
+
isExtraSmall: breakpoint === Breakpoint.EXTRA_SMALL,
|
|
1896
|
+
isSmall: breakpoint === Breakpoint.SMALL,
|
|
1897
|
+
isMedium: breakpoint === Breakpoint.MEDIUM,
|
|
1898
|
+
isLarge: breakpoint === Breakpoint.LARGE,
|
|
1899
|
+
isExtraLarge: breakpoint === Breakpoint.EXTRA_LARGE
|
|
1900
|
+
};
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1979
1903
|
const INITIAL_Y_POSITION = 0;
|
|
1980
1904
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
1981
1905
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2539,7 +2463,7 @@ const Chip = ({
|
|
|
2539
2463
|
}, value);
|
|
2540
2464
|
};
|
|
2541
2465
|
|
|
2542
|
-
var messages$
|
|
2466
|
+
var messages$7 = defineMessages({
|
|
2543
2467
|
ariaLabel: {
|
|
2544
2468
|
id: "neptune.Chips.ariaLabel"
|
|
2545
2469
|
}
|
|
@@ -2571,7 +2495,7 @@ const Chips = ({
|
|
|
2571
2495
|
value: chip.value,
|
|
2572
2496
|
label: chip.label,
|
|
2573
2497
|
closeButton: {
|
|
2574
|
-
'aria-label': intl.formatMessage(messages$
|
|
2498
|
+
'aria-label': intl.formatMessage(messages$7.ariaLabel, {
|
|
2575
2499
|
choice: chip.label
|
|
2576
2500
|
})
|
|
2577
2501
|
},
|
|
@@ -2679,7 +2603,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
|
|
|
2679
2603
|
|
|
2680
2604
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2681
2605
|
|
|
2682
|
-
var messages$
|
|
2606
|
+
var messages$6 = defineMessages({
|
|
2683
2607
|
monthLabel: {
|
|
2684
2608
|
id: "neptune.DateInput.month.label"
|
|
2685
2609
|
},
|
|
@@ -2719,8 +2643,10 @@ const DateInput = ({
|
|
|
2719
2643
|
size,
|
|
2720
2644
|
value,
|
|
2721
2645
|
dayLabel,
|
|
2646
|
+
dayAutoComplete,
|
|
2722
2647
|
monthLabel,
|
|
2723
2648
|
yearLabel,
|
|
2649
|
+
yearAutoComplete,
|
|
2724
2650
|
monthFormat,
|
|
2725
2651
|
mode,
|
|
2726
2652
|
onChange,
|
|
@@ -2755,12 +2681,12 @@ const DateInput = ({
|
|
|
2755
2681
|
const [month, setMonth] = useState(() => getExplodedDate('month'));
|
|
2756
2682
|
const [year, setYear] = useState(() => getExplodedDate('year'));
|
|
2757
2683
|
const [lastBroadcastedValue, setLastBroadcastedValue] = useState(getDateObject);
|
|
2758
|
-
dayLabel = dayLabel || formatMessage(messages$
|
|
2759
|
-
monthLabel = monthLabel || formatMessage(messages$
|
|
2760
|
-
yearLabel = yearLabel || formatMessage(messages$
|
|
2684
|
+
dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
|
|
2685
|
+
monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
|
|
2686
|
+
yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
|
|
2761
2687
|
placeholders = {
|
|
2762
2688
|
day: placeholders?.day || 'DD',
|
|
2763
|
-
month: placeholders?.month || formatMessage(messages$
|
|
2689
|
+
month: placeholders?.month || formatMessage(messages$6.monthLabel),
|
|
2764
2690
|
year: placeholders?.year || 'YYYY'
|
|
2765
2691
|
};
|
|
2766
2692
|
const getDateAsString = date => {
|
|
@@ -2918,6 +2844,7 @@ const DateInput = ({
|
|
|
2918
2844
|
children: /*#__PURE__*/jsx(Input, {
|
|
2919
2845
|
type: "number",
|
|
2920
2846
|
name: "day",
|
|
2847
|
+
autoComplete: dayAutoComplete,
|
|
2921
2848
|
value: day || '',
|
|
2922
2849
|
placeholder: placeholders.day,
|
|
2923
2850
|
disabled: disabled,
|
|
@@ -2940,6 +2867,7 @@ const DateInput = ({
|
|
|
2940
2867
|
children: /*#__PURE__*/jsx(Input, {
|
|
2941
2868
|
type: "number",
|
|
2942
2869
|
name: "year",
|
|
2870
|
+
autoComplete: yearAutoComplete,
|
|
2943
2871
|
placeholder: placeholders.year,
|
|
2944
2872
|
value: year || '',
|
|
2945
2873
|
disabled: disabled,
|
|
@@ -2987,8 +2915,10 @@ DateInput.propTypes = {
|
|
|
2987
2915
|
onFocus: PropTypes.func,
|
|
2988
2916
|
onBlur: PropTypes.func,
|
|
2989
2917
|
dayLabel: PropTypes.string,
|
|
2918
|
+
dayAutoComplete: PropTypes.string,
|
|
2990
2919
|
monthLabel: PropTypes.string,
|
|
2991
2920
|
yearLabel: PropTypes.string,
|
|
2921
|
+
yearAutoComplete: PropTypes.string,
|
|
2992
2922
|
monthFormat: PropTypes.oneOf(['long', 'short']),
|
|
2993
2923
|
mode: PropTypes.oneOf(['day-month-year', 'month-year']),
|
|
2994
2924
|
placeholders: PropTypes.shape({
|
|
@@ -3187,7 +3117,7 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(({
|
|
|
3187
3117
|
});
|
|
3188
3118
|
var ResponsivePanel$1 = ResponsivePanel;
|
|
3189
3119
|
|
|
3190
|
-
var messages$
|
|
3120
|
+
var messages$5 = defineMessages({
|
|
3191
3121
|
ariaLabel: {
|
|
3192
3122
|
id: "neptune.ClearButton.ariaLabel"
|
|
3193
3123
|
}
|
|
@@ -3250,7 +3180,7 @@ const DateTrigger = ({
|
|
|
3250
3180
|
className: "input-group-addon",
|
|
3251
3181
|
children: /*#__PURE__*/jsx(CloseButton, {
|
|
3252
3182
|
className: `clear-btn clear-btn--${size}`,
|
|
3253
|
-
"aria-label": formatMessage(messages$
|
|
3183
|
+
"aria-label": formatMessage(messages$5.ariaLabel),
|
|
3254
3184
|
size: Size.SMALL,
|
|
3255
3185
|
onClick: event => {
|
|
3256
3186
|
event.stopPropagation();
|
|
@@ -3280,50 +3210,85 @@ DateTrigger.defaultProps = {
|
|
|
3280
3210
|
};
|
|
3281
3211
|
var DateTrigger$1 = DateTrigger;
|
|
3282
3212
|
|
|
3213
|
+
var messages$4 = defineMessages({
|
|
3214
|
+
next: {
|
|
3215
|
+
id: "neptune.DateLookup.next"
|
|
3216
|
+
},
|
|
3217
|
+
previous: {
|
|
3218
|
+
id: "neptune.DateLookup.previous"
|
|
3219
|
+
},
|
|
3220
|
+
day: {
|
|
3221
|
+
id: "neptune.DateLookup.day"
|
|
3222
|
+
},
|
|
3223
|
+
month: {
|
|
3224
|
+
id: "neptune.DateLookup.month"
|
|
3225
|
+
},
|
|
3226
|
+
year: {
|
|
3227
|
+
id: "neptune.DateLookup.year"
|
|
3228
|
+
},
|
|
3229
|
+
twentyYears: {
|
|
3230
|
+
id: "neptune.DateLookup.twentyYears"
|
|
3231
|
+
},
|
|
3232
|
+
selected: {
|
|
3233
|
+
id: "neptune.DateLookup.selected"
|
|
3234
|
+
},
|
|
3235
|
+
goTo20YearView: {
|
|
3236
|
+
id: "neptune.DateLookup.goTo20YearView"
|
|
3237
|
+
}
|
|
3238
|
+
});
|
|
3239
|
+
|
|
3283
3240
|
const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
|
|
3284
3241
|
const DateHeader = ({
|
|
3285
3242
|
label,
|
|
3286
3243
|
onLabelClick,
|
|
3287
3244
|
onPreviousClick,
|
|
3288
|
-
onNextClick
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
className:
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3245
|
+
onNextClick,
|
|
3246
|
+
dateMode
|
|
3247
|
+
}) => {
|
|
3248
|
+
const intl = useIntl();
|
|
3249
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3250
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3251
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3252
|
+
className: "pull-left-single-direction",
|
|
3253
|
+
children: /*#__PURE__*/jsx("button", {
|
|
3254
|
+
type: "button",
|
|
3255
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3256
|
+
"aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
|
|
3257
|
+
onClick: onPreviousClick,
|
|
3258
|
+
children: /*#__PURE__*/jsx(Chevron$1, {
|
|
3259
|
+
orientation: Position.LEFT,
|
|
3260
|
+
className: "left-single-direction",
|
|
3261
|
+
size: Size.MEDIUM
|
|
3262
|
+
})
|
|
3301
3263
|
})
|
|
3302
|
-
})
|
|
3303
|
-
}), label && /*#__PURE__*/jsx("button", {
|
|
3304
|
-
type: "button",
|
|
3305
|
-
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3306
|
-
onClick: onLabelClick,
|
|
3307
|
-
children: label
|
|
3308
|
-
}), /*#__PURE__*/jsx("div", {
|
|
3309
|
-
className: "pull-right-single-direction",
|
|
3310
|
-
children: /*#__PURE__*/jsx("button", {
|
|
3264
|
+
}), label && /*#__PURE__*/jsx("button", {
|
|
3311
3265
|
type: "button",
|
|
3312
|
-
className: `
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3266
|
+
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3267
|
+
"aria-label": intl.formatMessage(messages$4.goTo20YearView),
|
|
3268
|
+
onClick: onLabelClick,
|
|
3269
|
+
children: label
|
|
3270
|
+
}), /*#__PURE__*/jsx("div", {
|
|
3271
|
+
className: "pull-right-single-direction",
|
|
3272
|
+
children: /*#__PURE__*/jsx("button", {
|
|
3273
|
+
type: "button",
|
|
3274
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3275
|
+
"aria-label": `${useIntl().formatMessage(messages$4.next)} ${dateMode}`,
|
|
3276
|
+
onClick: onNextClick,
|
|
3277
|
+
children: /*#__PURE__*/jsx(Chevron$1, {
|
|
3278
|
+
orientation: Position.RIGHT,
|
|
3279
|
+
className: "right-single-direction",
|
|
3280
|
+
size: Size.MEDIUM
|
|
3281
|
+
})
|
|
3318
3282
|
})
|
|
3319
|
-
})
|
|
3320
|
-
})
|
|
3321
|
-
}
|
|
3283
|
+
})]
|
|
3284
|
+
});
|
|
3285
|
+
};
|
|
3322
3286
|
DateHeader.propTypes = {
|
|
3323
3287
|
label: PropTypes.string,
|
|
3324
3288
|
onLabelClick: PropTypes.func,
|
|
3325
3289
|
onPreviousClick: PropTypes.func.isRequired,
|
|
3326
|
-
onNextClick: PropTypes.func.isRequired
|
|
3290
|
+
onNextClick: PropTypes.func.isRequired,
|
|
3291
|
+
dateMode: PropTypes.string
|
|
3327
3292
|
};
|
|
3328
3293
|
DateHeader.defaultProps = {
|
|
3329
3294
|
label: null,
|
|
@@ -3349,6 +3314,12 @@ class TableLink extends PureComponent {
|
|
|
3349
3314
|
this.props.onClick(this.props.item);
|
|
3350
3315
|
}
|
|
3351
3316
|
};
|
|
3317
|
+
calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
|
|
3318
|
+
if (active) {
|
|
3319
|
+
return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
|
|
3320
|
+
}
|
|
3321
|
+
return longTitle || title;
|
|
3322
|
+
};
|
|
3352
3323
|
render() {
|
|
3353
3324
|
const {
|
|
3354
3325
|
item,
|
|
@@ -3357,14 +3328,17 @@ class TableLink extends PureComponent {
|
|
|
3357
3328
|
longTitle,
|
|
3358
3329
|
active,
|
|
3359
3330
|
disabled,
|
|
3360
|
-
today
|
|
3331
|
+
today,
|
|
3332
|
+
intl: {
|
|
3333
|
+
formatMessage
|
|
3334
|
+
}
|
|
3361
3335
|
} = this.props;
|
|
3362
3336
|
return /*#__PURE__*/jsx(Fragment, {
|
|
3363
3337
|
children: /*#__PURE__*/jsx("button", {
|
|
3364
3338
|
type: "button",
|
|
3365
3339
|
className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
|
|
3366
3340
|
disabled: disabled,
|
|
3367
|
-
"aria-label": longTitle,
|
|
3341
|
+
"aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
|
|
3368
3342
|
onClick: this.onClick,
|
|
3369
3343
|
children: title || item
|
|
3370
3344
|
})
|
|
@@ -3386,7 +3360,7 @@ TableLink.defaultProps = {
|
|
|
3386
3360
|
title: null,
|
|
3387
3361
|
longTitle: null
|
|
3388
3362
|
};
|
|
3389
|
-
var TableLink$1 = TableLink;
|
|
3363
|
+
var TableLink$1 = injectIntl(TableLink);
|
|
3390
3364
|
|
|
3391
3365
|
const SHORT_DAY_FORMAT = {
|
|
3392
3366
|
day: 'numeric'
|
|
@@ -3430,6 +3404,7 @@ class DayCalendarTable extends PureComponent {
|
|
|
3430
3404
|
};
|
|
3431
3405
|
days = getDayNames(this.props.intl.locale, 'short');
|
|
3432
3406
|
daysShort = getDayNames(this.props.intl.locale, 'narrow');
|
|
3407
|
+
daysLong = getDayNames(this.props.intl.locale, 'long');
|
|
3433
3408
|
selectDay = day => {
|
|
3434
3409
|
const {
|
|
3435
3410
|
viewMonth,
|
|
@@ -3473,10 +3448,16 @@ class DayCalendarTable extends PureComponent {
|
|
|
3473
3448
|
className: "text-xs-center np-text-body-default-bold",
|
|
3474
3449
|
children: [/*#__PURE__*/jsx("span", {
|
|
3475
3450
|
className: "hidden-xs",
|
|
3476
|
-
children:
|
|
3451
|
+
children: /*#__PURE__*/jsx("abbr", {
|
|
3452
|
+
title: this.daysLong[index],
|
|
3453
|
+
children: day.slice(0, 3)
|
|
3454
|
+
})
|
|
3477
3455
|
}), /*#__PURE__*/jsx("span", {
|
|
3478
3456
|
className: "visible-xs-inline-block",
|
|
3479
|
-
children:
|
|
3457
|
+
children: /*#__PURE__*/jsx("abbr", {
|
|
3458
|
+
title: this.daysLong[index],
|
|
3459
|
+
children: this.daysShort[index].slice(0, 2)
|
|
3460
|
+
})
|
|
3480
3461
|
})]
|
|
3481
3462
|
}, day))
|
|
3482
3463
|
})
|
|
@@ -3544,7 +3525,8 @@ class DayCalendar extends PureComponent {
|
|
|
3544
3525
|
viewMonth,
|
|
3545
3526
|
viewYear,
|
|
3546
3527
|
intl: {
|
|
3547
|
-
locale
|
|
3528
|
+
locale,
|
|
3529
|
+
formatMessage
|
|
3548
3530
|
},
|
|
3549
3531
|
monthFormat,
|
|
3550
3532
|
onLabelClick,
|
|
@@ -3556,6 +3538,7 @@ class DayCalendar extends PureComponent {
|
|
|
3556
3538
|
month: monthFormat,
|
|
3557
3539
|
year: 'numeric'
|
|
3558
3540
|
}),
|
|
3541
|
+
dateMode: formatMessage(messages$4.month),
|
|
3559
3542
|
onLabelClick: onLabelClick,
|
|
3560
3543
|
onPreviousClick: this.selectPreviousMonth,
|
|
3561
3544
|
onNextClick: this.selectNextMonth
|
|
@@ -3675,13 +3658,15 @@ class MonthCalendar extends PureComponent {
|
|
|
3675
3658
|
max,
|
|
3676
3659
|
viewYear,
|
|
3677
3660
|
intl: {
|
|
3678
|
-
locale
|
|
3661
|
+
locale,
|
|
3662
|
+
formatMessage
|
|
3679
3663
|
},
|
|
3680
3664
|
placeholder,
|
|
3681
3665
|
onLabelClick
|
|
3682
3666
|
} = this.props;
|
|
3683
3667
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3684
3668
|
children: [/*#__PURE__*/jsx(DateHeader$1, {
|
|
3669
|
+
dateMode: formatMessage(messages$4.year),
|
|
3685
3670
|
label: formatDate(new Date(viewYear, 0), locale, {
|
|
3686
3671
|
year: 'numeric'
|
|
3687
3672
|
}),
|
|
@@ -3799,10 +3784,14 @@ class YearCalendar extends PureComponent {
|
|
|
3799
3784
|
min,
|
|
3800
3785
|
max,
|
|
3801
3786
|
viewYear,
|
|
3802
|
-
placeholder
|
|
3787
|
+
placeholder,
|
|
3788
|
+
intl: {
|
|
3789
|
+
formatMessage
|
|
3790
|
+
}
|
|
3803
3791
|
} = this.props;
|
|
3804
3792
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3805
3793
|
children: [/*#__PURE__*/jsx(DateHeader$1, {
|
|
3794
|
+
dateMode: formatMessage(messages$4.twentyYears),
|
|
3806
3795
|
onPreviousClick: this.selectPreviousYears,
|
|
3807
3796
|
onNextClick: this.selectNextYears
|
|
3808
3797
|
}), /*#__PURE__*/jsx(YearCalendarTable$1, {
|
|
@@ -3830,7 +3819,7 @@ YearCalendar.defaultProps = {
|
|
|
3830
3819
|
min: null,
|
|
3831
3820
|
max: null
|
|
3832
3821
|
};
|
|
3833
|
-
var YearCalendar$1 = YearCalendar;
|
|
3822
|
+
var YearCalendar$1 = injectIntl(YearCalendar);
|
|
3834
3823
|
|
|
3835
3824
|
const MODE = {
|
|
3836
3825
|
DAY: 'day',
|
|
@@ -6495,7 +6484,7 @@ function SelectInput({
|
|
|
6495
6484
|
children: [onClear != null && value != null ? /*#__PURE__*/jsxs(Fragment, {
|
|
6496
6485
|
children: [/*#__PURE__*/jsx("button", {
|
|
6497
6486
|
type: "button",
|
|
6498
|
-
"aria-label": intl.formatMessage(messages$
|
|
6487
|
+
"aria-label": intl.formatMessage(messages$5.ariaLabel),
|
|
6499
6488
|
disabled: uiDisabled,
|
|
6500
6489
|
className: "np-select-input-addon np-select-input-addon--interactive",
|
|
6501
6490
|
onClick: event => {
|
|
@@ -10094,6 +10083,7 @@ const PhoneNumberInput = props => {
|
|
|
10094
10083
|
className: `input-group input-group-${size}`,
|
|
10095
10084
|
children: /*#__PURE__*/jsx("input", {
|
|
10096
10085
|
id: id,
|
|
10086
|
+
autoComplete: "tel-national",
|
|
10097
10087
|
name: "phoneNumber",
|
|
10098
10088
|
inputMode: "numeric",
|
|
10099
10089
|
value: internalValue.suffix,
|
|
@@ -10568,6 +10558,14 @@ var en = {
|
|
|
10568
10558
|
"neptune.DateInput.day.label": "Day",
|
|
10569
10559
|
"neptune.DateInput.month.label": "Month",
|
|
10570
10560
|
"neptune.DateInput.year.label": "Year",
|
|
10561
|
+
"neptune.DateLookup.day": "day",
|
|
10562
|
+
"neptune.DateLookup.goTo20YearView": "Go to 20 year view",
|
|
10563
|
+
"neptune.DateLookup.month": "month",
|
|
10564
|
+
"neptune.DateLookup.next": "next",
|
|
10565
|
+
"neptune.DateLookup.previous": "previous",
|
|
10566
|
+
"neptune.DateLookup.selected": "selected",
|
|
10567
|
+
"neptune.DateLookup.twentyYears": "20 years",
|
|
10568
|
+
"neptune.DateLookup.year": "year",
|
|
10571
10569
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
10572
10570
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
10573
10571
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
@@ -11029,6 +11027,7 @@ class Snackbar extends Component {
|
|
|
11029
11027
|
ref: this.bodyRef,
|
|
11030
11028
|
as: "span",
|
|
11031
11029
|
className: `snackbar__text snackbar__text--${theme}`,
|
|
11030
|
+
"aria-live": "polite",
|
|
11032
11031
|
children: [text, action ? /*#__PURE__*/jsx(ActionButton, {
|
|
11033
11032
|
className: "snackbar__text__action",
|
|
11034
11033
|
onClick: action.onClick,
|
|
@@ -11928,7 +11927,8 @@ class Tabs extends Component {
|
|
|
11928
11927
|
children: title
|
|
11929
11928
|
}, title);
|
|
11930
11929
|
}), translateLineX ? /*#__PURE__*/jsx("li", {
|
|
11931
|
-
|
|
11930
|
+
role: "none",
|
|
11931
|
+
className: "tabs__line",
|
|
11932
11932
|
style: {
|
|
11933
11933
|
width: this.getTabLineWidth(),
|
|
11934
11934
|
transform: isRTL ? `translateX(-${translateLineX})` : `translateX(${translateLineX})`
|
|
@@ -13075,6 +13075,7 @@ const ProcessingStep = props => {
|
|
|
13075
13075
|
'm-b-2': isModern
|
|
13076
13076
|
}),
|
|
13077
13077
|
type: Typography.TITLE_BODY,
|
|
13078
|
+
"aria-live": "polite",
|
|
13078
13079
|
children: psProcessingText
|
|
13079
13080
|
}), psButtonText && /*#__PURE__*/jsx(Button, {
|
|
13080
13081
|
disabled: psButtonDisabled,
|
|
@@ -13118,6 +13119,7 @@ const CompleteStep = props => {
|
|
|
13118
13119
|
className: "droppable-card-content",
|
|
13119
13120
|
children: [/*#__PURE__*/jsx("div", {
|
|
13120
13121
|
className: "droppable-card-content d-flex flex-column align-items-center",
|
|
13122
|
+
"aria-live": "polite",
|
|
13121
13123
|
children: isError ? /*#__PURE__*/jsxs(Fragment, {
|
|
13122
13124
|
children: [isModern ? /*#__PURE__*/jsx(StatusIcon, {
|
|
13123
13125
|
size: Size.LARGE,
|
|
@@ -13486,6 +13488,7 @@ class Upload extends Component {
|
|
|
13486
13488
|
onClear: event => this.handleOnClear(event)
|
|
13487
13489
|
}), !isProcessing && /*#__PURE__*/jsx("div", {
|
|
13488
13490
|
className: "droppable-dropping-card droppable-card",
|
|
13491
|
+
"aria-live": "polite",
|
|
13489
13492
|
children: /*#__PURE__*/jsxs("div", {
|
|
13490
13493
|
className: "droppable-card-content",
|
|
13491
13494
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -13960,6 +13963,7 @@ const UploadItem = ({
|
|
|
13960
13963
|
onDownload: onDownloadFile,
|
|
13961
13964
|
children: /*#__PURE__*/jsx("div", {
|
|
13962
13965
|
className: "np-upload-button",
|
|
13966
|
+
"aria-live": "polite",
|
|
13963
13967
|
children: /*#__PURE__*/jsxs("div", {
|
|
13964
13968
|
className: "media",
|
|
13965
13969
|
children: [/*#__PURE__*/jsx("div", {
|