@ceed/ads 0.0.51 → 0.0.53

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.
@@ -11,6 +11,10 @@ export declare const useCalendarProps: (inProps: CalendarProps) => readonly [{
11
11
  views: View[];
12
12
  slots?: Partial<Record<import("../types").CalendarSlot, React.ElementType<any, keyof React.JSX.IntrinsicElements>>> | undefined;
13
13
  rangeSelection?: boolean | undefined;
14
+ minDate?: Date | undefined;
15
+ maxDate?: Date | undefined;
16
+ disableFuture?: boolean | undefined;
17
+ disablePast?: boolean | undefined;
14
18
  }, {
15
19
  viewMonth: Date;
16
20
  direction: number;
@@ -24,4 +28,8 @@ export declare const useCalendarProps: (inProps: CalendarProps) => readonly [{
24
28
  views: View[];
25
29
  slots?: Partial<Record<import("../types").CalendarSlot, React.ElementType<any, keyof React.JSX.IntrinsicElements>>> | undefined;
26
30
  rangeSelection?: boolean | undefined;
31
+ minDate?: Date | undefined;
32
+ maxDate?: Date | undefined;
33
+ disableFuture?: boolean | undefined;
34
+ disablePast?: boolean | undefined;
27
35
  }];
@@ -12,6 +12,7 @@ export declare const useCalendar: (ownerState: CalendarOwnerState) => {
12
12
  readonly isSelected: boolean | undefined;
13
13
  readonly onClick: () => void;
14
14
  readonly onMouseEnter: (() => void) | undefined;
15
+ readonly disabled: boolean | undefined;
15
16
  readonly tabIndex: -1;
16
17
  readonly "aria-label": string;
17
18
  readonly "aria-selected": "true" | undefined;
@@ -19,6 +20,7 @@ export declare const useCalendar: (ownerState: CalendarOwnerState) => {
19
20
  };
20
21
  getPickerMonthProps: (monthIndex: number) => {
21
22
  readonly isSelected: boolean | undefined;
23
+ readonly disabled: boolean | undefined;
22
24
  readonly onClick: () => void;
23
25
  readonly tabIndex: -1;
24
26
  readonly "aria-label": string;
@@ -13,6 +13,10 @@ export interface CalendarProps {
13
13
  onMonthChange?: (newMonth: DateValue) => void;
14
14
  slots?: Partial<Record<CalendarSlot, React.ElementType>>;
15
15
  rangeSelection?: boolean;
16
+ minDate?: DateValue;
17
+ maxDate?: DateValue;
18
+ disableFuture?: boolean;
19
+ disablePast?: boolean;
16
20
  }
17
21
  export interface CalendarOwnerState extends CalendarProps {
18
22
  viewMonth: Date;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  declare const Modal: import("framer-motion").CustomDomComponent<Pick<import("@mui/base").ModalOwnProps, "children" | "container" | "open" | "disablePortal" | "keepMounted" | "disableAutoFocus" | "disableEnforceFocus" | "disableRestoreFocus" | "disableEscapeKeyDown" | "disableScrollLock" | "hideBackdrop"> & {
3
- onClose?: ((event: {}, reason: "escapeKeyDown" | "backdropClick" | "closeClick") => void) | undefined;
3
+ onClose?: ((event: {}, reason: "backdropClick" | "escapeKeyDown" | "closeClick") => void) | undefined;
4
4
  sx?: import("@mui/joy/styles/types").SxProps | undefined;
5
5
  } & import("@mui/joy").ModalSlotsAndSlotProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
6
6
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
package/dist/index.js CHANGED
@@ -440,6 +440,11 @@ var useCalendar = (ownerState) => {
440
440
  isSelected,
441
441
  onClick: handleDayClick,
442
442
  onMouseEnter: ownerState.rangeSelection && ownerState.value?.[0] && !ownerState.value?.[1] ? () => setHoverDay(thisDay) : void 0,
443
+ disabled: ownerState.minDate && thisDay < ownerState.minDate || ownerState.maxDate && thisDay > ownerState.maxDate || ownerState.disableFuture && thisDay > /* @__PURE__ */ new Date() || ownerState.disablePast && thisDay < (() => {
444
+ const today = /* @__PURE__ */ new Date();
445
+ today.setHours(0, 0, 0, 0);
446
+ return today;
447
+ })(),
443
448
  tabIndex: -1,
444
449
  "aria-label": thisDay.toLocaleDateString(),
445
450
  "aria-selected": isSelected ? "true" : void 0,
@@ -451,6 +456,10 @@ var useCalendar = (ownerState) => {
451
456
  ownerState.value,
452
457
  ownerState.viewMonth,
453
458
  ownerState.rangeSelection,
459
+ ownerState.minDate,
460
+ ownerState.maxDate,
461
+ ownerState.disableFuture,
462
+ ownerState.disablePast,
454
463
  hoverDay
455
464
  ]
456
465
  ),
@@ -467,6 +476,16 @@ var useCalendar = (ownerState) => {
467
476
  };
468
477
  return {
469
478
  isSelected,
479
+ disabled: ownerState.minDate && (() => {
480
+ const lastDay = new Date(thisMonth);
481
+ lastDay.setMonth(lastDay.getMonth() + 1);
482
+ lastDay.setDate(0);
483
+ return lastDay < ownerState.minDate;
484
+ })() || ownerState.maxDate && (() => {
485
+ const lastDay = new Date(thisMonth);
486
+ lastDay.setDate(0);
487
+ return lastDay > ownerState.maxDate;
488
+ })() || ownerState.disableFuture && thisMonth > /* @__PURE__ */ new Date() || ownerState.disablePast && thisMonth < /* @__PURE__ */ new Date(),
470
489
  onClick: handleMonthClick,
471
490
  tabIndex: -1,
472
491
  "aria-label": getMonthName(thisMonth, ownerState.locale || "default")
@@ -478,7 +497,11 @@ var useCalendar = (ownerState) => {
478
497
  ownerState.onChange,
479
498
  ownerState.viewMonth,
480
499
  ownerState.locale,
481
- ownerState.value
500
+ ownerState.value,
501
+ ownerState.minDate,
502
+ ownerState.maxDate,
503
+ ownerState.disableFuture,
504
+ ownerState.disablePast
482
505
  ]
483
506
  )
484
507
  };
@@ -1401,18 +1424,13 @@ import { Popper } from "@mui/base/Popper";
1401
1424
 
1402
1425
  // src/components/Input/Input.tsx
1403
1426
  import React11 from "react";
1404
- import {
1405
- Input as JoyInput,
1406
- FormControl,
1407
- FormLabel,
1408
- FormHelperText
1409
- } from "@mui/joy";
1427
+ import { Input as JoyInput } from "@mui/joy";
1410
1428
  import { motion as motion10 } from "framer-motion";
1411
1429
  var MotionInput = motion10(JoyInput);
1412
1430
  var Input = (props) => {
1413
1431
  const { label, helperText, error, style, ...innerProps } = props;
1414
1432
  if (label) {
1415
- return /* @__PURE__ */ React11.createElement(FormControl, { error }, /* @__PURE__ */ React11.createElement(FormLabel, null, label), /* @__PURE__ */ React11.createElement(MotionInput, { ...innerProps }), helperText && /* @__PURE__ */ React11.createElement(FormHelperText, null, helperText));
1433
+ return /* @__PURE__ */ React11.createElement(FormControl, { error }, /* @__PURE__ */ React11.createElement(FormLabel, null, label), /* @__PURE__ */ React11.createElement(MotionInput, { ...innerProps, color: error ? "danger" : innerProps.color }), helperText && /* @__PURE__ */ React11.createElement(FormHelperText, null, helperText));
1416
1434
  }
1417
1435
  return /* @__PURE__ */ React11.createElement(MotionInput, { ...innerProps });
1418
1436
  };
@@ -1435,21 +1453,21 @@ var DialogActions_default = DialogActions;
1435
1453
  import { FormControl as JoyFormControl } from "@mui/joy";
1436
1454
  import { motion as motion12 } from "framer-motion";
1437
1455
  var MotionFormControl = motion12(JoyFormControl);
1438
- var FormControl2 = MotionFormControl;
1439
- FormControl2.displayName = "FormControl";
1456
+ var FormControl = MotionFormControl;
1457
+ FormControl.displayName = "FormControl";
1440
1458
 
1441
1459
  // src/components/FormControl/index.ts
1442
- var FormControl_default = FormControl2;
1460
+ var FormControl_default = FormControl;
1443
1461
 
1444
1462
  // src/components/FormLabel/FormLabel.tsx
1445
1463
  import { FormLabel as JoyFormLabel } from "@mui/joy";
1446
1464
  import { motion as motion13 } from "framer-motion";
1447
1465
  var MotionFormLabel = motion13(JoyFormLabel);
1448
- var FormLabel2 = MotionFormLabel;
1449
- FormLabel2.displayName = "FormLabel";
1466
+ var FormLabel = MotionFormLabel;
1467
+ FormLabel.displayName = "FormLabel";
1450
1468
 
1451
1469
  // src/components/FormLabel/index.ts
1452
- var FormLabel_default = FormLabel2;
1470
+ var FormLabel_default = FormLabel;
1453
1471
 
1454
1472
  // src/components/DatePicker/DatePicker.tsx
1455
1473
  var StyledPopper = styled3(Popper, {
@@ -1722,7 +1740,7 @@ var DateRangePicker = forwardRef5(
1722
1740
  setValue(event.target.value);
1723
1741
  onChange?.(event);
1724
1742
  },
1725
- []
1743
+ [onChange]
1726
1744
  );
1727
1745
  const handleCalendarToggle = useCallback5(
1728
1746
  (event) => {
@@ -1914,8 +1932,8 @@ Dropdown.displayName = "Dropdown";
1914
1932
  import { FormHelperText as JoyFormHelperText } from "@mui/joy";
1915
1933
  import { motion as motion20 } from "framer-motion";
1916
1934
  var MotionFormHelperText = motion20(JoyFormHelperText);
1917
- var FormHelperText2 = MotionFormHelperText;
1918
- FormHelperText2.displayName = "FormHelperText";
1935
+ var FormHelperText = MotionFormHelperText;
1936
+ FormHelperText.displayName = "FormHelperText";
1919
1937
 
1920
1938
  // src/components/Grid/Grid.tsx
1921
1939
  import { Grid as JoyGrid } from "@mui/joy";
@@ -1970,10 +1988,7 @@ RadioList.displayName = "RadioList";
1970
1988
  import React20 from "react";
1971
1989
  import {
1972
1990
  Select as JoySelect,
1973
- Option as JoyOption,
1974
- FormControl as FormControl3,
1975
- FormLabel as FormLabel3,
1976
- FormHelperText as FormHelperText3
1991
+ Option as JoyOption
1977
1992
  } from "@mui/joy";
1978
1993
  import { motion as motion24 } from "framer-motion";
1979
1994
  var MotionOption = motion24(JoyOption);
@@ -1982,7 +1997,7 @@ Option.displayName = "Option";
1982
1997
  function Select(props) {
1983
1998
  const { label, helperText, error, ...innerProps } = props;
1984
1999
  if (label) {
1985
- return /* @__PURE__ */ React20.createElement(FormControl3, { error }, /* @__PURE__ */ React20.createElement(FormLabel3, null, label), /* @__PURE__ */ React20.createElement(JoySelect, { ...innerProps }), helperText && /* @__PURE__ */ React20.createElement(FormHelperText3, null, helperText));
2000
+ return /* @__PURE__ */ React20.createElement(FormControl, { error }, /* @__PURE__ */ React20.createElement(FormLabel, null, label), /* @__PURE__ */ React20.createElement(JoySelect, { ...innerProps, color: error ? "danger" : innerProps.color }), helperText && /* @__PURE__ */ React20.createElement(FormHelperText, null, helperText));
1986
2001
  }
1987
2002
  return /* @__PURE__ */ React20.createElement(JoySelect, { ...innerProps });
1988
2003
  }
@@ -2157,9 +2172,9 @@ export {
2157
2172
  Divider,
2158
2173
  Drawer,
2159
2174
  Dropdown,
2160
- FormControl2 as FormControl,
2161
- FormHelperText2 as FormHelperText,
2162
- FormLabel2 as FormLabel,
2175
+ FormControl,
2176
+ FormHelperText,
2177
+ FormLabel,
2163
2178
  Grid,
2164
2179
  IconButton,
2165
2180
  Input,