@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
@@ -0,0 +1,193 @@
1
+ kind: component
2
+ id: button-group
3
+ name: ButtonGroup
4
+ description: >-
5
+ Joins related command buttons (and inputs or a Select) into one bar, with square
6
+ inner corners and shared borders.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [action, layout]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use for commands that belong together, e.g. download in several formats
20
+ (PDF / Excel), zoom in/out.
21
+ - level: should
22
+ statement: >-
23
+ Use for a split button: a primary button paired with a button that opens a
24
+ menu of more options (<dsds:dropdown-menu>).
25
+ example:
26
+ ref:
27
+ href: ./ButtonGroup.stories.tsx#SplitButton
28
+ rel: demo
29
+ uses:
30
+ - to: dropdown-menu
31
+ - level: should
32
+ statement: >-
33
+ Use for an input with a unit and a button attached, e.g. "AU$" + amount +
34
+ "เพิ่ม" (add).
35
+ - level: must-not
36
+ statement: >-
37
+ Never use it to pick one option that stays selected (e.g. monthly/yearly
38
+ view); use <dsds:toggle-group>, which shows the selected state.
39
+ alternatives:
40
+ - to: toggle-group
41
+ checkedBy: manual
42
+ - level: must-not
43
+ statement: >-
44
+ Never group the confirm/cancel buttons at the end of a form or Dialog; use
45
+ separate <dsds:button>s with space between them, to avoid mis-taps.
46
+ alternatives:
47
+ - to: button
48
+ checkedBy: manual
49
+ - level: should-not
50
+ statement: >-
51
+ Don't use it just to put a unit or icon in an input; use <dsds:input-group>.
52
+ alternatives:
53
+ - to: input-group
54
+
55
+ - kind: guidelines
56
+ for: all
57
+ items:
58
+ - id: group-label
59
+ level: must
60
+ statement: >-
61
+ Give `ButtonGroup` an `aria-label` saying what its buttons do together, e.g.
62
+ "ดาวน์โหลดรายงาน" (download report). The group has `role="group"`.
63
+ checks:
64
+ - href: ./ButtonGroup.stories.tsx#Playground
65
+ role: test
66
+ note: The play function checks the group role, its name, and the shared corners/borders
67
+ checkedBy: automated
68
+ - id: separator-for-borderless
69
+ level: must
70
+ statement: >-
71
+ Borderless buttons (`default`, `secondary`) must be separated with
72
+ `ButtonGroupSeparator`, or they merge into one block. `outline` already
73
+ shares its borders.
74
+ checkedBy: manual
75
+ - id: same-variant
76
+ level: should
77
+ statement: >-
78
+ Buttons in a group use the same variant and size, except a split button,
79
+ where the main button and the chevron button share a variant but the chevron
80
+ is `size="icon"`.
81
+ checkedBy: manual
82
+ - id: allowed-children
83
+ level: should
84
+ statement: >-
85
+ Allowed children: `Button`, `Input`, `Select`, `InputGroup`, `ButtonGroupText`
86
+ and nested `ButtonGroup`s (8px between groups). Other elements don't get the
87
+ shared corners and borders.
88
+ example:
89
+ ref:
90
+ href: ./ButtonGroup.stories.tsx#Nested
91
+ rel: demo
92
+ uses:
93
+ - to: button
94
+ - to: input
95
+ - to: select
96
+ - to: input-group
97
+ checkedBy: manual
98
+ - id: text-is-static
99
+ level: should
100
+ statement: >-
101
+ `ButtonGroupText` is only for text or units that can't be pressed, such as
102
+ "AU$". Use `render={<Label />}` when the text is the label of an input in the
103
+ group.
104
+ checkedBy: manual
105
+
106
+ - kind: guidelines
107
+ for: all
108
+ title: Accessibility
109
+ tags: [accessibility]
110
+ items:
111
+ - id: focus-raised
112
+ level: must
113
+ statement: >-
114
+ A keyboard-focused button is raised (`z-index: 10`) so neighbouring buttons
115
+ don't cover its focus ring. Never set `z-index` or `overflow: hidden` on the
116
+ group over it.
117
+ checks:
118
+ - href: ./ButtonGroup.stories.tsx#KeyboardFocus
119
+ role: test
120
+ note: The play function checks the focused button has zIndex 10
121
+ checkedBy: automated
122
+ - id: input-label
123
+ level: must
124
+ statement: >-
125
+ An `Input` in a group needs its own name (`aria-label`, or `ButtonGroupText`
126
+ with `render={<Label htmlFor="…" />}`). The "AU$" next to it isn't the
127
+ input's name.
128
+ evidence:
129
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html
130
+ role: WCAG 2.2 SC 3.3.2 (A)
131
+ checkedBy: manual
132
+ - id: text-contrast
133
+ level: must
134
+ statement: >-
135
+ Text in `ButtonGroupText` passes 17.76:1 light, 13.79:1 dark.
136
+ checks:
137
+ - href: ../../../scripts/tokens.mjs
138
+ role: test
139
+ note: CONTRAST_PAIRS "ข้อความใน ButtonGroup" (text in ButtonGroup)
140
+ checkedBy: automated
141
+
142
+ - kind: definitions
143
+ for: all
144
+ context: anatomy
145
+ items:
146
+ - term: ButtonGroup
147
+ definition: >-
148
+ The frame, `role="group"`. Takes `orientation`.
149
+ - term: ButtonGroupText
150
+ definition: >-
151
+ Text or a unit that can't be pressed; tinted background with a border
152
+ (`render` changes the element).
153
+ - term: ButtonGroupSeparator
154
+ definition: >-
155
+ A line between borderless buttons. `orientation` defaults to `vertical`.
156
+
157
+ sourceFiles:
158
+ - platform: react
159
+ file: ./ButtonGroup.tsx
160
+
161
+ imports:
162
+ - platform: react
163
+ code: >-
164
+ import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "@designil/labdsnov"
165
+ package: "@designil/labdsnov"
166
+
167
+ traits:
168
+ - traitType: variant
169
+ kind: enum
170
+ id: orientation
171
+ description: >-
172
+ Direction of the group.
173
+ values:
174
+ - id: horizontal
175
+ description: >-
176
+ One row; left/right inner corners are square.
177
+ - id: vertical
178
+ description: >-
179
+ One column; top/bottom inner corners are square.
180
+
181
+ uses:
182
+ - to: button
183
+ alternatives:
184
+ - to: toggle-group
185
+ - to: input-group
186
+
187
+ refs:
188
+ - href: ./ButtonGroup.md
189
+ rel: relates-to
190
+ role: Usage doc in Thai
191
+ - href: ./ButtonGroup.stories.tsx
192
+ rel: demo
193
+ role: CSF stories
@@ -0,0 +1,236 @@
1
+ kind: component
2
+ id: calendar
3
+ name: Calendar
4
+ description: >-
5
+ A month grid for picking a date or a date range, in Thai with the Buddhist year
6
+ ("พฤศจิกายน 2569"). Built on `react-day-picker`, with dates formatted by `Intl`
7
+ in the `th-TH` locale.
8
+ metadata:
9
+ status: {status: stable}
10
+ since: 1.0.0
11
+ tags: [form, date]
12
+
13
+ sections:
14
+ - kind: guidelines
15
+ for: all
16
+ framing: when-to-use
17
+ items:
18
+ - level: should
19
+ statement: >-
20
+ Use when the user needs to see the month around a date to choose it, e.g. an
21
+ appointment date.
22
+ - level: should
23
+ statement: >-
24
+ Use `mode="range"` to pick a date range, e.g. a statement period (with
25
+ `numberOfMonths={2}` on wide screens).
26
+ - level: may
27
+ statement: >-
28
+ Show the calendar inline on the page, e.g. inside a card (its background turns
29
+ transparent inside a card or popup).
30
+ - level: must-not
31
+ statement: >-
32
+ Don't place a bare Calendar as a date field in a form. Use <dsds:date-picker>,
33
+ which opens this calendar in a popup and shows the chosen value on its button.
34
+ alternatives:
35
+ - to: date-picker
36
+ checkedBy: manual
37
+ - level: should-not
38
+ statement: >-
39
+ Don't make users page month by month to reach a birth date or another date they
40
+ already know. Until a typed date field exists, use `captionLayout="dropdown"` with
41
+ `startMonth` / `endMonth`.
42
+ example:
43
+ ref:
44
+ href: ./Calendar.stories.tsx#Dropdowns
45
+ rel: demo
46
+
47
+ - kind: guidelines
48
+ for: all
49
+ items:
50
+ - id: buddhist-year-default
51
+ level: must
52
+ statement: >-
53
+ Keep the built-in Thai and Buddhist-year formatting. Never pass the `date-fns` `th`
54
+ `locale` or `formatters` built on `date-fns` `format()`: they give the Gregorian
55
+ year (2026 instead of 2569).
56
+ refines:
57
+ - to: shared-content#buddhist-year
58
+ checks:
59
+ - href: ./Calendar.stories.tsx#Playground
60
+ role: test
61
+ note: play function checks the month caption "พฤศจิกายน 2569"
62
+ checkedBy: automated
63
+ - id: disable-impossible
64
+ level: must
65
+ statement: >-
66
+ Disable dates that can't be chosen with `disabled` (e.g. `{ before: today }` for an
67
+ appointment, `{ after: today }` for a birth date) instead of validating after the
68
+ pick and showing an error.
69
+ example:
70
+ ref:
71
+ href: ./Calendar.stories.tsx#DisabledDays
72
+ rel: demo
73
+ checks:
74
+ - href: ./Calendar.stories.tsx#DisabledDays
75
+ role: test
76
+ checkedBy: automated
77
+ - id: controlled-in-client
78
+ level: must
79
+ statement: >-
80
+ Keep `selected` / `onSelect` in Client Component state (`"use client"`). A range
81
+ uses the `DateRange` type from `react-day-picker`.
82
+ checkedBy: manual
83
+ - id: month-arrows-ghost
84
+ level: should
85
+ statement: >-
86
+ Keep the default month arrows (`buttonVariant="ghost"`). Switch to `outline` only
87
+ when the calendar sits on a patterned background.
88
+ checkedBy: manual
89
+ - id: outside-days
90
+ level: may
91
+ statement: >-
92
+ `showOutsideDays` (default `true`) shows the previous/next month's days dimmed. Turn
93
+ it off when several months sit side by side, to avoid confusion.
94
+
95
+ - kind: guidelines
96
+ for: all
97
+ title: Accessibility
98
+ tags: [accessibility]
99
+ items:
100
+ - id: full-day-name
101
+ level: must
102
+ statement: >-
103
+ Each day button has a full Thai name, e.g. "วันศุกร์ที่ 13 พฤศจิกายน พ.ศ. 2569,
104
+ วันนี้, เลือกแล้ว" (Friday 13 November BE 2569, today, selected). Don't override
105
+ `labels` with a format that drops the weekday or year.
106
+ checks:
107
+ - href: ./Calendar.stories.tsx#Playground
108
+ role: test
109
+ note: play function checks the selected day's name contains "เลือกแล้ว" and the "เดือนถัดไป" (next month) button
110
+ checkedBy: automated
111
+ - id: selected-contrast
112
+ level: must
113
+ statement: >-
114
+ The selected day passes 4.93:1 light / 6.46:1 dark, mid-range days 17.76:1 /
115
+ 13.79:1, and weekday names 5.97:1 / 7.30:1.
116
+ checks:
117
+ - href: ../../../scripts/tokens.mjs
118
+ role: test
119
+ note: CONTRAST_PAIRS "… ใน Calendar"
120
+ checkedBy: automated
121
+ - id: not-only-calendar
122
+ level: should
123
+ statement: >-
124
+ Dates the user already knows should be typeable (no typed field yet, see Open
125
+ decisions). Picking from the grid alone is slow for screen reader users.
126
+ checkedBy: manual
127
+
128
+ - kind: definitions
129
+ for: all
130
+ context: keyboard
131
+ items:
132
+ - term: Left / Right arrow
133
+ definition: >-
134
+ Previous / next day
135
+ - term: Up / Down arrow
136
+ definition: >-
137
+ Previous / next week
138
+ - term: Enter / Space
139
+ definition: >-
140
+ Select the focused day
141
+ - term: Tab
142
+ definition: >-
143
+ Move between the "เดือนก่อนหน้า" / "เดือนถัดไป" (previous / next month) buttons
144
+ and the day grid
145
+
146
+ - kind: definitions
147
+ for: all
148
+ title: States
149
+ context: labdsnov.states
150
+ items:
151
+ - term: Today
152
+ definition: >-
153
+ Grey background
154
+ - term: Selected
155
+ definition: >-
156
+ Primary (orange) background, light text
157
+ - term: Mid-range
158
+ definition: >-
159
+ Grey background (`--calendar-range-bg`)
160
+ - term: Disabled
161
+ definition: >-
162
+ Dimmed, and skipped by arrow-key navigation
163
+
164
+ - kind: section
165
+ for: all
166
+ title: Open decisions
167
+ freeform:
168
+ - title: TODO
169
+ body: >-
170
+ There's no typed date field (dd/mm/yyyy) yet for birth dates or other dates the
171
+ user already knows.
172
+
173
+ sourceFiles:
174
+ - platform: react
175
+ file: ./Calendar.tsx
176
+
177
+ imports:
178
+ - platform: react
179
+ code: >-
180
+ import { Calendar } from "@designil/labdsnov"
181
+ package: "@designil/labdsnov"
182
+
183
+ traits:
184
+ - traitType: variant
185
+ kind: enum
186
+ id: mode
187
+ description: >-
188
+ How dates are picked
189
+ values:
190
+ - id: single
191
+ description: >-
192
+ One day
193
+ - id: multiple
194
+ description: >-
195
+ Several separate days
196
+ - id: range
197
+ description: >-
198
+ A date range (`from` / `to`)
199
+ - traitType: variant
200
+ kind: enum
201
+ id: captionLayout
202
+ description: >-
203
+ The month header
204
+ values:
205
+ - id: label
206
+ description: >-
207
+ Month name and Buddhist year as text (default)
208
+ - id: dropdown
209
+ description: >-
210
+ Pick month and year from lists, with `startMonth` / `endMonth`
211
+ - traitType: variant
212
+ kind: boolean
213
+ id: showWeekNumber
214
+ description: >-
215
+ Show week numbers
216
+ - traitType: variant
217
+ kind: boolean
218
+ id: showOutsideDays
219
+ description: >-
220
+ Show the previous/next month's days dimmed (default `true`)
221
+
222
+ uses:
223
+ - to: button
224
+ alternatives:
225
+ - to: date-picker
226
+
227
+ refs:
228
+ - href: ./Calendar.md
229
+ rel: relates-to
230
+ role: Thai usage doc
231
+ - href: ./Calendar.stories.tsx
232
+ rel: demo
233
+ role: CSF stories
234
+ - href: https://daypicker.dev
235
+ rel: relates-to
236
+ role: react-day-picker docs (all props)
@@ -0,0 +1,199 @@
1
+ kind: component
2
+ id: card
3
+ name: Card
4
+ description: >-
5
+ A raised area that groups content about one subject, e.g. a balance summary or the
6
+ beneficiaries, with its own header, content and buttons.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [layout]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use to summarise one subject on a dashboard, e.g. balance, investment plan,
20
+ beneficiaries.
21
+ - level: should
22
+ statement: >-
23
+ Use for a group of content with its own heading, content and buttons.
24
+ - level: must-not
25
+ statement: >-
26
+ Don't use Card for investment options. Use <dsds:fund-card>.
27
+ alternatives:
28
+ - to: fund-card
29
+ checkedBy: manual
30
+ - level: must-not
31
+ statement: >-
32
+ Don't build a selectable card from Card + onClick. Use the choice cards of
33
+ <dsds:field> (story `ChoiceCards`), which are real radios/checkboxes.
34
+ alternatives:
35
+ - to: field
36
+ checkedBy: manual
37
+ - level: should-not
38
+ statement: >-
39
+ Don't use a card just for spacing when the content isn't one group, and don't nest
40
+ cards in cards: the page gets heavy.
41
+ - level: should-not
42
+ statement: >-
43
+ Don't use as a notice. Use <dsds:alert>.
44
+ alternatives:
45
+ - to: alert
46
+
47
+ - kind: guidelines
48
+ for: all
49
+ items:
50
+ - id: one-primary-in-footer
51
+ level: must
52
+ statement: >-
53
+ `CardFooter` has at most one primary (`default`) button, placed rightmost.
54
+ Secondary buttons use `outline`, to its left.
55
+ refines:
56
+ - to: button#one-primary
57
+ checkedBy: manual
58
+ - id: card-action-content
59
+ level: should
60
+ statement: >-
61
+ `CardAction` (top right of the header) holds only a status <dsds:badge> or an icon
62
+ button that opens a menu (`Button size="icon-sm" variant="ghost"` + `aria-label`).
63
+ example:
64
+ ref:
65
+ href: ./Card.stories.tsx#WithMenuButton
66
+ rel: demo
67
+ uses:
68
+ - to: badge
69
+ - to: dropdown-menu
70
+ checkedBy: manual
71
+ - id: size-sm-dense
72
+ level: should
73
+ statement: >-
74
+ Use `size="sm"` (16px padding) in card grids or sidebars, and `default` (24px) for
75
+ the page's main card.
76
+ checkedBy: manual
77
+ - id: separators-by-class
78
+ level: should
79
+ statement: >-
80
+ For a divider under the header or above the footer, put `className="border-b"` on
81
+ `CardHeader` or `"border-t"` on `CardFooter`; spacing adjusts itself. Don't add a
82
+ <dsds:separator>.
83
+ checkedBy: manual
84
+ - id: media-first-child
85
+ level: may
86
+ statement: >-
87
+ An image as the card's first child sits flush to the top edge and follows the
88
+ card's corner radius.
89
+ - id: money-tabular
90
+ level: should
91
+ statement: >-
92
+ Money in a card uses `tabular-nums` with "AU$" in front, e.g. "AU$84,215.37". The
93
+ caption under the number uses `text-muted-foreground`.
94
+ checkedBy: manual
95
+
96
+ - kind: guidelines
97
+ for: all
98
+ title: Accessibility
99
+ tags: [accessibility]
100
+ items:
101
+ - id: title-not-heading
102
+ level: must
103
+ statement: >-
104
+ `CardTitle` is a `<div>`, not a page heading. If the card is a main section that
105
+ belongs in the heading outline, add `role="heading"` and `aria-level` yourself, or
106
+ put an `h2` outside the card.
107
+ evidence:
108
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html
109
+ role: WCAG 2.2 SC 1.3.1 (A)
110
+ checkedBy: manual
111
+ - id: card-text-contrast
112
+ level: must
113
+ statement: >-
114
+ Text on a card passes 19.59:1 light / 16.38:1 dark, muted captions 5.97:1 / 7.30:1,
115
+ and field borders in a card 3.93:1 / 3.50:1 (close to the 3:1 bar in dark mode).
116
+ checks:
117
+ - href: ../../../scripts/tokens.mjs
118
+ role: test
119
+ note: CONTRAST_PAIRS "… ใน Card"
120
+ checkedBy: automated
121
+ - id: icon-action-label
122
+ level: must
123
+ statement: >-
124
+ An icon button in `CardAction` has an `aria-label` saying whose menu it is, e.g.
125
+ "ตัวเลือกบัญชี" (account options).
126
+ refines:
127
+ - to: shared-a11y#icon-only-label
128
+ checkedBy: assisted
129
+
130
+ - kind: definitions
131
+ for: all
132
+ context: anatomy
133
+ items:
134
+ - term: Card
135
+ definition: >-
136
+ The frame; takes `size`
137
+ - term: CardHeader
138
+ definition: >-
139
+ Header holding Title, Description and Action
140
+ - term: CardTitle
141
+ definition: >-
142
+ Title, 16px medium (`--font-heading`), a `<div>`
143
+ - term: CardDescription
144
+ definition: >-
145
+ Muted caption, e.g. "ณ วันที่ 13 พ.ย. 2569" (as at 13 Nov 2569)
146
+ - term: CardAction
147
+ definition: >-
148
+ Top right of the header
149
+ - term: CardContent
150
+ definition: >-
151
+ Content
152
+ - term: CardFooter
153
+ definition: >-
154
+ Buttons at the bottom
155
+
156
+ - kind: section
157
+ for: all
158
+ title: Open decisions
159
+ freeform:
160
+ - title: TODO
161
+ body: >-
162
+ Not yet decided whether `CardTitle` should let you choose a heading level (`h2`,
163
+ `h3`).
164
+
165
+ sourceFiles:
166
+ - platform: react
167
+ file: ./Card.tsx
168
+
169
+ imports:
170
+ - platform: react
171
+ code: >-
172
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@designil/labdsnov"
173
+ package: "@designil/labdsnov"
174
+
175
+ traits:
176
+ - traitType: variant
177
+ kind: enum
178
+ id: size
179
+ description: >-
180
+ Inner padding and gap between parts
181
+ values:
182
+ - id: default
183
+ description: >-
184
+ 24px, the page's main card
185
+ - id: sm
186
+ description: >-
187
+ 16px, card grids or sidebars
188
+
189
+ alternatives:
190
+ - to: fund-card
191
+ - to: alert
192
+
193
+ refs:
194
+ - href: ./Card.md
195
+ rel: relates-to
196
+ role: Thai usage doc
197
+ - href: ./Card.stories.tsx
198
+ rel: demo
199
+ role: CSF stories