@digital-ai/dot-components 4.25.0 → 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
@@ -13840,7 +13840,9 @@ const StyledDatePicker = styled(DatePicker)`
13840
13840
  }
13841
13841
 
13842
13842
  .dot-icon-btn .dot-i {
13843
- margin-top: -5px;
13843
+ color: ${theme.palette.figma.typography.black};
13844
+ margin-top: -6px;
13845
+ margin-right: 6px;
13844
13846
  }
13845
13847
 
13846
13848
  .MuiFormLabel-root {
@@ -13873,68 +13875,17 @@ const StyledPickersDay = styled(PickersDay)`
13873
13875
 
13874
13876
  const rootClassName$C = 'dot-time-picker';
13875
13877
  const containerClassName$1 = 'dot-time-picker-container';
13878
+ const timePickerPopperClassName = 'dot-time-picker-popper';
13876
13879
  const TIME_SELECTION_HEIGHT_SPACING = 34.5;
13877
13880
  const TIME_SELECTION_WIDTH_SPACING = 14.5;
13878
13881
  const TIME_UNIT_WIDTH_SPACING = 4.5;
13879
13882
  const TIME_UNIT_HEIGHT_SPACING = 4.5;
13880
13883
  const StyledTimePickerContainer = styled.div`
13881
- ${({
13882
- theme
13883
- }) => css`
13884
+ ${() => css`
13884
13885
  &.${containerClassName$1} {
13885
13886
  .full-width {
13886
13887
  width: 100%;
13887
13888
  }
13888
-
13889
- .dot-time-picker-popper {
13890
- z-index: ${levelTop};
13891
-
13892
- .dot-time-picker-paper {
13893
- display: flex;
13894
- flex-direction: column;
13895
- align-items: center;
13896
-
13897
- .dot-time-picker-selection {
13898
- max-height: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING)};
13899
- width: ${theme.spacing(TIME_SELECTION_WIDTH_SPACING)};
13900
- display: flex;
13901
- margin: ${theme.spacing(1)};
13902
- gap: ${theme.spacing(0.5)};
13903
-
13904
- .dot-time-picker-hours,
13905
- .dot-time-picker-minutes,
13906
- .dot-time-picker-daytime {
13907
- display: flex;
13908
- flex-direction: column;
13909
- overflow: auto;
13910
- gap: ${theme.spacing(0.5)};
13911
- padding-bottom: ${theme.spacing(TIME_SELECTION_HEIGHT_SPACING - TIME_UNIT_HEIGHT_SPACING)};
13912
-
13913
- /* Hide scrollbar for Chrome, Safari and Opera */
13914
- ::-webkit-scrollbar {
13915
- display: none;
13916
- }
13917
-
13918
- /* Hide scrollbar for IE, Edge and Firefox */
13919
- -ms-overflow-style: none; /* IE and Edge */
13920
- scrollbar-width: none; /* Firefox */
13921
- }
13922
-
13923
- .dot-picker-button {
13924
- width: ${theme.spacing(TIME_UNIT_WIDTH_SPACING)};
13925
- height: ${theme.spacing(TIME_UNIT_HEIGHT_SPACING)};
13926
- margin: 0;
13927
- }
13928
- }
13929
-
13930
- .dot-time-picker-action-buttons {
13931
- display: flex;
13932
- align-items: center;
13933
- justify-content: space-between;
13934
- padding: ${theme.spacing(0.5)};
13935
- }
13936
- }
13937
- }
13938
13889
  }
13939
13890
  `}
13940
13891
  `;
@@ -13951,7 +13902,9 @@ const StyledTimePicker = styled(TimePicker)`
13951
13902
  }
13952
13903
 
13953
13904
  .dot-icon-btn .dot-i {
13954
- margin-top: -5px;
13905
+ margin-top: -6px;
13906
+ margin-right: 6px;
13907
+ color: ${theme.palette.figma.typography.black};
13955
13908
  }
13956
13909
 
13957
13910
  .MuiFormLabel-root {
@@ -13960,6 +13913,62 @@ const StyledTimePicker = styled(TimePicker)`
13960
13913
  }
13961
13914
  `}
13962
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
+ `;
13963
13972
 
13964
13973
  const rootClassName$B = 'dot-form';
13965
13974
  const StyledFormContainer = styled.div`
