@zayne-labs/ui-react 0.10.5 → 0.10.7
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/css/animation.css +47 -0
- package/css/theme.css +10 -4
- package/dist/esm/{await-fjas2Q-C.js → await-Da5w2vIc.js} +14 -15
- package/dist/esm/await-Da5w2vIc.js.map +1 -0
- package/dist/esm/{card-TD60Xux0.js → card-DDLJVCwL.js} +10 -10
- package/dist/esm/card-DDLJVCwL.js.map +1 -0
- package/dist/esm/{carousel-YXXtZ85s.js → carousel-B051PAAX.js} +20 -23
- package/dist/esm/carousel-B051PAAX.js.map +1 -0
- package/dist/esm/{chunk-Cl8Af3a2.js → chunk-CTAAG5j7.js} +3 -1
- package/dist/esm/{cn-_FbtIrlZ.js → cn-s-D7vHW1.js} +1 -1
- package/dist/esm/{cn-_FbtIrlZ.js.map → cn-s-D7vHW1.js.map} +1 -1
- package/dist/esm/common/await/index.d.ts +4 -0
- package/dist/esm/common/await/index.js +8 -0
- package/dist/esm/common/client-gate/index.d.ts +33 -0
- package/dist/esm/common/client-gate/index.js +35 -0
- package/dist/esm/common/client-gate/index.js.map +1 -0
- package/dist/esm/{components/common → common}/error-boundary/index.d.ts +1 -1
- package/dist/esm/{components/common → common}/error-boundary/index.js +1 -1
- package/dist/esm/common/for/index.d.ts +2 -0
- package/dist/esm/common/for/index.js +3 -0
- package/dist/esm/common/index.d.ts +9 -0
- package/dist/esm/common/index.js +11 -0
- package/dist/esm/common/presence/index.d.ts +22 -0
- package/dist/esm/common/presence/index.js +6 -0
- package/dist/esm/{components/common → common}/show/index.d.ts +1 -1
- package/dist/esm/{components/common → common}/show/index.js +1 -2
- package/dist/esm/{components/common → common}/slot/index.d.ts +1 -1
- package/dist/esm/common/slot/index.js +3 -0
- package/dist/esm/common/suspense-with-boundary/index.d.ts +3 -0
- package/dist/esm/common/suspense-with-boundary/index.js +4 -0
- package/dist/esm/{components/common → common}/switch/index.d.ts +1 -1
- package/dist/esm/{components/common → common}/switch/index.js +1 -2
- package/dist/esm/common/teleport/index.d.ts +2 -0
- package/dist/esm/common/teleport/index.js +3 -0
- package/dist/esm/{drag-scroll-De6-soln.js → drag-scroll-Bb1SG4On.js} +9 -12
- package/dist/esm/{drag-scroll-De6-soln.js.map → drag-scroll-Bb1SG4On.js.map} +1 -1
- package/dist/esm/drop-zone-C9VpKJAD.js +1013 -0
- package/dist/esm/drop-zone-C9VpKJAD.js.map +1 -0
- package/dist/esm/{error-boundary-xM9An3gz.js → error-boundary-y9Samt_s.js} +1 -1
- package/dist/esm/error-boundary-y9Samt_s.js.map +1 -0
- package/dist/esm/{for-DGs2XZ21.js → for-DK5rEY_m.js} +5 -7
- package/dist/esm/for-DK5rEY_m.js.map +1 -0
- package/dist/esm/{form-BHfmbX32.js → form-DyGy9LnA.js} +61 -73
- package/dist/esm/form-DyGy9LnA.js.map +1 -0
- package/dist/esm/{index-Y_2u8pWF.d.ts → index-ATxxr1XS.d.ts} +5 -4
- package/dist/esm/{index-Cbg54Lt4.d.ts → index-B4YvRWlE.d.ts} +21 -20
- package/dist/esm/{index-lKxE9WPi.d.ts → index-BAywimP3.d.ts} +4 -2
- package/dist/esm/index-BT0UvcRp.d.ts +23 -0
- package/dist/esm/index-BWD8WVO-.d.ts +340 -0
- package/dist/esm/{index-DVr1tbxh.d.ts → index-BsGxDKlt.d.ts} +10 -9
- package/dist/esm/{index-BYhH4Fm0.d.ts → index-C1GPFYKG.d.ts} +1 -1
- package/dist/esm/{index-D6o1oxQd.d.ts → index-C889t8UO.d.ts} +13 -16
- package/dist/esm/{index-CWKQ5V4B.d.ts → index-CZjeBSoQ.d.ts} +1 -1
- package/dist/esm/{index-DJjxpXUk.d.ts → index-CffEFE66.d.ts} +1 -1
- package/dist/esm/{index-BBJzo-WC.d.ts → index-CuJVxLEc.d.ts} +4 -3
- package/dist/esm/{index-BeDmH7lX.d.ts → index-DVBtz0VB.d.ts} +10 -9
- package/dist/esm/{index-DqutTJQB.d.ts → index-Dpt8KDv1.d.ts} +13 -12
- package/dist/esm/presence-CL5_GHQH.js +156 -0
- package/dist/esm/presence-CL5_GHQH.js.map +1 -0
- package/dist/esm/{show-BabiXbf7.js → show-N1ZXBhoA.js} +18 -9
- package/dist/esm/show-N1ZXBhoA.js.map +1 -0
- package/dist/esm/{slot-D1062oA5.js → slot-WVWfOlr3.js} +5 -6
- package/dist/esm/{slot-D1062oA5.js.map → slot-WVWfOlr3.js.map} +1 -1
- package/dist/esm/{suspense-with-boundary-CEVORL8K.js → suspense-with-boundary-D-1NYDV4.js} +2 -2
- package/dist/esm/suspense-with-boundary-D-1NYDV4.js.map +1 -0
- package/dist/esm/{switch-CCMD01Rs.js → switch-Ch22z21e.js} +7 -11
- package/dist/esm/switch-Ch22z21e.js.map +1 -0
- package/dist/esm/{teleport-DfuYOzsj.js → teleport-C8TzRm4M.js} +1 -1
- package/dist/esm/teleport-C8TzRm4M.js.map +1 -0
- package/dist/esm/{components/ui → ui}/card/index.d.ts +1 -1
- package/dist/esm/{components/ui → ui}/card/index.js +3 -3
- package/dist/esm/ui/carousel/index.d.ts +2 -0
- package/dist/esm/ui/carousel/index.js +16 -0
- package/dist/esm/ui/drag-scroll/index.d.ts +2 -0
- package/dist/esm/ui/drag-scroll/index.js +4 -0
- package/dist/esm/ui/drop-zone/index.d.ts +2 -0
- package/dist/esm/ui/drop-zone/index.js +17 -0
- package/dist/esm/{components/ui → ui}/form/index.d.ts +1 -1
- package/dist/esm/{components/ui → ui}/form/index.js +4 -5
- package/dist/esm/ui/index.d.ts +6 -0
- package/dist/esm/ui/index.js +18 -0
- package/dist/style.css +415 -25
- package/package.json +20 -17
- package/dist/esm/await-fjas2Q-C.js.map +0 -1
- package/dist/esm/card-TD60Xux0.js.map +0 -1
- package/dist/esm/carousel-YXXtZ85s.js.map +0 -1
- package/dist/esm/components/common/await/index.d.ts +0 -5
- package/dist/esm/components/common/await/index.js +0 -10
- package/dist/esm/components/common/for/index.d.ts +0 -2
- package/dist/esm/components/common/for/index.js +0 -3
- package/dist/esm/components/common/index.d.ts +0 -10
- package/dist/esm/components/common/index.js +0 -13
- package/dist/esm/components/common/slot/index.js +0 -3
- package/dist/esm/components/common/suspense-with-boundary/index.d.ts +0 -3
- package/dist/esm/components/common/suspense-with-boundary/index.js +0 -4
- package/dist/esm/components/common/teleport/index.d.ts +0 -2
- package/dist/esm/components/common/teleport/index.js +0 -3
- package/dist/esm/components/ui/carousel/index.d.ts +0 -2
- package/dist/esm/components/ui/carousel/index.js +0 -18
- package/dist/esm/components/ui/drag-scroll/index.d.ts +0 -2
- package/dist/esm/components/ui/drag-scroll/index.js +0 -4
- package/dist/esm/components/ui/drop-zone/index.d.ts +0 -2
- package/dist/esm/components/ui/drop-zone/index.js +0 -18
- package/dist/esm/components/ui/index.d.ts +0 -6
- package/dist/esm/components/ui/index.js +0 -19
- package/dist/esm/drop-zone-BPfSu99L.js +0 -381
- package/dist/esm/drop-zone-BPfSu99L.js.map +0 -1
- package/dist/esm/error-boundary-xM9An3gz.js.map +0 -1
- package/dist/esm/for-DGs2XZ21.js.map +0 -1
- package/dist/esm/form-BHfmbX32.js.map +0 -1
- package/dist/esm/getSlot-Cf5ON6lE.js +0 -85
- package/dist/esm/getSlot-Cf5ON6lE.js.map +0 -1
- package/dist/esm/index-B-NUFudm.d.ts +0 -183
- package/dist/esm/index-BNrCAe9Y.d.ts +0 -142
- package/dist/esm/index-CnvH74ea.d.ts +0 -20
- package/dist/esm/lib/utils/index.d.ts +0 -2
- package/dist/esm/lib/utils/index.js +0 -4
- package/dist/esm/show-BabiXbf7.js.map +0 -1
- package/dist/esm/suspense-with-boundary-CEVORL8K.js.map +0 -1
- package/dist/esm/switch-CCMD01Rs.js.map +0 -1
- package/dist/esm/teleport-DfuYOzsj.js.map +0 -1
- package/dist/esm/utils-ChjmDoRe.js +0 -89
- package/dist/esm/utils-ChjmDoRe.js.map +0 -1
- /package/dist/esm/{common-BYWy8Q78.js → common-PS3X58Pj.js} +0 -0
package/css/animation.css
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
@import "tw-animate-css";
|
|
2
|
+
|
|
1
3
|
@theme {
|
|
2
4
|
--animate-shake: shake 0.2s ease-in-out 0s 3;
|
|
3
5
|
|
|
6
|
+
--animate-fade-up: fade-up 0.5s ease-out;
|
|
7
|
+
|
|
8
|
+
--animate-fade-down: fade-down 0.5s ease-out;
|
|
9
|
+
|
|
10
|
+
--animate-files-in: files-in 0.3s ease-out forwards;
|
|
11
|
+
|
|
4
12
|
@keyframes shake {
|
|
5
13
|
0%,
|
|
6
14
|
100% {
|
|
@@ -13,4 +21,43 @@
|
|
|
13
21
|
transform: translateX(-6px);
|
|
14
22
|
}
|
|
15
23
|
}
|
|
24
|
+
|
|
25
|
+
@keyframes fade-up {
|
|
26
|
+
0% {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
transform: translateY(10px);
|
|
29
|
+
}
|
|
30
|
+
80% {
|
|
31
|
+
opacity: 0.6;
|
|
32
|
+
}
|
|
33
|
+
100% {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
transform: translateY(0px);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes fade-down {
|
|
40
|
+
0% {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: translateY(-10px);
|
|
43
|
+
}
|
|
44
|
+
80% {
|
|
45
|
+
opacity: 0.6;
|
|
46
|
+
}
|
|
47
|
+
100% {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
transform: translateY(0px);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes files-in {
|
|
54
|
+
from {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transform: translateY(-4px);
|
|
57
|
+
}
|
|
58
|
+
to {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
transform: translateY(0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
16
63
|
}
|
package/css/theme.css
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
@theme {
|
|
2
|
-
--color-
|
|
3
|
-
--color-
|
|
2
|
+
--color-zu-accent: oklch(0.967 0.001 286.375);
|
|
3
|
+
--color-zu-destructive: oklch(0.577 0.245 27.325);
|
|
4
|
+
--color-zu-muted-foreground: oklch(0.556 0 0);
|
|
5
|
+
--color-zu-primary: oklch(0.21 0.04 265.75);
|
|
6
|
+
--color-zu-ring: oklch(0.705 0.015 286.067);
|
|
4
7
|
}
|
|
5
8
|
|
|
6
9
|
:where(.dark, [data-theme="dark"]) {
|
|
7
|
-
--color-
|
|
8
|
-
--color-
|
|
10
|
+
--color-zu-accent: oklch(0.274 0.006 286.033);
|
|
11
|
+
--color-zu-muted-foreground: oklch(0.708 0 0);
|
|
12
|
+
--color-zu-destructive: oklch(0.704 0.191 22.216);
|
|
13
|
+
--color-zu-primary: oklch(0.92 0.004 286.32);
|
|
14
|
+
--color-zu-ring: oklch(0.552 0.016 285.938);
|
|
9
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { __export } from "./chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { __export } from "./chunk-CTAAG5j7.js";
|
|
2
|
+
import { ErrorBoundary, useErrorBoundaryContext } from "./error-boundary-y9Samt_s.js";
|
|
3
|
+
import { SlotRoot } from "./slot-WVWfOlr3.js";
|
|
4
|
+
import { getSlotMap, withSlotNameAndSymbol } from "@zayne-labs/toolkit-react/utils";
|
|
5
5
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
6
6
|
import { Fragment, Suspense, use, useMemo } from "react";
|
|
7
7
|
import { createCustomContext } from "@zayne-labs/toolkit-react";
|
|
@@ -53,15 +53,13 @@ function AwaitRootInner(props) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function AwaitSuccess(props) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return props.children;
|
|
56
|
+
const { children } = props;
|
|
57
|
+
if (!isFunction(children)) return children;
|
|
58
|
+
const { result } = useAwaitContext();
|
|
59
|
+
return children(result);
|
|
61
60
|
}
|
|
62
61
|
Object.assign(AwaitSuccess, withSlotNameAndSymbol("default"));
|
|
63
|
-
|
|
64
|
-
const AwaitError = withSlotNameAndSymbol("error", (props) => {
|
|
62
|
+
function AwaitError(props) {
|
|
65
63
|
const { asChild, children } = props;
|
|
66
64
|
const errorBoundaryContext = useErrorBoundaryContext();
|
|
67
65
|
const Component$1 = asChild ? SlotRoot : Fragment;
|
|
@@ -70,12 +68,13 @@ const AwaitError = withSlotNameAndSymbol("error", (props) => {
|
|
|
70
68
|
...asChild && errorBoundaryContext,
|
|
71
69
|
children: resolvedChildren
|
|
72
70
|
});
|
|
73
|
-
}
|
|
71
|
+
}
|
|
72
|
+
Object.assign(AwaitError, withSlotNameAndSymbol("error"));
|
|
73
|
+
const AwaitPending = withSlotNameAndSymbol("pending");
|
|
74
74
|
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/components/common/await/await-parts.ts
|
|
77
|
-
var await_parts_exports = {
|
|
78
|
-
__export(await_parts_exports, {
|
|
77
|
+
var await_parts_exports = __export({
|
|
79
78
|
Error: () => AwaitError,
|
|
80
79
|
Pending: () => AwaitPending,
|
|
81
80
|
Root: () => AwaitRoot,
|
|
@@ -84,4 +83,4 @@ __export(await_parts_exports, {
|
|
|
84
83
|
|
|
85
84
|
//#endregion
|
|
86
85
|
export { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext };
|
|
87
|
-
//# sourceMappingURL=await-
|
|
86
|
+
//# sourceMappingURL=await-Da5w2vIc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"await-Da5w2vIc.js","names":["ReactFragment","Component","Slot.Root"],"sources":["../../src/components/common/await/await-context.ts","../../src/components/common/await/await.tsx","../../src/components/common/await/await-parts.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type AwaitContextType<TValue = unknown> = {\n\tpromise: Promise<TValue>;\n\tresult: TValue;\n};\n\nconst [AwaitContextProvider, useAwaitContextImpl] = createCustomContext<AwaitContextType>({\n\thookName: \"useAwaitContext\",\n\tname: \"AwaitContext\",\n\tproviderName: \"AwaitInner\",\n});\n\nconst useAwaitContext = <TValue>() => useAwaitContextImpl() as AwaitContextType<TValue>;\n\nexport { useAwaitContext, AwaitContextProvider };\n","\"use client\";\n\nimport {\n\ttype GetSlotComponentProps,\n\tgetSlotMap,\n\twithSlotNameAndSymbol,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Fragment as ReactFragment, Suspense, use, useMemo } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps, useErrorBoundaryContext } from \"../error-boundary\";\nimport { Slot } from \"../slot\";\nimport type { SuspenseWithBoundaryProps } from \"../suspense-with-boundary\";\nimport { AwaitContextProvider, useAwaitContext } from \"./await-context\";\n\ntype RenderPropFn<TValue> = (result: TValue) => React.ReactNode;\n\ntype ChildrenType<TValue> = React.ReactNode | RenderPropFn<TValue>;\n\ntype AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, \"errorFallback\" | \"fallback\"> & {\n\tasChild?: boolean;\n\tchildren: ChildrenType<TValue>;\n\tpromise: Promise<TValue>;\n\twithErrorBoundary?: boolean;\n\twithSuspense?: boolean;\n};\n\nexport function AwaitRoot<TValue>(props: AwaitRootProps<TValue>) {\n\tconst {\n\t\tchildren,\n\t\terrorFallback,\n\t\tfallback,\n\t\twithErrorBoundary = true,\n\t\twithSuspense = true,\n\t\t...restOfProps\n\t} = props;\n\n\tconst WithErrorBoundary = withErrorBoundary ? ErrorBoundary : ReactFragment;\n\tconst WithSuspense = withSuspense ? Suspense : ReactFragment;\n\n\tconst slots =\n\t\t!isFunction(children) ?\n\t\t\tgetSlotMap<SlotComponentProps>(children)\n\t\t:\t({ default: children } as unknown as ReturnType<typeof getSlotMap<SlotComponentProps>>);\n\n\tconst selectedPendingFallback = slots.pending ?? fallback;\n\tconst selectedErrorFallback = slots.error ?? errorFallback;\n\n\treturn (\n\t\t<WithErrorBoundary {...(Boolean(selectedErrorFallback) && { fallback: selectedErrorFallback })}>\n\t\t\t<WithSuspense {...(Boolean(selectedPendingFallback) && { fallback: selectedPendingFallback })}>\n\t\t\t\t<AwaitRootInner {...restOfProps}>{slots.default}</AwaitRootInner>\n\t\t\t</WithSuspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\ntype AwaitRootInnerProps<TValue> = Pick<AwaitRootProps<TValue>, \"asChild\" | \"children\" | \"promise\">;\n\nfunction AwaitRootInner<TValue>(props: AwaitRootInnerProps<TValue>) {\n\tconst { asChild, children, promise } = props;\n\n\tconst result = use(promise);\n\n\tconst resolvedChildren = isFunction(children) ? children(result) : children;\n\n\tconst Component = asChild ? Slot.Root : ReactFragment;\n\n\tconst contextValue = useMemo(() => ({ promise, result }), [promise, result]);\n\n\treturn (\n\t\t<AwaitContextProvider value={contextValue}>\n\t\t\t<Component {...(asChild && contextValue)}>{resolvedChildren}</Component>\n\t\t</AwaitContextProvider>\n\t);\n}\n\ntype SlotComponentProps = AwaitErrorProps | AwaitPendingProps | AwaitSuccessProps;\n\ntype AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<\"default\", ChildrenType<TValue>>;\n\nexport function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(\n\tprops: Pick<AwaitSuccessProps<TValue>, \"children\">\n) {\n\tconst { children } = props;\n\n\tif (!isFunction(children)) {\n\t\treturn children;\n\t}\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks -- This hook only uses `use` under the hood so this is safe\n\tconst { result } = useAwaitContext<TValue>();\n\n\treturn children(result);\n}\n\nObject.assign(AwaitSuccess, withSlotNameAndSymbol<AwaitSuccessProps>(\"default\"));\n\ntype AwaitErrorProps = GetSlotComponentProps<\"error\", ErrorBoundaryProps[\"fallback\"]>;\n\nexport function AwaitError(props: AwaitErrorProps & { asChild?: boolean }) {\n\tconst { asChild, children } = props;\n\n\tconst errorBoundaryContext = useErrorBoundaryContext();\n\n\tconst Component = asChild ? Slot.Root : ReactFragment;\n\n\tconst resolvedChildren = isFunction(children) ? children(errorBoundaryContext) : children;\n\n\treturn <Component {...(asChild && errorBoundaryContext)}>{resolvedChildren}</Component>;\n}\n\nObject.assign(AwaitError, withSlotNameAndSymbol<AwaitErrorProps>(\"error\"));\n\ntype AwaitPendingProps = GetSlotComponentProps<\"pending\", React.SuspenseProps[\"fallback\"]>;\n\nexport const AwaitPending = withSlotNameAndSymbol<AwaitPendingProps>(\"pending\");\n","export {\n\tAwaitRoot as Root,\n\tAwaitError as Error,\n\tAwaitPending as Pending,\n\tAwaitSuccess as Success,\n} from \"./await\";\n"],"mappings":";;;;;;;;;;AAOA,MAAM,CAAC,sBAAsB,uBAAuB,oBAAsC;CACzF,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;AAEF,MAAM,wBAAgC,qBAAqB;;;;ACc3D,SAAgB,UAAkB,OAA+B;CAChE,MAAM,EACL,UACA,eACA,UACA,oBAAoB,MACpB,eAAe,KACf,GAAG,gBACA;CAEJ,MAAM,oBAAoB,oBAAoB,gBAAgBA;CAC9D,MAAM,eAAe,eAAe,WAAWA;CAE/C,MAAM,QACL,CAAC,WAAW,SAAS,GACpB,WAA+B,SAAS,GACtC,EAAE,SAAS,UAAU;CAEzB,MAAM,0BAA0B,MAAM,WAAW;CACjD,MAAM,wBAAwB,MAAM,SAAS;AAE7C,QACC,oBAAC;EAAkB,GAAK,QAAQ,sBAAsB,IAAI,EAAE,UAAU,uBAAuB;YAC5F,oBAAC;GAAa,GAAK,QAAQ,wBAAwB,IAAI,EAAE,UAAU,yBAAyB;aAC3F,oBAAC;IAAe,GAAI;cAAc,MAAM;KAAyB;IACnD;GACI;;AAMtB,SAAS,eAAuB,OAAoC;CACnE,MAAM,EAAE,SAAS,UAAU,YAAY;CAEvC,MAAM,SAAS,IAAI,QAAQ;CAE3B,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,OAAO,GAAG;CAEnE,MAAMC,cAAY,UAAUC,WAAYF;CAExC,MAAM,eAAe,eAAe;EAAE;EAAS;EAAQ,GAAG,CAAC,SAAS,OAAO,CAAC;AAE5E,QACC,oBAAC;EAAqB,OAAO;YAC5B,oBAACC;GAAU,GAAK,WAAW;aAAgB;IAA6B;GAClD;;AAQzB,SAAgB,aACf,OACC;CACD,MAAM,EAAE,aAAa;AAErB,KAAI,CAAC,WAAW,SAAS,CACxB,QAAO;CAIR,MAAM,EAAE,WAAW,iBAAyB;AAE5C,QAAO,SAAS,OAAO;;AAGxB,OAAO,OAAO,cAAc,sBAAyC,UAAU,CAAC;AAIhF,SAAgB,WAAW,OAAgD;CAC1E,MAAM,EAAE,SAAS,aAAa;CAE9B,MAAM,uBAAuB,yBAAyB;CAEtD,MAAMA,cAAY,UAAUC,WAAYF;CAExC,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,qBAAqB,GAAG;AAEjF,QAAO,oBAACC;EAAU,GAAK,WAAW;YAAwB;GAA6B;;AAGxF,OAAO,OAAO,YAAY,sBAAuC,QAAQ,CAAC;AAI1E,MAAa,eAAe,sBAAyC,UAAU"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __export } from "./chunk-
|
|
2
|
-
import { SlotRoot } from "./slot-
|
|
3
|
-
import { cnMerge } from "./cn-
|
|
1
|
+
import { __export } from "./chunk-CTAAG5j7.js";
|
|
2
|
+
import { SlotRoot } from "./slot-WVWfOlr3.js";
|
|
3
|
+
import { cnMerge } from "./cn-s-D7vHW1.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -16,12 +16,13 @@ function CardRoot(props) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
function CardHeader(props) {
|
|
19
|
-
const { as: Element = "header",...restOfProps } = props;
|
|
19
|
+
const { as: Element = "header", className,...restOfProps } = props;
|
|
20
20
|
return /* @__PURE__ */ jsx(Element, {
|
|
21
21
|
"data-scope": "card",
|
|
22
22
|
"data-part": "header",
|
|
23
23
|
"data-slot": "card-header",
|
|
24
|
-
className:
|
|
24
|
+
className: cnMerge(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6
|
|
25
|
+
has-data-[slot=card-action]:grid-cols-[1fr_auto]`, className),
|
|
25
26
|
...restOfProps
|
|
26
27
|
});
|
|
27
28
|
}
|
|
@@ -31,7 +32,7 @@ function CardTitle(props) {
|
|
|
31
32
|
"data-scope": "card",
|
|
32
33
|
"data-part": "title",
|
|
33
34
|
"data-slot": "card-title",
|
|
34
|
-
className: cnMerge("font-semibold
|
|
35
|
+
className: cnMerge("leading-none font-semibold", className),
|
|
35
36
|
...restOfProps
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -41,7 +42,7 @@ function CardDescription(props) {
|
|
|
41
42
|
"data-scope": "card",
|
|
42
43
|
"data-part": "description",
|
|
43
44
|
"data-slot": "card-description",
|
|
44
|
-
className: cnMerge("text-
|
|
45
|
+
className: cnMerge("text-sm text-zu-muted-foreground", className),
|
|
45
46
|
...restOfProps
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -79,8 +80,7 @@ function CardFooter(props) {
|
|
|
79
80
|
|
|
80
81
|
//#endregion
|
|
81
82
|
//#region src/components/ui/card/card-parts.ts
|
|
82
|
-
var card_parts_exports = {
|
|
83
|
-
__export(card_parts_exports, {
|
|
83
|
+
var card_parts_exports = __export({
|
|
84
84
|
Action: () => CardAction,
|
|
85
85
|
Content: () => CardContent,
|
|
86
86
|
Description: () => CardDescription,
|
|
@@ -92,4 +92,4 @@ __export(card_parts_exports, {
|
|
|
92
92
|
|
|
93
93
|
//#endregion
|
|
94
94
|
export { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports };
|
|
95
|
-
//# sourceMappingURL=card-
|
|
95
|
+
//# sourceMappingURL=card-DDLJVCwL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-DDLJVCwL.js","names":["Component","Slot.Root"],"sources":["../../src/components/ui/card/card.tsx","../../src/components/ui/card/card-parts.ts"],"sourcesContent":["import type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport * as React from \"react\";\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"root\"\n\t\t\tdata-slot=\"card-root\"\n\t\t\tclassName=\"flex flex-col gap-6 rounded-xl border py-6 shadow-sm\"\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"header\"\n\t\t\tdata-slot=\"card-header\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6\n\t\t\t\thas-data-[slot=card-action]:grid-cols-[1fr_auto]`,\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"title\"\n\t\t\tdata-slot=\"card-title\"\n\t\t\tclassName={cnMerge(\"leading-none font-semibold\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"description\"\n\t\t\tdata-slot=\"card-description\"\n\t\t\tclassName={cnMerge(\"text-sm text-zu-muted-foreground\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"content\"\n\t\t\tdata-slot=\"card-content\"\n\t\t\tclassName={cnMerge(\"px-6\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardAction<TElement extends React.ElementType = \"div\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"action\"\n\t\t\tdata-slot=\"card-action\"\n\t\t\tclassName={cnMerge(\"col-start-2 row-span-2 row-start-1 self-start justify-self-end\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, className, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn (\n\t\t<Component\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"footer\"\n\t\t\tdata-slot=\"card-footer\"\n\t\t\tclassName={cnMerge(\"px-6\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardAction as Action,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"],"mappings":";;;;;;;AAKA,SAAgB,SACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAW,GAAG,gBAAgB;AAEpD,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAU;EACV,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,UAAW,GAAG,gBAAgB;AAE9D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QACV;uDAEA,UACA;EACD,GAAI;GACH;;AAIJ,SAAgB,UAAqD,OAAmC;CACvG,MAAM,EAAE,IAAI,UAAU,MAAM,UAAW,GAAG,gBAAgB;AAE1D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,8BAA8B,UAAU;EAC3D,GAAI;GACH;;AAIJ,SAAgB,gBACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,KAAK,UAAW,GAAG,gBAAgB;AAEzD,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,oCAAoC,UAAU;EACjE,GAAI;GACH;;AAIJ,SAAgB,YACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,QAAQ,UAAU;EACrC,GAAI;GACH;;AAIJ,SAAgB,WAAuD,OAAmC;CACzG,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,kEAAkE,UAAU;EAC/F,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,SAAS,UAAW,GAAG,gBAAgB;CAEvE,MAAMA,cAAY,UAAUC,WAAY;AAExC,QACC,oBAACD;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,QAAQ,UAAU;EACrC,GAAI;GACH"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { __export } from "./chunk-
|
|
2
|
-
import { For } from "./for-
|
|
3
|
-
import { ShowContent, ShowFallback, ShowRoot } from "./show-
|
|
4
|
-
import { cnMerge } from "./cn-
|
|
1
|
+
import { __export } from "./chunk-CTAAG5j7.js";
|
|
2
|
+
import { For } from "./for-DK5rEY_m.js";
|
|
3
|
+
import { ShowContent, ShowFallback, ShowRoot } from "./show-N1ZXBhoA.js";
|
|
4
|
+
import { cnMerge } from "./cn-s-D7vHW1.js";
|
|
5
5
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
|
-
import { createStore } from "@zayne-labs/toolkit-core";
|
|
8
7
|
import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { createStore } from "@zayne-labs/toolkit-core";
|
|
10
10
|
import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
|
|
11
11
|
|
|
12
12
|
//#region src/components/ui/carousel/carousel-store-context.ts
|
|
@@ -17,7 +17,7 @@ const [CarouselStoreContextProvider, useCarouselStoreContext] = createZustandCon
|
|
|
17
17
|
});
|
|
18
18
|
const createCarouselStore = (storeValues) => {
|
|
19
19
|
const { images, onSlideBtnClick } = storeValues;
|
|
20
|
-
|
|
20
|
+
return createStore((set, get) => ({
|
|
21
21
|
currentSlide: 0,
|
|
22
22
|
images,
|
|
23
23
|
maxSlide: images.length - 1,
|
|
@@ -46,7 +46,6 @@ const createCarouselStore = (storeValues) => {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}));
|
|
49
|
-
return carouselStore;
|
|
50
49
|
};
|
|
51
50
|
const useCarousel = (props) => {
|
|
52
51
|
const { images, onSlideBtnClick } = props;
|
|
@@ -92,9 +91,8 @@ const ChevronLeftIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
92
91
|
const useCarouselOptions = (options) => {
|
|
93
92
|
const { actions, autoSlideInterval = 5e3, hasAutoSlide = false, shouldPauseOnHover = false } = options;
|
|
94
93
|
const [isPaused, setIsPaused] = useState(false);
|
|
95
|
-
const shouldAutoSlide = hasAutoSlide && !isPaused;
|
|
96
94
|
useAnimationInterval({
|
|
97
|
-
intervalDuration:
|
|
95
|
+
intervalDuration: hasAutoSlide && !isPaused ? autoSlideInterval : null,
|
|
98
96
|
onAnimation: actions.goToNextSlide
|
|
99
97
|
});
|
|
100
98
|
const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
|
|
@@ -193,16 +191,16 @@ function CarouselControls(props) {
|
|
|
193
191
|
})
|
|
194
192
|
});
|
|
195
193
|
}
|
|
196
|
-
function
|
|
194
|
+
function CarouselItemList(props) {
|
|
197
195
|
const { children, className, each } = props;
|
|
198
196
|
const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
|
|
199
197
|
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
200
198
|
return /* @__PURE__ */ jsx("ul", {
|
|
201
199
|
"data-scope": "carousel",
|
|
202
|
-
"data-part": "item-
|
|
203
|
-
"data-slot": "carousel-item-
|
|
204
|
-
className: cnMerge(`
|
|
205
|
-
|
|
200
|
+
"data-part": "item-list",
|
|
201
|
+
"data-slot": "carousel-item-list",
|
|
202
|
+
className: cnMerge(`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center
|
|
203
|
+
transition-transform duration-800`, className),
|
|
206
204
|
style: { "--translate-distance": `-${currentSlide * 100}%` },
|
|
207
205
|
children: isFunction(children) ? /* @__PURE__ */ jsx(For, {
|
|
208
206
|
each: images,
|
|
@@ -235,13 +233,13 @@ function CarouselCaption(props) {
|
|
|
235
233
|
children
|
|
236
234
|
});
|
|
237
235
|
}
|
|
238
|
-
function
|
|
236
|
+
function CarouselIndicatorList(props) {
|
|
239
237
|
const { children, className, each } = props;
|
|
240
238
|
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
241
239
|
return /* @__PURE__ */ jsx("ul", {
|
|
242
240
|
"data-scope": "carousel",
|
|
243
|
-
"data-part": "indicator-
|
|
244
|
-
"data-slot": "carousel-indicator-
|
|
241
|
+
"data-part": "indicator-list",
|
|
242
|
+
"data-slot": "carousel-indicator-list",
|
|
245
243
|
className: cnMerge("absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]", className),
|
|
246
244
|
children: isFunction(children) ? /* @__PURE__ */ jsx(For, {
|
|
247
245
|
each: images,
|
|
@@ -271,18 +269,17 @@ function CarouselIndicator(props) {
|
|
|
271
269
|
|
|
272
270
|
//#endregion
|
|
273
271
|
//#region src/components/ui/carousel/carousel-parts.ts
|
|
274
|
-
var carousel_parts_exports = {
|
|
275
|
-
__export(carousel_parts_exports, {
|
|
272
|
+
var carousel_parts_exports = __export({
|
|
276
273
|
Button: () => CarouselButton,
|
|
277
274
|
Caption: () => CarouselCaption,
|
|
278
275
|
Controls: () => CarouselControls,
|
|
279
276
|
Indicator: () => CarouselIndicator,
|
|
280
|
-
IndicatorGroup: () =>
|
|
277
|
+
IndicatorGroup: () => CarouselIndicatorList,
|
|
281
278
|
Item: () => CarouselItem,
|
|
282
|
-
ItemGroup: () =>
|
|
279
|
+
ItemGroup: () => CarouselItemList,
|
|
283
280
|
Root: () => CarouselRoot
|
|
284
281
|
});
|
|
285
282
|
|
|
286
283
|
//#endregion
|
|
287
|
-
export { CarouselButton, CarouselCaption, CarouselControls, CarouselIndicator,
|
|
288
|
-
//# sourceMappingURL=carousel-
|
|
284
|
+
export { CarouselButton, CarouselCaption, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselItem, CarouselItemList, CarouselRoot, carousel_parts_exports };
|
|
285
|
+
//# sourceMappingURL=carousel-B051PAAX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-B051PAAX.js","names":["useCarouselStore: typeof useCarouselStoreContext","Show.Root","Show.Content","Show.Fallback"],"sources":["../../src/components/ui/carousel/carousel-store-context.ts","../../src/components/ui/carousel/icons.tsx","../../src/components/ui/carousel/useCarouselOptions.ts","../../src/components/ui/carousel/carousel.tsx","../../src/components/ui/carousel/carousel-parts.ts"],"sourcesContent":["import { createStore } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useStore } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport type { CarouselRootProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [CarouselStoreContextProvider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselRoot\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselRootProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst carouselStore = createStore<CarouselStore<TImages>>((set, get) => ({\n\t\tcurrentSlide: 0,\n\t\timages,\n\t\tmaxSlide: images.length - 1,\n\n\t\t/* eslint-disable perfectionist/sort-objects -- actions should be last */\n\t\tactions: {\n\t\t\t/* eslint-enable perfectionist/sort-objects -- actions should be last */\n\n\t\t\tgoToNextSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === maxSlide) {\n\t\t\t\t\tgoToSlide(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide + 1);\n\t\t\t},\n\n\t\t\tgoToPreviousSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === 0) {\n\t\t\t\t\tgoToSlide(maxSlide);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide - 1);\n\t\t\t},\n\n\t\t\tgoToSlide: (newValue) => {\n\t\t\t\tonSlideBtnClick?.();\n\n\t\t\t\tset({ currentSlide: newValue });\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn carouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(props: Omit<CarouselRootProps<TImages>, \"children\">) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst savedOnSlideBtnClick = useCallbackRef(onSlideBtnClick);\n\n\tconst carouselStore = useMemo(\n\t\t() => createCarouselStore({ images, onSlideBtnClick: savedOnSlideBtnClick }),\n\t\t[images, savedOnSlideBtnClick]\n\t);\n\n\tconst useCarouselStore: typeof useCarouselStoreContext = (selector) => {\n\t\treturn useStore(carouselStore, selector);\n\t};\n\n\tconst savedUseCarouselStore = useCallbackRef(useCarouselStore);\n\n\treturn useMemo(\n\t\t() => ({ carouselStore, useCarouselStore: savedUseCarouselStore }),\n\t\t[carouselStore, savedUseCarouselStore]\n\t);\n};\n\nexport { CarouselStoreContextProvider, useCarousel, useCarouselStoreContext };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport type { CarouselStore } from \"./types\";\n\ntype CarouselOptions = {\n\tactions: CarouselStore[\"actions\"];\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions) => {\n\tconst { actions, autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst [isPaused, setIsPaused] = useState(false);\n\n\tconst shouldAutoSlide = hasAutoSlide && !isPaused;\n\n\tuseAnimationInterval({\n\t\tintervalDuration: shouldAutoSlide ? autoSlideInterval : null,\n\t\tonAnimation: actions.goToNextSlide,\n\t});\n\n\tconst pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));\n\n\tconst resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));\n\n\treturn { pauseAutoSlide, resumeAutoSlide };\n};\n\nexport { useCarouselOptions };\n","\"use client\";\n\nimport type { CssWithCustomProperties, PolymorphicPropsStrict } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Show } from \"@/components/common\";\nimport { For } from \"@/components/common/for\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport {\n\tCarouselStoreContextProvider,\n\tuseCarousel,\n\tuseCarouselStoreContext,\n} from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselRootProps,\n\tCarouselWrapperProps,\n\tImagesType,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>\n) {\n\tconst {\n\t\tas: Element = \"div\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\timages,\n\t\tonSlideBtnClick,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { carouselStore } = useCarousel({ images, onSlideBtnClick });\n\n\tconst actions = carouselStore.getState().actions;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tactions,\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\treturn (\n\t\t<CarouselStoreContextProvider store={carouselStore}>\n\t\t\t<Element\n\t\t\t\tdata-scope=\"carousel\"\n\t\t\t\tdata-part=\"content\"\n\t\t\t\tdata-slot=\"carousel-content\"\n\t\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</Element>\n\t\t</CarouselStoreContextProvider>\n\t);\n}\n\nexport function CarouselButton(props: CarouselButtonsProps) {\n\tconst { classNames, icon, variant } = props;\n\n\tconst { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);\n\n\treturn (\n\t\t<button\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"button\"\n\t\t\tdata-slot=\"carousel-button\"\n\t\t\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"controls\"\n\t\t\tdata-slot=\"carousel-controls\"\n\t\t\tclassName={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}\n\t\t>\n\t\t\t<Show.Root when={icon?.iconType}>\n\t\t\t\t<Show.Content>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Content>\n\n\t\t\t\t<Show.Fallback>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Fallback>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each } = props;\n\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item-list\"\n\t\t\tdata-slot=\"carousel-item-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center\n\t\t\t\ttransition-transform duration-800`,\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t\"--translate-distance\": `-${currentSlide * 100}%`,\n\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem(props: OtherCarouselProps) {\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item\"\n\t\t\tdata-slot=\"carousel-item\"\n\t\t\tclassName={cnMerge(\"flex w-full shrink-0 snap-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</li>\n\t);\n}\n\nexport function CarouselCaption<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"caption\"\n\t\t\tdata-slot=\"carousel-caption\"\n\t\t\tclassName={cnMerge(\"absolute z-10\", className)}\n\t\t>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator-list\"\n\t\t\tdata-slot=\"carousel-indicator-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselIndicator(props: CarouselIndicatorProps) {\n\tconst { classNames, currentIndex } = props;\n\n\tconst {\n\t\tactions: { goToSlide },\n\t\tcurrentSlide,\n\t} = useCarouselStoreContext((state) => state);\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator\"\n\t\t\tdata-slot=\"carousel-indicator\"\n\t\t\tclassName={cnMerge(\"inline-flex\", classNames?.base)}\n\t\t>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export {\n\tCarouselButton as Button,\n\tCarouselCaption as Caption,\n\tCarouselControls as Controls,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorList as IndicatorGroup,\n\tCarouselItem as Item,\n\tCarouselItemList as ItemGroup,\n\tCarouselRoot as Root,\n} from \"./carousel\";\n"],"mappings":"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"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __export = (
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
4
5
|
for (var name in all) __defProp(target, name, {
|
|
5
6
|
get: all[name],
|
|
6
7
|
enumerable: true
|
|
7
8
|
});
|
|
9
|
+
return target;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn-
|
|
1
|
+
{"version":3,"file":"cn-s-D7vHW1.js","names":[],"sources":["../../src/lib/utils/cn.ts"],"sourcesContent":["import { type ClassNameValue, twMerge } from \"tailwind-merge\";\n\nexport const cnMerge = (...classNames: ClassNameValue[]) => twMerge(classNames);\n"],"mappings":";;;AAEA,MAAa,WAAW,GAAG,eAAiC,QAAQ,WAAW"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../../index-BAywimP3.js";
|
|
2
|
+
import "../../index-ATxxr1XS.js";
|
|
3
|
+
import { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_d_exports, useAwaitContext } from "../../index-C889t8UO.js";
|
|
4
|
+
export { await_parts_d_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import "../../error-boundary-y9Samt_s.js";
|
|
5
|
+
import "../../slot-WVWfOlr3.js";
|
|
6
|
+
import { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext } from "../../await-Da5w2vIc.js";
|
|
7
|
+
|
|
8
|
+
export { await_parts_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/common/client-gate/client-gate.d.ts
|
|
4
|
+
type ClientGateProps = {
|
|
5
|
+
/**
|
|
6
|
+
* You are encouraged to add a fallback that is the same dimensions
|
|
7
|
+
* as the client rendered children. This will avoid content layout
|
|
8
|
+
* shift which is disgusting 🥲
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode | (() => React.ReactNode);
|
|
11
|
+
fallback?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @description Render the children only after the JS has loaded client-side. Use an optional
|
|
15
|
+
* fallback component if the JS is not yet loaded.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* **Render a Chart component if JS loads, renders a simple FakeChart
|
|
19
|
+
* component server-side or if there is no JS. The FakeChart can have only the
|
|
20
|
+
* UI without the behavior or be a loading spinner or skeleton.**
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* return (
|
|
24
|
+
* <ClientOnly fallback={<FakeChart />}>
|
|
25
|
+
* {() => <Chart />}
|
|
26
|
+
* </ClientOnly>
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function ClientGate(props: ClientGateProps): React.ReactNode;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ClientGate };
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
5
|
+
import "react";
|
|
6
|
+
import { useIsHydrated } from "@zayne-labs/toolkit-react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/common/client-gate/client-gate.tsx
|
|
9
|
+
/**
|
|
10
|
+
* @description Render the children only after the JS has loaded client-side. Use an optional
|
|
11
|
+
* fallback component if the JS is not yet loaded.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* **Render a Chart component if JS loads, renders a simple FakeChart
|
|
15
|
+
* component server-side or if there is no JS. The FakeChart can have only the
|
|
16
|
+
* UI without the behavior or be a loading spinner or skeleton.**
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* return (
|
|
20
|
+
* <ClientOnly fallback={<FakeChart />}>
|
|
21
|
+
* {() => <Chart />}
|
|
22
|
+
* </ClientOnly>
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function ClientGate(props) {
|
|
27
|
+
const { children, fallback } = props;
|
|
28
|
+
const isHydrated = useIsHydrated();
|
|
29
|
+
const getResolvedChildren = () => isFunction(children) ? children() : children;
|
|
30
|
+
return isHydrated ? getResolvedChildren() : fallback;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ClientGate };
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/client-gate/client-gate.tsx"],"sourcesContent":["\"use client\";\n\nimport { useIsHydrated } from \"@zayne-labs/toolkit-react\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\n\ntype ClientGateProps = {\n\t/**\n\t * You are encouraged to add a fallback that is the same dimensions\n\t * as the client rendered children. This will avoid content layout\n\t * shift which is disgusting 🥲\n\t */\n\tchildren: React.ReactNode | (() => React.ReactNode);\n\tfallback?: React.ReactNode;\n};\n\n/**\n * @description Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * **Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.**\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * {() => <Chart />}\n * </ClientOnly>\n * );\n * ```\n */\nfunction ClientGate(props: ClientGateProps) {\n\tconst { children, fallback } = props;\n\n\tconst isHydrated = useIsHydrated();\n\n\tconst getResolvedChildren = () => (isFunction(children) ? children() : children);\n\n\treturn isHydrated ? getResolvedChildren() : fallback;\n}\n\nexport { ClientGate };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAS,WAAW,OAAwB;CAC3C,MAAM,EAAE,UAAU,aAAa;CAE/B,MAAM,aAAa,eAAe;CAElC,MAAM,4BAA6B,WAAW,SAAS,GAAG,UAAU,GAAG;AAEvE,QAAO,aAAa,qBAAqB,GAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from "
|
|
1
|
+
import { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from "../../index-BAywimP3.js";
|
|
2
2
|
export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from "
|
|
4
|
+
import { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from "../../error-boundary-y9Samt_s.js";
|
|
5
5
|
|
|
6
6
|
export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorBoundary } from "../index-BAywimP3.js";
|
|
2
|
+
import { SuspenseWithBoundary } from "../index-ATxxr1XS.js";
|
|
3
|
+
import { await_parts_d_exports } from "../index-C889t8UO.js";
|
|
4
|
+
import { For, ForWithWrapper } from "../index-BT0UvcRp.js";
|
|
5
|
+
import { show_parts_d_exports } from "../index-BsGxDKlt.js";
|
|
6
|
+
import { slot_parts_d_exports } from "../index-CuJVxLEc.js";
|
|
7
|
+
import { switch_parts_d_exports } from "../index-CffEFE66.js";
|
|
8
|
+
import { Teleport } from "../index-CZjeBSoQ.js";
|
|
9
|
+
export { await_parts_d_exports as Await, ErrorBoundary, For, ForWithWrapper, show_parts_d_exports as Show, slot_parts_d_exports as Slot, SuspenseWithBoundary, switch_parts_d_exports as Switch, Teleport };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ErrorBoundary } from "../error-boundary-y9Samt_s.js";
|
|
2
|
+
import { slot_parts_exports } from "../slot-WVWfOlr3.js";
|
|
3
|
+
import { await_parts_exports } from "../await-Da5w2vIc.js";
|
|
4
|
+
import { For, ForWithWrapper } from "../for-DK5rEY_m.js";
|
|
5
|
+
import { show_parts_exports } from "../show-N1ZXBhoA.js";
|
|
6
|
+
import { SuspenseWithBoundary } from "../suspense-with-boundary-D-1NYDV4.js";
|
|
7
|
+
import { switch_parts_exports } from "../switch-Ch22z21e.js";
|
|
8
|
+
import { Teleport } from "../teleport-C8TzRm4M.js";
|
|
9
|
+
import "../common-PS3X58Pj.js";
|
|
10
|
+
|
|
11
|
+
export { await_parts_exports as Await, ErrorBoundary, For, ForWithWrapper, show_parts_exports as Show, slot_parts_exports as Slot, SuspenseWithBoundary, switch_parts_exports as Switch, Teleport };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/common/presence/use-presence.d.ts
|
|
4
|
+
type UsePresenceOptions = {
|
|
5
|
+
onExitComplete?: () => void;
|
|
6
|
+
present: boolean;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/components/common/presence/presence.d.ts
|
|
10
|
+
type RefProp = {
|
|
11
|
+
ref?: React.Ref<HTMLElement>;
|
|
12
|
+
};
|
|
13
|
+
type PresenceProps = UsePresenceOptions & {
|
|
14
|
+
children?: React.ReactElement<RefProp> | ((props: {
|
|
15
|
+
isPresent: boolean;
|
|
16
|
+
}) => React.ReactElement<RefProp>);
|
|
17
|
+
forceMount?: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare function Presence(props: PresenceProps): React.ReactElement<RefProp, string | React.JSXElementConstructor<any>> | null | undefined;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Presence };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ShowContent, ShowFallback, ShowRoot, show_parts_d_exports } from "
|
|
1
|
+
import { ShowContent, ShowFallback, ShowRoot, show_parts_d_exports } from "../../index-BsGxDKlt.js";
|
|
2
2
|
export { show_parts_d_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../../show-BabiXbf7.js";
|
|
4
|
+
import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../show-N1ZXBhoA.js";
|
|
6
5
|
|
|
7
6
|
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SlotRoot, SlotSlottable, slot_parts_d_exports } from "
|
|
1
|
+
import { SlotRoot, SlotSlottable, slot_parts_d_exports } from "../../index-CuJVxLEc.js";
|
|
2
2
|
export { slot_parts_d_exports as Slot, SlotRoot, SlotSlottable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_d_exports } from "
|
|
1
|
+
import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_d_exports } from "../../index-CffEFE66.js";
|
|
2
2
|
export { switch_parts_d_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports } from "../../../switch-CCMD01Rs.js";
|
|
4
|
+
import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports } from "../../switch-Ch22z21e.js";
|
|
6
5
|
|
|
7
6
|
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|