@slipstream-ui/core 0.11.4 → 0.11.6

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 (246) hide show
  1. package/dist/index.d.mts +100 -3
  2. package/dist/index.d.ts +100 -3
  3. package/dist/index.js +589 -441
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +484 -337
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/accordion.manifest.json +1 -1
  8. package/dist/manifests/alert.manifest.json +1 -1
  9. package/dist/manifests/announcement-bar.manifest.json +1 -1
  10. package/dist/manifests/app-shell.manifest.json +1 -1
  11. package/dist/manifests/applied-filters.manifest.json +1 -1
  12. package/dist/manifests/article-card.manifest.json +1 -1
  13. package/dist/manifests/auth-layout.manifest.json +1 -1
  14. package/dist/manifests/autocomplete.manifest.json +1 -1
  15. package/dist/manifests/avatar.manifest.json +1 -1
  16. package/dist/manifests/badge.manifest.json +1 -1
  17. package/dist/manifests/block.manifest.json +1 -1
  18. package/dist/manifests/bottom-nav.manifest.json +1 -1
  19. package/dist/manifests/breadcrumb.manifest.json +1 -1
  20. package/dist/manifests/button-group.manifest.json +1 -1
  21. package/dist/manifests/button.manifest.json +1 -1
  22. package/dist/manifests/calendar.manifest.json +1 -1
  23. package/dist/manifests/card.manifest.json +1 -1
  24. package/dist/manifests/checkbox.manifest.json +1 -1
  25. package/dist/manifests/comparison-table.manifest.json +1 -1
  26. package/dist/manifests/confirm-dialog.manifest.json +1 -1
  27. package/dist/manifests/contact-strip.manifest.json +1 -1
  28. package/dist/manifests/container.manifest.json +1 -1
  29. package/dist/manifests/cover-image.manifest.json +151 -0
  30. package/dist/manifests/cta-section.manifest.json +1 -1
  31. package/dist/manifests/data-table.manifest.json +1 -1
  32. package/dist/manifests/date-picker-popover.manifest.json +1 -1
  33. package/dist/manifests/date-picker.manifest.json +1 -1
  34. package/dist/manifests/date-range-picker.manifest.json +1 -1
  35. package/dist/manifests/deal-card.manifest.json +1 -1
  36. package/dist/manifests/dialog.manifest.json +1 -1
  37. package/dist/manifests/document-card.manifest.json +1 -1
  38. package/dist/manifests/drawer.manifest.json +1 -1
  39. package/dist/manifests/empty-state.manifest.json +45 -1
  40. package/dist/manifests/entity-card.manifest.json +1 -1
  41. package/dist/manifests/feature-grid.manifest.json +1 -1
  42. package/dist/manifests/feature-row.manifest.json +1 -1
  43. package/dist/manifests/fieldset.manifest.json +1 -1
  44. package/dist/manifests/file-upload.manifest.json +1 -1
  45. package/dist/manifests/filter-bar.manifest.json +1 -1
  46. package/dist/manifests/filter-chips.manifest.json +1 -1
  47. package/dist/manifests/filter-panel.manifest.json +1 -1
  48. package/dist/manifests/flex.manifest.json +1 -1
  49. package/dist/manifests/form-field.manifest.json +1 -1
  50. package/dist/manifests/form-layout.manifest.json +1 -1
  51. package/dist/manifests/form.manifest.json +1 -1
  52. package/dist/manifests/grid.manifest.json +1 -1
  53. package/dist/manifests/heading.manifest.json +1 -1
  54. package/dist/manifests/hero.manifest.json +1 -1
  55. package/dist/manifests/image.manifest.json +7 -1
  56. package/dist/manifests/input-group.manifest.json +1 -1
  57. package/dist/manifests/input.manifest.json +1 -1
  58. package/dist/manifests/label.manifest.json +1 -1
  59. package/dist/manifests/link-tabs.manifest.json +1 -1
  60. package/dist/manifests/link.manifest.json +1 -1
  61. package/dist/manifests/list.manifest.json +1 -1
  62. package/dist/manifests/load-more.manifest.json +1 -1
  63. package/dist/manifests/logo-cloud.manifest.json +1 -1
  64. package/dist/manifests/menu.manifest.json +1 -1
  65. package/dist/manifests/metric-card.manifest.json +1 -1
  66. package/dist/manifests/multi-select.manifest.json +1 -1
  67. package/dist/manifests/newsletter.manifest.json +1 -1
  68. package/dist/manifests/page-header.manifest.json +1 -1
  69. package/dist/manifests/pagination.manifest.json +1 -1
  70. package/dist/manifests/password-input.manifest.json +1 -1
  71. package/dist/manifests/popover.manifest.json +1 -1
  72. package/dist/manifests/process-steps.manifest.json +1 -1
  73. package/dist/manifests/progress.manifest.json +1 -1
  74. package/dist/manifests/prose.manifest.json +1 -1
  75. package/dist/manifests/radio.manifest.json +1 -1
  76. package/dist/manifests/range-slider.manifest.json +1 -1
  77. package/dist/manifests/search.manifest.json +1 -1
  78. package/dist/manifests/section-heading.manifest.json +1 -1
  79. package/dist/manifests/section.manifest.json +1 -1
  80. package/dist/manifests/segmented-control.manifest.json +29 -2
  81. package/dist/manifests/select-menu.manifest.json +1 -1
  82. package/dist/manifests/select.manifest.json +1 -1
  83. package/dist/manifests/separator.manifest.json +1 -1
  84. package/dist/manifests/site-footer.manifest.json +1 -1
  85. package/dist/manifests/site-header.manifest.json +1 -1
  86. package/dist/manifests/skeleton.manifest.json +1 -1
  87. package/dist/manifests/spinner.manifest.json +1 -1
  88. package/dist/manifests/stat-band.manifest.json +23 -1
  89. package/dist/manifests/stepper.manifest.json +1 -1
  90. package/dist/manifests/switch.manifest.json +1 -1
  91. package/dist/manifests/table-card.manifest.json +1 -1
  92. package/dist/manifests/table-of-contents.manifest.json +1 -1
  93. package/dist/manifests/table.manifest.json +1 -1
  94. package/dist/manifests/tabs.manifest.json +1 -1
  95. package/dist/manifests/testimonial.manifest.json +1 -1
  96. package/dist/manifests/text.manifest.json +1 -1
  97. package/dist/manifests/textarea.manifest.json +1 -1
  98. package/dist/manifests/theme-toggle.manifest.json +1 -1
  99. package/dist/manifests/time-picker.manifest.json +1 -1
  100. package/dist/manifests/timeline.manifest.json +1 -1
  101. package/dist/manifests/toast.manifest.json +1 -1
  102. package/dist/manifests/tombstone-card.manifest.json +1 -1
  103. package/dist/manifests/tooltip.manifest.json +1 -1
  104. package/dist/src/components/cover-image/CoverImage.d.ts +34 -0
  105. package/dist/src/components/cover-image/CoverImage.js +94 -0
  106. package/dist/src/components/cover-image/CoverImage.js.map +1 -0
  107. package/dist/src/components/cover-image/CoverImage.mjs +70 -0
  108. package/dist/src/components/cover-image/CoverImage.mjs.map +1 -0
  109. package/dist/src/components/cover-image/index.d.ts +1 -0
  110. package/dist/src/components/cover-image/index.js +29 -0
  111. package/dist/src/components/cover-image/index.js.map +1 -0
  112. package/dist/src/components/cover-image/index.mjs +5 -0
  113. package/dist/src/components/cover-image/index.mjs.map +1 -0
  114. package/dist/src/components/empty-state/EmptyState.d.ts +24 -0
  115. package/dist/src/components/empty-state/EmptyState.js +16 -6
  116. package/dist/src/components/empty-state/EmptyState.js.map +1 -1
  117. package/dist/src/components/empty-state/EmptyState.mjs +16 -6
  118. package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
  119. package/dist/src/components/image/Image.d.ts +3 -1
  120. package/dist/src/components/image/Image.js +2 -0
  121. package/dist/src/components/image/Image.js.map +1 -1
  122. package/dist/src/components/image/Image.mjs +2 -0
  123. package/dist/src/components/image/Image.mjs.map +1 -1
  124. package/dist/src/components/segmented-control/SegmentedControl.d.ts +21 -0
  125. package/dist/src/components/segmented-control/SegmentedControl.js +47 -16
  126. package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
  127. package/dist/src/components/segmented-control/SegmentedControl.mjs +48 -17
  128. package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
  129. package/dist/src/components/stat-band/StatBand.d.ts +16 -0
  130. package/dist/src/components/stat-band/StatBand.js +46 -9
  131. package/dist/src/components/stat-band/StatBand.js.map +1 -1
  132. package/dist/src/components/stat-band/StatBand.mjs +46 -9
  133. package/dist/src/components/stat-band/StatBand.mjs.map +1 -1
  134. package/dist/src/index.d.ts +1 -0
  135. package/dist/styles-full.css +1 -1
  136. package/dist/styles.css +1 -1
  137. package/package.json +2 -2
  138. package/src/components/cover-image/CoverImage.test.tsx +88 -0
  139. package/src/components/cover-image/CoverImage.tsx +109 -0
  140. package/src/components/cover-image/index.ts +1 -0
  141. package/src/components/empty-state/EmptyState.test.tsx +33 -0
  142. package/src/components/empty-state/EmptyState.tsx +34 -6
  143. package/src/components/image/Image.tsx +4 -0
  144. package/src/components/segmented-control/SegmentedControl.test.tsx +64 -0
  145. package/src/components/segmented-control/SegmentedControl.tsx +69 -15
  146. package/src/components/stat-band/StatBand.test.tsx +26 -0
  147. package/src/components/stat-band/StatBand.tsx +52 -7
  148. package/src/index.ts +1 -0
  149. package/src/manifests/accordion.manifest.json +1 -1
  150. package/src/manifests/alert.manifest.json +1 -1
  151. package/src/manifests/announcement-bar.manifest.json +1 -1
  152. package/src/manifests/app-shell.manifest.json +1 -1
  153. package/src/manifests/applied-filters.manifest.json +1 -1
  154. package/src/manifests/article-card.manifest.json +1 -1
  155. package/src/manifests/auth-layout.manifest.json +1 -1
  156. package/src/manifests/autocomplete.manifest.json +1 -1
  157. package/src/manifests/avatar.manifest.json +1 -1
  158. package/src/manifests/badge.manifest.json +1 -1
  159. package/src/manifests/block.manifest.json +1 -1
  160. package/src/manifests/bottom-nav.manifest.json +1 -1
  161. package/src/manifests/breadcrumb.manifest.json +1 -1
  162. package/src/manifests/button-group.manifest.json +1 -1
  163. package/src/manifests/button.manifest.json +1 -1
  164. package/src/manifests/calendar.manifest.json +1 -1
  165. package/src/manifests/card.manifest.json +1 -1
  166. package/src/manifests/checkbox.manifest.json +1 -1
  167. package/src/manifests/comparison-table.manifest.json +1 -1
  168. package/src/manifests/confirm-dialog.manifest.json +1 -1
  169. package/src/manifests/contact-strip.manifest.json +1 -1
  170. package/src/manifests/container.manifest.json +1 -1
  171. package/src/manifests/cover-image.manifest.json +151 -0
  172. package/src/manifests/cta-section.manifest.json +1 -1
  173. package/src/manifests/data-table.manifest.json +1 -1
  174. package/src/manifests/date-picker-popover.manifest.json +1 -1
  175. package/src/manifests/date-picker.manifest.json +1 -1
  176. package/src/manifests/date-range-picker.manifest.json +1 -1
  177. package/src/manifests/deal-card.manifest.json +1 -1
  178. package/src/manifests/dialog.manifest.json +1 -1
  179. package/src/manifests/document-card.manifest.json +1 -1
  180. package/src/manifests/drawer.manifest.json +1 -1
  181. package/src/manifests/empty-state.manifest.json +45 -1
  182. package/src/manifests/entity-card.manifest.json +1 -1
  183. package/src/manifests/feature-grid.manifest.json +1 -1
  184. package/src/manifests/feature-row.manifest.json +1 -1
  185. package/src/manifests/fieldset.manifest.json +1 -1
  186. package/src/manifests/file-upload.manifest.json +1 -1
  187. package/src/manifests/filter-bar.manifest.json +1 -1
  188. package/src/manifests/filter-chips.manifest.json +1 -1
  189. package/src/manifests/filter-panel.manifest.json +1 -1
  190. package/src/manifests/flex.manifest.json +1 -1
  191. package/src/manifests/form-field.manifest.json +1 -1
  192. package/src/manifests/form-layout.manifest.json +1 -1
  193. package/src/manifests/form.manifest.json +1 -1
  194. package/src/manifests/grid.manifest.json +1 -1
  195. package/src/manifests/heading.manifest.json +1 -1
  196. package/src/manifests/hero.manifest.json +1 -1
  197. package/src/manifests/image.manifest.json +7 -1
  198. package/src/manifests/input-group.manifest.json +1 -1
  199. package/src/manifests/input.manifest.json +1 -1
  200. package/src/manifests/label.manifest.json +1 -1
  201. package/src/manifests/link-tabs.manifest.json +1 -1
  202. package/src/manifests/link.manifest.json +1 -1
  203. package/src/manifests/list.manifest.json +1 -1
  204. package/src/manifests/load-more.manifest.json +1 -1
  205. package/src/manifests/logo-cloud.manifest.json +1 -1
  206. package/src/manifests/menu.manifest.json +1 -1
  207. package/src/manifests/metric-card.manifest.json +1 -1
  208. package/src/manifests/multi-select.manifest.json +1 -1
  209. package/src/manifests/newsletter.manifest.json +1 -1
  210. package/src/manifests/page-header.manifest.json +1 -1
  211. package/src/manifests/pagination.manifest.json +1 -1
  212. package/src/manifests/password-input.manifest.json +1 -1
  213. package/src/manifests/popover.manifest.json +1 -1
  214. package/src/manifests/process-steps.manifest.json +1 -1
  215. package/src/manifests/progress.manifest.json +1 -1
  216. package/src/manifests/prose.manifest.json +1 -1
  217. package/src/manifests/radio.manifest.json +1 -1
  218. package/src/manifests/range-slider.manifest.json +1 -1
  219. package/src/manifests/search.manifest.json +1 -1
  220. package/src/manifests/section-heading.manifest.json +1 -1
  221. package/src/manifests/section.manifest.json +1 -1
  222. package/src/manifests/segmented-control.manifest.json +29 -2
  223. package/src/manifests/select-menu.manifest.json +1 -1
  224. package/src/manifests/select.manifest.json +1 -1
  225. package/src/manifests/separator.manifest.json +1 -1
  226. package/src/manifests/site-footer.manifest.json +1 -1
  227. package/src/manifests/site-header.manifest.json +1 -1
  228. package/src/manifests/skeleton.manifest.json +1 -1
  229. package/src/manifests/spinner.manifest.json +1 -1
  230. package/src/manifests/stat-band.manifest.json +23 -1
  231. package/src/manifests/stepper.manifest.json +1 -1
  232. package/src/manifests/switch.manifest.json +1 -1
  233. package/src/manifests/table-card.manifest.json +1 -1
  234. package/src/manifests/table-of-contents.manifest.json +1 -1
  235. package/src/manifests/table.manifest.json +1 -1
  236. package/src/manifests/tabs.manifest.json +1 -1
  237. package/src/manifests/testimonial.manifest.json +1 -1
  238. package/src/manifests/text.manifest.json +1 -1
  239. package/src/manifests/textarea.manifest.json +1 -1
  240. package/src/manifests/theme-toggle.manifest.json +1 -1
  241. package/src/manifests/time-picker.manifest.json +1 -1
  242. package/src/manifests/timeline.manifest.json +1 -1
  243. package/src/manifests/toast.manifest.json +1 -1
  244. package/src/manifests/tombstone-card.manifest.json +1 -1
  245. package/src/manifests/tooltip.manifest.json +1 -1
  246. package/src/styles.css +5 -0
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.11.4",
7
+ "version": "0.11.6",
8
8
  "sourceDir": "tombstone-card",
