@zentauri-ui/zentauri-components 1.0.0 → 1.1.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,64 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, ComponentPropsWithoutRef, Ref } from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+ import * as class_variance_authority_types from 'class-variance-authority/types';
5
+
6
+ declare const stepperVariants: (props?: ({
7
+ orientation?: "horizontal" | "vertical" | null | undefined;
8
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
9
+ declare const stepperItemVariants: (props?: ({
10
+ orientation?: "horizontal" | "vertical" | null | undefined;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
+ declare const stepperIndicatorVariants: (props?: ({
13
+ appearance?: "complete" | "current" | "upcoming" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gray" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
14
+ size?: "sm" | "md" | "lg" | null | undefined;
15
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
16
+
17
+ type StepperVariantProps = VariantProps<typeof stepperVariants>;
18
+ type StepperProps = StepperVariantProps & {
19
+ size?: VariantProps<typeof stepperIndicatorVariants>["size"];
20
+ children?: ReactNode;
21
+ } & Omit<ComponentPropsWithoutRef<"div">, "children">;
22
+ type StepperItemProps = ComponentPropsWithoutRef<"div"> & {
23
+ children?: ReactNode;
24
+ };
25
+ type StepperIndicatorProps = ComponentPropsWithoutRef<"div"> & {
26
+ children?: ReactNode;
27
+ appearance?: StepperAppearance;
28
+ };
29
+ type StepperTitleProps = ComponentPropsWithoutRef<"div">;
30
+ type StepperDescriptionProps = ComponentPropsWithoutRef<"p">;
31
+ type StepperAppearance = VariantProps<typeof stepperIndicatorVariants>["appearance"];
32
+
33
+ declare function Stepper({ className, orientation, size, children, ref, ...rest }: StepperProps & {
34
+ ref?: Ref<HTMLDivElement>;
35
+ }): react_jsx_runtime.JSX.Element;
36
+ declare namespace Stepper {
37
+ var displayName: string;
38
+ }
39
+ declare function StepperItem({ className, ref, children, ...rest }: StepperItemProps & {
40
+ ref?: React.Ref<HTMLDivElement>;
41
+ }): react_jsx_runtime.JSX.Element;
42
+ declare namespace StepperItem {
43
+ var displayName: string;
44
+ }
45
+ declare function StepperIndicator({ className, ref, children, appearance, ...rest }: StepperIndicatorProps & {
46
+ ref?: React.Ref<HTMLDivElement>;
47
+ }): react_jsx_runtime.JSX.Element;
48
+ declare namespace StepperIndicator {
49
+ var displayName: string;
50
+ }
51
+ declare function StepperTitle({ className, ref, ...rest }: StepperTitleProps & {
52
+ ref?: React.Ref<HTMLDivElement>;
53
+ }): react_jsx_runtime.JSX.Element;
54
+ declare namespace StepperTitle {
55
+ var displayName: string;
56
+ }
57
+ declare function StepperDescription({ className, ref, ...rest }: StepperDescriptionProps & {
58
+ ref?: React.Ref<HTMLParagraphElement>;
59
+ }): react_jsx_runtime.JSX.Element;
60
+ declare namespace StepperDescription {
61
+ var displayName: string;
62
+ }
63
+
64
+ export { Stepper, type StepperAppearance, StepperDescription, type StepperDescriptionProps, StepperIndicator, type StepperIndicatorProps, StepperItem, type StepperItemProps, type StepperProps, StepperTitle, type StepperTitleProps, stepperIndicatorVariants, stepperItemVariants, stepperVariants };
@@ -0,0 +1,207 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkWZ2GOU2J_js = require('../chunk-WZ2GOU2J.js');
5
+ var react = require('react');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ var stepperVariants = classVarianceAuthority.cva("flex w-full", {
10
+ variants: {
11
+ orientation: {
12
+ horizontal: "flex-row flex-wrap items-start gap-4",
13
+ vertical: "flex-col gap-6"
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ orientation: "horizontal"
18
+ }
19
+ });
20
+ var stepperItemVariants = classVarianceAuthority.cva("relative flex gap-3", {
21
+ variants: {
22
+ orientation: {
23
+ horizontal: "min-w-0 flex-col items-center text-center",
24
+ vertical: "flex-row items-start text-left"
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ orientation: "horizontal"
29
+ }
30
+ });
31
+ var stepperIndicatorVariants = classVarianceAuthority.cva(
32
+ "grid size-9 shrink-0 place-items-center rounded-full border text-sm font-semibold transition-colors",
33
+ {
34
+ variants: {
35
+ appearance: {
36
+ complete: "border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30",
37
+ current: "border-violet-400 bg-violet-500/20 text-white ring-2 ring-violet-400/50",
38
+ upcoming: "border-white/15 bg-white/5 text-slate-400",
39
+ sky: "border-sky-500/60 bg-sky-500/20 text-sky-100 ring-2 ring-sky-400/30",
40
+ rose: "border-rose-500/60 bg-rose-500/20 text-rose-100 ring-2 ring-rose-400/30",
41
+ purple: "border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30",
42
+ pink: "border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30",
43
+ orange: "border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30",
44
+ yellow: "border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30",
45
+ teal: "border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30",
46
+ indigo: "border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30",
47
+ emerald: "border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30",
48
+ gray: "border-gray-500/60 bg-gray-500/20 text-gray-100 ring-2 ring-gray-400/30",
49
+ violet: "border-violet-500/60 bg-violet-500/20 text-violet-100 ring-2 ring-violet-400/30",
50
+ "gradient-blue": "border-blue-500/60 bg-blue-500/20 text-blue-100 ring-2 ring-blue-400/30",
51
+ "gradient-green": "border-green-500/60 bg-green-500/20 text-green-100 ring-2 ring-green-400/30",
52
+ "gradient-red": "border-red-500/60 bg-red-500/20 text-red-100 ring-2 ring-red-400/30",
53
+ "gradient-yellow": "border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30",
54
+ "gradient-purple": "border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30",
55
+ "gradient-teal": "border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30",
56
+ "gradient-indigo": "border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30",
57
+ "gradient-pink": "border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30",
58
+ "gradient-orange": "border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30"
59
+ },
60
+ size: {
61
+ sm: "size-8 text-xs",
62
+ md: "size-9 text-sm",
63
+ lg: "size-10 text-base"
64
+ }
65
+ },
66
+ defaultVariants: {
67
+ appearance: "upcoming",
68
+ size: "md"
69
+ }
70
+ }
71
+ );
72
+ var StepperContext = react.createContext(null);
73
+ function useStepper(component) {
74
+ const ctx = react.useContext(StepperContext);
75
+ if (!ctx) {
76
+ throw new Error(`${component} must be used within <Stepper>`);
77
+ }
78
+ return ctx;
79
+ }
80
+ var StepperIndexContext = react.createContext(null);
81
+ function useStepperIndex(component) {
82
+ const index = react.useContext(StepperIndexContext);
83
+ if (index === null) {
84
+ throw new Error(`${component} must be used within <StepperItem>`);
85
+ }
86
+ return index;
87
+ }
88
+ function Stepper({
89
+ className,
90
+ orientation = "horizontal",
91
+ size = "md",
92
+ children,
93
+ ref,
94
+ ...rest
95
+ }) {
96
+ const items = react.useMemo(
97
+ () => react.Children.toArray(children).filter(react.isValidElement),
98
+ [children]
99
+ );
100
+ const ctx = react.useMemo(
101
+ () => ({
102
+ orientation: orientation ?? "horizontal",
103
+ size: size ?? "md",
104
+ total: items.length
105
+ }),
106
+ [items.length, orientation, size]
107
+ );
108
+ return /* @__PURE__ */ jsxRuntime.jsx(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
109
+ "div",
110
+ {
111
+ ref,
112
+ "data-slot": "stepper",
113
+ role: "list",
114
+ className: chunkWZ2GOU2J_js.cn(stepperVariants({ orientation }), className),
115
+ ...rest,
116
+ children: items.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(StepperIndexContext.Provider, { value: index, children: child }, index))
117
+ }
118
+ ) });
119
+ }
120
+ Stepper.displayName = "Stepper";
121
+ function StepperItem({
122
+ className,
123
+ ref,
124
+ children,
125
+ ...rest
126
+ }) {
127
+ const { orientation } = useStepper("StepperItem");
128
+ return /* @__PURE__ */ jsxRuntime.jsx(
129
+ "div",
130
+ {
131
+ ref,
132
+ "data-slot": "stepper-item",
133
+ role: "listitem",
134
+ className: chunkWZ2GOU2J_js.cn(stepperItemVariants({ orientation }), className),
135
+ ...rest,
136
+ children
137
+ }
138
+ );
139
+ }
140
+ StepperItem.displayName = "StepperItem";
141
+ function StepperIndicator({
142
+ className,
143
+ ref,
144
+ children,
145
+ appearance,
146
+ ...rest
147
+ }) {
148
+ const { size } = useStepper("StepperIndicator");
149
+ const index = useStepperIndex("StepperIndicator");
150
+ return /* @__PURE__ */ jsxRuntime.jsx(
151
+ "div",
152
+ {
153
+ ref,
154
+ "data-slot": "stepper-indicator",
155
+ className: chunkWZ2GOU2J_js.cn(stepperIndicatorVariants({ appearance, size }), className),
156
+ ...rest,
157
+ children: children ?? index + 1
158
+ }
159
+ );
160
+ }
161
+ StepperIndicator.displayName = "StepperIndicator";
162
+ function StepperTitle({
163
+ className,
164
+ ref,
165
+ ...rest
166
+ }) {
167
+ return /* @__PURE__ */ jsxRuntime.jsx(
168
+ "div",
169
+ {
170
+ ref,
171
+ "data-slot": "stepper-title",
172
+ className: chunkWZ2GOU2J_js.cn(
173
+ "mt-3 text-sm font-semibold",
174
+ className
175
+ ),
176
+ ...rest
177
+ }
178
+ );
179
+ }
180
+ StepperTitle.displayName = "StepperTitle";
181
+ function StepperDescription({
182
+ className,
183
+ ref,
184
+ ...rest
185
+ }) {
186
+ return /* @__PURE__ */ jsxRuntime.jsx(
187
+ "p",
188
+ {
189
+ ref,
190
+ "data-slot": "stepper-description",
191
+ className: chunkWZ2GOU2J_js.cn("mt-1 text-xs text-slate-400", className),
192
+ ...rest
193
+ }
194
+ );
195
+ }
196
+ StepperDescription.displayName = "StepperDescription";
197
+
198
+ exports.Stepper = Stepper;
199
+ exports.StepperDescription = StepperDescription;
200
+ exports.StepperIndicator = StepperIndicator;
201
+ exports.StepperItem = StepperItem;
202
+ exports.StepperTitle = StepperTitle;
203
+ exports.stepperIndicatorVariants = stepperIndicatorVariants;
204
+ exports.stepperItemVariants = stepperItemVariants;
205
+ exports.stepperVariants = stepperVariants;
206
+ //# sourceMappingURL=stepper.js.map
207
+ //# sourceMappingURL=stepper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ui/stepper/variants.ts","../../src/ui/stepper/stepper.tsx"],"names":["cva","createContext","useContext","useMemo","Children","isValidElement","jsx","cn"],"mappings":";;;;;;;AAEO,IAAM,eAAA,GAAkBA,2BAAI,aAAA,EAAe;AAAA,EAChD,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,UAAA,EAAY,sCAAA;AAAA,MACZ,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,WAAA,EAAa;AAAA;AAEjB,CAAC;AAEM,IAAM,mBAAA,GAAsBA,2BAAI,qBAAA,EAAuB;AAAA,EAC5D,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,UAAA,EAAY,2CAAA;AAAA,MACZ,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,WAAA,EAAa;AAAA;AAEjB,CAAC;AAEM,IAAM,wB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SAAS,CAAA;AAAA,MACtE,GAAG,IAAA;AAAA,MAEH,sBAAY,KAAA,GAAQ;AAAA;AAAA,GACvB;AAEJ;AAEA,gBAAA,CAAiB,WAAA,GAAc,kBAAA;AAExB,SAAS,YAAA,CAAa;AAAA,EAC3B,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA4D;AAC1D,EAAA,uBACED,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAWC,mBAAA;AAAA,QACT,4BAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAEpB,SAAS,kBAAA,CAAmB;AAAA,EACjC,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwE;AACtE,EAAA,uBACED,cAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAWC,mBAAA,CAAG,6BAAA,EAA+B,SAAS,CAAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,kBAAA,CAAmB,WAAA,GAAc,oBAAA","file":"stepper.js","sourcesContent":["import { cva } from \"class-variance-authority\";\n\nexport const stepperVariants = cva(\"flex w-full\", {\n variants: {\n orientation: {\n horizontal: \"flex-row flex-wrap items-start gap-4\",\n vertical: \"flex-col gap-6\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n});\n\nexport const stepperItemVariants = cva(\"relative flex gap-3\", {\n variants: {\n orientation: {\n horizontal: \"min-w-0 flex-col items-center text-center\",\n vertical: \"flex-row items-start text-left\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n});\n\nexport const stepperIndicatorVariants = cva(\n \"grid size-9 shrink-0 place-items-center rounded-full border text-sm font-semibold transition-colors\",\n {\n variants: {\n appearance: {\n complete:\n \"border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30\",\n current:\n \"border-violet-400 bg-violet-500/20 text-white ring-2 ring-violet-400/50\",\n upcoming: \"border-white/15 bg-white/5 text-slate-400\",\n sky: \"border-sky-500/60 bg-sky-500/20 text-sky-100 ring-2 ring-sky-400/30\",\n rose: \"border-rose-500/60 bg-rose-500/20 text-rose-100 ring-2 ring-rose-400/30\",\n purple: \"border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30\",\n pink: \"border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30\",\n orange: \"border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30\",\n yellow: \"border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30\",\n teal: \"border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30\",\n indigo: \"border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30\",\n emerald: \"border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30\",\n gray: \"border-gray-500/60 bg-gray-500/20 text-gray-100 ring-2 ring-gray-400/30\",\n violet: \"border-violet-500/60 bg-violet-500/20 text-violet-100 ring-2 ring-violet-400/30\",\n \"gradient-blue\": \"border-blue-500/60 bg-blue-500/20 text-blue-100 ring-2 ring-blue-400/30\",\n \"gradient-green\": \"border-green-500/60 bg-green-500/20 text-green-100 ring-2 ring-green-400/30\",\n \"gradient-red\": \"border-red-500/60 bg-red-500/20 text-red-100 ring-2 ring-red-400/30\",\n \"gradient-yellow\": \"border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30\",\n \"gradient-purple\": \"border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30\",\n \"gradient-teal\": \"border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30\",\n \"gradient-indigo\": \"border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30\",\n \"gradient-pink\": \"border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30\",\n \"gradient-orange\": \"border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30\",\n },\n size: {\n sm: \"size-8 text-xs\",\n md: \"size-9 text-sm\",\n lg: \"size-10 text-base\",\n },\n },\n defaultVariants: {\n appearance: \"upcoming\",\n size: \"md\",\n },\n },\n);\n","\"use client\";\n\nimport {\n Children,\n createContext,\n isValidElement,\n useContext,\n useMemo,\n type Ref,\n} from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type {\n StepperCtx,\n StepperDescriptionProps,\n StepperIndicatorProps,\n StepperItemProps,\n StepperProps,\n StepperTitleProps,\n} from \"./types\";\nimport {\n stepperIndicatorVariants,\n stepperItemVariants,\n stepperVariants,\n} from \"./variants\";\n\n\nconst StepperContext = createContext<StepperCtx | null>(null);\n\nfunction useStepper(component: string): StepperCtx {\n const ctx = useContext(StepperContext);\n if (!ctx) {\n throw new Error(`${component} must be used within <Stepper>`);\n }\n return ctx;\n}\n\nconst StepperIndexContext = createContext<number | null>(null);\n\nfunction useStepperIndex(component: string): number {\n const index = useContext(StepperIndexContext);\n if (index === null) {\n throw new Error(`${component} must be used within <StepperItem>`);\n }\n return index;\n}\n\n\nexport function Stepper({\n className,\n orientation = \"horizontal\",\n size = \"md\",\n children,\n ref,\n ...rest\n}: StepperProps & { ref?: Ref<HTMLDivElement> }) {\n const items = useMemo(\n () => Children.toArray(children).filter(isValidElement),\n [children],\n );\n const ctx = useMemo(\n () => ({\n orientation: orientation ?? \"horizontal\",\n size: size ?? \"md\",\n total: items.length,\n }),\n [items.length, orientation, size],\n );\n\n return (\n <StepperContext.Provider value={ctx}>\n <div\n ref={ref}\n data-slot=\"stepper\"\n role=\"list\"\n className={cn(stepperVariants({ orientation }), className)}\n {...rest}\n >\n {items.map((child, index) => (\n <StepperIndexContext.Provider key={index} value={index}>\n {child}\n </StepperIndexContext.Provider>\n ))}\n </div>\n </StepperContext.Provider>\n );\n}\n\nStepper.displayName = \"Stepper\";\n\nexport function StepperItem({\n className,\n ref,\n children,\n ...rest\n}: StepperItemProps & { ref?: React.Ref<HTMLDivElement> }) {\n const { orientation } = useStepper(\"StepperItem\");\n return (\n <div\n ref={ref}\n data-slot=\"stepper-item\"\n role=\"listitem\"\n className={cn(stepperItemVariants({ orientation }), className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nStepperItem.displayName = \"StepperItem\";\n\nexport function StepperIndicator({\n className,\n ref,\n children,\n appearance,\n ...rest\n}: StepperIndicatorProps & { ref?: React.Ref<HTMLDivElement> }) {\n const { size } = useStepper(\"StepperIndicator\");\n const index = useStepperIndex(\"StepperIndicator\");\n return (\n <div\n ref={ref}\n data-slot=\"stepper-indicator\"\n className={cn(stepperIndicatorVariants({ appearance, size }), className)}\n {...rest}\n >\n {children ?? index + 1}\n </div>\n );\n}\n\nStepperIndicator.displayName = \"StepperIndicator\";\n\nexport function StepperTitle({\n className,\n ref,\n ...rest\n}: StepperTitleProps & { ref?: React.Ref<HTMLDivElement> }) {\n return (\n <div\n ref={ref}\n data-slot=\"stepper-title\"\n className={cn(\n \"mt-3 text-sm font-semibold\",\n className,\n )}\n {...rest}\n />\n );\n}\n\nStepperTitle.displayName = \"StepperTitle\";\n\nexport function StepperDescription({\n className,\n ref,\n ...rest\n}: StepperDescriptionProps & { ref?: React.Ref<HTMLParagraphElement> }) {\n return (\n <p\n ref={ref}\n data-slot=\"stepper-description\"\n className={cn(\"mt-1 text-xs text-slate-400\", className)}\n {...rest}\n />\n );\n}\n\nStepperDescription.displayName = \"StepperDescription\";\n"]}
@@ -0,0 +1,198 @@
1
+ "use client";
2
+ import { cn } from '../chunk-B23TPTVG.mjs';
3
+ import { createContext, useMemo, Children, isValidElement, useContext } from 'react';
4
+ import { cva } from 'class-variance-authority';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var stepperVariants = cva("flex w-full", {
8
+ variants: {
9
+ orientation: {
10
+ horizontal: "flex-row flex-wrap items-start gap-4",
11
+ vertical: "flex-col gap-6"
12
+ }
13
+ },
14
+ defaultVariants: {
15
+ orientation: "horizontal"
16
+ }
17
+ });
18
+ var stepperItemVariants = cva("relative flex gap-3", {
19
+ variants: {
20
+ orientation: {
21
+ horizontal: "min-w-0 flex-col items-center text-center",
22
+ vertical: "flex-row items-start text-left"
23
+ }
24
+ },
25
+ defaultVariants: {
26
+ orientation: "horizontal"
27
+ }
28
+ });
29
+ var stepperIndicatorVariants = cva(
30
+ "grid size-9 shrink-0 place-items-center rounded-full border text-sm font-semibold transition-colors",
31
+ {
32
+ variants: {
33
+ appearance: {
34
+ complete: "border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30",
35
+ current: "border-violet-400 bg-violet-500/20 text-white ring-2 ring-violet-400/50",
36
+ upcoming: "border-white/15 bg-white/5 text-slate-400",
37
+ sky: "border-sky-500/60 bg-sky-500/20 text-sky-100 ring-2 ring-sky-400/30",
38
+ rose: "border-rose-500/60 bg-rose-500/20 text-rose-100 ring-2 ring-rose-400/30",
39
+ purple: "border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30",
40
+ pink: "border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30",
41
+ orange: "border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30",
42
+ yellow: "border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30",
43
+ teal: "border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30",
44
+ indigo: "border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30",
45
+ emerald: "border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30",
46
+ gray: "border-gray-500/60 bg-gray-500/20 text-gray-100 ring-2 ring-gray-400/30",
47
+ violet: "border-violet-500/60 bg-violet-500/20 text-violet-100 ring-2 ring-violet-400/30",
48
+ "gradient-blue": "border-blue-500/60 bg-blue-500/20 text-blue-100 ring-2 ring-blue-400/30",
49
+ "gradient-green": "border-green-500/60 bg-green-500/20 text-green-100 ring-2 ring-green-400/30",
50
+ "gradient-red": "border-red-500/60 bg-red-500/20 text-red-100 ring-2 ring-red-400/30",
51
+ "gradient-yellow": "border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30",
52
+ "gradient-purple": "border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30",
53
+ "gradient-teal": "border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30",
54
+ "gradient-indigo": "border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30",
55
+ "gradient-pink": "border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30",
56
+ "gradient-orange": "border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30"
57
+ },
58
+ size: {
59
+ sm: "size-8 text-xs",
60
+ md: "size-9 text-sm",
61
+ lg: "size-10 text-base"
62
+ }
63
+ },
64
+ defaultVariants: {
65
+ appearance: "upcoming",
66
+ size: "md"
67
+ }
68
+ }
69
+ );
70
+ var StepperContext = createContext(null);
71
+ function useStepper(component) {
72
+ const ctx = useContext(StepperContext);
73
+ if (!ctx) {
74
+ throw new Error(`${component} must be used within <Stepper>`);
75
+ }
76
+ return ctx;
77
+ }
78
+ var StepperIndexContext = createContext(null);
79
+ function useStepperIndex(component) {
80
+ const index = useContext(StepperIndexContext);
81
+ if (index === null) {
82
+ throw new Error(`${component} must be used within <StepperItem>`);
83
+ }
84
+ return index;
85
+ }
86
+ function Stepper({
87
+ className,
88
+ orientation = "horizontal",
89
+ size = "md",
90
+ children,
91
+ ref,
92
+ ...rest
93
+ }) {
94
+ const items = useMemo(
95
+ () => Children.toArray(children).filter(isValidElement),
96
+ [children]
97
+ );
98
+ const ctx = useMemo(
99
+ () => ({
100
+ orientation: orientation ?? "horizontal",
101
+ size: size ?? "md",
102
+ total: items.length
103
+ }),
104
+ [items.length, orientation, size]
105
+ );
106
+ return /* @__PURE__ */ jsx(StepperContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
107
+ "div",
108
+ {
109
+ ref,
110
+ "data-slot": "stepper",
111
+ role: "list",
112
+ className: cn(stepperVariants({ orientation }), className),
113
+ ...rest,
114
+ children: items.map((child, index) => /* @__PURE__ */ jsx(StepperIndexContext.Provider, { value: index, children: child }, index))
115
+ }
116
+ ) });
117
+ }
118
+ Stepper.displayName = "Stepper";
119
+ function StepperItem({
120
+ className,
121
+ ref,
122
+ children,
123
+ ...rest
124
+ }) {
125
+ const { orientation } = useStepper("StepperItem");
126
+ return /* @__PURE__ */ jsx(
127
+ "div",
128
+ {
129
+ ref,
130
+ "data-slot": "stepper-item",
131
+ role: "listitem",
132
+ className: cn(stepperItemVariants({ orientation }), className),
133
+ ...rest,
134
+ children
135
+ }
136
+ );
137
+ }
138
+ StepperItem.displayName = "StepperItem";
139
+ function StepperIndicator({
140
+ className,
141
+ ref,
142
+ children,
143
+ appearance,
144
+ ...rest
145
+ }) {
146
+ const { size } = useStepper("StepperIndicator");
147
+ const index = useStepperIndex("StepperIndicator");
148
+ return /* @__PURE__ */ jsx(
149
+ "div",
150
+ {
151
+ ref,
152
+ "data-slot": "stepper-indicator",
153
+ className: cn(stepperIndicatorVariants({ appearance, size }), className),
154
+ ...rest,
155
+ children: children ?? index + 1
156
+ }
157
+ );
158
+ }
159
+ StepperIndicator.displayName = "StepperIndicator";
160
+ function StepperTitle({
161
+ className,
162
+ ref,
163
+ ...rest
164
+ }) {
165
+ return /* @__PURE__ */ jsx(
166
+ "div",
167
+ {
168
+ ref,
169
+ "data-slot": "stepper-title",
170
+ className: cn(
171
+ "mt-3 text-sm font-semibold",
172
+ className
173
+ ),
174
+ ...rest
175
+ }
176
+ );
177
+ }
178
+ StepperTitle.displayName = "StepperTitle";
179
+ function StepperDescription({
180
+ className,
181
+ ref,
182
+ ...rest
183
+ }) {
184
+ return /* @__PURE__ */ jsx(
185
+ "p",
186
+ {
187
+ ref,
188
+ "data-slot": "stepper-description",
189
+ className: cn("mt-1 text-xs text-slate-400", className),
190
+ ...rest
191
+ }
192
+ );
193
+ }
194
+ StepperDescription.displayName = "StepperDescription";
195
+
196
+ export { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperTitle, stepperIndicatorVariants, stepperItemVariants, stepperVariants };
197
+ //# sourceMappingURL=stepper.mjs.map
198
+ //# sourceMappingURL=stepper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ui/stepper/variants.ts","../../src/ui/stepper/stepper.tsx"],"names":[],"mappings":";;;;;AAEO,IAAM,eAAA,GAAkB,IAAI,aAAA,EAAe;AAAA,EAChD,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,UAAA,EAAY,sCAAA;AAAA,MACZ,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,WAAA,EAAa;AAAA;AAEjB,CAAC;AAEM,IAAM,mBAAA,GAAsB,IAAI,qBAAA,EAAuB;AAAA,EAC5D,QAAA,EAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,UAAA,EAAY,2CAAA;AAAA,MACZ,QAAA,EAAU;AAAA;AACZ,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,WAAA,EAAa;AAAA;AAEjB,CAAC;AAEM,IAAM,wBAAA,GAA2B,GAAA;AAAA,EACtC,qGAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,UAAA,EAAY;AAAA,QACV,QAAA,EACE,qFAAA;AAAA,QACF,OAAA,EACE,yEAAA;AAAA,QACF,QAAA,EAAU,2CAAA;AAAA,QACV,GAAA,EAAK,qEAAA;AA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uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,4BAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAEpB,SAAS,kBAAA,CAAmB;AAAA,EACjC,SAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwE;AACtE,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,6BAAA,EAA+B,SAAS,CAAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,kBAAA,CAAmB,WAAA,GAAc,oBAAA","file":"stepper.mjs","sourcesContent":["import { cva } from \"class-variance-authority\";\n\nexport const stepperVariants = cva(\"flex w-full\", {\n variants: {\n orientation: {\n horizontal: \"flex-row flex-wrap items-start gap-4\",\n vertical: \"flex-col gap-6\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n});\n\nexport const stepperItemVariants = cva(\"relative flex gap-3\", {\n variants: {\n orientation: {\n horizontal: \"min-w-0 flex-col items-center text-center\",\n vertical: \"flex-row items-start text-left\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n});\n\nexport const stepperIndicatorVariants = cva(\n \"grid size-9 shrink-0 place-items-center rounded-full border text-sm font-semibold transition-colors\",\n {\n variants: {\n appearance: {\n complete:\n \"border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30\",\n current:\n \"border-violet-400 bg-violet-500/20 text-white ring-2 ring-violet-400/50\",\n upcoming: \"border-white/15 bg-white/5 text-slate-400\",\n sky: \"border-sky-500/60 bg-sky-500/20 text-sky-100 ring-2 ring-sky-400/30\",\n rose: \"border-rose-500/60 bg-rose-500/20 text-rose-100 ring-2 ring-rose-400/30\",\n purple: \"border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30\",\n pink: \"border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30\",\n orange: \"border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30\",\n yellow: \"border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30\",\n teal: \"border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30\",\n indigo: \"border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30\",\n emerald: \"border-emerald-500/60 bg-emerald-500/20 text-emerald-100 ring-2 ring-emerald-400/30\",\n gray: \"border-gray-500/60 bg-gray-500/20 text-gray-100 ring-2 ring-gray-400/30\",\n violet: \"border-violet-500/60 bg-violet-500/20 text-violet-100 ring-2 ring-violet-400/30\",\n \"gradient-blue\": \"border-blue-500/60 bg-blue-500/20 text-blue-100 ring-2 ring-blue-400/30\",\n \"gradient-green\": \"border-green-500/60 bg-green-500/20 text-green-100 ring-2 ring-green-400/30\",\n \"gradient-red\": \"border-red-500/60 bg-red-500/20 text-red-100 ring-2 ring-red-400/30\",\n \"gradient-yellow\": \"border-yellow-500/60 bg-yellow-500/20 text-yellow-100 ring-2 ring-yellow-400/30\",\n \"gradient-purple\": \"border-purple-500/60 bg-purple-500/20 text-purple-100 ring-2 ring-purple-400/30\",\n \"gradient-teal\": \"border-teal-500/60 bg-teal-500/20 text-teal-100 ring-2 ring-teal-400/30\",\n \"gradient-indigo\": \"border-indigo-500/60 bg-indigo-500/20 text-indigo-100 ring-2 ring-indigo-400/30\",\n \"gradient-pink\": \"border-pink-500/60 bg-pink-500/20 text-pink-100 ring-2 ring-pink-400/30\",\n \"gradient-orange\": \"border-orange-500/60 bg-orange-500/20 text-orange-100 ring-2 ring-orange-400/30\",\n },\n size: {\n sm: \"size-8 text-xs\",\n md: \"size-9 text-sm\",\n lg: \"size-10 text-base\",\n },\n },\n defaultVariants: {\n appearance: \"upcoming\",\n size: \"md\",\n },\n },\n);\n","\"use client\";\n\nimport {\n Children,\n createContext,\n isValidElement,\n useContext,\n useMemo,\n type Ref,\n} from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type {\n StepperCtx,\n StepperDescriptionProps,\n StepperIndicatorProps,\n StepperItemProps,\n StepperProps,\n StepperTitleProps,\n} from \"./types\";\nimport {\n stepperIndicatorVariants,\n stepperItemVariants,\n stepperVariants,\n} from \"./variants\";\n\n\nconst StepperContext = createContext<StepperCtx | null>(null);\n\nfunction useStepper(component: string): StepperCtx {\n const ctx = useContext(StepperContext);\n if (!ctx) {\n throw new Error(`${component} must be used within <Stepper>`);\n }\n return ctx;\n}\n\nconst StepperIndexContext = createContext<number | null>(null);\n\nfunction useStepperIndex(component: string): number {\n const index = useContext(StepperIndexContext);\n if (index === null) {\n throw new Error(`${component} must be used within <StepperItem>`);\n }\n return index;\n}\n\n\nexport function Stepper({\n className,\n orientation = \"horizontal\",\n size = \"md\",\n children,\n ref,\n ...rest\n}: StepperProps & { ref?: Ref<HTMLDivElement> }) {\n const items = useMemo(\n () => Children.toArray(children).filter(isValidElement),\n [children],\n );\n const ctx = useMemo(\n () => ({\n orientation: orientation ?? \"horizontal\",\n size: size ?? \"md\",\n total: items.length,\n }),\n [items.length, orientation, size],\n );\n\n return (\n <StepperContext.Provider value={ctx}>\n <div\n ref={ref}\n data-slot=\"stepper\"\n role=\"list\"\n className={cn(stepperVariants({ orientation }), className)}\n {...rest}\n >\n {items.map((child, index) => (\n <StepperIndexContext.Provider key={index} value={index}>\n {child}\n </StepperIndexContext.Provider>\n ))}\n </div>\n </StepperContext.Provider>\n );\n}\n\nStepper.displayName = \"Stepper\";\n\nexport function StepperItem({\n className,\n ref,\n children,\n ...rest\n}: StepperItemProps & { ref?: React.Ref<HTMLDivElement> }) {\n const { orientation } = useStepper(\"StepperItem\");\n return (\n <div\n ref={ref}\n data-slot=\"stepper-item\"\n role=\"listitem\"\n className={cn(stepperItemVariants({ orientation }), className)}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nStepperItem.displayName = \"StepperItem\";\n\nexport function StepperIndicator({\n className,\n ref,\n children,\n appearance,\n ...rest\n}: StepperIndicatorProps & { ref?: React.Ref<HTMLDivElement> }) {\n const { size } = useStepper(\"StepperIndicator\");\n const index = useStepperIndex(\"StepperIndicator\");\n return (\n <div\n ref={ref}\n data-slot=\"stepper-indicator\"\n className={cn(stepperIndicatorVariants({ appearance, size }), className)}\n {...rest}\n >\n {children ?? index + 1}\n </div>\n );\n}\n\nStepperIndicator.displayName = \"StepperIndicator\";\n\nexport function StepperTitle({\n className,\n ref,\n ...rest\n}: StepperTitleProps & { ref?: React.Ref<HTMLDivElement> }) {\n return (\n <div\n ref={ref}\n data-slot=\"stepper-title\"\n className={cn(\n \"mt-3 text-sm font-semibold\",\n className,\n )}\n {...rest}\n />\n );\n}\n\nStepperTitle.displayName = \"StepperTitle\";\n\nexport function StepperDescription({\n className,\n ref,\n ...rest\n}: StepperDescriptionProps & { ref?: React.Ref<HTMLParagraphElement> }) {\n return (\n <p\n ref={ref}\n data-slot=\"stepper-description\"\n className={cn(\"mt-1 text-xs text-slate-400\", className)}\n {...rest}\n />\n );\n}\n\nStepperDescription.displayName = \"StepperDescription\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zentauri-ui/zentauri-components",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A UI component library built with React and Tailwind CSS",
5
5
  "license": "MIT",
6
6
  "files": ["dist"],