@designil/labdsnov 1.0.0 → 1.1.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.
Files changed (99) hide show
  1. package/README.md +18 -1
  2. package/dist/components/Accordion/Accordion.module.css.js +10 -10
  3. package/dist/components/Alert/Alert.module.css.js +10 -10
  4. package/dist/components/AlertDialog/AlertDialog.module.css.js +16 -16
  5. package/dist/components/Avatar/Avatar.module.css.js +18 -18
  6. package/dist/components/Badge/Badge.module.css.js +6 -6
  7. package/dist/components/Breadcrumb/Breadcrumb.module.css.js +14 -14
  8. package/dist/components/Button/Button.module.css.js +26 -26
  9. package/dist/components/ButtonGroup/ButtonGroup.module.css.js +2 -2
  10. package/dist/components/Calendar/Calendar.module.css.js +33 -33
  11. package/dist/components/Card/Card.module.css.js +20 -20
  12. package/dist/components/Chart/Chart.module.css.js +32 -32
  13. package/dist/components/Checkbox/Checkbox.module.css.js +10 -10
  14. package/dist/components/Collapsible/Collapsible.module.css.js +1 -1
  15. package/dist/components/Combobox/Combobox.module.css.js +32 -32
  16. package/dist/components/DatePicker/DatePicker.module.css.js +4 -4
  17. package/dist/components/Dialog/Dialog.module.css.js +13 -13
  18. package/dist/components/Drawer/Drawer.module.css.js +18 -18
  19. package/dist/components/DropdownMenu/DropdownMenu.module.css.js +24 -24
  20. package/dist/components/Empty/Empty.module.css.js +11 -11
  21. package/dist/components/Field/Field.module.css.js +25 -25
  22. package/dist/components/FundCard/FundCard.module.css.js +14 -14
  23. package/dist/components/HoverCard/HoverCard.module.css.js +5 -5
  24. package/dist/components/Input/Input.module.css.js +2 -2
  25. package/dist/components/InputGroup/InputGroup.module.css.js +16 -16
  26. package/dist/components/InputOTP/InputOTP.module.css.js +16 -16
  27. package/dist/components/Kbd/Kbd.module.css.js +1 -1
  28. package/dist/components/Label/Label.module.css.js +6 -6
  29. package/dist/components/NavigationMenu/NavigationMenu.module.css.js +24 -24
  30. package/dist/components/Pagination/Pagination.module.css.js +10 -10
  31. package/dist/components/Popover/Popover.module.css.js +10 -10
  32. package/dist/components/Progress/Progress.module.css.js +12 -12
  33. package/dist/components/RadioGroup/RadioGroup.module.css.js +8 -8
  34. package/dist/components/ScrollArea/ScrollArea.module.css.js +5 -5
  35. package/dist/components/Select/Select.module.css.js +34 -34
  36. package/dist/components/Separator/Separator.module.css.js +1 -1
  37. package/dist/components/Skeleton/Skeleton.module.css.js +1 -1
  38. package/dist/components/Slider/Slider.module.css.js +12 -12
  39. package/dist/components/Spinner/Spinner.module.css.js +1 -1
  40. package/dist/components/Switch/Switch.module.css.js +6 -6
  41. package/dist/components/Table/Table.module.css.js +8 -8
  42. package/dist/components/Tabs/Tabs.module.css.js +8 -8
  43. package/dist/components/Textarea/Textarea.module.css.js +1 -1
  44. package/dist/components/Toaster/Toaster.module.css.js +8 -8
  45. package/dist/components/Toggle/Toggle.module.css.js +8 -8
  46. package/dist/components/ToggleGroup/ToggleGroup.module.css.js +3 -3
  47. package/dist/components/Tooltip/Tooltip.module.css.js +5 -5
  48. package/dist/styles.css +1 -1
  49. package/docs/Colors.md +96 -43
  50. package/docs/Contributing.md +14 -7
  51. package/package.json +21 -13
  52. package/src/components/Accordion/Accordion.dsds.yaml +195 -0
  53. package/src/components/Alert/Alert.dsds.yaml +206 -0
  54. package/src/components/AlertDialog/AlertDialog.dsds.yaml +243 -0
  55. package/src/components/Avatar/Avatar.dsds.yaml +172 -0
  56. package/src/components/Badge/Badge.dsds.yaml +191 -0
  57. package/src/components/Breadcrumb/Breadcrumb.dsds.yaml +162 -0
  58. package/src/components/Button/Button.dsds.yaml +350 -0
  59. package/src/components/ButtonGroup/ButtonGroup.dsds.yaml +193 -0
  60. package/src/components/Calendar/Calendar.dsds.yaml +236 -0
  61. package/src/components/Card/Card.dsds.yaml +199 -0
  62. package/src/components/Chart/Chart.dsds.yaml +216 -0
  63. package/src/components/Checkbox/Checkbox.dsds.yaml +215 -0
  64. package/src/components/Collapsible/Collapsible.dsds.yaml +146 -0
  65. package/src/components/Combobox/Combobox.dsds.yaml +241 -0
  66. package/src/components/DatePicker/DatePicker.dsds.yaml +179 -0
  67. package/src/components/Dialog/Dialog.dsds.yaml +300 -0
  68. package/src/components/Drawer/Drawer.dsds.yaml +207 -0
  69. package/src/components/DropdownMenu/DropdownMenu.dsds.yaml +265 -0
  70. package/src/components/Empty/Empty.dsds.yaml +171 -0
  71. package/src/components/Field/Field.dsds.yaml +285 -0
  72. package/src/components/FundCard/FundCard.dsds.yaml +195 -0
  73. package/src/components/FundCard/FundCard.md +2 -2
  74. package/src/components/HoverCard/HoverCard.dsds.yaml +157 -0
  75. package/src/components/Input/Input.dsds.yaml +235 -0
  76. package/src/components/InputGroup/InputGroup.dsds.yaml +234 -0
  77. package/src/components/InputOTP/InputOTP.dsds.yaml +184 -0
  78. package/src/components/Kbd/Kbd.dsds.yaml +119 -0
  79. package/src/components/Label/Label.dsds.yaml +141 -0
  80. package/src/components/NavigationMenu/NavigationMenu.dsds.yaml +196 -0
  81. package/src/components/Pagination/Pagination.dsds.yaml +172 -0
  82. package/src/components/Popover/Popover.dsds.yaml +168 -0
  83. package/src/components/Progress/Progress.dsds.yaml +169 -0
  84. package/src/components/RadioGroup/RadioGroup.dsds.yaml +215 -0
  85. package/src/components/ScrollArea/ScrollArea.dsds.yaml +153 -0
  86. package/src/components/Select/Select.dsds.yaml +239 -0
  87. package/src/components/Separator/Separator.dsds.yaml +121 -0
  88. package/src/components/Skeleton/Skeleton.dsds.yaml +124 -0
  89. package/src/components/Slider/Slider.dsds.yaml +194 -0
  90. package/src/components/Spinner/Spinner.dsds.yaml +126 -0
  91. package/src/components/Switch/Switch.dsds.yaml +198 -0
  92. package/src/components/Table/Table.dsds.yaml +195 -0
  93. package/src/components/Tabs/Tabs.dsds.yaml +239 -0
  94. package/src/components/Textarea/Textarea.dsds.yaml +167 -0
  95. package/src/components/Toaster/Toaster.dsds.yaml +226 -0
  96. package/src/components/Toggle/Toggle.dsds.yaml +224 -0
  97. package/src/components/ToggleGroup/ToggleGroup.dsds.yaml +230 -0
  98. package/src/components/Tooltip/Tooltip.dsds.yaml +202 -0
  99. package/src/index.dsds.yaml +467 -0
