@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,168 @@
1
+ kind: component
2
+ id: popover
3
+ name: Popover
4
+ description: >-
5
+ A floating box next to a button that opens on click, holding short content or a few
6
+ fields without covering the whole page. 288px wide, 16px padding. Wraps Base UI's
7
+ `Popover`.
8
+ metadata:
9
+ status: {status: stable}
10
+ since: 1.0.0
11
+ tags: [overlay]
12
+
13
+ sections:
14
+ - kind: guidelines
15
+ for: all
16
+ framing: when-to-use
17
+ items:
18
+ - level: should
19
+ statement: >-
20
+ Use for details or small settings tied to that button, such as setting a goal or a
21
+ table filter.
22
+ - level: should
23
+ statement: >-
24
+ Use for explanations that contain a link or are too long for a <dsds:tooltip>.
25
+ - level: must-not
26
+ statement: >-
27
+ Don't use for confirming a decision or for a form that must be finished first; use
28
+ <dsds:dialog>. A Popover closes on an outside click, and what was typed is lost.
29
+ alternatives:
30
+ - to: dialog
31
+ checkedBy: manual
32
+ - level: should-not
33
+ statement: >-
34
+ Don't use for a one-line explanation; use <dsds:tooltip>.
35
+ alternatives:
36
+ - to: tooltip
37
+ - level: should-not
38
+ statement: >-
39
+ Don't use as a list of actions (use <dsds:dropdown-menu>) or to pick a value from a
40
+ list (use <dsds:select>).
41
+ alternatives:
42
+ - to: dropdown-menu
43
+ - to: select
44
+
45
+ - kind: guidelines
46
+ for: all
47
+ items:
48
+ - id: title-required
49
+ level: must
50
+ statement: >-
51
+ Always include a `PopoverTitle`, which names the box for screen readers, and a
52
+ `PopoverDescription` as its description.
53
+ checks:
54
+ - href: ./Popover.stories.tsx#OpenAndClose
55
+ role: test
56
+ note: play function checks toHaveAccessibleDescription
57
+ checkedBy: automated
58
+ - id: trigger-render
59
+ level: must
60
+ statement: >-
61
+ Write the trigger as `<PopoverTrigger render={<Button variant="outline" />}>`.
62
+ refs:
63
+ - to: shared-composition#render-prop
64
+ rel: relates-to
65
+ uses:
66
+ - to: button
67
+ checkedBy: assisted
68
+ - id: small-content
69
+ level: should
70
+ statement: >-
71
+ Keep the content to 1–3 fields or a short paragraph. Change the width with
72
+ `className` (e.g. `w-80`) only when needed.
73
+ checkedBy: manual
74
+ - id: apply-explicitly
75
+ level: should
76
+ statement: >-
77
+ Settings that affect the page (such as filters) apply as soon as they change, or
78
+ have a clear "ใช้ตัวกรอง" (apply filters) button. Don't make the result depend on
79
+ closing the box.
80
+ checkedBy: manual
81
+
82
+ - kind: guidelines
83
+ for: all
84
+ title: Accessibility
85
+ tags: [accessibility]
86
+ items:
87
+ - id: escape-returns-focus
88
+ level: must
89
+ statement: >-
90
+ Escape or an outside click closes it, and focus returns to the trigger.
91
+ evidence:
92
+ - href: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
93
+ role: WAI-ARIA APG Dialog pattern (non-modal)
94
+ checks:
95
+ - href: ./Popover.stories.tsx#OpenAndClose
96
+ role: test
97
+ note: play function checks aria-expanded and that focus returns to the trigger
98
+ checkedBy: automated
99
+ - id: popover-contrast
100
+ level: must
101
+ statement: >-
102
+ Text in the box passes 19.59:1 / 16.38:1, descriptions 5.97:1 / 7.30:1, and field
103
+ borders in the box 3.93:1 / 3.50:1.
104
+ checks:
105
+ - href: ../../../scripts/tokens.mjs
106
+ role: test
107
+ note: CONTRAST_PAIRS "… ในกล่องลอย" (in popovers)
108
+ checkedBy: automated
109
+
110
+ - kind: guidelines
111
+ for: agent
112
+ items:
113
+ - refs:
114
+ - to: shared-testing#assert-by-state
115
+ rel: same-as
116
+ - refs:
117
+ - to: shared-testing#query-portal-with-screen
118
+ rel: same-as
119
+
120
+ - kind: definitions
121
+ for: all
122
+ context: anatomy
123
+ items:
124
+ - term: Popover
125
+ definition: >-
126
+ The root. Takes `open` / `onOpenChange` and `defaultOpen`.
127
+ - term: PopoverTrigger
128
+ definition: >-
129
+ Opens and closes it.
130
+ - term: PopoverContent
131
+ definition: >-
132
+ The floating box (portalled). Takes `side` (`bottom`), `align` (`center`),
133
+ `sideOffset` (4).
134
+ - term: PopoverHeader / PopoverTitle / PopoverDescription
135
+ definition: >-
136
+ The header, its title and its description.
137
+
138
+ sourceFiles:
139
+ - platform: react
140
+ file: ./Popover.tsx
141
+
142
+ imports:
143
+ - platform: react
144
+ code: >-
145
+ import { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger } from "@designil/labdsnov"
146
+ package: "@designil/labdsnov"
147
+
148
+ traits:
149
+ - traitType: state
150
+ kind: boolean
151
+ id: open
152
+ description: >-
153
+ The box is open (`data-open`).
154
+
155
+ uses:
156
+ - to: button
157
+ alternatives:
158
+ - to: tooltip
159
+ - to: dialog
160
+ - to: hover-card
161
+
162
+ refs:
163
+ - href: ./Popover.md
164
+ rel: relates-to
165
+ role: Thai usage doc
166
+ - href: ./Popover.stories.tsx
167
+ rel: demo
168
+ role: CSF stories
@@ -0,0 +1,169 @@
1
+ kind: component
2
+ id: progress
3
+ name: Progress
4
+ description: >-
5
+ A bar showing how much of a task or goal is done. 12px high, full width, capsule
6
+ shaped. Wraps Base UI's `Progress`.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [feedback, data-display]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use for measurable progress, such as a document upload or the steps of an
20
+ application.
21
+ - level: should
22
+ statement: >-
23
+ Use for the share of a single goal, such as this year's contributions against the
24
+ cap.
25
+ - level: should-not
26
+ statement: >-
27
+ Don't use for a wait of unknown length. Use <dsds:skeleton> for loading content or
28
+ <dsds:spinner> in a button (use `value={null}` only when it must be a bar).
29
+ alternatives:
30
+ - to: skeleton
31
+ - to: spinner
32
+ - level: must-not
33
+ statement: >-
34
+ Don't use to compare several values; use <dsds:chart> or <dsds:table>.
35
+ alternatives:
36
+ - to: chart
37
+ - to: table
38
+ checkedBy: manual
39
+
40
+ - kind: guidelines
41
+ for: all
42
+ items:
43
+ - id: value-range
44
+ level: must
45
+ statement: >-
46
+ `value` lies within `min`–`max` (default 0–100). For money against a cap, pass the
47
+ real cap as `max` (e.g. `value={18600} max={30000}`) instead of working out a
48
+ percentage yourself.
49
+ checkedBy: manual
50
+ - id: label-and-value
51
+ level: should
52
+ statement: >-
53
+ Show `ProgressLabel` (top left) and `ProgressValue` (top right, "62%") so the
54
+ number can be read without estimating from the bar.
55
+ example:
56
+ ref:
57
+ href: ./Progress.stories.tsx#Playground
58
+ rel: demo
59
+ checkedBy: manual
60
+ - id: money-format
61
+ level: should
62
+ statement: >-
63
+ For money, pass `format` (`Intl.NumberFormatOptions`, e.g.
64
+ `{ style: "currency", currency: "AUD" }`) or write the amount in nearby text
65
+ (whether `ProgressValue` uses Thai formatting hasn't been checked).
66
+ checkedBy: manual
67
+ - id: no-colour-states
68
+ level: must-not
69
+ statement: >-
70
+ Don't recolour the bar to warning/danger with `className` when it nears or passes
71
+ the cap. These colours aren't defined yet (see Open decisions); use text or an
72
+ <dsds:alert> instead.
73
+ checkedBy: manual
74
+
75
+ - kind: guidelines
76
+ for: all
77
+ title: Accessibility
78
+ tags: [accessibility]
79
+ items:
80
+ - id: name-required
81
+ level: must
82
+ statement: >-
83
+ The bar needs a name: a `ProgressLabel`, or an `aria-label` when only the bar is
84
+ shown.
85
+ evidence:
86
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html
87
+ role: WCAG 2.2 SC 4.1.2 (A)
88
+ checks:
89
+ - href: ./Progress.stories.tsx#Playground
90
+ role: test
91
+ note: play function checks aria-valuenow="62"
92
+ checkedBy: assisted
93
+ - id: indicator-contrast
94
+ level: must
95
+ statement: >-
96
+ The indicator (`--progress-indicator`) on its track (`--progress-track`) passes
97
+ 4.74:1 light / 5.09:1 dark.
98
+ refines:
99
+ - to: shared-a11y#non-text-contrast
100
+ checks:
101
+ - href: ../../../scripts/tokens.mjs
102
+ role: test
103
+ note: CONTRAST_PAIRS "แถบ Progress บนราง" (Progress bar on track)
104
+ checkedBy: automated
105
+ - id: indeterminate-no-value
106
+ level: must
107
+ statement: >-
108
+ `value={null}` has no `aria-valuenow`, so screen readers know progress is unknown.
109
+ Never pass 0 to mean unknown.
110
+ checks:
111
+ - href: ./Progress.stories.tsx#Indeterminate
112
+ role: test
113
+ checkedBy: automated
114
+
115
+ - kind: definitions
116
+ for: all
117
+ context: anatomy
118
+ items:
119
+ - term: Progress
120
+ definition: >-
121
+ The root. Takes `value`, `min`, `max`, `format`, `aria-label`.
122
+ - term: ProgressLabel
123
+ definition: >-
124
+ The bar's name, top left, 14px medium.
125
+ - term: ProgressValue
126
+ definition: >-
127
+ The number, top right, 14px muted.
128
+ - term: Track + indicator
129
+ definition: >-
130
+ 12px high, capsule shaped.
131
+
132
+ - kind: section
133
+ for: all
134
+ title: Open decisions
135
+ freeform:
136
+ - title: TODO
137
+ body: >-
138
+ Not yet checked whether `format` shows Thai number formatting, and no colours are
139
+ defined for passing a goal or nearing a cap.
140
+
141
+ sourceFiles:
142
+ - platform: react
143
+ file: ./Progress.tsx
144
+
145
+ imports:
146
+ - platform: react
147
+ code: >-
148
+ import { Progress, ProgressLabel, ProgressValue } from "@designil/labdsnov"
149
+ package: "@designil/labdsnov"
150
+
151
+ traits:
152
+ - traitType: state
153
+ kind: boolean
154
+ id: indeterminate
155
+ description: >-
156
+ `value={null}`: progress is unknown.
157
+
158
+ alternatives:
159
+ - to: skeleton
160
+ - to: spinner
161
+ - to: chart
162
+
163
+ refs:
164
+ - href: ./Progress.md
165
+ rel: relates-to
166
+ role: Thai usage doc
167
+ - href: ./Progress.stories.tsx
168
+ rel: demo
169
+ role: CSF stories
@@ -0,0 +1,215 @@
1
+ kind: component
2
+ id: radio-group
3
+ name: RadioGroup
4
+ description: >-
5
+ Pick exactly one option from a short list where every option is visible at once. 16px
6
+ circles, options stacked 12px apart. Wraps Base UI's `RadioGroup` and `Radio`.
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 pick one of 2–5 options the user should see before deciding, such as an
20
+ investment plan or statement frequency.
21
+ - level: should-not
22
+ statement: >-
23
+ Don't use when there are many options (more than 5–7); use <dsds:select>.
24
+ alternatives:
25
+ - to: select
26
+ - level: must-not
27
+ statement: >-
28
+ Don't use when several options can be chosen; use <dsds:checkbox>.
29
+ alternatives:
30
+ - to: checkbox
31
+ checkedBy: manual
32
+ - level: must-not
33
+ statement: >-
34
+ Don't use two radios for on/off; use <dsds:switch> or <dsds:checkbox>.
35
+ alternatives:
36
+ - to: switch
37
+ checkedBy: manual
38
+ - level: must-not
39
+ statement: >-
40
+ Don't use to switch views of content; use <dsds:tabs>.
41
+ alternatives:
42
+ - to: tabs
43
+ checkedBy: manual
44
+
45
+ - kind: guidelines
46
+ for: all
47
+ items:
48
+ - id: item-label
49
+ level: must
50
+ statement: >-
51
+ Every `RadioGroupItem` has a `value` (required) and an `id` tied to a
52
+ <dsds:label> `htmlFor`, so clicking the text selects it. In forms use
53
+ `Field orientation="horizontal"`.
54
+ checks:
55
+ - href: ./RadioGroup.stories.tsx#Choosing
56
+ role: test
57
+ note: play function clicks the "เติบโตสูง" (high growth) text, then checks it's selected and onValueChange ran
58
+ uses:
59
+ - to: label
60
+ - to: field
61
+ checkedBy: automated
62
+ - id: preselect-safe
63
+ level: should
64
+ statement: >-
65
+ Preselect the safe or current value with `defaultValue` (e.g. the member's current
66
+ plan). Don't preselect when the choice has financial consequences the user must
67
+ choose deliberately.
68
+ checkedBy: manual
69
+ - id: choice-cards
70
+ level: should
71
+ statement: >-
72
+ Options with long descriptions (e.g. investment plans with their risk) become cards,
73
+ following the `ChoiceCards` story in <dsds:field>, instead of long label text.
74
+ uses:
75
+ - to: field
76
+ checkedBy: manual
77
+ - id: order-logical
78
+ level: should
79
+ statement: >-
80
+ Order options in a meaningful sequence (low to high risk, least to most frequent),
81
+ not alphabetically.
82
+ checkedBy: manual
83
+
84
+ - kind: guidelines
85
+ for: all
86
+ title: Accessibility
87
+ tags: [accessibility]
88
+ items:
89
+ - id: group-name
90
+ level: must
91
+ statement: >-
92
+ The group has a name: an `aria-label` on RadioGroup, or a `FieldSet` with a
93
+ `FieldLegend` around it.
94
+ refs:
95
+ - to: field#fieldset-legend
96
+ rel: relates-to
97
+ checks:
98
+ - href: ./RadioGroup.stories.tsx#Playground
99
+ role: test
100
+ note: play function checks the radiogroup's name
101
+ checkedBy: automated
102
+ - id: arrow-keys
103
+ level: must
104
+ statement: >-
105
+ Tab focuses the selected option (the whole group is a single Tab stop); up/down
106
+ arrows move and select at once. So never give a selection side effects that can't
107
+ be undone (such as submitting the form).
108
+ evidence:
109
+ - href: https://www.w3.org/WAI/ARIA/apg/patterns/radio/
110
+ role: WAI-ARIA APG Radio Group pattern
111
+ checks:
112
+ - href: ./RadioGroup.stories.tsx#Keyboard
113
+ role: test
114
+ checkedBy: automated
115
+ - id: control-contrast
116
+ level: must
117
+ statement: >-
118
+ An unselected circle's border (`--control-border`) passes 3.93:1 / 3.44:1, a
119
+ selected circle 5.23:1 / 6.99:1, and its dot 4.93:1 / 6.46:1. The hit area is at
120
+ least 24×24px.
121
+ refines:
122
+ - to: shared-a11y#non-text-contrast
123
+ checks:
124
+ - href: ../../../scripts/tokens.mjs
125
+ role: test
126
+ note: CONTRAST_PAIRS "… Checkbox / Radio …"
127
+ checkedBy: automated
128
+ - refs:
129
+ - to: shared-a11y#invalid-has-message
130
+ rel: same-as
131
+
132
+ - kind: definitions
133
+ for: all
134
+ context: anatomy
135
+ items:
136
+ - term: RadioGroup
137
+ definition: >-
138
+ The group. Takes `defaultValue`, `value` / `onValueChange`, `name`, `disabled`,
139
+ `aria-label`.
140
+ - term: RadioGroupItem
141
+ definition: >-
142
+ A 16px circle. Takes `value` (required), `id`, `disabled`, `aria-invalid`.
143
+
144
+ - kind: definitions
145
+ for: all
146
+ context: keyboard
147
+ items:
148
+ - term: Tab
149
+ definition: >-
150
+ Enters or leaves the group, focusing the selected option.
151
+ - term: Up / Down (Left / Right) arrows
152
+ definition: >-
153
+ Move to and select the previous / next option.
154
+
155
+ - kind: section
156
+ for: all
157
+ title: Open decisions
158
+ freeform:
159
+ - title: TODO
160
+ body: >-
161
+ The maximum number of options before switching to Select isn't defined ("5–7" is
162
+ an estimate).
163
+
164
+ sourceFiles:
165
+ - platform: react
166
+ file: ./RadioGroup.tsx
167
+
168
+ imports:
169
+ - platform: react
170
+ code: >-
171
+ import { RadioGroup, RadioGroupItem } from "@designil/labdsnov"
172
+ package: "@designil/labdsnov"
173
+
174
+ traits:
175
+ - traitType: state
176
+ kind: boolean
177
+ id: checked
178
+ description: >-
179
+ The selected option: a primary-coloured circle with a light dot.
180
+ - traitType: state
181
+ kind: boolean
182
+ id: disabled
183
+ description: >-
184
+ The whole group or one option is disabled, dimmed to 50%.
185
+ - traitType: state
186
+ kind: boolean
187
+ id: aria-invalid
188
+ name: Invalid
189
+ description: >-
190
+ On `RadioGroupItem`: red border and faint red ring.
191
+
192
+ uses:
193
+ - to: label
194
+ alternatives:
195
+ - to: select
196
+ - to: checkbox
197
+ - to: switch
198
+
199
+ refs:
200
+ - href: ./RadioGroup.md
201
+ rel: relates-to
202
+ role: Thai usage doc
203
+ - href: ./RadioGroup.stories.tsx
204
+ rel: demo
205
+ role: CSF stories
206
+ - href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=12-64
207
+ rel: design
208
+ role: Radio in Figma
209
+ - href: ../../../figma/Radio.figma.ts
210
+ rel: source
211
+ role: Code Connect template
212
+
213
+ $extensions:
214
+ com.figma:
215
+ nodeId: "12:64"
@@ -0,0 +1,153 @@
1
+ kind: component
2
+ id: scroll-area
3
+ name: ScrollArea
4
+ description: >-
5
+ A fixed-size box whose content scrolls, with a thin 10px scrollbar that looks the same
6
+ on every operating system. Wraps Base UI's `ScrollArea`.
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 for a long list in a confined space, such as recent activity in a <dsds:card>
20
+ or <dsds:popover>.
21
+ - level: may
22
+ statement: >-
23
+ Use for a row of cards that scrolls sideways (add
24
+ `<ScrollBar orientation="horizontal" />`).
25
+ example:
26
+ ref:
27
+ href: ./ScrollArea.stories.tsx#Horizontal
28
+ rel: demo
29
+ - level: must-not
30
+ statement: >-
31
+ Don't wrap the page's main content; let the page scroll normally. Nested scrolling
32
+ makes the mouse wheel and trackpad hard to use.
33
+ checkedBy: manual
34
+ - level: should-not
35
+ statement: >-
36
+ Don't wrap a <dsds:table> (it already scrolls sideways) or the lists of Select /
37
+ Combobox / DropdownMenu (they already scroll).
38
+ alternatives:
39
+ - to: table
40
+
41
+ - kind: guidelines
42
+ for: all
43
+ items:
44
+ - id: fixed-size
45
+ level: must
46
+ statement: >-
47
+ Set a size (`h-…` or `w-…`) with `className`. Otherwise the box grows with its
48
+ content and never scrolls.
49
+ checks:
50
+ - href: ./ScrollArea.stories.tsx#Playground
51
+ role: test
52
+ note: play function checks scrollHeight exceeds clientHeight and that it scrolls
53
+ checkedBy: assisted
54
+ - id: padding-inside
55
+ level: must
56
+ statement: >-
57
+ Put padding (`p-4`) on the content inside, not on `ScrollArea`, or the scrollbar is
58
+ pushed inwards too.
59
+ checkedBy: manual
60
+ - id: horizontal-nowrap
61
+ level: should
62
+ statement: >-
63
+ For a horizontal row, use `whitespace-nowrap` on the ScrollArea and `flex w-max` on
64
+ the content.
65
+ checkedBy: manual
66
+ - id: hint-more
67
+ level: should
68
+ statement: >-
69
+ Show that there's more: cut the height mid-item (not exactly at an item's edge), or
70
+ let the last card in a horizontal row peek out halfway.
71
+ checkedBy: manual
72
+
73
+ - kind: guidelines
74
+ for: all
75
+ title: Accessibility
76
+ tags: [accessibility]
77
+ items:
78
+ - id: keyboard-scroll
79
+ level: must
80
+ statement: >-
81
+ The area can be reached with Tab (with an inset focus ring) and scrolled with the
82
+ arrow keys. Add an `aria-label` on ScrollArea when nothing inside says what it is.
83
+ evidence:
84
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html
85
+ role: WCAG 2.2 SC 2.1.1 (A)
86
+ checkedBy: manual
87
+ - id: thumb-contrast
88
+ level: must
89
+ statement: >-
90
+ The scrollbar thumb (`--scroll-area-thumb`) passes 3.93:1 light / 4.05:1 dark on
91
+ the page background.
92
+ checks:
93
+ - href: ../../../scripts/tokens.mjs
94
+ role: test
95
+ note: CONTRAST_PAIRS "แถบเลื่อนของ ScrollArea" (ScrollArea scrollbar)
96
+ checkedBy: automated
97
+
98
+ - kind: definitions
99
+ for: all
100
+ context: anatomy
101
+ items:
102
+ - term: ScrollArea
103
+ definition: >-
104
+ The box (viewport plus a built-in vertical scrollbar). Size, border and radius come
105
+ from `className`.
106
+ - term: ScrollBar
107
+ definition: >-
108
+ An extra scrollbar. Takes `orientation`.
109
+
110
+ - kind: section
111
+ for: all
112
+ title: Open decisions
113
+ freeform:
114
+ - title: TODO
115
+ body: >-
116
+ Not yet checked that the area takes focus in every browser when it contains no
117
+ button or link.
118
+
119
+ sourceFiles:
120
+ - platform: react
121
+ file: ./ScrollArea.tsx
122
+
123
+ imports:
124
+ - platform: react
125
+ code: >-
126
+ import { ScrollArea, ScrollBar } from "@designil/labdsnov"
127
+ package: "@designil/labdsnov"
128
+
129
+ traits:
130
+ - traitType: variant
131
+ kind: enum
132
+ id: orientation
133
+ name: ScrollBar orientation
134
+ description: >-
135
+ The `orientation` prop of `ScrollBar`.
136
+ values:
137
+ - id: vertical
138
+ description: >-
139
+ Vertical (already built into ScrollArea).
140
+ - id: horizontal
141
+ description: >-
142
+ Horizontal; add it yourself when content is too wide.
143
+
144
+ alternatives:
145
+ - to: table
146
+
147
+ refs:
148
+ - href: ./ScrollArea.md
149
+ rel: relates-to
150
+ role: Thai usage doc
151
+ - href: ./ScrollArea.stories.tsx
152
+ rel: demo
153
+ role: CSF stories