@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.
- package/LICENSE +21 -0
- package/README.md +150 -2
- package/dist/components/Accordion/Accordion.d.ts +8 -0
- package/dist/components/Accordion/Accordion.js +82 -0
- package/dist/components/Accordion/Accordion.module.css.js +23 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +17 -0
- package/dist/components/Alert/Alert.js +58 -0
- package/dist/components/Alert/Alert.module.css.js +17 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +29 -0
- package/dist/components/AlertDialog/AlertDialog.js +150 -0
- package/dist/components/AlertDialog/AlertDialog.module.css.js +23 -0
- package/dist/components/AlertDialog/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +23 -0
- package/dist/components/Avatar/Avatar.js +84 -0
- package/dist/components/Avatar/Avatar.module.css.js +23 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Badge/Badge.d.ts +17 -0
- package/dist/components/Badge/Badge.js +37 -0
- package/dist/components/Badge/Badge.module.css.js +19 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +15 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +111 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +19 -0
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +39 -0
- package/dist/components/Button/Button.js +62 -0
- package/dist/components/Button/Button.module.css.js +37 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +21 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +59 -0
- package/dist/components/ButtonGroup/ButtonGroup.module.css.js +15 -0
- package/dist/components/ButtonGroup/index.d.ts +1 -0
- package/dist/components/Calendar/Calendar.d.ts +17 -0
- package/dist/components/Calendar/Calendar.js +154 -0
- package/dist/components/Calendar/Calendar.module.css.js +67 -0
- package/dist/components/Calendar/index.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +20 -0
- package/dist/components/Card/Card.js +87 -0
- package/dist/components/Card/Card.module.css.js +23 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Chart/Chart.d.ts +59 -0
- package/dist/components/Chart/Chart.js +199 -0
- package/dist/components/Chart/Chart.module.css.js +47 -0
- package/dist/components/Chart/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.js +44 -0
- package/dist/components/Checkbox/Checkbox.module.css.js +13 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Collapsible/Collapsible.d.ts +8 -0
- package/dist/components/Collapsible/Collapsible.js +28 -0
- package/dist/components/Collapsible/Collapsible.module.css.js +7 -0
- package/dist/components/Collapsible/index.d.ts +1 -0
- package/dist/components/Combobox/Combobox.d.ts +36 -0
- package/dist/components/Combobox/Combobox.js +296 -0
- package/dist/components/Combobox/Combobox.module.css.js +39 -0
- package/dist/components/Combobox/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +28 -0
- package/dist/components/DatePicker/DatePicker.js +73 -0
- package/dist/components/DatePicker/DatePicker.module.css.js +9 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +27 -0
- package/dist/components/Dialog/Dialog.js +144 -0
- package/dist/components/Dialog/Dialog.module.css.js +29 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +22 -0
- package/dist/components/Drawer/Drawer.js +166 -0
- package/dist/components/Drawer/Drawer.module.css.js +23 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +32 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +245 -0
- package/dist/components/DropdownMenu/DropdownMenu.module.css.js +33 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/Empty/Empty.d.ts +18 -0
- package/dist/components/Empty/Empty.js +76 -0
- package/dist/components/Empty/Empty.module.css.js +21 -0
- package/dist/components/Empty/index.d.ts +1 -0
- package/dist/components/Field/Field.d.ts +53 -0
- package/dist/components/Field/Field.js +172 -0
- package/dist/components/Field/Field.module.css.js +41 -0
- package/dist/components/Field/index.d.ts +1 -0
- package/dist/components/FundCard/FundCard.d.ts +18 -0
- package/dist/components/FundCard/FundCard.js +66 -0
- package/dist/components/FundCard/FundCard.module.css.js +25 -0
- package/dist/components/FundCard/index.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.d.ts +8 -0
- package/dist/components/HoverCard/HoverCard.js +42 -0
- package/dist/components/HoverCard/HoverCard.module.css.js +9 -0
- package/dist/components/HoverCard/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +12 -0
- package/dist/components/Input/Input.js +23 -0
- package/dist/components/Input/Input.module.css.js +11 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/InputGroup/InputGroup.d.ts +39 -0
- package/dist/components/InputGroup/InputGroup.js +103 -0
- package/dist/components/InputGroup/InputGroup.module.css.js +31 -0
- package/dist/components/InputGroup/index.d.ts +1 -0
- package/dist/components/InputOTP/InputOTP.d.ts +18 -0
- package/dist/components/InputOTP/InputOTP.js +72 -0
- package/dist/components/InputOTP/InputOTP.module.css.js +19 -0
- package/dist/components/InputOTP/index.d.ts +1 -0
- package/dist/components/Kbd/Kbd.d.ts +5 -0
- package/dist/components/Kbd/Kbd.js +20 -0
- package/dist/components/Kbd/Kbd.module.css.js +9 -0
- package/dist/components/Kbd/index.d.ts +1 -0
- package/dist/components/Label/Label.d.ts +7 -0
- package/dist/components/Label/Label.js +17 -0
- package/dist/components/Label/Label.module.css.js +9 -0
- package/dist/components/Label/index.d.ts +1 -0
- package/dist/components/NavigationMenu/NavigationMenu.d.ts +20 -0
- package/dist/components/NavigationMenu/NavigationMenu.js +153 -0
- package/dist/components/NavigationMenu/NavigationMenu.module.css.js +29 -0
- package/dist/components/NavigationMenu/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +29 -0
- package/dist/components/Pagination/Pagination.js +133 -0
- package/dist/components/Pagination/Pagination.module.css.js +19 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +10 -0
- package/dist/components/Popover/Popover.js +78 -0
- package/dist/components/Popover/Popover.module.css.js +15 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Progress/Progress.d.ts +12 -0
- package/dist/components/Progress/Progress.js +74 -0
- package/dist/components/Progress/Progress.module.css.js +15 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.js +37 -0
- package/dist/components/RadioGroup/RadioGroup.module.css.js +13 -0
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +9 -0
- package/dist/components/ScrollArea/ScrollArea.js +60 -0
- package/dist/components/ScrollArea/ScrollArea.module.css.js +17 -0
- package/dist/components/ScrollArea/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +23 -0
- package/dist/components/Select/Select.js +188 -0
- package/dist/components/Select/Select.module.css.js +37 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Separator/Separator.d.ts +4 -0
- package/dist/components/Separator/Separator.js +22 -0
- package/dist/components/Separator/Separator.module.css.js +7 -0
- package/dist/components/Separator/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +4 -0
- package/dist/components/Skeleton/Skeleton.js +16 -0
- package/dist/components/Skeleton/Skeleton.module.css.js +7 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +13 -0
- package/dist/components/Slider/Slider.js +61 -0
- package/dist/components/Slider/Slider.module.css.js +15 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.js +22 -0
- package/dist/components/Spinner/Spinner.module.css.js +7 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Switch/Switch.d.ts +13 -0
- package/dist/components/Switch/Switch.js +29 -0
- package/dist/components/Switch/Switch.module.css.js +13 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +12 -0
- package/dist/components/Table/Table.js +96 -0
- package/dist/components/Table/Table.module.css.js +23 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +16 -0
- package/dist/components/Tabs/Tabs.js +55 -0
- package/dist/components/Tabs/Tabs.module.css.js +17 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +4 -0
- package/dist/components/Textarea/Textarea.js +16 -0
- package/dist/components/Textarea/Textarea.module.css.js +7 -0
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Toaster/Toaster.d.ts +8 -0
- package/dist/components/Toaster/Toaster.js +85 -0
- package/dist/components/Toaster/Toaster.module.css.js +11 -0
- package/dist/components/Toaster/index.d.ts +1 -0
- package/dist/components/Toggle/Toggle.d.ts +26 -0
- package/dist/components/Toggle/Toggle.js +35 -0
- package/dist/components/Toggle/Toggle.module.css.js +17 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +20 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +64 -0
- package/dist/components/ToggleGroup/ToggleGroup.module.css.js +11 -0
- package/dist/components/ToggleGroup/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.js +61 -0
- package/dist/components/Tooltip/Tooltip.module.css.js +11 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +265 -0
- package/dist/styles.css +1 -0
- package/docs/Accessibility.md +129 -0
- package/docs/Colors.md +149 -0
- package/docs/ComponentTokens.md +191 -0
- package/docs/Contributing.md +104 -0
- package/docs/GettingStarted.md +106 -0
- package/docs/Radius.md +25 -0
- package/docs/Typography.md +38 -0
- package/package.json +88 -4
- package/src/components/Accordion/Accordion.dsds.yaml +195 -0
- package/src/components/Accordion/Accordion.md +102 -0
- package/src/components/Alert/Alert.dsds.yaml +206 -0
- package/src/components/Alert/Alert.md +90 -0
- package/src/components/AlertDialog/AlertDialog.dsds.yaml +243 -0
- package/src/components/AlertDialog/AlertDialog.md +131 -0
- package/src/components/Avatar/Avatar.dsds.yaml +172 -0
- package/src/components/Avatar/Avatar.md +77 -0
- package/src/components/Badge/Badge.dsds.yaml +191 -0
- package/src/components/Badge/Badge.md +124 -0
- package/src/components/Breadcrumb/Breadcrumb.dsds.yaml +162 -0
- package/src/components/Breadcrumb/Breadcrumb.md +110 -0
- package/src/components/Button/Button.dsds.yaml +350 -0
- package/src/components/Button/Button.md +165 -0
- package/src/components/ButtonGroup/ButtonGroup.dsds.yaml +193 -0
- package/src/components/ButtonGroup/ButtonGroup.md +96 -0
- package/src/components/Calendar/Calendar.dsds.yaml +236 -0
- package/src/components/Calendar/Calendar.md +111 -0
- package/src/components/Card/Card.dsds.yaml +199 -0
- package/src/components/Card/Card.md +99 -0
- package/src/components/Chart/Chart.dsds.yaml +216 -0
- package/src/components/Chart/Chart.md +112 -0
- package/src/components/Checkbox/Checkbox.dsds.yaml +215 -0
- package/src/components/Checkbox/Checkbox.md +105 -0
- package/src/components/Collapsible/Collapsible.dsds.yaml +146 -0
- package/src/components/Collapsible/Collapsible.md +86 -0
- package/src/components/Combobox/Combobox.dsds.yaml +241 -0
- package/src/components/Combobox/Combobox.md +143 -0
- package/src/components/DatePicker/DatePicker.dsds.yaml +179 -0
- package/src/components/DatePicker/DatePicker.md +82 -0
- package/src/components/Dialog/Dialog.dsds.yaml +300 -0
- package/src/components/Dialog/Dialog.md +193 -0
- package/src/components/Drawer/Drawer.dsds.yaml +207 -0
- package/src/components/Drawer/Drawer.md +125 -0
- package/src/components/DropdownMenu/DropdownMenu.dsds.yaml +265 -0
- package/src/components/DropdownMenu/DropdownMenu.md +151 -0
- package/src/components/Empty/Empty.dsds.yaml +171 -0
- package/src/components/Empty/Empty.md +90 -0
- package/src/components/Field/Field.dsds.yaml +285 -0
- package/src/components/Field/Field.md +139 -0
- package/src/components/FundCard/FundCard.dsds.yaml +195 -0
- package/src/components/FundCard/FundCard.md +93 -0
- package/src/components/HoverCard/HoverCard.dsds.yaml +157 -0
- package/src/components/HoverCard/HoverCard.md +100 -0
- package/src/components/Input/Input.dsds.yaml +235 -0
- package/src/components/Input/Input.md +115 -0
- package/src/components/InputGroup/InputGroup.dsds.yaml +234 -0
- package/src/components/InputGroup/InputGroup.md +115 -0
- package/src/components/InputOTP/InputOTP.dsds.yaml +184 -0
- package/src/components/InputOTP/InputOTP.md +105 -0
- package/src/components/Kbd/Kbd.dsds.yaml +119 -0
- package/src/components/Kbd/Kbd.md +85 -0
- package/src/components/Label/Label.dsds.yaml +141 -0
- package/src/components/Label/Label.md +75 -0
- package/src/components/NavigationMenu/NavigationMenu.dsds.yaml +196 -0
- package/src/components/NavigationMenu/NavigationMenu.md +128 -0
- package/src/components/Pagination/Pagination.dsds.yaml +172 -0
- package/src/components/Pagination/Pagination.md +115 -0
- package/src/components/Popover/Popover.dsds.yaml +168 -0
- package/src/components/Popover/Popover.md +111 -0
- package/src/components/Progress/Progress.dsds.yaml +169 -0
- package/src/components/Progress/Progress.md +83 -0
- package/src/components/RadioGroup/RadioGroup.dsds.yaml +215 -0
- package/src/components/RadioGroup/RadioGroup.md +123 -0
- package/src/components/ScrollArea/ScrollArea.dsds.yaml +153 -0
- package/src/components/ScrollArea/ScrollArea.md +88 -0
- package/src/components/Select/Select.dsds.yaml +239 -0
- package/src/components/Select/Select.md +170 -0
- package/src/components/Separator/Separator.dsds.yaml +121 -0
- package/src/components/Separator/Separator.md +68 -0
- package/src/components/Skeleton/Skeleton.dsds.yaml +124 -0
- package/src/components/Skeleton/Skeleton.md +68 -0
- package/src/components/Slider/Slider.dsds.yaml +194 -0
- package/src/components/Slider/Slider.md +107 -0
- package/src/components/Spinner/Spinner.dsds.yaml +126 -0
- package/src/components/Spinner/Spinner.md +64 -0
- package/src/components/Switch/Switch.dsds.yaml +198 -0
- package/src/components/Switch/Switch.md +101 -0
- package/src/components/Table/Table.dsds.yaml +195 -0
- package/src/components/Table/Table.md +117 -0
- package/src/components/Tabs/Tabs.dsds.yaml +239 -0
- package/src/components/Tabs/Tabs.md +173 -0
- package/src/components/Textarea/Textarea.dsds.yaml +167 -0
- package/src/components/Textarea/Textarea.md +89 -0
- package/src/components/Toaster/Toaster.dsds.yaml +226 -0
- package/src/components/Toaster/Toaster.md +107 -0
- package/src/components/Toggle/Toggle.dsds.yaml +224 -0
- package/src/components/Toggle/Toggle.md +103 -0
- package/src/components/ToggleGroup/ToggleGroup.dsds.yaml +230 -0
- package/src/components/ToggleGroup/ToggleGroup.md +95 -0
- package/src/components/Tooltip/Tooltip.dsds.yaml +202 -0
- package/src/components/Tooltip/Tooltip.md +104 -0
- package/src/index.dsds.yaml +467 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# FundCard (การ์ดตัวเลือกการลงทุน)
|
|
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 { FundCard } from "@designil/labdsnov"
|
|
17
|
+
|
|
18
|
+
;<FundCard
|
|
19
|
+
name="สมดุล (Balanced)"
|
|
20
|
+
manager="เซาเทิร์นครอส อินเวสเตอร์ส"
|
|
21
|
+
unitPrice={1.8342}
|
|
22
|
+
priceDate={new Date(2026, 10, 13)}
|
|
23
|
+
image={{ src: "/funds/balanced.svg", alt: "ภาพประกอบแผนภูมิวงกลม" }}
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`priceDate` ต้องเป็น `Date` (ไม่ใช่ข้อความ) และ `image.src` เป็น URL ของภาพที่เบราว์เซอร์โหลดได้ เช่น ไฟล์ในโฟลเดอร์ `public` ของแอป (แสดงด้วย `<img>` ธรรมดาแบบ lazy load ไม่ผ่าน `next/image`)
|
|
28
|
+
|
|
29
|
+
## When to use
|
|
30
|
+
|
|
31
|
+
- หน้ารวมตัวเลือกการลงทุน แสดงเป็นตาราง 2 คอลัมน์บนมือถือ และ 4 คอลัมน์บนจอ 640px ขึ้นไป (story `FundOptions`)
|
|
32
|
+
- แสดงตัวเลือกการลงทุนรายการเดียว เช่น แผนปัจจุบันของสมาชิก TODO: ยังไม่มีตัวอย่างการใช้งานนี้ในแอป
|
|
33
|
+
|
|
34
|
+
## When not to use
|
|
35
|
+
|
|
36
|
+
- **เปรียบเทียบตัวเลขหลายกองทุน** เช่น ผลตอบแทนย้อนหลัง ค่าธรรมเนียม: การ์ดไม่มีช่องสำหรับข้อมูลเหล่านี้ ใช้ `Table` (ดู [Table](../Table/Table.md))
|
|
37
|
+
- **เป็นปุ่มหรือลิงก์ให้กดเลือก**: การ์ดกดไม่ได้และไม่มีสถานะ hover/เลือก TODO: ยังไม่ได้ตัดสินใจว่าจะทำให้การ์ดกดเลือกได้หรือไม่
|
|
38
|
+
- **สินทรัพย์ที่ไม่ได้ซื้อขายเป็นหน่วยหรือไม่ใช่สกุลเงิน AUD**: ราคาแสดงเป็น AUD ต่อหน่วยเสมอ
|
|
39
|
+
|
|
40
|
+
## Props and variants
|
|
41
|
+
|
|
42
|
+
ไม่มี variant หรือ size การ์ดกว้างเต็มพื้นที่ที่วาง
|
|
43
|
+
|
|
44
|
+
| Prop | ค่า | บังคับ | ความหมาย |
|
|
45
|
+
| ----------- | -------------- | ---- | ----------------------------------------------------------------------- |
|
|
46
|
+
| `name` | ข้อความ | ใช่ | ชื่อตัวเลือกการลงทุน เช่น "สมดุล (Balanced)" ชื่อยาวจะขึ้นบรรทัดใหม่ |
|
|
47
|
+
| `manager` | ข้อความ | ใช่ | ผู้จัดการกองทุน แสดงเหนือชื่อ ยาวเกินหนึ่งบรรทัดจะถูกตัดด้วย "…" |
|
|
48
|
+
| `unitPrice` | ตัวเลข | ใช่ | ราคาต่อหน่วยเป็น AUD แสดงทศนิยม 4 ตำแหน่ง เช่น "AU$1.8342" |
|
|
49
|
+
| `priceDate` | วันที่ | ไม่ | วันที่ของราคา แสดงเป็น "ต่อหน่วย · ณ วันที่ 13 พ.ย. 2569" ถ้าไม่ใส่ จะเหลือ "ต่อหน่วย" |
|
|
50
|
+
| `image` | `{ src, alt }` | ไม่ | ภาพสี่เหลี่ยมจัตุรัสด้านบน ถ้าไม่ใส่ จะแสดงไอคอนแผนภูมิวงกลมแทน |
|
|
51
|
+
| `className` | class | ไม่ | ปรับหน้าตาเฉพาะจุดครั้งเดียว ชนะสไตล์ของการ์ดเสมอ |
|
|
52
|
+
|
|
53
|
+
- `alt` ของภาพเป็นภาษาไทยและบรรยายภาพ เช่น "ภาพประกอบแผนภูมิวงกลม" TODO: ภาพเป็นภาพประกอบเฉย ๆ ควรใช้ `alt` ว่างหรือไม่ ยังไม่ได้ตัดสินใจ
|
|
54
|
+
- ชื่อตัวเลือกเป็นหัวข้อระดับ 3 เสมอ TODO: ถ้าโครงสร้างหัวข้อของหน้าไม่ตรง ยังเปลี่ยนระดับไม่ได้
|
|
55
|
+
- ใช้ได้ทุกแอป React ภาพเป็น `<img>` ธรรมดา จึงไม่ได้ปรับขนาดหรือแปลงไฟล์ให้ ใช้ภาพขนาดพอดีการ์ด (เช่น SVG)
|
|
56
|
+
|
|
57
|
+
## Tokens used
|
|
58
|
+
|
|
59
|
+
ค่าทั้งหมดมาจาก `src/styles/theme.css`
|
|
60
|
+
|
|
61
|
+
| Token | โหมดสว่าง | โหมดมืด | ใช้ใน |
|
|
62
|
+
| -------------------- | -------------------------------- | -------------------------- | ------------------------------------------ |
|
|
63
|
+
| `--card` | `oklch(1 0 0)` | `oklch(0.228 0.013 107.4)` | พื้นการ์ด |
|
|
64
|
+
| `--card-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ชื่อและราคา |
|
|
65
|
+
| `--foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | เส้นขอบบาง ๆ รอบการ์ด (10%) |
|
|
66
|
+
| `--muted` | `oklch(0.966 0.005 106.5)` | `oklch(0.286 0.016 107.4)` | พื้นที่ภาพ (เห็นเมื่อไม่มีภาพ) |
|
|
67
|
+
| `--muted-foreground` | `oklch(0.5 0.027 107.3)` | `oklch(0.737 0.021 106.9)` | ผู้จัดการกองทุน, "ต่อหน่วย · ณ วันที่", ไอคอนแทนภาพ |
|
|
68
|
+
| `--radius` | `0.625rem` | – | มุมโค้ง (`--radius × 2.2` = 22px) |
|
|
69
|
+
| `--font-heading` | กำหนดโดยแอป (IBM Plex Sans Thai) | – | ชื่อตัวเลือก (16px, medium) |
|
|
70
|
+
|
|
71
|
+
ราคาใช้ 18px น้ำหนัก semibold และตัวเลขความกว้างเท่ากันเพื่อให้เรียงตรงกันในตาราง
|
|
72
|
+
|
|
73
|
+
## Example
|
|
74
|
+
|
|
75
|
+
จาก story `FundOptions` ใน `FundCard.stories.tsx` (ตัดเหลือ 2 การ์ด):
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<div className="mx-auto grid w-full max-w-4xl grid-cols-2 gap-4 sm:grid-cols-4">
|
|
79
|
+
<FundCard
|
|
80
|
+
name="สมดุล (Balanced)"
|
|
81
|
+
manager="เซาเทิร์นครอส อินเวสเตอร์ส"
|
|
82
|
+
unitPrice={1.8342}
|
|
83
|
+
priceDate={new Date(2026, 10, 13)}
|
|
84
|
+
image={{ src: "/funds/balanced.svg", alt: "ภาพประกอบแผนภูมิวงกลม" }}
|
|
85
|
+
/>
|
|
86
|
+
<FundCard
|
|
87
|
+
name="ลงทุนอย่างยั่งยืนเพื่อสิ่งแวดล้อมและสังคม (Sustainable ESG Growth)"
|
|
88
|
+
manager="แทสมัน ซัสเทนเนเบิล อินเวสต์เมนต์ส"
|
|
89
|
+
unitPrice={1.5527}
|
|
90
|
+
priceDate={new Date(2026, 10, 13)}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: hover-card
|
|
3
|
+
name: HoverCard
|
|
4
|
+
description: >-
|
|
5
|
+
A floating card that previews information when a link is hovered or focused, e.g. a
|
|
6
|
+
fund summary on a fund name. 288px wide, 22px corner radius. Wraps Base UI's
|
|
7
|
+
`PreviewCard`.
|
|
8
|
+
metadata:
|
|
9
|
+
status: {status: stable}
|
|
10
|
+
since: 1.0.0
|
|
11
|
+
tags: [overlay]
|
|
12
|
+
|
|
13
|
+
sections:
|
|
14
|
+
- kind: guidelines
|
|
15
|
+
for: all
|
|
16
|
+
framing: when-to-use
|
|
17
|
+
items:
|
|
18
|
+
- level: should
|
|
19
|
+
statement: >-
|
|
20
|
+
Use for a short preview of what a link leads to, such as a fund's risk and return.
|
|
21
|
+
- level: must-not
|
|
22
|
+
statement: >-
|
|
23
|
+
Don't put buttons or inputs in the card. Use <dsds:popover>, which opens on click.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: popover
|
|
26
|
+
checkedBy: manual
|
|
27
|
+
- level: must-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't put information the user needs to finish a task in the card. Show it on the
|
|
30
|
+
page: mobile has no hover.
|
|
31
|
+
checkedBy: manual
|
|
32
|
+
- level: should-not
|
|
33
|
+
statement: >-
|
|
34
|
+
Don't use it for a one-line explanation of a button or icon. Use <dsds:tooltip>.
|
|
35
|
+
alternatives:
|
|
36
|
+
- to: tooltip
|
|
37
|
+
|
|
38
|
+
- kind: guidelines
|
|
39
|
+
for: all
|
|
40
|
+
items:
|
|
41
|
+
- id: trigger-has-href
|
|
42
|
+
level: must
|
|
43
|
+
statement: >-
|
|
44
|
+
`HoverCardTrigger` is an `<a>` and must have an `href` to a page with the full
|
|
45
|
+
information. On mobile there's no hover, so tapping goes to that page.
|
|
46
|
+
checkedBy: manual
|
|
47
|
+
- id: content-duplicated
|
|
48
|
+
level: must
|
|
49
|
+
statement: >-
|
|
50
|
+
Everything in the card must also be available on the linked page. The card is
|
|
51
|
+
supplementary only.
|
|
52
|
+
checkedBy: manual
|
|
53
|
+
- id: trigger-looks-like-link
|
|
54
|
+
level: should
|
|
55
|
+
statement: >-
|
|
56
|
+
The link that opens the card looks like a link
|
|
57
|
+
(`font-medium text-primary underline underline-offset-4`), not plain text, so users
|
|
58
|
+
know there's something to hover.
|
|
59
|
+
example:
|
|
60
|
+
ref:
|
|
61
|
+
href: ./HoverCard.stories.tsx#Playground
|
|
62
|
+
rel: demo
|
|
63
|
+
checkedBy: manual
|
|
64
|
+
- id: short-preview
|
|
65
|
+
level: should
|
|
66
|
+
statement: >-
|
|
67
|
+
Keep content to 2–4 lines: the name (and a risk <dsds:badge>), a muted description,
|
|
68
|
+
and one key figure.
|
|
69
|
+
uses:
|
|
70
|
+
- to: badge
|
|
71
|
+
checkedBy: manual
|
|
72
|
+
- id: default-delays
|
|
73
|
+
level: may
|
|
74
|
+
statement: >-
|
|
75
|
+
You can tune `delay` / `closeDelay` on `HoverCardTrigger`, but the defaults stop
|
|
76
|
+
the card popping up when the pointer merely passes over.
|
|
77
|
+
|
|
78
|
+
- kind: guidelines
|
|
79
|
+
for: all
|
|
80
|
+
title: Accessibility
|
|
81
|
+
tags: [accessibility]
|
|
82
|
+
items:
|
|
83
|
+
- id: focus-opens
|
|
84
|
+
level: must
|
|
85
|
+
statement: >-
|
|
86
|
+
Focusing the link with the keyboard opens the card and Escape closes it, so
|
|
87
|
+
keyboard users get the same information as mouse users.
|
|
88
|
+
evidence:
|
|
89
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html
|
|
90
|
+
role: WCAG 2.2 SC 1.4.13 (AA)
|
|
91
|
+
checks:
|
|
92
|
+
- href: ./HoverCard.stories.tsx#FocusToOpen
|
|
93
|
+
role: test
|
|
94
|
+
- href: ./HoverCard.stories.tsx#HoverToOpen
|
|
95
|
+
role: test
|
|
96
|
+
note: play function checks data-open / data-closed on hover and unhover
|
|
97
|
+
checkedBy: automated
|
|
98
|
+
- id: hoverable
|
|
99
|
+
level: must
|
|
100
|
+
statement: >-
|
|
101
|
+
The pointer can move from the link into the card without it closing. Don't set
|
|
102
|
+
`closeDelay={0}`.
|
|
103
|
+
evidence:
|
|
104
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html
|
|
105
|
+
role: WCAG 2.2 SC 1.4.13 (AA)
|
|
106
|
+
checkedBy: manual
|
|
107
|
+
|
|
108
|
+
- kind: guidelines
|
|
109
|
+
for: agent
|
|
110
|
+
items:
|
|
111
|
+
- refs:
|
|
112
|
+
- to: shared-testing#assert-by-state
|
|
113
|
+
rel: same-as
|
|
114
|
+
|
|
115
|
+
- kind: definitions
|
|
116
|
+
for: all
|
|
117
|
+
context: anatomy
|
|
118
|
+
items:
|
|
119
|
+
- term: HoverCard
|
|
120
|
+
definition: >-
|
|
121
|
+
Root. Takes `open` / `onOpenChange`, `defaultOpen`.
|
|
122
|
+
- term: HoverCardTrigger
|
|
123
|
+
definition: >-
|
|
124
|
+
The `<a href>` link. Takes `delay`, `closeDelay`.
|
|
125
|
+
- term: HoverCardContent
|
|
126
|
+
definition: >-
|
|
127
|
+
The floating card. Takes `side` (default `bottom`, flips when there's no room),
|
|
128
|
+
`align` (`center`), `sideOffset` (4).
|
|
129
|
+
|
|
130
|
+
sourceFiles:
|
|
131
|
+
- platform: react
|
|
132
|
+
file: ./HoverCard.tsx
|
|
133
|
+
|
|
134
|
+
imports:
|
|
135
|
+
- platform: react
|
|
136
|
+
code: >-
|
|
137
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@designil/labdsnov"
|
|
138
|
+
package: "@designil/labdsnov"
|
|
139
|
+
|
|
140
|
+
traits:
|
|
141
|
+
- traitType: state
|
|
142
|
+
kind: boolean
|
|
143
|
+
id: open
|
|
144
|
+
description: >-
|
|
145
|
+
The card is open (`data-open`).
|
|
146
|
+
|
|
147
|
+
alternatives:
|
|
148
|
+
- to: tooltip
|
|
149
|
+
- to: popover
|
|
150
|
+
|
|
151
|
+
refs:
|
|
152
|
+
- href: ./HoverCard.md
|
|
153
|
+
rel: relates-to
|
|
154
|
+
role: Thai usage doc
|
|
155
|
+
- href: ./HoverCard.stories.tsx
|
|
156
|
+
rel: demo
|
|
157
|
+
role: CSF stories
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# HoverCard (การ์ดตัวอย่าง)
|
|
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
|
+
HoverCard,
|
|
18
|
+
HoverCardContent,
|
|
19
|
+
HoverCardTrigger,
|
|
20
|
+
} from "@designil/labdsnov"
|
|
21
|
+
|
|
22
|
+
;<HoverCard>
|
|
23
|
+
<HoverCardTrigger href="/funds/balanced">กองทุนสมดุล</HoverCardTrigger>
|
|
24
|
+
<HoverCardContent>…</HoverCardContent>
|
|
25
|
+
</HoverCard>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- `HoverCardTrigger` เป็นลิงก์ (`<a>`) **ต้องมี `href`** ไปหน้าที่มีข้อมูลครบ เพราะบนมือถือไม่มี hover
|
|
29
|
+
- เนื้อหาในการ์ดเป็นข้อมูลเสริมเท่านั้น ข้อมูลเดียวกันต้องหาได้จากหน้าที่ลิงก์ไป
|
|
30
|
+
|
|
31
|
+
## When to use
|
|
32
|
+
|
|
33
|
+
- ตัวอย่างสั้น ๆ ของสิ่งที่ลิงก์ไป เช่น ความเสี่ยงและผลตอบแทนของกองทุน
|
|
34
|
+
|
|
35
|
+
## When not to use
|
|
36
|
+
|
|
37
|
+
| สถานการณ์ | ใช้แทน |
|
|
38
|
+
| ------------------------------- | ------------------------ |
|
|
39
|
+
| คำอธิบายสั้นบรรทัดเดียวของปุ่มหรือไอคอน | `Tooltip` |
|
|
40
|
+
| เนื้อหาที่มีปุ่มหรือช่องกรอกให้ใช้งาน | `Popover` (เปิดด้วยการคลิก) |
|
|
41
|
+
| ข้อมูลที่ผู้ใช้ต้องเห็นเพื่อทำงานให้สำเร็จ | แสดงในหน้าเลย |
|
|
42
|
+
|
|
43
|
+
## Props and variants
|
|
44
|
+
|
|
45
|
+
### HoverCardContent
|
|
46
|
+
|
|
47
|
+
| Prop | ค่า | ค่าเริ่มต้น | ความหมาย |
|
|
48
|
+
| ------------ | -------------------------------- | -------- | ----------------------------- |
|
|
49
|
+
| `side` | `top`, `right`, `bottom`, `left` | `bottom` | ด้านที่การ์ดเปิด (สลับเองถ้าที่ไม่พอ) |
|
|
50
|
+
| `align` | `start`, `center`, `end` | `center` | การจัดแนวกับลิงก์ |
|
|
51
|
+
| `sideOffset` | px | `4` | ระยะห่างจากลิงก์ |
|
|
52
|
+
| `className` | class | – | เช่น เปลี่ยนความกว้าง (ปกติ 288px) |
|
|
53
|
+
|
|
54
|
+
### HoverCard / HoverCardTrigger
|
|
55
|
+
|
|
56
|
+
| Prop | ใช้กับ | ความหมาย |
|
|
57
|
+
| ----------------------- | ------------------ | -------------------- |
|
|
58
|
+
| `delay` / `closeDelay` | `HoverCardTrigger` | หน่วงก่อนเปิด / ปิด (ms) |
|
|
59
|
+
| `open` / `onOpenChange` | `HoverCard` | ควบคุมการเปิดจากภายนอก |
|
|
60
|
+
| `defaultOpen` | `HoverCard` | เปิดไว้ตั้งแต่แรก |
|
|
61
|
+
|
|
62
|
+
- เปิดเมื่อชี้เมาส์หรือโฟกัสลิงก์ด้วยคีย์บอร์ด ปิดเมื่อเลื่อนออกหรือกด Escape
|
|
63
|
+
- หน้าตาเหมือน `Popover`: พื้นกล่องลอย มุมโค้ง 22px เงา
|
|
64
|
+
|
|
65
|
+
## Tokens used
|
|
66
|
+
|
|
67
|
+
ค่าทั้งหมดมาจาก `src/styles/theme.css`
|
|
68
|
+
|
|
69
|
+
| Token | โหมดสว่าง | โหมดมืด | ใช้ใน |
|
|
70
|
+
| ---------------------- | -------------------------- | -------------------------- | ----------------------- |
|
|
71
|
+
| `--popover` | `oklch(1 0 0)` | `oklch(0.228 0.013 107.4)` | พื้นการ์ด |
|
|
72
|
+
| `--popover-foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | ตัวอักษร |
|
|
73
|
+
| `--foreground` | `oklch(0.153 0.006 107.1)` | `oklch(0.988 0.003 106.5)` | เส้นขอบจาง (5% / มืด 10%) |
|
|
74
|
+
|
|
75
|
+
## Example
|
|
76
|
+
|
|
77
|
+
จาก story `Playground` ใน `HoverCard.stories.tsx`:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<HoverCard>
|
|
81
|
+
<HoverCardTrigger
|
|
82
|
+
href="#balanced"
|
|
83
|
+
className="font-medium text-primary underline underline-offset-4"
|
|
84
|
+
>
|
|
85
|
+
กองทุนสมดุล
|
|
86
|
+
</HoverCardTrigger>
|
|
87
|
+
<HoverCardContent>
|
|
88
|
+
<div className="grid gap-2">
|
|
89
|
+
<div className="flex items-center justify-between gap-2">
|
|
90
|
+
<p className="font-medium">กองทุนสมดุล (Balanced)</p>
|
|
91
|
+
<Badge variant="warning">ความเสี่ยงปานกลาง</Badge>
|
|
92
|
+
</div>
|
|
93
|
+
<p className="text-muted-foreground">
|
|
94
|
+
หุ้น 60% ตราสารหนี้และเงินสด 40% เหมาะกับการออมระยะ 7 ปีขึ้นไป
|
|
95
|
+
</p>
|
|
96
|
+
<p>ผลตอบแทนย้อนหลัง 5 ปี 6.8% ต่อปี</p>
|
|
97
|
+
</div>
|
|
98
|
+
</HoverCardContent>
|
|
99
|
+
</HoverCard>
|
|
100
|
+
```
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: input
|
|
3
|
+
name: Input
|
|
4
|
+
description: >-
|
|
5
|
+
A single-line text field for things like name, email, password, phone number or file
|
|
6
|
+
selection. 36px high, full width, pill-shaped. Wraps Base UI's `Input`.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [form]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use for short single-line data in forms, such as editing account details or
|
|
20
|
+
signing in.
|
|
21
|
+
- level: must-not
|
|
22
|
+
statement: >-
|
|
23
|
+
Don't use it for multi-line text. Use <dsds:textarea>.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: textarea
|
|
26
|
+
checkedBy: manual
|
|
27
|
+
- level: must-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't use it to choose from a list or to switch something on/off. Use
|
|
30
|
+
<dsds:select>, <dsds:radio-group>, <dsds:checkbox> or <dsds:switch>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: select
|
|
33
|
+
- to: radio-group
|
|
34
|
+
- to: checkbox
|
|
35
|
+
- to: switch
|
|
36
|
+
checkedBy: manual
|
|
37
|
+
- level: must-not
|
|
38
|
+
statement: >-
|
|
39
|
+
Don't use `type="date"` to pick a date. Use <dsds:date-picker> (Buddhist year),
|
|
40
|
+
because the browser's date field shows the year in the device's calendar.
|
|
41
|
+
alternatives:
|
|
42
|
+
- to: date-picker
|
|
43
|
+
checkedBy: manual
|
|
44
|
+
- level: should-not
|
|
45
|
+
statement: >-
|
|
46
|
+
Don't use it for one-time codes. Use <dsds:input-otp>.
|
|
47
|
+
alternatives:
|
|
48
|
+
- to: input-otp
|
|
49
|
+
|
|
50
|
+
- kind: guidelines
|
|
51
|
+
for: all
|
|
52
|
+
items:
|
|
53
|
+
- id: always-labelled
|
|
54
|
+
level: must
|
|
55
|
+
statement: >-
|
|
56
|
+
Always pair it with a <dsds:label> (or `FieldLabel` in <dsds:field>) bound by
|
|
57
|
+
`id` / `htmlFor`.
|
|
58
|
+
uses:
|
|
59
|
+
- to: label
|
|
60
|
+
- to: field
|
|
61
|
+
checkedBy: manual
|
|
62
|
+
- id: placeholder-not-label
|
|
63
|
+
level: must-not
|
|
64
|
+
statement: >-
|
|
65
|
+
Don't use the placeholder as the label: it disappears once the user starts typing.
|
|
66
|
+
Use it only to show the format, e.g. "04xx xxx xxx".
|
|
67
|
+
evidence:
|
|
68
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html
|
|
69
|
+
role: WCAG 2.2 SC 3.3.2 (A)
|
|
70
|
+
checkedBy: manual
|
|
71
|
+
- id: right-type
|
|
72
|
+
level: should
|
|
73
|
+
statement: >-
|
|
74
|
+
Pick the `type` that matches the data (`email`, `password`, `tel`, `number`,
|
|
75
|
+
`search`, `file`) so mobile shows the right keyboard, and set `autoComplete`
|
|
76
|
+
(`email`, `name`, `tel`) on personal-details forms.
|
|
77
|
+
evidence:
|
|
78
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html
|
|
79
|
+
role: WCAG 2.2 SC 1.3.5 (AA)
|
|
80
|
+
example:
|
|
81
|
+
ref:
|
|
82
|
+
href: ./Input.stories.tsx#Types
|
|
83
|
+
rel: demo
|
|
84
|
+
checkedBy: manual
|
|
85
|
+
- id: required-on-input
|
|
86
|
+
level: must
|
|
87
|
+
statement: >-
|
|
88
|
+
Required fields set `required` on the Input itself too. The asterisk from
|
|
89
|
+
`Label required` is only visual.
|
|
90
|
+
refines:
|
|
91
|
+
- to: field#required-two-places
|
|
92
|
+
checkedBy: manual
|
|
93
|
+
- id: filled-default
|
|
94
|
+
level: should
|
|
95
|
+
statement: >-
|
|
96
|
+
Use `variant="filled"` (default, tinted background with a border) in forms. Where
|
|
97
|
+
`outline` (transparent background) should be used isn't defined yet.
|
|
98
|
+
checkedBy: manual
|
|
99
|
+
- id: money-in-group
|
|
100
|
+
level: should
|
|
101
|
+
statement: >-
|
|
102
|
+
A money field that needs "AU$" uses <dsds:input-group>. Don't write "AU$" in the
|
|
103
|
+
placeholder.
|
|
104
|
+
alternatives:
|
|
105
|
+
- to: input-group
|
|
106
|
+
checkedBy: manual
|
|
107
|
+
- id: font-size-mobile
|
|
108
|
+
level: should-not
|
|
109
|
+
statement: >-
|
|
110
|
+
Don't shrink the text below 16px on narrow screens with `className`: iOS zooms the
|
|
111
|
+
page on focus. The field already uses 16px on narrow screens and 14px from 768px.
|
|
112
|
+
checkedBy: manual
|
|
113
|
+
|
|
114
|
+
- kind: guidelines
|
|
115
|
+
for: all
|
|
116
|
+
title: Accessibility
|
|
117
|
+
tags: [accessibility]
|
|
118
|
+
items:
|
|
119
|
+
- id: invalid-described
|
|
120
|
+
level: must
|
|
121
|
+
statement: >-
|
|
122
|
+
An invalid field has `aria-invalid` and an `aria-describedby` pointing at the error
|
|
123
|
+
message below it.
|
|
124
|
+
refines:
|
|
125
|
+
- to: shared-a11y#invalid-has-message
|
|
126
|
+
checks:
|
|
127
|
+
- href: ./Input.stories.tsx#Invalid
|
|
128
|
+
role: test
|
|
129
|
+
note: play function checks toBeInvalid and toHaveAccessibleDescription
|
|
130
|
+
checkedBy: automated
|
|
131
|
+
- id: disabled-not-focusable
|
|
132
|
+
level: must
|
|
133
|
+
statement: >-
|
|
134
|
+
A `disabled` field dims to 50% and leaves the Tab order. A value the user must be
|
|
135
|
+
able to read or copy uses `readOnly` instead.
|
|
136
|
+
checks:
|
|
137
|
+
- href: ./Input.stories.tsx#Disabled
|
|
138
|
+
role: test
|
|
139
|
+
checkedBy: automated
|
|
140
|
+
- id: field-contrast
|
|
141
|
+
level: must
|
|
142
|
+
statement: >-
|
|
143
|
+
The field border (`--field-border`) passes 3.93:1 light / 4.05:1 dark on the page
|
|
144
|
+
background and 3.50:1 in a dark-mode card. The placeholder passes 5.40:1 / 7.17:1.
|
|
145
|
+
Don't change the border to `--border`.
|
|
146
|
+
checks:
|
|
147
|
+
- href: ../../../scripts/tokens.mjs
|
|
148
|
+
role: test
|
|
149
|
+
note: CONTRAST_PAIRS "เส้นขอบช่องกรอก…" and "placeholder ในช่องกรอก"
|
|
150
|
+
checkedBy: automated
|
|
151
|
+
- refs:
|
|
152
|
+
- to: shared-a11y#invalid-keeps-focus
|
|
153
|
+
rel: same-as
|
|
154
|
+
|
|
155
|
+
- kind: guidelines
|
|
156
|
+
for: agent
|
|
157
|
+
items:
|
|
158
|
+
- refs:
|
|
159
|
+
- to: shared-testing#fire-change-for-typing
|
|
160
|
+
rel: same-as
|
|
161
|
+
|
|
162
|
+
- kind: definitions
|
|
163
|
+
for: all
|
|
164
|
+
title: States
|
|
165
|
+
context: labdsnov.states
|
|
166
|
+
items:
|
|
167
|
+
- term: Keyboard focus
|
|
168
|
+
definition: >-
|
|
169
|
+
Solid `--focus-ring` border and ring.
|
|
170
|
+
- term: aria-invalid
|
|
171
|
+
definition: >-
|
|
172
|
+
Red border and faint red ring. On focus the ring becomes solid red.
|
|
173
|
+
- term: Disabled
|
|
174
|
+
definition: >-
|
|
175
|
+
Dimmed to 50%, not focusable.
|
|
176
|
+
|
|
177
|
+
sourceFiles:
|
|
178
|
+
- platform: react
|
|
179
|
+
file: ./Input.tsx
|
|
180
|
+
|
|
181
|
+
imports:
|
|
182
|
+
- platform: react
|
|
183
|
+
code: >-
|
|
184
|
+
import { Input } from "@designil/labdsnov"
|
|
185
|
+
package: "@designil/labdsnov"
|
|
186
|
+
|
|
187
|
+
traits:
|
|
188
|
+
- traitType: variant
|
|
189
|
+
kind: enum
|
|
190
|
+
id: variant
|
|
191
|
+
description: >-
|
|
192
|
+
The field's look.
|
|
193
|
+
values:
|
|
194
|
+
- id: filled
|
|
195
|
+
description: >-
|
|
196
|
+
Tinted background (`--field-bg`) with a border. Default, used in regular forms.
|
|
197
|
+
- id: outline
|
|
198
|
+
description: >-
|
|
199
|
+
Transparent background with a border. Where to use it isn't defined yet.
|
|
200
|
+
- traitType: state
|
|
201
|
+
kind: boolean
|
|
202
|
+
id: disabled
|
|
203
|
+
description: >-
|
|
204
|
+
Disabled.
|
|
205
|
+
- traitType: state
|
|
206
|
+
kind: boolean
|
|
207
|
+
id: aria-invalid
|
|
208
|
+
name: Invalid
|
|
209
|
+
description: >-
|
|
210
|
+
The value is invalid.
|
|
211
|
+
|
|
212
|
+
uses:
|
|
213
|
+
- to: label
|
|
214
|
+
alternatives:
|
|
215
|
+
- to: textarea
|
|
216
|
+
- to: input-group
|
|
217
|
+
- to: date-picker
|
|
218
|
+
|
|
219
|
+
refs:
|
|
220
|
+
- href: ./Input.md
|
|
221
|
+
rel: relates-to
|
|
222
|
+
role: Thai usage doc
|
|
223
|
+
- href: ./Input.stories.tsx
|
|
224
|
+
rel: demo
|
|
225
|
+
role: CSF stories
|
|
226
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=10-52
|
|
227
|
+
rel: design
|
|
228
|
+
role: Input in Figma
|
|
229
|
+
- href: ../../../figma/Input.figma.ts
|
|
230
|
+
rel: source
|
|
231
|
+
role: Code Connect template
|
|
232
|
+
|
|
233
|
+
$extensions:
|
|
234
|
+
com.figma:
|
|
235
|
+
nodeId: "10:52"
|