@suphark/ui 0.3.2 → 0.4.0

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.
@@ -10,6 +10,7 @@ import {
10
10
  DialogTitle,
11
11
  DialogTrigger,
12
12
  } from "@suphark/ui/components/ui/dialog";
13
+ import { cn } from "@suphark/ui/lib/utils";
13
14
  import { useRouter } from "next/navigation";
14
15
  import {
15
16
  type ReactElement,
@@ -76,7 +77,10 @@ export function FormDialog({
76
77
  return (
77
78
  <Dialog open={open} onOpenChange={setOpen}>
78
79
  {trigger && <DialogTrigger render={trigger} />}
79
- <DialogContent className={contentClassName ?? "sm:max-w-md"}>
80
+ {/* จำกัดความสูงไว้ในจอ: header/footer ตรึง เฉพาะเนื้อฟอร์มเลื่อน (ฟอร์มยาวไม่ล้นในหน้าต่างเตี้ย) */}
81
+ <DialogContent
82
+ className={cn("flex max-h-[calc(100dvh-2rem)] flex-col", contentClassName ?? "sm:max-w-md")}
83
+ >
80
84
  <form
81
85
  // ไม่ใช้ `action=` — React 19 รีเซ็ตฟอร์ม uncontrolled หลัง action จบทุกครั้ง (แม้คืน error)
82
86
  // ทำให้ค่าที่พิมพ์หาย; เรียก action ใน transition เองแทน ฟอร์มจึงคงค่าไว้ให้แก้ต่อได้
@@ -86,13 +90,15 @@ export function FormDialog({
86
90
  setSubmitted((n) => n + 1);
87
91
  startTransition(() => formAction(fd));
88
92
  }}
89
- className="flex flex-col gap-4"
93
+ className="flex min-h-0 flex-1 flex-col gap-4"
90
94
  >
91
95
  <DialogHeader>
92
96
  <DialogTitle>{title}</DialogTitle>
93
97
  {description && <DialogDescription>{description}</DialogDescription>}
94
98
  </DialogHeader>
95
- <div className="flex flex-col gap-3">{children}</div>
99
+ <div className="-mx-1 flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-1">
100
+ {children}
101
+ </div>
96
102
  <FormMessage state={state} />
97
103
  <DialogFooter>
98
104
  <Button type="button" variant="ghost" onClick={() => setOpen(false)}>
package/src/index.ts CHANGED
@@ -9,6 +9,8 @@
9
9
  * `chart` (recharts) ไม่อยู่ใน barrel: import ตรง `@suphark/ui/components/ui/chart` เมื่อแอปติดตั้ง recharts เอง
10
10
  */
11
11
 
12
+ // ชนิดช่วงวันที่ของ react-day-picker — แอปไม่ต้องติดตั้ง react-day-picker เอง
13
+ export type { DateRange } from "react-day-picker";
12
14
  // sonner: `toast()` คู่กับ <Toaster /> — แอปไม่ต้องติดตั้ง sonner เอง
13
15
  export { toast } from "sonner";
14
16
  export * from "./components/shared/button";
package/src/styles.css CHANGED
@@ -9,6 +9,10 @@
9
9
  *
10
10
  * ฟอนต์: Noto Sans Thai Looped (@fontsource) โหลดที่นี่ — แอปที่ต้องการฟอนต์อื่น override --font-sans ใน @theme ของตัวเอง
11
11
  * ส่วน print/A4 และสไตล์เฉพาะ feature ของ supplychain ไม่ได้ยกมา (อยู่ที่แอปนั้น)
12
+ *
13
+ * Override contract (ดู docs/agent-rules.md):
14
+ * แอปแก้ได้: --brand / --brand-foreground (บน wrapper), --font-sans / --font-mono, --radius
15
+ * ห้ามแก้: semantic token (--primary --background --muted --destructive …), --sidebar-*, --chart-*, วิธีสลับธีม
12
16
  */
13
17
  @import "tw-animate-css";
14
18
  @import "@fontsource/noto-sans-thai-looped/400.css";