@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.
- package/README.md +18 -1
- package/dist/components/Accordion/Accordion.module.css.js +10 -10
- package/dist/components/Alert/Alert.module.css.js +10 -10
- package/dist/components/AlertDialog/AlertDialog.module.css.js +16 -16
- package/dist/components/Avatar/Avatar.module.css.js +18 -18
- package/dist/components/Badge/Badge.module.css.js +6 -6
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +14 -14
- package/dist/components/Button/Button.module.css.js +26 -26
- package/dist/components/ButtonGroup/ButtonGroup.module.css.js +2 -2
- package/dist/components/Calendar/Calendar.module.css.js +33 -33
- package/dist/components/Card/Card.module.css.js +20 -20
- package/dist/components/Chart/Chart.module.css.js +32 -32
- package/dist/components/Checkbox/Checkbox.module.css.js +10 -10
- package/dist/components/Collapsible/Collapsible.module.css.js +1 -1
- package/dist/components/Combobox/Combobox.module.css.js +32 -32
- package/dist/components/DatePicker/DatePicker.module.css.js +4 -4
- package/dist/components/Dialog/Dialog.module.css.js +13 -13
- package/dist/components/Drawer/Drawer.module.css.js +18 -18
- package/dist/components/DropdownMenu/DropdownMenu.module.css.js +24 -24
- package/dist/components/Empty/Empty.module.css.js +11 -11
- package/dist/components/Field/Field.module.css.js +25 -25
- package/dist/components/FundCard/FundCard.module.css.js +14 -14
- package/dist/components/HoverCard/HoverCard.module.css.js +5 -5
- package/dist/components/Input/Input.module.css.js +2 -2
- package/dist/components/InputGroup/InputGroup.module.css.js +16 -16
- package/dist/components/InputOTP/InputOTP.module.css.js +16 -16
- package/dist/components/Kbd/Kbd.module.css.js +1 -1
- package/dist/components/Label/Label.module.css.js +6 -6
- package/dist/components/NavigationMenu/NavigationMenu.module.css.js +24 -24
- package/dist/components/Pagination/Pagination.module.css.js +10 -10
- package/dist/components/Popover/Popover.module.css.js +10 -10
- package/dist/components/Progress/Progress.module.css.js +12 -12
- package/dist/components/RadioGroup/RadioGroup.module.css.js +8 -8
- package/dist/components/ScrollArea/ScrollArea.module.css.js +5 -5
- package/dist/components/Select/Select.module.css.js +34 -34
- package/dist/components/Separator/Separator.module.css.js +1 -1
- package/dist/components/Skeleton/Skeleton.module.css.js +1 -1
- package/dist/components/Slider/Slider.module.css.js +12 -12
- package/dist/components/Spinner/Spinner.module.css.js +1 -1
- package/dist/components/Switch/Switch.module.css.js +6 -6
- package/dist/components/Table/Table.module.css.js +8 -8
- package/dist/components/Tabs/Tabs.module.css.js +8 -8
- package/dist/components/Textarea/Textarea.module.css.js +1 -1
- package/dist/components/Toaster/Toaster.module.css.js +8 -8
- package/dist/components/Toggle/Toggle.module.css.js +8 -8
- package/dist/components/ToggleGroup/ToggleGroup.module.css.js +3 -3
- package/dist/components/Tooltip/Tooltip.module.css.js +5 -5
- package/dist/styles.css +1 -1
- package/docs/Colors.md +96 -43
- package/docs/Contributing.md +14 -7
- package/package.json +21 -13
- package/src/components/Accordion/Accordion.dsds.yaml +195 -0
- package/src/components/Alert/Alert.dsds.yaml +206 -0
- package/src/components/AlertDialog/AlertDialog.dsds.yaml +243 -0
- package/src/components/Avatar/Avatar.dsds.yaml +172 -0
- package/src/components/Badge/Badge.dsds.yaml +191 -0
- package/src/components/Breadcrumb/Breadcrumb.dsds.yaml +162 -0
- package/src/components/Button/Button.dsds.yaml +350 -0
- package/src/components/ButtonGroup/ButtonGroup.dsds.yaml +193 -0
- package/src/components/Calendar/Calendar.dsds.yaml +236 -0
- package/src/components/Card/Card.dsds.yaml +199 -0
- package/src/components/Chart/Chart.dsds.yaml +216 -0
- package/src/components/Checkbox/Checkbox.dsds.yaml +215 -0
- package/src/components/Collapsible/Collapsible.dsds.yaml +146 -0
- package/src/components/Combobox/Combobox.dsds.yaml +241 -0
- package/src/components/DatePicker/DatePicker.dsds.yaml +179 -0
- package/src/components/Dialog/Dialog.dsds.yaml +300 -0
- package/src/components/Drawer/Drawer.dsds.yaml +207 -0
- package/src/components/DropdownMenu/DropdownMenu.dsds.yaml +265 -0
- package/src/components/Empty/Empty.dsds.yaml +171 -0
- package/src/components/Field/Field.dsds.yaml +285 -0
- package/src/components/FundCard/FundCard.dsds.yaml +195 -0
- package/src/components/FundCard/FundCard.md +2 -2
- package/src/components/HoverCard/HoverCard.dsds.yaml +157 -0
- package/src/components/Input/Input.dsds.yaml +235 -0
- package/src/components/InputGroup/InputGroup.dsds.yaml +234 -0
- package/src/components/InputOTP/InputOTP.dsds.yaml +184 -0
- package/src/components/Kbd/Kbd.dsds.yaml +119 -0
- package/src/components/Label/Label.dsds.yaml +141 -0
- package/src/components/NavigationMenu/NavigationMenu.dsds.yaml +196 -0
- package/src/components/Pagination/Pagination.dsds.yaml +172 -0
- package/src/components/Popover/Popover.dsds.yaml +168 -0
- package/src/components/Progress/Progress.dsds.yaml +169 -0
- package/src/components/RadioGroup/RadioGroup.dsds.yaml +215 -0
- package/src/components/ScrollArea/ScrollArea.dsds.yaml +153 -0
- package/src/components/Select/Select.dsds.yaml +239 -0
- package/src/components/Separator/Separator.dsds.yaml +121 -0
- package/src/components/Skeleton/Skeleton.dsds.yaml +124 -0
- package/src/components/Slider/Slider.dsds.yaml +194 -0
- package/src/components/Spinner/Spinner.dsds.yaml +126 -0
- package/src/components/Switch/Switch.dsds.yaml +198 -0
- package/src/components/Table/Table.dsds.yaml +195 -0
- package/src/components/Tabs/Tabs.dsds.yaml +239 -0
- package/src/components/Textarea/Textarea.dsds.yaml +167 -0
- package/src/components/Toaster/Toaster.dsds.yaml +226 -0
- package/src/components/Toggle/Toggle.dsds.yaml +224 -0
- package/src/components/ToggleGroup/ToggleGroup.dsds.yaml +230 -0
- package/src/components/Tooltip/Tooltip.dsds.yaml +202 -0
- package/src/index.dsds.yaml +467 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
# Context layer for @designil/labdsnov, in the Design System Doc Spec (DSDS)
|
|
2
|
+
# 0.23.2 format: https://designsystemdocspec.org
|
|
3
|
+
#
|
|
4
|
+
# This base document holds the system entry, the rules every component shares
|
|
5
|
+
# (`shared`), and a `rel: file` ref to each component's own
|
|
6
|
+
# `components/<Name>/<Name>.dsds.yaml`. Check it with `pnpm dsds:check`.
|
|
7
|
+
#
|
|
8
|
+
# The `.md` usage doc beside each component is the page people read (in Thai).
|
|
9
|
+
# The `.dsds.yaml` is the same knowledge as structured, checkable rules for
|
|
10
|
+
# agents and tools, in English: a level for every rule, why it holds, what
|
|
11
|
+
# backs it up (WCAG, a contrast ratio from `pnpm tokens:check`), what verifies
|
|
12
|
+
# it (a story's play function, a script) and what to use instead. Real UI copy
|
|
13
|
+
# stays in Thai, in quotes. Token values are never copied here: they live in
|
|
14
|
+
# `styles/theme.css`.
|
|
15
|
+
$schema: https://designsystemdocspec.org/v0.23.2/dsds.bundled.yaml
|
|
16
|
+
schemaVersion: "0.23.2"
|
|
17
|
+
|
|
18
|
+
name: labdsnov
|
|
19
|
+
|
|
20
|
+
entries:
|
|
21
|
+
- kind: system
|
|
22
|
+
id: labdsnov
|
|
23
|
+
name: labdsnov
|
|
24
|
+
description: >-
|
|
25
|
+
The Thai-language design system of the labdsnovweek1 member portal (a superannuation
|
|
26
|
+
fund portal). Built on shadcn/ui's base-luma style, wrapping Base UI
|
|
27
|
+
(`@base-ui/react`) and styled with Tailwind CSS v4 through CSS modules.
|
|
28
|
+
Shipped as the npm package `@designil/labdsnov` (React 19).
|
|
29
|
+
metadata:
|
|
30
|
+
status: {status: stable}
|
|
31
|
+
tags: [design-system, react, thai]
|
|
32
|
+
organization: Designil
|
|
33
|
+
url: https://github.com/dxnat/labdsnov
|
|
34
|
+
version: 1.0.0
|
|
35
|
+
platforms: [react]
|
|
36
|
+
license: MIT
|
|
37
|
+
sections:
|
|
38
|
+
- kind: guidelines
|
|
39
|
+
for: all
|
|
40
|
+
title: App setup
|
|
41
|
+
items:
|
|
42
|
+
- id: import-styles-once
|
|
43
|
+
level: must
|
|
44
|
+
statement: >-
|
|
45
|
+
Import `@designil/labdsnov/styles.css` once in the root layout, before the
|
|
46
|
+
app's own styles. It contains the tokens, preflight and component styles,
|
|
47
|
+
but no Tailwind utilities: the app must generate its own.
|
|
48
|
+
checkedBy: manual
|
|
49
|
+
- id: set-font-heading
|
|
50
|
+
level: must
|
|
51
|
+
statement: >-
|
|
52
|
+
Set `--font-heading` (the app uses IBM Plex Sans Thai via `next/font`).
|
|
53
|
+
Without it, the titles of Card, Dialog, AlertDialog, Drawer and Empty fall
|
|
54
|
+
back to the system font.
|
|
55
|
+
checkedBy: manual
|
|
56
|
+
- id: dark-class-on-html
|
|
57
|
+
level: must
|
|
58
|
+
statement: >-
|
|
59
|
+
Switch to dark mode with the `dark` class on `<html>` (the system's `dark`
|
|
60
|
+
variant is `&:is(.dark *)` and ignores `prefers-color-scheme`). With
|
|
61
|
+
`next-themes`, set `attribute="class"`. Toaster reads this class itself,
|
|
62
|
+
with no extra setup.
|
|
63
|
+
checkedBy: manual
|
|
64
|
+
- id: html-lang-th
|
|
65
|
+
level: must
|
|
66
|
+
statement: >-
|
|
67
|
+
Put `lang="th"` on `<html>` so screen readers read the page as Thai.
|
|
68
|
+
evidence:
|
|
69
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/language-of-page.html
|
|
70
|
+
role: WCAG 2.2 SC 3.1.1 (A)
|
|
71
|
+
checkedBy: manual
|
|
72
|
+
- id: mount-providers-once
|
|
73
|
+
level: must
|
|
74
|
+
statement: >-
|
|
75
|
+
Apps that use toasts mount `<Toaster />`, and apps that use tooltips wrap
|
|
76
|
+
the tree in `<TooltipProvider>`, once near the root, never again per page.
|
|
77
|
+
checkedBy: manual
|
|
78
|
+
uses:
|
|
79
|
+
- to: toaster
|
|
80
|
+
- to: tooltip
|
|
81
|
+
- id: read-the-entry-first
|
|
82
|
+
level: should
|
|
83
|
+
statement: >-
|
|
84
|
+
Before using or changing a component, read its entry here and the
|
|
85
|
+
`<Name>.md` beside it. Items marked TODO are decisions the team hasn't
|
|
86
|
+
made yet: ask, don't guess.
|
|
87
|
+
checkedBy: manual
|
|
88
|
+
refs:
|
|
89
|
+
- href: ../docs/GettingStarted.md
|
|
90
|
+
rel: relates-to
|
|
91
|
+
role: Full app setup (Thai)
|
|
92
|
+
- href: ../docs/Accessibility.md
|
|
93
|
+
rel: relates-to
|
|
94
|
+
role: The WCAG AA bar and the contrast ratio of every checked colour pair
|
|
95
|
+
- href: ./styles/theme.css
|
|
96
|
+
rel: source
|
|
97
|
+
role: Every token's value, light and dark
|
|
98
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov
|
|
99
|
+
rel: design
|
|
100
|
+
role: The system's Figma file
|
|
101
|
+
- href: npm:@designil/labdsnov
|
|
102
|
+
rel: source
|
|
103
|
+
|
|
104
|
+
shared:
|
|
105
|
+
- id: shared-a11y
|
|
106
|
+
name: Shared accessibility rules
|
|
107
|
+
description: >-
|
|
108
|
+
WCAG 2.2 AA rules every component must pass in both light and dark mode.
|
|
109
|
+
Written once here; components point at them with `same-as`.
|
|
110
|
+
sections:
|
|
111
|
+
- kind: guidelines
|
|
112
|
+
for: all
|
|
113
|
+
tags: [accessibility]
|
|
114
|
+
items:
|
|
115
|
+
- id: text-contrast
|
|
116
|
+
level: must
|
|
117
|
+
statement: >-
|
|
118
|
+
All text (including placeholders, text on tinted backgrounds and hover
|
|
119
|
+
states) has at least 4.5:1 contrast against the actual background it sits
|
|
120
|
+
on, in both modes.
|
|
121
|
+
evidence:
|
|
122
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html
|
|
123
|
+
role: WCAG 2.2 SC 1.4.3 (AA)
|
|
124
|
+
checks:
|
|
125
|
+
- href: ../scripts/tokens.mjs
|
|
126
|
+
role: test
|
|
127
|
+
note: "`pnpm tokens:check` computes every pair in CONTRAST_PAIRS, compositing translucent colours and color-mix over the real background. Runs in CI."
|
|
128
|
+
checkedBy: automated
|
|
129
|
+
tags: [accessibility, contrast]
|
|
130
|
+
- id: non-text-contrast
|
|
131
|
+
level: must
|
|
132
|
+
statement: >-
|
|
133
|
+
Field and control edges, focus rings, checked/on states, meaningful icons
|
|
134
|
+
and chart series have at least 3:1 contrast against what's next to them.
|
|
135
|
+
Decorative lines (Card edges, Separator) and disabled states are exempt.
|
|
136
|
+
evidence:
|
|
137
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
|
|
138
|
+
role: WCAG 2.2 SC 1.4.11 (AA)
|
|
139
|
+
checks:
|
|
140
|
+
- href: ../scripts/tokens.mjs
|
|
141
|
+
role: test
|
|
142
|
+
note: "`pnpm tokens:check`"
|
|
143
|
+
checkedBy: automated
|
|
144
|
+
tags: [accessibility, contrast]
|
|
145
|
+
- id: new-pair-needs-check
|
|
146
|
+
level: must
|
|
147
|
+
statement: >-
|
|
148
|
+
A new token that puts text or an edge on a background that hasn't been
|
|
149
|
+
checked yet must add that pair to `CONTRAST_PAIRS` in `scripts/tokens.mjs`,
|
|
150
|
+
then run `pnpm tokens:docs`. Otherwise `tokens:check` passes without ever
|
|
151
|
+
checking the new pair.
|
|
152
|
+
checkedBy: manual
|
|
153
|
+
tags: [accessibility, contrast, tokens]
|
|
154
|
+
- id: app-colours-same-bar
|
|
155
|
+
level: must
|
|
156
|
+
statement: >-
|
|
157
|
+
Colours the app sets itself, through `className` or a token override, must
|
|
158
|
+
meet the same bar. `tokens:check` only sees the values in `theme.css`, not
|
|
159
|
+
the app's colours.
|
|
160
|
+
checkedBy: manual
|
|
161
|
+
tags: [accessibility, contrast]
|
|
162
|
+
- id: focus-ring
|
|
163
|
+
level: must
|
|
164
|
+
statement: >-
|
|
165
|
+
Everything focusable shows a solid 2px border and ring in `--focus-ring` on
|
|
166
|
+
keyboard focus, including the `destructive` variant (7.40:1 on light,
|
|
167
|
+
10.52:1 on dark). Not shadcn's faint halo.
|
|
168
|
+
evidence:
|
|
169
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html
|
|
170
|
+
role: WCAG 2.2 SC 2.4.7 (AA)
|
|
171
|
+
checkedBy: assisted
|
|
172
|
+
tags: [accessibility, focus]
|
|
173
|
+
- id: invalid-has-message
|
|
174
|
+
level: must
|
|
175
|
+
statement: >-
|
|
176
|
+
An invalid field gets `aria-invalid` (red border `--invalid-border` and a
|
|
177
|
+
faint red ring `--invalid-ring`) and always a message under it saying what
|
|
178
|
+
is wrong, in `FieldError`, tied to the field through `aria-describedby`.
|
|
179
|
+
Red alone is not enough.
|
|
180
|
+
evidence:
|
|
181
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/error-identification.html
|
|
182
|
+
role: WCAG 2.2 SC 3.3.1 (A)
|
|
183
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html
|
|
184
|
+
role: WCAG 2.2 SC 1.4.1 (A)
|
|
185
|
+
checkedBy: manual
|
|
186
|
+
tags: [accessibility, forms]
|
|
187
|
+
uses:
|
|
188
|
+
- to: field
|
|
189
|
+
- id: invalid-keeps-focus
|
|
190
|
+
level: must
|
|
191
|
+
statement: >-
|
|
192
|
+
A focused invalid field switches its ring to solid red (`--invalid-border`)
|
|
193
|
+
so focus is still visible. Never let the faint invalid ring stand in for
|
|
194
|
+
the focus ring.
|
|
195
|
+
evidence:
|
|
196
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html
|
|
197
|
+
role: WCAG 2.2 SC 2.4.7 (AA)
|
|
198
|
+
checkedBy: assisted
|
|
199
|
+
tags: [accessibility, focus, forms]
|
|
200
|
+
- id: icon-only-label
|
|
201
|
+
level: must
|
|
202
|
+
statement: >-
|
|
203
|
+
An icon-only button or control needs a Thai `aria-label` naming the action
|
|
204
|
+
(e.g. "ตั้งค่า" settings, "ปิด" close); the icon inside is decoration.
|
|
205
|
+
evidence:
|
|
206
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html
|
|
207
|
+
role: WCAG 2.2 SC 4.1.2 (A)
|
|
208
|
+
checkedBy: assisted
|
|
209
|
+
tags: [accessibility, naming]
|
|
210
|
+
- id: target-size
|
|
211
|
+
level: must
|
|
212
|
+
statement: >-
|
|
213
|
+
Controls have a hit area of at least 24×24px. Checkbox, Radio and Switch
|
|
214
|
+
already extend their hit area beyond what's visible. Buttons at `xs` /
|
|
215
|
+
`icon-xs` are exactly 24px tall, so never place them flush against each
|
|
216
|
+
other without spacing.
|
|
217
|
+
evidence:
|
|
218
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html
|
|
219
|
+
role: WCAG 2.2 SC 2.5.8 (AA)
|
|
220
|
+
checkedBy: manual
|
|
221
|
+
tags: [accessibility, target-size]
|
|
222
|
+
- id: no-focus-ring-override
|
|
223
|
+
level: must-not
|
|
224
|
+
statement: >-
|
|
225
|
+
Never hide the focus ring with `outline-none`, `ring-0` or
|
|
226
|
+
`focus-visible:ring-0` in `className`: `className` always wins over the
|
|
227
|
+
component's styles.
|
|
228
|
+
evidence:
|
|
229
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html
|
|
230
|
+
role: WCAG 2.2 SC 2.4.7 (AA)
|
|
231
|
+
checkedBy: assisted
|
|
232
|
+
tags: [accessibility, focus]
|
|
233
|
+
|
|
234
|
+
- id: shared-content
|
|
235
|
+
name: Shared content rules
|
|
236
|
+
description: Language, dates and numbers that every component handles the same way.
|
|
237
|
+
sections:
|
|
238
|
+
- kind: guidelines
|
|
239
|
+
for: all
|
|
240
|
+
items:
|
|
241
|
+
- id: thai-copy
|
|
242
|
+
level: must
|
|
243
|
+
statement: >-
|
|
244
|
+
Everything the user sees or hears is in Thai, including `aria-label`,
|
|
245
|
+
button text and copy the components supply themselves (e.g. the close
|
|
246
|
+
button "ปิด", "หน้าก่อนหน้า" previous page, "ไม่พบผลลัพธ์" no results).
|
|
247
|
+
checkedBy: manual
|
|
248
|
+
tags: [content, language]
|
|
249
|
+
- id: buddhist-year
|
|
250
|
+
level: must
|
|
251
|
+
statement: >-
|
|
252
|
+
Dates are shown in Thai with the Buddhist Era year, using `Intl` with the
|
|
253
|
+
`th-TH` locale, e.g. "13 พ.ย. 2569". Never format them with `date-fns`'s
|
|
254
|
+
`th` locale: it gives the Gregorian year.
|
|
255
|
+
evidence:
|
|
256
|
+
- href: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
257
|
+
role: MDN Intl.DateTimeFormat
|
|
258
|
+
checkedBy: manual
|
|
259
|
+
tags: [content, dates]
|
|
260
|
+
- id: actions-are-verbs
|
|
261
|
+
level: should
|
|
262
|
+
statement: >-
|
|
263
|
+
Button text is a specific verb, e.g. "บันทึก" (save), "ลบ" (delete),
|
|
264
|
+
"เปลี่ยนแผน" (change plan). Avoid "ตกลง" (OK), "ใช่/ไม่" (yes/no) and
|
|
265
|
+
"ส่ง" (send), which don't say what will happen.
|
|
266
|
+
checkedBy: manual
|
|
267
|
+
refs:
|
|
268
|
+
- href: ./components/Dialog/Dialog.md
|
|
269
|
+
rel: relates-to
|
|
270
|
+
role: Where the rule comes from (Dialog's content rules)
|
|
271
|
+
|
|
272
|
+
- id: shared-composition
|
|
273
|
+
name: Shared composition rules
|
|
274
|
+
description: How Base UI components are composed in this system, which differs from shadcn's Radix version.
|
|
275
|
+
sections:
|
|
276
|
+
- kind: guidelines
|
|
277
|
+
for: all
|
|
278
|
+
items:
|
|
279
|
+
- id: render-prop
|
|
280
|
+
level: must
|
|
281
|
+
statement: >-
|
|
282
|
+
Make another element act as a trigger or close button with the `render`
|
|
283
|
+
prop, e.g. `<DialogTrigger render={<Button variant="outline" />}>`. Never use
|
|
284
|
+
`asChild`: it's a Radix API that Base UI doesn't have.
|
|
285
|
+
checkedBy: assisted
|
|
286
|
+
tags: [composition]
|
|
287
|
+
- id: link-looks-like-button
|
|
288
|
+
level: must
|
|
289
|
+
statement: >-
|
|
290
|
+
A link to another page that must look like a button is an `<a>` (or
|
|
291
|
+
Next.js `Link`) with `className={buttonVariants({ … })}`. Never use
|
|
292
|
+
`Button render={<a />}`: Base UI gives non-`<button>` elements
|
|
293
|
+
`role="button"`, so screen readers stop calling it a link.
|
|
294
|
+
evidence:
|
|
295
|
+
- href: https://www.w3.org/WAI/ARIA/apg/patterns/link/
|
|
296
|
+
role: WAI-ARIA APG Link pattern
|
|
297
|
+
checkedBy: assisted
|
|
298
|
+
tags: [composition, accessibility]
|
|
299
|
+
uses:
|
|
300
|
+
- to: button
|
|
301
|
+
- id: classname-one-off
|
|
302
|
+
level: should
|
|
303
|
+
statement: >-
|
|
304
|
+
Use `className` for a one-off visual tweak. It always wins over the
|
|
305
|
+
component's styles, because those sit in `@layer components`. If the same
|
|
306
|
+
look is needed again, ask for a new variant instead of copying classes.
|
|
307
|
+
checkedBy: manual
|
|
308
|
+
tags: [composition]
|
|
309
|
+
- id: hugeicons-only
|
|
310
|
+
level: should
|
|
311
|
+
statement: >-
|
|
312
|
+
Icons are Hugeicons (`@hugeicons/react` with `@hugeicons/core-free-icons`,
|
|
313
|
+
`strokeWidth={2}`), not lucide, which is shadcn's default.
|
|
314
|
+
checkedBy: assisted
|
|
315
|
+
tags: [composition, icons]
|
|
316
|
+
- id: no-next-imports
|
|
317
|
+
level: must-not
|
|
318
|
+
statement: >-
|
|
319
|
+
Library code must never import `next/*`. The root entry re-exports every
|
|
320
|
+
component, so one such import breaks the build of every non-Next app
|
|
321
|
+
(which is why FundCard uses a plain `<img>`). Apps using the library may
|
|
322
|
+
import `next/link` themselves.
|
|
323
|
+
checkedBy: manual
|
|
324
|
+
tags: [composition, build]
|
|
325
|
+
|
|
326
|
+
- id: shared-testing
|
|
327
|
+
name: Story and play function rules
|
|
328
|
+
description: >-
|
|
329
|
+
Traps that made play functions fail even though the component was correct,
|
|
330
|
+
for agents writing stories in `packages/ui`.
|
|
331
|
+
sections:
|
|
332
|
+
- kind: guidelines
|
|
333
|
+
for: agent
|
|
334
|
+
items:
|
|
335
|
+
- id: assert-by-state
|
|
336
|
+
level: must
|
|
337
|
+
statement: >-
|
|
338
|
+
Check that a popup (Dialog, Popover, Select, DropdownMenu, Tooltip, toast)
|
|
339
|
+
is open or closed by state (`data-open` / `data-closed`, the trigger's
|
|
340
|
+
`aria-expanded`) or by presence in the DOM. Never use `toBeVisible()`:
|
|
341
|
+
popups animate, and animations pause while the page is in the background.
|
|
342
|
+
checkedBy: manual
|
|
343
|
+
tags: [testing]
|
|
344
|
+
- id: query-portal-with-screen
|
|
345
|
+
level: must
|
|
346
|
+
statement: >-
|
|
347
|
+
Popups are portalled to `document.body`: query them with `screen`, not
|
|
348
|
+
`canvas`.
|
|
349
|
+
checkedBy: manual
|
|
350
|
+
tags: [testing]
|
|
351
|
+
- id: fire-change-for-typing
|
|
352
|
+
level: must
|
|
353
|
+
statement: >-
|
|
354
|
+
Check `onChange` of Input, Textarea, InputGroup, Combobox (filtering) and
|
|
355
|
+
InputOTP with `fireEvent.change(el, { target: { value } })`.
|
|
356
|
+
`userEvent.type` changes the value but never calls React's `onChange`.
|
|
357
|
+
checkedBy: manual
|
|
358
|
+
tags: [testing]
|
|
359
|
+
- id: modal-stories-not-autodocs
|
|
360
|
+
level: must
|
|
361
|
+
statement: >-
|
|
362
|
+
A story that opens a modal with `defaultOpen` needs `tags: ["!autodocs"]`,
|
|
363
|
+
or the modal covers the Docs page.
|
|
364
|
+
checkedBy: manual
|
|
365
|
+
tags: [testing]
|
|
366
|
+
- id: disabled-check-by-attribute
|
|
367
|
+
level: must-not
|
|
368
|
+
statement: >-
|
|
369
|
+
Never `userEvent.click` a disabled control: the disabled style sets
|
|
370
|
+
`pointer-events: none`, so the call throws instead of doing nothing. Check
|
|
371
|
+
by keyboard, `aria-disabled` or computed style.
|
|
372
|
+
checkedBy: manual
|
|
373
|
+
tags: [testing]
|
|
374
|
+
|
|
375
|
+
refs:
|
|
376
|
+
- href: ./components/Accordion/Accordion.dsds.yaml
|
|
377
|
+
rel: file
|
|
378
|
+
- href: ./components/Alert/Alert.dsds.yaml
|
|
379
|
+
rel: file
|
|
380
|
+
- href: ./components/AlertDialog/AlertDialog.dsds.yaml
|
|
381
|
+
rel: file
|
|
382
|
+
- href: ./components/Avatar/Avatar.dsds.yaml
|
|
383
|
+
rel: file
|
|
384
|
+
- href: ./components/Badge/Badge.dsds.yaml
|
|
385
|
+
rel: file
|
|
386
|
+
- href: ./components/Breadcrumb/Breadcrumb.dsds.yaml
|
|
387
|
+
rel: file
|
|
388
|
+
- href: ./components/Button/Button.dsds.yaml
|
|
389
|
+
rel: file
|
|
390
|
+
- href: ./components/ButtonGroup/ButtonGroup.dsds.yaml
|
|
391
|
+
rel: file
|
|
392
|
+
- href: ./components/Calendar/Calendar.dsds.yaml
|
|
393
|
+
rel: file
|
|
394
|
+
- href: ./components/Card/Card.dsds.yaml
|
|
395
|
+
rel: file
|
|
396
|
+
- href: ./components/Chart/Chart.dsds.yaml
|
|
397
|
+
rel: file
|
|
398
|
+
- href: ./components/Checkbox/Checkbox.dsds.yaml
|
|
399
|
+
rel: file
|
|
400
|
+
- href: ./components/Collapsible/Collapsible.dsds.yaml
|
|
401
|
+
rel: file
|
|
402
|
+
- href: ./components/Combobox/Combobox.dsds.yaml
|
|
403
|
+
rel: file
|
|
404
|
+
- href: ./components/DatePicker/DatePicker.dsds.yaml
|
|
405
|
+
rel: file
|
|
406
|
+
- href: ./components/Dialog/Dialog.dsds.yaml
|
|
407
|
+
rel: file
|
|
408
|
+
- href: ./components/Drawer/Drawer.dsds.yaml
|
|
409
|
+
rel: file
|
|
410
|
+
- href: ./components/DropdownMenu/DropdownMenu.dsds.yaml
|
|
411
|
+
rel: file
|
|
412
|
+
- href: ./components/Empty/Empty.dsds.yaml
|
|
413
|
+
rel: file
|
|
414
|
+
- href: ./components/Field/Field.dsds.yaml
|
|
415
|
+
rel: file
|
|
416
|
+
- href: ./components/FundCard/FundCard.dsds.yaml
|
|
417
|
+
rel: file
|
|
418
|
+
- href: ./components/HoverCard/HoverCard.dsds.yaml
|
|
419
|
+
rel: file
|
|
420
|
+
- href: ./components/Input/Input.dsds.yaml
|
|
421
|
+
rel: file
|
|
422
|
+
- href: ./components/InputGroup/InputGroup.dsds.yaml
|
|
423
|
+
rel: file
|
|
424
|
+
- href: ./components/InputOTP/InputOTP.dsds.yaml
|
|
425
|
+
rel: file
|
|
426
|
+
- href: ./components/Kbd/Kbd.dsds.yaml
|
|
427
|
+
rel: file
|
|
428
|
+
- href: ./components/Label/Label.dsds.yaml
|
|
429
|
+
rel: file
|
|
430
|
+
- href: ./components/NavigationMenu/NavigationMenu.dsds.yaml
|
|
431
|
+
rel: file
|
|
432
|
+
- href: ./components/Pagination/Pagination.dsds.yaml
|
|
433
|
+
rel: file
|
|
434
|
+
- href: ./components/Popover/Popover.dsds.yaml
|
|
435
|
+
rel: file
|
|
436
|
+
- href: ./components/Progress/Progress.dsds.yaml
|
|
437
|
+
rel: file
|
|
438
|
+
- href: ./components/RadioGroup/RadioGroup.dsds.yaml
|
|
439
|
+
rel: file
|
|
440
|
+
- href: ./components/ScrollArea/ScrollArea.dsds.yaml
|
|
441
|
+
rel: file
|
|
442
|
+
- href: ./components/Select/Select.dsds.yaml
|
|
443
|
+
rel: file
|
|
444
|
+
- href: ./components/Separator/Separator.dsds.yaml
|
|
445
|
+
rel: file
|
|
446
|
+
- href: ./components/Skeleton/Skeleton.dsds.yaml
|
|
447
|
+
rel: file
|
|
448
|
+
- href: ./components/Slider/Slider.dsds.yaml
|
|
449
|
+
rel: file
|
|
450
|
+
- href: ./components/Spinner/Spinner.dsds.yaml
|
|
451
|
+
rel: file
|
|
452
|
+
- href: ./components/Switch/Switch.dsds.yaml
|
|
453
|
+
rel: file
|
|
454
|
+
- href: ./components/Table/Table.dsds.yaml
|
|
455
|
+
rel: file
|
|
456
|
+
- href: ./components/Tabs/Tabs.dsds.yaml
|
|
457
|
+
rel: file
|
|
458
|
+
- href: ./components/Textarea/Textarea.dsds.yaml
|
|
459
|
+
rel: file
|
|
460
|
+
- href: ./components/Toaster/Toaster.dsds.yaml
|
|
461
|
+
rel: file
|
|
462
|
+
- href: ./components/Toggle/Toggle.dsds.yaml
|
|
463
|
+
rel: file
|
|
464
|
+
- href: ./components/ToggleGroup/ToggleGroup.dsds.yaml
|
|
465
|
+
rel: file
|
|
466
|
+
- href: ./components/Tooltip/Tooltip.dsds.yaml
|
|
467
|
+
rel: file
|