@waveso/ui 0.0.10 → 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.
- package/dist/accordion.d.ts +24 -8
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +50 -73
- package/dist/accordion.js.map +1 -1
- package/dist/action-bar.d.ts +83 -0
- package/dist/action-bar.d.ts.map +1 -0
- package/dist/action-bar.js +264 -0
- package/dist/action-bar.js.map +1 -0
- package/dist/alert-dialog.d.ts +56 -21
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +75 -127
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +26 -11
- package/dist/alert.d.ts.map +1 -0
- package/dist/alert.js +37 -68
- package/dist/alert.js.map +1 -1
- package/dist/animate.d.ts +117 -75
- package/dist/animate.d.ts.map +1 -0
- package/dist/animate.js +259 -223
- package/dist/animate.js.map +1 -1
- package/dist/aspect-ratio.d.ts +11 -6
- package/dist/aspect-ratio.d.ts.map +1 -0
- package/dist/aspect-ratio.js +12 -14
- package/dist/aspect-ratio.js.map +1 -1
- package/dist/autocomplete.d.ts +91 -25
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +119 -181
- package/dist/autocomplete.js.map +1 -1
- package/dist/avatar.d.ts +32 -11
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +42 -89
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +15 -8
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +34 -48
- package/dist/badge.js.map +1 -1
- package/dist/breadcrumb.d.ts +35 -11
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +60 -110
- package/dist/breadcrumb.js.map +1 -1
- package/dist/button-group.d.ts +26 -13
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +38 -76
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +17 -10
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +50 -3
- package/dist/button.js.map +1 -1
- package/dist/card.d.ts +35 -11
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +43 -82
- package/dist/card.js.map +1 -1
- package/dist/checkbox.d.ts +6 -4
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +21 -29
- package/dist/checkbox.js.map +1 -1
- package/dist/collapsible.d.ts +15 -7
- package/dist/collapsible.d.ts.map +1 -0
- package/dist/collapsible.js +19 -8
- package/dist/collapsible.js.map +1 -1
- package/dist/combobox.d.ts +83 -23
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +149 -247
- package/dist/combobox.js.map +1 -1
- package/dist/context-menu.d.ts +80 -26
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +108 -164
- package/dist/context-menu.js.map +1 -1
- package/dist/count.d.ts +45 -31
- package/dist/count.d.ts.map +1 -0
- package/dist/count.js +170 -165
- package/dist/count.js.map +1 -1
- package/dist/dialog.d.ts +61 -28
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +77 -120
- package/dist/dialog.js.map +1 -1
- package/dist/direction.d.ts +2 -1
- package/dist/direction.js +3 -3
- package/dist/drawer.d.ts +45 -15
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +93 -5
- package/dist/drawer.js.map +1 -1
- package/dist/encrypted-text.d.ts +25 -12
- package/dist/encrypted-text.d.ts.map +1 -0
- package/dist/encrypted-text.js +102 -134
- package/dist/encrypted-text.js.map +1 -1
- package/dist/field.d.ts +37 -21
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +52 -3
- package/dist/field.js.map +1 -1
- package/dist/film-grain-shader.d.ts +6 -0
- package/dist/film-grain-shader.d.ts.map +1 -0
- package/dist/film-grain-shader.js +88 -0
- package/dist/film-grain-shader.js.map +1 -0
- package/dist/film-grain-webgl.d.ts +20 -0
- package/dist/film-grain-webgl.d.ts.map +1 -0
- package/dist/film-grain-webgl.js +306 -0
- package/dist/film-grain-webgl.js.map +1 -0
- package/dist/film-grain.d.ts +21 -11
- package/dist/film-grain.d.ts.map +1 -0
- package/dist/film-grain.js +28 -420
- package/dist/film-grain.js.map +1 -1
- package/dist/form.d.ts +64 -49
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +112 -91
- package/dist/form.js.map +1 -1
- package/dist/gradient-reveal-text.d.ts +35 -22
- package/dist/gradient-reveal-text.d.ts.map +1 -0
- package/dist/gradient-reveal-text.js +238 -205
- package/dist/gradient-reveal-text.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +3 -1
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +28 -2
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/infinite-scroll.d.ts +29 -15
- package/dist/infinite-scroll.d.ts.map +1 -0
- package/dist/infinite-scroll.js +69 -99
- package/dist/infinite-scroll.js.map +1 -1
- package/dist/input-group.d.ts +41 -18
- package/dist/input-group.d.ts.map +1 -0
- package/dist/input-group.js +80 -6
- package/dist/input-group.js.map +1 -1
- package/dist/input-otp.d.ts +26 -10
- package/dist/input-otp.d.ts.map +1 -0
- package/dist/input-otp.js +40 -70
- package/dist/input-otp.js.map +1 -1
- package/dist/input.d.ts +10 -4
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +16 -3
- package/dist/input.js.map +1 -1
- package/dist/item.d.ts +58 -23
- package/dist/item.d.ts.map +1 -0
- package/dist/item.js +102 -160
- package/dist/item.js.map +1 -1
- package/dist/kbd.d.ts +12 -4
- package/dist/kbd.d.ts.map +1 -0
- package/dist/kbd.js +15 -24
- package/dist/kbd.js.map +1 -1
- package/dist/label.d.ts +9 -4
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +12 -16
- package/dist/label.js.map +1 -1
- package/dist/lib/focus.d.ts +42 -0
- package/dist/lib/focus.d.ts.map +1 -0
- package/dist/lib/focus.js +21 -0
- package/dist/lib/focus.js.map +1 -0
- package/dist/lib/internal-icons.d.ts +32 -0
- package/dist/lib/internal-icons.d.ts.map +1 -0
- package/dist/lib/internal-icons.js +222 -0
- package/dist/lib/internal-icons.js.map +1 -0
- package/dist/lib/utils.d.ts +4 -2
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +12 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/masonry.d.ts +25 -11
- package/dist/masonry.d.ts.map +1 -0
- package/dist/masonry.js +188 -229
- package/dist/masonry.js.map +1 -1
- package/dist/menu.d.ts +84 -26
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +141 -4
- package/dist/menu.js.map +1 -1
- package/dist/menubar.d.ts +60 -22
- package/dist/menubar.d.ts.map +1 -0
- package/dist/menubar.js +80 -52
- package/dist/menubar.js.map +1 -1
- package/dist/pagination.d.ts +38 -17
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +68 -107
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts +56 -14
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +62 -87
- package/dist/popover.js.map +1 -1
- package/dist/preview-card.d.ts +28 -9
- package/dist/preview-card.d.ts.map +1 -0
- package/dist/preview-card.js +40 -60
- package/dist/preview-card.js.map +1 -1
- package/dist/progress.d.ts +28 -9
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +35 -60
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +14 -8
- package/dist/radio-group.d.ts.map +1 -0
- package/dist/radio-group.js +18 -22
- package/dist/radio-group.js.map +1 -1
- package/dist/radio.d.ts +14 -6
- package/dist/radio.d.ts.map +1 -0
- package/dist/radio.js +24 -3
- package/dist/radio.js.map +1 -1
- package/dist/scroll-area.d.ts +16 -6
- package/dist/scroll-area.d.ts.map +1 -0
- package/dist/scroll-area.js +34 -55
- package/dist/scroll-area.js.map +1 -1
- package/dist/select.d.ts +66 -18
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +105 -185
- package/dist/select.js.map +1 -1
- package/dist/separator.d.ts +11 -5
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +17 -3
- package/dist/separator.js.map +1 -1
- package/dist/sidebar.d.ts +172 -79
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +363 -585
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.d.ts +8 -3
- package/dist/skeleton.d.ts.map +1 -0
- package/dist/skeleton.js +13 -3
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +16 -6
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +40 -67
- package/dist/slider.js.map +1 -1
- package/dist/spinner.d.ts +8 -3
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +15 -4
- package/dist/spinner.js.map +1 -1
- package/dist/switch.d.ts +12 -6
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +18 -25
- package/dist/switch.js.map +1 -1
- package/dist/table.d.ts +37 -11
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +51 -88
- package/dist/table.js.map +1 -1
- package/dist/tabs.d.ts +28 -12
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +40 -74
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.d.ts +13 -6
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +19 -3
- package/dist/textarea.js.map +1 -1
- package/dist/toast.d.ts +63 -39
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +177 -215
- package/dist/toast.js.map +1 -1
- package/dist/toggle-group.d.ts +26 -12
- package/dist/toggle-group.d.ts.map +1 -0
- package/dist/toggle-group.js +49 -73
- package/dist/toggle-group.js.map +1 -1
- package/dist/toggle.d.ts +17 -10
- package/dist/toggle.d.ts.map +1 -0
- package/dist/toggle.js +38 -3
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.d.ts +35 -14
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +52 -3
- package/dist/tooltip.js.map +1 -1
- package/dist/typewriter.d.ts +44 -31
- package/dist/typewriter.d.ts.map +1 -0
- package/dist/typewriter.js +185 -185
- package/dist/typewriter.js.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-45VQAWIM.js +0 -228
- package/dist/chunk-45VQAWIM.js.map +0 -1
- package/dist/chunk-6Y7LPQMO.js +0 -11
- package/dist/chunk-6Y7LPQMO.js.map +0 -1
- package/dist/chunk-76UQO56T.js +0 -19
- package/dist/chunk-76UQO56T.js.map +0 -1
- package/dist/chunk-7F4MPMLJ.js +0 -17
- package/dist/chunk-7F4MPMLJ.js.map +0 -1
- package/dist/chunk-BKTJYX4M.js +0 -143
- package/dist/chunk-BKTJYX4M.js.map +0 -1
- package/dist/chunk-D5XPEJ6T.js +0 -36
- package/dist/chunk-D5XPEJ6T.js.map +0 -1
- package/dist/chunk-DIGOLJIR.js +0 -105
- package/dist/chunk-DIGOLJIR.js.map +0 -1
- package/dist/chunk-IQ7YQ5XA.js +0 -141
- package/dist/chunk-IQ7YQ5XA.js.map +0 -1
- package/dist/chunk-NCHHHWTB.js +0 -85
- package/dist/chunk-NCHHHWTB.js.map +0 -1
- package/dist/chunk-OUFYQLVN.js +0 -56
- package/dist/chunk-OUFYQLVN.js.map +0 -1
- package/dist/chunk-QFSEK4M6.js +0 -22
- package/dist/chunk-QFSEK4M6.js.map +0 -1
- package/dist/chunk-QRW37LRP.js +0 -25
- package/dist/chunk-QRW37LRP.js.map +0 -1
- package/dist/chunk-RPQHL6C5.js +0 -26
- package/dist/chunk-RPQHL6C5.js.map +0 -1
- package/dist/chunk-V4ZX4YCP.js +0 -66
- package/dist/chunk-V4ZX4YCP.js.map +0 -1
- package/dist/chunk-YTSQQTSF.js +0 -44
- package/dist/chunk-YTSQQTSF.js.map +0 -1
- package/dist/chunk-ZZZH3JGW.js +0 -23
- package/dist/chunk-ZZZH3JGW.js.map +0 -1
- package/dist/direction.js.map +0 -1
package/dist/infinite-scroll.js
CHANGED
|
@@ -1,102 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import * as React from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function InfiniteScroll({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
69
|
-
const sentinel = /* @__PURE__ */ jsx(
|
|
70
|
-
"div",
|
|
71
|
-
{
|
|
72
|
-
ref: sentinelRef,
|
|
73
|
-
"data-slot": "infinite-scroll-sentinel",
|
|
74
|
-
"aria-hidden": "true",
|
|
75
|
-
className: "h-px"
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
return /* @__PURE__ */ jsxs(
|
|
79
|
-
"div",
|
|
80
|
-
{
|
|
81
|
-
"data-slot": "infinite-scroll",
|
|
82
|
-
"aria-busy": isLoading,
|
|
83
|
-
className: cn("flex flex-col", className),
|
|
84
|
-
children: [
|
|
85
|
-
direction === "up" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
-
sentinel,
|
|
87
|
-
loaderContent
|
|
88
|
-
] }),
|
|
89
|
-
children,
|
|
90
|
-
direction === "down" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
-
sentinel,
|
|
92
|
-
loaderContent
|
|
93
|
-
] }),
|
|
94
|
-
endContent
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./lib/utils.js";
|
|
3
|
+
import { Spinner } from "./spinner.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/infinite-scroll.tsx
|
|
7
|
+
function InfiniteScroll({ onLoadMore, hasMore, isLoading = false, direction = "down", root, rootMargin = "200px", threshold = 0, loader, endMessage, className, children }) {
|
|
8
|
+
const sentinelRef = React.useRef(null);
|
|
9
|
+
const loadingRef = React.useRef(false);
|
|
10
|
+
const onLoadMoreRef = React.useRef(onLoadMore);
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
onLoadMoreRef.current = onLoadMore;
|
|
13
|
+
}, [onLoadMore]);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
if (!isLoading) loadingRef.current = false;
|
|
16
|
+
}, [isLoading]);
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
const sentinel = sentinelRef.current;
|
|
19
|
+
if (!sentinel || !hasMore) return;
|
|
20
|
+
const observer = new IntersectionObserver((entries) => {
|
|
21
|
+
const [entry] = entries;
|
|
22
|
+
if (entry?.isIntersecting && !loadingRef.current) {
|
|
23
|
+
loadingRef.current = true;
|
|
24
|
+
onLoadMoreRef.current();
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
root: root?.current ?? null,
|
|
28
|
+
rootMargin,
|
|
29
|
+
threshold
|
|
30
|
+
});
|
|
31
|
+
observer.observe(sentinel);
|
|
32
|
+
return () => {
|
|
33
|
+
observer.disconnect();
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
hasMore,
|
|
37
|
+
root,
|
|
38
|
+
rootMargin,
|
|
39
|
+
threshold
|
|
40
|
+
]);
|
|
41
|
+
const loaderContent = isLoading && /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "infinite-scroll-loader",
|
|
43
|
+
className: "flex items-center justify-center py-6",
|
|
44
|
+
children: loader ?? /* @__PURE__ */ jsx(Spinner, { className: "size-6 text-muted-foreground" })
|
|
45
|
+
});
|
|
46
|
+
const endContent = !hasMore && !isLoading && endMessage && /* @__PURE__ */ jsx("div", {
|
|
47
|
+
"data-slot": "infinite-scroll-end",
|
|
48
|
+
className: "flex items-center justify-center py-6 text-sm text-muted-foreground",
|
|
49
|
+
children: endMessage
|
|
50
|
+
});
|
|
51
|
+
const sentinel = /* @__PURE__ */ jsx("div", {
|
|
52
|
+
ref: sentinelRef,
|
|
53
|
+
"data-slot": "infinite-scroll-sentinel",
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
className: "h-px"
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
58
|
+
"data-slot": "infinite-scroll",
|
|
59
|
+
"aria-busy": isLoading,
|
|
60
|
+
className: cn("flex flex-col", className),
|
|
61
|
+
children: [
|
|
62
|
+
direction === "up" && /* @__PURE__ */ jsxs(Fragment, { children: [sentinel, loaderContent] }),
|
|
63
|
+
children,
|
|
64
|
+
direction === "down" && /* @__PURE__ */ jsxs(Fragment, { children: [sentinel, loaderContent] }),
|
|
65
|
+
endContent
|
|
66
|
+
]
|
|
67
|
+
});
|
|
98
68
|
}
|
|
99
|
-
|
|
69
|
+
//#endregion
|
|
100
70
|
export { InfiniteScroll };
|
|
101
|
-
|
|
71
|
+
|
|
102
72
|
//# sourceMappingURL=infinite-scroll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"infinite-scroll.js","names":[],"sources":["../src/infinite-scroll.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"./lib/utils\"\nimport { Spinner } from \"./spinner\"\n\ntype InfiniteScrollProps = {\n onLoadMore: () => void\n hasMore: boolean\n isLoading?: boolean\n direction?: \"down\" | \"up\"\n root?: React.RefObject<Element | null>\n rootMargin?: string\n threshold?: number\n loader?: React.ReactNode\n endMessage?: React.ReactNode\n className?: string\n children?: React.ReactNode\n}\n\nfunction InfiniteScroll({\n onLoadMore,\n hasMore,\n isLoading = false,\n direction = \"down\",\n root,\n rootMargin = \"200px\",\n threshold = 0,\n loader,\n endMessage,\n className,\n children,\n}: InfiniteScrollProps) {\n const sentinelRef = React.useRef<HTMLDivElement>(null)\n const loadingRef = React.useRef(false)\n\n const onLoadMoreRef = React.useRef(onLoadMore)\n React.useEffect(() => {\n onLoadMoreRef.current = onLoadMore\n }, [onLoadMore])\n\n React.useEffect(() => {\n if (!isLoading) {\n loadingRef.current = false\n }\n }, [isLoading])\n\n React.useEffect(() => {\n const sentinel = sentinelRef.current\n if (!sentinel || !hasMore) return\n\n const observer = new IntersectionObserver(\n (entries) => {\n const [entry] = entries\n if (entry?.isIntersecting && !loadingRef.current) {\n loadingRef.current = true\n onLoadMoreRef.current()\n }\n },\n {\n root: root?.current ?? null,\n rootMargin,\n threshold,\n }\n )\n\n observer.observe(sentinel)\n\n return () => {\n observer.disconnect()\n }\n }, [hasMore, root, rootMargin, threshold])\n\n const loaderContent = isLoading && (\n <div\n data-slot=\"infinite-scroll-loader\"\n className=\"flex items-center justify-center py-6\"\n >\n {loader ?? <Spinner className=\"size-6 text-muted-foreground\" />}\n </div>\n )\n\n const endContent = !hasMore && !isLoading && endMessage && (\n <div\n data-slot=\"infinite-scroll-end\"\n className=\"flex items-center justify-center py-6 text-sm text-muted-foreground\"\n >\n {endMessage}\n </div>\n )\n\n const sentinel = (\n <div\n ref={sentinelRef}\n data-slot=\"infinite-scroll-sentinel\"\n aria-hidden=\"true\"\n className=\"h-px\"\n />\n )\n\n return (\n <div\n data-slot=\"infinite-scroll\"\n aria-busy={isLoading}\n className={cn(\"flex flex-col\", className)}\n >\n {direction === \"up\" && (\n <>\n {sentinel}\n {loaderContent}\n </>\n )}\n\n {children}\n\n {direction === \"down\" && (\n <>\n {sentinel}\n {loaderContent}\n </>\n )}\n\n {endContent}\n </div>\n )\n}\n\nexport { InfiniteScroll, type InfiniteScrollProps }\n"],"mappings":";;;;;;AAqBA,SAAS,eAAe,EACtB,YACA,SACA,YAAY,OACZ,YAAY,QACZ,MACA,aAAa,SACb,YAAY,GACZ,QACA,YACA,WACA,YACsB;CACtB,MAAM,cAAc,MAAM,OAAuB,KAAK;CACtD,MAAM,aAAa,MAAM,OAAO,MAAM;CAEtC,MAAM,gBAAgB,MAAM,OAAO,WAAW;AAC9C,OAAM,gBAAgB;AACpB,gBAAc,UAAU;IACvB,CAAC,WAAW,CAAC;AAEhB,OAAM,gBAAgB;AACpB,MAAI,CAAC,UACH,YAAW,UAAU;IAEtB,CAAC,UAAU,CAAC;AAEf,OAAM,gBAAgB;EACpB,MAAM,WAAW,YAAY;AAC7B,MAAI,CAAC,YAAY,CAAC,QAAS;EAE3B,MAAM,WAAW,IAAI,sBAClB,YAAY;GACX,MAAM,CAAC,SAAS;AAChB,OAAI,OAAO,kBAAkB,CAAC,WAAW,SAAS;AAChD,eAAW,UAAU;AACrB,kBAAc,SAAS;;KAG3B;GACE,MAAM,MAAM,WAAW;GACvB;GACA;GACD,CACF;AAED,WAAS,QAAQ,SAAS;AAE1B,eAAa;AACX,YAAS,YAAY;;IAEtB;EAAC;EAAS;EAAM;EAAY;EAAU,CAAC;CAE1C,MAAM,gBAAgB,aACpB,oBAAC,OAAD;EACE,aAAU;EACV,WAAU;YAET,UAAU,oBAAC,SAAD,EAAS,WAAU,gCAAiC,CAAA;EAC3D,CAAA;CAGR,MAAM,aAAa,CAAC,WAAW,CAAC,aAAa,cAC3C,oBAAC,OAAD;EACE,aAAU;EACV,WAAU;YAET;EACG,CAAA;CAGR,MAAM,WACJ,oBAAC,OAAD;EACE,KAAK;EACL,aAAU;EACV,eAAY;EACZ,WAAU;EACV,CAAA;AAGJ,QACE,qBAAC,OAAD;EACE,aAAU;EACV,aAAW;EACX,WAAW,GAAG,iBAAiB,UAAU;YAH3C;GAKG,cAAc,QACb,qBAAA,UAAA,EAAA,UAAA,CACG,UACA,cACA,EAAA,CAAA;GAGJ;GAEA,cAAc,UACb,qBAAA,UAAA,EAAA,UAAA,CACG,UACA,cACA,EAAA,CAAA;GAGJ;GACG"}
|
package/dist/input-group.d.ts
CHANGED
|
@@ -1,29 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { VariantProps } from
|
|
5
|
-
import
|
|
6
|
-
import '@base-ui/react/button';
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
|
+
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
7
6
|
|
|
7
|
+
//#region src/input-group.d.ts
|
|
8
8
|
type InputGroupProps = React.ComponentProps<"div">;
|
|
9
9
|
type InputGroupAddonProps = React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>;
|
|
10
10
|
type InputGroupButtonProps = Omit<React.ComponentProps<typeof Button>, "size" | "type"> & VariantProps<typeof inputGroupButtonVariants> & {
|
|
11
|
-
|
|
11
|
+
type?: "button" | "submit" | "reset";
|
|
12
12
|
};
|
|
13
13
|
type InputGroupTextProps = React.ComponentProps<"span">;
|
|
14
14
|
type InputGroupInputProps = React.ComponentProps<"input">;
|
|
15
15
|
type InputGroupTextareaProps = React.ComponentProps<"textarea">;
|
|
16
|
-
declare function InputGroup({
|
|
16
|
+
declare function InputGroup({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: InputGroupProps): _$react_jsx_runtime0.JSX.Element;
|
|
17
20
|
declare const inputGroupAddonVariants: (props?: ({
|
|
18
|
-
|
|
19
|
-
} &
|
|
20
|
-
declare function InputGroupAddon({
|
|
21
|
+
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
22
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
23
|
+
declare function InputGroupAddon({
|
|
24
|
+
className,
|
|
25
|
+
align,
|
|
26
|
+
...props
|
|
27
|
+
}: InputGroupAddonProps): _$react_jsx_runtime0.JSX.Element;
|
|
21
28
|
declare const inputGroupButtonVariants: (props?: ({
|
|
22
|
-
|
|
23
|
-
} &
|
|
24
|
-
declare function InputGroupButton({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
size?: "xs" | "sm" | "icon-xs" | "icon-sm" | null | undefined;
|
|
30
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
31
|
+
declare function InputGroupButton({
|
|
32
|
+
className,
|
|
33
|
+
type,
|
|
34
|
+
variant,
|
|
35
|
+
size,
|
|
36
|
+
...props
|
|
37
|
+
}: InputGroupButtonProps): _$react_jsx_runtime0.JSX.Element;
|
|
38
|
+
declare function InputGroupText({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: InputGroupTextProps): _$react_jsx_runtime0.JSX.Element;
|
|
42
|
+
declare function InputGroupInput({
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}: InputGroupInputProps): _$react_jsx_runtime0.JSX.Element;
|
|
46
|
+
declare function InputGroupTextarea({
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}: InputGroupTextareaProps): _$react_jsx_runtime0.JSX.Element;
|
|
50
|
+
//#endregion
|
|
29
51
|
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
52
|
+
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","names":[],"sources":["../src/input-group.tsx"],"mappings":";;;;;;;KAUK,eAAA,GAAkB,KAAA,CAAM,cAAA;AAAA,KAExB,oBAAA,GAAuB,KAAA,CAAM,cAAA,UAChC,YAAA,QAAoB,uBAAA;AAAA,KAEjB,qBAAA,GAAwB,IAAA,CAAK,KAAA,CAAM,cAAA,QAAsB,MAAA,sBAC5D,YAAA,QAAoB,wBAAA;EAClB,IAAA;AAAA;AAAA,KAGC,mBAAA,GAAsB,KAAA,CAAM,cAAA;AAAA,KAE5B,oBAAA,GAAuB,KAAA,CAAM,cAAA;AAAA,KAE7B,uBAAA,GAA0B,KAAA,CAAM,cAAA;AAAA,iBAE5B,UAAA,CAAA;EAAa,SAAA;EAAA,GAAc;AAAA,GAAS,eAAA,GAAe,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cActD,uBAAA,GAAuB,KAAA;;IAmB5B,iCAAA,CAAA,SAAA;AAAA,iBAEQ,eAAA,CAAA;EACP,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,oBAAA,GAAoB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAkBjB,wBAAA,GAAwB,KAAA;;IAgB7B,iCAAA,CAAA,SAAA;AAAA,iBAEQ,gBAAA,CAAA;EACP,SAAA;EACA,IAAA;EACA,OAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAYf,cAAA,CAAA;EAAiB,SAAA;EAAA,GAAc;AAAA,GAAS,mBAAA,GAAmB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAY3D,eAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,oBAAA,GAAoB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAad,kBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,uBAAA,GAAuB,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/input-group.js
CHANGED
|
@@ -1,7 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./lib/utils.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { Input } from "./input.js";
|
|
5
|
+
import { Textarea } from "./textarea.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
//#region src/input-group.tsx
|
|
10
|
+
function InputGroup({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
"data-slot": "input-group",
|
|
13
|
+
role: "group",
|
|
14
|
+
className: cn("border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 not-has-disabled:has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const inputGroupAddonVariants = cva("text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none", {
|
|
19
|
+
variants: { align: {
|
|
20
|
+
"inline-start": "pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first",
|
|
21
|
+
"inline-end": "pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last",
|
|
22
|
+
"block-start": "px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start",
|
|
23
|
+
"block-end": "px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"
|
|
24
|
+
} },
|
|
25
|
+
defaultVariants: { align: "inline-start" }
|
|
26
|
+
});
|
|
27
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
role: "group",
|
|
30
|
+
"data-slot": "input-group-addon",
|
|
31
|
+
"data-align": align,
|
|
32
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
33
|
+
onClick: (e) => {
|
|
34
|
+
if (e.target.closest("button")) return;
|
|
35
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
36
|
+
},
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const inputGroupButtonVariants = cva("gap-2 text-sm shadow-none flex items-center", {
|
|
41
|
+
variants: { size: {
|
|
42
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
43
|
+
sm: "",
|
|
44
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
|
|
45
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
46
|
+
} },
|
|
47
|
+
defaultVariants: { size: "xs" }
|
|
48
|
+
});
|
|
49
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
51
|
+
type,
|
|
52
|
+
"data-size": size,
|
|
53
|
+
variant,
|
|
54
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function InputGroupText({ className, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: cn("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function InputGroupInput({ className, ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
66
|
+
"data-slot": "input-group-control",
|
|
67
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
73
|
+
"data-slot": "input-group-control",
|
|
74
|
+
className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent", className),
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
80
|
+
|
|
7
81
|
//# sourceMappingURL=input-group.js.map
|
package/dist/input-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"input-group.js","names":[],"sources":["../src/input-group.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\nimport { Button } from \"./button\"\nimport { Input } from \"./input\"\nimport { Textarea } from \"./textarea\"\n\ntype InputGroupProps = React.ComponentProps<\"div\">\n\ntype InputGroupAddonProps = React.ComponentProps<\"div\"> &\n VariantProps<typeof inputGroupAddonVariants>\n\ntype InputGroupButtonProps = Omit<React.ComponentProps<typeof Button>, \"size\" | \"type\"> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: \"button\" | \"submit\" | \"reset\"\n }\n\ntype InputGroupTextProps = React.ComponentProps<\"span\">\n\ntype InputGroupInputProps = React.ComponentProps<\"input\">\n\ntype InputGroupTextareaProps = React.ComponentProps<\"textarea\">\n\nfunction InputGroup({ className, ...props }: InputGroupProps) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 not-has-disabled:has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n \"text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none\",\n {\n variants: {\n align: {\n \"inline-start\":\n \"pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first\",\n \"inline-end\":\n \"pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last\",\n \"block-start\":\n \"px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start\",\n \"block-end\":\n \"px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n }\n)\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: InputGroupAddonProps) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n \"gap-2 text-sm shadow-none flex items-center\",\n {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"\",\n \"icon-xs\":\n \"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n }\n)\n\nfunction InputGroupButton({\n className,\n type = \"button\",\n variant = \"ghost\",\n size = \"xs\",\n ...props\n}: InputGroupButtonProps) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: InputGroupTextProps) {\n return (\n <span\n className={cn(\n \"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({\n className,\n ...props\n}: InputGroupInputProps) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({\n className,\n ...props\n}: InputGroupTextareaProps) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAS,WAAW,EAAE,WAAW,GAAG,SAA0B;AAC5D,QACE,oBAAC,OAAD;EACE,aAAU;EACV,MAAK;EACL,WAAW,GACT,2qCACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,MAAM,0BAA0B,IAC9B,2PACA;CACE,UAAU,EACR,OAAO;EACL,gBACE;EACF,cACE;EACF,eACE;EACF,aACE;EACH,EACF;CACD,iBAAiB,EACf,OAAO,gBACR;CACF,CACF;AAED,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SACoB;AACvB,QACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,WAAW,GAAG,wBAAwB,EAAE,OAAO,CAAC,EAAE,UAAU;EAC5D,UAAU,MAAM;AACd,OAAK,EAAE,OAAuB,QAAQ,SAAS,CAC7C;AAEF,KAAE,cAAc,eAAe,cAAc,QAAQ,EAAE,OAAO;;EAEhE,GAAI;EACJ,CAAA;;AAIN,MAAM,2BAA2B,IAC/B,+CACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,WACE;EACF,WAAW;EACZ,EACF;CACD,iBAAiB,EACf,MAAM,MACP;CACF,CACF;AAED,SAAS,iBAAiB,EACxB,WACA,OAAO,UACP,UAAU,SACV,OAAO,MACP,GAAG,SACqB;AACxB,QACE,oBAAC,QAAD;EACQ;EACN,aAAW;EACF;EACT,WAAW,GAAG,yBAAyB,EAAE,MAAM,CAAC,EAAE,UAAU;EAC5D,GAAI;EACJ,CAAA;;AAIN,SAAS,eAAe,EAAE,WAAW,GAAG,SAA8B;AACpE,QACE,oBAAC,QAAD;EACE,WAAW,GACT,0HACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,gBAAgB,EACvB,WACA,GAAG,SACoB;AACvB,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,oLACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACuB;AAC1B,QACE,oBAAC,UAAD;EACE,aAAU;EACV,WAAW,GACT,qMACA,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/input-otp.d.ts
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import { OTPInput } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { OTPInput } from "input-otp";
|
|
4
4
|
|
|
5
|
+
//#region src/input-otp.d.ts
|
|
5
6
|
type InputOTPProps = React.ComponentProps<typeof OTPInput> & {
|
|
6
|
-
|
|
7
|
+
containerClassName?: string;
|
|
7
8
|
};
|
|
8
|
-
declare function InputOTP({
|
|
9
|
+
declare function InputOTP({
|
|
10
|
+
className,
|
|
11
|
+
containerClassName,
|
|
12
|
+
...props
|
|
13
|
+
}: InputOTPProps): _$react_jsx_runtime0.JSX.Element;
|
|
9
14
|
type InputOTPGroupProps = React.ComponentProps<"div">;
|
|
10
|
-
declare function InputOTPGroup({
|
|
15
|
+
declare function InputOTPGroup({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: InputOTPGroupProps): _$react_jsx_runtime0.JSX.Element;
|
|
11
19
|
type InputOTPSlotProps = React.ComponentProps<"div"> & {
|
|
12
|
-
|
|
20
|
+
index: number;
|
|
13
21
|
};
|
|
14
|
-
declare function InputOTPSlot({
|
|
22
|
+
declare function InputOTPSlot({
|
|
23
|
+
index,
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: InputOTPSlotProps): _$react_jsx_runtime0.JSX.Element;
|
|
15
27
|
type InputOTPSeparatorProps = React.ComponentProps<"div">;
|
|
16
|
-
declare function InputOTPSeparator({
|
|
17
|
-
|
|
28
|
+
declare function InputOTPSeparator({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: InputOTPSeparatorProps): _$react_jsx_runtime0.JSX.Element;
|
|
32
|
+
//#endregion
|
|
18
33
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
34
|
+
//# sourceMappingURL=input-otp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.d.ts","names":[],"sources":["../src/input-otp.tsx"],"mappings":";;;;;KAQK,aAAA,GAAgB,KAAA,CAAM,cAAA,QAAsB,QAAA;EAC/C,kBAAA;AAAA;AAAA,iBAGO,QAAA,CAAA;EACP,SAAA;EACA,kBAAA;EAAA,GACG;AAAA,GACF,aAAA,GAAa,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAeX,kBAAA,GAAqB,KAAA,CAAM,cAAA;AAAA,iBAEvB,aAAA,CAAA;EAAgB,SAAA;EAAA,GAAc;AAAA,GAAS,kBAAA,GAAkB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAa7D,iBAAA,GAAoB,KAAA,CAAM,cAAA;EAC7B,KAAA;AAAA;AAAA,iBAGO,YAAA,CAAA;EAAe,KAAA;EAAO,SAAA;EAAA,GAAc;AAAA,GAAS,iBAAA,GAAiB,oBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KA0BlE,sBAAA,GAAyB,KAAA,CAAM,cAAA;AAAA,iBAE3B,iBAAA,CAAA;EAAoB,SAAA;EAAA,GAAc;AAAA,GAAS,sBAAA,GAAsB,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/input-otp.js
CHANGED
|
@@ -1,79 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { jsx, jsxs } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
containerClassName: cn(
|
|
17
|
-
"flex items-center has-disabled:opacity-50",
|
|
18
|
-
containerClassName
|
|
19
|
-
),
|
|
20
|
-
spellCheck: false,
|
|
21
|
-
className: cn("disabled:cursor-not-allowed", className),
|
|
22
|
-
...props
|
|
23
|
-
}
|
|
24
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./lib/utils.js";
|
|
3
|
+
import { MinusIcon } from "./lib/internal-icons.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
7
|
+
//#region src/input-otp.tsx
|
|
8
|
+
function InputOTP({ className, containerClassName, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(OTPInput, {
|
|
10
|
+
"data-slot": "input-otp",
|
|
11
|
+
containerClassName: cn("flex items-center has-disabled:opacity-50", containerClassName),
|
|
12
|
+
spellCheck: false,
|
|
13
|
+
className: cn("disabled:cursor-not-allowed", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
25
16
|
}
|
|
26
17
|
function InputOTPGroup({ className, ...props }) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40",
|
|
33
|
-
className
|
|
34
|
-
),
|
|
35
|
-
...props
|
|
36
|
-
}
|
|
37
|
-
);
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
"data-slot": "input-otp-group",
|
|
20
|
+
className: cn("flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
38
23
|
}
|
|
39
24
|
function InputOTPSlot({ index, className, ...props }) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className
|
|
52
|
-
),
|
|
53
|
-
...props,
|
|
54
|
-
children: [
|
|
55
|
-
char,
|
|
56
|
-
hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
);
|
|
25
|
+
const { char, hasFakeCaret, isActive } = React.useContext(OTPInputContext)?.slots[index] ?? {};
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
"data-slot": "input-otp-slot",
|
|
28
|
+
"data-active": isActive || void 0,
|
|
29
|
+
className: cn("border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg", "data-active:border-ring data-active:ring-3 data-active:ring-ring/50 data-active:z-10", "aria-invalid:border-destructive data-active:aria-invalid:border-destructive data-active:aria-invalid:ring-destructive/20 dark:data-active:aria-invalid:ring-destructive/40", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
33
|
+
children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" })
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
60
36
|
}
|
|
61
37
|
function InputOTPSeparator({ className, ...props }) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
),
|
|
70
|
-
role: "separator",
|
|
71
|
-
...props,
|
|
72
|
-
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
73
|
-
}
|
|
74
|
-
);
|
|
38
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39
|
+
"data-slot": "input-otp-separator",
|
|
40
|
+
className: cn("flex items-center [&_svg:not([class*='size-'])]:size-4", className),
|
|
41
|
+
role: "separator",
|
|
42
|
+
...props,
|
|
43
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
44
|
+
});
|
|
75
45
|
}
|
|
76
|
-
|
|
46
|
+
//#endregion
|
|
77
47
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
78
|
-
|
|
48
|
+
|
|
79
49
|
//# sourceMappingURL=input-otp.js.map
|
package/dist/input-otp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"input-otp.js","names":[],"sources":["../src/input-otp.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { OTPInput, OTPInputContext } from \"input-otp\"\n\nimport { cn } from \"./lib/utils\"\nimport { MinusIcon } from \"./lib/internal-icons\"\n\ntype InputOTPProps = React.ComponentProps<typeof OTPInput> & {\n containerClassName?: string\n}\n\nfunction InputOTP({\n className,\n containerClassName,\n ...props\n}: InputOTPProps) {\n return (\n <OTPInput\n data-slot=\"input-otp\"\n containerClassName={cn(\n \"flex items-center has-disabled:opacity-50\",\n containerClassName,\n )}\n spellCheck={false}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n )\n}\n\ntype InputOTPGroupProps = React.ComponentProps<\"div\">\n\nfunction InputOTPGroup({ className, ...props }: InputOTPGroupProps) {\n return (\n <div\n data-slot=\"input-otp-group\"\n className={cn(\n \"flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n />\n )\n}\n\ntype InputOTPSlotProps = React.ComponentProps<\"div\"> & {\n index: number\n}\n\nfunction InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}\n\n return (\n <div\n data-slot=\"input-otp-slot\"\n data-active={isActive || undefined}\n className={cn(\n \"border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg\",\n \"data-active:border-ring data-active:ring-3 data-active:ring-ring/50 data-active:z-10\",\n \"aria-invalid:border-destructive data-active:aria-invalid:border-destructive data-active:aria-invalid:ring-destructive/20 dark:data-active:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"animate-caret-blink bg-foreground h-4 w-px duration-1000\" />\n </div>\n )}\n </div>\n )\n}\n\ntype InputOTPSeparatorProps = React.ComponentProps<\"div\">\n\nfunction InputOTPSeparator({ className, ...props }: InputOTPSeparatorProps) {\n return (\n <div\n data-slot=\"input-otp-separator\"\n className={cn(\n \"flex items-center [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n role=\"separator\"\n {...props}\n >\n <MinusIcon />\n </div>\n )\n}\n\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator\n}\n"],"mappings":";;;;;;;AAYA,SAAS,SAAS,EAChB,WACA,oBACA,GAAG,SACa;AAChB,QACE,oBAAC,UAAD;EACE,aAAU;EACV,oBAAoB,GAClB,6CACA,mBACD;EACD,YAAY;EACZ,WAAW,GAAG,+BAA+B,UAAU;EACvD,GAAI;EACJ,CAAA;;AAMN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,2KACA,UACD;EACD,GAAI;EACJ,CAAA;;AAQN,SAAS,aAAa,EAAE,OAAO,WAAW,GAAG,SAA4B;CAEvE,MAAM,EAAE,MAAM,cAAc,aADJ,MAAM,WAAW,gBACe,EAAE,MAAM,UAAU,EAAE;AAE5E,QACE,qBAAC,OAAD;EACE,aAAU;EACV,eAAa,YAAY,KAAA;EACzB,WAAW,GACT,4LACA,wFACA,8KACA,UACD;EACD,GAAI;YATN,CAWG,MACA,gBACC,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,OAAD,EAAK,WAAU,4DAA6D,CAAA;GACxE,CAAA,CAEJ;;;AAMV,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0DACA,UACD;EACD,MAAK;EACL,GAAI;YAEJ,oBAAC,WAAD,EAAa,CAAA;EACT,CAAA"}
|
package/dist/input.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
|
+
//#region src/input.d.ts
|
|
4
5
|
type InputProps = React.ComponentProps<"input">;
|
|
5
|
-
declare function Input({
|
|
6
|
-
|
|
6
|
+
declare function Input({
|
|
7
|
+
className,
|
|
8
|
+
type,
|
|
9
|
+
...props
|
|
10
|
+
}: InputProps): _$react_jsx_runtime0.JSX.Element;
|
|
11
|
+
//#endregion
|
|
7
12
|
export { Input };
|
|
13
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","names":[],"sources":["../src/input.tsx"],"mappings":";;;;KAKK,UAAA,GAAa,KAAA,CAAM,cAAA;AAAA,iBAEf,KAAA,CAAA;EAAQ,SAAA;EAAW,IAAA;EAAA,GAAS;AAAA,GAAS,UAAA,GAAU,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/input.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { cn } from "./lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Input as Input$1 } from "@base-ui/react/input";
|
|
5
|
+
//#region src/input.tsx
|
|
6
|
+
function Input({ className, type, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Input$1, {
|
|
8
|
+
type,
|
|
9
|
+
"data-slot": "input",
|
|
10
|
+
className: cn("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 file:text-foreground placeholder:text-muted-foreground h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Input };
|
|
16
|
+
|
|
4
17
|
//# sourceMappingURL=input.js.map
|