@acronis-platform/ui-react 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { cn as a } from "../../../lib/utils.js";
4
+ const o = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t("dl", { ref: i, className: a("w-full", s), ...e }));
5
+ o.displayName = "DescriptionList";
6
+ const c = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t(
7
+ "div",
8
+ {
9
+ ref: i,
10
+ className: a(
11
+ // `px-6` insets the content while the `border-t` divider stays full-bleed
12
+ // (the Figma card look). Override the padding via className when the
13
+ // surrounding container already pads (e.g. `-mx-6` inside a padded body).
14
+ "grid grid-cols-[var(--description-list-label,14rem)_minmax(0,1fr)] gap-x-4 border-t border-border px-6 py-3 text-sm leading-6",
15
+ s
16
+ ),
17
+ ...e
18
+ }
19
+ ));
20
+ c.displayName = "DescriptionListItem";
21
+ const n = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t("dt", { ref: i, className: a("text-foreground", s), ...e }));
22
+ n.displayName = "DescriptionListLabel";
23
+ const p = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t(
24
+ "dd",
25
+ {
26
+ ref: i,
27
+ className: a(
28
+ "flex min-w-0 items-start gap-2 text-foreground [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",
29
+ s
30
+ ),
31
+ ...e
32
+ }
33
+ ));
34
+ p.displayName = "DescriptionListValue";
35
+ const d = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t("p", { ref: i, className: a("text-muted-foreground", s), ...e }));
36
+ d.displayName = "DescriptionListValueDescription";
37
+ const l = r.forwardRef(({ className: s, ...e }, i) => /* @__PURE__ */ t(
38
+ "div",
39
+ {
40
+ ref: i,
41
+ className: a("flex flex-wrap items-center gap-4", s),
42
+ ...e
43
+ }
44
+ ));
45
+ l.displayName = "DescriptionListActions";
46
+ export {
47
+ o as DescriptionList,
48
+ l as DescriptionListActions,
49
+ c as DescriptionListItem,
50
+ n as DescriptionListLabel,
51
+ p as DescriptionListValue,
52
+ d as DescriptionListValueDescription
53
+ };
54
+ //# sourceMappingURL=description-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"description-list.js","sources":["../../../../src/components/ui/description-list/description-list.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// A key/value data list — rows of `label → value`, where the value can be plain\n// text, a status (leading icon + value + a muted description), or action links.\n// Built from the Figma \"Service status\" design (Cyber-Compliance node\n// 3001-20448). Semantic HTML: a `<dl>` of `<div>`-grouped `<dt>`/`<dd>` rows.\n// No `--ui-description-list-*` tier — it composes the shared semantic tokens:\n// • label / value -> text-foreground (--ui-text-on-surface-primary)\n// • description -> text-muted-foreground (--ui-text-on-surface-secondary)\n// • row divider -> border-border (--ui-border-on-surface-border)\n// • status icon color -> caller-provided (--ui-text-on-status-*)\n// • action links -> compose the `Link` component\n// The 2-column row grid uses a fixed label column (overridable per item via\n// className / the `--description-list-label` custom property).\n\nconst DescriptionList = React.forwardRef<\n HTMLDListElement,\n React.HTMLAttributes<HTMLDListElement>\n>(({ className, ...props }, ref) => (\n <dl ref={ref} className={cn('w-full', className)} {...props} />\n));\nDescriptionList.displayName = 'DescriptionList';\n\nconst DescriptionListItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n // `px-6` insets the content while the `border-t` divider stays full-bleed\n // (the Figma card look). Override the padding via className when the\n // surrounding container already pads (e.g. `-mx-6` inside a padded body).\n 'grid grid-cols-[var(--description-list-label,14rem)_minmax(0,1fr)] gap-x-4 border-t border-border px-6 py-3 text-sm leading-6',\n className\n )}\n {...props}\n />\n));\nDescriptionListItem.displayName = 'DescriptionListItem';\n\nconst DescriptionListLabel = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <dt ref={ref} className={cn('text-foreground', className)} {...props} />\n));\nDescriptionListLabel.displayName = 'DescriptionListLabel';\n\nconst DescriptionListValue = React.forwardRef<\n HTMLElement,\n React.HTMLAttributes<HTMLElement>\n>(({ className, ...props }, ref) => (\n <dd\n ref={ref}\n className={cn(\n 'flex min-w-0 items-start gap-2 text-foreground [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0',\n className\n )}\n {...props}\n />\n));\nDescriptionListValue.displayName = 'DescriptionListValue';\n\nconst DescriptionListValueDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p ref={ref} className={cn('text-muted-foreground', className)} {...props} />\n));\nDescriptionListValueDescription.displayName = 'DescriptionListValueDescription';\n\nconst DescriptionListActions = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('flex flex-wrap items-center gap-4', className)}\n {...props}\n />\n));\nDescriptionListActions.displayName = 'DescriptionListActions';\n\nexport {\n DescriptionList,\n DescriptionListItem,\n DescriptionListLabel,\n DescriptionListValue,\n DescriptionListValueDescription,\n DescriptionListActions,\n};\n"],"names":["DescriptionList","React","className","props","ref","cn","DescriptionListItem","jsx","DescriptionListLabel","DescriptionListValue","DescriptionListValueDescription","DescriptionListActions"],"mappings":";;;AAiBA,MAAMA,IAAkBC,EAAM,WAG5B,CAAC,EAAE,WAAAC,GAAW,GAAGC,KAASC,wBACzB,MAAA,EAAG,KAAAA,GAAU,WAAWC,EAAG,UAAUH,CAAS,GAAI,GAAGC,GAAO,CAC9D;AACDH,EAAgB,cAAc;AAE9B,MAAMM,IAAsBL,EAAM,WAGhC,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAG;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAH;AAAA,IACA,WAAWC;AAAA;AAAA;AAAA;AAAA,MAIT;AAAA,MACAH;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDG,EAAoB,cAAc;AAElC,MAAME,IAAuBP,EAAM,WAGjC,CAAC,EAAE,WAAAC,GAAW,GAAGC,KAASC,wBACzB,MAAA,EAAG,KAAAA,GAAU,WAAWC,EAAG,mBAAmBH,CAAS,GAAI,GAAGC,GAAO,CACvE;AACDK,EAAqB,cAAc;AAEnC,MAAMC,IAAuBR,EAAM,WAGjC,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAG;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAH;AAAA,IACA,WAAWC;AAAA,MACT;AAAA,MACAH;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDM,EAAqB,cAAc;AAEnC,MAAMC,IAAkCT,EAAM,WAG5C,CAAC,EAAE,WAAAC,GAAW,GAAGC,KAASC,wBACzB,KAAA,EAAE,KAAAA,GAAU,WAAWC,EAAG,yBAAyBH,CAAS,GAAI,GAAGC,GAAO,CAC5E;AACDO,EAAgC,cAAc;AAE9C,MAAMC,IAAyBV,EAAM,WAGnC,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAG;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAH;AAAA,IACA,WAAWC,EAAG,qCAAqCH,CAAS;AAAA,IAC3D,GAAGC;AAAA,EAAA;AACN,CACD;AACDQ,EAAuB,cAAc;"}
@@ -0,0 +1,80 @@
1
+ import { jsxs as l, jsx as e, Fragment as S } from "react/jsx-runtime";
2
+ import { Sheet as g, SheetTrigger as D, SheetContent as x, SheetHeader as N, SheetTitle as E, SheetCloseButton as L, SheetBody as T, SheetFooter as b } from "./sheet.js";
3
+ import { Spinner as j } from "../spinner/spinner.js";
4
+ import { Empty as w, EmptyHeader as B, EmptyTitle as v, EmptyDescription as C } from "../empty/empty.js";
5
+ import { DescriptionList as F, DescriptionListItem as H, DescriptionListLabel as I, DescriptionListValue as V } from "../description-list/description-list.js";
6
+ function k({
7
+ contentState: t,
8
+ properties: i,
9
+ children: n,
10
+ emptyTitle: h,
11
+ emptyDescription: d,
12
+ errorTitle: m,
13
+ errorDescription: s
14
+ }) {
15
+ if (t === "loading")
16
+ return /* @__PURE__ */ e("div", { className: "flex h-40 items-center justify-center", children: /* @__PURE__ */ e(j, {}) });
17
+ if (t === "empty" || t === "error") {
18
+ const r = t === "error";
19
+ return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ l(B, { children: [
20
+ /* @__PURE__ */ e(v, { children: r ? m ?? "Something went wrong" : h ?? "Nothing to show" }),
21
+ /* @__PURE__ */ e(C, { children: r ? s ?? "The details could not be loaded." : d ?? "There are no details to display yet." })
22
+ ] }) });
23
+ }
24
+ return n ? /* @__PURE__ */ e(S, { children: n }) : i != null && i.length ? /* @__PURE__ */ e(
25
+ F,
26
+ {
27
+ className: "-mx-6",
28
+ style: { "--description-list-label": "9rem" },
29
+ children: i.map((r, o) => /* @__PURE__ */ l(H, { children: [
30
+ /* @__PURE__ */ e(I, { className: "text-muted-foreground", children: r.label }),
31
+ /* @__PURE__ */ e(V, { className: "font-medium", children: r.value })
32
+ ] }, o))
33
+ }
34
+ ) : null;
35
+ }
36
+ function q({
37
+ open: t,
38
+ defaultOpen: i,
39
+ onOpenChange: n,
40
+ title: h,
41
+ side: d = "right",
42
+ contentState: m = "content",
43
+ properties: s,
44
+ children: r,
45
+ actions: o,
46
+ trigger: c,
47
+ emptyTitle: a,
48
+ emptyDescription: u,
49
+ errorTitle: f,
50
+ errorDescription: y,
51
+ portalContainer: p
52
+ }) {
53
+ return /* @__PURE__ */ l(g, { open: t, defaultOpen: i, onOpenChange: n, children: [
54
+ c ? /* @__PURE__ */ e(D, { render: c }) : null,
55
+ /* @__PURE__ */ l(x, { side: d, portalContainer: p, children: [
56
+ /* @__PURE__ */ l(N, { children: [
57
+ /* @__PURE__ */ e(E, { children: h }),
58
+ /* @__PURE__ */ e(L, {})
59
+ ] }),
60
+ /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(
61
+ k,
62
+ {
63
+ contentState: m,
64
+ properties: s,
65
+ emptyTitle: a,
66
+ emptyDescription: u,
67
+ errorTitle: f,
68
+ errorDescription: y,
69
+ children: r
70
+ }
71
+ ) }),
72
+ o ? /* @__PURE__ */ e(b, { children: o }) : null
73
+ ] })
74
+ ] });
75
+ }
76
+ q.displayName = "SheetDetails";
77
+ export {
78
+ q as SheetDetails
79
+ };
80
+ //# sourceMappingURL=sheet-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet-details.js","sources":["../../../../src/components/ui/sheet/sheet-details.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n DescriptionList,\n DescriptionListItem,\n DescriptionListLabel,\n DescriptionListValue,\n} from '../description-list';\nimport {\n Empty,\n EmptyDescription,\n EmptyHeader,\n EmptyTitle,\n} from '../empty';\nimport { Spinner } from '../spinner';\nimport {\n Sheet,\n SheetBody,\n SheetCloseButton,\n type SheetContentProps,\n SheetContent,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n} from './sheet';\n\n// `SheetDetails` is the preset for the `sheet-detail-panel` usage pattern — the\n// \"easy path that IS the pattern\". It bakes a right-anchored Sheet's header\n// (title + close), a body that switches by `contentState`\n// (loading → Spinner, empty/error → Empty, else a key/value property list or\n// custom children), and an optional footer of actions — so consumers don't\n// re-assemble (or hand-roll) the recipe. For anything outside the recipe, compose\n// the `Sheet*` parts directly. (React composition of the Vue kit's `Details`.)\n\nexport interface SheetDetailsProperty {\n label: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport type SheetDetailsContentState = 'content' | 'loading' | 'empty' | 'error';\n\nexport interface SheetDetailsProps {\n /** Controlled open state. Pair with `onOpenChange`. */\n open?: boolean;\n /** Initial open state when uncontrolled. */\n defaultOpen?: boolean;\n /** Fires when the sheet opens or closes. */\n onOpenChange?: (open: boolean, eventDetails: unknown) => void;\n /** Panel title (header). Also the accessible name. */\n title: React.ReactNode;\n /** Edge the panel anchors to. Defaults to `right`. */\n side?: SheetContentProps['side'];\n /** Which body view to show. Defaults to `content`. */\n contentState?: SheetDetailsContentState;\n /** Key/value rows rendered as the body in the `content` state (unless `children`). */\n properties?: SheetDetailsProperty[];\n /** Custom body for the `content` state — overrides `properties`. */\n children?: React.ReactNode;\n /** Footer action(s). Omit for no footer. */\n actions?: React.ReactNode;\n /** Optional trigger element (rendered via the Sheet trigger's `render`). */\n trigger?: React.ReactElement;\n /** Empty-state copy (`contentState=\"empty\"`). */\n emptyTitle?: React.ReactNode;\n emptyDescription?: React.ReactNode;\n /** Error-state copy (`contentState=\"error\"`). */\n errorTitle?: React.ReactNode;\n errorDescription?: React.ReactNode;\n /** Portal container (shadow-root mount for isolated previews). */\n portalContainer?: SheetContentProps['portalContainer'];\n}\n\nfunction SheetDetailsBody({\n contentState,\n properties,\n children,\n emptyTitle,\n emptyDescription,\n errorTitle,\n errorDescription,\n}: Pick<\n SheetDetailsProps,\n | 'contentState'\n | 'properties'\n | 'children'\n | 'emptyTitle'\n | 'emptyDescription'\n | 'errorTitle'\n | 'errorDescription'\n>) {\n if (contentState === 'loading') {\n return (\n <div className=\"flex h-40 items-center justify-center\">\n <Spinner />\n </div>\n );\n }\n if (contentState === 'empty' || contentState === 'error') {\n const isError = contentState === 'error';\n return (\n <Empty>\n <EmptyHeader>\n <EmptyTitle>\n {isError\n ? (errorTitle ?? 'Something went wrong')\n : (emptyTitle ?? 'Nothing to show')}\n </EmptyTitle>\n <EmptyDescription>\n {isError\n ? (errorDescription ?? 'The details could not be loaded.')\n : (emptyDescription ?? 'There are no details to display yet.')}\n </EmptyDescription>\n </EmptyHeader>\n </Empty>\n );\n }\n if (children) return <>{children}</>;\n if (properties?.length) {\n // Render through DescriptionList. `-mx-6` cancels the SheetBody padding so\n // the row dividers go full-bleed while the content stays aligned at the\n // panel's 24px inset; the label column is tightened for the narrow panel.\n return (\n <DescriptionList\n className=\"-mx-6\"\n style={{ '--description-list-label': '9rem' } as React.CSSProperties}\n >\n {properties.map((p, i) => (\n <DescriptionListItem key={i}>\n <DescriptionListLabel className=\"text-muted-foreground\">\n {p.label}\n </DescriptionListLabel>\n <DescriptionListValue className=\"font-medium\">\n {p.value}\n </DescriptionListValue>\n </DescriptionListItem>\n ))}\n </DescriptionList>\n );\n }\n return null;\n}\n\nfunction SheetDetails({\n open,\n defaultOpen,\n onOpenChange,\n title,\n side = 'right',\n contentState = 'content',\n properties,\n children,\n actions,\n trigger,\n emptyTitle,\n emptyDescription,\n errorTitle,\n errorDescription,\n portalContainer,\n}: SheetDetailsProps) {\n return (\n <Sheet open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {trigger ? <SheetTrigger render={trigger} /> : null}\n <SheetContent side={side} portalContainer={portalContainer}>\n <SheetHeader>\n <SheetTitle>{title}</SheetTitle>\n <SheetCloseButton />\n </SheetHeader>\n <SheetBody>\n <SheetDetailsBody\n contentState={contentState}\n properties={properties}\n emptyTitle={emptyTitle}\n emptyDescription={emptyDescription}\n errorTitle={errorTitle}\n errorDescription={errorDescription}\n >\n {children}\n </SheetDetailsBody>\n </SheetBody>\n {actions ? <SheetFooter>{actions}</SheetFooter> : null}\n </SheetContent>\n </Sheet>\n );\n}\nSheetDetails.displayName = 'SheetDetails';\n\nexport { SheetDetails };\n"],"names":["SheetDetailsBody","contentState","properties","children","emptyTitle","emptyDescription","errorTitle","errorDescription","jsx","Spinner","isError","Empty","jsxs","EmptyHeader","EmptyTitle","EmptyDescription","Fragment","DescriptionList","p","i","DescriptionListItem","DescriptionListLabel","DescriptionListValue","SheetDetails","open","defaultOpen","onOpenChange","title","side","actions","trigger","portalContainer","Sheet","SheetTrigger","SheetContent","SheetHeader","SheetTitle","SheetCloseButton","SheetBody","SheetFooter"],"mappings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