package/docs/Colors.md CHANGED
@@ -4,10 +4,11 @@
4
4
 
5
5
  สีทั้งหมดของระบบเป็น token ใน `src/styles/theme.css` มีค่าสำหรับโหมดสว่างและโหมดมืด ห้ามใช้ค่าสีตรง ๆ (เช่น `#f97316` หรือ `oklch(...)`) ในคอมโพเนนต์หรือหน้าจอ
6
6
 
7
- ## Two layers of tokens
7
+ ## Three layers of tokens
8
8
 
9
- 1. **Semantic tokens** (หน้านี้): สีตามความหมาย เช่น `--primary`, `--muted-foreground`, `--destructive` เปลี่ยนที่นี่แล้วทุกคอมโพเนนต์เปลี่ยนตาม
10
- 2. **Component tokens** (ดู [Component tokens](./ComponentTokens.md)): สีของแต่ละส่วนของคอมโพเนนต์ เช่น `--button-primary-bg` ชี้ไปที่ semantic token เปลี่ยนเพื่อปรับคอมโพเนนต์เดียว
9
+ 1. **Primitive tokens** (`--palette-*`, หน้านี้): จานสีดิบ เช่น `--palette-orange-700`, `--palette-olive-950` ไม่มีโหมดสว่าง/มืด ใช้ได้เฉพาะใน semantic token เท่านั้น ห้ามใช้ในคอมโพเนนต์หรือหน้าจอ
10
+ 2. **Semantic tokens** (หน้านี้): สีตามความหมาย เช่น `--primary`, `--muted-foreground`, `--destructive` ชี้ไปที่ primitive และเลือก primitive คนละตัวในโหมดสว่างกับโหมดมืด เปลี่ยนที่นี่แล้วทุกคอมโพเนนต์เปลี่ยนตาม
11
+ 3. **Component tokens** (ดู [Component tokens](./ComponentTokens.md)): สีของแต่ละส่วนของคอมโพเนนต์ เช่น `--button-primary-bg` ชี้ไปที่ semantic token เปลี่ยนเพื่อปรับคอมโพเนนต์เดียว
11
12
 
12
13
  ทุกคู่สีที่ใช้จริงผ่าน WCAG 2.2 AA ทั้งสองโหมด ดู [Accessibility](./Accessibility.md)
13
14
 
@@ -20,33 +21,85 @@
20
21
  - **`--border` vs `--control-border`**: `--border` สำหรับเส้นตกแต่ง (ขอบ Card, เส้นคั่น, ตาราง) ส่วนขอบที่บอกว่า "ตรงนี้คือช่องกรอก/ตัวเลือก" ต้องใช้ `--control-border` ซึ่งเข้มพอ (3:1)
21
22
  - **อย่าบอกความหมายด้วยสีอย่างเดียว**: สถานะ เช่น ความเสี่ยงสูง ต้องมีข้อความหรือไอคอนด้วยเสมอ
22
23
 