9
9
  "exportName": "TombstoneCard",
10
10
  "description": "Placeholder card for archived, closed or unavailable marketplace items.",
@@ -120,7 +120,7 @@
120
120
  ],
121
121
  "package": "@slipstream-ui/core",
122
122
  "importPath": "@slipstream-ui/core",
123
- "version": "0.11.4",
123
+ "version": "0.11.6",
124
124
  "sourceDir": "tooltip",
125
125
  "exportName": "Tooltip"
126
126
  }
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ export type CoverImageProps = {
3
+ /** Cover URL. When absent or broken, the seeded fallback renders instead. */
4
+ src?: string | null;
5
+ /** Required: describes the image for assistive tech. */
6
+ alt: string;
7
+ /**
8
+ * Aspect ratio: 'video' (16:9), 'square' (1:1), 'wide' (2:1), or any CSS
9
+ * aspect-ratio value such as '16/9' or '4/3'.
10
+ */
11
+ aspect?: 'video' | 'square' | 'wide' | string;
12
+ /** Stable key selecting the fallback gradient (e.g. entity slug). */
13
+ seed?: string;
14
+ /** Load eagerly and fetch at high priority for the LCP image. */
15
+ priority?: boolean;
16
+ /** Responsive `sizes` hint forwarded to the image. */
17
+ sizes?: string;
18
+ /** Custom fallback content; defaults to the seed-derived gradient. */
19
+ fallback?: React.ReactNode;
20
+ /** Optional mark centered on the default gradient (icon, monogram). */
21
+ mark?: React.ReactNode;
22
+ className?: string;
23
+ };
24
+ /**
25
+ * Media cover with a deterministic placeholder: a fixed-aspect box that shows
26
+ * the image when present and a seed-derived token gradient (plus optional
27
+ * mark) when the entity has no art. Broken images degrade to the same
28
+ * gradient through Image's fallback chain, so imageless grids still look
29
+ * intentional.
30
+ */
31
+ export declare function CoverImage({ src, alt, aspect, seed, priority, sizes, fallback, mark, className, }: CoverImageProps): React.JSX.Element;
32
+ export declare namespace CoverImage {
33
+ var displayName: string;
34
+ }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var CoverImage_exports = {};
20
+ __export(CoverImage_exports, {
21
+ CoverImage: () => CoverImage
22
+ });
23
+ module.exports = __toCommonJS(CoverImage_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_cn = require("../../utils/cn.js");
26
+ var import_Image = require("../image/Image.js");
27
+ const aspectClasses = {
28
+ video: "aspect-video",
29
+ square: "aspect-square",
30
+ wide: "aspect-[2/1]"
31
+ };
32
+ const gradients = [
33
+ "linear-gradient(135deg, hsl(var(--primary) / 0.18), hsl(var(--info) / 0.10))",
34
+ "linear-gradient(135deg, hsl(var(--info) / 0.16), hsl(var(--primary) / 0.08))",
35
+ "linear-gradient(135deg, hsl(var(--warning) / 0.14), hsl(var(--primary) / 0.10))",
36
+ "linear-gradient(135deg, hsl(var(--success) / 0.14), hsl(var(--info) / 0.08))"
37
+ ];
38
+ function hashSeed(seed) {
39
+ let hash = 0;
40
+ for (let i = 0; i < seed.length; i += 1) {
41
+ hash = hash * 31 + seed.charCodeAt(i) >>> 0;
42
+ }
43
+ return hash;
44
+ }
45
+ function seededGradient(seed) {
46
+ return { backgroundImage: gradients[hashSeed(seed) % gradients.length] };
47
+ }
48
+ function CoverImage({
49
+ src,
50
+ alt,
51
+ aspect = "video",
52
+ seed,
53
+ priority = false,
54
+ sizes,
55
+ fallback,
56
+ mark,
57
+ className
58
+ }) {
59
+ const preset = aspectClasses[aspect];
60
+ const aspectStyle = preset === void 0 && typeof aspect === "string" ? { aspectRatio: aspect } : void 0;
61
+ const fallbackNode = fallback ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
+ "div",
63
+ {
64
+ className: "flex h-full w-full items-center justify-center",
65
+ style: seededGradient(seed ?? alt),
66
+ "aria-hidden": "true",
67
+ children: mark && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground [&_svg]:size-8", children: mark })
68
+ }
69
+ );
70
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
+ "div",
72
+ {
73
+ className: (0, import_cn.cn)("relative overflow-hidden rounded-lg bg-muted", preset, className),
74
+ style: aspectStyle,
75
+ children: src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
+ import_Image.Image,
77
+ {
78
+ src,
79
+ alt,
80
+ priority,
81
+ sizes,
82
+ fallback: fallbackNode,
83
+ className: "h-full w-full object-cover"
84
+ }
85
+ ) : fallbackNode
86
+ }
87
+ );
88
+ }
89
+ CoverImage.displayName = "CoverImage";
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ CoverImage
93
+ });
94
+ //# sourceMappingURL=CoverImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/cover-image/CoverImage.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Image } from '../image/Image';\n\nexport type CoverImageProps = {\n /** Cover URL. When absent or broken, the seeded fallback renders instead. */\n src?: string | null;\n /** Required: describes the image for assistive tech. */\n alt: string;\n /**\n * Aspect ratio: 'video' (16:9), 'square' (1:1), 'wide' (2:1), or any CSS\n * aspect-ratio value such as '16/9' or '4/3'.\n */\n aspect?: 'video' | 'square' | 'wide' | string;\n /** Stable key selecting the fallback gradient (e.g. entity slug). */\n seed?: string;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Responsive `sizes` hint forwarded to the image. */\n sizes?: string;\n /** Custom fallback content; defaults to the seed-derived gradient. */\n fallback?: React.ReactNode;\n /** Optional mark centered on the default gradient (icon, monogram). */\n mark?: React.ReactNode;\n className?: string;\n};\n\nconst aspectClasses = {\n video: 'aspect-video',\n square: 'aspect-square',\n wide: 'aspect-[2/1]',\n} as const;\n\n// Token-derived gradients: every entry uses theme variables so covers stay on\n// the active palette in light and dark mode and pass the token audit.\nconst gradients = [\n 'linear-gradient(135deg, hsl(var(--primary) / 0.18), hsl(var(--info) / 0.10))',\n 'linear-gradient(135deg, hsl(var(--info) / 0.16), hsl(var(--primary) / 0.08))',\n 'linear-gradient(135deg, hsl(var(--warning) / 0.14), hsl(var(--primary) / 0.10))',\n 'linear-gradient(135deg, hsl(var(--success) / 0.14), hsl(var(--info) / 0.08))',\n] as const;\n\nfunction hashSeed(seed: string): number {\n let hash = 0;\n for (let i = 0; i < seed.length; i += 1) {\n hash = (hash * 31 + seed.charCodeAt(i)) >>> 0;\n }\n return hash;\n}\n\nfunction seededGradient(seed: string): React.CSSProperties {\n return { backgroundImage: gradients[hashSeed(seed) % gradients.length] };\n}\n\n/**\n * Media cover with a deterministic placeholder: a fixed-aspect box that shows\n * the image when present and a seed-derived token gradient (plus optional\n * mark) when the entity has no art. Broken images degrade to the same\n * gradient through Image's fallback chain, so imageless grids still look\n * intentional.\n */\nexport function CoverImage({\n src,\n alt,\n aspect = 'video',\n seed,\n priority = false,\n sizes,\n fallback,\n mark,\n className,\n}: CoverImageProps) {\n const preset = aspectClasses[aspect as keyof typeof aspectClasses];\n const aspectStyle =\n preset === undefined && typeof aspect === 'string' ? { aspectRatio: aspect } : undefined;\n\n const fallbackNode =\n fallback ?? (\n <div\n className=\"flex h-full w-full items-center justify-center\"\n style={seededGradient(seed ?? alt)}\n aria-hidden=\"true\"\n >\n {mark && <span className=\"text-muted-foreground [&_svg]:size-8\">{mark}</span>}\n </div>\n );\n\n return (\n <div\n className={cn('relative overflow-hidden rounded-lg bg-muted', preset, className)}\n style={aspectStyle}\n >\n {src ? (\n <Image\n src={src}\n alt={alt}\n priority={priority}\n sizes={sizes}\n fallback={fallbackNode}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n fallbackNode\n )}\n </div>\n );\n}\n\nCoverImage.displayName = 'CoverImage';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmFiB;AAlFjB,gBAAmB;AACnB,mBAAsB;AAyBtB,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAIA,MAAM,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,MAAsB;AACtC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;AACvC,WAAQ,OAAO,KAAK,KAAK,WAAW,CAAC,MAAO;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,SAAS,eAAe,MAAmC;AACzD,SAAO,EAAE,iBAAiB,UAAU,SAAS,IAAI,IAAI,UAAU,MAAM,EAAE;AACzE;AASO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,SAAS,cAAc,MAAoC;AACjE,QAAM,cACJ,WAAW,UAAa,OAAO,WAAW,WAAW,EAAE,aAAa,OAAO,IAAI;AAEjF,QAAM,eACJ,YACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,eAAe,QAAQ,GAAG;AAAA,MACjC,eAAY;AAAA,MAEX,kBAAQ,4CAAC,UAAK,WAAU,wCAAwC,gBAAK;AAAA;AAAA,EACxE;AAGJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,cAAG,gDAAgD,QAAQ,SAAS;AAAA,MAC/E,OAAO;AAAA,MAEN,gBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAU;AAAA,UACV,WAAU;AAAA;AAAA,MACZ,IAEA;AAAA;AAAA,EAEJ;AAEJ;AAEA,WAAW,cAAc;","names":[]}
@@ -0,0 +1,70 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../utils/cn.mjs";
3
+ import { Image } from "../image/Image.mjs";
4
+ const aspectClasses = {
5
+ video: "aspect-video",
6
+ square: "aspect-square",
7
+ wide: "aspect-[2/1]"
8
+ };
9
+ const gradients = [
10
+ "linear-gradient(135deg, hsl(var(--primary) / 0.18), hsl(var(--info) / 0.10))",
11
+ "linear-gradient(135deg, hsl(var(--info) / 0.16), hsl(var(--primary) / 0.08))",
12
+ "linear-gradient(135deg, hsl(var(--warning) / 0.14), hsl(var(--primary) / 0.10))",
13
+ "linear-gradient(135deg, hsl(var(--success) / 0.14), hsl(var(--info) / 0.08))"
14
+ ];
15
+ function hashSeed(seed) {
16
+ let hash = 0;
17
+ for (let i = 0; i < seed.length; i += 1) {
18
+ hash = hash * 31 + seed.charCodeAt(i) >>> 0;
19
+ }
20
+ return hash;
21
+ }
22
+ function seededGradient(seed) {
23
+ return { backgroundImage: gradients[hashSeed(seed) % gradients.length] };
24
+ }
25
+ function CoverImage({
26
+ src,
27
+ alt,
28
+ aspect = "video",
29
+ seed,
30
+ priority = false,
31
+ sizes,
32
+ fallback,
33
+ mark,
34
+ className
35
+ }) {
36
+ const preset = aspectClasses[aspect];
37
+ const aspectStyle = preset === void 0 && typeof aspect === "string" ? { aspectRatio: aspect } : void 0;
38
+ const fallbackNode = fallback ?? /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ className: "flex h-full w-full items-center justify-center",
42
+ style: seededGradient(seed ?? alt),
43
+ "aria-hidden": "true",
44
+ children: mark && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground [&_svg]:size-8", children: mark })
45
+ }
46
+ );
47
+ return /* @__PURE__ */ jsx(
48
+ "div",
49
+ {
50
+ className: cn("relative overflow-hidden rounded-lg bg-muted", preset, className),
51
+ style: aspectStyle,
52
+ children: src ? /* @__PURE__ */ jsx(
53
+ Image,
54
+ {
55
+ src,
56
+ alt,
57
+ priority,
58
+ sizes,
59
+ fallback: fallbackNode,
60
+ className: "h-full w-full object-cover"
61
+ }
62
+ ) : fallbackNode
63
+ }
64
+ );
65
+ }
66
+ CoverImage.displayName = "CoverImage";
67
+ export {
68
+ CoverImage
69
+ };
70
+ //# sourceMappingURL=CoverImage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/cover-image/CoverImage.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Image } from '../image/Image';\n\nexport type CoverImageProps = {\n /** Cover URL. When absent or broken, the seeded fallback renders instead. */\n src?: string | null;\n /** Required: describes the image for assistive tech. */\n alt: string;\n /**\n * Aspect ratio: 'video' (16:9), 'square' (1:1), 'wide' (2:1), or any CSS\n * aspect-ratio value such as '16/9' or '4/3'.\n */\n aspect?: 'video' | 'square' | 'wide' | string;\n /** Stable key selecting the fallback gradient (e.g. entity slug). */\n seed?: string;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Responsive `sizes` hint forwarded to the image. */\n sizes?: string;\n /** Custom fallback content; defaults to the seed-derived gradient. */\n fallback?: React.ReactNode;\n /** Optional mark centered on the default gradient (icon, monogram). */\n mark?: React.ReactNode;\n className?: string;\n};\n\nconst aspectClasses = {\n video: 'aspect-video',\n square: 'aspect-square',\n wide: 'aspect-[2/1]',\n} as const;\n\n// Token-derived gradients: every entry uses theme variables so covers stay on\n// the active palette in light and dark mode and pass the token audit.\nconst gradients = [\n 'linear-gradient(135deg, hsl(var(--primary) / 0.18), hsl(var(--info) / 0.10))',\n 'linear-gradient(135deg, hsl(var(--info) / 0.16), hsl(var(--primary) / 0.08))',\n 'linear-gradient(135deg, hsl(var(--warning) / 0.14), hsl(var(--primary) / 0.10))',\n 'linear-gradient(135deg, hsl(var(--success) / 0.14), hsl(var(--info) / 0.08))',\n] as const;\n\nfunction hashSeed(seed: string): number {\n let hash = 0;\n for (let i = 0; i < seed.length; i += 1) {\n hash = (hash * 31 + seed.charCodeAt(i)) >>> 0;\n }\n return hash;\n}\n\nfunction seededGradient(seed: string): React.CSSProperties {\n return { backgroundImage: gradients[hashSeed(seed) % gradients.length] };\n}\n\n/**\n * Media cover with a deterministic placeholder: a fixed-aspect box that shows\n * the image when present and a seed-derived token gradient (plus optional\n * mark) when the entity has no art. Broken images degrade to the same\n * gradient through Image's fallback chain, so imageless grids still look\n * intentional.\n */\nexport function CoverImage({\n src,\n alt,\n aspect = 'video',\n seed,\n priority = false,\n sizes,\n fallback,\n mark,\n className,\n}: CoverImageProps) {\n const preset = aspectClasses[aspect as keyof typeof aspectClasses];\n const aspectStyle =\n preset === undefined && typeof aspect === 'string' ? { aspectRatio: aspect } : undefined;\n\n const fallbackNode =\n fallback ?? (\n <div\n className=\"flex h-full w-full items-center justify-center\"\n style={seededGradient(seed ?? alt)}\n aria-hidden=\"true\"\n >\n {mark && <span className=\"text-muted-foreground [&_svg]:size-8\">{mark}</span>}\n </div>\n );\n\n return (\n <div\n className={cn('relative overflow-hidden rounded-lg bg-muted', preset, className)}\n style={aspectStyle}\n >\n {src ? (\n <Image\n src={src}\n alt={alt}\n priority={priority}\n sizes={sizes}\n fallback={fallbackNode}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n fallbackNode\n )}\n </div>\n );\n}\n\nCoverImage.displayName = 'CoverImage';\n"],"mappings":"AAmFiB;AAlFjB,SAAS,UAAU;AACnB,SAAS,aAAa;AAyBtB,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAIA,MAAM,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,MAAsB;AACtC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;AACvC,WAAQ,OAAO,KAAK,KAAK,WAAW,CAAC,MAAO;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,SAAS,eAAe,MAAmC;AACzD,SAAO,EAAE,iBAAiB,UAAU,SAAS,IAAI,IAAI,UAAU,MAAM,EAAE;AACzE;AASO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,SAAS,cAAc,MAAoC;AACjE,QAAM,cACJ,WAAW,UAAa,OAAO,WAAW,WAAW,EAAE,aAAa,OAAO,IAAI;AAEjF,QAAM,eACJ,YACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,eAAe,QAAQ,GAAG;AAAA,MACjC,eAAY;AAAA,MAEX,kBAAQ,oBAAC,UAAK,WAAU,wCAAwC,gBAAK;AAAA;AAAA,EACxE;AAGJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,gDAAgD,QAAQ,SAAS;AAAA,MAC/E,OAAO;AAAA,MAEN,gBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAU;AAAA,UACV,WAAU;AAAA;AAAA,MACZ,IAEA;AAAA;AAAA,EAEJ;AAEJ;AAEA,WAAW,cAAc;","names":[]}
@@ -0,0 +1 @@
1
+ export { CoverImage, type CoverImageProps } from './CoverImage';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var cover_image_exports = {};
20
+ __export(cover_image_exports, {
21
+ CoverImage: () => import_CoverImage.CoverImage
22
+ });
23
+ module.exports = __toCommonJS(cover_image_exports);
24
+ var import_CoverImage = require("./CoverImage.js");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ CoverImage
28
+ });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/cover-image/index.ts"],"sourcesContent":["export { CoverImage, type CoverImageProps } from './CoverImage';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAiD;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { CoverImage } from "./CoverImage.mjs";
2
+ export {
3
+ CoverImage
4
+ };
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/cover-image/index.ts"],"sourcesContent":["export { CoverImage, type CoverImageProps } from './CoverImage';\n"],"mappings":"AAAA,SAAS,kBAAwC;","names":[]}
@@ -23,6 +23,18 @@ export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
23
23
  titleAs?: 'p' | 'h2' | 'h3' | 'h4';
