@pactor-app/ui 0.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,136 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-RQHJBTEU.js";
4
+
5
+ // src/ui/accordion.tsx
6
+ import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
7
+ import { ChevronDownIcon } from "lucide-react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ function toArray(value) {
10
+ if (value === void 0) {
11
+ return void 0;
12
+ }
13
+ return Array.isArray(value) ? value : [value];
14
+ }
15
+ function Accordion({
16
+ type = "single",
17
+ value,
18
+ defaultValue,
19
+ onValueChange,
20
+ ...props
21
+ }) {
22
+ return /* @__PURE__ */ jsx(
23
+ AccordionPrimitive.Root,
24
+ {
25
+ "data-slot": "accordion",
26
+ multiple: type === "multiple",
27
+ value: toArray(value),
28
+ defaultValue: toArray(defaultValue),
29
+ onValueChange: onValueChange === void 0 ? void 0 : (next) => onValueChange(type === "multiple" ? next : next[0] ?? ""),
30
+ ...props
31
+ }
32
+ );
33
+ }
34
+ function AccordionItem({
35
+ className,
36
+ ...props
37
+ }) {
38
+ return /* @__PURE__ */ jsx(
39
+ AccordionPrimitive.Item,
40
+ {
41
+ "data-slot": "accordion-item",
42
+ className: cn("border-b border-border last:border-b-0", className),
43
+ ...props
44
+ }
45
+ );
46
+ }
47
+ function AccordionTrigger({
48
+ className,
49
+ children,
50
+ ...props
51
+ }) {
52
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
53
+ AccordionPrimitive.Trigger,
54
+ {
55
+ "data-slot": "accordion-trigger",
56
+ className: cn(
57
+ "flex flex-1 cursor-pointer items-center justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-colors outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[aria-expanded=true]>svg]:rotate-180",
58
+ className
59
+ ),
60
+ ...props,
61
+ children: [
62
+ children,
63
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200" })
64
+ ]
65
+ }
66
+ ) });
67
+ }
68
+ function AccordionContent({
69
+ className,
70
+ children,
71
+ ...props
72
+ }) {
73
+ return /* @__PURE__ */ jsx(
74
+ AccordionPrimitive.Panel,
75
+ {
76
+ "data-slot": "accordion-content",
77
+ className: "overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",
78
+ ...props,
79
+ children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
80
+ }
81
+ );
82
+ }
83
+
84
+ // src/ui/popover.tsx
85
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
86
+ import { jsx as jsx2 } from "react/jsx-runtime";
87
+ function Popover({
88
+ ...props
89
+ }) {
90
+ return /* @__PURE__ */ jsx2(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
91
+ }
92
+ function PopoverTrigger({
93
+ ...props
94
+ }) {
95
+ return /* @__PURE__ */ jsx2(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
96
+ }
97
+ function PopoverContent({
98
+ className,
99
+ align = "center",
100
+ side = "bottom",
101
+ sideOffset = 4,
102
+ anchor,
103
+ ...props
104
+ }) {
105
+ return /* @__PURE__ */ jsx2(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx2(
106
+ PopoverPrimitive.Positioner,
107
+ {
108
+ align,
109
+ side,
110
+ sideOffset,
111
+ anchor,
112
+ className: "isolate z-50",
113
+ children: /* @__PURE__ */ jsx2(
114
+ PopoverPrimitive.Popup,
115
+ {
116
+ "data-slot": "popover-content",
117
+ className: cn(
118
+ "z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
119
+ className
120
+ ),
121
+ ...props
122
+ }
123
+ )
124
+ }
125
+ ) });
126
+ }
127
+
128
+ export {
129
+ Accordion,
130
+ AccordionItem,
131
+ AccordionTrigger,
132
+ AccordionContent,
133
+ Popover,
134
+ PopoverTrigger,
135
+ PopoverContent
136
+ };