24
+ ## Primitive tokens
25
+
26
+ ชื่อตามสเกลของ Tailwind (สี-ระดับ) แต่ใช้ prefix `--palette-` เพื่อไม่ทับ `--color-*` ของ Tailwind ในแอป สีที่ตรงกับ Tailwind ใช้ระดับเดียวกัน สีที่ปรับเอง (ส่วนใหญ่เพื่อให้ผ่าน WCAG AA) ใช้ระดับที่ใกล้ที่สุดที่ยังว่าง (เช่น `olive-550`) จึงอาจไม่เท่ากับสีชื่อเดียวกันของ Tailwind ดูคอลัมน์ "เทียบกับ Tailwind"
27
+
28
+ เพิ่ม primitive เมื่อ semantic token ต้องการสีที่ยังไม่มีเท่านั้น ไม่ต้องเติมให้ครบทุกระดับ
29
+
30
+ <!-- generated:primitive -->
31
+
32
+ | Token | ค่า | เทียบกับ Tailwind |
33
+ | ----------------------- | ---------------------------- | ----------------------------------- |
34
+ | `--palette-white` | `oklch(1 0 0)` | ขาว |
35
+ | `--palette-white-a10` | `oklch(1 0 0 / 10%)` | ขาวโปร่ง 10% |
36
+ | `--palette-white-a15` | `oklch(1 0 0 / 15%)` | ขาวโปร่ง 15% |
37
+ | `--palette-neutral-50` | `oklch(0.985 0 0)` | ตรงกับ `neutral-50` |
38
+ | `--palette-olive-50` | `oklch(0.988 0.003 106.5)` | ตรงกับ `olive-50` |
39
+ | `--palette-olive-100` | `oklch(0.966 0.005 106.5)` | ตรงกับ `olive-100` |
40
+ | `--palette-olive-200` | `oklch(0.93 0.007 106.5)` | ตรงกับ `olive-200` |
41
+ | `--palette-olive-350` | `oklch(0.8 0.02 106.9)` | ระดับนี้ไม่มีใน Tailwind |
42
+ | `--palette-olive-400` | `oklch(0.737 0.021 106.9)` | ตรงกับ `olive-400` |
43
+ | `--palette-olive-500` | `oklch(0.6 0.02 106.9)` | ค่าต่างจาก `olive-500` ของ Tailwind |
44
+ | `--palette-olive-550` | `oklch(0.55 0.015 106.9)` | ระดับนี้ไม่มีใน Tailwind |
45
+ | `--palette-olive-600` | `oklch(0.5 0.027 107.3)` | ค่าต่างจาก `olive-600` ของ Tailwind |
46
+ | `--palette-olive-650` | `oklch(0.45 0.03 106.9)` | ระดับนี้ไม่มีใน Tailwind |
47
+ | `--palette-olive-800` | `oklch(0.286 0.016 107.4)` | ตรงกับ `olive-800` |
48
+ | `--palette-olive-900` | `oklch(0.228 0.013 107.4)` | ตรงกับ `olive-900` |
49
+ | `--palette-olive-950` | `oklch(0.153 0.006 107.1)` | ตรงกับ `olive-950` |
50
+ | `--palette-zinc-100` | `oklch(0.967 0.001 286.375)` | ตรงกับ `zinc-100` |
51
+ | `--palette-zinc-800` | `oklch(0.274 0.006 286.033)` | ตรงกับ `zinc-800` |
52
+ | `--palette-zinc-900` | `oklch(0.21 0.006 285.885)` | ตรงกับ `zinc-900` |
53
+ | `--palette-orange-50` | `oklch(0.98 0.016 73.684)` | ตรงกับ `orange-50` |
54
+ | `--palette-orange-500` | `oklch(0.705 0.187 47.604)` | ค่าต่างจาก `orange-500` ของ Tailwind |
55
+ | `--palette-orange-700` | `oklch(0.553 0.195 38.402)` | ตรงกับ `orange-700` |
56
+ | `--palette-orange-950` | `oklch(0.205 0.05 40)` | ค่าต่างจาก `orange-950` ของ Tailwind |
57
+ | `--palette-red-400` | `oklch(0.75 0.16 22.216)` | ค่าต่างจาก `red-400` ของ Tailwind |
58
+ | `--palette-red-700` | `oklch(0.505 0.2 27.325)` | ค่าต่างจาก `red-700` ของ Tailwind |
59
+ | `--palette-green-500` | `oklch(0.75 0.16 150)` | ค่าต่างจาก `green-500` ของ Tailwind |
60
+ | `--palette-green-700` | `oklch(0.49 0.12 150)` | ค่าต่างจาก `green-700` ของ Tailwind |
61
+ | `--palette-amber-400` | `oklch(0.82 0.15 80)` | ค่าต่างจาก `amber-400` ของ Tailwind |
62
+ | `--palette-amber-800` | `oklch(0.5 0.12 60)` | ค่าต่างจาก `amber-800` ของ Tailwind |
63
+ | `--palette-teal-500` | `oklch(0.72 0.11 190)` | ค่าต่างจาก `teal-500` ของ Tailwind |
64
+ | `--palette-teal-700` | `oklch(0.52 0.1 190)` | ค่าต่างจาก `teal-700` ของ Tailwind |
65
+ | `--palette-blue-400` | `oklch(0.7 0.14 262)` | ค่าต่างจาก `blue-400` ของ Tailwind |
66
+ | `--palette-blue-700` | `oklch(0.5 0.17 262)` | ค่าต่างจาก `blue-700` ของ Tailwind |
67
+ | `--palette-fuchsia-400` | `oklch(0.72 0.17 330)` | ค่าต่างจาก `fuchsia-400` ของ Tailwind |
68
+ | `--palette-fuchsia-700` | `oklch(0.52 0.19 330)` | ค่าต่างจาก `fuchsia-700` ของ Tailwind |
69
+ | `--palette-lime-500` | `oklch(0.78 0.17 135)` | ค่าต่างจาก `lime-500` ของ Tailwind |
70
+ | `--palette-lime-700` | `oklch(0.55 0.15 135)` | ค่าต่างจาก `lime-700` ของ Tailwind |
71
+
72
+ <!-- /generated:primitive -->
73
+
23
74
  ## Semantic tokens
24
75
 
76
+ ค่าในตารางคือ primitive ที่ token ชี้ไป สีโปร่งแสงเป็น primitive แยก เช่น `--palette-white-a10` คือขาวโปร่ง 10%
77
+
25
78
  <!-- generated:semantic -->
26
79
 
