@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,126 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: spinner
|
|
3
|
+
name: Spinner
|
|
4
|
+
description: >-
|
|
5
|
+
A spinning icon saying the result of an action is pending. 16px by default, takes
|
|
6
|
+
the surrounding text colour, has `role="status"` and the name "กำลังโหลด" (loading).
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [feedback]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use in a button whose result must be waited for, e.g. save, submit a request.
|
|
20
|
+
example:
|
|
21
|
+
ref:
|
|
22
|
+
href: ./Spinner.stories.tsx#InButton
|
|
23
|
+
rel: demo
|
|
24
|
+
- level: may
|
|
25
|
+
statement: >-
|
|
26
|
+
Use in small areas that are loading, e.g. inside a status badge.
|
|
27
|
+
- level: should-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't use for content of known shape that is loading (cards, tables). Use
|
|
30
|
+
<dsds:skeleton>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: skeleton
|
|
33
|
+
- level: should-not
|
|
34
|
+
statement: >-
|
|
35
|
+
Don't use for work with known progress (upload). Use <dsds:progress>.
|
|
36
|
+
alternatives:
|
|
37
|
+
- to: progress
|
|
38
|
+
- level: must-not
|
|
39
|
+
statement: >-
|
|
40
|
+
Never put a lone Spinner in the middle of the page with no text. Add text saying
|
|
41
|
+
what is happening.
|
|
42
|
+
checkedBy: manual
|
|
43
|
+
|
|
44
|
+
- kind: guidelines
|
|
45
|
+
for: all
|
|
46
|
+
items:
|
|
47
|
+
- id: button-pattern
|
|
48
|
+
level: must
|
|
49
|
+
statement: >-
|
|
50
|
+
A pending button: set `disabled` on the <dsds:button>, put
|
|
51
|
+
`<Spinner data-icon="inline-start" />` before the text, and change the text to
|
|
52
|
+
"กำลัง…" (…ing), e.g. "กำลังบันทึก…" (saving…). Button has no `loading` prop yet,
|
|
53
|
+
so assemble it yourself.
|
|
54
|
+
uses:
|
|
55
|
+
- to: button
|
|
56
|
+
checks:
|
|
57
|
+
- href: ./Spinner.stories.tsx#InButton
|
|
58
|
+
role: test
|
|
59
|
+
checkedBy: assisted
|
|
60
|
+
- id: inherit-colour
|
|
61
|
+
level: should
|
|
62
|
+
statement: >-
|
|
63
|
+
Don't set the Spinner's colour; it follows the surrounding text. Change the size
|
|
64
|
+
with `className` (`size-6`).
|
|
65
|
+
checkedBy: manual
|
|
66
|
+
- id: keep-width
|
|
67
|
+
level: should
|
|
68
|
+
statement: >-
|
|
69
|
+
A button switching to its pending state shouldn't change width much. Use
|
|
70
|
+
"กำลัง…" text of similar length or set a minimum width.
|
|
71
|
+
checkedBy: manual
|
|
72
|
+
|
|
73
|
+
- kind: guidelines
|
|
74
|
+
for: all
|
|
75
|
+
title: Accessibility
|
|
76
|
+
tags: [accessibility]
|
|
77
|
+
items:
|
|
78
|
+
- id: status-name
|
|
79
|
+
level: must
|
|
80
|
+
statement: >-
|
|
81
|
+
Spinner has `role="status"` and the name "กำลังโหลด". Override it with a Thai
|
|
82
|
+
`aria-label` saying what is happening ("กำลังบันทึก" (saving)).
|
|
83
|
+
evidence:
|
|
84
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html
|
|
85
|
+
role: WCAG 2.2 SC 4.1.3 (AA)
|
|
86
|
+
checks:
|
|
87
|
+
- href: ./Spinner.stories.tsx#Playground
|
|
88
|
+
role: test
|
|
89
|
+
note: play function finds role status named "กำลังโหลด"
|
|
90
|
+
checkedBy: automated
|
|
91
|
+
- id: no-double-announce
|
|
92
|
+
level: should
|
|
93
|
+
statement: >-
|
|
94
|
+
In a button whose text already changed to "กำลังบันทึก…", don't also set an
|
|
95
|
+
`aria-label` with the same meaning.
|
|
96
|
+
checkedBy: manual
|
|
97
|
+
|
|
98
|
+
- kind: section
|
|
99
|
+
for: all
|
|
100
|
+
title: Open decisions
|
|
101
|
+
freeform:
|
|
102
|
+
- title: TODO
|
|
103
|
+
body: >-
|
|
104
|
+
Button has no `loading` prop that adds a Spinner and disables it automatically.
|
|
105
|
+
|
|
106
|
+
sourceFiles:
|
|
107
|
+
- platform: react
|
|
108
|
+
file: ./Spinner.tsx
|
|
109
|
+
|
|
110
|
+
imports:
|
|
111
|
+
- platform: react
|
|
112
|
+
code: >-
|
|
113
|
+
import { Spinner } from "@designil/labdsnov"
|
|
114
|
+
package: "@designil/labdsnov"
|
|
115
|
+
|
|
116
|
+
alternatives:
|
|
117
|
+
- to: skeleton
|
|
118
|
+
- to: progress
|
|
119
|
+
|
|
120
|
+
refs:
|
|
121
|
+
- href: ./Spinner.md
|
|
122
|
+
rel: relates-to
|
|
123
|
+
role: Thai usage doc
|
|
124
|
+
- href: ./Spinner.stories.tsx
|
|
125
|
+
rel: demo
|
|
126
|
+
role: CSF stories
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: switch
|
|
3
|
+
name: Switch
|
|
4
|
+
description: >-
|
|
5
|
+
An on/off switch for a setting that takes effect immediately. Dark grey track when
|
|
6
|
+
off, primary (orange) when on. Wraps Base UI `Switch`.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [form, selection]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use for settings that take effect as soon as they're switched, with no save
|
|
20
|
+
button, e.g. notifications, receiving documents by email.
|
|
21
|
+
- level: must-not
|
|
22
|
+
statement: >-
|
|
23
|
+
Never use for a form value that applies on submit (e.g. accepting terms). Use
|
|
24
|
+
<dsds:checkbox>.
|
|
25
|
+
alternatives:
|
|
26
|
+
- to: checkbox
|
|
27
|
+
checkedBy: manual
|
|
28
|
+
- level: must-not
|
|
29
|
+
statement: >-
|
|
30
|
+
Never use to pick one of several options. Use <dsds:radio-group>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: radio-group
|
|
33
|
+
checkedBy: manual
|
|
34
|
+
- level: should-not
|
|
35
|
+
statement: >-
|
|
36
|
+
Don't use as an on/off display option in a toolbar (e.g. bold). Use
|
|
37
|
+
<dsds:toggle>.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: toggle
|
|
40
|
+
|
|
41
|
+
- kind: guidelines
|
|
42
|
+
for: all
|
|
43
|
+
items:
|
|
44
|
+
- id: label-describes-on
|
|
45
|
+
level: must
|
|
46
|
+
statement: >-
|
|
47
|
+
The label says what is on when the switch is on ("รับใบแจ้งยอดทางอีเมล"
|
|
48
|
+
(receive statements by email)). The label doesn't change with the state and
|
|
49
|
+
doesn't say "on/off".
|
|
50
|
+
checkedBy: manual
|
|
51
|
+
- id: label-bound
|
|
52
|
+
level: must
|
|
53
|
+
statement: >-
|
|
54
|
+
Tie a <dsds:label> with `id` / `htmlFor` so clicking the text toggles it. In
|
|
55
|
+
settings forms use `Field orientation="horizontal"` or `responsive`.
|
|
56
|
+
checks:
|
|
57
|
+
- href: ./Switch.stories.tsx#Toggle
|
|
58
|
+
role: test
|
|
59
|
+
note: play function clicks the switch and the label text and checks it toggles
|
|
60
|
+
uses:
|
|
61
|
+
- to: label
|
|
62
|
+
- to: field
|
|
63
|
+
checkedBy: automated
|
|
64
|
+
- id: save-immediately
|
|
65
|
+
level: must
|
|
66
|
+
statement: >-
|
|
67
|
+
Save immediately in `onCheckedChange`. If saving fails, put the switch back and
|
|
68
|
+
tell the user (how isn't defined yet, see Open decisions).
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: size-default
|
|
71
|
+
level: should
|
|
72
|
+
statement: >-
|
|
73
|
+
Use `size="default"` (44×20px track). `sm` (28×16px) has no defined use yet.
|
|
74
|
+
checkedBy: manual
|
|
75
|
+
|
|
76
|
+
- kind: guidelines
|
|
77
|
+
for: all
|
|
78
|
+
title: Accessibility
|
|
79
|
+
tags: [accessibility]
|
|
80
|
+
items:
|
|
81
|
+
- id: space-toggles
|
|
82
|
+
level: must
|
|
83
|
+
statement: >-
|
|
84
|
+
Tab to the switch and press Space to toggle (`role="switch"`, `aria-checked`).
|
|
85
|
+
evidence:
|
|
86
|
+
- href: https://www.w3.org/WAI/ARIA/apg/patterns/switch/
|
|
87
|
+
role: WAI-ARIA APG Switch pattern
|
|
88
|
+
checks:
|
|
89
|
+
- href: ./Switch.stories.tsx#Toggle
|
|
90
|
+
role: test
|
|
91
|
+
checkedBy: automated
|
|
92
|
+
- id: track-contrast
|
|
93
|
+
level: must
|
|
94
|
+
statement: >-
|
|
95
|
+
The off track (`--switch-track`) passes 3.93:1 / 4.05:1, the off thumb
|
|
96
|
+
3.93:1 / 4.68:1 and the on thumb 4.93:1 / 6.46:1 (light / dark). Never change the
|
|
97
|
+
off track to a light grey (`--muted`).
|
|
98
|
+
refines:
|
|
99
|
+
- to: shared-a11y#non-text-contrast
|
|
100
|
+
checks:
|
|
101
|
+
- href: ../../../scripts/tokens.mjs
|
|
102
|
+
role: test
|
|
103
|
+
note: CONTRAST_PAIRS "ราง Switch …" and "ปุ่มเลื่อน Switch …"
|
|
104
|
+
checkedBy: automated
|
|
105
|
+
- refs:
|
|
106
|
+
- to: shared-a11y#target-size
|
|
107
|
+
rel: same-as
|
|
108
|
+
|
|
109
|
+
- kind: definitions
|
|
110
|
+
for: all
|
|
111
|
+
title: States
|
|
112
|
+
context: labdsnov.states
|
|
113
|
+
items:
|
|
114
|
+
- term: Off
|
|
115
|
+
definition: >-
|
|
116
|
+
Dark grey track, thumb on the left.
|
|
117
|
+
- term: On
|
|
118
|
+
definition: >-
|
|
119
|
+
Primary-colour track, thumb moved to the right.
|
|
120
|
+
- term: aria-invalid
|
|
121
|
+
definition: >-
|
|
122
|
+
Red border and faint red ring.
|
|
123
|
+
- term: Disabled
|
|
124
|
+
definition: >-
|
|
125
|
+
50% opacity.
|
|
126
|
+
|
|
127
|
+
- kind: section
|
|
128
|
+
for: all
|
|
129
|
+
title: Open decisions
|
|
130
|
+
freeform:
|
|
131
|
+
- title: TODO
|
|
132
|
+
body: >-
|
|
133
|
+
Not defined how to tell the user a setting saved or failed to save (e.g. a
|
|
134
|
+
toast), and no defined use for size `sm`.
|
|
135
|
+
|
|
136
|
+
sourceFiles:
|
|
137
|
+
- platform: react
|
|
138
|
+
file: ./Switch.tsx
|
|
139
|
+
|
|
140
|
+
imports:
|
|
141
|
+
- platform: react
|
|
142
|
+
code: >-
|
|
143
|
+
import { Switch } from "@designil/labdsnov"
|
|
144
|
+
package: "@designil/labdsnov"
|
|
145
|
+
|
|
146
|
+
traits:
|
|
147
|
+
- traitType: variant
|
|
148
|
+
kind: enum
|
|
149
|
+
id: size
|
|
150
|
+
description: >-
|
|
151
|
+
Track size.
|
|
152
|
+
values:
|
|
153
|
+
- id: default
|
|
154
|
+
description: >-
|
|
155
|
+
44×20px.
|
|
156
|
+
- id: sm
|
|
157
|
+
description: >-
|
|
158
|
+
28×16px, no defined use yet.
|
|
159
|
+
- traitType: state
|
|
160
|
+
kind: boolean
|
|
161
|
+
id: checked
|
|
162
|
+
description: >-
|
|
163
|
+
Switched on.
|
|
164
|
+
- traitType: state
|
|
165
|
+
kind: boolean
|
|
166
|
+
id: disabled
|
|
167
|
+
description: >-
|
|
168
|
+
Disabled.
|
|
169
|
+
- traitType: state
|
|
170
|
+
kind: boolean
|
|
171
|
+
id: aria-invalid
|
|
172
|
+
name: Invalid
|
|
173
|
+
description: >-
|
|
174
|
+
Invalid value.
|
|
175
|
+
|
|
176
|
+
uses:
|
|
177
|
+
- to: label
|
|
178
|
+
alternatives:
|
|
179
|
+
- to: checkbox
|
|
180
|
+
- to: toggle
|
|
181
|
+
|
|
182
|
+
refs:
|
|
183
|
+
- href: ./Switch.md
|
|
184
|
+
rel: relates-to
|
|
185
|
+
role: Thai usage doc
|
|
186
|
+
- href: ./Switch.stories.tsx
|
|
187
|
+
rel: demo
|
|
188
|
+
role: CSF stories
|
|
189
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=12-89
|
|
190
|
+
rel: design
|
|
191
|
+
role: Switch in Figma
|
|
192
|
+
- href: ../../../figma/Switch.figma.ts
|
|
193
|
+
rel: source
|
|
194
|
+
role: Code Connect template
|
|
195
|
+
|
|
196
|
+
$extensions:
|
|
197
|
+
com.figma:
|
|
198
|
+
nodeId: "12:89"
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: table
|
|
3
|
+
name: Table
|
|
4
|
+
description: >-
|
|
5
|
+
A data table in rows and columns that is easy to read and compare, e.g. a
|
|
6
|
+
transaction list. Has a wrapper that scrolls horizontally. Structure only: no
|
|
7
|
+
sorting, filtering or pagination.
|
|
8
|
+
metadata:
|
|
9
|
+
status: {status: stable}
|
|
10
|
+
since: 1.0.0
|
|
11
|
+
tags: [data-display]
|
|
12
|
+
|
|
13
|
+
sections:
|
|
14
|
+
- kind: guidelines
|
|
15
|
+
for: all
|
|
16
|
+
framing: when-to-use
|
|
17
|
+
items:
|
|
18
|
+
- level: should
|
|
19
|
+
statement: >-
|
|
20
|
+
Use for many rows with the same columns that must be compared across rows, e.g.
|
|
21
|
+
transactions, monthly contributions.
|
|
22
|
+
- level: should-not
|
|
23
|
+
statement: >-
|
|
24
|
+
Don't use for a few values about one thing. Use <dsds:card>.
|
|
25
|
+
alternatives:
|
|
26
|
+
- to: card
|
|
27
|
+
- level: should-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't use to list investment options. Use <dsds:fund-card> (except for tables
|
|
30
|
+
that compare numbers).
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: fund-card
|
|
33
|
+
- level: must-not
|
|
34
|
+
statement: >-
|
|
35
|
+
Never use a table for page layout. Use CSS grid / flex.
|
|
36
|
+
checkedBy: manual
|
|
37
|
+
|
|
38
|
+
- kind: guidelines
|
|
39
|
+
for: all
|
|
40
|
+
items:
|
|
41
|
+
- id: money-right-tabular
|
|
42
|
+
level: must
|
|
43
|
+
statement: >-
|
|
44
|
+
Money columns are right-aligned (`text-right`) and use `tabular-nums` on both
|
|
45
|
+
`TableHead` and `TableCell`, so decimal points line up. Write "AU$1,245.00"
|
|
46
|
+
(2 decimals).
|
|
47
|
+
checkedBy: manual
|
|
48
|
+
- id: thai-dates
|
|
49
|
+
level: must
|
|
50
|
+
statement: >-
|
|
51
|
+
Date columns use the format "13 พ.ย. 2569" (`Intl` `th-TH`, short month,
|
|
52
|
+
Buddhist year).
|
|
53
|
+
refines:
|
|
54
|
+
- to: shared-content#buddhist-year
|
|
55
|
+
checkedBy: manual
|
|
56
|
+
- id: status-as-badge
|
|
57
|
+
level: should
|
|
58
|
+
statement: >-
|
|
59
|
+
Status columns use <dsds:badge> (`success` / `warning` / `destructive`)
|
|
60
|
+
following Badge's rules.
|
|
61
|
+
uses:
|
|
62
|
+
- to: badge
|
|
63
|
+
refs:
|
|
64
|
+
- to: badge#status-mapping
|
|
65
|
+
rel: relates-to
|
|
66
|
+
checkedBy: manual
|
|
67
|
+
- id: footer-totals
|
|
68
|
+
level: should
|
|
69
|
+
statement: >-
|
|
70
|
+
Put totals in `TableFooter` (faint grey background, medium weight). Use
|
|
71
|
+
`colSpan` for the "รวม" (total) label cell.
|
|
72
|
+
checkedBy: manual
|
|
73
|
+
- id: row-actions-menu
|
|
74
|
+
level: should
|
|
75
|
+
statement: >-
|
|
76
|
+
Per-row actions use a "…" button opening a <dsds:dropdown-menu> in the last
|
|
77
|
+
column, not several buttons per row.
|
|
78
|
+
uses:
|
|
79
|
+
- to: dropdown-menu
|
|
80
|
+
checkedBy: manual
|
|
81
|
+
- id: selected-row
|
|
82
|
+
level: may
|
|
83
|
+
statement: >-
|
|
84
|
+
Highlight a selected row with `data-state="selected"` on `TableRow`.
|
|
85
|
+
- id: long-list-pagination
|
|
86
|
+
level: should
|
|
87
|
+
statement: >-
|
|
88
|
+
Tables longer than about 25 rows use <dsds:pagination> below the table.
|
|
89
|
+
uses:
|
|
90
|
+
- to: pagination
|
|
91
|
+
checkedBy: manual
|
|
92
|
+
- id: no-wrap-awareness
|
|
93
|
+
level: should-not
|
|
94
|
+
statement: >-
|
|
95
|
+
Don't put long text in cells. Cell text doesn't wrap, so the table gets wide and
|
|
96
|
+
must scroll sideways on mobile.
|
|
97
|
+
|
|
98
|
+
- kind: guidelines
|
|
99
|
+
for: all
|
|
100
|
+
title: Accessibility
|
|
101
|
+
tags: [accessibility]
|
|
102
|
+
items:
|
|
103
|
+
- id: caption-required
|
|
104
|
+
level: must
|
|
105
|
+
statement: >-
|
|
106
|
+
Always add a `TableCaption`. It is the table's name for screen readers (shown
|
|
107
|
+
below the table).
|
|
108
|
+
evidence:
|
|
109
|
+
- href: https://www.w3.org/WAI/tutorials/tables/caption-summary/
|
|
110
|
+
role: W3C WAI Tables Tutorial, Caption & Summary
|
|
111
|
+
checkedBy: manual
|
|
112
|
+
- id: header-cells
|
|
113
|
+
level: must
|
|
114
|
+
statement: >-
|
|
115
|
+
Column headers use `TableHead` (`<th>`) inside `TableHeader`, not a bold
|
|
116
|
+
`TableCell`.
|
|
117
|
+
evidence:
|
|
118
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html
|
|
119
|
+
role: WCAG 2.2 SC 1.3.1 (A)
|
|
120
|
+
checks:
|
|
121
|
+
- href: ./Table.stories.tsx#Playground
|
|
122
|
+
role: test
|
|
123
|
+
note: play function checks 4 columnheaders and 6 rows
|
|
124
|
+
checkedBy: automated
|
|
125
|
+
- id: reflow
|
|
126
|
+
level: should
|
|
127
|
+
statement: >-
|
|
128
|
+
A wide table scrolls horizontally inside its wrapper and doesn't make the whole
|
|
129
|
+
page scroll sideways (see story `NarrowScreen`). Switching to a card list on
|
|
130
|
+
narrow screens is undecided.
|
|
131
|
+
evidence:
|
|
132
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/reflow.html
|
|
133
|
+
role: WCAG 2.2 SC 1.4.10 (AA)
|
|
134
|
+
checkedBy: manual
|
|
135
|
+
|
|
136
|
+
- kind: definitions
|
|
137
|
+
for: all
|
|
138
|
+
context: anatomy
|
|
139
|
+
items:
|
|
140
|
+
- term: Table
|
|
141
|
+
definition: >-
|
|
142
|
+
`<table>` in a horizontally scrolling wrapper, full width.
|
|
143
|
+
- term: TableCaption
|
|
144
|
+
definition: >-
|
|
145
|
+
The table name, shown below the table.
|
|
146
|
+
- term: TableHeader / TableHead
|
|
147
|
+
definition: >-
|
|
148
|
+
`<thead>` / `<th>`, column headers 48px tall.
|
|
149
|
+
- term: TableBody / TableRow / TableCell
|
|
150
|
+
definition: >-
|
|
151
|
+
Rows get a faint background on hover; cells have 12px padding.
|
|
152
|
+
- term: TableFooter
|
|
153
|
+
definition: >-
|
|
154
|
+
Summary row, faint grey background, medium weight.
|
|
155
|
+
|
|
156
|
+
- kind: section
|
|
157
|
+
for: all
|
|
158
|
+
title: Open decisions
|
|
159
|
+
freeform:
|
|
160
|
+
- title: TODO
|
|
161
|
+
body: >-
|
|
162
|
+
No data table with sorting, filtering and pagination yet, and not decided
|
|
163
|
+
whether to switch to a card list on narrow screens.
|
|
164
|
+
|
|
165
|
+
sourceFiles:
|
|
166
|
+
- platform: react
|
|
167
|
+
file: ./Table.tsx
|
|
168
|
+
|
|
169
|
+
imports:
|
|
170
|
+
- platform: react
|
|
171
|
+
code: >-
|
|
172
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@designil/labdsnov"
|
|
173
|
+
package: "@designil/labdsnov"
|
|
174
|
+
|
|
175
|
+
traits:
|
|
176
|
+
- traitType: state
|
|
177
|
+
kind: boolean
|
|
178
|
+
id: selected
|
|
179
|
+
description: >-
|
|
180
|
+
A `TableRow` with `data-state="selected"` gets a highlighted background.
|
|
181
|
+
|
|
182
|
+
uses:
|
|
183
|
+
- to: badge
|
|
184
|
+
alternatives:
|
|
185
|
+
- to: card
|
|
186
|
+
- to: fund-card
|
|
187
|
+
- to: chart
|
|
188
|
+
|
|
189
|
+
refs:
|
|
190
|
+
- href: ./Table.md
|
|
191
|
+
rel: relates-to
|
|
192
|
+
role: Thai usage doc
|
|
193
|
+
- href: ./Table.stories.tsx
|
|
194
|
+
rel: demo
|
|
195
|
+
role: CSF stories
|