@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,235 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: input
|
|
3
|
+
name: Input
|
|
4
|
+
description: >-
|
|
5
|
+
A single-line text field for things like name, email, password, phone number or file
|
|
6
|
+
selection. 36px high, full width, pill-shaped. Wraps Base UI's `Input`.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [form]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use for short single-line data in forms, such as editing account details or
|
|
20
|
+
signing in.
|
|
21
|
+
- level: must-not
|
|
22
|
+
statement: >-
|
|
23
|
+
Don't use it for multi-line text. Use <dsds:textarea>.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: textarea
|
|
26
|
+
checkedBy: manual
|
|
27
|
+
- level: must-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't use it to choose from a list or to switch something on/off. Use
|
|
30
|
+
<dsds:select>, <dsds:radio-group>, <dsds:checkbox> or <dsds:switch>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: select
|
|
33
|
+
- to: radio-group
|
|
34
|
+
- to: checkbox
|
|
35
|
+
- to: switch
|
|
36
|
+
checkedBy: manual
|
|
37
|
+
- level: must-not
|
|
38
|
+
statement: >-
|
|
39
|
+
Don't use `type="date"` to pick a date. Use <dsds:date-picker> (Buddhist year),
|
|
40
|
+
because the browser's date field shows the year in the device's calendar.
|
|
41
|
+
alternatives:
|
|
42
|
+
- to: date-picker
|
|
43
|
+
checkedBy: manual
|
|
44
|
+
- level: should-not
|
|
45
|
+
statement: >-
|
|
46
|
+
Don't use it for one-time codes. Use <dsds:input-otp>.
|
|
47
|
+
alternatives:
|
|
48
|
+
- to: input-otp
|
|
49
|
+
|
|
50
|
+
- kind: guidelines
|
|
51
|
+
for: all
|
|
52
|
+
items:
|
|
53
|
+
- id: always-labelled
|
|
54
|
+
level: must
|
|
55
|
+
statement: >-
|
|
56
|
+
Always pair it with a <dsds:label> (or `FieldLabel` in <dsds:field>) bound by
|
|
57
|
+
`id` / `htmlFor`.
|
|
58
|
+
uses:
|
|
59
|
+
- to: label
|
|
60
|
+
- to: field
|
|
61
|
+
checkedBy: manual
|
|
62
|
+
- id: placeholder-not-label
|
|
63
|
+
level: must-not
|
|
64
|
+
statement: >-
|
|
65
|
+
Don't use the placeholder as the label: it disappears once the user starts typing.
|
|
66
|
+
Use it only to show the format, e.g. "04xx xxx xxx".
|
|
67
|
+
evidence:
|
|
68
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html
|
|
69
|
+
role: WCAG 2.2 SC 3.3.2 (A)
|
|
70
|
+
checkedBy: manual
|
|
71
|
+
- id: right-type
|
|
72
|
+
level: should
|
|
73
|
+
statement: >-
|
|
74
|
+
Pick the `type` that matches the data (`email`, `password`, `tel`, `number`,
|
|
75
|
+
`search`, `file`) so mobile shows the right keyboard, and set `autoComplete`
|
|
76
|
+
(`email`, `name`, `tel`) on personal-details forms.
|
|
77
|
+
evidence:
|
|
78
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html
|
|
79
|
+
role: WCAG 2.2 SC 1.3.5 (AA)
|
|
80
|
+
example:
|
|
81
|
+
ref:
|
|
82
|
+
href: ./Input.stories.tsx#Types
|
|
83
|
+
rel: demo
|
|
84
|
+
checkedBy: manual
|
|
85
|
+
- id: required-on-input
|
|
86
|
+
level: must
|
|
87
|
+
statement: >-
|
|
88
|
+
Required fields set `required` on the Input itself too. The asterisk from
|
|
89
|
+
`Label required` is only visual.
|
|
90
|
+
refines:
|
|
91
|
+
- to: field#required-two-places
|
|
92
|
+
checkedBy: manual
|
|
93
|
+
- id: filled-default
|
|
94
|
+
level: should
|
|
95
|
+
statement: >-
|
|
96
|
+
Use `variant="filled"` (default, tinted background with a border) in forms. Where
|
|
97
|
+
`outline` (transparent background) should be used isn't defined yet.
|
|
98
|
+
checkedBy: manual
|
|
99
|
+
- id: money-in-group
|
|
100
|
+
level: should
|
|
101
|
+
statement: >-
|
|
102
|
+
A money field that needs "AU$" uses <dsds:input-group>. Don't write "AU$" in the
|
|
103
|
+
placeholder.
|
|
104
|
+
alternatives:
|
|
105
|
+
- to: input-group
|
|
106
|
+
checkedBy: manual
|
|
107
|
+
- id: font-size-mobile
|
|
108
|
+
level: should-not
|
|
109
|
+
statement: >-
|
|
110
|
+
Don't shrink the text below 16px on narrow screens with `className`: iOS zooms the
|
|
111
|
+
page on focus. The field already uses 16px on narrow screens and 14px from 768px.
|
|
112
|
+
checkedBy: manual
|
|
113
|
+
|
|
114
|
+
- kind: guidelines
|
|
115
|
+
for: all
|
|
116
|
+
title: Accessibility
|
|
117
|
+
tags: [accessibility]
|
|
118
|
+
items:
|
|
119
|
+
- id: invalid-described
|
|
120
|
+
level: must
|
|
121
|
+
statement: >-
|
|
122
|
+
An invalid field has `aria-invalid` and an `aria-describedby` pointing at the error
|
|
123
|
+
message below it.
|
|
124
|
+
refines:
|
|
125
|
+
- to: shared-a11y#invalid-has-message
|
|
126
|
+
checks:
|
|
127
|
+
- href: ./Input.stories.tsx#Invalid
|
|
128
|
+
role: test
|
|
129
|
+
note: play function checks toBeInvalid and toHaveAccessibleDescription
|
|
130
|
+
checkedBy: automated
|
|
131
|
+
- id: disabled-not-focusable
|
|
132
|
+
level: must
|
|
133
|
+
statement: >-
|
|
134
|
+
A `disabled` field dims to 50% and leaves the Tab order. A value the user must be
|
|
135
|
+
able to read or copy uses `readOnly` instead.
|
|
136
|
+
checks:
|
|
137
|
+
- href: ./Input.stories.tsx#Disabled
|
|
138
|
+
role: test
|
|
139
|
+
checkedBy: automated
|
|
140
|
+
- id: field-contrast
|
|
141
|
+
level: must
|
|
142
|
+
statement: >-
|
|
143
|
+
The field border (`--field-border`) passes 3.93:1 light / 4.05:1 dark on the page
|
|
144
|
+
background and 3.50:1 in a dark-mode card. The placeholder passes 5.40:1 / 7.17:1.
|
|
145
|
+
Don't change the border to `--border`.
|
|
146
|
+
checks:
|
|
147
|
+
- href: ../../../scripts/tokens.mjs
|
|
148
|
+
role: test
|
|
149
|
+
note: CONTRAST_PAIRS "เส้นขอบช่องกรอก…" and "placeholder ในช่องกรอก"
|
|
150
|
+
checkedBy: automated
|
|
151
|
+
- refs:
|
|
152
|
+
- to: shared-a11y#invalid-keeps-focus
|
|
153
|
+
rel: same-as
|
|
154
|
+
|
|
155
|
+
- kind: guidelines
|
|
156
|
+
for: agent
|
|
157
|
+
items:
|
|
158
|
+
- refs:
|
|
159
|
+
- to: shared-testing#fire-change-for-typing
|
|
160
|
+
rel: same-as
|
|
161
|
+
|
|
162
|
+
- kind: definitions
|
|
163
|
+
for: all
|
|
164
|
+
title: States
|
|
165
|
+
context: labdsnov.states
|
|
166
|
+
items:
|
|
167
|
+
- term: Keyboard focus
|
|
168
|
+
definition: >-
|
|
169
|
+
Solid `--focus-ring` border and ring.
|
|
170
|
+
- term: aria-invalid
|
|
171
|
+
definition: >-
|
|
172
|
+
Red border and faint red ring. On focus the ring becomes solid red.
|
|
173
|
+
- term: Disabled
|
|
174
|
+
definition: >-
|
|
175
|
+
Dimmed to 50%, not focusable.
|
|
176
|
+
|
|
177
|
+
sourceFiles:
|
|
178
|
+
- platform: react
|
|
179
|
+
file: ./Input.tsx
|
|
180
|
+
|
|
181
|
+
imports:
|
|
182
|
+
- platform: react
|
|
183
|
+
code: >-
|
|
184
|
+
import { Input } from "@designil/labdsnov"
|
|
185
|
+
package: "@designil/labdsnov"
|
|
186
|
+
|
|
187
|
+
traits:
|
|
188
|
+
- traitType: variant
|
|
189
|
+
kind: enum
|
|
190
|
+
id: variant
|
|
191
|
+
description: >-
|
|
192
|
+
The field's look.
|
|
193
|
+
values:
|
|
194
|
+
- id: filled
|
|
195
|
+
description: >-
|
|
196
|
+
Tinted background (`--field-bg`) with a border. Default, used in regular forms.
|
|
197
|
+
- id: outline
|
|
198
|
+
description: >-
|
|
199
|
+
Transparent background with a border. Where to use it isn't defined yet.
|
|
200
|
+
- traitType: state
|
|
201
|
+
kind: boolean
|
|
202
|
+
id: disabled
|
|
203
|
+
description: >-
|
|
204
|
+
Disabled.
|
|
205
|
+
- traitType: state
|
|
206
|
+
kind: boolean
|
|
207
|
+
id: aria-invalid
|
|
208
|
+
name: Invalid
|
|
209
|
+
description: >-
|
|
210
|
+
The value is invalid.
|
|
211
|
+
|
|
212
|
+
uses:
|
|
213
|
+
- to: label
|
|
214
|
+
alternatives:
|
|
215
|
+
- to: textarea
|
|
216
|
+
- to: input-group
|
|
217
|
+
- to: date-picker
|
|
218
|
+
|
|
219
|
+
refs:
|
|
220
|
+
- href: ./Input.md
|
|
221
|
+
rel: relates-to
|
|
222
|
+
role: Thai usage doc
|
|
223
|
+
- href: ./Input.stories.tsx
|
|
224
|
+
rel: demo
|
|
225
|
+
role: CSF stories
|
|
226
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=10-52
|
|
227
|
+
rel: design
|
|
228
|
+
role: Input in Figma
|
|
229
|
+
- href: ../../../figma/Input.figma.ts
|
|
230
|
+
rel: source
|
|
231
|
+
role: Code Connect template
|
|
232
|
+
|
|
233
|
+
$extensions:
|
|
234
|
+
com.figma:
|
|
235
|
+
nodeId: "10:52"
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: input-group
|
|
3
|
+
name: InputGroup
|
|
4
|
+
description: >-
|
|
5
|
+
A text field with an icon, text or button inside the same frame, such as "AU$" before
|
|
6
|
+
an amount or a copy button. Looks like a `filled` Input, 36px high.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [form]
|
|
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 unit or currency attached to the value, such as "AU$" or "%".
|
|
20
|
+
- level: should
|
|
21
|
+
statement: >-
|
|
22
|
+
Use for a search icon in a search field, and for buttons that act on the field's
|
|
23
|
+
value, such as show/hide password or copy.
|
|
24
|
+
- level: should
|
|
25
|
+
statement: >-
|
|
26
|
+
Use `InputGroupTextarea` for a text area with a row below it, such as a character
|
|
27
|
+
counter.
|
|
28
|
+
example:
|
|
29
|
+
ref:
|
|
30
|
+
href: ./InputGroup.stories.tsx#TextareaWithFooter
|
|
31
|
+
rel: demo
|
|
32
|
+
- level: must-not
|
|
33
|
+
statement: >-
|
|
34
|
+
Don't put the form's submit button in the group. Place a <dsds:button> outside the
|
|
35
|
+
field (or use <dsds:button-group> when the button really is part of the field).
|
|
36
|
+
alternatives:
|
|
37
|
+
- to: button
|
|
38
|
+
- to: button-group
|
|
39
|
+
checkedBy: manual
|
|
40
|
+
- level: must-not
|
|
41
|
+
statement: >-
|
|
42
|
+
Don't use `InputGroupText` as the field's label. Use <dsds:label> / `FieldLabel`.
|
|
43
|
+
alternatives:
|
|
44
|
+
- to: label
|
|
45
|
+
checkedBy: manual
|
|
46
|
+
- level: should-not
|
|
47
|
+
statement: >-
|
|
48
|
+
Don't use it to choose from a list. Use <dsds:select> or <dsds:combobox>.
|
|
49
|
+
alternatives:
|
|
50
|
+
- to: select
|
|
51
|
+
- to: combobox
|
|
52
|
+
|
|
53
|
+
- kind: guidelines
|
|
54
|
+
for: all
|
|
55
|
+
items:
|
|
56
|
+
- id: group-parts
|
|
57
|
+
level: must
|
|
58
|
+
statement: >-
|
|
59
|
+
Use `InputGroupInput` / `InputGroupTextarea` instead of `Input` / `Textarea` inside
|
|
60
|
+
the group (they have no background or frame of their own). A plain `Input` in the
|
|
61
|
+
group gives a frame inside a frame.
|
|
62
|
+
checkedBy: manual
|
|
63
|
+
- id: addon-after-in-code
|
|
64
|
+
level: should
|
|
65
|
+
statement: >-
|
|
66
|
+
Always place `InputGroupAddon` after the input in code and set where it shows with
|
|
67
|
+
`align` (default `inline-start`). The DOM order is then field first, addon second.
|
|
68
|
+
checkedBy: manual
|
|
69
|
+
- id: button-ghost-xs
|
|
70
|
+
level: should
|
|
71
|
+
statement: >-
|
|
72
|
+
Buttons in the group use `InputGroupButton` (`ghost`, default `size="xs"`, or
|
|
73
|
+
`icon-xs` for icons), not a regular-size `Button`, which is as tall as the field.
|
|
74
|
+
checkedBy: manual
|
|
75
|
+
- id: disabled-manual
|
|
76
|
+
level: must
|
|
77
|
+
statement: >-
|
|
78
|
+
To disable the whole group, set `data-disabled="true"` on `InputGroup` yourself and
|
|
79
|
+
`disabled` on the input. The group doesn't set this state automatically.
|
|
80
|
+
checkedBy: manual
|
|
81
|
+
- id: readonly-copy
|
|
82
|
+
level: should
|
|
83
|
+
statement: >-
|
|
84
|
+
A value offered for copying (e.g. a member number) uses `readOnly`, not
|
|
85
|
+
`disabled`, so it can still be focused and selected.
|
|
86
|
+
example:
|
|
87
|
+
ref:
|
|
88
|
+
href: ./InputGroup.stories.tsx#WithButtons
|
|
89
|
+
rel: demo
|
|
90
|
+
checkedBy: manual
|
|
91
|
+
|
|
92
|
+
- kind: guidelines
|
|
93
|
+
for: all
|
|
94
|
+
title: Accessibility
|
|
95
|
+
tags: [accessibility]
|
|
96
|
+
items:
|
|
97
|
+
- id: button-label
|
|
98
|
+
level: must
|
|
99
|
+
statement: >-
|
|
100
|
+
An icon-only `InputGroupButton` has a Thai `aria-label`, such as "คัดลอก" (copy) or
|
|
101
|
+
"แสดง" (show).
|
|
102
|
+
refines:
|
|
103
|
+
- to: shared-a11y#icon-only-label
|
|
104
|
+
checks:
|
|
105
|
+
- href: ./InputGroup.stories.tsx#WithButtons
|
|
106
|
+
role: test
|
|
107
|
+
note: play function finds the button by the name "คัดลอก"
|
|
108
|
+
checkedBy: automated
|
|
109
|
+
- id: addon-click-focuses
|
|
110
|
+
level: must
|
|
111
|
+
statement: >-
|
|
112
|
+
Clicking an addon (outside its buttons) focuses the input. Don't stop click events
|
|
113
|
+
in the addon.
|
|
114
|
+
checks:
|
|
115
|
+
- href: ./InputGroup.stories.tsx#SearchIcon
|
|
116
|
+
role: test
|
|
117
|
+
checkedBy: automated
|
|
118
|
+
- id: group-focus-invalid
|
|
119
|
+
level: must
|
|
120
|
+
statement: >-
|
|
121
|
+
When the input is focused the whole group shows the ring, and when the input has
|
|
122
|
+
`aria-invalid` the whole group turns red. Put `aria-invalid` on `InputGroupInput`,
|
|
123
|
+
not on `InputGroup`.
|
|
124
|
+
refs:
|
|
125
|
+
- to: shared-a11y#invalid-has-message
|
|
126
|
+
rel: relates-to
|
|
127
|
+
checkedBy: manual
|
|
128
|
+
- id: unit-not-in-name
|
|
129
|
+
level: should
|
|
130
|
+
statement: >-
|
|
131
|
+
The unit in `InputGroupText` ("AU$") isn't part of the field's name. Put the unit
|
|
132
|
+
in the label too when it matters, e.g. "จำนวนเงิน (AUD)" (amount).
|
|
133
|
+
checkedBy: manual
|
|
134
|
+
|
|
135
|
+
- kind: guidelines
|
|
136
|
+
for: agent
|
|
137
|
+
items:
|
|
138
|
+
- refs:
|
|
139
|
+
- to: shared-testing#fire-change-for-typing
|
|
140
|
+
rel: same-as
|
|
141
|
+
|
|
142
|
+
- kind: definitions
|
|
143
|
+
for: all
|
|
144
|
+
context: anatomy
|
|
145
|
+
items:
|
|
146
|
+
- term: InputGroup
|
|
147
|
+
definition: >-
|
|
148
|
+
The frame. Gets the ring when an input inside it is focused.
|
|
149
|
+
- term: InputGroupInput / InputGroupTextarea
|
|
150
|
+
definition: >-
|
|
151
|
+
Text fields with no background or frame.
|
|
152
|
+
- term: InputGroupAddon
|
|
153
|
+
definition: >-
|
|
154
|
+
The addon. Takes `align`.
|
|
155
|
+
- term: InputGroupText
|
|
156
|
+
definition: >-
|
|
157
|
+
Muted text or icon.
|
|
158
|
+
- term: InputGroupButton
|
|
159
|
+
definition: >-
|
|
160
|
+
A `ghost` button. Takes `size`.
|
|
161
|
+
|
|
162
|
+
- kind: section
|
|
163
|
+
for: all
|
|
164
|
+
title: Open decisions
|
|
165
|
+
freeform:
|
|
166
|
+
- title: TODO
|
|
167
|
+
body: >-
|
|
168
|
+
There's no automatic disabled state for the whole group yet.
|
|
169
|
+
|
|
170
|
+
sourceFiles:
|
|
171
|
+
- platform: react
|
|
172
|
+
file: ./InputGroup.tsx
|
|
173
|
+
|
|
174
|
+
imports:
|
|
175
|
+
- platform: react
|
|
176
|
+
code: >-
|
|
177
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "@designil/labdsnov"
|
|
178
|
+
package: "@designil/labdsnov"
|
|
179
|
+
|
|
180
|
+
traits:
|
|
181
|
+
- traitType: variant
|
|
182
|
+
kind: enum
|
|
183
|
+
id: addonAlign
|
|
184
|
+
name: InputGroupAddon align
|
|
185
|
+
description: >-
|
|
186
|
+
The `align` prop of `InputGroupAddon`.
|
|
187
|
+
values:
|
|
188
|
+
- id: inline-start
|
|
189
|
+
description: >-
|
|
190
|
+
Left of the input (default).
|
|
191
|
+
- id: inline-end
|
|
192
|
+
description: >-
|
|
193
|
+
Right of the input.
|
|
194
|
+
- id: block-start
|
|
195
|
+
description: >-
|
|
196
|
+
A row above; the group grows vertically.
|
|
197
|
+
- id: block-end
|
|
198
|
+
description: >-
|
|
199
|
+
A row below, e.g. a character counter.
|
|
200
|
+
- traitType: variant
|
|
201
|
+
kind: enum
|
|
202
|
+
id: buttonSize
|
|
203
|
+
name: InputGroupButton size
|
|
204
|
+
description: >-
|
|
205
|
+
The `size` prop of `InputGroupButton`.
|
|
206
|
+
values:
|
|
207
|
+
- id: xs
|
|
208
|
+
description: >-
|
|
209
|
+
24px high, with text (default).
|
|
210
|
+
- id: sm
|
|
211
|
+
description: >-
|
|
212
|
+
Button's `sm` size.
|
|
213
|
+
- id: icon-xs
|
|
214
|
+
description: >-
|
|
215
|
+
24×24px, icon only.
|
|
216
|
+
- id: icon-sm
|
|
217
|
+
description: >-
|
|
218
|
+
32×32px, icon only.
|
|
219
|
+
|
|
220
|
+
uses:
|
|
221
|
+
- to: input
|
|
222
|
+
- to: textarea
|
|
223
|
+
- to: button
|
|
224
|
+
alternatives:
|
|
225
|
+
- to: button-group
|
|
226
|
+
- to: combobox
|
|
227
|
+
|
|
228
|
+
refs:
|
|
229
|
+
- href: ./InputGroup.md
|
|
230
|
+
rel: relates-to
|
|
231
|
+
role: Thai usage doc
|
|
232
|
+
- href: ./InputGroup.stories.tsx
|
|
233
|
+
rel: demo
|
|
234
|
+
role: CSF stories
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: input-otp
|
|
3
|
+
name: InputOTP
|
|
4
|
+
description: >-
|
|
5
|
+
A one-time passcode (OTP) field split into one box per character, e.g. a 6-digit
|
|
6
|
+
SMS code. A single real input sits under the boxes. Built on `input-otp`.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [form, authentication]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use for one-time identity codes when signing in or confirming a withdrawal.
|
|
20
|
+
- level: must-not
|
|
21
|
+
statement: >-
|
|
22
|
+
Don't use for passwords or other long numbers (account number, TFN); use
|
|
23
|
+
<dsds:input>.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: input
|
|
26
|
+
checkedBy: manual
|
|
27
|
+
- level: must-not
|
|
28
|
+
statement: >-
|
|
29
|
+
Don't use for a PIN that must hide its digits: there is no option to mask the
|
|
30
|
+
boxes yet.
|
|
31
|
+
checkedBy: manual
|
|
32
|
+
|
|
33
|
+
- kind: guidelines
|
|
34
|
+
for: all
|
|
35
|
+
items:
|
|
36
|
+
- id: slots-match-length
|
|
37
|
+
level: must
|
|
38
|
+
statement: >-
|
|
39
|
+
Render one `InputOTPSlot` for every character of `maxLength` (required), with
|
|
40
|
+
`index` starting at 0 and no gaps. A missing box still accepts input, but its
|
|
41
|
+
character is invisible.
|
|
42
|
+
checkedBy: manual
|
|
43
|
+
- id: group-of-three
|
|
44
|
+
level: should
|
|
45
|
+
statement: >-
|
|
46
|
+
Split a 6-digit code into two groups of 3 boxes with an `InputOTPSeparator` between
|
|
47
|
+
them, so it's easy to read and compare against the SMS.
|
|
48
|
+
checkedBy: manual
|
|
49
|
+
- id: verify-on-complete
|
|
50
|
+
level: should
|
|
51
|
+
statement: >-
|
|
52
|
+
Send the code for checking in `onComplete` (called once every box is filled); no
|
|
53
|
+
separate "ยืนยัน" (confirm) button is needed. Show a checking state (e.g.
|
|
54
|
+
<dsds:spinner>) and set `disabled` while it runs.
|
|
55
|
+
checks:
|
|
56
|
+
- href: ./InputOTP.stories.tsx#Typing
|
|
57
|
+
role: test
|
|
58
|
+
note: play function checks that onComplete receives "482913"
|
|
59
|
+
uses:
|
|
60
|
+
- to: spinner
|
|
61
|
+
checkedBy: assisted
|
|
62
|
+
- id: paste-and-autofill
|
|
63
|
+
level: must-not
|
|
64
|
+
statement: >-
|
|
65
|
+
Don't replace it with 6 separate Inputs, and don't override `autoComplete`. This
|
|
66
|
+
component uses one real input, so pasting the whole code and SMS autofill on
|
|
67
|
+
mobile both work.
|
|
68
|
+
checkedBy: manual
|
|
69
|
+
|
|
70
|
+
- kind: guidelines
|
|
71
|
+
for: all
|
|
72
|
+
title: Accessibility
|
|
73
|
+
tags: [accessibility]
|
|
74
|
+
items:
|
|
75
|
+
- id: label-with-length
|
|
76
|
+
level: must
|
|
77
|
+
statement: >-
|
|
78
|
+
Tie a <dsds:label> to the `id` of `InputOTP` and state the length in it, e.g.
|
|
79
|
+
"รหัสยืนยัน 6 หลัก" (6-digit verification code).
|
|
80
|
+
uses:
|
|
81
|
+
- to: label
|
|
82
|
+
checkedBy: manual
|
|
83
|
+
- id: invalid-all-slots
|
|
84
|
+
level: must
|
|
85
|
+
statement: >-
|
|
86
|
+
For a wrong code, put `aria-invalid` on every `InputOTPSlot` (red border; the
|
|
87
|
+
active box gets a solid red ring) and add a message under the field saying what to
|
|
88
|
+
do next ("รหัสไม่ถูกต้อง กรุณาลองอีกครั้ง", wrong code, please try again).
|
|
89
|
+
refines:
|
|
90
|
+
- to: shared-a11y#invalid-has-message
|
|
91
|
+
example:
|
|
92
|
+
ref:
|
|
93
|
+
href: ./InputOTP.stories.tsx#Invalid
|
|
94
|
+
rel: demo
|
|
95
|
+
checkedBy: manual
|
|
96
|
+
- id: timing
|
|
97
|
+
level: should
|
|
98
|
+
statement: >-
|
|
99
|
+
If the code expires, show the remaining time as text and offer a
|
|
100
|
+
"ส่งรหัสอีกครั้ง" (resend code) button. Don't clear the field automatically when
|
|
101
|
+
time runs out.
|
|
102
|
+
evidence:
|
|
103
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/timing-adjustable.html
|
|
104
|
+
role: WCAG 2.2 SC 2.2.1 (A)
|
|
105
|
+
checkedBy: manual
|
|
106
|
+
|
|
107
|
+
- kind: guidelines
|
|
108
|
+
for: agent
|
|
109
|
+
items:
|
|
110
|
+
- refs:
|
|
111
|
+
- to: shared-testing#fire-change-for-typing
|
|
112
|
+
rel: same-as
|
|
113
|
+
|
|
114
|
+
- kind: definitions
|
|
115
|
+
for: all
|
|
116
|
+
context: anatomy
|
|
117
|
+
items:
|
|
118
|
+
- term: InputOTP
|
|
119
|
+
definition: >-
|
|
120
|
+
The real input. Takes `maxLength` (required), `value` / `onChange`, `onComplete`,
|
|
121
|
+
`pattern`, `disabled`, `containerClassName`.
|
|
122
|
+
- term: InputOTPGroup
|
|
123
|
+
definition: >-
|
|
124
|
+
A run of boxes joined into one capsule.
|
|
125
|
+
- term: InputOTPSlot
|
|
126
|
+
definition: >-
|
|
127
|
+
One 36px box per character. Takes `index` (required) and `aria-invalid`. The active
|
|
128
|
+
box shows the `--focus-ring` ring and a blinking caret.
|
|
129
|
+
- term: InputOTPSeparator
|
|
130
|
+
definition: >-
|
|
131
|
+
A dash between groups.
|
|
132
|
+
|
|
133
|
+
- kind: section
|
|
134
|
+
for: all
|
|
135
|
+
title: Open decisions
|
|
136
|
+
freeform:
|
|
137
|
+
- title: TODO
|
|
138
|
+
body: >-
|
|
139
|
+
There is no option to mask digits (PIN) yet, and no example of `pattern` (e.g.
|
|
140
|
+
digits only).
|
|
141
|
+
|
|
142
|
+
sourceFiles:
|
|
143
|
+
- platform: react
|
|
144
|
+
file: ./InputOTP.tsx
|
|
145
|
+
|
|
146
|
+
imports:
|
|
147
|
+
- platform: react
|
|
148
|
+
code: >-
|
|
149
|
+
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "@designil/labdsnov"
|
|
150
|
+
package: "@designil/labdsnov"
|
|
151
|
+
|
|
152
|
+
traits:
|
|
153
|
+
- traitType: state
|
|
154
|
+
kind: boolean
|
|
155
|
+
id: disabled
|
|
156
|
+
description: >-
|
|
157
|
+
Disabled, dimmed to 50%.
|
|
158
|
+
- traitType: state
|
|
159
|
+
kind: boolean
|
|
160
|
+
id: aria-invalid
|
|
161
|
+
name: Invalid
|
|
162
|
+
description: >-
|
|
163
|
+
On `InputOTPSlot`: the code is wrong. Red border.
|
|
164
|
+
- traitType: state
|
|
165
|
+
kind: boolean
|
|
166
|
+
id: active
|
|
167
|
+
description: >-
|
|
168
|
+
The box being filled. Solid ring and a blinking caret.
|
|
169
|
+
|
|
170
|
+
uses:
|
|
171
|
+
- to: label
|
|
172
|
+
alternatives:
|
|
173
|
+
- to: input
|
|
174
|
+
|
|
175
|
+
refs:
|
|
176
|
+
- href: ./InputOTP.md
|
|
177
|
+
rel: relates-to
|
|
178
|
+
role: Thai usage doc
|
|
179
|
+
- href: ./InputOTP.stories.tsx
|
|
180
|
+
rel: demo
|
|
181
|
+
role: CSF stories
|
|
182
|
+
- href: https://input-otp.rodz.dev
|
|
183
|
+
rel: relates-to
|
|
184
|
+
role: input-otp documentation
|