27
- | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
28
- | ------------------------ | ---------------------------- | ---------------------------- | ------------------------------------------------------- |
29
- | `--background` | `oklch(1 0 0)` | `oklch(0.153 0.006 107.1)` | พื้นหน้า |
30
- | `--foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรหลัก |
31
- | `--card` | `oklch(1 0 0)` | `oklch(0.228 0.013 107.4)` | พื้น Card |
32
- | `--card-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรใน Card |
33
- | `--popover` | `oklch(1 0 0)` | `oklch(0.228 0.013 107.4)` | พื้นกล่องลอย (Popover, เมนู, Dialog) |
34
- | `--popover-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรในกล่องลอย |
35
- | `--primary` | `oklch(0.553 0.195 38.402)` | `oklch(0.705 0.187 47.604)` | สีหลักของแบรนด์ (ส้ม): ปุ่มหลัก, ตัวเลือกที่เลือกแล้ว, ลิงก์ |
36
- | `--primary-foreground` | `oklch(0.98 0.016 73.684)` | `oklch(0.205 0.05 40)` | ตัวอักษรบน `--primary` |
37
- | `--secondary` | `oklch(0.967 0.001 286.375)` | `oklch(0.274 0.006 286.033)` | พื้นปุ่ม/ป้ายรอง |
38
- | `--secondary-foreground` | `oklch(0.21 0.006 285.885)` | `oklch(0.985 0 0)` | ตัวอักษรบน `--secondary` |
39
- | `--muted` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | พื้นจาง (แคปซูลแท็บ, Skeleton, ราง Progress) |
40
- | `--muted-foreground` | `oklch(0.5 0.027 107.3)` | `oklch(0.737 0.021 106.9)` | ตัวอักษรรอง: คำอธิบาย, placeholder, หัวข้อกลุ่ม |
41
- | `--accent` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | พื้นรายการที่ไฮไลต์ในเมนู |
42
- | `--accent-foreground` | `oklch(0.228 0.013 107.4)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรบน `--accent` |
43
- | `--destructive` | `oklch(0.505 0.2 27.325)` | `oklch(0.75 0.16 22.216)` | ข้อผิดพลาด การกระทำที่ลบหรือย้อนกลับไม่ได้ (ใช้เป็นตัวอักษรหรือพื้นจาง) |
44
- | `--success` | `oklch(0.49 0.12 150)` | `oklch(0.75 0.16 150)` | สำเร็จ ความเสี่ยงต่ำ (ใช้เป็นตัวอักษรหรือพื้นจาง) |
45
- | `--warning` | `oklch(0.5 0.12 60)` | `oklch(0.82 0.15 80)` | รอดำเนินการ ความเสี่ยงปานกลาง (ใช้เป็นตัวอักษรหรือพื้นจาง) |
46
- | `--border` | `oklch(0.93 0.007 106.5)` | `oklch(1 0 0 / 10%)` | เส้นตกแต่ง: ขอบ Card, เส้นคั่น, ตาราง (ไม่ต้องผ่าน 3:1) |
47
- | `--input` | `oklch(0.93 0.007 106.5)` | `oklch(1 0 0 / 15%)` | พื้นจางของช่องกรอก (ใช้แบบโปร่งแสง) |
48
- | `--control-border` | `oklch(0.6 0.02 106.9)` | `oklch(0.55 0.015 106.9)` | ขอบที่บอกว่าเป็นช่องกรอกหรือตัวควบคุม (ต้องผ่าน 3:1) |
49
- | `--ring` | `oklch(0.45 0.03 106.9)` | `oklch(0.8 0.02 106.9)` | สีวงแหวน focus |
80
+ | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
81
+ | ------------------------ | ---------------------- | ---------------------- | ------------------------------------------------------- |
82
+ | `--background` | `--palette-white` | `--palette-olive-950` | พื้นหน้า |
83
+ | `--foreground` | `--palette-olive-950` | `--palette-olive-50` | ตัวอักษรหลัก |
84
+ | `--card` | `--palette-white` | `--palette-olive-900` | พื้น Card |
85
+ | `--card-foreground` | `--palette-olive-950` | `--palette-olive-50` | ตัวอักษรใน Card |
86
+ | `--popover` | `--palette-white` | `--palette-olive-900` | พื้นกล่องลอย (Popover, เมนู, Dialog) |
87
+ | `--popover-foreground` | `--palette-olive-950` | `--palette-olive-50` | ตัวอักษรในกล่องลอย |
88
+ | `--primary` | `--palette-orange-700` | `--palette-orange-500` | สีหลักของแบรนด์ (ส้ม): ปุ่มหลัก, ตัวเลือกที่เลือกแล้ว, ลิงก์ |
89
+ | `--primary-foreground` | `--palette-orange-50` | `--palette-orange-950` | ตัวอักษรบน `--primary` |
90
+ | `--secondary` | `--palette-zinc-100` | `--palette-zinc-800` | พื้นปุ่ม/ป้ายรอง |
91
+ | `--secondary-foreground` | `--palette-zinc-900` | `--palette-neutral-50` | ตัวอักษรบน `--secondary` |
92
+ | `--muted` | `--palette-olive-100` | `--palette-olive-800` | พื้นจาง (แคปซูลแท็บ, Skeleton, ราง Progress) |
93
+ | `--muted-foreground` | `--palette-olive-600` | `--palette-olive-400` | ตัวอักษรรอง: คำอธิบาย, placeholder, หัวข้อกลุ่ม |
94
+ | `--accent` | `--palette-olive-100` | `--palette-olive-800` | พื้นรายการที่ไฮไลต์ในเมนู |
95
+ | `--accent-foreground` | `--palette-olive-900` | `--palette-olive-50` | ตัวอักษรบน `--accent` |
96
+ | `--destructive` | `--palette-red-700` | `--palette-red-400` | ข้อผิดพลาด การกระทำที่ลบหรือย้อนกลับไม่ได้ (ใช้เป็นตัวอักษรหรือพื้นจาง) |
97
+ | `--success` | `--palette-green-700` | `--palette-green-500` | สำเร็จ ความเสี่ยงต่ำ (ใช้เป็นตัวอักษรหรือพื้นจาง) |
98
+ | `--warning` | `--palette-amber-800` | `--palette-amber-400` | รอดำเนินการ ความเสี่ยงปานกลาง (ใช้เป็นตัวอักษรหรือพื้นจาง) |
99
+ | `--border` | `--palette-olive-200` | `--palette-white-a10` | เส้นตกแต่ง: ขอบ Card, เส้นคั่น, ตาราง (ไม่ต้องผ่าน 3:1) |
100
+ | `--input` | `--palette-olive-200` | `--palette-white-a15` | พื้นจางของช่องกรอก (ใช้แบบโปร่งแสง) |
101
+ | `--control-border` | `--palette-olive-500` | `--palette-olive-550` | ขอบที่บอกว่าเป็นช่องกรอกหรือตัวควบคุม (ต้องผ่าน 3:1) |
102
+ | `--ring` | `--palette-olive-650` | `--palette-olive-350` | สีวงแหวน focus |
50
103
 
