@instructure/ui-date-input 8.18.1-snapshot.2 → 8.19.1-snapshot.0
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 +4 -0
- package/es/DateInput/index.js +94 -108
- package/es/DateInput/props.js +0 -148
- package/es/DateInput/styles.js +3 -4
- package/lib/DateInput/index.js +97 -109
- package/lib/DateInput/props.js +0 -148
- package/lib/DateInput/styles.js +3 -4
- package/package.json +17 -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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.19.0](https://github.com/instructure/instructure-ui/compare/v8.18.0...v8.19.0) (2022-03-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-date-input
|
|
9
|
+
|
|
6
10
|
# [8.18.0](https://github.com/instructure/instructure-ui/compare/v8.17.0...v8.18.0) (2022-02-23)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-date-input
|
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,74 +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
|
-
var _this$props$makeStyle, _this$
|
|
122
|
+
var _this$props$makeStyle, _this$props7;
|
|
121
123
|
|
|
122
|
-
(_this$props$makeStyle = (_this$
|
|
124
|
+
(_this$props$makeStyle = (_this$props7 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props7);
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
componentDidUpdate() {
|
|
126
|
-
var _this$props$makeStyle2, _this$
|
|
128
|
+
var _this$props$makeStyle2, _this$props8;
|
|
127
129
|
|
|
128
|
-
(_this$props$makeStyle2 = (_this$
|
|
130
|
+
(_this$props$makeStyle2 = (_this$props8 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props8);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
get selectedDateId() {
|
|
132
134
|
let selectedDateId;
|
|
133
135
|
Children.toArray(this.props.children).forEach(day => {
|
|
134
|
-
const
|
|
135
|
-
date =
|
|
136
|
-
isSelected =
|
|
137
|
-
|
|
136
|
+
const _props = day.props,
|
|
137
|
+
date = _props.date,
|
|
138
|
+
isSelected = _props.isSelected;
|
|
139
|
+
|
|
140
|
+
if (isSelected) {
|
|
141
|
+
selectedDateId = this.formatDateId(date);
|
|
142
|
+
}
|
|
138
143
|
});
|
|
139
144
|
return selectedDateId;
|
|
140
145
|
}
|
|
@@ -147,43 +152,42 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
147
152
|
|
|
148
153
|
renderMonthNavigationButton() {
|
|
149
154
|
let type = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'prev';
|
|
150
|
-
const _this$
|
|
151
|
-
renderPrevMonthButton = _this$
|
|
152
|
-
renderNextMonthButton = _this$
|
|
155
|
+
const _this$props9 = this.props,
|
|
156
|
+
renderPrevMonthButton = _this$props9.renderPrevMonthButton,
|
|
157
|
+
renderNextMonthButton = _this$props9.renderNextMonthButton;
|
|
153
158
|
const button = type === 'prev' ? renderPrevMonthButton : renderNextMonthButton;
|
|
154
159
|
return button && safeCloneElement(callRenderProp(button), {
|
|
155
160
|
tabIndex: -1
|
|
156
161
|
});
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
renderDays(
|
|
160
|
-
let getOptionProps = _ref2.getOptionProps;
|
|
164
|
+
renderDays(getOptionProps) {
|
|
161
165
|
const children = this.props.children;
|
|
162
166
|
return Children.map(children, day => {
|
|
163
|
-
const _day$
|
|
164
|
-
date = _day$
|
|
165
|
-
isOutsideMonth = _day$
|
|
166
|
-
|
|
167
|
+
const _day$props = day.props,
|
|
168
|
+
date = _day$props.date,
|
|
169
|
+
isOutsideMonth = _day$props.isOutsideMonth;
|
|
170
|
+
const props = {
|
|
167
171
|
tabIndex: -1,
|
|
168
172
|
id: this.formatDateId(date)
|
|
169
173
|
};
|
|
170
174
|
const optionProps = getOptionProps(props);
|
|
171
|
-
|
|
175
|
+
const propsAdded = isOutsideMonth ? { ...props,
|
|
172
176
|
onClick: optionProps.onClick,
|
|
173
177
|
role: 'presentation'
|
|
174
178
|
} : optionProps;
|
|
175
|
-
return safeCloneElement(day,
|
|
179
|
+
return safeCloneElement(day, propsAdded);
|
|
176
180
|
});
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
renderCalendar(
|
|
180
|
-
let getListProps =
|
|
181
|
-
getOptionProps =
|
|
182
|
-
const _this$
|
|
183
|
-
onRequestRenderNextMonth = _this$
|
|
184
|
-
onRequestRenderPrevMonth = _this$
|
|
185
|
-
renderNavigationLabel = _this$
|
|
186
|
-
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;
|
|
187
191
|
return jsx(Calendar, getListProps({
|
|
188
192
|
onRequestRenderNextMonth,
|
|
189
193
|
onRequestRenderPrevMonth,
|
|
@@ -191,34 +195,32 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
191
195
|
renderWeekdayLabels,
|
|
192
196
|
renderNextMonthButton: this.renderMonthNavigationButton('next'),
|
|
193
197
|
renderPrevMonthButton: this.renderMonthNavigationButton('prev')
|
|
194
|
-
}), this.renderDays(
|
|
195
|
-
getOptionProps
|
|
196
|
-
}));
|
|
198
|
+
}), this.renderDays(getOptionProps));
|
|
197
199
|
}
|
|
198
200
|
|
|
199
|
-
renderInput(
|
|
200
|
-
let getInputProps =
|
|
201
|
-
getTriggerProps =
|
|
202
|
-
|
|
203
|
-
const _this$
|
|
204
|
-
renderLabel = _this$
|
|
205
|
-
value = _this$
|
|
206
|
-
placeholder = _this$
|
|
207
|
-
onBlur = _this$
|
|
208
|
-
isRequired = _this$
|
|
209
|
-
size = _this$
|
|
210
|
-
isInline = _this$
|
|
211
|
-
layout = _this$
|
|
212
|
-
width = _this$
|
|
213
|
-
messages = _this$
|
|
214
|
-
onRequestValidateDate = _this$
|
|
215
|
-
onRequestShowCalendar = _this$
|
|
216
|
-
onRequestHideCalendar = _this$
|
|
217
|
-
onRequestSelectNextDay = _this$
|
|
218
|
-
onRequestSelectPrevDay = _this$
|
|
219
|
-
onRequestRenderNextMonth = _this$
|
|
220
|
-
onRequestRenderPrevMonth = _this$
|
|
221
|
-
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);
|
|
222
224
|
|
|
223
225
|
const interaction = this.interaction;
|
|
224
226
|
|
|
@@ -249,27 +251,26 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
render() {
|
|
252
|
-
const _this$
|
|
253
|
-
placement = _this$
|
|
254
|
-
isShowingCalendar = _this$
|
|
255
|
-
assistiveText = _this$
|
|
256
|
-
styles = _this$
|
|
257
|
-
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;
|
|
258
259
|
return jsx(Selectable, {
|
|
259
260
|
isShowingOptions: isShowingCalendar,
|
|
260
261
|
onRequestShowOptions: this.handleShowCalendar,
|
|
261
262
|
onRequestHideOptions: this.handleHideCalendar,
|
|
262
263
|
onRequestHighlightOption: this.handleHighlightOption,
|
|
263
264
|
onRequestSelectOption: this.handleHideCalendar,
|
|
264
|
-
selectedOptionId: selectedDateId,
|
|
265
|
-
highlightedOptionId: selectedDateId
|
|
266
|
-
},
|
|
267
|
-
let getRootProps =
|
|
268
|
-
getInputProps =
|
|
269
|
-
getTriggerProps =
|
|
270
|
-
getListProps =
|
|
271
|
-
getOptionProps =
|
|
272
|
-
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;
|
|
273
274
|
return jsx("span", getRootProps({
|
|
274
275
|
css: styles === null || styles === void 0 ? void 0 : styles.dateInput
|
|
275
276
|
}), this.renderInput({
|
|
@@ -293,29 +294,14 @@ let DateInput = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec
|
|
|
293
294
|
}, _class2.displayName = "DateInput", _class2.componentId = 'DateInput', _class2.Day = Calendar.Day, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
294
295
|
value: '',
|
|
295
296
|
size: 'medium',
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
onBlur: event => {},
|
|
299
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
297
|
+
onBlur: () => {},
|
|
298
|
+
// must have a default so createChainedFunction works
|
|
300
299
|
isRequired: false,
|
|
301
300
|
isInline: false,
|
|
302
301
|
layout: 'stacked',
|
|
303
|
-
width: null,
|
|
304
302
|
display: 'inline-block',
|
|
305
|
-
inputRef: el => {},
|
|
306
303
|
placement: 'bottom center',
|
|
307
|
-
isShowingCalendar: false
|
|
308
|
-
onRequestValidateDate: event => {},
|
|
309
|
-
onRequestShowCalendar: event => {},
|
|
310
|
-
onRequestHideCalendar: event => {},
|
|
311
|
-
onRequestSelectNextDay: event => {},
|
|
312
|
-
onRequestSelectPrevDay: event => {},
|
|
313
|
-
onRequestRenderNextMonth: event => {},
|
|
314
|
-
onRequestRenderPrevMonth: event => {},
|
|
315
|
-
renderNavigationLabel: null,
|
|
316
|
-
renderNextMonthButton: null,
|
|
317
|
-
renderPrevMonthButton: null,
|
|
318
|
-
children: null
|
|
304
|
+
isShowingCalendar: false
|
|
319
305
|
}, _temp)) || _class) || _class);
|
|
320
306
|
export default DateInput;
|
|
321
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 {
|