24
24
  /** Compact padding for use inside panels and table bodies. */
25
25
  size?: 'sm' | 'md';
26
+ /** Horizontal alignment of content and actions. Default 'center'. */
27
+ align?: 'center' | 'start';
28
+ /**
29
+ * Surface treatment. 'panel' renders a tinted, solid-bordered surface for
30
+ * content pages (typically paired with align="start"); 'plain' keeps the
31
+ * default dashed outline. Default 'plain'.
32
+ */
33
+ tone?: 'plain' | 'panel';
34
+ /** Custom link element for action hrefs (Next Link, react-router Link). */
35
+ linkComponent?: React.ElementType;
36
+ /** Prop used to pass the destination to `linkComponent`. */
37
+ linkHrefProp?: 'href' | 'to';
26
38
  };
27
39
  /**
28
40
  * Placeholder for empty collections, zero-result searches and unconfigured
@@ -44,4 +56,16 @@ export declare const EmptyState: React.ForwardRefExoticComponent<React.HTMLAttri
44
56
  titleAs?: "p" | "h2" | "h3" | "h4";
45
57
  /** Compact padding for use inside panels and table bodies. */
46
58
  size?: "sm" | "md";
59
+ /** Horizontal alignment of content and actions. Default 'center'. */
60
+ align?: "center" | "start";
61
+ /**
62
+ * Surface treatment. 'panel' renders a tinted, solid-bordered surface for
63
+ * content pages (typically paired with align="start"); 'plain' keeps the
64
+ * default dashed outline. Default 'plain'.
65
+ */
66
+ tone?: "plain" | "panel";
67
+ /** Custom link element for action hrefs (Next Link, react-router Link). */
68
+ linkComponent?: React.ElementType;
69
+ /** Prop used to pass the destination to `linkComponent`. */
70
+ linkHrefProp?: "href" | "to";
47
71
  } & React.RefAttributes<HTMLDivElement>>;
