@instructure/ui-date-input 8.18.0 → 8.18.1-snapshot.12
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/LICENSE.md +27 -0
- package/es/DateInput/index.js +98 -108
- package/es/DateInput/props.js +0 -148
- package/es/DateInput/styles.js +3 -4
- package/lib/DateInput/index.js +101 -109
- package/lib/DateInput/props.js +0 -148
- package/lib/DateInput/styles.js +3 -4
- package/package.json +18 -17
- package/src/DateInput/index.tsx +62 -103
- package/src/DateInput/props.ts +78 -75
- package/src/DateInput/styles.ts +3 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateInput/index.d.ts +61 -70
- package/types/DateInput/index.d.ts.map +1 -1
- package/types/DateInput/props.d.ts +141 -18
- package/types/DateInput/props.d.ts.map +1 -1
- package/types/DateInput/styles.d.ts +3 -4
- package/types/DateInput/styles.d.ts.map +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/es/DateInput/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var _dec, _dec2, _class, _class2, _temp, _IconCalendarMonthLin;
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/** @jsx jsx */
|
|
32
|
-
import { Children, Component } from 'react';
|
|
32
|
+
import React, { Children, Component } from 'react';
|
|
33
33
|
import { Calendar } from '@instructure/ui-calendar';
|
|
34
34
|
import { IconCalendarMonthLine } from '@instructure/ui-icons';
|
|
35
35
|
import { Popover } from '@instructure/ui-popover';
|
|
@@ -46,6 +46,9 @@ import { propTypes, allowedProps } from './props';
|
|
|
46
46
|
---
|
|
47
47
|
category: components
|
|
48
48
|
---
|
|
49
|
+
The `DateInput` component provides a visual interface for inputting date data.
|
|
50
|
+
See <https://instructure.design/#DateInput/>
|
|
51
|
+
@tsProps
|
|
49
52
|
**/
|
|
50
53
|
let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class DateInput extends Component {
|
|
51
54
|
constructor() {
|
|
@@ -67,70 +70,76 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
this.handleInputRef = el => {
|
|
70
|
-
|
|
71
|
-
const hasInputRef = this.state.hasInputRef; // Ensures that we position the Calendar with respect to the input correctly
|
|
72
|
-
// if the Calendar is open on mount
|
|
73
|
+
var _this$props$inputRef, _this$props;
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
// Ensures that we position the Calendar with respect to the input correctly
|
|
76
|
+
// if the Calendar is open on mount
|
|
77
|
+
if (!this.state.hasInputRef) {
|
|
75
78
|
this.setState({
|
|
76
79
|
hasInputRef: true
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
this._input = el;
|
|
81
|
-
inputRef(el);
|
|
84
|
+
(_this$props$inputRef = (_this$props = this.props).inputRef) === null || _this$props$inputRef === void 0 ? void 0 : _this$props$inputRef.call(_this$props, el);
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
this.handleInputChange = (event, value) => {
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
var _this$props$onChange, _this$props2;
|
|
89
|
+
|
|
90
|
+
(_this$props$onChange = (_this$props2 = this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props2, event, {
|
|
87
91
|
value
|
|
88
92
|
});
|
|
89
93
|
this.handleShowCalendar(event);
|
|
90
94
|
};
|
|
91
95
|
|
|
92
96
|
this.handleShowCalendar = event => {
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
if (this.interaction === 'enabled') {
|
|
98
|
+
var _this$props$onRequest, _this$props3;
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
onRequestShowCalendar(event);
|
|
100
|
+
(_this$props$onRequest = (_this$props3 = this.props).onRequestShowCalendar) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props3, event);
|
|
98
101
|
}
|
|
99
102
|
};
|
|
100
103
|
|
|
101
104
|
this.handleHideCalendar = event => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
onRequestHideCalendar(event);
|
|
105
|
+
var _this$props$onRequest2, _this$props4, _this$props$onRequest3, _this$props5;
|
|
106
|
+
|
|
107
|
+
(_this$props$onRequest2 = (_this$props4 = this.props).onRequestValidateDate) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props4, event);
|
|
108
|
+
(_this$props$onRequest3 = (_this$props5 = this.props).onRequestHideCalendar) === null || _this$props$onRequest3 === void 0 ? void 0 : _this$props$onRequest3.call(_this$props5, event);
|
|
107
109
|
};
|
|
108
110
|
|
|
109
111
|
this.handleHighlightOption = (event, _ref) => {
|
|
110
112
|
let direction = _ref.direction;
|
|
111
|
-
const _this$
|
|
112
|
-
onRequestSelectNextDay = _this$
|
|
113
|
-
onRequestSelectPrevDay = _this$
|
|
114
|
-
if (direction === -1) onRequestSelectPrevDay(event);
|
|
115
|
-
if (direction === 1) onRequestSelectNextDay(event);
|
|
113
|
+
const _this$props6 = this.props,
|
|
114
|
+
onRequestSelectNextDay = _this$props6.onRequestSelectNextDay,
|
|
115
|
+
onRequestSelectPrevDay = _this$props6.onRequestSelectPrevDay;
|
|
116
|
+
if (direction === -1) onRequestSelectPrevDay === null || onRequestSelectPrevDay === void 0 ? void 0 : onRequestSelectPrevDay(event);
|
|
117
|
+
if (direction === 1) onRequestSelectNextDay === null || onRequestSelectNextDay === void 0 ? void 0 : onRequestSelectNextDay(event);
|
|
116
118
|
};
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
componentDidMount() {
|
|
120
|
-
|
|
122
|
+
var _this$props$makeStyle, _this$props7;
|
|
123
|
+
|
|
124
|
+
(_this$props$makeStyle = (_this$props7 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props7);
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
componentDidUpdate() {
|
|
124
|
-
|
|
128
|
+
var _this$props$makeStyle2, _this$props8;
|
|
129
|
+
|
|
130
|
+
(_this$props$makeStyle2 = (_this$props8 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props8);
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
get selectedDateId() {
|
|
128
134
|
let selectedDateId;
|
|
129
135
|
Children.toArray(this.props.children).forEach(day => {
|
|
130
|
-
const
|
|
131
|
-
date =
|
|
132
|
-
isSelected =
|
|
133
|
-
|
|
136
|
+
const _props = day.props,
|
|
137
|
+
date = _props.date,
|
|
138
|
+
isSelected = _props.isSelected;
|
|
139
|
+
|
|
140
|
+
if (isSelected) {
|
|
141
|
+
selectedDateId = this.formatDateId(date);
|
|
142
|
+
}
|
|
134
143
|
});
|
|
135
144
|
return selectedDateId;
|
|
136
145
|
}
|
|
@@ -143,43 +152,42 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
143
152
|
|
|
144
153
|
renderMonthNavigationButton() {
|
|
145
154
|
let type = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'prev';
|
|
146
|
-
const _this$
|
|
147
|
-
renderPrevMonthButton = _this$
|
|
148
|
-
renderNextMonthButton = _this$
|
|
155
|
+
const _this$props9 = this.props,
|
|
156
|
+
renderPrevMonthButton = _this$props9.renderPrevMonthButton,
|
|
157
|
+
renderNextMonthButton = _this$props9.renderNextMonthButton;
|
|
149
158
|
const button = type === 'prev' ? renderPrevMonthButton : renderNextMonthButton;
|
|
150
159
|
return button && safeCloneElement(callRenderProp(button), {
|
|
151
160
|
tabIndex: -1
|
|
152
161
|
});
|
|
153
162
|
}
|
|
154
163
|
|
|
155
|
-
renderDays(
|
|
156
|
-
let getOptionProps = _ref2.getOptionProps;
|
|
164
|
+
renderDays(getOptionProps) {
|
|
157
165
|
const children = this.props.children;
|
|
158
166
|
return Children.map(children, day => {
|
|
159
|
-
const _day$
|
|
160
|
-
date = _day$
|
|
161
|
-
isOutsideMonth = _day$
|
|
162
|
-
|
|
167
|
+
const _day$props = day.props,
|
|
168
|
+
date = _day$props.date,
|
|
169
|
+
isOutsideMonth = _day$props.isOutsideMonth;
|
|
170
|
+
const props = {
|
|
163
171
|
tabIndex: -1,
|
|
164
172
|
id: this.formatDateId(date)
|
|
165
173
|
};
|
|
166
174
|
const optionProps = getOptionProps(props);
|
|
167
|
-
|
|
175
|
+
const propsAdded = isOutsideMonth ? { ...props,
|
|
168
176
|
onClick: optionProps.onClick,
|
|
169
177
|
role: 'presentation'
|
|
170
178
|
} : optionProps;
|
|
171
|
-
return safeCloneElement(day,
|
|
179
|
+
return safeCloneElement(day, propsAdded);
|
|
172
180
|
});
|
|
173
181
|
}
|
|
174
182
|
|
|
175
|
-
renderCalendar(
|
|
176
|
-
let getListProps =
|
|
177
|
-
getOptionProps =
|
|
178
|
-
const _this$
|
|
179
|
-
onRequestRenderNextMonth = _this$
|
|
180
|
-
onRequestRenderPrevMonth = _this$
|
|
181
|
-
renderNavigationLabel = _this$
|
|
182
|
-
renderWeekdayLabels = _this$
|
|
183
|
+
renderCalendar(_ref2) {
|
|
184
|
+
let getListProps = _ref2.getListProps,
|
|
185
|
+
getOptionProps = _ref2.getOptionProps;
|
|
186
|
+
const _this$props10 = this.props,
|
|
187
|
+
onRequestRenderNextMonth = _this$props10.onRequestRenderNextMonth,
|
|
188
|
+
onRequestRenderPrevMonth = _this$props10.onRequestRenderPrevMonth,
|
|
189
|
+
renderNavigationLabel = _this$props10.renderNavigationLabel,
|
|
190
|
+
renderWeekdayLabels = _this$props10.renderWeekdayLabels;
|
|
183
191
|
return jsx(Calendar, getListProps({
|
|
184
192
|
onRequestRenderNextMonth,
|
|
185
193
|
onRequestRenderPrevMonth,
|
|
@@ -187,34 +195,32 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
187
195
|
renderWeekdayLabels,
|
|
188
196
|
renderNextMonthButton: this.renderMonthNavigationButton('next'),
|
|
189
197
|
renderPrevMonthButton: this.renderMonthNavigationButton('prev')
|
|
190
|
-
}), this.renderDays(
|
|
191
|
-
getOptionProps
|
|
192
|
-
}));
|
|
198
|
+
}), this.renderDays(getOptionProps));
|
|
193
199
|
}
|
|
194
200
|
|
|
195
|
-
renderInput(
|
|
196
|
-
let getInputProps =
|
|
197
|
-
getTriggerProps =
|
|
198
|
-
|
|
199
|
-
const _this$
|
|
200
|
-
renderLabel = _this$
|
|
201
|
-
value = _this$
|
|
202
|
-
placeholder = _this$
|
|
203
|
-
onBlur = _this$
|
|
204
|
-
isRequired = _this$
|
|
205
|
-
size = _this$
|
|
206
|
-
isInline = _this$
|
|
207
|
-
layout = _this$
|
|
208
|
-
width = _this$
|
|
209
|
-
messages = _this$
|
|
210
|
-
onRequestValidateDate = _this$
|
|
211
|
-
onRequestShowCalendar = _this$
|
|
212
|
-
onRequestHideCalendar = _this$
|
|
213
|
-
onRequestSelectNextDay = _this$
|
|
214
|
-
onRequestSelectPrevDay = _this$
|
|
215
|
-
onRequestRenderNextMonth = _this$
|
|
216
|
-
onRequestRenderPrevMonth = _this$
|
|
217
|
-
rest = _objectWithoutProperties(_this$
|
|
201
|
+
renderInput(_ref3) {
|
|
202
|
+
let getInputProps = _ref3.getInputProps,
|
|
203
|
+
getTriggerProps = _ref3.getTriggerProps;
|
|
204
|
+
|
|
205
|
+
const _this$props11 = this.props,
|
|
206
|
+
renderLabel = _this$props11.renderLabel,
|
|
207
|
+
value = _this$props11.value,
|
|
208
|
+
placeholder = _this$props11.placeholder,
|
|
209
|
+
onBlur = _this$props11.onBlur,
|
|
210
|
+
isRequired = _this$props11.isRequired,
|
|
211
|
+
size = _this$props11.size,
|
|
212
|
+
isInline = _this$props11.isInline,
|
|
213
|
+
layout = _this$props11.layout,
|
|
214
|
+
width = _this$props11.width,
|
|
215
|
+
messages = _this$props11.messages,
|
|
216
|
+
onRequestValidateDate = _this$props11.onRequestValidateDate,
|
|
217
|
+
onRequestShowCalendar = _this$props11.onRequestShowCalendar,
|
|
218
|
+
onRequestHideCalendar = _this$props11.onRequestHideCalendar,
|
|
219
|
+
onRequestSelectNextDay = _this$props11.onRequestSelectNextDay,
|
|
220
|
+
onRequestSelectPrevDay = _this$props11.onRequestSelectPrevDay,
|
|
221
|
+
onRequestRenderNextMonth = _this$props11.onRequestRenderNextMonth,
|
|
222
|
+
onRequestRenderPrevMonth = _this$props11.onRequestRenderPrevMonth,
|
|
223
|
+
rest = _objectWithoutProperties(_this$props11, _excluded);
|
|
218
224
|
|
|
219
225
|
const interaction = this.interaction;
|
|
220
226
|
|
|
@@ -245,34 +251,33 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
render() {
|
|
248
|
-
const _this$
|
|
249
|
-
placement = _this$
|
|
250
|
-
isShowingCalendar = _this$
|
|
251
|
-
assistiveText = _this$
|
|
252
|
-
styles = _this$
|
|
253
|
-
const selectedDateId = this.selectedDateId;
|
|
254
|
+
const _this$props12 = this.props,
|
|
255
|
+
placement = _this$props12.placement,
|
|
256
|
+
isShowingCalendar = _this$props12.isShowingCalendar,
|
|
257
|
+
assistiveText = _this$props12.assistiveText,
|
|
258
|
+
styles = _this$props12.styles;
|
|
254
259
|
return jsx(Selectable, {
|
|
255
260
|
isShowingOptions: isShowingCalendar,
|
|
256
261
|
onRequestShowOptions: this.handleShowCalendar,
|
|
257
262
|
onRequestHideOptions: this.handleHideCalendar,
|
|
258
263
|
onRequestHighlightOption: this.handleHighlightOption,
|
|
259
264
|
onRequestSelectOption: this.handleHideCalendar,
|
|
260
|
-
selectedOptionId: selectedDateId,
|
|
261
|
-
highlightedOptionId: selectedDateId
|
|
262
|
-
},
|
|
263
|
-
let getRootProps =
|
|
264
|
-
getInputProps =
|
|
265
|
-
getTriggerProps =
|
|
266
|
-
getListProps =
|
|
267
|
-
getOptionProps =
|
|
268
|
-
getDescriptionProps =
|
|
265
|
+
selectedOptionId: this.selectedDateId,
|
|
266
|
+
highlightedOptionId: this.selectedDateId
|
|
267
|
+
}, _ref4 => {
|
|
268
|
+
let getRootProps = _ref4.getRootProps,
|
|
269
|
+
getInputProps = _ref4.getInputProps,
|
|
270
|
+
getTriggerProps = _ref4.getTriggerProps,
|
|
271
|
+
getListProps = _ref4.getListProps,
|
|
272
|
+
getOptionProps = _ref4.getOptionProps,
|
|
273
|
+
getDescriptionProps = _ref4.getDescriptionProps;
|
|
269
274
|
return jsx("span", getRootProps({
|
|
270
|
-
css: styles
|
|
275
|
+
css: styles === null || styles === void 0 ? void 0 : styles.dateInput
|
|
271
276
|
}), this.renderInput({
|
|
272
277
|
getInputProps,
|
|
273
278
|
getTriggerProps
|
|
274
279
|
}), jsx("span", Object.assign({}, getDescriptionProps(), {
|
|
275
|
-
css: styles
|
|
280
|
+
css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
|
|
276
281
|
}), assistiveText), jsx(Popover, {
|
|
277
282
|
placement: placement,
|
|
278
283
|
isShowingContent: isShowingCalendar,
|
|
@@ -289,29 +294,14 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
289
294
|
}, _class2.displayName = "DateInput", _class2.componentId = 'DateInput', _class2.Day = Calendar.Day, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
290
295
|
value: '',
|
|
291
296
|
size: 'medium',
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
onBlur: event => {},
|
|
295
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
297
|
+
onBlur: () => {},
|
|
298
|
+
// must have a default so createChainedFunction works
|
|
296
299
|
isRequired: false,
|
|
297
300
|
isInline: false,
|
|
298
301
|
layout: 'stacked',
|
|
299
|
-
width: null,
|
|
300
302
|
display: 'inline-block',
|
|
301
|
-
inputRef: el => {},
|
|
302
303
|
placement: 'bottom center',
|
|
303
|
-
isShowingCalendar: false
|
|
304
|
-
onRequestValidateDate: event => {},
|
|
305
|
-
onRequestShowCalendar: event => {},
|
|
306
|
-
onRequestHideCalendar: event => {},
|
|
307
|
-
onRequestSelectNextDay: event => {},
|
|
308
|
-
onRequestSelectPrevDay: event => {},
|
|
309
|
-
onRequestRenderNextMonth: event => {},
|
|
310
|
-
onRequestRenderPrevMonth: event => {},
|
|
311
|
-
renderNavigationLabel: null,
|
|
312
|
-
renderNextMonthButton: null,
|
|
313
|
-
renderPrevMonthButton: null,
|
|
314
|
-
children: null
|
|
304
|
+
isShowingCalendar: false
|
|
315
305
|
}, _temp)) || _class) || _class);
|
|
316
306
|
export default DateInput;
|
|
317
307
|
export { DateInput };
|
package/es/DateInput/props.js
CHANGED
|
@@ -27,182 +27,34 @@ import { FormPropTypes } from '@instructure/ui-form-field';
|
|
|
27
27
|
import { PositionPropTypes } from '@instructure/ui-position';
|
|
28
28
|
import { Calendar } from '@instructure/ui-calendar';
|
|
29
29
|
const propTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* Specifies the input label.
|
|
32
|
-
*/
|
|
33
30
|
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Specifies the input value.
|
|
37
|
-
*/
|
|
38
31
|
value: controllable(PropTypes.string),
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Specifies the input size.
|
|
42
|
-
*/
|
|
43
32
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Html placeholder text to display when the input has no value. This should
|
|
47
|
-
* be hint text, not a label replacement.
|
|
48
|
-
*/
|
|
49
33
|
placeholder: PropTypes.string,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Callback executed when the input fires a change event.
|
|
53
|
-
* @param {Object} event - the event object
|
|
54
|
-
* @param {Object} data - additional data
|
|
55
|
-
* @param data.value - the new value
|
|
56
|
-
*/
|
|
57
34
|
onChange: PropTypes.func,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Callback executed when the input fires a blur event.
|
|
61
|
-
*/
|
|
62
35
|
onBlur: PropTypes.func,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
66
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
67
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
68
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
69
|
-
*/
|
|
70
36
|
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Specifies if the input is required.
|
|
74
|
-
*/
|
|
75
37
|
isRequired: PropTypes.bool,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Controls whether the input is rendered inline with other elements or if it
|
|
79
|
-
* is rendered as a block level element.
|
|
80
|
-
*/
|
|
81
38
|
isInline: PropTypes.bool,
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Additional helpful text to provide to screen readers about the operation
|
|
85
|
-
* of the component.
|
|
86
|
-
*/
|
|
87
39
|
assistiveText: PropTypes.string,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Controls the layout. When set to `stacked`, the label rests on top of the
|
|
91
|
-
* input. When set to `inline` the label is next to the input.
|
|
92
|
-
*/
|
|
93
40
|
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Specifies the width of the input.
|
|
97
|
-
*/
|
|
98
41
|
width: PropTypes.string,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Specifies the display property of the container.
|
|
102
|
-
*/
|
|
103
42
|
display: PropTypes.oneOf(['inline-block', 'block']),
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Provides a ref to the underlying input element.
|
|
107
|
-
*/
|
|
108
43
|
inputRef: PropTypes.func,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Displays messages and validation for the input. It should be an object
|
|
112
|
-
* with the following shape:
|
|
113
|
-
* `{
|
|
114
|
-
* text: PropTypes.node,
|
|
115
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
116
|
-
* }`
|
|
117
|
-
*/
|
|
118
44
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The placement of the calendar in relation to the input.
|
|
122
|
-
*/
|
|
123
45
|
placement: PositionPropTypes.placement,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Controls whether or not the calendar is showing.
|
|
127
|
-
*/
|
|
128
46
|
isShowingCalendar: PropTypes.bool,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Callback fired when the input is blurred. Feedback should be provided
|
|
132
|
-
* to the user when this function is called if the selected date or input
|
|
133
|
-
* value is not valid.
|
|
134
|
-
*/
|
|
135
47
|
onRequestValidateDate: PropTypes.func,
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Callback fired requesting the calendar be shown.
|
|
139
|
-
*/
|
|
140
48
|
onRequestShowCalendar: PropTypes.func,
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Callback fired requesting the calendar be hidden.
|
|
144
|
-
*/
|
|
145
49
|
onRequestHideCalendar: PropTypes.func,
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Callback fired requesting the next day be selected. If no date is currently
|
|
149
|
-
* selected should default to the first day of the currently rendered month.
|
|
150
|
-
*/
|
|
151
50
|
onRequestSelectNextDay: PropTypes.func,
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Callback fired requesting the previous day be selected. If no date is currently
|
|
155
|
-
* selected should default to the first day of the currently rendered month.
|
|
156
|
-
*/
|
|
157
51
|
onRequestSelectPrevDay: PropTypes.func,
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Callback fired requesting the next month be rendered.
|
|
161
|
-
*/
|
|
162
52
|
onRequestRenderNextMonth: PropTypes.func,
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Callback fired requesting the previous month be rendered.
|
|
166
|
-
*/
|
|
167
53
|
onRequestRenderPrevMonth: PropTypes.func,
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Content to render in the calendar navigation header. The recommendation is
|
|
171
|
-
* to include the name of the current rendered month along with the year.
|
|
172
|
-
*/
|
|
173
54
|
renderNavigationLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* An array of labels containing the name of each day of the week. The visible
|
|
177
|
-
* portion of the label should be abbreviated (no longer than three characters).
|
|
178
|
-
* Note that screen readers will read this content preceding each date as the
|
|
179
|
-
* `<Calendar />` is navigated. Consider using
|
|
180
|
-
* [AccessibleContent](#AccessibleContent) with the `alt` prop containing the
|
|
181
|
-
* full day name for assistive technologies and the children containing the
|
|
182
|
-
* abbreviation. ex. `[<AccessibleContent alt="Sunday">Sun</AccessibleContent>, ...]`
|
|
183
|
-
*/
|
|
184
55
|
renderWeekdayLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])).isRequired,
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* A button to render in the calendar navigation header. The recommendation is
|
|
188
|
-
* to compose it with the [Button](#Button) component, setting the `variant`
|
|
189
|
-
* prop to `icon`, the `size` prop to `small`, and setting the `icon` prop to
|
|
190
|
-
* [IconArrowOpenEnd](#iconography).
|
|
191
|
-
*/
|
|
192
56
|
renderNextMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* A button to render in the calendar navigation header. The recommendation is
|
|
196
|
-
* to compose it with the [Button](#Button) component, setting the `variant`
|
|
197
|
-
* prop to `icon`, the `size` prop to `small`, and setting the `icon` prop to
|
|
198
|
-
* [IconArrowOpenStart](#iconography).
|
|
199
|
-
*/
|
|
200
57
|
renderPrevMonthButton: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* children of type `<DateInput.Day />` There should be exactly 42 provided (6
|
|
204
|
-
* weeks).
|
|
205
|
-
*/
|
|
206
58
|
children: ChildrenPropTypes.oneOf([Calendar.Day])
|
|
207
59
|
};
|
|
208
60
|
const allowedProps = ['renderLabel', 'value', 'size', 'placeholder', 'onChange', 'onBlur', 'interaction', 'isRequired', 'isInline', 'assistiveText', 'layout', 'width', 'display', 'inputRef', 'messages', 'placement', 'isShowingCalendar', 'onRequestValidateDate', 'onRequestShowCalendar', 'onRequestHideCalendar', 'onRequestSelectNextDay', 'onRequestSelectPrevDay', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderWeekdayLabels', 'renderNextMonthButton', 'renderPrevMonthButton', 'children'];
|
package/es/DateInput/styles.js
CHANGED
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
* private: true
|
|
28
28
|
* ---
|
|
29
29
|
* Generates the style object from the theme and provided additional information
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @
|
|
33
|
-
* @return {Object} The final style object, which will be used in the component
|
|
30
|
+
* @param _componentTheme The theme variable object.
|
|
31
|
+
* @param props the props of the component, the style is applied to
|
|
32
|
+
* @return The final style object, which will be used in the component
|
|
34
33
|
*/
|
|
35
34
|
const generateStyle = (_componentTheme, props) => {
|
|
36
35
|
return {
|