@@ -52599,7 +52608,8 @@ const DotDatePicker = ({
52599
52608
  children: [error && jsx(DotIcon, {
52600
52609
  className: "dot-error-icon",
52601
52610
  "data-testid": "dot-error-icon",
52602
- iconId: "error-solid"
52611
+ iconId: "error-solid",
52612
+ fontSize: "large"
52603
52613
  }), jsx(DotIconButton, {
52604
52614
  ariaLabel: "Open date picker",
52605
52615
  "data-pendoid": "date-picker-open-btn",
@@ -52789,7 +52799,9 @@ const DotTimePicker = ({
52789
52799
  }, [value, defaultValue]);
52790
52800
  useLayoutEffect(() => {
52791
52801
  if (isPickerOpened && time) {
52792
- scrollToSelectedTime();
52802
+ requestAnimationFrame(() => {
52803
+ scrollToSelectedTime();
52804
+ });
52793
52805
  }
52794
52806
  }, [isPickerOpened, time]);
52795
52807
  useEffect(() => {
@@ -52806,6 +52818,7 @@ const DotTimePicker = ({
52806
52818
  onPopperTimeChange && onPopperTimeChange(pickedDateTime.format(DEFAULT_TIME_FORMAT));
52807
52819
  };
52808
52820
  const handleInputChange = (currentValue, context) => {
52821
+ if (currentValue && !currentValue.isValid()) return;
52809
52822
  const currentTimeValue = currentValue ? currentValue : null;
52810
52823
  setPickerTime(currentValue ? currentValue : null);
52811
52824
  !isControlledComponent && setTime(currentTimeValue);
@@ -52838,7 +52851,7 @@ const DotTimePicker = ({
52838
52851
  handleClose();
52839
52852
  };
52840
52853
  const handleSet = () => {
52841
- if (!pickerTime) {
52854
+ if (!pickerTime || pickerTime.isSame(time)) {
52842
52855
  handleClose();
52843
52856
  return;
52844
52857
  }
@@ -53006,7 +53019,8 @@ const DotTimePicker = ({
53006
53019
  children: [error && jsx(DotIcon, {
53007
53020
  className: "dot-error-icon",
53008
53021
  "data-testid": dataTestId && `${dataTestId}-input-error-icon`,
53009
- iconId: "error-solid"
53022
+ iconId: "error-solid",
53023
+ fontSize: "large"
53010
53024
  }), !disableOpenPicker && !isComponentReadOnly && !disabled && jsx(DotIconButton, {
53011
53025
  ariaLabel: "Open time picker",
53012
53026
  "data-pendoid": dataPendoId && `${dataPendoId}-open-btn`,
@@ -53033,11 +53047,11 @@ const DotTimePicker = ({
53033
53047
  },
53034
53048
  value: time
53035
53049
  })]
53036
- }), jsx(Popper, {
53050
+ }), jsx(StyledTimePickerPopper, {
53037
53051
  anchorEl: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current,
53038
- className: "dot-time-picker-popper",
53052
+ className: timePickerPopperClassName,
53039
53053
  "data-testid": dataTestId && `${dataTestId}-popper`,
53040
- disablePortal: true,
53054
+ disablePortal: false,
53041
53055
  open: isPickerOpened,
53042
53056
  onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper),
53043
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.0",
3
+ "version": "4.25.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -80,6 +80,6 @@ export interface DatePickerProps extends CommonProps {
80
80
  */
81
81
  showDaysOutsideCurrentMonth?: boolean;
82
82
  /** The selected value. Used when the component is controlled. Date in ISO 8601 format, ie: YYYY-MM-DD */
83
- value?: string;
83
+ value?: string | null;
84
84
  }
85
85
  export declare const DotDatePicker: ({ ariaLabel, autoFocus, className, closeOnSelect, "data-pendoid": dataPendoId, "data-testid": dataTestId, defaultValue, disableOpenPicker, disablePast, disablePortal, disabled, displayWeekNumber, displayClearButton, error, fixedWeekNumber, focusInputOnPopperOpened, format, fullWidth, helperText, inputId, inputName, label, locale, maxDate, minDate, onAccept, onBlur, onChange, onClose, onError, onKeyDown, onOpen, open, persistentLabel, readOnly, required, showDaysOutsideCurrentMonth, value, informationToolTip, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -55,7 +55,7 @@ export interface TimePickerProps extends CommonProps {
55
55
  /** If true, the label is displayed as required and the input element will be required. */
56
56
  required?: boolean;
57
57
  /** The selected value. Used when the component is controlled. Time in ISO 8601 format, ie: HH:mm */
58
- value?: string;
58
+ value?: string | null;
59
59
  }
60
60
  export declare const DEFAULT_PICKER_TIME_FORMAT = "HH:mm";
61
61
  export declare const DEFAULT_TIME_FORMAT = "HH:mm";
@@ -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>;