@transferwise/components 45.15.0 → 45.16.0
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 +550 -488
- package/build/index.esm.js.map +1 -1
- package/build/index.js +549 -487
- 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/styles/popover/Popover.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -1
- package/build/types/alert/Alert.d.ts.map +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/card/Card.d.ts.map +1 -1
- package/build/types/common/card/index.d.ts +1 -0
- package/build/types/common/card/index.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/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +9 -3
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardIndicator.d.ts +5 -3
- package/build/types/promoCard/PromoCardIndicator.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 +4 -3
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
- package/src/alert/Alert.js +11 -9
- package/src/alert/Alert.spec.js +22 -13
- package/src/alert/withArrow/withArrow.spec.js +4 -4
- 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/card/Card.tsx +6 -2
- package/src/common/card/index.ts +1 -0
- 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 +25 -3
- package/src/dateLookup/tableLink/TableLink.spec.js +66 -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 +36 -9
- package/src/inputs/_BottomSheet.less +1 -1
- package/src/inputs/_BottomSheet.tsx +57 -52
- package/src/inputs/_Popover.less +1 -1
- package/src/inputs/_Popover.tsx +31 -24
- package/src/listItem/ListItem.story.tsx +1 -1
- package/src/main.css +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
- package/src/popover/Popover.css +1 -1
- package/src/promoCard/PromoCard.css +1 -1
- package/src/promoCard/PromoCard.less +9 -9
- package/src/promoCard/PromoCard.spec.tsx +1 -0
- package/src/promoCard/PromoCard.story.tsx +90 -30
- package/src/promoCard/PromoCard.tsx +69 -22
- package/src/promoCard/PromoCardIndicator.tsx +20 -8
- 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
|
};
|
|
@@ -1151,8 +1150,8 @@ const Alert = props => {
|
|
|
1151
1150
|
setShouldFire(false);
|
|
1152
1151
|
};
|
|
1153
1152
|
return /*#__PURE__*/jsxs("div", {
|
|
1154
|
-
role: "alert",
|
|
1155
1153
|
className: classNames('alert d-flex', `alert-${mappedType}`, className),
|
|
1154
|
+
"data-testid": "alert",
|
|
1156
1155
|
onTouchStart: handleTouchStart,
|
|
1157
1156
|
onTouchEnd: handleTouchEnd,
|
|
1158
1157
|
onTouchMove: handleTouchMove,
|
|
@@ -1161,17 +1160,20 @@ const Alert = props => {
|
|
|
1161
1160
|
"data-testid": variant,
|
|
1162
1161
|
children: [generateIcon(), /*#__PURE__*/jsxs("div", {
|
|
1163
1162
|
className: "alert__message",
|
|
1164
|
-
children: [
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1163
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1164
|
+
role: Sentiment.NEGATIVE === mappedType ? 'alert' : 'status',
|
|
1165
|
+
children: [title && /*#__PURE__*/jsx(Title, {
|
|
1166
|
+
className: "m-b-1",
|
|
1167
|
+
type: Typography.TITLE_BODY,
|
|
1168
|
+
children: title
|
|
1169
|
+
}), /*#__PURE__*/jsx(Body, {
|
|
1170
|
+
as: "span",
|
|
1171
|
+
className: "d-block",
|
|
1172
|
+
type: Typography.BODY_LARGE,
|
|
1173
|
+
children: children || /*#__PURE__*/jsx(InlineMarkdown$1, {
|
|
1174
|
+
children: message
|
|
1175
|
+
})
|
|
1176
|
+
})]
|
|
1175
1177
|
}), action && /*#__PURE__*/jsx(Link, {
|
|
1176
1178
|
href: action.href,
|
|
1177
1179
|
className: "m-t-1",
|
|
@@ -1405,7 +1407,7 @@ const AvatarWrapper = ({
|
|
|
1405
1407
|
type: AvatarType.THUMBNAIL,
|
|
1406
1408
|
children: /*#__PURE__*/jsx("img", {
|
|
1407
1409
|
src: url,
|
|
1408
|
-
alt: "
|
|
1410
|
+
alt: "",
|
|
1409
1411
|
onError: () => setImageLoadError(true)
|
|
1410
1412
|
}),
|
|
1411
1413
|
...avatarProps
|
|
@@ -1459,268 +1461,23 @@ function getInitials(name) {
|
|
|
1459
1461
|
return allInitials[0] + allInitials.slice(-1);
|
|
1460
1462
|
}
|
|
1461
1463
|
|
|
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
1464
|
const FocusBoundary = ({
|
|
1689
1465
|
children
|
|
1690
1466
|
}) => {
|
|
1691
|
-
const
|
|
1692
|
-
const parent = isUndefined(document) ? undefined : document;
|
|
1693
|
-
const [focusableEls, setFocusableEls] = useState({});
|
|
1467
|
+
const wrapperReference = useRef(null);
|
|
1694
1468
|
useEffect(() => {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
});
|
|
1699
|
-
setFocusableEls(getFocusableElements(boundaryReference.current));
|
|
1700
|
-
}
|
|
1469
|
+
wrapperReference.current?.focus({
|
|
1470
|
+
preventScroll: true
|
|
1471
|
+
});
|
|
1701
1472
|
}, []);
|
|
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
1473
|
return /*#__PURE__*/jsx("div", {
|
|
1720
|
-
ref:
|
|
1474
|
+
ref: wrapperReference,
|
|
1721
1475
|
tabIndex: -1,
|
|
1722
|
-
|
|
1723
|
-
|
|
1476
|
+
children: /*#__PURE__*/jsx(FocusScope, {
|
|
1477
|
+
contain: true,
|
|
1478
|
+
restoreFocus: true,
|
|
1479
|
+
children: children
|
|
1480
|
+
})
|
|
1724
1481
|
});
|
|
1725
1482
|
};
|
|
1726
1483
|
var FocusBoundary$1 = FocusBoundary;
|
|
@@ -1911,70 +1668,240 @@ const DimmerContentWrapper = ({
|
|
|
1911
1668
|
scrollBody
|
|
1912
1669
|
}) => {
|
|
1913
1670
|
useEffect(() => {
|
|
1914
|
-
if (scrollBody) {
|
|
1915
|
-
addNoScrollClass();
|
|
1671
|
+
if (scrollBody) {
|
|
1672
|
+
addNoScrollClass();
|
|
1673
|
+
}
|
|
1674
|
+
return () => {
|
|
1675
|
+
if (scrollBody) {
|
|
1676
|
+
removeNoScrollClass();
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
}, [scrollBody]);
|
|
1680
|
+
return children;
|
|
1681
|
+
};
|
|
1682
|
+
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1683
|
+
|
|
1684
|
+
const EXIT_ANIMATION = 350;
|
|
1685
|
+
const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
1686
|
+
children,
|
|
1687
|
+
className,
|
|
1688
|
+
open,
|
|
1689
|
+
position,
|
|
1690
|
+
showSlidingPanelBorder,
|
|
1691
|
+
slidingPanelPositionFixed,
|
|
1692
|
+
...rest
|
|
1693
|
+
}, reference) => {
|
|
1694
|
+
/** @type {RefObject<HTMLDivElement>} */
|
|
1695
|
+
const localReference = useRef(null);
|
|
1696
|
+
return /*#__PURE__*/jsx(CSSTransition, {
|
|
1697
|
+
...rest,
|
|
1698
|
+
nodeRef: localReference,
|
|
1699
|
+
in: open
|
|
1700
|
+
// Wait for animation to finish before unmount.
|
|
1701
|
+
,
|
|
1702
|
+
timeout: {
|
|
1703
|
+
enter: 0,
|
|
1704
|
+
exit: EXIT_ANIMATION
|
|
1705
|
+
},
|
|
1706
|
+
classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1707
|
+
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1708
|
+
}, 'sliding-panel'),
|
|
1709
|
+
appear: true,
|
|
1710
|
+
unmountOnExit: true,
|
|
1711
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1712
|
+
ref: mergeRefs([reference, localReference]),
|
|
1713
|
+
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1714
|
+
children: children
|
|
1715
|
+
})
|
|
1716
|
+
});
|
|
1717
|
+
});
|
|
1718
|
+
SlidingPanel.propTypes = {
|
|
1719
|
+
children: PropTypes.node,
|
|
1720
|
+
className: PropTypes.string,
|
|
1721
|
+
open: PropTypes.bool,
|
|
1722
|
+
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1723
|
+
showSlidingPanelBorder: PropTypes.bool,
|
|
1724
|
+
slidingPanelPositionFixed: PropTypes.bool
|
|
1725
|
+
};
|
|
1726
|
+
SlidingPanel.defaultProps = {
|
|
1727
|
+
children: null,
|
|
1728
|
+
className: undefined,
|
|
1729
|
+
open: false,
|
|
1730
|
+
position: 'left',
|
|
1731
|
+
showSlidingPanelBorder: false,
|
|
1732
|
+
slidingPanelPositionFixed: false
|
|
1733
|
+
};
|
|
1734
|
+
var SlidingPanel$1 = SlidingPanel;
|
|
1735
|
+
|
|
1736
|
+
const THROTTLE_MS = 100;
|
|
1737
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1738
|
+
const useClientWidth = ({
|
|
1739
|
+
ref,
|
|
1740
|
+
throttleMs = THROTTLE_MS
|
|
1741
|
+
}) => {
|
|
1742
|
+
const [clientWidth, setClientWidth] = useState(null);
|
|
1743
|
+
useIsomorphicLayoutEffect(() => {
|
|
1744
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1745
|
+
const updateClientWidth = () => {
|
|
1746
|
+
if (ref) {
|
|
1747
|
+
// when `ref` is a window
|
|
1748
|
+
if ('innerWidth' in ref) {
|
|
1749
|
+
setClientWidth(ref.innerWidth);
|
|
1750
|
+
}
|
|
1751
|
+
// when `ref` is an element
|
|
1752
|
+
else if (ref.current) {
|
|
1753
|
+
setClientWidth(ref.current.clientWidth);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1758
|
+
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1759
|
+
// won't get removed even if the component is unmounted.
|
|
1760
|
+
const attachedFunction = throttle(updateClientWidth, throttleMs);
|
|
1761
|
+
window.addEventListener('resize', attachedFunction, true);
|
|
1762
|
+
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1763
|
+
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1764
|
+
window.requestAnimationFrame(updateClientWidth);
|
|
1765
|
+
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1766
|
+
}, []);
|
|
1767
|
+
return [clientWidth];
|
|
1768
|
+
};
|
|
1769
|
+
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1770
|
+
|
|
1771
|
+
const useConditionalListener = ({
|
|
1772
|
+
attachListener,
|
|
1773
|
+
callback,
|
|
1774
|
+
eventType,
|
|
1775
|
+
parent
|
|
1776
|
+
}) => {
|
|
1777
|
+
useEffect(() => {
|
|
1778
|
+
if (attachListener && !isUndefined(parent)) {
|
|
1779
|
+
parent.addEventListener(eventType, callback, true);
|
|
1780
|
+
}
|
|
1781
|
+
return () => {
|
|
1782
|
+
if (!isUndefined(parent)) {
|
|
1783
|
+
parent.removeEventListener(eventType, callback, true);
|
|
1784
|
+
}
|
|
1785
|
+
};
|
|
1786
|
+
}, [attachListener, callback, eventType, parent]);
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
const DirectionContext = /*#__PURE__*/createContext(Direction.LTR);
|
|
1790
|
+
const DirectionProvider = ({
|
|
1791
|
+
direction,
|
|
1792
|
+
children
|
|
1793
|
+
}) => {
|
|
1794
|
+
return /*#__PURE__*/jsx(DirectionContext.Provider, {
|
|
1795
|
+
value: direction,
|
|
1796
|
+
children: children
|
|
1797
|
+
});
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
const useDirection = () => {
|
|
1801
|
+
const direction = useContext(DirectionContext);
|
|
1802
|
+
return {
|
|
1803
|
+
direction,
|
|
1804
|
+
isRTL: direction === 'rtl'
|
|
1805
|
+
};
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
const ObserverParams = {
|
|
1809
|
+
threshold: 0.1
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* useHasIntersected.
|
|
1814
|
+
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1815
|
+
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1816
|
+
*
|
|
1817
|
+
* @param elRef.elRef
|
|
1818
|
+
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1819
|
+
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1820
|
+
* @param elRef.loading
|
|
1821
|
+
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1822
|
+
*/
|
|
1823
|
+
const useHasIntersected = ({
|
|
1824
|
+
elRef,
|
|
1825
|
+
loading
|
|
1826
|
+
}) => {
|
|
1827
|
+
const [hasIntersected, setHasIntersected] = useState(false);
|
|
1828
|
+
const {
|
|
1829
|
+
current
|
|
1830
|
+
} = elRef || {};
|
|
1831
|
+
const isValidReference = () => {
|
|
1832
|
+
return elRef && current;
|
|
1833
|
+
};
|
|
1834
|
+
const handleOnIntersect = (entries, observer) => {
|
|
1835
|
+
entries.forEach(entry => {
|
|
1836
|
+
if (entry.isIntersecting) {
|
|
1837
|
+
setHasIntersected(true);
|
|
1838
|
+
observer.unobserve(current);
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
};
|
|
1842
|
+
useEffect(() => {
|
|
1843
|
+
let observer;
|
|
1844
|
+
let didCancel = false;
|
|
1845
|
+
|
|
1846
|
+
// Check if window is define for SSR and Old browsers fallback
|
|
1847
|
+
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1848
|
+
setHasIntersected(true);
|
|
1849
|
+
} else if (!didCancel) {
|
|
1850
|
+
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1851
|
+
observer.observe(current);
|
|
1916
1852
|
}
|
|
1917
1853
|
return () => {
|
|
1918
|
-
|
|
1919
|
-
|
|
1854
|
+
didCancel = true;
|
|
1855
|
+
if (observer) {
|
|
1856
|
+
observer.unobserve(current);
|
|
1920
1857
|
}
|
|
1921
1858
|
};
|
|
1922
|
-
}, [
|
|
1923
|
-
|
|
1859
|
+
}, [elRef]);
|
|
1860
|
+
if (loading === 'eager') {
|
|
1861
|
+
return [false];
|
|
1862
|
+
}
|
|
1863
|
+
return [hasIntersected];
|
|
1924
1864
|
};
|
|
1925
|
-
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1926
1865
|
|
|
1927
|
-
const
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
position,
|
|
1933
|
-
showSlidingPanelBorder,
|
|
1934
|
-
slidingPanelPositionFixed,
|
|
1935
|
-
...rest
|
|
1936
|
-
}, reference) => {
|
|
1937
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1938
|
-
const localReference = useRef(null);
|
|
1939
|
-
return /*#__PURE__*/jsx(CSSTransition, {
|
|
1940
|
-
...rest,
|
|
1941
|
-
nodeRef: localReference,
|
|
1942
|
-
in: open
|
|
1943
|
-
// Wait for animation to finish before unmount.
|
|
1944
|
-
,
|
|
1945
|
-
timeout: {
|
|
1946
|
-
enter: 0,
|
|
1947
|
-
exit: EXIT_ANIMATION
|
|
1948
|
-
},
|
|
1949
|
-
classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1950
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1951
|
-
}, 'sliding-panel'),
|
|
1952
|
-
appear: true,
|
|
1953
|
-
unmountOnExit: true,
|
|
1954
|
-
children: /*#__PURE__*/jsx("div", {
|
|
1955
|
-
ref: mergeRefs([reference, localReference]),
|
|
1956
|
-
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1957
|
-
children: children
|
|
1958
|
-
})
|
|
1866
|
+
const useLayout = () => {
|
|
1867
|
+
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1868
|
+
const [breakpoint, setBreakpoint] = useState();
|
|
1869
|
+
const [clientWidth] = useClientWidth({
|
|
1870
|
+
ref: windowReference
|
|
1959
1871
|
});
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1872
|
+
useEffect(() => {
|
|
1873
|
+
if (!clientWidth) {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
if (clientWidth <= Breakpoint.EXTRA_SMALL) {
|
|
1877
|
+
setBreakpoint(Breakpoint.EXTRA_SMALL);
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
if (Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= Breakpoint.SMALL) {
|
|
1881
|
+
setBreakpoint(Breakpoint.SMALL);
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1884
|
+
if (Breakpoint.SMALL < clientWidth && clientWidth <= Breakpoint.MEDIUM) {
|
|
1885
|
+
setBreakpoint(Breakpoint.MEDIUM);
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
if (Breakpoint.MEDIUM < clientWidth && clientWidth <= Breakpoint.LARGE) {
|
|
1889
|
+
setBreakpoint(Breakpoint.LARGE);
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (Breakpoint.LARGE < clientWidth) {
|
|
1893
|
+
setBreakpoint(Breakpoint.EXTRA_LARGE);
|
|
1894
|
+
}
|
|
1895
|
+
}, [clientWidth]);
|
|
1896
|
+
return {
|
|
1897
|
+
isMobile: !!breakpoint && [Breakpoint.EXTRA_SMALL, Breakpoint.SMALL].includes(breakpoint),
|
|
1898
|
+
isExtraSmall: breakpoint === Breakpoint.EXTRA_SMALL,
|
|
1899
|
+
isSmall: breakpoint === Breakpoint.SMALL,
|
|
1900
|
+
isMedium: breakpoint === Breakpoint.MEDIUM,
|
|
1901
|
+
isLarge: breakpoint === Breakpoint.LARGE,
|
|
1902
|
+
isExtraLarge: breakpoint === Breakpoint.EXTRA_LARGE
|
|
1903
|
+
};
|
|
1976
1904
|
};
|
|
1977
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1978
1905
|
|
|
1979
1906
|
const INITIAL_Y_POSITION = 0;
|
|
1980
1907
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
@@ -2333,7 +2260,7 @@ var Card$2 = Card$1;
|
|
|
2333
2260
|
|
|
2334
2261
|
const Card = ({
|
|
2335
2262
|
className,
|
|
2336
|
-
children,
|
|
2263
|
+
children = null,
|
|
2337
2264
|
id,
|
|
2338
2265
|
isDisabled = false,
|
|
2339
2266
|
isSmall = false,
|
|
@@ -2356,7 +2283,10 @@ const Card = ({
|
|
|
2356
2283
|
size: isSmall ? 'sm' : 'md',
|
|
2357
2284
|
isDisabled: isDisabled,
|
|
2358
2285
|
testId: "close-button",
|
|
2359
|
-
onClick:
|
|
2286
|
+
onClick: e => {
|
|
2287
|
+
stopPropagation$1(e);
|
|
2288
|
+
onDismiss();
|
|
2289
|
+
}
|
|
2360
2290
|
}), children]
|
|
2361
2291
|
});
|
|
2362
2292
|
};
|
|
@@ -2539,7 +2469,7 @@ const Chip = ({
|
|
|
2539
2469
|
}, value);
|
|
2540
2470
|
};
|
|
2541
2471
|
|
|
2542
|
-
var messages$
|
|
2472
|
+
var messages$7 = defineMessages({
|
|
2543
2473
|
ariaLabel: {
|
|
2544
2474
|
id: "neptune.Chips.ariaLabel"
|
|
2545
2475
|
}
|
|
@@ -2571,7 +2501,7 @@ const Chips = ({
|
|
|
2571
2501
|
value: chip.value,
|
|
2572
2502
|
label: chip.label,
|
|
2573
2503
|
closeButton: {
|
|
2574
|
-
'aria-label': intl.formatMessage(messages$
|
|
2504
|
+
'aria-label': intl.formatMessage(messages$7.ariaLabel, {
|
|
2575
2505
|
choice: chip.label
|
|
2576
2506
|
})
|
|
2577
2507
|
},
|
|
@@ -2679,7 +2609,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
|
|
|
2679
2609
|
|
|
2680
2610
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2681
2611
|
|
|
2682
|
-
var messages$
|
|
2612
|
+
var messages$6 = defineMessages({
|
|
2683
2613
|
monthLabel: {
|
|
2684
2614
|
id: "neptune.DateInput.month.label"
|
|
2685
2615
|
},
|
|
@@ -2719,8 +2649,10 @@ const DateInput = ({
|
|
|
2719
2649
|
size,
|
|
2720
2650
|
value,
|
|
2721
2651
|
dayLabel,
|
|
2652
|
+
dayAutoComplete,
|
|
2722
2653
|
monthLabel,
|
|
2723
2654
|
yearLabel,
|
|
2655
|
+
yearAutoComplete,
|
|
2724
2656
|
monthFormat,
|
|
2725
2657
|
mode,
|
|
2726
2658
|
onChange,
|
|
@@ -2755,12 +2687,12 @@ const DateInput = ({
|
|
|
2755
2687
|
const [month, setMonth] = useState(() => getExplodedDate('month'));
|
|
2756
2688
|
const [year, setYear] = useState(() => getExplodedDate('year'));
|
|
2757
2689
|
const [lastBroadcastedValue, setLastBroadcastedValue] = useState(getDateObject);
|
|
2758
|
-
dayLabel = dayLabel || formatMessage(messages$
|
|
2759
|
-
monthLabel = monthLabel || formatMessage(messages$
|
|
2760
|
-
yearLabel = yearLabel || formatMessage(messages$
|
|
2690
|
+
dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
|
|
2691
|
+
monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
|
|
2692
|
+
yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
|
|
2761
2693
|
placeholders = {
|
|
2762
2694
|
day: placeholders?.day || 'DD',
|
|
2763
|
-
month: placeholders?.month || formatMessage(messages$
|
|
2695
|
+
month: placeholders?.month || formatMessage(messages$6.monthLabel),
|
|
2764
2696
|
year: placeholders?.year || 'YYYY'
|
|
2765
2697
|
};
|
|
2766
2698
|
const getDateAsString = date => {
|
|
@@ -2918,6 +2850,7 @@ const DateInput = ({
|
|
|
2918
2850
|
children: /*#__PURE__*/jsx(Input, {
|
|
2919
2851
|
type: "number",
|
|
2920
2852
|
name: "day",
|
|
2853
|
+
autoComplete: dayAutoComplete,
|
|
2921
2854
|
value: day || '',
|
|
2922
2855
|
placeholder: placeholders.day,
|
|
2923
2856
|
disabled: disabled,
|
|
@@ -2940,6 +2873,7 @@ const DateInput = ({
|
|
|
2940
2873
|
children: /*#__PURE__*/jsx(Input, {
|
|
2941
2874
|
type: "number",
|
|
2942
2875
|
name: "year",
|
|
2876
|
+
autoComplete: yearAutoComplete,
|
|
2943
2877
|
placeholder: placeholders.year,
|
|
2944
2878
|
value: year || '',
|
|
2945
2879
|
disabled: disabled,
|
|
@@ -2987,8 +2921,10 @@ DateInput.propTypes = {
|
|
|
2987
2921
|
onFocus: PropTypes.func,
|
|
2988
2922
|
onBlur: PropTypes.func,
|
|
2989
2923
|
dayLabel: PropTypes.string,
|
|
2924
|
+
dayAutoComplete: PropTypes.string,
|
|
2990
2925
|
monthLabel: PropTypes.string,
|
|
2991
2926
|
yearLabel: PropTypes.string,
|
|
2927
|
+
yearAutoComplete: PropTypes.string,
|
|
2992
2928
|
monthFormat: PropTypes.oneOf(['long', 'short']),
|
|
2993
2929
|
mode: PropTypes.oneOf(['day-month-year', 'month-year']),
|
|
2994
2930
|
placeholders: PropTypes.shape({
|
|
@@ -3187,7 +3123,7 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(({
|
|
|
3187
3123
|
});
|
|
3188
3124
|
var ResponsivePanel$1 = ResponsivePanel;
|
|
3189
3125
|
|
|
3190
|
-
var messages$
|
|
3126
|
+
var messages$5 = defineMessages({
|
|
3191
3127
|
ariaLabel: {
|
|
3192
3128
|
id: "neptune.ClearButton.ariaLabel"
|
|
3193
3129
|
}
|
|
@@ -3250,7 +3186,7 @@ const DateTrigger = ({
|
|
|
3250
3186
|
className: "input-group-addon",
|
|
3251
3187
|
children: /*#__PURE__*/jsx(CloseButton, {
|
|
3252
3188
|
className: `clear-btn clear-btn--${size}`,
|
|
3253
|
-
"aria-label": formatMessage(messages$
|
|
3189
|
+
"aria-label": formatMessage(messages$5.ariaLabel),
|
|
3254
3190
|
size: Size.SMALL,
|
|
3255
3191
|
onClick: event => {
|
|
3256
3192
|
event.stopPropagation();
|
|
@@ -3280,50 +3216,85 @@ DateTrigger.defaultProps = {
|
|
|
3280
3216
|
};
|
|
3281
3217
|
var DateTrigger$1 = DateTrigger;
|
|
3282
3218
|
|
|
3219
|
+
var messages$4 = defineMessages({
|
|
3220
|
+
next: {
|
|
3221
|
+
id: "neptune.DateLookup.next"
|
|
3222
|
+
},
|
|
3223
|
+
previous: {
|
|
3224
|
+
id: "neptune.DateLookup.previous"
|
|
3225
|
+
},
|
|
3226
|
+
day: {
|
|
3227
|
+
id: "neptune.DateLookup.day"
|
|
3228
|
+
},
|
|
3229
|
+
month: {
|
|
3230
|
+
id: "neptune.DateLookup.month"
|
|
3231
|
+
},
|
|
3232
|
+
year: {
|
|
3233
|
+
id: "neptune.DateLookup.year"
|
|
3234
|
+
},
|
|
3235
|
+
twentyYears: {
|
|
3236
|
+
id: "neptune.DateLookup.twentyYears"
|
|
3237
|
+
},
|
|
3238
|
+
selected: {
|
|
3239
|
+
id: "neptune.DateLookup.selected"
|
|
3240
|
+
},
|
|
3241
|
+
goTo20YearView: {
|
|
3242
|
+
id: "neptune.DateLookup.goTo20YearView"
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
|
|
3283
3246
|
const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
|
|
3284
3247
|
const DateHeader = ({
|
|
3285
3248
|
label,
|
|
3286
3249
|
onLabelClick,
|
|
3287
3250
|
onPreviousClick,
|
|
3288
|
-
onNextClick
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
className:
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3251
|
+
onNextClick,
|
|
3252
|
+
dateMode
|
|
3253
|
+
}) => {
|
|
3254
|
+
const intl = useIntl();
|
|
3255
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3256
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3257
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3258
|
+
className: "pull-left-single-direction",
|
|
3259
|
+
children: /*#__PURE__*/jsx("button", {
|
|
3260
|
+
type: "button",
|
|
3261
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3262
|
+
"aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
|
|
3263
|
+
onClick: onPreviousClick,
|
|
3264
|
+
children: /*#__PURE__*/jsx(Chevron$1, {
|
|
3265
|
+
orientation: Position.LEFT,
|
|
3266
|
+
className: "left-single-direction",
|
|
3267
|
+
size: Size.MEDIUM
|
|
3268
|
+
})
|
|
3301
3269
|
})
|
|
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", {
|
|
3270
|
+
}), label && /*#__PURE__*/jsx("button", {
|
|
3311
3271
|
type: "button",
|
|
3312
|
-
className: `
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3272
|
+
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3273
|
+
"aria-label": intl.formatMessage(messages$4.goTo20YearView),
|
|
3274
|
+
onClick: onLabelClick,
|
|
3275
|
+
children: label
|
|
3276
|
+
}), /*#__PURE__*/jsx("div", {
|
|
3277
|
+
className: "pull-right-single-direction",
|
|
3278
|
+
children: /*#__PURE__*/jsx("button", {
|
|
3279
|
+
type: "button",
|
|
3280
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3281
|
+
"aria-label": `${useIntl().formatMessage(messages$4.next)} ${dateMode}`,
|
|
3282
|
+
onClick: onNextClick,
|
|
3283
|
+
children: /*#__PURE__*/jsx(Chevron$1, {
|
|
3284
|
+
orientation: Position.RIGHT,
|
|
3285
|
+
className: "right-single-direction",
|
|
3286
|
+
size: Size.MEDIUM
|
|
3287
|
+
})
|
|
3318
3288
|
})
|
|
3319
|
-
})
|
|
3320
|
-
})
|
|
3321
|
-
}
|
|
3289
|
+
})]
|
|
3290
|
+
});
|
|
3291
|
+
};
|
|
3322
3292
|
DateHeader.propTypes = {
|
|
3323
3293
|
label: PropTypes.string,
|
|
3324
3294
|
onLabelClick: PropTypes.func,
|
|
3325
3295
|
onPreviousClick: PropTypes.func.isRequired,
|
|
3326
|
-
onNextClick: PropTypes.func.isRequired
|
|
3296
|
+
onNextClick: PropTypes.func.isRequired,
|
|
3297
|
+
dateMode: PropTypes.string
|
|
3327
3298
|
};
|
|
3328
3299
|
DateHeader.defaultProps = {
|
|
3329
3300
|
label: null,
|
|
@@ -3349,6 +3320,12 @@ class TableLink extends PureComponent {
|
|
|
3349
3320
|
this.props.onClick(this.props.item);
|
|
3350
3321
|
}
|
|
3351
3322
|
};
|
|
3323
|
+
calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
|
|
3324
|
+
if (active) {
|
|
3325
|
+
return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
|
|
3326
|
+
}
|
|
3327
|
+
return longTitle || title;
|
|
3328
|
+
};
|
|
3352
3329
|
render() {
|
|
3353
3330
|
const {
|
|
3354
3331
|
item,
|
|
@@ -3357,14 +3334,18 @@ class TableLink extends PureComponent {
|
|
|
3357
3334
|
longTitle,
|
|
3358
3335
|
active,
|
|
3359
3336
|
disabled,
|
|
3360
|
-
today
|
|
3337
|
+
today,
|
|
3338
|
+
intl: {
|
|
3339
|
+
formatMessage
|
|
3340
|
+
}
|
|
3361
3341
|
} = this.props;
|
|
3362
3342
|
return /*#__PURE__*/jsx(Fragment, {
|
|
3363
3343
|
children: /*#__PURE__*/jsx("button", {
|
|
3364
3344
|
type: "button",
|
|
3365
3345
|
className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
|
|
3366
3346
|
disabled: disabled,
|
|
3367
|
-
"aria-label": longTitle,
|
|
3347
|
+
"aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
|
|
3348
|
+
"aria-pressed": active,
|
|
3368
3349
|
onClick: this.onClick,
|
|
3369
3350
|
children: title || item
|
|
3370
3351
|
})
|
|
@@ -3386,7 +3367,7 @@ TableLink.defaultProps = {
|
|
|
3386
3367
|
title: null,
|
|
3387
3368
|
longTitle: null
|
|
3388
3369
|
};
|
|
3389
|
-
var TableLink$1 = TableLink;
|
|
3370
|
+
var TableLink$1 = injectIntl(TableLink);
|
|
3390
3371
|
|
|
3391
3372
|
const SHORT_DAY_FORMAT = {
|
|
3392
3373
|
day: 'numeric'
|
|
@@ -3430,6 +3411,7 @@ class DayCalendarTable extends PureComponent {
|
|
|
3430
3411
|
};
|
|
3431
3412
|
days = getDayNames(this.props.intl.locale, 'short');
|
|
3432
3413
|
daysShort = getDayNames(this.props.intl.locale, 'narrow');
|
|
3414
|
+
daysLong = getDayNames(this.props.intl.locale, 'long');
|
|
3433
3415
|
selectDay = day => {
|
|
3434
3416
|
const {
|
|
3435
3417
|
viewMonth,
|
|
@@ -3473,10 +3455,16 @@ class DayCalendarTable extends PureComponent {
|
|
|
3473
3455
|
className: "text-xs-center np-text-body-default-bold",
|
|
3474
3456
|
children: [/*#__PURE__*/jsx("span", {
|
|
3475
3457
|
className: "hidden-xs",
|
|
3476
|
-
children:
|
|
3458
|
+
children: /*#__PURE__*/jsx("abbr", {
|
|
3459
|
+
title: this.daysLong[index],
|
|
3460
|
+
children: day.slice(0, 3)
|
|
3461
|
+
})
|
|
3477
3462
|
}), /*#__PURE__*/jsx("span", {
|
|
3478
3463
|
className: "visible-xs-inline-block",
|
|
3479
|
-
children:
|
|
3464
|
+
children: /*#__PURE__*/jsx("abbr", {
|
|
3465
|
+
title: this.daysLong[index],
|
|
3466
|
+
children: this.daysShort[index].slice(0, 2)
|
|
3467
|
+
})
|
|
3480
3468
|
})]
|
|
3481
3469
|
}, day))
|
|
3482
3470
|
})
|
|
@@ -3544,7 +3532,8 @@ class DayCalendar extends PureComponent {
|
|
|
3544
3532
|
viewMonth,
|
|
3545
3533
|
viewYear,
|
|
3546
3534
|
intl: {
|
|
3547
|
-
locale
|
|
3535
|
+
locale,
|
|
3536
|
+
formatMessage
|
|
3548
3537
|
},
|
|
3549
3538
|
monthFormat,
|
|
3550
3539
|
onLabelClick,
|
|
@@ -3556,6 +3545,7 @@ class DayCalendar extends PureComponent {
|
|
|
3556
3545
|
month: monthFormat,
|
|
3557
3546
|
year: 'numeric'
|
|
3558
3547
|
}),
|
|
3548
|
+
dateMode: formatMessage(messages$4.month),
|
|
3559
3549
|
onLabelClick: onLabelClick,
|
|
3560
3550
|
onPreviousClick: this.selectPreviousMonth,
|
|
3561
3551
|
onNextClick: this.selectNextMonth
|
|
@@ -3675,13 +3665,15 @@ class MonthCalendar extends PureComponent {
|
|
|
3675
3665
|
max,
|
|
3676
3666
|
viewYear,
|
|
3677
3667
|
intl: {
|
|
3678
|
-
locale
|
|
3668
|
+
locale,
|
|
3669
|
+
formatMessage
|
|
3679
3670
|
},
|
|
3680
3671
|
placeholder,
|
|
3681
3672
|
onLabelClick
|
|
3682
3673
|
} = this.props;
|
|
3683
3674
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3684
3675
|
children: [/*#__PURE__*/jsx(DateHeader$1, {
|
|
3676
|
+
dateMode: formatMessage(messages$4.year),
|
|
3685
3677
|
label: formatDate(new Date(viewYear, 0), locale, {
|
|
3686
3678
|
year: 'numeric'
|
|
3687
3679
|
}),
|
|
@@ -3799,10 +3791,14 @@ class YearCalendar extends PureComponent {
|
|
|
3799
3791
|
min,
|
|
3800
3792
|
max,
|
|
3801
3793
|
viewYear,
|
|
3802
|
-
placeholder
|
|
3794
|
+
placeholder,
|
|
3795
|
+
intl: {
|
|
3796
|
+
formatMessage
|
|
3797
|
+
}
|
|
3803
3798
|
} = this.props;
|
|
3804
3799
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3805
3800
|
children: [/*#__PURE__*/jsx(DateHeader$1, {
|
|
3801
|
+
dateMode: formatMessage(messages$4.twentyYears),
|
|
3806
3802
|
onPreviousClick: this.selectPreviousYears,
|
|
3807
3803
|
onNextClick: this.selectNextYears
|
|
3808
3804
|
}), /*#__PURE__*/jsx(YearCalendarTable$1, {
|
|
@@ -3830,7 +3826,7 @@ YearCalendar.defaultProps = {
|
|
|
3830
3826
|
min: null,
|
|
3831
3827
|
max: null
|
|
3832
3828
|
};
|
|
3833
|
-
var YearCalendar$1 = YearCalendar;
|
|
3829
|
+
var YearCalendar$1 = injectIntl(YearCalendar);
|
|
3834
3830
|
|
|
3835
3831
|
const MODE = {
|
|
3836
3832
|
DAY: 'day',
|
|
@@ -6229,65 +6225,74 @@ function BottomSheet({
|
|
|
6229
6225
|
getFloatingProps
|
|
6230
6226
|
} = useInteractions([dismiss, role]);
|
|
6231
6227
|
const [floatingKey, setFloatingKey] = useState(0);
|
|
6228
|
+
const {
|
|
6229
|
+
theme,
|
|
6230
|
+
screenMode
|
|
6231
|
+
} = useTheme();
|
|
6232
6232
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
6233
6233
|
children: [open ? /*#__PURE__*/jsx(PreventScroll, {}) : null, renderTrigger?.({
|
|
6234
6234
|
ref: refs.setReference,
|
|
6235
6235
|
getInteractionProps: getReferenceProps
|
|
6236
6236
|
}), /*#__PURE__*/jsx(FloatingPortal, {
|
|
6237
|
-
children: /*#__PURE__*/
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
className:
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6237
|
+
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
6238
|
+
theme: theme,
|
|
6239
|
+
screenMode: screenMode,
|
|
6240
|
+
isNotRootProvider: true,
|
|
6241
|
+
children: /*#__PURE__*/jsxs(Transition, {
|
|
6242
|
+
show: open,
|
|
6243
|
+
className: "np-bottom-sheet-v2-container",
|
|
6244
|
+
beforeEnter: () => {
|
|
6245
|
+
setFloatingKey(prev => prev + 1);
|
|
6246
|
+
},
|
|
6247
|
+
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
6248
|
+
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
6249
|
+
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
6250
|
+
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
6251
|
+
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6252
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6253
|
+
className: "np-bottom-sheet-v2-backdrop"
|
|
6254
|
+
})
|
|
6255
|
+
}), /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6256
|
+
context: context,
|
|
6257
|
+
initialFocus: initialFocusRef,
|
|
6258
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6259
|
+
className: "np-bottom-sheet-v2",
|
|
6260
|
+
children: /*#__PURE__*/jsx(Transition.Child, {
|
|
6261
|
+
className: "np-bottom-sheet-v2-content",
|
|
6262
|
+
enter: "np-bottom-sheet-v2-content--enter",
|
|
6263
|
+
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
6264
|
+
leave: "np-bottom-sheet-v2-content--leave",
|
|
6265
|
+
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
6266
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
6267
|
+
// Force inner state invalidation on open
|
|
6268
|
+
ref: refs.setFloating,
|
|
6269
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
6270
|
+
...getFloatingProps(),
|
|
6271
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
6272
|
+
className: "np-bottom-sheet-v2-header",
|
|
6273
|
+
children: /*#__PURE__*/jsx(CloseButton, {
|
|
6274
|
+
size: Size.SMALL,
|
|
6275
|
+
onClick: () => {
|
|
6276
|
+
onClose?.();
|
|
6277
|
+
}
|
|
6278
|
+
})
|
|
6279
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
6280
|
+
className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6281
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6282
|
+
}),
|
|
6283
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6284
|
+
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6285
|
+
children: title
|
|
6286
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6287
|
+
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6288
|
+
children: children
|
|
6289
|
+
})]
|
|
6285
6290
|
})]
|
|
6286
|
-
})
|
|
6287
|
-
}
|
|
6291
|
+
}, floatingKey)
|
|
6292
|
+
})
|
|
6288
6293
|
})
|
|
6289
|
-
})
|
|
6290
|
-
})
|
|
6294
|
+
})]
|
|
6295
|
+
})
|
|
6291
6296
|
})
|
|
6292
6297
|
})]
|
|
6293
6298
|
});
|
|
@@ -6363,41 +6368,50 @@ function Popover({
|
|
|
6363
6368
|
getFloatingProps
|
|
6364
6369
|
} = useInteractions([role, dismiss]);
|
|
6365
6370
|
const [floatingKey, setFloatingKey] = useState(0);
|
|
6371
|
+
const {
|
|
6372
|
+
theme,
|
|
6373
|
+
screenMode
|
|
6374
|
+
} = useTheme();
|
|
6366
6375
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
6367
6376
|
children: [open ? /*#__PURE__*/jsx(PreventScroll, {}) : null, renderTrigger({
|
|
6368
6377
|
ref: refs.setReference,
|
|
6369
6378
|
getInteractionProps: getReferenceProps
|
|
6370
6379
|
}), /*#__PURE__*/jsx(FloatingPortal, {
|
|
6371
|
-
children: /*#__PURE__*/jsx(
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
children:
|
|
6393
|
-
className:
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6380
|
+
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
6381
|
+
theme: theme,
|
|
6382
|
+
screenMode: screenMode,
|
|
6383
|
+
isNotRootProvider: true,
|
|
6384
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6385
|
+
context: context,
|
|
6386
|
+
children: /*#__PURE__*/jsx(Transition, {
|
|
6387
|
+
show: open,
|
|
6388
|
+
leave: "transition-opacity",
|
|
6389
|
+
leaveTo: "opacity-0",
|
|
6390
|
+
beforeEnter: () => {
|
|
6391
|
+
setFloatingKey(prev => prev + 1);
|
|
6392
|
+
},
|
|
6393
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6394
|
+
// Force inner state invalidation on open
|
|
6395
|
+
ref: refs.setFloating,
|
|
6396
|
+
className: "np-popover-v2-container"
|
|
6397
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
6398
|
+
,
|
|
6399
|
+
style: floatingStyles,
|
|
6400
|
+
...getFloatingProps(),
|
|
6401
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
6402
|
+
className: classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
6403
|
+
'np-popover-v2--padding-md': padding === 'md'
|
|
6404
|
+
}),
|
|
6405
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6406
|
+
className: "np-popover-v2-title np-text-title-body",
|
|
6407
|
+
children: title
|
|
6408
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6409
|
+
className: "np-popover-v2-content np-text-body-default",
|
|
6410
|
+
children: children
|
|
6411
|
+
})]
|
|
6412
|
+
})
|
|
6413
|
+
}, floatingKey)
|
|
6414
|
+
})
|
|
6401
6415
|
})
|
|
6402
6416
|
})
|
|
6403
6417
|
})]
|
|
@@ -6495,7 +6509,7 @@ function SelectInput({
|
|
|
6495
6509
|
children: [onClear != null && value != null ? /*#__PURE__*/jsxs(Fragment, {
|
|
6496
6510
|
children: [/*#__PURE__*/jsx("button", {
|
|
6497
6511
|
type: "button",
|
|
6498
|
-
"aria-label": intl.formatMessage(messages$
|
|
6512
|
+
"aria-label": intl.formatMessage(messages$5.ariaLabel),
|
|
6499
6513
|
disabled: uiDisabled,
|
|
6500
6514
|
className: "np-select-input-addon np-select-input-addon--interactive",
|
|
6501
6515
|
onClick: event => {
|
|
@@ -10094,6 +10108,7 @@ const PhoneNumberInput = props => {
|
|
|
10094
10108
|
className: `input-group input-group-${size}`,
|
|
10095
10109
|
children: /*#__PURE__*/jsx("input", {
|
|
10096
10110
|
id: id,
|
|
10111
|
+
autoComplete: "tel-national",
|
|
10097
10112
|
name: "phoneNumber",
|
|
10098
10113
|
inputMode: "numeric",
|
|
10099
10114
|
value: internalValue.suffix,
|
|
@@ -10345,10 +10360,12 @@ const PromoCardIndicator = ({
|
|
|
10345
10360
|
children,
|
|
10346
10361
|
label,
|
|
10347
10362
|
icon,
|
|
10363
|
+
isSmall = false,
|
|
10348
10364
|
testid,
|
|
10349
10365
|
...rest
|
|
10350
10366
|
}) => {
|
|
10351
|
-
const
|
|
10367
|
+
const isIconString = icon && typeof icon === 'string';
|
|
10368
|
+
const IconComponent = isIconString && {
|
|
10352
10369
|
check: Check,
|
|
10353
10370
|
arrow: ArrowRight,
|
|
10354
10371
|
download: Download
|
|
@@ -10362,12 +10379,15 @@ const PromoCardIndicator = ({
|
|
|
10362
10379
|
type: Typography.BODY_LARGE_BOLD,
|
|
10363
10380
|
className: "np-Card-indicatorText",
|
|
10364
10381
|
children: label
|
|
10365
|
-
}),
|
|
10382
|
+
}), icon && /*#__PURE__*/jsx(Avatar, {
|
|
10383
|
+
type: AvatarType.ICON,
|
|
10384
|
+
size: isSmall ? 40 : 56,
|
|
10385
|
+
backgroundColor: "var(--Card-indicator-icon-background-color)",
|
|
10366
10386
|
className: "np-Card-indicatorIcon",
|
|
10367
|
-
children: /*#__PURE__*/jsx(IconComponent, {
|
|
10387
|
+
children: IconComponent ? /*#__PURE__*/jsx(IconComponent, {
|
|
10368
10388
|
size: 24,
|
|
10369
10389
|
"aria-hidden": "true"
|
|
10370
|
-
})
|
|
10390
|
+
}) : icon
|
|
10371
10391
|
}), children]
|
|
10372
10392
|
});
|
|
10373
10393
|
};
|
|
@@ -10429,6 +10449,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10429
10449
|
imageClass,
|
|
10430
10450
|
imageSource,
|
|
10431
10451
|
indicatorLabel,
|
|
10452
|
+
indicatorIcon,
|
|
10432
10453
|
isChecked,
|
|
10433
10454
|
isDisabled,
|
|
10434
10455
|
onClick,
|
|
@@ -10439,6 +10460,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10439
10460
|
title,
|
|
10440
10461
|
type,
|
|
10441
10462
|
value,
|
|
10463
|
+
isSmall,
|
|
10464
|
+
useDisplayFont = true,
|
|
10442
10465
|
...props
|
|
10443
10466
|
}, reference) => {
|
|
10444
10467
|
// Set the `checked` state to the value of `defaultChecked` if it is truthy,
|
|
@@ -10462,7 +10485,19 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10462
10485
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
10463
10486
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
10464
10487
|
// `icon` to `undefined`.
|
|
10465
|
-
|
|
10488
|
+
// Create a function to get icon type
|
|
10489
|
+
const getIconType = () => {
|
|
10490
|
+
if (indicatorIcon) {
|
|
10491
|
+
return indicatorIcon;
|
|
10492
|
+
}
|
|
10493
|
+
if (download) {
|
|
10494
|
+
return 'download';
|
|
10495
|
+
}
|
|
10496
|
+
if (href && !type) {
|
|
10497
|
+
return 'arrow';
|
|
10498
|
+
}
|
|
10499
|
+
return undefined;
|
|
10500
|
+
};
|
|
10466
10501
|
// Define all class names string based on the values of the `href`, `type`,
|
|
10467
10502
|
// `checked`, and `className` props.
|
|
10468
10503
|
const commonClasses = classNames({
|
|
@@ -10479,7 +10514,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10479
10514
|
isDisabled: isDisabled || contextIsDisabled,
|
|
10480
10515
|
onClick,
|
|
10481
10516
|
ref: reference,
|
|
10482
|
-
'data-testid': testId
|
|
10517
|
+
'data-testid': testId,
|
|
10518
|
+
isSmall
|
|
10483
10519
|
};
|
|
10484
10520
|
// Object with Anchor props that will be passed to the `a` element. These
|
|
10485
10521
|
// won't be refurned if set to `isDisabled`
|
|
@@ -10507,6 +10543,27 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10507
10543
|
ref: reference,
|
|
10508
10544
|
tabIndex: 0
|
|
10509
10545
|
} : {};
|
|
10546
|
+
const getTitle = () => {
|
|
10547
|
+
const titleContent = href && !type ? /*#__PURE__*/jsx("a", {
|
|
10548
|
+
className: "np-Card-titleLink",
|
|
10549
|
+
...anchorProps,
|
|
10550
|
+
children: title
|
|
10551
|
+
}) : title;
|
|
10552
|
+
const titleProps = {
|
|
10553
|
+
id: `${componentId}-title`,
|
|
10554
|
+
as: headingLevel,
|
|
10555
|
+
className: 'np-Card-title'
|
|
10556
|
+
};
|
|
10557
|
+
return useDisplayFont ? /*#__PURE__*/jsx(Display, {
|
|
10558
|
+
type: Typography.DISPLAY_SMALL,
|
|
10559
|
+
...titleProps,
|
|
10560
|
+
children: titleContent
|
|
10561
|
+
}) : /*#__PURE__*/jsx(Title, {
|
|
10562
|
+
type: Typography.TITLE_SUBSECTION,
|
|
10563
|
+
...titleProps,
|
|
10564
|
+
children: titleContent
|
|
10565
|
+
});
|
|
10566
|
+
};
|
|
10510
10567
|
useEffect(() => {
|
|
10511
10568
|
setChecked(defaultChecked ?? isChecked ?? false);
|
|
10512
10569
|
}, [defaultChecked, isChecked]);
|
|
@@ -10520,17 +10577,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10520
10577
|
size: 24,
|
|
10521
10578
|
"aria-hidden": "true"
|
|
10522
10579
|
})
|
|
10523
|
-
}), /*#__PURE__*/jsx(
|
|
10524
|
-
id: `${componentId}-title`,
|
|
10525
|
-
as: headingLevel,
|
|
10526
|
-
className: "np-Card-title",
|
|
10527
|
-
type: Typography.DISPLAY_SMALL,
|
|
10528
|
-
children: href && !type ? /*#__PURE__*/jsx("a", {
|
|
10529
|
-
className: "np-Card-titleLink",
|
|
10530
|
-
...anchorProps,
|
|
10531
|
-
children: title
|
|
10532
|
-
}) : title
|
|
10533
|
-
}), /*#__PURE__*/jsx(Body, {
|
|
10580
|
+
}), getTitle(), /*#__PURE__*/jsx(Body, {
|
|
10534
10581
|
className: "np-Card-description",
|
|
10535
10582
|
children: description
|
|
10536
10583
|
}), imageSource && /*#__PURE__*/jsx("div", {
|
|
@@ -10544,7 +10591,8 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
10544
10591
|
})
|
|
10545
10592
|
}), /*#__PURE__*/jsx(PromoCardIndicator, {
|
|
10546
10593
|
label: indicatorLabel,
|
|
10547
|
-
icon:
|
|
10594
|
+
icon: getIconType(),
|
|
10595
|
+
isSmall: isSmall
|
|
10548
10596
|
})]
|
|
10549
10597
|
});
|
|
10550
10598
|
});
|
|
@@ -10568,6 +10616,14 @@ var en = {
|
|
|
10568
10616
|
"neptune.DateInput.day.label": "Day",
|
|
10569
10617
|
"neptune.DateInput.month.label": "Month",
|
|
10570
10618
|
"neptune.DateInput.year.label": "Year",
|
|
10619
|
+
"neptune.DateLookup.day": "day",
|
|
10620
|
+
"neptune.DateLookup.goTo20YearView": "Go to 20 year view",
|
|
10621
|
+
"neptune.DateLookup.month": "month",
|
|
10622
|
+
"neptune.DateLookup.next": "next",
|
|
10623
|
+
"neptune.DateLookup.previous": "previous",
|
|
10624
|
+
"neptune.DateLookup.selected": "selected",
|
|
10625
|
+
"neptune.DateLookup.twentyYears": "20 years",
|
|
10626
|
+
"neptune.DateLookup.year": "year",
|
|
10571
10627
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
10572
10628
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
10573
10629
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
@@ -11029,6 +11085,7 @@ class Snackbar extends Component {
|
|
|
11029
11085
|
ref: this.bodyRef,
|
|
11030
11086
|
as: "span",
|
|
11031
11087
|
className: `snackbar__text snackbar__text--${theme}`,
|
|
11088
|
+
"aria-live": "polite",
|
|
11032
11089
|
children: [text, action ? /*#__PURE__*/jsx(ActionButton, {
|
|
11033
11090
|
className: "snackbar__text__action",
|
|
11034
11091
|
onClick: action.onClick,
|
|
@@ -11928,7 +11985,8 @@ class Tabs extends Component {
|
|
|
11928
11985
|
children: title
|
|
11929
11986
|
}, title);
|
|
11930
11987
|
}), translateLineX ? /*#__PURE__*/jsx("li", {
|
|
11931
|
-
|
|
11988
|
+
role: "none",
|
|
11989
|
+
className: "tabs__line",
|
|
11932
11990
|
style: {
|
|
11933
11991
|
width: this.getTabLineWidth(),
|
|
11934
11992
|
transform: isRTL ? `translateX(-${translateLineX})` : `translateX(${translateLineX})`
|
|
@@ -13075,6 +13133,7 @@ const ProcessingStep = props => {
|
|
|
13075
13133
|
'm-b-2': isModern
|
|
13076
13134
|
}),
|
|
13077
13135
|
type: Typography.TITLE_BODY,
|
|
13136
|
+
"aria-live": "polite",
|
|
13078
13137
|
children: psProcessingText
|
|
13079
13138
|
}), psButtonText && /*#__PURE__*/jsx(Button, {
|
|
13080
13139
|
disabled: psButtonDisabled,
|
|
@@ -13118,6 +13177,7 @@ const CompleteStep = props => {
|
|
|
13118
13177
|
className: "droppable-card-content",
|
|
13119
13178
|
children: [/*#__PURE__*/jsx("div", {
|
|
13120
13179
|
className: "droppable-card-content d-flex flex-column align-items-center",
|
|
13180
|
+
"aria-live": "polite",
|
|
13121
13181
|
children: isError ? /*#__PURE__*/jsxs(Fragment, {
|
|
13122
13182
|
children: [isModern ? /*#__PURE__*/jsx(StatusIcon, {
|
|
13123
13183
|
size: Size.LARGE,
|
|
@@ -13486,6 +13546,7 @@ class Upload extends Component {
|
|
|
13486
13546
|
onClear: event => this.handleOnClear(event)
|
|
13487
13547
|
}), !isProcessing && /*#__PURE__*/jsx("div", {
|
|
13488
13548
|
className: "droppable-dropping-card droppable-card",
|
|
13549
|
+
"aria-live": "polite",
|
|
13489
13550
|
children: /*#__PURE__*/jsxs("div", {
|
|
13490
13551
|
className: "droppable-card-content",
|
|
13491
13552
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -13960,6 +14021,7 @@ const UploadItem = ({
|
|
|
13960
14021
|
onDownload: onDownloadFile,
|
|
13961
14022
|
children: /*#__PURE__*/jsx("div", {
|
|
13962
14023
|
className: "np-upload-button",
|
|
14024
|
+
"aria-live": "polite",
|
|
13963
14025
|
children: /*#__PURE__*/jsxs("div", {
|
|
13964
14026
|
className: "media",
|
|
13965
14027
|
children: [/*#__PURE__*/jsx("div", {
|