@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.js
CHANGED
|
@@ -11,8 +11,9 @@ var formatting = require('@transferwise/formatting');
|
|
|
11
11
|
var throttle = require('lodash.throttle');
|
|
12
12
|
var reactTransitionGroup = require('react-transition-group');
|
|
13
13
|
var reactDom = require('react-dom');
|
|
14
|
-
var
|
|
14
|
+
var focus = require('@react-aria/focus');
|
|
15
15
|
var mergeRefs = require('react-merge-refs');
|
|
16
|
+
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
16
17
|
var reactPopper = require('react-popper');
|
|
17
18
|
var react$1 = require('@headlessui/react');
|
|
18
19
|
var reactId = require('@radix-ui/react-id');
|
|
@@ -644,10 +645,8 @@ const Option$2 = /*#__PURE__*/React.forwardRef(({
|
|
|
644
645
|
})
|
|
645
646
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
646
647
|
className: "media-body",
|
|
647
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
648
|
-
|
|
649
|
-
type: exports.Typography.BODY_LARGE_BOLD,
|
|
650
|
-
className: "text-primary np-option__title d-block",
|
|
648
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
|
|
649
|
+
className: "np-text-body-large-bold text-primary np-option__title",
|
|
651
650
|
children: title
|
|
652
651
|
}), content && /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
653
652
|
className: "d-block np-option__body",
|
|
@@ -797,7 +796,7 @@ const ActionOption = ({
|
|
|
797
796
|
});
|
|
798
797
|
};
|
|
799
798
|
|
|
800
|
-
var messages$
|
|
799
|
+
var messages$9 = reactIntl.defineMessages({
|
|
801
800
|
ariaLabel: {
|
|
802
801
|
id: "neptune.CloseButton.ariaLabel"
|
|
803
802
|
}
|
|
@@ -813,7 +812,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
|
|
|
813
812
|
testId
|
|
814
813
|
}, reference) {
|
|
815
814
|
const intl = reactIntl.useIntl();
|
|
816
|
-
ariaLabel ??= intl.formatMessage(messages$
|
|
815
|
+
ariaLabel ??= intl.formatMessage(messages$9.ariaLabel);
|
|
817
816
|
const Icon = filled ? icons.CrossCircleFill : icons.Cross;
|
|
818
817
|
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
819
818
|
ref: reference,
|
|
@@ -833,7 +832,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
|
|
|
833
832
|
});
|
|
834
833
|
});
|
|
835
834
|
|
|
836
|
-
var messages$
|
|
835
|
+
var messages$8 = reactIntl.defineMessages({
|
|
837
836
|
opensInNewTab: {
|
|
838
837
|
id: "neptune.Link.opensInNewTab"
|
|
839
838
|
}
|
|
@@ -862,7 +861,7 @@ const Link = ({
|
|
|
862
861
|
onClick: onClick,
|
|
863
862
|
...props,
|
|
864
863
|
children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
|
|
865
|
-
title: formatMessage(messages$
|
|
864
|
+
title: formatMessage(messages$8.opensInNewTab)
|
|
866
865
|
})]
|
|
867
866
|
});
|
|
868
867
|
};
|
|
@@ -1438,7 +1437,7 @@ const AvatarWrapper = ({
|
|
|
1438
1437
|
type: exports.AvatarType.THUMBNAIL,
|
|
1439
1438
|
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
1440
1439
|
src: url,
|
|
1441
|
-
alt: "
|
|
1440
|
+
alt: "",
|
|
1442
1441
|
onError: () => setImageLoadError(true)
|
|
1443
1442
|
}),
|
|
1444
1443
|
...avatarProps
|
|
@@ -1492,268 +1491,23 @@ function getInitials(name) {
|
|
|
1492
1491
|
return allInitials[0] + allInitials.slice(-1);
|
|
1493
1492
|
}
|
|
1494
1493
|
|
|
1495
|
-
const THROTTLE_MS = 100;
|
|
1496
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1497
|
-
const useClientWidth = ({
|
|
1498
|
-
ref,
|
|
1499
|
-
throttleMs = THROTTLE_MS
|
|
1500
|
-
}) => {
|
|
1501
|
-
const [clientWidth, setClientWidth] = React.useState(null);
|
|
1502
|
-
useIsomorphicLayoutEffect(() => {
|
|
1503
|
-
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1504
|
-
const updateClientWidth = () => {
|
|
1505
|
-
if (ref) {
|
|
1506
|
-
// when `ref` is a window
|
|
1507
|
-
if ('innerWidth' in ref) {
|
|
1508
|
-
setClientWidth(ref.innerWidth);
|
|
1509
|
-
}
|
|
1510
|
-
// when `ref` is an element
|
|
1511
|
-
else if (ref.current) {
|
|
1512
|
-
setClientWidth(ref.current.clientWidth);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
};
|
|
1516
|
-
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1517
|
-
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1518
|
-
// won't get removed even if the component is unmounted.
|
|
1519
|
-
const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
|
|
1520
|
-
window.addEventListener('resize', attachedFunction, true);
|
|
1521
|
-
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1522
|
-
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1523
|
-
window.requestAnimationFrame(updateClientWidth);
|
|
1524
|
-
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1525
|
-
}, []);
|
|
1526
|
-
return [clientWidth];
|
|
1527
|
-
};
|
|
1528
|
-
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1529
|
-
|
|
1530
|
-
const useConditionalListener = ({
|
|
1531
|
-
attachListener,
|
|
1532
|
-
callback,
|
|
1533
|
-
eventType,
|
|
1534
|
-
parent
|
|
1535
|
-
}) => {
|
|
1536
|
-
React.useEffect(() => {
|
|
1537
|
-
if (attachListener && !neptuneValidation.isUndefined(parent)) {
|
|
1538
|
-
parent.addEventListener(eventType, callback, true);
|
|
1539
|
-
}
|
|
1540
|
-
return () => {
|
|
1541
|
-
if (!neptuneValidation.isUndefined(parent)) {
|
|
1542
|
-
parent.removeEventListener(eventType, callback, true);
|
|
1543
|
-
}
|
|
1544
|
-
};
|
|
1545
|
-
}, [attachListener, callback, eventType, parent]);
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
|
|
1549
|
-
const DirectionProvider = ({
|
|
1550
|
-
direction,
|
|
1551
|
-
children
|
|
1552
|
-
}) => {
|
|
1553
|
-
return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
|
|
1554
|
-
value: direction,
|
|
1555
|
-
children: children
|
|
1556
|
-
});
|
|
1557
|
-
};
|
|
1558
|
-
|
|
1559
|
-
const useDirection = () => {
|
|
1560
|
-
const direction = React.useContext(DirectionContext);
|
|
1561
|
-
return {
|
|
1562
|
-
direction,
|
|
1563
|
-
isRTL: direction === 'rtl'
|
|
1564
|
-
};
|
|
1565
|
-
};
|
|
1566
|
-
|
|
1567
|
-
const ObserverParams = {
|
|
1568
|
-
threshold: 0.1
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
/**
|
|
1572
|
-
* useHasIntersected.
|
|
1573
|
-
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1574
|
-
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1575
|
-
*
|
|
1576
|
-
* @param elRef.elRef
|
|
1577
|
-
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1578
|
-
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1579
|
-
* @param elRef.loading
|
|
1580
|
-
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1581
|
-
*/
|
|
1582
|
-
const useHasIntersected = ({
|
|
1583
|
-
elRef,
|
|
1584
|
-
loading
|
|
1585
|
-
}) => {
|
|
1586
|
-
const [hasIntersected, setHasIntersected] = React.useState(false);
|
|
1587
|
-
const {
|
|
1588
|
-
current
|
|
1589
|
-
} = elRef || {};
|
|
1590
|
-
const isValidReference = () => {
|
|
1591
|
-
return elRef && current;
|
|
1592
|
-
};
|
|
1593
|
-
const handleOnIntersect = (entries, observer) => {
|
|
1594
|
-
entries.forEach(entry => {
|
|
1595
|
-
if (entry.isIntersecting) {
|
|
1596
|
-
setHasIntersected(true);
|
|
1597
|
-
observer.unobserve(current);
|
|
1598
|
-
}
|
|
1599
|
-
});
|
|
1600
|
-
};
|
|
1601
|
-
React.useEffect(() => {
|
|
1602
|
-
let observer;
|
|
1603
|
-
let didCancel = false;
|
|
1604
|
-
|
|
1605
|
-
// Check if window is define for SSR and Old browsers fallback
|
|
1606
|
-
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1607
|
-
setHasIntersected(true);
|
|
1608
|
-
} else if (!didCancel) {
|
|
1609
|
-
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1610
|
-
observer.observe(current);
|
|
1611
|
-
}
|
|
1612
|
-
return () => {
|
|
1613
|
-
didCancel = true;
|
|
1614
|
-
if (observer) {
|
|
1615
|
-
observer.unobserve(current);
|
|
1616
|
-
}
|
|
1617
|
-
};
|
|
1618
|
-
}, [elRef]);
|
|
1619
|
-
if (loading === 'eager') {
|
|
1620
|
-
return [false];
|
|
1621
|
-
}
|
|
1622
|
-
return [hasIntersected];
|
|
1623
|
-
};
|
|
1624
|
-
|
|
1625
|
-
const useLayout = () => {
|
|
1626
|
-
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1627
|
-
const [breakpoint, setBreakpoint] = React.useState();
|
|
1628
|
-
const [clientWidth] = useClientWidth({
|
|
1629
|
-
ref: windowReference
|
|
1630
|
-
});
|
|
1631
|
-
React.useEffect(() => {
|
|
1632
|
-
if (!clientWidth) {
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
|
|
1636
|
-
setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
|
|
1637
|
-
return;
|
|
1638
|
-
}
|
|
1639
|
-
if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
|
|
1640
|
-
setBreakpoint(exports.Breakpoint.SMALL);
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
|
|
1644
|
-
setBreakpoint(exports.Breakpoint.MEDIUM);
|
|
1645
|
-
return;
|
|
1646
|
-
}
|
|
1647
|
-
if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
|
|
1648
|
-
setBreakpoint(exports.Breakpoint.LARGE);
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
|
-
if (exports.Breakpoint.LARGE < clientWidth) {
|
|
1652
|
-
setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
|
|
1653
|
-
}
|
|
1654
|
-
}, [clientWidth]);
|
|
1655
|
-
return {
|
|
1656
|
-
isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
|
|
1657
|
-
isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
|
|
1658
|
-
isSmall: breakpoint === exports.Breakpoint.SMALL,
|
|
1659
|
-
isMedium: breakpoint === exports.Breakpoint.MEDIUM,
|
|
1660
|
-
isLarge: breakpoint === exports.Breakpoint.LARGE,
|
|
1661
|
-
isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
|
|
1662
|
-
};
|
|
1663
|
-
};
|
|
1664
|
-
|
|
1665
|
-
/**
|
|
1666
|
-
* This function returns the first and the last focusable elements within a node.
|
|
1667
|
-
*
|
|
1668
|
-
* @param {Node} focusBoundaryContainer - the area that contains focused elements.
|
|
1669
|
-
* @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.
|
|
1670
|
-
*/
|
|
1671
|
-
|
|
1672
|
-
const getFocusableElements = focusBoundaryContainer => {
|
|
1673
|
-
const focusableEls = {
|
|
1674
|
-
first: focusBoundaryContainer,
|
|
1675
|
-
last: focusBoundaryContainer
|
|
1676
|
-
};
|
|
1677
|
-
if (focusBoundaryContainer?.querySelectorAll) {
|
|
1678
|
-
const allEls = [...focusBoundaryContainer.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(element => !element.hasAttribute('disabled'));
|
|
1679
|
-
if (allEls.length > 0) {
|
|
1680
|
-
[focusableEls.first] = allEls;
|
|
1681
|
-
focusableEls.last = allEls[allEls.length - 1];
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
return focusableEls;
|
|
1685
|
-
};
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* This function resets the focus to either last of first focusable elements within a node.
|
|
1689
|
-
*
|
|
1690
|
-
* @param {object} focusableEls - contains the first last of first focusable elements within a node.
|
|
1691
|
-
* @param {object} event - the triggered event
|
|
1692
|
-
*/
|
|
1693
|
-
|
|
1694
|
-
const resetFocus = ({
|
|
1695
|
-
focusableEls: {
|
|
1696
|
-
first,
|
|
1697
|
-
last
|
|
1698
|
-
},
|
|
1699
|
-
event
|
|
1700
|
-
}) => {
|
|
1701
|
-
const {
|
|
1702
|
-
activeElement
|
|
1703
|
-
} = document;
|
|
1704
|
-
if (event.shiftKey && activeElement === first) {
|
|
1705
|
-
if (last) {
|
|
1706
|
-
last.focus();
|
|
1707
|
-
}
|
|
1708
|
-
event.preventDefault();
|
|
1709
|
-
}
|
|
1710
|
-
if (!event.shiftKey && activeElement === last) {
|
|
1711
|
-
if (first) {
|
|
1712
|
-
first.focus();
|
|
1713
|
-
}
|
|
1714
|
-
event.preventDefault();
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
const {
|
|
1719
|
-
TAB
|
|
1720
|
-
} = Key;
|
|
1721
1494
|
const FocusBoundary = ({
|
|
1722
1495
|
children
|
|
1723
1496
|
}) => {
|
|
1724
|
-
const
|
|
1725
|
-
const parent = neptuneValidation.isUndefined(document) ? undefined : document;
|
|
1726
|
-
const [focusableEls, setFocusableEls] = React.useState({});
|
|
1497
|
+
const wrapperReference = React.useRef(null);
|
|
1727
1498
|
React.useEffect(() => {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
});
|
|
1732
|
-
setFocusableEls(getFocusableElements(boundaryReference.current));
|
|
1733
|
-
}
|
|
1499
|
+
wrapperReference.current?.focus({
|
|
1500
|
+
preventScroll: true
|
|
1501
|
+
});
|
|
1734
1502
|
}, []);
|
|
1735
|
-
// If event type is Tab the resetFocus will force the focus to either the first focusable or last in boundaryRef .
|
|
1736
|
-
useConditionalListener({
|
|
1737
|
-
eventType: 'keydown',
|
|
1738
|
-
callback: event => {
|
|
1739
|
-
if (neptuneValidation.isKey({
|
|
1740
|
-
keyType: TAB,
|
|
1741
|
-
event
|
|
1742
|
-
})) {
|
|
1743
|
-
resetFocus({
|
|
1744
|
-
event,
|
|
1745
|
-
focusableEls
|
|
1746
|
-
});
|
|
1747
|
-
}
|
|
1748
|
-
},
|
|
1749
|
-
attachListener: true,
|
|
1750
|
-
parent
|
|
1751
|
-
});
|
|
1752
1503
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1753
|
-
ref:
|
|
1504
|
+
ref: wrapperReference,
|
|
1754
1505
|
tabIndex: -1,
|
|
1755
|
-
|
|
1756
|
-
|
|
1506
|
+
children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
|
|
1507
|
+
contain: true,
|
|
1508
|
+
restoreFocus: true,
|
|
1509
|
+
children: children
|
|
1510
|
+
})
|
|
1757
1511
|
});
|
|
1758
1512
|
};
|
|
1759
1513
|
var FocusBoundary$1 = FocusBoundary;
|
|
@@ -2009,6 +1763,176 @@ SlidingPanel.defaultProps = {
|
|
|
2009
1763
|
};
|
|
2010
1764
|
var SlidingPanel$1 = SlidingPanel;
|
|
2011
1765
|
|
|
1766
|
+
const THROTTLE_MS = 100;
|
|
1767
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1768
|
+
const useClientWidth = ({
|
|
1769
|
+
ref,
|
|
1770
|
+
throttleMs = THROTTLE_MS
|
|
1771
|
+
}) => {
|
|
1772
|
+
const [clientWidth, setClientWidth] = React.useState(null);
|
|
1773
|
+
useIsomorphicLayoutEffect(() => {
|
|
1774
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1775
|
+
const updateClientWidth = () => {
|
|
1776
|
+
if (ref) {
|
|
1777
|
+
// when `ref` is a window
|
|
1778
|
+
if ('innerWidth' in ref) {
|
|
1779
|
+
setClientWidth(ref.innerWidth);
|
|
1780
|
+
}
|
|
1781
|
+
// when `ref` is an element
|
|
1782
|
+
else if (ref.current) {
|
|
1783
|
+
setClientWidth(ref.current.clientWidth);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1788
|
+
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1789
|
+
// won't get removed even if the component is unmounted.
|
|
1790
|
+
const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
|
|
1791
|
+
window.addEventListener('resize', attachedFunction, true);
|
|
1792
|
+
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1793
|
+
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1794
|
+
window.requestAnimationFrame(updateClientWidth);
|
|
1795
|
+
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1796
|
+
}, []);
|
|
1797
|
+
return [clientWidth];
|
|
1798
|
+
};
|
|
1799
|
+
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1800
|
+
|
|
1801
|
+
const useConditionalListener = ({
|
|
1802
|
+
attachListener,
|
|
1803
|
+
callback,
|
|
1804
|
+
eventType,
|
|
1805
|
+
parent
|
|
1806
|
+
}) => {
|
|
1807
|
+
React.useEffect(() => {
|
|
1808
|
+
if (attachListener && !neptuneValidation.isUndefined(parent)) {
|
|
1809
|
+
parent.addEventListener(eventType, callback, true);
|
|
1810
|
+
}
|
|
1811
|
+
return () => {
|
|
1812
|
+
if (!neptuneValidation.isUndefined(parent)) {
|
|
1813
|
+
parent.removeEventListener(eventType, callback, true);
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
}, [attachListener, callback, eventType, parent]);
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
|
|
1820
|
+
const DirectionProvider = ({
|
|
1821
|
+
direction,
|
|
1822
|
+
children
|
|
1823
|
+
}) => {
|
|
1824
|
+
return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
|
|
1825
|
+
value: direction,
|
|
1826
|
+
children: children
|
|
1827
|
+
});
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
const useDirection = () => {
|
|
1831
|
+
const direction = React.useContext(DirectionContext);
|
|
1832
|
+
return {
|
|
1833
|
+
direction,
|
|
1834
|
+
isRTL: direction === 'rtl'
|
|
1835
|
+
};
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
const ObserverParams = {
|
|
1839
|
+
threshold: 0.1
|
|
1840
|
+
};
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* useHasIntersected.
|
|
1844
|
+
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1845
|
+
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1846
|
+
*
|
|
1847
|
+
* @param elRef.elRef
|
|
1848
|
+
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1849
|
+
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1850
|
+
* @param elRef.loading
|
|
1851
|
+
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1852
|
+
*/
|
|
1853
|
+
const useHasIntersected = ({
|
|
1854
|
+
elRef,
|
|
1855
|
+
loading
|
|
1856
|
+
}) => {
|
|
1857
|
+
const [hasIntersected, setHasIntersected] = React.useState(false);
|
|
1858
|
+
const {
|
|
1859
|
+
current
|
|
1860
|
+
} = elRef || {};
|
|
1861
|
+
const isValidReference = () => {
|
|
1862
|
+
return elRef && current;
|
|
1863
|
+
};
|
|
1864
|
+
const handleOnIntersect = (entries, observer) => {
|
|
1865
|
+
entries.forEach(entry => {
|
|
1866
|
+
if (entry.isIntersecting) {
|
|
1867
|
+
setHasIntersected(true);
|
|
1868
|
+
observer.unobserve(current);
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
};
|
|
1872
|
+
React.useEffect(() => {
|
|
1873
|
+
let observer;
|
|
1874
|
+
let didCancel = false;
|
|
1875
|
+
|
|
1876
|
+
// Check if window is define for SSR and Old browsers fallback
|
|
1877
|
+
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1878
|
+
setHasIntersected(true);
|
|
1879
|
+
} else if (!didCancel) {
|
|
1880
|
+
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1881
|
+
observer.observe(current);
|
|
1882
|
+
}
|
|
1883
|
+
return () => {
|
|
1884
|
+
didCancel = true;
|
|
1885
|
+
if (observer) {
|
|
1886
|
+
observer.unobserve(current);
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
}, [elRef]);
|
|
1890
|
+
if (loading === 'eager') {
|
|
1891
|
+
return [false];
|
|
1892
|
+
}
|
|
1893
|
+
return [hasIntersected];
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
const useLayout = () => {
|
|
1897
|
+
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1898
|
+
const [breakpoint, setBreakpoint] = React.useState();
|
|
1899
|
+
const [clientWidth] = useClientWidth({
|
|
1900
|
+
ref: windowReference
|
|
1901
|
+
});
|
|
1902
|
+
React.useEffect(() => {
|
|
1903
|
+
if (!clientWidth) {
|
|
1904
|
+
return;
|
|
1905
|
+
}
|
|
1906
|
+
if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
|
|
1907
|
+
setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
|
|
1908
|
+
return;
|
|
1909
|
+
}
|
|
1910
|
+
if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
|
|
1911
|
+
setBreakpoint(exports.Breakpoint.SMALL);
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
|
|
1915
|
+
setBreakpoint(exports.Breakpoint.MEDIUM);
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1918
|
+
if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
|
|
1919
|
+
setBreakpoint(exports.Breakpoint.LARGE);
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
if (exports.Breakpoint.LARGE < clientWidth) {
|
|
1923
|
+
setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
|
|
1924
|
+
}
|
|
1925
|
+
}, [clientWidth]);
|
|
1926
|
+
return {
|
|
1927
|
+
isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
|
|
1928
|
+
isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
|
|
1929
|
+
isSmall: breakpoint === exports.Breakpoint.SMALL,
|
|
1930
|
+
isMedium: breakpoint === exports.Breakpoint.MEDIUM,
|
|
1931
|
+
isLarge: breakpoint === exports.Breakpoint.LARGE,
|
|
1932
|
+
isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
|
|
2012
1936
|
const INITIAL_Y_POSITION = 0;
|
|
2013
1937
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
2014
1938
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2572,7 +2496,7 @@ const Chip = ({
|
|
|
2572
2496
|
}, value);
|
|
2573
2497
|
};
|
|
2574
2498
|
|
|
2575
|
-
var messages$
|
|
2499
|
+
var messages$7 = reactIntl.defineMessages({
|
|
2576
2500
|
ariaLabel: {
|
|
2577
2501
|
id: "neptune.Chips.ariaLabel"
|
|
2578
2502
|
}
|
|
@@ -2604,7 +2528,7 @@ const Chips = ({
|
|
|
2604
2528
|
value: chip.value,
|
|
2605
2529
|
label: chip.label,
|
|
2606
2530
|
closeButton: {
|
|
2607
|
-
'aria-label': intl.formatMessage(messages$
|
|
2531
|
+
'aria-label': intl.formatMessage(messages$7.ariaLabel, {
|
|
2608
2532
|
choice: chip.label
|
|
2609
2533
|
})
|
|
2610
2534
|
},
|
|
@@ -2712,7 +2636,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
|
|
|
2712
2636
|
|
|
2713
2637
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2714
2638
|
|
|
2715
|
-
var messages$
|
|
2639
|
+
var messages$6 = reactIntl.defineMessages({
|
|
2716
2640
|
monthLabel: {
|
|
2717
2641
|
id: "neptune.DateInput.month.label"
|
|
2718
2642
|
},
|
|
@@ -2752,8 +2676,10 @@ const DateInput = ({
|
|
|
2752
2676
|
size,
|
|
2753
2677
|
value,
|
|
2754
2678
|
dayLabel,
|
|
2679
|
+
dayAutoComplete,
|
|
2755
2680
|
monthLabel,
|
|
2756
2681
|
yearLabel,
|
|
2682
|
+
yearAutoComplete,
|
|
2757
2683
|
monthFormat,
|
|
2758
2684
|
mode,
|
|
2759
2685
|
onChange,
|
|
@@ -2788,12 +2714,12 @@ const DateInput = ({
|
|
|
2788
2714
|
const [month, setMonth] = React.useState(() => getExplodedDate('month'));
|
|
2789
2715
|
const [year, setYear] = React.useState(() => getExplodedDate('year'));
|
|
2790
2716
|
const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
|
|
2791
|
-
dayLabel = dayLabel || formatMessage(messages$
|
|
2792
|
-
monthLabel = monthLabel || formatMessage(messages$
|
|
2793
|
-
yearLabel = yearLabel || formatMessage(messages$
|
|
2717
|
+
dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
|
|
2718
|
+
monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
|
|
2719
|
+
yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
|
|
2794
2720
|
placeholders = {
|
|
2795
2721
|
day: placeholders?.day || 'DD',
|
|
2796
|
-
month: placeholders?.month || formatMessage(messages$
|
|
2722
|
+
month: placeholders?.month || formatMessage(messages$6.monthLabel),
|
|
2797
2723
|
year: placeholders?.year || 'YYYY'
|
|
2798
2724
|
};
|
|
2799
2725
|
const getDateAsString = date => {
|
|
@@ -2951,6 +2877,7 @@ const DateInput = ({
|
|
|
2951
2877
|
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
2952
2878
|
type: "number",
|
|
2953
2879
|
name: "day",
|
|
2880
|
+
autoComplete: dayAutoComplete,
|
|
2954
2881
|
value: day || '',
|
|
2955
2882
|
placeholder: placeholders.day,
|
|
2956
2883
|
disabled: disabled,
|
|
@@ -2973,6 +2900,7 @@ const DateInput = ({
|
|
|
2973
2900
|
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
2974
2901
|
type: "number",
|
|
2975
2902
|
name: "year",
|
|
2903
|
+
autoComplete: yearAutoComplete,
|
|
2976
2904
|
placeholder: placeholders.year,
|
|
2977
2905
|
value: year || '',
|
|
2978
2906
|
disabled: disabled,
|
|
@@ -3020,8 +2948,10 @@ DateInput.propTypes = {
|
|
|
3020
2948
|
onFocus: PropTypes__default.default.func,
|
|
3021
2949
|
onBlur: PropTypes__default.default.func,
|
|
3022
2950
|
dayLabel: PropTypes__default.default.string,
|
|
2951
|
+
dayAutoComplete: PropTypes__default.default.string,
|
|
3023
2952
|
monthLabel: PropTypes__default.default.string,
|
|
3024
2953
|
yearLabel: PropTypes__default.default.string,
|
|
2954
|
+
yearAutoComplete: PropTypes__default.default.string,
|
|
3025
2955
|
monthFormat: PropTypes__default.default.oneOf(['long', 'short']),
|
|
3026
2956
|
mode: PropTypes__default.default.oneOf(['day-month-year', 'month-year']),
|
|
3027
2957
|
placeholders: PropTypes__default.default.shape({
|
|
@@ -3220,7 +3150,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3220
3150
|
});
|
|
3221
3151
|
var ResponsivePanel$1 = ResponsivePanel;
|
|
3222
3152
|
|
|
3223
|
-
var messages$
|
|
3153
|
+
var messages$5 = reactIntl.defineMessages({
|
|
3224
3154
|
ariaLabel: {
|
|
3225
3155
|
id: "neptune.ClearButton.ariaLabel"
|
|
3226
3156
|
}
|
|
@@ -3283,7 +3213,7 @@ const DateTrigger = ({
|
|
|
3283
3213
|
className: "input-group-addon",
|
|
3284
3214
|
children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
3285
3215
|
className: `clear-btn clear-btn--${size}`,
|
|
3286
|
-
"aria-label": formatMessage(messages$
|
|
3216
|
+
"aria-label": formatMessage(messages$5.ariaLabel),
|
|
3287
3217
|
size: exports.Size.SMALL,
|
|
3288
3218
|
onClick: event => {
|
|
3289
3219
|
event.stopPropagation();
|
|
@@ -3313,50 +3243,85 @@ DateTrigger.defaultProps = {
|
|
|
3313
3243
|
};
|
|
3314
3244
|
var DateTrigger$1 = DateTrigger;
|
|
3315
3245
|
|
|
3246
|
+
var messages$4 = reactIntl.defineMessages({
|
|
3247
|
+
next: {
|
|
3248
|
+
id: "neptune.DateLookup.next"
|
|
3249
|
+
},
|
|
3250
|
+
previous: {
|
|
3251
|
+
id: "neptune.DateLookup.previous"
|
|
3252
|
+
},
|
|
3253
|
+
day: {
|
|
3254
|
+
id: "neptune.DateLookup.day"
|
|
3255
|
+
},
|
|
3256
|
+
month: {
|
|
3257
|
+
id: "neptune.DateLookup.month"
|
|
3258
|
+
},
|
|
3259
|
+
year: {
|
|
3260
|
+
id: "neptune.DateLookup.year"
|
|
3261
|
+
},
|
|
3262
|
+
twentyYears: {
|
|
3263
|
+
id: "neptune.DateLookup.twentyYears"
|
|
3264
|
+
},
|
|
3265
|
+
selected: {
|
|
3266
|
+
id: "neptune.DateLookup.selected"
|
|
3267
|
+
},
|
|
3268
|
+
goTo20YearView: {
|
|
3269
|
+
id: "neptune.DateLookup.goTo20YearView"
|
|
3270
|
+
}
|
|
3271
|
+
});
|
|
3272
|
+
|
|
3316
3273
|
const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
|
|
3317
3274
|
const DateHeader = ({
|
|
3318
3275
|
label,
|
|
3319
3276
|
onLabelClick,
|
|
3320
3277
|
onPreviousClick,
|
|
3321
|
-
onNextClick
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
className:
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3278
|
+
onNextClick,
|
|
3279
|
+
dateMode
|
|
3280
|
+
}) => {
|
|
3281
|
+
const intl = reactIntl.useIntl();
|
|
3282
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3283
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3284
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3285
|
+
className: "pull-left-single-direction",
|
|
3286
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3287
|
+
type: "button",
|
|
3288
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3289
|
+
"aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
|
|
3290
|
+
onClick: onPreviousClick,
|
|
3291
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
|
|
3292
|
+
orientation: exports.Position.LEFT,
|
|
3293
|
+
className: "left-single-direction",
|
|
3294
|
+
size: exports.Size.MEDIUM
|
|
3295
|
+
})
|
|
3334
3296
|
})
|
|
3335
|
-
})
|
|
3336
|
-
}), label && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3337
|
-
type: "button",
|
|
3338
|
-
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3339
|
-
onClick: onLabelClick,
|
|
3340
|
-
children: label
|
|
3341
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3342
|
-
className: "pull-right-single-direction",
|
|
3343
|
-
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3297
|
+
}), label && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3344
3298
|
type: "button",
|
|
3345
|
-
className: `
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3299
|
+
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3300
|
+
"aria-label": intl.formatMessage(messages$4.goTo20YearView),
|
|
3301
|
+
onClick: onLabelClick,
|
|
3302
|
+
children: label
|
|
3303
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3304
|
+
className: "pull-right-single-direction",
|
|
3305
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3306
|
+
type: "button",
|
|
3307
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3308
|
+
"aria-label": `${reactIntl.useIntl().formatMessage(messages$4.next)} ${dateMode}`,
|
|
3309
|
+
onClick: onNextClick,
|
|
3310
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
|
|
3311
|
+
orientation: exports.Position.RIGHT,
|
|
3312
|
+
className: "right-single-direction",
|
|
3313
|
+
size: exports.Size.MEDIUM
|
|
3314
|
+
})
|
|
3351
3315
|
})
|
|
3352
|
-
})
|
|
3353
|
-
})
|
|
3354
|
-
}
|
|
3316
|
+
})]
|
|
3317
|
+
});
|
|
3318
|
+
};
|
|
3355
3319
|
DateHeader.propTypes = {
|
|
3356
3320
|
label: PropTypes__default.default.string,
|
|
3357
3321
|
onLabelClick: PropTypes__default.default.func,
|
|
3358
3322
|
onPreviousClick: PropTypes__default.default.func.isRequired,
|
|
3359
|
-
onNextClick: PropTypes__default.default.func.isRequired
|
|
3323
|
+
onNextClick: PropTypes__default.default.func.isRequired,
|
|
3324
|
+
dateMode: PropTypes__default.default.string
|
|
3360
3325
|
};
|
|
3361
3326
|
DateHeader.defaultProps = {
|
|
3362
3327
|
label: null,
|
|
@@ -3382,6 +3347,12 @@ class TableLink extends React.PureComponent {
|
|
|
3382
3347
|
this.props.onClick(this.props.item);
|
|
3383
3348
|
}
|
|
3384
3349
|
};
|
|
3350
|
+
calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
|
|
3351
|
+
if (active) {
|
|
3352
|
+
return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
|
|
3353
|
+
}
|
|
3354
|
+
return longTitle || title;
|
|
3355
|
+
};
|
|
3385
3356
|
render() {
|
|
3386
3357
|
const {
|
|
3387
3358
|
item,
|
|
@@ -3390,14 +3361,17 @@ class TableLink extends React.PureComponent {
|
|
|
3390
3361
|
longTitle,
|
|
3391
3362
|
active,
|
|
3392
3363
|
disabled,
|
|
3393
|
-
today
|
|
3364
|
+
today,
|
|
3365
|
+
intl: {
|
|
3366
|
+
formatMessage
|
|
3367
|
+
}
|
|
3394
3368
|
} = this.props;
|
|
3395
3369
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3396
3370
|
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3397
3371
|
type: "button",
|
|
3398
3372
|
className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
|
|
3399
3373
|
disabled: disabled,
|
|
3400
|
-
"aria-label": longTitle,
|
|
3374
|
+
"aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
|
|
3401
3375
|
onClick: this.onClick,
|
|
3402
3376
|
children: title || item
|
|
3403
3377
|
})
|
|
@@ -3419,7 +3393,7 @@ TableLink.defaultProps = {
|
|
|
3419
3393
|
title: null,
|
|
3420
3394
|
longTitle: null
|
|
3421
3395
|
};
|
|
3422
|
-
var TableLink$1 = TableLink;
|
|
3396
|
+
var TableLink$1 = reactIntl.injectIntl(TableLink);
|
|
3423
3397
|
|
|
3424
3398
|
const SHORT_DAY_FORMAT = {
|
|
3425
3399
|
day: 'numeric'
|
|
@@ -3463,6 +3437,7 @@ class DayCalendarTable extends React.PureComponent {
|
|
|
3463
3437
|
};
|
|
3464
3438
|
days = getDayNames(this.props.intl.locale, 'short');
|
|
3465
3439
|
daysShort = getDayNames(this.props.intl.locale, 'narrow');
|
|
3440
|
+
daysLong = getDayNames(this.props.intl.locale, 'long');
|
|
3466
3441
|
selectDay = day => {
|
|
3467
3442
|
const {
|
|
3468
3443
|
viewMonth,
|
|
@@ -3506,10 +3481,16 @@ class DayCalendarTable extends React.PureComponent {
|
|
|
3506
3481
|
className: "text-xs-center np-text-body-default-bold",
|
|
3507
3482
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3508
3483
|
className: "hidden-xs",
|
|
3509
|
-
children:
|
|
3484
|
+
children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
|
|
3485
|
+
title: this.daysLong[index],
|
|
3486
|
+
children: day.slice(0, 3)
|
|
3487
|
+
})
|
|
3510
3488
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3511
3489
|
className: "visible-xs-inline-block",
|
|
3512
|
-
children:
|
|
3490
|
+
children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
|
|
3491
|
+
title: this.daysLong[index],
|
|
3492
|
+
children: this.daysShort[index].slice(0, 2)
|
|
3493
|
+
})
|
|
3513
3494
|
})]
|
|
3514
3495
|
}, day))
|
|
3515
3496
|
})
|
|
@@ -3577,7 +3558,8 @@ class DayCalendar extends React.PureComponent {
|
|
|
3577
3558
|
viewMonth,
|
|
3578
3559
|
viewYear,
|
|
3579
3560
|
intl: {
|
|
3580
|
-
locale
|
|
3561
|
+
locale,
|
|
3562
|
+
formatMessage
|
|
3581
3563
|
},
|
|
3582
3564
|
monthFormat,
|
|
3583
3565
|
onLabelClick,
|
|
@@ -3589,6 +3571,7 @@ class DayCalendar extends React.PureComponent {
|
|
|
3589
3571
|
month: monthFormat,
|
|
3590
3572
|
year: 'numeric'
|
|
3591
3573
|
}),
|
|
3574
|
+
dateMode: formatMessage(messages$4.month),
|
|
3592
3575
|
onLabelClick: onLabelClick,
|
|
3593
3576
|
onPreviousClick: this.selectPreviousMonth,
|
|
3594
3577
|
onNextClick: this.selectNextMonth
|
|
@@ -3708,13 +3691,15 @@ class MonthCalendar extends React.PureComponent {
|
|
|
3708
3691
|
max,
|
|
3709
3692
|
viewYear,
|
|
3710
3693
|
intl: {
|
|
3711
|
-
locale
|
|
3694
|
+
locale,
|
|
3695
|
+
formatMessage
|
|
3712
3696
|
},
|
|
3713
3697
|
placeholder,
|
|
3714
3698
|
onLabelClick
|
|
3715
3699
|
} = this.props;
|
|
3716
3700
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3717
3701
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
|
|
3702
|
+
dateMode: formatMessage(messages$4.year),
|
|
3718
3703
|
label: formatting.formatDate(new Date(viewYear, 0), locale, {
|
|
3719
3704
|
year: 'numeric'
|
|
3720
3705
|
}),
|
|
@@ -3832,10 +3817,14 @@ class YearCalendar extends React.PureComponent {
|
|
|
3832
3817
|
min,
|
|
3833
3818
|
max,
|
|
3834
3819
|
viewYear,
|
|
3835
|
-
placeholder
|
|
3820
|
+
placeholder,
|
|
3821
|
+
intl: {
|
|
3822
|
+
formatMessage
|
|
3823
|
+
}
|
|
3836
3824
|
} = this.props;
|
|
3837
3825
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3838
3826
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
|
|
3827
|
+
dateMode: formatMessage(messages$4.twentyYears),
|
|
3839
3828
|
onPreviousClick: this.selectPreviousYears,
|
|
3840
3829
|
onNextClick: this.selectNextYears
|
|
3841
3830
|
}), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
|
|
@@ -3863,7 +3852,7 @@ YearCalendar.defaultProps = {
|
|
|
3863
3852
|
min: null,
|
|
3864
3853
|
max: null
|
|
3865
3854
|
};
|
|
3866
|
-
var YearCalendar$1 = YearCalendar;
|
|
3855
|
+
var YearCalendar$1 = reactIntl.injectIntl(YearCalendar);
|
|
3867
3856
|
|
|
3868
3857
|
const MODE = {
|
|
3869
3858
|
DAY: 'day',
|
|
@@ -6528,7 +6517,7 @@ function SelectInput({
|
|
|
6528
6517
|
children: [onClear != null && value != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6529
6518
|
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
6530
6519
|
type: "button",
|
|
6531
|
-
"aria-label": intl.formatMessage(messages$
|
|
6520
|
+
"aria-label": intl.formatMessage(messages$5.ariaLabel),
|
|
6532
6521
|
disabled: uiDisabled,
|
|
6533
6522
|
className: "np-select-input-addon np-select-input-addon--interactive",
|
|
6534
6523
|
onClick: event => {
|
|
@@ -10127,6 +10116,7 @@ const PhoneNumberInput = props => {
|
|
|
10127
10116
|
className: `input-group input-group-${size}`,
|
|
10128
10117
|
children: /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
10129
10118
|
id: id,
|
|
10119
|
+
autoComplete: "tel-national",
|
|
10130
10120
|
name: "phoneNumber",
|
|
10131
10121
|
inputMode: "numeric",
|
|
10132
10122
|
value: internalValue.suffix,
|
|
@@ -10601,6 +10591,14 @@ var en = {
|
|
|
10601
10591
|
"neptune.DateInput.day.label": "Day",
|
|
10602
10592
|
"neptune.DateInput.month.label": "Month",
|
|
10603
10593
|
"neptune.DateInput.year.label": "Year",
|
|
10594
|
+
"neptune.DateLookup.day": "day",
|
|
10595
|
+
"neptune.DateLookup.goTo20YearView": "Go to 20 year view",
|
|
10596
|
+
"neptune.DateLookup.month": "month",
|
|
10597
|
+
"neptune.DateLookup.next": "next",
|
|
10598
|
+
"neptune.DateLookup.previous": "previous",
|
|
10599
|
+
"neptune.DateLookup.selected": "selected",
|
|
10600
|
+
"neptune.DateLookup.twentyYears": "20 years",
|
|
10601
|
+
"neptune.DateLookup.year": "year",
|
|
10604
10602
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
10605
10603
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
10606
10604
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
@@ -11062,6 +11060,7 @@ class Snackbar extends React.Component {
|
|
|
11062
11060
|
ref: this.bodyRef,
|
|
11063
11061
|
as: "span",
|
|
11064
11062
|
className: `snackbar__text snackbar__text--${theme}`,
|
|
11063
|
+
"aria-live": "polite",
|
|
11065
11064
|
children: [text, action ? /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
|
|
11066
11065
|
className: "snackbar__text__action",
|
|
11067
11066
|
onClick: action.onClick,
|
|
@@ -11961,7 +11960,8 @@ class Tabs extends React.Component {
|
|
|
11961
11960
|
children: title
|
|
11962
11961
|
}, title);
|
|
11963
11962
|
}), translateLineX ? /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
11964
|
-
|
|
11963
|
+
role: "none",
|
|
11964
|
+
className: "tabs__line",
|
|
11965
11965
|
style: {
|
|
11966
11966
|
width: this.getTabLineWidth(),
|
|
11967
11967
|
transform: isRTL ? `translateX(-${translateLineX})` : `translateX(${translateLineX})`
|
|
@@ -13108,6 +13108,7 @@ const ProcessingStep = props => {
|
|
|
13108
13108
|
'm-b-2': isModern
|
|
13109
13109
|
}),
|
|
13110
13110
|
type: exports.Typography.TITLE_BODY,
|
|
13111
|
+
"aria-live": "polite",
|
|
13111
13112
|
children: psProcessingText
|
|
13112
13113
|
}), psButtonText && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
13113
13114
|
disabled: psButtonDisabled,
|
|
@@ -13151,6 +13152,7 @@ const CompleteStep = props => {
|
|
|
13151
13152
|
className: "droppable-card-content",
|
|
13152
13153
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13153
13154
|
className: "droppable-card-content d-flex flex-column align-items-center",
|
|
13155
|
+
"aria-live": "polite",
|
|
13154
13156
|
children: isError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13155
13157
|
children: [isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
13156
13158
|
size: exports.Size.LARGE,
|
|
@@ -13519,6 +13521,7 @@ class Upload extends React.Component {
|
|
|
13519
13521
|
onClear: event => this.handleOnClear(event)
|
|
13520
13522
|
}), !isProcessing && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13521
13523
|
className: "droppable-dropping-card droppable-card",
|
|
13524
|
+
"aria-live": "polite",
|
|
13522
13525
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13523
13526
|
className: "droppable-card-content",
|
|
13524
13527
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -13993,6 +13996,7 @@ const UploadItem = ({
|
|
|
13993
13996
|
onDownload: onDownloadFile,
|
|
13994
13997
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13995
13998
|
className: "np-upload-button",
|
|
13999
|
+
"aria-live": "polite",
|
|
13996
14000
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13997
14001
|
className: "media",
|
|
13998
14002
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|