@transferwise/components 0.0.0-experimental-ff4fa52 → 0.0.0-experimental-1413ac0
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/README.md +14 -1
- package/build/i18n/zh-HK.json +2 -2
- package/build/index.esm.js +182 -273
- package/build/index.esm.js.map +1 -1
- package/build/index.js +155 -246
- package/build/index.js.map +1 -1
- package/build/mocks.esm.js +40 -0
- package/build/mocks.esm.js.map +1 -0
- package/build/mocks.js +43 -0
- package/build/mocks.js.map +1 -0
- package/build/types/body/Body.d.ts +1 -1
- package/build/types/common/commonProps.d.ts +1 -1
- package/build/types/common/commonProps.d.ts.map +1 -1
- package/build/types/common/dateUtils/getDayNames/getDayNames.d.ts +1 -1
- package/build/types/common/dateUtils/getDayNames/getDayNames.d.ts.map +1 -1
- package/build/types/common/dateUtils/getDayNames/index.d.ts +2 -0
- package/build/types/common/dateUtils/getDayNames/index.d.ts.map +1 -0
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
- package/build/types/common/dateUtils/getMonthNames/index.d.ts +2 -0
- package/build/types/common/dateUtils/getMonthNames/index.d.ts.map +1 -0
- package/build/types/common/dateUtils/index.d.ts +6 -6
- package/build/types/common/dateUtils/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/isDateValid/index.d.ts +2 -0
- package/build/types/common/dateUtils/isDateValid/index.d.ts.map +1 -0
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts +2 -2
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts +2 -0
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts.map +1 -0
- package/build/types/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.d.ts +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.d.ts.map +1 -1
- package/build/types/common/dateUtils/isWithinRange/index.d.ts +2 -0
- package/build/types/common/dateUtils/isWithinRange/index.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/build/types/common/dateUtils/moveToWithinRange/index.d.ts.map +1 -0
- 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/panel/Panel.d.ts +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
- package/build/types/dateInput/DateInput.d.ts +41 -35
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.messages.d.ts +33 -24
- package/build/types/dateInput/DateInput.messages.d.ts.map +1 -1
- package/build/types/dateInput/index.d.ts +1 -1
- package/build/types/dateInput/index.d.ts.map +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.d.ts +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.d.ts.map +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/index.d.ts +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/index.d.ts.map +1 -1
- package/build/types/dateInput/utils/explodeDate/explodeDate.d.ts +5 -2
- package/build/types/dateInput/utils/explodeDate/explodeDate.d.ts.map +1 -1
- package/build/types/dateInput/utils/explodeDate/index.d.ts +1 -1
- package/build/types/dateInput/utils/explodeDate/index.d.ts.map +1 -1
- package/build/types/dateInput/utils/index.d.ts +2 -2
- package/build/types/dateInput/utils/index.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts +39 -52
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/decision/index.d.ts +1 -2
- package/build/types/decision/index.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/mocks.d.ts +9 -0
- package/build/types/mocks.d.ts.map +1 -0
- package/build/types/promoCard/PromoCard.d.ts +1 -2
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +1 -1
- package/build/types/test-utils/window-mock.d.ts.map +1 -1
- package/package.json +17 -1
- package/src/common/commonProps.ts +1 -1
- package/src/common/dateUtils/getDayNames/{getDayNames.ts → getDayNames.js} +2 -5
- package/src/common/dateUtils/getDayNames/getDayNames.spec.js +1 -1
- package/src/common/dateUtils/getDayNames/index.js +1 -0
- package/src/common/dateUtils/getMonthNames/{getMonthNames.ts → getMonthNames.js} +3 -5
- package/src/common/dateUtils/getMonthNames/getMonthNames.spec.js +8 -9
- package/src/common/dateUtils/getMonthNames/index.js +1 -0
- package/src/common/dateUtils/index.js +6 -0
- package/src/common/dateUtils/isDateValid/index.js +1 -0
- package/src/common/dateUtils/isDateValid/isDateValid.js +6 -0
- package/src/common/dateUtils/isDateValid/{isDateValid.spec.ts → isDateValid.spec.js} +1 -1
- package/src/common/dateUtils/isMonthAndYearFormat/index.js +1 -0
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.js +4 -0
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.spec.js +7 -3
- package/src/common/dateUtils/isWithinRange/index.js +1 -0
- package/src/common/dateUtils/isWithinRange/{isWithinRange.ts → isWithinRange.js} +1 -1
- package/src/common/dateUtils/isWithinRange/{isWithinRange.spec.ts → isWithinRange.spec.js} +1 -1
- package/src/common/dateUtils/moveToWithinRange/index.js +1 -0
- package/src/common/dateUtils/moveToWithinRange/{moveToWithinRange.ts → moveToWithinRange.js} +2 -2
- package/src/dateInput/{DateInput.tsx → DateInput.js} +97 -120
- package/src/dateInput/DateInput.spec.js +55 -6
- package/src/dateInput/DateInput.story.tsx +7 -9
- package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.ts → convertToLocalMidnight.js} +1 -1
- package/src/dateInput/utils/explodeDate/{explodeDate.ts → explodeDate.js} +1 -3
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +0 -1
- package/src/decision/Decision.spec.js +53 -59
- package/src/decision/{Decision.story.js → Decision.story.tsx} +5 -5
- package/src/decision/Decision.tsx +136 -0
- package/src/decision/index.ts +1 -0
- package/src/i18n/zh-HK.json +2 -2
- package/src/index.ts +1 -0
- package/src/mocks.ts +48 -0
- package/src/promoCard/PromoCard.tsx +1 -2
- package/src/test-utils/window-mock.ts +7 -23
- package/src/tile/Tile.js +1 -1
- package/build/types/decision/decisionEnums.d.ts +0 -9
- package/build/types/decision/decisionEnums.d.ts.map +0 -1
- package/build/types/sizeSwapper/SizeSwapper.d.ts +0 -3
- package/build/types/sizeSwapper/SizeSwapper.d.ts.map +0 -1
- package/build/types/sizeSwapper/index.d.ts +0 -2
- package/build/types/sizeSwapper/index.d.ts.map +0 -1
- package/src/common/dateUtils/index.ts +0 -6
- package/src/common/dateUtils/isDateValid/isDateValid.ts +0 -13
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.ts +0 -4
- package/src/decision/Decision.js +0 -148
- package/src/decision/decisionEnums.ts +0 -11
- package/src/decision/index.js +0 -2
- package/src/sizeSwapper/SizeSwapper.js +0 -69
- package/src/sizeSwapper/SizeSwapper.spec.js +0 -100
- package/src/sizeSwapper/SizeSwapper.story.js +0 -34
- package/src/sizeSwapper/index.js +0 -1
- /package/src/dateInput/{DateInput.messages.ts → DateInput.messages.js} +0 -0
- /package/src/dateInput/{index.ts → index.js} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.spec.ts → convertToLocalMidnight.spec.js} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{index.ts → index.js} +0 -0
- /package/src/dateInput/utils/explodeDate/{explodeDate.spec.ts → explodeDate.spec.js} +0 -0
- /package/src/dateInput/utils/explodeDate/{index.ts → index.js} +0 -0
- /package/src/dateInput/utils/{index.ts → index.js} +0 -0
package/build/index.esm.js
CHANGED
|
@@ -7,7 +7,6 @@ import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1,
|
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
10
|
-
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
11
10
|
import { Transition, Listbox } from '@headlessui/react';
|
|
12
11
|
import mergeProps from 'merge-props';
|
|
13
12
|
import mergeRefs from 'react-merge-refs';
|
|
@@ -15,6 +14,7 @@ import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
|
15
14
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
16
15
|
import { FocusScope } from '@react-aria/focus';
|
|
17
16
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
17
|
+
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
18
18
|
import { CSSTransition } from 'react-transition-group';
|
|
19
19
|
import { usePopper } from 'react-popper';
|
|
20
20
|
import throttle from 'lodash.throttle';
|
|
@@ -207,7 +207,7 @@ var Width;
|
|
|
207
207
|
/**
|
|
208
208
|
* @deprecated use `ControlType` and `Priority` enums instead
|
|
209
209
|
*/
|
|
210
|
-
var Type
|
|
210
|
+
var Type;
|
|
211
211
|
(function (Type) {
|
|
212
212
|
Type["PRIMARY"] = "primary";
|
|
213
213
|
/**
|
|
@@ -217,7 +217,7 @@ var Type$1;
|
|
|
217
217
|
Type["SECONDARY"] = "secondary";
|
|
218
218
|
Type["DANGER"] = "danger";
|
|
219
219
|
Type["LINK"] = "link";
|
|
220
|
-
})(Type
|
|
220
|
+
})(Type || (Type = {}));
|
|
221
221
|
|
|
222
222
|
var DateMode;
|
|
223
223
|
(function (DateMode) {
|
|
@@ -244,7 +244,7 @@ var Position;
|
|
|
244
244
|
Position["TOP"] = "top";
|
|
245
245
|
})(Position || (Position = {}));
|
|
246
246
|
|
|
247
|
-
var Layout
|
|
247
|
+
var Layout;
|
|
248
248
|
(function (Layout) {
|
|
249
249
|
Layout["VERTICAL"] = "VERTICAL";
|
|
250
250
|
Layout["VERTICAL_TWO_COLUMN"] = "VERTICAL_TWO_COLUMN";
|
|
@@ -253,7 +253,7 @@ var Layout$1;
|
|
|
253
253
|
Layout["HORIZONTAL_JUSTIFIED"] = "HORIZONTAL_JUSTIFIED";
|
|
254
254
|
Layout["HORIZONTAL_LEFT_ALIGNED"] = "HORIZONTAL_LEFT_ALIGNED";
|
|
255
255
|
Layout["HORIZONTAL_RIGHT_ALIGNED"] = "HORIZONTAL_RIGHT_ALIGNED";
|
|
256
|
-
})(Layout
|
|
256
|
+
})(Layout || (Layout = {}));
|
|
257
257
|
|
|
258
258
|
var Status;
|
|
259
259
|
(function (Status) {
|
|
@@ -2235,23 +2235,23 @@ const priorityClassMap = {
|
|
|
2235
2235
|
};
|
|
2236
2236
|
|
|
2237
2237
|
const deprecatedTypeMap = {
|
|
2238
|
-
[Type
|
|
2239
|
-
[Type
|
|
2240
|
-
[Type
|
|
2241
|
-
[Type
|
|
2242
|
-
[Type
|
|
2238
|
+
[Type.PRIMARY]: ControlType.ACCENT,
|
|
2239
|
+
[Type.SECONDARY]: ControlType.ACCENT,
|
|
2240
|
+
[Type.LINK]: ControlType.ACCENT,
|
|
2241
|
+
[Type.PAY]: ControlType.POSITIVE,
|
|
2242
|
+
[Type.DANGER]: ControlType.NEGATIVE
|
|
2243
2243
|
};
|
|
2244
2244
|
const oldTypePriorityMap = {
|
|
2245
|
-
[Type
|
|
2246
|
-
[Type
|
|
2247
|
-
[Type
|
|
2245
|
+
[Type.DANGER]: Priority.SECONDARY,
|
|
2246
|
+
[Type.LINK]: Priority.TERTIARY,
|
|
2247
|
+
[Type.SECONDARY]: Priority.SECONDARY
|
|
2248
2248
|
};
|
|
2249
2249
|
const deprecatedTypeMapMessage = {
|
|
2250
|
-
[Type
|
|
2251
|
-
[Type
|
|
2252
|
-
[Type
|
|
2253
|
-
[Type
|
|
2254
|
-
[Type
|
|
2250
|
+
[Type.DANGER]: 'Type.NEGATIVE',
|
|
2251
|
+
[Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',
|
|
2252
|
+
[Type.PAY]: 'ControlType.POSITIVE',
|
|
2253
|
+
[Type.PRIMARY]: 'ControlType.ACCENT',
|
|
2254
|
+
[Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY'
|
|
2255
2255
|
};
|
|
2256
2256
|
const deprecatedTypes = Object.keys(deprecatedTypeMap);
|
|
2257
2257
|
const establishNewType = originalType => deprecatedTypeMap[originalType] || originalType;
|
|
@@ -2763,17 +2763,9 @@ const getMonthNames = (locale, format = 'long') => {
|
|
|
2763
2763
|
return months;
|
|
2764
2764
|
};
|
|
2765
2765
|
|
|
2766
|
-
const isDateValid = date =>
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
} else if (date instanceof Date) {
|
|
2770
|
-
return validDateObject(date);
|
|
2771
|
-
} else {
|
|
2772
|
-
return validDateString(date);
|
|
2773
|
-
}
|
|
2774
|
-
};
|
|
2775
|
-
const validDateString = dateString => validDateObject(new Date(dateString));
|
|
2776
|
-
const validDateObject = dateObject => !isNaN(dateObject.getTime());
|
|
2766
|
+
const isDateValid = date => validDateObject(date) || validDateString(date);
|
|
2767
|
+
const validDateString = dateString => typeof dateString === 'string' && validDateObject(new Date(dateString));
|
|
2768
|
+
const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateObject); // eslint-disable-line no-restricted-globals
|
|
2777
2769
|
|
|
2778
2770
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2779
2771
|
|
|
@@ -2808,6 +2800,7 @@ const explodeDate = date => {
|
|
|
2808
2800
|
|
|
2809
2801
|
const convertToLocalMidnight = date => {
|
|
2810
2802
|
const utcDate = new Date(date.split('T')[0]); // using YYYY-MM-DD creates UTC date
|
|
2803
|
+
|
|
2811
2804
|
return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate());
|
|
2812
2805
|
};
|
|
2813
2806
|
|
|
@@ -2820,21 +2813,21 @@ const INITIAL_DEFAULT_STATE = {
|
|
|
2820
2813
|
const DateInput = ({
|
|
2821
2814
|
'aria-labelledby': ariaLabelledBy,
|
|
2822
2815
|
'aria-label': ariaLabel,
|
|
2823
|
-
disabled
|
|
2824
|
-
size
|
|
2825
|
-
value
|
|
2816
|
+
disabled,
|
|
2817
|
+
size,
|
|
2818
|
+
value,
|
|
2826
2819
|
dayLabel,
|
|
2827
2820
|
dayAutoComplete,
|
|
2828
2821
|
monthLabel,
|
|
2829
2822
|
yearLabel,
|
|
2830
2823
|
yearAutoComplete,
|
|
2831
|
-
monthFormat
|
|
2832
|
-
mode
|
|
2824
|
+
monthFormat,
|
|
2825
|
+
mode,
|
|
2833
2826
|
onChange,
|
|
2834
2827
|
onFocus,
|
|
2835
|
-
onBlur
|
|
2828
|
+
onBlur,
|
|
2836
2829
|
placeholders,
|
|
2837
|
-
id
|
|
2830
|
+
id,
|
|
2838
2831
|
selectProps
|
|
2839
2832
|
}) => {
|
|
2840
2833
|
const {
|
|
@@ -2851,10 +2844,8 @@ const DateInput = ({
|
|
|
2851
2844
|
let explodedDate = INITIAL_DEFAULT_STATE;
|
|
2852
2845
|
if (value && isDateValid(value)) {
|
|
2853
2846
|
const dateObject = getDateObject();
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
}
|
|
2857
|
-
if (typeof value === 'string' && isMonthAndYearFormat(value)) {
|
|
2847
|
+
explodedDate = explodeDate(dateObject);
|
|
2848
|
+
if (isMonthAndYearFormat(value)) {
|
|
2858
2849
|
explodedDate.day = null;
|
|
2859
2850
|
}
|
|
2860
2851
|
}
|
|
@@ -2873,7 +2864,7 @@ const DateInput = ({
|
|
|
2873
2864
|
year: placeholders?.year || formatMessage(messages$9.yearPlaceholder)
|
|
2874
2865
|
};
|
|
2875
2866
|
const getDateAsString = date => {
|
|
2876
|
-
if (
|
|
2867
|
+
if (!isDateValid(date)) {
|
|
2877
2868
|
return '';
|
|
2878
2869
|
}
|
|
2879
2870
|
switch (mode) {
|
|
@@ -2894,12 +2885,14 @@ const DateInput = ({
|
|
|
2894
2885
|
}), /*#__PURE__*/jsx(SelectInput, {
|
|
2895
2886
|
name: "month",
|
|
2896
2887
|
disabled: disabled,
|
|
2897
|
-
placeholder: placeholders
|
|
2888
|
+
placeholder: placeholders.month,
|
|
2898
2889
|
items: monthOptions,
|
|
2899
2890
|
size: size,
|
|
2900
|
-
value: monthOptions.find(item => item.value === month)?.value,
|
|
2901
|
-
renderValue:
|
|
2902
|
-
|
|
2891
|
+
value: monthOptions.find(item => item.value.value === month)?.value,
|
|
2892
|
+
renderValue: ({
|
|
2893
|
+
label
|
|
2894
|
+
}) => /*#__PURE__*/jsx(SelectInputOptionContent, {
|
|
2895
|
+
title: label
|
|
2903
2896
|
}),
|
|
2904
2897
|
onChange: selectedValue => handleMonthChange(selectedValue),
|
|
2905
2898
|
...selectProps
|
|
@@ -2908,10 +2901,14 @@ const DateInput = ({
|
|
|
2908
2901
|
};
|
|
2909
2902
|
const getMonthsOptions = () => {
|
|
2910
2903
|
const options = [];
|
|
2911
|
-
|
|
2904
|
+
const months = getMonthNames(locale, monthFormat);
|
|
2905
|
+
months.forEach((label, index) => {
|
|
2912
2906
|
options.push({
|
|
2913
2907
|
type: 'option',
|
|
2914
|
-
value:
|
|
2908
|
+
value: {
|
|
2909
|
+
label,
|
|
2910
|
+
value: index
|
|
2911
|
+
}
|
|
2915
2912
|
});
|
|
2916
2913
|
});
|
|
2917
2914
|
return options;
|
|
@@ -2923,33 +2920,35 @@ const DateInput = ({
|
|
|
2923
2920
|
broadcastNewValue(INITIAL_DEFAULT_STATE);
|
|
2924
2921
|
}
|
|
2925
2922
|
if (mode === DateMode.MONTH_YEAR) {
|
|
2926
|
-
if (newMonth
|
|
2923
|
+
if (newMonth >= 0 && newYear && (newMonth !== month || newYear !== year)) {
|
|
2927
2924
|
broadcastNewValue(newValue);
|
|
2928
2925
|
}
|
|
2929
|
-
} else if (newDay && newMonth
|
|
2926
|
+
} else if (newDay && newMonth >= 0 && newYear && (newDay !== day || newMonth !== month || newYear !== year)) {
|
|
2930
2927
|
broadcastNewValue(newValue);
|
|
2931
2928
|
}
|
|
2932
2929
|
};
|
|
2933
2930
|
const handleDayChange = event => {
|
|
2934
2931
|
const {
|
|
2935
2932
|
checkedDay
|
|
2936
|
-
} = checkDate(
|
|
2933
|
+
} = checkDate(event.target.value, month, year);
|
|
2937
2934
|
setDay(checkedDay);
|
|
2938
2935
|
handleInternalValue(checkedDay, month, year);
|
|
2939
2936
|
};
|
|
2940
2937
|
const handleMonthChange = selectedValue => {
|
|
2941
|
-
if (selectedValue
|
|
2938
|
+
if (!selectedValue) {
|
|
2942
2939
|
setMonth(null);
|
|
2943
2940
|
handleInternalValue(day, null, year);
|
|
2944
2941
|
return;
|
|
2945
2942
|
}
|
|
2946
|
-
const selectedMonth = selectedValue ? selectedValue : 0;
|
|
2943
|
+
const selectedMonth = selectedValue ? selectedValue.value : 0;
|
|
2947
2944
|
const {
|
|
2948
2945
|
checkedDay
|
|
2949
2946
|
} = checkDate(day, selectedMonth, year);
|
|
2950
2947
|
setMonth(selectedMonth);
|
|
2951
|
-
if (day
|
|
2952
|
-
|
|
2948
|
+
if (day) {
|
|
2949
|
+
if (checkedDay !== day) {
|
|
2950
|
+
setDay(checkedDay);
|
|
2951
|
+
}
|
|
2953
2952
|
}
|
|
2954
2953
|
handleInternalValue(checkedDay, selectedMonth, year);
|
|
2955
2954
|
};
|
|
@@ -2960,37 +2959,35 @@ const DateInput = ({
|
|
|
2960
2959
|
// Correct day based on year and month.
|
|
2961
2960
|
const {
|
|
2962
2961
|
checkedDay
|
|
2963
|
-
} = checkDate(day, month,
|
|
2964
|
-
if (day
|
|
2965
|
-
|
|
2962
|
+
} = checkDate(day, month, newValue);
|
|
2963
|
+
if (day) {
|
|
2964
|
+
if (checkedDay !== day) {
|
|
2965
|
+
setDay(checkedDay);
|
|
2966
|
+
}
|
|
2966
2967
|
}
|
|
2967
|
-
setYear(
|
|
2968
|
-
handleInternalValue(checkedDay, month,
|
|
2968
|
+
setYear(slicedYear);
|
|
2969
|
+
handleInternalValue(checkedDay, month, slicedYear);
|
|
2969
2970
|
} else {
|
|
2970
|
-
setYear(
|
|
2971
|
+
setYear(slicedYear);
|
|
2971
2972
|
handleInternalValue(day, month, null);
|
|
2972
2973
|
}
|
|
2973
2974
|
};
|
|
2974
2975
|
const broadcastNewValue = newValue => {
|
|
2975
2976
|
if (newValue !== lastBroadcastedValue) {
|
|
2976
2977
|
setLastBroadcastedValue(newValue);
|
|
2977
|
-
|
|
2978
|
-
onChange(null);
|
|
2979
|
-
} else {
|
|
2980
|
-
onChange(getDateAsString(newValue) || null);
|
|
2981
|
-
}
|
|
2978
|
+
onChange(getDateAsString(newValue) || null);
|
|
2982
2979
|
}
|
|
2983
2980
|
};
|
|
2984
2981
|
const checkDate = (newDay = null, newMonth = 0, newYear = null) => {
|
|
2985
2982
|
let checkedDay = newDay;
|
|
2986
|
-
const maxDay = new Date(newYear || 2000, newMonth
|
|
2983
|
+
const maxDay = new Date(newYear || 2000, newMonth + 1, 0).getDate();
|
|
2987
2984
|
if (!newDay) {
|
|
2988
2985
|
checkedDay = null;
|
|
2989
2986
|
}
|
|
2990
|
-
if (newDay && newDay < 0) {
|
|
2987
|
+
if (newDay && newDay < 0 || newDay === '00') {
|
|
2991
2988
|
checkedDay = 1;
|
|
2992
2989
|
}
|
|
2993
|
-
if (newDay && newMonth || newDay
|
|
2990
|
+
if (newDay && newMonth || newDay > 31) {
|
|
2994
2991
|
checkedDay = newDay > maxDay ? maxDay : newDay;
|
|
2995
2992
|
}
|
|
2996
2993
|
return {
|
|
@@ -3010,10 +3007,8 @@ const DateInput = ({
|
|
|
3010
3007
|
id: id,
|
|
3011
3008
|
"aria-labelledby": ariaLabelledBy,
|
|
3012
3009
|
"aria-label": ariaLabel,
|
|
3013
|
-
|
|
3014
|
-
,
|
|
3015
|
-
onFocus: event => shouldPropagateOnFocus(event) ? onFocus && onFocus(event) : event.stopPropagation(),
|
|
3016
|
-
onBlur: event => shouldPropagateOnBlur(event) ? onBlur && onBlur(event) : event.stopPropagation(),
|
|
3010
|
+
onFocus: event => shouldPropagateOnFocus(event) ? onFocus && onFocus() : event.stopPropagation(),
|
|
3011
|
+
onBlur: event => shouldPropagateOnBlur(event) ? onBlur && onBlur() : event.stopPropagation(),
|
|
3017
3012
|
children: /*#__PURE__*/jsxs("div", {
|
|
3018
3013
|
className: "row",
|
|
3019
3014
|
children: [monthBeforeDay && /*#__PURE__*/jsx("div", {
|
|
@@ -3066,6 +3061,7 @@ const DateInput = ({
|
|
|
3066
3061
|
})
|
|
3067
3062
|
});
|
|
3068
3063
|
};
|
|
3064
|
+
|
|
3069
3065
|
// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
3070
3066
|
function shouldPropagateOnFocus({
|
|
3071
3067
|
target,
|
|
@@ -3075,6 +3071,7 @@ function shouldPropagateOnFocus({
|
|
|
3075
3071
|
const relatedParent = relatedTarget && relatedTarget.closest('.tw-date');
|
|
3076
3072
|
return targetParent !== relatedParent;
|
|
3077
3073
|
}
|
|
3074
|
+
|
|
3078
3075
|
// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
|
|
3079
3076
|
function shouldPropagateOnBlur({
|
|
3080
3077
|
target,
|
|
@@ -3091,6 +3088,42 @@ function shouldPropagateOnBlur({
|
|
|
3091
3088
|
const focusElementParent = focusElement && focusElement.closest('.tw-date');
|
|
3092
3089
|
return blurElementParent !== focusElementParent;
|
|
3093
3090
|
}
|
|
3091
|
+
DateInput.propTypes = {
|
|
3092
|
+
'aria-label': PropTypes.string,
|
|
3093
|
+
'aria-labelledby': PropTypes.string,
|
|
3094
|
+
disabled: PropTypes.bool,
|
|
3095
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
3096
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
|
|
3097
|
+
onChange: PropTypes.func.isRequired,
|
|
3098
|
+
onFocus: PropTypes.func,
|
|
3099
|
+
onBlur: PropTypes.func,
|
|
3100
|
+
dayLabel: PropTypes.string,
|
|
3101
|
+
dayAutoComplete: PropTypes.string,
|
|
3102
|
+
monthLabel: PropTypes.string,
|
|
3103
|
+
yearLabel: PropTypes.string,
|
|
3104
|
+
yearAutoComplete: PropTypes.string,
|
|
3105
|
+
monthFormat: PropTypes.oneOf(['long', 'short']),
|
|
3106
|
+
mode: PropTypes.oneOf(['day-month-year', 'month-year']),
|
|
3107
|
+
placeholders: PropTypes.shape({
|
|
3108
|
+
day: PropTypes.node,
|
|
3109
|
+
month: PropTypes.node,
|
|
3110
|
+
year: PropTypes.node
|
|
3111
|
+
}),
|
|
3112
|
+
id: PropTypes.string,
|
|
3113
|
+
selectProps: PropTypes.object
|
|
3114
|
+
};
|
|
3115
|
+
DateInput.defaultProps = {
|
|
3116
|
+
disabled: false,
|
|
3117
|
+
size: Size.MEDIUM,
|
|
3118
|
+
value: null,
|
|
3119
|
+
onFocus: null,
|
|
3120
|
+
onBlur: null,
|
|
3121
|
+
monthFormat: MonthFormat.LONG,
|
|
3122
|
+
mode: DateMode.DAY_MONTH_YEAR,
|
|
3123
|
+
id: '',
|
|
3124
|
+
selectProps: {}
|
|
3125
|
+
};
|
|
3126
|
+
var DateInput$1 = DateInput;
|
|
3094
3127
|
|
|
3095
3128
|
const POPOVER_OFFSET = [0, 16];
|
|
3096
3129
|
// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
|
|
@@ -4335,19 +4368,6 @@ DateLookup.defaultProps = {
|
|
|
4335
4368
|
};
|
|
4336
4369
|
var DateLookup$1 = DateLookup;
|
|
4337
4370
|
|
|
4338
|
-
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
4339
|
-
var Presentation;
|
|
4340
|
-
(function (Presentation) {
|
|
4341
|
-
Presentation["LIST"] = "LIST";
|
|
4342
|
-
Presentation["LIST_BLOCK"] = "LIST_BLOCK";
|
|
4343
|
-
Presentation["LIST_BLOCK_GRID"] = "LIST_BLOCK_GRID";
|
|
4344
|
-
})(Presentation || (Presentation = {}));
|
|
4345
|
-
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
4346
|
-
var Type;
|
|
4347
|
-
(function (Type) {
|
|
4348
|
-
Type["NAVIGATION"] = "NAVIGATION";
|
|
4349
|
-
})(Type || (Type = {}));
|
|
4350
|
-
|
|
4351
4371
|
const NavigationOption = /*#__PURE__*/forwardRef(({
|
|
4352
4372
|
as: component = 'button',
|
|
4353
4373
|
disabled = false,
|
|
@@ -4381,70 +4401,6 @@ const NavigationOption = /*#__PURE__*/forwardRef(({
|
|
|
4381
4401
|
});
|
|
4382
4402
|
});
|
|
4383
4403
|
|
|
4384
|
-
const Layout = {
|
|
4385
|
-
COLUMN: 'COLUMN'
|
|
4386
|
-
};
|
|
4387
|
-
const SizeSwapper = /*#__PURE__*/forwardRef(({
|
|
4388
|
-
items,
|
|
4389
|
-
inline
|
|
4390
|
-
}, reference) => {
|
|
4391
|
-
const parentReference = useRef(null);
|
|
4392
|
-
const [clientWidth] = useClientWidth({
|
|
4393
|
-
ref: reference || parentReference
|
|
4394
|
-
});
|
|
4395
|
-
if (!items || items.length === 0) {
|
|
4396
|
-
return null;
|
|
4397
|
-
}
|
|
4398
|
-
// If all breakpoints are specified and clientWidth never > breakpoint itemsToRender can be undefined.
|
|
4399
|
-
// Do not use deconstruct here to get items and layout.
|
|
4400
|
-
let itemsToRender = [];
|
|
4401
|
-
if (clientWidth) {
|
|
4402
|
-
itemsToRender = items.filter(({
|
|
4403
|
-
breakpoint = 0
|
|
4404
|
-
}) => clientWidth >= breakpoint).pop();
|
|
4405
|
-
} else {
|
|
4406
|
-
// On SSR environments useClientWidth returns null because ref is undefined so we render
|
|
4407
|
-
// all elements by default.
|
|
4408
|
-
// If there's no SSR and on first Hydration only the right elements are going to be rendered.
|
|
4409
|
-
// If clientWidth is null or zero all elements render like a responsive technique would do.
|
|
4410
|
-
itemsToRender.items = items.map(({
|
|
4411
|
-
items
|
|
4412
|
-
}) => Object.values(items));
|
|
4413
|
-
}
|
|
4414
|
-
|
|
4415
|
-
// Always return parent container even if there are no items to display to
|
|
4416
|
-
// keep the ref on DOM and let clientWidth be calculated properly.
|
|
4417
|
-
return /*#__PURE__*/jsx("div", {
|
|
4418
|
-
ref: parentReference,
|
|
4419
|
-
className: classNames('np-size-swapper', {
|
|
4420
|
-
'd-flex': !inline,
|
|
4421
|
-
'd-inline-flex': inline,
|
|
4422
|
-
'flex-column': itemsToRender && itemsToRender.layout === Layout.COLUMN,
|
|
4423
|
-
'flex-wrap': itemsToRender && itemsToRender.wrap
|
|
4424
|
-
}),
|
|
4425
|
-
style: {
|
|
4426
|
-
visibility: clientWidth ? 'visible' : 'hidden'
|
|
4427
|
-
},
|
|
4428
|
-
children: itemsToRender && itemsToRender.items
|
|
4429
|
-
});
|
|
4430
|
-
});
|
|
4431
|
-
SizeSwapper.Breakpoint = Breakpoint;
|
|
4432
|
-
SizeSwapper.Layout = Layout;
|
|
4433
|
-
SizeSwapper.propTypes = {
|
|
4434
|
-
inline: PropTypes.bool,
|
|
4435
|
-
/** List of items that will appear at the specified breakpoint and presented in row or columns depending on layout */
|
|
4436
|
-
items: PropTypes.arrayOf(PropTypes.shape({
|
|
4437
|
-
items: PropTypes.arrayOf(PropTypes.element),
|
|
4438
|
-
breakpoint: PropTypes.number,
|
|
4439
|
-
layout: PropTypes.oneOf([SizeSwapper.Layout.COLUMN]),
|
|
4440
|
-
wrap: PropTypes.bool
|
|
4441
|
-
})).isRequired
|
|
4442
|
-
};
|
|
4443
|
-
SizeSwapper.defaultProps = {
|
|
4444
|
-
inline: false
|
|
4445
|
-
};
|
|
4446
|
-
var SizeSwapper$1 = SizeSwapper;
|
|
4447
|
-
|
|
4448
4404
|
const Tile = ({
|
|
4449
4405
|
className,
|
|
4450
4406
|
description,
|
|
@@ -4493,7 +4449,7 @@ Tile.propTypes = {
|
|
|
4493
4449
|
className: PropTypes.string,
|
|
4494
4450
|
description: PropTypes.node,
|
|
4495
4451
|
disabled: PropTypes.bool,
|
|
4496
|
-
href: PropTypes.string
|
|
4452
|
+
href: PropTypes.string,
|
|
4497
4453
|
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
4498
4454
|
/** Accepts only Avatar and images */
|
|
4499
4455
|
media: PropTypes.node.isRequired,
|
|
@@ -4512,85 +4468,28 @@ Tile.defaultProps = {
|
|
|
4512
4468
|
};
|
|
4513
4469
|
var Tile$1 = Tile;
|
|
4514
4470
|
|
|
4471
|
+
var DecisionPresentation;
|
|
4472
|
+
(function (DecisionPresentation) {
|
|
4473
|
+
DecisionPresentation["LIST"] = "LIST";
|
|
4474
|
+
DecisionPresentation["LIST_BLOCK"] = "LIST_BLOCK";
|
|
4475
|
+
DecisionPresentation["LIST_BLOCK_GRID"] = "LIST_BLOCK_GRID";
|
|
4476
|
+
})(DecisionPresentation || (DecisionPresentation = {}));
|
|
4477
|
+
var DecisionType;
|
|
4478
|
+
(function (DecisionType) {
|
|
4479
|
+
DecisionType["NAVIGATION"] = "NAVIGATION";
|
|
4480
|
+
})(DecisionType || (DecisionType = {}));
|
|
4515
4481
|
const Decision = ({
|
|
4516
4482
|
options,
|
|
4517
|
-
presentation,
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4483
|
+
presentation = DecisionPresentation.LIST,
|
|
4484
|
+
size = Size.MEDIUM,
|
|
4485
|
+
type = DecisionType.NAVIGATION,
|
|
4486
|
+
showMediaCircleInList = true,
|
|
4487
|
+
isContainerAligned = false
|
|
4522
4488
|
}) => {
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
} = Presentation;
|
|
4528
|
-
if (presentation === LIST_BLOCK || presentation === LIST_BLOCK_GRID) {
|
|
4529
|
-
const isSmall = size === Size.SMALL;
|
|
4530
|
-
const isGrid = presentation === LIST_BLOCK_GRID;
|
|
4531
|
-
const items = [{
|
|
4532
|
-
items: [],
|
|
4533
|
-
layout: SizeSwapper$1.Layout.COLUMN
|
|
4534
|
-
}, {
|
|
4535
|
-
items: [],
|
|
4536
|
-
breakpoint: isSmall ? Breakpoint.EXTRA_SMALL : Breakpoint.SMALL,
|
|
4537
|
-
wrap: isGrid
|
|
4538
|
-
}];
|
|
4539
|
-
options.forEach(({
|
|
4540
|
-
description,
|
|
4541
|
-
disabled,
|
|
4542
|
-
href,
|
|
4543
|
-
target,
|
|
4544
|
-
media: {
|
|
4545
|
-
block,
|
|
4546
|
-
list
|
|
4547
|
-
},
|
|
4548
|
-
onClick,
|
|
4549
|
-
title
|
|
4550
|
-
}, key) => {
|
|
4551
|
-
items[0].items.push( /*#__PURE__*/jsx(NavigationOption
|
|
4552
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
4553
|
-
, {
|
|
4554
|
-
complex: false,
|
|
4555
|
-
content: description,
|
|
4556
|
-
disabled: disabled,
|
|
4557
|
-
href: href,
|
|
4558
|
-
target: target,
|
|
4559
|
-
media: list,
|
|
4560
|
-
showMediaAtAllSizes: true,
|
|
4561
|
-
showMediaCircle: showMediaCircleInList,
|
|
4562
|
-
isContainerAligned: isContainerAligned,
|
|
4563
|
-
title: title,
|
|
4564
|
-
onClick: onClick
|
|
4565
|
-
}, `nav-${key}`));
|
|
4566
|
-
items[1].items.push( /*#__PURE__*/jsx(Tile$1
|
|
4567
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
4568
|
-
, {
|
|
4569
|
-
className: classNames(`np-decision__tile${isSmall ? '--small' : ''}`, {
|
|
4570
|
-
'np-decision__tile--fixed-width': isGrid
|
|
4571
|
-
}),
|
|
4572
|
-
description: description,
|
|
4573
|
-
disabled: disabled,
|
|
4574
|
-
href: href,
|
|
4575
|
-
target: target,
|
|
4576
|
-
media: block,
|
|
4577
|
-
size: isSmall ? Size.SMALL : Size.MEDIUM,
|
|
4578
|
-
title: title,
|
|
4579
|
-
onClick: onClick
|
|
4580
|
-
}, `tile-${key}`));
|
|
4581
|
-
});
|
|
4582
|
-
return /*#__PURE__*/jsx("div", {
|
|
4583
|
-
className: classNames('np-decision', {
|
|
4584
|
-
'np-decision--small': isSmall,
|
|
4585
|
-
'np-decision--grid': isGrid
|
|
4586
|
-
}),
|
|
4587
|
-
children: /*#__PURE__*/jsx(SizeSwapper$1, {
|
|
4588
|
-
items: items
|
|
4589
|
-
})
|
|
4590
|
-
});
|
|
4591
|
-
}
|
|
4592
|
-
// LIST
|
|
4593
|
-
return options.map(({
|
|
4489
|
+
const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);
|
|
4490
|
+
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
4491
|
+
if (type === DecisionType.NAVIGATION) {
|
|
4492
|
+
const renderedOptions = options.map(({
|
|
4594
4493
|
title,
|
|
4595
4494
|
description,
|
|
4596
4495
|
disabled,
|
|
@@ -4615,44 +4514,54 @@ const Decision = ({
|
|
|
4615
4514
|
title: title,
|
|
4616
4515
|
onClick: onClick
|
|
4617
4516
|
}, `nav-${key}`));
|
|
4517
|
+
if (presentation === DecisionPresentation.LIST_BLOCK || presentation === DecisionPresentation.LIST_BLOCK_GRID) {
|
|
4518
|
+
const isSmall = size === Size.SMALL;
|
|
4519
|
+
const breakpoint = isSmall ? screenXs : screenSm;
|
|
4520
|
+
const isGrid = presentation === DecisionPresentation.LIST_BLOCK_GRID;
|
|
4521
|
+
return /*#__PURE__*/jsx("div", {
|
|
4522
|
+
className: classNames('np-decision', {
|
|
4523
|
+
'np-decision--small': isSmall,
|
|
4524
|
+
'np-decision--grid': isGrid
|
|
4525
|
+
}),
|
|
4526
|
+
children: /*#__PURE__*/jsx("div", {
|
|
4527
|
+
className: classNames('np-size-swapper d-flex', breakpoint ? isGrid && 'flex-wrap' : 'flex-column'),
|
|
4528
|
+
children: breakpoint ? options.map(({
|
|
4529
|
+
description,
|
|
4530
|
+
disabled,
|
|
4531
|
+
href,
|
|
4532
|
+
target,
|
|
4533
|
+
media: {
|
|
4534
|
+
block
|
|
4535
|
+
},
|
|
4536
|
+
onClick,
|
|
4537
|
+
title
|
|
4538
|
+
}, key) => /*#__PURE__*/jsx(Tile$1
|
|
4539
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
4540
|
+
, {
|
|
4541
|
+
className: classNames(`np-decision__tile${isSmall ? '--small' : ''}`, {
|
|
4542
|
+
'np-decision__tile--fixed-width': isGrid
|
|
4543
|
+
}),
|
|
4544
|
+
description: description,
|
|
4545
|
+
disabled: disabled,
|
|
4546
|
+
href: href,
|
|
4547
|
+
target: target,
|
|
4548
|
+
media: block,
|
|
4549
|
+
size: isSmall ? Size.SMALL : Size.MEDIUM,
|
|
4550
|
+
title: title,
|
|
4551
|
+
onClick: onClick
|
|
4552
|
+
}, `tile-${key}`)) : renderedOptions
|
|
4553
|
+
})
|
|
4554
|
+
});
|
|
4555
|
+
}
|
|
4556
|
+
// LIST
|
|
4557
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
4558
|
+
children: renderedOptions
|
|
4559
|
+
});
|
|
4618
4560
|
}
|
|
4619
|
-
return
|
|
4620
|
-
};
|
|
4621
|
-
Decision.propTypes = {
|
|
4622
|
-
/** A list of elements to be rendered */
|
|
4623
|
-
options: PropTypes.arrayOf(PropTypes.shape({
|
|
4624
|
-
description: PropTypes.node,
|
|
4625
|
-
disabled: PropTypes.bool,
|
|
4626
|
-
href: PropTypes.string,
|
|
4627
|
-
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
4628
|
-
media: PropTypes.shape({
|
|
4629
|
-
block: PropTypes.node.isRequired,
|
|
4630
|
-
list: PropTypes.node.isRequired
|
|
4631
|
-
}),
|
|
4632
|
-
onClick: PropTypes.func,
|
|
4633
|
-
title: PropTypes.node.isRequired
|
|
4634
|
-
})).isRequired,
|
|
4635
|
-
/** Handles the display mode of the component */
|
|
4636
|
-
presentation: PropTypes.oneOf(['LIST', 'LIST_BLOCK', 'LIST_BLOCK_GRID']),
|
|
4637
|
-
/** Size currently affects only Tile dimension */
|
|
4638
|
-
size: PropTypes.oneOf(['sm', 'md']),
|
|
4639
|
-
/** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */
|
|
4640
|
-
type: PropTypes.oneOf(['NAVIGATION']),
|
|
4641
|
-
/** Display media in a circle in list presentation */
|
|
4642
|
-
showMediaCircleInList: PropTypes.bool,
|
|
4643
|
-
/** Sets navigation options to be aligned with the parent container */
|
|
4644
|
-
isContainerAligned: PropTypes.bool
|
|
4645
|
-
};
|
|
4646
|
-
Decision.defaultProps = {
|
|
4647
|
-
presentation: Presentation.LIST,
|
|
4648
|
-
size: Size.MEDIUM,
|
|
4649
|
-
type: Type.NAVIGATION,
|
|
4650
|
-
showMediaCircleInList: true,
|
|
4651
|
-
isContainerAligned: false
|
|
4561
|
+
return null;
|
|
4652
4562
|
};
|
|
4653
|
-
var Decision$1 = Decision;
|
|
4654
4563
|
|
|
4655
|
-
const isLayoutHorizontal = layout => [Layout
|
|
4564
|
+
const isLayoutHorizontal = layout => [Layout.HORIZONTAL_LEFT_ALIGNED, Layout.HORIZONTAL_RIGHT_ALIGNED, Layout.HORIZONTAL_JUSTIFIED].includes(layout);
|
|
4656
4565
|
const getAlignmentClasses = (layout, action) => {
|
|
4657
4566
|
let classes = ['d-flex'];
|
|
4658
4567
|
if (action) {
|
|
@@ -4662,12 +4571,12 @@ const getAlignmentClasses = (layout, action) => {
|
|
|
4662
4571
|
classes.push('align-items-start');
|
|
4663
4572
|
}
|
|
4664
4573
|
}
|
|
4665
|
-
if (layout === Layout
|
|
4574
|
+
if (layout === Layout.HORIZONTAL_RIGHT_ALIGNED) {
|
|
4666
4575
|
classes.push('text-sm-right tw-definition-list--right-aligned-desktop');
|
|
4667
4576
|
} else {
|
|
4668
4577
|
classes.push('justify-content-between');
|
|
4669
4578
|
}
|
|
4670
|
-
if (layout === Layout
|
|
4579
|
+
if (layout === Layout.HORIZONTAL_JUSTIFIED) {
|
|
4671
4580
|
classes.push('text-sm-justify');
|
|
4672
4581
|
}
|
|
4673
4582
|
return classes;
|
|
@@ -4679,8 +4588,8 @@ const DefinitionList = ({
|
|
|
4679
4588
|
}) => /*#__PURE__*/jsx("dl", {
|
|
4680
4589
|
className: classNames('tw-definition-list d-flex ', {
|
|
4681
4590
|
'text-muted': muted,
|
|
4682
|
-
'flex-column': layout === Layout
|
|
4683
|
-
'tw-definition-list--columns flex-column flex-row--sm': layout === Layout
|
|
4591
|
+
'flex-column': layout === Layout.VERTICAL_ONE_COLUMN,
|
|
4592
|
+
'tw-definition-list--columns flex-column flex-row--sm': layout === Layout.VERTICAL_TWO_COLUMN,
|
|
4684
4593
|
'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout)
|
|
4685
4594
|
}),
|
|
4686
4595
|
children: definitions.filter(definition => definition).map(({
|
|
@@ -4722,7 +4631,7 @@ DefinitionList.propTypes = {
|
|
|
4722
4631
|
};
|
|
4723
4632
|
DefinitionList.defaultProps = {
|
|
4724
4633
|
definitions: [],
|
|
4725
|
-
layout: Layout
|
|
4634
|
+
layout: Layout.VERTICAL_TWO_COLUMN,
|
|
4726
4635
|
muted: false
|
|
4727
4636
|
};
|
|
4728
4637
|
var DefinitionList$1 = DefinitionList;
|
|
@@ -5275,7 +5184,7 @@ DynamicFieldDefinitionList.propTypes = {
|
|
|
5275
5184
|
};
|
|
5276
5185
|
DynamicFieldDefinitionList.defaultProps = {
|
|
5277
5186
|
title: null,
|
|
5278
|
-
layout: Layout
|
|
5187
|
+
layout: Layout.VERTICAL_TWO_COLUMN
|
|
5279
5188
|
};
|
|
5280
5189
|
var DynamicFieldDefinitionList$1 = DynamicFieldDefinitionList;
|
|
5281
5190
|
|
|
@@ -5334,11 +5243,11 @@ const Emphasis = ({
|
|
|
5334
5243
|
const FlowHeader = /*#__PURE__*/React.forwardRef(({
|
|
5335
5244
|
bottomContent,
|
|
5336
5245
|
className,
|
|
5337
|
-
layout = Layout
|
|
5246
|
+
layout = Layout.HORIZONTAL,
|
|
5338
5247
|
leftContent,
|
|
5339
5248
|
rightContent
|
|
5340
5249
|
}, reference) => {
|
|
5341
|
-
const isVertical = layout === Layout
|
|
5250
|
+
const isVertical = layout === Layout.VERTICAL;
|
|
5342
5251
|
return /*#__PURE__*/jsxs("div", {
|
|
5343
5252
|
ref: reference,
|
|
5344
5253
|
className: classNames('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', 'justify-content-between', 'flex__item--12', className),
|
|
@@ -5749,7 +5658,7 @@ const FlowNavigation = ({
|
|
|
5749
5658
|
steps: steps,
|
|
5750
5659
|
className: classNames('np-flow-navigation__stepper')
|
|
5751
5660
|
}),
|
|
5752
|
-
layout: clientWidth != null && clientWidth < Breakpoint.LARGE ? Layout
|
|
5661
|
+
layout: clientWidth != null && clientWidth < Breakpoint.LARGE ? Layout.VERTICAL : Layout.HORIZONTAL
|
|
5753
5662
|
})
|
|
5754
5663
|
});
|
|
5755
5664
|
};
|
|
@@ -15407,10 +15316,10 @@ var zhHK = {
|
|
|
15407
15316
|
"neptune.ClearButton.ariaLabel": "清除",
|
|
15408
15317
|
"neptune.CloseButton.ariaLabel": "關閉",
|
|
15409
15318
|
"neptune.DateInput.day.label": "日",
|
|
15410
|
-
"neptune.DateInput.day.placeholder": "
|
|
15319
|
+
"neptune.DateInput.day.placeholder": "DD",
|
|
15411
15320
|
"neptune.DateInput.month.label": "月",
|
|
15412
15321
|
"neptune.DateInput.year.label": "年",
|
|
15413
|
-
"neptune.DateInput.year.placeholder": "
|
|
15322
|
+
"neptune.DateInput.year.placeholder": "YYYY",
|
|
15414
15323
|
"neptune.DateLookup.day": "日",
|
|
15415
15324
|
"neptune.DateLookup.goTo20YearView": "切換至20年視圖",
|
|
15416
15325
|
"neptune.DateLookup.month": "月",
|
|
@@ -15480,5 +15389,5 @@ const translations = {
|
|
|
15480
15389
|
'zh-HK': zhHK
|
|
15481
15390
|
};
|
|
15482
15391
|
|
|
15483
|
-
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, 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$1 as CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision
|
|
15392
|
+
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, 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$1 as CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput$1 as DateInput, DateLookup$1 as 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$1 as InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown$1 as Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$2 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio$1 as Radio, RadioGroup$1 as RadioGroup, RadioOption$1 as RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel$1 as SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky$1 as Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip$1 as Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15484
15393
|
//# sourceMappingURL=index.esm.js.map
|