orcs-design-system 3.2.4 → 3.2.6
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/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- package/package.json +29 -38
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import React, { useState } from "react";
|
|
3
2
|
import DatePicker from ".";
|
|
4
3
|
import Box from "../Box";
|
|
5
4
|
import Spacer from "../Spacer";
|
|
6
5
|
import "react-dates/lib/css/_datepicker.css";
|
|
7
6
|
import "react-dates/initialize";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
export default {
|
|
9
9
|
title: "Components/DatePicker",
|
|
10
|
-
decorators: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}],
|
|
10
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
11
|
+
bg: "greyLightest",
|
|
12
|
+
height: "400px",
|
|
13
|
+
p: "r",
|
|
14
|
+
children: storyFn()
|
|
15
|
+
})],
|
|
17
16
|
component: DatePicker
|
|
18
17
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setDate = _useState2[1];
|
|
24
|
-
var _useState3 = useState(false),
|
|
25
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
-
focused = _useState4[0],
|
|
27
|
-
setFocused = _useState4[1];
|
|
28
|
-
var onDateChange = function onDateChange(selectedDate) {
|
|
18
|
+
const SingleDate = () => {
|
|
19
|
+
const [date, setDate] = useState(null);
|
|
20
|
+
const [focused, setFocused] = useState(false);
|
|
21
|
+
const onDateChange = selectedDate => {
|
|
29
22
|
setDate(selectedDate);
|
|
30
23
|
};
|
|
31
|
-
|
|
24
|
+
const onFocusChange = el => {
|
|
32
25
|
setFocused(el.focused);
|
|
33
26
|
};
|
|
34
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/_jsx(DatePicker, {
|
|
35
28
|
single: true,
|
|
36
29
|
date: date,
|
|
37
30
|
placeholder: "Date",
|
|
@@ -42,54 +35,46 @@ var SingleDate = function SingleDate() {
|
|
|
42
35
|
displayFormat: "DD/MM/YYYY"
|
|
43
36
|
});
|
|
44
37
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
setDate = _useState6[1];
|
|
50
|
-
var _useState7 = useState(false),
|
|
51
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
52
|
-
focused = _useState8[0],
|
|
53
|
-
setFocused = _useState8[1];
|
|
54
|
-
var onDateChange = function onDateChange(selectedDate) {
|
|
38
|
+
const InvalidRequiredDate = () => {
|
|
39
|
+
const [date, setDate] = useState(null);
|
|
40
|
+
const [focused, setFocused] = useState(false);
|
|
41
|
+
const onDateChange = selectedDate => {
|
|
55
42
|
setDate(selectedDate);
|
|
56
43
|
};
|
|
57
|
-
|
|
44
|
+
const onFocusChange = el => {
|
|
58
45
|
setFocused(el.focused);
|
|
59
46
|
};
|
|
60
|
-
return /*#__PURE__*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
47
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
48
|
+
children: /*#__PURE__*/_jsx(DatePicker, {
|
|
49
|
+
id: "invalid date",
|
|
50
|
+
single: true,
|
|
51
|
+
label: "Project start date - date required",
|
|
52
|
+
required: true,
|
|
53
|
+
date: date,
|
|
54
|
+
invalid: true,
|
|
55
|
+
placeholder: "Date",
|
|
56
|
+
focused: focused,
|
|
57
|
+
onDateChange: onDateChange,
|
|
58
|
+
onFocusChange: onFocusChange,
|
|
59
|
+
numberOfMonths: 1,
|
|
60
|
+
displayFormat: "DD/MM/YYYY"
|
|
61
|
+
})
|
|
62
|
+
});
|
|
74
63
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setFocused = _useState12[1];
|
|
84
|
-
var onDatesChange = function onDatesChange(_ref) {
|
|
85
|
-
var startDate = _ref.startDate,
|
|
86
|
-
endDate = _ref.endDate;
|
|
64
|
+
const DateRange = () => {
|
|
65
|
+
const [dates, setDates] = useState({});
|
|
66
|
+
const [focused, setFocused] = useState(null);
|
|
67
|
+
const onDatesChange = _ref => {
|
|
68
|
+
let {
|
|
69
|
+
startDate,
|
|
70
|
+
endDate
|
|
71
|
+
} = _ref;
|
|
87
72
|
setDates({
|
|
88
|
-
startDate
|
|
89
|
-
endDate
|
|
73
|
+
startDate,
|
|
74
|
+
endDate
|
|
90
75
|
});
|
|
91
76
|
};
|
|
92
|
-
return /*#__PURE__*/
|
|
77
|
+
return /*#__PURE__*/_jsx(DatePicker, {
|
|
93
78
|
range: true,
|
|
94
79
|
startDate: dates.startDate,
|
|
95
80
|
endDate: dates.endDate,
|
|
@@ -99,73 +84,56 @@ var DateRange = function DateRange() {
|
|
|
99
84
|
displayFormat: "DD/MM/YYYY"
|
|
100
85
|
});
|
|
101
86
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
113
|
-
focused1 = _useState18[0],
|
|
114
|
-
setFocused1 = _useState18[1];
|
|
115
|
-
var _useState19 = useState(null),
|
|
116
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
117
|
-
focused2 = _useState20[0],
|
|
118
|
-
setFocused2 = _useState20[1];
|
|
119
|
-
var onDatesChange = function onDatesChange(_ref2) {
|
|
120
|
-
var startDate = _ref2.startDate,
|
|
121
|
-
endDate = _ref2.endDate;
|
|
87
|
+
const ShowClearDates = () => {
|
|
88
|
+
const [date, setDate] = useState(null);
|
|
89
|
+
const [dates, setDates] = useState({});
|
|
90
|
+
const [focused1, setFocused1] = useState(null);
|
|
91
|
+
const [focused2, setFocused2] = useState(null);
|
|
92
|
+
const onDatesChange = _ref2 => {
|
|
93
|
+
let {
|
|
94
|
+
startDate,
|
|
95
|
+
endDate
|
|
96
|
+
} = _ref2;
|
|
122
97
|
setDates({
|
|
123
|
-
startDate
|
|
124
|
-
endDate
|
|
98
|
+
startDate,
|
|
99
|
+
endDate
|
|
125
100
|
});
|
|
126
101
|
};
|
|
127
|
-
|
|
102
|
+
const onDateChange = selectedDate => {
|
|
128
103
|
setDate(selectedDate);
|
|
129
104
|
};
|
|
130
|
-
|
|
105
|
+
const onFocusChange = el => {
|
|
131
106
|
setFocused1(el.focused);
|
|
132
107
|
setFocused2(el.focused);
|
|
133
108
|
};
|
|
134
|
-
return /*#__PURE__*/
|
|
135
|
-
mb: "l"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
};
|
|
157
|
-
export var singleDate = function singleDate() {
|
|
158
|
-
return /*#__PURE__*/React.createElement(SingleDate, null);
|
|
159
|
-
};
|
|
160
|
-
export var invalidRequiredDate = function invalidRequiredDate() {
|
|
161
|
-
return /*#__PURE__*/React.createElement(InvalidRequiredDate, null);
|
|
162
|
-
};
|
|
163
|
-
export var dateRange = function dateRange() {
|
|
164
|
-
return /*#__PURE__*/React.createElement(DateRange, null);
|
|
165
|
-
};
|
|
166
|
-
export var showClearDates = function showClearDates() {
|
|
167
|
-
return /*#__PURE__*/React.createElement(ShowClearDates, null);
|
|
109
|
+
return /*#__PURE__*/_jsxs(Spacer, {
|
|
110
|
+
mb: "l",
|
|
111
|
+
children: [/*#__PURE__*/_jsx(DatePicker, {
|
|
112
|
+
single: true,
|
|
113
|
+
showClearDate: true,
|
|
114
|
+
date: date,
|
|
115
|
+
placeholder: "Date",
|
|
116
|
+
focused: focused1,
|
|
117
|
+
onDateChange: onDateChange,
|
|
118
|
+
onFocusChange: onFocusChange,
|
|
119
|
+
numberOfMonths: 1,
|
|
120
|
+
displayFormat: "DD/MM/YYYY"
|
|
121
|
+
}), /*#__PURE__*/_jsx(DatePicker, {
|
|
122
|
+
range: true,
|
|
123
|
+
showClearDates: true,
|
|
124
|
+
startDate: dates.startDate,
|
|
125
|
+
endDate: dates.endDate,
|
|
126
|
+
onDatesChange: onDatesChange,
|
|
127
|
+
focusedInput: focused2,
|
|
128
|
+
onFocusChange: setFocused2,
|
|
129
|
+
displayFormat: "DD/MM/YYYY"
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
168
132
|
};
|
|
133
|
+
export const singleDate = () => /*#__PURE__*/_jsx(SingleDate, {});
|
|
134
|
+
export const invalidRequiredDate = () => /*#__PURE__*/_jsx(InvalidRequiredDate, {});
|
|
135
|
+
export const dateRange = () => /*#__PURE__*/_jsx(DateRange, {});
|
|
136
|
+
export const showClearDates = () => /*#__PURE__*/_jsx(ShowClearDates, {});
|
|
169
137
|
singleDate.__docgenInfo = {
|
|
170
138
|
"description": "",
|
|
171
139
|
"methods": [],
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
var _excluded = ["single", "range", "width", "height", "zIndex", "invalid", "required", "label", "id", "startDateId", "boldLabel"];
|
|
10
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
13
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
1
|
import React from "react";
|
|
15
2
|
import PropTypes from "prop-types";
|
|
16
3
|
import momentPropTypes from "react-moment-proptypes";
|
|
@@ -24,7 +11,8 @@ import { themeGet } from "@styled-system/theme-get";
|
|
|
24
11
|
import DateRangePickerShape from "react-dates/lib/shapes/DateRangePickerShape";
|
|
25
12
|
import { DateRangePickerPhrases } from "react-dates/lib/defaultPhrases";
|
|
26
13
|
import { START_DATE, END_DATE, HORIZONTAL_ORIENTATION, ANCHOR_LEFT, NAV_POSITION_TOP } from "react-dates/lib/constants";
|
|
27
|
-
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
+
const defaultProps = {
|
|
28
16
|
autoFocus: false,
|
|
29
17
|
autoFocusEndDate: false,
|
|
30
18
|
initialStartDate: null,
|
|
@@ -62,197 +50,92 @@ var defaultProps = {
|
|
|
62
50
|
navPosition: NAV_POSITION_TOP,
|
|
63
51
|
navPrev: null,
|
|
64
52
|
navNext: null,
|
|
65
|
-
onPrevMonthClick
|
|
66
|
-
onNextMonthClick
|
|
67
|
-
onClose
|
|
53
|
+
onPrevMonthClick() {},
|
|
54
|
+
onNextMonthClick() {},
|
|
55
|
+
onClose() {},
|
|
68
56
|
// day presentation and interaction related props
|
|
69
57
|
renderCalendarDay: undefined,
|
|
70
58
|
renderDayContents: null,
|
|
71
59
|
minimumNights: 1,
|
|
72
60
|
enableOutsideDays: false,
|
|
73
|
-
isDayBlocked:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
isOutsideRange: function isOutsideRange() {
|
|
77
|
-
return false;
|
|
78
|
-
},
|
|
79
|
-
isDayHighlighted: function isDayHighlighted() {
|
|
80
|
-
return false;
|
|
81
|
-
},
|
|
61
|
+
isDayBlocked: () => false,
|
|
62
|
+
isOutsideRange: () => false,
|
|
63
|
+
isDayHighlighted: () => false,
|
|
82
64
|
displayFormat: "DD/MM/YYYY",
|
|
83
65
|
monthFormat: "MMMM YYYY",
|
|
84
66
|
phrases: DateRangePickerPhrases,
|
|
85
|
-
stateDateWrapper:
|
|
86
|
-
return date;
|
|
87
|
-
}
|
|
67
|
+
stateDateWrapper: date => date
|
|
88
68
|
};
|
|
89
|
-
|
|
69
|
+
const DatePickerLabel = styled.label.withConfig({
|
|
90
70
|
displayName: "DatePicker__DatePickerLabel",
|
|
91
71
|
componentId: "sc-15292wq-0"
|
|
92
|
-
})(["display:block;margin-bottom:", ";font-size:", ";font-weight:", ";color:", ";"], themeGet("space.xs"), themeGet("fontSizes.1"),
|
|
93
|
-
|
|
94
|
-
}, function (props) {
|
|
95
|
-
return props.invalid ? themeGet("colors.dangerDark") : themeGet("colors.greyDarkest");
|
|
96
|
-
});
|
|
97
|
-
var DatePickerContainer = styled.div.withConfig({
|
|
72
|
+
})(["display:block;margin-bottom:", ";font-size:", ";font-weight:", ";color:", ";"], themeGet("space.xs"), themeGet("fontSizes.1"), props => props.boldLabel ? themeGet("fontWeights.2") : themeGet("fontWeights.1"), props => props.invalid ? themeGet("colors.dangerDark") : themeGet("colors.greyDarkest"));
|
|
73
|
+
const DatePickerContainer = styled.div.withConfig({
|
|
98
74
|
displayName: "DatePicker__DatePickerContainer",
|
|
99
75
|
componentId: "sc-15292wq-1"
|
|
100
|
-
})([".SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.DateInput{width:", ";background:none;position:relative;}.DateRangePickerInput_arrow_svg path{fill:", ";}.DateRangePickerInput_arrow{display:none;}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input[disabled]{background:", ";color:", ";}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DateRangePickerInput .DateInput:first-child .DateInput_input{border-radius:", ";}.DateRangePickerInput .DateInput:last-child .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input__disabled{border-radius:", ";}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{padding-right:0;.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{display:none;}.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .SingleDatePickerInput_clearDate,.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .DateRangePickerInput_clearDates{display:flex;}}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{display:flex;align-items:center;.DateInput:first-child .DateInput_input:not([value=\"\"]){border-radius:", ";}}}.DateRangePickerInput__showClearDates{.DateInput:first-child .DateInput_input:not([value=\"\"]){border-radius:", ";}}}.DateRangePickerInput__showClearDates .DateInput:first-child:has(.DateInput_input:not([value=\"\"])) ~ .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput:first-child ~ .DateInput .DateInput_input:not([value=\"\"]){border-radius:0;}.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{background-color:", ";border-radius:", ";height:", ";display:flex;align-items:center;justify-content:center;margin:0;position:relative;top:auto;right:auto;transform:none;border:1px solid ", ";&:hover,&:focus{outline:0;border:1px solid ", ";svg path{fill:", ";}}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight:before,.DayPickerKeyboardShortcuts_show__topRight:before{border-right:33px solid ", ";transition:", ";}.DayPickerKeyboardShortcuts_show__bottomRight:hover:before,.DayPickerKeyboardShortcuts_show__topRight:hover:before{border-right:33px solid ", ";}.CalendarDay__selected_span,.CalendarDay__hovered_span,.CalendarDay__hovered_span:active{background:", ";border:1px solid ", ";color:", ";}.CalendarDay__hovered_span:hover,.CalendarDay__default:hover{background:", ";border:1px double ", ";color:", ";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:", ";border:1px solid ", ";}.DateInput_fang{margin-top:1px;z-index:", ";}"],
|
|
101
|
-
return props.width ? props.width : "110px";
|
|
102
|
-
}, function (props) {
|
|
103
|
-
return themeGet("colors.greyLight")(props);
|
|
104
|
-
}, function (props) {
|
|
105
|
-
return props.zIndex ? props.zIndex : "1";
|
|
106
|
-
}, function (props) {
|
|
107
|
-
return themeGet("fontSizes.2")(props);
|
|
108
|
-
}, function (props) {
|
|
109
|
-
return themeGet("fontWeights.1")(props);
|
|
110
|
-
}, function (props) {
|
|
111
|
-
return themeGet("transition.transitionDefault")(props);
|
|
112
|
-
}, function (props) {
|
|
113
|
-
return themeGet("colors.white")(props);
|
|
114
|
-
}, function (props) {
|
|
115
|
-
return themeGet("colors.greyDarkest")(props);
|
|
116
|
-
}, function (props) {
|
|
117
|
-
return props.height ? props.height : "40px";
|
|
118
|
-
}, function (props) {
|
|
119
|
-
return props.width ? props.width : "110px";
|
|
120
|
-
}, function (props) {
|
|
121
|
-
return themeGet("radii.2")(props);
|
|
122
|
-
}, function (props) {
|
|
123
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props);
|
|
124
|
-
}, function (props) {
|
|
125
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
126
|
-
}, function (props) {
|
|
127
|
-
return themeGet("shadows.thinOutline")(props);
|
|
128
|
-
}, function (props) {
|
|
129
|
-
return themeGet("colors.primary30")(props);
|
|
130
|
-
}, function (props) {
|
|
131
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
132
|
-
}, function (props) {
|
|
133
|
-
return themeGet("colors.grey")(props);
|
|
134
|
-
}, function (props) {
|
|
135
|
-
return themeGet("colors.greyLightest")(props);
|
|
136
|
-
}, function (props) {
|
|
137
|
-
return themeGet("colors.grey")(props);
|
|
138
|
-
}, function (props) {
|
|
139
|
-
return themeGet("shadows.thinOutline")(props);
|
|
140
|
-
}, function (props) {
|
|
141
|
-
return themeGet("colors.primary30")(props);
|
|
142
|
-
}, function (props) {
|
|
143
|
-
return themeGet("colors.primary")(props);
|
|
144
|
-
}, function (props) {
|
|
145
|
-
return "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props));
|
|
146
|
-
}, function (props) {
|
|
147
|
-
return "0 ".concat(themeGet("radii.2")(props), " ").concat(themeGet("radii.2")(props), " 0");
|
|
148
|
-
}, function (props) {
|
|
149
|
-
return "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props));
|
|
150
|
-
}, function (props) {
|
|
151
|
-
return "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props));
|
|
152
|
-
}, function (props) {
|
|
153
|
-
return themeGet("colors.greyLighter")(props);
|
|
154
|
-
}, function (props) {
|
|
155
|
-
return "0 ".concat(themeGet("radii.2")(props), " ").concat(themeGet("radii.2")(props), " 0");
|
|
156
|
-
}, function (props) {
|
|
157
|
-
return props.height ? props.height : "40px";
|
|
158
|
-
}, function (props) {
|
|
159
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props);
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
162
|
-
}, function (props) {
|
|
163
|
-
return props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props);
|
|
164
|
-
}, function (props) {
|
|
165
|
-
return themeGet("colors.greyDarkest")(props);
|
|
166
|
-
}, function (props) {
|
|
167
|
-
return themeGet("transition.transitionDefault")(props);
|
|
168
|
-
}, function (props) {
|
|
169
|
-
return themeGet("colors.primary")(props);
|
|
170
|
-
}, function (props) {
|
|
171
|
-
return themeGet("colors.primary")(props);
|
|
172
|
-
}, function (props) {
|
|
173
|
-
return themeGet("colors.primary")(props);
|
|
174
|
-
}, function (props) {
|
|
175
|
-
return themeGet("transition.transitionDefault")(props);
|
|
176
|
-
}, function (props) {
|
|
177
|
-
return themeGet("colors.primaryDark")(props);
|
|
178
|
-
}, function (props) {
|
|
179
|
-
return themeGet("colors.primaryLight")(props);
|
|
180
|
-
}, function (props) {
|
|
181
|
-
return themeGet("colors.primaryLight")(props);
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return themeGet("colors.white")(props);
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return themeGet("colors.primary")(props);
|
|
186
|
-
}, function (props) {
|
|
187
|
-
return themeGet("colors.primary")(props);
|
|
188
|
-
}, function (props) {
|
|
189
|
-
return themeGet("colors.white")(props);
|
|
190
|
-
}, function (props) {
|
|
191
|
-
return themeGet("colors.primaryDarker")(props);
|
|
192
|
-
}, function (props) {
|
|
193
|
-
return themeGet("colors.primaryDarker")(props);
|
|
194
|
-
}, function (props) {
|
|
195
|
-
return props.zIndex ? props.zIndex + 1 : "2";
|
|
196
|
-
});
|
|
76
|
+
})([".SingleDatePickerInput,.DateRangePickerInput{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;border:0;border-radius:0;background:transparent;}.SingleDatePickerInput__withBorder,.DateRangePickerInput__withBorder{border:none;border-radius:0;}.DateInput{width:", ";background:none;position:relative;}.DateRangePickerInput_arrow_svg path{fill:", ";}.DateRangePickerInput_arrow{display:none;}.SingleDatePicker_picker,.DateRangePicker_picker{background:none;z-index:", ";}.DateInput_input{display:block;cursor:text;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size:", ";font-weight:", ";z-index:1;transition:", ";background:", ";color:", ";height:", ";width:", ";padding:5px 12px 6px 12px;border-radius:", ";border:1px solid ", ";&:hover{border:1px solid ", ";}&:focus{outline:0;box-shadow:", " ", ";border:1px solid ", ";}&::placeholder{color:", ";}}.DateInput_input[disabled]{background:", ";color:", ";}.DateInput_input__focused{outline:0;box-shadow:", " ", ";border:1px solid ", ";}.DateRangePickerInput .DateInput:first-child .DateInput_input{border-radius:", ";}.DateRangePickerInput .DateInput:last-child .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput .DateInput_input__disabled{border-radius:", ";}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{padding-right:0;.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{display:none;}.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .SingleDatePickerInput_clearDate,.DateInput:has(.DateInput_input:not([value=\"\"])) ~ .DateRangePickerInput_clearDates{display:flex;}}.SingleDatePickerInput__showClearDate,.DateRangePickerInput__showClearDates{display:flex;align-items:center;.DateInput:first-child .DateInput_input:not([value=\"\"]){border-radius:", ";}}}.DateRangePickerInput__showClearDates{.DateInput:first-child .DateInput_input:not([value=\"\"]){border-radius:", ";}}}.DateRangePickerInput__showClearDates .DateInput:first-child:has(.DateInput_input:not([value=\"\"])) ~ .DateInput .DateInput_input,.DateRangePickerInput__showClearDates .DateInput:first-child ~ .DateInput .DateInput_input:not([value=\"\"]){border-radius:0;}.SingleDatePickerInput_clearDate,.DateRangePickerInput_clearDates{background-color:", ";border-radius:", ";height:", ";display:flex;align-items:center;justify-content:center;margin:0;position:relative;top:auto;right:auto;transform:none;border:1px solid ", ";&:hover,&:focus{outline:0;border:1px solid ", ";svg path{fill:", ";}}.DayPickerKeyboardShortcuts_panel{color:", ";}.CalendarDay__default{transition:", ";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:", ";border:1px solid ", ";}.DayPickerKeyboardShortcuts_show__bottomRight{border-radius:0 0 3px 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__topRight{border-radius:0 3px 0 0;overflow:hidden;}.DayPickerKeyboardShortcuts_show__bottomRight:before,.DayPickerKeyboardShortcuts_show__topRight:before{border-right:33px solid ", ";transition:", ";}.DayPickerKeyboardShortcuts_show__bottomRight:hover:before,.DayPickerKeyboardShortcuts_show__topRight:hover:before{border-right:33px solid ", ";}.CalendarDay__selected_span,.CalendarDay__hovered_span,.CalendarDay__hovered_span:active{background:", ";border:1px solid ", ";color:", ";}.CalendarDay__hovered_span:hover,.CalendarDay__default:hover{background:", ";border:1px double ", ";color:", ";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:", ";border:1px solid ", ";}.DateInput_fang{margin-top:1px;z-index:", ";}"], props => props.width ? props.width : "110px", props => themeGet("colors.greyLight")(props), props => props.zIndex ? props.zIndex : "1", props => themeGet("fontSizes.2")(props), props => themeGet("fontWeights.1")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.white")(props), props => themeGet("colors.greyDarkest")(props), props => props.height ? props.height : "40px", props => props.width ? props.width : "110px", props => themeGet("radii.2")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("colors.grey")(props), props => themeGet("colors.greyLightest")(props), props => themeGet("colors.grey")(props), props => themeGet("shadows.thinOutline")(props), props => themeGet("colors.primary30")(props), props => themeGet("colors.primary")(props), props => "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props)), props => "0 ".concat(themeGet("radii.2")(props), " ").concat(themeGet("radii.2")(props), " 0"), props => "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props)), props => "".concat(themeGet("radii.2")(props), " 0 0 ").concat(themeGet("radii.2")(props)), props => themeGet("colors.greyLighter")(props), props => "0 ".concat(themeGet("radii.2")(props), " ").concat(themeGet("radii.2")(props), " 0"), props => props.height ? props.height : "40px", props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.black30")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => props.invalid ? themeGet("colors.danger")(props) : themeGet("colors.primary")(props), props => themeGet("colors.greyDarkest")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primaryDark")(props), props => themeGet("colors.primaryLight")(props), props => themeGet("colors.primaryLight")(props), props => themeGet("colors.white")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.primary")(props), props => themeGet("colors.white")(props), props => themeGet("colors.primaryDarker")(props), props => themeGet("colors.primaryDarker")(props), props => props.zIndex ? props.zIndex + 1 : "2");
|
|
197
77
|
|
|
198
78
|
/**
|
|
199
79
|
*
|
|
200
80
|
* Datepicker uses airbnb's react datepicker under the hood. This is just a wrapper to override styles, the only props you need to specify is either single or range. For all functionality and additional required props refer to documentation here: <https://github.com/airbnb/react-dates>
|
|
201
81
|
*/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
82
|
+
|
|
83
|
+
class DatePicker extends React.Component {
|
|
84
|
+
render() {
|
|
85
|
+
const {
|
|
86
|
+
single,
|
|
87
|
+
range,
|
|
88
|
+
width,
|
|
89
|
+
height,
|
|
90
|
+
zIndex,
|
|
91
|
+
invalid,
|
|
92
|
+
required,
|
|
93
|
+
label,
|
|
94
|
+
id,
|
|
95
|
+
startDateId,
|
|
96
|
+
boldLabel,
|
|
97
|
+
...pickerProps
|
|
98
|
+
} = this.props;
|
|
99
|
+
return /*#__PURE__*/_jsx(DatePickerContainer, {
|
|
100
|
+
width: width,
|
|
101
|
+
height: height,
|
|
102
|
+
invalid: invalid,
|
|
103
|
+
zIndex: zIndex,
|
|
104
|
+
required: required,
|
|
105
|
+
children: single ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
106
|
+
children: [label && /*#__PURE__*/_jsxs(DatePickerLabel, {
|
|
107
|
+
htmlFor: id,
|
|
108
|
+
invalid: invalid,
|
|
109
|
+
boldLabel: boldLabel,
|
|
110
|
+
children: [label, required && /*#__PURE__*/_jsx(Small, {
|
|
111
|
+
color: "danger",
|
|
112
|
+
ml: "xs",
|
|
113
|
+
children: "*"
|
|
114
|
+
})]
|
|
115
|
+
}), /*#__PURE__*/_jsx(SingleDatePicker, {
|
|
116
|
+
id: id,
|
|
117
|
+
...pickerProps
|
|
118
|
+
})]
|
|
119
|
+
}) : range ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
120
|
+
children: [label && /*#__PURE__*/_jsxs(DatePickerLabel, {
|
|
121
|
+
htmlFor: startDateId,
|
|
122
|
+
invalid: invalid,
|
|
123
|
+
boldLabel: boldLabel,
|
|
124
|
+
children: [label, required && /*#__PURE__*/_jsx(Small, {
|
|
125
|
+
color: "danger",
|
|
126
|
+
ml: "xs",
|
|
127
|
+
children: "*"
|
|
128
|
+
})]
|
|
129
|
+
}), /*#__PURE__*/_jsx(DateRangePicker, {
|
|
130
|
+
id: id,
|
|
131
|
+
...pickerProps
|
|
132
|
+
})]
|
|
133
|
+
}) : null
|
|
134
|
+
});
|
|
208
135
|
}
|
|
209
|
-
|
|
210
|
-
key: "render",
|
|
211
|
-
value: function render() {
|
|
212
|
-
var _this$props = this.props,
|
|
213
|
-
single = _this$props.single,
|
|
214
|
-
range = _this$props.range,
|
|
215
|
-
width = _this$props.width,
|
|
216
|
-
height = _this$props.height,
|
|
217
|
-
zIndex = _this$props.zIndex,
|
|
218
|
-
invalid = _this$props.invalid,
|
|
219
|
-
required = _this$props.required,
|
|
220
|
-
label = _this$props.label,
|
|
221
|
-
id = _this$props.id,
|
|
222
|
-
startDateId = _this$props.startDateId,
|
|
223
|
-
boldLabel = _this$props.boldLabel,
|
|
224
|
-
pickerProps = _objectWithoutProperties(_this$props, _excluded);
|
|
225
|
-
return /*#__PURE__*/React.createElement(DatePickerContainer, {
|
|
226
|
-
width: width,
|
|
227
|
-
height: height,
|
|
228
|
-
invalid: invalid,
|
|
229
|
-
zIndex: zIndex,
|
|
230
|
-
required: required
|
|
231
|
-
}, single ? /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(DatePickerLabel, {
|
|
232
|
-
htmlFor: id,
|
|
233
|
-
invalid: invalid,
|
|
234
|
-
boldLabel: boldLabel
|
|
235
|
-
}, label, required && /*#__PURE__*/React.createElement(Small, {
|
|
236
|
-
color: "danger",
|
|
237
|
-
ml: "xs"
|
|
238
|
-
}, "*")), /*#__PURE__*/React.createElement(SingleDatePicker, _extends({
|
|
239
|
-
id: id
|
|
240
|
-
}, pickerProps))) : range ? /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(DatePickerLabel, {
|
|
241
|
-
htmlFor: startDateId,
|
|
242
|
-
invalid: invalid,
|
|
243
|
-
boldLabel: boldLabel
|
|
244
|
-
}, label, required && /*#__PURE__*/React.createElement(Small, {
|
|
245
|
-
color: "danger",
|
|
246
|
-
ml: "xs"
|
|
247
|
-
}, "*")), /*#__PURE__*/React.createElement(DateRangePicker, _extends({
|
|
248
|
-
id: id
|
|
249
|
-
}, pickerProps))) : null);
|
|
250
|
-
}
|
|
251
|
-
}]);
|
|
252
|
-
return DatePicker;
|
|
253
|
-
}(React.Component);
|
|
136
|
+
}
|
|
254
137
|
DatePicker.defaultProps = defaultProps;
|
|
255
|
-
DatePicker.propTypes =
|
|
138
|
+
DatePicker.propTypes = {
|
|
256
139
|
/** Specifies a single date picker */
|
|
257
140
|
single: PropTypes.bool,
|
|
258
141
|
/** Specifies a range date picker */
|
|
@@ -289,8 +172,9 @@ DatePicker.propTypes = _objectSpread({
|
|
|
289
172
|
autoFocusEndDate: PropTypes.bool,
|
|
290
173
|
stateDateWrapper: PropTypes.func,
|
|
291
174
|
initialStartDate: momentPropTypes.momentObj,
|
|
292
|
-
initialEndDate: momentPropTypes.momentObj
|
|
293
|
-
|
|
175
|
+
initialEndDate: momentPropTypes.momentObj,
|
|
176
|
+
...omit(DateRangePickerShape, ["startDate", "endDate", "onDatesChange", "focusedInput", "onFocusChange"])
|
|
177
|
+
};
|
|
294
178
|
|
|
295
179
|
/**
|
|
296
180
|
* Test description
|