@auth0/quantum-product 2.5.9 → 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.
Files changed (39) hide show
  1. package/breadcrumbs/breadcrumbs-item/breadcrumbs-item.js +2 -2
  2. package/button/button.d.ts +1 -0
  3. package/button/button.js +2 -2
  4. package/card/card.d.ts +1 -0
  5. package/card/card.js +2 -2
  6. package/chip/chip.d.ts +1 -0
  7. package/chip/chip.js +2 -2
  8. package/date-picker/date-picker-context.d.ts +2 -0
  9. package/date-picker/date-picker-context.js +2 -0
  10. package/date-picker/date-picker-popover.js +114 -137
  11. package/date-picker/date-picker-time-input.d.ts +21 -0
  12. package/date-picker/date-picker-time-input.js +362 -0
  13. package/date-picker/date-picker-types.d.ts +4 -0
  14. package/date-picker/date-picker.js +4 -2
  15. package/esm/breadcrumbs/breadcrumbs-item/breadcrumbs-item.js +2 -2
  16. package/esm/button/button.js +2 -2
  17. package/esm/card/card.js +2 -2
  18. package/esm/chip/chip.js +2 -2
  19. package/esm/date-picker/date-picker-context.js +2 -0
  20. package/esm/date-picker/date-picker-popover.js +114 -137
  21. package/esm/date-picker/date-picker-time-input.js +336 -0
  22. package/esm/date-picker/date-picker.js +4 -2
  23. package/esm/icon-button/icon-button.js +2 -2
  24. package/esm/link/link.js +2 -2
  25. package/esm/panel/panel/panel-classes.js +1 -0
  26. package/esm/panel/panel/panel.js +1 -0
  27. package/esm/tabs/tab/tab.js +2 -2
  28. package/icon-button/icon-button.d.ts +1 -0
  29. package/icon-button/icon-button.js +2 -2
  30. package/link/link.d.ts +4 -0
  31. package/link/link.js +2 -2
  32. package/package.json +1 -1
  33. package/panel/panel/panel-classes.d.ts +1 -1
  34. package/panel/panel/panel-classes.js +1 -0
  35. package/panel/panel/panel.d.ts +1 -1
  36. package/panel/panel/panel.js +1 -0
  37. package/panel/panel-context.d.ts +1 -1
  38. package/tabs/tab/tab.d.ts +1 -0
  39. package/tabs/tab/tab.js +2 -2
@@ -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
  });
@@ -73,9 +73,9 @@ var DisabledWrapper = styled('span', {
73
73
  });
74
74
  export var IconButton = React.forwardRef(function (props, ref) {
75
75
  var iconButtonContext = useIconButtonContext();
76
- var isLoading = props.isLoading, _a = props.SpinnerProps, SpinnerProps = _a === void 0 ? {} : _a, children = props.children, label = props.label, _b = props.color, color = _b === void 0 ? 'default' : _b, _c = props.variant, variant = _c === void 0 ? 'link' : _c, _d = props.size, size = _d === void 0 ? 'medium' : _d, disabled = props.disabled, edgeProp = props.edge, _e = props.shape, shape = _e === void 0 ? 'default' : _e, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, iconButtonProps = __rest(props, ["isLoading", "SpinnerProps", "children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose"]);
76
+ var isLoading = props.isLoading, _a = props.SpinnerProps, SpinnerProps = _a === void 0 ? {} : _a, children = props.children, label = props.label, _b = props.color, color = _b === void 0 ? 'default' : _b, _c = props.variant, variant = _c === void 0 ? 'link' : _c, _d = props.size, size = _d === void 0 ? 'medium' : _d, disabled = props.disabled, edgeProp = props.edge, _e = props.shape, shape = _e === void 0 ? 'default' : _e, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, analyticsId = props.analyticsId, iconButtonProps = __rest(props, ["isLoading", "SpinnerProps", "children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose", "analyticsId"]);
77
77
  var edge = edgeProp != null ? edgeProp : iconButtonContext.edge;
78
78
  var captizedLable = label ? capitalize(label) : null;
79
- var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled || isLoading, size: size, variant: variant, ownerState: { shape: shape, isLoading: isLoading }, "aria-label": captizedLable }, iconButtonProps), isLoading ? React.createElement(ButtonSpinner, __assign({}, SpinnerProps)) : React.createElement(React.Fragment, null, children)));
79
+ var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled || isLoading, size: size, variant: variant, ownerState: { shape: shape, isLoading: isLoading }, "aria-label": captizedLable }, (analyticsId && { 'data-analytics-id': analyticsId }), iconButtonProps), isLoading ? React.createElement(ButtonSpinner, __assign({}, SpinnerProps)) : React.createElement(React.Fragment, null, children)));
80
80
  return (React.createElement(Root, { title: captizedLable, placement: tooltipPlacement, onClose: onTooltipClose }, disabled ? React.createElement(DisabledWrapper, null, button) : button));
