@codapet/design-system 0.7.2 → 0.7.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.
package/dist/index.d.mts CHANGED
@@ -380,8 +380,17 @@ declare function DrawerTrigger({ ...props }: React$1.ComponentProps<typeof Drawe
380
380
  declare function DrawerPortal({ ...props }: React$1.ComponentProps<typeof Drawer$1.Portal>): react_jsx_runtime.JSX.Element;
381
381
  declare function DrawerClose({ ...props }: React$1.ComponentProps<typeof Drawer$1.Close>): react_jsx_runtime.JSX.Element;
382
382
  declare function DrawerOverlay({ className, ...props }: React$1.ComponentProps<typeof Drawer$1.Overlay>): react_jsx_runtime.JSX.Element;
383
- declare function DrawerContent({ className, children, withCloseButton, ...props }: React$1.ComponentProps<typeof Drawer$1.Content> & {
383
+ declare const drawerDirectionClasses: {
384
+ readonly top: "inset-x-0 top-0 max-h-[80vh] rounded-b-3xl border-b border-border-default";
385
+ readonly bottom: "inset-x-0 bottom-0 max-h-[80vh] rounded-t-3xl border-t border-border-default";
386
+ readonly right: "inset-y-0 right-0 w-3/4 border-l border-border-default sm:max-w-sm";
387
+ readonly left: "inset-y-0 left-0 w-3/4 border-r border-border-default sm:max-w-sm";
388
+ };
389
+ declare function DrawerContent({ className, children, withCloseButton, showCloseButton, direction, overlayClassName, ...props }: React$1.ComponentProps<typeof Drawer$1.Content> & {
384
390
  withCloseButton?: boolean;
391
+ showCloseButton?: boolean;
392
+ direction?: keyof typeof drawerDirectionClasses;
393
+ overlayClassName?: string;
385
394
  }): react_jsx_runtime.JSX.Element;
386
395
  declare function DrawerHeader({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
387
396
  declare function DrawerFooter({ className, ...props }: React$1.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
package/dist/index.mjs CHANGED
@@ -477,6 +477,29 @@ var AutoResizeTextarea = React7.forwardRef(
477
477
  React7.useLayoutEffect(() => {
478
478
  resize();
479
479
  }, [resize, value]);
480
+ React7.useLayoutEffect(() => {
481
+ const el = innerRef.current;
482
+ if (!el) return;
483
+ const descriptor = Object.getOwnPropertyDescriptor(
484
+ window.HTMLTextAreaElement.prototype,
485
+ "value"
486
+ );
487
+ if (!descriptor?.get || !descriptor?.set) return;
488
+ const { get, set } = descriptor;
489
+ Object.defineProperty(el, "value", {
490
+ configurable: true,
491
+ get() {
492
+ return get.call(this);
493
+ },
494
+ set(v) {
495
+ set.call(this, v);
496
+ resize();
497
+ }
498
+ });
499
+ return () => {
500
+ delete el.value;
501
+ };
502
+ }, [resize]);
480
503
  return /* @__PURE__ */ jsx8(
481
504
  Textarea,
482
505
  {
@@ -1732,7 +1755,7 @@ function DialogOverlay({
1732
1755
  {
1733
1756
  "data-slot": "dialog-overlay",
1734
1757
  className: cn(
1735
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1758
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/40",
1736
1759
  className
1737
1760
  ),
1738
1761
  ...props
@@ -1753,7 +1776,7 @@ function DialogContent({
1753
1776
  {
1754
1777
  "data-slot": "dialog-content",
1755
1778
  className: cn(
1756
- "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-400 sm:max-w-lg",
1779
+ "bg-background border-border-default 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-3xl border p-6 shadow-lg duration-400 sm:max-w-lg",
1757
1780
  className
1758
1781
  ),
1759
1782
  ...props,
@@ -1763,7 +1786,7 @@ function DialogContent({
1763
1786
  DialogPrimitive.Close,
1764
1787
  {
1765
1788
  "data-slot": "dialog-close",
1766
- className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1789
+ className: "border-border-default text-muted-foreground hover:bg-muted absolute top-4 right-4 flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1767
1790
  children: [
1768
1791
  /* @__PURE__ */ jsx21(XIcon, {}),
1769
1792
  /* @__PURE__ */ jsx21("span", { className: "sr-only", children: "Close" })
@@ -2934,6 +2957,7 @@ function DateRangeInput({
2934
2957
  }
2935
2958
 
2936
2959
  // src/components/ui/drawer.tsx
2960
+ import { XIcon as XIcon2 } from "lucide-react";
2937
2961
  import "react";
2938
2962
  import { Drawer as DrawerPrimitive } from "vaul";
2939
2963
  import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
@@ -2966,36 +2990,53 @@ function DrawerOverlay({
2966
2990
  {
2967
2991
  "data-slot": "drawer-overlay",
2968
2992
  className: cn(
2969
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
2993
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/40",
2970
2994
  className
2971
2995
  ),
2972
2996
  ...props
2973
2997
  }
2974
2998
  );
2975
2999
  }
3000
+ var drawerDirectionClasses = {
3001
+ top: "inset-x-0 top-0 max-h-[80vh] rounded-b-3xl border-b border-border-default",
3002
+ bottom: "inset-x-0 bottom-0 max-h-[80vh] rounded-t-3xl border-t border-border-default",
3003
+ right: "inset-y-0 right-0 w-3/4 border-l border-border-default sm:max-w-sm",
3004
+ left: "inset-y-0 left-0 w-3/4 border-r border-border-default sm:max-w-sm"
3005
+ };
2976
3006
  function DrawerContent({
2977
3007
  className,
2978
3008
  children,
2979
3009
  withCloseButton = true,
3010
+ showCloseButton = true,
3011
+ direction = "bottom",
3012
+ overlayClassName,
2980
3013
  ...props
2981
3014
  }) {
2982
3015
  return /* @__PURE__ */ jsxs15(DrawerPortal, { "data-slot": "drawer-portal", children: [
2983
- /* @__PURE__ */ jsx28(DrawerOverlay, {}),
3016
+ /* @__PURE__ */ jsx28(DrawerOverlay, { className: overlayClassName }),
2984
3017
  /* @__PURE__ */ jsxs15(
2985
3018
  DrawerPrimitive.Content,
2986
3019
  {
2987
3020
  "data-slot": "drawer-content",
2988
3021
  className: cn(
2989
3022
  "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
2990
- "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
2991
- "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
2992
- "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
2993
- "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
3023
+ drawerDirectionClasses[direction],
2994
3024
  className
2995
3025
  ),
2996
3026
  ...props,
2997
3027
  children: [
2998
3028
  withCloseButton && /* @__PURE__ */ jsx28("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
3029
+ showCloseButton && /* @__PURE__ */ jsxs15(
3030
+ DrawerPrimitive.Close,
3031
+ {
3032
+ "data-slot": "drawer-close-button",
3033
+ className: "border-border-default text-muted-foreground hover:bg-muted absolute top-4 right-4 z-10 flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3034
+ children: [
3035
+ /* @__PURE__ */ jsx28(XIcon2, {}),
3036
+ /* @__PURE__ */ jsx28("span", { className: "sr-only", children: "Close" })
3037
+ ]
3038
+ }
3039
+ ),
2999
3040
  children
3000
3041
  ]
3001
3042
  }
@@ -3020,7 +3061,10 @@ function DrawerFooter({ className, ...props }) {
3020
3061
  "div",
3021
3062
  {
3022
3063
  "data-slot": "drawer-footer",
3023
- className: cn("mt-auto flex flex-col gap-2 p-4", className),
3064
+ className: cn(
3065
+ "border-border mt-auto flex shrink-0 flex-col gap-2 border-t px-4 pt-4 pb-[max(1rem,env(safe-area-inset-bottom,0px))]",
3066
+ className
3067
+ ),
3024
3068
  ...props
3025
3069
  }
3026
3070
  );
@@ -5143,7 +5187,7 @@ function SearchInput({
5143
5187
 
5144
5188
  // src/components/ui/searchable-select.tsx
5145
5189
  import * as React44 from "react";
5146
- import { CheckIcon as CheckIcon4, ChevronsUpDown, XIcon as XIcon2 } from "lucide-react";
5190
+ import { CheckIcon as CheckIcon4, ChevronsUpDown, XIcon as XIcon3 } from "lucide-react";
5147
5191
  import { jsx as jsx46, jsxs as jsxs27 } from "react/jsx-runtime";
5148
5192
  var SearchableSelectContext = React44.createContext(null);
5149
5193
  function useSearchableSelect() {
@@ -5311,7 +5355,7 @@ function SearchableSelectTrigger({
5311
5355
  e.stopPropagation();
5312
5356
  ctx.setValues(ctx.values.filter((val) => val !== v));
5313
5357
  },
5314
- children: /* @__PURE__ */ jsx46(XIcon2, { className: "size-3" })
5358
+ children: /* @__PURE__ */ jsx46(XIcon3, { className: "size-3" })
5315
5359
  }
5316
5360
  )
5317
5361
  ]
@@ -5668,7 +5712,7 @@ function Separator5({
5668
5712
 
5669
5713
  // src/components/ui/sheet.tsx
5670
5714
  import * as SheetPrimitive from "@radix-ui/react-dialog";
5671
- import { XIcon as XIcon3 } from "lucide-react";
5715
+ import { XIcon as XIcon4 } from "lucide-react";
5672
5716
  import "react";
5673
5717
  import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
5674
5718
  function Sheet({ ...props }) {
@@ -5730,7 +5774,7 @@ function SheetContent({
5730
5774
  children: [
5731
5775
  children,
5732
5776
  showCloseButton && /* @__PURE__ */ jsxs29(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
5733
- /* @__PURE__ */ jsx49(XIcon3, { className: "size-4" }),
5777
+ /* @__PURE__ */ jsx49(XIcon4, { className: "size-4" }),
5734
5778
  /* @__PURE__ */ jsx49("span", { className: "sr-only", children: "Close" })
5735
5779
  ] })
5736
5780
  ]
@@ -6660,7 +6704,7 @@ var SmartDialog = ({ children, ...props }) => {
6660
6704
  };
6661
6705
  var SmartDialogContent = ({
6662
6706
  children,
6663
- overlayClassName = "",
6707
+ overlayClassName,
6664
6708
  withCloseButton,
6665
6709
  showCloseButton,
6666
6710
  ...props
@@ -6670,14 +6714,16 @@ var SmartDialogContent = ({
6670
6714
  DrawerContent,
6671
6715
  {
6672
6716
  ...props,
6673
- withCloseButton: withCloseButton ?? showCloseButton ?? true,
6717
+ overlayClassName,
6718
+ withCloseButton: withCloseButton ?? true,
6719
+ showCloseButton: showCloseButton ?? true,
6674
6720
  children
6675
6721
  }
6676
6722
  ) : /* @__PURE__ */ jsx54(
6677
6723
  DialogContent,
6678
6724
  {
6679
6725
  ...props,
6680
- showCloseButton: showCloseButton ?? withCloseButton ?? true,
6726
+ showCloseButton: showCloseButton ?? true,
6681
6727
  overlayClassName,
6682
6728
  children
6683
6729
  }