@designil/labdsnov 0.0.0-stage → 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 (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -2
  3. package/dist/components/Accordion/Accordion.d.ts +8 -0
  4. package/dist/components/Accordion/Accordion.js +82 -0
  5. package/dist/components/Accordion/Accordion.module.css.js +23 -0
  6. package/dist/components/Accordion/index.d.ts +1 -0
  7. package/dist/components/Alert/Alert.d.ts +17 -0
  8. package/dist/components/Alert/Alert.js +58 -0
  9. package/dist/components/Alert/Alert.module.css.js +17 -0
  10. package/dist/components/Alert/index.d.ts +1 -0
  11. package/dist/components/AlertDialog/AlertDialog.d.ts +29 -0
  12. package/dist/components/AlertDialog/AlertDialog.js +150 -0
  13. package/dist/components/AlertDialog/AlertDialog.module.css.js +23 -0
  14. package/dist/components/AlertDialog/index.d.ts +1 -0
  15. package/dist/components/Avatar/Avatar.d.ts +23 -0
  16. package/dist/components/Avatar/Avatar.js +84 -0
  17. package/dist/components/Avatar/Avatar.module.css.js +23 -0
  18. package/dist/components/Avatar/index.d.ts +1 -0
  19. package/dist/components/Badge/Badge.d.ts +17 -0
  20. package/dist/components/Badge/Badge.js +37 -0
  21. package/dist/components/Badge/Badge.module.css.js +19 -0
  22. package/dist/components/Badge/index.d.ts +1 -0
  23. package/dist/components/Breadcrumb/Breadcrumb.d.ts +15 -0
  24. package/dist/components/Breadcrumb/Breadcrumb.js +111 -0
  25. package/dist/components/Breadcrumb/Breadcrumb.module.css.js +19 -0
  26. package/dist/components/Breadcrumb/index.d.ts +1 -0
  27. package/dist/components/Button/Button.d.ts +39 -0
  28. package/dist/components/Button/Button.js +62 -0
  29. package/dist/components/Button/Button.module.css.js +37 -0
  30. package/dist/components/Button/index.d.ts +1 -0
  31. package/dist/components/ButtonGroup/ButtonGroup.d.ts +21 -0
  32. package/dist/components/ButtonGroup/ButtonGroup.js +59 -0
  33. package/dist/components/ButtonGroup/ButtonGroup.module.css.js +15 -0
  34. package/dist/components/ButtonGroup/index.d.ts +1 -0
  35. package/dist/components/Calendar/Calendar.d.ts +17 -0
  36. package/dist/components/Calendar/Calendar.js +154 -0
  37. package/dist/components/Calendar/Calendar.module.css.js +67 -0
  38. package/dist/components/Calendar/index.d.ts +1 -0
  39. package/dist/components/Card/Card.d.ts +20 -0
  40. package/dist/components/Card/Card.js +87 -0
  41. package/dist/components/Card/Card.module.css.js +23 -0
  42. package/dist/components/Card/index.d.ts +1 -0
  43. package/dist/components/Chart/Chart.d.ts +59 -0
  44. package/dist/components/Chart/Chart.js +199 -0
  45. package/dist/components/Chart/Chart.module.css.js +47 -0
  46. package/dist/components/Chart/index.d.ts +1 -0
  47. package/dist/components/Checkbox/Checkbox.d.ts +4 -0
  48. package/dist/components/Checkbox/Checkbox.js +44 -0
  49. package/dist/components/Checkbox/Checkbox.module.css.js +13 -0
  50. package/dist/components/Checkbox/index.d.ts +1 -0
  51. package/dist/components/Collapsible/Collapsible.d.ts +8 -0
  52. package/dist/components/Collapsible/Collapsible.js +28 -0
  53. package/dist/components/Collapsible/Collapsible.module.css.js +7 -0
  54. package/dist/components/Collapsible/index.d.ts +1 -0
  55. package/dist/components/Combobox/Combobox.d.ts +36 -0
  56. package/dist/components/Combobox/Combobox.js +296 -0
  57. package/dist/components/Combobox/Combobox.module.css.js +39 -0
  58. package/dist/components/Combobox/index.d.ts +1 -0
  59. package/dist/components/DatePicker/DatePicker.d.ts +28 -0
  60. package/dist/components/DatePicker/DatePicker.js +73 -0
  61. package/dist/components/DatePicker/DatePicker.module.css.js +9 -0
  62. package/dist/components/DatePicker/index.d.ts +1 -0
  63. package/dist/components/Dialog/Dialog.d.ts +27 -0
  64. package/dist/components/Dialog/Dialog.js +144 -0
  65. package/dist/components/Dialog/Dialog.module.css.js +29 -0
  66. package/dist/components/Dialog/index.d.ts +1 -0
  67. package/dist/components/Drawer/Drawer.d.ts +22 -0
  68. package/dist/components/Drawer/Drawer.js +166 -0
  69. package/dist/components/Drawer/Drawer.module.css.js +23 -0
  70. package/dist/components/Drawer/index.d.ts +1 -0
  71. package/dist/components/DropdownMenu/DropdownMenu.d.ts +32 -0
  72. package/dist/components/DropdownMenu/DropdownMenu.js +245 -0
  73. package/dist/components/DropdownMenu/DropdownMenu.module.css.js +33 -0
  74. package/dist/components/DropdownMenu/index.d.ts +1 -0
  75. package/dist/components/Empty/Empty.d.ts +18 -0
  76. package/dist/components/Empty/Empty.js +76 -0
  77. package/dist/components/Empty/Empty.module.css.js +21 -0
  78. package/dist/components/Empty/index.d.ts +1 -0
  79. package/dist/components/Field/Field.d.ts +53 -0
  80. package/dist/components/Field/Field.js +172 -0
  81. package/dist/components/Field/Field.module.css.js +41 -0
  82. package/dist/components/Field/index.d.ts +1 -0
  83. package/dist/components/FundCard/FundCard.d.ts +18 -0
  84. package/dist/components/FundCard/FundCard.js +66 -0
  85. package/dist/components/FundCard/FundCard.module.css.js +25 -0
  86. package/dist/components/FundCard/index.d.ts +1 -0
  87. package/dist/components/HoverCard/HoverCard.d.ts +8 -0
  88. package/dist/components/HoverCard/HoverCard.js +42 -0
  89. package/dist/components/HoverCard/HoverCard.module.css.js +9 -0
  90. package/dist/components/HoverCard/index.d.ts +1 -0
  91. package/dist/components/Input/Input.d.ts +12 -0
  92. package/dist/components/Input/Input.js +23 -0
  93. package/dist/components/Input/Input.module.css.js +11 -0
  94. package/dist/components/Input/index.d.ts +1 -0
  95. package/dist/components/InputGroup/InputGroup.d.ts +39 -0
  96. package/dist/components/InputGroup/InputGroup.js +103 -0
  97. package/dist/components/InputGroup/InputGroup.module.css.js +31 -0
  98. package/dist/components/InputGroup/index.d.ts +1 -0
  99. package/dist/components/InputOTP/InputOTP.d.ts +18 -0
  100. package/dist/components/InputOTP/InputOTP.js +72 -0
  101. package/dist/components/InputOTP/InputOTP.module.css.js +19 -0
  102. package/dist/components/InputOTP/index.d.ts +1 -0
  103. package/dist/components/Kbd/Kbd.d.ts +5 -0
  104. package/dist/components/Kbd/Kbd.js +20 -0
  105. package/dist/components/Kbd/Kbd.module.css.js +9 -0
  106. package/dist/components/Kbd/index.d.ts +1 -0
  107. package/dist/components/Label/Label.d.ts +7 -0
  108. package/dist/components/Label/Label.js +17 -0
  109. package/dist/components/Label/Label.module.css.js +9 -0
  110. package/dist/components/Label/index.d.ts +1 -0
  111. package/dist/components/NavigationMenu/NavigationMenu.d.ts +20 -0
  112. package/dist/components/NavigationMenu/NavigationMenu.js +153 -0
  113. package/dist/components/NavigationMenu/NavigationMenu.module.css.js +29 -0
  114. package/dist/components/NavigationMenu/index.d.ts +1 -0
  115. package/dist/components/Pagination/Pagination.d.ts +29 -0
  116. package/dist/components/Pagination/Pagination.js +133 -0
  117. package/dist/components/Pagination/Pagination.module.css.js +19 -0
  118. package/dist/components/Pagination/index.d.ts +1 -0
  119. package/dist/components/Popover/Popover.d.ts +10 -0
  120. package/dist/components/Popover/Popover.js +78 -0
  121. package/dist/components/Popover/Popover.module.css.js +15 -0
  122. package/dist/components/Popover/index.d.ts +1 -0
  123. package/dist/components/Progress/Progress.d.ts +12 -0
  124. package/dist/components/Progress/Progress.js +74 -0
  125. package/dist/components/Progress/Progress.module.css.js +15 -0
  126. package/dist/components/Progress/index.d.ts +1 -0
  127. package/dist/components/RadioGroup/RadioGroup.d.ts +6 -0
  128. package/dist/components/RadioGroup/RadioGroup.js +37 -0
  129. package/dist/components/RadioGroup/RadioGroup.module.css.js +13 -0
  130. package/dist/components/RadioGroup/index.d.ts +1 -0
  131. package/dist/components/ScrollArea/ScrollArea.d.ts +9 -0
  132. package/dist/components/ScrollArea/ScrollArea.js +60 -0
  133. package/dist/components/ScrollArea/ScrollArea.module.css.js +17 -0
  134. package/dist/components/ScrollArea/index.d.ts +1 -0
  135. package/dist/components/Select/Select.d.ts +23 -0
  136. package/dist/components/Select/Select.js +188 -0
  137. package/dist/components/Select/Select.module.css.js +37 -0
  138. package/dist/components/Select/index.d.ts +1 -0
  139. package/dist/components/Separator/Separator.d.ts +4 -0
  140. package/dist/components/Separator/Separator.js +22 -0
  141. package/dist/components/Separator/Separator.module.css.js +7 -0
  142. package/dist/components/Separator/index.d.ts +1 -0
  143. package/dist/components/Skeleton/Skeleton.d.ts +4 -0
  144. package/dist/components/Skeleton/Skeleton.js +16 -0
  145. package/dist/components/Skeleton/Skeleton.module.css.js +7 -0
  146. package/dist/components/Skeleton/index.d.ts +1 -0
  147. package/dist/components/Slider/Slider.d.ts +13 -0
  148. package/dist/components/Slider/Slider.js +61 -0
  149. package/dist/components/Slider/Slider.module.css.js +15 -0
  150. package/dist/components/Slider/index.d.ts +1 -0
  151. package/dist/components/Spinner/Spinner.d.ts +6 -0
  152. package/dist/components/Spinner/Spinner.js +22 -0
  153. package/dist/components/Spinner/Spinner.module.css.js +7 -0
  154. package/dist/components/Spinner/index.d.ts +1 -0
  155. package/dist/components/Switch/Switch.d.ts +13 -0
  156. package/dist/components/Switch/Switch.js +29 -0
  157. package/dist/components/Switch/Switch.module.css.js +13 -0
  158. package/dist/components/Switch/index.d.ts +1 -0
  159. package/dist/components/Table/Table.d.ts +12 -0
  160. package/dist/components/Table/Table.js +96 -0
  161. package/dist/components/Table/Table.module.css.js +23 -0
  162. package/dist/components/Table/index.d.ts +1 -0
  163. package/dist/components/Tabs/Tabs.d.ts +16 -0
  164. package/dist/components/Tabs/Tabs.js +55 -0
  165. package/dist/components/Tabs/Tabs.module.css.js +17 -0
  166. package/dist/components/Tabs/index.d.ts +1 -0
  167. package/dist/components/Textarea/Textarea.d.ts +4 -0
  168. package/dist/components/Textarea/Textarea.js +16 -0
  169. package/dist/components/Textarea/Textarea.module.css.js +7 -0
  170. package/dist/components/Textarea/index.d.ts +1 -0
  171. package/dist/components/Toaster/Toaster.d.ts +8 -0
  172. package/dist/components/Toaster/Toaster.js +85 -0
  173. package/dist/components/Toaster/Toaster.module.css.js +11 -0
  174. package/dist/components/Toaster/index.d.ts +1 -0
  175. package/dist/components/Toggle/Toggle.d.ts +26 -0
  176. package/dist/components/Toggle/Toggle.js +35 -0
  177. package/dist/components/Toggle/Toggle.module.css.js +17 -0
  178. package/dist/components/Toggle/index.d.ts +1 -0
  179. package/dist/components/ToggleGroup/ToggleGroup.d.ts +20 -0
  180. package/dist/components/ToggleGroup/ToggleGroup.js +64 -0
  181. package/dist/components/ToggleGroup/ToggleGroup.module.css.js +11 -0
  182. package/dist/components/ToggleGroup/index.d.ts +1 -0
  183. package/dist/components/Tooltip/Tooltip.d.ts +8 -0
  184. package/dist/components/Tooltip/Tooltip.js +61 -0
  185. package/dist/components/Tooltip/Tooltip.module.css.js +11 -0
  186. package/dist/components/Tooltip/index.d.ts +1 -0
  187. package/dist/index.d.ts +47 -0
  188. package/dist/index.js +265 -0
  189. package/dist/styles.css +1 -0
  190. package/docs/Accessibility.md +129 -0
  191. package/docs/Colors.md +149 -0
  192. package/docs/ComponentTokens.md +191 -0
  193. package/docs/Contributing.md +104 -0
  194. package/docs/GettingStarted.md +106 -0
  195. package/docs/Radius.md +25 -0
  196. package/docs/Typography.md +38 -0
  197. package/package.json +88 -4
  198. package/src/components/Accordion/Accordion.dsds.yaml +195 -0
  199. package/src/components/Accordion/Accordion.md +102 -0
  200. package/src/components/Alert/Alert.dsds.yaml +206 -0
  201. package/src/components/Alert/Alert.md +90 -0
  202. package/src/components/AlertDialog/AlertDialog.dsds.yaml +243 -0
  203. package/src/components/AlertDialog/AlertDialog.md +131 -0
  204. package/src/components/Avatar/Avatar.dsds.yaml +172 -0
  205. package/src/components/Avatar/Avatar.md +77 -0
  206. package/src/components/Badge/Badge.dsds.yaml +191 -0
  207. package/src/components/Badge/Badge.md +124 -0
  208. package/src/components/Breadcrumb/Breadcrumb.dsds.yaml +162 -0
  209. package/src/components/Breadcrumb/Breadcrumb.md +110 -0
  210. package/src/components/Button/Button.dsds.yaml +350 -0
  211. package/src/components/Button/Button.md +165 -0
  212. package/src/components/ButtonGroup/ButtonGroup.dsds.yaml +193 -0
  213. package/src/components/ButtonGroup/ButtonGroup.md +96 -0
  214. package/src/components/Calendar/Calendar.dsds.yaml +236 -0
  215. package/src/components/Calendar/Calendar.md +111 -0
  216. package/src/components/Card/Card.dsds.yaml +199 -0
  217. package/src/components/Card/Card.md +99 -0
  218. package/src/components/Chart/Chart.dsds.yaml +216 -0
  219. package/src/components/Chart/Chart.md +112 -0
  220. package/src/components/Checkbox/Checkbox.dsds.yaml +215 -0
  221. package/src/components/Checkbox/Checkbox.md +105 -0
  222. package/src/components/Collapsible/Collapsible.dsds.yaml +146 -0
  223. package/src/components/Collapsible/Collapsible.md +86 -0
  224. package/src/components/Combobox/Combobox.dsds.yaml +241 -0
  225. package/src/components/Combobox/Combobox.md +143 -0
  226. package/src/components/DatePicker/DatePicker.dsds.yaml +179 -0
  227. package/src/components/DatePicker/DatePicker.md +82 -0
  228. package/src/components/Dialog/Dialog.dsds.yaml +300 -0
  229. package/src/components/Dialog/Dialog.md +193 -0
  230. package/src/components/Drawer/Drawer.dsds.yaml +207 -0
  231. package/src/components/Drawer/Drawer.md +125 -0
  232. package/src/components/DropdownMenu/DropdownMenu.dsds.yaml +265 -0
  233. package/src/components/DropdownMenu/DropdownMenu.md +151 -0
  234. package/src/components/Empty/Empty.dsds.yaml +171 -0
  235. package/src/components/Empty/Empty.md +90 -0
  236. package/src/components/Field/Field.dsds.yaml +285 -0
  237. package/src/components/Field/Field.md +139 -0
  238. package/src/components/FundCard/FundCard.dsds.yaml +195 -0
  239. package/src/components/FundCard/FundCard.md +93 -0
  240. package/src/components/HoverCard/HoverCard.dsds.yaml +157 -0
  241. package/src/components/HoverCard/HoverCard.md +100 -0
  242. package/src/components/Input/Input.dsds.yaml +235 -0
  243. package/src/components/Input/Input.md +115 -0
  244. package/src/components/InputGroup/InputGroup.dsds.yaml +234 -0
  245. package/src/components/InputGroup/InputGroup.md +115 -0
  246. package/src/components/InputOTP/InputOTP.dsds.yaml +184 -0
  247. package/src/components/InputOTP/InputOTP.md +105 -0
  248. package/src/components/Kbd/Kbd.dsds.yaml +119 -0
  249. package/src/components/Kbd/Kbd.md +85 -0
  250. package/src/components/Label/Label.dsds.yaml +141 -0
  251. package/src/components/Label/Label.md +75 -0
  252. package/src/components/NavigationMenu/NavigationMenu.dsds.yaml +196 -0
  253. package/src/components/NavigationMenu/NavigationMenu.md +128 -0
  254. package/src/components/Pagination/Pagination.dsds.yaml +172 -0
  255. package/src/components/Pagination/Pagination.md +115 -0
  256. package/src/components/Popover/Popover.dsds.yaml +168 -0
  257. package/src/components/Popover/Popover.md +111 -0
  258. package/src/components/Progress/Progress.dsds.yaml +169 -0
  259. package/src/components/Progress/Progress.md +83 -0
  260. package/src/components/RadioGroup/RadioGroup.dsds.yaml +215 -0
  261. package/src/components/RadioGroup/RadioGroup.md +123 -0
  262. package/src/components/ScrollArea/ScrollArea.dsds.yaml +153 -0
  263. package/src/components/ScrollArea/ScrollArea.md +88 -0
  264. package/src/components/Select/Select.dsds.yaml +239 -0
  265. package/src/components/Select/Select.md +170 -0
  266. package/src/components/Separator/Separator.dsds.yaml +121 -0
  267. package/src/components/Separator/Separator.md +68 -0
  268. package/src/components/Skeleton/Skeleton.dsds.yaml +124 -0
  269. package/src/components/Skeleton/Skeleton.md +68 -0
  270. package/src/components/Slider/Slider.dsds.yaml +194 -0
  271. package/src/components/Slider/Slider.md +107 -0
  272. package/src/components/Spinner/Spinner.dsds.yaml +126 -0
  273. package/src/components/Spinner/Spinner.md +64 -0
  274. package/src/components/Switch/Switch.dsds.yaml +198 -0
  275. package/src/components/Switch/Switch.md +101 -0
  276. package/src/components/Table/Table.dsds.yaml +195 -0
  277. package/src/components/Table/Table.md +117 -0
  278. package/src/components/Tabs/Tabs.dsds.yaml +239 -0
  279. package/src/components/Tabs/Tabs.md +173 -0
  280. package/src/components/Textarea/Textarea.dsds.yaml +167 -0
  281. package/src/components/Textarea/Textarea.md +89 -0
  282. package/src/components/Toaster/Toaster.dsds.yaml +226 -0
  283. package/src/components/Toaster/Toaster.md +107 -0
  284. package/src/components/Toggle/Toggle.dsds.yaml +224 -0
  285. package/src/components/Toggle/Toggle.md +103 -0
  286. package/src/components/ToggleGroup/ToggleGroup.dsds.yaml +230 -0
  287. package/src/components/ToggleGroup/ToggleGroup.md +95 -0
  288. package/src/components/Tooltip/Tooltip.dsds.yaml +202 -0
  289. package/src/components/Tooltip/Tooltip.md +104 -0
  290. package/src/index.dsds.yaml +467 -0
@@ -0,0 +1,265 @@
1
+ kind: component
2
+ id: dropdown-menu
3
+ name: DropdownMenu
4
+ description: >-
5
+ A list of commands opened from a button, such as edit, download or delete for one
6
+ item. At least 192px wide. Wraps Base UI's `Menu`.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [overlay, action]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use for several commands on one item that you don't want to show as separate
20
+ buttons, such as the "…" menu in a table row or a card.
21
+ - level: may
22
+ statement: >-
23
+ Use for small display options, such as choosing columns
24
+ (`DropdownMenuCheckboxItem`) or a sort order (`DropdownMenuRadioItem`).
25
+ example:
26
+ ref:
27
+ href: ./DropdownMenu.stories.tsx#Choices
28
+ rel: demo
29
+ - level: must-not
30
+ statement: >-
31
+ Don't use it to pick a form value. Use <dsds:select>, which submits with the form
32
+ and shows the chosen value.
33
+ alternatives:
34
+ - to: select
35
+ checkedBy: manual
36
+ - level: must-not
37
+ statement: >-
38
+ Don't hide the page's main action in a menu. Use a <dsds:button> that's always
39
+ visible.
40
+ alternatives:
41
+ - to: button
42
+ checkedBy: manual
43
+ - level: must-not
44
+ statement: >-
45
+ Don't use it to navigate to other pages. Use links or <dsds:navigation-menu>.
46
+ alternatives:
47
+ - to: navigation-menu
48
+ checkedBy: manual
49
+ - level: should-not
50
+ statement: >-
51
+ Don't put content or inputs in a menu. Use <dsds:popover>.
52
+ alternatives:
53
+ - to: popover
54
+
55
+ - kind: guidelines
56
+ for: all
57
+ items:
58
+ - id: destructive-last
59
+ level: must
60
+ statement: >-
61
+ Items that delete or can't be undone use `variant="destructive"`, go last after a
62
+ `DropdownMenuSeparator`, and open an <dsds:alert-dialog> to confirm instead of
63
+ deleting straight away.
64
+ uses:
65
+ - to: alert-dialog
66
+ checkedBy: manual
67
+ - id: trigger-render
68
+ level: must
69
+ statement: >-
70
+ Write the opening button as `<DropdownMenuTrigger render={<Button size="icon"
71
+ variant="ghost" aria-label="…" />}>`, with the "…" icon (`MoreHorizontalIcon`) as
72
+ the trigger's child.
73
+ refs:
74
+ - to: shared-composition#render-prop
75
+ rel: relates-to
76
+ uses:
77
+ - to: button
78
+ checkedBy: assisted
79
+ - id: icons-consistent
80
+ level: should
81
+ statement: >-
82
+ If one item has an icon, every item in its group should too, or use `inset` on
83
+ the items without one so the text lines up.
84
+ checkedBy: manual
85
+ - id: group-label
86
+ level: should
87
+ statement: >-
88
+ A menu for a named item (e.g. one beneficiary) puts a `DropdownMenuLabel` in a
89
+ `DropdownMenuGroup` saying whose menu it is.
90
+ checkedBy: manual
91
+ - id: shortcut-display-only
92
+ level: should
93
+ statement: >-
94
+ `DropdownMenuShortcut` only displays a shortcut; it doesn't bind the key. Show
95
+ only shortcuts the app actually binds.
96
+ checkedBy: manual
97
+ - id: max-depth
98
+ level: should-not
99
+ statement: >-
100
+ Don't nest submenus (`DropdownMenuSub`) more than one level deep.
101
+ - id: no-disabled-hidden-reason
102
+ level: should-not
103
+ statement: >-
104
+ Don't disable an item without a visible reason. If the user can never do it, hide
105
+ the item instead (disabled items still take focus but can't be chosen).
106
+
107
+ - kind: guidelines
108
+ for: all
109
+ title: Accessibility
110
+ tags: [accessibility]
111
+ items:
112
+ - id: trigger-label
113
+ level: must
114
+ statement: >-
115
+ An icon button that opens a menu has an `aria-label` saying whose menu it is, e.g.
116
+ "ตัวเลือกผู้รับผลประโยชน์" (beneficiary options), not just "เพิ่มเติม" (more)
117
+ when there are several rows.
118
+ refines:
119
+ - to: shared-a11y#icon-only-label
120
+ checkedBy: assisted
121
+ - id: keyboard-menu
122
+ level: must
123
+ statement: >-
124
+ Enter on the trigger opens the menu and focuses the first item. Up/down arrows
125
+ move, Escape closes and returns focus, and choosing an item closes the menu.
126
+ evidence:
127
+ - href: https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
128
+ role: WAI-ARIA APG Menu Button pattern
129
+ checks:
130
+ - href: ./DropdownMenu.stories.tsx#Keyboard
131
+ role: test
132
+ - href: ./DropdownMenu.stories.tsx#ChooseItem
133
+ role: test
134
+ checkedBy: automated
135
+ - id: destructive-contrast
136
+ level: must
137
+ statement: >-
138
+ Destructive items pass 6.52:1 / 6.98:1 on the menu background and 5.46:1 / 4.91:1
139
+ when highlighted (light / dark).
140
+ checks:
141
+ - href: ../../../scripts/tokens.mjs
142
+ role: test
143
+ note: CONTRAST_PAIRS "รายการลบในเมนู" and "รายการลบที่ไฮไลต์"
144
+ checkedBy: automated
145
+
146
+ - kind: guidelines
147
+ for: agent
148
+ items:
149
+ - refs:
150
+ - to: shared-testing#assert-by-state
151
+ rel: same-as
152
+ - refs:
153
+ - to: shared-testing#query-portal-with-screen
154
+ rel: same-as
155
+
156
+ - kind: definitions
157
+ for: all
158
+ context: anatomy
159
+ items:
160
+ - term: DropdownMenu / DropdownMenuTrigger / DropdownMenuContent
161
+ definition: >-
162
+ Root, opening button, floating box (`side` defaults to `bottom`, `align` to
163
+ `start`).
164
+ - term: DropdownMenuGroup + DropdownMenuLabel
165
+ definition: >-
166
+ A group of items with a heading.
167
+ - term: DropdownMenuItem
168
+ definition: >-
169
+ A command. Takes `variant`, `inset`, `disabled`, `onClick`.
170
+ - term: DropdownMenuCheckboxItem
171
+ definition: >-
172
+ Several can be ticked.
173
+ - term: DropdownMenuRadioGroup + DropdownMenuRadioItem
174
+ definition: >-
175
+ Only one can be chosen.
176
+ - term: DropdownMenuSub / SubTrigger / SubContent
177
+ definition: >-
178
+ A submenu.
179
+ - term: DropdownMenuSeparator
180
+ definition: >-
181
+ A divider line.
182
+ - term: DropdownMenuShortcut
183
+ definition: >-
184
+ A shortcut at the end of an item (display only).
185
+
186
+ - kind: definitions
187
+ for: all
188
+ context: keyboard
189
+ items:
190
+ - term: Enter / Space on the trigger
191
+ definition: >-
192
+ Opens and focuses the first item.
193
+ - term: Up / Down arrows
194
+ definition: >-
195
+ Move between items.
196
+ - term: Right / Left arrows
197
+ definition: >-
198
+ Open / close a submenu.
199
+ - term: Escape
200
+ definition: >-
201
+ Closes and returns focus to the trigger.
202
+
203
+ - kind: section
204
+ for: all
205
+ title: Open decisions
206
+ freeform:
207
+ - title: TODO
208
+ body: >-
209
+ No story yet shows opening a confirmation dialog from a `destructive` item.
210
+
211
+ sourceFiles:
212
+ - platform: react
213
+ file: ./DropdownMenu.tsx
214
+
215
+ imports:
216
+ - platform: react
217
+ code: >-
218
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@designil/labdsnov"
219
+ package: "@designil/labdsnov"
220
+
221
+ traits:
222
+ - traitType: variant
223
+ kind: enum
224
+ id: itemVariant
225
+ name: DropdownMenuItem variant
226
+ description: >-
227
+ The `variant` prop of `DropdownMenuItem`.
228
+ values:
229
+ - id: default
230
+ description: >-
231
+ A regular command.
232
+ - id: destructive
233
+ description: >-
234
+ Red text and icon, for actions that delete or can't be undone.
235
+ - traitType: variant
236
+ kind: boolean
237
+ id: inset
238
+ description: >-
239
+ Indents to line up with items that have an icon or check mark. Works on Item,
240
+ Label, SubTrigger, CheckboxItem and RadioItem.
241
+ - traitType: state
242
+ kind: boolean
243
+ id: disabled
244
+ description: >-
245
+ An item that can't be chosen, dimmed to 50%. It still takes focus.
246
+ - traitType: state
247
+ kind: boolean
248
+ id: highlighted
249
+ description: >-
250
+ The item under the pointer or focus, with a `--menu-item-highlight-bg` background.
251
+
252
+ uses:
253
+ - to: button
254
+ alternatives:
255
+ - to: select
256
+ - to: popover
257
+ - to: navigation-menu
258
+
259
+ refs:
260
+ - href: ./DropdownMenu.md
261
+ rel: relates-to
262
+ role: Thai usage doc
263
+ - href: ./DropdownMenu.stories.tsx
264
+ rel: demo
265
+ role: CSF stories
@@ -0,0 +1,151 @@
1
+ # DropdownMenu (เมนูคำสั่ง)
2
+
3
+ ## Purpose
4
+
5
+ รายการคำสั่งที่เปิดจากปุ่ม เช่น แก้ไข ดาวน์โหลด ลบ ของรายการหนึ่ง
6
+
7
+ ## Import and usage
8
+
9
+ **ตั้งค่าครั้งเดียวในแอป** (ใช้ร่วมกันทุกคอมโพเนนต์):
10
+
11
+ 1. ติดตั้ง `@designil/labdsnov` (`pnpm add @designil/labdsnov`) พร้อม `react` และ `react-dom` 19
12
+ 2. import สไตล์ครั้งเดียวที่ root layout: `import "@designil/labdsnov/styles.css"`
13
+ 3. กำหนดตัวแปร `--font-heading` (แอปใช้ IBM Plex Sans Thai) และใส่ class `dark` ที่ `<html>` เมื่อต้องการโหมดมืด
14
+
15
+ ```tsx
16
+ import {
17
+ Button,
18
+ DropdownMenu,
19
+ DropdownMenuContent,
20
+ DropdownMenuItem,
21
+ DropdownMenuSeparator,
22
+ DropdownMenuTrigger,
23
+ } from "@designil/labdsnov"
24
+
25
+ ;<DropdownMenu>
26
+ <DropdownMenuTrigger
27
+ render={<Button size="icon" variant="ghost" aria-label="ตัวเลือกเพิ่มเติม" />}
28
+ >
29
+ <HugeiconsIcon icon={MoreHorizontalIcon} strokeWidth={2} />
30
+ </DropdownMenuTrigger>
31
+ <DropdownMenuContent>
32
+ <DropdownMenuItem onClick={onEdit}>แก้ไข</DropdownMenuItem>
33
+ <DropdownMenuSeparator />
34
+ <DropdownMenuItem variant="destructive" onClick={onDelete}>
35
+ ลบ
36
+ </DropdownMenuItem>
37
+ </DropdownMenuContent>
38
+ </DropdownMenu>
39
+ ```
40
+
41
+ - ปุ่มไอคอนอย่างเดียวที่เปิดเมนูต้องมี `aria-label`
42
+
43
+ ## When to use
44
+
45
+ - คำสั่งหลายอย่างของรายการเดียว ที่ไม่อยากแสดงเป็นปุ่มทั้งหมด เช่น เมนู "…" ในแถวตารางหรือการ์ด
46
+ - ตัวเลือกการแสดงผลเล็ก ๆ เช่น เลือกคอลัมน์ (checkbox item) หรือการเรียงลำดับ (radio item)
47
+
48
+ ## When not to use
49
+
50
+ | สถานการณ์ | ใช้แทน |
51
+ | ----------------- | ------------------------ |
52
+ | เลือกค่าในฟอร์ม | `Select` |
53
+ | การกระทำหลักของหน้า | `Button` ที่มองเห็นตลอด |
54
+ | นำทางไปหน้าอื่น | ลิงก์ หรือ `NavigationMenu` |
55
+ | เนื้อหาหรือช่องกรอก | `Popover` |
56
+
57
+ ## Anatomy
58
+
59
+ - **DropdownMenu** → **DropdownMenuTrigger** + **DropdownMenuContent**
60
+ - **DropdownMenuGroup** → **DropdownMenuLabel** + **DropdownMenuItem**
61
+ - **DropdownMenuCheckboxItem**: ติ๊กได้หลายข้อ
62
+ - **DropdownMenuRadioGroup** → **DropdownMenuRadioItem**: เลือกได้ข้อเดียว
63
+ - **DropdownMenuSub** → **DropdownMenuSubTrigger** + **DropdownMenuSubContent**: เมนูย่อย
64
+ - **DropdownMenuSeparator**: เส้นคั่น
65
+ - **DropdownMenuShortcut**: แสดงปุ่มลัดท้ายรายการ (แค่แสดง ไม่ได้ผูกคีย์ให้)
66
+
67
+ ## Props and variants
68
+
69
+ ### DropdownMenuItem
70
+
71
+ | Prop | ค่า | ค่าเริ่มต้น | ความหมาย |
72
+ | ---------- | ------------------------ | --------- | ------------------------------------------------------- |
73
+ | `variant` | `default`, `destructive` | `default` | `destructive` = ตัวอักษรและไอคอนสีแดง สำหรับลบหรือย้อนกลับไม่ได้ |
74
+ | `inset` | `boolean` | `false` | เยื้องซ้าย ให้ตรงกับรายการที่มีไอคอน |
75
+ | `disabled` | `boolean` | `false` | จางลง 50% เลือกไม่ได้ |
76
+ | `onClick` | ฟังก์ชัน | – | สิ่งที่ทำเมื่อเลือก |
77
+
78
+ `inset` ใช้กับ `DropdownMenuLabel`, `DropdownMenuSubTrigger`, `DropdownMenuCheckboxItem` และ `DropdownMenuRadioItem` ได้ด้วย
79
+
80
+ ### DropdownMenuContent
81
+
82
+ | Prop | ค่า | ค่าเริ่มต้น | ความหมาย |
83
+ | ----------- | -------------------------------- | -------- | ---------------------------------- |
84
+ | `side` | `top`, `right`, `bottom`, `left` | `bottom` | ด้านที่เปิดออกจาก trigger |
85
+ | `align` | `start`, `center`, `end` | `start` | การจัดแนวตาม trigger |
86
+ | `className` | class | – | กว้างอย่างน้อย 192px หรือเท่ากับ trigger |
87
+
88
+ ### พฤติกรรมที่มีให้แล้ว
89
+
90
+ - เลือกรายการแล้วเมนูปิดเอง เปิดด้วยคีย์บอร์ดแล้วโฟกัสอยู่ที่รายการแรก ลูกศรขึ้น/ลงเลื่อนระหว่างรายการ (รายการที่ปิดใช้งานรับโฟกัสได้แต่เลือกไม่ได้) Escape ปิดเมนู
91
+ - การยืนยันการลบ: เปิด `Dialog` จากรายการ `destructive` อีกขั้นหนึ่ง TODO: ยังไม่มีตัวอย่างใน stories
92
+
93
+ ## Tokens used
94
+
95
+ ค่าทั้งหมดมาจาก `src/styles/theme.css`
96
+
97
+ ### Component tokens
98
+
99
+ token เฉพาะของคอมโพเนนต์นี้ ชี้ไปที่ semantic token ด้านล่าง เปลี่ยนที่นี่เพื่อปรับเฉพาะคอมโพเนนต์นี้ (โหมดมืด "–" = ใช้ค่าเดียวกับโหมดสว่าง)
100
+
101
+ | Token | โหมดสว่าง | โหมดมืด | ใช้ใน |
102
+ | --------------------------------- | --------------------- | ------------------- | ------------------ |
103
+ | `--menu-label-fg` | `--muted-foreground` | – | หัวข้อกลุ่ม, ปุ่มลัด |
104
+ | `--menu-item-highlight-bg` | `--accent` | – | พื้นรายการที่ไฮไลต์ |
105
+ | `--menu-item-highlight-fg` | `--accent-foreground` | – | ตัวอักษรรายการที่ไฮไลต์ |
106
+ | `--menu-destructive-fg` | `--destructive` | – | ตัวอักษรรายการลบ |
107
+ | `--menu-destructive-highlight-bg` | `--destructive` 10% | `--destructive` 20% | พื้นรายการลบที่ไฮไลต์ |
108
+
109
+ ### Semantic tokens
110
+
111
+ | Token | โหมดสว่าง | โหมดมืด | ใช้ใน |
112
+ | ---------------------- | -------------------------- | -------------------------- | ------------------------------------------------- |
113
+ | `--popover` | `oklch(1 0 0)` | `oklch(0.228 0.013 107.4)` | พื้นเมนู |
114
+ | `--popover-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษร |
115
+ | `--accent` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | พื้นรายการที่โฟกัส |
116
+ | `--accent-foreground` | `oklch(0.228 0.013 107.4)` | `oklch(0.988 0.003 106.5)` | ตัวอักษรรายการที่โฟกัส |
117
+ | `--muted-foreground` | `oklch(0.5 0.027 107.3)` | `oklch(0.737 0.021 106.9)` | หัวข้อกลุ่ม, ปุ่มลัด |
118
+ | `--destructive` | `oklch(0.505 0.2 27.325)` | `oklch(0.75 0.16 22.216)` | รายการ `destructive` (พื้นตอนโฟกัส 10% สว่าง, 20% มืด) |
119
+ | `--border` | `oklch(0.93 0.007 106.5)` | `oklch(1 0 0 / 10%)` | เส้นคั่น (50%) |
120
+ | `--foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | เส้นขอบบาง ๆ รอบเมนู (5% สว่าง, 10% มืด) |
121
+
122
+ ## Example
123
+
124
+ จาก story `Playground` ใน `DropdownMenu.stories.tsx`:
125
+
126
+ ```tsx
127
+ <DropdownMenu>
128
+ <DropdownMenuTrigger
129
+ render={
130
+ <Button size="icon" variant="outline" aria-label="ตัวเลือกผู้รับผลประโยชน์" />
131
+ }
132
+ >
133
+ <HugeiconsIcon icon={MoreHorizontalIcon} strokeWidth={2} />
134
+ </DropdownMenuTrigger>
135
+ <DropdownMenuContent>
136
+ <DropdownMenuGroup>
137
+ <DropdownMenuLabel>ผู้รับผลประโยชน์</DropdownMenuLabel>
138
+ <DropdownMenuItem>
139
+ <HugeiconsIcon icon={PencilEdit02Icon} strokeWidth={2} />
140
+ แก้ไข
141
+ </DropdownMenuItem>
142
+ <DropdownMenuItem disabled>ส่งต่อให้ที่ปรึกษา</DropdownMenuItem>
143
+ </DropdownMenuGroup>
144
+ <DropdownMenuSeparator />
145
+ <DropdownMenuItem variant="destructive">
146
+ <HugeiconsIcon icon={Delete02Icon} strokeWidth={2} />
147
+ ลบ
148
+ </DropdownMenuItem>
149
+ </DropdownMenuContent>
150
+ </DropdownMenu>
151
+ ```
@@ -0,0 +1,171 @@
1
+ kind: component
2
+ id: empty
3
+ name: Empty
4
+ description: >-
5
+ A message shown in place of a list or page that has no data yet, saying why and what
6
+ to do next. Content is centred with 48px padding.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [feedback]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use for a list that's still empty, e.g. no beneficiaries or no documents yet.
20
+ - level: should
21
+ statement: >-
22
+ Use for a search or filter with no results ("ไม่พบธุรกรรม", no transactions found).
23
+ - level: must-not
24
+ statement: >-
25
+ Don't show it while loading. Use <dsds:skeleton>, and show "ยังไม่มี…"
26
+ (nothing yet) only once loading has finished and the list really is empty.
27
+ alternatives:
28
+ - to: skeleton
29
+ checkedBy: manual
30
+ - level: must-not
31
+ statement: >-
32
+ Don't use it when loading failed. Use a `destructive` <dsds:alert>, because the
33
+ data may exist.
34
+ alternatives:
35
+ - to: alert
36
+ checkedBy: manual
37
+ - level: should-not
38
+ statement: >-
39
+ Don't use it inside a Select or Combobox list. Use `ComboboxEmpty`
40
+ (<dsds:combobox>).
41
+ alternatives:
42
+ - to: combobox
43
+
44
+ - kind: guidelines
45
+ for: all
46
+ items:
47
+ - id: title-states-what
48
+ level: must
49
+ statement: >-
50
+ `EmptyTitle` says what is empty ("ยังไม่มีเอกสาร", no documents yet;
51
+ "ไม่พบธุรกรรม", no transactions found), not "ไม่มีข้อมูล" (no data).
52
+ checkedBy: manual
53
+ - id: description-next-step
54
+ level: should
55
+ statement: >-
56
+ `EmptyDescription` gives the reason or the next step. An empty filter result tells
57
+ the user to change the filter ("ลองเปลี่ยนช่วงวันที่", try another date range).
58
+ checkedBy: manual
59
+ - id: one-action
60
+ level: should
61
+ statement: >-
62
+ A list that's empty because the user hasn't added anything yet has one primary
63
+ button in `EmptyContent`, worded like the title ("เพิ่มผู้รับผลประโยชน์", add
64
+ beneficiary). An empty search result needs no button.
65
+ uses:
66
+ - to: button
67
+ checkedBy: manual
68
+ - id: media-icon
69
+ level: should
70
+ statement: >-
71
+ Prefer `EmptyMedia variant="icon"` (icon in a 40px grey square). Use `default` for
72
+ a full-size illustration.
73
+ example:
74
+ ref:
75
+ href: ./Empty.stories.tsx#MediaVariants
76
+ rel: demo
77
+ checkedBy: manual
78
+ - id: border-standalone
79
+ level: may
80
+ statement: >-
81
+ Add `className="border"` (dashed outline) when Empty stands in for a whole list
82
+ area. Leave it off inside a card that already has a border.
83
+
84
+ - kind: guidelines
85
+ for: all
86
+ title: Accessibility
87
+ tags: [accessibility]
88
+ items:
89
+ - id: announce-after-filter
90
+ level: should
91
+ statement: >-
92
+ An empty filter result that appears without a page load is wrapped in
93
+ `role="status"`, so screen readers hear that nothing was found.
94
+ evidence:
95
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html
96
+ role: WCAG 2.2 SC 4.1.3 (AA)
97
+ checkedBy: manual
98
+ - id: title-not-heading
99
+ level: should
100
+ statement: >-
101
+ `EmptyTitle` is a `<div>`, not a page heading. The section's `h2` belongs outside
102
+ Empty (see Open decisions).
103
+ checkedBy: manual
104
+
105
+ - kind: definitions
106
+ for: all
107
+ context: anatomy
108
+ items:
109
+ - term: Empty
110
+ definition: >-
111
+ The container. No border unless you add `border`.
112
+ - term: EmptyHeader
113
+ definition: >-
114
+ Media + Title + Description.
115
+ - term: EmptyMedia
116
+ definition: >-
117
+ Icon or image. Takes `variant`.
118
+ - term: EmptyTitle
119
+ definition: >-
120
+ Heading, 18px medium.
121
+ - term: EmptyDescription
122
+ definition: >-
123
+ Reason or next step. Links in the text are underlined.
124
+ - term: EmptyContent
125
+ definition: >-
126
+ Buttons or the next action.
127
+
128
+ - kind: section
129
+ for: all
130
+ title: Open decisions
131
+ freeform:
132
+ - title: TODO
133
+ body: >-
134
+ The title is a `<div>`; its heading level can't be chosen yet.
135
+
136
+ sourceFiles:
137
+ - platform: react
138
+ file: ./Empty.tsx
139
+
140
+ imports:
141
+ - platform: react
142
+ code: >-
143
+ import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@designil/labdsnov"
144
+ package: "@designil/labdsnov"
145
+
146
+ traits:
147
+ - traitType: variant
148
+ kind: enum
149
+ id: mediaVariant
150
+ name: EmptyMedia variant
151
+ description: >-
152
+ The `variant` prop of `EmptyMedia`.
153
+ values:
154
+ - id: default
155
+ description: >-
156
+ The icon or image at its own size.
157
+ - id: icon
158
+ description: >-
159
+ The icon in a 40px grey square.
160
+
161
+ alternatives:
162
+ - to: skeleton
163
+ - to: alert
164
+
165
+ refs:
166
+ - href: ./Empty.md
167
+ rel: relates-to
168
+ role: Thai usage doc
169
+ - href: ./Empty.stories.tsx
170
+ rel: demo
171
+ role: CSF stories
@@ -0,0 +1,90 @@
1
+ # Empty (สถานะว่าง)
2
+
3
+ ## Purpose
4
+
5
+ ข้อความแทนรายการหรือหน้าที่ยังไม่มีข้อมูล บอกเหตุผลและสิ่งที่ทำต่อได้
6
+
7
+ ## Import and usage
8
+
9
+ **ตั้งค่าครั้งเดียวในแอป** (ใช้ร่วมกันทุกคอมโพเนนต์):
10
+
11
+ 1. ติดตั้ง `@designil/labdsnov` (`pnpm add @designil/labdsnov`) พร้อม `react` และ `react-dom` 19
12
+ 2. import สไตล์ครั้งเดียวที่ root layout: `import "@designil/labdsnov/styles.css"`
13
+ 3. กำหนดตัวแปร `--font-heading` (แอปใช้ IBM Plex Sans Thai) และใส่ class `dark` ที่ `<html>` เมื่อต้องการโหมดมืด
14
+
15
+ ```tsx
16
+ import {
17
+ Button,
18
+ Empty,
19
+ EmptyContent,
20
+ EmptyDescription,
21
+ EmptyHeader,
22
+ EmptyMedia,
23
+ EmptyTitle,
24
+ } from "@designil/labdsnov"
25
+
26
+ ;<Empty className="border">
27
+ <EmptyHeader>
28
+ <EmptyMedia variant="icon">
29
+ <HugeiconsIcon icon={UserAdd01Icon} strokeWidth={2} />
30
+ </EmptyMedia>
31
+ <EmptyTitle>ยังไม่มีผู้รับผลประโยชน์</EmptyTitle>
32
+ <EmptyDescription>ระบุผู้รับผลประโยชน์เพื่อให้เงินไปถึงคนที่คุณต้องการ</EmptyDescription>
33
+ </EmptyHeader>
34
+ <EmptyContent>
35
+ <Button>เพิ่มผู้รับผลประโยชน์</Button>
36
+ </EmptyContent>
37
+ </Empty>
38
+ ```
39
+
40
+ - ใส่ `className="border"` เพื่อให้มีกรอบเส้นประ (ไม่ใส่ = ไม่มีกรอบ)
41
+
42
+ ## When to use
43
+
44
+ - รายการที่ยังว่าง เช่น ยังไม่มีผู้รับผลประโยชน์ ยังไม่มีเอกสาร
45
+ - ผลการค้นหาหรือกรองที่ไม่พบข้อมูล ("ไม่พบธุรกรรม")
46
+
47
+ ## When not to use
48
+
49
+ - **กำลังโหลด**: ใช้ `Skeleton` (อย่าแสดง "ไม่มีข้อมูล" ก่อนโหลดเสร็จ)
50
+ - **ข้อผิดพลาด** (โหลดไม่สำเร็จ): ใช้ `Alert` แบบ `destructive`
51
+ - **รายการว่างใน `Select` หรือ `Combobox`**: ใช้ `ComboboxEmpty`
52
+
53
+ ## Props and variants
54
+
55
+ ไม่มี variant หรือ size ของทั้งกล่อง เนื้อหาอยู่กึ่งกลาง ระยะขอบใน 48px
56
+
57
+ | ส่วน / Prop | ความหมาย |
58
+ | ---------------------- | -------------------------------------------------------------- |
59
+ | `EmptyMedia` `variant` | `default`: ไอคอนหรือภาพตามขนาดจริง `icon`: ไอคอนในสี่เหลี่ยมเทา 40px |
60
+ | `EmptyTitle` | หัวข้อ (18px, medium) บอกว่าว่างอะไร |
61
+ | `EmptyDescription` | บอกเหตุผลหรือสิ่งที่ทำได้ต่อ ลิงก์ในข้อความขีดเส้นใต้ |
62
+ | `EmptyContent` | ปุ่มหรือการกระทำต่อไป |
63
+
64
+ - เขียนหัวข้อให้บอกสถานะ ("ยังไม่มีเอกสาร") ไม่ใช่ "ไม่มีข้อมูล"
65
+ - TODO: หัวข้อเป็น `<div>` ไม่ใช่หัวข้อของหน้า ยังเลือกระดับหัวข้อไม่ได้
66
+
67
+ ## Tokens used
68
+
69
+ ค่าทั้งหมดมาจาก `src/styles/theme.css`
70
+
71
+ | Token | โหมดสว่าง | โหมดมืด | ใช้ใน |
72
+ | -------------------- | -------------------------------- | -------------------------- | --------------------------- |
73
+ | `--muted` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | พื้นไอคอน (`icon`) |
74
+ | `--foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ไอคอน (`icon`) |
75
+ | `--muted-foreground` | `oklch(0.5 0.027 107.3)` | `oklch(0.737 0.021 106.9)` | คำอธิบาย |
76
+ | `--border` | `oklch(0.93 0.007 106.5)` | `oklch(1 0 0 / 10%)` | กรอบเส้นประ (เมื่อใส่ `border`) |
77
+ | `--font-heading` | กำหนดโดยแอป (IBM Plex Sans Thai) | – | หัวข้อ |
78
+
79
+ ## Example
80
+
81
+ จาก story `NoBorder` ใน `Empty.stories.tsx`:
82
+
83
+ ```tsx
84
+ <Empty className="w-96">
85
+ <EmptyHeader>
86
+ <EmptyTitle>ไม่พบธุรกรรม</EmptyTitle>
87
+ <EmptyDescription>ลองเปลี่ยนช่วงวันที่</EmptyDescription>
88
+ </EmptyHeader>
89
+ </Empty>
90
+ ```