81
81
  });
package/esm/link/link.js CHANGED
@@ -124,14 +124,14 @@ var EndIcon = styled('span', { name: linkComponentName, slot: 'EndIcon' })(funct
124
124
  export var Link = React.forwardRef(function (props, ref) {
125
125
  var className = props.className, children = props.children, startIcon = props.startIcon, endIcon = props.endIcon, _a = props.color, color = _a === void 0 ? 'primary' : _a, _b = props.component, component = _b === void 0 ? 'a' : _b, _c = props.underline, underline = _c === void 0 ? 'none' : _c, _d = props.variant, variant = _d === void 0 ? 'inherit' : _d,
126
126
  // remove to avoid forwarding
127
- propClasses = props.classes, rootProps = __rest(props, ["className", "children", "startIcon", "endIcon", "color", "component", "underline", "variant", "classes"]);
127
+ propClasses = props.classes, analyticsId = props.analyticsId, rootProps = __rest(props, ["className", "children", "startIcon", "endIcon", "color", "component", "underline", "variant", "classes", "analyticsId"]);
128
128
  var classes = useMergedClasses(linkClasses, getLinkUtilityClass, propClasses);
129
129
  var ownerState = {
130
130
  color: color,
131
131
  component: component,
132
132
  underline: underline,
133
133
  };
134
- return (React.createElement(Root, __assign({ color: color === 'inherit' ? color : undefined, component: component, className: clsx([classes.root, className]), ref: ref, ownerState: ownerState, variant: variant }, rootProps),
134
+ return (React.createElement(Root, __assign({ color: color === 'inherit' ? color : undefined, component: component, className: clsx([classes.root, className]), ref: ref, ownerState: ownerState, variant: variant }, (analyticsId && { 'data-analytics-id': analyticsId }), rootProps),
135
135
  !!startIcon && (React.createElement(StartIcon, { className: clsx(classes.icon, classes.startIcon, classes.startIcon) }, startIcon)),
136
136
  children,
137
137
  !!endIcon && React.createElement(EndIcon, { className: clsx(classes.icon, classes.endIcon) }, endIcon)));
@@ -12,6 +12,7 @@ export var panelClasses = generateUtilityClasses(panelComponentName, [
12
12
  'sizeSmall',
13
13
  'sizeMedium',
14
14
  'sizeLarge',
15
+ 'sizeXLarge',
15
16
  'placementStart',
16
17
  'placementEnd',
17
18
  'closeButton',
@@ -33,6 +33,7 @@ var widthBySize = {
33
33
  small: 320,
34
34
  medium: 360,
35
35
  large: 440,
36
+ xlarge: 540,
36
37
  };
37
38
  var Root = styled('div', {
38
39
  name: panelComponentName,
@@ -43,9 +43,9 @@ var LabelContainer = styled('div')(function (_a) {
43
43
  });
44
44
  });
45
45
  export var Tab = React.forwardRef(function (_a, ref) {
46
- var value = _a.value, productReleaseStage = _a.productReleaseStage, label = _a.label, _b = _a.sx, sx = _b === void 0 ? {} : _b, tabProps = __rest(_a, ["value", "productReleaseStage", "label", "sx"]);
46
+ var value = _a.value, productReleaseStage = _a.productReleaseStage, label = _a.label, _b = _a.sx, sx = _b === void 0 ? {} : _b, analyticsId = _a.analyticsId, tabProps = __rest(_a, ["value", "productReleaseStage", "label", "sx", "analyticsId"]);
47
47
  var _c = useTabsContext(), getTabProps = _c.getTabProps, fullWidth = _c.fullWidth;
48
48
  return (React.createElement(MuiTab, __assign({ ref: ref }, getTabProps(value), { value: value, label: React.createElement(StackLayout, { gutter: 0 },
49
49
  React.createElement(LabelContainer, { width: sx === null || sx === void 0 ? void 0 : sx.width, maxWidth: sx === null || sx === void 0 ? void 0 : sx.maxWidth, title: label }, label),
50
- productReleaseStage && React.createElement(AvailabilityLabel, { productReleaseStage: productReleaseStage })) }, tabProps, { fullWidth: fullWidth })));
50
+ productReleaseStage && React.createElement(AvailabilityLabel, { productReleaseStage: productReleaseStage })) }, (analyticsId && { 'data-analytics-id': analyticsId }), tabProps, { fullWidth: fullWidth })));
51
51
  });
@@ -18,6 +18,7 @@ export type IIconButtonTypeMap<ExtraPropsType = {}, DefaultElementType extends R
18
18
  target?: string;
19
19
  isLoading?: boolean;
20
20
  SpinnerProps?: Partial<ISpinnerProps>;
21
+ analyticsId?: string;
21
22
  }, DefaultElementType>;
22
23
  export interface IExtendIconButtonTypeMap<M extends OverridableTypeMap> {
23
24
  props: M['props'] & (M['props'] extends {
@@ -99,9 +99,9 @@ var DisabledWrapper = (0, styled_1.styled)('span', {
99
99
  });
100
100
  exports.IconButton = React.forwardRef(function (props, ref) {
101
101
  var iconButtonContext = (0, icon_button_context_1.useIconButtonContext)();
102
- var isLoading = props.isLoading, _a = props.SpinnerProps, SpinnerProps = _a === void 0 ? {} : _a, children = props.children, label = props.label, _b = props.color, color = _b === void 0 ? 'default' : _b, _c = props.variant, variant = _c === void 0 ? 'link' : _c, _d = props.size, size = _d === void 0 ? 'medium' : _d, disabled = props.disabled, edgeProp = props.edge, _e = props.shape, shape = _e === void 0 ? 'default' : _e, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, iconButtonProps = __rest(props, ["isLoading", "SpinnerProps", "children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose"]);
102
+ var isLoading = props.isLoading, _a = props.SpinnerProps, SpinnerProps = _a === void 0 ? {} : _a, children = props.children, label = props.label, _b = props.color, color = _b === void 0 ? 'default' : _b, _c = props.variant, variant = _c === void 0 ? 'link' : _c, _d = props.size, size = _d === void 0 ? 'medium' : _d, disabled = props.disabled, edgeProp = props.edge, _e = props.shape, shape = _e === void 0 ? 'default' : _e, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, analyticsId = props.analyticsId, iconButtonProps = __rest(props, ["isLoading", "SpinnerProps", "children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose", "analyticsId"]);
103
103
  var edge = edgeProp != null ? edgeProp : iconButtonContext.edge;
104
104
  var captizedLable = label ? (0, material_1.capitalize)(label) : null;
105
- var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled || isLoading, size: size, variant: variant, ownerState: { shape: shape, isLoading: isLoading }, "aria-label": captizedLable }, iconButtonProps), isLoading ? React.createElement(ButtonSpinner, __assign({}, SpinnerProps)) : React.createElement(React.Fragment, null, children)));
105
+ var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled || isLoading, size: size, variant: variant, ownerState: { shape: shape, isLoading: isLoading }, "aria-label": captizedLable }, (analyticsId && { 'data-analytics-id': analyticsId }), iconButtonProps), isLoading ? React.createElement(ButtonSpinner, __assign({}, SpinnerProps)) : React.createElement(React.Fragment, null, children)));
106
106
  return (React.createElement(Root, { title: captizedLable, placement: tooltipPlacement, onClose: onTooltipClose }, disabled ? React.createElement(DisabledWrapper, null, button) : button));
