@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,119 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: kbd
|
|
3
|
+
name: Kbd
|
|
4
|
+
description: >-
|
|
5
|
+
Shows a keyboard key or shortcut, such as ⌘ K, in text, a menu or a Tooltip. A
|
|
6
|
+
`<kbd>`, 22px high, 12px text, 10px radius.
|
|
7
|
+
metadata:
|
|
8
|
+
status: {status: stable}
|
|
9
|
+
since: 1.0.0
|
|
10
|
+
tags: [display]
|
|
11
|
+
|
|
12
|
+
sections:
|
|
13
|
+
- kind: guidelines
|
|
14
|
+
for: all
|
|
15
|
+
framing: when-to-use
|
|
16
|
+
items:
|
|
17
|
+
- level: should
|
|
18
|
+
statement: >-
|
|
19
|
+
Use to show shortcuts in a <dsds:tooltip>, a menu or help text.
|
|
20
|
+
- level: may
|
|
21
|
+
statement: >-
|
|
22
|
+
Use as a hint inside a search field in <dsds:input-group>; its background follows
|
|
23
|
+
the field.
|
|
24
|
+
example:
|
|
25
|
+
ref:
|
|
26
|
+
href: ./Kbd.stories.tsx#InInputGroup
|
|
27
|
+
rel: demo
|
|
28
|
+
- level: must-not
|
|
29
|
+
statement: >-
|
|
30
|
+
Don't use it as something to click. Kbd isn't interactive; use <dsds:button>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: button
|
|
33
|
+
checkedBy: manual
|
|
34
|
+
- level: should-not
|
|
35
|
+
statement: >-
|
|
36
|
+
Don't use for code or values the user must type, such as a member number; use
|
|
37
|
+
`<code>` or plain text.
|
|
38
|
+
|
|
39
|
+
- kind: guidelines
|
|
40
|
+
for: all
|
|
41
|
+
items:
|
|
42
|
+
- id: group-simultaneous
|
|
43
|
+
level: must
|
|
44
|
+
statement: >-
|
|
45
|
+
Keys pressed together go in a `KbdGroup`
|
|
46
|
+
(`<KbdGroup><Kbd>⌘</Kbd><Kbd>K</Kbd></KbdGroup>`). Don't write "+" between them.
|
|
47
|
+
checkedBy: manual
|
|
48
|
+
- id: key-names-as-printed
|
|
49
|
+
level: must
|
|
50
|
+
statement: >-
|
|
51
|
+
Write key names as printed on the keyboard (`Enter`, `Esc`, `⌘`, `Ctrl`), not
|
|
52
|
+
translated into Thai. The surrounding sentence is Thai, e.g. "กด … เพื่อค้นหากองทุน"
|
|
53
|
+
(press … to search funds).
|
|
54
|
+
checkedBy: manual
|
|
55
|
+
- id: real-shortcut-only
|
|
56
|
+
level: must
|
|
57
|
+
statement: >-
|
|
58
|
+
Only show shortcuts the app actually binds. Kbd doesn't bind any key.
|
|
59
|
+
checkedBy: manual
|
|
60
|
+
- id: tooltip-auto-colour
|
|
61
|
+
level: may
|
|
62
|
+
statement: >-
|
|
63
|
+
Inside a Tooltip, don't set colours: Kbd inverts with the Tooltip on its own
|
|
64
|
+
(`--kbd-tooltip-*`).
|
|
65
|
+
example:
|
|
66
|
+
ref:
|
|
67
|
+
href: ./Kbd.stories.tsx#InTooltip
|
|
68
|
+
rel: demo
|
|
69
|
+
|
|
70
|
+
- kind: guidelines
|
|
71
|
+
for: all
|
|
72
|
+
title: Accessibility
|
|
73
|
+
tags: [accessibility]
|
|
74
|
+
items:
|
|
75
|
+
- id: kbd-contrast
|
|
76
|
+
level: must
|
|
77
|
+
statement: >-
|
|
78
|
+
Kbd text passes 5.41:1 light / 6.14:1 dark, and inside a Tooltip 10.96:1 / 14.60:1.
|
|
79
|
+
checks:
|
|
80
|
+
- href: ../../../scripts/tokens.mjs
|
|
81
|
+
role: test
|
|
82
|
+
note: CONTRAST_PAIRS "Kbd …"
|
|
83
|
+
checkedBy: automated
|
|
84
|
+
- id: symbol-name
|
|
85
|
+
level: should
|
|
86
|
+
statement: >-
|
|
87
|
+
Symbols like ⌘ ⇧ ⌥ aren't always read out as key names. Add an `aria-label` to the
|
|
88
|
+
`Kbd` (e.g. `aria-label="Command"`) when the shortcut matters.
|
|
89
|
+
checkedBy: manual
|
|
90
|
+
|
|
91
|
+
- kind: section
|
|
92
|
+
for: all
|
|
93
|
+
title: Open decisions
|
|
94
|
+
freeform:
|
|
95
|
+
- title: TODO
|
|
96
|
+
body: >-
|
|
97
|
+
Not yet decided how to show ⌘ (macOS) or Ctrl (Windows) depending on the user's
|
|
98
|
+
device.
|
|
99
|
+
|
|
100
|
+
sourceFiles:
|
|
101
|
+
- platform: react
|
|
102
|
+
file: ./Kbd.tsx
|
|
103
|
+
|
|
104
|
+
imports:
|
|
105
|
+
- platform: react
|
|
106
|
+
code: >-
|
|
107
|
+
import { Kbd, KbdGroup } from "@designil/labdsnov"
|
|
108
|
+
package: "@designil/labdsnov"
|
|
109
|
+
|
|
110
|
+
alternatives:
|
|
111
|
+
- to: button
|
|
112
|
+
|
|
113
|
+
refs:
|
|
114
|
+
- href: ./Kbd.md
|
|
115
|
+
rel: relates-to
|
|
116
|
+
role: Thai usage doc
|
|
117
|
+
- href: ./Kbd.stories.tsx
|
|
118
|
+
rel: demo
|
|
119
|
+
role: CSF stories
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: label
|
|
3
|
+
name: Label
|
|
4
|
+
description: >-
|
|
5
|
+
The name of a form field: says what to enter, and whether it's required (red
|
|
6
|
+
asterisk). 14px, medium weight, rendered as a `<label>`.
|
|
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: must
|
|
18
|
+
statement: >-
|
|
19
|
+
Every <dsds:input> has a Label tied to it (or a `FieldLabel` inside <dsds:field>).
|
|
20
|
+
checkedBy: manual
|
|
21
|
+
- level: must-not
|
|
22
|
+
statement: >-
|
|
23
|
+
Don't use it as a section or page heading; use `h2`/`h3`.
|
|
24
|
+
checkedBy: manual
|
|
25
|
+
- level: must-not
|
|
26
|
+
statement: >-
|
|
27
|
+
Don't use it for help text or error messages under a field; use
|
|
28
|
+
`FieldDescription` / `FieldError` in <dsds:field>.
|
|
29
|
+
alternatives:
|
|
30
|
+
- to: field
|
|
31
|
+
checkedBy: manual
|
|
32
|
+
- level: should-not
|
|
33
|
+
statement: >-
|
|
34
|
+
Don't use a Label with no field to point at. Without `htmlFor` it does nothing; use
|
|
35
|
+
plain text.
|
|
36
|
+
|
|
37
|
+
- kind: guidelines
|
|
38
|
+
for: all
|
|
39
|
+
items:
|
|
40
|
+
- id: htmlfor-matches-id
|
|
41
|
+
level: must
|
|
42
|
+
statement: >-
|
|
43
|
+
`htmlFor` always matches the field's `id`. Clicking the label focuses the field,
|
|
44
|
+
and screen readers read the label as the field's name.
|
|
45
|
+
evidence:
|
|
46
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html
|
|
47
|
+
role: WCAG 2.2 SC 1.3.1 (A)
|
|
48
|
+
checks:
|
|
49
|
+
- href: ./Label.stories.tsx#WithInput
|
|
50
|
+
role: test
|
|
51
|
+
note: play function clicks the "อีเมล" (email) label, then checks the field has focus and that name
|
|
52
|
+
checkedBy: automated
|
|
53
|
+
- id: required-both
|
|
54
|
+
level: must
|
|
55
|
+
statement: >-
|
|
56
|
+
`required` on Label only draws the red asterisk. Put `required` on the field too.
|
|
57
|
+
refines:
|
|
58
|
+
- to: field#required-two-places
|
|
59
|
+
checks:
|
|
60
|
+
- href: ./Label.stories.tsx#Required
|
|
61
|
+
role: test
|
|
62
|
+
note: play function checks for "*" in ::after
|
|
63
|
+
checkedBy: assisted
|
|
64
|
+
- id: above-8px
|
|
65
|
+
level: should
|
|
66
|
+
statement: >-
|
|
67
|
+
Place the label above the field, 8px apart (`grid gap-2`), with short text such as
|
|
68
|
+
"อีเมล" (email) or "ชื่อ-นามสกุล" (full name).
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: disabled-structure
|
|
71
|
+
level: should
|
|
72
|
+
statement: >-
|
|
73
|
+
The label dims to 50% when its field is disabled only in two structures: the field
|
|
74
|
+
has class `peer` and comes before the label (`.peer:disabled ~ label`), or the
|
|
75
|
+
label sits in an element with class `group` and `data-disabled="true"`. A label
|
|
76
|
+
placed above the field in the usual way does not dim on its own.
|
|
77
|
+
example:
|
|
78
|
+
ref:
|
|
79
|
+
href: ./Label.stories.tsx#DisabledGroup
|
|
80
|
+
rel: demo
|
|
81
|
+
checks:
|
|
82
|
+
- href: ./Label.stories.tsx#DisabledPeer
|
|
83
|
+
role: test
|
|
84
|
+
- href: ./Label.stories.tsx#DisabledGroup
|
|
85
|
+
role: test
|
|
86
|
+
checkedBy: automated
|
|
87
|
+
- id: no-colon
|
|
88
|
+
level: should-not
|
|
89
|
+
statement: >-
|
|
90
|
+
Don't end a label with ":" (every story writes "อีเมล", not "อีเมล:").
|
|
91
|
+
|
|
92
|
+
- kind: section
|
|
93
|
+
for: all
|
|
94
|
+
title: Open decisions
|
|
95
|
+
freeform:
|
|
96
|
+
- title: TODO
|
|
97
|
+
body: >-
|
|
98
|
+
Not yet checked whether screen readers read out the `required` asterisk.
|
|
99
|
+
|
|
100
|
+
sourceFiles:
|
|
101
|
+
- platform: react
|
|
102
|
+
file: ./Label.tsx
|
|
103
|
+
|
|
104
|
+
imports:
|
|
105
|
+
- platform: react
|
|
106
|
+
code: >-
|
|
107
|
+
import { Label } from "@designil/labdsnov"
|
|
108
|
+
package: "@designil/labdsnov"
|
|
109
|
+
|
|
110
|
+
traits:
|
|
111
|
+
- traitType: variant
|
|
112
|
+
kind: boolean
|
|
113
|
+
id: required
|
|
114
|
+
description: >-
|
|
115
|
+
A red asterisk after the text (visual only).
|
|
116
|
+
- traitType: state
|
|
117
|
+
kind: boolean
|
|
118
|
+
id: disabled
|
|
119
|
+
description: >-
|
|
120
|
+
Dimmed to 50% when its field is disabled (through `peer` or `group`).
|
|
121
|
+
|
|
122
|
+
alternatives:
|
|
123
|
+
- to: field
|
|
124
|
+
|
|
125
|
+
refs:
|
|
126
|
+
- href: ./Label.md
|
|
127
|
+
rel: relates-to
|
|
128
|
+
role: Thai usage doc
|
|
129
|
+
- href: ./Label.stories.tsx
|
|
130
|
+
rel: demo
|
|
131
|
+
role: CSF stories
|
|
132
|
+
- href: https://www.figma.com/design/QsKWb3A53lIh4QBDnAkGHh/labdsnov?node-id=10-142
|
|
133
|
+
rel: design
|
|
134
|
+
role: Label in Figma
|
|
135
|
+
- href: ../../../figma/Label.figma.ts
|
|
136
|
+
rel: source
|
|
137
|
+
role: Code Connect template
|
|
138
|
+
|
|
139
|
+
$extensions:
|
|
140
|
+
com.figma:
|
|
141
|
+
nodeId: "10:142"
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: navigation-menu
|
|
3
|
+
name: NavigationMenu
|
|
4
|
+
description: >-
|
|
5
|
+
The site's main menu bar, with direct links and triggers that open panels of sub-links.
|
|
6
|
+
All panels share one container that resizes and slides between them. Wraps Base UI's
|
|
7
|
+
`NavigationMenu`.
|
|
8
|
+
metadata:
|
|
9
|
+
status: {status: stable}
|
|
10
|
+
since: 1.0.0
|
|
11
|
+
tags: [navigation]
|
|
12
|
+
|
|
13
|
+
sections:
|
|
14
|
+
- kind: guidelines
|
|
15
|
+
for: all
|
|
16
|
+
framing: when-to-use
|
|
17
|
+
items:
|
|
18
|
+
- level: should
|
|
19
|
+
statement: >-
|
|
20
|
+
Use as the main menu on wide screens when there are categories with sub-links, e.g.
|
|
21
|
+
บัญชีของฉัน / ลงทุน / เอกสาร (my account / invest / documents).
|
|
22
|
+
- level: must-not
|
|
23
|
+
statement: >-
|
|
24
|
+
Don't use for actions on an item (edit / delete); use <dsds:dropdown-menu>.
|
|
25
|
+
alternatives:
|
|
26
|
+
- to: dropdown-menu
|
|
27
|
+
checkedBy: manual
|
|
28
|
+
- level: must-not
|
|
29
|
+
statement: >-
|
|
30
|
+
Don't use to switch views within one page; use <dsds:tabs>.
|
|
31
|
+
alternatives:
|
|
32
|
+
- to: tabs
|
|
33
|
+
checkedBy: manual
|
|
34
|
+
- level: should-not
|
|
35
|
+
statement: >-
|
|
36
|
+
Don't use to show where the current page sits in a deep structure; use
|
|
37
|
+
<dsds:breadcrumb>.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: breadcrumb
|
|
40
|
+
- level: should-not
|
|
41
|
+
statement: >-
|
|
42
|
+
Don't use as the mobile menu (not designed yet, see Open decisions).
|
|
43
|
+
|
|
44
|
+
- kind: guidelines
|
|
45
|
+
for: all
|
|
46
|
+
items:
|
|
47
|
+
- id: top-link-style
|
|
48
|
+
level: must
|
|
49
|
+
statement: >-
|
|
50
|
+
A top-level link with no panel gets `className={navigationMenuTriggerStyle()}` so
|
|
51
|
+
it looks like the triggers.
|
|
52
|
+
checkedBy: manual
|
|
53
|
+
- id: next-link-render
|
|
54
|
+
level: must
|
|
55
|
+
statement: >-
|
|
56
|
+
Next.js links use `<NavigationMenuLink render={<Link href="…" />}>`.
|
|
57
|
+
checkedBy: manual
|
|
58
|
+
- id: active-page
|
|
59
|
+
level: must
|
|
60
|
+
statement: >-
|
|
61
|
+
The current page's link gets `active` (faint grey background), both at the top
|
|
62
|
+
level and inside panels.
|
|
63
|
+
checkedBy: manual
|
|
64
|
+
- id: content-width
|
|
65
|
+
level: should
|
|
66
|
+
statement: >-
|
|
67
|
+
`NavigationMenuContent` has no width of its own; set it on the child, e.g.
|
|
68
|
+
`<ul className="grid w-64 gap-1">`.
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: trigger-not-link
|
|
71
|
+
level: should
|
|
72
|
+
statement: >-
|
|
73
|
+
`NavigationMenuTrigger` only opens a panel; it doesn't navigate. If the category
|
|
74
|
+
has an overview page, make it the first link in the panel.
|
|
75
|
+
checkedBy: manual
|
|
76
|
+
- id: few-top-items
|
|
77
|
+
level: should
|
|
78
|
+
statement: >-
|
|
79
|
+
Keep the top level to about 5–6 items, each named in 1–2 words.
|
|
80
|
+
checkedBy: manual
|
|
81
|
+
|
|
82
|
+
- kind: guidelines
|
|
83
|
+
for: all
|
|
84
|
+
title: Accessibility
|
|
85
|
+
tags: [accessibility]
|
|
86
|
+
items:
|
|
87
|
+
- id: nav-label
|
|
88
|
+
level: must
|
|
89
|
+
statement: >-
|
|
90
|
+
Give `NavigationMenu` a Thai `aria-label` (e.g. "เมนูหลัก", main menu) when the
|
|
91
|
+
page has more than one navigation menu.
|
|
92
|
+
evidence:
|
|
93
|
+
- href: https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/
|
|
94
|
+
role: WAI-ARIA APG Landmark Regions
|
|
95
|
+
checkedBy: manual
|
|
96
|
+
- id: keyboard-panel
|
|
97
|
+
level: must
|
|
98
|
+
statement: >-
|
|
99
|
+
Tab to a trigger, Enter/Space opens its panel (`aria-expanded="true"`), Escape
|
|
100
|
+
closes it.
|
|
101
|
+
checks:
|
|
102
|
+
- href: ./NavigationMenu.stories.tsx#OpenPanel
|
|
103
|
+
role: test
|
|
104
|
+
checkedBy: automated
|
|
105
|
+
- id: aria-current
|
|
106
|
+
level: should
|
|
107
|
+
statement: >-
|
|
108
|
+
An `active` link should also be announced as `aria-current="page"` (check with a
|
|
109
|
+
screen reader before relying on it).
|
|
110
|
+
checkedBy: manual
|
|
111
|
+
|
|
112
|
+
- kind: definitions
|
|
113
|
+
for: all
|
|
114
|
+
context: anatomy
|
|
115
|
+
items:
|
|
116
|
+
- term: NavigationMenu
|
|
117
|
+
definition: >-
|
|
118
|
+
The `<nav>`. Takes `align` (`start` default, `center`, `end`) and `value` /
|
|
119
|
+
`onValueChange`.
|
|
120
|
+
- term: NavigationMenuList / NavigationMenuItem
|
|
121
|
+
definition: >-
|
|
122
|
+
The top-level row and its items.
|
|
123
|
+
- term: NavigationMenuTrigger
|
|
124
|
+
definition: >-
|
|
125
|
+
Opens a panel. Its arrow rotates when open.
|
|
126
|
+
- term: NavigationMenuContent
|
|
127
|
+
definition: >-
|
|
128
|
+
A panel of sub-links.
|
|
129
|
+
- term: NavigationMenuLink
|
|
130
|
+
definition: >-
|
|
131
|
+
A link. Takes `active` and `render`.
|
|
132
|
+
- term: NavigationMenuIndicator
|
|
133
|
+
definition: >-
|
|
134
|
+
A small arrow under the open trigger (optional).
|
|
135
|
+
- term: navigationMenuTriggerStyle()
|
|
136
|
+
definition: >-
|
|
137
|
+
The trigger classes, for direct top-level links.
|
|
138
|
+
|
|
139
|
+
- kind: section
|
|
140
|
+
for: all
|
|
141
|
+
title: Open decisions
|
|
142
|
+
freeform:
|
|
143
|
+
- title: TODO
|
|
144
|
+
body: >-
|
|
145
|
+
The mobile menu (e.g. inside a Drawer) isn't designed yet, and arrow-key movement
|
|
146
|
+
between triggers hasn't been checked.
|
|
147
|
+
|
|
148
|
+
sourceFiles:
|
|
149
|
+
- platform: react
|
|
150
|
+
file: ./NavigationMenu.tsx
|
|
151
|
+
|
|
152
|
+
imports:
|
|
153
|
+
- platform: react
|
|
154
|
+
code: >-
|
|
155
|
+
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle } from "@designil/labdsnov"
|
|
156
|
+
package: "@designil/labdsnov"
|
|
157
|
+
|
|
158
|
+
traits:
|
|
159
|
+
- traitType: variant
|
|
160
|
+
kind: enum
|
|
161
|
+
id: align
|
|
162
|
+
description: >-
|
|
163
|
+
How a panel lines up with its trigger.
|
|
164
|
+
values:
|
|
165
|
+
- id: start
|
|
166
|
+
description: >-
|
|
167
|
+
Aligned to the trigger's left edge (default).
|
|
168
|
+
- id: center
|
|
169
|
+
description: >-
|
|
170
|
+
Centred on the trigger.
|
|
171
|
+
- id: end
|
|
172
|
+
description: >-
|
|
173
|
+
Aligned to the trigger's right edge.
|
|
174
|
+
- traitType: state
|
|
175
|
+
kind: boolean
|
|
176
|
+
id: active
|
|
177
|
+
description: >-
|
|
178
|
+
The current page's link. Faint grey background.
|
|
179
|
+
- traitType: state
|
|
180
|
+
kind: boolean
|
|
181
|
+
id: open
|
|
182
|
+
description: >-
|
|
183
|
+
A panel is open.
|
|
184
|
+
|
|
185
|
+
alternatives:
|
|
186
|
+
- to: breadcrumb
|
|
187
|
+
- to: tabs
|
|
188
|
+
- to: dropdown-menu
|
|
189
|
+
|
|
190
|
+
refs:
|
|
191
|
+
- href: ./NavigationMenu.md
|
|
192
|
+
rel: relates-to
|
|
193
|
+
role: Thai usage doc
|
|
194
|
+
- href: ./NavigationMenu.stories.tsx
|
|
195
|
+
rel: demo
|
|
196
|
+
role: CSF stories
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: pagination
|
|
3
|
+
name: Pagination
|
|
4
|
+
description: >-
|
|
5
|
+
Page-number links for a long list split across pages, such as past transactions. They
|
|
6
|
+
are plain `<a>` elements styled with `buttonVariants()`, so they're announced as links
|
|
7
|
+
(shadcn's are announced as buttons).
|
|
8
|
+
metadata:
|
|
9
|
+
status: {status: stable}
|
|
10
|
+
since: 1.0.0
|
|
11
|
+
tags: [navigation]
|
|
12
|
+
|
|
13
|
+
sections:
|
|
14
|
+
- kind: guidelines
|
|
15
|
+
for: all
|
|
16
|
+
framing: when-to-use
|
|
17
|
+
items:
|
|
18
|
+
- level: should
|
|
19
|
+
statement: >-
|
|
20
|
+
Use for lists too long for one page where the user may need to return to a page,
|
|
21
|
+
such as a transactions table.
|
|
22
|
+
- level: should-not
|
|
23
|
+
statement: >-
|
|
24
|
+
Don't paginate short lists (up to about 25 rows); show everything.
|
|
25
|
+
- level: must-not
|
|
26
|
+
statement: >-
|
|
27
|
+
Don't use for form steps; use "ถัดไป" / "ย้อนกลับ" (next / back) buttons
|
|
28
|
+
(<dsds:button>).
|
|
29
|
+
alternatives:
|
|
30
|
+
- to: button
|
|
31
|
+
checkedBy: manual
|
|
32
|
+
|
|
33
|
+
- kind: guidelines
|
|
34
|
+
for: all
|
|
35
|
+
items:
|
|
36
|
+
- id: every-page-has-url
|
|
37
|
+
level: must
|
|
38
|
+
statement: >-
|
|
39
|
+
Every link has its page's `href` (`?page=3`) so the user can go back or share the
|
|
40
|
+
link. Never use `onClick` alone without an `href`.
|
|
41
|
+
checkedBy: manual
|
|
42
|
+
- id: app-computes-pages
|
|
43
|
+
level: must
|
|
44
|
+
statement: >-
|
|
45
|
+
The app decides which page numbers to show; Pagination is only the look. Show the
|
|
46
|
+
first page, the last page, the current page and its neighbours, and put a
|
|
47
|
+
`PaginationEllipsis` where pages are skipped.
|
|
48
|
+
example:
|
|
49
|
+
ref:
|
|
50
|
+
href: ./Pagination.stories.tsx#Playground
|
|
51
|
+
rel: demo
|
|
52
|
+
checkedBy: manual
|
|
53
|
+
- id: current-page-active
|
|
54
|
+
level: must
|
|
55
|
+
statement: >-
|
|
56
|
+
Mark the current page with `isActive` (outline button and `aria-current="page"`).
|
|
57
|
+
Only one page can be active.
|
|
58
|
+
checks:
|
|
59
|
+
- href: ./Pagination.stories.tsx#Playground
|
|
60
|
+
role: test
|
|
61
|
+
note: play function checks aria-current on page 2
|
|
62
|
+
checkedBy: automated
|
|
63
|
+
- id: hide-edge-links
|
|
64
|
+
level: must
|
|
65
|
+
statement: >-
|
|
66
|
+
Hide `PaginationPrevious` on the first page and `PaginationNext` on the last page
|
|
67
|
+
yourself; there's no disabled state yet. A link to the page you're already on
|
|
68
|
+
confuses people.
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: prev-next-text
|
|
71
|
+
level: may
|
|
72
|
+
statement: >-
|
|
73
|
+
Change the "ก่อนหน้า" / "ถัดไป" (previous / next) text with `text`. Below 640px only
|
|
74
|
+
the arrow shows.
|
|
75
|
+
- id: no-button-render
|
|
76
|
+
level: must-not
|
|
77
|
+
statement: >-
|
|
78
|
+
Don't turn PaginationLink into `Button render={<a />}`: it would be announced as a
|
|
79
|
+
button.
|
|
80
|
+
refs:
|
|
81
|
+
- to: shared-composition#link-looks-like-button
|
|
82
|
+
rel: relates-to
|
|
83
|
+
checkedBy: manual
|
|
84
|
+
|
|
85
|
+
- kind: guidelines
|
|
86
|
+
for: all
|
|
87
|
+
title: Accessibility
|
|
88
|
+
tags: [accessibility]
|
|
89
|
+
items:
|
|
90
|
+
- id: nav-name
|
|
91
|
+
level: must
|
|
92
|
+
statement: >-
|
|
93
|
+
`Pagination` is a `<nav aria-label="การแบ่งหน้า">` (pagination). The previous/next
|
|
94
|
+
links are named "ไปหน้าก่อนหน้า" / "ไปหน้าถัดไป" (go to previous / next page), which
|
|
95
|
+
still read out when the visible text is hidden on narrow screens.
|
|
96
|
+
checks:
|
|
97
|
+
- href: ./Pagination.stories.tsx#Playground
|
|
98
|
+
role: test
|
|
99
|
+
note: play function finds the link named "ไปหน้าถัดไป"
|
|
100
|
+
checkedBy: automated
|
|
101
|
+
- id: target-36
|
|
102
|
+
level: should
|
|
103
|
+
statement: >-
|
|
104
|
+
Page numbers are 36px `icon` buttons. Don't shrink them to `icon-xs`, because they
|
|
105
|
+
sit right next to each other.
|
|
106
|
+
refines:
|
|
107
|
+
- to: shared-a11y#target-size
|
|
108
|
+
checkedBy: manual
|
|
109
|
+
- id: focus-after-change
|
|
110
|
+
level: should
|
|
111
|
+
statement: >-
|
|
112
|
+
If the page changes without a full reload, move focus to the list's heading or
|
|
113
|
+
table instead of leaving it on the page number.
|
|
114
|
+
checkedBy: manual
|
|
115
|
+
|
|
116
|
+
- kind: definitions
|
|
117
|
+
for: all
|
|
118
|
+
context: anatomy
|
|
119
|
+
items:
|
|
120
|
+
- term: Pagination
|
|
121
|
+
definition: >-
|
|
122
|
+
The `<nav>`, centred.
|
|
123
|
+
- term: PaginationContent / PaginationItem
|
|
124
|
+
definition: >-
|
|
125
|
+
`<ul>` / `<li>`.
|
|
126
|
+
- term: PaginationLink
|
|
127
|
+
definition: >-
|
|
128
|
+
A page-number link styled as a ghost `icon` button. Takes `href`, `isActive`,
|
|
129
|
+
`size`.
|
|
130
|
+
- term: PaginationPrevious / PaginationNext
|
|
131
|
+
definition: >-
|
|
132
|
+
"ก่อนหน้า" / "ถัดไป" (previous / next) links with an arrow. Take `text`.
|
|
133
|
+
- term: PaginationEllipsis
|
|
134
|
+
definition: >-
|
|
135
|
+
"…" between page numbers.
|
|
136
|
+
|
|
137
|
+
- kind: section
|
|
138
|
+
for: all
|
|
139
|
+
title: Open decisions
|
|
140
|
+
freeform:
|
|
141
|
+
- title: TODO
|
|
142
|
+
body: >-
|
|
143
|
+
Previous/next links have no disabled state yet, and a "โหลดเพิ่ม" (load more)
|
|
144
|
+
button for continuous feeds hasn't been decided.
|
|
145
|
+
|
|
146
|
+
sourceFiles:
|
|
147
|
+
- platform: react
|
|
148
|
+
file: ./Pagination.tsx
|
|
149
|
+
|
|
150
|
+
imports:
|
|
151
|
+
- platform: react
|
|
152
|
+
code: >-
|
|
153
|
+
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@designil/labdsnov"
|
|
154
|
+
package: "@designil/labdsnov"
|
|
155
|
+
|
|
156
|
+
traits:
|
|
157
|
+
- traitType: state
|
|
158
|
+
kind: boolean
|
|
159
|
+
id: isActive
|
|
160
|
+
description: >-
|
|
161
|
+
The current page: outline button and `aria-current="page"`.
|
|
162
|
+
|
|
163
|
+
uses:
|
|
164
|
+
- to: button
|
|
165
|
+
|
|
166
|
+
refs:
|
|
167
|
+
- href: ./Pagination.md
|
|
168
|
+
rel: relates-to
|
|
169
|
+
role: Thai usage doc
|
|
170
|
+
- href: ./Pagination.stories.tsx
|
|
171
|
+
rel: demo
|
|
172
|
+
role: CSF stories
|