@zayne-labs/ui-react 0.9.16 → 0.9.17
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/esm/await-Fe4LFRKd.js +89 -0
- package/dist/esm/await-Fe4LFRKd.js.map +1 -0
- package/dist/esm/card-DRjs-vtv.js +54 -0
- package/dist/esm/card-DRjs-vtv.js.map +1 -0
- package/dist/esm/carousel-Dznupnx8.js +270 -0
- package/dist/esm/carousel-Dznupnx8.js.map +1 -0
- package/dist/esm/chunk-Cl8Af3a2.js +11 -0
- package/dist/esm/cn-_FbtIrlZ.js +8 -0
- package/dist/esm/cn-_FbtIrlZ.js.map +1 -0
- package/dist/esm/common-BYWy8Q78.js +0 -0
- package/dist/esm/components/common/await/index.d.ts +6 -14
- package/dist/esm/components/common/await/index.js +10 -8
- package/dist/esm/components/common/error-boundary/index.d.ts +2 -17
- package/dist/esm/components/common/error-boundary/index.js +6 -4
- package/dist/esm/components/common/for/index.d.ts +2 -10
- package/dist/esm/components/common/for/index.js +3 -4
- package/dist/esm/components/common/index.d.ts +11 -13
- package/dist/esm/components/common/index.js +13 -14
- package/dist/esm/components/common/show/index.d.ts +2 -26
- package/dist/esm/components/common/show/index.js +7 -5
- package/dist/esm/components/common/slot/index.d.ts +2 -12
- package/dist/esm/components/common/slot/index.js +3 -4
- package/dist/esm/components/common/suspense-with-boundary/index.d.ts +3 -11
- package/dist/esm/components/common/suspense-with-boundary/index.js +4 -5
- package/dist/esm/components/common/switch/index.d.ts +2 -25
- package/dist/esm/components/common/switch/index.js +7 -5
- package/dist/esm/components/common/teleport/index.d.ts +2 -12
- package/dist/esm/components/common/teleport/index.js +3 -4
- package/dist/esm/components/ui/card/index.d.ts +2 -17
- package/dist/esm/components/ui/card/index.js +5 -6
- package/dist/esm/components/ui/carousel/index.d.ts +2 -95
- package/dist/esm/components/ui/carousel/index.js +18 -16
- package/dist/esm/components/ui/drag-scroll/index.d.ts +2 -21
- package/dist/esm/components/ui/drag-scroll/index.js +4 -5
- package/dist/esm/components/ui/drop-zone/index.d.ts +3 -11
- package/dist/esm/components/ui/drop-zone/index.js +18 -16
- package/dist/esm/components/ui/form/index.d.ts +2 -228
- package/dist/esm/components/ui/form/index.js +10 -8
- package/dist/esm/components/ui/index.d.ts +7 -11
- package/dist/esm/components/ui/index.js +19 -20
- package/dist/esm/drag-scroll-BLjij7aI.js +111 -0
- package/dist/esm/drag-scroll-BLjij7aI.js.map +1 -0
- package/dist/esm/drop-zone-_YK9C3Xj.js +313 -0
- package/dist/esm/drop-zone-_YK9C3Xj.js.map +1 -0
- package/dist/esm/error-boundary-B3ycUZ1t.js +126 -0
- package/dist/esm/error-boundary-B3ycUZ1t.js.map +1 -0
- package/dist/esm/for-aTw1TgJo.js +42 -0
- package/dist/esm/for-aTw1TgJo.js.map +1 -0
- package/dist/esm/form-DytCfL6R.js +590 -0
- package/dist/esm/form-DytCfL6R.js.map +1 -0
- package/dist/esm/getSlot-BIcGgBwN.js +85 -0
- package/dist/esm/getSlot-BIcGgBwN.js.map +1 -0
- package/dist/esm/{getSlotMap-DTkxtGhd.d.ts → getSlotMap-DA_uhXqU.d.ts} +17 -16
- package/dist/esm/index--1COprHP.d.ts +32 -0
- package/dist/esm/index-1UCPJf7B.d.ts +19 -0
- package/dist/esm/index-BC0r1cBF.d.ts +104 -0
- package/dist/esm/index-BPeZJS-v.d.ts +191 -0
- package/dist/esm/index-BSJ30pGj.d.ts +68 -0
- package/dist/esm/{for-BH5FhFuV.d.ts → index-BhpBx8dH.d.ts} +14 -6
- package/dist/esm/index-BuSQsDCX.d.ts +22 -0
- package/dist/esm/index-C0XZoIZD.d.ts +35 -0
- package/dist/esm/index-C4ub0yqe.d.ts +49 -0
- package/dist/esm/index-CTZr4PTO.d.ts +24 -0
- package/dist/esm/index-DKfm0Dyj.d.ts +61 -0
- package/dist/esm/index-DQ1yFGd2.d.ts +229 -0
- package/dist/esm/index-DmOz1yDZ.d.ts +14 -0
- package/dist/esm/index-DnaUCh8d.d.ts +15 -0
- package/dist/esm/lib/utils/index.d.ts +3 -61
- package/dist/esm/lib/utils/index.js +4 -5
- package/dist/esm/show-BgYrfIxJ.js +41 -0
- package/dist/esm/show-BgYrfIxJ.js.map +1 -0
- package/dist/esm/slot-RXTKo4L7.js +58 -0
- package/dist/esm/slot-RXTKo4L7.js.map +1 -0
- package/dist/esm/suspense-with-boundary-TrQxYRG6.js +21 -0
- package/dist/esm/suspense-with-boundary-TrQxYRG6.js.map +1 -0
- package/dist/esm/switch-PF5xTJfr.js +42 -0
- package/dist/esm/switch-PF5xTJfr.js.map +1 -0
- package/dist/esm/teleport-dlSjWj_t.js +32 -0
- package/dist/esm/teleport-dlSjWj_t.js.map +1 -0
- package/dist/esm/utils-D4YNWj2X.js +89 -0
- package/dist/esm/utils-D4YNWj2X.js.map +1 -0
- package/package.json +4 -4
- package/dist/esm/await-parts-BJ6C-y1f.d.ts +0 -36
- package/dist/esm/chunk-6QJYHPBL.js +0 -45
- package/dist/esm/chunk-6QJYHPBL.js.map +0 -1
- package/dist/esm/chunk-BJ7WR4XW.js +0 -274
- package/dist/esm/chunk-BJ7WR4XW.js.map +0 -1
- package/dist/esm/chunk-CWUEUCR5.js +0 -3
- package/dist/esm/chunk-CWUEUCR5.js.map +0 -1
- package/dist/esm/chunk-D6QZA3UT.js +0 -56
- package/dist/esm/chunk-D6QZA3UT.js.map +0 -1
- package/dist/esm/chunk-EYWTW54R.js +0 -42
- package/dist/esm/chunk-EYWTW54R.js.map +0 -1
- package/dist/esm/chunk-G5BNZM66.js +0 -32
- package/dist/esm/chunk-G5BNZM66.js.map +0 -1
- package/dist/esm/chunk-JC52CA2O.js +0 -113
- package/dist/esm/chunk-JC52CA2O.js.map +0 -1
- package/dist/esm/chunk-M7YXNGT6.js +0 -48
- package/dist/esm/chunk-M7YXNGT6.js.map +0 -1
- package/dist/esm/chunk-MRYXZN2P.js +0 -336
- package/dist/esm/chunk-MRYXZN2P.js.map +0 -1
- package/dist/esm/chunk-MT2MQDK2.js +0 -13
- package/dist/esm/chunk-MT2MQDK2.js.map +0 -1
- package/dist/esm/chunk-N4274N5K.js +0 -50
- package/dist/esm/chunk-N4274N5K.js.map +0 -1
- package/dist/esm/chunk-NXZZXJRH.js +0 -41
- package/dist/esm/chunk-NXZZXJRH.js.map +0 -1
- package/dist/esm/chunk-OHG7GB7O.js +0 -8
- package/dist/esm/chunk-OHG7GB7O.js.map +0 -1
- package/dist/esm/chunk-P5QP73HG.js +0 -626
- package/dist/esm/chunk-P5QP73HG.js.map +0 -1
- package/dist/esm/chunk-PZ5AY32C.js +0 -9
- package/dist/esm/chunk-PZ5AY32C.js.map +0 -1
- package/dist/esm/chunk-V5ZPMMIH.js +0 -121
- package/dist/esm/chunk-V5ZPMMIH.js.map +0 -1
- package/dist/esm/chunk-YO5LJ7ZJ.js +0 -74
- package/dist/esm/chunk-YO5LJ7ZJ.js.map +0 -1
- package/dist/esm/chunk-YSDKXBU7.js +0 -68
- package/dist/esm/chunk-YSDKXBU7.js.map +0 -1
- package/dist/esm/components/common/await/index.js.map +0 -1
- package/dist/esm/components/common/error-boundary/index.js.map +0 -1
- package/dist/esm/components/common/for/index.js.map +0 -1
- package/dist/esm/components/common/index.js.map +0 -1
- package/dist/esm/components/common/show/index.js.map +0 -1
- package/dist/esm/components/common/slot/index.js.map +0 -1
- package/dist/esm/components/common/suspense-with-boundary/index.js.map +0 -1
- package/dist/esm/components/common/switch/index.js.map +0 -1
- package/dist/esm/components/common/teleport/index.js.map +0 -1
- package/dist/esm/components/ui/card/index.js.map +0 -1
- package/dist/esm/components/ui/carousel/index.js.map +0 -1
- package/dist/esm/components/ui/drag-scroll/index.js.map +0 -1
- package/dist/esm/components/ui/drop-zone/index.js.map +0 -1
- package/dist/esm/components/ui/form/index.js.map +0 -1
- package/dist/esm/components/ui/index.js.map +0 -1
- package/dist/esm/drop-zone-parts-CvseSoXA.d.ts +0 -186
- package/dist/esm/error-boundary-BD0X61Sg.d.ts +0 -28
- package/dist/esm/lib/utils/index.js.map +0 -1
- package/dist/esm/types-mdfDDNrr.d.ts +0 -25
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
|
+
import { getSlotMap, withSlotNameAndSymbol } from "./utils-D4YNWj2X.js";
|
|
3
|
+
import { ErrorBoundary, useErrorBoundaryContext } from "./error-boundary-B3ycUZ1t.js";
|
|
4
|
+
import { SlotRoot } from "./slot-RXTKo4L7.js";
|
|
5
|
+
import { Fragment, Suspense, use, useMemo } from "react";
|
|
6
|
+
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
7
|
+
import { createCustomContext } from "@zayne-labs/toolkit-react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/components/common/await/await-context.ts
|
|
11
|
+
const [AwaitContextProvider, useAwaitContextImpl] = createCustomContext({
|
|
12
|
+
hookName: "useAwaitContext",
|
|
13
|
+
name: "AwaitContext",
|
|
14
|
+
providerName: "AwaitInner"
|
|
15
|
+
});
|
|
16
|
+
const useAwaitContext = () => useAwaitContextImpl();
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/common/await/await.tsx
|
|
20
|
+
function AwaitRoot(props) {
|
|
21
|
+
const { children, errorFallback, fallback, wrapperVariant = "all",...restOfProps } = props;
|
|
22
|
+
const withErrorBoundary = wrapperVariant === "all" || wrapperVariant === "only-errorBoundary";
|
|
23
|
+
const withSuspense = wrapperVariant === "all" || wrapperVariant === "only-suspense";
|
|
24
|
+
const WithErrorBoundary = withErrorBoundary ? ErrorBoundary : Fragment;
|
|
25
|
+
const WithSuspense = withSuspense ? Suspense : Fragment;
|
|
26
|
+
const slots = !isFunction(children) ? getSlotMap(children) : { default: children };
|
|
27
|
+
const selectedPendingFallback = slots.pending ?? fallback;
|
|
28
|
+
const selectedErrorFallback = slots.error ?? errorFallback;
|
|
29
|
+
return /* @__PURE__ */ jsx(WithErrorBoundary, {
|
|
30
|
+
...Boolean(selectedErrorFallback) && { fallback: selectedErrorFallback },
|
|
31
|
+
children: /* @__PURE__ */ jsx(WithSuspense, {
|
|
32
|
+
...Boolean(selectedPendingFallback) && { fallback: selectedPendingFallback },
|
|
33
|
+
children: /* @__PURE__ */ jsx(AwaitRootInner, {
|
|
34
|
+
...restOfProps,
|
|
35
|
+
children: slots.default
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function AwaitRootInner(props) {
|
|
41
|
+
const { asChild, children, promise } = props;
|
|
42
|
+
const result = use(promise);
|
|
43
|
+
const resolvedChildren = isFunction(children) ? children(result) : children;
|
|
44
|
+
const Component$1 = asChild ? SlotRoot : Fragment;
|
|
45
|
+
const contextValue = useMemo(() => ({
|
|
46
|
+
promise,
|
|
47
|
+
result
|
|
48
|
+
}), [promise, result]);
|
|
49
|
+
return /* @__PURE__ */ jsx(AwaitContextProvider, {
|
|
50
|
+
value: contextValue,
|
|
51
|
+
children: /* @__PURE__ */ jsx(Component$1, {
|
|
52
|
+
...asChild && contextValue,
|
|
53
|
+
children: resolvedChildren
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function AwaitSuccess(props) {
|
|
58
|
+
if (isFunction(props.children)) {
|
|
59
|
+
const { result } = useAwaitContext();
|
|
60
|
+
return props.children(result);
|
|
61
|
+
}
|
|
62
|
+
return props.children;
|
|
63
|
+
}
|
|
64
|
+
Object.assign(AwaitSuccess, withSlotNameAndSymbol("default"));
|
|
65
|
+
const AwaitPending = withSlotNameAndSymbol("pending");
|
|
66
|
+
const AwaitError = withSlotNameAndSymbol("error", (props) => {
|
|
67
|
+
const { asChild, children } = props;
|
|
68
|
+
const errorBoundaryContext = useErrorBoundaryContext();
|
|
69
|
+
const Component$1 = asChild ? SlotRoot : Fragment;
|
|
70
|
+
const resolvedChildren = isFunction(children) ? children(errorBoundaryContext) : children;
|
|
71
|
+
return /* @__PURE__ */ jsx(Component$1, {
|
|
72
|
+
...asChild && errorBoundaryContext,
|
|
73
|
+
children: resolvedChildren
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/common/await/await-parts.ts
|
|
79
|
+
var await_parts_exports = {};
|
|
80
|
+
__export(await_parts_exports, {
|
|
81
|
+
Error: () => AwaitError,
|
|
82
|
+
Pending: () => AwaitPending,
|
|
83
|
+
Root: () => AwaitRoot,
|
|
84
|
+
Success: () => AwaitSuccess
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext };
|
|
89
|
+
//# sourceMappingURL=await-Fe4LFRKd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"await-Fe4LFRKd.js","names":["props: AwaitRootProps<TValue>","ReactFragment","props: AwaitRootInnerProps<TValue>","Component","props: Pick<AwaitSuccessProps<TValue>, \"children\">"],"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\nexport const [AwaitContextProvider, useAwaitContextImpl] = createCustomContext<AwaitContextType>({\n\thookName: \"useAwaitContext\",\n\tname: \"AwaitContext\",\n\tproviderName: \"AwaitInner\",\n});\n\nexport const useAwaitContext = <TValue>() => useAwaitContextImpl() as AwaitContextType<TValue>;\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { type GetSlotComponentProps, getSlotMap, withSlotNameAndSymbol } from \"@/lib/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\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\twrapperVariant?: \"all\" | \"none\" | \"only-errorBoundary\" | \"only-suspense\";\n};\n\nexport function AwaitRoot<TValue>(props: AwaitRootProps<TValue>) {\n\tconst { children, errorFallback, fallback, wrapperVariant = \"all\", ...restOfProps } = props;\n\n\tconst withErrorBoundary = wrapperVariant === \"all\" || wrapperVariant === \"only-errorBoundary\";\n\tconst withSuspense = wrapperVariant === \"all\" || wrapperVariant === \"only-suspense\";\n\n\tconst WithErrorBoundary = withErrorBoundary ? ErrorBoundary : ReactFragment;\n\tconst WithSuspense = withSuspense ? Suspense : ReactFragment;\n\n\tconst slots = !isFunction(children)\n\t\t? getSlotMap<SlotComponentProps>(children)\n\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\tif (isFunction(props.children)) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks -- This hook only uses `use` under the hood so this is safe\n\t\tconst { result } = useAwaitContext<TValue>();\n\n\t\treturn props.children(result);\n\t}\n\n\treturn props.children;\n}\n\nObject.assign(AwaitSuccess, withSlotNameAndSymbol<AwaitSuccessProps>(\"default\"));\n\ntype AwaitPendingProps = GetSlotComponentProps<\"pending\", React.SuspenseProps[\"fallback\"]>;\n\nexport const AwaitPending = withSlotNameAndSymbol<AwaitPendingProps>(\"pending\");\n\ntype AwaitErrorProps = GetSlotComponentProps<\"error\", ErrorBoundaryProps[\"fallback\"]>;\n\nexport const AwaitError = withSlotNameAndSymbol<AwaitErrorProps, { asChild?: boolean }>(\n\t\"error\",\n\t(props) => {\n\t\tconst { asChild, children } = props;\n\n\t\tconst errorBoundaryContext = useErrorBoundaryContext();\n\n\t\tconst Component = asChild ? Slot.Root : ReactFragment;\n\n\t\tconst resolvedChildren = isFunction(children) ? children(errorBoundaryContext) : children;\n\n\t\treturn <Component {...(asChild && errorBoundaryContext)}>{resolvedChildren}</Component>;\n\t}\n);\n","export {\n\tAwaitRoot as Root,\n\tAw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AE;EAE/B,MAAM,EAAE,QAAQ,GAAG,iBAAyB;AAE5C,SAAO,MAAM,SAAS,OAAO;CAC7B;AAED,QAAO,MAAM;AACb;AAED,OAAO,OAAO,cAAc,sBAAyC,UAAU,CAAC;AAIhF,MAAa,eAAe,sBAAyC,UAAU;AAI/E,MAAa,aAAa,sBACzB,SACA,CAAC,UAAU;CACV,MAAM,EAAE,SAAS,UAAU,GAAG;CAE9B,MAAM,uBAAuB,yBAAyB;CAEtD,MAAMD,cAAY,qBAAsBF;CAExC,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,qBAAqB,GAAG;AAEjF,wBAAO,IAACE;EAAU,GAAK,WAAW;YAAwB;GAA6B;AACvF,EACD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
|
+
import { SlotRoot } from "./slot-RXTKo4L7.js";
|
|
3
|
+
import { cnMerge } from "./cn-_FbtIrlZ.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/ui/card/card.tsx
|
|
8
|
+
function CardRoot(props) {
|
|
9
|
+
const { as: Element = "article",...restOfProps } = props;
|
|
10
|
+
return /* @__PURE__ */ jsx(Element, { ...restOfProps });
|
|
11
|
+
}
|
|
12
|
+
function CardHeader(props) {
|
|
13
|
+
const { as: Element = "header",...restOfProps } = props;
|
|
14
|
+
return /* @__PURE__ */ jsx(Element, { ...restOfProps });
|
|
15
|
+
}
|
|
16
|
+
function CardTitle(props) {
|
|
17
|
+
const { as: Element = "h3", className,...restOfProps } = props;
|
|
18
|
+
return /* @__PURE__ */ jsx(Element, {
|
|
19
|
+
className: cnMerge("font-semibold", className),
|
|
20
|
+
...restOfProps
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function CardDescription(props) {
|
|
24
|
+
const { as: Element = "p", className,...restOfProps } = props;
|
|
25
|
+
return /* @__PURE__ */ jsx(Element, {
|
|
26
|
+
className: cnMerge("text-shadcn-muted-foreground text-sm", className),
|
|
27
|
+
...restOfProps
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function CardContent(props) {
|
|
31
|
+
const { as: Element = "div",...restOfProps } = props;
|
|
32
|
+
return /* @__PURE__ */ jsx(Element, { ...restOfProps });
|
|
33
|
+
}
|
|
34
|
+
function CardFooter(props) {
|
|
35
|
+
const { as: Element = "footer", asChild,...restOfProps } = props;
|
|
36
|
+
const Component$1 = asChild ? SlotRoot : Element;
|
|
37
|
+
return /* @__PURE__ */ jsx(Component$1, { ...restOfProps });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/ui/card/card-parts.ts
|
|
42
|
+
var card_parts_exports = {};
|
|
43
|
+
__export(card_parts_exports, {
|
|
44
|
+
Content: () => CardContent,
|
|
45
|
+
Description: () => CardDescription,
|
|
46
|
+
Footer: () => CardFooter,
|
|
47
|
+
Header: () => CardHeader,
|
|
48
|
+
Root: () => CardRoot,
|
|
49
|
+
Title: () => CardTitle
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports };
|
|
54
|
+
//# sourceMappingURL=card-DRjs-vtv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-DRjs-vtv.js","names":["props: PolymorphicProps<TElement>","props: PolymorphicProps<TElement, { asChild?: boolean }>","Component"],"sources":["../../src/components/ui/card/card.tsx","../../src/components/ui/card/card-parts.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn <Element className={cnMerge(\"font-semibold\", className)} {...restOfProps} />;\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 className={cnMerge(\"text-shadcn-muted-foreground text-sm\", className)} {...restOfProps} />\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...restOfProps} />;\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"],"mappings":";;;;;;;AAMA,SAAgB,SACfA,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAW,GAAG,aAAa,GAAG;AAEpD,wBAAO,IAAC,WAAQ,GAAI,cAAe;AACnC;AAED,SAAgB,WACfA,OACC;CACD,MAAM,EAAE,IAAI,UAAU,SAAU,GAAG,aAAa,GAAG;AAEnD,wBAAO,IAAC,WAAQ,GAAI,cAAe;AACnC;AAED,SAAgB,UAAqDA,OAAmC;CACvG,MAAM,EAAE,IAAI,UAAU,MAAM,UAAW,GAAG,aAAa,GAAG;AAE1D,wBAAO,IAAC;EAAQ,WAAW,QAAQ,iBAAiB,UAAU;EAAE,GAAI;GAAe;AACnF;AAED,SAAgB,gBACfA,OACC;CACD,MAAM,EAAE,IAAI,UAAU,KAAK,UAAW,GAAG,aAAa,GAAG;AAEzD,wBACC,IAAC;EAAQ,WAAW,QAAQ,wCAAwC,UAAU;EAAE,GAAI;GAAe;AAEpG;AAED,SAAgB,YACfA,OACC;CACD,MAAM,EAAE,IAAI,UAAU,MAAO,GAAG,aAAa,GAAG;AAEhD,wBAAO,IAAC,WAAQ,GAAI,cAAe;AACnC;AAED,SAAgB,WACfC,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,QAAS,GAAG,aAAa,GAAG;CAE5D,MAAMC,cAAY,qBAAsB;AAExC,wBAAO,IAACA,eAAU,GAAI,cAAe;AACrC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
|
+
import { getElementList } from "./for-aTw1TgJo.js";
|
|
3
|
+
import { ShowFallback, ShowRoot } from "./show-BgYrfIxJ.js";
|
|
4
|
+
import { cnMerge } from "./cn-_FbtIrlZ.js";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { useAnimationInterval, useCallbackRef, useConstant } from "@zayne-labs/toolkit-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
|
|
9
|
+
import { create } from "zustand";
|
|
10
|
+
|
|
11
|
+
//#region src/components/ui/carousel/carousel-store-context.tsx
|
|
12
|
+
const [Provider, useCarouselStoreContext] = createZustandContext({
|
|
13
|
+
hookName: "useCarouselStore",
|
|
14
|
+
name: "CarouselStoreContext",
|
|
15
|
+
providerName: "CarouselContextProvider"
|
|
16
|
+
});
|
|
17
|
+
const createCarouselStore = (storeValues) => {
|
|
18
|
+
const { images, onSlideBtnClick } = storeValues;
|
|
19
|
+
const useInitCarouselStore = create()((set, get) => ({
|
|
20
|
+
currentSlide: 0,
|
|
21
|
+
images,
|
|
22
|
+
maxSlide: images.length - 1,
|
|
23
|
+
actions: {
|
|
24
|
+
goToNextSlide: () => {
|
|
25
|
+
const { currentSlide, maxSlide } = get();
|
|
26
|
+
const { goToSlide } = get().actions;
|
|
27
|
+
if (currentSlide === maxSlide) {
|
|
28
|
+
goToSlide(0);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
goToSlide(currentSlide + 1);
|
|
32
|
+
},
|
|
33
|
+
goToPreviousSlide: () => {
|
|
34
|
+
const { currentSlide, maxSlide } = get();
|
|
35
|
+
const { goToSlide } = get().actions;
|
|
36
|
+
if (currentSlide === 0) {
|
|
37
|
+
goToSlide(maxSlide);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
goToSlide(currentSlide - 1);
|
|
41
|
+
},
|
|
42
|
+
goToSlide: (newValue) => {
|
|
43
|
+
onSlideBtnClick?.();
|
|
44
|
+
set({ currentSlide: newValue });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
48
|
+
return useInitCarouselStore;
|
|
49
|
+
};
|
|
50
|
+
const useCarousel = (props) => {
|
|
51
|
+
const { images, onSlideBtnClick } = props;
|
|
52
|
+
const useInitCarouselStore = useConstant(() => createCarouselStore({
|
|
53
|
+
images,
|
|
54
|
+
onSlideBtnClick
|
|
55
|
+
}));
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
useInitCarouselStore.setState({ images });
|
|
58
|
+
}, [images]);
|
|
59
|
+
return useInitCarouselStore;
|
|
60
|
+
};
|
|
61
|
+
function CarouselContextProvider(props) {
|
|
62
|
+
const { children, images, onSlideBtnClick } = props;
|
|
63
|
+
const useInitCarouselStore = useCarousel({
|
|
64
|
+
images,
|
|
65
|
+
onSlideBtnClick
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
68
|
+
value: useInitCarouselStore,
|
|
69
|
+
children
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/components/ui/carousel/icons.tsx
|
|
75
|
+
const ChevronLeftIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
width: "1em",
|
|
78
|
+
height: "1em",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
...props,
|
|
81
|
+
children: /* @__PURE__ */ jsxs("g", {
|
|
82
|
+
fill: "none",
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
strokeLinecap: "round",
|
|
85
|
+
strokeLinejoin: "round",
|
|
86
|
+
strokeWidth: "2",
|
|
87
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
88
|
+
cx: "12",
|
|
89
|
+
cy: "12",
|
|
90
|
+
r: "10"
|
|
91
|
+
}), /* @__PURE__ */ jsx("path", { d: "m14 16l-4-4l4-4" })]
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/components/ui/carousel/useCarouselOptions.ts
|
|
97
|
+
const useCarouselOptions = (options = {}) => {
|
|
98
|
+
const { autoSlideInterval = 5e3, hasAutoSlide = false, shouldPauseOnHover = false } = options;
|
|
99
|
+
const { goToNextSlide } = useCarouselStoreContext((state) => state.actions);
|
|
100
|
+
const [isPaused, setIsPaused] = useState(false);
|
|
101
|
+
const shouldAutoSlide = hasAutoSlide && !isPaused;
|
|
102
|
+
useAnimationInterval({
|
|
103
|
+
intervalDuration: shouldAutoSlide ? autoSlideInterval : null,
|
|
104
|
+
onAnimation: goToNextSlide
|
|
105
|
+
});
|
|
106
|
+
const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
|
|
107
|
+
const resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));
|
|
108
|
+
return {
|
|
109
|
+
pauseAutoSlide,
|
|
110
|
+
resumeAutoSlide
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/components/ui/carousel/carousel.tsx
|
|
116
|
+
function CarouselContent(props) {
|
|
117
|
+
const { as: HtmlElement = "article", autoSlideInterval, children, classNames, hasAutoSlide, shouldPauseOnHover } = props;
|
|
118
|
+
const { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({
|
|
119
|
+
autoSlideInterval,
|
|
120
|
+
hasAutoSlide,
|
|
121
|
+
shouldPauseOnHover
|
|
122
|
+
});
|
|
123
|
+
return /* @__PURE__ */ jsx(HtmlElement, {
|
|
124
|
+
"data-id": "Carousel",
|
|
125
|
+
className: cnMerge("relative select-none", classNames?.base),
|
|
126
|
+
onMouseEnter: pauseAutoSlide,
|
|
127
|
+
onMouseLeave: resumeAutoSlide,
|
|
128
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
129
|
+
"data-id": "Scroll Container",
|
|
130
|
+
className: cnMerge("flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", classNames?.scrollContainer),
|
|
131
|
+
children
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function CarouselButton(props) {
|
|
136
|
+
const { classNames, icon, variant } = props;
|
|
137
|
+
const { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);
|
|
138
|
+
return /* @__PURE__ */ jsx("button", {
|
|
139
|
+
type: "button",
|
|
140
|
+
className: cnMerge("z-30 flex h-full w-fit items-center", variant === "prev" ? "justify-start" : "justify-end", classNames?.base),
|
|
141
|
+
onClick: variant === "prev" ? goToPreviousSlide : goToNextSlide,
|
|
142
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: cnMerge("transition-transform active:scale-[1.06]", classNames?.iconContainer),
|
|
144
|
+
children: icon ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cnMerge(variant === "next" && "rotate-180", classNames?.defaultIcon) })
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function CarouselControls(props) {
|
|
149
|
+
const { classNames, icon } = props;
|
|
150
|
+
return /* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: cnMerge("absolute inset-0 flex justify-between", classNames?.base),
|
|
152
|
+
children: /* @__PURE__ */ jsxs(ShowRoot, {
|
|
153
|
+
when: icon?.iconType,
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsx(CarouselButton, {
|
|
156
|
+
variant: "prev",
|
|
157
|
+
classNames: {
|
|
158
|
+
defaultIcon: classNames?.defaultIcon,
|
|
159
|
+
iconContainer: cnMerge(icon?.iconType === "nextIcon" && "rotate-180", classNames?.iconContainer)
|
|
160
|
+
},
|
|
161
|
+
icon: icon?.icon
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx(CarouselButton, {
|
|
164
|
+
variant: "next",
|
|
165
|
+
classNames: {
|
|
166
|
+
defaultIcon: classNames?.defaultIcon,
|
|
167
|
+
iconContainer: cnMerge(icon?.iconType === "prevIcon" && "rotate-180", classNames?.iconContainer)
|
|
168
|
+
},
|
|
169
|
+
icon: icon?.icon
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsxs(ShowFallback, { children: [/* @__PURE__ */ jsx(CarouselButton, {
|
|
172
|
+
variant: "prev",
|
|
173
|
+
classNames: {
|
|
174
|
+
defaultIcon: classNames?.defaultIcon,
|
|
175
|
+
iconContainer: classNames?.iconContainer
|
|
176
|
+
},
|
|
177
|
+
icon: icon?.prev
|
|
178
|
+
}), /* @__PURE__ */ jsx(CarouselButton, {
|
|
179
|
+
variant: "next",
|
|
180
|
+
classNames: {
|
|
181
|
+
defaultIcon: classNames?.defaultIcon,
|
|
182
|
+
iconContainer: classNames?.iconContainer
|
|
183
|
+
},
|
|
184
|
+
icon: icon?.next
|
|
185
|
+
})] })
|
|
186
|
+
]
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function CarouselItemGroup(props) {
|
|
191
|
+
const { children, className, each, render } = props;
|
|
192
|
+
const [ItemList] = getElementList("base");
|
|
193
|
+
const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
|
|
194
|
+
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
195
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
196
|
+
"data-id": "Carousel Image Wrapper",
|
|
197
|
+
className: cnMerge(`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]
|
|
198
|
+
[transition:transform_800ms_ease]`, className),
|
|
199
|
+
style: { "--translate-distance": `-${currentSlide * 100}%` },
|
|
200
|
+
children: typeof render === "function" ? /* @__PURE__ */ jsx(ItemList, {
|
|
201
|
+
each: images,
|
|
202
|
+
render
|
|
203
|
+
}) : /* @__PURE__ */ jsx(ItemList, {
|
|
204
|
+
each: images,
|
|
205
|
+
children
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function CarouselItem({ children, className,...restOfProps }) {
|
|
210
|
+
return /* @__PURE__ */ jsx("li", {
|
|
211
|
+
className: cnMerge("flex w-full shrink-0 snap-center justify-center", className),
|
|
212
|
+
...restOfProps,
|
|
213
|
+
children
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function CarouselCaption(props) {
|
|
217
|
+
const { as: HtmlElement = "div", children, className } = props;
|
|
218
|
+
return /* @__PURE__ */ jsx(HtmlElement, {
|
|
219
|
+
"data-id": "Carousel Caption",
|
|
220
|
+
className: cnMerge("absolute z-10", className),
|
|
221
|
+
children
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function CarouselIndicatorGroup(props) {
|
|
225
|
+
const { children, className, each, render } = props;
|
|
226
|
+
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
227
|
+
const [IndicatorList] = getElementList("base");
|
|
228
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
229
|
+
"data-id": "Carousel Indicators",
|
|
230
|
+
className: cnMerge("absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]", className),
|
|
231
|
+
children: typeof render === "function" ? /* @__PURE__ */ jsx(IndicatorList, {
|
|
232
|
+
each: images,
|
|
233
|
+
render
|
|
234
|
+
}) : /* @__PURE__ */ jsx(IndicatorList, {
|
|
235
|
+
each: images,
|
|
236
|
+
children
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function CarouselIndicator(props) {
|
|
241
|
+
const { classNames, currentIndex } = props;
|
|
242
|
+
const { actions: { goToSlide }, currentSlide } = useCarouselStoreContext((state) => state);
|
|
243
|
+
return /* @__PURE__ */ jsx("li", {
|
|
244
|
+
className: cnMerge("inline-flex", classNames?.base),
|
|
245
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
246
|
+
type: "button",
|
|
247
|
+
onClick: () => goToSlide(currentIndex),
|
|
248
|
+
className: cnMerge("size-[6px] rounded-[50%]", classNames?.base, currentIndex === currentSlide && ["w-[35px] rounded-[5px]", classNames?.isActive])
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/components/ui/carousel/carousel-parts.ts
|
|
255
|
+
var carousel_parts_exports = {};
|
|
256
|
+
__export(carousel_parts_exports, {
|
|
257
|
+
Button: () => CarouselButton,
|
|
258
|
+
Caption: () => CarouselCaption,
|
|
259
|
+
Content: () => CarouselContent,
|
|
260
|
+
Controls: () => CarouselControls,
|
|
261
|
+
Indicator: () => CarouselIndicator,
|
|
262
|
+
IndicatorGroup: () => CarouselIndicatorGroup,
|
|
263
|
+
Item: () => CarouselItem,
|
|
264
|
+
ItemGroup: () => CarouselItemGroup,
|
|
265
|
+
Root: () => CarouselContextProvider
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
//#endregion
|
|
269
|
+
export { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, carousel_parts_exports };
|
|
270
|
+
//# sourceMappingURL=carousel-Dznupnx8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-Dznupnx8.js","names":["storeValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">","props: Omit<CarouselProviderProps<TImages>, \"children\">","props: CarouselProviderProps<TImages>","props: React.SVGProps<SVGSVGElement>","options: CarouselOptions","props: PolymorphicProps<TElement, CarouselContentProps>","props: CarouselButtonsProps","props: CarouselControlProps","props: CarouselWrapperProps<TArrayItem>","props: PolymorphicProps<TElement, OtherCarouselProps>","props: CarouselIndicatorProps"],"sources":["../../src/components/ui/carousel/carousel-store-context.tsx","../../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 * as React from \"react\";\n\nimport { useConstant } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { create } from \"zustand\";\nimport type { CarouselProviderProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [Provider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselContextProvider\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst useInitCarouselStore = create<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 useInitCarouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(\n\tprops: Omit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));\n\n\t// == To set images again when a page is mounted, preventing stale images from previous page\n\tuseEffect(() => {\n\t\tuseInitCarouselStore.setState({ images });\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- useInitCarouselStore is stable\n\t}, [images]);\n\n\treturn useInitCarouselStore;\n};\n\n// == Provider Component\nfunction CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>) {\n\tconst { children, images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useCarousel({ images, onSlideBtnClick });\n\n\treturn <Provider value={useInitCarouselStore}>{children}</Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- It's fine\nexport { useCarouselStoreContext, CarouselContextProvider };\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 { useCarouselStoreContext } from \"./carousel-store-context\";\n\ntype CarouselOptions = {\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions = {}) => {\n\tconst { autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst { goToNextSlide } = useCarouselStoreContext((state) => state.actions);\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: 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 * as React from \"react\";\n\nimport { Show } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { CssWithCustomProperties, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselContentProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselWrapperProps,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselContent<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement, CarouselContentProps>\n) {\n\tconst {\n\t\tas: HtmlElement = \"article\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\t// FIXME - Prevent touch swipe on mobile using a cover element or allow swipe but it must update the state appropriately\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-id=\"Carousel\"\n\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-id=\"Scroll Container\"\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</HtmlElement>\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\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 className={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}>\n\t\t\t<Show.Root when={icon?.iconType}>\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\n\t\t\t\t<Show.Otherwise>\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.Otherwise>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst [ItemList] = getElementList(\"base\");\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-id=\"Carousel Image Wrapper\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]\n\t\t\t\t[transition:transform_800ms_ease]`,\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{typeof render === \"function\" ? (\n\t\t\t\t<ItemList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<ItemList each={images}>{children}</ItemList>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem({ children, className, ...restOfProps }: OtherCarouselProps) {\n\treturn (\n\t\t<li\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: PolymorphicProps<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement data-id=\"Carousel Caption\" className={cnMerge(\"absolute z-10\", className)}>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\tconst [IndicatorList] = getElementList(\"base\");\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Indicators\"\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{typeof render === \"function\" ? (\n\t\t\t\t<IndicatorList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<IndicatorList each={images}>{children}</IndicatorList>\n\t\t\t)}\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 className={cnMerge(\"inline-flex\", classNames?.base)}>\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 { CarouselContextProvider as Root } from \"./carousel-store-context\";\nexport {\n\tCarouselContent as Content,\n\tCarouselControls as Controls,\n\tCarouselButton as Button,\n\tCarouselItem as Item,\n\tCarouselItemGroup as ItemGroup,\n\tCarouselCaption as Caption,\n\tC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|
+
{"version":3,"file":"cn-_FbtIrlZ.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,UAAU,CAAC,GAAG,eAAiC,QAAQ,WAAW"}
|
|
File without changes
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type AwaitContextType<TValue = unknown> = {
|
|
9
|
-
promise: Promise<TValue>;
|
|
10
|
-
result: TValue;
|
|
11
|
-
};
|
|
12
|
-
declare const useAwaitContext: <TValue>() => AwaitContextType<TValue>;
|
|
13
|
-
|
|
14
|
-
export { useAwaitContext };
|
|
1
|
+
import "../../../getSlotMap-DA_uhXqU.js";
|
|
2
|
+
import "../../../index-DKfm0Dyj.js";
|
|
3
|
+
import "../../../index-BSJ30pGj.js";
|
|
4
|
+
import "../../../index-DmOz1yDZ.js";
|
|
5
|
+
import { AwaitError$1 as AwaitError, AwaitPending$1 as AwaitPending, AwaitRoot$1 as AwaitRoot, AwaitSuccess$1 as AwaitSuccess, await_parts_d_exports, useAwaitContext$1 as useAwaitContext } from "../../../index-C4ub0yqe.js";
|
|
6
|
+
export { await_parts_d_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import "../../../utils-D4YNWj2X.js";
|
|
5
|
+
import "../../../getSlot-BIcGgBwN.js";
|
|
6
|
+
import "../../../error-boundary-B3ycUZ1t.js";
|
|
7
|
+
import "../../../slot-RXTKo4L7.js";
|
|
8
|
+
import { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext } from "../../../await-Fe4LFRKd.js";
|
|
9
|
+
|
|
10
|
+
export { await_parts_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
type ErrorBoundaryContextType = {
|
|
6
|
-
error: unknown;
|
|
7
|
-
hasError: boolean;
|
|
8
|
-
resetErrorBoundary: (...args: unknown[]) => void;
|
|
9
|
-
};
|
|
10
|
-
declare const useErrorBoundaryContext: () => ErrorBoundaryContextType;
|
|
11
|
-
|
|
12
|
-
declare const useErrorBoundary: <TError extends Error>() => {
|
|
13
|
-
resetBoundary: () => void;
|
|
14
|
-
showBoundary: (error: TError) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { type ErrorBoundaryContextType, useErrorBoundary, useErrorBoundaryContext };
|
|
1
|
+
import { ErrorBoundary$1 as ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary$1 as useErrorBoundary, useErrorBoundaryContext$1 as useErrorBoundaryContext } from "../../../index-BSJ30pGj.js";
|
|
2
|
+
export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from "../../../error-boundary-B3ycUZ1t.js";
|
|
5
|
+
|
|
6
|
+
export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import 'react';
|
|
4
|
-
import '@zayne-labs/toolkit-react/utils';
|
|
5
|
-
import '@zayne-labs/toolkit-type-helpers';
|
|
6
|
-
|
|
7
|
-
type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
|
|
8
|
-
declare const getElementList: <TVariant extends "base" | "withWrapper" = "withWrapper">(variant?: TVariant) => GetElementListResult<TVariant>;
|
|
9
|
-
|
|
10
|
-
export { For, ForWithWrapper, getElementList };
|
|
1
|
+
import { For$1 as For, ForRenderProps, ForWithWrapper$1 as ForWithWrapper, getElementList$1 as getElementList } from "../../../index-BhpBx8dH.js";
|
|
2
|
+
export { For, ForRenderProps, ForWithWrapper, getElementList };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { For, ForWithWrapper, getElementList } from "../../../for-aTw1TgJo.js";
|
|
2
|
+
|
|
3
|
+
export { For, ForWithWrapper, getElementList };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import '@zayne-labs/toolkit-type-helpers';
|
|
13
|
-
import '@zayne-labs/toolkit-react/utils';
|
|
1
|
+
import "../../getSlotMap-DA_uhXqU.js";
|
|
2
|
+
import "../../index-DKfm0Dyj.js";
|
|
3
|
+
import { ErrorBoundary$1 as ErrorBoundary } from "../../index-BSJ30pGj.js";
|
|
4
|
+
import { SuspenseWithBoundary$1 as SuspenseWithBoundary } from "../../index-DmOz1yDZ.js";
|
|
5
|
+
import { await_parts_d_exports } from "../../index-C4ub0yqe.js";
|
|
6
|
+
import { For$1 as For, ForWithWrapper$1 as ForWithWrapper } from "../../index-BhpBx8dH.js";
|
|
7
|
+
import { show_parts_d_exports } from "../../index-C0XZoIZD.js";
|
|
8
|
+
import { slot_parts_d_exports } from "../../index-1UCPJf7B.js";
|
|
9
|
+
import { switch_parts_d_exports } from "../../index--1COprHP.js";
|
|
10
|
+
import { Teleport$1 as Teleport } from "../../index-DnaUCh8d.js";
|
|
11
|
+
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 };
|