@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,241 @@
1
+ kind: component
2
+ id: combobox
3
+ name: Combobox
4
+ description: >-
5
+ A field where users type to filter a long list, then pick a value (or several, as
6
+ chips). Looks like InputGroup. Wraps Base UI's `Combobox`.
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 value from a very long list whose names users already know, e.g.
20
+ country, bank.
21
+ - level: should
22
+ statement: >-
23
+ Use `multiple` with chips when several values can be picked, e.g. countries worked
24
+ in.
25
+ - level: should-not
26
+ statement: >-
27
+ Don't use for short lists (under about 15 options). Use <dsds:select>.
28
+ alternatives:
29
+ - to: select
30
+ - level: should-not
31
+ statement: >-
32
+ Don't use for 2–5 options that should all be visible. Use <dsds:radio-group>.
33
+ alternatives:
34
+ - to: radio-group
35
+ - level: must-not
36
+ statement: >-
37
+ Don't use for free text that doesn't have to match the list. Use <dsds:input>.
38
+ alternatives:
39
+ - to: input
40
+ checkedBy: manual
41
+
42
+ - kind: guidelines
43
+ for: all
44
+ items:
45
+ - id: items-and-render-fn
46
+ level: must
47
+ statement: >-
48
+ Pass the whole list as `items` on `Combobox` and give `ComboboxList` a function
49
+ `(item) => <ComboboxItem key value>`. The component filters for you: never
50
+ `.filter()` the list yourself and map it into children.
51
+ checks:
52
+ - href: ./Combobox.stories.tsx#FilterAndChoose
53
+ role: test
54
+ note: play function types "สห" and expects 2 options left
55
+ checkedBy: automated
56
+ - id: always-empty
57
+ level: must
58
+ statement: >-
59
+ Always include `ComboboxEmpty` saying nothing was found, e.g. "ไม่พบประเทศที่ค้นหา"
60
+ (no matching country). Otherwise an empty list has no explanation.
61
+ checks:
62
+ - href: ./Combobox.stories.tsx#NoMatch
63
+ role: test
64
+ checkedBy: automated
65
+ - id: object-items-label
66
+ level: must
67
+ statement: >-
68
+ Object items need `itemToStringLabel` on `Combobox` to say which text is searched
69
+ and shown in the field; otherwise the field shows "[object Object]".
70
+ checkedBy: manual
71
+ - id: chips-anchor
72
+ level: must
73
+ statement: >-
74
+ Multiple mode uses `ComboboxChips` + `ComboboxValue` + `ComboboxChip` +
75
+ `ComboboxChipsInput` instead of `ComboboxInput`, and passes the `anchor` from
76
+ `useComboboxAnchor()` both to `ComboboxChips` (`ref`) and to `ComboboxContent`;
77
+ otherwise the list is positioned in the wrong place.
78
+ example:
79
+ ref:
80
+ href: ./Combobox.stories.tsx#MultipleChips
81
+ rel: demo
82
+ checkedBy: manual
83
+ - id: full-width-in-form
84
+ level: should
85
+ statement: >-
86
+ The field is as wide as its content. In forms add `className="w-full"` to match
87
+ other fields.
88
+ checkedBy: manual
89
+ - id: placeholder-hint
90
+ level: should
91
+ statement: >-
92
+ `placeholder` explains how to use it ("พิมพ์เพื่อค้นหา", type to search;
93
+ "เพิ่มประเทศ", add a country). It isn't the field's label; that's the <dsds:label>.
94
+ checkedBy: manual
95
+ - id: clear-or-trigger
96
+ level: may
97
+ statement: >-
98
+ `showClear` shows an "×" clear button (hiding the chevron while a value is set).
99
+ Suits optional fields.
100
+ - id: no-userevent-type
101
+ level: must-not
102
+ statement: >-
103
+ In play functions don't test filtering with `userEvent.type`. Use
104
+ `fireEvent.change`.
105
+ refs:
106
+ - to: shared-testing#fire-change-for-typing
107
+ rel: relates-to
108
+ checkedBy: manual
109
+
110
+ - kind: guidelines
111
+ for: all
112
+ title: Accessibility
113
+ tags: [accessibility]
114
+ items:
115
+ - id: input-label
116
+ level: must
117
+ statement: >-
118
+ `ComboboxInput` (or `ComboboxChipsInput`) has an `id` bound to a <dsds:label>
119
+ `htmlFor`. The placeholder isn't the field's name.
120
+ evidence:
121
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html
122
+ role: WCAG 2.2 SC 3.3.2 (A)
123
+ checkedBy: manual
124
+ - id: chip-remove-label
125
+ level: must
126
+ statement: >-
127
+ The "×" on each chip is already named "นำออก" (remove). In multiple mode don't hide
128
+ it with `showRemove={false}` unless there's another keyboard way to remove values.
129
+ checks:
130
+ - href: ./Combobox.stories.tsx#MultipleChips
131
+ role: test
132
+ note: play function presses "นำออก" and the chip disappears
133
+ checkedBy: automated
134
+ - refs:
135
+ - to: shared-a11y#focus-ring
136
+ rel: same-as
137
+
138
+ - kind: definitions
139
+ for: all
140
+ context: anatomy
141
+ items:
142
+ - term: Combobox
143
+ definition: >-
144
+ Root; takes `items`, `value` / `onValueChange`, `defaultValue`, `multiple`,
145
+ `itemToStringLabel`
146
+ - term: ComboboxInput
147
+ definition: >-
148
+ The text field; takes `showTrigger` (default `true`), `showClear`, `disabled`
149
+ - term: ComboboxContent
150
+ definition: >-
151
+ The list popup (portalled); takes `anchor`
152
+ - term: ComboboxList / ComboboxItem
153
+ definition: >-
154
+ The options; the selected one has a tick on the right, `disabled` can't be picked
155
+ - term: ComboboxEmpty
156
+ definition: >-
157
+ Message shown when nothing matches
158
+ - term: ComboboxGroup / ComboboxLabel / ComboboxSeparator
159
+ definition: >-
160
+ Group the options
161
+ - term: ComboboxChips / ComboboxChip / ComboboxChipsInput
162
+ definition: >-
163
+ Multiple mode; each chip has a "นำออก" (remove) button
164
+
165
+ - kind: definitions
166
+ for: all
167
+ context: keyboard
168
+ items:
169
+ - term: Typing
170
+ definition: >-
171
+ Filters the list
172
+ - term: Up / Down arrow
173
+ definition: >-
174
+ Highlight the previous / next option
175
+ - term: Enter
176
+ definition: >-
177
+ Pick the highlighted option
178
+ - term: Escape
179
+ definition: >-
180
+ Close the list
181
+
182
+ - kind: section
183
+ for: all
184
+ title: Open decisions
185
+ freeform:
186
+ - title: TODO
187
+ body: >-
188
+ The number of options at which to switch from Select to Combobox isn't decided
189
+ ("about 15" is an estimate).
190
+
191
+ sourceFiles:
192
+ - platform: react
193
+ file: ./Combobox.tsx
194
+
195
+ imports:
196
+ - platform: react
197
+ code: >-
198
+ import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from "@designil/labdsnov"
199
+ package: "@designil/labdsnov"
200
+
201
+ traits:
202
+ - traitType: variant
203
+ kind: boolean
204
+ id: multiple
205
+ description: >-
206
+ Several values can be picked; used with chips
207
+ - traitType: variant
208
+ kind: boolean
209
+ id: showTrigger
210
+ description: >-
211
+ Chevron button that opens the list (default `true`)
212
+ - traitType: variant
213
+ kind: boolean
214
+ id: showClear
215
+ description: >-
216
+ "×" button that clears the value
217
+ - traitType: state
218
+ kind: boolean
219
+ id: disabled
220
+ description: >-
221
+ Disabled
222
+ - traitType: state
223
+ kind: boolean
224
+ id: open
225
+ description: >-
226
+ The list is open
227
+
228
+ uses:
229
+ - to: input-group
230
+ - to: label
231
+ alternatives:
232
+ - to: select
233
+ - to: radio-group
234
+
235
+ refs:
236
+ - href: ./Combobox.md
237
+ rel: relates-to
238
+ role: Thai usage doc
239
+ - href: ./Combobox.stories.tsx
240
+ rel: demo
241
+ role: CSF stories
@@ -0,0 +1,179 @@
1
+ kind: component
2
+ id: date-picker
3
+ name: DatePicker
4
+ description: >-
5
+ A form button that opens a calendar in a popup to pick one date, shown in Thai with the
6
+ Buddhist year ("13 พ.ย. 2569"). Composed from Popover + Calendar + Button (shadcn only
7
+ has a recipe for this).
8
+ metadata:
9
+ status: {status: stable}
10
+ since: 1.0.0
11
+ tags: [form, date]
12
+
13
+ sections:
14
+ - kind: guidelines
15
+ for: all
16
+ framing: when-to-use
17
+ items:
18
+ - level: should
19
+ statement: >-
20
+ Use as a date field in a form, e.g. employment start date, effective date.
21
+ - level: may
22
+ statement: >-
23
+ Use for birth dates or other distant dates when the month/year dropdowns are turned
24
+ on through `calendarProps` (story `DateOfBirth`).
25
+ example:
26
+ ref:
27
+ href: ./DatePicker.stories.tsx#DateOfBirth
28
+ rel: demo
29
+ - level: must-not
30
+ statement: >-
31
+ Don't use for date ranges (not supported). Compose `Calendar mode="range"` in a
32
+ <dsds:popover> yourself.
33
+ alternatives:
34
+ - to: calendar
35
+ - to: popover
36
+ checkedBy: manual
37
+ - level: should-not
38
+ statement: >-
39
+ Don't use to show a date that can't be edited. Show it as text, "13 พ.ย. 2569".
40
+
41
+ - kind: guidelines
42
+ for: all
43
+ items:
44
+ - id: label-by-id
45
+ level: must
46
+ statement: >-
47
+ Put an `id` on DatePicker (it lands on the button) and bind it to `<Label htmlFor>`.
48
+ Otherwise the button's name is just "เลือกวันที่" (choose a date) or the date,
49
+ with no hint of what the field is.
50
+ evidence:
51
+ - href: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html
52
+ role: WCAG 2.2 SC 3.3.2 (A)
53
+ uses:
54
+ - to: label
55
+ checkedBy: manual
56
+ - id: value-is-date
57
+ level: must
58
+ statement: >-
59
+ The value is a `Date` (`value` / `onValueChange`); `onValueChange` gets `undefined`
60
+ when cleared. Keep it in Client Component state and send it to the server as ISO,
61
+ not as the displayed text (which uses the Buddhist year).
62
+ checkedBy: manual
63
+ - id: limit-range
64
+ level: must
65
+ statement: >-
66
+ Restrict pickable dates through `calendarProps.disabled` (e.g. birth date
67
+ `{ after: today }`, effective date `{ before: today }`) instead of validating after
68
+ the pick.
69
+ uses:
70
+ - to: calendar
71
+ checkedBy: manual
72
+ - id: closes-on-select
73
+ level: should
74
+ statement: >-
75
+ Picking a date closes the popup and returns focus to the button. No "ตกลง" (OK)
76
+ button is needed.
77
+ checks:
78
+ - href: ./DatePicker.stories.tsx#PickDate
79
+ role: test
80
+ note: play function checks that after picking, the button shows "20 พ.ย. 2569" and aria-expanded="false"
81
+ checkedBy: automated
82
+ - id: full-width-in-form
83
+ level: should
84
+ statement: >-
85
+ It's 240px wide by default. In forms add `className="w-full"` to match other
86
+ fields.
87
+ checkedBy: manual
88
+ - id: placeholder-default
89
+ level: may
90
+ statement: >-
91
+ Use the default `placeholder` "เลือกวันที่" (choose a date). Change it when it adds
92
+ meaning, e.g. "เลือกวันเกิด" (choose date of birth).
93
+ - id: no-date-fns-format
94
+ level: must-not
95
+ statement: >-
96
+ Don't format a date shown next to the field with `date-fns` `th` to match the
97
+ button. Use
98
+ `Intl.DateTimeFormat("th-TH", { day: "numeric", month: "short", year: "numeric" })`.
99
+ refs:
100
+ - to: shared-content#buddhist-year
101
+ rel: relates-to
102
+ checkedBy: manual
103
+
104
+ - kind: guidelines
105
+ for: all
106
+ title: Accessibility
107
+ tags: [accessibility]
108
+ items:
109
+ - id: invalid-described
110
+ level: must
111
+ statement: >-
112
+ An invalid field gets `aria-invalid` and `aria-describedby` pointing at the
113
+ `FieldError` (both props are passed on to the button).
114
+ refines:
115
+ - to: shared-a11y#invalid-has-message
116
+ checkedBy: manual
117
+ - id: placeholder-contrast
118
+ level: must
119
+ statement: >-
120
+ The muted placeholder text passes 5.97:1 light / 8.43:1 dark on the page
121
+ background.
122
+ checks:
123
+ - href: ../../../scripts/tokens.mjs
124
+ role: test
125
+ note: CONTRAST_PAIRS "คำอธิบายบนพื้นหน้า"
126
+ checkedBy: automated
127
+
128
+ - kind: section
129
+ for: all
130
+ title: Open decisions
131
+ freeform:
132
+ - title: TODO
133
+ body: >-
134
+ Date ranges aren't supported, there's no typed date field, and the look (an outline
135
+ button with a calendar icon) differs from Input / Select (`filled`); it's not
136
+ decided whether to make them match.
137
+
138
+ sourceFiles:
139
+ - platform: react
140
+ file: ./DatePicker.tsx
141
+
142
+ imports:
143
+ - platform: react
144
+ code: >-
145
+ import { DatePicker } from "@designil/labdsnov"
146
+ package: "@designil/labdsnov"
147
+
148
+ traits:
149
+ - traitType: state
150
+ kind: boolean
151
+ id: disabled
152
+ description: >-
153
+ Disabled
154
+ - traitType: state
155
+ kind: boolean
156
+ id: aria-invalid
157
+ name: Invalid
158
+ description: >-
159
+ Invalid value; red border
160
+ - traitType: state
161
+ kind: boolean
162
+ id: empty
163
+ description: >-
164
+ Nothing picked yet; shows the muted placeholder
165
+
166
+ uses:
167
+ - to: popover
168
+ - to: calendar
169
+ - to: button
170
+ alternatives:
171
+ - to: calendar
172
+
173
+ refs:
174
+ - href: ./DatePicker.md
175
+ rel: relates-to
176
+ role: Thai usage doc
177
+ - href: ./DatePicker.stories.tsx
178
+ rel: demo
179
+ role: CSF stories