@digital-ai/dot-components 2.7.3 → 2.7.4
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/CHANGE_LOG.md +18 -5
- package/index.esm.js +160 -112
- package/index.umd.js +204 -134
- package/lib/components/auto-complete/AutoComplete.d.ts +3 -1
- package/lib/components/auto-complete/AutoComplete.stories.d.ts +2 -1
- package/lib/components/date-picker/DatePicker.d.ts +6 -3
- package/lib/components/date-picker/DatePicker.stories.d.ts +1 -5
- package/lib/components/date-picker/index.d.ts +2 -0
- package/lib/components/date-picker/utils/helpers.d.ts +5 -0
- package/lib/components/date-picker/utils/models.d.ts +5 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/time-picker/TimePicker.d.ts +12 -5
- package/lib/components/time-picker/TimePicker.stories.d.ts +3 -2
- package/lib/components/time-picker/TimePicker.stories.styles.d.ts +2 -0
- package/lib/components/time-picker/utils/helpers.d.ts +2 -0
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.7.4](https://www.npmjs.com/package/@digital-ai/dot-components) (05/04/2023)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.7.3...2.7.4)
|
|
6
|
+
|
|
7
|
+
**Features:**
|
|
8
|
+
|
|
9
|
+
- S-92362: `DotAutoComplete` - Expose `getOptionDisabled` from MUI Autocomplete [\#1474](https://github.com/digital-ai/dot-components/pull/1474) ([dmiletic85](https://github.com/dmiletic85))
|
|
10
|
+
- S-92310 Use ISO format for `DatePicker` and `TimePicker` [\#1472](https://github.com/digital-ai/dot-components/pull/1472) ([angel-git](https://github.com/angel-git))
|
|
11
|
+
- S-92224: `DotDatePicker`, `DotTimePicker` - Improve keyboard accessibility [\#1470](https://github.com/digital-ai/dot-components/pull/1470) ([dmiletic85](https://github.com/dmiletic85))
|
|
12
|
+
|
|
3
13
|
## [2.7.3](https://www.npmjs.com/package/@digital-ai/dot-components) (05/01/2023)
|
|
4
14
|
|
|
5
15
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.7.2...2.7.3)
|
|
@@ -22,6 +32,10 @@
|
|
|
22
32
|
|
|
23
33
|
- S-92086: `DotDatePicker` improvements [\#1461](https://github.com/digital-ai/dot-components/pull/1461) ([dmiletic85](https://github.com/dmiletic85))
|
|
24
34
|
|
|
35
|
+
**Fixed bugs:**
|
|
36
|
+
|
|
37
|
+
- Issue-1449: Update status pills to have generally lighter backgrounds [\#1456](https://github.com/digital-ai/dot-components/pull/1456) ([jmcnally](https://github.com/jmcnally))
|
|
38
|
+
|
|
25
39
|
## [2.7.1](https://www.npmjs.com/package/@digital-ai/dot-components) (04/20/2023)
|
|
26
40
|
|
|
27
41
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.7.0...2.7.1)
|
|
@@ -32,7 +46,6 @@
|
|
|
32
46
|
|
|
33
47
|
**Fixed bugs:**
|
|
34
48
|
|
|
35
|
-
- Issue-1449: Update status pills to have generally lighter backgrounds [\#1456](https://github.com/digital-ai/dot-components/pull/1456) ([jmcnally](https://github.com/jmcnally))
|
|
36
49
|
- `DotTimePicker`, `DotDatePicker`: fix issues with controlled and uncontrolled states [\#1454](https://github.com/digital-ai/dot-components/pull/1454) ([dmiletic85](https://github.com/dmiletic85))
|
|
37
50
|
- D-24807: `Demo app` - fix error when starting demo application [\#1451](https://github.com/digital-ai/dot-components/pull/1451) ([dmiletic85](https://github.com/dmiletic85))
|
|
38
51
|
|
|
@@ -492,7 +505,6 @@
|
|
|
492
505
|
|
|
493
506
|
**Features:**
|
|
494
507
|
|
|
495
|
-
- S-84117: As a customer admin, I want the IdP creation flow to be more intuitive, as I find the existing user flow a little overwhelming [\#1185](https://github.com/digital-ai/dot-components/pull/1185) ([ryangamble](https://github.com/ryangamble))
|
|
496
508
|
- S-85256: `Map` component example in demo app [\#1184](https://github.com/digital-ai/dot-components/pull/1184) ([dmiletic85](https://github.com/dmiletic85))
|
|
497
509
|
|
|
498
510
|
**Fixed bugs:**
|
|
@@ -511,6 +523,7 @@
|
|
|
511
523
|
|
|
512
524
|
**Features:**
|
|
513
525
|
|
|
526
|
+
- S-84117: As a customer admin, I want the IdP creation flow to be more intuitive, as I find the existing user flow a little overwhelming [\#1185](https://github.com/digital-ai/dot-components/pull/1185) ([ryangamble](https://github.com/ryangamble))
|
|
514
527
|
- S-85283: `InlineEdit` component should provide a tooltip out the box [\#1181](https://github.com/digital-ai/dot-components/pull/1181) ([dmiletic85](https://github.com/dmiletic85))
|
|
515
528
|
|
|
516
529
|
**Fixed bugs:**
|
|
@@ -717,7 +730,6 @@
|
|
|
717
730
|
**Fixed bugs:**
|
|
718
731
|
|
|
719
732
|
- D-20004: Fix multiSelect for tables that use onUpdateData callback [\#1005](https://github.com/digital-ai/dot-components/pull/1005) ([selsemore](https://github.com/selsemore))
|
|
720
|
-
- D-19932: `Avatar` tooltip appears in wrong position [\#995](https://github.com/digital-ai/dot-components/pull/995) ([dmiletic85](https://github.com/dmiletic85))
|
|
721
733
|
|
|
722
734
|
**Misc:**
|
|
723
735
|
|
|
@@ -738,6 +750,7 @@
|
|
|
738
750
|
**Fixed bugs:**
|
|
739
751
|
|
|
740
752
|
- D-19944: `Drawer` close icon doesn't have enough padding [\#996](https://github.com/digital-ai/dot-components/pull/996) ([dmiletic85](https://github.com/dmiletic85))
|
|
753
|
+
- D-19932: `Avatar` tooltip appears in wrong position [\#995](https://github.com/digital-ai/dot-components/pull/995) ([dmiletic85](https://github.com/dmiletic85))
|
|
741
754
|
- D-19816: `SplitButton`: `data-testid` is assigned to multiple elements [\#986](https://github.com/digital-ai/dot-components/pull/986) ([dmiletic85](https://github.com/dmiletic85))
|
|
742
755
|
- D-19820: Failing `Table` unit tests on NX major upgrade branch [\#983](https://github.com/digital-ai/dot-components/pull/983) ([dmiletic85](https://github.com/dmiletic85))
|
|
743
756
|
|
|
@@ -952,6 +965,7 @@
|
|
|
952
965
|
|
|
953
966
|
- \#841 Fix DotDynamicForm initial form state for controls with initialValue false [\#842](https://github.com/digital-ai/dot-components/pull/842) ([selsemore](https://github.com/selsemore))
|
|
954
967
|
- D-19189: Extended sidenav drawer should collapse when another drawer option is clicked [\#830](https://github.com/digital-ai/dot-components/pull/830) ([dmiletic85](https://github.com/dmiletic85))
|
|
968
|
+
- D-19177: `Go back` item in `DotSidebar` is not aligned with rest of items [\#826](https://github.com/digital-ai/dot-components/pull/826) ([dmiletic85](https://github.com/dmiletic85))
|
|
955
969
|
|
|
956
970
|
**Misc:**
|
|
957
971
|
|
|
@@ -970,7 +984,6 @@
|
|
|
970
984
|
**Fixed bugs:**
|
|
971
985
|
|
|
972
986
|
- D-19151: `DotBadge` generates console warnings [\#827](https://github.com/digital-ai/dot-components/pull/827) ([dmiletic85](https://github.com/dmiletic85))
|
|
973
|
-
- D-19177: `Go back` item in `DotSidebar` is not aligned with rest of items [\#826](https://github.com/digital-ai/dot-components/pull/826) ([dmiletic85](https://github.com/dmiletic85))
|
|
974
987
|
|
|
975
988
|
## [1.3.4](https://www.npmjs.com/package/@digital-ai/dot-components) (11/30/2021)
|
|
976
989
|
|
|
@@ -1014,7 +1027,6 @@
|
|
|
1014
1027
|
- S-80109: Expose built-in `leaveDelay`, `onClose`, `open` props on `DotTooltip` component [\#786](https://github.com/digital-ai/dot-components/pull/786) ([dmiletic85](https://github.com/dmiletic85))
|
|
1015
1028
|
- S-76907: update ButtonToggle styles, update unit tests and add e2e tests [\#785](https://github.com/digital-ai/dot-components/pull/785) ([CWSites](https://github.com/CWSites))
|
|
1016
1029
|
- S-80048: product wrapper demo [\#782](https://github.com/digital-ai/dot-components/pull/782) ([CWSites](https://github.com/CWSites))
|
|
1017
|
-
- Add submitButtonProps prop to DotJsonSchemaForm component [\#775](https://github.com/digital-ai/dot-components/pull/775) ([selsemore](https://github.com/selsemore))
|
|
1018
1030
|
|
|
1019
1031
|
## [1.3.2](https://www.npmjs.com/package/@digital-ai/dot-components) (11/05/2021)
|
|
1020
1032
|
|
|
@@ -1029,6 +1041,7 @@
|
|
|
1029
1041
|
|
|
1030
1042
|
- Patch release [\#780](https://github.com/digital-ai/dot-components/pull/780) ([TheKeithStewart](https://github.com/TheKeithStewart))
|
|
1031
1043
|
- S-79985: temporarily remove react-jsonschema-form from library [\#776](https://github.com/digital-ai/dot-components/pull/776) ([TheKeithStewart](https://github.com/TheKeithStewart))
|
|
1044
|
+
- Add submitButtonProps prop to DotJsonSchemaForm component [\#775](https://github.com/digital-ai/dot-components/pull/775) ([selsemore](https://github.com/selsemore))
|
|
1032
1045
|
- S-76893: Webpack 4 - update peer dependencies [\#768](https://github.com/digital-ai/dot-components/pull/768) ([CWSites](https://github.com/CWSites))
|
|
1033
1046
|
- S-79957: improve husky [\#765](https://github.com/digital-ai/dot-components/pull/765) ([CWSites](https://github.com/CWSites))
|
|
1034
1047
|
|
package/index.esm.js
CHANGED
|
@@ -4309,6 +4309,7 @@ const DotAutoComplete = ({
|
|
|
4309
4309
|
error: _error = false,
|
|
4310
4310
|
filterSelectedOptions: _filterSelectedOptions = true,
|
|
4311
4311
|
freesolo: _freesolo = true,
|
|
4312
|
+
checkIfOptionDisabled,
|
|
4312
4313
|
group: _group = false,
|
|
4313
4314
|
helperText,
|
|
4314
4315
|
inputId,
|
|
@@ -4530,6 +4531,7 @@ const DotAutoComplete = ({
|
|
|
4530
4531
|
filterSelectedOptions: _filterSelectedOptions,
|
|
4531
4532
|
freeSolo: _freesolo,
|
|
4532
4533
|
getOptionLabel: option => parseAutoCompleteValue(option),
|
|
4534
|
+
getOptionDisabled: checkIfOptionDisabled,
|
|
4533
4535
|
groupBy: _group ? option => option.group : undefined,
|
|
4534
4536
|
ListboxComponent: ListboxComponent,
|
|
4535
4537
|
loading: loading,
|
|
@@ -9468,6 +9470,26 @@ const DotLinearProgress = ({
|
|
|
9468
9470
|
}, void 0);
|
|
9469
9471
|
};
|
|
9470
9472
|
|
|
9473
|
+
var DatePickerKeydownContext;
|
|
9474
|
+
(function (DatePickerKeydownContext) {
|
|
9475
|
+
DatePickerKeydownContext[DatePickerKeydownContext["Input"] = 0] = "Input";
|
|
9476
|
+
DatePickerKeydownContext[DatePickerKeydownContext["PickerButton"] = 1] = "PickerButton";
|
|
9477
|
+
DatePickerKeydownContext[DatePickerKeydownContext["Popper"] = 2] = "Popper";
|
|
9478
|
+
})(DatePickerKeydownContext || (DatePickerKeydownContext = {}));
|
|
9479
|
+
|
|
9480
|
+
/** This returns a `boolean` indicating whether the Day.js object contains a valid date or not. */
|
|
9481
|
+
const checkIfValidDate = (date, format) => dayjs(date, format, true).isValid();
|
|
9482
|
+
const getContextEnumBasedOnTarget = (event, inputElement, contextEnum) => {
|
|
9483
|
+
const targetElement = event.target;
|
|
9484
|
+
const isWithinInput = inputElement === null || inputElement === void 0 ? void 0 : inputElement.contains(targetElement);
|
|
9485
|
+
let currentContextEnum = contextEnum;
|
|
9486
|
+
// Key was captured within text field but not on the input itself
|
|
9487
|
+
if (contextEnum === DatePickerKeydownContext.Input && !isWithinInput) {
|
|
9488
|
+
currentContextEnum = DatePickerKeydownContext.PickerButton;
|
|
9489
|
+
}
|
|
9490
|
+
return currentContextEnum;
|
|
9491
|
+
};
|
|
9492
|
+
|
|
9471
9493
|
const rootClassName$1 = 'dot-date-picker';
|
|
9472
9494
|
const containerClassName$1 = 'dot-date-picker-container';
|
|
9473
9495
|
const rectanglePickersDayClassName = 'dot-rectangle-pickers-day';
|
|
@@ -9494,6 +9516,7 @@ const RectanglePickersDay = pickersDayProps => {
|
|
|
9494
9516
|
disableRipple: true
|
|
9495
9517
|
}), void 0);
|
|
9496
9518
|
};
|
|
9519
|
+
const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD';
|
|
9497
9520
|
const DotDatePicker = ({
|
|
9498
9521
|
ariaLabel,
|
|
9499
9522
|
autoFocus: _autoFocus = false,
|
|
@@ -9524,6 +9547,7 @@ const DotDatePicker = ({
|
|
|
9524
9547
|
onChange,
|
|
9525
9548
|
onClose,
|
|
9526
9549
|
onError,
|
|
9550
|
+
onKeyDown,
|
|
9527
9551
|
onOpen,
|
|
9528
9552
|
open,
|
|
9529
9553
|
persistentLabel,
|
|
@@ -9532,7 +9556,7 @@ const DotDatePicker = ({
|
|
|
9532
9556
|
showDaysOutsideCurrentMonth,
|
|
9533
9557
|
value
|
|
9534
9558
|
}) => {
|
|
9535
|
-
const
|
|
9559
|
+
const displayFormat = format || DEFAULT_DATE_FORMAT;
|
|
9536
9560
|
const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
|
|
9537
9561
|
const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
|
|
9538
9562
|
const isInputReadOnly = _readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
|
|
@@ -9566,13 +9590,13 @@ const DotDatePicker = ({
|
|
|
9566
9590
|
}, [locale]);
|
|
9567
9591
|
const handleChange = (changedValue, context) => {
|
|
9568
9592
|
if (!onChange || changedValue && !changedValue.isValid()) return;
|
|
9569
|
-
onChange(changedValue ? changedValue.format(
|
|
9593
|
+
onChange(changedValue ? changedValue.format(DEFAULT_DATE_FORMAT) : null, context);
|
|
9570
9594
|
};
|
|
9571
9595
|
const handleAccept = changedValue => {
|
|
9572
9596
|
if (!onAccept) return;
|
|
9573
|
-
onAccept(changedValue ? changedValue.format(
|
|
9597
|
+
onAccept(changedValue ? changedValue.format(DEFAULT_DATE_FORMAT) : null);
|
|
9574
9598
|
};
|
|
9575
|
-
const handleError = (validationError, currentValue) => onError === null || onError === void 0 ? void 0 : onError(validationError, dayjs(currentValue).format(
|
|
9599
|
+
const handleError = (validationError, currentValue) => onError === null || onError === void 0 ? void 0 : onError(validationError, dayjs(currentValue).format(DEFAULT_DATE_FORMAT));
|
|
9576
9600
|
const handleOpen = () => {
|
|
9577
9601
|
if (focusInputOnPopperOpened && inputRef.current) {
|
|
9578
9602
|
focusInput(inputRef);
|
|
@@ -9588,6 +9612,10 @@ const DotDatePicker = ({
|
|
|
9588
9612
|
}
|
|
9589
9613
|
return actionBar;
|
|
9590
9614
|
};
|
|
9615
|
+
const handleKeyDown = contextEnum => event => {
|
|
9616
|
+
const currentContextEnum = getContextEnumBasedOnTarget(event, inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, contextEnum);
|
|
9617
|
+
onKeyDown(event, currentContextEnum);
|
|
9618
|
+
};
|
|
9591
9619
|
return jsx(StyledDatePickerContainer, Object.assign({
|
|
9592
9620
|
className: containerClasses,
|
|
9593
9621
|
"data-testid": dataTestId
|
|
@@ -9607,16 +9635,16 @@ const DotDatePicker = ({
|
|
|
9607
9635
|
autoFocus: _autoFocus,
|
|
9608
9636
|
closeOnSelect: _closeOnSelect,
|
|
9609
9637
|
className: rootClasses,
|
|
9610
|
-
defaultValue: defaultValue && dayjs(defaultValue,
|
|
9638
|
+
defaultValue: defaultValue && dayjs(defaultValue, DEFAULT_DATE_FORMAT),
|
|
9611
9639
|
disableOpenPicker: disableOpenPicker || isInputReadOnly || disabled,
|
|
9612
9640
|
disablePast: disablePast,
|
|
9613
9641
|
disabled: disabled,
|
|
9614
9642
|
displayWeekNumber: displayWeekNumber,
|
|
9615
9643
|
fixedWeekNumber: fixedWeekNumber,
|
|
9616
|
-
format:
|
|
9644
|
+
format: displayFormat,
|
|
9617
9645
|
label: persistentLabel ? null : label,
|
|
9618
|
-
maxDate: maxDate && dayjs(maxDate,
|
|
9619
|
-
minDate: minDate && dayjs(minDate,
|
|
9646
|
+
maxDate: maxDate && dayjs(maxDate, DEFAULT_DATE_FORMAT),
|
|
9647
|
+
minDate: minDate && dayjs(minDate, DEFAULT_DATE_FORMAT),
|
|
9620
9648
|
onAccept: handleAccept,
|
|
9621
9649
|
onChange: handleChange,
|
|
9622
9650
|
onClose: onClose,
|
|
@@ -9651,6 +9679,7 @@ const DotDatePicker = ({
|
|
|
9651
9679
|
'data-testid': 'dot-date-picker-input',
|
|
9652
9680
|
onBlur
|
|
9653
9681
|
},
|
|
9682
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Input),
|
|
9654
9683
|
inputRef,
|
|
9655
9684
|
fullWidth: _fullWidth,
|
|
9656
9685
|
name: inputName
|
|
@@ -9662,10 +9691,11 @@ const DotDatePicker = ({
|
|
|
9662
9691
|
disableEnforceFocus: true
|
|
9663
9692
|
},
|
|
9664
9693
|
popper: {
|
|
9665
|
-
disablePortal: _disablePortal
|
|
9694
|
+
disablePortal: _disablePortal,
|
|
9695
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper)
|
|
9666
9696
|
}
|
|
9667
9697
|
},
|
|
9668
|
-
value: value && dayjs(value,
|
|
9698
|
+
value: value && dayjs(value, DEFAULT_DATE_FORMAT)
|
|
9669
9699
|
}, void 0)]
|
|
9670
9700
|
}), void 0)
|
|
9671
9701
|
}), void 0);
|
|
@@ -9734,6 +9764,8 @@ const getPopperButtonTabIndex = (index, isSelected, selectedValue) => selectedVa
|
|
|
9734
9764
|
const getDaytimeButtonTabIndex = (currentDaytime, selectedDaytime) => selectedDaytime && currentDaytime === selectedDaytime || !selectedDaytime && currentDaytime === Daytime.AM ? undefined : -1;
|
|
9735
9765
|
const getSelectedDaytime = dateTime => dateTime && dateTime.format('A') || Daytime.AM;
|
|
9736
9766
|
const getTimePickerButtonType = selectedDaytime => selectedDaytime && selectedDaytime === Daytime.PM ? 'primary' : 'text';
|
|
9767
|
+
const checkIfOpenPropDefined = open => open !== null && open !== undefined;
|
|
9768
|
+
const getDaytimeButtonType = daytimeSelected => daytimeSelected && daytimeSelected === Daytime.AM ? 'primary' : 'text';
|
|
9737
9769
|
|
|
9738
9770
|
const rootClassName = 'dot-time-picker';
|
|
9739
9771
|
const containerClassName = 'dot-time-picker-container';
|
|
@@ -9755,17 +9787,18 @@ const StyledTimePicker = styled(TimePicker).withConfig({
|
|
|
9755
9787
|
}) => css(["&.", "{", ";}"], rootClassName, pickerInputStyles(theme)));
|
|
9756
9788
|
|
|
9757
9789
|
dayjs.extend(utc);
|
|
9758
|
-
const DEFAULT_PICKER_TIME_FORMAT = '
|
|
9759
|
-
const DEFAULT_TIME_FORMAT = '
|
|
9790
|
+
const DEFAULT_PICKER_TIME_FORMAT = 'HH:mm';
|
|
9791
|
+
const DEFAULT_TIME_FORMAT = 'HH:mm';
|
|
9760
9792
|
const DEFAULT_TIME = '01:00';
|
|
9761
9793
|
const DotTimePicker = ({
|
|
9762
|
-
ampm: _ampm =
|
|
9794
|
+
ampm: _ampm = false,
|
|
9763
9795
|
ariaLabel,
|
|
9764
9796
|
autoFocus: _autoFocus = false,
|
|
9765
9797
|
className,
|
|
9766
9798
|
'data-testid': dataTestId,
|
|
9767
9799
|
defaultValue,
|
|
9768
9800
|
disableOpenPicker: _disableOpenPicker = false,
|
|
9801
|
+
disableClickAwayListener: _disableClickAwayListener = false,
|
|
9769
9802
|
disabled,
|
|
9770
9803
|
error,
|
|
9771
9804
|
format,
|
|
@@ -9777,8 +9810,10 @@ const DotTimePicker = ({
|
|
|
9777
9810
|
label,
|
|
9778
9811
|
onAccept,
|
|
9779
9812
|
onBlur,
|
|
9813
|
+
onCancel,
|
|
9780
9814
|
onChange,
|
|
9781
9815
|
onClose,
|
|
9816
|
+
onKeyDown,
|
|
9782
9817
|
onOpen,
|
|
9783
9818
|
open,
|
|
9784
9819
|
persistentLabel,
|
|
@@ -9786,7 +9821,7 @@ const DotTimePicker = ({
|
|
|
9786
9821
|
required: _required = false,
|
|
9787
9822
|
value
|
|
9788
9823
|
}) => {
|
|
9789
|
-
const
|
|
9824
|
+
const displayFormat = format || DEFAULT_TIME_FORMAT;
|
|
9790
9825
|
const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
|
|
9791
9826
|
const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
|
|
9792
9827
|
const isComponentReadOnly = _readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
|
|
@@ -9803,7 +9838,7 @@ const DotTimePicker = ({
|
|
|
9803
9838
|
const minutes = getMinutesForTimePicker();
|
|
9804
9839
|
const daytimeSelected = getSelectedDaytime(pickerTime);
|
|
9805
9840
|
const selectedPickerHour = pickerTime && calculateHourBasedOnTimeFormat(pickerTime, _ampm);
|
|
9806
|
-
const isOpenPropDefined = open
|
|
9841
|
+
const isOpenPropDefined = checkIfOpenPropDefined(open);
|
|
9807
9842
|
const isControlledComponent = onChange && value !== undefined;
|
|
9808
9843
|
useEffect(() => {
|
|
9809
9844
|
if (hasValueWithoutChangeHandler) {
|
|
@@ -9816,9 +9851,9 @@ const DotTimePicker = ({
|
|
|
9816
9851
|
useEffect(() => {
|
|
9817
9852
|
let timeValue = null;
|
|
9818
9853
|
if (defaultValue) {
|
|
9819
|
-
timeValue = getDayjsUtcDate(defaultValue,
|
|
9854
|
+
timeValue = getDayjsUtcDate(defaultValue, DEFAULT_TIME_FORMAT);
|
|
9820
9855
|
} else if (value) {
|
|
9821
|
-
timeValue = getDayjsUtcDate(value,
|
|
9856
|
+
timeValue = getDayjsUtcDate(value, DEFAULT_TIME_FORMAT);
|
|
9822
9857
|
}
|
|
9823
9858
|
setTime(timeValue);
|
|
9824
9859
|
setPickerTime(timeValue);
|
|
@@ -9844,7 +9879,7 @@ const DotTimePicker = ({
|
|
|
9844
9879
|
const currentTimeValue = currentValue ? currentValue : null;
|
|
9845
9880
|
setPickerTime(currentValue ? currentValue : null);
|
|
9846
9881
|
!isControlledComponent && setTime(currentTimeValue);
|
|
9847
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(currentValue ? currentValue.format(
|
|
9882
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(currentValue ? currentValue.format(DEFAULT_TIME_FORMAT) : null, context);
|
|
9848
9883
|
};
|
|
9849
9884
|
const handleClose = () => {
|
|
9850
9885
|
!isOpenPropDefined && setIsPickerOpened(false);
|
|
@@ -9869,6 +9904,7 @@ const DotTimePicker = ({
|
|
|
9869
9904
|
};
|
|
9870
9905
|
const handleCancel = () => {
|
|
9871
9906
|
setPickerTime(time);
|
|
9907
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
9872
9908
|
handleClose();
|
|
9873
9909
|
};
|
|
9874
9910
|
const handleSet = () => {
|
|
@@ -9877,12 +9913,16 @@ const DotTimePicker = ({
|
|
|
9877
9913
|
return;
|
|
9878
9914
|
}
|
|
9879
9915
|
setTime(pickerTime);
|
|
9880
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(pickerTime.format(
|
|
9916
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(pickerTime.format(DEFAULT_TIME_FORMAT), {
|
|
9881
9917
|
validationError: null
|
|
9882
9918
|
});
|
|
9883
|
-
onAccept === null || onAccept === void 0 ? void 0 : onAccept(pickerTime.format(
|
|
9919
|
+
onAccept === null || onAccept === void 0 ? void 0 : onAccept(pickerTime.format(DEFAULT_TIME_FORMAT));
|
|
9884
9920
|
handleClose();
|
|
9885
9921
|
};
|
|
9922
|
+
const handleKeyDown = contextEnum => event => {
|
|
9923
|
+
const currentContextEnum = getContextEnumBasedOnTarget(event, inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, contextEnum);
|
|
9924
|
+
onKeyDown(event, currentContextEnum);
|
|
9925
|
+
};
|
|
9886
9926
|
const scrollToSelectedTime = () => {
|
|
9887
9927
|
if (!(hoursRef === null || hoursRef === void 0 ? void 0 : hoursRef.current) || !(minutesRef === null || minutesRef === void 0 ? void 0 : minutesRef.current)) return;
|
|
9888
9928
|
const selectedHour = calculateHourBasedOnTimeFormat(time, _ampm);
|
|
@@ -9915,6 +9955,100 @@ const DotTimePicker = ({
|
|
|
9915
9955
|
if (event.key !== 'Escape' || !isPickerOpened) return;
|
|
9916
9956
|
handleCancel();
|
|
9917
9957
|
};
|
|
9958
|
+
const wrapWithClickAwayListener = children => jsx(ClickAwayListener, Object.assign({
|
|
9959
|
+
onClickAway: handleSet
|
|
9960
|
+
}, {
|
|
9961
|
+
children: children
|
|
9962
|
+
}), void 0);
|
|
9963
|
+
const renderTimePickerHours = () => hours.map((hour, index) => {
|
|
9964
|
+
const isSelected = pickerTime ? selectedPickerHour === hour : false;
|
|
9965
|
+
return jsx(DotButton, Object.assign({
|
|
9966
|
+
className: "dot-picker-button",
|
|
9967
|
+
"data-testid": dataTestId && `${dataTestId}-hour-button-${hour}`,
|
|
9968
|
+
onClick: () => handleHourClick(hour),
|
|
9969
|
+
onKeyDown: handleTimeKeydown(hoursRef, index),
|
|
9970
|
+
tabIndex: getPopperButtonTabIndex(index, isSelected, selectedPickerHour),
|
|
9971
|
+
type: isSelected ? 'primary' : 'text'
|
|
9972
|
+
}, {
|
|
9973
|
+
children: hour.toString().padStart(2, '0')
|
|
9974
|
+
}), hour);
|
|
9975
|
+
});
|
|
9976
|
+
const renderTimePickerMinutes = () => minutes.map((minute, index) => {
|
|
9977
|
+
const isSelected = pickerTime ? pickerTime.minute() === minute : false;
|
|
9978
|
+
return jsx(DotButton, Object.assign({
|
|
9979
|
+
className: "dot-picker-button",
|
|
9980
|
+
"data-testid": dataTestId && `${dataTestId}-minute-button-${minute}`,
|
|
9981
|
+
type: isSelected ? 'primary' : 'text',
|
|
9982
|
+
onClick: () => handleMinuteClick(minute),
|
|
9983
|
+
onKeyDown: handleTimeKeydown(minutesRef, index),
|
|
9984
|
+
tabIndex: getPopperButtonTabIndex(index, isSelected, pickerTime === null || pickerTime === void 0 ? void 0 : pickerTime.minute())
|
|
9985
|
+
}, {
|
|
9986
|
+
children: minute.toString().padStart(2, '0')
|
|
9987
|
+
}), minute);
|
|
9988
|
+
});
|
|
9989
|
+
const renderTimePickerActionButtons = () => jsxs("div", Object.assign({
|
|
9990
|
+
className: "dot-time-picker-action-buttons"
|
|
9991
|
+
}, {
|
|
9992
|
+
children: [jsx(DotButton, Object.assign({
|
|
9993
|
+
"data-testid": dataTestId && `${dataTestId}-cancel`,
|
|
9994
|
+
onClick: handleCancel,
|
|
9995
|
+
size: "small",
|
|
9996
|
+
type: "text"
|
|
9997
|
+
}, {
|
|
9998
|
+
children: "Cancel"
|
|
9999
|
+
}), void 0), jsx(DotButton, Object.assign({
|
|
10000
|
+
"data-testid": dataTestId && `${dataTestId}-set`,
|
|
10001
|
+
onClick: handleSet,
|
|
10002
|
+
size: "small",
|
|
10003
|
+
type: "text"
|
|
10004
|
+
}, {
|
|
10005
|
+
children: "Set"
|
|
10006
|
+
}), void 0)]
|
|
10007
|
+
}), void 0);
|
|
10008
|
+
const renderDaytime = () => jsxs("div", Object.assign({
|
|
10009
|
+
className: "dot-time-picker-daytime",
|
|
10010
|
+
ref: daytimeRef
|
|
10011
|
+
}, {
|
|
10012
|
+
children: [jsx(DotButton, Object.assign({
|
|
10013
|
+
className: "dot-picker-button",
|
|
10014
|
+
"data-testid": dataTestId && `${dataTestId}-am-button`,
|
|
10015
|
+
onClick: () => handleDaytimeSelection(Daytime.AM),
|
|
10016
|
+
onKeyDown: handleTimeKeydown(daytimeRef, 0),
|
|
10017
|
+
tabIndex: getDaytimeButtonTabIndex(Daytime.AM, daytimeSelected),
|
|
10018
|
+
type: getDaytimeButtonType(daytimeSelected)
|
|
10019
|
+
}, {
|
|
10020
|
+
children: Daytime.AM
|
|
10021
|
+
}), Daytime.AM), jsx(DotButton, Object.assign({
|
|
10022
|
+
className: "dot-picker-button",
|
|
10023
|
+
"data-testid": dataTestId && `${dataTestId}-pm-button`,
|
|
10024
|
+
onClick: () => handleDaytimeSelection(Daytime.PM),
|
|
10025
|
+
onKeyDown: handleTimeKeydown(daytimeRef, 1),
|
|
10026
|
+
tabIndex: getDaytimeButtonTabIndex(Daytime.PM, daytimeSelected),
|
|
10027
|
+
type: getTimePickerButtonType(daytimeSelected)
|
|
10028
|
+
}, {
|
|
10029
|
+
children: Daytime.PM
|
|
10030
|
+
}), Daytime.PM)]
|
|
10031
|
+
}), void 0);
|
|
10032
|
+
const paperComponent = jsxs(Paper, Object.assign({
|
|
10033
|
+
className: "dot-time-picker-paper",
|
|
10034
|
+
elevation: 8
|
|
10035
|
+
}, {
|
|
10036
|
+
children: [jsxs("div", Object.assign({
|
|
10037
|
+
className: "dot-time-picker-selection"
|
|
10038
|
+
}, {
|
|
10039
|
+
children: [jsx("div", Object.assign({
|
|
10040
|
+
className: "dot-time-picker-hours",
|
|
10041
|
+
ref: hoursRef
|
|
10042
|
+
}, {
|
|
10043
|
+
children: renderTimePickerHours()
|
|
10044
|
+
}), void 0), jsx("div", Object.assign({
|
|
10045
|
+
className: "dot-time-picker-minutes",
|
|
10046
|
+
ref: minutesRef
|
|
10047
|
+
}, {
|
|
10048
|
+
children: renderTimePickerMinutes()
|
|
10049
|
+
}), void 0), _ampm && renderDaytime()]
|
|
10050
|
+
}), void 0), !hideActionButtons && renderTimePickerActionButtons()]
|
|
10051
|
+
}), void 0);
|
|
9918
10052
|
return jsxs(StyledTimePickerContainer, Object.assign({
|
|
9919
10053
|
className: containerClasses,
|
|
9920
10054
|
"data-testid": dataTestId,
|
|
@@ -9936,7 +10070,7 @@ const DotTimePicker = ({
|
|
|
9936
10070
|
autoFocus: _autoFocus,
|
|
9937
10071
|
className: rootClasses,
|
|
9938
10072
|
disabled: disabled,
|
|
9939
|
-
format:
|
|
10073
|
+
format: displayFormat,
|
|
9940
10074
|
inputRef: inputRef,
|
|
9941
10075
|
label: persistentLabel ? null : label,
|
|
9942
10076
|
onChange: handleInputChange,
|
|
@@ -9966,7 +10100,8 @@ const DotTimePicker = ({
|
|
|
9966
10100
|
onBlur
|
|
9967
10101
|
},
|
|
9968
10102
|
fullWidth: _fullWidth,
|
|
9969
|
-
name: inputName
|
|
10103
|
+
name: inputName,
|
|
10104
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Input)
|
|
9970
10105
|
},
|
|
9971
10106
|
field: {
|
|
9972
10107
|
readOnly: isComponentReadOnly
|
|
@@ -9980,97 +10115,10 @@ const DotTimePicker = ({
|
|
|
9980
10115
|
"data-testid": dataTestId && `${dataTestId}-popper`,
|
|
9981
10116
|
disablePortal: true,
|
|
9982
10117
|
open: isPickerOpened,
|
|
10118
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper),
|
|
9983
10119
|
placement: "bottom-start"
|
|
9984
10120
|
}, {
|
|
9985
|
-
children:
|
|
9986
|
-
onClickAway: handleSet
|
|
9987
|
-
}, {
|
|
9988
|
-
children: jsxs(Paper, Object.assign({
|
|
9989
|
-
className: "dot-time-picker-paper",
|
|
9990
|
-
elevation: 8
|
|
9991
|
-
}, {
|
|
9992
|
-
children: [jsxs("div", Object.assign({
|
|
9993
|
-
className: "dot-time-picker-selection"
|
|
9994
|
-
}, {
|
|
9995
|
-
children: [jsx("div", Object.assign({
|
|
9996
|
-
className: "dot-time-picker-hours",
|
|
9997
|
-
ref: hoursRef
|
|
9998
|
-
}, {
|
|
9999
|
-
children: hours.map((hour, index) => {
|
|
10000
|
-
const isSelected = pickerTime ? selectedPickerHour === hour : false;
|
|
10001
|
-
return jsx(DotButton, Object.assign({
|
|
10002
|
-
className: "dot-picker-button",
|
|
10003
|
-
"data-testid": dataTestId && `${dataTestId}-hour-button-${hour}`,
|
|
10004
|
-
onClick: () => handleHourClick(hour),
|
|
10005
|
-
onKeyDown: handleTimeKeydown(hoursRef, index),
|
|
10006
|
-
tabIndex: getPopperButtonTabIndex(index, isSelected, selectedPickerHour),
|
|
10007
|
-
type: isSelected ? 'primary' : 'text'
|
|
10008
|
-
}, {
|
|
10009
|
-
children: hour.toString().padStart(2, '0')
|
|
10010
|
-
}), hour);
|
|
10011
|
-
})
|
|
10012
|
-
}), void 0), jsx("div", Object.assign({
|
|
10013
|
-
className: "dot-time-picker-minutes",
|
|
10014
|
-
ref: minutesRef
|
|
10015
|
-
}, {
|
|
10016
|
-
children: minutes.map((minute, index) => {
|
|
10017
|
-
const isSelected = pickerTime ? pickerTime.minute() === minute : false;
|
|
10018
|
-
return jsx(DotButton, Object.assign({
|
|
10019
|
-
className: "dot-picker-button",
|
|
10020
|
-
"data-testid": dataTestId && `${dataTestId}-minute-button-${minute}`,
|
|
10021
|
-
type: isSelected ? 'primary' : 'text',
|
|
10022
|
-
onClick: () => handleMinuteClick(minute),
|
|
10023
|
-
onKeyDown: handleTimeKeydown(minutesRef, index),
|
|
10024
|
-
tabIndex: getPopperButtonTabIndex(index, isSelected, pickerTime === null || pickerTime === void 0 ? void 0 : pickerTime.minute())
|
|
10025
|
-
}, {
|
|
10026
|
-
children: minute.toString().padStart(2, '0')
|
|
10027
|
-
}), minute);
|
|
10028
|
-
})
|
|
10029
|
-
}), void 0), _ampm && jsxs("div", Object.assign({
|
|
10030
|
-
className: "dot-time-picker-daytime",
|
|
10031
|
-
ref: daytimeRef
|
|
10032
|
-
}, {
|
|
10033
|
-
children: [jsx(DotButton, Object.assign({
|
|
10034
|
-
className: "dot-picker-button",
|
|
10035
|
-
"data-testid": dataTestId && `${dataTestId}-am-button`,
|
|
10036
|
-
onClick: () => handleDaytimeSelection(Daytime.AM),
|
|
10037
|
-
onKeyDown: handleTimeKeydown(daytimeRef, 0),
|
|
10038
|
-
tabIndex: getDaytimeButtonTabIndex(Daytime.AM, daytimeSelected),
|
|
10039
|
-
type: daytimeSelected && daytimeSelected === Daytime.AM ? 'primary' : 'text'
|
|
10040
|
-
}, {
|
|
10041
|
-
children: Daytime.AM
|
|
10042
|
-
}), Daytime.AM), jsx(DotButton, Object.assign({
|
|
10043
|
-
className: "dot-picker-button",
|
|
10044
|
-
"data-testid": dataTestId && `${dataTestId}-pm-button`,
|
|
10045
|
-
onClick: () => handleDaytimeSelection(Daytime.PM),
|
|
10046
|
-
onKeyDown: handleTimeKeydown(daytimeRef, 1),
|
|
10047
|
-
tabIndex: getDaytimeButtonTabIndex(Daytime.PM, daytimeSelected),
|
|
10048
|
-
type: getTimePickerButtonType(daytimeSelected)
|
|
10049
|
-
}, {
|
|
10050
|
-
children: Daytime.PM
|
|
10051
|
-
}), Daytime.PM)]
|
|
10052
|
-
}), void 0)]
|
|
10053
|
-
}), void 0), !hideActionButtons && jsxs("div", Object.assign({
|
|
10054
|
-
className: "dot-time-picker-action-buttons"
|
|
10055
|
-
}, {
|
|
10056
|
-
children: [jsx(DotButton, Object.assign({
|
|
10057
|
-
"data-testid": dataTestId && `${dataTestId}-cancel`,
|
|
10058
|
-
onClick: handleCancel,
|
|
10059
|
-
size: "small",
|
|
10060
|
-
type: "text"
|
|
10061
|
-
}, {
|
|
10062
|
-
children: "Cancel"
|
|
10063
|
-
}), void 0), jsx(DotButton, Object.assign({
|
|
10064
|
-
"data-testid": dataTestId && `${dataTestId}-set`,
|
|
10065
|
-
onClick: handleSet,
|
|
10066
|
-
size: "small",
|
|
10067
|
-
type: "text"
|
|
10068
|
-
}, {
|
|
10069
|
-
children: "Set"
|
|
10070
|
-
}), void 0)]
|
|
10071
|
-
}), void 0)]
|
|
10072
|
-
}), void 0)
|
|
10073
|
-
}), void 0)
|
|
10121
|
+
children: _disableClickAwayListener ? paperComponent : wrapWithClickAwayListener(paperComponent)
|
|
10074
10122
|
}), void 0)]
|
|
10075
10123
|
}), void 0);
|
|
10076
10124
|
};
|
|
@@ -10087,4 +10135,4 @@ const DotClickAwayListener = ({
|
|
|
10087
10135
|
}, void 0);
|
|
10088
10136
|
};
|
|
10089
10137
|
|
|
10090
|
-
export { Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, lightThemeColors as lightColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotSnackbarContext };
|
|
10138
|
+
export { Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, checkIfValidDate, lightThemeColors as lightColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotSnackbarContext };
|