51
104
  <!-- /generated:semantic -->
52
105
 
@@ -56,13 +109,13 @@
56
109
 
57
110
  <!-- generated:chart -->
58
111
 
59
- | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
60
- | ----------- | --------------------------- | --------------------------- | --------------------- |
61
- | `--chart-1` | `oklch(0.553 0.195 38.402)` | `oklch(0.705 0.187 47.604)` | สีกราฟชุดที่ 1: ส้ม (สีหลัก) |
62
- | `--chart-2` | `oklch(0.52 0.1 190)` | `oklch(0.72 0.11 190)` | สีกราฟชุดที่ 2: เขียวอมฟ้า |
63
- | `--chart-3` | `oklch(0.5 0.17 262)` | `oklch(0.7 0.14 262)` | สีกราฟชุดที่ 3: น้ำเงิน |
64
- | `--chart-4` | `oklch(0.52 0.19 330)` | `oklch(0.72 0.17 330)` | สีกราฟชุดที่ 4: ชมพูม่วง |
65
- | `--chart-5` | `oklch(0.55 0.15 135)` | `oklch(0.78 0.17 135)` | สีกราฟชุดที่ 5: เขียว |
112
+ | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
113
+ | ----------- | ----------------------- | ----------------------- | --------------------- |
114
+ | `--chart-1` | `--palette-orange-700` | `--palette-orange-500` | สีกราฟชุดที่ 1: ส้ม (สีหลัก) |
115
+ | `--chart-2` | `--palette-teal-700` | `--palette-teal-500` | สีกราฟชุดที่ 2: เขียวอมฟ้า |
116
+ | `--chart-3` | `--palette-blue-700` | `--palette-blue-400` | สีกราฟชุดที่ 3: น้ำเงิน |
117
+ | `--chart-4` | `--palette-fuchsia-700` | `--palette-fuchsia-400` | สีกราฟชุดที่ 4: ชมพูม่วง |
118
+ | `--chart-5` | `--palette-lime-700` | `--palette-lime-500` | สีกราฟชุดที่ 5: เขียว |
66
119
 
67
120
  <!-- /generated:chart -->
68
121
 
@@ -74,16 +127,16 @@ TODO: ยังไม่ได้ตรวจว่าแยกสีได้
74
127
 
75
128
  <!-- generated:sidebar -->
76
129
 
77
- | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
78
- | ------------------------------ | --------------------------- | --------------------------- | ------------------------------------ |
79
- | `--sidebar` | `oklch(0.988 0.003 106.5)` | `oklch(0.228 0.013 107.4)` | พื้นแถบข้าง (สำหรับแอป ยังไม่มีคอมโพเนนต์ใช้) |
80
- | `--sidebar-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรในแถบข้าง |
81
- | `--sidebar-primary` | `oklch(0.553 0.195 38.402)` | `oklch(0.705 0.187 47.604)` | สีหลักในแถบข้าง |
82
- | `--sidebar-primary-foreground` | `oklch(0.98 0.016 73.684)` | `oklch(0.205 0.05 40)` | ตัวอักษรบน `--sidebar-primary` |
83
- | `--sidebar-accent` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | รายการที่ไฮไลต์ในแถบข้าง |
84
- | `--sidebar-accent-foreground` | `oklch(0.228 0.013 107.4)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรบน `--sidebar-accent` |
85
- | `--sidebar-border` | `oklch(0.93 0.007 106.5)` | `oklch(1 0 0 / 10%)` | เส้นในแถบข้าง |
86
- | `--sidebar-ring` | `oklch(0.45 0.03 106.9)` | `oklch(0.8 0.02 106.9)` | วงแหวน focus ในแถบข้าง |
130
+ | Token | โหมดสว่าง | โหมดมืด | ใช้กับ |
131
+ | ------------------------------ | ---------------------- | ---------------------- | ------------------------------------ |
132
+ | `--sidebar` | `--palette-olive-50` | `--palette-olive-900` | พื้นแถบข้าง (สำหรับแอป ยังไม่มีคอมโพเนนต์ใช้) |
133
+ | `--sidebar-foreground` | `--palette-olive-950` | `--palette-olive-50` | ตัวอักษรในแถบข้าง |
134
+ | `--sidebar-primary` | `--palette-orange-700` | `--palette-orange-500` | สีหลักในแถบข้าง |
135
+ | `--sidebar-primary-foreground` | `--palette-orange-50` | `--palette-orange-950` | ตัวอักษรบน `--sidebar-primary` |
136
+ | `--sidebar-accent` | `--palette-olive-100` | `--palette-olive-800` | รายการที่ไฮไลต์ในแถบข้าง |
137
+ | `--sidebar-accent-foreground` | `--palette-olive-900` | `--palette-olive-50` | ตัวอักษรบน `--sidebar-accent` |
138
+ | `--sidebar-border` | `--palette-olive-200` | `--palette-white-a10` | เส้นในแถบข้าง |
139
+ | `--sidebar-ring` | `--palette-olive-650` | `--palette-olive-350` | วงแหวน focus ในแถบข้าง |
87
140
 
88
141
  <!-- /generated:sidebar -->
89
142
 
@@ -11,7 +11,7 @@ pnpm install
11
11
  pnpm storybook # http://localhost:6006
