@walco-ai/claude-plugin-design-system 0.0.0-stage → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +35 -2
  3. package/dist/breakpoints.d.ts +10 -0
  4. package/dist/components/AppHeader/AppHeader.d.ts +23 -0
  5. package/dist/components/Badge/Badge.d.ts +9 -0
  6. package/dist/components/Banner/Banner.d.ts +23 -0
  7. package/dist/components/Button/Button.d.ts +13 -0
  8. package/dist/components/Card/Card.d.ts +12 -0
  9. package/dist/components/ChangeBar/ChangeBar.d.ts +9 -0
  10. package/dist/components/Checkbox/Checkbox.d.ts +3 -0
  11. package/dist/components/CollapsibleRow/CollapsibleRow.d.ts +24 -0
  12. package/dist/components/Field/Field.d.ts +18 -0
  13. package/dist/components/Figure/Figure.d.ts +10 -0
  14. package/dist/components/FilterChip/FilterChip.d.ts +14 -0
  15. package/dist/components/Icon/Icon.d.ts +12 -0
  16. package/dist/components/Icon/icons.d.ts +34 -0
  17. package/dist/components/IconButton/IconButton.d.ts +10 -0
  18. package/dist/components/Link/Link.d.ts +8 -0
  19. package/dist/components/LiveIndicator/LiveIndicator.d.ts +10 -0
  20. package/dist/components/PillButton/PillButton.d.ts +13 -0
  21. package/dist/components/ProgressBar/ProgressBar.d.ts +12 -0
  22. package/dist/components/Prose/Prose.d.ts +13 -0
  23. package/dist/components/Radio/Choice.d.ts +10 -0
  24. package/dist/components/Radio/Radio.d.ts +3 -0
  25. package/dist/components/ScrollArea/ScrollArea.d.ts +12 -0
  26. package/dist/components/SegmentedControl/SegmentedControl.d.ts +17 -0
  27. package/dist/components/StatusBadge/StatusBadge.d.ts +9 -0
  28. package/dist/components/StatusDot/StatusDot.d.ts +13 -0
  29. package/dist/components/Tabs/Tabs.d.ts +17 -0
  30. package/dist/components/TextArea/TextArea.d.ts +10 -0
  31. package/dist/components/TextField/TextField.d.ts +10 -0
  32. package/dist/components/TruncatedPath/TruncatedPath.d.ts +7 -0
  33. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +7 -0
  34. package/dist/fonts/OFL.txt +94 -0
  35. package/dist/fonts/fonts.css +91 -0
  36. package/dist/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  37. package/dist/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  38. package/dist/fonts/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  39. package/dist/fonts/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  40. package/dist/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  41. package/dist/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  42. package/dist/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  43. package/dist/fonts/ibm-plex-sans-latin-ext-400-normal.woff2 +0 -0
  44. package/dist/fonts/ibm-plex-sans-latin-ext-500-normal.woff2 +0 -0
  45. package/dist/fonts/ibm-plex-sans-latin-ext-600-normal.woff2 +0 -0
  46. package/dist/index.d.ts +30 -0
  47. package/dist/index.js +662 -0
  48. package/dist/internal/cx.d.ts +2 -0
  49. package/dist/internal/tone.d.ts +2 -0
  50. package/dist/styles.css +1519 -0
  51. package/package.json +33 -4
