@auth0/quantum-product 2.6.0 → 2.7.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/date-picker/date-picker-context.d.ts +2 -0
- package/date-picker/date-picker-context.js +2 -0
- package/date-picker/date-picker-popover.js +114 -137
- package/date-picker/date-picker-time-input.d.ts +21 -0
- package/date-picker/date-picker-time-input.js +362 -0
- package/date-picker/date-picker-types.d.ts +4 -0
- package/date-picker/date-picker.js +4 -2
- package/esm/date-picker/date-picker-context.js +2 -0
- package/esm/date-picker/date-picker-popover.js +114 -137
- package/esm/date-picker/date-picker-time-input.js +336 -0
- package/esm/date-picker/date-picker.js +4 -2
- package/esm/panel/panel/panel-classes.js +1 -0
- package/esm/panel/panel/panel.js +1 -0
- package/package.json +1 -1
- package/panel/panel/panel-classes.d.ts +1 -1
- package/panel/panel/panel-classes.js +1 -0
- package/panel/panel/panel.d.ts +1 -1
- package/panel/panel/panel.js +1 -0
- package/panel/panel-context.d.ts +1 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { styled } from '../styled';
|
|
14
|
+
import { TextField } from '../text-field';
|
|
15
|
+
import { datePickerPopoverComponentName } from './date-picker-classes';
|
|
16
|
+
var TimeInputContainer = styled('div', { name: datePickerPopoverComponentName, slot: 'TimeInput' })(function (_a) {
|
|
17
|
+
var theme = _a.theme;
|
|
18
|
+
return ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
justifyContent: 'flex-start',
|
|
21
|
+
gap: theme.spacing(0.5),
|
|
22
|
+
padding: theme.spacing(1),
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
borderTop: "1px solid ".concat(theme.tokens.color_border_default),
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
var EndTimeInputContainer = styled('div', { name: datePickerPopoverComponentName, slot: 'EndTimeInput' })(function (_a) {
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return ({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'flex-start',
|
|
32
|
+
gap: theme.spacing(0.5),
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
marginLeft: theme.spacing(2),
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var TimeInput = styled(TextField, { name: datePickerPopoverComponentName, slot: 'TimeInputField' })({
|
|
38
|
+
minWidth: '3rem',
|
|
39
|
+
width: '3rem',
|
|
40
|
+
'& .MuiOutlinedInput-input': {
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
var TimeInputLabel = styled('span', { name: datePickerPopoverComponentName, slot: 'TimeInputLabel' })(function (_a) {
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return ({
|
|
47
|
+
color: theme.tokens.color_fg_default,
|
|
48
|
+
fontSize: theme.typography.caption.fontSize,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export var DatePickerTimeInput = React.forwardRef(function (props, ref) {
|
|
52
|
+
var startTime = props.startTime, endTime = props.endTime, _a = props.isRangeSelection, isRangeSelection = _a === void 0 ? false : _a, onStartTimeChange = props.onStartTimeChange, onEndTimeChange = props.onEndTimeChange, onClear = props.onClear;
|
|
53
|
+
// Refs for time input navigation
|
|
54
|
+
var hoursRef = React.useRef(null);
|
|
55
|
+
var minutesRef = React.useRef(null);
|
|
56
|
+
var secondsRef = React.useRef(null);
|
|
57
|
+
var endHoursRef = React.useRef(null);
|
|
58
|
+
var endMinutesRef = React.useRef(null);
|
|
59
|
+
var endSecondsRef = React.useRef(null);
|
|
60
|
+
var handleTimeChange = function (value, timeType, field, max) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
var numValue = value.replace(/\D/g, '');
|
|
63
|
+
var parsed = parseInt(numValue, 10);
|
|
64
|
+
var newValue = '00';
|
|
65
|
+
if (!isNaN(parsed) && parsed >= 0 && parsed <= max) {
|
|
66
|
+
newValue = parsed.toString().padStart(2, '0');
|
|
67
|
+
}
|
|
68
|
+
else if (value === '') {
|
|
69
|
+
newValue = '00';
|
|
70
|
+
}
|
|
71
|
+
if (timeType === 'start') {
|
|
72
|
+
var newTime = __assign(__assign({}, startTime), (_a = {}, _a[field] = newValue, _a));
|
|
73
|
+
onStartTimeChange(newTime);
|
|
74
|
+
}
|
|
75
|
+
else if (timeType === 'end' && endTime && onEndTimeChange) {
|
|
76
|
+
var newTime = __assign(__assign({}, endTime), (_b = {}, _b[field] = newValue, _b));
|
|
77
|
+
onEndTimeChange(newTime);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var clearAllTimeInputs = React.useCallback(function () {
|
|
81
|
+
var clearedTime = { hours: '00', minutes: '00', seconds: '00' };
|
|
82
|
+
onStartTimeChange(clearedTime);
|
|
83
|
+
if (isRangeSelection && onEndTimeChange) {
|
|
84
|
+
onEndTimeChange(clearedTime);
|
|
85
|
+
}
|
|
86
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
87
|
+
setTimeout(function () {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
(_a = hoursRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
90
|
+
(_b = hoursRef.current) === null || _b === void 0 ? void 0 : _b.setSelectionRange(0, 0);
|
|
91
|
+
}, 0);
|
|
92
|
+
}, [onStartTimeChange, onEndTimeChange, onClear, isRangeSelection]);
|
|
93
|
+
var handleArrowKeys = function (e, config, target, isAtStart, isAtEnd) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
switch (e.key) {
|
|
96
|
+
case 'ArrowUp': {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
var upValue = parseInt(config.currentValue, 10) || 0;
|
|
99
|
+
var newUpValue = upValue === config.max ? 0 : upValue + 1;
|
|
100
|
+
var newValueStr = newUpValue.toString().padStart(2, '0');
|
|
101
|
+
handleTimeChange(newValueStr, config.timeType, config.field, config.max);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case 'ArrowDown': {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
var downValue = parseInt(config.currentValue, 10) || 0;
|
|
107
|
+
var newDownValue = downValue === 0 ? config.max : downValue - 1;
|
|
108
|
+
var newValueStr = newDownValue.toString().padStart(2, '0');
|
|
109
|
+
handleTimeChange(newValueStr, config.timeType, config.field, config.max);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 'ArrowRight':
|
|
113
|
+
if (isAtEnd && ((_a = config.nextRef) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
config.nextRef.current.focus();
|
|
116
|
+
config.nextRef.current.setSelectionRange(0, 0);
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case 'ArrowLeft':
|
|
120
|
+
if (isAtStart && ((_b = config.prevRef) === null || _b === void 0 ? void 0 : _b.current)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
config.prevRef.current.focus();
|
|
123
|
+
config.prevRef.current.setSelectionRange(2, 2);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var handleEditKeys = function (e, config, target, startPos, endPos, isAtStart) {
|
|
129
|
+
var _a;
|
|
130
|
+
switch (e.key) {
|
|
131
|
+
case 'Backspace':
|
|
132
|
+
if (isAtStart && ((_a = config.prevRef) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
config.prevRef.current.focus();
|
|
135
|
+
config.prevRef.current.setSelectionRange(2, 2);
|
|
136
|
+
}
|
|
137
|
+
else if (startPos === endPos) {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
var newPos_1 = Math.max(0, startPos - 1);
|
|
140
|
+
var newValue = target.value.substring(0, newPos_1) + '0' + target.value.substring(startPos);
|
|
141
|
+
var parsed = parseInt(newValue, 10) || 0;
|
|
142
|
+
if (parsed <= config.max) {
|
|
143
|
+
handleTimeChange(newValue, config.timeType, config.field, config.max);
|
|
144
|
+
setTimeout(function () { return target.setSelectionRange(newPos_1, newPos_1); }, 0);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case 'Delete':
|
|
149
|
+
if (startPos === endPos) {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
var newValue = target.value.substring(0, startPos) + '0' + target.value.substring(startPos + 1);
|
|
152
|
+
var parsed = parseInt(newValue, 10) || 0;
|
|
153
|
+
if (parsed <= config.max) {
|
|
154
|
+
handleTimeChange(newValue, config.timeType, config.field, config.max);
|
|
155
|
+
setTimeout(function () { return target.setSelectionRange(startPos, startPos); }, 0);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var handleNumberInput = function (e, config, target, startPos, endPos) {
|
|
162
|
+
if (!/^[0-9]$/.test(e.key))
|
|
163
|
+
return;
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
var newValue = target.value;
|
|
166
|
+
if (startPos === endPos) {
|
|
167
|
+
if (target.value.length < 2) {
|
|
168
|
+
newValue = target.value + e.key;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
newValue = target.value.substring(0, startPos) + e.key + target.value.substring(startPos + 1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
newValue = target.value.substring(0, startPos) + e.key + target.value.substring(endPos);
|
|
176
|
+
}
|
|
177
|
+
var parsed = parseInt(newValue, 10) || 0;
|
|
178
|
+
if (parsed <= config.max) {
|
|
179
|
+
handleTimeChange(newValue, config.timeType, config.field, config.max);
|
|
180
|
+
var newPos_2 = Math.min(startPos + 1, 2);
|
|
181
|
+
setTimeout(function () {
|
|
182
|
+
var _a;
|
|
183
|
+
target.setSelectionRange(newPos_2, newPos_2);
|
|
184
|
+
if (newValue.length === 2 && startPos === 1 && ((_a = config.nextRef) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
185
|
+
config.nextRef.current.focus();
|
|
186
|
+
config.nextRef.current.setSelectionRange(0, 0);
|
|
187
|
+
}
|
|
188
|
+
}, 0);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var handleTimeKeyDown = function (e, currentValue, timeType, field, max, nextRef, prevRef) {
|
|
192
|
+
var target = e.target;
|
|
193
|
+
var selectionStart = target.selectionStart, selectionEnd = target.selectionEnd;
|
|
194
|
+
var startPos = selectionStart !== null && selectionStart !== void 0 ? selectionStart : 0;
|
|
195
|
+
var endPos = selectionEnd !== null && selectionEnd !== void 0 ? selectionEnd : 0;
|
|
196
|
+
var isAtStart = startPos === 0;
|
|
197
|
+
var isAtEnd = startPos === target.value.length;
|
|
198
|
+
var config = {
|
|
199
|
+
currentValue: currentValue,
|
|
200
|
+
timeType: timeType,
|
|
201
|
+
field: field,
|
|
202
|
+
max: max,
|
|
203
|
+
nextRef: nextRef,
|
|
204
|
+
prevRef: prevRef,
|
|
205
|
+
};
|
|
206
|
+
// Clear all inputs with Cmd/Ctrl + Backspace
|
|
207
|
+
if (e.key === 'Backspace' && (e.metaKey || e.ctrlKey)) {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
clearAllTimeInputs();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {
|
|
213
|
+
handleArrowKeys(e, config, target, isAtStart, isAtEnd);
|
|
214
|
+
}
|
|
215
|
+
else if (['Backspace', 'Delete'].includes(e.key)) {
|
|
216
|
+
handleEditKeys(e, config, target, startPos, endPos, isAtStart);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
handleNumberInput(e, config, target, startPos, endPos);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
var parseTimeFromDigits = function (digitsOnly) {
|
|
223
|
+
var hours = '00';
|
|
224
|
+
var minutes = '00';
|
|
225
|
+
var seconds = '00';
|
|
226
|
+
if (digitsOnly.length === 6) {
|
|
227
|
+
hours = Math.min(parseInt(digitsOnly.substring(0, 2), 10), 23)
|
|
228
|
+
.toString()
|
|
229
|
+
.padStart(2, '0');
|
|
230
|
+
minutes = Math.min(parseInt(digitsOnly.substring(2, 4), 10), 59)
|
|
231
|
+
.toString()
|
|
232
|
+
.padStart(2, '0');
|
|
233
|
+
seconds = Math.min(parseInt(digitsOnly.substring(4, 6), 10), 59)
|
|
234
|
+
.toString()
|
|
235
|
+
.padStart(2, '0');
|
|
236
|
+
}
|
|
237
|
+
else if (digitsOnly.length === 4) {
|
|
238
|
+
hours = Math.min(parseInt(digitsOnly.substring(0, 2), 10), 23)
|
|
239
|
+
.toString()
|
|
240
|
+
.padStart(2, '0');
|
|
241
|
+
minutes = Math.min(parseInt(digitsOnly.substring(2, 4), 10), 59)
|
|
242
|
+
.toString()
|
|
243
|
+
.padStart(2, '0');
|
|
244
|
+
}
|
|
245
|
+
else if (digitsOnly.length <= 2) {
|
|
246
|
+
hours = Math.min(parseInt(digitsOnly, 10), 23).toString().padStart(2, '0');
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
var paddedDigits = digitsOnly.padStart(4, '0');
|
|
250
|
+
hours = Math.min(parseInt(paddedDigits.substring(0, 2), 10), 23)
|
|
251
|
+
.toString()
|
|
252
|
+
.padStart(2, '0');
|
|
253
|
+
minutes = Math.min(parseInt(paddedDigits.substring(2, 4), 10), 59)
|
|
254
|
+
.toString()
|
|
255
|
+
.padStart(2, '0');
|
|
256
|
+
}
|
|
257
|
+
return { hours: hours, minutes: minutes, seconds: seconds };
|
|
258
|
+
};
|
|
259
|
+
var getFocusTargetAfterPaste = function (digitsOnly, timeType) {
|
|
260
|
+
var isStart = timeType === 'start';
|
|
261
|
+
if (digitsOnly.length === 6) {
|
|
262
|
+
return isStart ? secondsRef : endSecondsRef;
|
|
263
|
+
}
|
|
264
|
+
else if (digitsOnly.length === 4) {
|
|
265
|
+
return isStart ? minutesRef : endMinutesRef;
|
|
266
|
+
}
|
|
267
|
+
else if (digitsOnly.length <= 2) {
|
|
268
|
+
return isStart ? hoursRef : endHoursRef;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
return isStart ? minutesRef : endMinutesRef;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
var handleTimePaste = function (e, timeType) {
|
|
275
|
+
e.preventDefault();
|
|
276
|
+
var pastedText = e.clipboardData.getData('text').trim();
|
|
277
|
+
var digitsOnly = pastedText.replace(/\D/g, '').substring(0, 6);
|
|
278
|
+
if (digitsOnly.length === 0)
|
|
279
|
+
return;
|
|
280
|
+
var newTime = parseTimeFromDigits(digitsOnly);
|
|
281
|
+
var focusTargetRef = getFocusTargetAfterPaste(digitsOnly, timeType);
|
|
282
|
+
if (timeType === 'start') {
|
|
283
|
+
onStartTimeChange(newTime);
|
|
284
|
+
}
|
|
285
|
+
else if (timeType === 'end' && onEndTimeChange) {
|
|
286
|
+
onEndTimeChange(newTime);
|
|
287
|
+
}
|
|
288
|
+
setTimeout(function () {
|
|
289
|
+
var _a, _b;
|
|
290
|
+
(_a = focusTargetRef === null || focusTargetRef === void 0 ? void 0 : focusTargetRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
291
|
+
(_b = focusTargetRef === null || focusTargetRef === void 0 ? void 0 : focusTargetRef.current) === null || _b === void 0 ? void 0 : _b.setSelectionRange(2, 2);
|
|
292
|
+
}, 0);
|
|
293
|
+
};
|
|
294
|
+
var getAccessibilityProps = function (timeType, field, value) {
|
|
295
|
+
var max = field === 'hours' ? 23 : 59;
|
|
296
|
+
var fieldLabel = field === 'hours' ? 'Hours' : field === 'minutes' ? 'Minutes' : 'Seconds';
|
|
297
|
+
var typeLabel = isRangeSelection ? (timeType === 'start' ? 'Start time' : 'End time') : 'Time';
|
|
298
|
+
return {
|
|
299
|
+
'aria-label': "".concat(typeLabel, " ").concat(fieldLabel.toLowerCase()),
|
|
300
|
+
'aria-describedby': 'time-input-help',
|
|
301
|
+
role: 'spinbutton',
|
|
302
|
+
'aria-valuemin': 0,
|
|
303
|
+
'aria-valuemax': max,
|
|
304
|
+
'aria-valuenow': parseInt(value, 10) || 0,
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
return (React.createElement(TimeInputContainer, { ref: ref },
|
|
308
|
+
React.createElement(TimeInputLabel, null, "Time:"),
|
|
309
|
+
React.createElement(TimeInput, { size: "small", value: startTime.hours, onChange: function (e) { return handleTimeChange(e.target.value, 'start', 'hours', 23); }, inputRef: hoursRef, placeholder: "HH", InputProps: {
|
|
310
|
+
onKeyDown: function (e) { return handleTimeKeyDown(e, startTime.hours, 'start', 'hours', 23, minutesRef, null); },
|
|
311
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'start'); } }, getAccessibilityProps('start', 'hours', startTime.hours)) }),
|
|
312
|
+
React.createElement("span", null, ":"),
|
|
313
|
+
React.createElement(TimeInput, { size: "small", value: startTime.minutes, onChange: function (e) { return handleTimeChange(e.target.value, 'start', 'minutes', 59); }, inputRef: minutesRef, placeholder: "MM", InputProps: {
|
|
314
|
+
onKeyDown: function (e) { return handleTimeKeyDown(e, startTime.minutes, 'start', 'minutes', 59, secondsRef, hoursRef); },
|
|
315
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'start'); } }, getAccessibilityProps('start', 'minutes', startTime.minutes)) }),
|
|
316
|
+
React.createElement("span", null, ":"),
|
|
317
|
+
React.createElement(TimeInput, { size: "small", value: startTime.seconds, onChange: function (e) { return handleTimeChange(e.target.value, 'start', 'seconds', 59); }, inputRef: secondsRef, placeholder: "SS", InputProps: {
|
|
318
|
+
onKeyDown: function (e) {
|
|
319
|
+
return handleTimeKeyDown(e, startTime.seconds, 'start', 'seconds', 59, isRangeSelection ? endHoursRef : null, minutesRef);
|
|
320
|
+
},
|
|
321
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'start'); } }, getAccessibilityProps('start', 'seconds', startTime.seconds)) }),
|
|
322
|
+
isRangeSelection && endTime && onEndTimeChange && (React.createElement(EndTimeInputContainer, null,
|
|
323
|
+
React.createElement(TimeInputLabel, null, "End Time:"),
|
|
324
|
+
React.createElement(TimeInput, { size: "small", value: endTime.hours, onChange: function (e) { return handleTimeChange(e.target.value, 'end', 'hours', 23); }, inputRef: endHoursRef, placeholder: "HH", InputProps: {
|
|
325
|
+
onKeyDown: function (e) { return handleTimeKeyDown(e, endTime.hours, 'end', 'hours', 23, endMinutesRef, secondsRef); },
|
|
326
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'end'); } }, getAccessibilityProps('end', 'hours', endTime.hours)) }),
|
|
327
|
+
React.createElement("span", null, ":"),
|
|
328
|
+
React.createElement(TimeInput, { size: "small", value: endTime.minutes, onChange: function (e) { return handleTimeChange(e.target.value, 'end', 'minutes', 59); }, inputRef: endMinutesRef, placeholder: "MM", InputProps: {
|
|
329
|
+
onKeyDown: function (e) { return handleTimeKeyDown(e, endTime.minutes, 'end', 'minutes', 59, endSecondsRef, endHoursRef); },
|
|
330
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'end'); } }, getAccessibilityProps('end', 'minutes', endTime.minutes)) }),
|
|
331
|
+
React.createElement("span", null, ":"),
|
|
332
|
+
React.createElement(TimeInput, { size: "small", value: endTime.seconds, onChange: function (e) { return handleTimeChange(e.target.value, 'end', 'seconds', 59); }, inputRef: endSecondsRef, placeholder: "SS", InputProps: {
|
|
333
|
+
onKeyDown: function (e) { return handleTimeKeyDown(e, endTime.seconds, 'end', 'seconds', 59, null, endMinutesRef); },
|
|
334
|
+
}, inputProps: __assign({ onPaste: function (e) { return handleTimePaste(e, 'end'); } }, getAccessibilityProps('end', 'seconds', endTime.seconds)) })))));
|
|
335
|
+
});
|
|
336
|
+
DatePickerTimeInput.displayName = 'DatePickerTimeInput';
|
|
@@ -52,7 +52,7 @@ var Root = styled('div', { name: datePickerComponentName, slot: 'Root' })({
|
|
|
52
52
|
width: '100%',
|
|
53
53
|
});
|
|
54
54
|
export var DatePicker = React.forwardRef(function (props, ref) {
|
|
55
|
-
var value = props.value, onChange = props.onChange, _a = props.dateFormat, dateFormat = _a === void 0 ? 'MM/dd/yyyy' : _a, _b = props.timeFormat, timeFormat = _b === void 0 ? 'HH:mm:ss' : _b, _c = props.placeholder, placeholder = _c === void 0 ? dateFormat + (props.showTimeInput ? ' ' + timeFormat : '') : _c, _d = props.disabled, disabled = _d === void 0 ? false : _d, _e = props.fullWidth, fullWidth = _e === void 0 ? false : _e, _f = props.size, size = _f === void 0 ? 'medium' : _f, _g = props.readOnly, readOnly = _g === void 0 ? false : _g, _h = props.required, required = _h === void 0 ? false : _h, _j = props.error, error = _j === void 0 ? false : _j, helperText = props.helperText, options = props.options, _k = props.isRangeSelection, isRangeSelection = _k === void 0 ? false : _k, _l = props.showTwoMonths, showTwoMonths = _l === void 0 ? false : _l, _m = props.showTimeInput, showTimeInput = _m === void 0 ? false : _m, _o = props.allowTimestampPasting, allowTimestampPasting = _o === void 0 ? false : _o, _p = props.timestampUnit, timestampUnit = _p === void 0 ? 'ms' : _p, _q = props.TextFieldProps, TextFieldProps = _q === void 0 ? {} : _q, propClasses = props.classes, externalState = props.state, rootProps = __rest(props, ["value", "onChange", "dateFormat", "timeFormat", "placeholder", "disabled", "fullWidth", "size", "readOnly", "required", "error", "helperText", "options", "isRangeSelection", "showTwoMonths", "showTimeInput", "allowTimestampPasting", "timestampUnit", "TextFieldProps", "classes", "state"]);
|
|
55
|
+
var value = props.value, onChange = props.onChange, _a = props.dateFormat, dateFormat = _a === void 0 ? 'MM/dd/yyyy' : _a, _b = props.timeFormat, timeFormat = _b === void 0 ? 'HH:mm:ss' : _b, minDate = props.minDate, maxDate = props.maxDate, _c = props.placeholder, placeholder = _c === void 0 ? dateFormat + (props.showTimeInput ? ' ' + timeFormat : '') : _c, _d = props.disabled, disabled = _d === void 0 ? false : _d, _e = props.fullWidth, fullWidth = _e === void 0 ? false : _e, _f = props.size, size = _f === void 0 ? 'medium' : _f, _g = props.readOnly, readOnly = _g === void 0 ? false : _g, _h = props.required, required = _h === void 0 ? false : _h, _j = props.error, error = _j === void 0 ? false : _j, helperText = props.helperText, options = props.options, _k = props.isRangeSelection, isRangeSelection = _k === void 0 ? false : _k, _l = props.showTwoMonths, showTwoMonths = _l === void 0 ? false : _l, _m = props.showTimeInput, showTimeInput = _m === void 0 ? false : _m, _o = props.allowTimestampPasting, allowTimestampPasting = _o === void 0 ? false : _o, _p = props.timestampUnit, timestampUnit = _p === void 0 ? 'ms' : _p, _q = props.TextFieldProps, TextFieldProps = _q === void 0 ? {} : _q, propClasses = props.classes, externalState = props.state, rootProps = __rest(props, ["value", "onChange", "dateFormat", "timeFormat", "minDate", "maxDate", "placeholder", "disabled", "fullWidth", "size", "readOnly", "required", "error", "helperText", "options", "isRangeSelection", "showTwoMonths", "showTimeInput", "allowTimestampPasting", "timestampUnit", "TextFieldProps", "classes", "state"]);
|
|
56
56
|
var classes = useMergedClasses(datePickerClasses, getDatePickerUtilityClass, propClasses);
|
|
57
57
|
var internalState = useDatePickerState();
|
|
58
58
|
var _r = externalState || internalState, triggerProps = _r.triggerProps, popoverProps = _r.popoverProps;
|
|
@@ -118,6 +118,8 @@ export var DatePicker = React.forwardRef(function (props, ref) {
|
|
|
118
118
|
return (React.createElement(DatePickerContext.Provider, { value: {
|
|
119
119
|
dateFormat: dateFormat,
|
|
120
120
|
timeFormat: timeFormat,
|
|
121
|
+
minDate: minDate,
|
|
122
|
+
maxDate: maxDate,
|
|
121
123
|
onSelectDate: handleDateSelect,
|
|
122
124
|
isRangeSelection: isRangeSelection,
|
|
123
125
|
showTimeInput: showTimeInput,
|
|
@@ -131,5 +133,5 @@ export var DatePicker = React.forwardRef(function (props, ref) {
|
|
|
131
133
|
TextFieldProps.onClick(e);
|
|
132
134
|
}
|
|
133
135
|
} }, TextFieldProps)),
|
|
134
|
-
React.createElement(DatePickerPopover, __assign({}, popoverProps, { onDateSelect: handleDateSelect, options: options, value: displayValue, dateFormat: dateFormat, timeFormat: timeFormat, showTwoMonths: showTwoMonths, isRangeSelection: isRangeSelection, showTimeInput: showTimeInput })))));
|
|
136
|
+
React.createElement(DatePickerPopover, __assign({}, popoverProps, { onDateSelect: handleDateSelect, options: options, minDate: minDate, maxDate: maxDate, value: displayValue, dateFormat: dateFormat, timeFormat: timeFormat, showTwoMonths: showTwoMonths, isRangeSelection: isRangeSelection, showTimeInput: showTimeInput })))));
|
|
135
137
|
});
|
package/esm/panel/panel/panel.js
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const panelComponentName: "QuantumPanel";
|
|
2
2
|
export declare function getPanelUtilityClass(slot: string): string;
|
|
3
|
-
export declare const panelClasses: Record<"fixed" | "content" | "open" | "root" | "sizeSmall" | "sizeMedium" | "sizeLarge" | "closeButton" | "variantFloating" | "variantPersistent" | "variantPermanent" | "placementStart" | "placementEnd", string>;
|
|
3
|
+
export declare const panelClasses: Record<"fixed" | "content" | "open" | "root" | "sizeSmall" | "sizeMedium" | "sizeLarge" | "closeButton" | "variantFloating" | "variantPersistent" | "variantPermanent" | "sizeXLarge" | "placementStart" | "placementEnd", string>;
|
|
4
4
|
export type PanelClasses = typeof panelClasses;
|
|
5
5
|
export type PanelClassKey = keyof PanelClasses;
|
package/panel/panel/panel.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const Panel: React.ForwardRefExoticComponent<Partial<IPanelOwnerS
|
|
|
33
33
|
onClose?(event: React.MouseEvent<HTMLButtonElement>, reason: 'closeButtonClick'): void;
|
|
34
34
|
/** convenience prop for rendering the label for close button with a Panel component */
|
|
35
35
|
closeButtonLabel?: string | undefined;
|
|
36
|
-
classes?: Partial<Record<"fixed" | "content" | "open" | "root" | "sizeSmall" | "sizeMedium" | "sizeLarge" | "closeButton" | "variantFloating" | "variantPersistent" | "variantPermanent" | "placementStart" | "placementEnd", string>> | undefined;
|
|
36
|
+
classes?: Partial<Record<"fixed" | "content" | "open" | "root" | "sizeSmall" | "sizeMedium" | "sizeLarge" | "closeButton" | "variantFloating" | "variantPersistent" | "variantPermanent" | "sizeXLarge" | "placementStart" | "placementEnd", string>> | undefined;
|
|
37
37
|
closeIconButtonProps?: Partial<IIconButtonProps<"button", {}>> | undefined;
|
|
38
38
|
PanelHeaderProps?: Partial<IPanelHeaderProps> | undefined;
|
|
39
39
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "size" | "classes" | "children" | "variant" | "onClose" | "placement" | "offsetTop" | "closeButtonLabel" | "isOpen" | "isFixed" | "closeIconButtonProps" | "PanelHeaderProps"> & import("../../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
package/panel/panel/panel.js
CHANGED
package/panel/panel-context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export type PanelSize = 'small' | 'medium' | 'large';
|
|
2
|
+
export type PanelSize = 'small' | 'medium' | 'large' | 'xlarge';
|
|
3
3
|
export type PanelVariant = 'floating' | 'persistent' | 'permanent';
|
|
4
4
|
export type PanelPlacement = 'start' | 'end';
|
|
5
5
|
export interface IPanelContextValue {
|