@digital-ai/dot-components 4.25.1 → 4.25.2

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/index.esm.js CHANGED
@@ -13875,68 +13875,17 @@ const StyledPickersDay = styled(PickersDay)`
13875
13875
 
13876
13876
  const rootClassName$C = 'dot-time-picker';
13877
13877
  const containerClassName$1 = 'dot-time-picker-container';
13878
+ const timePickerPopperClassName = 'dot-time-picker-popper';
13878
13879
  const TIME_SELECTION_HEIGHT_SPACING = 34.5;
13879
13880
  const TIME_SELECTION_WIDTH_SPACING = 14.5;
13880
13881
  const TIME_UNIT_WIDTH_SPACING = 4.5;
13881
13882
  const TIME_UNIT_HEIGHT_SPACING = 4.5;
13882
13883
  const StyledTimePickerContainer = styled.div`
13883
- ${({
13884
- theme
13885
- }) => css`
13884
+ ${() => css`
13886
13885
  &.${containerClassName$1} {
13887
13886
  .full-width {
13888
13887
  width: 100%;
13889
13888
  }
13890
-
13891
- .dot-time-picker-popper {
13892
- z-index: ${levelTop};
13893
-
13894
- .dot-time-picker-paper {
13895
- display: flex;
13896
- flex-direction: column;
13897
- align-items: center;
13898
-
13899
- .dot-time-picker-selection {
13900
- max-height: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING)};
13901
- width: ${theme.spacing(TIME_SELECTION_WIDTH_SPACING)};
13902
- display: flex;
13903
- margin: ${theme.spacing(1)};
13904
- gap: ${theme.spacing(0.5)};
13905
-
13906
- .dot-time-picker-hours,
13907
- .dot-time-picker-minutes,
13908
- .dot-time-picker-daytime {
13909
- display: flex;
13910
- flex-direction: column;
13911
- overflow: auto;
13912
- gap: ${theme.spacing(0.5)};
13913
- padding-bottom: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING - TIME_UNIT_HEIGHT_SPACING)};
13914
-
13915
- /* Hide scrollbar for Chrome, Safari and Opera */
13916
- ::-webkit-scrollbar {
13917
- display: none;
13918
- }
13919
-
13920
- /* Hide scrollbar for IE, Edge and Firefox */
13921
- -ms-overflow-style: none; /* IE and Edge */
13922
- scrollbar-width: none; /* Firefox */
13923
- }
13924
-
13925
- .dot-picker-button {
13926
- width: ${theme.spacing(TIME_UNIT_WIDTH_SPACING)};
13927
- height: ${theme.spacing(TIME_UNIT_HEIGHT_SPACING)};
13928
- margin: 0;
13929
- }
13930
- }
13931
-
13932
- .dot-time-picker-action-buttons {
13933
- display: flex;
13934
- align-items: center;
13935
- justify-content: space-between;
13936
- padding: ${theme.spacing(0.5)};
13937
- }
13938
- }
13939
- }
13940
13889
  }
13941
13890
  `}
13942
13891
  `;
@@ -13964,6 +13913,62 @@ const StyledTimePicker = styled(TimePicker)`
13964
13913
  }
13965
13914
  `}
