@zayne-labs/ui-react 0.10.45 → 0.10.46
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/theme.css +4 -2
- package/dist/esm/{chunk-BL-4obUL.js → chunk-CpZCTQkd.js} +2 -2
- package/dist/esm/{client-gate-B3fRopBx.js → client-gate-CZczUIeY.js} +3 -3
- package/dist/esm/{client-gate-B3fRopBx.js.map → client-gate-CZczUIeY.js.map} +1 -1
- package/dist/esm/cn-Dnsqr-G7.js.map +1 -1
- package/dist/esm/common/await/index.d.ts +6 -6
- package/dist/esm/common/await/index.js +3 -3
- package/dist/esm/common/await/index.js.map +1 -1
- package/dist/esm/common/client-gate/index.d.ts +6 -6
- package/dist/esm/common/client-gate/index.js +1 -1
- package/dist/esm/common/error-boundary/index.d.ts +2 -2
- package/dist/esm/common/for/index.d.ts +4 -4
- package/dist/esm/common/presence/index.d.ts +4 -4
- package/dist/esm/common/presence/index.js +1 -1
- package/dist/esm/common/show/index.d.ts +4 -4
- package/dist/esm/common/show/index.js +1 -1
- package/dist/esm/common/slot/index.d.ts +4 -4
- package/dist/esm/common/slot/index.js +1 -1
- package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
- package/dist/esm/common/switch/index.d.ts +4 -4
- package/dist/esm/common/switch/index.js +2 -2
- package/dist/esm/common/teleport/index.d.ts +3 -3
- package/dist/esm/common/teleport/index.js +7 -2
- package/dist/esm/common/teleport/index.js.map +1 -1
- package/dist/esm/error-boundary-TM4xzQfq.js.map +1 -1
- package/dist/esm/{index-DzMX8Xce.d.ts → index-Bw26wyvy.d.ts} +4 -4
- package/dist/esm/{index-Dvt8y6Uu.d.ts → index-D3QKG4Tt.d.ts} +9 -9
- package/dist/esm/{presence-Ctp-Trws.js → presence-BTPyxGeW.js} +2 -2
- package/dist/esm/presence-BTPyxGeW.js.map +1 -0
- package/dist/esm/{show-7VInUu_D.js → show-1Md5CZML.js} +3 -3
- package/dist/esm/{show-7VInUu_D.js.map → show-1Md5CZML.js.map} +1 -1
- package/dist/esm/{slot-CURylbjq.js → slot-aKEvaEWn.js} +3 -3
- package/dist/esm/slot-aKEvaEWn.js.map +1 -0
- package/dist/esm/ui/card/index.d.ts +8 -8
- package/dist/esm/ui/card/index.js +3 -3
- package/dist/esm/ui/card/index.js.map +1 -1
- package/dist/esm/ui/carousel/index.d.ts +9 -9
- package/dist/esm/ui/carousel/index.js +3 -3
- package/dist/esm/ui/carousel/index.js.map +1 -1
- package/dist/esm/ui/drag-scroll/index.d.ts +98 -11
- package/dist/esm/ui/drag-scroll/index.js +242 -71
- package/dist/esm/ui/drag-scroll/index.js.map +1 -1
- package/dist/esm/ui/drop-zone/index.d.ts +71 -72
- package/dist/esm/ui/drop-zone/index.js +23 -15
- package/dist/esm/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/ui/form/index.d.ts +22 -23
- package/dist/esm/ui/form/index.js +31 -29
- package/dist/esm/ui/form/index.js.map +1 -1
- package/dist/style.css +9 -2
- package/package.json +13 -9
- package/dist/esm/presence-Ctp-Trws.js.map +0 -1
- package/dist/esm/slot-CURylbjq.js.map +0 -1
package/css/theme.css
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
@theme {
|
|
2
|
+
--color-zu-foreground: oklch(0.145 0 0);
|
|
2
3
|
--color-zu-accent: oklch(0.967 0.001 286.375);
|
|
3
|
-
--color-zu-
|
|
4
|
+
--color-zu-accent-foreground: oklch(0.205 0 0);
|
|
4
5
|
--color-zu-muted-foreground: oklch(0.556 0 0);
|
|
6
|
+
--color-zu-destructive: oklch(0.577 0.245 27.325);
|
|
5
7
|
--color-zu-primary: oklch(0.21 0.04 265.75);
|
|
6
8
|
--color-zu-primary-foreground: oklch(0.985 0 0);
|
|
7
9
|
--color-zu-ring: oklch(0.705 0.015 286.067);
|
|
8
|
-
--color-zu-foreground: oklch(0.145 0 0);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
:where(.dark, [data-theme="dark"]) {
|
|
12
13
|
--color-zu-foreground: oklch(0.985 0 0);
|
|
13
14
|
--color-zu-accent: oklch(0.274 0.006 286.033);
|
|
15
|
+
--color-zu-accent-foreground: oklch(0.985 0 0);
|
|
14
16
|
--color-zu-muted-foreground: oklch(0.708 0 0);
|
|
15
17
|
--color-zu-destructive: oklch(0.704 0.191 22.216);
|
|
16
18
|
--color-zu-primary: oklch(0.92 0.004 286.32);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var __exportAll = (all, symbols) => {
|
|
4
4
|
let target = {};
|
|
5
5
|
for (var name in all) {
|
|
6
6
|
__defProp(target, name, {
|
|
@@ -15,4 +15,4 @@ var __export = (all, symbols) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
export {
|
|
18
|
+
export { __exportAll as t };
|
|
@@ -22,10 +22,10 @@ import { useIsHydrated } from "@zayne-labs/toolkit-react";
|
|
|
22
22
|
function ClientGate(props) {
|
|
23
23
|
const { children, fallback } = props;
|
|
24
24
|
const isHydrated = useIsHydrated();
|
|
25
|
-
const
|
|
26
|
-
return isHydrated ?
|
|
25
|
+
const resolvedChildren = () => isFunction(children) ? children() : children;
|
|
26
|
+
return isHydrated ? resolvedChildren() : fallback;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
30
|
export { ClientGate as t };
|
|
31
|
-
//# sourceMappingURL=client-gate-
|
|
31
|
+
//# sourceMappingURL=client-gate-CZczUIeY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-gate-
|
|
1
|
+
{"version":3,"file":"client-gate-CZczUIeY.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\";\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 resolvedChildren = () => (isFunction(children) ? children() : children);\n\n\treturn isHydrated ? resolvedChildren() : fallback;\n}\n\nexport { ClientGate };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,WAAW,OAAwB;CAC3C,MAAM,EAAE,UAAU,aAAa;CAE/B,MAAM,aAAa,eAAe;CAElC,MAAM,yBAA0B,WAAW,SAAS,GAAG,UAAU,GAAG;AAEpE,QAAO,aAAa,kBAAkB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn-Dnsqr-G7.js","names":[],"sources":["../../src/lib/utils/cn.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"cn-Dnsqr-G7.js","names":[],"sources":["../../src/lib/utils/cn.ts"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\n\nexport const cnMerge: typeof twMerge = (...classNames) => twMerge(classNames);\n"],"mappings":";;;AAEA,MAAa,WAA2B,GAAG,eAAe,QAAQ,WAAW"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ErrorBoundaryProps } from "../../index-
|
|
2
|
-
import { n as SuspenseWithBoundaryProps } from "../../index-
|
|
1
|
+
import { a as ErrorBoundaryProps } from "../../index-D3QKG4Tt.js";
|
|
2
|
+
import { n as SuspenseWithBoundaryProps } from "../../index-Bw26wyvy.js";
|
|
3
3
|
import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
4
|
+
import * as react38 from "react";
|
|
5
|
+
import * as react_jsx_runtime41 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/components/common/await/await.d.ts
|
|
8
8
|
type RenderPropFn<TValue> = (result: TValue) => React.ReactNode;
|
|
@@ -14,9 +14,9 @@ type AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, "errorFallback" |
|
|
|
14
14
|
withErrorBoundary?: boolean;
|
|
15
15
|
withSuspense?: boolean;
|
|
16
16
|
};
|
|
17
|
-
declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>):
|
|
17
|
+
declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime41.JSX.Element;
|
|
18
18
|
type AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<"default", ChildrenType<TValue>>;
|
|
19
|
-
declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">):
|
|
19
|
+
declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): react38.ReactNode;
|
|
20
20
|
type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["fallback"]>;
|
|
21
21
|
declare const AwaitError: {
|
|
22
22
|
(props: Pick<AwaitErrorProps, "children"> & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { t as
|
|
3
|
+
import { t as __exportAll } from "../../chunk-CpZCTQkd.js";
|
|
4
4
|
import { n as ErrorBoundary, r as useErrorBoundaryContext } from "../../error-boundary-TM4xzQfq.js";
|
|
5
|
-
import { n as SlotRoot } from "../../slot-
|
|
5
|
+
import { n as SlotRoot } from "../../slot-aKEvaEWn.js";
|
|
6
6
|
import { getSlotMap, withSlotNameAndSymbol } from "@zayne-labs/toolkit-react/utils";
|
|
7
7
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
8
8
|
import { Fragment, Suspense, use, useMemo } from "react";
|
|
@@ -77,7 +77,7 @@ const AwaitPending = withSlotNameAndSymbol("pending");
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/components/common/await/await-parts.ts
|
|
80
|
-
var await_parts_exports = /* @__PURE__ */
|
|
80
|
+
var await_parts_exports = /* @__PURE__ */ __exportAll({
|
|
81
81
|
Error: () => AwaitError,
|
|
82
82
|
Pending: () => AwaitPending,
|
|
83
83
|
Root: () => AwaitRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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\
|
|
1
|
+
{"version":3,"file":"index.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\tgetSlotMap,\n\twithSlotNameAndSymbol,\n\ttype GetSlotComponentProps,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, Suspense, use, useMemo } from \"react\";\nimport { ErrorBoundary, useErrorBoundaryContext, type ErrorBoundaryProps } 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\t// eslint-disable-next-line react-hooks/rule-suppression -- Ignore\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 children(result);\n\t}\n\n\treturn children;\n}\n\nObject.assign(AwaitSuccess, withSlotNameAndSymbol<AwaitSuccessProps>(\"default\"));\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\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;;;;ACa3D,SAAgB,UAAkB,OAA+B;CAChE,MAAM,EACL,UACA,eACA,UACA,oBAAoB,MACpB,eAAe,MACf,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,WAAW,SAAS,EAAE;EAGzB,MAAM,EAAE,WAAW,iBAAyB;AAE5C,SAAO,SAAS,OAAO;;AAGxB,QAAO;;AAGR,OAAO,OAAO,cAAc,sBAAyC,UAAU,CAAC;AAIhF,MAAa,aAAa,sBACzB,UACC,UAAU;CACV,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;EAExF;AAID,MAAa,eAAe,sBAAyC,UAAU"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react37 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/common/client-gate/client-gate.d.ts
|
|
4
4
|
type ClientGateProps = {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
10
|
children: React.ReactNode | (() => React.ReactNode);
|
|
11
11
|
fallback?: React.ReactNode;
|
|
12
12
|
};
|
|
@@ -27,7 +27,7 @@ type ClientGateProps = {
|
|
|
27
27
|
* );
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
declare function ClientGate(props: ClientGateProps):
|
|
30
|
+
declare function ClientGate(props: ClientGateProps): react37.ReactNode;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { ClientGate };
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ErrorBoundaryProps, i as ErrorBoundary, n as ErrorBoundaryContextType, o as
|
|
2
|
-
export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps,
|
|
1
|
+
import { a as ErrorBoundaryProps, i as ErrorBoundary, n as ErrorBoundaryContextType, o as ErrorFallbackProps, r as useErrorBoundaryContext, t as useErrorBoundary } from "../../index-D3QKG4Tt.js";
|
|
2
|
+
export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, ErrorFallbackProps, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DiscriminatedRenderItemProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
2
|
import { Prettify } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
3
|
+
import * as react25 from "react";
|
|
4
|
+
import * as react_jsx_runtime40 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/common/for/for.d.ts
|
|
7
7
|
type ArrayOrNumber = number | readonly unknown[];
|
|
@@ -12,10 +12,10 @@ type ForProps<TArray extends ArrayOrNumber> = Prettify<{
|
|
|
12
12
|
each: TArray;
|
|
13
13
|
fallback?: React.ReactNode;
|
|
14
14
|
} & ForRenderProps<TArray>>;
|
|
15
|
-
declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean |
|
|
15
|
+
declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean | react25.ReactElement<unknown, string | react25.JSXElementConstructor<any>> | Iterable<react25.ReactNode> | Promise<string | number | bigint | boolean | react25.ReactPortal | react25.ReactElement<unknown, string | react25.JSXElementConstructor<any>> | Iterable<react25.ReactNode> | null | undefined> | null;
|
|
16
16
|
declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, ForProps<TArray>> & {
|
|
17
17
|
displayFallBackWhenEmpty?: boolean;
|
|
18
|
-
}): string | number | bigint | boolean |
|
|
18
|
+
}): string | number | bigint | boolean | react_jsx_runtime40.JSX.Element | Iterable<react25.ReactNode> | Promise<string | number | bigint | boolean | react25.ReactPortal | react25.ReactElement<unknown, string | react25.JSXElementConstructor<any>> | Iterable<react25.ReactNode> | null | undefined> | null;
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/components/common/for/getElementList.d.ts
|
|
21
21
|
type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { InferProps } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime37 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/common/presence/use-presence.d.ts
|
|
5
5
|
type UsePresenceOptions = {
|
|
6
6
|
onExitComplete?: () => void;
|
|
7
7
|
present: boolean;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* @default "animation"
|
|
10
|
+
*/
|
|
11
11
|
variant?: "animation" | "transition";
|
|
12
12
|
};
|
|
13
13
|
type UsePresenceResult = {
|
|
@@ -30,7 +30,7 @@ type PresenceProps = UsePresenceOptions & {
|
|
|
30
30
|
className?: string;
|
|
31
31
|
forceMount?: boolean;
|
|
32
32
|
};
|
|
33
|
-
declare function Presence(props: PresenceProps):
|
|
33
|
+
declare function Presence(props: PresenceProps): react_jsx_runtime37.JSX.Element | null;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { Presence };
|
|
36
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react14 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/common/show/show.d.ts
|
|
4
4
|
type ShowProps<TWhen> = {
|
|
@@ -12,15 +12,15 @@ type ShowProps<TWhen> = {
|
|
|
12
12
|
fallback?: React.ReactNode;
|
|
13
13
|
when: false | TWhen | null | undefined;
|
|
14
14
|
};
|
|
15
|
-
declare function ShowRoot<TWhen>(props: ShowProps<TWhen>): string | number | bigint | boolean |
|
|
15
|
+
declare function ShowRoot<TWhen>(props: ShowProps<TWhen>): string | number | bigint | boolean | react14.ReactElement<unknown, string | react14.JSXElementConstructor<any>> | Iterable<react14.ReactNode> | Promise<string | number | bigint | boolean | react14.ReactPortal | react14.ReactElement<unknown, string | react14.JSXElementConstructor<any>> | Iterable<react14.ReactNode> | null | undefined> | null;
|
|
16
16
|
type ShowContentProps<TWhen> = Pick<ShowProps<TWhen>, "children" | "when">;
|
|
17
|
-
declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>):
|
|
17
|
+
declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): react14.ReactNode;
|
|
18
18
|
declare namespace ShowContent {
|
|
19
19
|
var slotSymbol: symbol;
|
|
20
20
|
}
|
|
21
21
|
declare function ShowFallback(props: {
|
|
22
22
|
children: React.ReactNode;
|
|
23
|
-
}):
|
|
23
|
+
}): react14.ReactNode;
|
|
24
24
|
declare namespace ShowFallback {
|
|
25
25
|
var slotSymbol: symbol;
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { i as ShowRoot, n as ShowContent, r as ShowFallback, t as show_parts_exports } from "../../show-
|
|
3
|
+
import { i as ShowRoot, n as ShowContent, r as ShowFallback, t as show_parts_exports } from "../../show-1Md5CZML.js";
|
|
4
4
|
|
|
5
5
|
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { InferProps } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as react23 from "react";
|
|
3
|
+
import * as react_jsx_runtime38 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/common/slot/slot.d.ts
|
|
6
6
|
type SlotProps = InferProps<HTMLElement> & {
|
|
7
7
|
ref?: React.Ref<HTMLElement>;
|
|
8
8
|
};
|
|
9
|
-
declare function SlotRoot(props: SlotProps):
|
|
9
|
+
declare function SlotRoot(props: SlotProps): react_jsx_runtime38.JSX.Element | null;
|
|
10
10
|
declare function SlotSlottable({
|
|
11
11
|
children
|
|
12
|
-
}: Pick<SlotProps, "children">):
|
|
12
|
+
}: Pick<SlotProps, "children">): react23.ReactNode;
|
|
13
13
|
declare namespace slot_parts_d_exports {
|
|
14
14
|
export { SlotRoot as Root, SlotSlottable as Slottable };
|
|
15
15
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../index-
|
|
2
|
-
import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-
|
|
1
|
+
import "../../index-D3QKG4Tt.js";
|
|
2
|
+
import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-Bw26wyvy.js";
|
|
3
3
|
export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react11 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/common/switch/switch.d.ts
|
|
4
4
|
type ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;
|
|
@@ -6,17 +6,17 @@ type SwitchProps = {
|
|
|
6
6
|
children: ValidSwitchComponentType | ValidSwitchComponentType[];
|
|
7
7
|
value?: unknown;
|
|
8
8
|
};
|
|
9
|
-
declare function SwitchRoot(props: SwitchProps):
|
|
9
|
+
declare function SwitchRoot(props: SwitchProps): react11.ReactNode;
|
|
10
10
|
type SwitchMatchProps<TWhen> = {
|
|
11
11
|
children: React.ReactNode | ((value: TWhen) => React.ReactNode);
|
|
12
12
|
when: false | TWhen | null | undefined;
|
|
13
13
|
};
|
|
14
|
-
declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>):
|
|
14
|
+
declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>): react11.ReactNode;
|
|
15
15
|
declare function SwitchDefault({
|
|
16
16
|
children
|
|
17
17
|
}: {
|
|
18
18
|
children: React.ReactNode;
|
|
19
|
-
}):
|
|
19
|
+
}): react11.ReactNode;
|
|
20
20
|
declare namespace SwitchDefault {
|
|
21
21
|
var slotSymbol: symbol;
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { t as
|
|
3
|
+
import { t as __exportAll } from "../../chunk-CpZCTQkd.js";
|
|
4
4
|
import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
|
|
5
5
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ SwitchDefault.slotSymbol = Symbol("switch-default");
|
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/components/common/switch/switch-parts.ts
|
|
31
|
-
var switch_parts_exports = /* @__PURE__ */
|
|
31
|
+
var switch_parts_exports = /* @__PURE__ */ __exportAll({
|
|
32
32
|
Default: () => SwitchDefault,
|
|
33
33
|
Match: () => SwitchMatch,
|
|
34
34
|
Root: () => SwitchRoot
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AnyString } from "@zayne-labs/toolkit-type-helpers";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/common/teleport/teleport.d.ts
|
|
5
5
|
type ValidHtmlTags = keyof HTMLElementTagNameMap;
|
|
6
6
|
type PortalProps = {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
insertPosition?: InsertPosition;
|
|
9
|
-
to: AnyString | HTMLElement | ValidHtmlTags | null;
|
|
9
|
+
to: AnyString | HTMLElement | React.RefObject<HTMLElement> | ValidHtmlTags | null;
|
|
10
10
|
};
|
|
11
|
-
declare function Teleport(props: PortalProps):
|
|
11
|
+
declare function Teleport(props: PortalProps): react_jsx_runtime0.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { Teleport };
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ClientGate } from "../../client-gate-
|
|
1
|
+
import { t as ClientGate } from "../../client-gate-CZczUIeY.js";
|
|
2
2
|
import { isString } from "@zayne-labs/toolkit-type-helpers";
|
|
3
3
|
import { useLayoutEffect, useState } from "react";
|
|
4
4
|
import { useCallbackRef } from "@zayne-labs/toolkit-react";
|
|
@@ -7,6 +7,11 @@ import { createPortal } from "react-dom";
|
|
|
7
7
|
|
|
8
8
|
//#region src/components/common/teleport/teleport.tsx
|
|
9
9
|
const TELEPORT_KEY = "teleport-wrapper";
|
|
10
|
+
const getDestination = (to) => {
|
|
11
|
+
if (isString(to)) return document.querySelector(to);
|
|
12
|
+
if (to instanceof HTMLElement) return to;
|
|
13
|
+
return to.current;
|
|
14
|
+
};
|
|
10
15
|
function Teleport(props) {
|
|
11
16
|
const { children, insertPosition, to } = props;
|
|
12
17
|
const [portalContainer, setPortalContainer] = useState(null);
|
|
@@ -15,7 +20,7 @@ function Teleport(props) {
|
|
|
15
20
|
});
|
|
16
21
|
useLayoutEffect(() => {
|
|
17
22
|
if (!to) return;
|
|
18
|
-
const destination =
|
|
23
|
+
const destination = getDestination(to);
|
|
19
24
|
if (!insertPosition) {
|
|
20
25
|
destination && stableUpdatePortalContainer(destination);
|
|
21
26
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { type AnyString
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { isString, type AnyString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLayoutEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ClientGate } from \"../client-gate\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\ntype PortalProps = {\n\tchildren: React.ReactNode;\n\tinsertPosition?: InsertPosition;\n\tto: AnyString | HTMLElement | React.RefObject<HTMLElement> | ValidHtmlTags | null;\n};\n\nconst TELEPORT_KEY = \"teleport-wrapper\";\n\nconst getDestination = (to: NonNullable<PortalProps[\"to\"]>) => {\n\tif (isString(to)) {\n\t\treturn document.querySelector<HTMLElement>(to);\n\t}\n\n\tif (to instanceof HTMLElement) {\n\t\treturn to;\n\t}\n\n\treturn to.current;\n};\n\nfunction Teleport(props: PortalProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\tconst stableUpdatePortalContainer = useCallbackRef((destination: HTMLElement | null) => {\n\t\tsetPortalContainer(destination);\n\t});\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\tconst destination = getDestination(to);\n\n\t\tif (!insertPosition) {\n\t\t\tdestination && stableUpdatePortalContainer(destination);\n\t\t\treturn;\n\t\t}\n\n\t\tconst tempWrapper = document.createElement(\"div\");\n\t\ttempWrapper.id = TELEPORT_KEY;\n\t\ttempWrapper.style.display = \"contents\";\n\n\t\tdestination?.insertAdjacentElement(insertPosition, tempWrapper);\n\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\ttempWrapper.replaceWith(...tempWrapper.children);\n\t\t}, 0);\n\n\t\tstableUpdatePortalContainer(tempWrapper);\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t\tclearTimeout(timeoutId);\n\t\t};\n\t}, [to, insertPosition, stableUpdatePortalContainer]);\n\n\treturn (\n\t\t<ClientGate>\n\t\t\t{() => portalContainer && createPortal(children, portalContainer, TELEPORT_KEY)}\n\t\t</ClientGate>\n\t);\n}\n\nexport { Teleport };\n"],"mappings":";;;;;;;;AAgBA,MAAM,eAAe;AAErB,MAAM,kBAAkB,OAAuC;AAC9D,KAAI,SAAS,GAAG,CACf,QAAO,SAAS,cAA2B,GAAG;AAG/C,KAAI,cAAc,YACjB,QAAO;AAGR,QAAO,GAAG;;AAGX,SAAS,SAAS,OAAoB;CACrC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,KAAK;CAEhF,MAAM,8BAA8B,gBAAgB,gBAAoC;AACvF,qBAAmB,YAAY;GAC9B;AAEF,uBAAsB;AACrB,MAAI,CAAC,GAAI;EAET,MAAM,cAAc,eAAe,GAAG;AAEtC,MAAI,CAAC,gBAAgB;AACpB,kBAAe,4BAA4B,YAAY;AACvD;;EAGD,MAAM,cAAc,SAAS,cAAc,MAAM;AACjD,cAAY,KAAK;AACjB,cAAY,MAAM,UAAU;AAE5B,eAAa,sBAAsB,gBAAgB,YAAY;EAE/D,MAAM,YAAY,iBAAiB;AAClC,eAAY,YAAY,GAAG,YAAY,SAAS;KAC9C,EAAE;AAEL,8BAA4B,YAAY;AAExC,eAAa;AACZ,eAAY,QAAQ;AACpB,gBAAa,UAAU;;IAEtB;EAAC;EAAI;EAAgB;EAA4B,CAAC;AAErD,QACC,oBAAC,8BACO,mBAAmB,aAAa,UAAU,iBAAiB,aAAa,GACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary-TM4xzQfq.js","names":["
|
|
1
|
+
{"version":3,"file":"error-boundary-TM4xzQfq.js","names":["#resetErrorBoundary"],"sources":["../../src/components/common/error-boundary/error-boundary-context.ts","../../src/components/common/error-boundary/error-boundary.tsx","../../src/components/common/error-boundary/useErrorBoundary.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type ErrorBoundaryContextType = {\n\terror: unknown;\n\thasError: boolean;\n\tresetErrorBoundary: (...args: unknown[]) => void;\n};\n\nconst [ErrorBoundaryContext, useErrorBoundaryContext] = createCustomContext<ErrorBoundaryContextType>({\n\thookName: \"useErrorBoundaryContext\",\n\tname: \"ErrorBoundaryContext\",\n\tproviderName: \"ErrorBoundaryContextProvider\",\n});\n\nexport { ErrorBoundaryContext, useErrorBoundaryContext };\n","\"use client\";\n\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Component } from \"react\";\nimport { ErrorBoundaryContext, type ErrorBoundaryContextType } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps, ErrorFallbackProps } from \"./types\";\n\ntype ErrorBoundaryState =\n\t| {\n\t\t\terror: Error;\n\t\t\thasError: true;\n\t }\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t };\n\nconst initialState: ErrorBoundaryState = {\n\terror: null,\n\thasError: false,\n};\n\nconst hasArrayChanged = (arrayOne: unknown[] = [], arrayTwo: unknown[] = []) => {\n\treturn (\n\t\tarrayOne.length !== arrayTwo.length\n\t\t|| arrayOne.some((item, index) => !Object.is(item, arrayTwo[index]))\n\t);\n};\n\n/**\n * Copied from react-error-boundary package\n * @see https://github.com/bvaughn/react-error-boundary\n */\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n\tconstructor(props: ErrorBoundaryProps) {\n\t\tsuper(props);\n\n\t\tthis.state = initialState;\n\t}\n\n\tstatic getDerivedStateFromError(error: Error) {\n\t\treturn { error, hasError: true };\n\t}\n\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tthis.props.onError?.({ error, info });\n\t}\n\n\toverride componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n\t\tconst { hasError } = this.state;\n\t\tconst { resetKeys } = this.props;\n\n\t\t// == There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array, we'd end up resetting the error boundary immediately.\n\t\t// == This would likely trigger a second error to be thrown.\n\t\t// == So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n\t\tif (hasError && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\tnext: resetKeys,\n\t\t\t\tprev: prevProps.resetKeys,\n\t\t\t\treason: \"keys\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback } = this.props;\n\t\tconst { error, hasError } = this.state;\n\n\t\tlet childToRender = children;\n\n\t\tif (hasError) {\n\t\t\tswitch (true) {\n\t\t\t\tcase isFunction(fallback): {\n\t\t\t\t\tconst fallbackRenderProps = {\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t} satisfies ErrorFallbackProps;\n\n\t\t\t\t\tchildToRender = fallback(fallbackRenderProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(fallback): {\n\t\t\t\t\tchildToRender = fallback;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.warn(\"No fallback provided to error boundary\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst contextValue = {\n\t\t\terror,\n\t\t\thasError,\n\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t} satisfies ErrorBoundaryContextType;\n\n\t\treturn <ErrorBoundaryContext value={contextValue}>{childToRender}</ErrorBoundaryContext>;\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error !== null) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\targs: parameters,\n\t\t\t\treason: \"imperative-api\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t};\n}\n","import { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useErrorBoundaryContext } from \"./error-boundary-context\";\n\ntype UseErrorBoundaryState<TError extends Error> =\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t }\n\t| {\n\t\t\terror: TError;\n\t\t\thasError: true;\n\t };\n\nexport const useErrorBoundary = <TError extends Error>() => {\n\tconst { resetErrorBoundary } = useErrorBoundaryContext();\n\n\tconst [state, setState] = useState<UseErrorBoundaryState<TError>>({\n\t\terror: null,\n\t\thasError: false,\n\t});\n\n\tif (state.hasError) {\n\t\tthrow state.error;\n\t}\n\n\tconst resetBoundary = useCallbackRef(() => {\n\t\tresetErrorBoundary();\n\n\t\tsetState({\n\t\t\terror: null,\n\t\t\thasError: false,\n\t\t});\n\t});\n\n\tconst showBoundary = useCallbackRef((error: TError) => {\n\t\tsetState({\n\t\t\terror,\n\t\t\thasError: true,\n\t\t});\n\t});\n\n\treturn { resetBoundary, showBoundary };\n};\n"],"mappings":";;;;;;AAQA,MAAM,CAAC,sBAAsB,2BAA2B,oBAA8C;CACrG,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;;;;ACKF,MAAM,eAAmC;CACxC,OAAO;CACP,UAAU;CACV;AAED,MAAM,mBAAmB,WAAsB,EAAE,EAAE,WAAsB,EAAE,KAAK;AAC/E,QACC,SAAS,WAAW,SAAS,UAC1B,SAAS,MAAM,MAAM,UAAU,CAAC,OAAO,GAAG,MAAM,SAAS,OAAO,CAAC;;;;;;AAStE,IAAa,gBAAb,cAAmC,UAAkD;CACpF,YAAY,OAA2B;AACtC,QAAM,MAAM;AAEZ,OAAK,QAAQ;;CAGd,OAAO,yBAAyB,OAAc;AAC7C,SAAO;GAAE;GAAO,UAAU;GAAM;;CAGjC,AAAS,kBAAkB,OAAc,MAAuB;AAC/D,OAAK,MAAM,UAAU;GAAE;GAAO;GAAM,CAAC;;CAGtC,AAAS,mBAAmB,WAA+B,WAA+B;EACzF,MAAM,EAAE,aAAa,KAAK;EAC1B,MAAM,EAAE,cAAc,KAAK;AAM3B,MAAI,YAAY,UAAU,UAAU,QAAQ,gBAAgB,UAAU,WAAW,UAAU,EAAE;AAC5F,QAAK,MAAM,UAAU;IACpB,MAAM;IACN,MAAM,UAAU;IAChB,QAAQ;IACR,CAAC;AAEF,QAAK,SAAS,aAAa;;;CAI7B,AAAS,SAAS;EACjB,MAAM,EAAE,UAAU,aAAa,KAAK;EACpC,MAAM,EAAE,OAAO,aAAa,KAAK;EAEjC,IAAI,gBAAgB;AAEpB,MAAI,SACH,SAAQ,MAAR;GACC,KAAK,WAAW,SAAS;AAMxB,oBAAgB,SALY;KAC3B;KACA,oBAAoB,MAAKA;KACzB,CAE4C;AAC7C;GAGD,KAAK,QAAQ,SAAS;AACrB,oBAAgB;AAChB;GAGD,QACC,SAAQ,KAAK,yCAAyC;;AAWzD,SAAO,oBAAC;GAAqB,OANR;IACpB;IACA;IACA,oBAAoB,MAAKA;IACzB;aAEkD;IAAqC;;CAGzF,uBAAuB,GAAG,eAA0B;EACnD,MAAM,EAAE,UAAU,KAAK;AAEvB,MAAI,UAAU,MAAM;AACnB,QAAK,MAAM,UAAU;IACpB,MAAM;IACN,QAAQ;IACR,CAAC;AAEF,QAAK,SAAS,aAAa;;;;;;;ACrG9B,MAAa,yBAA+C;CAC3D,MAAM,EAAE,uBAAuB,yBAAyB;CAExD,MAAM,CAAC,OAAO,YAAY,SAAwC;EACjE,OAAO;EACP,UAAU;EACV,CAAC;AAEF,KAAI,MAAM,SACT,OAAM,MAAM;AAmBb,QAAO;EAAE,eAhBa,qBAAqB;AAC1C,uBAAoB;AAEpB,YAAS;IACR,OAAO;IACP,UAAU;IACV,CAAC;IACD;EASsB,cAPH,gBAAgB,UAAkB;AACtD,YAAS;IACR;IACA,UAAU;IACV,CAAC;IACD;EAEoC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ErrorBoundaryProps } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { a as ErrorBoundaryProps } from "./index-D3QKG4Tt.js";
|
|
2
|
+
import * as react_jsx_runtime36 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/common/suspense-with-boundary/suspense-with-boundary.d.ts
|
|
5
5
|
type SuspenseWithBoundaryProps = {
|
|
@@ -7,7 +7,7 @@ type SuspenseWithBoundaryProps = {
|
|
|
7
7
|
errorFallback?: ErrorBoundaryProps["fallback"];
|
|
8
8
|
fallback?: React.ReactNode;
|
|
9
9
|
};
|
|
10
|
-
declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps):
|
|
10
|
+
declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): react_jsx_runtime36.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { SuspenseWithBoundaryProps as n, SuspenseWithBoundary as t };
|
|
13
|
-
//# sourceMappingURL=index-
|
|
13
|
+
//# sourceMappingURL=index-Bw26wyvy.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react24 from "react";
|
|
2
2
|
import { Component } from "react";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
3
|
+
import * as _zayne_labs_toolkit_react4 from "@zayne-labs/toolkit-react";
|
|
4
|
+
import * as react_jsx_runtime39 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/common/error-boundary/types.d.ts
|
|
7
|
-
type
|
|
7
|
+
type ErrorFallbackProps = {
|
|
8
8
|
error: unknown;
|
|
9
9
|
resetErrorBoundary: (...args: unknown[]) => void;
|
|
10
10
|
};
|
|
11
11
|
type ErrorBoundaryProps = {
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
-
fallback?: React.ReactNode | ((props:
|
|
13
|
+
fallback?: React.ReactNode | ((props: ErrorFallbackProps) => React.ReactNode);
|
|
14
14
|
onError?: (context: {
|
|
15
15
|
error: Error;
|
|
16
16
|
info: React.ErrorInfo & {
|
|
@@ -49,7 +49,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
|
|
|
49
49
|
};
|
|
50
50
|
componentDidCatch(error: Error, info: React.ErrorInfo): void;
|
|
51
51
|
componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
|
|
52
|
-
render():
|
|
52
|
+
render(): react_jsx_runtime39.JSX.Element;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/components/common/error-boundary/error-boundary-context.d.ts
|
|
@@ -58,7 +58,7 @@ type ErrorBoundaryContextType = {
|
|
|
58
58
|
hasError: boolean;
|
|
59
59
|
resetErrorBoundary: (...args: unknown[]) => void;
|
|
60
60
|
};
|
|
61
|
-
declare const ErrorBoundaryContext:
|
|
61
|
+
declare const ErrorBoundaryContext: react24.Context<ErrorBoundaryContextType>, useErrorBoundaryContext: _zayne_labs_toolkit_react4.UseCustomContext<ErrorBoundaryContextType, true>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/components/common/error-boundary/useErrorBoundary.d.ts
|
|
64
64
|
declare const useErrorBoundary: <TError extends Error>() => {
|
|
@@ -66,5 +66,5 @@ declare const useErrorBoundary: <TError extends Error>() => {
|
|
|
66
66
|
showBoundary: (error: TError) => void;
|
|
67
67
|
};
|
|
68
68
|
//#endregion
|
|
69
|
-
export { ErrorBoundaryProps as a, ErrorBoundary as i, ErrorBoundaryContextType as n,
|
|
70
|
-
//# sourceMappingURL=index-
|
|
69
|
+
export { ErrorBoundaryProps as a, ErrorBoundary as i, ErrorBoundaryContextType as n, ErrorFallbackProps as o, useErrorBoundaryContext as r, useErrorBoundary as t };
|
|
70
|
+
//# sourceMappingURL=index-D3QKG4Tt.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SlotRoot } from "./slot-
|
|
1
|
+
import { n as SlotRoot } from "./slot-aKEvaEWn.js";
|
|
2
2
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
4
4
|
import { useCallbackRef, useComposeRefs, useToggle } from "@zayne-labs/toolkit-react";
|
|
@@ -208,4 +208,4 @@ function Presence(props) {
|
|
|
208
208
|
|
|
209
209
|
//#endregion
|
|
210
210
|
export { Presence as t };
|
|
211
|
-
//# sourceMappingURL=presence-
|
|
211
|
+
//# sourceMappingURL=presence-BTPyxGeW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence-BTPyxGeW.js","names":["Slot.Root"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { dataAttr, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useToggle } from \"@zayne-labs/toolkit-react\";\nimport type { InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from \"react\";\n\ntype StateMachineConfig<TState extends string, TEvent extends string> = {\n\tinitial: TState;\n\tstates: Record<TState, Partial<Record<TEvent, TState>>>;\n};\n\nconst useStateMachine = <TState extends string, TEvent extends string>(\n\tconfig: StateMachineConfig<TState, TEvent>\n) => {\n\tconst reducer = (prevState: TState, event: TEvent): TState => {\n\t\tconst newState = config.states[prevState][event] ?? prevState;\n\n\t\treturn newState;\n\t};\n\n\treturn useReducer(reducer, config.initial);\n};\n\nconst getAnimationName = (styles: CSSStyleDeclaration | null) => styles?.animationName ?? \"none\";\n\nexport type UsePresenceOptions = {\n\tonExitComplete?: () => void;\n\tpresent: boolean;\n\t/**\n\t * @default \"animation\"\n\t */\n\tvariant?: \"animation\" | \"transition\";\n};\n\nexport type UsePresenceResult = {\n\tisPresent: boolean;\n\tisPresentOrIsTransitionComplete: boolean;\n\tpropGetters: {\n\t\tgetPresenceProps: (innerProps: InferProps<HTMLElement>) => InferProps<HTMLElement>;\n\t};\n\tref: React.Ref<HTMLElement>;\n\tshouldStartTransition: boolean;\n};\n\n/**\n * React hook that provides the ability to animate the mount/unmount of a component.\n * @see https://github.com/radix-ui/primitives/blob/main/packages/react/presence/src/presence.tsx\n */\n\nconst usePresence = (options: UsePresenceOptions): UsePresenceResult => {\n\tconst { onExitComplete, present: presentProp, variant = \"animation\" } = options;\n\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst [node, setNode] = useState<HTMLElement | null>(null);\n\n\tconst [hasTransitioned, toggleHasTransitioned] = useToggle(false);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevNodeStateRef = useRef<{\n\t\tprevAnimationName: string;\n\t\tprevPresent: boolean;\n\t}>({\n\t\tprevAnimationName: \"none\",\n\t\tprevPresent: presentProp,\n\t});\n\n\tconst initialState = presentProp ? \"mounted\" : \"unmounted\";\n\n\tconst [state, send] = useStateMachine({\n\t\tinitial: initialState,\n\t\tstates: {\n\t\t\tmounted: {\n\t\t\t\tANIMATION_OUT: \"unmountSuspended\",\n\t\t\t\tUNMOUNT: \"unmounted\",\n\t\t\t},\n\t\t\tunmounted: {\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t\tunmountSuspended: {\n\t\t\t\tANIMATION_END: \"unmounted\",\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t},\n\t});\n\n\tuseEffect(() => {\n\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\tprevNodeStateRef.current.prevAnimationName = state === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [state]);\n\n\tuseLayoutEffect(() => {\n\t\tconst styles = stylesRef.current;\n\t\tconst wasPresent = prevNodeStateRef.current.prevPresent;\n\t\tconst hasPresentChanged = wasPresent !== presentProp;\n\n\t\tif (!hasPresentChanged) return;\n\n\t\tconst prevAnimationName = prevNodeStateRef.current.prevAnimationName;\n\t\tconst currentAnimationName = getAnimationName(styles);\n\n\t\tswitch (true) {\n\t\t\tcase presentProp: {\n\t\t\t\tsend(\"MOUNT\");\n\n\t\t\t\tif (variant === \"transition\") {\n\t\t\t\t\trequestAnimationFrame(() => toggleHasTransitioned(true));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line react-hooks/todo -- Ignore\n\t\t\tcase Boolean(node) && variant === \"animation\": {\n\t\t\t\tconst hasAnimation = currentAnimationName !== \"none\" && styles?.display !== \"none\";\n\n\t\t\t\t/**\n\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t * computed styles) because there is no `animationrun` event (like the `transitionrun` event) and `animationstart`\n\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t */\n\n\t\t\t\tconst isAnimationStarted = hasAnimation && prevAnimationName !== currentAnimationName;\n\n\t\t\t\tconst isAnimatingOut = wasPresent && isAnimationStarted;\n\n\t\t\t\tsend(isAnimatingOut ? \"ANIMATION_OUT\" : \"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprevNodeStateRef.current.prevPresent = presentProp;\n\t}, [presentProp, node, send, variant, toggleHasTransitioned]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!node) {\n\t\t\t// Transition to the unmounted state if the node is removed prematurely.\n\t\t\t// We avoid doing so during cleanup as the node may change but still exist.\n\t\t\tsend(\"ANIMATION_END\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet timeoutId: number;\n\n\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\tprevNodeStateRef.current.prevAnimationName = getAnimationName(stylesRef.current);\n\t\t};\n\n\t\t/**\n\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t */\n\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\t\t// The event.animationName is unescaped for CSS syntax, so we need to escape it to compare with the animationName computed from the style.\n\t\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t// user-provided event handlers would not be called.\n\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\tif (!prevNodeStateRef.current.prevPresent) {\n\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t// still causes a flash.\n\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t}\n\t\t\t\t}) as never;\n\t\t\t}\n\t\t};\n\n\t\tconst handleTransitionRun = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_OUT\");\n\t\t};\n\n\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node && !prevNodeStateRef.current.prevPresent;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_END\");\n\t\t};\n\n\t\tconst onAnimationStartCleanup = on(\"animationstart\", node, handleAnimationStart);\n\t\tconst onAnimationEndCleanup = on(\"animationend\", node, handleAnimationEnd);\n\t\tconst onAnimationCancelCleanup = on(\"animationcancel\", node, handleAnimationEnd);\n\n\t\tconst onTransitionRunCleanup = on(\"transitionrun\", node, handleTransitionRun);\n\t\tconst onTransitionEndCleanup = on(\"transitionend\", node, handleTransitionEnd);\n\t\tconst onTransitionCancelCleanup = on(\"transitioncancel\", node, handleTransitionEnd);\n\n\t\treturn () => {\n\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\tonAnimationStartCleanup();\n\t\t\tonAnimationEndCleanup();\n\t\t\tonAnimationCancelCleanup();\n\n\t\t\tonTransitionRunCleanup();\n\t\t\tonTransitionEndCleanup();\n\t\t\tonTransitionCancelCleanup();\n\t\t};\n\t}, [node, send]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = state === \"unmounted\" && !presentProp;\n\n\t\tif (isExitCompleted) {\n\t\t\ttoggleHasTransitioned(false);\n\t\t\tstableOnExitComplete?.();\n\t\t}\n\t}, [state, presentProp, stableOnExitComplete, toggleHasTransitioned]);\n\n\tconst ref = useCallbackRef((refNode: HTMLElement | null) => {\n\t\tsetNode(refNode);\n\n\t\tif (refNode) {\n\t\t\tstylesRef.current = getComputedStyle(refNode);\n\t\t}\n\t});\n\n\tconst MOUNTED_STATES = [\"mounted\", \"unmountSuspended\"] satisfies Array<typeof state>;\n\tconst isPresent = MOUNTED_STATES.includes(state);\n\tconst isPresentOrIsTransitionComplete = isPresent || hasTransitioned;\n\tconst shouldStartTransition = presentProp && hasTransitioned;\n\n\tconst getPresenceProps: UsePresenceResult[\"propGetters\"][\"getPresenceProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst transitionState = shouldStartTransition ? \"active\" : \"inactive\";\n\n\t\t\treturn {\n\t\t\t\t\"data-present\": dataAttr(isPresent),\n\t\t\t\t\"data-present-or-transition-complete\": dataAttr(isPresentOrIsTransitionComplete),\n\t\t\t\t\"data-state\": state,\n\t\t\t\t...(variant === \"transition\" && { \"data-transition\": transitionState }),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: innerProps.className,\n\t\t\t};\n\t\t},\n\t\t[isPresent, isPresentOrIsTransitionComplete, shouldStartTransition, state, variant]\n\t);\n\n\tconst propGetters = useMemo(() => ({ getPresenceProps }), [getPresenceProps]);\n\n\tconst result = useMemo<UsePresenceResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tisPresent,\n\t\t\t\tisPresentOrIsTransitionComplete,\n\t\t\t\tpropGetters,\n\t\t\t\tref,\n\t\t\t\tshouldStartTransition,\n\t\t\t}) satisfies UsePresenceResult,\n\t\t[isPresent, isPresentOrIsTransitionComplete, propGetters, ref, shouldStartTransition]\n\t);\n\n\treturn result;\n};\n\nexport { usePresence };\n","\"use client\";\n\nimport { useComposeRefs } from \"@zayne-labs/toolkit-react\";\nimport { isFunction, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Slot } from \"../slot\";\nimport { usePresence, type UsePresenceOptions, type UsePresenceResult } from \"./use-presence\";\n\ntype RefProp = { ref?: React.Ref<HTMLElement> };\n\ntype RenderPropContext = Omit<UsePresenceResult, \"propGetters\" | \"ref\">;\n\ntype PresenceProps = UsePresenceOptions & {\n\tchildren?: React.ReactElement<RefProp> | ((props: RenderPropContext) => React.ReactElement<RefProp>);\n\tclassName?: string;\n\tforceMount?: boolean;\n};\n\nfunction Presence(props: PresenceProps) {\n\tconst { children, className, forceMount = false, onExitComplete, present, variant } = props;\n\n\tconst {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tpropGetters,\n\t\tref: presenceRef,\n\t\tshouldStartTransition,\n\t} = usePresence({ onExitComplete, present, variant });\n\n\tconst context = {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tshouldStartTransition,\n\t} satisfies RenderPropContext;\n\n\tconst resolvedChild = isFunction(children) ? children(context) : children;\n\n\tconst childRef = (resolvedChild?.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = useComposeRefs(presenceRef, childRef);\n\n\tconst shouldRender =\n\t\tforceMount || (variant === \"transition\" ? isPresentOrIsTransitionComplete : isPresent);\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Slot.Root ref={ref} {...propGetters.getPresenceProps({ className })}>\n\t\t\t{resolvedChild}\n\t\t</Slot.Root>\n\t);\n}\n\nexport { Presence };\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __exportAll } from "./chunk-CpZCTQkd.js";
|
|
2
2
|
import { getMultipleSlots, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
|
|
3
3
|
import { assert, isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
4
4
|
import { toArray } from "@zayne-labs/toolkit-core";
|
|
@@ -36,7 +36,7 @@ ShowFallback.slotSymbol = Symbol("show-fallback");
|
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/components/common/show/show-parts.ts
|
|
39
|
-
var show_parts_exports = /* @__PURE__ */
|
|
39
|
+
var show_parts_exports = /* @__PURE__ */ __exportAll({
|
|
40
40
|
Content: () => ShowContent,
|
|
41
41
|
Fallback: () => ShowFallback,
|
|
42
42
|
Otherwise: () => ShowFallback,
|
|
@@ -45,4 +45,4 @@ var show_parts_exports = /* @__PURE__ */ __export({
|
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
export { ShowRoot as i, ShowContent as n, ShowFallback as r, show_parts_exports as t };
|
|
48
|
-
//# sourceMappingURL=show-
|
|
48
|
+
//# sourceMappingURL=show-1Md5CZML.js.map
|