@raystack/apsara 0.18.2 → 0.18.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.
@@ -1,4 +1,8 @@
1
1
  import { DayPickerProps } from "react-day-picker";
2
- export type CalendarProps = DayPickerProps & {};
3
- export declare const Calendar: ({ className, classNames, showOutsideDays, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
2
+ interface OnDropdownOpen {
3
+ onDropdownOpen?: VoidFunction;
4
+ }
5
+ export type CalendarProps = DayPickerProps & OnDropdownOpen;
6
+ export declare const Calendar: ({ className, classNames, showOutsideDays, onDropdownOpen, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
4
8
  //# sourceMappingURL=calendar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../calendar/calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAa5E,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,EAAE,CAAC;AAkDhD,eAAO,MAAM,QAAQ,yDAKlB,aAAa,4CAyCf,CAAC"}
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../calendar/calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAa5E,UAAU,cAAc;IACtB,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC;AAmE5D,eAAO,MAAM,QAAQ,yEAMlB,aAAa,4CA2Cf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAElE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CAoCjB"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAElE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CA+CjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../dialog/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBA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,eAAe,CAAC,OAAO,CAAC,EAC9D,YAAY,CAAC,OAAO,OAAO,CAAC;CAAG;AAgBnC,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AACrE,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAMlB;AAED,eAAO,MAAM,MAAM;;;;;;;;;;CAMjB,CAAC"}
package/dist/index.cjs CHANGED
@@ -6675,7 +6675,7 @@ var styles$t = {"dialogContent":"dialog-module_dialogContent__bljTL","overlay":"
6675
6675
 
6676
6676
  const dialogContent = cva(styles$t.dialogContent);
6677
6677
  const DialogContent = React.forwardRef(({ className, children, close, overlayStyle, overlayClassname, ...props }, forwardedRef) => {
6678
- return (jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$602eac185826482c, { children: [jsxRuntimeExports.jsx(Overlay$1, { className: overlayClassname, style: overlayStyle }), jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: dialogContent({ className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton$1, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] })] }));
6678
+ return (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$602eac185826482c, { children: jsxRuntimeExports.jsx(Overlay$1, { className: overlayClassname, style: overlayStyle, children: jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: dialogContent({ className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton$1, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] }) }) }));
6679
6679
  });
6680
6680
  const overlay$1 = cva(styles$t.overlay);
6681
6681
  const Overlay$1 = React.forwardRef(({ className, ...props }, ref) => (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, { ref: ref, className: overlay$1({ className }), ...props })));
@@ -21283,7 +21283,7 @@ const sheetContent = cva(styles$b.sheetContent, {
21283
21283
  },
21284
21284
  });
21285
21285
  const SheetContent = React.forwardRef(({ className, children, close, side, ...props }, forwardedRef) => {
21286
- return (jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$602eac185826482c, { children: [jsxRuntimeExports.jsx(Overlay, {}), jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: sheetContent({ side, className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] })] }));
21286
+ return (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$602eac185826482c, { children: jsxRuntimeExports.jsx(Overlay, { children: jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: sheetContent({ side, className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] }) }) }));
21287
21287
  });
21288
21288
  const overlay = cva(styles$b.overlay);
21289
21289
  const Overlay = React.forwardRef(({ className, ...props }, ref) => (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, { ref: ref, className: overlay({ className }), ...props })));