package/dist/index.js ADDED
@@ -0,0 +1,662 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeft, ArrowRight, Check, ChevronDown, ChevronRight, CircleAlert, CircleCheck, Clock, Copy, ExternalLink, History, Info, LoaderCircle, MessageSquareText, Network, NotepadText, Pencil, Plus, RefreshCw, Search, Send, TriangleAlert, X } from "lucide-react";
3
+ import { useId, useRef, useState } from "react";
4
+ //#region package/src/internal/cx.ts
5
+ /** Joins the class names that are set. */
6
+ function cx(...names) {
7
+ return names.filter((name) => typeof name === "string" && name !== "").join(" ");
8
+ }
9
+ //#endregion
10
+ //#region package/src/components/Icon/Icon.tsx
11
+ function Icon({ icon, size = "md", label, className }) {
12
+ const Glyph = icon.component;
13
+ const naming = label === void 0 ? { "aria-hidden": true } : {
14
+ role: "img",
15
+ "aria-label": label
16
+ };
17
+ return /* @__PURE__ */ jsx(Glyph, {
18
+ className: cx("cpds-icon", `cpds-icon--${size}`, className),
19
+ strokeWidth: 1.75,
20
+ focusable: "false",
21
+ "data-icon": icon.name,
22
+ ...naming
23
+ });
24
+ }
25
+ //#endregion
26
+ //#region package/src/components/Icon/icons.ts
27
+ /**
28
+ * One icon of the design system's set. Only this package creates them, so the set stays closed; each icon is its own
29
+ * export, so a bundle keeps only the icons an interface imports.
30
+ */
31
+ var IconGlyph = class {
32
+ #closedSet = true;
33
+ name;
34
+ component;
35
+ constructor(name, component) {
36
+ this.name = name;
37
+ this.component = component;
38
+ }
39
+ };
40
+ var iconArrowLeft = /* @__PURE__ */ new IconGlyph("arrow-left", ArrowLeft);
41
+ var iconArrowRight = /* @__PURE__ */ new IconGlyph("arrow-right", ArrowRight);
42
+ var iconCheck = /* @__PURE__ */ new IconGlyph("check", Check);
43
+ var iconChevronDown = /* @__PURE__ */ new IconGlyph("chevron-down", ChevronDown);
44
+ var iconChevronRight = /* @__PURE__ */ new IconGlyph("chevron-right", ChevronRight);
45
+ var iconCircleAlert = /* @__PURE__ */ new IconGlyph("circle-alert", CircleAlert);
46
+ var iconCircleCheck = /* @__PURE__ */ new IconGlyph("circle-check", CircleCheck);
47
+ var iconClock = /* @__PURE__ */ new IconGlyph("clock", Clock);
48
+ var iconCopy = /* @__PURE__ */ new IconGlyph("copy", Copy);
49
+ var iconDiagram = /* @__PURE__ */ new IconGlyph("diagram", Network);
50
+ var iconExternalLink = /* @__PURE__ */ new IconGlyph("external-link", ExternalLink);
51
+ var iconHistory = /* @__PURE__ */ new IconGlyph("history", History);
52
+ var iconInfo = /* @__PURE__ */ new IconGlyph("info", Info);
53
+ var iconLoader = /* @__PURE__ */ new IconGlyph("loader", LoaderCircle);
54
+ var iconMessage = /* @__PURE__ */ new IconGlyph("message", MessageSquareText);
55
+ var iconNotepad = /* @__PURE__ */ new IconGlyph("notepad", NotepadText);
56
+ var iconPencil = /* @__PURE__ */ new IconGlyph("pencil", Pencil);
57
+ var iconPlus = /* @__PURE__ */ new IconGlyph("plus", Plus);
58
+ var iconRefresh = /* @__PURE__ */ new IconGlyph("refresh", RefreshCw);
59
+ var iconSearch = /* @__PURE__ */ new IconGlyph("search", Search);
60
+ var iconSend = /* @__PURE__ */ new IconGlyph("send", Send);
61
+ var iconTriangleAlert = /* @__PURE__ */ new IconGlyph("triangle-alert", TriangleAlert);
62
+ var iconX = /* @__PURE__ */ new IconGlyph("x", X);
63
+ //#endregion
64
+ //#region package/src/components/Button/Button.tsx
65
+ function Button({ variant = "secondary", icon, loading = false, type = "button", className, onClick, children, ...rest }) {
66
+ const lead = loading ? /* @__PURE__ */ jsx(Icon, {
67
+ icon: iconLoader,
68
+ className: "cpds-button__spinner"
69
+ }) : icon === void 0 ? null : /* @__PURE__ */ jsx(Icon, { icon });
70
+ const click = (event) => {
71
+ if (loading) {
72
+ event.preventDefault();
73
+ return;
74
+ }
75
+ onClick?.(event);
76
+ };
77
+ return /* @__PURE__ */ jsxs("button", {
78
+ type,
79
+ className: cx("cpds-button", `cpds-button--${variant}`, className),
80
+ "aria-busy": loading || void 0,
81
+ "aria-disabled": loading || rest["aria-disabled"],
82
+ "data-loading": loading || void 0,
83
+ onClick: click,
84
+ ...rest,
85
+ children: [/* @__PURE__ */ jsx("span", {
86
+ className: "cpds-button__lead",
87
+ "data-open": lead !== null || void 0,
88
+ children: /* @__PURE__ */ jsx("span", {
89
+ className: "cpds-button__lead-inner",
90
+ children: lead
91
+ })
92
+ }), /* @__PURE__ */ jsx("span", { children })]
93
+ });
94
+ }
95
+ //#endregion
96
+ //#region package/src/components/IconButton/IconButton.tsx
97
+ function IconButton({ icon, label, variant = "ghost", type = "button", title, className, ...rest }) {
98
+ return /* @__PURE__ */ jsx("button", {
99
+ type,
100
+ "aria-label": label,
101
+ title: title ?? label,
102
+ className: cx("cpds-icon-button", `cpds-icon-button--${variant}`, className),
103
+ ...rest,
104
+ children: /* @__PURE__ */ jsx(Icon, { icon })
105
+ });
106
+ }
107
+ //#endregion
108
+ //#region package/src/components/Link/Link.tsx
109
+ function Link({ variant = "accent", className, children, ...rest }) {
110
+ return /* @__PURE__ */ jsx("a", {
111
+ className: cx("cpds-link", `cpds-link--${variant}`, className),
112
+ ...rest,
113
+ children
114
+ });
115
+ }
116
+ //#endregion
117
+ //#region package/src/components/Field/Field.tsx
118
+ /** The frame shared by the text fields: a label above, the control, then a hint or an error below. */
119
+ function Field({ id, label, hint, error, className, children }) {
120
+ const hintId = hint === void 0 ? void 0 : `${id}-hint`;
121
+ const errorId = error === void 0 ? void 0 : `${id}-error`;
122
+ const describedBy = [errorId, hintId].filter((value) => value !== void 0).join(" ") || void 0;
123
+ return /* @__PURE__ */ jsxs("div", {
124
+ className: cx("cpds-field", className),
125
+ children: [
126
+ /* @__PURE__ */ jsx("label", {
127
+ className: "cpds-field__label",
128
+ htmlFor: id,
129
+ children: label
130
+ }),
131
+ children({
132
+ id,
133
+ describedBy,
134
+ invalid: error !== void 0
135
+ }),
136
+ error !== void 0 && /* @__PURE__ */ jsxs("p", {
137
+ className: "cpds-field__error",
138
+ id: errorId,
139
+ children: [/* @__PURE__ */ jsx(Icon, {
140
+ icon: iconCircleAlert,
141
+ size: "sm"
142
+ }), /* @__PURE__ */ jsx("span", { children: error })]
143
+ }),
144
+ hint !== void 0 && /* @__PURE__ */ jsx("p", {
145
+ className: "cpds-field__hint",
146
+ id: hintId,
147
+ children: hint
148
+ })
149
+ ]
150
+ });
151
+ }
152
+ //#endregion
153
+ //#region package/src/components/TextField/TextField.tsx
154
+ function TextField({ label, hint, error, className, id, type = "text", ...rest }) {
155
+ const generated = useId();
156
+ return /* @__PURE__ */ jsx(Field, {
157
+ id: id ?? generated,
158
+ label,
159
+ hint,
160
+ error,
161
+ className,
162
+ children: (control) => /* @__PURE__ */ jsx("input", {
163
+ ...rest,
164
+ id: control.id,
165
+ type,
166
+ className: "cpds-input",
167
+ "aria-invalid": control.invalid || void 0,
168
+ "aria-describedby": control.describedBy
169
+ })
170
+ });
171
+ }
172
+ //#endregion
173
+ //#region package/src/components/TextArea/TextArea.tsx
174
+ function TextArea({ label, hint, error, className, id, rows = 3, ...rest }) {
175
+ const generated = useId();
176
+ return /* @__PURE__ */ jsx(Field, {
177
+ id: id ?? generated,
178
+ label,
179
+ hint,
180
+ error,
181
+ className,
182
+ children: (control) => /* @__PURE__ */ jsx("textarea", {
183
+ ...rest,
184
+ id: control.id,
185
+ rows,
186
+ className: "cpds-input",
187
+ "aria-invalid": control.invalid || void 0,
188
+ "aria-describedby": control.describedBy
189
+ })
190
+ });
191
+ }
192
+ //#endregion
193
+ //#region package/src/components/Radio/Choice.tsx
194
+ /** A radio button or a checkbox with its label, the whole row being the touch target. */
195
+ function Choice({ type, label, description, className, ...rest }) {
196
+ return /* @__PURE__ */ jsxs("label", {
197
+ className: cx("cpds-choice", className),
198
+ children: [/* @__PURE__ */ jsx("input", {
199
+ ...rest,
200
+ type,
201
+ className: "cpds-choice__input"
202
+ }), /* @__PURE__ */ jsxs("span", {
203
+ className: "cpds-choice__text",
204
+ children: [/* @__PURE__ */ jsx("span", {
205
+ className: "cpds-choice__label",
206
+ children: label
207
+ }), description !== void 0 && /* @__PURE__ */ jsx("span", {
208
+ className: "cpds-choice__description",
209
+ children: description
210
+ })]
211
+ })]
212
+ });
213
+ }
214
+ //#endregion
215
+ //#region package/src/components/Radio/Radio.tsx
216
+ function Radio(props) {
217
+ return /* @__PURE__ */ jsx(Choice, {
218
+ ...props,
219
+ type: "radio"
220
+ });
221
+ }
222
+ //#endregion
223
+ //#region package/src/components/Checkbox/Checkbox.tsx
224
+ function Checkbox(props) {
225
+ return /* @__PURE__ */ jsx(Choice, {
226
+ ...props,
227
+ type: "checkbox"
228
+ });
229
+ }
230
+ //#endregion
231
+ //#region package/src/components/Card/Card.tsx
232
+ function Card({ variant = "default", inset = "lg", as: Tag = "div", className, children, ...rest }) {
233
+ return /* @__PURE__ */ jsx(Tag, {
234
+ className: cx("cpds-card", `cpds-card--${variant}`, `cpds-card--inset-${inset}`, className),
235
+ ...rest,
236
+ children
237
+ });
238
+ }
239
+ //#endregion
240
+ //#region package/src/components/Badge/Badge.tsx
241
+ /** A small label attached to an item, such as "Recommended" or "Revised". */
242
+ function Badge({ tone = "neutral", className, children, ...rest }) {
243
+ return /* @__PURE__ */ jsx("span", {
244
+ className: cx("cpds-badge", `cpds-tone--${tone}`, className),
245
+ ...rest,
246
+ children
247
+ });
248
+ }
249
+ //#endregion
250
+ //#region package/src/components/StatusBadge/StatusBadge.tsx
251
+ /** The status of an item or of a view, such as "Waiting for you" or "Confirmed". */
252
+ function StatusBadge({ tone, className, children, ...rest }) {
253
+ return /* @__PURE__ */ jsx("span", {
254
+ className: cx("cpds-status-badge", `cpds-tone--${tone}`, className),
255
+ ...rest,
256
+ children
257
+ });
258
+ }
259
+ //#endregion
260
+ //#region package/src/components/CollapsibleRow/CollapsibleRow.tsx
261
+ /** A row that shows or hides its content, collapsed by default. */
262
+ function CollapsibleRow({ title, leading, meta, variant = "card", selected = false, expanded, defaultExpanded = false, onExpandedChange, className, children }) {
263
+ const [own, setOwn] = useState(defaultExpanded);
264
+ const open = expanded ?? own;
265
+ const contentId = useId();
266
+ const toggle = () => {
267
+ setOwn(!open);
268
+ onExpandedChange?.(!open);
269
+ };
270
+ const sliding = variant === "row";
271
+ return /* @__PURE__ */ jsxs("div", {
272
+ className: cx("cpds-collapsible", `cpds-collapsible--${variant}`, className),
273
+ "data-expanded": open,
274
+ "data-selected": selected || void 0,
275
+ "aria-current": selected || void 0,
276
+ children: [/* @__PURE__ */ jsxs("button", {
277
+ type: "button",
278
+ className: "cpds-collapsible__trigger",
279
+ "aria-expanded": open,
280
+ "aria-controls": contentId,
281
+ onClick: toggle,
282
+ children: [
283
+ /* @__PURE__ */ jsx(Icon, {
284
+ icon: iconChevronRight,
285
+ size: "sm",
286
+ className: "cpds-collapsible__chevron"
287
+ }),
288
+ leading !== void 0 && /* @__PURE__ */ jsx("span", {
289
+ className: "cpds-collapsible__leading",
290
+ children: leading
291
+ }),
292
+ /* @__PURE__ */ jsx("span", {
293
+ className: "cpds-collapsible__title",
294
+ children: title
295
+ }),
296
+ meta !== void 0 && /* @__PURE__ */ jsx("span", {
297
+ className: "cpds-collapsible__meta",
298
+ children: meta
299
+ })
300
+ ]
301
+ }), sliding ? /* @__PURE__ */ jsx("div", {
302
+ id: contentId,
303
+ className: "cpds-collapsible__content",
304
+ inert: !open,
305
+ children: /* @__PURE__ */ jsx("div", {
306
+ className: "cpds-collapsible__inner",
307
+ children
308
+ })
309
+ }) : /* @__PURE__ */ jsx("div", {
310
+ id: contentId,
311
+ className: "cpds-collapsible__content",
312
+ hidden: !open,
313
+ children
314
+ })]
315
+ });
316
+ }
317
+ //#endregion
318
+ //#region package/src/components/LiveIndicator/LiveIndicator.tsx
319
+ var defaultLabels = {
320
+ live: "Live",
321
+ offline: "Offline"
322
+ };
323
+ /** Whether the page is receiving live updates: a dot and a word. */
324
+ function LiveIndicator({ connection, label, className }) {
325
+ return /* @__PURE__ */ jsxs("span", {
326
+ className: cx("cpds-live", `cpds-live--${connection}`, className),
327
+ role: "status",
328
+ children: [/* @__PURE__ */ jsx("span", {
329
+ className: "cpds-live__dot",
330
+ "aria-hidden": "true"
331
+ }), label ?? defaultLabels[connection]]
332
+ });
333
+ }
334
+ //#endregion
335
+ //#region package/src/components/AppHeader/AppHeader.tsx
336
+ /** The bar at the top of an interface: its name, the breadcrumb, the live indicator and a few actions. */
337
+ function AppHeader({ title, icon, breadcrumb, connection, actions, className }) {
338
+ return /* @__PURE__ */ jsxs("header", {
339
+ className: cx("cpds-app-header", className),
340
+ children: [
341
+ /* @__PURE__ */ jsxs("div", {
342
+ className: "cpds-app-header__title",
343
+ children: [icon !== void 0 && /* @__PURE__ */ jsx(Icon, {
344
+ icon,
345
+ size: "lg"
346
+ }), /* @__PURE__ */ jsx("span", { children: title })]
347
+ }),
348
+ breadcrumb !== void 0 && breadcrumb.length > 0 && /* @__PURE__ */ jsx("nav", {
349
+ "aria-label": "Breadcrumb",
350
+ className: "cpds-app-header__breadcrumb",
351
+ children: /* @__PURE__ */ jsx("ol", { children: breadcrumb.map((item, index) => {
352
+ const current = index === breadcrumb.length - 1;
353
+ return /* @__PURE__ */ jsxs("li", { children: [index > 0 && /* @__PURE__ */ jsx("span", {
354
+ "aria-hidden": "true",
355
+ className: "cpds-app-header__separator",
356
+ children: "/"
357
+ }), item.href !== void 0 && !current ? /* @__PURE__ */ jsx(Link, {
358
+ href: item.href,
359
+ variant: "muted",
360
+ children: item.label
361
+ }) : /* @__PURE__ */ jsx("span", {
362
+ "aria-current": current ? "page" : void 0,
363
+ className: "cpds-app-header__current",
364
+ children: item.label
365
+ })] }, `${String(index)}-${item.label}`);
366
+ }) })
367
+ }),
368
+ (connection !== void 0 || actions !== void 0) && /* @__PURE__ */ jsxs("div", {
369
+ className: "cpds-app-header__end",
370
+ children: [connection !== void 0 && /* @__PURE__ */ jsx(LiveIndicator, { connection }), actions]
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ //#endregion
376
+ //#region package/src/components/Banner/Banner.tsx
377
+ var toneIcons = {
378
+ neutral: iconInfo,
379
+ info: iconInfo,
380
+ waiting: iconClock,
381
+ success: iconCircleCheck,
382
+ danger: iconCircleAlert
383
+ };
384
+ /** A message about the state of a view or an item, announced politely to assistive technologies. */
385
+ function Banner({ variant = "info", tone = "info", icon, title, actions, onDismiss, dismissLabel = "Dismiss", className, children }) {
386
+ const controls = variant === "info" && (actions !== void 0 || onDismiss !== void 0);
387
+ const message = /* @__PURE__ */ jsxs(Fragment, { children: [
388
+ title !== void 0 && /* @__PURE__ */ jsx("strong", {
389
+ className: "cpds-banner__title",
390
+ children: title
391
+ }),
392
+ title !== void 0 && " ",
393
+ children
394
+ ] });
395
+ return /* @__PURE__ */ jsxs("div", {
396
+ role: controls ? void 0 : "status",
397
+ className: cx("cpds-banner", `cpds-banner--${variant}`, `cpds-banner-tone--${tone}`, variant === "info" && `cpds-tone--${tone}`, controls && "cpds-banner--with-controls", className),
398
+ children: [
399
+ /* @__PURE__ */ jsx(Icon, {
400
+ icon: icon ?? toneIcons[tone],
401
+ size: variant === "status" ? "sm" : "md"
402
+ }),
403
+ /* @__PURE__ */ jsx("span", {
404
+ role: controls ? "status" : void 0,
405
+ className: "cpds-banner__message",
406
+ children: message
407
+ }),
408
+ controls && /* @__PURE__ */ jsxs("span", {
409
+ className: "cpds-banner__controls",
410
+ children: [actions, onDismiss !== void 0 && /* @__PURE__ */ jsx(IconButton, {
411
+ icon: iconX,
412
+ label: dismissLabel,
413
+ variant: "ghost",
414
+ onClick: onDismiss
415
+ })]
416
+ })
417
+ ]
418
+ });
419
+ }
420
+ //#endregion
421
+ //#region package/src/components/Figure/Figure.tsx
422
+ /** A frame around a visual, with an optional caption. */
423
+ function Figure({ caption, className, children }) {
424
+ const captionId = useId();
425
+ return /* @__PURE__ */ jsxs("figure", {
426
+ className: cx("cpds-figure", className),
427
+ "aria-labelledby": caption === void 0 ? void 0 : captionId,
428
+ children: [/* @__PURE__ */ jsx("div", {
429
+ className: "cpds-figure__content",
430
+ children
431
+ }), caption !== void 0 && /* @__PURE__ */ jsx("figcaption", {
432
+ id: captionId,
433
+ className: "cpds-figure__caption",
434
+ children: caption
435
+ })]
436
+ });
437
+ }
438
+ //#endregion
439
+ //#region package/src/components/Prose/Prose.tsx
440
+ /** Styles rendered rich text, such as the output of a Markdown renderer, with the design system's tokens. */
441
+ function Prose({ density = "block", className, children, ...rest }) {
442
+ return /* @__PURE__ */ jsx(density === "inline" ? "span" : "div", {
443
+ className: cx("cpds-prose", `cpds-prose--${density}`, className),
444
+ ...rest,
445
+ children
446
+ });
447
+ }
448
+ //#endregion
449
+ //#region package/src/components/VisuallyHidden/VisuallyHidden.tsx
450
+ /** Text read by assistive technologies and never drawn, such as the full name of a compact item. */
451
+ function VisuallyHidden({ className, children }) {
452
+ return /* @__PURE__ */ jsx("span", {
453
+ className: cx("cpds-visually-hidden", className),
454
+ children
455
+ });
456
+ }
457
+ //#endregion
458
+ //#region package/src/components/StatusDot/StatusDot.tsx
459
+ /** A small dot in the tone of a state, filled for an active state, outlined for one that has not started. */
460
+ function StatusDot({ status, label, className }) {
461
+ return /* @__PURE__ */ jsx("span", {
462
+ className: cx("cpds-status-dot", `cpds-status-dot--${status}`, className),
463
+ "aria-hidden": label === void 0 ? true : void 0,
464
+ children: label !== void 0 && /* @__PURE__ */ jsx(VisuallyHidden, { children: label })
465
+ });
466
+ }
467
+ //#endregion
468
+ //#region package/src/components/ProgressBar/ProgressBar.tsx
469
+ /** How far a task has gone: a short bar, filled in the running tone, in the success tone once complete. */
470
+ function ProgressBar({ value, max, label, valueText, className }) {
471
+ const ratio = max > 0 ? Math.min(Math.max(value / max, 0), 1) : 0;
472
+ const complete = max > 0 && value >= max;
473
+ return /* @__PURE__ */ jsxs("span", {
474
+ className: cx("cpds-progress", className),
475
+ "data-complete": complete || void 0,
476
+ children: [/* @__PURE__ */ jsx("span", {
477
+ className: "cpds-progress__track",
478
+ role: "progressbar",
479
+ "aria-label": label,
480
+ "aria-valuemin": 0,
481
+ "aria-valuemax": max,
482
+ "aria-valuenow": value,
483
+ style: { "--cpds-progress-ratio": ratio },
484
+ children: /* @__PURE__ */ jsx("span", { className: "cpds-progress__fill" })
485
+ }), valueText !== void 0 && /* @__PURE__ */ jsx("span", {
486
+ className: "cpds-progress__text",
487
+ children: valueText
488
+ })]
489
+ });
490
+ }
491
+ //#endregion
492
+ //#region package/src/components/FilterChip/FilterChip.tsx
493
+ /** A filter the user turns on or off: outlined while off, filled in its tone while on. */
494
+ function FilterChip({ pressed, onPressedChange, tone = "accent", count, type = "button", className, children, ...rest }) {
495
+ return /* @__PURE__ */ jsxs("button", {
496
+ type,
497
+ "aria-pressed": pressed,
498
+ className: cx("cpds-filter-chip", pressed && `cpds-tone--${tone}`, className),
499
+ onClick: () => {
500
+ onPressedChange(!pressed);
501
+ },
502
+ ...rest,
503
+ children: [children, count !== void 0 && /* @__PURE__ */ jsx("span", {
504
+ className: "cpds-filter-chip__count",
505
+ children: count
506
+ })]
507
+ });
508
+ }
509
+ //#endregion
510
+ //#region package/src/components/SegmentedControl/SegmentedControl.tsx
511
+ /** A choice between a few views, side by side in one track, the selected one filled; no option changes size. */
512
+ function SegmentedControl({ options, value, onChange, label, fullWidth = false, className }) {
513
+ return /* @__PURE__ */ jsx("div", {
514
+ role: "group",
515
+ "aria-label": label,
516
+ className: cx("cpds-segmented", fullWidth && "cpds-segmented--full-width", className),
517
+ children: options.map((option) => /* @__PURE__ */ jsx("button", {
518
+ type: "button",
519
+ className: "cpds-segmented__option",
520
+ "aria-pressed": option.id === value,
521
+ onClick: () => {
522
+ onChange(option.id);
523
+ },
524
+ children: option.label
525
+ }, option.id))
526
+ });
527
+ }
528
+ //#endregion
529
+ //#region package/src/components/Tabs/Tabs.tsx
530
+ /**
531
+ * Tabs sharing the full width over panels drawn in one grid cell: only the selected panel shows, the others stay laid
532
+ * out but hidden and inert, so the cell keeps the tallest panel's height and switching moves nothing below.
533
+ */
534
+ function Tabs({ tabs, value, onChange, label, panels, className }) {
535
+ const prefix = useId();
536
+ const list = useRef(null);
537
+ const move = (event, index) => {
538
+ const last = tabs.length - 1;
539
+ const target = {
540
+ ArrowRight: index === last ? 0 : index + 1,
541
+ ArrowLeft: index === 0 ? last : index - 1,
542
+ Home: 0,
543
+ End: last
544
+ }[event.key];
545
+ const next = target === void 0 ? void 0 : tabs[target];
546
+ if (next === void 0) return;
547
+ event.preventDefault();
548
+ onChange(next.id);
549
+ list.current?.querySelector(`#${CSS.escape(`${prefix}-tab-${next.id}`)}`)?.focus();
550
+ };
551
+ return /* @__PURE__ */ jsxs("div", {
552
+ className: cx("cpds-tabs", className),
553
+ children: [/* @__PURE__ */ jsx("div", {
554
+ ref: list,
555
+ role: "tablist",
556
+ "aria-label": label,
557
+ className: "cpds-tabs__list",
558
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsx("button", {
559
+ type: "button",
560
+ role: "tab",
561
+ id: `${prefix}-tab-${tab.id}`,
562
+ className: "cpds-tabs__tab",
563
+ "aria-selected": tab.id === value,
564
+ "aria-controls": `${prefix}-panel-${tab.id}`,
565
+ tabIndex: tab.id === value ? 0 : -1,
566
+ onClick: () => {
567
+ onChange(tab.id);
568
+ },
569
+ onKeyDown: (event) => {
570
+ move(event, index);
571
+ },
572
+ children: tab.label
573
+ }, tab.id))
574
+ }), /* @__PURE__ */ jsx("div", {
575
+ className: "cpds-tabs__panels",
576
+ children: tabs.map((tab) => /* @__PURE__ */ jsx("div", {
577
+ role: "tabpanel",
578
+ id: `${prefix}-panel-${tab.id}`,
579
+ "aria-labelledby": `${prefix}-tab-${tab.id}`,
580
+ className: "cpds-tabs__panel",
581
+ "data-active": tab.id === value || void 0,
582
+ inert: tab.id !== value,
583
+ children: panels[tab.id]
584
+ }, tab.id))
585
+ })]
586
+ });
587
+ }
588
+ //#endregion
589
+ //#region package/src/components/ScrollArea/ScrollArea.tsx
590
+ /** A region that scrolls its content within itself, with thin scrollbars, reachable and scrollable by keyboard. */
591
+ function ScrollArea({ label, axis = "vertical", className, children }) {
592
+ return /* @__PURE__ */ jsx("div", {
593
+ role: "region",
594
+ "aria-label": label,
595
+ tabIndex: 0,
596
+ className: cx("cpds-scroll-area", `cpds-scroll-area--${axis}`, className),
597
+ children
598
+ });
599
+ }
600
+ //#endregion
601
+ //#region package/src/components/PillButton/PillButton.tsx
602
+ /** A compact rounded button for a small count or a short action, such as "+2" or "3 hidden". */
603
+ function PillButton({ tone = "neutral", variant = "tinted", icon, type = "button", className, children, ...rest }) {
604
+ return /* @__PURE__ */ jsxs("button", {
605
+ type,
606
+ className: cx("cpds-pill-button", `cpds-pill-button--${variant}`, `cpds-pill-button-tone--${tone}`, variant === "tinted" && `cpds-tone--${tone}`, className),
607
+ ...rest,
608
+ children: [icon !== void 0 && /* @__PURE__ */ jsx(Icon, {
609
+ icon,
610
+ size: "sm"
611
+ }), children]
612
+ });
613
+ }
614
+ //#endregion
615
+ //#region package/src/components/ChangeBar/ChangeBar.tsx
616
+ /** The share of lines added and removed, as a row of cells; decorative, so the counts must be given as text too. */
617
+ function ChangeBar({ added, removed, cells = 5, className }) {
618
+ const total = added + removed;
619
+ const red = removed > 0 ? Math.max(1, Math.round(removed / total * cells)) : 0;
620
+ const green = added > 0 ? Math.max(1, cells - red) : 0;
621
+ const removedCells = Math.min(red, cells - green);
622
+ return /* @__PURE__ */ jsx("span", {
623
+ className: cx("cpds-change-bar", className),
624
+ "aria-hidden": "true",
625
+ children: Array.from({ length: cells }, (_, index) => /* @__PURE__ */ jsx("span", {
626
+ className: "cpds-change-bar__cell",
627
+ "data-change": index < green ? "added" : index < green + removedCells ? "removed" : void 0
628
+ }, index))
629
+ });
630
+ }
631
+ //#endregion
632
+ //#region package/src/components/TruncatedPath/TruncatedPath.tsx
633
+ /** A file path on one line, shortened in its middle: the directory gives way first, the file name stays whole. */
634
+ function TruncatedPath({ path, className }) {
635
+ const slash = path.lastIndexOf("/");
636
+ const directory = path.slice(0, slash + 1);
637
+ const name = path.slice(slash + 1);
638
+ return /* @__PURE__ */ jsxs("span", {
639
+ className: cx("cpds-truncated-path", className),
640
+ title: path,
641
+ children: [directory !== "" && /* @__PURE__ */ jsx("span", {
642
+ className: "cpds-truncated-path__directory",
643
+ children: directory
644
+ }), /* @__PURE__ */ jsx("span", {
645
+ className: "cpds-truncated-path__name",
646
+ children: name
647
+ })]
648
+ });
649
+ }
650
+ //#endregion
651
+ //#region package/src/breakpoints.ts
652
+ /**
653
+ * The widths in CSS pixels where a layout changes, the same as the --breakpoint-medium and --breakpoint-wide tokens.
654
+ * Custom properties cannot drive a media or a container query, so a layout reads these numbers instead: narrow below
655
+ * medium, medium from medium to below wide, wide from wide up.
656
+ */
657
+ var breakpoints = {
658
+ medium: 720,
659
+ wide: 1200
660
+ };
661
+ //#endregion
662
+ export { AppHeader, Badge, Banner, Button, Card, ChangeBar, Checkbox, CollapsibleRow, Figure, FilterChip, Icon, IconButton, Link, LiveIndicator, PillButton, ProgressBar, Prose, Radio, ScrollArea, SegmentedControl, StatusBadge, StatusDot, Tabs, TextArea, TextField, TruncatedPath, VisuallyHidden, breakpoints, iconArrowLeft, iconArrowRight, iconCheck, iconChevronDown, iconChevronRight, iconCircleAlert, iconCircleCheck, iconClock, iconCopy, iconDiagram, iconExternalLink, iconHistory, iconInfo, iconLoader, iconMessage, iconNotepad, iconPencil, iconPlus, iconRefresh, iconSearch, iconSend, iconTriangleAlert, iconX };
@@ -0,0 +1,2 @@
1
+ /** Joins the class names that are set. */
2
+ export declare function cx(...names: readonly (string | false | undefined)[]): string;
@@ -0,0 +1,2 @@
1
+ /** The tones a badge, a status badge, a filter chip or a pill button takes: each names a background and the text drawn on it. */
2
+ export type Tone = "neutral" | "info" | "accent" | "queued" | "waiting" | "success" | "danger";