@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,265 @@
1
+ kind: component
2
+ id: dropdown-menu
3
+ name: DropdownMenu
4
+ description: >-
5
+ A list of commands opened from a button, such as edit, download or delete for one
6
+ item. At least 192px wide. Wraps Base UI's `Menu`.
7
+ metadata:
8
+ status: {status: stable}
9
+ since: 1.0.0
10
+ tags: [overlay, action]
11
+
12
+ sections:
13
+ - kind: guidelines
14
+ for: all
15
+ framing: when-to-use
16
+ items:
17
+ - level: should
18
+ statement: >-
19
+ Use for several commands on one item that you don't want to show as separate
20
+ buttons, such as the "…" menu in a table row or a card.
21
+ - level: may
22
+ statement: >-
23
+ Use for small display options, such as choosing columns
24
+ (`DropdownMenuCheckboxItem`) or a sort order (`DropdownMenuRadioItem`).
25
+ example:
26
+ ref:
27
+ href: ./DropdownMenu.stories.tsx#Choices
28
+ rel: demo
29
+ - level: must-not
30
+ statement: >-
31
+ Don't use it to pick a form value. Use <dsds:select>, which submits with the form
32
+ and shows the chosen value.
33
+ alternatives:
34
+ - to: select
35
+ checkedBy: manual
36
+ - level: must-not
37
+ statement: >-
38
+ Don't hide the page's main action in a menu. Use a <dsds:button> that's always
39
+ visible.
40
+ alternatives:
41
+ - to: button
42
+ checkedBy: manual
43
+ - level: must-not
44
+ statement: >-
45
+ Don't use it to navigate to other pages. Use links or <dsds:navigation-menu>.
46
+ alternatives:
47
+ - to: navigation-menu
48
+ checkedBy: manual
49
+ - level: should-not
50
+ statement: >-
51
+ Don't put content or inputs in a menu. Use <dsds:popover>.
52
+ alternatives:
53
+ - to: popover
54
+
55
+ - kind: guidelines
56
+ for: all
57
+ items:
58
+ - id: destructive-last
59
+ level: must
60
+ statement: >-
61
+ Items that delete or can't be undone use `variant="destructive"`, go last after a
62
+ `DropdownMenuSeparator`, and open an <dsds:alert-dialog> to confirm instead of
63
+ deleting straight away.
64
+ uses:
65
+ - to: alert-dialog
66
+ checkedBy: manual
67
+ - id: trigger-render
68
+ level: must
69
+ statement: >-
70
+ Write the opening button as `<DropdownMenuTrigger render={<Button size="icon"
71
+ variant="ghost" aria-label="…" />}>`, with the "…" icon (`MoreHorizontalIcon`) as
72
+ the trigger's child.
73
+ refs:
74
+ - to: shared-composition#render-prop
75
+ rel: relates-to
76
+ uses:
77
+ - to: button
78
+ checkedBy: assisted
79
+ - id: icons-consistent
80
+ level: should
81
+ statement: >-
82
+ If one item has an icon, every item in its group should too, or use `inset` on
83
+ the items without one so the text lines up.
84
+ checkedBy: manual
85
+ - id: group-label
86
+ level: should
87
+ statement: >-
88
+ A menu for a named item (e.g. one beneficiary) puts a `DropdownMenuLabel` in a
89
+ `DropdownMenuGroup` saying whose menu it is.
90
+ checkedBy: manual
91
+ - id: shortcut-display-only
92
+ level: should
93
+ statement: >-
94
+ `DropdownMenuShortcut` only displays a shortcut; it doesn't bind the key. Show
95
+ only shortcuts the app actually binds.
96
+ checkedBy: manual
97
+ - id: max-depth
98
+ level: should-not
99
+ statement: >-
100
+ Don't nest submenus (`DropdownMenuSub`) more than one level deep.
101
+ - id: no-disabled-hidden-reason
102
+ level: should-not
103
+ statement: >-
104
+ Don't disable an item without a visible reason. If the user can never do it, hide
105
+ the item instead (disabled items still take focus but can't be chosen).
106
+
107
+ - kind: guidelines
108
+ for: all
109
+ title: Accessibility
110
+ tags: [accessibility]
111
+ items:
112
+ - id: trigger-label
113
+ level: must
114
+ statement: >-
115
+ An icon button that opens a menu has an `aria-label` saying whose menu it is, e.g.
116
+ "ตัวเลือกผู้รับผลประโยชน์" (beneficiary options), not just "เพิ่มเติม" (more)
117
+ when there are several rows.
118
+ refines:
119
+ - to: shared-a11y#icon-only-label
120
+ checkedBy: assisted
121
+ - id: keyboard-menu
122
+ level: must
123
+ statement: >-
124
+ Enter on the trigger opens the menu and focuses the first item. Up/down arrows
125
+ move, Escape closes and returns focus, and choosing an item closes the menu.
126
+ evidence:
127
+ - href: https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
128
+ role: WAI-ARIA APG Menu Button pattern
129
+ checks:
130
+ - href: ./DropdownMenu.stories.tsx#Keyboard
131
+ role: test
132
+ - href: ./DropdownMenu.stories.tsx#ChooseItem
133
+ role: test
134
+ checkedBy: automated
135
+ - id: destructive-contrast
136
+ level: must
137
+ statement: >-
138
+ Destructive items pass 6.52:1 / 6.98:1 on the menu background and 5.46:1 / 4.91:1
139
+ when highlighted (light / dark).
140
+ checks:
141
+ - href: ../../../scripts/tokens.mjs
142
+ role: test
143
+ note: CONTRAST_PAIRS "รายการลบในเมนู" and "รายการลบที่ไฮไลต์"
144
+ checkedBy: automated
145
+
146
+ - kind: guidelines
147
+ for: agent
148
+ items:
149
+ - refs:
150
+ - to: shared-testing#assert-by-state
151
+ rel: same-as
152
+ - refs:
153
+ - to: shared-testing#query-portal-with-screen
154
+ rel: same-as
155
+
156
+ - kind: definitions
157
+ for: all
158
+ context: anatomy
159
+ items:
160
+ - term: DropdownMenu / DropdownMenuTrigger / DropdownMenuContent
161
+ definition: >-
162
+ Root, opening button, floating box (`side` defaults to `bottom`, `align` to
163
+ `start`).
164
+ - term: DropdownMenuGroup + DropdownMenuLabel
165
+ definition: >-
166
+ A group of items with a heading.
167
+ - term: DropdownMenuItem
168
+ definition: >-
169
+ A command. Takes `variant`, `inset`, `disabled`, `onClick`.
170
+ - term: DropdownMenuCheckboxItem
171
+ definition: >-
172
+ Several can be ticked.
173
+ - term: DropdownMenuRadioGroup + DropdownMenuRadioItem
174
+ definition: >-
175
+ Only one can be chosen.
176
+ - term: DropdownMenuSub / SubTrigger / SubContent
177
+ definition: >-
178
+ A submenu.
179
+ - term: DropdownMenuSeparator
180
+ definition: >-
181
+ A divider line.
182
+ - term: DropdownMenuShortcut
183
+ definition: >-
184
+ A shortcut at the end of an item (display only).
185
+
186
+ - kind: definitions
187
+ for: all
188
+ context: keyboard
189
+ items:
190
+ - term: Enter / Space on the trigger
191
+ definition: >-
192
+ Opens and focuses the first item.
193
+ - term: Up / Down arrows
194
+ definition: >-
195
+ Move between items.
196
+ - term: Right / Left arrows
197
+ definition: >-
198
+ Open / close a submenu.
199
+ - term: Escape
200
+ definition: >-
201
+ Closes and returns focus to the trigger.
202
+
203
+ - kind: section
204
+ for: all
205
+ title: Open decisions
206
+ freeform:
207
+ - title: TODO
208
+ body: >-
209
+ No story yet shows opening a confirmation dialog from a `destructive` item.
210
+
211
+ sourceFiles:
212
+ - platform: react
213
+ file: ./DropdownMenu.tsx
214
+
215
+ imports:
216
+ - platform: react
217
+ code: >-
218
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@designil/labdsnov"
219
+ package: "@designil/labdsnov"
220
+
221
+ traits:
222
+ - traitType: variant
223
+ kind: enum
224
+ id: itemVariant
225
+ name: DropdownMenuItem variant
226
+ description: >-
227
+ The `variant` prop of `DropdownMenuItem`.
228
+ values:
229
+ - id: default
230
+ description: >-
231
+ A regular command.
232
+ - id: destructive
233
+ description: >-
234
+ Red text and icon, for actions that delete or can't be undone.
235
+ - traitType: variant
236
+ kind: boolean
237
+ id: inset
238
+ description: >-
239
+ Indents to line up with items that have an icon or check mark. Works on Item,
240
+ Label, SubTrigger, CheckboxItem and RadioItem.
241
+ - traitType: state
242
+ kind: boolean
243
+ id: disabled
244
+ description: >-
245
+ An item that can't be chosen, dimmed to 50%. It still takes focus.
246
+ - traitType: state
247
+ kind: boolean
248
+ id: highlighted
249
+ description: >-
250
+ The item under the pointer or focus, with a `--menu-item-highlight-bg` background.
251
+
252
+ uses:
253
+ - to: button
254
+ alternatives:
255
+ - to: select
256
+ - to: popover
257
+ - to: navigation-menu
258
+
259
+ refs:
260
+ - href: ./DropdownMenu.md
261
+ rel: relates-to
262
+ role: Thai usage doc
263
+ - href: ./DropdownMenu.stories.tsx
264
+ rel: demo
265
+ role: CSF stories
@@ -0,0 +1,171 @@
1
+ kind: component
2
+ id: empty
3
+ name: Empty
4
+ description: >-
5
+ A message shown in place of a list or page that has no data yet, saying why and what
6
+ to do next. Content is centred with 48px padding.
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 for a list that's still empty, e.g. no beneficiaries or no documents yet.
20
+ - level: should
21
+ statement: >-
22
+ Use for a search or filter with no results ("ไม่พบธุรกรรม", no transactions found).
23
+ - level: must-not
24
+ statement: >-
25
+ Don't show it while loading. Use <dsds:skeleton>, and show "ยังไม่มี…"
26
+ (nothing yet) only once loading has finished and the list really is empty.
27
+ alternatives:
28
+ - to: skeleton
29
+ checkedBy: manual
30
+ - level: must-not
31
+ statement: >-
32
+ Don't use it when loading failed. Use a `destructive` <dsds:alert>, because the
33
+ data may exist.
34
+ alternatives:
35
+ - to: alert
36
+ checkedBy: manual
37
+ - level: should-not
38
+ statement: >-
39
+ Don't use it inside a Select or Combobox list. Use `ComboboxEmpty`
40
+ (<dsds:combobox>).
41
+ alternatives:
42
+ - to: combobox
43
+
44
+ - kind: guidelines
45
+ for: all
46
+ items:
47
+ - id: title-states-what
48
+ level: must
49
+ statement: >-
50
+ `EmptyTitle` says what is empty ("ยังไม่มีเอกสาร", no documents yet;
51
+ "ไม่พบธุรกรรม", no transactions found), not "ไม่มีข้อมูล" (no data).
52
+ checkedBy: manual
53
+ - id: description-next-step
54
+ level: should
55
+ statement: >-
56
+ `EmptyDescription` gives the reason or the next step. An empty filter result tells
57
+ the user to change the filter ("ลองเปลี่ยนช่วงวันที่", try another date range).
58
+ checkedBy: manual
59
+ - id: one-action
60
+ level: should
61
+ statement: >-
62
+ A list that's empty because the user hasn't added anything yet has one primary
63
+ button in `EmptyContent`, worded like the title ("เพิ่มผู้รับผลประโยชน์", add
64
+ beneficiary). An empty search result needs no button.
65
+ uses:
66
+ - to: button
67
+ checkedBy: manual
68
+ - id: media-icon
69
+ level: should
70
+ statement: >-
71
+ Prefer `EmptyMedia variant="icon"` (icon in a 40px grey square). Use `default` for
72
+ a full-size illustration.
73
+ example:
74
+ ref:
75
+ href: ./Empty.stories.tsx#MediaVariants
76
+ rel: demo
77
+ checkedBy: manual
78
+ - id: border-standalone
79
+ level: may
80
+ statement: >-
81
+ Add `className="border"` (dashed outline) when Empty stands in for a whole list
82
+ area. Leave it off inside a card that already has a border.
83
+
84
+ - kind: guidelines
85
+ for: all
86
+ title: Accessibility
87
+ tags: [accessibility]
88
+ items:
89
+ - id: announce-after-filter
90
+ level: should
91
+ statement: >-
92
+ An empty filter result that appears without a page load is wrapped in
93
+ `role="status"`, so screen readers hear that nothing was found.
94
+ evidence:
95
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html
96
+ role: WCAG 2.2 SC 4.1.3 (AA)
97
+ checkedBy: manual
98
+ - id: title-not-heading
99
+ level: should
100
+ statement: >-
101
+ `EmptyTitle` is a `<div>`, not a page heading. The section's `h2` belongs outside
102
+ Empty (see Open decisions).
103
+ checkedBy: manual
104
+
105
+ - kind: definitions
106
+ for: all
107
+ context: anatomy
108
+ items:
109
+ - term: Empty
110
+ definition: >-
111
+ The container. No border unless you add `border`.
112
+ - term: EmptyHeader
113
+ definition: >-
114
+ Media + Title + Description.
115
+ - term: EmptyMedia
116
+ definition: >-
117
+ Icon or image. Takes `variant`.
118
+ - term: EmptyTitle
119
+ definition: >-
120
+ Heading, 18px medium.
121
+ - term: EmptyDescription
122
+ definition: >-
123
+ Reason or next step. Links in the text are underlined.
124
+ - term: EmptyContent
125
+ definition: >-
126
+ Buttons or the next action.
127
+
128
+ - kind: section
129
+ for: all
130
+ title: Open decisions
131
+ freeform:
132
+ - title: TODO
133
+ body: >-
134
+ The title is a `<div>`; its heading level can't be chosen yet.
135
+
136
+ sourceFiles:
137
+ - platform: react
138
+ file: ./Empty.tsx
139
+
140
+ imports:
141
+ - platform: react
142
+ code: >-
143
+ import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@designil/labdsnov"
144
+ package: "@designil/labdsnov"
145
+
146
+ traits:
147
+ - traitType: variant
148
+ kind: enum
149
+ id: mediaVariant
150
+ name: EmptyMedia variant
151
+ description: >-
152
+ The `variant` prop of `EmptyMedia`.
153
+ values:
154
+ - id: default
155
+ description: >-
156
+ The icon or image at its own size.
157
+ - id: icon
158
+ description: >-
159
+ The icon in a 40px grey square.
160
+
161
+ alternatives:
162
+ - to: skeleton
163
+ - to: alert
164
+
165
+ refs:
166
+ - href: ./Empty.md
167
+ rel: relates-to
168
+ role: Thai usage doc
169
+ - href: ./Empty.stories.tsx
170
+ rel: demo
171
+ role: CSF stories