@dilipod/ui 0.2.12 → 0.2.13

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 +1 @@
1
- {"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/components/use-toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAK7D,KAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,QAAA,MAAM,WAAW;;;;;CAKP,CAAA;AASV,KAAK,UAAU,GAAG,OAAO,WAAW,CAAA;AAEpC,KAAK,MAAM,GACP;IACE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC7B,KAAK,EAAE,YAAY,CAAA;CACpB,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAEL,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAoBD,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAmDtD,CAAA;AAaD,KAAK,KAAK,GAAG,IAAI,CA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eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAqDtD,CAAA;AAaD,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAGT,YAAY;EAwBpC;AAED,iBAAS,QAAQ;;wBAgBO,MAAM;YAvJpB,YAAY,EAAE;EAyJvB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
package/dist/index.js CHANGED
@@ -261,7 +261,7 @@ var SheetOverlay = React24__namespace.forwardRef(({ className, ...props }, ref)
261
261
  SheetPrimitive__namespace.Overlay,
262
262
  {
263
263
  className: cn(
264
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
264
+ "fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-150",
265
265
  className
266
266
  ),
267
267
  ...props,
@@ -271,7 +271,7 @@ var SheetOverlay = React24__namespace.forwardRef(({ className, ...props }, ref)
271
271
  ));
272
272
  SheetOverlay.displayName = SheetPrimitive__namespace.Overlay.displayName;
273
273
  var sheetVariants = classVarianceAuthority.cva(
274
- "fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
274
+ "fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out duration-150",
275
275
  {
276
276
  variants: {
277
277
  side: {
@@ -1468,7 +1468,7 @@ var DropdownMenuSubContent = React24__namespace.forwardRef(({ className, ...prop
1468
1468
  {
1469
1469
  ref,
1470
1470
  className: cn(
1471
- "z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
1471
+ "z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 origin-[--radix-dropdown-menu-content-transform-origin]",
1472
1472
  className
1473
1473
  ),
1474
1474
  ...props
@@ -1481,7 +1481,7 @@ var DropdownMenuContent = React24__namespace.forwardRef(({ className, sideOffset
1481
1481
  ref,
1482
1482
  sideOffset,
1483
1483
  className: cn(
1484
- "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-sm border bg-popover p-1.5 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
1484
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-sm border bg-popover p-1.5 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 origin-[--radix-dropdown-menu-content-transform-origin]",
1485
1485
  className
1486
1486
  ),
1487
1487
  ...props
@@ -1942,7 +1942,7 @@ var DialogContent = React24__namespace.forwardRef(({ className, children, ...pro
1942
1942
  {
1943
1943
  ref,
1944
1944
  className: cn(
1945
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-white p-6 shadow-lg duration-150 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.97] data-[state=open]:zoom-in-[0.97] sm:rounded-lg",
1945
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-white p-6 shadow-lg duration-150 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.98] data-[state=open]:zoom-in-[0.98] sm:rounded-lg",
1946
1946
  className
1947
1947
  ),
1948
1948
  ...props,
@@ -2020,7 +2020,7 @@ var ToastViewport = React24__namespace.forwardRef(({ className, ...props }, ref)
2020
2020
  ));
2021
2021
  ToastViewport.displayName = ToastPrimitives__namespace.Viewport.displayName;
2022
2022
  var toastVariants = classVarianceAuthority.cva(
2023
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-sm border-none p-4 transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-bottom-full",
2023
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-sm border-none p-4 transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.98] data-[state=open]:zoom-in-[0.98] duration-150",
2024
2024
  {
2025
2025
  variants: {
2026
2026
  variant: {
@@ -2103,13 +2103,15 @@ var ToastIcon = ({ variant }) => {
2103
2103
  }
2104
2104
  };
2105
2105
  var TOAST_LIMIT = 5;
2106
- var TOAST_REMOVE_DELAY = 5e3;
2106
+ var TOAST_REMOVE_DELAY = 1e3;
2107
+ var TOAST_AUTO_DISMISS_DELAY = 4e3;
2107
2108
  var count = 0;
2108
2109
  function genId() {
2109
2110
  count = (count + 1) % Number.MAX_SAFE_INTEGER;
2110
2111
  return count.toString();
2111
2112
  }
2112
2113
  var toastTimeouts = /* @__PURE__ */ new Map();
2114
+ var autoDismissTimeouts = /* @__PURE__ */ new Map();
2113
2115
  var addToRemoveQueue = (toastId) => {
2114
2116
  if (toastTimeouts.has(toastId)) {
2115
2117
  return;
@@ -2123,9 +2125,23 @@ var addToRemoveQueue = (toastId) => {
2123
2125
  }, TOAST_REMOVE_DELAY);
2124
2126
  toastTimeouts.set(toastId, timeout);
2125
2127
  };
2128
+ var scheduleAutoDismiss = (toastId) => {
2129
+ if (autoDismissTimeouts.has(toastId)) {
2130
+ return;
2131
+ }
2132
+ const timeout = setTimeout(() => {
2133
+ autoDismissTimeouts.delete(toastId);
2134
+ dispatch({
2135
+ type: "DISMISS_TOAST",
2136
+ toastId
2137
+ });
2138
+ }, TOAST_AUTO_DISMISS_DELAY);
2139
+ autoDismissTimeouts.set(toastId, timeout);
2140
+ };
2126
2141
  var reducer = (state, action) => {
2127
2142
  switch (action.type) {
2128
2143
  case "ADD_TOAST":
2144
+ scheduleAutoDismiss(action.toast.id);
2129
2145
  return {
2130
2146
  ...state,
2131
2147
  toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)