@ceebee/ui 0.5.2 → 0.6.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/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { isValidElement, cloneElement } from 'react';
3
- import { ChevronRight, Check } from 'lucide-react';
1
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
2
+ import { Children, isValidElement, Fragment, cloneElement } from 'react';
3
+ import { XCircle, AlertTriangle, CheckCircle2, Info, ChevronRight, Check } from 'lucide-react';
4
+ import { encode } from 'uqr';
4
5
 
5
6
  // src/lib/cn.ts
6
7
  function cn(...parts) {
@@ -94,6 +95,172 @@ function Heading({ level = 2, size, className, children }) {
94
95
  const resolved = size ?? ["3xl", "2xl", "xl", "lg"][level - 1] ?? "lg";
95
96
  return /* @__PURE__ */ jsx(Tag, { className: cn("cb-heading", `cb-text--${resolved}`, className), children });
96
97
  }
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
+ function PageContainerSkeleton({ breadcrumb = true, subtitle = true, extra = true, tabs = false, lines = 4, containerSize = "lg" }) {
235
+ 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(Skeleton, { className: "cb-page-container__skeleton-breadcrumb" }) : null,
237
+ /* @__PURE__ */ jsxs("header", { className: "cb-page-container__header", children: [
238
+ /* @__PURE__ */ jsxs("div", { className: "cb-page-container__heading", children: [
239
+ /* @__PURE__ */ jsx(Skeleton, { className: "cb-page-container__skeleton-title" }),
240
+ subtitle ? /* @__PURE__ */ jsx(Skeleton, { className: "cb-page-container__skeleton-subtitle" }) : null
241
+ ] }),
242
+ extra ? /* @__PURE__ */ jsx(Skeleton, { className: "cb-page-container__skeleton-extra" }) : null
243
+ ] }),
244
+ tabs ? /* @__PURE__ */ jsx(Skeleton, { className: "cb-page-container__skeleton-tabs" }) : null,
245
+ /* @__PURE__ */ jsx(Skeleton.Text, { lines })
246
+ ] }) });
247
+ }
248
+ function PageContainerRoot({ breadcrumb, title, subtitle, extra, tabs, children, containerSize = "lg" }) {
249
+ const hasHeader = title != null || subtitle != null || extra != null;
250
+ return /* @__PURE__ */ jsx(Container, { size: containerSize, children: /* @__PURE__ */ jsxs("section", { className: "cb-page-container", children: [
251
+ breadcrumb != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__breadcrumb", children: breadcrumb }) : null,
252
+ hasHeader ? /* @__PURE__ */ jsxs("header", { className: "cb-page-container__header", children: [
253
+ /* @__PURE__ */ jsxs("div", { className: "cb-page-container__heading", children: [
254
+ title != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__title", children: title }) : null,
255
+ subtitle != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__subtitle", children: subtitle }) : null
256
+ ] }),
257
+ extra != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__extra", children: extra }) : null
258
+ ] }) : null,
259
+ tabs != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__tabs", children: tabs }) : null,
260
+ children != null ? /* @__PURE__ */ jsx("div", { className: "cb-page-container__body", children }) : null
261
+ ] }) });
262
+ }
263
+ var PageContainer = Object.assign(PageContainerRoot, { Skeleton: PageContainerSkeleton });
97
264
  function LinkButton({
98
265
  variant = "solid",
99
266
  tone = "brand",
@@ -114,7 +281,7 @@ function LinkButton({
114
281
  iconOnly && "cb-button--icon",
115
282
  className
116
283
  );
117
- const body = /* @__PURE__ */ jsxs(Fragment, { children: [
284
+ const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
118
285
  iconStart,
119
286
  iconOnly ? null : /* @__PURE__ */ jsx("span", { className: "cb-button__label", children }),
120
287
  iconOnly ? null : iconEnd
@@ -144,6 +311,54 @@ function LinkButton({
144
311
  }
145
312
  );
146
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 });
147
362
  function Divider({ children, orientation = "horizontal", className }) {
148
363
  if (orientation === "vertical") {
149
364
  return /* @__PURE__ */ jsx("span", { className: cn("cb-divider", "cb-divider--vertical", className), role: "separator", "aria-orientation": "vertical" });
@@ -167,6 +382,133 @@ function Empty({ title, description, icon, actions, variant = "first-run", class
167
382
  actions ? /* @__PURE__ */ jsx("div", { className: "cb-empty__actions", children: actions }) : null
168
383
  ] });
169
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
+ }
170
512
  function Spin({ size = "md", tone = "brand", label, className }) {
171
513
  return /* @__PURE__ */ jsx(
172
514
  "span",
@@ -209,22 +551,6 @@ function ProgressBar({ value, max = 100, tone = "brand", size = "md", label, sho
209
551
  ] }) : null
210
552
  ] });
211
553
  }
212
- function box({ width = "100%", height = "1rem", radius = "md", className }) {
213
- const style = { "--cb-skeleton-w": width, "--cb-skeleton-h": height };
214
- return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("cb-skeleton", `cb-radius--${radius}`, className), style });
215
- }
216
- function text({ lines = 3, lastLineWidth = "62%", className }) {
217
- 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)) });
218
- }
219
- function circle({ size = "2.5rem", className }) {
220
- return /* @__PURE__ */ jsx(SkeletonBox, { width: size, height: size, radius: "full", className });
221
- }
222
- var SkeletonBox = box;
223
- var Skeleton = Object.assign(box, {
224
- Text: text,
225
- Circle: circle,
226
- Rect: box
227
- });
228
554
  function TimelineRoot({ entries, className }) {
229
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: [
230
556
  /* @__PURE__ */ jsx("span", { className: "cb-timeline__rail", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "cb-timeline__marker", children: entry.icon }) }),
@@ -544,5 +870,254 @@ function StatCardSkeleton({ withVisual = false, className }) {
544
870
  ] });
545
871
  }
546
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 });
547
1122
 
548
- export { Avatar, AvatarGroup, Badge, BarMini, Breadcrumb, Container, Divider, Donut, Empty, Flex, Grid, Heading, Leaderboard, LinkButton, ProgressBar, ProgressRing, Skeleton, Sparkline, Spin, Statistic, Steps, Surface, Text, Timeline, cn, donutArcs, hueForName, initialsOf, ringGeometry, sparklineGeometry };
1123
+ export { Affix, Anchor, AnchorSkeleton, Avatar, AvatarGroup, Badge, BarMini, Breadcrumb, Card, Container, Descriptions, Divider, Donut, Empty, Flex, Grid, Heading, Leaderboard, LinkButton, Listy, ListySkeleton, Masonry, MasonrySkeleton, Notification, NotificationSkeleton, PageContainer, PageContainerSkeleton, ProgressBar, ProgressRing, QRCode, Result, ResultSkeleton, Skeleton, Space, SpaceSkeleton, Sparkline, Spin, Statistic, Steps, Surface, Text, Timeline, cn, donutArcs, hueForName, initialsOf, ringGeometry, sparklineGeometry };