@slipstream-ui/core 0.11.3 → 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.
- package/dist/index.d.mts +126 -7
- package/dist/index.d.ts +126 -7
- package/dist/index.js +605 -444
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +500 -340
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +1 -1
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +1 -1
- package/dist/manifests/app-shell.manifest.json +1 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +1 -1
- package/dist/manifests/auth-layout.manifest.json +1 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +1 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +1 -1
- package/dist/manifests/breadcrumb.manifest.json +1 -1
- package/dist/manifests/button-group.manifest.json +1 -1
- package/dist/manifests/button.manifest.json +1 -1
- package/dist/manifests/calendar.manifest.json +1 -1
- package/dist/manifests/card.manifest.json +1 -1
- package/dist/manifests/checkbox.manifest.json +1 -1
- package/dist/manifests/comparison-table.manifest.json +1 -1
- package/dist/manifests/confirm-dialog.manifest.json +1 -1
- package/dist/manifests/contact-strip.manifest.json +1 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cover-image.manifest.json +151 -0
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +1 -1
- package/dist/manifests/date-picker-popover.manifest.json +1 -1
- package/dist/manifests/date-picker.manifest.json +1 -1
- package/dist/manifests/date-range-picker.manifest.json +1 -1
- package/dist/manifests/deal-card.manifest.json +1 -1
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +1 -1
- package/dist/manifests/drawer.manifest.json +1 -1
- package/dist/manifests/empty-state.manifest.json +45 -1
- package/dist/manifests/entity-card.manifest.json +1 -1
- package/dist/manifests/feature-grid.manifest.json +1 -1
- package/dist/manifests/feature-row.manifest.json +1 -1
- package/dist/manifests/fieldset.manifest.json +1 -1
- package/dist/manifests/file-upload.manifest.json +1 -1
- package/dist/manifests/filter-bar.manifest.json +1 -1
- package/dist/manifests/filter-chips.manifest.json +1 -1
- package/dist/manifests/filter-panel.manifest.json +1 -1
- package/dist/manifests/flex.manifest.json +1 -1
- package/dist/manifests/form-field.manifest.json +1 -1
- package/dist/manifests/form-layout.manifest.json +16 -4
- package/dist/manifests/form.manifest.json +1 -1
- package/dist/manifests/grid.manifest.json +1 -1
- package/dist/manifests/heading.manifest.json +1 -1
- package/dist/manifests/hero.manifest.json +1 -1
- package/dist/manifests/image.manifest.json +7 -1
- package/dist/manifests/input-group.manifest.json +1 -1
- package/dist/manifests/input.manifest.json +1 -1
- package/dist/manifests/label.manifest.json +1 -1
- package/dist/manifests/link-tabs.manifest.json +1 -1
- package/dist/manifests/link.manifest.json +1 -1
- package/dist/manifests/list.manifest.json +1 -1
- package/dist/manifests/load-more.manifest.json +1 -1
- package/dist/manifests/logo-cloud.manifest.json +1 -1
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +1 -1
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +1 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +1 -1
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +29 -2
- package/dist/manifests/select-menu.manifest.json +1 -1
- package/dist/manifests/select.manifest.json +1 -1
- package/dist/manifests/separator.manifest.json +1 -1
- package/dist/manifests/site-footer.manifest.json +1 -1
- package/dist/manifests/site-header.manifest.json +1 -1
- package/dist/manifests/skeleton.manifest.json +1 -1
- package/dist/manifests/spinner.manifest.json +1 -1
- package/dist/manifests/stat-band.manifest.json +23 -1
- package/dist/manifests/stepper.manifest.json +1 -1
- package/dist/manifests/switch.manifest.json +1 -1
- package/dist/manifests/table-card.manifest.json +1 -1
- package/dist/manifests/table-of-contents.manifest.json +1 -1
- package/dist/manifests/table.manifest.json +1 -1
- package/dist/manifests/tabs.manifest.json +1 -1
- package/dist/manifests/testimonial.manifest.json +1 -1
- package/dist/manifests/text.manifest.json +1 -1
- package/dist/manifests/textarea.manifest.json +1 -1
- package/dist/manifests/theme-toggle.manifest.json +1 -1
- package/dist/manifests/time-picker.manifest.json +1 -1
- package/dist/manifests/timeline.manifest.json +1 -1
- package/dist/manifests/toast.manifest.json +1 -1
- package/dist/manifests/tombstone-card.manifest.json +1 -1
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/cover-image/CoverImage.d.ts +34 -0
- package/dist/src/components/cover-image/CoverImage.js +94 -0
- package/dist/src/components/cover-image/CoverImage.js.map +1 -0
- package/dist/src/components/cover-image/CoverImage.mjs +70 -0
- package/dist/src/components/cover-image/CoverImage.mjs.map +1 -0
- package/dist/src/components/cover-image/index.d.ts +1 -0
- package/dist/src/components/cover-image/index.js +29 -0
- package/dist/src/components/cover-image/index.js.map +1 -0
- package/dist/src/components/cover-image/index.mjs +5 -0
- package/dist/src/components/cover-image/index.mjs.map +1 -0
- package/dist/src/components/empty-state/EmptyState.d.ts +24 -0
- package/dist/src/components/empty-state/EmptyState.js +16 -6
- package/dist/src/components/empty-state/EmptyState.js.map +1 -1
- package/dist/src/components/empty-state/EmptyState.mjs +16 -6
- package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
- package/dist/src/components/form-layout/FormLayout.d.ts +26 -4
- package/dist/src/components/form-layout/FormLayout.js +16 -3
- package/dist/src/components/form-layout/FormLayout.js.map +1 -1
- package/dist/src/components/form-layout/FormLayout.mjs +16 -3
- package/dist/src/components/form-layout/FormLayout.mjs.map +1 -1
- package/dist/src/components/image/Image.d.ts +3 -1
- package/dist/src/components/image/Image.js +2 -0
- package/dist/src/components/image/Image.js.map +1 -1
- package/dist/src/components/image/Image.mjs +2 -0
- package/dist/src/components/image/Image.mjs.map +1 -1
- package/dist/src/components/segmented-control/SegmentedControl.d.ts +21 -0
- package/dist/src/components/segmented-control/SegmentedControl.js +47 -16
- package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/src/components/segmented-control/SegmentedControl.mjs +48 -17
- package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
- package/dist/src/components/stat-band/StatBand.d.ts +16 -0
- package/dist/src/components/stat-band/StatBand.js +46 -9
- package/dist/src/components/stat-band/StatBand.js.map +1 -1
- package/dist/src/components/stat-band/StatBand.mjs +46 -9
- package/dist/src/components/stat-band/StatBand.mjs.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/cover-image/CoverImage.test.tsx +88 -0
- package/src/components/cover-image/CoverImage.tsx +109 -0
- package/src/components/cover-image/index.ts +1 -0
- package/src/components/empty-state/EmptyState.test.tsx +33 -0
- package/src/components/empty-state/EmptyState.tsx +34 -6
- package/src/components/form-layout/FormLayout.test.tsx +26 -0
- package/src/components/form-layout/FormLayout.tsx +37 -5
- package/src/components/image/Image.tsx +4 -0
- package/src/components/segmented-control/SegmentedControl.test.tsx +64 -0
- package/src/components/segmented-control/SegmentedControl.tsx +69 -15
- package/src/components/stat-band/StatBand.test.tsx +26 -0
- package/src/components/stat-band/StatBand.tsx +52 -7
- package/src/index.ts +1 -0
- package/src/manifests/accordion.manifest.json +1 -1
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +1 -1
- package/src/manifests/app-shell.manifest.json +1 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +1 -1
- package/src/manifests/auth-layout.manifest.json +1 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +1 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +1 -1
- package/src/manifests/breadcrumb.manifest.json +1 -1
- package/src/manifests/button-group.manifest.json +1 -1
- package/src/manifests/button.manifest.json +1 -1
- package/src/manifests/calendar.manifest.json +1 -1
- package/src/manifests/card.manifest.json +1 -1
- package/src/manifests/checkbox.manifest.json +1 -1
- package/src/manifests/comparison-table.manifest.json +1 -1
- package/src/manifests/confirm-dialog.manifest.json +1 -1
- package/src/manifests/contact-strip.manifest.json +1 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cover-image.manifest.json +151 -0
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +1 -1
- package/src/manifests/date-picker-popover.manifest.json +1 -1
- package/src/manifests/date-picker.manifest.json +1 -1
- package/src/manifests/date-range-picker.manifest.json +1 -1
- package/src/manifests/deal-card.manifest.json +1 -1
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +1 -1
- package/src/manifests/drawer.manifest.json +1 -1
- package/src/manifests/empty-state.manifest.json +45 -1
- package/src/manifests/entity-card.manifest.json +1 -1
- package/src/manifests/feature-grid.manifest.json +1 -1
- package/src/manifests/feature-row.manifest.json +1 -1
- package/src/manifests/fieldset.manifest.json +1 -1
- package/src/manifests/file-upload.manifest.json +1 -1
- package/src/manifests/filter-bar.manifest.json +1 -1
- package/src/manifests/filter-chips.manifest.json +1 -1
- package/src/manifests/filter-panel.manifest.json +1 -1
- package/src/manifests/flex.manifest.json +1 -1
- package/src/manifests/form-field.manifest.json +1 -1
- package/src/manifests/form-layout.manifest.json +16 -4
- package/src/manifests/form.manifest.json +1 -1
- package/src/manifests/grid.manifest.json +1 -1
- package/src/manifests/heading.manifest.json +1 -1
- package/src/manifests/hero.manifest.json +1 -1
- package/src/manifests/image.manifest.json +7 -1
- package/src/manifests/input-group.manifest.json +1 -1
- package/src/manifests/input.manifest.json +1 -1
- package/src/manifests/label.manifest.json +1 -1
- package/src/manifests/link-tabs.manifest.json +1 -1
- package/src/manifests/link.manifest.json +1 -1
- package/src/manifests/list.manifest.json +1 -1
- package/src/manifests/load-more.manifest.json +1 -1
- package/src/manifests/logo-cloud.manifest.json +1 -1
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +1 -1
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +1 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +1 -1
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +29 -2
- package/src/manifests/select-menu.manifest.json +1 -1
- package/src/manifests/select.manifest.json +1 -1
- package/src/manifests/separator.manifest.json +1 -1
- package/src/manifests/site-footer.manifest.json +1 -1
- package/src/manifests/site-header.manifest.json +1 -1
- package/src/manifests/skeleton.manifest.json +1 -1
- package/src/manifests/spinner.manifest.json +1 -1
- package/src/manifests/stat-band.manifest.json +23 -1
- package/src/manifests/stepper.manifest.json +1 -1
- package/src/manifests/switch.manifest.json +1 -1
- package/src/manifests/table-card.manifest.json +1 -1
- package/src/manifests/table-of-contents.manifest.json +1 -1
- package/src/manifests/table.manifest.json +1 -1
- package/src/manifests/tabs.manifest.json +1 -1
- package/src/manifests/testimonial.manifest.json +1 -1
- package/src/manifests/text.manifest.json +1 -1
- package/src/manifests/textarea.manifest.json +1 -1
- package/src/manifests/theme-toggle.manifest.json +1 -1
- package/src/manifests/time-picker.manifest.json +1 -1
- package/src/manifests/timeline.manifest.json +1 -1
- package/src/manifests/toast.manifest.json +1 -1
- package/src/manifests/tombstone-card.manifest.json +1 -1
- package/src/manifests/tooltip.manifest.json +1 -1
- 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.
|
|
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.",
|
|
@@ -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 @@
|
|
|
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
|
-
|
|
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
|
|
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-
|
|
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 <
|
|
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
|
-
|
|
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
|
|
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-
|
|
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 <
|
|
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"]}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type GapValue } from '../../utils/gap';
|
|
3
|
+
/** Column count per breakpoint; `base` applies at every width. */
|
|
4
|
+
export type FormLayoutColumns = 1 | 2 | 3 | 4 | {
|
|
5
|
+
base?: 1 | 2 | 3 | 4;
|
|
6
|
+
sm?: 1 | 2 | 3 | 4;
|
|
7
|
+
md?: 1 | 2 | 3 | 4;
|
|
8
|
+
lg?: 1 | 2 | 3 | 4;
|
|
9
|
+
xl?: 1 | 2 | 3 | 4;
|
|
10
|
+
};
|
|
3
11
|
export type FormLayoutProps = React.HTMLAttributes<HTMLElement> & {
|
|
4
12
|
/** Grouping layout: even vertical stack (default), horizontal row, or responsive grid. */
|
|
5
13
|
layout?: 'stack' | 'row' | 'grid';
|
|
6
|
-
/**
|
|
7
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Grid column count (1-4) at every width, or per breakpoint
|
|
16
|
+
* (`{ base: 1, md: 2 }`) for responsive grids without className overrides.
|
|
17
|
+
*/
|
|
18
|
+
columns?: FormLayoutColumns;
|
|
8
19
|
/** Even spacing between children — token ('md') or exact pixels (16). */
|
|
9
20
|
gap?: GapValue;
|
|
10
21
|
/** Group label; renders a semantic <legend> when as="fieldset". */
|
|
11
22
|
legend?: string;
|
|
23
|
+
/** Extra classes for the legend (fieldset mode). */
|
|
24
|
+
legendClassName?: string;
|
|
12
25
|
/** Supporting line under the legend (fieldset mode). */
|
|
13
26
|
description?: string;
|
|
27
|
+
/** Extra classes for the description (fieldset mode). */
|
|
28
|
+
descriptionClassName?: string;
|
|
14
29
|
/** Render as a semantic fieldset (default 'div'). */
|
|
15
30
|
as?: 'div' | 'fieldset';
|
|
16
31
|
};
|
|
@@ -23,14 +38,21 @@ export type FormLayoutProps = React.HTMLAttributes<HTMLElement> & {
|
|
|
23
38
|
declare const FormLayout: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
24
39
|
/** Grouping layout: even vertical stack (default), horizontal row, or responsive grid. */
|
|
25
40
|
layout?: "stack" | "row" | "grid";
|
|
26
|
-
/**
|
|
27
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Grid column count (1-4) at every width, or per breakpoint
|
|
43
|
+
* (`{ base: 1, md: 2 }`) for responsive grids without className overrides.
|
|
44
|
+
*/
|
|
45
|
+
columns?: FormLayoutColumns;
|
|
28
46
|
/** Even spacing between children — token ('md') or exact pixels (16). */
|
|
29
47
|
gap?: GapValue;
|
|
30
48
|
/** Group label; renders a semantic <legend> when as="fieldset". */
|
|
31
49
|
legend?: string;
|
|
50
|
+
/** Extra classes for the legend (fieldset mode). */
|
|
51
|
+
legendClassName?: string;
|
|
32
52
|
/** Supporting line under the legend (fieldset mode). */
|
|
33
53
|
description?: string;
|
|
54
|
+
/** Extra classes for the description (fieldset mode). */
|
|
55
|
+
descriptionClassName?: string;
|
|
34
56
|
/** Render as a semantic fieldset (default 'div'). */
|
|
35
57
|
as?: "div" | "fieldset";
|
|
36
58
|
} & React.RefAttributes<HTMLElement>>;
|