@@ -38,11 +38,13 @@ var import_Button = require("../button/Button.js");
38
38
  function isActionObject(value) {
39
39
  return typeof value === "object" && value !== null && !React.isValidElement(value) && "label" in value;
40
40
  }
41
- function renderAction(action) {
41
+ function renderAction(action, linkComponent, linkHrefProp = "href") {
42
42
  if (!isActionObject(action)) return action;
43
43
  const { label, onClick, href, variant } = action;
44
44
  if (href) {
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { variant, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href, children: label }) });
45
+ const LinkEl = linkComponent ?? "a";
46
+ const destination = linkHrefProp === "to" ? { to: href } : { href };
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { variant, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LinkEl, { ...destination, children: label }) });
46
48
  }
47
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { variant, onClick, children: label });
48
50
  }
@@ -55,17 +57,25 @@ const EmptyState = React.forwardRef(function EmptyState2({
55
57
  secondaryAction,
56
58
  titleAs: Title = "p",
57
59
  size = "md",
60
+ align = "center",
61
+ tone = "plain",
62
+ linkComponent,
63
+ linkHrefProp = "href",
58
64
  className,
59
65
  children,
60
66
  ...props
61
67
  }, ref) {
62
- const primaryAction = renderAction(action) ?? actions;
68
+ const primaryAction = renderAction(action, linkComponent, linkHrefProp) ?? actions;
69
+ const start = align === "start";
63
70
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
64
71
  "div",
65
72
  {
66
73
  ref,
67
74
  className: (0, import_cn.cn)(
68
- "flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center",
75
+ "flex flex-col rounded-lg text-center",
76
+ start ? "items-start text-left" : "items-center text-center",
77
+ "justify-center",
78
+ tone === "panel" ? "border border-border bg-muted" : "border border-dashed border-border",
69
79
  size === "md" ? "gap-3 px-6 py-12" : "gap-2 px-4 py-6",
70
80
  className
71
81
  ),
@@ -73,9 +83,9 @@ const EmptyState = React.forwardRef(function EmptyState2({
73
83
  children: [
74
84
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground [&_svg]:size-8", children: icon }),
75
85
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, { className: (0, import_cn.cn)("font-semibold", size === "md" ? "text-base" : "text-sm"), children: title }),
76
- description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "max-w-sm text-sm text-muted-foreground", children: description }),
86
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: (0, import_cn.cn)("max-w-sm text-sm text-muted-foreground", start && "max-w-md"), children: description }),
77
87
  children,
78
- (primaryAction || secondaryAction) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-1 flex flex-wrap items-center justify-center gap-2", children: [
88
+ (primaryAction || secondaryAction) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("mt-1 flex flex-wrap items-center gap-2", start ? "justify-start" : "justify-center"), children: [
79
89
  primaryAction,
80
90
  secondaryAction
81
91
  ] })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(action: React.ReactNode | EmptyStateAction | undefined): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n return (\n <Button variant={variant} asChild>\n <a href={href}>{label}</a>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action) ?? actions;\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className=\"max-w-sm text-sm text-muted-foreground\">{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className=\"mt-1 flex flex-wrap items-center justify-center gap-2\">\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CQ;AA9CR,YAAuB;AACvB,gBAAmB;AACnB,oBAAyC;AA4BzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aAAa,QAAyE;AAC7F,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,WACE,4CAAC,wBAAO,SAAkB,SAAO,MAC/B,sDAAC,OAAE,MAAa,iBAAM,GACxB;AAAA,EAEJ;AACA,SACE,4CAAC,wBAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,MAAM,KAAK;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW;AAAA,QACT;AAAA,QACA,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,4CAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,4CAAC,SAAM,eAAW,cAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,4CAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,QAClF;AAAA,SACC,iBAAiB,oBACjB,6CAAC,SAAI,WAAU,yDACZ;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