12
12
  ```
13
13
 
14
- ห้าม `npm publish` / `pnpm publish` จนกว่าจะถึงรอบเผยแพร่
14
+ ห้าม `npm publish` / `pnpm publish` / `changeset publish` เอง CI เป็นคนเผยแพร่ (ดู `RELEASING.md`) PR ของฟีเจอร์เข้า `develop` ส่วน hotfix เข้า `main`
15
15
 
16
16
  ## Add a component
17
17
 
@@ -24,10 +24,12 @@ pnpm storybook # http://localhost:6006
24
24
  | `index.ts` | export ส่วนที่เป็น public |
25
25
  | `<Name>.stories.tsx` | story ละสถานะ พร้อม `play` ตรวจพฤติกรรม ข้อความภาษาไทย |
26
26
  | `<Name>.md` | usage doc ภาษาไทย (ดูหัวข้อด้านล่าง) |
27
+ | `<Name>.dsds.yaml` | context layer ภาษาอังกฤษตาม DSDS: กฎการใช้งานแบบมีระดับ เหตุผล และสิ่งที่ตรวจ (ดู `AGENTS.md`) |
27
28
 
28
- 2. **export** จาก `packages/ui/src/index.ts` (เรียงตามตัวอักษร)
29
+ 2. **export** จาก `packages/ui/src/index.ts` (เรียงตามตัวอักษร) และเพิ่ม `rel: file` ของ `<Name>.dsds.yaml` ใน `packages/ui/src/index.dsds.yaml`
29
30
  3. ถ้าคอมโพเนนต์ใช้ hook หรือ context ใส่ `"use client"` บรรทัดแรก และเพิ่มชื่อในรายการของ `AGENTS.md`
30
31
  4. **ข้อความที่ผู้ใช้เห็น** (รวม `aria-label`) เป็นภาษาไทย วันที่เป็นปี พ.ศ.
32
+ 5. **Code Connect** (ถ้ามีคอมโพเนนต์นี้ในไฟล์ Figma): เพิ่ม `packages/ui/figma/<Name>.figma.ts` ที่ map property ใน Figma ไปเป็น prop ในโค้ด ดูหัวข้อ Code Connect ใน `AGENTS.md`
31
33
 
32
34
  ## Styling rules
33
35
 
@@ -41,9 +43,10 @@ pnpm storybook # http://localhost:6006
41
43
  ## Add or change a token
42
44
 
43
45
  1. แก้ `packages/ui/src/styles/theme.css`
44
- - **semantic token**: ใส่ทั้งใน `:root` และ `.dark` และเพิ่มใน `@theme inline` ถ้าต้องการ utility ชื่อสั้น
46
+ - **primitive token** (`--palette-*`): เพิ่มเฉพาะเมื่อ semantic token ต้องการสีที่ยังไม่มี ใส่ในบล็อก `:root` แรกของ `theme.css` ตั้งชื่อตามสเกล Tailwind (ถ้าค่าตรงกับ Tailwind ใช้ระดับเดียวกัน) ใช้ใน semantic token เท่านั้น
47
+ - **semantic token**: ใส่ทั้งใน `:root` และ `.dark` ค่าเป็น `var(--palette-…)` (สีโปร่งแสงเพิ่มเป็น primitive แยก เช่น `--palette-white-a10` ไม่ใช้ `color-mix()` เพราะ fallback ของ build เป็นสีทึบ) และเพิ่มใน `@theme inline` ถ้าต้องการ utility ชื่อสั้น
45
48
  - **component token**: ใส่ใน `:root, .dark` ใต้ความเห็นชื่อกลุ่ม (เช่น `/* Button */`) ชี้ไปที่ semantic token ค่าที่ต่างในโหมดมืดใส่ใน `.dark` ด้านล่าง
46
- 2. เพิ่มคำอธิบายภาษาไทยของ token ใน `SEMANTIC_DESC` / `COMPONENT_DESC` ใน `packages/ui/scripts/tokens.mjs`
49
+ 2. เพิ่มคำอธิบายภาษาไทยของ token ใน `SEMANTIC_DESC` / `COMPONENT_DESC` ใน `packages/ui/scripts/tokens.mjs` (primitive ไม่ต้อง ตารางจะบอกเองว่าตรงกับสีไหนของ Tailwind)
47
50
  3. ถ้า token วางตัวอักษรหรือขอบบนพื้นใหม่ เพิ่มคู่ใน `CONTRAST_PAIRS`
48
51
  4. รัน
49
52
 
@@ -53,7 +56,7 @@ pnpm storybook # http://localhost:6006
53
56
  ```
54
57
 
55
58
  5. แก้ตาราง "Tokens used" ใน `<Name>.md` ของคอมโพเนนต์ที่ใช้ token นั้น
56
- 6. ค่าสีมาจากแอป DSADV (`src/app/globals.css`) TODO: ยังไม่ได้ตัดสินใจว่าไฟล์ไหนเป็นต้นฉบับ แจ้งทีมแอปเมื่อเปลี่ยนค่า
59
+ 6. ค่าสีมาจากแอป `labdsnovweek1` (`src/app/globals.css`) TODO: ยังไม่ได้ตัดสินใจว่าไฟล์ไหนเป็นต้นฉบับ แจ้งทีมแอปเมื่อเปลี่ยนค่า
57
60
 
58
61
  ## Write the usage doc
59
62
 
@@ -68,7 +71,7 @@ pnpm storybook # http://localhost:6006
68
71
 
69
72
  - เขียนให้นักออกแบบและ AI agent อ่าน ไม่ใส่รายละเอียดการ implement (export, data attribute, class)
70
73
  - สิ่งที่ยังไม่แน่ใจหรือยังไม่ได้ตัดสินใจ เขียนเป็น `TODO:` ห้ามเดา
71
- - แก้ prop, variant, token หรือพฤติกรรม ต้องแก้ `.md` ใน change เดียวกัน
74
+ - แก้ prop, variant, token หรือพฤติกรรม ต้องแก้ `.md` และ `.dsds.yaml` ใน change เดียวกัน
72
75
  - story file import doc ด้วย `import guidelines from "./<Name>.md?raw"` แล้วส่งผ่าน `usageDoc()` เข้า `parameters.docs.description.component` เพื่อแสดงในหน้า Docs
73
76
 
74
77
  ## Write stories
@@ -86,11 +89,15 @@ pnpm format # จัดรูปแบบโค้ดก่อน CI
86
89
  pnpm typecheck
