@suphark/ui 0.3.2 → 0.3.3
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/CHANGELOG.md +17 -0
- package/README.md +12 -1
- package/package.json +1 -1
- package/src/components/design-system/design-system-showcase.tsx +49 -46
- package/src/components/design-system/search-index.ts +219 -0
- package/src/components/design-system/sections/hero-specimen.tsx +112 -0
- package/src/components/design-system/sections/showcase-data-display.tsx +17 -17
- package/src/components/design-system/sections/showcase-feedback.tsx +14 -20
- package/src/components/design-system/sections/showcase-forms.tsx +12 -16
- package/src/components/design-system/sections/showcase-foundations.tsx +12 -18
- package/src/components/design-system/sections/showcase-guidelines-recipes.tsx +10 -14
- package/src/components/design-system/sections/showcase-overlays-navigation.tsx +16 -20
- package/src/components/design-system/sections/showcase-overview.tsx +95 -27
- package/src/components/design-system/sections/showcase-primitives.tsx +18 -22
- package/src/components/shared/form-dialog.tsx +9 -3
- package/src/index.ts +2 -0
- package/src/styles.css +4 -0
|
@@ -101,11 +101,11 @@ export function ShowcasePrimitives() {
|
|
|
101
101
|
<div className="flex flex-col gap-1">
|
|
102
102
|
<div className="flex items-center gap-2">
|
|
103
103
|
<Badge variant="outline">Core Primitives</Badge>
|
|
104
|
-
<span className="text-
|
|
104
|
+
<span className="text-muted-foreground text-sm">
|
|
105
105
|
Buttons, Badges, Cards, Avatars & Structure
|
|
106
106
|
</span>
|
|
107
107
|
</div>
|
|
108
|
-
<h2 className="
|
|
108
|
+
<h2 className="font-bold text-2xl text-foreground tracking-tight">
|
|
109
109
|
คอมโพเนนต์พื้นฐานและการแสดงผลโครงสร้าง
|
|
110
110
|
</h2>
|
|
111
111
|
<p className="text-sm text-muted-foreground">
|
|
@@ -114,14 +114,12 @@ export function ShowcasePrimitives() {
|
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
{/* Button Matrix */}
|
|
117
|
-
<Card>
|
|
117
|
+
<Card id="primitives-button">
|
|
118
118
|
<CardHeader>
|
|
119
119
|
<div className="flex items-center justify-between">
|
|
120
120
|
<div>
|
|
121
|
-
<CardTitle className="text-
|
|
122
|
-
<CardDescription
|
|
123
|
-
ลำดับความสำคัญของปุ่มและขนาดตามความเหมาะสมของหน้าจอ
|
|
124
|
-
</CardDescription>
|
|
121
|
+
<CardTitle className="text-lg">Button Hierarchy & Variants</CardTitle>
|
|
122
|
+
<CardDescription>ลำดับความสำคัญของปุ่มและขนาดตามความเหมาะสมของหน้าจอ</CardDescription>
|
|
125
123
|
</div>
|
|
126
124
|
<Badge variant="secondary">shadcn/ui Button</Badge>
|
|
127
125
|
</div>
|
|
@@ -248,12 +246,12 @@ export function ShowcasePrimitives() {
|
|
|
248
246
|
</Card>
|
|
249
247
|
|
|
250
248
|
{/* Shared Button Wrappers */}
|
|
251
|
-
<Card>
|
|
249
|
+
<Card id="primitives-shared-buttons">
|
|
252
250
|
<CardHeader>
|
|
253
251
|
<div className="flex items-center justify-between">
|
|
254
252
|
<div>
|
|
255
|
-
<CardTitle className="text-
|
|
256
|
-
<CardDescription
|
|
253
|
+
<CardTitle className="text-lg">Shared Action Button Wrappers</CardTitle>
|
|
254
|
+
<CardDescription>
|
|
257
255
|
คอมโพเนนต์ปุ่มมาตรฐานพร้อมสไตล์และไอคอนจาก <code>src/components/shared/button/*</code>
|
|
258
256
|
</CardDescription>
|
|
259
257
|
</div>
|
|
@@ -274,12 +272,10 @@ export function ShowcasePrimitives() {
|
|
|
274
272
|
</Card>
|
|
275
273
|
|
|
276
274
|
{/* Badges & Status Indicators */}
|
|
277
|
-
<Card>
|
|
275
|
+
<Card id="primitives-badge">
|
|
278
276
|
<CardHeader>
|
|
279
|
-
<CardTitle className="text-
|
|
280
|
-
<CardDescription
|
|
281
|
-
ป้ายสถานะสำหรับ workflow การจัดซื้อและกระบวนการอนุมัติ
|
|
282
|
-
</CardDescription>
|
|
277
|
+
<CardTitle className="text-lg">Badge & Status Indicators</CardTitle>
|
|
278
|
+
<CardDescription>ป้ายสถานะสำหรับ workflow การจัดซื้อและกระบวนการอนุมัติ</CardDescription>
|
|
283
279
|
</CardHeader>
|
|
284
280
|
<CardContent className="flex flex-col gap-4">
|
|
285
281
|
<div className="flex flex-wrap items-center gap-2">
|
|
@@ -310,7 +306,7 @@ export function ShowcasePrimitives() {
|
|
|
310
306
|
</Card>
|
|
311
307
|
|
|
312
308
|
{/* Full Card Composition & Avatar */}
|
|
313
|
-
<div className="grid gap-6 lg:grid-cols-2">
|
|
309
|
+
<div id="primitives-card" className="grid gap-6 lg:grid-cols-2">
|
|
314
310
|
{/* Full Card Composition */}
|
|
315
311
|
<Card>
|
|
316
312
|
<CardHeader>
|
|
@@ -319,7 +315,7 @@ export function ShowcasePrimitives() {
|
|
|
319
315
|
<span className="text-xs text-muted-foreground">Updated today</span>
|
|
320
316
|
</div>
|
|
321
317
|
<CardTitle className="text-lg">Package Evaluation Summary</CardTitle>
|
|
322
|
-
<CardDescription
|
|
318
|
+
<CardDescription>
|
|
323
319
|
โครงสร้าง Card แบบเต็มรูปแบบ (CardHeader / Title / Description / Content / Footer)
|
|
324
320
|
</CardDescription>
|
|
325
321
|
</CardHeader>
|
|
@@ -398,12 +394,12 @@ export function ShowcasePrimitives() {
|
|
|
398
394
|
</div>
|
|
399
395
|
|
|
400
396
|
{/* Accordion & Collapsible */}
|
|
401
|
-
<div className="grid gap-6 lg:grid-cols-2">
|
|
397
|
+
<div id="primitives-accordion" className="grid gap-6 lg:grid-cols-2">
|
|
402
398
|
{/* Accordion */}
|
|
403
399
|
<Card>
|
|
404
400
|
<CardHeader className="pb-2">
|
|
405
|
-
<CardTitle className="text-
|
|
406
|
-
<CardDescription
|
|
401
|
+
<CardTitle className="text-lg">Accordion Primitive</CardTitle>
|
|
402
|
+
<CardDescription>สำหรับคำถามที่พบบ่อยหรือเงื่อนไขสัญญา</CardDescription>
|
|
407
403
|
</CardHeader>
|
|
408
404
|
<CardContent>
|
|
409
405
|
<Accordion className="w-full">
|
|
@@ -430,8 +426,8 @@ export function ShowcasePrimitives() {
|
|
|
430
426
|
{/* Collapsible */}
|
|
431
427
|
<Card>
|
|
432
428
|
<CardHeader className="pb-2">
|
|
433
|
-
<CardTitle className="text-
|
|
434
|
-
<CardDescription
|
|
429
|
+
<CardTitle className="text-lg">Collapsible Primitive</CardTitle>
|
|
430
|
+
<CardDescription>สำหรับกล่องฟิลเตอร์ขั้นสูงหรือข้อมูลทางเลือก</CardDescription>
|
|
435
431
|
</CardHeader>
|
|
436
432
|
<CardContent>
|
|
437
433
|
<Collapsible
|
|
@@ -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
|
-
|
|
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">
|
|
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";
|