@spaced-out/ui-design-system 0.1.109 → 0.1.111
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/CHANGELOG.md +19 -0
- package/lib/components/DateRangePicker/Calendar.js +4 -2
- package/lib/components/DateRangePicker/Calendar.js.flow +11 -6
- package/lib/components/DateRangePicker/DateRangePicker.js +47 -35
- package/lib/components/DateRangePicker/DateRangePicker.js.flow +71 -70
- package/lib/components/DateRangePicker/DateRangeWrapper.js +35 -8
- package/lib/components/DateRangePicker/DateRangeWrapper.js.flow +98 -74
- package/lib/components/DateRangePicker/index.js.flow +0 -1
- package/lib/components/Input/Input.js +15 -2
- package/lib/components/Input/Input.js.flow +20 -0
- package/lib/components/Menu/Menu.js +6 -5
- package/lib/components/Menu/Menu.js.flow +15 -5
- package/lib/components/Menu/Menu.module.css +1 -1
- package/lib/types/date-range-picker.js +3 -0
- package/lib/types/date-range-picker.js.flow +18 -0
- package/lib/types/index.js +11 -0
- package/lib/types/index.js.flow +1 -0
- package/lib/types/menu.js.flow +2 -0
- package/lib/utils/date-range-picker/date-range-picker.js +306 -0
- package/lib/utils/date-range-picker/date-range-picker.js.flow +335 -0
- package/lib/utils/date-range-picker/index.js +27 -0
- package/lib/utils/date-range-picker/index.js.flow +4 -0
- package/lib/utils/index.js +11 -0
- package/lib/utils/index.js.flow +1 -0
- package/package.json +1 -1
- package/lib/components/DateRangePicker/utils.js +0 -236
- package/lib/components/DateRangePicker/utils.js.flow +0 -245
- /package/lib/{components/DateRangePicker → utils/date-range-picker}/timezones.js +0 -0
- /package/lib/{components/DateRangePicker → utils/date-range-picker}/timezones.js.flow +0 -0
|
@@ -4,6 +4,17 @@ import * as React from 'react';
|
|
|
4
4
|
// $FlowFixMe[untyped-import]
|
|
5
5
|
import moment from 'moment-timezone';
|
|
6
6
|
|
|
7
|
+
import type {DateRange, DateRangeWithTimezone} from '../../types';
|
|
8
|
+
import {
|
|
9
|
+
addTimezone,
|
|
10
|
+
generateAvailableYears,
|
|
11
|
+
getAvailableMonths,
|
|
12
|
+
getMonthEndDate,
|
|
13
|
+
getTimezones,
|
|
14
|
+
MARKERS,
|
|
15
|
+
MONTHS,
|
|
16
|
+
NAVIGATION_ACTION,
|
|
17
|
+
} from '../../utils';
|
|
7
18
|
import classify from '../../utils/classify';
|
|
8
19
|
import {Button} from '../Button';
|
|
9
20
|
import {
|
|
@@ -19,24 +30,14 @@ import {FocusManager} from '../FocusManager';
|
|
|
19
30
|
import {ClickableIcon} from '../Icon';
|
|
20
31
|
|
|
21
32
|
import {Calendar} from './Calendar.js';
|
|
22
|
-
import type {DateRange, DateRangeWithTimezone} from './utils';
|
|
23
|
-
import {
|
|
24
|
-
addTimezone,
|
|
25
|
-
generateAvailableYears,
|
|
26
|
-
getAddedDate,
|
|
27
|
-
getAvailableMonths,
|
|
28
|
-
getMonthStartDate,
|
|
29
|
-
getTimezones,
|
|
30
|
-
MARKERS,
|
|
31
|
-
MONTHS,
|
|
32
|
-
NAVIGATION_ACTION,
|
|
33
|
-
} from './utils';
|
|
34
33
|
|
|
35
34
|
import css from './DateRangeWrapper.module.css';
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
type HeaderProps = {
|
|
39
38
|
date: string,
|
|
39
|
+
minDate: string,
|
|
40
|
+
maxDate: string,
|
|
40
41
|
rangeStartMonth: string,
|
|
41
42
|
rangeEndMonth: string,
|
|
42
43
|
nextDisabled: boolean,
|
|
@@ -50,6 +51,8 @@ type HeaderProps = {
|
|
|
50
51
|
type DateRangeWrapperProps = {
|
|
51
52
|
dateRange: DateRange,
|
|
52
53
|
hoverDay: string,
|
|
54
|
+
minDate: string,
|
|
55
|
+
maxDate: string,
|
|
53
56
|
rangeStartMonth: string,
|
|
54
57
|
rangeEndMonth: string,
|
|
55
58
|
cardWrapperClass: ?string,
|
|
@@ -74,6 +77,8 @@ type DateRangeWrapperProps = {
|
|
|
74
77
|
const CalendarHeader = ({
|
|
75
78
|
date,
|
|
76
79
|
marker,
|
|
80
|
+
minDate,
|
|
81
|
+
maxDate,
|
|
77
82
|
setMonth,
|
|
78
83
|
rangeStartMonth,
|
|
79
84
|
rangeEndMonth,
|
|
@@ -81,64 +86,73 @@ const CalendarHeader = ({
|
|
|
81
86
|
nextDisabled,
|
|
82
87
|
prevDisabled,
|
|
83
88
|
onClickPrevious,
|
|
84
|
-
}: HeaderProps): React.Node =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
89
|
+
}: HeaderProps): React.Node => {
|
|
90
|
+
const availableYears = generateAvailableYears({
|
|
91
|
+
marker,
|
|
92
|
+
minDate,
|
|
93
|
+
maxDate,
|
|
94
|
+
rangeStartMonth,
|
|
95
|
+
rangeEndMonth,
|
|
96
|
+
});
|
|
97
|
+
const availableMonths = getAvailableMonths({
|
|
98
|
+
marker,
|
|
99
|
+
minDate,
|
|
100
|
+
maxDate,
|
|
101
|
+
rangeStartMonth,
|
|
102
|
+
rangeEndMonth,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className={css.calendarHeader}>
|
|
107
|
+
<ClickableIcon
|
|
108
|
+
ariaLabel="Select Previous Month"
|
|
109
|
+
size="small"
|
|
110
|
+
name="chevron-left"
|
|
111
|
+
className={classify(css.headerIcon, {
|
|
112
|
+
[css.disabledIcon]: prevDisabled,
|
|
113
|
+
})}
|
|
114
|
+
onClick={onClickPrevious}
|
|
115
|
+
color={prevDisabled ? 'disabled' : 'secondary'}
|
|
116
|
+
/>
|
|
117
|
+
<Dropdown
|
|
118
|
+
size="small"
|
|
119
|
+
disabled={!availableMonths.length || moment(minDate).isAfter(maxDate)}
|
|
120
|
+
menu={{
|
|
121
|
+
selectedKeys: [moment(date).month().toString()],
|
|
122
|
+
options: availableMonths,
|
|
123
|
+
}}
|
|
124
|
+
onChange={(event) => {
|
|
125
|
+
setMonth(getMonthEndDate(moment(date).set('M', event.key)));
|
|
126
|
+
}}
|
|
127
|
+
dropdownInputText={MONTHS[moment(date).month()].label}
|
|
128
|
+
scrollMenuToBottom
|
|
129
|
+
/>
|
|
130
|
+
<Dropdown
|
|
131
|
+
disabled={!availableYears.length || moment(minDate).isAfter(maxDate)}
|
|
132
|
+
menu={{
|
|
133
|
+
selectedKeys: [moment(date).year().toString()],
|
|
134
|
+
options: availableYears,
|
|
135
|
+
}}
|
|
136
|
+
size="small"
|
|
137
|
+
onChange={(event) => {
|
|
138
|
+
setMonth(getMonthEndDate(moment(date).set('y', event.key)));
|
|
139
|
+
}}
|
|
140
|
+
dropdownInputText={moment(date).year()}
|
|
141
|
+
scrollMenuToBottom
|
|
142
|
+
/>
|
|
143
|
+
<ClickableIcon
|
|
144
|
+
size="small"
|
|
145
|
+
ariaLabel="Select Next Month"
|
|
146
|
+
name="chevron-right"
|
|
147
|
+
className={classify(css.headerIcon, {
|
|
148
|
+
[css.disabledIcon]: nextDisabled,
|
|
149
|
+
})}
|
|
150
|
+
onClick={onClickNext}
|
|
151
|
+
color={nextDisabled ? 'disabled' : 'secondary'}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
142
156
|
|
|
143
157
|
export const DateRangeWrapper: React$AbstractComponent<
|
|
144
158
|
DateRangeWrapperProps,
|
|
@@ -150,6 +164,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
150
164
|
onCancel,
|
|
151
165
|
handlers,
|
|
152
166
|
hoverDay,
|
|
167
|
+
minDate,
|
|
168
|
+
maxDate,
|
|
153
169
|
timezone,
|
|
154
170
|
dateRange,
|
|
155
171
|
rangeStartMonth,
|
|
@@ -189,6 +205,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
189
205
|
handlers,
|
|
190
206
|
hoverDay,
|
|
191
207
|
dateRange,
|
|
208
|
+
minDate,
|
|
209
|
+
maxDate,
|
|
192
210
|
};
|
|
193
211
|
|
|
194
212
|
return (
|
|
@@ -207,7 +225,12 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
207
225
|
date={rangeStartMonth}
|
|
208
226
|
setMonth={setRangeStartMonth}
|
|
209
227
|
nextDisabled={!canNavigateCloser}
|
|
210
|
-
prevDisabled={
|
|
228
|
+
prevDisabled={moment(rangeStartMonth).isSameOrBefore(
|
|
229
|
+
minDate,
|
|
230
|
+
'M',
|
|
231
|
+
)}
|
|
232
|
+
minDate={minDate}
|
|
233
|
+
maxDate={maxDate}
|
|
211
234
|
onClickNext={() =>
|
|
212
235
|
onMonthNavigate(
|
|
213
236
|
MARKERS.DATE_RANGE_START,
|
|
@@ -227,10 +250,10 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
227
250
|
rangeEndMonth={rangeEndMonth}
|
|
228
251
|
date={rangeEndMonth}
|
|
229
252
|
setMonth={setRangeEndMonth}
|
|
230
|
-
nextDisabled={moment(
|
|
231
|
-
getAddedDate(rangeEndMonth, 1, 'M'),
|
|
232
|
-
).isSameOrAfter(moment())}
|
|
253
|
+
nextDisabled={moment(rangeEndMonth).isSameOrAfter(maxDate, 'M')}
|
|
233
254
|
prevDisabled={!canNavigateCloser}
|
|
255
|
+
minDate={minDate}
|
|
256
|
+
maxDate={maxDate}
|
|
234
257
|
onClickNext={() =>
|
|
235
258
|
onMonthNavigate(MARKERS.DATE_RANGE_END, NAVIGATION_ACTION.NEXT)
|
|
236
259
|
}
|
|
@@ -257,6 +280,7 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
257
280
|
{!hideTimezone && (
|
|
258
281
|
<SimpleDropdown
|
|
259
282
|
options={getTimezones()}
|
|
283
|
+
disabled={moment(minDate).isAfter(maxDate)}
|
|
260
284
|
classNames={{
|
|
261
285
|
box: css.timezoneDropdown,
|
|
262
286
|
}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Input = exports.INPUT_TYPES = void 0;
|
|
6
|
+
exports.Input = exports.INPUT_TYPES = exports.EXPONENT_CHARACTER_LIST = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classify = require("../../utils/classify");
|
|
9
9
|
var _Icon = require("../Icon");
|
|
@@ -13,6 +13,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const EXPONENT_CHARACTER_LIST = ['E', 'e'];
|
|
17
|
+
exports.EXPONENT_CHARACTER_LIST = EXPONENT_CHARACTER_LIST;
|
|
16
18
|
const INPUT_TYPES = Object.freeze({
|
|
17
19
|
text: 'text',
|
|
18
20
|
number: 'number',
|
|
@@ -55,6 +57,8 @@ const Input_ = (props, ref) => {
|
|
|
55
57
|
required,
|
|
56
58
|
readOnly,
|
|
57
59
|
boxRef,
|
|
60
|
+
onKeyDown,
|
|
61
|
+
disallowExponents,
|
|
58
62
|
...inputProps
|
|
59
63
|
} = props;
|
|
60
64
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
@@ -68,6 +72,14 @@ const Input_ = (props, ref) => {
|
|
|
68
72
|
}
|
|
69
73
|
onIconRightClick && onIconRightClick(e);
|
|
70
74
|
};
|
|
75
|
+
const handleKeyDown = e => {
|
|
76
|
+
if (type === INPUT_TYPES.number && disallowExponents) {
|
|
77
|
+
if (EXPONENT_CHARACTER_LIST.includes(e.key)) {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
onKeyDown?.(e);
|
|
82
|
+
};
|
|
71
83
|
return /*#__PURE__*/React.createElement("div", {
|
|
72
84
|
className: (0, _classify.classify)(_InputModule.default.wrapper, {
|
|
73
85
|
[_InputModule.default.filled]: controlledInputFilled ?? false,
|
|
@@ -107,7 +119,8 @@ const Input_ = (props, ref) => {
|
|
|
107
119
|
onFocus: onFocus,
|
|
108
120
|
onBlur: onBlur,
|
|
109
121
|
type: showPassword ? 'text' : type,
|
|
110
|
-
readOnly: readOnly && 'readOnly'
|
|
122
|
+
readOnly: readOnly && 'readOnly',
|
|
123
|
+
onKeyDown: handleKeyDown
|
|
111
124
|
})), type === 'color' && /*#__PURE__*/React.createElement("div", {
|
|
112
125
|
className: (0, _classify.classify)(_InputModule.default.colorText, _InputModule.default[size], {
|
|
113
126
|
[_InputModule.default.hasValue]: value
|
|
@@ -15,6 +15,8 @@ type ClassNames = $ReadOnly<{
|
|
|
15
15
|
iconRight?: string,
|
|
16
16
|
}>;
|
|
17
17
|
|
|
18
|
+
export const EXPONENT_CHARACTER_LIST = ['E', 'e'];
|
|
19
|
+
|
|
18
20
|
export const INPUT_TYPES = Object.freeze({
|
|
19
21
|
text: 'text',
|
|
20
22
|
number: 'number',
|
|
@@ -69,6 +71,11 @@ export type InputProps = {
|
|
|
69
71
|
min?: string,
|
|
70
72
|
max?: string,
|
|
71
73
|
autoComplete?: string,
|
|
74
|
+
/* Note(Nishant): Restricts typing `e` and `E` in the number input when
|
|
75
|
+
set to true. We have baked this condition in the keydown handler itself so
|
|
76
|
+
this would restrict and not show these exponent characters when typed
|
|
77
|
+
**/
|
|
78
|
+
disallowExponents?: boolean,
|
|
72
79
|
/** The step attribute is a number that specifies the granularity that the value must adhere to, or the special value any.
|
|
73
80
|
* Only values which are equal to the basis for stepping (min if specified, value otherwise, and an
|
|
74
81
|
* appropriate default value if neither of those is provided) are valid. */
|
|
@@ -102,6 +109,8 @@ const Input_ = (props: InputProps, ref): React.Node => {
|
|
|
102
109
|
required,
|
|
103
110
|
readOnly,
|
|
104
111
|
boxRef,
|
|
112
|
+
onKeyDown,
|
|
113
|
+
disallowExponents,
|
|
105
114
|
...inputProps
|
|
106
115
|
} = props;
|
|
107
116
|
|
|
@@ -121,6 +130,16 @@ const Input_ = (props: InputProps, ref): React.Node => {
|
|
|
121
130
|
onIconRightClick && onIconRightClick(e);
|
|
122
131
|
};
|
|
123
132
|
|
|
133
|
+
const handleKeyDown = (e: SyntheticKeyboardEvent<HTMLInputElement>) => {
|
|
134
|
+
if (type === INPUT_TYPES.number && disallowExponents) {
|
|
135
|
+
if (EXPONENT_CHARACTER_LIST.includes(e.key)) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
onKeyDown?.(e);
|
|
141
|
+
};
|
|
142
|
+
|
|
124
143
|
return (
|
|
125
144
|
<div
|
|
126
145
|
className={classify(css.wrapper, {
|
|
@@ -173,6 +192,7 @@ const Input_ = (props: InputProps, ref): React.Node => {
|
|
|
173
192
|
onBlur={onBlur}
|
|
174
193
|
type={showPassword ? 'text' : type}
|
|
175
194
|
readOnly={readOnly && 'readOnly'}
|
|
195
|
+
onKeyDown={handleKeyDown}
|
|
176
196
|
/>
|
|
177
197
|
{type === 'color' && (
|
|
178
198
|
<div
|
|
@@ -27,6 +27,7 @@ const RenderOption = _ref => {
|
|
|
27
27
|
groupTitleOptions,
|
|
28
28
|
classNames,
|
|
29
29
|
searchText = '',
|
|
30
|
+
showResultText = true,
|
|
30
31
|
...restProps
|
|
31
32
|
} = _ref;
|
|
32
33
|
const {
|
|
@@ -46,7 +47,7 @@ const RenderOption = _ref => {
|
|
|
46
47
|
menuHeight,
|
|
47
48
|
itemHeight
|
|
48
49
|
} = virtualization;
|
|
49
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && showResultText && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
50
51
|
className: _MenuModule.default.filterOptionsResultText,
|
|
51
52
|
color: "tertiary"
|
|
52
53
|
}, resultText), virtualization && isVirtualizationEnabled ? /*#__PURE__*/React.createElement(_reactWindow.FixedSizeList, {
|
|
@@ -80,7 +81,7 @@ const RenderOption = _ref => {
|
|
|
80
81
|
if (composeOptions && Array.isArray(composeOptions) && composeOptions.length) {
|
|
81
82
|
const optionsFiltered = !allowSearch ? composeOptions : (0, _menu.getFilteredComposeOptionsFromSearchText)(composeOptions, searchText);
|
|
82
83
|
const resultText = !allowSearch ? '' : (0, _menu.getFilteredComposeOptionsResultText)(optionsFiltered);
|
|
83
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && showResultText && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
84
85
|
className: _MenuModule.default.filterOptionsResultText,
|
|
85
86
|
color: "tertiary"
|
|
86
87
|
}, resultText), optionsFiltered.map((composeMenuOptions, index) =>
|
|
@@ -101,7 +102,7 @@ const RenderOption = _ref => {
|
|
|
101
102
|
if (groupTitleOptions && Array.isArray(groupTitleOptions) && groupTitleOptions.length) {
|
|
102
103
|
const optionsFiltered = !allowSearch ? groupTitleOptions : (0, _menu.getFilteredGroupTitleOptionsFromSearchText)(groupTitleOptions, searchText);
|
|
103
104
|
const resultText = !allowSearch ? '' : (0, _menu.getFilteredGroupTitleOptionsResultText)(optionsFiltered);
|
|
104
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
105
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, allowSearch && showResultText && /*#__PURE__*/React.createElement(_Text.FormLabelSmall, {
|
|
105
106
|
className: _MenuModule.default.filterOptionsResultText,
|
|
106
107
|
color: "tertiary"
|
|
107
108
|
}, resultText), optionsFiltered.map((optionsGroup, index) =>
|
|
@@ -163,7 +164,7 @@ const Menu = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
163
164
|
},
|
|
164
165
|
ref: ref
|
|
165
166
|
}, hasHeader && /*#__PURE__*/React.createElement("div", {
|
|
166
|
-
className: _MenuModule.default.menuHeader
|
|
167
|
+
className: (0, _classify.classify)(_MenuModule.default.menuHeader, classNames?.header)
|
|
167
168
|
}, header), allowSearch && /*#__PURE__*/React.createElement(_SearchInput.SearchInput, {
|
|
168
169
|
value: searchText,
|
|
169
170
|
onChange: e => setSearchText(e.target.value),
|
|
@@ -172,7 +173,7 @@ const Menu = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
172
173
|
}), /*#__PURE__*/React.createElement(RenderOption, _extends({}, props, {
|
|
173
174
|
searchText: searchText
|
|
174
175
|
})), hasFooter && /*#__PURE__*/React.createElement("div", {
|
|
175
|
-
className: _MenuModule.default.menuFooter
|
|
176
|
+
className: (0, _classify.classify)(_MenuModule.default.menuFooter, classNames?.footer)
|
|
176
177
|
}, footer));
|
|
177
178
|
});
|
|
178
179
|
exports.Menu = Menu;
|
|
@@ -75,6 +75,7 @@ export type BaseMenuProps = {
|
|
|
75
75
|
virtualization?: Virtualization,
|
|
76
76
|
header?: React.Node,
|
|
77
77
|
footer?: React.Node,
|
|
78
|
+
showResultText?: boolean,
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export type MenuOptionTypes = {
|
|
@@ -114,6 +115,7 @@ const RenderOption = ({
|
|
|
114
115
|
groupTitleOptions,
|
|
115
116
|
classNames,
|
|
116
117
|
searchText = '',
|
|
118
|
+
showResultText = true,
|
|
117
119
|
...restProps
|
|
118
120
|
}: RenderOptionProps): React.Node => {
|
|
119
121
|
const {
|
|
@@ -141,7 +143,7 @@ const RenderOption = ({
|
|
|
141
143
|
|
|
142
144
|
return (
|
|
143
145
|
<>
|
|
144
|
-
{allowSearch && (
|
|
146
|
+
{allowSearch && showResultText && (
|
|
145
147
|
<FormLabelSmall
|
|
146
148
|
className={css.filterOptionsResultText}
|
|
147
149
|
color="tertiary"
|
|
@@ -204,7 +206,7 @@ const RenderOption = ({
|
|
|
204
206
|
|
|
205
207
|
return (
|
|
206
208
|
<>
|
|
207
|
-
{allowSearch && (
|
|
209
|
+
{allowSearch && showResultText && (
|
|
208
210
|
<FormLabelSmall
|
|
209
211
|
className={css.filterOptionsResultText}
|
|
210
212
|
color="tertiary"
|
|
@@ -250,7 +252,7 @@ const RenderOption = ({
|
|
|
250
252
|
|
|
251
253
|
return (
|
|
252
254
|
<>
|
|
253
|
-
{allowSearch && (
|
|
255
|
+
{allowSearch && showResultText && (
|
|
254
256
|
<FormLabelSmall
|
|
255
257
|
className={css.filterOptionsResultText}
|
|
256
258
|
color="tertiary"
|
|
@@ -348,7 +350,11 @@ export const Menu: React$AbstractComponent<MenuProps, HTMLDivElement> =
|
|
|
348
350
|
}}
|
|
349
351
|
ref={ref}
|
|
350
352
|
>
|
|
351
|
-
{hasHeader &&
|
|
353
|
+
{hasHeader && (
|
|
354
|
+
<div className={classify(css.menuHeader, classNames?.header)}>
|
|
355
|
+
{header}
|
|
356
|
+
</div>
|
|
357
|
+
)}
|
|
352
358
|
{allowSearch && (
|
|
353
359
|
<SearchInput
|
|
354
360
|
value={searchText}
|
|
@@ -358,7 +364,11 @@ export const Menu: React$AbstractComponent<MenuProps, HTMLDivElement> =
|
|
|
358
364
|
/>
|
|
359
365
|
)}
|
|
360
366
|
<RenderOption {...props} searchText={searchText} />
|
|
361
|
-
{hasFooter &&
|
|
367
|
+
{hasFooter && (
|
|
368
|
+
<div className={classify(css.menuFooter, classNames?.footer)}>
|
|
369
|
+
{footer}
|
|
370
|
+
</div>
|
|
371
|
+
)}
|
|
362
372
|
</div>
|
|
363
373
|
);
|
|
364
374
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import {DATE_RANGE_PICKER_ERRORS} from '../utils/date-range-picker';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export type TimeUnit = 'years' | 'months' | 'days' | 'd' | 'M' | 'y';
|
|
7
|
+
export type DateRange = {startDate?: ?string, endDate?: ?string};
|
|
8
|
+
export type DateRangePickerErrorTypes = $Keys<typeof DATE_RANGE_PICKER_ERRORS>;
|
|
9
|
+
export type DateRangePickerError = {
|
|
10
|
+
type: string,
|
|
11
|
+
description: string,
|
|
12
|
+
};
|
|
13
|
+
export type DateRangeWithTimezone = {|
|
|
14
|
+
...DateRange,
|
|
15
|
+
startDateUTC?: ?string,
|
|
16
|
+
endDateUTC?: ?string,
|
|
17
|
+
timezone?: string,
|
|
18
|
+
|};
|
package/lib/types/index.js
CHANGED
|
@@ -25,6 +25,17 @@ Object.keys(_common).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _dateRangePicker = require("./date-range-picker");
|
|
29
|
+
Object.keys(_dateRangePicker).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _dateRangePicker[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _dateRangePicker[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
var _menu = require("./menu");
|
|
29
40
|
Object.keys(_menu).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
package/lib/types/index.js.flow
CHANGED