@cntyclub/ui-react 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -9
- package/dist/index.js +24 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/pipeline.tsx +43 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntyclub/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React component library for the Country Club UI Kit — Base UI primitives styled with the Country Club design system (Tailwind CSS v4)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Fragment } from "react";
|
|
3
4
|
import type * as React from "react";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
4
6
|
|
|
5
7
|
import { cn } from "../../lib/utils/css";
|
|
6
8
|
|
|
@@ -17,65 +19,80 @@ interface PipelineProps extends React.ComponentProps<"div"> {
|
|
|
17
19
|
/** Ordered funnel stages, left to right. */
|
|
18
20
|
stages: PipelineStage[];
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
21
|
-
* Typically a percentage string; any node works.
|
|
22
|
+
* Step-to-step conversion markers shown in the connector *between* stages
|
|
23
|
+
* (length = `stages.length - 1`). Typically a percentage string; any node works.
|
|
22
24
|
*/
|
|
23
25
|
conversions?: React.ReactNode[];
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
|
-
* A
|
|
28
|
-
* step-to-step conversion
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* A conversion funnel — equal-width stages laid left to right, joined by
|
|
30
|
+
* connectors that carry the step-to-step conversion and a chevron pointing to
|
|
31
|
+
* the next stage, so the row reads as a flow rather than a set of loose stats.
|
|
32
|
+
*
|
|
33
|
+
* The component is its own container query context: when it gets narrow (e.g.
|
|
34
|
+
* beside a docked panel) the connectors hide and the stages reflow into a
|
|
35
|
+
* two-column grid, staying readable without squashing the numbers.
|
|
31
36
|
*/
|
|
32
37
|
function Pipeline({ stages, conversions = [], className, ...props }: PipelineProps) {
|
|
33
38
|
return (
|
|
34
39
|
<div
|
|
35
|
-
className={cn(
|
|
40
|
+
className={cn(
|
|
41
|
+
"@container flex items-stretch @max-[560px]:grid @max-[560px]:grid-cols-2 @max-[560px]:gap-x-6 @max-[560px]:gap-y-5",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
36
44
|
data-slot="pipeline"
|
|
37
45
|
{...props}
|
|
38
46
|
>
|
|
39
47
|
{stages.map((stage, i) => {
|
|
40
48
|
const conv = i < stages.length - 1 ? conversions[i] : undefined;
|
|
41
49
|
return (
|
|
42
|
-
<
|
|
43
|
-
<div className="flex
|
|
44
|
-
<
|
|
50
|
+
<Fragment key={i}>
|
|
51
|
+
<div className="min-w-0 flex-1 px-0.5" data-slot="pipeline-stage">
|
|
52
|
+
<div
|
|
45
53
|
className={cn(
|
|
46
|
-
"font-sans font-
|
|
47
|
-
stage.accent && "text-
|
|
54
|
+
"font-sans font-bold text-3xl text-foreground leading-none tabular-nums tracking-tight",
|
|
55
|
+
stage.accent && "text-success",
|
|
48
56
|
)}
|
|
49
57
|
>
|
|
50
58
|
{stage.value}
|
|
51
|
-
</
|
|
52
|
-
|
|
59
|
+
</div>
|
|
60
|
+
<div className="mt-2 text-muted-foreground text-xs leading-snug">
|
|
61
|
+
{stage.label}
|
|
62
|
+
</div>
|
|
53
63
|
</div>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
64
|
+
{conv != null ? <PipelineConnector>{conv}</PipelineConnector> : null}
|
|
65
|
+
</Fragment>
|
|
58
66
|
);
|
|
59
67
|
})}
|
|
60
68
|
</div>
|
|
61
69
|
);
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
72
|
+
/**
|
|
73
|
+
* The between-stages connector: a conversion pill above a chevron pointing to
|
|
74
|
+
* the next stage. Hidden when the funnel collapses to a grid.
|
|
75
|
+
*/
|
|
76
|
+
function PipelineConnector({
|
|
66
77
|
className,
|
|
78
|
+
children,
|
|
67
79
|
...props
|
|
68
|
-
}: React.ComponentProps<"
|
|
80
|
+
}: React.ComponentProps<"div">) {
|
|
69
81
|
return (
|
|
70
|
-
<
|
|
82
|
+
<div
|
|
71
83
|
className={cn(
|
|
72
|
-
"
|
|
84
|
+
"flex flex-none flex-col items-center justify-center gap-1.5 px-1 @max-[560px]:hidden",
|
|
73
85
|
className,
|
|
74
86
|
)}
|
|
75
|
-
data-slot="pipeline-
|
|
87
|
+
data-slot="pipeline-connector"
|
|
76
88
|
{...props}
|
|
77
|
-
|
|
89
|
+
>
|
|
90
|
+
<span className="inline-flex items-center rounded-full border border-success/20 bg-success/10 px-2 py-0.5 font-medium text-[11px] text-success tabular-nums dark:bg-success/16">
|
|
91
|
+
{children}
|
|
92
|
+
</span>
|
|
93
|
+
<ChevronRight className="size-3.5 text-muted-foreground/40" aria-hidden />
|
|
94
|
+
</div>
|
|
78
95
|
);
|
|
79
96
|
}
|
|
80
97
|
|
|
81
|
-
export { Pipeline,
|
|
98
|
+
export { Pipeline, PipelineConnector, type PipelineProps, type PipelineStage };
|