@saasflare/ui 1.0.0 → 1.0.1

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,223 @@
1
+ 'use strict';
2
+
3
+ var chunk7UB3R5JU_js = require('../chunk-7UB3R5JU.js');
4
+ var chunkJOVJRQO3_js = require('../chunk-JOVJRQO3.js');
5
+ var React = require('react');
6
+ var useEmblaCarousel = require('embla-carousel-react');
7
+ var lucideReact = require('lucide-react');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
+ var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
32
+
33
+ var CarouselContext = React__namespace.createContext(null);
34
+ function useCarousel() {
35
+ const context = React__namespace.useContext(CarouselContext);
36
+ if (!context) {
37
+ throw new Error("useCarousel must be used within a <Carousel />");
38
+ }
39
+ return context;
40
+ }
41
+ function Carousel({
42
+ orientation = "horizontal",
43
+ opts,
44
+ setApi,
45
+ plugins,
46
+ className,
47
+ children,
48
+ ...props
49
+ }) {
50
+ const [carouselRef, api] = useEmblaCarousel__default.default(
51
+ {
52
+ ...opts,
53
+ axis: orientation === "horizontal" ? "x" : "y"
54
+ },
55
+ plugins
56
+ );
57
+ const [canScrollPrev, setCanScrollPrev] = React__namespace.useState(false);
58
+ const [canScrollNext, setCanScrollNext] = React__namespace.useState(false);
59
+ const onSelect = React__namespace.useCallback((api2) => {
60
+ if (!api2) return;
61
+ setCanScrollPrev(api2.canScrollPrev());
62
+ setCanScrollNext(api2.canScrollNext());
63
+ }, []);
64
+ const scrollPrev = React__namespace.useCallback(() => {
65
+ api?.scrollPrev();
66
+ }, [api]);
67
+ const scrollNext = React__namespace.useCallback(() => {
68
+ api?.scrollNext();
69
+ }, [api]);
70
+ const handleKeyDown = React__namespace.useCallback(
71
+ (event) => {
72
+ if (event.key === "ArrowLeft") {
73
+ event.preventDefault();
74
+ scrollPrev();
75
+ } else if (event.key === "ArrowRight") {
76
+ event.preventDefault();
77
+ scrollNext();
78
+ }
79
+ },
80
+ [scrollPrev, scrollNext]
81
+ );
82
+ React__namespace.useEffect(() => {
83
+ if (!api || !setApi) return;
84
+ setApi(api);
85
+ }, [api, setApi]);
86
+ React__namespace.useEffect(() => {
87
+ if (!api) return;
88
+ onSelect(api);
89
+ api.on("reInit", onSelect);
90
+ api.on("select", onSelect);
91
+ return () => {
92
+ api?.off("select", onSelect);
93
+ };
94
+ }, [api, onSelect]);
95
+ return /* @__PURE__ */ jsxRuntime.jsx(
96
+ CarouselContext.Provider,
97
+ {
98
+ value: {
99
+ carouselRef,
100
+ api,
101
+ opts,
102
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
103
+ scrollPrev,
104
+ scrollNext,
105
+ canScrollPrev,
106
+ canScrollNext
107
+ },
108
+ children: /* @__PURE__ */ jsxRuntime.jsx(
109
+ "div",
110
+ {
111
+ onKeyDownCapture: handleKeyDown,
112
+ className: chunkJOVJRQO3_js.cn("relative", className),
113
+ role: "region",
114
+ "aria-roledescription": "carousel",
115
+ "data-slot": "carousel",
116
+ ...props,
117
+ children
118
+ }
119
+ )
120
+ }
121
+ );
122
+ }
123
+ function CarouselContent({ className, ...props }) {
124
+ const { carouselRef, orientation } = useCarousel();
125
+ return /* @__PURE__ */ jsxRuntime.jsx(
126
+ "div",
127
+ {
128
+ ref: carouselRef,
129
+ className: "overflow-hidden",
130
+ "data-slot": "carousel-content",
131
+ children: /* @__PURE__ */ jsxRuntime.jsx(
132
+ "div",
133
+ {
134
+ className: chunkJOVJRQO3_js.cn(
135
+ "flex",
136
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
137
+ className
138
+ ),
139
+ ...props
140
+ }
141
+ )
142
+ }
143
+ );
144
+ }
145
+ function CarouselItem({ className, ...props }) {
146
+ const { orientation } = useCarousel();
147
+ return /* @__PURE__ */ jsxRuntime.jsx(
148
+ "div",
149
+ {
150
+ role: "group",
151
+ "aria-roledescription": "slide",
152
+ "data-slot": "carousel-item",
153
+ className: chunkJOVJRQO3_js.cn(
154
+ "min-w-0 shrink-0 grow-0 basis-full",
155
+ orientation === "horizontal" ? "pl-4" : "pt-4",
156
+ className
157
+ ),
158
+ ...props
159
+ }
160
+ );
161
+ }
162
+ function CarouselPrevious({
163
+ className,
164
+ variant = "outline",
165
+ size = "icon",
166
+ ...props
167
+ }) {
168
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
169
+ return /* @__PURE__ */ jsxRuntime.jsxs(
170
+ chunk7UB3R5JU_js.Button,
171
+ {
172
+ "data-slot": "carousel-previous",
173
+ variant,
174
+ size,
175
+ className: chunkJOVJRQO3_js.cn(
176
+ "absolute size-8 rounded-full",
177
+ orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
178
+ className
179
+ ),
180
+ disabled: !canScrollPrev,
181
+ onClick: scrollPrev,
182
+ ...props,
183
+ children: [
184
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, {}),
185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Previous slide" })
186
+ ]
187
+ }
188
+ );
189
+ }
190
+ function CarouselNext({
191
+ className,
192
+ variant = "outline",
193
+ size = "icon",
194
+ ...props
195
+ }) {
196
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
197
+ return /* @__PURE__ */ jsxRuntime.jsxs(
198
+ chunk7UB3R5JU_js.Button,
199
+ {
200
+ "data-slot": "carousel-next",
201
+ variant,
202
+ size,
203
+ className: chunkJOVJRQO3_js.cn(
204
+ "absolute size-8 rounded-full",
205
+ orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
206
+ className
207
+ ),
208
+ disabled: !canScrollNext,
209
+ onClick: scrollNext,
210
+ ...props,
211
+ children: [
212
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, {}),
213
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Next slide" })
214
+ ]
215
+ }
216
+ );
217
+ }
218
+
219
+ exports.Carousel = Carousel;
220
+ exports.CarouselContent = CarouselContent;
221
+ exports.CarouselItem = CarouselItem;
222
+ exports.CarouselNext = CarouselNext;
223
+ exports.CarouselPrevious = CarouselPrevious;
@@ -0,0 +1,194 @@
1
+ import { Button } from '../chunk-P2JF7JDY.mjs';
2
+ import { cn } from '../chunk-S26666D6.mjs';
3
+ import * as React from 'react';
4
+ import useEmblaCarousel from 'embla-carousel-react';
5
+ import { ArrowLeft, ArrowRight } from 'lucide-react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ var CarouselContext = React.createContext(null);
9
+ function useCarousel() {
10
+ const context = React.useContext(CarouselContext);
11
+ if (!context) {
12
+ throw new Error("useCarousel must be used within a <Carousel />");
13
+ }
14
+ return context;
15
+ }
16
+ function Carousel({
17
+ orientation = "horizontal",
18
+ opts,
19
+ setApi,
20
+ plugins,
21
+ className,
22
+ children,
23
+ ...props
24
+ }) {
25
+ const [carouselRef, api] = useEmblaCarousel(
26
+ {
27
+ ...opts,
28
+ axis: orientation === "horizontal" ? "x" : "y"
29
+ },
30
+ plugins
31
+ );
32
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
33
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
34
+ const onSelect = React.useCallback((api2) => {
35
+ if (!api2) return;
36
+ setCanScrollPrev(api2.canScrollPrev());
37
+ setCanScrollNext(api2.canScrollNext());
38
+ }, []);
39
+ const scrollPrev = React.useCallback(() => {
40
+ api?.scrollPrev();
41
+ }, [api]);
42
+ const scrollNext = React.useCallback(() => {
43
+ api?.scrollNext();
44
+ }, [api]);
45
+ const handleKeyDown = React.useCallback(
46
+ (event) => {
47
+ if (event.key === "ArrowLeft") {
48
+ event.preventDefault();
49
+ scrollPrev();
50
+ } else if (event.key === "ArrowRight") {
51
+ event.preventDefault();
52
+ scrollNext();
53
+ }
54
+ },
55
+ [scrollPrev, scrollNext]
56
+ );
57
+ React.useEffect(() => {
58
+ if (!api || !setApi) return;
59
+ setApi(api);
60
+ }, [api, setApi]);
61
+ React.useEffect(() => {
62
+ if (!api) return;
63
+ onSelect(api);
64
+ api.on("reInit", onSelect);
65
+ api.on("select", onSelect);
66
+ return () => {
67
+ api?.off("select", onSelect);
68
+ };
69
+ }, [api, onSelect]);
70
+ return /* @__PURE__ */ jsx(
71
+ CarouselContext.Provider,
72
+ {
73
+ value: {
74
+ carouselRef,
75
+ api,
76
+ opts,
77
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
78
+ scrollPrev,
79
+ scrollNext,
80
+ canScrollPrev,
81
+ canScrollNext
82
+ },
83
+ children: /* @__PURE__ */ jsx(
84
+ "div",
85
+ {
86
+ onKeyDownCapture: handleKeyDown,
87
+ className: cn("relative", className),
88
+ role: "region",
89
+ "aria-roledescription": "carousel",
90
+ "data-slot": "carousel",
91
+ ...props,
92
+ children
93
+ }
94
+ )
95
+ }
96
+ );
97
+ }
98
+ function CarouselContent({ className, ...props }) {
99
+ const { carouselRef, orientation } = useCarousel();
100
+ return /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ ref: carouselRef,
104
+ className: "overflow-hidden",
105
+ "data-slot": "carousel-content",
106
+ children: /* @__PURE__ */ jsx(
107
+ "div",
108
+ {
109
+ className: cn(
110
+ "flex",
111
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
112
+ className
113
+ ),
114
+ ...props
115
+ }
116
+ )
117
+ }
118
+ );
119
+ }
120
+ function CarouselItem({ className, ...props }) {
121
+ const { orientation } = useCarousel();
122
+ return /* @__PURE__ */ jsx(
123
+ "div",
124
+ {
125
+ role: "group",
126
+ "aria-roledescription": "slide",
127
+ "data-slot": "carousel-item",
128
+ className: cn(
129
+ "min-w-0 shrink-0 grow-0 basis-full",
130
+ orientation === "horizontal" ? "pl-4" : "pt-4",
131
+ className
132
+ ),
133
+ ...props
134
+ }
135
+ );
136
+ }
137
+ function CarouselPrevious({
138
+ className,
139
+ variant = "outline",
140
+ size = "icon",
141
+ ...props
142
+ }) {
143
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
144
+ return /* @__PURE__ */ jsxs(
145
+ Button,
146
+ {
147
+ "data-slot": "carousel-previous",
148
+ variant,
149
+ size,
150
+ className: cn(
151
+ "absolute size-8 rounded-full",
152
+ orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
153
+ className
154
+ ),
155
+ disabled: !canScrollPrev,
156
+ onClick: scrollPrev,
157
+ ...props,
158
+ children: [
159
+ /* @__PURE__ */ jsx(ArrowLeft, {}),
160
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
161
+ ]
162
+ }
163
+ );
164
+ }
165
+ function CarouselNext({
166
+ className,
167
+ variant = "outline",
168
+ size = "icon",
169
+ ...props
170
+ }) {
171
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
172
+ return /* @__PURE__ */ jsxs(
173
+ Button,
174
+ {
175
+ "data-slot": "carousel-next",
176
+ variant,
177
+ size,
178
+ className: cn(
179
+ "absolute size-8 rounded-full",
180
+ orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
181
+ className
182
+ ),
183
+ disabled: !canScrollNext,
184
+ onClick: scrollNext,
185
+ ...props,
186
+ children: [
187
+ /* @__PURE__ */ jsx(ArrowRight, {}),
188
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
189
+ ]
190
+ }
191
+ );
192
+ }
193
+
194
+ export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious };
@@ -0,0 +1,69 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import * as RechartsPrimitive from 'recharts';
4
+
5
+ declare const THEMES: {
6
+ readonly light: "";
7
+ readonly dark: ".dark";
8
+ };
9
+ type ChartConfig = {
10
+ [k in string]: {
11
+ label?: React.ReactNode;
12
+ icon?: React.ComponentType;
13
+ } & ({
14
+ color?: string;
15
+ theme?: never;
16
+ } | {
17
+ color?: never;
18
+ theme: Record<keyof typeof THEMES, string>;
19
+ });
20
+ };
21
+ declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
22
+ config: ChartConfig;
23
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
24
+ }): react_jsx_runtime.JSX.Element;
25
+ declare const ChartStyle: ({ id, config }: {
26
+ id: string;
27
+ config: ChartConfig;
28
+ }) => react_jsx_runtime.JSX.Element | null;
29
+ declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
30
+ interface ChartTooltipPayloadItem {
31
+ name?: string;
32
+ value?: number | string;
33
+ dataKey?: string | number;
34
+ type?: string;
35
+ color?: string;
36
+ fill?: string;
37
+ payload?: Record<string, unknown>;
38
+ }
39
+ interface ChartTooltipContentProps extends React.ComponentProps<"div"> {
40
+ active?: boolean;
41
+ payload?: ChartTooltipPayloadItem[];
42
+ label?: string | number;
43
+ labelFormatter?: (label: unknown, payload: ChartTooltipPayloadItem[]) => React.ReactNode;
44
+ labelClassName?: string;
45
+ formatter?: (value: unknown, name: string, entry: ChartTooltipPayloadItem, index: number, payload: unknown) => React.ReactNode;
46
+ color?: string;
47
+ hideLabel?: boolean;
48
+ hideIndicator?: boolean;
49
+ indicator?: "line" | "dot" | "dashed";
50
+ nameKey?: string;
51
+ labelKey?: string;
52
+ }
53
+ declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): react_jsx_runtime.JSX.Element | null;
54
+ declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
55
+ interface ChartLegendPayloadItem {
56
+ value?: string;
57
+ type?: string;
58
+ color?: string;
59
+ dataKey?: string | number;
60
+ }
61
+ interface ChartLegendContentProps extends React.ComponentProps<"div"> {
62
+ payload?: ChartLegendPayloadItem[];
63
+ verticalAlign?: "top" | "bottom" | "middle";
64
+ hideIcon?: boolean;
65
+ nameKey?: string;
66
+ }
67
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): react_jsx_runtime.JSX.Element | null;
68
+
69
+ export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
@@ -0,0 +1,69 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import * as RechartsPrimitive from 'recharts';
4
+
5
+ declare const THEMES: {
6
+ readonly light: "";
7
+ readonly dark: ".dark";
8
+ };
9
+ type ChartConfig = {
10
+ [k in string]: {
11
+ label?: React.ReactNode;
12
+ icon?: React.ComponentType;
13
+ } & ({
14
+ color?: string;
15
+ theme?: never;
16
+ } | {
17
+ color?: never;
18
+ theme: Record<keyof typeof THEMES, string>;
19
+ });
20
+ };
21
+ declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
22
+ config: ChartConfig;
23
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
24
+ }): react_jsx_runtime.JSX.Element;
25
+ declare const ChartStyle: ({ id, config }: {
26
+ id: string;
27
+ config: ChartConfig;
28
+ }) => react_jsx_runtime.JSX.Element | null;
29
+ declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
30
+ interface ChartTooltipPayloadItem {
31
+ name?: string;
32
+ value?: number | string;
33
+ dataKey?: string | number;
34
+ type?: string;
35
+ color?: string;
36
+ fill?: string;
37
+ payload?: Record<string, unknown>;
38
+ }
39
+ interface ChartTooltipContentProps extends React.ComponentProps<"div"> {
40
+ active?: boolean;
41
+ payload?: ChartTooltipPayloadItem[];
42
+ label?: string | number;
43
+ labelFormatter?: (label: unknown, payload: ChartTooltipPayloadItem[]) => React.ReactNode;
44
+ labelClassName?: string;
45
+ formatter?: (value: unknown, name: string, entry: ChartTooltipPayloadItem, index: number, payload: unknown) => React.ReactNode;
46
+ color?: string;
47
+ hideLabel?: boolean;
48
+ hideIndicator?: boolean;
49
+ indicator?: "line" | "dot" | "dashed";
50
+ nameKey?: string;
51
+ labelKey?: string;
52
+ }
53
+ declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): react_jsx_runtime.JSX.Element | null;
54
+ declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
55
+ interface ChartLegendPayloadItem {
56
+ value?: string;
57
+ type?: string;
58
+ color?: string;
59
+ dataKey?: string | number;
60
+ }
61
+ interface ChartLegendContentProps extends React.ComponentProps<"div"> {
62
+ payload?: ChartLegendPayloadItem[];
63
+ verticalAlign?: "top" | "bottom" | "middle";
64
+ hideIcon?: boolean;
65
+ nameKey?: string;
66
+ }
67
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): react_jsx_runtime.JSX.Element | null;
68
+
69
+ export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };