@a5it/sync-ui 0.1.39 → 0.1.40
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/components/cards/detail-line-item.d.ts +45 -0
- package/dist/components/cards/detail-line-item.d.ts.map +1 -0
- package/dist/components/cards/detail-line-item.js +51 -0
- package/dist/components/cards/detail-line-item.js.map +1 -0
- package/dist/components/cards/index.d.ts +5 -0
- package/dist/components/cards/index.d.ts.map +1 -0
- package/dist/components/cards/index.js +6 -0
- package/dist/components/cards/index.js.map +1 -0
- package/dist/components/cards/sidebar-card.d.ts +87 -0
- package/dist/components/cards/sidebar-card.d.ts.map +1 -0
- package/dist/components/cards/sidebar-card.js +150 -0
- package/dist/components/cards/sidebar-card.js.map +1 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type DetailLineItemProps = React.ComponentProps<"div">;
|
|
3
|
+
/**
|
|
4
|
+
* A key-value pair row for detail/sidebar cards.
|
|
5
|
+
*
|
|
6
|
+
* Compose with `DetailLineItemLabel` and `DetailLineItemValue` as children.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <DetailLineItem>
|
|
11
|
+
* <DetailLineItemLabel>Sub-Total</DetailLineItemLabel>
|
|
12
|
+
* <DetailLineItemValue>$1,234.56</DetailLineItemValue>
|
|
13
|
+
* </DetailLineItem>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example — custom label with tooltip
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <DetailLineItem>
|
|
19
|
+
* <DetailLineItemLabel>
|
|
20
|
+
* <span>Est Margin</span>
|
|
21
|
+
* <Tooltip>…</Tooltip>
|
|
22
|
+
* </DetailLineItemLabel>
|
|
23
|
+
* <DetailLineItemValue className="text-[#2e6dfa]">
|
|
24
|
+
* $500.00 (15.5%)
|
|
25
|
+
* </DetailLineItemValue>
|
|
26
|
+
* </DetailLineItem>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function DetailLineItem({ className, children, ...props }: DetailLineItemProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export type DetailLineItemLabelProps = React.ComponentProps<"div">;
|
|
31
|
+
/**
|
|
32
|
+
* Left-side label of a key-value row.
|
|
33
|
+
* Renders with 60% opacity by default. Accepts any ReactNode — plain text,
|
|
34
|
+
* icons, tooltips, etc.
|
|
35
|
+
*/
|
|
36
|
+
declare function DetailLineItemLabel({ className, children, ...props }: DetailLineItemLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export type DetailLineItemValueProps = React.ComponentProps<"div">;
|
|
38
|
+
/**
|
|
39
|
+
* Right-side value of a key-value row.
|
|
40
|
+
* Renders as semibold text. Accepts any ReactNode — formatted currency,
|
|
41
|
+
* status pills, links, etc.
|
|
42
|
+
*/
|
|
43
|
+
declare function DetailLineItemValue({ className, children, ...props }: DetailLineItemValueProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export { DetailLineItem, DetailLineItemLabel, DetailLineItemValue };
|
|
45
|
+
//# sourceMappingURL=detail-line-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detail-line-item.d.ts","sourceRoot":"","sources":["../../../src/components/cards/detail-line-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,2CAU7E;AAID,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEnE;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAc1B;AAID,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEnE;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAa1B;AAID,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
/**
|
|
5
|
+
* A key-value pair row for detail/sidebar cards.
|
|
6
|
+
*
|
|
7
|
+
* Compose with `DetailLineItemLabel` and `DetailLineItemValue` as children.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <DetailLineItem>
|
|
12
|
+
* <DetailLineItemLabel>Sub-Total</DetailLineItemLabel>
|
|
13
|
+
* <DetailLineItemValue>$1,234.56</DetailLineItemValue>
|
|
14
|
+
* </DetailLineItem>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example — custom label with tooltip
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <DetailLineItem>
|
|
20
|
+
* <DetailLineItemLabel>
|
|
21
|
+
* <span>Est Margin</span>
|
|
22
|
+
* <Tooltip>…</Tooltip>
|
|
23
|
+
* </DetailLineItemLabel>
|
|
24
|
+
* <DetailLineItemValue className="text-[#2e6dfa]">
|
|
25
|
+
* $500.00 (15.5%)
|
|
26
|
+
* </DetailLineItemValue>
|
|
27
|
+
* </DetailLineItem>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function DetailLineItem({ className, children, ...props }) {
|
|
31
|
+
return (_jsx("div", { className: cn("flex w-full items-start gap-2", className), "data-slot": "detail-line-item", ...props, children: children }));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Left-side label of a key-value row.
|
|
35
|
+
* Renders with 60% opacity by default. Accepts any ReactNode — plain text,
|
|
36
|
+
* icons, tooltips, etc.
|
|
37
|
+
*/
|
|
38
|
+
function DetailLineItemLabel({ className, children, ...props }) {
|
|
39
|
+
return (_jsx("div", { className: cn("flex flex-1 items-center text-[14px] leading-[16px] text-[#1a1a1a]", className), style: { opacity: 0.6 }, "data-slot": "detail-line-item-label", ...props, children: children }));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Right-side value of a key-value row.
|
|
43
|
+
* Renders as semibold text. Accepts any ReactNode — formatted currency,
|
|
44
|
+
* status pills, links, etc.
|
|
45
|
+
*/
|
|
46
|
+
function DetailLineItemValue({ className, children, ...props }) {
|
|
47
|
+
return (_jsx("div", { className: cn("shrink-0 text-[14px] font-semibold leading-[16px] text-[#1a1a1a]", className), "data-slot": "detail-line-item-value", ...props, children: children }));
|
|
48
|
+
}
|
|
49
|
+
/* ─────────────────────────── Exports ─────────────────────────── */
|
|
50
|
+
export { DetailLineItem, DetailLineItemLabel, DetailLineItemValue };
|
|
51
|
+
//# sourceMappingURL=detail-line-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detail-line-item.js","sourceRoot":"","sources":["../../../src/components/cards/detail-line-item.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAMrC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB;IAC5E,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,eAC/C,kBAAkB,KACxB,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAMD;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACiB;IACzB,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,oEAAoE,EACpE,SAAS,CACV,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,eACb,wBAAwB,KAC9B,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAMD;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACiB;IACzB,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,SAAS,CACV,eACS,wBAAwB,KAC9B,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,qEAAqE;AAErE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SidebarCard, SidebarCardHeader, SidebarCardTitle, SidebarCardAction, SidebarCardContent, SidebarCardSection, } from "./sidebar-card";
|
|
2
|
+
export type { SidebarCardProps, SidebarCardHeaderProps, SidebarCardTitleProps, SidebarCardActionProps, SidebarCardContentProps, SidebarCardSectionProps, } from "./sidebar-card";
|
|
3
|
+
export { DetailLineItem, DetailLineItemLabel, DetailLineItemValue, } from "./detail-line-item";
|
|
4
|
+
export type { DetailLineItemProps, DetailLineItemLabelProps, DetailLineItemValueProps, } from "./detail-line-item";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/cards/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// ── SidebarCard (composable) ──
|
|
3
|
+
export { SidebarCard, SidebarCardHeader, SidebarCardTitle, SidebarCardAction, SidebarCardContent, SidebarCardSection, } from "./sidebar-card";
|
|
4
|
+
// ── DetailLineItem (composable key-value row) ──
|
|
5
|
+
export { DetailLineItem, DetailLineItemLabel, DetailLineItemValue, } from "./detail-line-item";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cards/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,iCAAiC;AACjC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAUxB,kDAAkD;AAClD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SidebarCardProps = React.ComponentProps<"div"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Initial open state for collapsible cards.
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the card can be collapsed/expanded.
|
|
10
|
+
* When `false`, the card renders as a static (always-open) detail card.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
/** Cypress test identifier */
|
|
15
|
+
"data-cy"?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Root container for a sidebar card.
|
|
19
|
+
*
|
|
20
|
+
* Manages collapse state via internal context so sub-components
|
|
21
|
+
* (`SidebarCardHeader`, `SidebarCardContent`, etc.) can read it
|
|
22
|
+
* without prop drilling.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <SidebarCard>
|
|
27
|
+
* <SidebarCardHeader>
|
|
28
|
+
* <SidebarCardTitle>Quote</SidebarCardTitle>
|
|
29
|
+
* <SidebarCardAction>
|
|
30
|
+
* <MyDropdownMenu />
|
|
31
|
+
* </SidebarCardAction>
|
|
32
|
+
* </SidebarCardHeader>
|
|
33
|
+
* <SidebarCardContent>
|
|
34
|
+
* <SidebarCardSection bordered>…</SidebarCardSection>
|
|
35
|
+
* <SidebarCardSection>…</SidebarCardSection>
|
|
36
|
+
* </SidebarCardContent>
|
|
37
|
+
* </SidebarCard>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function SidebarCard({ defaultOpen, collapsible, className, children, ...props }: SidebarCardProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export type SidebarCardHeaderProps = React.ComponentProps<"div">;
|
|
42
|
+
/**
|
|
43
|
+
* Header row for the sidebar card (56px height).
|
|
44
|
+
*
|
|
45
|
+
* When the card is collapsible, clicking the header area (excluding the
|
|
46
|
+
* action slot) toggles the card open/closed and renders a chevron icon.
|
|
47
|
+
*
|
|
48
|
+
* Compose with `SidebarCardTitle` and optionally `SidebarCardAction`.
|
|
49
|
+
*/
|
|
50
|
+
declare function SidebarCardHeader({ className, children, ...props }: SidebarCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export type SidebarCardTitleProps = React.ComponentProps<"div">;
|
|
52
|
+
/**
|
|
53
|
+
* Title text inside the header row.
|
|
54
|
+
* Renders as 18px bold text with truncation.
|
|
55
|
+
*/
|
|
56
|
+
declare function SidebarCardTitle({ className, children, ...props }: SidebarCardTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export type SidebarCardActionProps = React.ComponentProps<"div">;
|
|
58
|
+
/**
|
|
59
|
+
* Right-side action slot in the header.
|
|
60
|
+
*
|
|
61
|
+
* The consumer brings their own content (dropdown menu, button, etc.).
|
|
62
|
+
* Clicks inside this slot are stopped from propagating to the toggle button.
|
|
63
|
+
*/
|
|
64
|
+
declare function SidebarCardAction({ className, children, ...props }: SidebarCardActionProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export type SidebarCardContentProps = React.ComponentProps<"div">;
|
|
66
|
+
/**
|
|
67
|
+
* Animated collapsible body of the card.
|
|
68
|
+
*
|
|
69
|
+
* Uses a ResizeObserver to measure content height and smoothly transition
|
|
70
|
+
* between open/closed states. When `collapsible` is `false` in the parent
|
|
71
|
+
* `SidebarCard`, this component simply renders its children without animation.
|
|
72
|
+
*/
|
|
73
|
+
declare function SidebarCardContent({ className, children, ...props }: SidebarCardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export type SidebarCardSectionProps = React.ComponentProps<"div"> & {
|
|
75
|
+
/**
|
|
76
|
+
* Show a bottom border on this section.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
bordered?: boolean;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* A padded section inside the card content.
|
|
83
|
+
* Use `bordered` to add a bottom separator between sections.
|
|
84
|
+
*/
|
|
85
|
+
declare function SidebarCardSection({ bordered, className, children, ...props }: SidebarCardSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export { SidebarCard, SidebarCardHeader, SidebarCardTitle, SidebarCardAction, SidebarCardContent, SidebarCardSection, };
|
|
87
|
+
//# sourceMappingURL=sidebar-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-card.d.ts","sourceRoot":"","sources":["../../../src/components/cards/sidebar-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC3D;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,WAAW,CAAC,EACnB,WAAkB,EAClB,WAAkB,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,2CA0BlB;AAID,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAuExB;AAID,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEhE;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,2CAavB;AAID,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAWxB;AAID,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,2CA8DzB;AAID,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAczB;AAID,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ChevronUp } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const SidebarCardContext = React.createContext(null);
|
|
7
|
+
function useSidebarCardContext() {
|
|
8
|
+
const ctx = React.useContext(SidebarCardContext);
|
|
9
|
+
if (!ctx) {
|
|
10
|
+
throw new Error("SidebarCard compound components must be used within <SidebarCard>");
|
|
11
|
+
}
|
|
12
|
+
return ctx;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Root container for a sidebar card.
|
|
16
|
+
*
|
|
17
|
+
* Manages collapse state via internal context so sub-components
|
|
18
|
+
* (`SidebarCardHeader`, `SidebarCardContent`, etc.) can read it
|
|
19
|
+
* without prop drilling.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <SidebarCard>
|
|
24
|
+
* <SidebarCardHeader>
|
|
25
|
+
* <SidebarCardTitle>Quote</SidebarCardTitle>
|
|
26
|
+
* <SidebarCardAction>
|
|
27
|
+
* <MyDropdownMenu />
|
|
28
|
+
* </SidebarCardAction>
|
|
29
|
+
* </SidebarCardHeader>
|
|
30
|
+
* <SidebarCardContent>
|
|
31
|
+
* <SidebarCardSection bordered>…</SidebarCardSection>
|
|
32
|
+
* <SidebarCardSection>…</SidebarCardSection>
|
|
33
|
+
* </SidebarCardContent>
|
|
34
|
+
* </SidebarCard>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function SidebarCard({ defaultOpen = true, collapsible = true, className, children, ...props }) {
|
|
38
|
+
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
39
|
+
const toggle = React.useCallback(() => {
|
|
40
|
+
setIsOpen((prev) => !prev);
|
|
41
|
+
}, []);
|
|
42
|
+
const ctx = React.useMemo(() => ({ isOpen: collapsible ? isOpen : true, toggle, collapsible }), [isOpen, toggle, collapsible]);
|
|
43
|
+
return (_jsx(SidebarCardContext.Provider, { value: ctx, children: _jsx("div", { className: cn("overflow-hidden rounded-[12px] w-full bg-white", className), "data-slot": "sidebar-card", ...props, children: children }) }));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Header row for the sidebar card (56px height).
|
|
47
|
+
*
|
|
48
|
+
* When the card is collapsible, clicking the header area (excluding the
|
|
49
|
+
* action slot) toggles the card open/closed and renders a chevron icon.
|
|
50
|
+
*
|
|
51
|
+
* Compose with `SidebarCardTitle` and optionally `SidebarCardAction`.
|
|
52
|
+
*/
|
|
53
|
+
function SidebarCardHeader({ className, children, ...props }) {
|
|
54
|
+
const { isOpen, toggle, collapsible } = useSidebarCardContext();
|
|
55
|
+
return (_jsxs("div", { className: cn("flex h-[56px] w-full items-center gap-[8px] border-b px-[24px] py-[8px]", collapsible && "hover:bg-[#fafafa] transition-colors", isOpen ? "border-[#e6e6e6]" : "border-transparent", className), "data-slot": "sidebar-card-header", ...props, children: [collapsible ? (_jsxs("button", { type: "button", onClick: toggle, className: "flex min-w-0 flex-1 items-center gap-[8px] text-left cursor-pointer rounded-[6px] hover:bg-[#fafafa] transition-colors", "aria-expanded": isOpen, "data-cy": "sidebar-card-toggle", children: [_jsx("div", { className: "size-5 shrink-0", children: _jsx(ChevronUp, { className: cn("size-5 transition-transform duration-200 ease-in-out", !isOpen && "rotate-180"), color: "#1a1a1a" }) }), React.Children.map(children, (child) => {
|
|
56
|
+
if (React.isValidElement(child) &&
|
|
57
|
+
child.props?.["data-slot"] ===
|
|
58
|
+
"sidebar-card-title") {
|
|
59
|
+
return child;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
})] })) : (_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-[8px]", children: React.Children.map(children, (child) => {
|
|
63
|
+
if (React.isValidElement(child) &&
|
|
64
|
+
child.props?.["data-slot"] ===
|
|
65
|
+
"sidebar-card-title") {
|
|
66
|
+
return child;
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}) })), React.Children.map(children, (child) => {
|
|
70
|
+
if (React.isValidElement(child) &&
|
|
71
|
+
child.props?.["data-slot"] ===
|
|
72
|
+
"sidebar-card-action") {
|
|
73
|
+
return child;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
})] }));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Title text inside the header row.
|
|
80
|
+
* Renders as 18px bold text with truncation.
|
|
81
|
+
*/
|
|
82
|
+
function SidebarCardTitle({ className, children, ...props }) {
|
|
83
|
+
return (_jsx("div", { className: cn("flex-1 truncate text-[18px] font-bold leading-[24px] text-[#1a1a1a]", className), "data-slot": "sidebar-card-title", ...props, children: children }));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Right-side action slot in the header.
|
|
87
|
+
*
|
|
88
|
+
* The consumer brings their own content (dropdown menu, button, etc.).
|
|
89
|
+
* Clicks inside this slot are stopped from propagating to the toggle button.
|
|
90
|
+
*/
|
|
91
|
+
function SidebarCardAction({ className, children, ...props }) {
|
|
92
|
+
return (_jsx("div", { className: cn("shrink-0", className), onClick: (e) => e.stopPropagation(), "data-slot": "sidebar-card-action", ...props, children: children }));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Animated collapsible body of the card.
|
|
96
|
+
*
|
|
97
|
+
* Uses a ResizeObserver to measure content height and smoothly transition
|
|
98
|
+
* between open/closed states. When `collapsible` is `false` in the parent
|
|
99
|
+
* `SidebarCard`, this component simply renders its children without animation.
|
|
100
|
+
*/
|
|
101
|
+
function SidebarCardContent({ className, children, ...props }) {
|
|
102
|
+
const { isOpen, collapsible } = useSidebarCardContext();
|
|
103
|
+
const contentRef = React.useRef(null);
|
|
104
|
+
const [height, setHeight] = React.useState(isOpen ? undefined : 0);
|
|
105
|
+
// Measure content height when opening/closing
|
|
106
|
+
React.useEffect(() => {
|
|
107
|
+
if (!collapsible || !contentRef.current)
|
|
108
|
+
return;
|
|
109
|
+
if (isOpen) {
|
|
110
|
+
setHeight(contentRef.current.scrollHeight);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
setHeight(0);
|
|
114
|
+
}
|
|
115
|
+
}, [isOpen, collapsible]);
|
|
116
|
+
// Handle dynamic content changes while open
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
if (!collapsible || !contentRef.current || !isOpen)
|
|
119
|
+
return;
|
|
120
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
if (isOpen) {
|
|
123
|
+
const newHeight = entry.contentRect.height;
|
|
124
|
+
setHeight((prev) => (prev === newHeight ? prev : newHeight));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
resizeObserver.observe(contentRef.current);
|
|
129
|
+
return () => {
|
|
130
|
+
resizeObserver.disconnect();
|
|
131
|
+
};
|
|
132
|
+
}, [isOpen, collapsible]);
|
|
133
|
+
// Non-collapsible: render children directly
|
|
134
|
+
if (!collapsible) {
|
|
135
|
+
return (_jsx("div", { "data-slot": "sidebar-card-content", className: className, ...props, children: children }));
|
|
136
|
+
}
|
|
137
|
+
return (_jsx("div", { className: cn("overflow-hidden transition-all duration-300 ease-in-out", className), style: {
|
|
138
|
+
height: height !== undefined ? `${height}px` : undefined,
|
|
139
|
+
}, "data-slot": "sidebar-card-content", ...props, children: _jsx("div", { ref: contentRef, children: children }) }));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A padded section inside the card content.
|
|
143
|
+
* Use `bordered` to add a bottom separator between sections.
|
|
144
|
+
*/
|
|
145
|
+
function SidebarCardSection({ bordered = false, className, children, ...props }) {
|
|
146
|
+
return (_jsx("div", { className: cn("px-6 py-3", bordered && "border-b border-[#e6e6e6]", className), "data-slot": "sidebar-card-section", ...props, children: children }));
|
|
147
|
+
}
|
|
148
|
+
/* ─────────────────────────── Exports ─────────────────────────── */
|
|
149
|
+
export { SidebarCard, SidebarCardHeader, SidebarCardTitle, SidebarCardAction, SidebarCardContent, SidebarCardSection, };
|
|
150
|
+
//# sourceMappingURL=sidebar-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-card.js","sourceRoot":"","sources":["../../../src/components/cards/sidebar-card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAUrC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAC5C,IAAI,CACL,CAAC;AAEF,SAAS,qBAAqB;IAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAoBD;;;;;;;;;;;;;;;;;;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,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACgB;IACxB,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,WAAW,EACX,QAAQ,IAAI,2BAA2B,EACvC,SAAS,CACV,eACS,sBAAsB,KAC5B,KAAK,YAER,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,qEAAqE;AAErE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
-
size?: "default" | "
|
|
5
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, isLoading, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
8
|
asChild?: boolean;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|