107
107
  });
package/link/link.d.ts CHANGED
@@ -44,6 +44,10 @@ export interface ILinkTypeMap<P = {}, D extends React.ElementType = 'a'> {
44
44
  * @default 'none'
45
45
  */
46
46
  underline?: 'none' | 'hover';
47
+ /**
48
+ * Analytics ID
49
+ */
50
+ analyticsId?: string;
47
51
  };
48
52
  defaultComponent: D;
49
53
  }
package/link/link.js CHANGED
@@ -153,14 +153,14 @@ var EndIcon = (0, styled_1.styled)('span', { name: link_classes_1.linkComponentN
153
153
  exports.Link = React.forwardRef(function (props, ref) {
154
154
  var className = props.className, children = props.children, startIcon = props.startIcon, endIcon = props.endIcon, _a = props.color, color = _a === void 0 ? 'primary' : _a, _b = props.component, component = _b === void 0 ? 'a' : _b, _c = props.underline, underline = _c === void 0 ? 'none' : _c, _d = props.variant, variant = _d === void 0 ? 'inherit' : _d,
155
155
  // remove to avoid forwarding
156
- propClasses = props.classes, rootProps = __rest(props, ["className", "children", "startIcon", "endIcon", "color", "component", "underline", "variant", "classes"]);
156
+ propClasses = props.classes, analyticsId = props.analyticsId, rootProps = __rest(props, ["className", "children", "startIcon", "endIcon", "color", "component", "underline", "variant", "classes", "analyticsId"]);
157
157
  var classes = (0, classes_1.useMergedClasses)(link_classes_1.linkClasses, link_classes_1.getLinkUtilityClass, propClasses);
158
158
  var ownerState = {
159
159
  color: color,
160
160
  component: component,
161
161
  underline: underline,
162
162
  };
163
- return (React.createElement(Root, __assign({ color: color === 'inherit' ? color : undefined, component: component, className: (0, clsx_1.default)([classes.root, className]), ref: ref, ownerState: ownerState, variant: variant }, rootProps),
163
+ return (React.createElement(Root, __assign({ color: color === 'inherit' ? color : undefined, component: component, className: (0, clsx_1.default)([classes.root, className]), ref: ref, ownerState: ownerState, variant: variant }, (analyticsId && { 'data-analytics-id': analyticsId }), rootProps),
164
164
  !!startIcon && (React.createElement(StartIcon, { className: (0, clsx_1.default)(classes.icon, classes.startIcon, classes.startIcon) }, startIcon)),
165
165
  children,
166
166
  !!endIcon && React.createElement(EndIcon, { className: (0, clsx_1.default)(classes.icon, classes.endIcon) }, endIcon)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-product",
3
- "version": "2.5.9",
3
+ "version": "2.7.0",
4
4
  "sideEffects": false,
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -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;
@@ -16,6 +16,7 @@ exports.panelClasses = (0, classes_1.generateUtilityClasses)(exports.panelCompon
16
16
  'sizeSmall',
17
17
  'sizeMedium',
18
18
  'sizeLarge',
19
+ 'sizeXLarge',
19
20
  'placementStart',
20
21
  'placementEnd',
21
22
  'closeButton',
@@ -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>>;
@@ -59,6 +59,7 @@ var widthBySize = {
59
59
  small: 320,
60
60
  medium: 360,
61
61
  large: 440,
62
+ xlarge: 540,
62
63
  };
63
64
  var Root = (0, styled_1.styled)('div', {
64
65
  name: panel_classes_1.panelComponentName,
@@ -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 {
package/tabs/tab/tab.d.ts CHANGED
@@ -3,6 +3,7 @@ import { OverridableComponent, OverrideProps } from '../../overridable-component
3
3
  import { TabTypeMap } from '@mui/material/Tab';
4
4
  type ITabTypeMap<ExtraPropsType = {}, DefaultElementType extends React.ElementType = TabTypeMap['defaultComponent']> = TabTypeMap<ExtraPropsType & {
5
5
  productReleaseStage?: 'beta' | 'earlyAccess' | 'generalAvailability';
6
+ analyticsId?: string;
6
7
  }, DefaultElementType>;
7
8
  export type ITabProps<D extends React.ElementType = ITabTypeMap['defaultComponent'], P = {}> = OverrideProps<ITabTypeMap<P, D>, D>;
8
9
  export declare const Tab: OverridableComponent<ITabTypeMap<{}, "div">>;
package/tabs/tab/tab.js CHANGED
@@ -72,9 +72,9 @@ var LabelContainer = (0, styled_1.styled)('div')(function (_a) {
72
72
  });
73
73
  });
74
74
  exports.Tab = React.forwardRef(function (_a, ref) {
75
- var value = _a.value, productReleaseStage = _a.productReleaseStage, label = _a.label, _b = _a.sx, sx = _b === void 0 ? {} : _b, tabProps = __rest(_a, ["value", "productReleaseStage", "label", "sx"]);
75
+ var value = _a.value, productReleaseStage = _a.productReleaseStage, label = _a.label, _b = _a.sx, sx = _b === void 0 ? {} : _b, analyticsId = _a.analyticsId, tabProps = __rest(_a, ["value", "productReleaseStage", "label", "sx", "analyticsId"]);
76
76
  var _c = (0, tabs_context_1.useTabsContext)(), getTabProps = _c.getTabProps, fullWidth = _c.fullWidth;
77
77
  return (React.createElement(Tab_1.default, __assign({ ref: ref }, getTabProps(value), { value: value, label: React.createElement(stack_layout_1.StackLayout, { gutter: 0 },
78
78
  React.createElement(LabelContainer, { width: sx === null || sx === void 0 ? void 0 : sx.width, maxWidth: sx === null || sx === void 0 ? void 0 : sx.maxWidth, title: label }, label),
79
- productReleaseStage && React.createElement(AvailabilityLabel, { productReleaseStage: productReleaseStage })) }, tabProps, { fullWidth: fullWidth })));
79
+ productReleaseStage && React.createElement(AvailabilityLabel, { productReleaseStage: productReleaseStage })) }, (analyticsId && { 'data-analytics-id': analyticsId }), tabProps, { fullWidth: fullWidth })));
80
80
  });