@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,216 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: chart
|
|
3
|
+
name: Chart
|
|
4
|
+
description: >-
|
|
5
|
+
A wrapper for Recharts charts that applies the design system's colours, labels,
|
|
6
|
+
tooltip and legend. Each series' colour comes from `config` and becomes
|
|
7
|
+
`var(--color-<key>)`.
|
|
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 trends over time, e.g. monthly balance (area or line chart).
|
|
21
|
+
- level: should
|
|
22
|
+
statement: >-
|
|
23
|
+
Use to compare amounts, e.g. contributions by source (bar chart).
|
|
24
|
+
- level: must-not
|
|
25
|
+
statement: >-
|
|
26
|
+
Don't chart a single number. Show it in a <dsds:card>.
|
|
27
|
+
alternatives:
|
|
28
|
+
- to: card
|
|
29
|
+
checkedBy: manual
|
|
30
|
+
- level: must-not
|
|
31
|
+
statement: >-
|
|
32
|
+
Don't chart the share of a single goal. Use <dsds:progress>.
|
|
33
|
+
alternatives:
|
|
34
|
+
- to: progress
|
|
35
|
+
checkedBy: manual
|
|
36
|
+
- level: should-not
|
|
37
|
+
statement: >-
|
|
38
|
+
Don't chart values users must read exactly (per-transaction amounts, transaction
|
|
39
|
+
dates). Use <dsds:table>.
|
|
40
|
+
alternatives:
|
|
41
|
+
- to: table
|
|
42
|
+
|
|
43
|
+
- kind: guidelines
|
|
44
|
+
for: all
|
|
45
|
+
items:
|
|
46
|
+
- id: config-required
|
|
47
|
+
level: must
|
|
48
|
+
statement: >-
|
|
49
|
+
Always pass `config` (`satisfies ChartConfig`). Each data key has a Thai `label`
|
|
50
|
+
(e.g. "เงินสมทบจากนายจ้าง", employer contributions) and a `color`. Reference
|
|
51
|
+
colours in `fill` / `stroke` as `var(--color-<key>)`, never as raw colour values.
|
|
52
|
+
checks:
|
|
53
|
+
- href: ./Chart.stories.tsx#Playground
|
|
54
|
+
role: test
|
|
55
|
+
note: play function checks the label from config appears in the legend
|
|
56
|
+
checkedBy: assisted
|
|
57
|
+
- id: chart-tokens
|
|
58
|
+
level: must
|
|
59
|
+
statement: >-
|
|
60
|
+
Series colours use `var(--chart-1)` to `var(--chart-5)` (or another token such as
|
|
61
|
+
`--primary`) so dark mode switches by itself. Other mode-specific colours use
|
|
62
|
+
`theme: { light, dark }` in config.
|
|
63
|
+
checkedBy: manual
|
|
64
|
+
- id: max-five-series
|
|
65
|
+
level: should
|
|
66
|
+
statement: >-
|
|
67
|
+
At most 5 series per chart, matching the number of contrast-checked chart tokens.
|
|
68
|
+
A 6th series has no colour guaranteed to pass 3:1.
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: currency-formatter
|
|
71
|
+
level: must
|
|
72
|
+
statement: >-
|
|
73
|
+
Money values in the tooltip need a `formatter` that formats AUD with
|
|
74
|
+
`Intl.NumberFormat("th-TH", { style: "currency", currency: "AUD" })`. The tooltip
|
|
75
|
+
only shows the number via `toLocaleString("th-TH")`, with no currency.
|
|
76
|
+
checkedBy: manual
|
|
77
|
+
- id: month-labels-thai
|
|
78
|
+
level: should
|
|
79
|
+
statement: >-
|
|
80
|
+
X-axis month labels use short Thai month names ("มิ.ย.", "พ.ย.") and the chart's
|
|
81
|
+
`aria-label` uses the Buddhist year.
|
|
82
|
+
refs:
|
|
83
|
+
- to: shared-content#buddhist-year
|
|
84
|
+
rel: relates-to
|
|
85
|
+
checkedBy: manual
|
|
86
|
+
- id: tooltip-indicator
|
|
87
|
+
level: may
|
|
88
|
+
statement: >-
|
|
89
|
+
`ChartTooltipContent` uses `indicator="line"` for line/area charts and `dot`
|
|
90
|
+
(default) for bar charts.
|
|
91
|
+
|
|
92
|
+
- kind: guidelines
|
|
93
|
+
for: all
|
|
94
|
+
title: Accessibility
|
|
95
|
+
tags: [accessibility]
|
|
96
|
+
items:
|
|
97
|
+
- id: img-role-summary
|
|
98
|
+
level: must
|
|
99
|
+
statement: >-
|
|
100
|
+
`ChartContainer` has `role="img"` and an `aria-label` summarising what the chart
|
|
101
|
+
shows, including the period, e.g. "ยอดเงินในบัญชี มิถุนายน ถึง พฤศจิกายน 2569"
|
|
102
|
+
(account balance, June to November 2569).
|
|
103
|
+
evidence:
|
|
104
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html
|
|
105
|
+
role: WCAG 2.2 SC 1.1.1 (A)
|
|
106
|
+
checkedBy: manual
|
|
107
|
+
- id: accessibility-layer
|
|
108
|
+
level: must
|
|
109
|
+
statement: >-
|
|
110
|
+
Recharts charts get `accessibilityLayer` so each data point can be explored by
|
|
111
|
+
keyboard.
|
|
112
|
+
checkedBy: manual
|
|
113
|
+
- id: series-contrast
|
|
114
|
+
level: must
|
|
115
|
+
statement: >-
|
|
116
|
+
`--chart-1` to `--chart-5` pass 3:1 on the page and card backgrounds in both modes.
|
|
117
|
+
The lowest is `--chart-5` on the light background (4.60:1).
|
|
118
|
+
refines:
|
|
119
|
+
- to: shared-a11y#non-text-contrast
|
|
120
|
+
checks:
|
|
121
|
+
- href: ../../../scripts/tokens.mjs
|
|
122
|
+
role: test
|
|
123
|
+
note: CONTRAST_PAIRS "สีกราฟชุดที่ …"
|
|
124
|
+
checkedBy: automated
|
|
125
|
+
- id: not-colour-only
|
|
126
|
+
level: must
|
|
127
|
+
statement: >-
|
|
128
|
+
A chart with more than one series needs a legend (`ChartLegendContent`) with labels.
|
|
129
|
+
Users shouldn't have to tell series apart by colour alone.
|
|
130
|
+
evidence:
|
|
131
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html
|
|
132
|
+
role: WCAG 2.2 SC 1.4.1 (A)
|
|
133
|
+
checkedBy: manual
|
|
134
|
+
|
|
135
|
+
- kind: definitions
|
|
136
|
+
for: all
|
|
137
|
+
context: anatomy
|
|
138
|
+
items:
|
|
139
|
+
- term: ChartContainer
|
|
140
|
+
definition: >-
|
|
141
|
+
The frame, 16:9 and full width by default. Takes `config` (required) and
|
|
142
|
+
`initialDimension` (320×200 by default, before the real size is measured).
|
|
143
|
+
- term: ChartTooltip + ChartTooltipContent
|
|
144
|
+
definition: >-
|
|
145
|
+
Tooltip; takes `indicator`, `hideLabel`, `hideIndicator`, `formatter`
|
|
146
|
+
- term: ChartLegend + ChartLegendContent
|
|
147
|
+
definition: >-
|
|
148
|
+
Legend built from `config` (`hideIcon` hides the icon)
|
|
149
|
+
|
|
150
|
+
- kind: section
|
|
151
|
+
for: all
|
|
152
|
+
title: Open decisions
|
|
153
|
+
freeform:
|
|
154
|
+
- title: TODO
|
|
155
|
+
body: >-
|
|
156
|
+
Important data should also be readable as a table or text next to the chart; the
|
|
157
|
+
format isn't decided. The tooltip doesn't show currency automatically yet.
|
|
158
|
+
|
|
159
|
+
sourceFiles:
|
|
160
|
+
- platform: react
|
|
161
|
+
file: ./Chart.tsx
|
|
162
|
+
|
|
163
|
+
imports:
|
|
164
|
+
- platform: react
|
|
165
|
+
code: >-
|
|
166
|
+
import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, type ChartConfig } from "@designil/labdsnov"
|
|
167
|
+
package: "@designil/labdsnov"
|
|
168
|
+
|
|
169
|
+
traits:
|
|
170
|
+
- traitType: variant
|
|
171
|
+
kind: enum
|
|
172
|
+
id: indicator
|
|
173
|
+
description: >-
|
|
174
|
+
The colour marker before each value in `ChartTooltipContent`
|
|
175
|
+
values:
|
|
176
|
+
- id: dot
|
|
177
|
+
description: >-
|
|
178
|
+
A colour dot (default), suits bar charts
|
|
179
|
+
- id: line
|
|
180
|
+
description: >-
|
|
181
|
+
A vertical line, suits line and area charts
|
|
182
|
+
- id: dashed
|
|
183
|
+
description: >-
|
|
184
|
+
A dashed line
|
|
185
|
+
- traitType: variant
|
|
186
|
+
kind: boolean
|
|
187
|
+
id: hideLabel
|
|
188
|
+
description: >-
|
|
189
|
+
Hide the tooltip heading (e.g. the month name)
|
|
190
|
+
- traitType: variant
|
|
191
|
+
kind: boolean
|
|
192
|
+
id: hideIndicator
|
|
193
|
+
description: >-
|
|
194
|
+
Hide the colour marker in the tooltip
|
|
195
|
+
|
|
196
|
+
combos:
|
|
197
|
+
- subject: hideIndicator
|
|
198
|
+
level: should-not
|
|
199
|
+
items: [indicator.dashed, indicator.line]
|
|
200
|
+
note: >-
|
|
201
|
+
With the marker hidden, `indicator` has no effect.
|
|
202
|
+
|
|
203
|
+
alternatives:
|
|
204
|
+
- to: table
|
|
205
|
+
- to: progress
|
|
206
|
+
|
|
207
|
+
refs:
|
|
208
|
+
- href: ./Chart.md
|
|
209
|
+
rel: relates-to
|
|
210
|
+
role: Thai usage doc
|
|
211
|
+
- href: ./Chart.stories.tsx
|
|
212
|
+
rel: demo
|
|
213
|
+
role: CSF stories
|
|
214
|
+
- href: https://recharts.org
|
|
215
|
+
rel: relates-to
|
|
216
|
+
role: Recharts docs
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: checkbox
|
|
3
|
+
name: Checkbox
|
|
4
|
+
description: >-
|
|
5
|
+
A box that turns one option on or off, or lets users pick several options from a list.
|
|
6
|
+
The box is 16px with a hit area larger than the box. Wraps Base UI's `Checkbox`.
|
|
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 to accept terms or confirm a single statement that takes effect when the form
|
|
20
|
+
is submitted.
|
|
21
|
+
- level: should
|
|
22
|
+
statement: >-
|
|
23
|
+
Use to pick several options from a list, e.g. the channels for receiving documents.
|
|
24
|
+
- level: should
|
|
25
|
+
statement: >-
|
|
26
|
+
Use `indeterminate` for a "select all" with only some items selected (a dash
|
|
27
|
+
instead of a tick).
|
|
28
|
+
- level: must-not
|
|
29
|
+
statement: >-
|
|
30
|
+
Don't use when only one of several options can be picked. Use <dsds:radio-group>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: radio-group
|
|
33
|
+
checkedBy: manual
|
|
34
|
+
- level: must-not
|
|
35
|
+
statement: >-
|
|
36
|
+
Don't use for a setting that takes effect immediately without saving. Use
|
|
37
|
+
<dsds:switch>.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: switch
|
|
40
|
+
checkedBy: manual
|
|
41
|
+
- level: must-not
|
|
42
|
+
statement: >-
|
|
43
|
+
Don't use a Checkbox to trigger an action such as "ลบรายการที่เลือก" (delete
|
|
44
|
+
selected). Use <dsds:button>.
|
|
45
|
+
alternatives:
|
|
46
|
+
- to: button
|
|
47
|
+
checkedBy: manual
|
|
48
|
+
|
|
49
|
+
- kind: guidelines
|
|
50
|
+
for: all
|
|
51
|
+
items:
|
|
52
|
+
- id: label-bound
|
|
53
|
+
level: must
|
|
54
|
+
statement: >-
|
|
55
|
+
Always bind a <dsds:label> with `id` / `htmlFor` so clicking the text ticks the
|
|
56
|
+
box. In forms use `Field orientation="horizontal"` so the Checkbox sits before the
|
|
57
|
+
text.
|
|
58
|
+
checks:
|
|
59
|
+
- href: ./Checkbox.stories.tsx#Toggle
|
|
60
|
+
role: test
|
|
61
|
+
note: play function checks that clicking the Label text toggles the value
|
|
62
|
+
uses:
|
|
63
|
+
- to: label
|
|
64
|
+
- to: field
|
|
65
|
+
checkedBy: automated
|
|
66
|
+
- id: label-is-positive
|
|
67
|
+
level: should
|
|
68
|
+
statement: >-
|
|
69
|
+
Phrase the label as a statement that's true when ticked ("รับใบแจ้งยอดทางอีเมล",
|
|
70
|
+
receive statements by email), not a negative ("ไม่ต้องการรับ…", don't want…), which
|
|
71
|
+
reads backwards when ticked.
|
|
72
|
+
checkedBy: manual
|
|
73
|
+
- id: required-consent
|
|
74
|
+
level: should
|
|
75
|
+
statement: >-
|
|
76
|
+
Required consent uses `required` plus a `FieldError` when unticked. Don't disable
|
|
77
|
+
the submit button until it's ticked: users can't tell why they can't press it.
|
|
78
|
+
uses:
|
|
79
|
+
- to: field
|
|
80
|
+
checkedBy: manual
|
|
81
|
+
- id: no-default-consent
|
|
82
|
+
level: must-not
|
|
83
|
+
statement: >-
|
|
84
|
+
Never pre-tick consent (terms, marketing, data sharing) with `defaultChecked`.
|
|
85
|
+
checkedBy: manual
|
|
86
|
+
|
|
87
|
+
- kind: guidelines
|
|
88
|
+
for: all
|
|
89
|
+
title: Accessibility
|
|
90
|
+
tags: [accessibility]
|
|
91
|
+
items:
|
|
92
|
+
- id: space-toggles
|
|
93
|
+
level: must
|
|
94
|
+
statement: >-
|
|
95
|
+
Tab to the box and press Space to tick it (`aria-checked` follows). Indeterminate
|
|
96
|
+
is announced as `aria-checked="mixed"`.
|
|
97
|
+
evidence:
|
|
98
|
+
- href: https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
|
|
99
|
+
role: WAI-ARIA APG Checkbox pattern
|
|
100
|
+
checks:
|
|
101
|
+
- href: ./Checkbox.stories.tsx#Keyboard
|
|
102
|
+
role: test
|
|
103
|
+
checkedBy: automated
|
|
104
|
+
- id: border-contrast
|
|
105
|
+
level: must
|
|
106
|
+
statement: >-
|
|
107
|
+
The unticked border (`--control-border`) passes 3.93:1 light / 3.44:1 dark, and the
|
|
108
|
+
ticked box 5.23:1 / 6.99:1. Don't change the border to `--border` (a decorative
|
|
109
|
+
colour that fails 3:1).
|
|
110
|
+
refines:
|
|
111
|
+
- to: shared-a11y#non-text-contrast
|
|
112
|
+
checks:
|
|
113
|
+
- href: ../../../scripts/tokens.mjs
|
|
114
|
+
role: test
|
|
115
|
+
note: CONTRAST_PAIRS "ขอบ Checkbox / Radio …" and "Checkbox / Radio ที่เลือกแล้ว"
|
|
116
|
+
checkedBy: automated
|
|
117
|
+
- id: hit-area
|
|
118
|
+
level: must
|
|
119
|
+
statement: >-
|
|
120
|
+
The hit area is at least 24×24px even though the box is 16px. Don't set
|
|
121
|
+
`overflow: hidden` on a wrapper that would clip it.
|
|
122
|
+
refines:
|
|
123
|
+
- to: shared-a11y#target-size
|
|
124
|
+
checkedBy: manual
|
|
125
|
+
- refs:
|
|
126
|
+
- to: shared-a11y#invalid-has-message
|
|
127
|
+
rel: same-as
|
|
128
|
+
|
|
129
|
+
- kind: definitions
|
|
130
|
+
for: all
|
|
131
|
+
title: States
|
|
132
|
+
context: labdsnov.states
|
|
133
|
+
items:
|
|
134
|
+
- term: Unticked
|
|
135
|
+
definition: >-
|
|
136
|
+
Box with a `--control-border` border
|
|
137
|
+
- term: Ticked / indeterminate
|
|
138
|
+
definition: >-
|
|
139
|
+
Primary (orange) box with a light tick or dash
|
|
140
|
+
- term: aria-invalid
|
|
141
|
+
definition: >-
|
|
142
|
+
Red border and faint red ring
|
|
143
|
+
- term: Disabled
|
|
144
|
+
definition: >-
|
|
145
|
+
Dimmed to 50%
|
|
146
|
+
|
|
147
|
+
sourceFiles:
|
|
148
|
+
- platform: react
|
|
149
|
+
file: ./Checkbox.tsx
|
|
150
|
+
|
|
151
|
+
imports:
|
|
152
|
+
- platform: react
|
|
153
|
+
code: >-
|
|
154
|
+
import { Checkbox } from "@designil/labdsnov"
|
|
155
|
+
package: "@designil/labdsnov"
|
|
156
|
+
|
|
157
|
+
traits:
|
|
158
|
+
- traitType: state
|
|
159
|
+
kind: boolean
|
|
160
|
+
id: checked
|
|
161
|
+
description: >-
|
|
162
|
+
Ticked (`checked` / `defaultChecked`)
|
|
163
|
+
- traitType: state
|
|
164
|
+
kind: boolean
|
|
165
|
+
id: indeterminate
|
|
166
|
+
description: >-
|
|
167
|
+
Partly selected; shows a dash instead of a tick
|
|
168
|
+
- traitType: state
|
|
169
|
+
kind: boolean
|
|
170
|
+
id: disabled
|
|
171
|
+
description: >-
|
|
172
|
+
Disabled, dimmed to 50%
|
|
173
|
+
- traitType: state
|
|
174
|
+
kind: boolean
|
|
175
|
+
id: required
|
|
176
|
+
description: >-
|
|
177
|
+
Must be ticked before the form is submitted
|
|
178
|
+
- traitType: state
|
|
179
|
+
kind: boolean
|
|
180
|
+
id: aria-invalid
|
|
181
|
+
name: Invalid
|
|
182
|
+
description: >-
|
|
183
|
+
Invalid value; red border and faint red ring
|
|
184
|
+
|
|
185
|
+
combos:
|
|
186
|
+
- subject: indeterminate
|
|
187
|
+
level: should-not
|
|
188
|
+
items: [checked]
|
|
189
|
+
note: >-
|
|
190
|
+
indeterminate overrides how checked is shown, so setting both makes the visible state
|
|
191
|
+
differ from the submitted value.
|
|
192
|
+
|
|
193
|
+
uses:
|
|
194
|
+
- to: label
|
|
195
|
+
alternatives:
|
|
196
|
+
- to: radio-group
|
|
197
|
+
- to: switch
|
|
198
|
+
|
|
199
|
+
refs:
|
|
200
|
+
- href: ./Checkbox.md
|
|
201
|
+
rel: relates-to
|
|
202
|
+
role: Thai usage doc
|
|
203
|
+
- href: ./Checkbox.stories.tsx
|
|
204
|
+
rel: demo
|
|
205
|
+
role: CSF stories
|
|
206
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=12-51
|
|
207
|
+
rel: design
|
|
208
|
+
role: Checkbox in Figma
|
|
209
|
+
- href: ../../../figma/Checkbox.figma.ts
|
|
210
|
+
rel: source
|
|
211
|
+
role: Code Connect template
|
|
212
|
+
|
|
213
|
+
$extensions:
|
|
214
|
+
com.figma:
|
|
215
|
+
nodeId: "12:51"
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: collapsible
|
|
3
|
+
name: Collapsible
|
|
4
|
+
description: >-
|
|
5
|
+
Hides and shows a single section of content with a button, e.g. fee details. It has
|
|
6
|
+
no look of its own. Wraps Base UI's `Collapsible`.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [disclosure]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use for supporting detail most people don't need to read, e.g. how fees are
|
|
20
|
+
calculated.
|
|
21
|
+
- level: should
|
|
22
|
+
statement: >-
|
|
23
|
+
Use to hide advanced options in a form.
|
|
24
|
+
- level: must-not
|
|
25
|
+
statement: >-
|
|
26
|
+
Don't hide information users need to decide (e.g. the total fee). Show it on the
|
|
27
|
+
page. Collapsible may only hide the breakdown of a figure that's already shown.
|
|
28
|
+
checkedBy: manual
|
|
29
|
+
- level: should-not
|
|
30
|
+
statement: >-
|
|
31
|
+
Don't use for several stacked sections such as an FAQ. Use <dsds:accordion>.
|
|
32
|
+
alternatives:
|
|
33
|
+
- to: accordion
|
|
34
|
+
- level: should-not
|
|
35
|
+
statement: >-
|
|
36
|
+
Don't use for content that floats over the page. Use <dsds:popover>.
|
|
37
|
+
alternatives:
|
|
38
|
+
- to: popover
|
|
39
|
+
|
|
40
|
+
- kind: guidelines
|
|
41
|
+
for: all
|
|
42
|
+
items:
|
|
43
|
+
- id: trigger-is-button
|
|
44
|
+
level: must
|
|
45
|
+
statement: >-
|
|
46
|
+
The trigger has no look of its own. Write it as
|
|
47
|
+
`<CollapsibleTrigger render={<Button variant="ghost" size="sm" />}>`.
|
|
48
|
+
refs:
|
|
49
|
+
- to: shared-composition#render-prop
|
|
50
|
+
rel: relates-to
|
|
51
|
+
uses:
|
|
52
|
+
- to: button
|
|
53
|
+
checkedBy: assisted
|
|
54
|
+
- id: trigger-says-what
|
|
55
|
+
level: should
|
|
56
|
+
statement: >-
|
|
57
|
+
The button text says what will be shown ("ดูรายละเอียด", see details). Don't
|
|
58
|
+
change it to "ซ่อน" (hide) when open: `aria-expanded` and the rotated chevron
|
|
59
|
+
convey the state.
|
|
60
|
+
checkedBy: manual
|
|
61
|
+
- id: rotate-chevron
|
|
62
|
+
level: may
|
|
63
|
+
statement: >-
|
|
64
|
+
Rotate the chevron with `className="[&[data-panel-open]_svg]:rotate-180"` on the
|
|
65
|
+
trigger.
|
|
66
|
+
- id: find-in-page
|
|
67
|
+
level: may
|
|
68
|
+
statement: >-
|
|
69
|
+
For content users may search with Ctrl+F, use `keepMounted` together with
|
|
70
|
+
`hiddenUntilFound` on `CollapsibleContent`.
|
|
71
|
+
|
|
72
|
+
- kind: guidelines
|
|
73
|
+
for: all
|
|
74
|
+
title: Accessibility
|
|
75
|
+
tags: [accessibility]
|
|
76
|
+
items:
|
|
77
|
+
- id: aria-expanded
|
|
78
|
+
level: must
|
|
79
|
+
statement: >-
|
|
80
|
+
The trigger has `aria-expanded` matching the state, and Enter or Space opens and
|
|
81
|
+
closes it.
|
|
82
|
+
evidence:
|
|
83
|
+
- href: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
|
|
84
|
+
role: WAI-ARIA APG Disclosure pattern
|
|
85
|
+
checks:
|
|
86
|
+
- href: ./Collapsible.stories.tsx#OpenAndClose
|
|
87
|
+
role: test
|
|
88
|
+
- href: ./Collapsible.stories.tsx#Keyboard
|
|
89
|
+
role: test
|
|
90
|
+
checkedBy: automated
|
|
91
|
+
- id: content-after-trigger
|
|
92
|
+
level: should
|
|
93
|
+
statement: >-
|
|
94
|
+
Place `CollapsibleContent` right after the trigger in DOM order, so the next Tab
|
|
95
|
+
goes into the content just opened.
|
|
96
|
+
checkedBy: manual
|
|
97
|
+
|
|
98
|
+
- kind: definitions
|
|
99
|
+
for: all
|
|
100
|
+
context: anatomy
|
|
101
|
+
items:
|
|
102
|
+
- term: Collapsible
|
|
103
|
+
definition: >-
|
|
104
|
+
Root; takes `open` / `onOpenChange`, `defaultOpen`, `disabled`
|
|
105
|
+
- term: CollapsibleTrigger
|
|
106
|
+
definition: >-
|
|
107
|
+
The open/close button; use `render` with Button
|
|
108
|
+
- term: CollapsibleContent
|
|
109
|
+
definition: >-
|
|
110
|
+
The content; its height animates open/closed in 200ms. Takes `keepMounted`.
|
|
111
|
+
|
|
112
|
+
sourceFiles:
|
|
113
|
+
- platform: react
|
|
114
|
+
file: ./Collapsible.tsx
|
|
115
|
+
|
|
116
|
+
imports:
|
|
117
|
+
- platform: react
|
|
118
|
+
code: >-
|
|
119
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@designil/labdsnov"
|
|
120
|
+
package: "@designil/labdsnov"
|
|
121
|
+
|
|
122
|
+
traits:
|
|
123
|
+
- traitType: state
|
|
124
|
+
kind: boolean
|
|
125
|
+
id: open
|
|
126
|
+
description: >-
|
|
127
|
+
Content is open; the trigger has `data-panel-open` and `aria-expanded="true"`
|
|
128
|
+
- traitType: state
|
|
129
|
+
kind: boolean
|
|
130
|
+
id: disabled
|
|
131
|
+
description: >-
|
|
132
|
+
The trigger can't open or close
|
|
133
|
+
|
|
134
|
+
uses:
|
|
135
|
+
- to: button
|
|
136
|
+
alternatives:
|
|
137
|
+
- to: accordion
|
|
138
|
+
- to: popover
|
|
139
|
+
|
|
140
|
+
refs:
|
|
141
|
+
- href: ./Collapsible.md
|
|
142
|
+
rel: relates-to
|
|
143
|
+
role: Thai usage doc
|
|
144
|
+
- href: ./Collapsible.stories.tsx
|
|
145
|
+
rel: demo
|
|
146
|
+
role: CSF stories
|