@alexgorbatchev/shadcn 0.0.31 → 0.0.32
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/README.md +1 -0
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/dist/{chunk-0ewzb2ax.js → chunk-0kyfh857.js} +1 -1
- package/dist/{chunk-8wfy03bp.js → chunk-6kwf9644.js} +1 -1
- package/dist/{chunk-82e7fbmq.js → chunk-9vyg3854.js} +2 -1
- package/dist/chunk-c6g2rbhv.js +3940 -0
- package/dist/chunk-dzvsjw59.js +200 -0
- package/dist/chunk-tch86q2w.js +6050 -0
- package/dist/{chunk-53q730zs.js → chunk-zdt8xxzy.js} +3 -0
- package/dist/components/Alert.d.ts +1 -1
- package/dist/components/assistant-ui/elements/Chart.js +2 -2
- package/dist/components/assistant-ui/elements/GuardrailNotice.js +2 -2
- package/dist/components/assistant-ui/index.js +4 -4
- package/dist/components/assistant-ui/native/Sources.d.ts +1 -1
- package/dist/components/carousel/index.js +15 -204
- package/dist/components/chart/AnalyticsChart.d.ts +3 -2
- package/dist/components/chart/Chart.d.ts +1 -1
- package/dist/components/chart/index.js +24 -10
- package/dist/components/chart/types.d.ts +1 -0
- package/dist/components/json-render/JsonAccordion.d.ts +3 -0
- package/dist/components/json-render/JsonAlert.d.ts +3 -0
- package/dist/components/json-render/JsonAvatar.d.ts +3 -0
- package/dist/components/json-render/JsonBadge.d.ts +3 -0
- package/dist/components/json-render/JsonButton.d.ts +3 -0
- package/dist/components/json-render/JsonButtonGroup.d.ts +3 -0
- package/dist/components/json-render/JsonCard.d.ts +3 -0
- package/dist/components/json-render/JsonCarousel.d.ts +3 -0
- package/dist/components/json-render/JsonCheckbox.d.ts +3 -0
- package/dist/components/json-render/JsonCollapsible.d.ts +3 -0
- package/dist/components/json-render/JsonDialog.d.ts +3 -0
- package/dist/components/json-render/JsonDrawer.d.ts +3 -0
- package/dist/components/json-render/JsonDropdownMenu.d.ts +3 -0
- package/dist/components/json-render/JsonGrid.d.ts +3 -0
- package/dist/components/json-render/JsonHeading.d.ts +3 -0
- package/dist/components/json-render/JsonImage.d.ts +3 -0
- package/dist/components/json-render/JsonInput.d.ts +3 -0
- package/dist/components/json-render/JsonLink.d.ts +3 -0
- package/dist/components/json-render/JsonPagination.d.ts +3 -0
- package/dist/components/json-render/JsonPopover.d.ts +3 -0
- package/dist/components/json-render/JsonProgress.d.ts +3 -0
- package/dist/components/json-render/JsonRadio.d.ts +3 -0
- package/dist/components/json-render/JsonSelect.d.ts +3 -0
- package/dist/components/json-render/JsonSeparator.d.ts +3 -0
- package/dist/components/json-render/JsonSkeleton.d.ts +3 -0
- package/dist/components/json-render/JsonSlider.d.ts +3 -0
- package/dist/components/json-render/JsonSpinner.d.ts +3 -0
- package/dist/components/json-render/JsonStack.d.ts +3 -0
- package/dist/components/json-render/JsonSwitch.d.ts +3 -0
- package/dist/components/json-render/JsonTable.d.ts +3 -0
- package/dist/components/json-render/JsonTabs.d.ts +3 -0
- package/dist/components/json-render/JsonText.d.ts +3 -0
- package/dist/components/json-render/JsonTextarea.d.ts +3 -0
- package/dist/components/json-render/JsonToggle.d.ts +3 -0
- package/dist/components/json-render/JsonToggleGroup.d.ts +3 -0
- package/dist/components/json-render/JsonTooltip.d.ts +3 -0
- package/dist/components/json-render/catalog.d.ts +548 -0
- package/dist/components/json-render/catalog.js +6 -0
- package/dist/components/json-render/getPaginationRange.d.ts +1 -0
- package/dist/components/json-render/index.d.ts +39 -0
- package/dist/components/json-render/index.js +1254 -0
- package/dist/index.js +569 -4191
- package/licenses/json-render-APACHE-2.0.txt +201 -0
- package/llms/components/data-display/AnalyticsChart.md +34 -0
- package/llms/components/data-display/JsonRender.md +476 -0
- package/llms/components/feedback/Alert.md +20 -4
- package/llms/setup.md +1 -0
- package/llms.txt +1 -0
- package/package.json +19 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./chunk-cp2m7y7v.js";
|
|
4
|
+
import {
|
|
5
|
+
Button2
|
|
6
|
+
} from "./chunk-q7p28b89.js";
|
|
7
|
+
|
|
8
|
+
// src/components/carousel/Carousel.tsx
|
|
9
|
+
import { useCallback, useEffect, useState } from "react";
|
|
10
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
11
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
12
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon } from "lucide-react";
|
|
13
|
+
|
|
14
|
+
// src/components/carousel/CarouselContext.ts
|
|
15
|
+
import { createContext } from "react";
|
|
16
|
+
var CarouselContext = createContext(null);
|
|
17
|
+
|
|
18
|
+
// src/components/carousel/hooks/useCarousel.ts
|
|
19
|
+
import { useContext } from "react";
|
|
20
|
+
function useCarousel2() {
|
|
21
|
+
const context = useContext(CarouselContext);
|
|
22
|
+
if (!context)
|
|
23
|
+
throw new Error("useCarousel must be used within Carousel.");
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/components/carousel/Carousel.tsx
|
|
28
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
29
|
+
function Carousel2({
|
|
30
|
+
density,
|
|
31
|
+
orientation = "horizontal",
|
|
32
|
+
opts,
|
|
33
|
+
setApi,
|
|
34
|
+
plugins,
|
|
35
|
+
className,
|
|
36
|
+
children,
|
|
37
|
+
onKeyDown,
|
|
38
|
+
...props
|
|
39
|
+
}) {
|
|
40
|
+
const inheritedDirection = useDirection();
|
|
41
|
+
const direction = opts?.direction ?? inheritedDirection;
|
|
42
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
43
|
+
...opts,
|
|
44
|
+
direction,
|
|
45
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
46
|
+
breakpoints: {
|
|
47
|
+
...opts?.breakpoints,
|
|
48
|
+
"(prefers-reduced-motion: reduce)": {
|
|
49
|
+
...opts?.breakpoints?.["(prefers-reduced-motion: reduce)"],
|
|
50
|
+
duration: 0
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, plugins);
|
|
54
|
+
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
55
|
+
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
56
|
+
const scrollPrev = useCallback(() => api?.scrollPrev(), [api]);
|
|
57
|
+
const scrollNext = useCallback(() => api?.scrollNext(), [api]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!api)
|
|
60
|
+
return;
|
|
61
|
+
const update = () => {
|
|
62
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
63
|
+
setCanScrollNext(api.canScrollNext());
|
|
64
|
+
};
|
|
65
|
+
update();
|
|
66
|
+
api.on("reInit", update);
|
|
67
|
+
api.on("select", update);
|
|
68
|
+
return () => {
|
|
69
|
+
api.off("reInit", update);
|
|
70
|
+
api.off("select", update);
|
|
71
|
+
};
|
|
72
|
+
}, [api]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (api)
|
|
75
|
+
setApi?.(api);
|
|
76
|
+
}, [api, setApi]);
|
|
77
|
+
const handleKeyDown = (event) => {
|
|
78
|
+
onKeyDown?.(event);
|
|
79
|
+
if (event.defaultPrevented || event.target !== event.currentTarget)
|
|
80
|
+
return;
|
|
81
|
+
const previousKey = orientation === "vertical" ? "ArrowUp" : direction === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
82
|
+
const nextKey = orientation === "vertical" ? "ArrowDown" : direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
83
|
+
if (event.key === previousKey) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
scrollPrev();
|
|
86
|
+
}
|
|
87
|
+
if (event.key === nextKey) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
scrollNext();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
93
|
+
value: { carouselRef, api, orientation, direction, scrollPrev, scrollNext, canScrollPrev, canScrollNext },
|
|
94
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
95
|
+
"data-slot": "carousel",
|
|
96
|
+
"data-density": density,
|
|
97
|
+
dir: direction,
|
|
98
|
+
role: "region",
|
|
99
|
+
"aria-roledescription": "carousel",
|
|
100
|
+
tabIndex: 0,
|
|
101
|
+
className: cn2("relative outline-none focus-visible:ring-1 focus-visible:ring-ring", className),
|
|
102
|
+
...props,
|
|
103
|
+
onKeyDown: handleKeyDown,
|
|
104
|
+
children
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function CarouselContent2({ className, ...props }) {
|
|
109
|
+
const { carouselRef, orientation } = useCarousel2();
|
|
110
|
+
return /* @__PURE__ */ jsx("div", {
|
|
111
|
+
ref: carouselRef,
|
|
112
|
+
"data-slot": "carousel-content",
|
|
113
|
+
className: "overflow-hidden",
|
|
114
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
115
|
+
className: cn2("flex", orientation === "horizontal" ? "-ms-panel touch-pan-y touch-pinch-zoom" : "-mt-panel flex-col touch-pan-x touch-pinch-zoom", className),
|
|
116
|
+
...props
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function CarouselItem2({ className, ...props }) {
|
|
121
|
+
const { orientation } = useCarousel2();
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
role: "group",
|
|
124
|
+
"aria-roledescription": "slide",
|
|
125
|
+
"data-slot": "carousel-item",
|
|
126
|
+
className: cn2("min-h-0 min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "ps-panel" : "pt-panel", className),
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function CarouselPrevious2({
|
|
131
|
+
className,
|
|
132
|
+
variant = "outline",
|
|
133
|
+
size = "icon-sm",
|
|
134
|
+
disabled,
|
|
135
|
+
onClick,
|
|
136
|
+
children,
|
|
137
|
+
...props
|
|
138
|
+
}) {
|
|
139
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel2();
|
|
140
|
+
return /* @__PURE__ */ jsx(Button2, {
|
|
141
|
+
"data-slot": "carousel-previous",
|
|
142
|
+
variant,
|
|
143
|
+
size,
|
|
144
|
+
className: (state) => cn2("absolute touch-manipulation", orientation === "horizontal" ? "inset-y-0 -start-10 my-auto" : "-top-10 left-1/2 -translate-x-1/2", typeof className === "function" ? className(state) : className),
|
|
145
|
+
disabled: disabled || !canScrollPrev,
|
|
146
|
+
onClick: (event) => {
|
|
147
|
+
onClick?.(event);
|
|
148
|
+
if (!event.defaultPrevented)
|
|
149
|
+
scrollPrev();
|
|
150
|
+
},
|
|
151
|
+
...props,
|
|
152
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, {
|
|
153
|
+
children: [
|
|
154
|
+
orientation === "horizontal" ? /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
155
|
+
className: "rtl:rotate-180"
|
|
156
|
+
}) : /* @__PURE__ */ jsx(ChevronUpIcon, {}),
|
|
157
|
+
/* @__PURE__ */ jsx("span", {
|
|
158
|
+
className: "sr-only",
|
|
159
|
+
children: "Previous slide"
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function CarouselNext2({
|
|
166
|
+
className,
|
|
167
|
+
variant = "outline",
|
|
168
|
+
size = "icon-sm",
|
|
169
|
+
disabled,
|
|
170
|
+
onClick,
|
|
171
|
+
children,
|
|
172
|
+
...props
|
|
173
|
+
}) {
|
|
174
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel2();
|
|
175
|
+
return /* @__PURE__ */ jsx(Button2, {
|
|
176
|
+
"data-slot": "carousel-next",
|
|
177
|
+
variant,
|
|
178
|
+
size,
|
|
179
|
+
className: (state) => cn2("absolute touch-manipulation", orientation === "horizontal" ? "inset-y-0 -end-10 my-auto" : "-bottom-10 left-1/2 -translate-x-1/2", typeof className === "function" ? className(state) : className),
|
|
180
|
+
disabled: disabled || !canScrollNext,
|
|
181
|
+
onClick: (event) => {
|
|
182
|
+
onClick?.(event);
|
|
183
|
+
if (!event.defaultPrevented)
|
|
184
|
+
scrollNext();
|
|
185
|
+
},
|
|
186
|
+
...props,
|
|
187
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, {
|
|
188
|
+
children: [
|
|
189
|
+
orientation === "horizontal" ? /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
190
|
+
className: "rtl:rotate-180"
|
|
191
|
+
}) : /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
|
192
|
+
/* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: "sr-only",
|
|
194
|
+
children: "Next slide"
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
export { useCarousel2, Carousel2, CarouselContent2, CarouselItem2, CarouselPrevious2, CarouselNext2 };
|