87
90
  pnpm lint
88
91
  pnpm tokens:check
92
+ pnpm dsds:check # ตรวจ .dsds.yaml กับ schema และโค้ด
89
93
  pnpm build
90
94
  pnpm check:dist # ตรวจ dist หลัง build
95
+ pnpm changeset # เพิ่ม changeset ถ้า change นี้กระทบสิ่งที่ publish ใน packages/ui
91
96
  ```
92
97
 
93
- - คำสั่งชุดนี้คือสิ่งที่ GitHub Actions (`.github/workflows/ci.yml`) รันกับทุก pull request ที่เข้า `main` ถ้าไม่ผ่านจะ merge ไม่ได้ (เมื่อตั้ง branch protection แล้ว)
98
+ - คำสั่งชุดนี้คือสิ่งที่ GitHub Actions (`.github/workflows/ci.yml`) รันกับทุก pull request ที่เข้า `main` หรือ `develop` ถ้าไม่ผ่านจะ merge ไม่ได้ (เมื่อตั้ง branch protection แล้ว)
99
+ - merge เข้า `develop` ที่มี changeset ค้างอยู่ CI จะ publish เวอร์ชัน beta (`x.y.z-beta.N`, ติดตั้งด้วย `@beta`) ให้เอง
100
+ - merge เข้า `main` แล้ว bot จะเปิด PR "chore: version packages" พอ merge PR นั้น CI จะ publish เวอร์ชัน stable (`latest`) ขั้นตอนทั้งหมดอยู่ใน `RELEASING.md`
94
101
 
95
102
  - เปิด Storybook ดูทุก story ที่แก้ ทั้งโหมดสว่างและมืด และดูว่า `play` ผ่านในแผง Interactions
96
103
  - hover และสถานะ `:active` บังคับใน story ไม่ได้ ตรวจด้วยมือ
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@designil/labdsnov",
3
- "version": "1.0.0",
4
- "description": "DSADV design system: Thai-first shadcn/ui components on Base UI, styled with Tailwind CSS v4 CSS modules.",
3
+ "version": "1.1.0",
4
+ "description": "labdsnov design system: Thai-first shadcn/ui components on Base UI, styled with Tailwind CSS v4 CSS modules.",
5
5
  "keywords": [
6
6
  "design-system",
7
7
  "react",
@@ -36,11 +36,24 @@
36
36
  "files": [
37
37
  "dist",
38
38
  "docs/*.md",
39
- "src/components/*/*.md"
39
+ "src/components/*/*.md",
40
+ "src/index.dsds.yaml",
41
+ "src/components/*/*.dsds.yaml"
40
42
  ],
41
43
  "publishConfig": {
42
44
  "access": "public"
43
45
  },
46
+ "scripts": {
47
+ "build": "rm -rf dist && vite build && tsc -p tsconfig.build.json",
48
+ "typecheck": "tsc --noEmit && tsc -p figma",
49
+ "pack:dry": "pnpm pack --dry-run",
50
+ "tokens:check": "node scripts/tokens.mjs check",
51
+ "tokens:docs": "node scripts/tokens.mjs docs",
52
+ "check:dist": "node scripts/check-dist.mjs",
53
+ "dsds:check": "node scripts/dsds.mjs",
54
+ "figma:parse": "figma connect parse --exit-on-unreadable-files > /dev/null",
55
+ "figma:publish": "figma connect publish --exit-on-unreadable-files"
56
+ },
44
57
  "dependencies": {
45
58
  "@base-ui/react": "^1.9.0",
46
59
  "@hugeicons/core-free-icons": "^4.4.0",
@@ -57,10 +70,12 @@
57
70
  "react-dom": "^19.0.0"
58
71
  },
59
72
  "devDependencies": {
73
+ "@figma/code-connect": "2.1.1",
60
74
  "@storybook/nextjs-vite": "10.6.7",
61
75
  "@tailwindcss/vite": "^4",
62
76
  "@types/react": "^19",
63
77
  "@types/react-dom": "^19",
78
+ "ajv": "8.20.0",
64
79
  "next": "16.4.4",
65
80
  "react": "19.3.1",
66
81
  "react-dom": "19.3.1",
@@ -69,14 +84,7 @@
69
84
  "tailwindcss": "^4",
70
85
  "tw-animate-css": "^1.4.0",
71
86
  "typescript": "^5",
72
- "vite": "^7"
73
- },
74
- "scripts": {
75
- "build": "rm -rf dist && vite build && tsc -p tsconfig.build.json",
76
- "typecheck": "tsc --noEmit",
77
- "pack:dry": "pnpm pack --dry-run",
78
- "tokens:check": "node scripts/tokens.mjs check",
79
- "tokens:docs": "node scripts/tokens.mjs docs",
80
- "check:dist": "node scripts/check-dist.mjs"
87
+ "vite": "^7",
88
+ "yaml": "2.9.1"
81
89
  }
82
- }
90
+ }
@@ -0,0 +1,195 @@
1
+ kind: component
2
+ id: accordion
3
+ name: Accordion
4
+ description: >-
5
+ A list of headings that open one section of content at a time, such as an FAQ.
6
+ 18px rounded frame; the open section has a faint grey background. Wraps Base
7
+ UI's `Accordion`.
8
+ metadata:
9
+ status: {status: stable}
10
+ since: 1.0.0
11
+ tags: [disclosure]
12
+
13
+ sections:
14
+ - kind: guidelines
15
+ for: all
16
+ framing: when-to-use
17
+ items:
18
+ - level: should
19
+ statement: >-
20
+ Use for FAQs, or secondary detail most users don't need to read in full.
21
+ - level: should
22
+ statement: >-
23
+ Use to shorten a page on mobile when each section can be read without
24
+ knowing the others.
25
+ - level: must-not
26
+ statement: >-
27
+ Never hide information everyone must see (e.g. fees, withdrawal conditions)
28
+ in an Accordion; show it on the page.
29
+ checkedBy: manual
30
+ - level: must-not
31
+ statement: >-
32
+ Never use it to switch between views of the same content; use <dsds:tabs>.
33
+ alternatives:
34
+ - to: tabs
35
+ checkedBy: manual
36
+ - level: must-not
37
+ statement: >-
38
+ Never use it for steps that must be done in order (there's no stepper
39
+ component yet, see Open decisions).
40
+ checkedBy: manual
41
+ - level: should-not
42
+ statement: >-
43
+ Don't use it for a single collapsible section (e.g. "ดูรายละเอียดเพิ่มเติม"
44
+ see more details); use <dsds:collapsible>, which has no frame or heading.
45
+ alternatives:
46
+ - to: collapsible
47
+
48
+ - kind: guidelines
49
+ for: all
50
+ items:
51
+ - id: unique-item-value
52
+ level: must
53
+ statement: >-
54
+ Every `AccordionItem` has a unique `value` (e.g. `"withdraw"`, `"fees"`).
55
+ `defaultValue` and `value` refer to these names as an array, even when only
56
+ one section is open (`defaultValue={["fees"]}`).
57
+ checkedBy: manual
58
+ - id: one-at-a-time
59
+ level: should
60
+ statement: >-
61
+ Keep the default (one section at a time: opening a new one closes the
62
+ previous one). Use `multiple` only when users need to compare two sections
63
+ side by side.
64
+ checks:
65
+ - href: ./Accordion.stories.tsx#OpenOneAtATime
66
+ role: test
67
+ note: The play function checks that opening the second section sets the first to aria-expanded="false"
68
+ checkedBy: automated
69
+ - id: trigger-is-question
70
+ level: should
71
+ statement: >-
72
+ The heading (`AccordionTrigger`) is a question or short one-line title, e.g.
73
+ "ฉันถอนเงินได้เมื่อไร?" (when can I withdraw?), and the answer in
74
+ `AccordionContent` stands on its own.
75
+ checkedBy: manual
76
+ - id: no-interactive-in-trigger
77
+ level: must-not
78
+ statement: >-
79
+ Never put a button or link inside `AccordionTrigger`. The heading is already
80
+ a `<button>`; a button inside a button is invalid HTML and unreachable by
81
+ keyboard.
82
+ checkedBy: manual
83
+
84
+ - kind: guidelines
85
+ for: all
86
+ title: Accessibility
87
+ tags: [accessibility]
88
+ items:
89
+ - id: keyboard-toggle
90
+ level: must
91
+ statement: >-
92
+ Headings open and close with Enter or Space, and carry `aria-expanded` for
93
+ their state.
94
+ evidence:
95
+ - href: https://www.w3.org/WAI/ARIA/apg/patterns/accordion/
96
+ role: WAI-ARIA APG Accordion pattern
97
+ checks:
98
+ - href: ./Accordion.stories.tsx#Keyboard
99
+ role: test
100
+ note: The play function tabs to the first heading, presses Enter, and checks aria-expanded="true"
101
+ checkedBy: automated
102
+ - id: heading-level
103
+ level: should
104
+ statement: >-
105
+ Headings are always `h3`. Place the Accordion under an `h2` of the page so
106
+ the heading order doesn't skip a level (the level can't be changed yet, see
107
+ Open decisions).
108
+ evidence:
109
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html
110
+ role: WCAG 2.2 SC 1.3.1 (A)
111
+ checkedBy: manual
112
+ - refs:
113
+ - to: shared-a11y#focus-ring
114
+ rel: same-as
115
+
116
+ - kind: definitions
117
+ for: all
118
+ context: anatomy
119
+ items:
120
+ - term: Accordion
121
+ definition: >-
122
+ The frame around all sections. Takes `multiple`, `defaultValue`, `value` /
123
+ `onValueChange`.
124
+ - term: AccordionItem
125
+ definition: >-
126
+ One section. Takes `value` (required) and `disabled` (can't open, 50%
127
+ opacity).
128
+ - term: AccordionTrigger
129
+ definition: >-
130
+ The heading button inside an `h3`. The chevron on the right points down when
131
+ closed and up when open. Has a focus ring (shadcn's doesn't).
132
+ - term: AccordionContent
133
+ definition: >-
134
+ The content, which slides open and closed with an animation.
135
+
136
+ - kind: definitions
137
+ for: all
138
+ context: keyboard
139
+ items:
140
+ - term: Tab
141
+ definition: >-
142
+ Move to the next heading.
143
+ - term: Enter / Space
144
+ definition: >-
145
+ Open or close the focused section.
146
+
147
+ - kind: section
148
+ for: all
149
+ title: Open decisions
150
+ freeform:
151
+ - title: TODO
152
+ body: >-
153
+ The heading level (`h3`) can't yet follow the page's structure, and there's
154
+ no stepper component for ordered steps.
155
+
156
+ sourceFiles:
157
+ - platform: react
158
+ file: ./Accordion.tsx
159
+
160
+ imports:
161
+ - platform: react
162
+ code: >-
163
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@designil/labdsnov"
164
+ package: "@designil/labdsnov"
165
+
166
+ traits:
167
+ - traitType: variant
168
+ kind: boolean
169
+ id: multiple
170
+ description: >-
171
+ Lets several sections be open at once. Defaults to `false` (opening a new
172
+ section closes the previous one).
173
+ - traitType: state
174
+ kind: boolean
175
+ id: open
176
+ description: >-
177
+ The section is open: the heading has `aria-expanded="true"` and a faint grey
178
+ background.
179
+ - traitType: state
180
+ kind: boolean
181
+ id: disabled
182
+ description: >-
183
+ An `AccordionItem` that can't open, at 50% opacity.
184
+
185
+ alternatives:
186
+ - to: collapsible
187
+ - to: tabs
188
+
189
+ refs:
190
+ - href: ./Accordion.md
191
+ rel: relates-to
192
+ role: Usage doc in Thai
193
+ - href: ./Accordion.stories.tsx
194
+ rel: demo
195
+ role: CSF stories