13966
13915
  `;
13916
+ const StyledTimePickerPopper = styled(Popper)`
13917
+ ${({
13918
+ theme
13919
+ }) => css`
13920
+ &.${timePickerPopperClassName} {
13921
+ z-index: ${levelTop};
13922
+
13923
+ .dot-time-picker-paper {
13924
+ display: flex;
13925
+ flex-direction: column;
13926
+ align-items: center;
13927
+
13928
+ .dot-time-picker-selection {
13929
+ max-height: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING)};
13930
+ width: ${theme.spacing(TIME_SELECTION_WIDTH_SPACING)};
13931
+ display: flex;
13932
+ margin: ${theme.spacing(1)};
13933
+ gap: ${theme.spacing(0.5)};
13934
+
13935
+ .dot-time-picker-hours,
13936
+ .dot-time-picker-minutes,
13937
+ .dot-time-picker-daytime {
13938
+ display: flex;
13939
+ flex-direction: column;
13940
+ overflow: auto;
13941
+ gap: ${theme.spacing(0.5)};
13942
+ padding-bottom: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING - TIME_UNIT_HEIGHT_SPACING)};
13943
+
13944
+ /* Hide scrollbar for Chrome, Safari and Opera */
13945
+
13946
+ ::-webkit-scrollbar {
13947
+ display: none;
13948
+ }
13949
+
13950
+ /* Hide scrollbar for IE, Edge and Firefox */
13951
+ -ms-overflow-style: none; /* IE and Edge */
13952
+ scrollbar-width: none; /* Firefox */
13953
+ }
13954
+
13955
+ .dot-picker-button {
13956
+ width: ${theme.spacing(TIME_UNIT_WIDTH_SPACING)};
13957
+ height: ${theme.spacing(TIME_UNIT_HEIGHT_SPACING)};
13958
+ margin: 0;
13959
+ }
13960
+ }
13961
+
13962
+ .dot-time-picker-action-buttons {
13963
+ display: flex;
13964
+ align-items: center;
13965
+ justify-content: space-between;
13966
+ padding: ${theme.spacing(0.5)};
13967
+ }
13968
+ }
13969
+ }
13970
+ `}
13971
+ `;
13967
13972
 
13968
13973
  const rootClassName$B = 'dot-form';
13969
13974
  const StyledFormContainer = styled.div`
@@ -52794,7 +52799,9 @@ const DotTimePicker = ({
52794
52799
  }, [value, defaultValue]);
52795
52800
  useLayoutEffect(() => {
52796
52801
  if (isPickerOpened && time) {
52797
- scrollToSelectedTime();
52802
+ requestAnimationFrame(() => {
52803
+ scrollToSelectedTime();
52804
+ });
52798
52805
  }
52799
52806
  }, [isPickerOpened, time]);
52800
52807
  useEffect(() => {
@@ -52811,6 +52818,7 @@ const DotTimePicker = ({
52811
52818
  onPopperTimeChange && onPopperTimeChange(pickedDateTime.format(DEFAULT_TIME_FORMAT));
52812
52819
  };
52813
52820
  const handleInputChange = (currentValue, context) => {
52821
+ if (currentValue && !currentValue.isValid()) return;
52814
52822
  const currentTimeValue = currentValue ? currentValue : null;
52815
52823
  setPickerTime(currentValue ? currentValue : null);
52816
52824
  !isControlledComponent && setTime(currentTimeValue);
@@ -52843,7 +52851,7 @@ const DotTimePicker = ({
52843
52851
  handleClose();
52844
52852
  };
52845
52853
  const handleSet = () => {
52846
- if (!pickerTime) {
52854
+ if (!pickerTime || pickerTime.isSame(time)) {
52847
52855
  handleClose();
52848
52856
  return;
52849
52857
  }
@@ -53039,11 +53047,11 @@ const DotTimePicker = ({
53039
53047
  },
53040
53048
  value: time
53041
53049
  })]
53042
- }), jsx(Popper, {
53050
+ }), jsx(StyledTimePickerPopper, {
53043
53051
  anchorEl: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current,
53044
- className: "dot-time-picker-popper",
53052
+ className: timePickerPopperClassName,
53045
53053
  "data-testid": dataTestId && `${dataTestId}-popper`,
53046
- disablePortal: true,
53054
+ disablePortal: false,
53047
53055
  open: isPickerOpened,
53048
53056
  onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper),
53049
53057
  placement: "bottom-start",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.25.1",
3
+ "version": "4.25.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -1,7 +1,18 @@
1
1
  /// <reference types="react" />
2
2
  export declare const rootClassName = "dot-time-picker";
3
3
  export declare const containerClassName = "dot-time-picker-container";
4
+ export declare const timePickerPopperClassName = "dot-time-picker-popper";
4
5
  export declare const StyledTimePickerContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
5
6
  export declare const StyledTimePicker: import("styled-components").StyledComponent<(<TDate>(props: import("@mui/x-date-pickers").TimePickerProps<TDate> & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element) & {
6
7
  propTypes?: any;
7
8
  }, any, {}, never>;
9
+ export declare const StyledTimePickerPopper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("@mui/base").PopperProps, "direction"> & {
10
+ component?: import("react").ElementType<any>;
11
+ components?: {
12
+ Root?: import("react").ElementType<any>;
13
+ };
14
+ componentsProps?: {
15
+ root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps>;
16
+ };
17
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme>;
18
+ } & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;