@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.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/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +8260 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-CNbBbErC.js +129 -0
- package/dist/pages/_figures-data-BDmScEny.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
- package/dist/pages/alert-BD4e6QTh.js +769 -0
- package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
- package/dist/pages/area-chart-B91dLcGo.js +562 -0
- package/dist/pages/avatar-DPPHXJAu.js +713 -0
- package/dist/pages/badge-C9JR0thI.js +729 -0
- package/dist/pages/button-D3V912P4.js +518 -0
- package/dist/pages/calendar-DSDZ9nRH.js +630 -0
- package/dist/pages/card-DUggbis3.js +659 -0
- package/dist/pages/checkbox-DwimQaK3.js +365 -0
- package/dist/pages/colour-BwuO8xAv.js +1498 -0
- package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
- package/dist/pages/date-picker-BYSa816m.js +1421 -0
- package/dist/pages/delta-CtAo0eIM.js +574 -0
- package/dist/pages/dialog-BRAf4LMh.js +1451 -0
- package/dist/pages/docs-BNOb7AqR.js +515 -0
- package/dist/pages/empty-state-C-mLrXW2.js +417 -0
- package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
- package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/icon-button-C9eSVPPW.js +861 -0
- package/dist/pages/icons-sxkTs5Ob.js +473 -0
- package/dist/pages/input-KF9Gkawf.js +1093 -0
- package/dist/pages/installation-DpsX8G_n.js +445 -0
- package/dist/pages/kbd-cNfDoikz.js +544 -0
- package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
- package/dist/pages/logo-BfGF1Pq9.js +571 -0
- package/dist/pages/menu-by2sgQ09.js +1618 -0
- package/dist/pages/motion-BvTGc2Dk.js +855 -0
- package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
- package/dist/pages/overview-BPEbZQ6g.js +130 -0
- package/dist/pages/pagination-BBUnGvv5.js +249 -0
- package/dist/pages/popover-Db1gLDpb.js +1136 -0
- package/dist/pages/principles-CeAIOIdt.js +483 -0
- package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
- package/dist/pages/registry-CroHzK9I.js +244 -0
- package/dist/pages/release-Dvo684UJ.js +13 -0
- package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
- package/dist/pages/search-field-BN7MWGQ4.js +693 -0
- package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
- package/dist/pages/select-DguELoRR.js +1429 -0
- package/dist/pages/separator-CPZub9pv.js +351 -0
- package/dist/pages/shape-DKvA0YKr.js +627 -0
- package/dist/pages/skeleton-DLuBhP46.js +561 -0
- package/dist/pages/sparkline-DMMYGbHn.js +668 -0
- package/dist/pages/switch-B-Qe4kcT.js +517 -0
- package/dist/pages/table-AMoODng4.js +607 -0
- package/dist/pages/tabs-B4M-usCV.js +1455 -0
- package/dist/pages/textarea-fTuUZRQb.js +693 -0
- package/dist/pages/toast-CKP03zjy.js +1176 -0
- package/dist/pages/tooltip-CBYil3kt.js +697 -0
- package/dist/pages/typography-PCbg8Bhg.js +735 -0
- package/manifest.json +3125 -0
- package/package.json +35 -4
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
|
|
4
|
+
import { t as Playground } from "./Playground-CNbBbErC.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Button, IconButton, SearchField, Separator, Tooltip } from "@orbitcommerce/constellation";
|
|
8
|
+
import { ArrowClockwiseIcon, ArrowCounterClockwiseIcon, ArrowsClockwiseIcon, ArrowsDownUpIcon, BellIcon, CopySimpleIcon, DotsThreeIcon, DownloadSimpleIcon, FunnelSimpleIcon, GearSixIcon, LinkSimpleIcon, ListBulletsIcon, MagnifyingGlassIcon, PencilSimpleIcon, PlusIcon, QuestionIcon, TextBIcon, TextItalicIcon, TextUnderlineIcon, TrashIcon, XIcon } from "@orbitcommerce/constellation/icons";
|
|
9
|
+
//#region src/pages/components/icon-button.tsx
|
|
10
|
+
function Preview() {
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
style: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
gap: 8
|
|
15
|
+
},
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
18
|
+
label: "Notifications",
|
|
19
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
22
|
+
label: "Edit product",
|
|
23
|
+
variant: "soft",
|
|
24
|
+
children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
27
|
+
label: "More actions",
|
|
28
|
+
variant: "secondary",
|
|
29
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, {})
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
32
|
+
label: "Add product",
|
|
33
|
+
variant: "primary",
|
|
34
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var ICONS = {
|
|
40
|
+
"<BellIcon />": /* @__PURE__ */ jsx(BellIcon, {}),
|
|
41
|
+
"<GearSixIcon />": /* @__PURE__ */ jsx(GearSixIcon, {}),
|
|
42
|
+
"<TrashIcon />": /* @__PURE__ */ jsx(TrashIcon, {})
|
|
43
|
+
};
|
|
44
|
+
var PLAYGROUND = [
|
|
45
|
+
{
|
|
46
|
+
prop: "label",
|
|
47
|
+
type: "text",
|
|
48
|
+
default: "Notifications",
|
|
49
|
+
toAttr: (v) => `label="${String(v).replace(/"/g, """)}"`
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
prop: "children",
|
|
53
|
+
type: "select",
|
|
54
|
+
options: Object.keys(ICONS),
|
|
55
|
+
default: "<BellIcon />"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
prop: "variant",
|
|
59
|
+
type: "select",
|
|
60
|
+
options: [
|
|
61
|
+
"ghost",
|
|
62
|
+
"secondary",
|
|
63
|
+
"soft",
|
|
64
|
+
"primary",
|
|
65
|
+
"inverse",
|
|
66
|
+
"critical"
|
|
67
|
+
],
|
|
68
|
+
default: "secondary",
|
|
69
|
+
toAttr: (v) => v === "ghost" ? null : `variant="${v}"`
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
prop: "size",
|
|
73
|
+
type: "select",
|
|
74
|
+
options: [
|
|
75
|
+
"xs",
|
|
76
|
+
"sm",
|
|
77
|
+
"md",
|
|
78
|
+
"lg"
|
|
79
|
+
],
|
|
80
|
+
default: "md"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
prop: "loading",
|
|
84
|
+
type: "boolean",
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
prop: "disabled",
|
|
89
|
+
type: "boolean",
|
|
90
|
+
default: false
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
var MARKS = [
|
|
94
|
+
{
|
|
95
|
+
mark: "bold",
|
|
96
|
+
label: "Bold",
|
|
97
|
+
keys: ["mod", "B"],
|
|
98
|
+
icon: /* @__PURE__ */ jsx(TextBIcon, {})
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
mark: "italic",
|
|
102
|
+
label: "Italic",
|
|
103
|
+
keys: ["mod", "I"],
|
|
104
|
+
icon: /* @__PURE__ */ jsx(TextItalicIcon, {})
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
mark: "underline",
|
|
108
|
+
label: "Underline",
|
|
109
|
+
keys: ["mod", "U"],
|
|
110
|
+
icon: /* @__PURE__ */ jsx(TextUnderlineIcon, {})
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
function FormattingToolbar() {
|
|
114
|
+
const [on, setOn] = useState({
|
|
115
|
+
bold: true,
|
|
116
|
+
italic: false,
|
|
117
|
+
underline: false
|
|
118
|
+
});
|
|
119
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
120
|
+
role: "group",
|
|
121
|
+
"aria-label": "Text formatting",
|
|
122
|
+
className: "icon-button-row",
|
|
123
|
+
children: [
|
|
124
|
+
MARKS.map(({ mark, label, keys, icon }) => /* @__PURE__ */ jsx(Tooltip, {
|
|
125
|
+
content: label,
|
|
126
|
+
shortcut: keys,
|
|
127
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
128
|
+
label,
|
|
129
|
+
size: "sm",
|
|
130
|
+
variant: on[mark] ? "soft" : "ghost",
|
|
131
|
+
"aria-pressed": on[mark],
|
|
132
|
+
onClick: () => setOn((s) => ({
|
|
133
|
+
...s,
|
|
134
|
+
[mark]: !s[mark]
|
|
135
|
+
})),
|
|
136
|
+
children: icon
|
|
137
|
+
})
|
|
138
|
+
}, mark)),
|
|
139
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
140
|
+
orientation: "vertical",
|
|
141
|
+
className: "icon-button-divider"
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
144
|
+
content: "Bulleted list",
|
|
145
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
146
|
+
label: "Bulleted list",
|
|
147
|
+
size: "sm",
|
|
148
|
+
children: /* @__PURE__ */ jsx(ListBulletsIcon, {})
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
152
|
+
content: "Add link",
|
|
153
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
154
|
+
label: "Add link",
|
|
155
|
+
size: "sm",
|
|
156
|
+
children: /* @__PURE__ */ jsx(LinkSimpleIcon, {})
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ jsx(Separator, {
|
|
160
|
+
orientation: "vertical",
|
|
161
|
+
className: "icon-button-divider"
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
164
|
+
content: "Undo",
|
|
165
|
+
shortcut: ["mod", "Z"],
|
|
166
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
167
|
+
label: "Undo",
|
|
168
|
+
size: "sm",
|
|
169
|
+
children: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {})
|
|
170
|
+
})
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
173
|
+
content: "Redo",
|
|
174
|
+
shortcut: [
|
|
175
|
+
"mod",
|
|
176
|
+
"shift",
|
|
177
|
+
"Z"
|
|
178
|
+
],
|
|
179
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
180
|
+
label: "Redo",
|
|
181
|
+
size: "sm",
|
|
182
|
+
children: /* @__PURE__ */ jsx(ArrowClockwiseIcon, {})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function RefreshButton() {
|
|
189
|
+
const [syncing, setSyncing] = useState(false);
|
|
190
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
191
|
+
content: "Refresh stock levels",
|
|
192
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
193
|
+
label: "Refresh stock levels",
|
|
194
|
+
variant: "secondary",
|
|
195
|
+
loading: syncing,
|
|
196
|
+
onClick: () => {
|
|
197
|
+
setSyncing(true);
|
|
198
|
+
window.setTimeout(() => setSyncing(false), 2400);
|
|
199
|
+
},
|
|
200
|
+
children: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {})
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function Page() {
|
|
205
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
206
|
+
title: "Icon button",
|
|
207
|
+
status: "stable",
|
|
208
|
+
importNames: ["IconButton", "Tooltip"],
|
|
209
|
+
lead: "A round button that holds a single icon, for compact actions in the header, toolbars and rows. It always carries a label: screen readers read it as the button's name, and a tooltip shows it to everyone else.",
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ jsx(Section, {
|
|
212
|
+
id: "playground",
|
|
213
|
+
title: "Playground",
|
|
214
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
215
|
+
"Change the props and watch the button. The playground starts on ",
|
|
216
|
+
/* @__PURE__ */ jsx("code", { children: "secondary" }),
|
|
217
|
+
" so the circle shows at rest; the component's default is ",
|
|
218
|
+
/* @__PURE__ */ jsx("code", { children: "ghost" }),
|
|
219
|
+
", only a glyph until the pointer arrives."
|
|
220
|
+
] }),
|
|
221
|
+
children: /* @__PURE__ */ jsx(Playground, {
|
|
222
|
+
component: "IconButton",
|
|
223
|
+
childrenProp: "children",
|
|
224
|
+
controls: PLAYGROUND,
|
|
225
|
+
render: (v) => /* @__PURE__ */ jsx(IconButton, {
|
|
226
|
+
label: String(v.label),
|
|
227
|
+
variant: v.variant,
|
|
228
|
+
size: v.size,
|
|
229
|
+
loading: Boolean(v.loading),
|
|
230
|
+
disabled: Boolean(v.disabled),
|
|
231
|
+
children: ICONS[String(v.children)]
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
236
|
+
id: "variants",
|
|
237
|
+
title: "Variants",
|
|
238
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
239
|
+
"The same six materials as ",
|
|
240
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
241
|
+
to: "/components/button",
|
|
242
|
+
children: "Button"
|
|
243
|
+
}),
|
|
244
|
+
", on a circle. ",
|
|
245
|
+
/* @__PURE__ */ jsx("code", { children: "ghost" }),
|
|
246
|
+
" is the default, because icon buttons usually sit in groups where filled circles would crowd each other."
|
|
247
|
+
] }),
|
|
248
|
+
children: [/* @__PURE__ */ jsxs(Example, {
|
|
249
|
+
code: `
|
|
250
|
+
<IconButton label="Notifications"><BellIcon /></IconButton>
|
|
251
|
+
<IconButton label="More actions" variant="secondary"><DotsThreeIcon /></IconButton>
|
|
252
|
+
<IconButton label="Edit product" variant="soft"><PencilSimpleIcon /></IconButton>
|
|
253
|
+
<IconButton label="Add product" variant="primary"><PlusIcon /></IconButton>
|
|
254
|
+
<IconButton label="Remove image" variant="inverse"><XIcon /></IconButton>
|
|
255
|
+
<IconButton label="Delete product" variant="critical"><TrashIcon /></IconButton>`,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
258
|
+
label: "Notifications",
|
|
259
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
262
|
+
label: "More actions",
|
|
263
|
+
variant: "secondary",
|
|
264
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, {})
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
267
|
+
label: "Edit product",
|
|
268
|
+
variant: "soft",
|
|
269
|
+
children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
272
|
+
label: "Add product",
|
|
273
|
+
variant: "primary",
|
|
274
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
277
|
+
label: "Remove image",
|
|
278
|
+
variant: "inverse",
|
|
279
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
280
|
+
}),
|
|
281
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
282
|
+
label: "Delete product",
|
|
283
|
+
variant: "critical",
|
|
284
|
+
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
288
|
+
title: "When to use each",
|
|
289
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
290
|
+
columns: ["Variant", "Use it for"],
|
|
291
|
+
rows: [
|
|
292
|
+
[/* @__PURE__ */ jsx("code", { children: "ghost" }), "The default. Header and toolbar actions, row actions, anything that repeats. Quiet until hovered."],
|
|
293
|
+
[/* @__PURE__ */ jsx("code", { children: "secondary" }), "Beside secondary pills, so the group reads as one set, e.g. More actions at the end of a row of buttons."],
|
|
294
|
+
[/* @__PURE__ */ jsx("code", { children: "soft" }), "A toggle that is on, such as Bold in a formatting toolbar. Also quiet filled actions in dense toolbars."],
|
|
295
|
+
[/* @__PURE__ */ jsx("code", { children: "primary" }), "Rarely: the view's one primary action where there is no room for words, such as Add product on a phone."],
|
|
296
|
+
[/* @__PURE__ */ jsx("code", { children: "inverse" }), "Over photos and busy surfaces, e.g. removing an image from a product gallery."],
|
|
297
|
+
[/* @__PURE__ */ jsx("code", { children: "critical" }), "A destructive action standing on its own. In a list of rows a ghost bin is calmer. Confirm first either way."]
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
})]
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ jsx(Section, {
|
|
303
|
+
id: "both-themes",
|
|
304
|
+
title: "In both themes",
|
|
305
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every variant, light and dark side by side. Hover the ghost button to see its tint." }),
|
|
306
|
+
children: /* @__PURE__ */ jsxs(ThemePair, { children: [
|
|
307
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
308
|
+
label: "Notifications",
|
|
309
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
312
|
+
label: "More actions",
|
|
313
|
+
variant: "secondary",
|
|
314
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, {})
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
317
|
+
label: "Edit product",
|
|
318
|
+
variant: "soft",
|
|
319
|
+
children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
322
|
+
label: "Add product",
|
|
323
|
+
variant: "primary",
|
|
324
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
327
|
+
label: "Remove image",
|
|
328
|
+
variant: "inverse",
|
|
329
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
332
|
+
label: "Delete product",
|
|
333
|
+
variant: "critical",
|
|
334
|
+
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
335
|
+
})
|
|
336
|
+
] })
|
|
337
|
+
}),
|
|
338
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
339
|
+
id: "sizes",
|
|
340
|
+
title: "Sizes",
|
|
341
|
+
description: /* @__PURE__ */ jsx("p", { children: "The control scale shared with every control in the kit, so an icon button lines up with the pills and fields beside it. The button is always a circle: its width is its height." }),
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ jsxs(Example, {
|
|
344
|
+
code: `
|
|
345
|
+
<IconButton label="Notifications" variant="secondary" size="lg"><BellIcon /></IconButton>
|
|
346
|
+
<IconButton label="Notifications" variant="secondary"><BellIcon /></IconButton>
|
|
347
|
+
<IconButton label="Notifications" variant="secondary" size="sm"><BellIcon /></IconButton>
|
|
348
|
+
<IconButton label="Notifications" variant="secondary" size="xs"><BellIcon /></IconButton>`,
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
351
|
+
label: "Notifications",
|
|
352
|
+
variant: "secondary",
|
|
353
|
+
size: "lg",
|
|
354
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
357
|
+
label: "Notifications",
|
|
358
|
+
variant: "secondary",
|
|
359
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
362
|
+
label: "Notifications",
|
|
363
|
+
variant: "secondary",
|
|
364
|
+
size: "sm",
|
|
365
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
368
|
+
label: "Notifications",
|
|
369
|
+
variant: "secondary",
|
|
370
|
+
size: "xs",
|
|
371
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
372
|
+
})
|
|
373
|
+
]
|
|
374
|
+
}),
|
|
375
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
376
|
+
columns: [
|
|
377
|
+
"Size",
|
|
378
|
+
"Button",
|
|
379
|
+
"Icon",
|
|
380
|
+
"Use it for"
|
|
381
|
+
],
|
|
382
|
+
rows: [
|
|
383
|
+
[
|
|
384
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
385
|
+
"44px",
|
|
386
|
+
"18px",
|
|
387
|
+
"Touch-first screens, where a finger needs the room."
|
|
388
|
+
],
|
|
389
|
+
[
|
|
390
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
391
|
+
"36px",
|
|
392
|
+
"16px",
|
|
393
|
+
"The default: the app header and page toolbars."
|
|
394
|
+
],
|
|
395
|
+
[
|
|
396
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
397
|
+
"30px",
|
|
398
|
+
"15px",
|
|
399
|
+
"Table toolbars, card headers and panels."
|
|
400
|
+
],
|
|
401
|
+
[
|
|
402
|
+
/* @__PURE__ */ jsx("code", { children: "xs" }),
|
|
403
|
+
"24px",
|
|
404
|
+
"13px",
|
|
405
|
+
"Inside dense rows only, e.g. copying an order number. The smallest target WCAG 2.2 allows."
|
|
406
|
+
]
|
|
407
|
+
]
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
410
|
+
title: "In a table toolbar",
|
|
411
|
+
description: /* @__PURE__ */ jsx("p", { children: "Small icon buttons beside a small search field and a small pill: one height, one line." }),
|
|
412
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
413
|
+
align: "fill",
|
|
414
|
+
code: `
|
|
415
|
+
<SearchField size="sm" aria-label="Search orders" placeholder="Search orders" />
|
|
416
|
+
<Tooltip content="Filter">
|
|
417
|
+
<IconButton label="Filter" variant="secondary" size="sm"><FunnelSimpleIcon /></IconButton>
|
|
418
|
+
</Tooltip>
|
|
419
|
+
<Tooltip content="Sort">
|
|
420
|
+
<IconButton label="Sort" variant="secondary" size="sm"><ArrowsDownUpIcon /></IconButton>
|
|
421
|
+
</Tooltip>
|
|
422
|
+
<Button size="sm" icon={<DownloadSimpleIcon />}>Export</Button>`,
|
|
423
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
424
|
+
className: "icon-button-table-bar",
|
|
425
|
+
children: [/* @__PURE__ */ jsx(SearchField, {
|
|
426
|
+
size: "sm",
|
|
427
|
+
"aria-label": "Search orders",
|
|
428
|
+
placeholder: "Search orders"
|
|
429
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
430
|
+
className: "icon-button-table-bar__end",
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
433
|
+
content: "Filter",
|
|
434
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
435
|
+
label: "Filter",
|
|
436
|
+
variant: "secondary",
|
|
437
|
+
size: "sm",
|
|
438
|
+
children: /* @__PURE__ */ jsx(FunnelSimpleIcon, {})
|
|
439
|
+
})
|
|
440
|
+
}),
|
|
441
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
442
|
+
content: "Sort",
|
|
443
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
444
|
+
label: "Sort",
|
|
445
|
+
variant: "secondary",
|
|
446
|
+
size: "sm",
|
|
447
|
+
children: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {})
|
|
448
|
+
})
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ jsx(Button, {
|
|
451
|
+
size: "sm",
|
|
452
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
453
|
+
children: "Export"
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
})]
|
|
457
|
+
})
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
]
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
463
|
+
id: "tooltip",
|
|
464
|
+
title: "With a tooltip",
|
|
465
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
466
|
+
"The label names the button for screen readers, but sighted people only see the icon. Wrap the button in a",
|
|
467
|
+
" ",
|
|
468
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
469
|
+
to: "/components/tooltip",
|
|
470
|
+
children: "Tooltip"
|
|
471
|
+
}),
|
|
472
|
+
" that repeats the label, so hovering or tabbing to it says what it does. When the action has a keyboard shortcut, pass ",
|
|
473
|
+
/* @__PURE__ */ jsx("code", { children: "shortcut" }),
|
|
474
|
+
" and the keys appear beside the words."
|
|
475
|
+
] }), /* @__PURE__ */ jsx("p", { children: "A tooltip opens after a short hover and straight away on keyboard focus. Once one is open, its neighbours open instantly, so moving along a toolbar is quick. Hover the header actions below." })] }),
|
|
476
|
+
children: [
|
|
477
|
+
/* @__PURE__ */ jsx(Example, {
|
|
478
|
+
code: `
|
|
479
|
+
<Tooltip content="Search" shortcut={['mod', 'K']} side="bottom">
|
|
480
|
+
<IconButton label="Search"><MagnifyingGlassIcon /></IconButton>
|
|
481
|
+
</Tooltip>
|
|
482
|
+
<Tooltip content="Notifications" side="bottom">
|
|
483
|
+
<IconButton label="Notifications"><BellIcon /></IconButton>
|
|
484
|
+
</Tooltip>
|
|
485
|
+
<Tooltip content="Help and shortcuts" shortcut={['?']} side="bottom">
|
|
486
|
+
<IconButton label="Help and shortcuts"><QuestionIcon /></IconButton>
|
|
487
|
+
</Tooltip>
|
|
488
|
+
<Tooltip content="Store settings" side="bottom">
|
|
489
|
+
<IconButton label="Store settings"><GearSixIcon /></IconButton>
|
|
490
|
+
</Tooltip>`,
|
|
491
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
492
|
+
className: "icon-button-row",
|
|
493
|
+
children: [
|
|
494
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
495
|
+
content: "Search",
|
|
496
|
+
shortcut: ["mod", "K"],
|
|
497
|
+
side: "bottom",
|
|
498
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
499
|
+
label: "Search",
|
|
500
|
+
children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {})
|
|
501
|
+
})
|
|
502
|
+
}),
|
|
503
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
504
|
+
content: "Notifications",
|
|
505
|
+
side: "bottom",
|
|
506
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
507
|
+
label: "Notifications",
|
|
508
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
509
|
+
})
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
512
|
+
content: "Help and shortcuts",
|
|
513
|
+
shortcut: ["?"],
|
|
514
|
+
side: "bottom",
|
|
515
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
516
|
+
label: "Help and shortcuts",
|
|
517
|
+
children: /* @__PURE__ */ jsx(QuestionIcon, {})
|
|
518
|
+
})
|
|
519
|
+
}),
|
|
520
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
521
|
+
content: "Store settings",
|
|
522
|
+
side: "bottom",
|
|
523
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
524
|
+
label: "Store settings",
|
|
525
|
+
children: /* @__PURE__ */ jsx(GearSixIcon, {})
|
|
526
|
+
})
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
})
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ jsx(ThemePair, {
|
|
532
|
+
caption: "Held open here for review. The shortcut shows ⌘ on a Mac and Ctrl elsewhere.",
|
|
533
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
534
|
+
className: "icon-button-row",
|
|
535
|
+
children: [
|
|
536
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
537
|
+
content: "Search",
|
|
538
|
+
shortcut: ["mod", "K"],
|
|
539
|
+
side: "bottom",
|
|
540
|
+
open: true,
|
|
541
|
+
hideWhenDetached: true,
|
|
542
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
543
|
+
label: "Search",
|
|
544
|
+
children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {})
|
|
545
|
+
})
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
548
|
+
label: "Notifications",
|
|
549
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
550
|
+
}),
|
|
551
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
552
|
+
label: "Help and shortcuts",
|
|
553
|
+
children: /* @__PURE__ */ jsx(QuestionIcon, {})
|
|
554
|
+
})
|
|
555
|
+
]
|
|
556
|
+
})
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ jsx(Note, {
|
|
559
|
+
title: "Touch screens",
|
|
560
|
+
children: "Tooltips never open on touch, so on a phone the icon has to be clear on its own. If it is not, use a Button with words."
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
}),
|
|
564
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
565
|
+
id: "toolbar",
|
|
566
|
+
title: "In a toolbar",
|
|
567
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
568
|
+
"Group related icon buttons 4px apart and split the groups with a vertical",
|
|
569
|
+
" ",
|
|
570
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
571
|
+
to: "/components/separator",
|
|
572
|
+
children: "Separator"
|
|
573
|
+
}),
|
|
574
|
+
". For a button that switches something on and off, pass",
|
|
575
|
+
" ",
|
|
576
|
+
/* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
|
|
577
|
+
" and switch it to ",
|
|
578
|
+
/* @__PURE__ */ jsx("code", { children: "soft" }),
|
|
579
|
+
" while it is on. Try the formatting buttons."
|
|
580
|
+
] }),
|
|
581
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
582
|
+
code: `
|
|
583
|
+
const [bold, setBold] = useState(true)
|
|
584
|
+
|
|
585
|
+
<div role="group" aria-label="Text formatting">
|
|
586
|
+
<Tooltip content="Bold" shortcut={['mod', 'B']}>
|
|
587
|
+
<IconButton
|
|
588
|
+
label="Bold"
|
|
589
|
+
size="sm"
|
|
590
|
+
variant={bold ? 'soft' : 'ghost'}
|
|
591
|
+
aria-pressed={bold}
|
|
592
|
+
onClick={() => setBold(!bold)}
|
|
593
|
+
>
|
|
594
|
+
<TextBIcon />
|
|
595
|
+
</IconButton>
|
|
596
|
+
</Tooltip>
|
|
597
|
+
{/* Italic and Underline work the same way */}
|
|
598
|
+
<Separator orientation="vertical" />
|
|
599
|
+
<Tooltip content="Bulleted list">
|
|
600
|
+
<IconButton label="Bulleted list" size="sm"><ListBulletsIcon /></IconButton>
|
|
601
|
+
</Tooltip>
|
|
602
|
+
<Tooltip content="Add link">
|
|
603
|
+
<IconButton label="Add link" size="sm"><LinkSimpleIcon /></IconButton>
|
|
604
|
+
</Tooltip>
|
|
605
|
+
<Separator orientation="vertical" />
|
|
606
|
+
<Tooltip content="Undo" shortcut={['mod', 'Z']}>
|
|
607
|
+
<IconButton label="Undo" size="sm"><ArrowCounterClockwiseIcon /></IconButton>
|
|
608
|
+
</Tooltip>
|
|
609
|
+
<Tooltip content="Redo" shortcut={['mod', 'shift', 'Z']}>
|
|
610
|
+
<IconButton label="Redo" size="sm"><ArrowClockwiseIcon /></IconButton>
|
|
611
|
+
</Tooltip>
|
|
612
|
+
</div>`,
|
|
613
|
+
children: /* @__PURE__ */ jsx(FormattingToolbar, {})
|
|
614
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
615
|
+
title: "Not a toolbar role",
|
|
616
|
+
children: [
|
|
617
|
+
"The group is a plain ",
|
|
618
|
+
/* @__PURE__ */ jsx("code", { children: "role=\"group\"" }),
|
|
619
|
+
" with a name, and every button is its own Tab stop. Only use",
|
|
620
|
+
" ",
|
|
621
|
+
/* @__PURE__ */ jsx("code", { children: "role=\"toolbar\"" }),
|
|
622
|
+
" if you also add arrow-key movement between the buttons, which IconButton does not do for you."
|
|
623
|
+
]
|
|
624
|
+
})]
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
627
|
+
id: "loading",
|
|
628
|
+
title: "Loading",
|
|
629
|
+
description: /* @__PURE__ */ jsx("p", { children: "While the action runs, a comet circles the button (teal on every material but primary), presses are ignored and focus stays put. Press the refresh button to see it." }),
|
|
630
|
+
children: [/* @__PURE__ */ jsxs(Example, {
|
|
631
|
+
code: `
|
|
632
|
+
const [syncing, setSyncing] = useState(false)
|
|
633
|
+
|
|
634
|
+
<Tooltip content="Refresh stock levels">
|
|
635
|
+
<IconButton label="Refresh stock levels" variant="secondary" loading={syncing} onClick={refresh}>
|
|
636
|
+
<ArrowsClockwiseIcon />
|
|
637
|
+
</IconButton>
|
|
638
|
+
</Tooltip>
|
|
639
|
+
<IconButton label="Syncing catalogue" loading><ArrowsClockwiseIcon /></IconButton>`,
|
|
640
|
+
children: [/* @__PURE__ */ jsx(RefreshButton, {}), /* @__PURE__ */ jsx(IconButton, {
|
|
641
|
+
label: "Syncing catalogue",
|
|
642
|
+
loading: true,
|
|
643
|
+
children: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {})
|
|
644
|
+
})]
|
|
645
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
646
|
+
title: "Long actions",
|
|
647
|
+
children: "The spinner takes the icon's place, so the circle says something is happening but not what. For actions that take more than a moment, a Button with words (\"Syncing catalogue\") tells people more."
|
|
648
|
+
})]
|
|
649
|
+
}),
|
|
650
|
+
/* @__PURE__ */ jsx(Section, {
|
|
651
|
+
id: "disabled",
|
|
652
|
+
title: "Disabled",
|
|
653
|
+
description: /* @__PURE__ */ jsx("p", { children: "Drops to 45% and can no longer be focused, so a keyboard user never reaches its tooltip. Undo and redo are the fair use: when there is nothing to undo, the reason is obvious. Otherwise leave it enabled and explain the problem when it is pressed." }),
|
|
654
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
655
|
+
code: `
|
|
656
|
+
<IconButton label="Undo" disabled><ArrowCounterClockwiseIcon /></IconButton>
|
|
657
|
+
<IconButton label="Redo" disabled><ArrowClockwiseIcon /></IconButton>
|
|
658
|
+
<IconButton label="More actions" variant="secondary" disabled><DotsThreeIcon /></IconButton>`,
|
|
659
|
+
children: [
|
|
660
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
661
|
+
label: "Undo",
|
|
662
|
+
disabled: true,
|
|
663
|
+
children: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {})
|
|
664
|
+
}),
|
|
665
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
666
|
+
label: "Redo",
|
|
667
|
+
disabled: true,
|
|
668
|
+
children: /* @__PURE__ */ jsx(ArrowClockwiseIcon, {})
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
671
|
+
label: "More actions",
|
|
672
|
+
variant: "secondary",
|
|
673
|
+
disabled: true,
|
|
674
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, {})
|
|
675
|
+
})
|
|
676
|
+
]
|
|
677
|
+
})
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
680
|
+
id: "guidelines",
|
|
681
|
+
title: "Guidelines",
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
684
|
+
do: {
|
|
685
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
686
|
+
icon: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {}),
|
|
687
|
+
children: "Sync stock"
|
|
688
|
+
}),
|
|
689
|
+
caption: "When the icon is not understood at a glance, add the words: a Button with an icon."
|
|
690
|
+
},
|
|
691
|
+
dont: {
|
|
692
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
693
|
+
label: "Sync stock",
|
|
694
|
+
variant: "secondary",
|
|
695
|
+
children: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {})
|
|
696
|
+
}),
|
|
697
|
+
caption: "Circling arrows could mean refresh, sync or undo, and a tooltip only helps people who hover."
|
|
698
|
+
}
|
|
699
|
+
}),
|
|
700
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
701
|
+
do: {
|
|
702
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
703
|
+
className: "icon-button-row",
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
706
|
+
label: "Edit product",
|
|
707
|
+
children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
|
|
708
|
+
}),
|
|
709
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
710
|
+
label: "Duplicate product",
|
|
711
|
+
children: /* @__PURE__ */ jsx(CopySimpleIcon, {})
|
|
712
|
+
}),
|
|
713
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
714
|
+
label: "Delete product",
|
|
715
|
+
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
716
|
+
})
|
|
717
|
+
]
|
|
718
|
+
}),
|
|
719
|
+
caption: "One material along a toolbar, so the icons read as a set."
|
|
720
|
+
},
|
|
721
|
+
dont: {
|
|
722
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
723
|
+
className: "icon-button-row",
|
|
724
|
+
"data-gap": "wide",
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
727
|
+
label: "Edit product",
|
|
728
|
+
variant: "secondary",
|
|
729
|
+
children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
732
|
+
label: "Duplicate product",
|
|
733
|
+
variant: "primary",
|
|
734
|
+
children: /* @__PURE__ */ jsx(CopySimpleIcon, {})
|
|
735
|
+
}),
|
|
736
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
737
|
+
label: "Delete product",
|
|
738
|
+
variant: "critical",
|
|
739
|
+
children: /* @__PURE__ */ jsx(TrashIcon, {})
|
|
740
|
+
})
|
|
741
|
+
]
|
|
742
|
+
}),
|
|
743
|
+
caption: "Mixed materials make every button shout. The view's primary action is a pill with words."
|
|
744
|
+
}
|
|
745
|
+
}),
|
|
746
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
747
|
+
"Label with a verb and the thing it acts on: \"Delete product\", \"Copy order number\", \"Print packing slip\". Name the action, not the picture.",
|
|
748
|
+
"One icon, one meaning across Orbit: a bin always deletes and a pencil always edits.",
|
|
749
|
+
"Tooltips go where there is room: below in the top bar, above in rows and footers.",
|
|
750
|
+
"Keep icon buttons in a group 4px apart and split groups with a vertical separator."
|
|
751
|
+
] })
|
|
752
|
+
]
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ jsx(Section, {
|
|
755
|
+
id: "accessibility",
|
|
756
|
+
title: "Accessibility",
|
|
757
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
758
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
759
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
760
|
+
" is required and becomes the button's ",
|
|
761
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
762
|
+
". The icon is hidden from assistive tech."
|
|
763
|
+
] }),
|
|
764
|
+
"A tooltip is not the name. While it is open it is linked to the button as a description, so keep it the same as the label, plus the shortcut if there is one.",
|
|
765
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
766
|
+
"Toggles take ",
|
|
767
|
+
/* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
|
|
768
|
+
", so screen readers announce them as on or off."
|
|
769
|
+
] }),
|
|
770
|
+
"Renders a native button, so Enter and Space press it. The teal focus ring is 2px, offset from the circle, and shows for keyboard focus only.",
|
|
771
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
772
|
+
"While loading it uses ",
|
|
773
|
+
/* @__PURE__ */ jsx("code", { children: "aria-busy" }),
|
|
774
|
+
" and ",
|
|
775
|
+
/* @__PURE__ */ jsx("code", { children: "aria-disabled" }),
|
|
776
|
+
", not ",
|
|
777
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
778
|
+
", so focus is not lost mid-action."
|
|
779
|
+
] }),
|
|
780
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("code", { children: "xs" }), " is 24px, the smallest target WCAG 2.2 allows. Leave space around it."] })
|
|
781
|
+
] })
|
|
782
|
+
}),
|
|
783
|
+
/* @__PURE__ */ jsx(Section, {
|
|
784
|
+
id: "props",
|
|
785
|
+
title: "Props",
|
|
786
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
787
|
+
"Also accepts every native button attribute, such as ",
|
|
788
|
+
/* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
|
|
789
|
+
" and ",
|
|
790
|
+
/* @__PURE__ */ jsx("code", { children: "type" }),
|
|
791
|
+
"."
|
|
792
|
+
] }),
|
|
793
|
+
children: /* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
794
|
+
{
|
|
795
|
+
name: "label",
|
|
796
|
+
type: "string",
|
|
797
|
+
required: true,
|
|
798
|
+
description: "The button's accessible name, set as aria-label. Name the action."
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
name: "children",
|
|
802
|
+
type: "ReactNode",
|
|
803
|
+
required: true,
|
|
804
|
+
description: "The icon. The button sizes it: 13, 15, 16 or 18px."
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: "variant",
|
|
808
|
+
type: "ButtonVariant",
|
|
809
|
+
default: "'ghost'",
|
|
810
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
811
|
+
"The material, as on Button: ",
|
|
812
|
+
/* @__PURE__ */ jsx("code", { children: "primary" }),
|
|
813
|
+
", ",
|
|
814
|
+
/* @__PURE__ */ jsx("code", { children: "secondary" }),
|
|
815
|
+
", ",
|
|
816
|
+
/* @__PURE__ */ jsx("code", { children: "soft" }),
|
|
817
|
+
",",
|
|
818
|
+
" ",
|
|
819
|
+
/* @__PURE__ */ jsx("code", { children: "ghost" }),
|
|
820
|
+
", ",
|
|
821
|
+
/* @__PURE__ */ jsx("code", { children: "inverse" }),
|
|
822
|
+
" or ",
|
|
823
|
+
/* @__PURE__ */ jsx("code", { children: "critical" }),
|
|
824
|
+
"."
|
|
825
|
+
] })
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
name: "size",
|
|
829
|
+
type: "'xs' | 'sm' | 'md' | 'lg'",
|
|
830
|
+
default: "'md'",
|
|
831
|
+
description: "A circle 24, 30, 36 or 44px across."
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
name: "loading",
|
|
835
|
+
type: "boolean",
|
|
836
|
+
default: "false",
|
|
837
|
+
description: "Comet in orbit, the spinner in the icon's place, presses ignored, focus kept."
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
name: "disabled",
|
|
841
|
+
type: "boolean",
|
|
842
|
+
description: "Native disabled. It can no longer be focused."
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "asChild",
|
|
846
|
+
type: "boolean",
|
|
847
|
+
default: "false",
|
|
848
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
849
|
+
"Render your element (a router link) as the round button. Put the icon inside it:",
|
|
850
|
+
" ",
|
|
851
|
+
/* @__PURE__ */ jsx("code", { children: "<IconButton asChild label=\"Help\"><Link to=\"/help\"><QuestionIcon /></Link></IconButton>" }),
|
|
852
|
+
"."
|
|
853
|
+
] })
|
|
854
|
+
}
|
|
855
|
+
] })
|
|
856
|
+
})
|
|
857
|
+
]
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
//#endregion
|
|
861
|
+
export { Page, Preview };
|