@transferwise/components 0.0.0-experimental-a53ae95 → 0.0.0-experimental-ff4fa52
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 +1 -14
- package/build/index.esm.js +56 -89
- package/build/index.esm.js.map +1 -1
- package/build/index.js +56 -89
- package/build/index.js.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/getMonthNames/getMonthNames.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
- 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/isDateValid.d.ts +2 -2
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
- 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/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/dateInput/DateInput.d.ts +35 -41
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.messages.d.ts +24 -33
- 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 +2 -5
- 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/test-utils/window-mock.d.ts.map +1 -1
- package/package.json +1 -17
- package/src/common/dateUtils/getDayNames/getDayNames.spec.js +1 -1
- package/src/common/dateUtils/getDayNames/{getDayNames.js → getDayNames.ts} +5 -2
- package/src/common/dateUtils/getMonthNames/getMonthNames.spec.js +9 -8
- package/src/common/dateUtils/getMonthNames/{getMonthNames.js → getMonthNames.ts} +5 -3
- package/src/common/dateUtils/index.ts +6 -0
- package/src/common/dateUtils/isDateValid/{isDateValid.spec.js → isDateValid.spec.ts} +1 -1
- package/src/common/dateUtils/isDateValid/isDateValid.ts +13 -0
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.spec.js +3 -7
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.ts +4 -0
- package/src/common/dateUtils/isWithinRange/{isWithinRange.spec.js → isWithinRange.spec.ts} +1 -1
- package/src/common/dateUtils/isWithinRange/{isWithinRange.js → isWithinRange.ts} +1 -1
- package/src/common/dateUtils/moveToWithinRange/{moveToWithinRange.js → moveToWithinRange.ts} +2 -2
- package/src/dateInput/DateInput.spec.js +6 -55
- package/src/dateInput/DateInput.story.tsx +9 -7
- package/src/dateInput/{DateInput.js → DateInput.tsx} +120 -97
- package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.js → convertToLocalMidnight.ts} +1 -1
- package/src/dateInput/utils/explodeDate/{explodeDate.js → explodeDate.ts} +3 -1
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -0
- package/src/test-utils/window-mock.ts +23 -7
- package/build/mocks.esm.js +0 -40
- package/build/mocks.esm.js.map +0 -1
- package/build/mocks.js +0 -43
- package/build/mocks.js.map +0 -1
- package/build/types/common/dateUtils/getDayNames/index.d.ts +0 -2
- package/build/types/common/dateUtils/getDayNames/index.d.ts.map +0 -1
- package/build/types/common/dateUtils/getMonthNames/index.d.ts +0 -2
- package/build/types/common/dateUtils/getMonthNames/index.d.ts.map +0 -1
- package/build/types/common/dateUtils/isDateValid/index.d.ts +0 -2
- package/build/types/common/dateUtils/isDateValid/index.d.ts.map +0 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts +0 -2
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts.map +0 -1
- package/build/types/common/dateUtils/isWithinRange/index.d.ts +0 -2
- package/build/types/common/dateUtils/isWithinRange/index.d.ts.map +0 -1
- package/build/types/common/dateUtils/moveToWithinRange/index.d.ts +0 -2
- package/build/types/common/dateUtils/moveToWithinRange/index.d.ts.map +0 -1
- package/build/types/mocks.d.ts +0 -9
- package/build/types/mocks.d.ts.map +0 -1
- package/src/common/dateUtils/getDayNames/index.js +0 -1
- package/src/common/dateUtils/getMonthNames/index.js +0 -1
- package/src/common/dateUtils/index.js +0 -6
- package/src/common/dateUtils/isDateValid/index.js +0 -1
- package/src/common/dateUtils/isDateValid/isDateValid.js +0 -6
- package/src/common/dateUtils/isMonthAndYearFormat/index.js +0 -1
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.js +0 -4
- package/src/common/dateUtils/isWithinRange/index.js +0 -1
- package/src/common/dateUtils/moveToWithinRange/index.js +0 -1
- package/src/mocks.ts +0 -48
- /package/src/dateInput/{DateInput.messages.js → DateInput.messages.ts} +0 -0
- /package/src/dateInput/{index.js → index.ts} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.spec.js → convertToLocalMidnight.spec.ts} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{index.js → index.ts} +0 -0
- /package/src/dateInput/utils/explodeDate/{explodeDate.spec.js → explodeDate.spec.ts} +0 -0
- /package/src/dateInput/utils/explodeDate/{index.js → index.ts} +0 -0
- /package/src/dateInput/utils/{index.js → index.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://github.com/transferwise/neptune-web/actions) [](https://www.npmjs.com/package/@transferwise/components)
|
|
2
2
|
|
|
3
|
-
# Neptune Web React Components
|
|
3
|
+
# Neptune Web React Components Temp
|
|
4
4
|
|
|
5
5
|
Neptune is the Design System built by and used at TransferWise. Neptune Web is the Neptune framework for Web. Neptune Web provides a way to build high quality, consistent user experiences on the web with ease.
|
|
6
6
|
|
|
@@ -48,19 +48,6 @@ Note: types for some of components are not 100% accurate (some of them will be j
|
|
|
48
48
|
|
|
49
49
|
Please follow [rules for JS components](https://github.com/transferwise/neptune-web/blob/main/packages/components/CONTRIBUTING.md#js-component-rules) in order to generate accurate types for them.
|
|
50
50
|
|
|
51
|
-
### Mocks for testing
|
|
52
|
-
|
|
53
|
-
We expose reusable mocks for Jest and Vitest under an isolated entry point. They can be applied by passing the testing framework as the parameter:
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
import { mockMatchMedia, mockResizeObserver } from '@transferwise/components/mocks';
|
|
57
|
-
import { jest } from '@jest/globals';
|
|
58
|
-
import { vi } from 'vitest';
|
|
59
|
-
|
|
60
|
-
mockMatchMedia(jest); // With Jest
|
|
61
|
-
mockResizeObserver(vi); // With Vitest
|
|
62
|
-
```
|
|
63
|
-
|
|
64
51
|
## Documentation
|
|
65
52
|
|
|
66
53
|
Visit the [docs](https://transferwise.github.io/neptune-web/about/Home) for information on getting started, usage information and examples for each component.
|
package/build/index.esm.js
CHANGED
|
@@ -7,6 +7,7 @@ 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';
|
|
10
11
|
import { Transition, Listbox } from '@headlessui/react';
|
|
11
12
|
import mergeProps from 'merge-props';
|
|
12
13
|
import mergeRefs from 'react-merge-refs';
|
|
@@ -14,7 +15,6 @@ import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
|
14
15
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
15
16
|
import { FocusScope } from '@react-aria/focus';
|
|
16
17
|
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';
|
|
@@ -2763,9 +2763,17 @@ const getMonthNames = (locale, format = 'long') => {
|
|
|
2763
2763
|
return months;
|
|
2764
2764
|
};
|
|
2765
2765
|
|
|
2766
|
-
const isDateValid = date =>
|
|
2767
|
-
|
|
2768
|
-
|
|
2766
|
+
const isDateValid = date => {
|
|
2767
|
+
if (date === null) {
|
|
2768
|
+
return false;
|
|
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());
|
|
2769
2777
|
|
|
2770
2778
|
const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
|
|
2771
2779
|
|
|
@@ -2800,7 +2808,6 @@ const explodeDate = date => {
|
|
|
2800
2808
|
|
|
2801
2809
|
const convertToLocalMidnight = date => {
|
|
2802
2810
|
const utcDate = new Date(date.split('T')[0]); // using YYYY-MM-DD creates UTC date
|
|
2803
|
-
|
|
2804
2811
|
return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate());
|
|
2805
2812
|
};
|
|
2806
2813
|
|
|
@@ -2813,21 +2820,21 @@ const INITIAL_DEFAULT_STATE = {
|
|
|
2813
2820
|
const DateInput = ({
|
|
2814
2821
|
'aria-labelledby': ariaLabelledBy,
|
|
2815
2822
|
'aria-label': ariaLabel,
|
|
2816
|
-
disabled,
|
|
2817
|
-
size,
|
|
2818
|
-
value,
|
|
2823
|
+
disabled = false,
|
|
2824
|
+
size = Size.MEDIUM,
|
|
2825
|
+
value = null,
|
|
2819
2826
|
dayLabel,
|
|
2820
2827
|
dayAutoComplete,
|
|
2821
2828
|
monthLabel,
|
|
2822
2829
|
yearLabel,
|
|
2823
2830
|
yearAutoComplete,
|
|
2824
|
-
monthFormat,
|
|
2825
|
-
mode,
|
|
2831
|
+
monthFormat = MonthFormat.LONG,
|
|
2832
|
+
mode = DateMode.DAY_MONTH_YEAR,
|
|
2826
2833
|
onChange,
|
|
2827
2834
|
onFocus,
|
|
2828
|
-
onBlur,
|
|
2835
|
+
onBlur = undefined,
|
|
2829
2836
|
placeholders,
|
|
2830
|
-
id,
|
|
2837
|
+
id = '',
|
|
2831
2838
|
selectProps
|
|
2832
2839
|
}) => {
|
|
2833
2840
|
const {
|
|
@@ -2844,8 +2851,10 @@ const DateInput = ({
|
|
|
2844
2851
|
let explodedDate = INITIAL_DEFAULT_STATE;
|
|
2845
2852
|
if (value && isDateValid(value)) {
|
|
2846
2853
|
const dateObject = getDateObject();
|
|
2847
|
-
|
|
2848
|
-
|
|
2854
|
+
if (dateObject !== null) {
|
|
2855
|
+
explodedDate = explodeDate(dateObject);
|
|
2856
|
+
}
|
|
2857
|
+
if (typeof value === 'string' && isMonthAndYearFormat(value)) {
|
|
2849
2858
|
explodedDate.day = null;
|
|
2850
2859
|
}
|
|
2851
2860
|
}
|
|
@@ -2864,7 +2873,7 @@ const DateInput = ({
|
|
|
2864
2873
|
year: placeholders?.year || formatMessage(messages$9.yearPlaceholder)
|
|
2865
2874
|
};
|
|
2866
2875
|
const getDateAsString = date => {
|
|
2867
|
-
if (!isDateValid(date)) {
|
|
2876
|
+
if (date === null || !isDateValid(date)) {
|
|
2868
2877
|
return '';
|
|
2869
2878
|
}
|
|
2870
2879
|
switch (mode) {
|
|
@@ -2885,14 +2894,12 @@ const DateInput = ({
|
|
|
2885
2894
|
}), /*#__PURE__*/jsx(SelectInput, {
|
|
2886
2895
|
name: "month",
|
|
2887
2896
|
disabled: disabled,
|
|
2888
|
-
placeholder: placeholders
|
|
2897
|
+
placeholder: placeholders?.month,
|
|
2889
2898
|
items: monthOptions,
|
|
2890
2899
|
size: size,
|
|
2891
|
-
value: monthOptions.find(item => item.value
|
|
2892
|
-
renderValue: ({
|
|
2893
|
-
|
|
2894
|
-
}) => /*#__PURE__*/jsx(SelectInputOptionContent, {
|
|
2895
|
-
title: label
|
|
2900
|
+
value: monthOptions.find(item => item.value === month)?.value,
|
|
2901
|
+
renderValue: selectedValue => /*#__PURE__*/jsx(SelectInputOptionContent, {
|
|
2902
|
+
title: getMonthNames(locale, monthFormat)[selectedValue]
|
|
2896
2903
|
}),
|
|
2897
2904
|
onChange: selectedValue => handleMonthChange(selectedValue),
|
|
2898
2905
|
...selectProps
|
|
@@ -2901,14 +2908,10 @@ const DateInput = ({
|
|
|
2901
2908
|
};
|
|
2902
2909
|
const getMonthsOptions = () => {
|
|
2903
2910
|
const options = [];
|
|
2904
|
-
|
|
2905
|
-
months.forEach((label, index) => {
|
|
2911
|
+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].forEach(index => {
|
|
2906
2912
|
options.push({
|
|
2907
2913
|
type: 'option',
|
|
2908
|
-
value:
|
|
2909
|
-
label,
|
|
2910
|
-
value: index
|
|
2911
|
-
}
|
|
2914
|
+
value: index
|
|
2912
2915
|
});
|
|
2913
2916
|
});
|
|
2914
2917
|
return options;
|
|
@@ -2920,35 +2923,33 @@ const DateInput = ({
|
|
|
2920
2923
|
broadcastNewValue(INITIAL_DEFAULT_STATE);
|
|
2921
2924
|
}
|
|
2922
2925
|
if (mode === DateMode.MONTH_YEAR) {
|
|
2923
|
-
if (newMonth >= 0 && newYear && (newMonth !== month || newYear !== year)) {
|
|
2926
|
+
if (newMonth && newMonth >= 0 && newYear && (newMonth !== month || newYear !== year)) {
|
|
2924
2927
|
broadcastNewValue(newValue);
|
|
2925
2928
|
}
|
|
2926
|
-
} else if (newDay && newMonth >= 0 && newYear && (newDay !== day || newMonth !== month || newYear !== year)) {
|
|
2929
|
+
} else if (newDay && newMonth !== null && newMonth >= 0 && newYear && (newDay !== day || newMonth !== month || newYear !== year)) {
|
|
2927
2930
|
broadcastNewValue(newValue);
|
|
2928
2931
|
}
|
|
2929
2932
|
};
|
|
2930
2933
|
const handleDayChange = event => {
|
|
2931
2934
|
const {
|
|
2932
2935
|
checkedDay
|
|
2933
|
-
} = checkDate(event.target.value, month, year);
|
|
2936
|
+
} = checkDate(parseInt(event.target.value), month, year);
|
|
2934
2937
|
setDay(checkedDay);
|
|
2935
2938
|
handleInternalValue(checkedDay, month, year);
|
|
2936
2939
|
};
|
|
2937
2940
|
const handleMonthChange = selectedValue => {
|
|
2938
|
-
if (
|
|
2941
|
+
if (selectedValue === null) {
|
|
2939
2942
|
setMonth(null);
|
|
2940
2943
|
handleInternalValue(day, null, year);
|
|
2941
2944
|
return;
|
|
2942
2945
|
}
|
|
2943
|
-
const selectedMonth = selectedValue ? selectedValue
|
|
2946
|
+
const selectedMonth = selectedValue ? selectedValue : 0;
|
|
2944
2947
|
const {
|
|
2945
2948
|
checkedDay
|
|
2946
2949
|
} = checkDate(day, selectedMonth, year);
|
|
2947
2950
|
setMonth(selectedMonth);
|
|
2948
|
-
if (day) {
|
|
2949
|
-
|
|
2950
|
-
setDay(checkedDay);
|
|
2951
|
-
}
|
|
2951
|
+
if (day && checkedDay !== day) {
|
|
2952
|
+
setDay(checkedDay);
|
|
2952
2953
|
}
|
|
2953
2954
|
handleInternalValue(checkedDay, selectedMonth, year);
|
|
2954
2955
|
};
|
|
@@ -2959,35 +2960,37 @@ const DateInput = ({
|
|
|
2959
2960
|
// Correct day based on year and month.
|
|
2960
2961
|
const {
|
|
2961
2962
|
checkedDay
|
|
2962
|
-
} = checkDate(day, month, newValue);
|
|
2963
|
-
if (day) {
|
|
2964
|
-
|
|
2965
|
-
setDay(checkedDay);
|
|
2966
|
-
}
|
|
2963
|
+
} = checkDate(day, month, parseInt(newValue));
|
|
2964
|
+
if (day && checkedDay !== day) {
|
|
2965
|
+
setDay(checkedDay);
|
|
2967
2966
|
}
|
|
2968
|
-
setYear(slicedYear);
|
|
2969
|
-
handleInternalValue(checkedDay, month, slicedYear);
|
|
2967
|
+
setYear(parseInt(slicedYear));
|
|
2968
|
+
handleInternalValue(checkedDay, month, parseInt(slicedYear));
|
|
2970
2969
|
} else {
|
|
2971
|
-
setYear(slicedYear);
|
|
2970
|
+
setYear(parseInt(slicedYear));
|
|
2972
2971
|
handleInternalValue(day, month, null);
|
|
2973
2972
|
}
|
|
2974
2973
|
};
|
|
2975
2974
|
const broadcastNewValue = newValue => {
|
|
2976
2975
|
if (newValue !== lastBroadcastedValue) {
|
|
2977
2976
|
setLastBroadcastedValue(newValue);
|
|
2978
|
-
|
|
2977
|
+
if (newValue === INITIAL_DEFAULT_STATE) {
|
|
2978
|
+
onChange(null);
|
|
2979
|
+
} else {
|
|
2980
|
+
onChange(getDateAsString(newValue) || null);
|
|
2981
|
+
}
|
|
2979
2982
|
}
|
|
2980
2983
|
};
|
|
2981
2984
|
const checkDate = (newDay = null, newMonth = 0, newYear = null) => {
|
|
2982
2985
|
let checkedDay = newDay;
|
|
2983
|
-
const maxDay = new Date(newYear || 2000, newMonth + 1, 0).getDate();
|
|
2986
|
+
const maxDay = new Date(newYear || 2000, newMonth ? newMonth + 1 : 1, 0).getDate();
|
|
2984
2987
|
if (!newDay) {
|
|
2985
2988
|
checkedDay = null;
|
|
2986
2989
|
}
|
|
2987
|
-
if (newDay && newDay < 0
|
|
2990
|
+
if (newDay && newDay < 0) {
|
|
2988
2991
|
checkedDay = 1;
|
|
2989
2992
|
}
|
|
2990
|
-
if (newDay && newMonth || newDay > 31) {
|
|
2993
|
+
if (newDay && newMonth || newDay && newDay > 31) {
|
|
2991
2994
|
checkedDay = newDay > maxDay ? maxDay : newDay;
|
|
2992
2995
|
}
|
|
2993
2996
|
return {
|
|
@@ -3007,8 +3010,10 @@ const DateInput = ({
|
|
|
3007
3010
|
id: id,
|
|
3008
3011
|
"aria-labelledby": ariaLabelledBy,
|
|
3009
3012
|
"aria-label": ariaLabel,
|
|
3010
|
-
|
|
3011
|
-
|
|
3013
|
+
role: "group" // Add role attribute to indicate container for interactive elements
|
|
3014
|
+
,
|
|
3015
|
+
onFocus: event => shouldPropagateOnFocus(event) ? onFocus && onFocus(event) : event.stopPropagation(),
|
|
3016
|
+
onBlur: event => shouldPropagateOnBlur(event) ? onBlur && onBlur(event) : event.stopPropagation(),
|
|
3012
3017
|
children: /*#__PURE__*/jsxs("div", {
|
|
3013
3018
|
className: "row",
|
|
3014
3019
|
children: [monthBeforeDay && /*#__PURE__*/jsx("div", {
|
|
@@ -3061,7 +3066,6 @@ const DateInput = ({
|
|
|
3061
3066
|
})
|
|
3062
3067
|
});
|
|
3063
3068
|
};
|
|
3064
|
-
|
|
3065
3069
|
// Should only propagate if the relatedTarget is not part of this DateInput component.
|
|
3066
3070
|
function shouldPropagateOnFocus({
|
|
3067
3071
|
target,
|
|
@@ -3071,7 +3075,6 @@ function shouldPropagateOnFocus({
|
|
|
3071
3075
|
const relatedParent = relatedTarget && relatedTarget.closest('.tw-date');
|
|
3072
3076
|
return targetParent !== relatedParent;
|
|
3073
3077
|
}
|
|
3074
|
-
|
|
3075
3078
|
// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
|
|
3076
3079
|
function shouldPropagateOnBlur({
|
|
3077
3080
|
target,
|
|
@@ -3088,42 +3091,6 @@ function shouldPropagateOnBlur({
|
|
|
3088
3091
|
const focusElementParent = focusElement && focusElement.closest('.tw-date');
|
|
3089
3092
|
return blurElementParent !== focusElementParent;
|
|
3090
3093
|
}
|
|
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;
|
|
3127
3094
|
|
|
3128
3095
|
const POPOVER_OFFSET = [0, 16];
|
|
3129
3096
|
// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
|
|
@@ -15513,5 +15480,5 @@ const translations = {
|
|
|
15513
15480
|
'zh-HK': zhHK
|
|
15514
15481
|
};
|
|
15515
15482
|
|
|
15516
|
-
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
|
|
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$1 as Decision, Presentation as DecisionPresentation, Type as 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$1 as 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$1 as Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15517
15484
|
//# sourceMappingURL=index.esm.js.map
|