@@ -28048,19 +28048,24 @@ function DayPicker(props) {
28048
28048
  var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption_label":"calendar-module_caption_label__C5Ys7","dropdowns":"calendar-module_dropdowns__Wn53e","dropdown_trigger":"calendar-module_dropdown_trigger__dsyaq","dropdown_item_text":"calendar-module_dropdown_item_text__Tudqv","nav_button":"calendar-module_nav_button__8W5py","nav_button_previous":"calendar-module_nav_button_previous__lWJYm","nav_button_next":"calendar-module_nav_button_next__1MzRT","months":"calendar-module_months__IN75k","nav":"calendar-module_nav__aGeze","month_caption":"calendar-module_month_caption__Ws6Hx","day":"calendar-module_day__rQFGK","disabled":"calendar-module_disabled__jqgRB","outside":"calendar-module_outside__nq5XC","selected":"calendar-module_selected__kiiAZ","range_middle":"calendar-module_range_middle__PmzFi","range_start":"calendar-module_range_start__ZUooG","range_end":"calendar-module_range_end__PKrm7","week":"calendar-module_week__kCvKJ","day_button":"calendar-module_day_button__vCKP1","today":"calendar-module_today__iXQIQ","weekday":"calendar-module_weekday__xzf6F","hidden":"calendar-module_hidden__wqJVo","calendarPopover":"calendar-module_calendarPopover__PY4sa","datePickerInput":"calendar-module_datePickerInput__aOnRQ","dropdown_icon":"calendar-module_dropdown_icon__rDTbz","dropdown_content":"calendar-module_dropdown_content__ajJ5V"};
28049
28049
 
28050
28050
  const root$1 = cva(styles$6.calendarRoot);
28051
- function DropDown({ options = [], value, onChange }) {
28051
+ function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
28052
+ const [open, setOpen] = React.useState(false);
28053
+ React.useEffect(() => {
28054
+ if (open && onDropdownOpen)
28055
+ onDropdownOpen();
28056
+ }, [open]);
28052
28057
  function handleChange(value) {
28053
28058
  if (onChange) {
28054
28059
  onChange({ target: { value } });
28055
28060
  }
28056
28061
  }
28057
- return (jsxRuntimeExports.jsxs(Select$1, { value: value?.toString(), onValueChange: handleChange, children: [jsxRuntimeExports.jsx(Select$1.Trigger, { className: styles$6.dropdown_trigger, iconProps: {
28062
+ return (jsxRuntimeExports.jsxs(Select$1, { value: value?.toString(), onValueChange: handleChange, open: open, onOpenChange: setOpen, children: [jsxRuntimeExports.jsx(Select$1.Trigger, { className: styles$6.dropdown_trigger, iconProps: {
28058
28063
  className: styles$6.dropdown_icon,
28059
28064
  }, children: jsxRuntimeExports.jsx(Select$1.Value, {}) }), jsxRuntimeExports.jsxs(Select$1.Content, { className: styles$6.dropdown_content, children: [jsxRuntimeExports.jsx(Select$1.ScrollUpButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: "center", children: jsxRuntimeExports.jsx(ChevronUpIcon, {}) }) }), jsxRuntimeExports.jsx(Select$1.Viewport, { children: options.map((opt) => (jsxRuntimeExports.jsx(Select$1.Item, { value: opt.value.toString(), disabled: opt.disabled, textProps: {
28060
28065
  className: styles$6.dropdown_item_text,
28061
28066
  }, children: opt.label }, opt.value))) }), jsxRuntimeExports.jsx(Select$1.ScrollDownButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: "center", children: jsxRuntimeExports.jsx(ChevronDownIcon, {}) }) })] })] }));
28062
28067
  }
28063
- const Calendar = function ({ className, classNames, showOutsideDays = true, ...props }) {
28068
+ const Calendar = function ({ className, classNames, showOutsideDays = true, onDropdownOpen, ...props }) {
28064
28069
  return (jsxRuntimeExports.jsx(DayPicker, { showOutsideDays: showOutsideDays, components: {
28065
28070
  Chevron: (props) => {
28066
28071
  if (props.orientation === "left") {
@@ -28068,7 +28073,7 @@ const Calendar = function ({ className, classNames, showOutsideDays = true, ...p
28068
28073
  }
28069
28074
  return jsxRuntimeExports.jsx(ChevronRightIcon, { ...props });
28070
28075
  },
28071
- Dropdown: DropDown,
28076
+ Dropdown: (props) => (jsxRuntimeExports.jsx(DropDown, { ...props, onDropdownOpen: onDropdownOpen })),
28072
28077
  }, classNames: {
28073
28078
  caption_label: styles$6.caption_label,
28074
28079
  button_previous: `${styles$6.nav_button} ${styles$6.nav_button_previous}`,
@@ -28142,14 +28147,21 @@ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
28142
28147
  function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, value = new Date(), onSelect = () => { }, }) {
28143
28148
  const [showCalendar, setShowCalendar] = React.useState(false);
28144
28149
  const dateValue = dayjs(value).format(dateFormat);
28150
+ const isDropdownOpenedRef = React.useRef(false);
28145
28151
  const handleSelect = (day) => {
28146
28152
  onSelect(day);
28147
28153
  setShowCalendar(false);
28148
28154
  };
28155
+ function onDropdownOpen() {
28156
+ isDropdownOpenedRef.current = true;
28157
+ }
28149
28158
  function onOpenChange(open) {
28150
- setShowCalendar(Boolean(open));
28159
+ if (!isDropdownOpenedRef.current) {
28160
+ setShowCalendar(Boolean(open));
28161
+ }
28162
+ isDropdownOpenedRef.current = false;
28151
28163
  }
28152
- return (jsxRuntimeExports.jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntimeExports.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports.jsx(TextField, { value: dateValue, trailing: jsxRuntimeExports.jsx(CalendarIcon, {}), className: styles$6.datePickerInput, readOnly: true, ...textFieldProps }) }), jsxRuntimeExports.jsx(Popover.Content, { side: side, className: styles$6.calendarPopover, children: jsxRuntimeExports.jsx(Calendar, { required: true, ...calendarProps, mode: "single", selected: value, defaultMonth: value, onSelect: handleSelect }) })] }));
28164
+ return (jsxRuntimeExports.jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntimeExports.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports.jsx(TextField, { value: dateValue, trailing: jsxRuntimeExports.jsx(CalendarIcon, {}), className: styles$6.datePickerInput, readOnly: true, ...textFieldProps }) }), jsxRuntimeExports.jsx(Popover.Content, { side: side, className: styles$6.calendarPopover, children: jsxRuntimeExports.jsx(Calendar, { required: true, ...calendarProps, onDropdownOpen: onDropdownOpen, mode: "single", selected: value, defaultMonth: value, onSelect: handleSelect }) })] }));
28153
28165
  }
28154
28166
 
28155
28167
  function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {