Skip to content

Commit 733dae9

Browse files
committed
docs: add examples for aria directives
1 parent 41719c3 commit 733dae9

File tree

11 files changed

+658
-0
lines changed

11 files changed

+658
-0
lines changed

src/dev-app/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ ng_project(
2727
"//src/cdk/overlay",
2828
"//src/dev-app/aria-accordion",
2929
"//src/dev-app/aria-combobox",
30+
"//src/dev-app/aria-docs-examples",
31+
"//src/dev-app/aria-docs-examples/autocomplete:autocomplete-docs-demo",
3032
"//src/dev-app/aria-grid",
3133
"//src/dev-app/aria-listbox",
3234
"//src/dev-app/aria-menu",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("//tools:defaults.bzl", "ng_project")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ng_project(
6+
name = "aria-docs-examples",
7+
srcs = glob(["**/*.ts"]),
8+
assets = [
9+
"aria-docs-examples.html",
10+
"aria-docs-examples.css",
11+
],
12+
deps = [
13+
"//:node_modules/@angular/core",
14+
"//src/components-examples/aria/accordion",
15+
"//src/components-examples/aria/combobox",
16+
"//src/components-examples/aria/grid",
17+
"//src/components-examples/aria/listbox",
18+
"//src/components-examples/aria/menu",
19+
"//src/components-examples/aria/tabs",
20+
"//src/components-examples/aria/toolbar",
21+
"//src/components-examples/aria/tree",
22+
],
23+
)
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/** Accordion */
2+
3+
[ngAccordionTrigger] {
4+
display: inline-flex;
5+
background: inherit;
6+
border: none;
7+
align-items: center;
8+
font-size: inherit;
9+
height: 36px;
10+
}
11+
12+
[ngAccordionTrigger] svg {
13+
width: 24px;
14+
height: 24px;
15+
transition: transform 0.2s ease-in-out;
16+
transform: rotate(90deg);
17+
}
18+
19+
[ngAccordionTrigger][aria-expanded='true'] svg {
20+
transform: rotate(-90deg);
21+
}
22+
23+
/** Grid */
24+
25+
[ngGrid] {
26+
display: flex;
27+
flex-direction: column;
28+
}
29+
30+
[ngGridRow] {
31+
display: flex;
32+
align-items: center;
33+
height: 36px;
34+
}
35+
36+
[ngGridCell] {
37+
padding: 8px;
38+
}
39+
40+
button[ngGridCellWidget] {
41+
display: flex;
42+
height: 36px;
43+
width: 36px;
44+
padding: 8px;
45+
}
46+
47+
/** Combobox */
48+
49+
[ngCombobox] .cdk-overlay-pane {
50+
background: light-dark(white, black);
51+
border: 1px solid;
52+
padding: 8px;
53+
}
54+
55+
[ngCombobox] [ngOption][aria-selected='true'] {
56+
font-weight: bold;
57+
}
58+
59+
[ngCombobox]:focus-within [ngOption][data-active='true'] {
60+
border: 1px solid;
61+
}
62+
63+
/** Listbox */
64+
65+
[ngListbox] {
66+
list-style-type: none;
67+
padding: 0;
68+
}
69+
70+
[ngOption] {
71+
display: flex;
72+
align-items: center;
73+
cursor: pointer;
74+
}
75+
76+
[ngListbox]:focus-within [ngOption][data-active='true'] {
77+
font-weight: bold;
78+
}
79+
80+
[ngOption] .demo-selection-indicator {
81+
font-size: 2rem;
82+
}
83+
84+
[ngOption][aria-selected='false'] .demo-selection-indicator::before {
85+
content: '-';
86+
}
87+
88+
[ngOption][aria-selected='true'] .demo-selection-indicator::before {
89+
content: '✓';
90+
}
91+
92+
/** Menu */
93+
94+
[ngMenuItem] {
95+
display: flex;
96+
align-items: center;
97+
cursor: pointer;
98+
height: 36px;
99+
}
100+
101+
/** Radio */
102+
103+
[ngRadioGroup] {
104+
list-style-type: none;
105+
padding: 0;
106+
}
107+
108+
[ngRadioButton] {
109+
display: flex;
110+
align-items: center;
111+
height: 36px;
112+
cursor: pointer;
113+
}
114+
115+
[ngRadioButton] .demo-selection-indicator {
116+
padding-right: 8px;
117+
}
118+
119+
[ngRadioButton][aria-checked='true'] .demo-selection-indicator::before {
120+
content: '◉';
121+
}
122+
123+
[ngRadioButton][aria-checked='false'] .demo-selection-indicator::before {
124+
content: '◯';
125+
}
126+
127+
[ngTabList] {
128+
list-style-type: none;
129+
display: flex;
130+
padding: 0;
131+
}
132+
133+
[ngToolbar] {
134+
display: flex;
135+
height: 36px;
136+
align-items: center;
137+
}
138+
139+
[ngToolbar] [ngRadioGroup] {
140+
display: flex;
141+
}
142+
143+
/* Tree */
144+
145+
[ngTreeItem][aria-expanded='false'] > [ngTreeItem] {
146+
display: none;
147+
}

0 commit comments

Comments
 (0)