@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.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
|
};
|
|
@@ -1184,8 +1183,8 @@ const Alert = props => {
|
|
|
1184
1183
|
setShouldFire(false);
|
|
1185
1184
|
};
|
|
1186
1185
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1187
|
-
role: "alert",
|
|
1188
1186
|
className: classNames__default.default('alert d-flex', `alert-${mappedType}`, className),
|
|
1187
|
+
"data-testid": "alert",
|
|
1189
1188
|
onTouchStart: handleTouchStart,
|
|
1190
1189
|
onTouchEnd: handleTouchEnd,
|
|
1191
1190
|
onTouchMove: handleTouchMove,
|
|
@@ -1194,17 +1193,20 @@ const Alert = props => {
|
|
|
1194
1193
|
"data-testid": variant,
|
|
1195
1194
|
children: [generateIcon(), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1196
1195
|
className: "alert__message",
|
|
1197
|
-
children: [
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1196
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1197
|
+
role: exports.Sentiment.NEGATIVE === mappedType ? 'alert' : 'status',
|
|
1198
|
+
children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
1199
|
+
className: "m-b-1",
|
|
1200
|
+
type: exports.Typography.TITLE_BODY,
|
|
1201
|
+
children: title
|
|
1202
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
1203
|
+
as: "span",
|
|
1204
|
+
className: "d-block",
|
|
1205
|
+
type: exports.Typography.BODY_LARGE,
|
|
1206
|
+
children: children || /*#__PURE__*/jsxRuntime.jsx(InlineMarkdown$1, {
|
|
1207
|
+
children: message
|
|
1208
|
+
})
|
|
1209
|
+
})]
|
|
1208
1210
|
}), action && /*#__PURE__*/jsxRuntime.jsx(Link, {
|
|
1209
1211
|
href: action.href,
|
|
1210
1212
|
className: "m-t-1",
|
|
@@ -1438,7 +1440,7 @@ const AvatarWrapper = ({
|
|
|
1438
1440
|
type: exports.AvatarType.THUMBNAIL,
|
|
1439
1441
|
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
1440
1442
|
src: url,
|
|
1441
|
-
alt: "
|
|
1443
|
+
alt: "",
|
|
1442
1444
|
onError: () => setImageLoadError(true)
|
|
1443
1445
|
}),
|
|
1444
1446
|
...avatarProps
|
|
@@ -1492,268 +1494,23 @@ function getInitials(name) {
|
|
|
1492
1494
|
return allInitials[0] + allInitials.slice(-1);
|
|
1493
1495
|
}
|
|
1494
1496
|
|
|
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
1497
|
const FocusBoundary = ({
|
|
1722
1498
|
children
|
|
1723
1499
|
}) => {
|
|
1724
|
-
const
|
|
1725
|
-
const parent = neptuneValidation.isUndefined(document) ? undefined : document;
|
|
1726
|
-
const [focusableEls, setFocusableEls] = React.useState({});
|
|
1500
|
+
const wrapperReference = React.useRef(null);
|
|
1727
1501
|
React.useEffect(() => {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
});
|
|
1732
|
-
setFocusableEls(getFocusableElements(boundaryReference.current));
|
|
1733
|
-
}
|
|
1502
|
+
wrapperReference.current?.focus({
|
|
1503
|
+
preventScroll: true
|
|
1504
|
+
});
|
|
1734
1505
|
}, []);
|
|
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
1506
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1753
|
-
ref:
|
|
1507
|
+
ref: wrapperReference,
|
|
1754
1508
|
tabIndex: -1,
|
|
1755
|
-
|
|
1756
|
-
|
|
1509
|
+
children: /*#__PURE__*/jsxRuntime.jsx(focus.FocusScope, {
|
|
1510
|
+
contain: true,
|
|
1511
|
+
restoreFocus: true,
|
|
1512
|
+
children: children
|
|
1513
|
+
})
|
|
1757
1514
|
});
|
|
1758
1515
|
};
|
|
1759
1516
|
var FocusBoundary$1 = FocusBoundary;
|
|
@@ -1944,70 +1701,240 @@ const DimmerContentWrapper = ({
|
|
|
1944
1701
|
scrollBody
|
|
1945
1702
|
}) => {
|
|
1946
1703
|
React.useEffect(() => {
|
|
1947
|
-
if (scrollBody) {
|
|
1948
|
-
addNoScrollClass();
|
|
1704
|
+
if (scrollBody) {
|
|
1705
|
+
addNoScrollClass();
|
|
1706
|
+
}
|
|
1707
|
+
return () => {
|
|
1708
|
+
if (scrollBody) {
|
|
1709
|
+
removeNoScrollClass();
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
}, [scrollBody]);
|
|
1713
|
+
return children;
|
|
1714
|
+
};
|
|
1715
|
+
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1716
|
+
|
|
1717
|
+
const EXIT_ANIMATION = 350;
|
|
1718
|
+
const SlidingPanel = /*#__PURE__*/React.forwardRef(({
|
|
1719
|
+
children,
|
|
1720
|
+
className,
|
|
1721
|
+
open,
|
|
1722
|
+
position,
|
|
1723
|
+
showSlidingPanelBorder,
|
|
1724
|
+
slidingPanelPositionFixed,
|
|
1725
|
+
...rest
|
|
1726
|
+
}, reference) => {
|
|
1727
|
+
/** @type {RefObject<HTMLDivElement>} */
|
|
1728
|
+
const localReference = React.useRef(null);
|
|
1729
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
|
|
1730
|
+
...rest,
|
|
1731
|
+
nodeRef: localReference,
|
|
1732
|
+
in: open
|
|
1733
|
+
// Wait for animation to finish before unmount.
|
|
1734
|
+
,
|
|
1735
|
+
timeout: {
|
|
1736
|
+
enter: 0,
|
|
1737
|
+
exit: EXIT_ANIMATION
|
|
1738
|
+
},
|
|
1739
|
+
classNames: classNames__default.default(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1740
|
+
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1741
|
+
}, 'sliding-panel'),
|
|
1742
|
+
appear: true,
|
|
1743
|
+
unmountOnExit: true,
|
|
1744
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1745
|
+
ref: mergeRefs__default.default([reference, localReference]),
|
|
1746
|
+
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1747
|
+
children: children
|
|
1748
|
+
})
|
|
1749
|
+
});
|
|
1750
|
+
});
|
|
1751
|
+
SlidingPanel.propTypes = {
|
|
1752
|
+
children: PropTypes__default.default.node,
|
|
1753
|
+
className: PropTypes__default.default.string,
|
|
1754
|
+
open: PropTypes__default.default.bool,
|
|
1755
|
+
position: PropTypes__default.default.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1756
|
+
showSlidingPanelBorder: PropTypes__default.default.bool,
|
|
1757
|
+
slidingPanelPositionFixed: PropTypes__default.default.bool
|
|
1758
|
+
};
|
|
1759
|
+
SlidingPanel.defaultProps = {
|
|
1760
|
+
children: null,
|
|
1761
|
+
className: undefined,
|
|
1762
|
+
open: false,
|
|
1763
|
+
position: 'left',
|
|
1764
|
+
showSlidingPanelBorder: false,
|
|
1765
|
+
slidingPanelPositionFixed: false
|
|
1766
|
+
};
|
|
1767
|
+
var SlidingPanel$1 = SlidingPanel;
|
|
1768
|
+
|
|
1769
|
+
const THROTTLE_MS = 100;
|
|
1770
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1771
|
+
const useClientWidth = ({
|
|
1772
|
+
ref,
|
|
1773
|
+
throttleMs = THROTTLE_MS
|
|
1774
|
+
}) => {
|
|
1775
|
+
const [clientWidth, setClientWidth] = React.useState(null);
|
|
1776
|
+
useIsomorphicLayoutEffect(() => {
|
|
1777
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1778
|
+
const updateClientWidth = () => {
|
|
1779
|
+
if (ref) {
|
|
1780
|
+
// when `ref` is a window
|
|
1781
|
+
if ('innerWidth' in ref) {
|
|
1782
|
+
setClientWidth(ref.innerWidth);
|
|
1783
|
+
}
|
|
1784
|
+
// when `ref` is an element
|
|
1785
|
+
else if (ref.current) {
|
|
1786
|
+
setClientWidth(ref.current.clientWidth);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1791
|
+
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1792
|
+
// won't get removed even if the component is unmounted.
|
|
1793
|
+
const attachedFunction = throttle__default.default(updateClientWidth, throttleMs);
|
|
1794
|
+
window.addEventListener('resize', attachedFunction, true);
|
|
1795
|
+
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1796
|
+
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1797
|
+
window.requestAnimationFrame(updateClientWidth);
|
|
1798
|
+
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1799
|
+
}, []);
|
|
1800
|
+
return [clientWidth];
|
|
1801
|
+
};
|
|
1802
|
+
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1803
|
+
|
|
1804
|
+
const useConditionalListener = ({
|
|
1805
|
+
attachListener,
|
|
1806
|
+
callback,
|
|
1807
|
+
eventType,
|
|
1808
|
+
parent
|
|
1809
|
+
}) => {
|
|
1810
|
+
React.useEffect(() => {
|
|
1811
|
+
if (attachListener && !neptuneValidation.isUndefined(parent)) {
|
|
1812
|
+
parent.addEventListener(eventType, callback, true);
|
|
1813
|
+
}
|
|
1814
|
+
return () => {
|
|
1815
|
+
if (!neptuneValidation.isUndefined(parent)) {
|
|
1816
|
+
parent.removeEventListener(eventType, callback, true);
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
}, [attachListener, callback, eventType, parent]);
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
const DirectionContext = /*#__PURE__*/React.createContext(exports.Direction.LTR);
|
|
1823
|
+
const DirectionProvider = ({
|
|
1824
|
+
direction,
|
|
1825
|
+
children
|
|
1826
|
+
}) => {
|
|
1827
|
+
return /*#__PURE__*/jsxRuntime.jsx(DirectionContext.Provider, {
|
|
1828
|
+
value: direction,
|
|
1829
|
+
children: children
|
|
1830
|
+
});
|
|
1831
|
+
};
|
|
1832
|
+
|
|
1833
|
+
const useDirection = () => {
|
|
1834
|
+
const direction = React.useContext(DirectionContext);
|
|
1835
|
+
return {
|
|
1836
|
+
direction,
|
|
1837
|
+
isRTL: direction === 'rtl'
|
|
1838
|
+
};
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
const ObserverParams = {
|
|
1842
|
+
threshold: 0.1
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* useHasIntersected.
|
|
1847
|
+
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
1848
|
+
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
1849
|
+
*
|
|
1850
|
+
* @param elRef.elRef
|
|
1851
|
+
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
1852
|
+
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
1853
|
+
* @param elRef.loading
|
|
1854
|
+
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
1855
|
+
*/
|
|
1856
|
+
const useHasIntersected = ({
|
|
1857
|
+
elRef,
|
|
1858
|
+
loading
|
|
1859
|
+
}) => {
|
|
1860
|
+
const [hasIntersected, setHasIntersected] = React.useState(false);
|
|
1861
|
+
const {
|
|
1862
|
+
current
|
|
1863
|
+
} = elRef || {};
|
|
1864
|
+
const isValidReference = () => {
|
|
1865
|
+
return elRef && current;
|
|
1866
|
+
};
|
|
1867
|
+
const handleOnIntersect = (entries, observer) => {
|
|
1868
|
+
entries.forEach(entry => {
|
|
1869
|
+
if (entry.isIntersecting) {
|
|
1870
|
+
setHasIntersected(true);
|
|
1871
|
+
observer.unobserve(current);
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
};
|
|
1875
|
+
React.useEffect(() => {
|
|
1876
|
+
let observer;
|
|
1877
|
+
let didCancel = false;
|
|
1878
|
+
|
|
1879
|
+
// Check if window is define for SSR and Old browsers fallback
|
|
1880
|
+
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
1881
|
+
setHasIntersected(true);
|
|
1882
|
+
} else if (!didCancel) {
|
|
1883
|
+
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
1884
|
+
observer.observe(current);
|
|
1949
1885
|
}
|
|
1950
1886
|
return () => {
|
|
1951
|
-
|
|
1952
|
-
|
|
1887
|
+
didCancel = true;
|
|
1888
|
+
if (observer) {
|
|
1889
|
+
observer.unobserve(current);
|
|
1953
1890
|
}
|
|
1954
1891
|
};
|
|
1955
|
-
}, [
|
|
1956
|
-
|
|
1892
|
+
}, [elRef]);
|
|
1893
|
+
if (loading === 'eager') {
|
|
1894
|
+
return [false];
|
|
1895
|
+
}
|
|
1896
|
+
return [hasIntersected];
|
|
1957
1897
|
};
|
|
1958
|
-
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1959
1898
|
|
|
1960
|
-
const
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
position,
|
|
1966
|
-
showSlidingPanelBorder,
|
|
1967
|
-
slidingPanelPositionFixed,
|
|
1968
|
-
...rest
|
|
1969
|
-
}, reference) => {
|
|
1970
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1971
|
-
const localReference = React.useRef(null);
|
|
1972
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
|
|
1973
|
-
...rest,
|
|
1974
|
-
nodeRef: localReference,
|
|
1975
|
-
in: open
|
|
1976
|
-
// Wait for animation to finish before unmount.
|
|
1977
|
-
,
|
|
1978
|
-
timeout: {
|
|
1979
|
-
enter: 0,
|
|
1980
|
-
exit: EXIT_ANIMATION
|
|
1981
|
-
},
|
|
1982
|
-
classNames: classNames__default.default(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1983
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1984
|
-
}, 'sliding-panel'),
|
|
1985
|
-
appear: true,
|
|
1986
|
-
unmountOnExit: true,
|
|
1987
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1988
|
-
ref: mergeRefs__default.default([reference, localReference]),
|
|
1989
|
-
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1990
|
-
children: children
|
|
1991
|
-
})
|
|
1899
|
+
const useLayout = () => {
|
|
1900
|
+
const windowReference = typeof window === 'undefined' ? undefined : window;
|
|
1901
|
+
const [breakpoint, setBreakpoint] = React.useState();
|
|
1902
|
+
const [clientWidth] = useClientWidth({
|
|
1903
|
+
ref: windowReference
|
|
1992
1904
|
});
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
1905
|
+
React.useEffect(() => {
|
|
1906
|
+
if (!clientWidth) {
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
if (clientWidth <= exports.Breakpoint.EXTRA_SMALL) {
|
|
1910
|
+
setBreakpoint(exports.Breakpoint.EXTRA_SMALL);
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
if (exports.Breakpoint.EXTRA_SMALL < clientWidth && clientWidth <= exports.Breakpoint.SMALL) {
|
|
1914
|
+
setBreakpoint(exports.Breakpoint.SMALL);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
if (exports.Breakpoint.SMALL < clientWidth && clientWidth <= exports.Breakpoint.MEDIUM) {
|
|
1918
|
+
setBreakpoint(exports.Breakpoint.MEDIUM);
|
|
1919
|
+
return;
|
|
1920
|
+
}
|
|
1921
|
+
if (exports.Breakpoint.MEDIUM < clientWidth && clientWidth <= exports.Breakpoint.LARGE) {
|
|
1922
|
+
setBreakpoint(exports.Breakpoint.LARGE);
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
if (exports.Breakpoint.LARGE < clientWidth) {
|
|
1926
|
+
setBreakpoint(exports.Breakpoint.EXTRA_LARGE);
|
|
1927
|
+
}
|
|
1928
|
+
}, [clientWidth]);
|
|
1929
|
+
return {
|
|
1930
|
+
isMobile: !!breakpoint && [exports.Breakpoint.EXTRA_SMALL, exports.Breakpoint.SMALL].includes(breakpoint),
|
|
1931
|
+
isExtraSmall: breakpoint === exports.Breakpoint.EXTRA_SMALL,
|
|
1932
|
+
isSmall: breakpoint === exports.Breakpoint.SMALL,
|
|
1933
|
+
isMedium: breakpoint === exports.Breakpoint.MEDIUM,
|
|
1934
|
+
isLarge: breakpoint === exports.Breakpoint.LARGE,
|
|
1935
|
+
isExtraLarge: breakpoint === exports.Breakpoint.EXTRA_LARGE
|
|
1936
|
+
};
|
|
2009
1937
|
};
|
|
2010
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
2011
1938
|
|
|
2012
1939
|
const INITIAL_Y_POSITION = 0;
|
|
2013
1940
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
@@ -2366,7 +2293,7 @@ var Card$2 = Card$1;
|
|
|
2366
2293
|
|
|
2367
2294
|
const Card = ({
|
|
2368
2295
|
className,
|
|
2369
|
-
children,
|
|
2296
|
+
children = null,
|
|
2370
2297
|
id,
|
|
2371
2298
|
isDisabled = false,
|
|
2372
2299
|
isSmall = false,
|
|
@@ -2389,7 +2316,10 @@ const Card = ({
|
|
|
2389
2316
|
size: isSmall ? 'sm' : 'md',
|
|
2390
2317
|
isDisabled: isDisabled,
|
|
2391
2318
|
testId: "close-button",
|
|
2392
|
-
onClick:
|
|
2319
|
+
onClick: e => {
|
|
2320
|
+
stopPropagation$1(e);
|
|
2321
|
+
onDismiss();
|
|
2322
|
+
}
|
|
2393
2323
|
}), children]
|
|
2394
2324
|
});
|
|
2395
2325
|
};
|
|
@@ -2572,7 +2502,7 @@ const Chip = ({
|
|
|
2572
2502
|
}, value);
|
|
2573
2503
|
};
|
|
2574
2504
|
|
|
2575
|
-
var messages$
|
|
2505
|
+
var messages$7 = reactIntl.defineMessages({
|
|
2576
2506
|
ariaLabel: {
|
|
2577
2507
|
id: "neptune.Chips.ariaLabel"
|
|
2578
2508
|
}
|
|
@@ -2604,7 +2534,7 @@ const Chips = ({
|
|
|
2604
2534
|
value: chip.value,
|
|
2605
2535
|
label: chip.label,
|
|
2606
2536
|
closeButton: {
|
|
2607
|
-
'aria-label': intl.formatMessage(messages$
|
|
2537
|
+
'aria-label': intl.formatMessage(messages$7.ariaLabel, {
|
|
2608
2538
|
choice: chip.label
|
|
2609
2539
|
})
|
|
2610
2540
|
},
|
|
@@ -2712,7 +2642,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
|
|
|
2712
2642
|
|
|
2713
2643
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2714
2644
|
|
|
2715
|
-
var messages$
|
|
2645
|
+
var messages$6 = reactIntl.defineMessages({
|
|
2716
2646
|
monthLabel: {
|
|
2717
2647
|
id: "neptune.DateInput.month.label"
|
|
2718
2648
|
},
|
|
@@ -2752,8 +2682,10 @@ const DateInput = ({
|
|
|
2752
2682
|
size,
|
|
2753
2683
|
value,
|
|
2754
2684
|
dayLabel,
|
|
2685
|
+
dayAutoComplete,
|
|
2755
2686
|
monthLabel,
|
|
2756
2687
|
yearLabel,
|
|
2688
|
+
yearAutoComplete,
|
|
2757
2689
|
monthFormat,
|
|
2758
2690
|
mode,
|
|
2759
2691
|
onChange,
|
|
@@ -2788,12 +2720,12 @@ const DateInput = ({
|
|
|
2788
2720
|
const [month, setMonth] = React.useState(() => getExplodedDate('month'));
|
|
2789
2721
|
const [year, setYear] = React.useState(() => getExplodedDate('year'));
|
|
2790
2722
|
const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
|
|
2791
|
-
dayLabel = dayLabel || formatMessage(messages$
|
|
2792
|
-
monthLabel = monthLabel || formatMessage(messages$
|
|
2793
|
-
yearLabel = yearLabel || formatMessage(messages$
|
|
2723
|
+
dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
|
|
2724
|
+
monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
|
|
2725
|
+
yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
|
|
2794
2726
|
placeholders = {
|
|
2795
2727
|
day: placeholders?.day || 'DD',
|
|
2796
|
-
month: placeholders?.month || formatMessage(messages$
|
|
2728
|
+
month: placeholders?.month || formatMessage(messages$6.monthLabel),
|
|
2797
2729
|
year: placeholders?.year || 'YYYY'
|
|
2798
2730
|
};
|
|
2799
2731
|
const getDateAsString = date => {
|
|
@@ -2951,6 +2883,7 @@ const DateInput = ({
|
|
|
2951
2883
|
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
2952
2884
|
type: "number",
|
|
2953
2885
|
name: "day",
|
|
2886
|
+
autoComplete: dayAutoComplete,
|
|
2954
2887
|
value: day || '',
|
|
2955
2888
|
placeholder: placeholders.day,
|
|
2956
2889
|
disabled: disabled,
|
|
@@ -2973,6 +2906,7 @@ const DateInput = ({
|
|
|
2973
2906
|
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
2974
2907
|
type: "number",
|
|
2975
2908
|
name: "year",
|
|
2909
|
+
autoComplete: yearAutoComplete,
|
|
2976
2910
|
placeholder: placeholders.year,
|
|
2977
2911
|
value: year || '',
|
|
2978
2912
|
disabled: disabled,
|
|
@@ -3020,8 +2954,10 @@ DateInput.propTypes = {
|
|
|
3020
2954
|
onFocus: PropTypes__default.default.func,
|
|
3021
2955
|
onBlur: PropTypes__default.default.func,
|
|
3022
2956
|
dayLabel: PropTypes__default.default.string,
|
|
2957
|
+
dayAutoComplete: PropTypes__default.default.string,
|
|
3023
2958
|
monthLabel: PropTypes__default.default.string,
|
|
3024
2959
|
yearLabel: PropTypes__default.default.string,
|
|
2960
|
+
yearAutoComplete: PropTypes__default.default.string,
|
|
3025
2961
|
monthFormat: PropTypes__default.default.oneOf(['long', 'short']),
|
|
3026
2962
|
mode: PropTypes__default.default.oneOf(['day-month-year', 'month-year']),
|
|
3027
2963
|
placeholders: PropTypes__default.default.shape({
|
|
@@ -3220,7 +3156,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3220
3156
|
});
|
|
3221
3157
|
var ResponsivePanel$1 = ResponsivePanel;
|
|
3222
3158
|
|
|
3223
|
-
var messages$
|
|
3159
|
+
var messages$5 = reactIntl.defineMessages({
|
|
3224
3160
|
ariaLabel: {
|
|
3225
3161
|
id: "neptune.ClearButton.ariaLabel"
|
|
3226
3162
|
}
|
|
@@ -3283,7 +3219,7 @@ const DateTrigger = ({
|
|
|
3283
3219
|
className: "input-group-addon",
|
|
3284
3220
|
children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
3285
3221
|
className: `clear-btn clear-btn--${size}`,
|
|
3286
|
-
"aria-label": formatMessage(messages$
|
|
3222
|
+
"aria-label": formatMessage(messages$5.ariaLabel),
|
|
3287
3223
|
size: exports.Size.SMALL,
|
|
3288
3224
|
onClick: event => {
|
|
3289
3225
|
event.stopPropagation();
|
|
@@ -3313,50 +3249,85 @@ DateTrigger.defaultProps = {
|
|
|
3313
3249
|
};
|
|
3314
3250
|
var DateTrigger$1 = DateTrigger;
|
|
3315
3251
|
|
|
3252
|
+
var messages$4 = reactIntl.defineMessages({
|
|
3253
|
+
next: {
|
|
3254
|
+
id: "neptune.DateLookup.next"
|
|
3255
|
+
},
|
|
3256
|
+
previous: {
|
|
3257
|
+
id: "neptune.DateLookup.previous"
|
|
3258
|
+
},
|
|
3259
|
+
day: {
|
|
3260
|
+
id: "neptune.DateLookup.day"
|
|
3261
|
+
},
|
|
3262
|
+
month: {
|
|
3263
|
+
id: "neptune.DateLookup.month"
|
|
3264
|
+
},
|
|
3265
|
+
year: {
|
|
3266
|
+
id: "neptune.DateLookup.year"
|
|
3267
|
+
},
|
|
3268
|
+
twentyYears: {
|
|
3269
|
+
id: "neptune.DateLookup.twentyYears"
|
|
3270
|
+
},
|
|
3271
|
+
selected: {
|
|
3272
|
+
id: "neptune.DateLookup.selected"
|
|
3273
|
+
},
|
|
3274
|
+
goTo20YearView: {
|
|
3275
|
+
id: "neptune.DateLookup.goTo20YearView"
|
|
3276
|
+
}
|
|
3277
|
+
});
|
|
3278
|
+
|
|
3316
3279
|
const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold rounded-sm';
|
|
3317
3280
|
const DateHeader = ({
|
|
3318
3281
|
label,
|
|
3319
3282
|
onLabelClick,
|
|
3320
3283
|
onPreviousClick,
|
|
3321
|
-
onNextClick
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
className:
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3284
|
+
onNextClick,
|
|
3285
|
+
dateMode
|
|
3286
|
+
}) => {
|
|
3287
|
+
const intl = reactIntl.useIntl();
|
|
3288
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3289
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3290
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3291
|
+
className: "pull-left-single-direction",
|
|
3292
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3293
|
+
type: "button",
|
|
3294
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3295
|
+
"aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
|
|
3296
|
+
onClick: onPreviousClick,
|
|
3297
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
|
|
3298
|
+
orientation: exports.Position.LEFT,
|
|
3299
|
+
className: "left-single-direction",
|
|
3300
|
+
size: exports.Size.MEDIUM
|
|
3301
|
+
})
|
|
3334
3302
|
})
|
|
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", {
|
|
3303
|
+
}), label && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3344
3304
|
type: "button",
|
|
3345
|
-
className: `
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3305
|
+
className: `tw-date-lookup-header-current ${buttonClasses}`,
|
|
3306
|
+
"aria-label": intl.formatMessage(messages$4.goTo20YearView),
|
|
3307
|
+
onClick: onLabelClick,
|
|
3308
|
+
children: label
|
|
3309
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3310
|
+
className: "pull-right-single-direction",
|
|
3311
|
+
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3312
|
+
type: "button",
|
|
3313
|
+
className: `d-inline-flex ${buttonClasses}`,
|
|
3314
|
+
"aria-label": `${reactIntl.useIntl().formatMessage(messages$4.next)} ${dateMode}`,
|
|
3315
|
+
onClick: onNextClick,
|
|
3316
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
|
|
3317
|
+
orientation: exports.Position.RIGHT,
|
|
3318
|
+
className: "right-single-direction",
|
|
3319
|
+
size: exports.Size.MEDIUM
|
|
3320
|
+
})
|
|
3351
3321
|
})
|
|
3352
|
-
})
|
|
3353
|
-
})
|
|
3354
|
-
}
|
|
3322
|
+
})]
|
|
3323
|
+
});
|
|
3324
|
+
};
|
|
3355
3325
|
DateHeader.propTypes = {
|
|
3356
3326
|
label: PropTypes__default.default.string,
|
|
3357
3327
|
onLabelClick: PropTypes__default.default.func,
|
|
3358
3328
|
onPreviousClick: PropTypes__default.default.func.isRequired,
|
|
3359
|
-
onNextClick: PropTypes__default.default.func.isRequired
|
|
3329
|
+
onNextClick: PropTypes__default.default.func.isRequired,
|
|
3330
|
+
dateMode: PropTypes__default.default.string
|
|
3360
3331
|
};
|
|
3361
3332
|
DateHeader.defaultProps = {
|
|
3362
3333
|
label: null,
|
|
@@ -3382,6 +3353,12 @@ class TableLink extends React.PureComponent {
|
|
|
3382
3353
|
this.props.onClick(this.props.item);
|
|
3383
3354
|
}
|
|
3384
3355
|
};
|
|
3356
|
+
calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
|
|
3357
|
+
if (active) {
|
|
3358
|
+
return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
|
|
3359
|
+
}
|
|
3360
|
+
return longTitle || title;
|
|
3361
|
+
};
|
|
3385
3362
|
render() {
|
|
3386
3363
|
const {
|
|
3387
3364
|
item,
|
|
@@ -3390,14 +3367,18 @@ class TableLink extends React.PureComponent {
|
|
|
3390
3367
|
longTitle,
|
|
3391
3368
|
active,
|
|
3392
3369
|
disabled,
|
|
3393
|
-
today
|
|
3370
|
+
today,
|
|
3371
|
+
intl: {
|
|
3372
|
+
formatMessage
|
|
3373
|
+
}
|
|
3394
3374
|
} = this.props;
|
|
3395
3375
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3396
3376
|
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3397
3377
|
type: "button",
|
|
3398
3378
|
className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
|
|
3399
3379
|
disabled: disabled,
|
|
3400
|
-
"aria-label": longTitle,
|
|
3380
|
+
"aria-label": this.calculateAriaLabel(longTitle, title, active, type, formatMessage),
|
|
3381
|
+
"aria-pressed": active,
|
|
3401
3382
|
onClick: this.onClick,
|
|
3402
3383
|
children: title || item
|
|
3403
3384
|
})
|
|
@@ -3419,7 +3400,7 @@ TableLink.defaultProps = {
|
|
|
3419
3400
|
title: null,
|
|
3420
3401
|
longTitle: null
|
|
3421
3402
|
};
|
|
3422
|
-
var TableLink$1 = TableLink;
|
|
3403
|
+
var TableLink$1 = reactIntl.injectIntl(TableLink);
|
|
3423
3404
|
|
|
3424
3405
|
const SHORT_DAY_FORMAT = {
|
|
3425
3406
|
day: 'numeric'
|
|
@@ -3463,6 +3444,7 @@ class DayCalendarTable extends React.PureComponent {
|
|
|
3463
3444
|
};
|
|
3464
3445
|
days = getDayNames(this.props.intl.locale, 'short');
|
|
3465
3446
|
daysShort = getDayNames(this.props.intl.locale, 'narrow');
|
|
3447
|
+
daysLong = getDayNames(this.props.intl.locale, 'long');
|
|
3466
3448
|
selectDay = day => {
|
|
3467
3449
|
const {
|
|
3468
3450
|
viewMonth,
|
|
@@ -3506,10 +3488,16 @@ class DayCalendarTable extends React.PureComponent {
|
|
|
3506
3488
|
className: "text-xs-center np-text-body-default-bold",
|
|
3507
3489
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3508
3490
|
className: "hidden-xs",
|
|
3509
|
-
children:
|
|
3491
|
+
children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
|
|
3492
|
+
title: this.daysLong[index],
|
|
3493
|
+
children: day.slice(0, 3)
|
|
3494
|
+
})
|
|
3510
3495
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3511
3496
|
className: "visible-xs-inline-block",
|
|
3512
|
-
children:
|
|
3497
|
+
children: /*#__PURE__*/jsxRuntime.jsx("abbr", {
|
|
3498
|
+
title: this.daysLong[index],
|
|
3499
|
+
children: this.daysShort[index].slice(0, 2)
|
|
3500
|
+
})
|
|
3513
3501
|
})]
|
|
3514
3502
|
}, day))
|
|
3515
3503
|
})
|
|
@@ -3577,7 +3565,8 @@ class DayCalendar extends React.PureComponent {
|
|
|
3577
3565
|
viewMonth,
|
|
3578
3566
|
viewYear,
|
|
3579
3567
|
intl: {
|
|
3580
|
-
locale
|
|
3568
|
+
locale,
|
|
3569
|
+
formatMessage
|
|
3581
3570
|
},
|
|
3582
3571
|
monthFormat,
|
|
3583
3572
|
onLabelClick,
|
|
@@ -3589,6 +3578,7 @@ class DayCalendar extends React.PureComponent {
|
|
|
3589
3578
|
month: monthFormat,
|
|
3590
3579
|
year: 'numeric'
|
|
3591
3580
|
}),
|
|
3581
|
+
dateMode: formatMessage(messages$4.month),
|
|
3592
3582
|
onLabelClick: onLabelClick,
|
|
3593
3583
|
onPreviousClick: this.selectPreviousMonth,
|
|
3594
3584
|
onNextClick: this.selectNextMonth
|
|
@@ -3708,13 +3698,15 @@ class MonthCalendar extends React.PureComponent {
|
|
|
3708
3698
|
max,
|
|
3709
3699
|
viewYear,
|
|
3710
3700
|
intl: {
|
|
3711
|
-
locale
|
|
3701
|
+
locale,
|
|
3702
|
+
formatMessage
|
|
3712
3703
|
},
|
|
3713
3704
|
placeholder,
|
|
3714
3705
|
onLabelClick
|
|
3715
3706
|
} = this.props;
|
|
3716
3707
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3717
3708
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
|
|
3709
|
+
dateMode: formatMessage(messages$4.year),
|
|
3718
3710
|
label: formatting.formatDate(new Date(viewYear, 0), locale, {
|
|
3719
3711
|
year: 'numeric'
|
|
3720
3712
|
}),
|
|
@@ -3832,10 +3824,14 @@ class YearCalendar extends React.PureComponent {
|
|
|
3832
3824
|
min,
|
|
3833
3825
|
max,
|
|
3834
3826
|
viewYear,
|
|
3835
|
-
placeholder
|
|
3827
|
+
placeholder,
|
|
3828
|
+
intl: {
|
|
3829
|
+
formatMessage
|
|
3830
|
+
}
|
|
3836
3831
|
} = this.props;
|
|
3837
3832
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3838
3833
|
children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
|
|
3834
|
+
dateMode: formatMessage(messages$4.twentyYears),
|
|
3839
3835
|
onPreviousClick: this.selectPreviousYears,
|
|
3840
3836
|
onNextClick: this.selectNextYears
|
|
3841
3837
|
}), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
|
|
@@ -3863,7 +3859,7 @@ YearCalendar.defaultProps = {
|
|
|
3863
3859
|
min: null,
|
|
3864
3860
|
max: null
|
|
3865
3861
|
};
|
|
3866
|
-
var YearCalendar$1 = YearCalendar;
|
|
3862
|
+
var YearCalendar$1 = reactIntl.injectIntl(YearCalendar);
|
|
3867
3863
|
|
|
3868
3864
|
const MODE = {
|
|
3869
3865
|
DAY: 'day',
|
|
@@ -6262,65 +6258,74 @@ function BottomSheet({
|
|
|
6262
6258
|
getFloatingProps
|
|
6263
6259
|
} = react.useInteractions([dismiss, role]);
|
|
6264
6260
|
const [floatingKey, setFloatingKey] = React.useState(0);
|
|
6261
|
+
const {
|
|
6262
|
+
theme,
|
|
6263
|
+
screenMode
|
|
6264
|
+
} = componentsTheming.useTheme();
|
|
6265
6265
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6266
6266
|
children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger?.({
|
|
6267
6267
|
ref: refs.setReference,
|
|
6268
6268
|
getInteractionProps: getReferenceProps
|
|
6269
6269
|
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
6270
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
className:
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6270
|
+
children: /*#__PURE__*/jsxRuntime.jsx(componentsTheming.ThemeProvider, {
|
|
6271
|
+
theme: theme,
|
|
6272
|
+
screenMode: screenMode,
|
|
6273
|
+
isNotRootProvider: true,
|
|
6274
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition, {
|
|
6275
|
+
show: open,
|
|
6276
|
+
className: "np-bottom-sheet-v2-container",
|
|
6277
|
+
beforeEnter: () => {
|
|
6278
|
+
setFloatingKey(prev => prev + 1);
|
|
6279
|
+
},
|
|
6280
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6281
|
+
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
6282
|
+
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
6283
|
+
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
6284
|
+
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6285
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6286
|
+
className: "np-bottom-sheet-v2-backdrop"
|
|
6287
|
+
})
|
|
6288
|
+
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6289
|
+
context: context,
|
|
6290
|
+
initialFocus: initialFocusRef,
|
|
6291
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6292
|
+
className: "np-bottom-sheet-v2",
|
|
6293
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6294
|
+
className: "np-bottom-sheet-v2-content",
|
|
6295
|
+
enter: "np-bottom-sheet-v2-content--enter",
|
|
6296
|
+
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
6297
|
+
leave: "np-bottom-sheet-v2-content--leave",
|
|
6298
|
+
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
6299
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6300
|
+
// Force inner state invalidation on open
|
|
6301
|
+
ref: refs.setFloating,
|
|
6302
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
6303
|
+
...getFloatingProps(),
|
|
6304
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6305
|
+
className: "np-bottom-sheet-v2-header",
|
|
6306
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
6307
|
+
size: exports.Size.SMALL,
|
|
6308
|
+
onClick: () => {
|
|
6309
|
+
onClose?.();
|
|
6310
|
+
}
|
|
6311
|
+
})
|
|
6312
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6313
|
+
className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6314
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6315
|
+
}),
|
|
6316
|
+
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6317
|
+
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6318
|
+
children: title
|
|
6319
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6320
|
+
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6321
|
+
children: children
|
|
6322
|
+
})]
|
|
6318
6323
|
})]
|
|
6319
|
-
})
|
|
6320
|
-
}
|
|
6324
|
+
}, floatingKey)
|
|
6325
|
+
})
|
|
6321
6326
|
})
|
|
6322
|
-
})
|
|
6323
|
-
})
|
|
6327
|
+
})]
|
|
6328
|
+
})
|
|
6324
6329
|
})
|
|
6325
6330
|
})]
|
|
6326
6331
|
});
|
|
@@ -6396,41 +6401,50 @@ function Popover({
|
|
|
6396
6401
|
getFloatingProps
|
|
6397
6402
|
} = react.useInteractions([role, dismiss]);
|
|
6398
6403
|
const [floatingKey, setFloatingKey] = React.useState(0);
|
|
6404
|
+
const {
|
|
6405
|
+
theme,
|
|
6406
|
+
screenMode
|
|
6407
|
+
} = componentsTheming.useTheme();
|
|
6399
6408
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6400
6409
|
children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger({
|
|
6401
6410
|
ref: refs.setReference,
|
|
6402
6411
|
getInteractionProps: getReferenceProps
|
|
6403
6412
|
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
6404
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
children:
|
|
6426
|
-
className:
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6413
|
+
children: /*#__PURE__*/jsxRuntime.jsx(componentsTheming.ThemeProvider, {
|
|
6414
|
+
theme: theme,
|
|
6415
|
+
screenMode: screenMode,
|
|
6416
|
+
isNotRootProvider: true,
|
|
6417
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6418
|
+
context: context,
|
|
6419
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition, {
|
|
6420
|
+
show: open,
|
|
6421
|
+
leave: "transition-opacity",
|
|
6422
|
+
leaveTo: "opacity-0",
|
|
6423
|
+
beforeEnter: () => {
|
|
6424
|
+
setFloatingKey(prev => prev + 1);
|
|
6425
|
+
},
|
|
6426
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6427
|
+
// Force inner state invalidation on open
|
|
6428
|
+
ref: refs.setFloating,
|
|
6429
|
+
className: "np-popover-v2-container"
|
|
6430
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
6431
|
+
,
|
|
6432
|
+
style: floatingStyles,
|
|
6433
|
+
...getFloatingProps(),
|
|
6434
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6435
|
+
className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
6436
|
+
'np-popover-v2--padding-md': padding === 'md'
|
|
6437
|
+
}),
|
|
6438
|
+
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6439
|
+
className: "np-popover-v2-title np-text-title-body",
|
|
6440
|
+
children: title
|
|
6441
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6442
|
+
className: "np-popover-v2-content np-text-body-default",
|
|
6443
|
+
children: children
|
|
6444
|
+
})]
|
|
6445
|
+
})
|
|
6446
|
+
}, floatingKey)
|
|
6447
|
+
})
|
|
6434
6448
|
})
|
|
6435
6449
|
})
|
|
6436
6450
|
})]
|
|
@@ -6528,7 +6542,7 @@ function SelectInput({
|
|
|
6528
6542
|
children: [onClear != null && value != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6529
6543
|
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
6530
6544
|
type: "button",
|
|
6531
|
-
"aria-label": intl.formatMessage(messages$
|
|
6545
|
+
"aria-label": intl.formatMessage(messages$5.ariaLabel),
|
|
6532
6546
|
disabled: uiDisabled,
|
|
6533
6547
|
className: "np-select-input-addon np-select-input-addon--interactive",
|
|
6534
6548
|
onClick: event => {
|
|
@@ -10127,6 +10141,7 @@ const PhoneNumberInput = props => {
|
|
|
10127
10141
|
className: `input-group input-group-${size}`,
|
|
10128
10142
|
children: /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
10129
10143
|
id: id,
|
|
10144
|
+
autoComplete: "tel-national",
|
|
10130
10145
|
name: "phoneNumber",
|
|
10131
10146
|
inputMode: "numeric",
|
|
10132
10147
|
value: internalValue.suffix,
|
|
@@ -10378,10 +10393,12 @@ const PromoCardIndicator = ({
|
|
|
10378
10393
|
children,
|
|
10379
10394
|
label,
|
|
10380
10395
|
icon,
|
|
10396
|
+
isSmall = false,
|
|
10381
10397
|
testid,
|
|
10382
10398
|
...rest
|
|
10383
10399
|
}) => {
|
|
10384
|
-
const
|
|
10400
|
+
const isIconString = icon && typeof icon === 'string';
|
|
10401
|
+
const IconComponent = isIconString && {
|
|
10385
10402
|
check: icons.Check,
|
|
10386
10403
|
arrow: icons.ArrowRight,
|
|
10387
10404
|
download: icons.Download
|
|
@@ -10395,12 +10412,15 @@ const PromoCardIndicator = ({
|
|
|
10395
10412
|
type: exports.Typography.BODY_LARGE_BOLD,
|
|
10396
10413
|
className: "np-Card-indicatorText",
|
|
10397
10414
|
children: label
|
|
10398
|
-
}),
|
|
10415
|
+
}), icon && /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
10416
|
+
type: exports.AvatarType.ICON,
|
|
10417
|
+
size: isSmall ? 40 : 56,
|
|
10418
|
+
backgroundColor: "var(--Card-indicator-icon-background-color)",
|
|
10399
10419
|
className: "np-Card-indicatorIcon",
|
|
10400
|
-
children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
10420
|
+
children: IconComponent ? /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
10401
10421
|
size: 24,
|
|
10402
10422
|
"aria-hidden": "true"
|
|
10403
|
-
})
|
|
10423
|
+
}) : icon
|
|
10404
10424
|
}), children]
|
|
10405
10425
|
});
|
|
10406
10426
|
};
|
|
@@ -10462,6 +10482,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10462
10482
|
imageClass,
|
|
10463
10483
|
imageSource,
|
|
10464
10484
|
indicatorLabel,
|
|
10485
|
+
indicatorIcon,
|
|
10465
10486
|
isChecked,
|
|
10466
10487
|
isDisabled,
|
|
10467
10488
|
onClick,
|
|
@@ -10472,6 +10493,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10472
10493
|
title,
|
|
10473
10494
|
type,
|
|
10474
10495
|
value,
|
|
10496
|
+
isSmall,
|
|
10497
|
+
useDisplayFont = true,
|
|
10475
10498
|
...props
|
|
10476
10499
|
}, reference) => {
|
|
10477
10500
|
// Set the `checked` state to the value of `defaultChecked` if it is truthy,
|
|
@@ -10495,7 +10518,19 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10495
10518
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
10496
10519
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
10497
10520
|
// `icon` to `undefined`.
|
|
10498
|
-
|
|
10521
|
+
// Create a function to get icon type
|
|
10522
|
+
const getIconType = () => {
|
|
10523
|
+
if (indicatorIcon) {
|
|
10524
|
+
return indicatorIcon;
|
|
10525
|
+
}
|
|
10526
|
+
if (download) {
|
|
10527
|
+
return 'download';
|
|
10528
|
+
}
|
|
10529
|
+
if (href && !type) {
|
|
10530
|
+
return 'arrow';
|
|
10531
|
+
}
|
|
10532
|
+
return undefined;
|
|
10533
|
+
};
|
|
10499
10534
|
// Define all class names string based on the values of the `href`, `type`,
|
|
10500
10535
|
// `checked`, and `className` props.
|
|
10501
10536
|
const commonClasses = classNames__default.default({
|
|
@@ -10512,7 +10547,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10512
10547
|
isDisabled: isDisabled || contextIsDisabled,
|
|
10513
10548
|
onClick,
|
|
10514
10549
|
ref: reference,
|
|
10515
|
-
'data-testid': testId
|
|
10550
|
+
'data-testid': testId,
|
|
10551
|
+
isSmall
|
|
10516
10552
|
};
|
|
10517
10553
|
// Object with Anchor props that will be passed to the `a` element. These
|
|
10518
10554
|
// won't be refurned if set to `isDisabled`
|
|
@@ -10540,6 +10576,27 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10540
10576
|
ref: reference,
|
|
10541
10577
|
tabIndex: 0
|
|
10542
10578
|
} : {};
|
|
10579
|
+
const getTitle = () => {
|
|
10580
|
+
const titleContent = href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
10581
|
+
className: "np-Card-titleLink",
|
|
10582
|
+
...anchorProps,
|
|
10583
|
+
children: title
|
|
10584
|
+
}) : title;
|
|
10585
|
+
const titleProps = {
|
|
10586
|
+
id: `${componentId}-title`,
|
|
10587
|
+
as: headingLevel,
|
|
10588
|
+
className: 'np-Card-title'
|
|
10589
|
+
};
|
|
10590
|
+
return useDisplayFont ? /*#__PURE__*/jsxRuntime.jsx(Display, {
|
|
10591
|
+
type: exports.Typography.DISPLAY_SMALL,
|
|
10592
|
+
...titleProps,
|
|
10593
|
+
children: titleContent
|
|
10594
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
10595
|
+
type: exports.Typography.TITLE_SUBSECTION,
|
|
10596
|
+
...titleProps,
|
|
10597
|
+
children: titleContent
|
|
10598
|
+
});
|
|
10599
|
+
};
|
|
10543
10600
|
React.useEffect(() => {
|
|
10544
10601
|
setChecked(defaultChecked ?? isChecked ?? false);
|
|
10545
10602
|
}, [defaultChecked, isChecked]);
|
|
@@ -10553,17 +10610,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10553
10610
|
size: 24,
|
|
10554
10611
|
"aria-hidden": "true"
|
|
10555
10612
|
})
|
|
10556
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
10557
|
-
id: `${componentId}-title`,
|
|
10558
|
-
as: headingLevel,
|
|
10559
|
-
className: "np-Card-title",
|
|
10560
|
-
type: exports.Typography.DISPLAY_SMALL,
|
|
10561
|
-
children: href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
10562
|
-
className: "np-Card-titleLink",
|
|
10563
|
-
...anchorProps,
|
|
10564
|
-
children: title
|
|
10565
|
-
}) : title
|
|
10566
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
10613
|
+
}), getTitle(), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
10567
10614
|
className: "np-Card-description",
|
|
10568
10615
|
children: description
|
|
10569
10616
|
}), imageSource && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -10577,7 +10624,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10577
10624
|
})
|
|
10578
10625
|
}), /*#__PURE__*/jsxRuntime.jsx(PromoCardIndicator, {
|
|
10579
10626
|
label: indicatorLabel,
|
|
10580
|
-
icon:
|
|
10627
|
+
icon: getIconType(),
|
|
10628
|
+
isSmall: isSmall
|
|
10581
10629
|
})]
|
|
10582
10630
|
});
|
|
10583
10631
|
});
|
|
@@ -10601,6 +10649,14 @@ var en = {
|
|
|
10601
10649
|
"neptune.DateInput.day.label": "Day",
|
|
10602
10650
|
"neptune.DateInput.month.label": "Month",
|
|
10603
10651
|
"neptune.DateInput.year.label": "Year",
|
|
10652
|
+
"neptune.DateLookup.day": "day",
|
|
10653
|
+
"neptune.DateLookup.goTo20YearView": "Go to 20 year view",
|
|
10654
|
+
"neptune.DateLookup.month": "month",
|
|
10655
|
+
"neptune.DateLookup.next": "next",
|
|
10656
|
+
"neptune.DateLookup.previous": "previous",
|
|
10657
|
+
"neptune.DateLookup.selected": "selected",
|
|
10658
|
+
"neptune.DateLookup.twentyYears": "20 years",
|
|
10659
|
+
"neptune.DateLookup.year": "year",
|
|
10604
10660
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
10605
10661
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
10606
10662
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
@@ -11062,6 +11118,7 @@ class Snackbar extends React.Component {
|
|
|
11062
11118
|
ref: this.bodyRef,
|
|
11063
11119
|
as: "span",
|
|
11064
11120
|
className: `snackbar__text snackbar__text--${theme}`,
|
|
11121
|
+
"aria-live": "polite",
|
|
11065
11122
|
children: [text, action ? /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
|
|
11066
11123
|
className: "snackbar__text__action",
|
|
11067
11124
|
onClick: action.onClick,
|
|
@@ -11961,7 +12018,8 @@ class Tabs extends React.Component {
|
|
|
11961
12018
|
children: title
|
|
11962
12019
|
}, title);
|
|
11963
12020
|
}), translateLineX ? /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
11964
|
-
|
|
12021
|
+
role: "none",
|
|
12022
|
+
className: "tabs__line",
|
|
11965
12023
|
style: {
|
|
11966
12024
|
width: this.getTabLineWidth(),
|
|
11967
12025
|
transform: isRTL ? `translateX(-${translateLineX})` : `translateX(${translateLineX})`
|
|
@@ -13108,6 +13166,7 @@ const ProcessingStep = props => {
|
|
|
13108
13166
|
'm-b-2': isModern
|
|
13109
13167
|
}),
|
|
13110
13168
|
type: exports.Typography.TITLE_BODY,
|
|
13169
|
+
"aria-live": "polite",
|
|
13111
13170
|
children: psProcessingText
|
|
13112
13171
|
}), psButtonText && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
13113
13172
|
disabled: psButtonDisabled,
|
|
@@ -13151,6 +13210,7 @@ const CompleteStep = props => {
|
|
|
13151
13210
|
className: "droppable-card-content",
|
|
13152
13211
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13153
13212
|
className: "droppable-card-content d-flex flex-column align-items-center",
|
|
13213
|
+
"aria-live": "polite",
|
|
13154
13214
|
children: isError ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13155
13215
|
children: [isModern ? /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
13156
13216
|
size: exports.Size.LARGE,
|
|
@@ -13519,6 +13579,7 @@ class Upload extends React.Component {
|
|
|
13519
13579
|
onClear: event => this.handleOnClear(event)
|
|
13520
13580
|
}), !isProcessing && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13521
13581
|
className: "droppable-dropping-card droppable-card",
|
|
13582
|
+
"aria-live": "polite",
|
|
13522
13583
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13523
13584
|
className: "droppable-card-content",
|
|
13524
13585
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -13993,6 +14054,7 @@ const UploadItem = ({
|
|
|
13993
14054
|
onDownload: onDownloadFile,
|
|
13994
14055
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13995
14056
|
className: "np-upload-button",
|
|
14057
|
+
"aria-live": "polite",
|
|
13996
14058
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13997
14059
|
className: "media",
|
|
13998
14060
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|