@ceebee/ui 0.6.0 → 1.0.1
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/THIRD_PARTY_NOTICES.md +28 -0
- package/dist/client.d.ts +27 -1394
- package/dist/client.js +309 -4301
- package/dist/index.d.ts +10 -585
- package/dist/index.js +22 -860
- package/dist/skins/astra.css +1 -1
- package/dist/styles.css +691 -4180
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
2
|
-
import { Children, isValidElement, Fragment, cloneElement } from 'react';
|
|
3
|
-
import { XCircle, AlertTriangle, CheckCircle2, Info, ChevronRight, Check } from 'lucide-react';
|
|
4
|
-
import { encode } from 'uqr';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
2
|
|
|
6
3
|
// src/lib/cn.ts
|
|
7
4
|
function cn(...parts) {
|
|
@@ -95,154 +92,18 @@ function Heading({ level = 2, size, className, children }) {
|
|
|
95
92
|
const resolved = size ?? ["3xl", "2xl", "xl", "lg"][level - 1] ?? "lg";
|
|
96
93
|
return /* @__PURE__ */ jsx(Tag, { className: cn("cb-heading", `cb-text--${resolved}`, className), children });
|
|
97
94
|
}
|
|
98
|
-
function box({ width = "100%", height = "1rem", radius = "md", className }) {
|
|
99
|
-
const style = { "--cb-skeleton-w": width, "--cb-skeleton-h": height };
|
|
100
|
-
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("cb-skeleton", `cb-radius--${radius}`, className), style });
|
|
101
|
-
}
|
|
102
|
-
function text({ lines = 3, lastLineWidth = "62%", className }) {
|
|
103
|
-
return /* @__PURE__ */ jsx("span", { className: cn("cb-skeleton-text", className), children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx(SkeletonBox, { height: "0.75rem", width: i === lines - 1 ? lastLineWidth : "100%" }, i)) });
|
|
104
|
-
}
|
|
105
|
-
function circle({ size = "2.5rem", className }) {
|
|
106
|
-
return /* @__PURE__ */ jsx(SkeletonBox, { width: size, height: size, radius: "full", className });
|
|
107
|
-
}
|
|
108
|
-
var SkeletonBox = box;
|
|
109
|
-
var Skeleton = Object.assign(box, {
|
|
110
|
-
Text: text,
|
|
111
|
-
Circle: circle,
|
|
112
|
-
Rect: box
|
|
113
|
-
});
|
|
114
|
-
var sizeSteps = {
|
|
115
|
-
small: 2,
|
|
116
|
-
middle: 3,
|
|
117
|
-
large: 4
|
|
118
|
-
};
|
|
119
|
-
function stepFor(size) {
|
|
120
|
-
return typeof size === "number" ? size : sizeSteps[size];
|
|
121
|
-
}
|
|
122
|
-
function SpaceSkeleton({ items = 3, direction = "horizontal", size = "small", wrap = false, className }) {
|
|
123
|
-
const style = { "--cb-space-gap": `var(--cb-space-${stepFor(size)})` };
|
|
124
|
-
return /* @__PURE__ */ jsx(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
className: cn(
|
|
128
|
-
"cb-space",
|
|
129
|
-
"cb-space--skeleton",
|
|
130
|
-
`cb-space--${direction}`,
|
|
131
|
-
"cb-space--align-center",
|
|
132
|
-
wrap && "cb-space--wrap",
|
|
133
|
-
className
|
|
134
|
-
),
|
|
135
|
-
style,
|
|
136
|
-
"aria-hidden": "true",
|
|
137
|
-
children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsx("span", { className: "cb-space__item", children: /* @__PURE__ */ jsx(Skeleton, { className: "cb-space__skeleton-item" }) }, index))
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
var sizeSteps2 = {
|
|
142
|
-
small: 2,
|
|
143
|
-
middle: 3,
|
|
144
|
-
large: 4
|
|
145
|
-
};
|
|
146
|
-
function stepFor2(size) {
|
|
147
|
-
return typeof size === "number" ? size : sizeSteps2[size];
|
|
148
|
-
}
|
|
149
|
-
function normalizeChildren(children) {
|
|
150
|
-
return Children.toArray(children).flatMap(
|
|
151
|
-
(child) => isValidElement(child) && child.type === Fragment ? normalizeChildren(child.props.children) : [child]
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
function SpaceRoot({
|
|
155
|
-
direction = "horizontal",
|
|
156
|
-
size = "small",
|
|
157
|
-
align = "center",
|
|
158
|
-
wrap = false,
|
|
159
|
-
split,
|
|
160
|
-
className,
|
|
161
|
-
children
|
|
162
|
-
}) {
|
|
163
|
-
const style = { "--cb-space-gap": `var(--cb-space-${stepFor2(size)})` };
|
|
164
|
-
const items = normalizeChildren(children);
|
|
165
|
-
const renderedItems = items.map((child, index) => /* @__PURE__ */ jsx("span", { className: "cb-space__item", children: child }, `item-${index}`));
|
|
166
|
-
return /* @__PURE__ */ jsx(
|
|
167
|
-
"div",
|
|
168
|
-
{
|
|
169
|
-
className: cn(
|
|
170
|
-
"cb-space",
|
|
171
|
-
`cb-space--${direction}`,
|
|
172
|
-
`cb-space--align-${align}`,
|
|
173
|
-
wrap && "cb-space--wrap",
|
|
174
|
-
className
|
|
175
|
-
),
|
|
176
|
-
style,
|
|
177
|
-
children: renderedItems.flatMap(
|
|
178
|
-
(item, index) => split != null && index < items.length - 1 ? [item, /* @__PURE__ */ jsx("span", { className: "cb-space__split", "aria-hidden": "true", children: split }, `split-${index}`)] : [item]
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
function SpaceCompact({ direction = "horizontal", className, children }) {
|
|
184
|
-
return /* @__PURE__ */ jsx("div", { className: cn("cb-space-compact", `cb-space-compact--${direction}`, className), children });
|
|
185
|
-
}
|
|
186
|
-
var Space = Object.assign(SpaceRoot, {
|
|
187
|
-
Compact: SpaceCompact,
|
|
188
|
-
Skeleton: SpaceSkeleton
|
|
189
|
-
});
|
|
190
|
-
function MasonrySkeleton({ items = 6, columns = 3, gap = 4, className }) {
|
|
191
|
-
const style = {
|
|
192
|
-
"--cb-masonry-columns": String(columns),
|
|
193
|
-
"--cb-masonry-gap": `var(--cb-space-${gap})`
|
|
194
|
-
};
|
|
195
|
-
return /* @__PURE__ */ jsx(
|
|
196
|
-
"div",
|
|
197
|
-
{
|
|
198
|
-
className: cn("cb-masonry", "cb-masonry--skeleton", className),
|
|
199
|
-
style,
|
|
200
|
-
"data-columns": columns,
|
|
201
|
-
"data-gap": gap,
|
|
202
|
-
"aria-hidden": "true",
|
|
203
|
-
children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsx("div", { className: "cb-masonry__item", children: /* @__PURE__ */ jsx(Skeleton, { className: cn("cb-masonry__skeleton-item", `cb-masonry__skeleton-item--${index % 3}`) }) }, index))
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
function normalizeChildren2(children) {
|
|
208
|
-
return Children.toArray(children).flatMap(
|
|
209
|
-
(child) => isValidElement(child) && child.type === Fragment ? normalizeChildren2(child.props.children) : [child]
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
function MasonryRoot({ columns = 3, gap = 4, className, children }) {
|
|
213
|
-
const style = {
|
|
214
|
-
"--cb-masonry-columns": String(columns),
|
|
215
|
-
"--cb-masonry-gap": `var(--cb-space-${gap})`
|
|
216
|
-
};
|
|
217
|
-
const items = normalizeChildren2(children);
|
|
218
|
-
return /* @__PURE__ */ jsx(
|
|
219
|
-
"div",
|
|
220
|
-
{
|
|
221
|
-
className: cn("cb-masonry", className),
|
|
222
|
-
style,
|
|
223
|
-
"data-columns": columns,
|
|
224
|
-
"data-gap": gap,
|
|
225
|
-
children: items.map((child, index) => /* @__PURE__ */ jsx("div", { className: "cb-masonry__item", children: child }, `item-${index}`))
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
var Masonry = Object.assign(MasonryRoot, { Skeleton: MasonrySkeleton });
|
|
230
|
-
function Affix({ edge = "top", offset = "md", children }) {
|
|
231
|
-
const style = { "--cb-affix-offset": `var(--cb-space-${offset === "sm" ? 2 : offset === "md" ? 4 : 6})` };
|
|
232
|
-
return /* @__PURE__ */ jsx("div", { className: cn("cb-affix", `cb-affix--${edge}`, `cb-affix--offset-${offset}`), style, "data-edge": edge, "data-offset": offset, children });
|
|
233
|
-
}
|
|
234
95
|
function PageContainerSkeleton({ breadcrumb = true, subtitle = true, extra = true, tabs = false, lines = 4, containerSize = "lg" }) {
|
|
235
96
|
return /* @__PURE__ */ jsx(Container, { size: containerSize, children: /* @__PURE__ */ jsxs("section", { className: "cb-page-container cb-page-container--skeleton", "aria-hidden": "true", children: [
|
|
236
|
-
breadcrumb ? /* @__PURE__ */ jsx(
|
|
97
|
+
breadcrumb ? /* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-breadcrumb" }) : null,
|
|
237
98
|
/* @__PURE__ */ jsxs("header", { className: "cb-page-container__header", children: [
|
|
238
99
|
/* @__PURE__ */ jsxs("div", { className: "cb-page-container__heading", children: [
|
|
239
|
-
/* @__PURE__ */ jsx(
|
|
240
|
-
subtitle ? /* @__PURE__ */ jsx(
|
|
100
|
+
/* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-title" }),
|
|
101
|
+
subtitle ? /* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-subtitle" }) : null
|
|
241
102
|
] }),
|
|
242
|
-
extra ? /* @__PURE__ */ jsx(
|
|
103
|
+
extra ? /* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-extra" }) : null
|
|
243
104
|
] }),
|
|
244
|
-
tabs ? /* @__PURE__ */ jsx(
|
|
245
|
-
/* @__PURE__ */ jsx(
|
|
105
|
+
tabs ? /* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-tabs" }) : null,
|
|
106
|
+
Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx("span", { className: "cb-page-container__skeleton-line" }, index))
|
|
246
107
|
] }) });
|
|
247
108
|
}
|
|
248
109
|
function PageContainerRoot({ breadcrumb, title, subtitle, extra, tabs, children, containerSize = "lg" }) {
|
|
@@ -261,379 +122,6 @@ function PageContainerRoot({ breadcrumb, title, subtitle, extra, tabs, children,
|
|
|
261
122
|
] }) });
|
|
262
123
|
}
|
|
263
124
|
var PageContainer = Object.assign(PageContainerRoot, { Skeleton: PageContainerSkeleton });
|
|
264
|
-
function LinkButton({
|
|
265
|
-
variant = "solid",
|
|
266
|
-
tone = "brand",
|
|
267
|
-
size = "md",
|
|
268
|
-
iconStart,
|
|
269
|
-
iconEnd,
|
|
270
|
-
className,
|
|
271
|
-
children,
|
|
272
|
-
render,
|
|
273
|
-
...rest
|
|
274
|
-
}) {
|
|
275
|
-
const iconOnly = children === void 0 || children === null || children === false || children === "";
|
|
276
|
-
const classes = cn(
|
|
277
|
-
"cb-button",
|
|
278
|
-
"cb-link-button",
|
|
279
|
-
`cb-button--${variant}`,
|
|
280
|
-
`cb-button--${size}`,
|
|
281
|
-
iconOnly && "cb-button--icon",
|
|
282
|
-
className
|
|
283
|
-
);
|
|
284
|
-
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
285
|
-
iconStart,
|
|
286
|
-
iconOnly ? null : /* @__PURE__ */ jsx("span", { className: "cb-button__label", children }),
|
|
287
|
-
iconOnly ? null : iconEnd
|
|
288
|
-
] });
|
|
289
|
-
if (render && isValidElement(render)) {
|
|
290
|
-
return cloneElement(render, {
|
|
291
|
-
className: cn(classes, render.props.className),
|
|
292
|
-
"data-tone": tone,
|
|
293
|
-
...rest,
|
|
294
|
-
children: body
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
return /* @__PURE__ */ jsx(
|
|
298
|
-
"a",
|
|
299
|
-
{
|
|
300
|
-
className: cn(
|
|
301
|
-
"cb-button",
|
|
302
|
-
"cb-link-button",
|
|
303
|
-
`cb-button--${variant}`,
|
|
304
|
-
`cb-button--${size}`,
|
|
305
|
-
iconOnly && "cb-button--icon",
|
|
306
|
-
className
|
|
307
|
-
),
|
|
308
|
-
"data-tone": tone,
|
|
309
|
-
...rest,
|
|
310
|
-
children: body
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
function AnchorSkeleton({
|
|
315
|
-
items = 4,
|
|
316
|
-
orientation = "vertical",
|
|
317
|
-
size = "md",
|
|
318
|
-
tone = "brand",
|
|
319
|
-
"aria-label": ariaLabel = "Loading on this page navigation"
|
|
320
|
-
}) {
|
|
321
|
-
return /* @__PURE__ */ jsx(
|
|
322
|
-
"nav",
|
|
323
|
-
{
|
|
324
|
-
"aria-label": ariaLabel,
|
|
325
|
-
"aria-hidden": "true",
|
|
326
|
-
className: cn("cb-anchor", `cb-anchor--${orientation}`, `cb-anchor--${size}`, `cb-anchor--${tone}`, "cb-anchor--skeleton"),
|
|
327
|
-
children: /* @__PURE__ */ jsx("ul", { className: "cb-anchor__list", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsx("li", { className: "cb-anchor__item", children: /* @__PURE__ */ jsx(Skeleton, { className: cn("cb-anchor__skeleton-link", index % 3 === 0 && "cb-anchor__skeleton-link--long") }) }, index)) })
|
|
328
|
-
}
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
function AnchorRoot({
|
|
332
|
-
items,
|
|
333
|
-
activeId,
|
|
334
|
-
orientation = "vertical",
|
|
335
|
-
size = "md",
|
|
336
|
-
tone = "brand",
|
|
337
|
-
motion = true,
|
|
338
|
-
"aria-label": ariaLabel = "On this page"
|
|
339
|
-
}) {
|
|
340
|
-
return /* @__PURE__ */ jsx(
|
|
341
|
-
"nav",
|
|
342
|
-
{
|
|
343
|
-
"aria-label": ariaLabel,
|
|
344
|
-
className: cn(
|
|
345
|
-
"cb-anchor",
|
|
346
|
-
`cb-anchor--${orientation}`,
|
|
347
|
-
`cb-anchor--${size}`,
|
|
348
|
-
`cb-anchor--${tone}`,
|
|
349
|
-
!motion && "cb-anchor--motion-off"
|
|
350
|
-
),
|
|
351
|
-
children: /* @__PURE__ */ jsx(AnchorList, { items, activeId })
|
|
352
|
-
}
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
function AnchorList({ items, activeId, nested = false }) {
|
|
356
|
-
return /* @__PURE__ */ jsx("ul", { className: cn("cb-anchor__list", nested && "cb-anchor__list--nested"), children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: "cb-anchor__item", children: [
|
|
357
|
-
/* @__PURE__ */ jsx("a", { className: "cb-anchor__link", href: item.href, "aria-current": activeId === item.id ? "location" : void 0, children: item.label }),
|
|
358
|
-
item.children?.length ? /* @__PURE__ */ jsx(AnchorList, { items: item.children, activeId, nested: true }) : null
|
|
359
|
-
] }, item.id)) });
|
|
360
|
-
}
|
|
361
|
-
var Anchor = Object.assign(AnchorRoot, { Skeleton: AnchorSkeleton });
|
|
362
|
-
function Divider({ children, orientation = "horizontal", className }) {
|
|
363
|
-
if (orientation === "vertical") {
|
|
364
|
-
return /* @__PURE__ */ jsx("span", { className: cn("cb-divider", "cb-divider--vertical", className), role: "separator", "aria-orientation": "vertical" });
|
|
365
|
-
}
|
|
366
|
-
if (children) {
|
|
367
|
-
return /* @__PURE__ */ jsx("div", { className: cn("cb-divider", "cb-divider--labelled", className), role: "separator", children: /* @__PURE__ */ jsx("span", { className: "cb-divider__label", children }) });
|
|
368
|
-
}
|
|
369
|
-
return /* @__PURE__ */ jsx("hr", { className: cn("cb-divider", className) });
|
|
370
|
-
}
|
|
371
|
-
function Badge({ children, tone = "neutral", variant = "soft", size = "md", dot, className }) {
|
|
372
|
-
return /* @__PURE__ */ jsxs("span", { className: cn("cb-badge", `cb-badge--${variant}`, `cb-badge--${size}`, className), "data-tone": tone, children: [
|
|
373
|
-
dot ? /* @__PURE__ */ jsx("span", { className: "cb-badge__dot", "aria-hidden": "true" }) : null,
|
|
374
|
-
children
|
|
375
|
-
] });
|
|
376
|
-
}
|
|
377
|
-
function Empty({ title, description, icon, actions, variant = "first-run", className }) {
|
|
378
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("cb-empty", className), "data-variant": variant, children: [
|
|
379
|
-
icon ? /* @__PURE__ */ jsx("span", { className: "cb-empty__icon", children: icon }) : null,
|
|
380
|
-
/* @__PURE__ */ jsx("p", { className: "cb-empty__title", children: title }),
|
|
381
|
-
description ? /* @__PURE__ */ jsx("p", { className: "cb-empty__description", children: description }) : null,
|
|
382
|
-
actions ? /* @__PURE__ */ jsx("div", { className: "cb-empty__actions", children: actions }) : null
|
|
383
|
-
] });
|
|
384
|
-
}
|
|
385
|
-
function ResultSkeleton() {
|
|
386
|
-
return /* @__PURE__ */ jsxs("section", { className: "cb-result cb-result--skeleton", "aria-hidden": "true", children: [
|
|
387
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-result__skeleton-icon" }),
|
|
388
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-result__skeleton-title" }),
|
|
389
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-result__skeleton-description" }),
|
|
390
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-result__skeleton-extra", children: [
|
|
391
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-result__skeleton-action" }),
|
|
392
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-result__skeleton-action" })
|
|
393
|
-
] })
|
|
394
|
-
] });
|
|
395
|
-
}
|
|
396
|
-
var STATUS_TONES = {
|
|
397
|
-
success: "success",
|
|
398
|
-
info: "info",
|
|
399
|
-
warning: "warning",
|
|
400
|
-
error: "danger",
|
|
401
|
-
"404": "neutral",
|
|
402
|
-
"403": "warning",
|
|
403
|
-
"500": "danger"
|
|
404
|
-
};
|
|
405
|
-
var STATUS_MARKS = {
|
|
406
|
-
success: "\u2713",
|
|
407
|
-
info: "i",
|
|
408
|
-
warning: "!",
|
|
409
|
-
error: "\xD7",
|
|
410
|
-
"404": "?",
|
|
411
|
-
"403": "!",
|
|
412
|
-
"500": "\xD7"
|
|
413
|
-
};
|
|
414
|
-
function ResultRoot({ title, description, status = "info", icon, extra, children }) {
|
|
415
|
-
const tone = STATUS_TONES[status];
|
|
416
|
-
return /* @__PURE__ */ jsxs("section", { className: "cb-result", "data-status": status, "data-tone": tone, children: [
|
|
417
|
-
/* @__PURE__ */ jsx("div", { className: "cb-result__icon", "aria-hidden": "true", children: icon ?? /* @__PURE__ */ jsx("span", { className: "cb-result__mark", children: STATUS_MARKS[status] }) }),
|
|
418
|
-
/* @__PURE__ */ jsx("div", { className: "cb-result__title", children: title }),
|
|
419
|
-
description ? /* @__PURE__ */ jsx("div", { className: "cb-result__description", children: description }) : null,
|
|
420
|
-
extra ? /* @__PURE__ */ jsx("div", { className: "cb-result__extra", children: extra }) : null,
|
|
421
|
-
children ? /* @__PURE__ */ jsx("div", { className: "cb-result__content", children }) : null
|
|
422
|
-
] });
|
|
423
|
-
}
|
|
424
|
-
var Result = Object.assign(ResultRoot, { Skeleton: ResultSkeleton });
|
|
425
|
-
function NotificationSkeleton({ lines = 2, withActions = false }) {
|
|
426
|
-
const safeLines = Number.isFinite(lines) ? Math.max(0, Math.floor(lines)) : 2;
|
|
427
|
-
return /* @__PURE__ */ jsxs("section", { className: "cb-notification cb-notification--skeleton", "aria-hidden": "true", children: [
|
|
428
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-notification__skeleton-icon" }),
|
|
429
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-notification__content", children: [
|
|
430
|
-
/* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-notification__skeleton-title" }),
|
|
431
|
-
Array.from({ length: safeLines }, (_, index) => /* @__PURE__ */ jsx(
|
|
432
|
-
"span",
|
|
433
|
-
{
|
|
434
|
-
className: "cb-skeleton cb-notification__skeleton-line",
|
|
435
|
-
"data-last": index === safeLines - 1 || void 0
|
|
436
|
-
},
|
|
437
|
-
index
|
|
438
|
-
)),
|
|
439
|
-
withActions ? /* @__PURE__ */ jsx("div", { className: "cb-notification__actions", children: /* @__PURE__ */ jsx("span", { className: "cb-skeleton cb-notification__skeleton-action" }) }) : null
|
|
440
|
-
] })
|
|
441
|
-
] });
|
|
442
|
-
}
|
|
443
|
-
var ICONS = {
|
|
444
|
-
neutral: /* @__PURE__ */ jsx(Info, { size: 20 }),
|
|
445
|
-
info: /* @__PURE__ */ jsx(Info, { size: 20 }),
|
|
446
|
-
success: /* @__PURE__ */ jsx(CheckCircle2, { size: 20 }),
|
|
447
|
-
warning: /* @__PURE__ */ jsx(AlertTriangle, { size: 20 }),
|
|
448
|
-
danger: /* @__PURE__ */ jsx(XCircle, { size: 20 })
|
|
449
|
-
};
|
|
450
|
-
function NotificationRoot({
|
|
451
|
-
title,
|
|
452
|
-
description,
|
|
453
|
-
icon,
|
|
454
|
-
actions,
|
|
455
|
-
tone = "info",
|
|
456
|
-
announce = true
|
|
457
|
-
}) {
|
|
458
|
-
const liveProps = announce ? { role: tone === "danger" ? "alert" : "status" } : {};
|
|
459
|
-
return /* @__PURE__ */ jsxs("section", { className: "cb-notification", "data-tone": tone, ...liveProps, children: [
|
|
460
|
-
icon === null ? null : /* @__PURE__ */ jsx("span", { className: "cb-notification__icon", "aria-hidden": "true", children: icon ?? ICONS[tone] }),
|
|
461
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-notification__content", children: [
|
|
462
|
-
/* @__PURE__ */ jsx("div", { className: "cb-notification__title", children: title }),
|
|
463
|
-
description ? /* @__PURE__ */ jsx("div", { className: "cb-notification__description", children: description }) : null,
|
|
464
|
-
actions ? /* @__PURE__ */ jsx("div", { className: "cb-notification__actions", children: actions }) : null
|
|
465
|
-
] })
|
|
466
|
-
] });
|
|
467
|
-
}
|
|
468
|
-
var Notification = Object.assign(NotificationRoot, {
|
|
469
|
-
Skeleton: NotificationSkeleton
|
|
470
|
-
});
|
|
471
|
-
function QRCode({
|
|
472
|
-
value,
|
|
473
|
-
label,
|
|
474
|
-
size = "md",
|
|
475
|
-
errorCorrection = "M",
|
|
476
|
-
boostErrorCorrection = true
|
|
477
|
-
}) {
|
|
478
|
-
if (value.length === 0) throw new RangeError("QRCode value must not be empty.");
|
|
479
|
-
if (label.trim().length === 0) throw new RangeError("QRCode label must not be empty.");
|
|
480
|
-
const matrix = encode(value, {
|
|
481
|
-
ecc: errorCorrection,
|
|
482
|
-
boostEcc: boostErrorCorrection,
|
|
483
|
-
// Four light modules are the ISO quiet-zone recommendation. This is encoding geometry,
|
|
484
|
-
// not visual spacing, so it intentionally does not use a CSS Token.
|
|
485
|
-
border: 4
|
|
486
|
-
});
|
|
487
|
-
return /* @__PURE__ */ jsxs(
|
|
488
|
-
"svg",
|
|
489
|
-
{
|
|
490
|
-
className: `cb-qr-code cb-qr-code--${size}`,
|
|
491
|
-
viewBox: `0 0 ${matrix.size} ${matrix.size}`,
|
|
492
|
-
role: "img",
|
|
493
|
-
"aria-label": label,
|
|
494
|
-
shapeRendering: "crispEdges",
|
|
495
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
496
|
-
children: [
|
|
497
|
-
/* @__PURE__ */ jsx("rect", { className: "cb-qr-code__background", width: matrix.size, height: matrix.size }),
|
|
498
|
-
/* @__PURE__ */ jsx("path", { className: "cb-qr-code__modules", d: matrixPath(matrix.data) })
|
|
499
|
-
]
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
function matrixPath(data) {
|
|
504
|
-
const commands = [];
|
|
505
|
-
for (let row = 0; row < data.length; row += 1) {
|
|
506
|
-
for (let column = 0; column < data[row].length; column += 1) {
|
|
507
|
-
if (data[row][column]) commands.push(`M${column} ${row}h1v1h-1z`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
return commands.join("");
|
|
511
|
-
}
|
|
512
|
-
function Spin({ size = "md", tone = "brand", label, className }) {
|
|
513
|
-
return /* @__PURE__ */ jsx(
|
|
514
|
-
"span",
|
|
515
|
-
{
|
|
516
|
-
className: cn("cb-spin", `cb-spin--${size}`, className),
|
|
517
|
-
"data-tone": tone,
|
|
518
|
-
role: label ? "status" : void 0,
|
|
519
|
-
"aria-label": label,
|
|
520
|
-
"aria-hidden": label ? void 0 : true
|
|
521
|
-
}
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
function ProgressBar({ value, max = 100, tone = "brand", size = "md", label, showValue, className }) {
|
|
525
|
-
const indeterminate = value === void 0;
|
|
526
|
-
const clamped = indeterminate ? 0 : Math.min(Math.max(value, 0), max);
|
|
527
|
-
const percent = max > 0 ? Math.round(clamped / max * 100) : 0;
|
|
528
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("cb-progress", className), "data-tone": tone, "data-size": size, children: [
|
|
529
|
-
/* @__PURE__ */ jsx(
|
|
530
|
-
"div",
|
|
531
|
-
{
|
|
532
|
-
className: "cb-progress__track",
|
|
533
|
-
role: "progressbar",
|
|
534
|
-
"aria-label": label,
|
|
535
|
-
"aria-valuemin": indeterminate ? void 0 : 0,
|
|
536
|
-
"aria-valuemax": indeterminate ? void 0 : max,
|
|
537
|
-
"aria-valuenow": indeterminate ? void 0 : clamped,
|
|
538
|
-
children: /* @__PURE__ */ jsx(
|
|
539
|
-
"div",
|
|
540
|
-
{
|
|
541
|
-
className: "cb-progress__fill",
|
|
542
|
-
"data-indeterminate": indeterminate || void 0,
|
|
543
|
-
style: indeterminate ? void 0 : { width: `${percent}%` }
|
|
544
|
-
}
|
|
545
|
-
)
|
|
546
|
-
}
|
|
547
|
-
),
|
|
548
|
-
showValue && !indeterminate ? /* @__PURE__ */ jsxs("span", { className: "cb-progress__value", children: [
|
|
549
|
-
percent,
|
|
550
|
-
"%"
|
|
551
|
-
] }) : null
|
|
552
|
-
] });
|
|
553
|
-
}
|
|
554
|
-
function TimelineRoot({ entries, className }) {
|
|
555
|
-
return /* @__PURE__ */ jsx("ol", { className: cn("cb-timeline", className), children: entries.map((entry, index) => /* @__PURE__ */ jsxs("li", { className: "cb-timeline__entry", "data-tone": entry.tone ?? "neutral", children: [
|
|
556
|
-
/* @__PURE__ */ jsx("span", { className: "cb-timeline__rail", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "cb-timeline__marker", children: entry.icon }) }),
|
|
557
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-timeline__body", children: [
|
|
558
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-timeline__head", children: [
|
|
559
|
-
/* @__PURE__ */ jsx("p", { className: "cb-timeline__title", children: entry.title }),
|
|
560
|
-
/* @__PURE__ */ jsx("span", { className: "cb-timeline__time", children: entry.time })
|
|
561
|
-
] }),
|
|
562
|
-
entry.description ? /* @__PURE__ */ jsx("p", { className: "cb-timeline__description", children: entry.description }) : null
|
|
563
|
-
] })
|
|
564
|
-
] }, index)) });
|
|
565
|
-
}
|
|
566
|
-
function TimelineSkeleton({ entries = 3, className }) {
|
|
567
|
-
return /* @__PURE__ */ jsx("div", { className: cn("cb-timeline", className), "aria-hidden": "true", children: Array.from({ length: entries }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "cb-timeline__entry", children: [
|
|
568
|
-
/* @__PURE__ */ jsx("span", { className: "cb-timeline__rail", children: /* @__PURE__ */ jsx(Skeleton.Circle, { size: "1.5rem" }) }),
|
|
569
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-timeline__body", children: [
|
|
570
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "45%", height: "0.875rem" }),
|
|
571
|
-
/* @__PURE__ */ jsx("div", { style: { marginTop: "var(--cb-space-2)" }, children: /* @__PURE__ */ jsx(Skeleton, { width: "70%", height: "0.75rem" }) })
|
|
572
|
-
] })
|
|
573
|
-
] }, index)) });
|
|
574
|
-
}
|
|
575
|
-
var Timeline = Object.assign(TimelineRoot, { Skeleton: TimelineSkeleton });
|
|
576
|
-
|
|
577
|
-
// src/data/progress-ring.math.ts
|
|
578
|
-
function ringGeometry(value, max, size, thickness) {
|
|
579
|
-
const safeMax = max > 0 ? max : 1;
|
|
580
|
-
const clamped = Math.min(Math.max(Number.isFinite(value) ? value : 0, 0), safeMax);
|
|
581
|
-
const radius = (size - thickness) / 2;
|
|
582
|
-
const circumference = 2 * Math.PI * radius;
|
|
583
|
-
const dashOffset = circumference * (1 - clamped / safeMax);
|
|
584
|
-
return { radius, circumference, dashOffset, clamped };
|
|
585
|
-
}
|
|
586
|
-
function ProgressRing({
|
|
587
|
-
value,
|
|
588
|
-
max = 100,
|
|
589
|
-
size = 96,
|
|
590
|
-
thickness = 10,
|
|
591
|
-
tone = "brand",
|
|
592
|
-
hue,
|
|
593
|
-
children,
|
|
594
|
-
label,
|
|
595
|
-
className
|
|
596
|
-
}) {
|
|
597
|
-
const { radius, circumference, dashOffset, clamped } = ringGeometry(value, max, size, thickness);
|
|
598
|
-
const center = size / 2;
|
|
599
|
-
const style = {
|
|
600
|
-
"--cb-ring-size": `${size}px`,
|
|
601
|
-
"--cb-ring-circumference": `${circumference}`,
|
|
602
|
-
"--cb-ring-offset": `${dashOffset}`
|
|
603
|
-
};
|
|
604
|
-
return /* @__PURE__ */ jsxs(
|
|
605
|
-
"div",
|
|
606
|
-
{
|
|
607
|
-
className: cn("cb-ring", className),
|
|
608
|
-
style,
|
|
609
|
-
"data-tone": tone,
|
|
610
|
-
"data-hue": hue,
|
|
611
|
-
role: "img",
|
|
612
|
-
"aria-label": `${label}: ${Math.round(clamped / (max || 1) * 100)}%`,
|
|
613
|
-
children: [
|
|
614
|
-
/* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, "aria-hidden": "true", children: [
|
|
615
|
-
/* @__PURE__ */ jsx("circle", { className: "cb-ring__track", cx: center, cy: center, r: radius, strokeWidth: thickness, fill: "none" }),
|
|
616
|
-
/* @__PURE__ */ jsx(
|
|
617
|
-
"circle",
|
|
618
|
-
{
|
|
619
|
-
className: "cb-ring__value",
|
|
620
|
-
cx: center,
|
|
621
|
-
cy: center,
|
|
622
|
-
r: radius,
|
|
623
|
-
strokeWidth: thickness,
|
|
624
|
-
fill: "none",
|
|
625
|
-
strokeLinecap: "round",
|
|
626
|
-
strokeDasharray: circumference,
|
|
627
|
-
strokeDashoffset: dashOffset,
|
|
628
|
-
transform: `rotate(-90 ${center} ${center})`
|
|
629
|
-
}
|
|
630
|
-
)
|
|
631
|
-
] }),
|
|
632
|
-
/* @__PURE__ */ jsx("div", { className: "cb-ring__center", children: children ?? `${Math.round(clamped / (max || 1) * 100)}%` })
|
|
633
|
-
]
|
|
634
|
-
}
|
|
635
|
-
);
|
|
636
|
-
}
|
|
637
125
|
|
|
638
126
|
// src/data/donut.math.ts
|
|
639
127
|
function donutArcs(slices, circumference) {
|
|
@@ -740,8 +228,6 @@ function BarMini({ values, width = 120, height = 32, tone = "brand", hue, label,
|
|
|
740
228
|
);
|
|
741
229
|
}) }) });
|
|
742
230
|
}
|
|
743
|
-
|
|
744
|
-
// src/media/avatar.util.ts
|
|
745
231
|
var HUES = ["violet", "blue", "teal", "green", "amber", "rose"];
|
|
746
232
|
function initialsOf(name) {
|
|
747
233
|
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -755,31 +241,6 @@ function hueForName(name) {
|
|
|
755
241
|
for (let i = 0; i < name.length; i += 1) hash = hash * 31 + name.charCodeAt(i) >>> 0;
|
|
756
242
|
return HUES[hash % HUES.length];
|
|
757
243
|
}
|
|
758
|
-
function Avatar({ name, src, size = "md", hue, status, className }) {
|
|
759
|
-
return /* @__PURE__ */ jsxs(
|
|
760
|
-
"span",
|
|
761
|
-
{
|
|
762
|
-
className: cn("cb-avatar", `cb-avatar--${size}`, className),
|
|
763
|
-
"data-hue": hue ?? hueForName(name),
|
|
764
|
-
role: "img",
|
|
765
|
-
"aria-label": name,
|
|
766
|
-
children: [
|
|
767
|
-
/* @__PURE__ */ jsx("span", { className: "cb-avatar__initials", "aria-hidden": "true", children: initialsOf(name) }),
|
|
768
|
-
src ? /* @__PURE__ */ jsx("img", { className: "cb-avatar__image", src, alt: "", loading: "lazy" }) : null,
|
|
769
|
-
status ? /* @__PURE__ */ jsx("span", { className: "cb-avatar__status", "data-status": status, "aria-hidden": "true" }) : null
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
function AvatarGroup({ children, overflow, size = "md", className }) {
|
|
775
|
-
return /* @__PURE__ */ jsxs("span", { className: cn("cb-avatar-group", className), children: [
|
|
776
|
-
children,
|
|
777
|
-
overflow && overflow > 0 ? /* @__PURE__ */ jsx("span", { className: cn("cb-avatar", `cb-avatar--${size}`, "cb-avatar--overflow"), children: /* @__PURE__ */ jsxs("span", { className: "cb-avatar__initials", children: [
|
|
778
|
-
"+",
|
|
779
|
-
overflow
|
|
780
|
-
] }) }) : null
|
|
781
|
-
] });
|
|
782
|
-
}
|
|
783
244
|
function LeaderboardRoot({ entries, label, medals = true, className }) {
|
|
784
245
|
return /* @__PURE__ */ jsx("ol", { className: cn("cb-leaderboard", className), "aria-label": label, children: entries.map((entry, index) => {
|
|
785
246
|
const rank = index + 1;
|
|
@@ -791,7 +252,19 @@ function LeaderboardRoot({ entries, label, medals = true, className }) {
|
|
|
791
252
|
"data-you": entry.you || void 0,
|
|
792
253
|
children: [
|
|
793
254
|
/* @__PURE__ */ jsx("span", { className: "cb-leaderboard__rank", "aria-hidden": "true", children: rank }),
|
|
794
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ jsxs(
|
|
256
|
+
"span",
|
|
257
|
+
{
|
|
258
|
+
className: "cb-leaderboard__avatar",
|
|
259
|
+
"data-hue": entry.hue ?? hueForName(entry.name),
|
|
260
|
+
role: "img",
|
|
261
|
+
"aria-label": entry.name,
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsx("span", { className: "cb-leaderboard__initials", "aria-hidden": "true", children: initialsOf(entry.name) }),
|
|
264
|
+
entry.avatarSrc ? /* @__PURE__ */ jsx("img", { className: "cb-leaderboard__photo", src: entry.avatarSrc, alt: "", loading: "lazy" }) : null
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
),
|
|
795
268
|
/* @__PURE__ */ jsxs("span", { className: "cb-leaderboard__text", children: [
|
|
796
269
|
/* @__PURE__ */ jsxs("span", { className: "cb-leaderboard__name", children: [
|
|
797
270
|
entry.name,
|
|
@@ -807,317 +280,6 @@ function LeaderboardRoot({ entries, label, medals = true, className }) {
|
|
|
807
280
|
);
|
|
808
281
|
}) });
|
|
809
282
|
}
|
|
810
|
-
|
|
811
|
-
return /* @__PURE__ */ jsx("div", { className: cn("cb-leaderboard", className), "aria-hidden": "true", children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "cb-leaderboard__row", children: [
|
|
812
|
-
/* @__PURE__ */ jsx("span", { className: "cb-leaderboard__rank", children: /* @__PURE__ */ jsx(Skeleton, { width: "0.75rem", height: "0.75rem" }) }),
|
|
813
|
-
/* @__PURE__ */ jsx(Skeleton.Circle, { size: "1.75rem" }),
|
|
814
|
-
/* @__PURE__ */ jsx("span", { className: "cb-leaderboard__text", children: /* @__PURE__ */ jsx(Skeleton, { width: "7rem", height: "0.875rem" }) }),
|
|
815
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "2.5rem", height: "0.875rem" })
|
|
816
|
-
] }, index)) });
|
|
817
|
-
}
|
|
818
|
-
var Leaderboard = Object.assign(LeaderboardRoot, { Skeleton: LeaderboardSkeleton });
|
|
819
|
-
function Breadcrumb({ items, maxItems = 4, className }) {
|
|
820
|
-
const collapsed = items.length > maxItems ? [items[0], { label: "\u2026" }, ...items.slice(items.length - (maxItems - 2))] : items;
|
|
821
|
-
return /* @__PURE__ */ jsx("nav", { className: cn("cb-crumbs", className), "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsx("ol", { className: "cb-crumbs__list", children: collapsed.map((crumb, index) => {
|
|
822
|
-
const isLast = index === collapsed.length - 1;
|
|
823
|
-
return /* @__PURE__ */ jsxs("li", { className: "cb-crumbs__item", children: [
|
|
824
|
-
isLast ? /* @__PURE__ */ jsx("span", { className: "cb-crumbs__current", "aria-current": "page", children: crumb.label }) : crumb.href ? /* @__PURE__ */ jsx("a", { className: "cb-crumbs__link", href: crumb.href, children: crumb.label }) : /* @__PURE__ */ jsx("span", { className: "cb-crumbs__text", children: crumb.label }),
|
|
825
|
-
isLast ? null : /* @__PURE__ */ jsx(ChevronRight, { size: 14, className: "cb-crumbs__separator", "aria-hidden": "true" })
|
|
826
|
-
] }, `${String(crumb.label)}-${index}`);
|
|
827
|
-
}) }) });
|
|
828
|
-
}
|
|
829
|
-
function Steps({ steps, current, orientation = "horizontal", className }) {
|
|
830
|
-
return /* @__PURE__ */ jsx("ol", { className: cn("cb-steps", `cb-steps--${orientation}`, className), children: steps.map((step, index) => {
|
|
831
|
-
const state = index < current ? "done" : index === current ? "current" : "todo";
|
|
832
|
-
return /* @__PURE__ */ jsxs("li", { className: "cb-steps__step", "data-state": state, children: [
|
|
833
|
-
/* @__PURE__ */ jsx("span", { className: "cb-steps__marker", "aria-hidden": "true", children: state === "done" ? /* @__PURE__ */ jsx(Check, { size: 13, strokeWidth: 3 }) : index + 1 }),
|
|
834
|
-
/* @__PURE__ */ jsxs("span", { className: "cb-steps__text", children: [
|
|
835
|
-
/* @__PURE__ */ jsxs("span", { className: "cb-steps__label", children: [
|
|
836
|
-
step.label,
|
|
837
|
-
/* @__PURE__ */ jsx("span", { className: "cb-visually-hidden", children: state === "done" ? " (completed)" : state === "current" ? " (current step)" : "" })
|
|
838
|
-
] }),
|
|
839
|
-
step.description ? /* @__PURE__ */ jsx("span", { className: "cb-steps__description", children: step.description }) : null
|
|
840
|
-
] })
|
|
841
|
-
] }, index);
|
|
842
|
-
}) });
|
|
843
|
-
}
|
|
844
|
-
function Statistic({ label, value, delta, caption, hue, icon, visual, className }) {
|
|
845
|
-
return /* @__PURE__ */ jsxs(Surface, { variant: "tinted", hue, radius: "lg", padding: "md", className: cn("cb-stat", className), children: [
|
|
846
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-stat__head", children: [
|
|
847
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", tone: "muted", weight: "medium", children: label }),
|
|
848
|
-
icon ? /* @__PURE__ */ jsx("span", { className: "cb-stat__icon", children: icon }) : null
|
|
849
|
-
] }),
|
|
850
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-stat__body", children: [
|
|
851
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
852
|
-
/* @__PURE__ */ jsx("p", { className: "cb-stat__value cb-numeric", children: value }),
|
|
853
|
-
delta ? /* @__PURE__ */ jsx("span", { className: "cb-stat__delta", "data-direction": delta.direction, children: delta.value }) : null,
|
|
854
|
-
caption ? /* @__PURE__ */ jsx(Text, { size: "xs", tone: "subtle", className: "cb-stat__caption", children: caption }) : null
|
|
855
|
-
] }),
|
|
856
|
-
visual ? /* @__PURE__ */ jsx("div", { className: "cb-stat__visual", children: visual }) : null
|
|
857
|
-
] })
|
|
858
|
-
] });
|
|
859
|
-
}
|
|
860
|
-
function StatCardSkeleton({ withVisual = false, className }) {
|
|
861
|
-
return /* @__PURE__ */ jsxs(Surface, { variant: "tinted", radius: "lg", padding: "md", className: cn("cb-stat", className), children: [
|
|
862
|
-
/* @__PURE__ */ jsx("div", { className: "cb-stat__head", children: /* @__PURE__ */ jsx(Skeleton, { width: "7rem", height: "0.875rem" }) }),
|
|
863
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-stat__body", children: [
|
|
864
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-stat__skeleton-col", children: [
|
|
865
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "5.5rem", height: "2rem" }),
|
|
866
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "3.5rem", height: "0.75rem" })
|
|
867
|
-
] }),
|
|
868
|
-
withVisual ? /* @__PURE__ */ jsx(Skeleton.Circle, { size: "4rem" }) : null
|
|
869
|
-
] })
|
|
870
|
-
] });
|
|
871
|
-
}
|
|
872
|
-
Statistic.Skeleton = StatCardSkeleton;
|
|
873
|
-
function CardSkeletonContent({ lines = 3, meta = false }) {
|
|
874
|
-
if (meta) {
|
|
875
|
-
return /* @__PURE__ */ jsxs("div", { className: "cb-card-meta", children: [
|
|
876
|
-
/* @__PURE__ */ jsx(Skeleton.Circle, { size: "2.5rem", className: "cb-card-meta__avatar" }),
|
|
877
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-card-meta__content", children: [
|
|
878
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "45%", height: "0.875rem" }),
|
|
879
|
-
/* @__PURE__ */ jsx(Skeleton.Text, { lines })
|
|
880
|
-
] })
|
|
881
|
-
] });
|
|
882
|
-
}
|
|
883
|
-
return /* @__PURE__ */ jsx(Skeleton.Text, { lines });
|
|
884
|
-
}
|
|
885
|
-
function CardSkeleton({
|
|
886
|
-
size = "md",
|
|
887
|
-
variant = "plain",
|
|
888
|
-
glassStyle = "regular",
|
|
889
|
-
tone = "neutral",
|
|
890
|
-
hue,
|
|
891
|
-
elevation = "sm",
|
|
892
|
-
radius = "lg",
|
|
893
|
-
bordered = true,
|
|
894
|
-
withCover = false,
|
|
895
|
-
withActions = false,
|
|
896
|
-
meta = false,
|
|
897
|
-
lines = 3,
|
|
898
|
-
className
|
|
899
|
-
}) {
|
|
900
|
-
return /* @__PURE__ */ jsxs(
|
|
901
|
-
Surface,
|
|
902
|
-
{
|
|
903
|
-
variant,
|
|
904
|
-
glassStyle,
|
|
905
|
-
tone,
|
|
906
|
-
hue,
|
|
907
|
-
elevation,
|
|
908
|
-
radius,
|
|
909
|
-
padding: "none",
|
|
910
|
-
bordered,
|
|
911
|
-
className: cn("cb-card", `cb-card--${size}`, "cb-card--skeleton", className),
|
|
912
|
-
children: [
|
|
913
|
-
withCover ? /* @__PURE__ */ jsx("div", { className: "cb-card__cover cb-card__skeleton-cover", children: /* @__PURE__ */ jsx(Skeleton.Rect, { width: "100%", height: "100%", radius: "sm" }) }) : null,
|
|
914
|
-
/* @__PURE__ */ jsx("div", { className: "cb-card__body", children: /* @__PURE__ */ jsx(CardSkeletonContent, { lines, meta }) }),
|
|
915
|
-
withActions ? /* @__PURE__ */ jsxs("div", { className: "cb-card__actions cb-card__skeleton-actions", children: [
|
|
916
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "5rem", height: "2rem" }),
|
|
917
|
-
/* @__PURE__ */ jsx(Skeleton, { width: "5rem", height: "2rem" })
|
|
918
|
-
] }) : null
|
|
919
|
-
]
|
|
920
|
-
}
|
|
921
|
-
);
|
|
922
|
-
}
|
|
923
|
-
function CardRoot({
|
|
924
|
-
title,
|
|
925
|
-
extra,
|
|
926
|
-
cover,
|
|
927
|
-
tabs,
|
|
928
|
-
actions,
|
|
929
|
-
children,
|
|
930
|
-
size = "md",
|
|
931
|
-
variant = "plain",
|
|
932
|
-
glassStyle = "regular",
|
|
933
|
-
tone = "neutral",
|
|
934
|
-
hue,
|
|
935
|
-
elevation = "sm",
|
|
936
|
-
radius = "lg",
|
|
937
|
-
bordered = true,
|
|
938
|
-
hoverable = false,
|
|
939
|
-
nested = false,
|
|
940
|
-
loading = false,
|
|
941
|
-
asSection = false,
|
|
942
|
-
className
|
|
943
|
-
}) {
|
|
944
|
-
const hasHeader = title != null || extra != null;
|
|
945
|
-
const hasBody = loading || children != null;
|
|
946
|
-
return /* @__PURE__ */ jsxs(
|
|
947
|
-
Surface,
|
|
948
|
-
{
|
|
949
|
-
variant,
|
|
950
|
-
glassStyle,
|
|
951
|
-
tone,
|
|
952
|
-
hue,
|
|
953
|
-
elevation,
|
|
954
|
-
radius,
|
|
955
|
-
padding: "none",
|
|
956
|
-
bordered,
|
|
957
|
-
asSection,
|
|
958
|
-
className: cn(
|
|
959
|
-
"cb-card",
|
|
960
|
-
`cb-card--${size}`,
|
|
961
|
-
hoverable && "cb-card--hoverable",
|
|
962
|
-
nested && "cb-card--nested",
|
|
963
|
-
className
|
|
964
|
-
),
|
|
965
|
-
children: [
|
|
966
|
-
cover ? /* @__PURE__ */ jsx("div", { className: "cb-card__cover", children: cover }) : null,
|
|
967
|
-
hasHeader ? /* @__PURE__ */ jsxs("header", { className: "cb-card__header", children: [
|
|
968
|
-
title != null ? /* @__PURE__ */ jsx("div", { className: "cb-card__title", children: title }) : null,
|
|
969
|
-
extra != null ? /* @__PURE__ */ jsx("div", { className: "cb-card__extra", children: extra }) : null
|
|
970
|
-
] }) : null,
|
|
971
|
-
tabs ? /* @__PURE__ */ jsx("div", { className: "cb-card__tabs", children: tabs }) : null,
|
|
972
|
-
hasBody ? /* @__PURE__ */ jsx("div", { className: "cb-card__body", "aria-busy": loading || void 0, children: loading ? /* @__PURE__ */ jsx(CardSkeletonContent, {}) : children }) : null,
|
|
973
|
-
actions ? /* @__PURE__ */ jsx("footer", { className: "cb-card__actions", children: actions }) : null
|
|
974
|
-
]
|
|
975
|
-
}
|
|
976
|
-
);
|
|
977
|
-
}
|
|
978
|
-
function CardMeta({ avatar, title, description, className }) {
|
|
979
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("cb-card-meta", className), children: [
|
|
980
|
-
avatar ? /* @__PURE__ */ jsx("div", { className: "cb-card-meta__avatar", children: avatar }) : null,
|
|
981
|
-
/* @__PURE__ */ jsxs("div", { className: "cb-card-meta__content", children: [
|
|
982
|
-
title != null ? /* @__PURE__ */ jsx("div", { className: "cb-card-meta__title", children: title }) : null,
|
|
983
|
-
description != null ? /* @__PURE__ */ jsx("div", { className: "cb-card-meta__description", children: description }) : null
|
|
984
|
-
] })
|
|
985
|
-
] });
|
|
986
|
-
}
|
|
987
|
-
function CardGrid({ columns = 3, gap = 0, minItemWidth, className, children }) {
|
|
988
|
-
return /* @__PURE__ */ jsx(
|
|
989
|
-
Grid,
|
|
990
|
-
{
|
|
991
|
-
columns,
|
|
992
|
-
gap,
|
|
993
|
-
minItemWidth,
|
|
994
|
-
className: cn("cb-card-grid", className),
|
|
995
|
-
children
|
|
996
|
-
}
|
|
997
|
-
);
|
|
998
|
-
}
|
|
999
|
-
var Card = Object.assign(CardRoot, {
|
|
1000
|
-
Meta: CardMeta,
|
|
1001
|
-
Grid: CardGrid,
|
|
1002
|
-
Skeleton: CardSkeleton
|
|
1003
|
-
});
|
|
1004
|
-
function DescriptionsSkeleton({
|
|
1005
|
-
columns = 3,
|
|
1006
|
-
layout = "horizontal",
|
|
1007
|
-
size = "md",
|
|
1008
|
-
bordered = false,
|
|
1009
|
-
items = 6,
|
|
1010
|
-
className
|
|
1011
|
-
}) {
|
|
1012
|
-
return /* @__PURE__ */ jsx(
|
|
1013
|
-
"section",
|
|
1014
|
-
{
|
|
1015
|
-
"aria-hidden": "true",
|
|
1016
|
-
className: cn(
|
|
1017
|
-
"cb-descriptions",
|
|
1018
|
-
`cb-descriptions--${size}`,
|
|
1019
|
-
`cb-descriptions--${layout}`,
|
|
1020
|
-
bordered && "cb-descriptions--bordered",
|
|
1021
|
-
"cb-descriptions--skeleton",
|
|
1022
|
-
className
|
|
1023
|
-
),
|
|
1024
|
-
"data-columns": columns,
|
|
1025
|
-
style: { "--cb-descriptions-columns": columns },
|
|
1026
|
-
children: /* @__PURE__ */ jsx("dl", { className: "cb-descriptions__list", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "cb-descriptions__item", children: [
|
|
1027
|
-
/* @__PURE__ */ jsx("dt", { className: "cb-descriptions__label cb-descriptions__skeleton-label", children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
1028
|
-
/* @__PURE__ */ jsx("dd", { className: "cb-descriptions__value cb-descriptions__skeleton-value", children: /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
1029
|
-
] }, index)) })
|
|
1030
|
-
}
|
|
1031
|
-
);
|
|
1032
|
-
}
|
|
1033
|
-
function DescriptionsItem({ label, children, span = 1, className }) {
|
|
1034
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("cb-descriptions__item", `cb-descriptions__item--span-${span}`, className), children: [
|
|
1035
|
-
/* @__PURE__ */ jsx("dt", { className: "cb-descriptions__label", children: label }),
|
|
1036
|
-
/* @__PURE__ */ jsx("dd", { className: "cb-descriptions__value", children })
|
|
1037
|
-
] });
|
|
1038
|
-
}
|
|
1039
|
-
function DescriptionsRoot({
|
|
1040
|
-
title,
|
|
1041
|
-
extra,
|
|
1042
|
-
children,
|
|
1043
|
-
columns = 3,
|
|
1044
|
-
layout = "horizontal",
|
|
1045
|
-
size = "md",
|
|
1046
|
-
bordered = false,
|
|
1047
|
-
colon = true,
|
|
1048
|
-
className
|
|
1049
|
-
}) {
|
|
1050
|
-
const hasHeader = title != null || extra != null;
|
|
1051
|
-
return /* @__PURE__ */ jsxs(
|
|
1052
|
-
"section",
|
|
1053
|
-
{
|
|
1054
|
-
className: cn(
|
|
1055
|
-
"cb-descriptions",
|
|
1056
|
-
`cb-descriptions--${size}`,
|
|
1057
|
-
`cb-descriptions--${layout}`,
|
|
1058
|
-
bordered && "cb-descriptions--bordered",
|
|
1059
|
-
!colon && "cb-descriptions--without-colon",
|
|
1060
|
-
className
|
|
1061
|
-
),
|
|
1062
|
-
"data-columns": columns,
|
|
1063
|
-
style: { "--cb-descriptions-columns": columns },
|
|
1064
|
-
children: [
|
|
1065
|
-
hasHeader ? /* @__PURE__ */ jsxs("header", { className: "cb-descriptions__header", children: [
|
|
1066
|
-
title != null ? /* @__PURE__ */ jsx("div", { className: "cb-descriptions__title", children: title }) : null,
|
|
1067
|
-
extra != null ? /* @__PURE__ */ jsx("div", { className: "cb-descriptions__extra", children: extra }) : null
|
|
1068
|
-
] }) : null,
|
|
1069
|
-
/* @__PURE__ */ jsx("dl", { className: "cb-descriptions__list", children })
|
|
1070
|
-
]
|
|
1071
|
-
}
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
var Descriptions = Object.assign(DescriptionsRoot, {
|
|
1075
|
-
Item: DescriptionsItem,
|
|
1076
|
-
Skeleton: DescriptionsSkeleton
|
|
1077
|
-
});
|
|
1078
|
-
function ListySkeleton({ items = 5, grouped: grouped2 = false }) {
|
|
1079
|
-
return /* @__PURE__ */ jsx("ul", { className: "cb-listy cb-listy--skeleton", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("li", { className: grouped2 ? "cb-listy__group" : "cb-listy__section", children: [
|
|
1080
|
-
grouped2 ? /* @__PURE__ */ jsx(Skeleton, { className: "cb-listy__skeleton-heading" }) : null,
|
|
1081
|
-
/* @__PURE__ */ jsx("ul", { className: grouped2 ? "cb-listy__group-items" : "cb-listy__section-items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsx("li", { className: "cb-listy__item", children: /* @__PURE__ */ jsx(Skeleton, { className: "cb-listy__skeleton-row" }) }, index)) })
|
|
1082
|
-
] }) });
|
|
1083
|
-
}
|
|
1084
|
-
function grouped(items, getKey, getGroup) {
|
|
1085
|
-
const itemKeys = /* @__PURE__ */ new Set();
|
|
1086
|
-
const closedGroups = /* @__PURE__ */ new Set();
|
|
1087
|
-
const result = [];
|
|
1088
|
-
let activeGroupKey;
|
|
1089
|
-
items.forEach((item, index) => {
|
|
1090
|
-
const key = getKey(item);
|
|
1091
|
-
if (itemKeys.has(key)) throw new RangeError(`Listy item keys must be unique: ${key}`);
|
|
1092
|
-
itemKeys.add(key);
|
|
1093
|
-
const group = getGroup?.(item);
|
|
1094
|
-
if (group && group.key.length === 0) throw new RangeError("Listy group keys must not be empty.");
|
|
1095
|
-
if (group?.key !== activeGroupKey) {
|
|
1096
|
-
if (activeGroupKey) closedGroups.add(activeGroupKey);
|
|
1097
|
-
if (group && closedGroups.has(group.key)) throw new RangeError(`Listy group keys must be contiguous: ${group.key}`);
|
|
1098
|
-
result.push({ group, entries: [] });
|
|
1099
|
-
activeGroupKey = group?.key;
|
|
1100
|
-
}
|
|
1101
|
-
if (result.length === 0) result.push({ entries: [] });
|
|
1102
|
-
result[result.length - 1].entries.push({ item, index, key });
|
|
1103
|
-
});
|
|
1104
|
-
return result;
|
|
1105
|
-
}
|
|
1106
|
-
function ListyRoot({
|
|
1107
|
-
items,
|
|
1108
|
-
getKey,
|
|
1109
|
-
renderItem,
|
|
1110
|
-
getGroup,
|
|
1111
|
-
stickyGroupHeadings = false,
|
|
1112
|
-
optimizeRendering = false,
|
|
1113
|
-
"aria-label": ariaLabel = "List"
|
|
1114
|
-
}) {
|
|
1115
|
-
const sections = grouped(items, getKey, getGroup);
|
|
1116
|
-
return /* @__PURE__ */ jsx("ul", { className: "cb-listy", "aria-label": ariaLabel, "data-optimized": optimizeRendering || void 0, children: sections.flatMap((section, sectionIndex) => section.group ? /* @__PURE__ */ jsxs("li", { className: "cb-listy__group", children: [
|
|
1117
|
-
/* @__PURE__ */ jsx("div", { className: "cb-listy__group-heading", "data-sticky": stickyGroupHeadings || void 0, children: section.group.label }),
|
|
1118
|
-
/* @__PURE__ */ jsx("ul", { className: "cb-listy__group-items", children: section.entries.map(({ item, index, key }) => /* @__PURE__ */ jsx("li", { className: "cb-listy__item", children: renderItem(item, index) }, key)) })
|
|
1119
|
-
] }, section.group.key) : section.entries.map(({ item, index, key }) => /* @__PURE__ */ jsx("li", { className: "cb-listy__item", children: renderItem(item, index) }, `${sectionIndex}-${key}`))) });
|
|
1120
|
-
}
|
|
1121
|
-
var Listy = Object.assign(ListyRoot, { Skeleton: ListySkeleton });
|
|
283
|
+
var Leaderboard = LeaderboardRoot;
|
|
1122
284
|
|
|
1123
|
-
export {
|
|
285
|
+
export { BarMini, Container, Donut, Flex, Grid, Heading, Leaderboard, PageContainer, PageContainerSkeleton, Sparkline, Surface, Text, cn, donutArcs, sparklineGeometry };
|