1
+ {"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n /** Horizontal alignment of content and actions. Default 'center'. */\n align?: 'center' | 'start';\n /**\n * Surface treatment. 'panel' renders a tinted, solid-bordered surface for\n * content pages (typically paired with align=\"start\"); 'plain' keeps the\n * default dashed outline. Default 'plain'.\n */\n tone?: 'plain' | 'panel';\n /** Custom link element for action hrefs (Next Link, react-router Link). */\n linkComponent?: React.ElementType;\n /** Prop used to pass the destination to `linkComponent`. */\n linkHrefProp?: 'href' | 'to';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(\n action: React.ReactNode | EmptyStateAction | undefined,\n linkComponent?: React.ElementType,\n linkHrefProp: 'href' | 'to' = 'href'\n): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n const LinkEl = linkComponent ?? 'a';\n const destination = linkHrefProp === 'to' ? { to: href } : { href };\n return (\n <Button variant={variant} asChild>\n <LinkEl {...destination}>{label}</LinkEl>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n align = 'center',\n tone = 'plain',\n linkComponent,\n linkHrefProp = 'href',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action, linkComponent, linkHrefProp) ?? actions;\n const start = align === 'start';\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col rounded-lg text-center',\n start ? 'items-start text-left' : 'items-center text-center',\n 'justify-center',\n tone === 'panel'\n ? 'border border-border bg-muted'\n : 'border border-dashed border-border',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className={cn('max-w-sm text-sm text-muted-foreground', start && 'max-w-md')}>{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className={cn('mt-1 flex flex-wrap items-center gap-2', start ? 'justify-start' : 'justify-center')}>\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgEQ;AAhER,YAAuB;AACvB,gBAAmB;AACnB,oBAAyC;AAwCzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aACP,QACA,eACA,eAA8B,QACb;AACjB,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,UAAM,SAAS,iBAAiB;AAChC,UAAM,cAAc,iBAAiB,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE,KAAK;AAClE,WACE,4CAAC,wBAAO,SAAkB,SAAO,MAC/B,sDAAC,UAAQ,GAAG,aAAc,iBAAM,GAClC;AAAA,EAEJ;AACA,SACE,4CAAC,wBAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,QAAQ,eAAe,YAAY,KAAK;AAC3E,QAAM,QAAQ,UAAU;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW;AAAA,QACT;AAAA,QACA,QAAQ,0BAA0B;AAAA,QAClC;AAAA,QACA,SAAS,UACL,kCACA;AAAA,QACJ,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,4CAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,4CAAC,SAAM,eAAW,cAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,4CAAC,OAAE,eAAW,cAAG,0CAA0C,SAAS,UAAU,GAAI,uBAAY;AAAA,QAC7G;AAAA,SACC,iBAAiB,oBACjB,6CAAC,SAAI,eAAW,cAAG,0CAA0C,QAAQ,kBAAkB,gBAAgB,GACpG;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
@@ -5,11 +5,13 @@ import { Button } from "../button/Button.mjs";
5
5
  function isActionObject(value) {
6
6
  return typeof value === "object" && value !== null && !React.isValidElement(value) && "label" in value;
7
7
  }
8
- function renderAction(action) {
8
+ function renderAction(action, linkComponent, linkHrefProp = "href") {
9
9
  if (!isActionObject(action)) return action;
10
10
  const { label, onClick, href, variant } = action;
11
11
  if (href) {
12
- return /* @__PURE__ */ jsx(Button, { variant, asChild: true, children: /* @__PURE__ */ jsx("a", { href, children: label }) });
12
+ const LinkEl = linkComponent ?? "a";
13
+ const destination = linkHrefProp === "to" ? { to: href } : { href };
14
+ return /* @__PURE__ */ jsx(Button, { variant, asChild: true, children: /* @__PURE__ */ jsx(LinkEl, { ...destination, children: label }) });
13
15
  }
14
16
  return /* @__PURE__ */ jsx(Button, { variant, onClick, children: label });
15
17
  }
@@ -22,17 +24,25 @@ const EmptyState = React.forwardRef(function EmptyState2({
22
24
  secondaryAction,
23
25
  titleAs: Title = "p",
24
26
  size = "md",
27
+ align = "center",
28
+ tone = "plain",
29
+ linkComponent,
30
+ linkHrefProp = "href",
25
31
  className,
26
32
  children,
27
33
  ...props
28
34
  }, ref) {
29
- const primaryAction = renderAction(action) ?? actions;
35
+ const primaryAction = renderAction(action, linkComponent, linkHrefProp) ?? actions;
36
+ const start = align === "start";
30
37
  return /* @__PURE__ */ jsxs(
31
38
  "div",
32
39
  {
33
40
  ref,
34
41
  className: cn(
35
- "flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center",
42
+ "flex flex-col rounded-lg text-center",
43
+ start ? "items-start text-left" : "items-center text-center",
44
+ "justify-center",
45
+ tone === "panel" ? "border border-border bg-muted" : "border border-dashed border-border",
36
46
  size === "md" ? "gap-3 px-6 py-12" : "gap-2 px-4 py-6",
37
47
  className
38
48
  ),
@@ -40,9 +50,9 @@ const EmptyState = React.forwardRef(function EmptyState2({
40
50
  children: [
41
51
  icon && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground [&_svg]:size-8", children: icon }),
42
52
  /* @__PURE__ */ jsx(Title, { className: cn("font-semibold", size === "md" ? "text-base" : "text-sm"), children: title }),
43
- description && /* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-muted-foreground", children: description }),
53
+ description && /* @__PURE__ */ jsx("p", { className: cn("max-w-sm text-sm text-muted-foreground", start && "max-w-md"), children: description }),
44
54
  children,
45
- (primaryAction || secondaryAction) && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap items-center justify-center gap-2", children: [
55
+ (primaryAction || secondaryAction) && /* @__PURE__ */ jsxs("div", { className: cn("mt-1 flex flex-wrap items-center gap-2", start ? "justify-start" : "justify-center"), children: [
46
56
  primaryAction,
47
57
  secondaryAction
48
58
  ] })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(action: React.ReactNode | EmptyStateAction | undefined): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n return (\n <Button variant={variant} asChild>\n <a href={href}>{label}</a>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action) ?? actions;\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className=\"max-w-sm text-sm text-muted-foreground\">{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className=\"mt-1 flex flex-wrap items-center justify-center gap-2\">\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":"AA8CQ,cAgDA,YAhDA;AA9CR,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,cAAgC;AA4BzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aAAa,QAAyE;AAC7F,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,WACE,oBAAC,UAAO,SAAkB,SAAO,MAC/B,8BAAC,OAAE,MAAa,iBAAM,GACxB;AAAA,EAEJ;AACA,SACE,oBAAC,UAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,MAAM,KAAK;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,oBAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,oBAAC,SAAM,WAAW,GAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,oBAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,QAClF;AAAA,SACC,iBAAiB,oBACjB,qBAAC,SAAI,WAAU,yDACZ;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
1
+ {"version":3,"sources":["../../../../src/components/empty-state/EmptyState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../button/Button';\n\n/** Object form of `action`: EmptyState renders the button/link for you. */\nexport type EmptyStateAction = {\n label: React.ReactNode;\n onClick?: () => void;\n /** Renders an anchor (styled as a button) instead of a button. */\n href?: string;\n variant?: ButtonProps['variant'];\n};\n\nexport type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Icon or illustration shown above the title. */\n icon?: React.ReactNode;\n title: string;\n description?: string;\n /** Primary action: a rendered node, or an action object. */\n action?: React.ReactNode | EmptyStateAction;\n /** Alias for `action` for codebases that pass a list of actions. */\n actions?: React.ReactNode;\n /** Secondary action shown beside the primary one. */\n secondaryAction?: React.ReactNode;\n /** Heading level for the title. Defaults to a paragraph. */\n titleAs?: 'p' | 'h2' | 'h3' | 'h4';\n /** Compact padding for use inside panels and table bodies. */\n size?: 'sm' | 'md';\n /** Horizontal alignment of content and actions. Default 'center'. */\n align?: 'center' | 'start';\n /**\n * Surface treatment. 'panel' renders a tinted, solid-bordered surface for\n * content pages (typically paired with align=\"start\"); 'plain' keeps the\n * default dashed outline. Default 'plain'.\n */\n tone?: 'plain' | 'panel';\n /** Custom link element for action hrefs (Next Link, react-router Link). */\n linkComponent?: React.ElementType;\n /** Prop used to pass the destination to `linkComponent`. */\n linkHrefProp?: 'href' | 'to';\n};\n\nfunction isActionObject(value: unknown): value is EmptyStateAction {\n return (\n typeof value === 'object' &&\n value !== null &&\n !React.isValidElement(value) &&\n 'label' in value\n );\n}\n\n/** Normalizes the node and object forms into a single element. */\nfunction renderAction(\n action: React.ReactNode | EmptyStateAction | undefined,\n linkComponent?: React.ElementType,\n linkHrefProp: 'href' | 'to' = 'href'\n): React.ReactNode {\n if (!isActionObject(action)) return action;\n const { label, onClick, href, variant } = action;\n if (href) {\n const LinkEl = linkComponent ?? 'a';\n const destination = linkHrefProp === 'to' ? { to: href } : { href };\n return (\n <Button variant={variant} asChild>\n <LinkEl {...destination}>{label}</LinkEl>\n </Button>\n );\n }\n return (\n <Button variant={variant} onClick={onClick}>\n {label}\n </Button>\n );\n}\n\n/**\n * Placeholder for empty collections, zero-result searches and unconfigured\n * features. Keeps the title/description/action hierarchy consistent across\n * the product.\n */\nexport const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n actions,\n secondaryAction,\n titleAs: Title = 'p',\n size = 'md',\n align = 'center',\n tone = 'plain',\n linkComponent,\n linkHrefProp = 'href',\n className,\n children,\n ...props\n },\n ref\n) {\n const primaryAction = renderAction(action, linkComponent, linkHrefProp) ?? actions;\n const start = align === 'start';\n return (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col rounded-lg text-center',\n start ? 'items-start text-left' : 'items-center text-center',\n 'justify-center',\n tone === 'panel'\n ? 'border border-border bg-muted'\n : 'border border-dashed border-border',\n size === 'md' ? 'gap-3 px-6 py-12' : 'gap-2 px-4 py-6',\n className\n )}\n {...props}\n >\n {icon && <div className=\"text-muted-foreground [&_svg]:size-8\">{icon}</div>}\n <Title className={cn('font-semibold', size === 'md' ? 'text-base' : 'text-sm')}>{title}</Title>\n {description && <p className={cn('max-w-sm text-sm text-muted-foreground', start && 'max-w-md')}>{description}</p>}\n {children}\n {(primaryAction || secondaryAction) && (\n <div className={cn('mt-1 flex flex-wrap items-center gap-2', start ? 'justify-start' : 'justify-center')}>\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":"AAgEQ,cA0DA,YA1DA;AAhER,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,cAAgC;AAwCzC,SAAS,eAAe,OAA2C;AACjE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,eAAe,KAAK,KAC3B,WAAW;AAEf;AAGA,SAAS,aACP,QACA,eACA,eAA8B,QACb;AACjB,MAAI,CAAC,eAAe,MAAM,EAAG,QAAO;AACpC,QAAM,EAAE,OAAO,SAAS,MAAM,QAAQ,IAAI;AAC1C,MAAI,MAAM;AACR,UAAM,SAAS,iBAAiB;AAChC,UAAM,cAAc,iBAAiB,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE,KAAK;AAClE,WACE,oBAAC,UAAO,SAAkB,SAAO,MAC/B,8BAAC,UAAQ,GAAG,aAAc,iBAAM,GAClC;AAAA,EAEJ;AACA,SACE,oBAAC,UAAO,SAAkB,SACvB,iBACH;AAEJ;AAOO,MAAM,aAAa,MAAM,WAA4C,SAASA,YACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,QAAQ;AAAA,EACjB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,gBAAgB,aAAa,QAAQ,eAAe,YAAY,KAAK;AAC3E,QAAM,QAAQ,UAAU;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,QAAQ,0BAA0B;AAAA,QAClC;AAAA,QACA,SAAS,UACL,kCACA;AAAA,QACJ,SAAS,OAAO,qBAAqB;AAAA,QACrC;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,oBAAC,SAAI,WAAU,wCAAwC,gBAAK;AAAA,QACrE,oBAAC,SAAM,WAAW,GAAG,iBAAiB,SAAS,OAAO,cAAc,SAAS,GAAI,iBAAM;AAAA,QACtF,eAAe,oBAAC,OAAE,WAAW,GAAG,0CAA0C,SAAS,UAAU,GAAI,uBAAY;AAAA,QAC7G;AAAA,SACC,iBAAiB,oBACjB,qBAAC,SAAI,WAAW,GAAG,0CAA0C,QAAQ,kBAAkB,gBAAgB,GACpG;AAAA;AAAA,UACA;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["EmptyState"]}
@@ -18,6 +18,8 @@ export type ImageProps = {
18
18
  className?: string;
19
19
  /** Classes for the image when a consumer wants to keep them separate. */
20
20
  imgClassName?: string;
21
+ /** Responsive `sizes` hint for the browser's source selection. */
22
+ sizes?: string;
21
23
  style?: React.CSSProperties;
22
24
  };
23
25
  /**
@@ -28,7 +30,7 @@ export type ImageProps = {
28
30
  * intrinsic dimensions are always rendered and only the priority image is
29
31
  * eager.
30
32
  */
31
- export declare function Image({ src, alt, fallbackSrc, fallback, priority, width, height, className, imgClassName, style, }: ImageProps): React.JSX.Element;
33
+ export declare function Image({ src, alt, fallbackSrc, fallback, priority, width, height, className, imgClassName, sizes, style, }: ImageProps): React.JSX.Element;
32
34
  export declare namespace Image {
33
35
  var displayName: string;
34
36
  }
@@ -45,6 +45,7 @@ function Image({
45
45
  height = 630,
46
46
  className,
47
47
  imgClassName,
48
+ sizes,
48
49
  style
49
50
  }) {
50
51
  const [stage, setStage] = React.useState(0);
@@ -66,6 +67,7 @@ function Image({
66
67
  loading: priority ? "eager" : "lazy",
67
68
  fetchPriority: priority ? "high" : "auto",
68
69
  decoding: "async",
70
+ sizes,
69
71
  className: (0, import_cn.cn)(className, imgClassName),
70
72
  style,
71
73
  onError
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n // Restart the src -> fallbackSrc -> fallback chain whenever the URLs\n // change, so a reused component never sticks on a stale fallback.\n const [prevUrls, setPrevUrls] = React.useState({ src, fallbackSrc });\n if (prevUrls.src !== src || prevUrls.fallbackSrc !== fallbackSrc) {\n setPrevUrls({ src, fallbackSrc });\n setStage(0);\n }\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DsC;AAzDtC,YAAuB;AACvB,gBAAmB;AAgCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAGrD,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC;AACnE,MAAI,SAAS,QAAQ,OAAO,SAAS,gBAAgB,aAAa;AAChE,gBAAY,EAAE,KAAK,YAAY,CAAC;AAChC,aAAS,CAAC;AAAA,EACZ;AAEA,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,2EAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT,eAAW,cAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}
1
+ {"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n /** Responsive `sizes` hint for the browser's source selection. */\n sizes?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n sizes,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n // Restart the src -> fallbackSrc -> fallback chain whenever the URLs\n // change, so a reused component never sticks on a stale fallback.\n const [prevUrls, setPrevUrls] = React.useState({ src, fallbackSrc });\n if (prevUrls.src !== src || prevUrls.fallbackSrc !== fallbackSrc) {\n setPrevUrls({ src, fallbackSrc });\n setStage(0);\n }\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n sizes={sizes}\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DsC;AA5DtC,YAAuB;AACvB,gBAAmB;AAkCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAGrD,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC;AACnE,MAAI,SAAS,QAAQ,OAAO,SAAS,gBAAgB,aAAa;AAChE,gBAAY,EAAE,KAAK,YAAY,CAAC;AAChC,aAAS,CAAC;AAAA,EACZ;AAEA,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,2EAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT;AAAA,MACA,eAAW,cAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}
@@ -12,6 +12,7 @@ function Image({
12
12
  height = 630,
13
13
  className,
14
14
  imgClassName,
15
+ sizes,
15
16
  style
16
17
  }) {
17
18
  const [stage, setStage] = React.useState(0);
@@ -33,6 +34,7 @@ function Image({
33
34
  loading: priority ? "eager" : "lazy",
34
35
  fetchPriority: priority ? "high" : "auto",
35
36
  decoding: "async",
37
+ sizes,
36
38
  className: cn(className, imgClassName),
37
39
  style,
38
40
  onError
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n // Restart the src -> fallbackSrc -> fallback chain whenever the URLs\n // change, so a reused component never sticks on a stale fallback.\n const [prevUrls, setPrevUrls] = React.useState({ src, fallbackSrc });\n if (prevUrls.src !== src || prevUrls.fallbackSrc !== fallbackSrc) {\n setPrevUrls({ src, fallbackSrc });\n setStage(0);\n }\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";AA2DsC;AAzDtC,YAAY,WAAW;AACvB,SAAS,UAAU;AAgCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAGrD,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC;AACnE,MAAI,SAAS,QAAQ,OAAO,SAAS,gBAAgB,aAAa;AAChE,gBAAY,EAAE,KAAK,YAAY,CAAC;AAChC,aAAS,CAAC;AAAA,EACZ;AAEA,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,gCAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT,WAAW,GAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}
1
+ {"version":3,"sources":["../../../../src/components/image/Image.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ImageProps = {\n /** Primary image URL. Hotlinked sources are expected. */\n src: string;\n /** Required: describes the image, not the component. */\n alt: string;\n /** Second chance before the fallback node (e.g. generated placeholder art). */\n fallbackSrc?: string;\n /** Rendered when every URL has failed (icon, initials, empty panel). */\n fallback?: React.ReactNode;\n /** Load eagerly and fetch at high priority for the LCP image. */\n priority?: boolean;\n /** Intrinsic width; always emitted so the browser reserves space. */\n width?: number;\n /** Intrinsic height; always emitted so the browser reserves space. */\n height?: number;\n /** Classes for the image; merged with imgClassName. */\n className?: string;\n /** Classes for the image when a consumer wants to keep them separate. */\n imgClassName?: string;\n /** Responsive `sizes` hint for the browser's source selection. */\n sizes?: string;\n style?: React.CSSProperties;\n};\n\n/**\n * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.\n *\n * Organizer images are hotlinked and occasionally 403, move, or die. Cards\n * must never show a broken-image box or shift layout when that happens, so\n * intrinsic dimensions are always rendered and only the priority image is\n * eager.\n */\nexport function Image({\n src,\n alt,\n fallbackSrc,\n fallback,\n priority = false,\n width = 1200,\n height = 630,\n className,\n imgClassName,\n sizes,\n style,\n}: ImageProps) {\n const [stage, setStage] = React.useState<0 | 1 | 2>(0);\n // Restart the src -> fallbackSrc -> fallback chain whenever the URLs\n // change, so a reused component never sticks on a stale fallback.\n const [prevUrls, setPrevUrls] = React.useState({ src, fallbackSrc });\n if (prevUrls.src !== src || prevUrls.fallbackSrc !== fallbackSrc) {\n setPrevUrls({ src, fallbackSrc });\n setStage(0);\n }\n\n const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));\n const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;\n\n if (!current || stage === 2) return <>{fallback ?? null}</>;\n\n return (\n <img\n src={current}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? 'eager' : 'lazy'}\n fetchPriority={priority ? 'high' : 'auto'}\n decoding=\"async\"\n sizes={sizes}\n className={cn(className, imgClassName)}\n style={style}\n onError={onError}\n />\n );\n}\n\nImage.displayName = 'Image';\n"],"mappings":";AA8DsC;AA5DtC,YAAY,WAAW;AACvB,SAAS,UAAU;AAkCZ,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAoB,CAAC;AAGrD,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC;AACnE,MAAI,SAAS,QAAQ,OAAO,SAAS,gBAAgB,aAAa;AAChE,gBAAY,EAAE,KAAK,YAAY,CAAC;AAChC,aAAS,CAAC;AAAA,EACZ;AAEA,QAAM,UAAU,MAAM,SAAS,CAACA,aAAaA,aAAY,KAAK,cAAc,IAAI,CAAE;AAClF,QAAM,UAAU,UAAU,IAAI,MAAM,UAAU,IAAI,cAAc;AAEhE,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO,gCAAG,sBAAY,MAAK;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,UAAU;AAAA,MAC9B,eAAe,WAAW,SAAS;AAAA,MACnC,UAAS;AAAA,MACT;AAAA,MACA,WAAW,GAAG,WAAW,YAAY;AAAA,MACrC;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,cAAc;","names":["current"]}