@transferwise/components 46.27.0 → 46.28.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/th.json +2 -2
- package/build/index.js +327 -630
- package/build/index.js.map +1 -1
- package/build/index.mjs +328 -631
- package/build/index.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +47 -58
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/alert/index.d.ts +2 -1
- package/build/types/alert/index.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +7 -9
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/common/dateUtils/isWithinRange/isWithinRange.d.ts +1 -1
- package/build/types/common/dateUtils/isWithinRange/isWithinRange.d.ts.map +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/moveToWithinRange.d.ts +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/moveToWithinRange.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +0 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +75 -28
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.messages.d.ts +42 -63
- package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts +9 -22
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/index.d.ts +1 -1
- package/build/types/dateLookup/dateHeader/index.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +13 -31
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/index.d.ts +1 -1
- package/build/types/dateLookup/dateTrigger/index.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts +19 -2
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/index.d.ts +1 -1
- package/build/types/dateLookup/dayCalendar/index.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +12 -2
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/index.d.ts +1 -1
- package/build/types/dateLookup/dayCalendar/table/index.d.ts.map +1 -1
- package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts +1 -1
- package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts.map +1 -1
- package/build/types/dateLookup/getStartOfDay/index.d.ts +1 -1
- package/build/types/dateLookup/getStartOfDay/index.d.ts.map +1 -1
- package/build/types/dateLookup/index.d.ts +2 -1
- package/build/types/dateLookup/index.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts +17 -2
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/index.d.ts +1 -1
- package/build/types/dateLookup/monthCalendar/index.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +10 -26
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/table/index.d.ts +1 -1
- package/build/types/dateLookup/monthCalendar/table/index.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +15 -2
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/index.d.ts +1 -1
- package/build/types/dateLookup/yearCalendar/index.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts +10 -26
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/table/index.d.ts +1 -1
- package/build/types/dateLookup/yearCalendar/table/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -4
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.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/statusIcon/StatusIcon.d.ts +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/alert/{Alert.spec.js → Alert.spec.tsx} +43 -40
- package/src/alert/Alert.story.tsx +1 -2
- package/src/alert/Alert.tsx +218 -0
- package/src/alert/index.ts +2 -0
- package/src/button/Button.tsx +6 -10
- package/src/common/dateUtils/isWithinRange/isWithinRange.spec.ts +21 -0
- package/src/common/dateUtils/isWithinRange/isWithinRange.ts +2 -2
- package/src/common/dateUtils/moveToWithinRange/moveToWithinRange.ts +8 -4
- package/src/common/propsValues/sentiment.ts +0 -10
- package/src/dateLookup/DateLookup.state.spec.js +7 -0
- package/src/dateLookup/{DateLookup.story.js → DateLookup.story.tsx} +13 -14
- package/src/dateLookup/DateLookup.tests.story.tsx +70 -0
- package/src/dateLookup/{DateLookup.js → DateLookup.tsx} +115 -81
- package/src/dateLookup/dateHeader/{DateHeader.js → DateHeader.tsx} +15 -15
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +0 -22
- package/src/dateLookup/dateTrigger/{DateTrigger.js → DateTrigger.tsx} +15 -32
- package/src/dateLookup/dayCalendar/{DayCalendar.js → DayCalendar.tsx} +14 -21
- package/src/dateLookup/dayCalendar/table/{DayCalendarTable.js → DayCalendarTable.tsx} +26 -37
- package/src/dateLookup/getStartOfDay/{getStartOfDay.js → getStartOfDay.tsx} +1 -1
- package/src/dateLookup/index.ts +2 -0
- package/src/dateLookup/monthCalendar/{MonthCalendar.js → MonthCalendar.tsx} +19 -22
- package/src/dateLookup/monthCalendar/table/{MonthCalendarTable.js → MonthCalendarTable.tsx} +31 -30
- package/src/dateLookup/yearCalendar/{YearCalendar.js → YearCalendar.tsx} +18 -21
- package/src/dateLookup/yearCalendar/table/{YearCalendarTable.js → YearCalendarTable.tsx} +26 -28
- package/src/i18n/th.json +2 -2
- package/src/index.ts +2 -1
- package/src/inlineAlert/InlineAlert.spec.tsx +0 -7
- package/src/inlineAlert/InlineAlert.tsx +19 -47
- package/src/inputs/InputGroup.tsx +3 -3
- package/src/inputs/SelectInput.tsx +1 -0
- package/src/inputs/_BottomSheet.tsx +44 -54
- package/src/inputs/_Popover.tsx +20 -23
- package/src/statusIcon/StatusIcon.tsx +14 -14
- package/build/types/alert/withArrow/alertArrowPositions.d.ts +0 -9
- package/build/types/alert/withArrow/alertArrowPositions.d.ts.map +0 -1
- package/build/types/alert/withArrow/index.d.ts +0 -3
- package/build/types/alert/withArrow/index.d.ts.map +0 -1
- package/build/types/alert/withArrow/withArrow.d.ts +0 -11
- package/build/types/alert/withArrow/withArrow.d.ts.map +0 -1
- package/src/alert/Alert.js +0 -196
- package/src/alert/index.js +0 -1
- package/src/alert/withArrow/alertArrowPositions.ts +0 -9
- package/src/alert/withArrow/index.js +0 -2
- package/src/alert/withArrow/withArrow.js +0 -50
- package/src/alert/withArrow/withArrow.spec.js +0 -51
- package/src/dateLookup/index.js +0 -1
- /package/src/dateLookup/{DateLookup.messages.js → DateLookup.messages.ts} +0 -0
- /package/src/dateLookup/dateHeader/{index.js → index.ts} +0 -0
- /package/src/dateLookup/dateTrigger/{index.js → index.ts} +0 -0
- /package/src/dateLookup/dayCalendar/{index.js → index.ts} +0 -0
- /package/src/dateLookup/dayCalendar/table/{index.js → index.ts} +0 -0
- /package/src/dateLookup/getStartOfDay/{index.js → index.ts} +0 -0
- /package/src/dateLookup/monthCalendar/{index.js → index.ts} +0 -0
- /package/src/dateLookup/monthCalendar/table/{index.js → index.ts} +0 -0
- /package/src/dateLookup/yearCalendar/{index.js → index.ts} +0 -0
- /package/src/dateLookup/yearCalendar/table/{index.js → index.ts} +0 -0
package/build/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect, createContext, useContext, useImperativeHandle, createElement, Component, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useId } from '@radix-ui/react-id';
|
|
6
|
-
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$
|
|
6
|
+
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import commonmark from 'commonmark';
|
|
9
10
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
10
11
|
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
11
12
|
import { Transition, Listbox } from '@headlessui/react';
|
|
12
13
|
import mergeProps from 'merge-props';
|
|
13
14
|
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
|
|
14
15
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
15
|
-
import { FocusScope } from '@react-aria/focus';
|
|
16
16
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
17
17
|
import { CSSTransition } from 'react-transition-group';
|
|
18
|
+
import { isUndefined, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
19
|
+
import { createPortal } from 'react-dom';
|
|
20
|
+
import { FocusScope } from '@react-aria/focus';
|
|
18
21
|
import { usePopper } from 'react-popper';
|
|
19
22
|
import throttle from 'lodash.throttle';
|
|
20
|
-
import { createPortal } from 'react-dom';
|
|
21
|
-
import { isUndefined, isKey, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
22
|
-
import commonmark from 'commonmark';
|
|
23
23
|
import { Flag, Illustration } from '@wise/art';
|
|
24
24
|
import clamp$2 from 'lodash.clamp';
|
|
25
25
|
import debounce from 'lodash.debounce';
|
|
@@ -775,22 +775,22 @@ const Link = ({
|
|
|
775
775
|
});
|
|
776
776
|
};
|
|
777
777
|
|
|
778
|
+
const iconTypeMap = {
|
|
779
|
+
positive: Check,
|
|
780
|
+
neutral: Info$1,
|
|
781
|
+
warning: Alert$1,
|
|
782
|
+
negative: Cross,
|
|
783
|
+
pending: ClockBorderless,
|
|
784
|
+
info: Info$1,
|
|
785
|
+
error: Cross,
|
|
786
|
+
success: Check
|
|
787
|
+
};
|
|
778
788
|
const StatusIcon = ({
|
|
779
|
-
sentiment =
|
|
780
|
-
size =
|
|
789
|
+
sentiment = 'neutral',
|
|
790
|
+
size = 'md'
|
|
781
791
|
}) => {
|
|
782
|
-
const iconTypeMap = {
|
|
783
|
-
[Sentiment.POSITIVE]: Check,
|
|
784
|
-
[Sentiment.NEUTRAL]: Info$1,
|
|
785
|
-
[Sentiment.WARNING]: Alert$2,
|
|
786
|
-
[Sentiment.NEGATIVE]: Cross,
|
|
787
|
-
[Sentiment.PENDING]: ClockBorderless,
|
|
788
|
-
[Sentiment.INFO]: Info$1,
|
|
789
|
-
[Sentiment.ERROR]: Cross,
|
|
790
|
-
[Sentiment.SUCCESS]: Check
|
|
791
|
-
};
|
|
792
|
-
const iconColor = [Sentiment.WARNING, Sentiment.PENDING].includes(sentiment) ? 'dark' : 'light';
|
|
793
792
|
const Icon = iconTypeMap[sentiment];
|
|
793
|
+
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
794
794
|
return /*#__PURE__*/jsx("span", {
|
|
795
795
|
"data-testid": "status-icon",
|
|
796
796
|
className: classNames('status-circle', 'status-circle-' + size, sentiment),
|
|
@@ -800,7 +800,7 @@ const StatusIcon = ({
|
|
|
800
800
|
});
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
-
function logActionRequired
|
|
803
|
+
function logActionRequired(message) {
|
|
804
804
|
if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
|
|
805
805
|
// eslint-disable-next-line no-console
|
|
806
806
|
console.warn(message);
|
|
@@ -808,48 +808,10 @@ function logActionRequired$1(message) {
|
|
|
808
808
|
}
|
|
809
809
|
function logActionRequiredIf(message, conditional) {
|
|
810
810
|
if (conditional) {
|
|
811
|
-
logActionRequired
|
|
811
|
+
logActionRequired(message);
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
const deprecatedMessage = ({
|
|
816
|
-
component,
|
|
817
|
-
propName,
|
|
818
|
-
message,
|
|
819
|
-
expiryDate
|
|
820
|
-
}) => {
|
|
821
|
-
const messages = [`${component} has deprecated the use of ${propName}.`];
|
|
822
|
-
if (message) {
|
|
823
|
-
messages.push(message);
|
|
824
|
-
}
|
|
825
|
-
if (expiryDate) {
|
|
826
|
-
messages.push(`${propName} will be removed on or after ${expiryDate.toLocaleString('en-GB', {
|
|
827
|
-
year: 'numeric',
|
|
828
|
-
month: 'numeric',
|
|
829
|
-
day: 'numeric'
|
|
830
|
-
})}`);
|
|
831
|
-
}
|
|
832
|
-
return messages.join(' ');
|
|
833
|
-
};
|
|
834
|
-
const deprecated = (validator, {
|
|
835
|
-
component,
|
|
836
|
-
message = '',
|
|
837
|
-
newProp: newProperty = null,
|
|
838
|
-
expiryDate = null
|
|
839
|
-
}) => (props, propertyName, ...rest) => {
|
|
840
|
-
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
841
|
-
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
842
|
-
logActionRequired$1(deprecatedMessage({
|
|
843
|
-
component,
|
|
844
|
-
propName: propertyName,
|
|
845
|
-
message: newPropertyMessage,
|
|
846
|
-
expiryDate
|
|
847
|
-
}));
|
|
848
|
-
}
|
|
849
|
-
return validator(props, propertyName, ...rest);
|
|
850
|
-
};
|
|
851
|
-
var deprecated$1 = deprecated;
|
|
852
|
-
|
|
853
815
|
const reader = new commonmark.Parser();
|
|
854
816
|
const writer = new commonmark.HtmlRenderer({
|
|
855
817
|
safe: true
|
|
@@ -869,7 +831,7 @@ function Markdown({
|
|
|
869
831
|
const linkTarget = config?.link?.target ?? '_self';
|
|
870
832
|
const paragraphClass = config?.paragraph?.className ?? '';
|
|
871
833
|
if (allowList != null && blockList != null) {
|
|
872
|
-
logActionRequired
|
|
834
|
+
logActionRequired('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
|
|
873
835
|
}
|
|
874
836
|
const parser = nodes => {
|
|
875
837
|
const parsed = reader.parse(nodes);
|
|
@@ -930,146 +892,98 @@ InlineMarkdown.defaultProps = {
|
|
|
930
892
|
};
|
|
931
893
|
var InlineMarkdown$1 = InlineMarkdown;
|
|
932
894
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
};
|
|
953
|
-
AlertWithArrow.defaultProps = {
|
|
954
|
-
className: undefined
|
|
955
|
-
};
|
|
956
|
-
return AlertWithArrow;
|
|
895
|
+
var AlertArrowPosition;
|
|
896
|
+
(function (AlertArrowPosition) {
|
|
897
|
+
AlertArrowPosition["TOP_LEFT"] = "up-left";
|
|
898
|
+
AlertArrowPosition["TOP"] = "up-center";
|
|
899
|
+
AlertArrowPosition["TOP_RIGHT"] = "up-right";
|
|
900
|
+
AlertArrowPosition["BOTTOM_LEFT"] = "down-left";
|
|
901
|
+
AlertArrowPosition["BOTTOM"] = "down-center";
|
|
902
|
+
AlertArrowPosition["BOTTOM_RIGHT"] = "down-right";
|
|
903
|
+
})(AlertArrowPosition || (AlertArrowPosition = {}));
|
|
904
|
+
function resolveType(type) {
|
|
905
|
+
switch (type) {
|
|
906
|
+
case 'success':
|
|
907
|
+
return 'positive';
|
|
908
|
+
case 'info':
|
|
909
|
+
return 'neutral';
|
|
910
|
+
case 'error':
|
|
911
|
+
return 'negative';
|
|
912
|
+
}
|
|
913
|
+
return type;
|
|
957
914
|
}
|
|
958
|
-
function
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
return classes.concat('arrow-bottom', 'arrow-right');
|
|
976
|
-
case TOP:
|
|
977
|
-
return classes.concat('arrow-center');
|
|
978
|
-
case TOP_RIGHT:
|
|
979
|
-
return classes.concat('arrow-right');
|
|
980
|
-
case TOP_LEFT:
|
|
981
|
-
default:
|
|
982
|
-
return classes;
|
|
915
|
+
function Alert({
|
|
916
|
+
arrow,
|
|
917
|
+
action,
|
|
918
|
+
children,
|
|
919
|
+
className,
|
|
920
|
+
dismissible,
|
|
921
|
+
icon,
|
|
922
|
+
onDismiss,
|
|
923
|
+
message,
|
|
924
|
+
size,
|
|
925
|
+
title,
|
|
926
|
+
type = 'neutral',
|
|
927
|
+
variant = 'desktop'
|
|
928
|
+
}) {
|
|
929
|
+
useEffect(() => {
|
|
930
|
+
if (arrow !== undefined) {
|
|
931
|
+
logActionRequired("Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.");
|
|
983
932
|
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
const deprecatedTypeMap$1 = {
|
|
989
|
-
[Sentiment.SUCCESS]: Sentiment.POSITIVE,
|
|
990
|
-
[Sentiment.INFO]: Sentiment.NEUTRAL,
|
|
991
|
-
[Sentiment.ERROR]: Sentiment.NEGATIVE
|
|
992
|
-
};
|
|
993
|
-
const Alert = props => {
|
|
994
|
-
const {
|
|
995
|
-
isModern
|
|
996
|
-
} = useTheme();
|
|
997
|
-
const iconTypeMap = {
|
|
998
|
-
[Sentiment.POSITIVE]: CheckCircle,
|
|
999
|
-
[Sentiment.NEUTRAL]: InfoCircle,
|
|
1000
|
-
[Sentiment.WARNING]: Warning,
|
|
1001
|
-
[Sentiment.NEGATIVE]: CrossCircle,
|
|
1002
|
-
[Sentiment.PENDING]: Clock
|
|
1003
|
-
};
|
|
1004
|
-
const [shouldFire, setShouldFire] = useState(false);
|
|
1005
|
-
const {
|
|
1006
|
-
arrow,
|
|
1007
|
-
action,
|
|
1008
|
-
children,
|
|
1009
|
-
className,
|
|
1010
|
-
icon,
|
|
1011
|
-
onDismiss,
|
|
1012
|
-
message,
|
|
1013
|
-
title,
|
|
1014
|
-
type,
|
|
1015
|
-
variant
|
|
1016
|
-
} = props;
|
|
1017
|
-
const closeButtonReference = useRef(null);
|
|
1018
|
-
if (arrow) {
|
|
1019
|
-
const AlertWithArrow = withArrow(Alert, arrow);
|
|
1020
|
-
return /*#__PURE__*/jsx(AlertWithArrow, {
|
|
1021
|
-
...props
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
logActionRequired(props);
|
|
1025
|
-
const mappedType = deprecatedTypeMap$1[type] || type;
|
|
1026
|
-
const Icon = iconTypeMap[mappedType];
|
|
1027
|
-
function generateIcon() {
|
|
1028
|
-
if (icon) {
|
|
1029
|
-
return /*#__PURE__*/jsx("div", {
|
|
1030
|
-
className: "alert__icon",
|
|
1031
|
-
children: icon
|
|
1032
|
-
});
|
|
933
|
+
}, [arrow]);
|
|
934
|
+
useEffect(() => {
|
|
935
|
+
if (children !== undefined) {
|
|
936
|
+
logActionRequired("Alert component doesn't support 'children' anymore, use 'message' instead.");
|
|
1033
937
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
});
|
|
1039
|
-
} else {
|
|
1040
|
-
return /*#__PURE__*/jsx(Icon, {
|
|
1041
|
-
size: 24
|
|
1042
|
-
});
|
|
938
|
+
}, [children]);
|
|
939
|
+
useEffect(() => {
|
|
940
|
+
if (dismissible !== undefined) {
|
|
941
|
+
logActionRequired("Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.");
|
|
1043
942
|
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
943
|
+
}, [dismissible]);
|
|
944
|
+
useEffect(() => {
|
|
945
|
+
if (size !== undefined) {
|
|
946
|
+
logActionRequired("Alert component doesn't support 'size' anymore, please remove that prop.");
|
|
947
|
+
}
|
|
948
|
+
}, [size]);
|
|
949
|
+
const resolvedType = resolveType(type);
|
|
950
|
+
useEffect(() => {
|
|
951
|
+
if (resolvedType !== type) {
|
|
952
|
+
logActionRequired(`Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`);
|
|
953
|
+
}
|
|
954
|
+
}, [resolvedType, type]);
|
|
955
|
+
const [shouldFire, setShouldFire] = useState(false);
|
|
956
|
+
const closeButtonReference = useRef(null);
|
|
957
|
+
return /*#__PURE__*/jsxs("div", {
|
|
958
|
+
className: classNames('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
|
|
959
|
+
"data-testid": "alert",
|
|
960
|
+
onTouchStart: () => setShouldFire(true),
|
|
961
|
+
onTouchEnd: event => {
|
|
962
|
+
if (shouldFire && action &&
|
|
1049
963
|
// Check if current event is triggered from closeButton
|
|
1050
|
-
|
|
1051
|
-
if (action
|
|
1052
|
-
window.top
|
|
964
|
+
event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
|
|
965
|
+
if (action.target === '_blank') {
|
|
966
|
+
window.top?.open(action.href);
|
|
1053
967
|
} else {
|
|
1054
|
-
window.top
|
|
968
|
+
window.top?.location.assign(action.href);
|
|
1055
969
|
}
|
|
1056
970
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
return /*#__PURE__*/jsxs("div", {
|
|
1061
|
-
className: classNames('alert d-flex', `alert-${mappedType}`, className),
|
|
1062
|
-
"data-testid": "alert",
|
|
1063
|
-
onTouchStart: handleTouchStart,
|
|
1064
|
-
onTouchEnd: handleTouchEnd,
|
|
1065
|
-
onTouchMove: handleTouchMove,
|
|
971
|
+
setShouldFire(false);
|
|
972
|
+
},
|
|
973
|
+
onTouchMove: () => setShouldFire(false),
|
|
1066
974
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1067
975
|
className: classNames('alert__content', 'd-flex', 'flex-grow-1', variant),
|
|
1068
976
|
"data-testid": variant,
|
|
1069
|
-
children: [
|
|
977
|
+
children: [icon ? /*#__PURE__*/jsx("div", {
|
|
978
|
+
className: "alert__icon",
|
|
979
|
+
children: icon
|
|
980
|
+
}) : /*#__PURE__*/jsx(StatusIcon, {
|
|
981
|
+
size: Size.LARGE,
|
|
982
|
+
sentiment: resolvedType
|
|
983
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1070
984
|
className: "alert__message",
|
|
1071
985
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1072
|
-
role: Sentiment.NEGATIVE ===
|
|
986
|
+
role: Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
|
|
1073
987
|
children: [title && /*#__PURE__*/jsx(Title, {
|
|
1074
988
|
className: "m-b-1",
|
|
1075
989
|
type: Typography.TITLE_BODY,
|
|
@@ -1097,72 +1011,24 @@ const Alert = props => {
|
|
|
1097
1011
|
onClick: onDismiss
|
|
1098
1012
|
})]
|
|
1099
1013
|
});
|
|
1100
|
-
};
|
|
1101
|
-
const deprecatedTypeMapMessage$1 = {
|
|
1102
|
-
[Sentiment.SUCCESS]: 'Sentiment.POSITIVE',
|
|
1103
|
-
[Sentiment.INFO]: 'Sentiment.NEUTRAL',
|
|
1104
|
-
[Sentiment.ERROR]: 'Sentiment.NEGATIVE'
|
|
1105
|
-
};
|
|
1106
|
-
const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
|
|
1107
|
-
function logActionRequired({
|
|
1108
|
-
size,
|
|
1109
|
-
type
|
|
1110
|
-
}) {
|
|
1111
|
-
logActionRequiredIf('Alert no longer supports any possible variations in size. Please remove the `size` prop.', !!size);
|
|
1112
|
-
logActionRequiredIf(`Alert has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage$1[type]}.`, deprecatedTypes$1.includes(type));
|
|
1113
1014
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
/** The presence of the onDismiss handler will trigger the visibility of the close button */
|
|
1132
|
-
onDismiss: PropTypes.func,
|
|
1133
|
-
/** The type dictates which icon and colour will be used */
|
|
1134
|
-
type: PropTypes.oneOf(['negative', 'neutral', 'positive', 'warning', 'info', 'error', 'success']),
|
|
1135
|
-
variant: PropTypes.oneOf(['desktop', 'mobile']),
|
|
1136
|
-
/** @deprecated no arrow for `Alert` component anymore, consider to use [`InlineAlert`](https://transferwise.github.io/neptune-web/components/alerts/InlineAlert) component */
|
|
1137
|
-
arrow: deprecated$1(PropTypes.oneOf(['up-left', 'up-center', 'up-right', 'down-left', 'down-center', 'down-right']), {
|
|
1138
|
-
component: 'Alert',
|
|
1139
|
-
expiryDate: new Date('03-01-2021')
|
|
1140
|
-
}),
|
|
1141
|
-
/** @deprecated use `message` property instead */
|
|
1142
|
-
children: deprecated$1(requiredIf(PropTypes.node, ({
|
|
1143
|
-
message
|
|
1144
|
-
}) => !message), {
|
|
1145
|
-
component: 'Alert',
|
|
1146
|
-
message: 'You should now use the `message` prop. Be aware `message` only accepts plain text or text with **bold** markdown.',
|
|
1147
|
-
expiryDate: new Date('03-01-2021')
|
|
1148
|
-
}),
|
|
1149
|
-
/** @deprecated use `onDismiss` instead */
|
|
1150
|
-
dismissible: deprecated$1(PropTypes.bool, {
|
|
1151
|
-
component: 'Alert',
|
|
1152
|
-
message: 'The Alert will now be considered dismissible if an `onDismiss` hander is present.',
|
|
1153
|
-
expiryDate: new Date('03-01-2021')
|
|
1154
|
-
})
|
|
1155
|
-
};
|
|
1156
|
-
Alert.defaultProps = {
|
|
1157
|
-
action: undefined,
|
|
1158
|
-
arrow: undefined,
|
|
1159
|
-
className: undefined,
|
|
1160
|
-
dismissible: undefined,
|
|
1161
|
-
icon: undefined,
|
|
1162
|
-
type: Sentiment.NEUTRAL,
|
|
1163
|
-
variant: Variant.DESKTOP
|
|
1164
|
-
};
|
|
1165
|
-
var Alert$1 = Alert;
|
|
1015
|
+
function alertArrowClassNames(arrow) {
|
|
1016
|
+
switch (arrow) {
|
|
1017
|
+
case 'down-center':
|
|
1018
|
+
return 'arrow arrow-bottom arrow-center';
|
|
1019
|
+
case 'down-left':
|
|
1020
|
+
return 'arrow arrow-bottom arrow-left';
|
|
1021
|
+
case 'down-right':
|
|
1022
|
+
return 'arrow arrow-bottom arrow-right';
|
|
1023
|
+
case 'up-center':
|
|
1024
|
+
return 'arrow arrow-center';
|
|
1025
|
+
case 'up-right':
|
|
1026
|
+
return 'arrow arrow-right';
|
|
1027
|
+
case 'up-left':
|
|
1028
|
+
default:
|
|
1029
|
+
return 'arrow';
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1166
1032
|
|
|
1167
1033
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
1168
1034
|
var AvatarType;
|
|
@@ -1388,6 +1254,7 @@ const FocusBoundary = ({
|
|
|
1388
1254
|
})
|
|
1389
1255
|
});
|
|
1390
1256
|
};
|
|
1257
|
+
var FocusBoundary$1 = FocusBoundary;
|
|
1391
1258
|
|
|
1392
1259
|
function withNextPortalWrapper(Component) {
|
|
1393
1260
|
return function (props) {
|
|
@@ -1529,7 +1396,7 @@ const Dimmer = ({
|
|
|
1529
1396
|
onExited: onExited,
|
|
1530
1397
|
children: /*#__PURE__*/jsx(DimmerContentWrapper, {
|
|
1531
1398
|
scrollBody: !transparent,
|
|
1532
|
-
children: /*#__PURE__*/jsx(FocusBoundary, {
|
|
1399
|
+
children: /*#__PURE__*/jsx(FocusBoundary$1, {
|
|
1533
1400
|
children: /*#__PURE__*/jsx("div", {
|
|
1534
1401
|
ref: dimmerReference,
|
|
1535
1402
|
className: classNames('dimmer', {
|
|
@@ -2161,7 +2028,7 @@ var messages$b = defineMessages({
|
|
|
2161
2028
|
}
|
|
2162
2029
|
});
|
|
2163
2030
|
|
|
2164
|
-
const typeClassMap
|
|
2031
|
+
const typeClassMap = {
|
|
2165
2032
|
[ControlType.ACCENT]: 'btn-accent',
|
|
2166
2033
|
[ControlType.POSITIVE]: 'btn-positive',
|
|
2167
2034
|
[ControlType.NEGATIVE]: 'btn-negative'
|
|
@@ -2245,7 +2112,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2245
2112
|
},
|
|
2246
2113
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2247
2114
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2248
|
-
typeClassMap
|
|
2115
|
+
typeClassMap[newType],
|
|
2249
2116
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2250
2117
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2251
2118
|
priorityClassMap[newPriority], className);
|
|
@@ -2630,7 +2497,7 @@ const CircularButton = ({
|
|
|
2630
2497
|
type = ControlType.ACCENT,
|
|
2631
2498
|
...rest
|
|
2632
2499
|
}) => {
|
|
2633
|
-
const classes = classNames('btn np-btn', typeClassMap
|
|
2500
|
+
const classes = classNames('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
|
|
2634
2501
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
|
|
2635
2502
|
size: 24
|
|
2636
2503
|
}) : icon;
|
|
@@ -2665,11 +2532,17 @@ function getDayNames(locale, format = 'short') {
|
|
|
2665
2532
|
|
|
2666
2533
|
// Makes sure that date is between min and max dates, returns a cloned min or max
|
|
2667
2534
|
function moveToWithinRange(date, min, max) {
|
|
2668
|
-
|
|
2535
|
+
if (min && date < min) {
|
|
2536
|
+
return new Date(min);
|
|
2537
|
+
}
|
|
2538
|
+
if (max && date > max) {
|
|
2539
|
+
return new Date(max);
|
|
2540
|
+
}
|
|
2541
|
+
return date;
|
|
2669
2542
|
}
|
|
2670
2543
|
|
|
2671
2544
|
function isWithinRange(date, min, max) {
|
|
2672
|
-
return
|
|
2545
|
+
return (!min || date >= min) && (!max || date <= max);
|
|
2673
2546
|
}
|
|
2674
2547
|
|
|
2675
2548
|
const getMonthNames = (locale, format = 'long') => {
|
|
@@ -3193,7 +3066,7 @@ var dateTriggerMessages = defineMessages({
|
|
|
3193
3066
|
|
|
3194
3067
|
const DateTrigger = ({
|
|
3195
3068
|
selectedDate,
|
|
3196
|
-
size,
|
|
3069
|
+
size = Size.MEDIUM,
|
|
3197
3070
|
placeholder,
|
|
3198
3071
|
label,
|
|
3199
3072
|
monthFormat,
|
|
@@ -3205,19 +3078,6 @@ const DateTrigger = ({
|
|
|
3205
3078
|
locale,
|
|
3206
3079
|
formatMessage
|
|
3207
3080
|
} = useIntl();
|
|
3208
|
-
const handleKeyDown = event => {
|
|
3209
|
-
if (isKey({
|
|
3210
|
-
keyType: 'Space',
|
|
3211
|
-
event: event
|
|
3212
|
-
}) || isKey({
|
|
3213
|
-
keyType: 'Enter',
|
|
3214
|
-
event: event
|
|
3215
|
-
})) {
|
|
3216
|
-
event.stopPropagation();
|
|
3217
|
-
event.preventDefault();
|
|
3218
|
-
onClear();
|
|
3219
|
-
}
|
|
3220
|
-
};
|
|
3221
3081
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3222
3082
|
children: [/*#__PURE__*/jsxs("button", {
|
|
3223
3083
|
className: `btn btn-${size} btn-input np-date-trigger`,
|
|
@@ -3254,29 +3114,12 @@ const DateTrigger = ({
|
|
|
3254
3114
|
event.stopPropagation();
|
|
3255
3115
|
event.preventDefault();
|
|
3256
3116
|
onClear();
|
|
3257
|
-
}
|
|
3258
|
-
onKeyPress: handleKeyDown
|
|
3117
|
+
}
|
|
3259
3118
|
})
|
|
3260
3119
|
})]
|
|
3261
3120
|
}) : null]
|
|
3262
3121
|
});
|
|
3263
3122
|
};
|
|
3264
|
-
DateTrigger.propTypes = {
|
|
3265
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3266
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
3267
|
-
placeholder: PropTypes.string.isRequired,
|
|
3268
|
-
label: PropTypes.string.isRequired,
|
|
3269
|
-
monthFormat: PropTypes.oneOf(['short', 'long']).isRequired,
|
|
3270
|
-
disabled: PropTypes.bool.isRequired,
|
|
3271
|
-
onClick: PropTypes.func,
|
|
3272
|
-
onClear: PropTypes.func
|
|
3273
|
-
};
|
|
3274
|
-
DateTrigger.defaultProps = {
|
|
3275
|
-
selectedDate: null,
|
|
3276
|
-
size: Size.MEDIUM,
|
|
3277
|
-
onClear: undefined
|
|
3278
|
-
};
|
|
3279
|
-
var DateTrigger$1 = DateTrigger;
|
|
3280
3123
|
|
|
3281
3124
|
var messages$8 = defineMessages({
|
|
3282
3125
|
next: {
|
|
@@ -3358,18 +3201,6 @@ const DateHeader = ({
|
|
|
3358
3201
|
})]
|
|
3359
3202
|
});
|
|
3360
3203
|
};
|
|
3361
|
-
DateHeader.propTypes = {
|
|
3362
|
-
label: PropTypes.string,
|
|
3363
|
-
onLabelClick: PropTypes.func,
|
|
3364
|
-
onPreviousClick: PropTypes.func.isRequired,
|
|
3365
|
-
onNextClick: PropTypes.func.isRequired,
|
|
3366
|
-
dateMode: PropTypes.string
|
|
3367
|
-
};
|
|
3368
|
-
DateHeader.defaultProps = {
|
|
3369
|
-
label: null,
|
|
3370
|
-
onLabelClick: () => {}
|
|
3371
|
-
};
|
|
3372
|
-
var DateHeader$1 = DateHeader;
|
|
3373
3204
|
|
|
3374
3205
|
function getFocusableTime(props) {
|
|
3375
3206
|
return props.timeSpan.find(time => props.isActive(time)) || props.timeSpan.find(time => props.isNow(time) && !props.isDisabled(time)) || props.timeSpan.find(time => !props.isDisabled(time));
|
|
@@ -3455,10 +3286,9 @@ class DayCalendarTable extends PureComponent {
|
|
|
3455
3286
|
let week = [];
|
|
3456
3287
|
const weeks = [];
|
|
3457
3288
|
let i;
|
|
3458
|
-
|
|
3459
3289
|
// Pad first week
|
|
3460
3290
|
for (i = 1; i < firstDayOfMonth; i += 1) {
|
|
3461
|
-
week.push(
|
|
3291
|
+
week.push(-1);
|
|
3462
3292
|
}
|
|
3463
3293
|
// Fill in days
|
|
3464
3294
|
for (i = 1; i <= daysInMonth; i += 1) {
|
|
@@ -3471,7 +3301,7 @@ class DayCalendarTable extends PureComponent {
|
|
|
3471
3301
|
if (week.length > 0) {
|
|
3472
3302
|
// Pad last week
|
|
3473
3303
|
for (i = week.length; i < 7; i += 1) {
|
|
3474
|
-
week.push(
|
|
3304
|
+
week.push(-1);
|
|
3475
3305
|
}
|
|
3476
3306
|
weeks.push(week);
|
|
3477
3307
|
}
|
|
@@ -3526,12 +3356,10 @@ class DayCalendarTable extends PureComponent {
|
|
|
3526
3356
|
const {
|
|
3527
3357
|
viewMonth,
|
|
3528
3358
|
viewYear,
|
|
3529
|
-
intl
|
|
3530
|
-
locale
|
|
3531
|
-
}
|
|
3359
|
+
intl
|
|
3532
3360
|
} = this.props;
|
|
3533
3361
|
const weeks = this.getTableStructure();
|
|
3534
|
-
|
|
3362
|
+
const autoFocusDay = this.getAutofocusDay(weeks);
|
|
3535
3363
|
return /*#__PURE__*/jsxs("table", {
|
|
3536
3364
|
className: "table table-condensed table-bordered tw-date-lookup-calendar m-b-0",
|
|
3537
3365
|
children: [/*#__PURE__*/jsx("thead", {
|
|
@@ -3557,12 +3385,12 @@ class DayCalendarTable extends PureComponent {
|
|
|
3557
3385
|
children: weeks.map((week, weekIndex) => /*#__PURE__*/jsx("tr", {
|
|
3558
3386
|
children: week.map((day, dayIndex) => /*#__PURE__*/jsx("td", {
|
|
3559
3387
|
className: dayIndex > 4 ? 'weekend' : '',
|
|
3560
|
-
children: day && /*#__PURE__*/jsx(TableLink, {
|
|
3388
|
+
children: day !== -1 && /*#__PURE__*/jsx(TableLink, {
|
|
3561
3389
|
item: day,
|
|
3562
3390
|
type: "day",
|
|
3563
|
-
title: formatDate(new Date(viewYear, viewMonth, day), locale, SHORT_DAY_FORMAT),
|
|
3391
|
+
title: formatDate(new Date(viewYear, viewMonth, day), intl.locale, SHORT_DAY_FORMAT),
|
|
3564
3392
|
autofocus: day === autoFocusDay,
|
|
3565
|
-
longTitle: formatDate(new Date(viewYear, viewMonth, day), locale),
|
|
3393
|
+
longTitle: formatDate(new Date(viewYear, viewMonth, day), intl.locale),
|
|
3566
3394
|
active: this.isActive(day),
|
|
3567
3395
|
disabled: this.isDisabled(day),
|
|
3568
3396
|
today: this.isToday(day),
|
|
@@ -3574,19 +3402,6 @@ class DayCalendarTable extends PureComponent {
|
|
|
3574
3402
|
});
|
|
3575
3403
|
}
|
|
3576
3404
|
}
|
|
3577
|
-
DayCalendarTable.propTypes = {
|
|
3578
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3579
|
-
min: PropTypes.instanceOf(Date),
|
|
3580
|
-
max: PropTypes.instanceOf(Date),
|
|
3581
|
-
viewMonth: PropTypes.number.isRequired,
|
|
3582
|
-
viewYear: PropTypes.number.isRequired,
|
|
3583
|
-
onSelect: PropTypes.func.isRequired
|
|
3584
|
-
};
|
|
3585
|
-
DayCalendarTable.defaultProps = {
|
|
3586
|
-
selectedDate: null,
|
|
3587
|
-
min: null,
|
|
3588
|
-
max: null
|
|
3589
|
-
};
|
|
3590
3405
|
var DayCalendarTable$1 = injectIntl(DayCalendarTable);
|
|
3591
3406
|
|
|
3592
3407
|
class DayCalendar extends PureComponent {
|
|
@@ -3626,7 +3441,7 @@ class DayCalendar extends PureComponent {
|
|
|
3626
3441
|
onSelect
|
|
3627
3442
|
} = this.props;
|
|
3628
3443
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3629
|
-
children: [/*#__PURE__*/jsx(DateHeader
|
|
3444
|
+
children: [/*#__PURE__*/jsx(DateHeader, {
|
|
3630
3445
|
label: formatDate(new Date(viewYear, viewMonth), locale, {
|
|
3631
3446
|
month: monthFormat,
|
|
3632
3447
|
year: 'numeric'
|
|
@@ -3646,22 +3461,6 @@ class DayCalendar extends PureComponent {
|
|
|
3646
3461
|
});
|
|
3647
3462
|
}
|
|
3648
3463
|
}
|
|
3649
|
-
DayCalendar.propTypes = {
|
|
3650
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3651
|
-
min: PropTypes.instanceOf(Date),
|
|
3652
|
-
max: PropTypes.instanceOf(Date),
|
|
3653
|
-
viewMonth: PropTypes.number.isRequired,
|
|
3654
|
-
viewYear: PropTypes.number.isRequired,
|
|
3655
|
-
monthFormat: PropTypes.oneOf([MonthFormat.LONG, MonthFormat.SHORT]).isRequired,
|
|
3656
|
-
onSelect: PropTypes.func.isRequired,
|
|
3657
|
-
onLabelClick: PropTypes.func.isRequired,
|
|
3658
|
-
onViewDateUpdate: PropTypes.func.isRequired
|
|
3659
|
-
};
|
|
3660
|
-
DayCalendar.defaultProps = {
|
|
3661
|
-
selectedDate: null,
|
|
3662
|
-
min: null,
|
|
3663
|
-
max: null
|
|
3664
|
-
};
|
|
3665
3464
|
var DayCalendar$1 = injectIntl(DayCalendar);
|
|
3666
3465
|
|
|
3667
3466
|
const ROWS$1 = 3;
|
|
@@ -3693,7 +3492,7 @@ const MonthCalendarTable = ({
|
|
|
3693
3492
|
});
|
|
3694
3493
|
};
|
|
3695
3494
|
const isActive = month => {
|
|
3696
|
-
return selectedDate && month === selectedDate.getMonth() && viewYear === selectedDate.getFullYear();
|
|
3495
|
+
return !!(selectedDate && month === selectedDate.getMonth() && viewYear === selectedDate.getFullYear());
|
|
3697
3496
|
};
|
|
3698
3497
|
const isThisMonth = month => {
|
|
3699
3498
|
return viewYear === new Date().getFullYear() && month === new Date().getMonth();
|
|
@@ -3703,7 +3502,9 @@ const MonthCalendarTable = ({
|
|
|
3703
3502
|
return !!(min && date < new Date(min.getFullYear(), min.getMonth()) || max && date > new Date(max.getFullYear(), max.getMonth()));
|
|
3704
3503
|
};
|
|
3705
3504
|
const autofocusMonth = (() => {
|
|
3706
|
-
const months =
|
|
3505
|
+
const months = Array.from({
|
|
3506
|
+
length: ROWS$1 * COLS$1
|
|
3507
|
+
}, (_, index) => index);
|
|
3707
3508
|
return getFocusableTime({
|
|
3708
3509
|
isActive,
|
|
3709
3510
|
isNow: isThisMonth,
|
|
@@ -3717,33 +3518,23 @@ const MonthCalendarTable = ({
|
|
|
3717
3518
|
className: "sr-only",
|
|
3718
3519
|
children: /*#__PURE__*/jsx("tr", {
|
|
3719
3520
|
children: /*#__PURE__*/jsx("th", {
|
|
3720
|
-
colSpan:
|
|
3521
|
+
colSpan: COLS$1,
|
|
3721
3522
|
children: placeholder
|
|
3722
3523
|
})
|
|
3723
3524
|
})
|
|
3724
3525
|
}), /*#__PURE__*/jsx("tbody", {
|
|
3725
|
-
children:
|
|
3726
|
-
|
|
3526
|
+
children: Array.from({
|
|
3527
|
+
length: ROWS$1
|
|
3528
|
+
}, (_, rowIndex) => /*#__PURE__*/jsx("tr", {
|
|
3529
|
+
children: Array.from({
|
|
3530
|
+
length: COLS$1
|
|
3531
|
+
}, (_, colIndex) => /*#__PURE__*/jsx("td", {
|
|
3727
3532
|
children: getLink(rowIndex * COLS$1 + colIndex)
|
|
3728
3533
|
}, colIndex))
|
|
3729
3534
|
}, rowIndex))
|
|
3730
3535
|
})]
|
|
3731
3536
|
});
|
|
3732
3537
|
};
|
|
3733
|
-
MonthCalendarTable.propTypes = {
|
|
3734
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3735
|
-
min: PropTypes.instanceOf(Date),
|
|
3736
|
-
max: PropTypes.instanceOf(Date),
|
|
3737
|
-
viewYear: PropTypes.number.isRequired,
|
|
3738
|
-
placeholder: PropTypes.string.isRequired,
|
|
3739
|
-
onSelect: PropTypes.func.isRequired
|
|
3740
|
-
};
|
|
3741
|
-
MonthCalendarTable.defaultProps = {
|
|
3742
|
-
selectedDate: null,
|
|
3743
|
-
min: null,
|
|
3744
|
-
max: null
|
|
3745
|
-
};
|
|
3746
|
-
var MonthCalendarTable$1 = MonthCalendarTable;
|
|
3747
3538
|
|
|
3748
3539
|
class MonthCalendar extends PureComponent {
|
|
3749
3540
|
onMonthSelect = month => {
|
|
@@ -3776,7 +3567,7 @@ class MonthCalendar extends PureComponent {
|
|
|
3776
3567
|
onLabelClick
|
|
3777
3568
|
} = this.props;
|
|
3778
3569
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3779
|
-
children: [/*#__PURE__*/jsx(DateHeader
|
|
3570
|
+
children: [/*#__PURE__*/jsx(DateHeader, {
|
|
3780
3571
|
dateMode: formatMessage(messages$8.year),
|
|
3781
3572
|
label: formatDate(new Date(viewYear, 0), locale, {
|
|
3782
3573
|
year: 'numeric'
|
|
@@ -3784,32 +3575,17 @@ class MonthCalendar extends PureComponent {
|
|
|
3784
3575
|
onLabelClick: onLabelClick,
|
|
3785
3576
|
onPreviousClick: this.selectPreviousYear,
|
|
3786
3577
|
onNextClick: this.selectNextYear
|
|
3787
|
-
}), /*#__PURE__*/jsx(MonthCalendarTable
|
|
3788
|
-
selectedDate,
|
|
3789
|
-
min,
|
|
3790
|
-
max,
|
|
3791
|
-
viewYear,
|
|
3792
|
-
placeholder,
|
|
3578
|
+
}), /*#__PURE__*/jsx(MonthCalendarTable, {
|
|
3579
|
+
selectedDate: selectedDate,
|
|
3580
|
+
min: min,
|
|
3581
|
+
max: max,
|
|
3582
|
+
viewYear: viewYear,
|
|
3583
|
+
placeholder: placeholder,
|
|
3793
3584
|
onSelect: this.onMonthSelect
|
|
3794
3585
|
})]
|
|
3795
3586
|
});
|
|
3796
3587
|
}
|
|
3797
3588
|
}
|
|
3798
|
-
MonthCalendar.propTypes = {
|
|
3799
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3800
|
-
min: PropTypes.instanceOf(Date),
|
|
3801
|
-
max: PropTypes.instanceOf(Date),
|
|
3802
|
-
viewYear: PropTypes.number.isRequired,
|
|
3803
|
-
placeholder: PropTypes.string.isRequired,
|
|
3804
|
-
onSelect: PropTypes.func.isRequired,
|
|
3805
|
-
onLabelClick: PropTypes.func.isRequired,
|
|
3806
|
-
onViewDateUpdate: PropTypes.func.isRequired
|
|
3807
|
-
};
|
|
3808
|
-
MonthCalendar.defaultProps = {
|
|
3809
|
-
selectedDate: null,
|
|
3810
|
-
min: null,
|
|
3811
|
-
max: null
|
|
3812
|
-
};
|
|
3813
3589
|
var MonthCalendar$1 = injectIntl(MonthCalendar);
|
|
3814
3590
|
|
|
3815
3591
|
const ROWS = 5;
|
|
@@ -3851,7 +3627,9 @@ const YearCalendarTable = ({
|
|
|
3851
3627
|
return !!(min && year < min.getFullYear() || max && year > max.getFullYear());
|
|
3852
3628
|
};
|
|
3853
3629
|
const autofocusYear = (() => {
|
|
3854
|
-
const years =
|
|
3630
|
+
const years = Array.from({
|
|
3631
|
+
length: ROWS * COLS
|
|
3632
|
+
}, (_, index) => startYear + index);
|
|
3855
3633
|
return getFocusableTime({
|
|
3856
3634
|
isActive,
|
|
3857
3635
|
isNow: isThisYear,
|
|
@@ -3865,33 +3643,23 @@ const YearCalendarTable = ({
|
|
|
3865
3643
|
className: "sr-only",
|
|
3866
3644
|
children: /*#__PURE__*/jsx("tr", {
|
|
3867
3645
|
children: /*#__PURE__*/jsx("th", {
|
|
3868
|
-
colSpan:
|
|
3646
|
+
colSpan: COLS,
|
|
3869
3647
|
children: placeholder
|
|
3870
3648
|
})
|
|
3871
3649
|
})
|
|
3872
3650
|
}), /*#__PURE__*/jsx("tbody", {
|
|
3873
|
-
children:
|
|
3874
|
-
|
|
3651
|
+
children: Array.from({
|
|
3652
|
+
length: ROWS
|
|
3653
|
+
}, (_, rowIndex) => /*#__PURE__*/jsx("tr", {
|
|
3654
|
+
children: Array.from({
|
|
3655
|
+
length: COLS
|
|
3656
|
+
}, (_, colIndex) => /*#__PURE__*/jsx("td", {
|
|
3875
3657
|
children: getLink(startYear + rowIndex * COLS + colIndex)
|
|
3876
3658
|
}, colIndex))
|
|
3877
3659
|
}, rowIndex))
|
|
3878
3660
|
})]
|
|
3879
3661
|
});
|
|
3880
3662
|
};
|
|
3881
|
-
YearCalendarTable.propTypes = {
|
|
3882
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3883
|
-
min: PropTypes.instanceOf(Date),
|
|
3884
|
-
max: PropTypes.instanceOf(Date),
|
|
3885
|
-
viewYear: PropTypes.number.isRequired,
|
|
3886
|
-
placeholder: PropTypes.string.isRequired,
|
|
3887
|
-
onSelect: PropTypes.func.isRequired
|
|
3888
|
-
};
|
|
3889
|
-
YearCalendarTable.defaultProps = {
|
|
3890
|
-
selectedDate: null,
|
|
3891
|
-
min: null,
|
|
3892
|
-
max: null
|
|
3893
|
-
};
|
|
3894
|
-
var YearCalendarTable$1 = YearCalendarTable;
|
|
3895
3663
|
|
|
3896
3664
|
class YearCalendar extends PureComponent {
|
|
3897
3665
|
onYearSelect = year => {
|
|
@@ -3922,43 +3690,35 @@ class YearCalendar extends PureComponent {
|
|
|
3922
3690
|
}
|
|
3923
3691
|
} = this.props;
|
|
3924
3692
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3925
|
-
children: [/*#__PURE__*/jsx(DateHeader
|
|
3693
|
+
children: [/*#__PURE__*/jsx(DateHeader, {
|
|
3926
3694
|
dateMode: formatMessage(messages$8.twentyYears),
|
|
3927
3695
|
onPreviousClick: this.selectPreviousYears,
|
|
3928
3696
|
onNextClick: this.selectNextYears
|
|
3929
|
-
}), /*#__PURE__*/jsx(YearCalendarTable
|
|
3930
|
-
selectedDate,
|
|
3931
|
-
min,
|
|
3932
|
-
max,
|
|
3933
|
-
viewYear,
|
|
3934
|
-
placeholder,
|
|
3697
|
+
}), /*#__PURE__*/jsx(YearCalendarTable, {
|
|
3698
|
+
selectedDate: selectedDate,
|
|
3699
|
+
min: min,
|
|
3700
|
+
max: max,
|
|
3701
|
+
viewYear: viewYear,
|
|
3702
|
+
placeholder: placeholder,
|
|
3935
3703
|
onSelect: this.onYearSelect
|
|
3936
3704
|
})]
|
|
3937
3705
|
});
|
|
3938
3706
|
}
|
|
3939
3707
|
}
|
|
3940
|
-
YearCalendar.propTypes = {
|
|
3941
|
-
selectedDate: PropTypes.instanceOf(Date),
|
|
3942
|
-
min: PropTypes.instanceOf(Date),
|
|
3943
|
-
max: PropTypes.instanceOf(Date),
|
|
3944
|
-
viewYear: PropTypes.number.isRequired,
|
|
3945
|
-
placeholder: PropTypes.string.isRequired,
|
|
3946
|
-
onSelect: PropTypes.func.isRequired,
|
|
3947
|
-
onViewDateUpdate: PropTypes.func.isRequired
|
|
3948
|
-
};
|
|
3949
|
-
YearCalendar.defaultProps = {
|
|
3950
|
-
selectedDate: null,
|
|
3951
|
-
min: null,
|
|
3952
|
-
max: null
|
|
3953
|
-
};
|
|
3954
3708
|
var YearCalendar$1 = injectIntl(YearCalendar);
|
|
3955
3709
|
|
|
3956
|
-
const MODE = {
|
|
3957
|
-
DAY: 'day',
|
|
3958
|
-
MONTH: 'month',
|
|
3959
|
-
YEAR: 'year'
|
|
3960
|
-
};
|
|
3961
3710
|
class DateLookup extends PureComponent {
|
|
3711
|
+
static defaultProps = {
|
|
3712
|
+
value: null,
|
|
3713
|
+
min: null,
|
|
3714
|
+
max: null,
|
|
3715
|
+
size: Size.MEDIUM,
|
|
3716
|
+
placeholder: '',
|
|
3717
|
+
label: '',
|
|
3718
|
+
monthFormat: MonthFormat.LONG,
|
|
3719
|
+
disabled: false,
|
|
3720
|
+
clearable: false
|
|
3721
|
+
};
|
|
3962
3722
|
element = /*#__PURE__*/createRef();
|
|
3963
3723
|
dropdown = /*#__PURE__*/createRef();
|
|
3964
3724
|
constructor(props) {
|
|
@@ -3971,7 +3731,7 @@ class DateLookup extends PureComponent {
|
|
|
3971
3731
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
3972
3732
|
viewYear: (props.value || new Date()).getFullYear(),
|
|
3973
3733
|
open: false,
|
|
3974
|
-
mode:
|
|
3734
|
+
mode: 'day',
|
|
3975
3735
|
isMobile: false
|
|
3976
3736
|
};
|
|
3977
3737
|
}
|
|
@@ -3979,20 +3739,20 @@ class DateLookup extends PureComponent {
|
|
|
3979
3739
|
const propsSelected = getStartOfDay(props.value);
|
|
3980
3740
|
const propsMin = getStartOfDay(props.min);
|
|
3981
3741
|
const propsMax = getStartOfDay(props.max);
|
|
3982
|
-
const hasSelectedChanged =
|
|
3983
|
-
const hasMinChanged =
|
|
3984
|
-
const hasMaxChanged =
|
|
3742
|
+
const hasSelectedChanged = state.selectedDate?.getTime() !== propsSelected?.getTime();
|
|
3743
|
+
const hasMinChanged = state.min?.getTime() !== propsMin?.getTime();
|
|
3744
|
+
const hasMaxChanged = state.max?.getTime() !== propsMax?.getTime();
|
|
3985
3745
|
if (hasSelectedChanged || hasMinChanged || hasMaxChanged) {
|
|
3986
3746
|
const selectedDate = hasSelectedChanged ? propsSelected : state.selectedDate;
|
|
3987
3747
|
const min = hasMinChanged ? propsMin : state.min;
|
|
3988
3748
|
const max = hasMaxChanged ? propsMax : state.max;
|
|
3989
|
-
|
|
3990
|
-
if (!isWithinRange(selectedDate, min, max)) {
|
|
3749
|
+
if (selectedDate && !isWithinRange(selectedDate, min, max)) {
|
|
3991
3750
|
props.onChange(moveToWithinRange(selectedDate, min, max));
|
|
3992
3751
|
return null;
|
|
3993
3752
|
}
|
|
3994
|
-
const
|
|
3995
|
-
const
|
|
3753
|
+
const viewDateThatIsWithinRange = selectedDate || (min || max) && moveToWithinRange(new Date(), min, max) || new Date();
|
|
3754
|
+
const viewMonth = viewDateThatIsWithinRange.getMonth();
|
|
3755
|
+
const viewYear = viewDateThatIsWithinRange.getFullYear();
|
|
3996
3756
|
return {
|
|
3997
3757
|
selectedDate,
|
|
3998
3758
|
min,
|
|
@@ -4004,12 +3764,12 @@ class DateLookup extends PureComponent {
|
|
|
4004
3764
|
return null;
|
|
4005
3765
|
}
|
|
4006
3766
|
componentDidUpdate(previousProps) {
|
|
4007
|
-
if (
|
|
3767
|
+
if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {
|
|
4008
3768
|
this.focusOn('.active');
|
|
4009
3769
|
}
|
|
4010
|
-
|
|
3770
|
+
const mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);
|
|
4011
3771
|
this.setState({
|
|
4012
|
-
isMobile:
|
|
3772
|
+
isMobile: mediaQuery.matches
|
|
4013
3773
|
});
|
|
4014
3774
|
}
|
|
4015
3775
|
componentWillUnmount() {
|
|
@@ -4022,7 +3782,7 @@ class DateLookup extends PureComponent {
|
|
|
4022
3782
|
} = this.props;
|
|
4023
3783
|
this.setState({
|
|
4024
3784
|
open: true,
|
|
4025
|
-
mode:
|
|
3785
|
+
mode: 'day'
|
|
4026
3786
|
});
|
|
4027
3787
|
if (onFocus) {
|
|
4028
3788
|
onFocus();
|
|
@@ -4111,17 +3871,19 @@ class DateLookup extends PureComponent {
|
|
|
4111
3871
|
}
|
|
4112
3872
|
let date;
|
|
4113
3873
|
if (selectedDate) {
|
|
4114
|
-
date = new Date(mode ===
|
|
3874
|
+
date = new Date(mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(), mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(), mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate());
|
|
4115
3875
|
} else {
|
|
4116
3876
|
date = getStartOfDay(new Date());
|
|
4117
3877
|
}
|
|
4118
|
-
|
|
4119
|
-
|
|
3878
|
+
if (date) {
|
|
3879
|
+
date = moveToWithinRange(date, min, max);
|
|
3880
|
+
}
|
|
3881
|
+
if (date?.getTime() !== selectedDate?.getTime()) {
|
|
4120
3882
|
this.props.onChange(date);
|
|
4121
3883
|
}
|
|
4122
3884
|
};
|
|
4123
3885
|
focusOn = (preferredElement, fallbackElement) => {
|
|
4124
|
-
const element = this.element.current
|
|
3886
|
+
const element = this.element.current?.querySelector(preferredElement);
|
|
4125
3887
|
if (element) {
|
|
4126
3888
|
element.focus();
|
|
4127
3889
|
} else if (fallbackElement) {
|
|
@@ -4135,9 +3897,9 @@ class DateLookup extends PureComponent {
|
|
|
4135
3897
|
this.focusOn('.active', '.today');
|
|
4136
3898
|
});
|
|
4137
3899
|
};
|
|
4138
|
-
switchToDays = () => this.switchMode(
|
|
4139
|
-
switchToMonths = () => this.switchMode(
|
|
4140
|
-
switchToYears = () => this.switchMode(
|
|
3900
|
+
switchToDays = () => this.switchMode('day');
|
|
3901
|
+
switchToMonths = () => this.switchMode('month');
|
|
3902
|
+
switchToYears = () => this.switchMode('year');
|
|
4141
3903
|
handleSelectedDateUpdate = selectedDate => {
|
|
4142
3904
|
this.setState({
|
|
4143
3905
|
selectedDate
|
|
@@ -4174,31 +3936,31 @@ class DateLookup extends PureComponent {
|
|
|
4174
3936
|
className: classNames({
|
|
4175
3937
|
'p-a-1': !isMobile
|
|
4176
3938
|
}),
|
|
4177
|
-
children: [mode ===
|
|
4178
|
-
selectedDate,
|
|
4179
|
-
min,
|
|
4180
|
-
max,
|
|
4181
|
-
viewMonth,
|
|
4182
|
-
viewYear,
|
|
4183
|
-
monthFormat,
|
|
3939
|
+
children: [mode === 'day' && /*#__PURE__*/jsx(DayCalendar$1, {
|
|
3940
|
+
selectedDate: selectedDate,
|
|
3941
|
+
min: min,
|
|
3942
|
+
max: max,
|
|
3943
|
+
viewMonth: viewMonth,
|
|
3944
|
+
viewYear: viewYear,
|
|
3945
|
+
monthFormat: monthFormat,
|
|
4184
3946
|
onSelect: this.handleSelectedDateUpdate,
|
|
4185
3947
|
onLabelClick: this.switchToYears,
|
|
4186
3948
|
onViewDateUpdate: this.handleViewDateUpdate
|
|
4187
|
-
}), mode ===
|
|
4188
|
-
selectedDate,
|
|
4189
|
-
min,
|
|
4190
|
-
max,
|
|
4191
|
-
viewYear,
|
|
4192
|
-
placeholder,
|
|
3949
|
+
}), mode === 'month' && /*#__PURE__*/jsx(MonthCalendar$1, {
|
|
3950
|
+
selectedDate: selectedDate,
|
|
3951
|
+
min: min,
|
|
3952
|
+
max: max,
|
|
3953
|
+
viewYear: viewYear,
|
|
3954
|
+
placeholder: placeholder,
|
|
4193
3955
|
onSelect: this.switchToDays,
|
|
4194
3956
|
onLabelClick: this.switchToYears,
|
|
4195
3957
|
onViewDateUpdate: this.handleViewDateUpdate
|
|
4196
|
-
}), mode ===
|
|
4197
|
-
selectedDate,
|
|
4198
|
-
min,
|
|
4199
|
-
max,
|
|
4200
|
-
viewYear,
|
|
4201
|
-
placeholder,
|
|
3958
|
+
}), mode === 'year' && /*#__PURE__*/jsx(YearCalendar$1, {
|
|
3959
|
+
selectedDate: selectedDate,
|
|
3960
|
+
min: min,
|
|
3961
|
+
max: max,
|
|
3962
|
+
viewYear: viewYear,
|
|
3963
|
+
placeholder: placeholder,
|
|
4202
3964
|
onSelect: this.switchToMonths,
|
|
4203
3965
|
onViewDateUpdate: this.handleViewDateUpdate
|
|
4204
3966
|
})]
|
|
@@ -4224,21 +3986,20 @@ class DateLookup extends PureComponent {
|
|
|
4224
3986
|
value
|
|
4225
3987
|
} = this.props;
|
|
4226
3988
|
return /*#__PURE__*/jsxs("div", {
|
|
4227
|
-
// eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
4228
3989
|
ref: this.element,
|
|
4229
3990
|
id: this.props.id,
|
|
4230
3991
|
"aria-labelledby": ariaLabelledBy,
|
|
4231
3992
|
className: "input-group",
|
|
4232
3993
|
onKeyDown: this.handleKeyDown,
|
|
4233
|
-
children: [/*#__PURE__*/jsx(DateTrigger
|
|
4234
|
-
selectedDate,
|
|
4235
|
-
size,
|
|
4236
|
-
placeholder,
|
|
4237
|
-
label,
|
|
4238
|
-
monthFormat,
|
|
4239
|
-
disabled,
|
|
3994
|
+
children: [/*#__PURE__*/jsx(DateTrigger, {
|
|
3995
|
+
selectedDate: selectedDate,
|
|
3996
|
+
size: size,
|
|
3997
|
+
placeholder: placeholder,
|
|
3998
|
+
label: label,
|
|
3999
|
+
monthFormat: monthFormat,
|
|
4000
|
+
disabled: disabled || false,
|
|
4240
4001
|
onClick: this.open,
|
|
4241
|
-
onClear: !disabled && clearable && value ? this.handleClear :
|
|
4002
|
+
onClear: !disabled && clearable && value ? this.handleClear : undefined
|
|
4242
4003
|
}), /*#__PURE__*/jsx(ResponsivePanel$1, {
|
|
4243
4004
|
anchorRef: this.element,
|
|
4244
4005
|
open: open,
|
|
@@ -4250,36 +4011,6 @@ class DateLookup extends PureComponent {
|
|
|
4250
4011
|
});
|
|
4251
4012
|
}
|
|
4252
4013
|
}
|
|
4253
|
-
DateLookup.propTypes = {
|
|
4254
|
-
id: PropTypes.string,
|
|
4255
|
-
value: PropTypes.instanceOf(Date),
|
|
4256
|
-
min: PropTypes.instanceOf(Date),
|
|
4257
|
-
max: PropTypes.instanceOf(Date),
|
|
4258
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
4259
|
-
placeholder: PropTypes.string,
|
|
4260
|
-
label: PropTypes.string,
|
|
4261
|
-
'aria-labelledby': PropTypes.string,
|
|
4262
|
-
monthFormat: PropTypes.oneOf(['long', 'short']),
|
|
4263
|
-
disabled: PropTypes.bool,
|
|
4264
|
-
onChange: PropTypes.func.isRequired,
|
|
4265
|
-
onFocus: PropTypes.func,
|
|
4266
|
-
onBlur: PropTypes.func,
|
|
4267
|
-
clearable: PropTypes.bool
|
|
4268
|
-
};
|
|
4269
|
-
DateLookup.defaultProps = {
|
|
4270
|
-
value: null,
|
|
4271
|
-
min: null,
|
|
4272
|
-
max: null,
|
|
4273
|
-
size: Size.MEDIUM,
|
|
4274
|
-
placeholder: '',
|
|
4275
|
-
label: '',
|
|
4276
|
-
monthFormat: MonthFormat.LONG,
|
|
4277
|
-
disabled: false,
|
|
4278
|
-
onFocus: null,
|
|
4279
|
-
onBlur: null,
|
|
4280
|
-
clearable: false
|
|
4281
|
-
};
|
|
4282
|
-
var DateLookup$1 = DateLookup;
|
|
4283
4014
|
|
|
4284
4015
|
const NavigationOption = /*#__PURE__*/forwardRef(({
|
|
4285
4016
|
as: component = 'button',
|
|
@@ -5866,7 +5597,7 @@ function Popover$1({
|
|
|
5866
5597
|
const resolvedPlacement = resolvePlacement(preferredPlacement);
|
|
5867
5598
|
useEffect(() => {
|
|
5868
5599
|
if (resolvedPlacement !== preferredPlacement) {
|
|
5869
|
-
logActionRequired
|
|
5600
|
+
logActionRequired(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5870
5601
|
}
|
|
5871
5602
|
}, [preferredPlacement, resolvedPlacement]);
|
|
5872
5603
|
const anchorReference = useRef(null);
|
|
@@ -5971,49 +5702,22 @@ const Info = ({
|
|
|
5971
5702
|
});
|
|
5972
5703
|
};
|
|
5973
5704
|
|
|
5974
|
-
|
|
5975
|
-
[Sentiment.ERROR]: 'danger',
|
|
5976
|
-
[Sentiment.NEGATIVE]: 'danger'
|
|
5977
|
-
};
|
|
5978
|
-
const InlineAlert = ({
|
|
5705
|
+
function InlineAlert({
|
|
5979
5706
|
id,
|
|
5980
|
-
type =
|
|
5707
|
+
type = 'neutral',
|
|
5981
5708
|
className,
|
|
5982
5709
|
children
|
|
5983
|
-
})
|
|
5984
|
-
const
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
role: "alert",
|
|
5991
|
-
id: id,
|
|
5992
|
-
className: classNames('alert alert-detach', typeClass, className),
|
|
5993
|
-
children: [(type === 'error' || type === 'negative') && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
5994
|
-
children: children
|
|
5995
|
-
})]
|
|
5996
|
-
});
|
|
5997
|
-
}
|
|
5998
|
-
const getAlertContents = ({
|
|
5999
|
-
children,
|
|
6000
|
-
className
|
|
6001
|
-
}) => {
|
|
6002
|
-
return /*#__PURE__*/jsx("div", {
|
|
6003
|
-
role: "alert",
|
|
6004
|
-
id: id,
|
|
6005
|
-
className: classNames('alert alert-detach p-x-2 p-y-1', typeClass, className),
|
|
5710
|
+
}) {
|
|
5711
|
+
const danger = type === 'negative' || type === 'error';
|
|
5712
|
+
return /*#__PURE__*/jsxs("div", {
|
|
5713
|
+
role: "alert",
|
|
5714
|
+
id: id,
|
|
5715
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5716
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
6006
5717
|
children: children
|
|
6007
|
-
})
|
|
6008
|
-
};
|
|
6009
|
-
const AlertWithArrow = withArrow(getAlertContents, ArrowPosition.TOP_LEFT);
|
|
6010
|
-
return /*#__PURE__*/jsx(AlertWithArrow, {
|
|
6011
|
-
id,
|
|
6012
|
-
type,
|
|
6013
|
-
className,
|
|
6014
|
-
children
|
|
5718
|
+
})]
|
|
6015
5719
|
});
|
|
6016
|
-
}
|
|
5720
|
+
}
|
|
6017
5721
|
|
|
6018
5722
|
/*
|
|
6019
5723
|
* Inspired by:
|
|
@@ -6112,9 +5816,9 @@ function InputAddon({
|
|
|
6112
5816
|
const ref = useRef(null);
|
|
6113
5817
|
useResizeObserver(ref, entry => {
|
|
6114
5818
|
// TODO: Remove fallback once most browsers support `borderBoxSize`
|
|
6115
|
-
|
|
6116
|
-
if (
|
|
6117
|
-
setInputPadding(
|
|
5819
|
+
const inlineSize = entry.borderBoxSize?.[0]?.inlineSize;
|
|
5820
|
+
if (inlineSize != null) {
|
|
5821
|
+
setInputPadding(inlineSize);
|
|
6118
5822
|
} else {
|
|
6119
5823
|
const targetStyle = getComputedStyle(entry.target);
|
|
6120
5824
|
setInputPadding(entry.contentRect.width + Number.parseFloat(targetStyle.paddingInlineStart) + Number.parseFloat(targetStyle.paddingInlineEnd));
|
|
@@ -6261,65 +5965,61 @@ function BottomSheet({
|
|
|
6261
5965
|
theme: "personal",
|
|
6262
5966
|
screenMode: theme === 'personal' ? screenMode : 'light',
|
|
6263
5967
|
isNotRootProvider: true,
|
|
6264
|
-
children: /*#__PURE__*/
|
|
5968
|
+
children: /*#__PURE__*/jsxs(Transition, {
|
|
6265
5969
|
show: open,
|
|
6266
5970
|
className: "np-bottom-sheet-v2-container",
|
|
6267
5971
|
beforeEnter: () => {
|
|
6268
5972
|
setFloatingKey(prev => prev + 1);
|
|
6269
5973
|
},
|
|
6270
5974
|
afterLeave: onCloseEnd,
|
|
6271
|
-
children: /*#__PURE__*/
|
|
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
|
-
className: "np-bottom-sheet-v2-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
}),
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
}) : null, /*#__PURE__*/jsx("div", {
|
|
6314
|
-
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6315
|
-
children: children
|
|
6316
|
-
})]
|
|
5975
|
+
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
5976
|
+
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
5977
|
+
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
5978
|
+
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
5979
|
+
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
5980
|
+
children: /*#__PURE__*/jsx("div", {
|
|
5981
|
+
className: "np-bottom-sheet-v2-backdrop"
|
|
5982
|
+
})
|
|
5983
|
+
}), /*#__PURE__*/jsx("div", {
|
|
5984
|
+
className: "np-bottom-sheet-v2",
|
|
5985
|
+
children: /*#__PURE__*/jsx(Transition.Child, {
|
|
5986
|
+
className: "np-bottom-sheet-v2-content",
|
|
5987
|
+
enter: "np-bottom-sheet-v2-content--enter",
|
|
5988
|
+
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
5989
|
+
leave: "np-bottom-sheet-v2-content--leave",
|
|
5990
|
+
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
5991
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
5992
|
+
context: context,
|
|
5993
|
+
initialFocus: initialFocusRef,
|
|
5994
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5995
|
+
// Force inner state invalidation on open
|
|
5996
|
+
ref: refs.setFloating,
|
|
5997
|
+
className: "np-bottom-sheet-v2-content-inner-container",
|
|
5998
|
+
...getFloatingProps(),
|
|
5999
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
6000
|
+
className: "np-bottom-sheet-v2-header",
|
|
6001
|
+
children: /*#__PURE__*/jsx(CloseButton, {
|
|
6002
|
+
size: Size.SMALL,
|
|
6003
|
+
onClick: () => {
|
|
6004
|
+
onClose?.();
|
|
6005
|
+
}
|
|
6006
|
+
})
|
|
6007
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
6008
|
+
className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6009
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6010
|
+
}),
|
|
6011
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6012
|
+
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6013
|
+
children: title
|
|
6014
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6015
|
+
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6016
|
+
children: children
|
|
6317
6017
|
})]
|
|
6318
|
-
}
|
|
6319
|
-
})
|
|
6018
|
+
})]
|
|
6019
|
+
}, floatingKey)
|
|
6320
6020
|
})
|
|
6321
|
-
})
|
|
6322
|
-
})
|
|
6021
|
+
})
|
|
6022
|
+
})]
|
|
6323
6023
|
})
|
|
6324
6024
|
})
|
|
6325
6025
|
})]
|
|
@@ -6417,36 +6117,32 @@ function Popover({
|
|
|
6417
6117
|
setFloatingKey(prev => prev + 1);
|
|
6418
6118
|
},
|
|
6419
6119
|
afterLeave: onCloseEnd,
|
|
6420
|
-
children: /*#__PURE__*/jsx(
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
})]
|
|
6447
|
-
})
|
|
6448
|
-
}, floatingKey)
|
|
6449
|
-
})
|
|
6120
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6121
|
+
context: context,
|
|
6122
|
+
children: /*#__PURE__*/jsx("div", {
|
|
6123
|
+
// Force inner state invalidation on open
|
|
6124
|
+
ref: refs.setFloating,
|
|
6125
|
+
className: classNames('np-popover-v2-container', {
|
|
6126
|
+
'np-popover-v2-container--size-md': size$1 === 'md',
|
|
6127
|
+
'np-popover-v2-container--size-lg': size$1 === 'lg'
|
|
6128
|
+
})
|
|
6129
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
6130
|
+
,
|
|
6131
|
+
style: floatingStyles,
|
|
6132
|
+
...getFloatingProps(),
|
|
6133
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
6134
|
+
className: classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
6135
|
+
'np-popover-v2--padding-md': padding === 'md'
|
|
6136
|
+
}),
|
|
6137
|
+
children: [title ? /*#__PURE__*/jsx("h2", {
|
|
6138
|
+
className: "np-popover-v2-title np-text-title-body",
|
|
6139
|
+
children: title
|
|
6140
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
6141
|
+
className: "np-popover-v2-content np-text-body-default",
|
|
6142
|
+
children: children
|
|
6143
|
+
})]
|
|
6144
|
+
})
|
|
6145
|
+
}, floatingKey)
|
|
6450
6146
|
})
|
|
6451
6147
|
})
|
|
6452
6148
|
})
|
|
@@ -6825,6 +6521,7 @@ function SelectInputOptions({
|
|
|
6825
6521
|
})
|
|
6826
6522
|
}) : null, /*#__PURE__*/jsxs("section", {
|
|
6827
6523
|
ref: listboxContainerRef,
|
|
6524
|
+
tabIndex: -1,
|
|
6828
6525
|
className: classNames('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
|
|
6829
6526
|
children: [resultsEmpty ? /*#__PURE__*/jsxs("div", {
|
|
6830
6527
|
id: statusId,
|
|
@@ -14050,7 +13747,7 @@ function CriticalCommsBanner({
|
|
|
14050
13747
|
type: AvatarType.ICON,
|
|
14051
13748
|
className: classNames(isModern ? 'm-r-2' : 'm-r-1'),
|
|
14052
13749
|
backgroundColor: isModern ? 'var(--color-sentiment-negative)' : 'var(--color-background-negative)',
|
|
14053
|
-
children: isModern ? /*#__PURE__*/jsx(AlertCircleFill, {}) : /*#__PURE__*/jsx(Alert$
|
|
13750
|
+
children: isModern ? /*#__PURE__*/jsx(AlertCircleFill, {}) : /*#__PURE__*/jsx(Alert$1, {
|
|
14054
13751
|
size: 24
|
|
14055
13752
|
})
|
|
14056
13753
|
}), /*#__PURE__*/jsxs("div", {
|
|
@@ -14834,10 +14531,10 @@ var th = {
|
|
|
14834
14531
|
"neptune.ClearButton.ariaLabel": "ล้าง",
|
|
14835
14532
|
"neptune.CloseButton.ariaLabel": "ปิด",
|
|
14836
14533
|
"neptune.DateInput.day.label": "วัน",
|
|
14837
|
-
"neptune.DateInput.day.placeholder": "
|
|
14534
|
+
"neptune.DateInput.day.placeholder": "วัน",
|
|
14838
14535
|
"neptune.DateInput.month.label": "เดือน",
|
|
14839
14536
|
"neptune.DateInput.year.label": "ปี",
|
|
14840
|
-
"neptune.DateInput.year.placeholder": "
|
|
14537
|
+
"neptune.DateInput.year.placeholder": "ปี",
|
|
14841
14538
|
"neptune.DateLookup.day": "วัน",
|
|
14842
14539
|
"neptune.DateLookup.goTo20YearView": "ไปที่มุมมอง 20 ปี",
|
|
14843
14540
|
"neptune.DateLookup.month": "เดือน",
|
|
@@ -15139,5 +14836,5 @@ const translations = {
|
|
|
15139
14836
|
'zh-HK': zhHK
|
|
15140
14837
|
};
|
|
15141
14838
|
|
|
15142
|
-
export { Accordion, ActionButton, ActionOption, Alert
|
|
14839
|
+
export { Accordion, ActionButton, ActionOption, Alert, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15143
14840
|
//# sourceMappingURL=index.mjs.map
|