@zayne-labs/ui-react 0.11.10 → 0.11.12

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.
Files changed (36) hide show
  1. package/dist/components/cn-jNZfGhrk.js.map +1 -1
  2. package/dist/components/common/await/index.d.ts +4 -6
  3. package/dist/components/common/await/index.js.map +1 -1
  4. package/dist/components/common/client-gate/index.d.ts +1 -3
  5. package/dist/components/common/client-gate/index.js.map +1 -1
  6. package/dist/components/common/error-boundary/index.d.ts +2 -2
  7. package/dist/components/common/for/index.d.ts +2 -4
  8. package/dist/components/common/presence/index.d.ts +1 -2
  9. package/dist/components/common/show/index.d.ts +3 -5
  10. package/dist/components/common/slot/index.d.ts +2 -4
  11. package/dist/components/common/suspense-with-boundary/index.d.ts +1 -1
  12. package/dist/components/common/suspense-with-boundary/index.js.map +1 -1
  13. package/dist/components/common/switch/index.d.ts +3 -5
  14. package/dist/components/common/teleport/index.d.ts +1 -2
  15. package/dist/components/common/teleport/index.js.map +1 -1
  16. package/dist/components/error-boundary-BOZ3EvMt.js.map +1 -1
  17. package/dist/components/for-DGTMIS0w.js.map +1 -1
  18. package/dist/components/{index-DgA9ry9R.d.ts → index-CUmHEGwU.d.ts} +3 -6
  19. package/dist/components/{index-BXWyFo6R.d.ts → index-Dvg4OLWa.d.ts} +3 -4
  20. package/dist/components/presence-DDuEcp1q.js.map +1 -1
  21. package/dist/components/show-CMxdpPiN.js.map +1 -1
  22. package/dist/components/slot-B2aEs2RU.js.map +1 -1
  23. package/dist/components/switch-Dwy5Gzsb.js.map +1 -1
  24. package/dist/components/ui/card/index.d.ts +7 -8
  25. package/dist/components/ui/card/index.js.map +1 -1
  26. package/dist/components/ui/carousel/index.d.ts +9 -10
  27. package/dist/components/ui/carousel/index.js.map +1 -1
  28. package/dist/components/ui/drag-scroll/index.d.ts +10 -80
  29. package/dist/components/ui/drag-scroll/index.js.map +1 -1
  30. package/dist/components/ui/drop-zone/index.d.ts +16 -86
  31. package/dist/components/ui/drop-zone/index.js.map +1 -1
  32. package/dist/components/ui/form/index.d.ts +21 -23
  33. package/dist/components/ui/form/index.js +11 -5
  34. package/dist/components/ui/form/index.js.map +1 -1
  35. package/dist/style.css +1 -4
  36. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"cn-jNZfGhrk.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
+ {"version":3,"file":"cn-jNZfGhrk.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,UAAU"}
@@ -1,8 +1,6 @@
1
- import { o as ErrorBoundaryProps } from "../../index-DgA9ry9R.js";
2
- import { n as SuspenseWithBoundaryProps } from "../../index-BXWyFo6R.js";
1
+ import { o as ErrorBoundaryProps } from "../../index-CUmHEGwU.js";
2
+ import { n as SuspenseWithBoundaryProps } from "../../index-Dvg4OLWa.js";
3
3
  import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
4
- import * as _$react from "react";
5
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
6
4
 
7
5
  //#region src/components/common/await/await.d.ts
8
6
  type RenderPropFn<TValue> = (result: TValue) => React.ReactNode;
@@ -14,9 +12,9 @@ type AwaitRootProps<TValue> = Omit<SuspenseWithBoundaryProps, "children"> & {
14
12
  withErrorBoundary?: boolean;
15
13
  withSuspense?: boolean;
16
14
  };
17
- declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): _$react_jsx_runtime0.JSX.Element;
15
+ declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): import("react/jsx-runtime").JSX.Element;
18
16
  type AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<"default", ChildrenType<TValue>>;
19
- declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): _$react.ReactNode;
17
+ declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): import("react").ReactNode;
20
18
  type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["errorFallback"]>;
21
19
  declare const AwaitError: {
22
20
  (props: Pick<AwaitErrorProps, "children"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ReactFragment","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\nexport type AwaitRootProps<TValue> = Omit<SuspenseWithBoundaryProps, \"children\"> & {\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\tasChild,\n\t\tchildren,\n\t\terrorFallback,\n\t\terrorResetKeys,\n\t\tfallback,\n\t\tname,\n\t\tonError,\n\t\tonErrorReset,\n\t\tpromise,\n\t\twithErrorBoundary = true,\n\t\twithSuspense = true,\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 resolvedPendingFallback = slots.pending ?? fallback;\n\tconst resolvedErrorFallback = slots.error ?? errorFallback;\n\n\treturn (\n\t\t<WithErrorBoundary\n\t\t\t{...(withErrorBoundary && {\n\t\t\t\terrorFallback: resolvedErrorFallback,\n\t\t\t\terrorResetKeys,\n\t\t\t\tonError,\n\t\t\t\tonErrorReset,\n\t\t\t})}\n\t\t>\n\t\t\t<WithSuspense {...(withSuspense && { fallback: resolvedPendingFallback, name })}>\n\t\t\t\t<AwaitRootImpl promise={promise} asChild={asChild}>\n\t\t\t\t\t{slots.default}\n\t\t\t\t</AwaitRootImpl>\n\t\t\t</WithSuspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\ntype AwaitRootImplProps<TValue> = Pick<AwaitRootProps<TValue>, \"asChild\" | \"children\" | \"promise\">;\n\nfunction AwaitRootImpl<TValue>(props: AwaitRootImplProps<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/rules-of-hooks, react-hooks/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[\"errorFallback\"]>;\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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AO;;AAGR,OAAO,OAAO,cAAc,sBAAyC,UAAU,CAAC;AAIhF,MAAa,aAAa,sBACzB,UACC,UAAU;CACV,MAAM,EAAE,SAAS,aAAa;CAE9B,MAAM,uBAAuB,yBAAyB;CAEtD,MAAM,YAAY,UAAUC,WAAYD;CAExC,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,qBAAqB,GAAG;AAEjF,QAAO,oBAAC,WAAD;EAAW,GAAK,WAAW;YAAwB;EAA6B,CAAA;EAExF;AAID,MAAa,eAAe,sBAAyC,UAAU"}
1
+ {"version":3,"file":"index.js","names":["ReactFragment","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\nexport type AwaitRootProps<TValue> = Omit<SuspenseWithBoundaryProps, \"children\"> & {\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\tasChild,\n\t\tchildren,\n\t\terrorFallback,\n\t\terrorResetKeys,\n\t\tfallback,\n\t\tname,\n\t\tonError,\n\t\tonErrorReset,\n\t\tpromise,\n\t\twithErrorBoundary = true,\n\t\twithSuspense = true,\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 resolvedPendingFallback = slots.pending ?? fallback;\n\tconst resolvedErrorFallback = slots.error ?? errorFallback;\n\n\treturn (\n\t\t<WithErrorBoundary\n\t\t\t{...(withErrorBoundary && {\n\t\t\t\terrorFallback: resolvedErrorFallback,\n\t\t\t\terrorResetKeys,\n\t\t\t\tonError,\n\t\t\t\tonErrorReset,\n\t\t\t})}\n\t\t>\n\t\t\t<WithSuspense {...(withSuspense && { fallback: resolvedPendingFallback, name })}>\n\t\t\t\t<AwaitRootImpl promise={promise} asChild={asChild}>\n\t\t\t\t\t{slots.default}\n\t\t\t\t</AwaitRootImpl>\n\t\t\t</WithSuspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\ntype AwaitRootImplProps<TValue> = Pick<AwaitRootProps<TValue>, \"asChild\" | \"children\" | \"promise\">;\n\nfunction AwaitRootImpl<TValue>(props: AwaitRootImplProps<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/rules-of-hooks, react-hooks/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[\"errorFallback\"]>;\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,CAA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SAAS,CAAC;AAI/E,MAAa,aAAa,sBACzB,UACC,UAAU;CACV,MAAM,EAAE,SAAS,aAAa;CAE9B,MAAM,uBAAuB,wBAAwB;CAErD,MAAM,YAAY,UAAUC,WAAYD;CAExC,MAAM,mBAAmB,WAAW,QAAQ,IAAI,SAAS,oBAAoB,IAAI;CAEjF,OAAO,oBAAC,WAAD;EAAW,GAAK,WAAW;YAAwB;CAA4B,CAAA;AACvF,CACD;AAIA,MAAa,eAAe,sBAAyC,SAAS"}
@@ -1,5 +1,3 @@
1
- import * as _$react from "react";
2
-
3
1
  //#region src/components/common/client-gate/client-gate.d.ts
4
2
  type ClientGateProps = {
5
3
  /**
@@ -27,7 +25,7 @@ type ClientGateProps = {
27
25
  * );
28
26
  * ```
29
27
  */
30
- declare function ClientGate(props: ClientGateProps): _$react.ReactNode;
28
+ declare function ClientGate(props: ClientGateProps): import("react").ReactNode;
31
29
  //#endregion
32
30
  export { ClientGate, ClientGateProps };
33
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/client-gate/client-gate.tsx"],"sourcesContent":["\"use client\";\n\nimport { useIsHydrated } from \"@zayne-labs/toolkit-react\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport type 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
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/client-gate/client-gate.tsx"],"sourcesContent":["\"use client\";\n\nimport { useIsHydrated } from \"@zayne-labs/toolkit-react\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport type 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,cAAc;CAEjC,MAAM,yBAA0B,WAAW,QAAQ,IAAI,SAAS,IAAI;CAEpE,OAAO,aAAa,iBAAiB,IAAI;AAC1C"}
@@ -1,2 +1,2 @@
1
- import { a as ErrorBoundary, i as useErrorBoundaryContext, n as useErrorBoundary, o as ErrorBoundaryProps, r as ErrorBoundaryContextType, s as ErrorFallbackRenderProps, t as UseErrorBoundaryReturn } from "../../index-DgA9ry9R.js";
2
- export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, ErrorFallbackRenderProps, UseErrorBoundaryReturn, useErrorBoundary, useErrorBoundaryContext };
1
+ import { a as ErrorBoundary, i as useErrorBoundaryContext, n as useErrorBoundary, o as ErrorBoundaryProps, r as ErrorBoundaryContextType, s as ErrorFallbackRenderProps, t as UseErrorBoundaryReturn } from "../../index-CUmHEGwU.js";
2
+ export { ErrorBoundary, type ErrorBoundaryContextType, ErrorBoundaryProps, ErrorFallbackRenderProps, UseErrorBoundaryReturn, useErrorBoundary, useErrorBoundaryContext };
@@ -1,7 +1,5 @@
1
1
  import { DiscriminatedRenderItemProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
2
  import { Prettify } from "@zayne-labs/toolkit-type-helpers";
3
- import * as _$react from "react";
4
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
3
 
6
4
  //#region src/components/common/for/for.d.ts
7
5
  type ArrayOrNumber = number | readonly unknown[];
@@ -12,11 +10,11 @@ type ForProps<TArray extends ArrayOrNumber> = Prettify<{
12
10
  each: TArray;
13
11
  fallback?: React.ReactNode;
14
12
  } & ForRenderProps<TArray>>;
15
- declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | null;
13
+ declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
16
14
  type ForWithWrapperProps<TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul"> = PolymorphicPropsStrict<TElement, ForProps<TArray>> & {
17
15
  displayFallBackWhenEmpty?: boolean;
18
16
  };
19
- declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: ForWithWrapperProps<TArray, TElement>): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | null;
17
+ declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: ForWithWrapperProps<TArray, TElement>): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
20
18
  //#endregion
21
19
  //#region src/components/common/for/getElementList.d.ts
22
20
  type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
@@ -1,5 +1,4 @@
1
1
  import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
 
4
3
  //#region src/components/common/presence/use-presence.d.ts
5
4
  type UsePresenceOptions = {
@@ -30,7 +29,7 @@ type PresenceProps = UsePresenceOptions & {
30
29
  className?: string;
31
30
  forceMount?: boolean;
32
31
  };
33
- declare function Presence(props: PresenceProps): _$react_jsx_runtime0.JSX.Element | null;
32
+ declare function Presence(props: PresenceProps): import("react/jsx-runtime").JSX.Element | null;
34
33
  //#endregion
35
34
  export { Presence, PresenceProps };
36
35
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,3 @@
1
- import * as _$react from "react";
2
-
3
1
  //#region src/components/common/show/show.d.ts
4
2
  type ShowRootProps<TWhen> = {
5
3
  children: React.ReactNode;
@@ -12,15 +10,15 @@ type ShowRootProps<TWhen> = {
12
10
  fallback?: React.ReactNode;
13
11
  when: false | TWhen | null | undefined;
14
12
  };
15
- declare function ShowRoot<TWhen>(props: ShowRootProps<TWhen>): string | number | bigint | boolean | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | null;
13
+ declare function ShowRoot<TWhen>(props: ShowRootProps<TWhen>): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
16
14
  type ShowContentProps<TWhen> = Pick<ShowRootProps<TWhen>, "children" | "when">;
17
- declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): _$react.ReactNode;
15
+ declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): import("react").ReactNode;
18
16
  declare namespace ShowContent {
19
17
  var slotSymbol: symbol;
20
18
  }
21
19
  declare function ShowFallback(props: {
22
20
  children: React.ReactNode;
23
- }): _$react.ReactNode;
21
+ }): import("react").ReactNode;
24
22
  declare namespace ShowFallback {
25
23
  var slotSymbol: symbol;
26
24
  }
@@ -1,15 +1,13 @@
1
1
  import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
- import * as _$react from "react";
3
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
2
 
5
3
  //#region src/components/common/slot/slot.d.ts
6
4
  type SlotProps = InferProps<HTMLElement> & {
7
5
  ref?: React.Ref<HTMLElement>;
8
6
  };
9
- declare function SlotRoot(props: SlotProps): _$react_jsx_runtime0.JSX.Element | null;
7
+ declare function SlotRoot(props: SlotProps): import("react/jsx-runtime").JSX.Element | null;
10
8
  declare function SlotSlottable({
11
9
  children
12
- }: Pick<SlotProps, "children">): _$react.ReactNode;
10
+ }: Pick<SlotProps, "children">): import("react").ReactNode;
13
11
  declare namespace slot_parts_d_exports {
14
12
  export { SlotRoot as Root, SlotSlottable as Slottable };
15
13
  }
@@ -1,2 +1,2 @@
1
- import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-BXWyFo6R.js";
1
+ import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-Dvg4OLWa.js";
2
2
  export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/suspense-with-boundary/suspense-with-boundary.tsx"],"sourcesContent":["import { Suspense, type SuspenseProps } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\nexport type SuspenseWithBoundaryProps = ErrorBoundaryProps & SuspenseProps;\n\nexport function SuspenseWithBoundary(props: SuspenseWithBoundaryProps) {\n\tconst { children, fallback, name, ...restOfErrorBoundaryProps } = props;\n\n\treturn (\n\t\t<ErrorBoundary {...restOfErrorBoundaryProps}>\n\t\t\t<Suspense fallback={fallback} name={name}>\n\t\t\t\t{children}\n\t\t\t</Suspense>\n\t\t</ErrorBoundary>\n\t);\n}\n"],"mappings":";;;;AAKA,SAAgB,qBAAqB,OAAkC;CACtE,MAAM,EAAE,UAAU,UAAU,MAAM,GAAG,6BAA6B;AAElE,QACC,oBAAC,eAAD;EAAe,GAAI;YAClB,oBAAC,UAAD;GAAoB;GAAgB;GAClC;GACS,CAAA;EACI,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/suspense-with-boundary/suspense-with-boundary.tsx"],"sourcesContent":["import { Suspense, type SuspenseProps } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\nexport type SuspenseWithBoundaryProps = ErrorBoundaryProps & SuspenseProps;\n\nexport function SuspenseWithBoundary(props: SuspenseWithBoundaryProps) {\n\tconst { children, fallback, name, ...restOfErrorBoundaryProps } = props;\n\n\treturn (\n\t\t<ErrorBoundary {...restOfErrorBoundaryProps}>\n\t\t\t<Suspense fallback={fallback} name={name}>\n\t\t\t\t{children}\n\t\t\t</Suspense>\n\t\t</ErrorBoundary>\n\t);\n}\n"],"mappings":";;;;AAKA,SAAgB,qBAAqB,OAAkC;CACtE,MAAM,EAAE,UAAU,UAAU,MAAM,GAAG,6BAA6B;CAElE,OACC,oBAAC,eAAD;EAAe,GAAI;YAClB,oBAAC,UAAD;GAAoB;GAAgB;GAClC;EACQ,CAAA;CACI,CAAA;AAEjB"}
@@ -1,22 +1,20 @@
1
- import * as _$react from "react";
2
-
3
1
  //#region src/components/common/switch/switch.d.ts
4
2
  type ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;
5
3
  type SwitchRootProps<TValue> = {
6
4
  children: ValidSwitchComponentType | ValidSwitchComponentType[];
7
5
  value?: TValue;
8
6
  };
9
- declare function SwitchRoot<TValue>(props: SwitchRootProps<TValue>): string | number | bigint | boolean | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | null | undefined;
7
+ declare function SwitchRoot<TValue>(props: SwitchRootProps<TValue>): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null | undefined;
10
8
  type SwitchMatchProps<TWhen> = {
11
9
  children: React.ReactNode | ((value: TWhen) => React.ReactNode);
12
10
  when: false | TWhen | null | undefined;
13
11
  };
14
- declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>): _$react.ReactNode;
12
+ declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>): import("react").ReactNode;
15
13
  declare function SwitchDefault({
16
14
  children
17
15
  }: {
18
16
  children: React.ReactNode;
19
- }): _$react.ReactNode;
17
+ }): import("react").ReactNode;
20
18
  declare namespace SwitchDefault {
21
19
  var slotSymbol: symbol;
22
20
  }
@@ -1,5 +1,4 @@
1
1
  import { AnyString } from "@zayne-labs/toolkit-type-helpers";
2
- import * as _$react from "react";
3
2
 
4
3
  //#region src/components/common/teleport/teleport.d.ts
5
4
  type ValidHtmlTags = keyof HTMLElementTagNameMap;
@@ -8,7 +7,7 @@ type TeleportProps = {
8
7
  insertPosition?: InsertPosition;
9
8
  to: AnyString | HTMLElement | React.RefObject<HTMLElement> | ValidHtmlTags | null;
10
9
  };
11
- declare function Teleport(props: TeleportProps): _$react.ReactPortal | null;
10
+ declare function Teleport(props: TeleportProps): import("react").ReactPortal | null;
12
11
  //#endregion
13
12
  export { Teleport, type TeleportProps };
14
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { isString, type AnyString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\nexport type TeleportProps = {\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<TeleportProps[\"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: TeleportProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\tconst destinationRef = useRef<HTMLElement | null>(null);\n\n\tconst tempWrapperRef = useRef<HTMLDivElement | null>(null);\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\t// eslint-disable-next-line react-hooks/todo -- Ignore for now\n\t\tdestinationRef.current ??= getDestination(to);\n\n\t\tif (!destinationRef.current) return;\n\n\t\tif (!insertPosition) {\n\t\t\tsetPortalContainer(destinationRef.current);\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/todo -- Ignore for now\n\t\ttempWrapperRef.current ??= document.createElement(\"div\");\n\t\ttempWrapperRef.current.dataset.id = TELEPORT_KEY;\n\t\ttempWrapperRef.current.style.display = \"contents\";\n\n\t\tdestinationRef.current.insertAdjacentElement(insertPosition, tempWrapperRef.current);\n\n\t\t// const timeoutId = setTimeout(() => {\n\t\t// \ttempWrapperRef.current.replaceWith(...tempWrapper.children);\n\t\t// }, 0);\n\n\t\tsetPortalContainer(tempWrapperRef.current);\n\n\t\treturn () => {\n\t\t\ttempWrapperRef.current?.remove();\n\t\t};\n\t}, [to, insertPosition]);\n\n\treturn portalContainer && createPortal(children, portalContainer, TELEPORT_KEY);\n}\n\nexport { Teleport };\n"],"mappings":";;;;AAcA,MAAM,eAAe;AAErB,MAAM,kBAAkB,OAAyC;AAChE,KAAI,SAAS,GAAG,CACf,QAAO,SAAS,cAA2B,GAAG;AAG/C,KAAI,cAAc,YACjB,QAAO;AAGR,QAAO,GAAG;;AAGX,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,KAAK;CAEhF,MAAM,iBAAiB,OAA2B,KAAK;CAEvD,MAAM,iBAAiB,OAA8B,KAAK;AAE1D,uBAAsB;AACrB,MAAI,CAAC,GAAI;AAGT,iBAAe,YAAY,eAAe,GAAG;AAE7C,MAAI,CAAC,eAAe,QAAS;AAE7B,MAAI,CAAC,gBAAgB;AACpB,sBAAmB,eAAe,QAAQ;AAC1C;;AAID,iBAAe,YAAY,SAAS,cAAc,MAAM;AACxD,iBAAe,QAAQ,QAAQ,KAAK;AACpC,iBAAe,QAAQ,MAAM,UAAU;AAEvC,iBAAe,QAAQ,sBAAsB,gBAAgB,eAAe,QAAQ;AAMpF,qBAAmB,eAAe,QAAQ;AAE1C,eAAa;AACZ,kBAAe,SAAS,QAAQ;;IAE/B,CAAC,IAAI,eAAe,CAAC;AAExB,QAAO,mBAAmB,aAAa,UAAU,iBAAiB,aAAa"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { isString, type AnyString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\nexport type TeleportProps = {\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<TeleportProps[\"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: TeleportProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\tconst destinationRef = useRef<HTMLElement | null>(null);\n\n\tconst tempWrapperRef = useRef<HTMLDivElement | null>(null);\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\t// eslint-disable-next-line react-hooks/todo -- Ignore for now\n\t\tdestinationRef.current ??= getDestination(to);\n\n\t\tif (!destinationRef.current) return;\n\n\t\tif (!insertPosition) {\n\t\t\tsetPortalContainer(destinationRef.current);\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/todo -- Ignore for now\n\t\ttempWrapperRef.current ??= document.createElement(\"div\");\n\t\ttempWrapperRef.current.dataset.id = TELEPORT_KEY;\n\t\ttempWrapperRef.current.style.display = \"contents\";\n\n\t\tdestinationRef.current.insertAdjacentElement(insertPosition, tempWrapperRef.current);\n\n\t\t// const timeoutId = setTimeout(() => {\n\t\t// \ttempWrapperRef.current.replaceWith(...tempWrapper.children);\n\t\t// }, 0);\n\n\t\tsetPortalContainer(tempWrapperRef.current);\n\n\t\treturn () => {\n\t\t\ttempWrapperRef.current?.remove();\n\t\t};\n\t}, [to, insertPosition]);\n\n\treturn portalContainer && createPortal(children, portalContainer, TELEPORT_KEY);\n}\n\nexport { Teleport };\n"],"mappings":";;;;AAcA,MAAM,eAAe;AAErB,MAAM,kBAAkB,OAAyC;CAChE,IAAI,SAAS,EAAE,GACd,OAAO,SAAS,cAA2B,EAAE;CAG9C,IAAI,cAAc,aACjB,OAAO;CAGR,OAAO,GAAG;AACX;AAEA,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,IAAI;CAE/E,MAAM,iBAAiB,OAA2B,IAAI;CAEtD,MAAM,iBAAiB,OAA8B,IAAI;CAEzD,sBAAsB;EACrB,IAAI,CAAC,IAAI;EAGT,eAAe,YAAY,eAAe,EAAE;EAE5C,IAAI,CAAC,eAAe,SAAS;EAE7B,IAAI,CAAC,gBAAgB;GACpB,mBAAmB,eAAe,OAAO;GACzC;EACD;EAGA,eAAe,YAAY,SAAS,cAAc,KAAK;EACvD,eAAe,QAAQ,QAAQ,KAAK;EACpC,eAAe,QAAQ,MAAM,UAAU;EAEvC,eAAe,QAAQ,sBAAsB,gBAAgB,eAAe,OAAO;EAMnF,mBAAmB,eAAe,OAAO;EAEzC,aAAa;GACZ,eAAe,SAAS,OAAO;EAChC;CACD,GAAG,CAAC,IAAI,cAAc,CAAC;CAEvB,OAAO,mBAAmB,aAAa,UAAU,iBAAiB,YAAY;AAC/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary-BOZ3EvMt.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\";\nimport type { ErrorFallbackRenderProps } from \"./types\";\n\nexport type ErrorBoundaryContextType = ErrorFallbackRenderProps & {\n\thasError: boolean;\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 } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps } 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 { errorResetKeys } = 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 (\n\t\t\thasError\n\t\t\t&& prevState.error !== null\n\t\t\t&& hasArrayChanged(prevProps.errorResetKeys, errorResetKeys)\n\t\t) {\n\t\t\tthis.props.onErrorReset?.({\n\t\t\t\tnext: errorResetKeys,\n\t\t\t\tprev: prevProps.errorResetKeys,\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, errorFallback } = 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(errorFallback): {\n\t\t\t\t\tchildToRender = errorFallback({\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(errorFallback): {\n\t\t\t\t\tchildToRender = errorFallback;\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\n\t\t\treturn (\n\t\t\t\t<ErrorBoundaryContext\n\t\t\t\t\tvalue={{\n\t\t\t\t\t\terror,\n\t\t\t\t\t\thasError,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{childToRender}\n\t\t\t\t</ErrorBoundaryContext>\n\t\t\t);\n\t\t}\n\n\t\treturn childToRender;\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error === null) return;\n\n\t\tthis.props.onErrorReset?.({\n\t\t\targs: parameters,\n\t\t\treason: \"imperative-api\",\n\t\t});\n\n\t\tthis.setState(initialState);\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\nexport type UseErrorBoundaryReturn = {\n\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ACA,oBAAoB,MAAA;KACpB;cAEA;IACqB,CAAA;;AAIzB,SAAO;;CAGR,uBAAuB,GAAG,eAA0B;EACnD,MAAM,EAAE,UAAU,KAAK;AAEvB,MAAI,UAAU,KAAM;AAEpB,OAAK,MAAM,eAAe;GACzB,MAAM;GACN,QAAQ;GACR,CAAC;AAEF,OAAK,SAAS,aAAa;;;;;AC9G7B,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;IAUmB;EAAE,cAPH,gBAAgB,UAAkB;AACtD,YAAS;IACR;IACA,UAAU;IACV,CAAC;IAGiC;EAAE"}
1
+ {"version":3,"file":"error-boundary-BOZ3EvMt.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\";\nimport type { ErrorFallbackRenderProps } from \"./types\";\n\nexport type ErrorBoundaryContextType = ErrorFallbackRenderProps & {\n\thasError: boolean;\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 } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps } 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 { errorResetKeys } = 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 (\n\t\t\thasError\n\t\t\t&& prevState.error !== null\n\t\t\t&& hasArrayChanged(prevProps.errorResetKeys, errorResetKeys)\n\t\t) {\n\t\t\tthis.props.onErrorReset?.({\n\t\t\t\tnext: errorResetKeys,\n\t\t\t\tprev: prevProps.errorResetKeys,\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, errorFallback } = 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(errorFallback): {\n\t\t\t\t\tchildToRender = errorFallback({\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(errorFallback): {\n\t\t\t\t\tchildToRender = errorFallback;\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\n\t\t\treturn (\n\t\t\t\t<ErrorBoundaryContext\n\t\t\t\t\tvalue={{\n\t\t\t\t\t\terror,\n\t\t\t\t\t\thasError,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{childToRender}\n\t\t\t\t</ErrorBoundaryContext>\n\t\t\t);\n\t\t}\n\n\t\treturn childToRender;\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error === null) return;\n\n\t\tthis.props.onErrorReset?.({\n\t\t\targs: parameters,\n\t\t\treason: \"imperative-api\",\n\t\t});\n\n\t\tthis.setState(initialState);\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\nexport type UseErrorBoundaryReturn = {\n\tresetBoundary: () => void;\n\tshowBoundary: (error: Error) => void;\n};\n"],"mappings":";;;;;AAOA,MAAM,CAAC,sBAAsB,2BAA2B,oBAA8C;CACrG,UAAU;CACV,MAAM;CACN,cAAc;AACf,CAAC;;;ACMD,MAAM,eAAmC;CACxC,OAAO;CACP,UAAU;AACX;AAEA,MAAM,mBAAmB,WAAsB,CAAC,GAAG,WAAsB,CAAC,MAAM;CAC/E,OACC,SAAS,WAAW,SAAS,UAC1B,SAAS,MAAM,MAAM,UAAU,CAAC,OAAO,GAAG,MAAM,SAAS,MAAM,CAAC;AAErE;;;;;AAOA,IAAa,gBAAb,cAAmC,UAAkD;CACpF,YAAY,OAA2B;EACtC,MAAM,KAAK;EAEX,KAAK,QAAQ;CACd;CAEA,OAAO,yBAAyB,OAAc;EAC7C,OAAO;GAAE;GAAO,UAAU;EAAK;CAChC;CAEA,kBAA2B,OAAc,MAAuB;EAC/D,KAAK,MAAM,UAAU;GAAE;GAAO;EAAK,CAAC;CACrC;CAEA,mBAA4B,WAA+B,WAA+B;EACzF,MAAM,EAAE,aAAa,KAAK;EAC1B,MAAM,EAAE,mBAAmB,KAAK;EAMhC,IACC,YACG,UAAU,UAAU,QACpB,gBAAgB,UAAU,gBAAgB,cAAc,GAC1D;GACD,KAAK,MAAM,eAAe;IACzB,MAAM;IACN,MAAM,UAAU;IAChB,QAAQ;GACT,CAAC;GAED,KAAK,SAAS,YAAY;EAC3B;CACD;CAEA,SAAkB;EACjB,MAAM,EAAE,UAAU,kBAAkB,KAAK;EACzC,MAAM,EAAE,OAAO,aAAa,KAAK;EAEjC,IAAI,gBAAgB;EAEpB,IAAI,UAAU;GACb,QAAQ,MAAR;IACC,KAAK,WAAW,aAAa;KAC5B,gBAAgB,cAAc;MAC7B;MACA,oBAAoB,KAAKA;KAC1B,CAAC;KACD;IAGD,KAAK,QAAQ,aAAa;KACzB,gBAAgB;KAChB;IAGD,SACC,QAAQ,KAAK,wCAAwC;GAEvD;GAEA,OACC,oBAAC,sBAAD;IACC,OAAO;KACN;KACA;KACA,oBAAoB,KAAKA;IAC1B;cAEC;GACoB,CAAA;EAExB;EAEA,OAAO;CACR;CAEA,uBAAuB,GAAG,eAA0B;EACnD,MAAM,EAAE,UAAU,KAAK;EAEvB,IAAI,UAAU,MAAM;EAEpB,KAAK,MAAM,eAAe;GACzB,MAAM;GACN,QAAQ;EACT,CAAC;EAED,KAAK,SAAS,YAAY;CAC3B;AACD;;;AChHA,MAAa,yBAA+C;CAC3D,MAAM,EAAE,uBAAuB,wBAAwB;CAEvD,MAAM,CAAC,OAAO,YAAY,SAAwC;EACjE,OAAO;EACP,UAAU;CACX,CAAC;CAED,IAAI,MAAM,UACT,MAAM,MAAM;CAmBb,OAAO;EAAE,eAhBa,qBAAqB;GAC1C,mBAAmB;GAEnB,SAAS;IACR,OAAO;IACP,UAAU;GACX,CAAC;EACF,CASqB;EAAG,cAPH,gBAAgB,UAAkB;GACtD,SAAS;IACR;IACA,UAAU;GACX,CAAC;EACF,CAEmC;CAAE;AACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"for-DGTMIS0w.js","names":[],"sources":["../../src/components/common/for/for.tsx","../../src/components/common/for/getElementList.ts"],"sourcesContent":["import type {\n\tDiscriminatedRenderItemProps,\n\tPolymorphicPropsStrict,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, isNumber, type Prettify } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ArrayOrNumber = number | readonly unknown[];\n\ntype GetArrayItemType<TArray extends ArrayOrNumber> =\n\tTArray extends readonly unknown[] ? TArray[number]\n\t: TArray extends number ? number\n\t: unknown;\n\ntype RenderPropFn<TArray extends ArrayOrNumber> = (\n\titem: GetArrayItemType<TArray>,\n\tindex: number,\n\tarray: Array<GetArrayItemType<TArray>>\n) => React.ReactNode;\n\nexport type ForRenderProps<TArray extends ArrayOrNumber> = DiscriminatedRenderItemProps<\n\tRenderPropFn<TArray>\n>;\n\n/* eslint-disable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\nexport type ForProps<TArray extends ArrayOrNumber> = Prettify<\n\t{\n\t\teach: TArray;\n\t\tfallback?: React.ReactNode;\n\t} & ForRenderProps<TArray>\n>;\n/* eslint-enable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\n\nconst isArrayEmpty = <TArray extends ArrayOrNumber>(each: TArray) => {\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\treturn each == null || (isNumber(each) && each === 0) || (isArray(each) && each.length === 0);\n};\n\nexport function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>) {\n\tconst { children, each, fallback = null, renderItem } = props;\n\n\tif (isArrayEmpty(each)) {\n\t\treturn fallback;\n\t}\n\n\tconst resolvedArray = isNumber(each) ? [...Array(each).keys()] : (each as unknown[]);\n\n\tconst selectedChildren = typeof children === \"function\" ? children : renderItem;\n\n\tconst elementList = resolvedArray.map((...params) => {\n\t\ttype Params = Parameters<RenderPropFn<TArray>>;\n\n\t\treturn selectedChildren(...(params as Params));\n\t});\n\n\treturn elementList;\n}\n\nexport type ForWithWrapperProps<\n\tTArray extends ArrayOrNumber,\n\tTElement extends React.ElementType = \"ul\",\n> = PolymorphicPropsStrict<TElement, ForProps<TArray>> & { displayFallBackWhenEmpty?: boolean };\n\nexport function ForWithWrapper<\n\tconst TArray extends ArrayOrNumber,\n\tTElement extends React.ElementType = \"ul\",\n>(props: ForWithWrapperProps<TArray, TElement>) {\n\tconst {\n\t\tas: ListContainer = \"ul\",\n\t\tchildren,\n\t\tdisplayFallBackWhenEmpty = false,\n\t\teach,\n\t\tfallback = null,\n\t\trenderItem,\n\t\t...restOfProps\n\t} = props;\n\n\tif (displayFallBackWhenEmpty && isArrayEmpty(each)) {\n\t\treturn fallback;\n\t}\n\n\treturn (\n\t\t<ListContainer {...restOfProps}>\n\t\t\t<For {...({ children, each, fallback, renderItem } as ForProps<TArray>)} />\n\t\t</ListContainer>\n\t);\n}\n","import { For, ForWithWrapper } from \"./for\";\n\ntype GetElementListResult<TVariant extends \"base\" | \"withWrapper\"> =\n\tTVariant extends \"base\" ? [typeof For] : [typeof ForWithWrapper];\n\nconst getElementList = <TVariant extends \"base\" | \"withWrapper\" = \"withWrapper\">(\n\tvariant?: TVariant\n): GetElementListResult<TVariant> => {\n\tswitch (variant) {\n\t\tcase \"base\": {\n\t\t\treturn [For] as never;\n\t\t}\n\t\tcase \"withWrapper\": {\n\t\t\treturn [ForWithWrapper] as never;\n\t\t}\n\t\tdefault: {\n\t\t\treturn [ForWithWrapper] as never;\n\t\t}\n\t}\n};\n\nexport { getElementList };\n"],"mappings":";;;AAgCA,MAAM,gBAA8C,SAAiB;AAEpE,QAAO,QAAQ,QAAS,SAAS,KAAK,IAAI,SAAS,KAAO,QAAQ,KAAK,IAAI,KAAK,WAAW;;AAG5F,SAAgB,IAAwC,OAAyB;CAChF,MAAM,EAAE,UAAU,MAAM,WAAW,MAAM,eAAe;AAExD,KAAI,aAAa,KAAK,CACrB,QAAO;CAGR,MAAM,gBAAgB,SAAS,KAAK,GAAG,CAAC,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,GAAI;CAElE,MAAM,mBAAmB,OAAO,aAAa,aAAa,WAAW;AAQrE,QANoB,cAAc,KAAK,GAAG,WAAW;AAGpD,SAAO,iBAAiB,GAAI,OAAkB;GAG7B;;AAQnB,SAAgB,eAGd,OAA8C;CAC/C,MAAM,EACL,IAAI,gBAAgB,MACpB,UACA,2BAA2B,OAC3B,MACA,WAAW,MACX,YACA,GAAG,gBACA;AAEJ,KAAI,4BAA4B,aAAa,KAAK,CACjD,QAAO;AAGR,QACC,oBAAC,eAAD;EAAe,GAAI;YAClB,oBAAC,KAAD;GAAY;GAAU;GAAM;GAAU;GAAqC,CAAA;EAC5D,CAAA;;;;AC9ElB,MAAM,kBACL,YACoC;AACpC,SAAQ,SAAR;EACC,KAAK,OACJ,QAAO,CAAC,IAAI;EAEb,KAAK,cACJ,QAAO,CAAC,eAAe;EAExB,QACC,QAAO,CAAC,eAAe"}
1
+ {"version":3,"file":"for-DGTMIS0w.js","names":[],"sources":["../../src/components/common/for/for.tsx","../../src/components/common/for/getElementList.ts"],"sourcesContent":["import type {\n\tDiscriminatedRenderItemProps,\n\tPolymorphicPropsStrict,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, isNumber, type Prettify } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ArrayOrNumber = number | readonly unknown[];\n\ntype GetArrayItemType<TArray extends ArrayOrNumber> =\n\tTArray extends readonly unknown[] ? TArray[number]\n\t: TArray extends number ? number\n\t: unknown;\n\ntype RenderPropFn<TArray extends ArrayOrNumber> = (\n\titem: GetArrayItemType<TArray>,\n\tindex: number,\n\tarray: Array<GetArrayItemType<TArray>>\n) => React.ReactNode;\n\nexport type ForRenderProps<TArray extends ArrayOrNumber> = DiscriminatedRenderItemProps<\n\tRenderPropFn<TArray>\n>;\n\n/* eslint-disable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\nexport type ForProps<TArray extends ArrayOrNumber> = Prettify<\n\t{\n\t\teach: TArray;\n\t\tfallback?: React.ReactNode;\n\t} & ForRenderProps<TArray>\n>;\n/* eslint-enable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\n\nconst isArrayEmpty = <TArray extends ArrayOrNumber>(each: TArray) => {\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\treturn each == null || (isNumber(each) && each === 0) || (isArray(each) && each.length === 0);\n};\n\nexport function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>) {\n\tconst { children, each, fallback = null, renderItem } = props;\n\n\tif (isArrayEmpty(each)) {\n\t\treturn fallback;\n\t}\n\n\tconst resolvedArray = isNumber(each) ? [...Array(each).keys()] : (each as unknown[]);\n\n\tconst selectedChildren = typeof children === \"function\" ? children : renderItem;\n\n\tconst elementList = resolvedArray.map((...params) => {\n\t\ttype Params = Parameters<RenderPropFn<TArray>>;\n\n\t\treturn selectedChildren(...(params as Params));\n\t});\n\n\treturn elementList;\n}\n\nexport type ForWithWrapperProps<\n\tTArray extends ArrayOrNumber,\n\tTElement extends React.ElementType = \"ul\",\n> = PolymorphicPropsStrict<TElement, ForProps<TArray>> & { displayFallBackWhenEmpty?: boolean };\n\nexport function ForWithWrapper<\n\tconst TArray extends ArrayOrNumber,\n\tTElement extends React.ElementType = \"ul\",\n>(props: ForWithWrapperProps<TArray, TElement>) {\n\tconst {\n\t\tas: ListContainer = \"ul\",\n\t\tchildren,\n\t\tdisplayFallBackWhenEmpty = false,\n\t\teach,\n\t\tfallback = null,\n\t\trenderItem,\n\t\t...restOfProps\n\t} = props;\n\n\tif (displayFallBackWhenEmpty && isArrayEmpty(each)) {\n\t\treturn fallback;\n\t}\n\n\treturn (\n\t\t<ListContainer {...restOfProps}>\n\t\t\t<For {...({ children, each, fallback, renderItem } as ForProps<TArray>)} />\n\t\t</ListContainer>\n\t);\n}\n","import { For, ForWithWrapper } from \"./for\";\n\ntype GetElementListResult<TVariant extends \"base\" | \"withWrapper\"> =\n\tTVariant extends \"base\" ? [typeof For] : [typeof ForWithWrapper];\n\nconst getElementList = <TVariant extends \"base\" | \"withWrapper\" = \"withWrapper\">(\n\tvariant?: TVariant\n): GetElementListResult<TVariant> => {\n\tswitch (variant) {\n\t\tcase \"base\": {\n\t\t\treturn [For] as never;\n\t\t}\n\t\tcase \"withWrapper\": {\n\t\t\treturn [ForWithWrapper] as never;\n\t\t}\n\t\tdefault: {\n\t\t\treturn [ForWithWrapper] as never;\n\t\t}\n\t}\n};\n\nexport { getElementList };\n"],"mappings":";;;AAgCA,MAAM,gBAA8C,SAAiB;CAEpE,OAAO,QAAQ,QAAS,SAAS,IAAI,KAAK,SAAS,KAAO,QAAQ,IAAI,KAAK,KAAK,WAAW;AAC5F;AAEA,SAAgB,IAAwC,OAAyB;CAChF,MAAM,EAAE,UAAU,MAAM,WAAW,MAAM,eAAe;CAExD,IAAI,aAAa,IAAI,GACpB,OAAO;CAGR,MAAM,gBAAgB,SAAS,IAAI,IAAI,CAAC,GAAG,MAAM,IAAI,EAAE,KAAK,CAAC,IAAK;CAElE,MAAM,mBAAmB,OAAO,aAAa,aAAa,WAAW;CAQrE,OANoB,cAAc,KAAK,GAAG,WAAW;EAGpD,OAAO,iBAAiB,GAAI,MAAiB;CAC9C,CAEiB;AAClB;AAOA,SAAgB,eAGd,OAA8C;CAC/C,MAAM,EACL,IAAI,gBAAgB,MACpB,UACA,2BAA2B,OAC3B,MACA,WAAW,MACX,YACA,GAAG,gBACA;CAEJ,IAAI,4BAA4B,aAAa,IAAI,GAChD,OAAO;CAGR,OACC,oBAAC,eAAD;EAAe,GAAI;YAClB,oBAAC,KAAD;GAAY;GAAU;GAAM;GAAU;EAAoC,CAAA;CAC5D,CAAA;AAEjB;;;AChFA,MAAM,kBACL,YACoC;CACpC,QAAQ,SAAR;EACC,KAAK,QACJ,OAAO,CAAC,GAAG;EAEZ,KAAK,eACJ,OAAO,CAAC,cAAc;EAEvB,SACC,OAAO,CAAC,cAAc;CAExB;AACD"}
@@ -1,7 +1,4 @@
1
- import * as _$react from "react";
2
1
  import { Component } from "react";
3
- import * as _$_zayne_labs_toolkit_react0 from "@zayne-labs/toolkit-react";
4
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
2
 
6
3
  //#region src/components/common/error-boundary/types.d.ts
7
4
  type ErrorFallbackRenderProps = {
@@ -49,14 +46,14 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
49
46
  };
50
47
  componentDidCatch(error: Error, info: React.ErrorInfo): void;
51
48
  componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
52
- render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | null | undefined;
49
+ render(): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
53
50
  }
54
51
  //#endregion
55
52
  //#region src/components/common/error-boundary/error-boundary-context.d.ts
56
53
  type ErrorBoundaryContextType = ErrorFallbackRenderProps & {
57
54
  hasError: boolean;
58
55
  };
59
- declare const ErrorBoundaryContext: _$react.Context<ErrorBoundaryContextType>, useErrorBoundaryContext: _$_zayne_labs_toolkit_react0.UseCustomContext<ErrorBoundaryContextType, true>;
56
+ declare const ErrorBoundaryContext: import("react").Context<ErrorBoundaryContextType>, useErrorBoundaryContext: import("@zayne-labs/toolkit-react").UseCustomContext<ErrorBoundaryContextType, true>;
60
57
  //#endregion
61
58
  //#region src/components/common/error-boundary/useErrorBoundary.d.ts
62
59
  declare const useErrorBoundary: <TError extends Error>() => {
@@ -69,4 +66,4 @@ type UseErrorBoundaryReturn = {
69
66
  };
70
67
  //#endregion
71
68
  export { ErrorBoundary as a, useErrorBoundaryContext as i, useErrorBoundary as n, ErrorBoundaryProps as o, ErrorBoundaryContextType as r, ErrorFallbackRenderProps as s, UseErrorBoundaryReturn as t };
72
- //# sourceMappingURL=index-DgA9ry9R.d.ts.map
69
+ //# sourceMappingURL=index-CUmHEGwU.d.ts.map
@@ -1,10 +1,9 @@
1
- import { o as ErrorBoundaryProps } from "./index-DgA9ry9R.js";
1
+ import { o as ErrorBoundaryProps } from "./index-CUmHEGwU.js";
2
2
  import { SuspenseProps } from "react";
3
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
3
 
5
4
  //#region src/components/common/suspense-with-boundary/suspense-with-boundary.d.ts
6
5
  type SuspenseWithBoundaryProps = ErrorBoundaryProps & SuspenseProps;
7
- declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): _$react_jsx_runtime0.JSX.Element;
6
+ declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): import("react/jsx-runtime").JSX.Element;
8
7
  //#endregion
9
8
  export { SuspenseWithBoundaryProps as n, SuspenseWithBoundary as t };
10
- //# sourceMappingURL=index-BXWyFo6R.d.ts.map
9
+ //# sourceMappingURL=index-Dvg4OLWa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"presence-DDuEcp1q.js","names":["Slot.Root"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { 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 PresencePropGetters = {\n\tgetPresenceProps: (innerProps: InferProps<HTMLElement>) => InferProps<HTMLElement>;\n};\n\nexport type UsePresenceResult = {\n\tisMounted: boolean;\n\tisTransitionComplete: boolean;\n\tpropGetters: PresencePropGetters;\n\tref: React.Ref<HTMLElement>;\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 [isTransitionComplete, toggleIsTransitionComplete] = useToggle(false);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevNodeStateRef = useRef({\n\t\tprevAnimationName: \"none\",\n\t\tprevPresent: presentProp,\n\t});\n\n\tconst initialState = presentProp ? \"mounted\" : \"unmounted\";\n\n\tconst [mountState, 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 =\n\t\t\tmountState === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [mountState]);\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(() => toggleIsTransitionComplete(true));\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node): {\n\t\t\t\tif (variant === \"animation\") {\n\t\t\t\t\tconst hasAnimation = currentAnimationName !== \"none\" && styles?.display !== \"none\";\n\n\t\t\t\t\t/**\n\t\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t\t * computed styles) because there is no `animationrun` event (like the `transitionrun` event) and `animationstart`\n\t\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t\t */\n\n\t\t\t\t\tconst isAnimationStarted = hasAnimation && prevAnimationName !== currentAnimationName;\n\n\t\t\t\t\tconst isAnimatingOut = wasPresent && isAnimationStarted;\n\n\t\t\t\t\tsend(isAnimatingOut ? \"ANIMATION_OUT\" : \"UNMOUNT\");\n\t\t\t\t}\n\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, toggleIsTransitionComplete]);\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\tconst setupAnimationListeners = () => {\n\t\t\tlet timeoutId: number;\n\n\t\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t\tprevNodeStateRef.current.prevAnimationName = getAnimationName(stylesRef.current);\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t\t */\n\t\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\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\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t\t// user-provided event handlers would not be called.\n\t\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\t\tif (!prevNodeStateRef.current.prevPresent) {\n\t\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\t\t// eslint-disable-next-line react/immutability -- Ignore\n\t\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t\t// still causes a flash.\n\t\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\t\t// eslint-disable-next-line react/immutability -- Ignore\n\t\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t\t}\n\t\t\t\t\t}) as never;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst onAnimationStartCleanup = on(node, \"animationstart\", handleAnimationStart);\n\t\t\tconst onAnimationEndCleanup = on(node, \"animationend\", handleAnimationEnd);\n\t\t\tconst onAnimationCancelCleanup = on(node, \"animationcancel\", handleAnimationEnd);\n\n\t\t\tconst cleanup = () => {\n\t\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\t\tonAnimationStartCleanup();\n\t\t\t\tonAnimationEndCleanup();\n\t\t\t\tonAnimationCancelCleanup();\n\t\t\t};\n\n\t\t\treturn cleanup;\n\t\t};\n\n\t\tconst setupTransitionListeners = () => {\n\t\t\tconst handleTransitionRun = (event: TransitionEvent) => {\n\t\t\t\tconst isTargetTransitioningNode = event.target === node;\n\n\t\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\t\tsend(\"ANIMATION_OUT\");\n\t\t\t};\n\n\t\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\t\tconst isTargetTransitioningNode =\n\t\t\t\t\tevent.target === node && !prevNodeStateRef.current.prevPresent;\n\n\t\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\t\tsend(\"ANIMATION_END\");\n\t\t\t};\n\n\t\t\tconst onTransitionRunCleanup = on(node, \"transitionrun\", handleTransitionRun);\n\t\t\tconst onTransitionEndCleanup = on(node, \"transitionend\", handleTransitionEnd);\n\t\t\tconst onTransitionCancelCleanup = on(node, \"transitioncancel\", handleTransitionEnd);\n\n\t\t\tconst cleanup = () => {\n\t\t\t\tonTransitionRunCleanup();\n\t\t\t\tonTransitionEndCleanup();\n\t\t\t\tonTransitionCancelCleanup();\n\t\t\t};\n\n\t\t\treturn cleanup;\n\t\t};\n\n\t\tswitch (variant) {\n\t\t\tcase \"animation\": {\n\t\t\t\tconst cleanup = setupAnimationListeners();\n\n\t\t\t\treturn cleanup;\n\t\t\t}\n\n\t\t\tcase \"transition\": {\n\t\t\t\tconst cleanup = setupTransitionListeners();\n\n\t\t\t\treturn cleanup;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tvariant satisfies never;\n\t\t\t\tthrow new Error(`Invalid variant: ${variant}`);\n\t\t\t}\n\t\t}\n\t}, [node, send, variant]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = !presentProp && mountState === \"unmounted\";\n\n\t\tif (isExitCompleted) {\n\t\t\ttoggleIsTransitionComplete(false);\n\t\t\tstableOnExitComplete?.();\n\t\t}\n\t}, [mountState, presentProp, stableOnExitComplete, toggleIsTransitionComplete]);\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 mountState>;\n\tconst isMounted = MOUNTED_STATES.includes(mountState);\n\tconst transitionPhase = presentProp && isTransitionComplete ? \"enter\" : \"exit\";\n\tconst animationPhase = presentProp ? \"enter\" : \"exit\";\n\n\tconst getPresenceProps: PresencePropGetters[\"getPresenceProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t\"data-mounted\": isMounted,\n\t\t\t\t\"data-present\": presentProp,\n\t\t\t\t\"data-variant\": variant,\n\t\t\t\t...(variant === \"animation\" && { \"data-animation-phase\": animationPhase }),\n\t\t\t\t...(variant === \"transition\" && { \"data-transition-phase\": transitionPhase }),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: innerProps.className,\n\t\t\t};\n\t\t},\n\t\t[animationPhase, isMounted, presentProp, transitionPhase, variant]\n\t);\n\n\tconst propGetters = useMemo(\n\t\t() => ({\n\t\t\tgetPresenceProps,\n\t\t}),\n\t\t[getPresenceProps]\n\t);\n\n\tconst result = useMemo<UsePresenceResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tisMounted,\n\t\t\t\tisTransitionComplete,\n\t\t\t\tpropGetters,\n\t\t\t\tref,\n\t\t\t}) satisfies UsePresenceResult,\n\t\t[isMounted, isTransitionComplete, propGetters, ref]\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\t& Pick<UsePresenceOptions, \"present\">;\n\nexport type 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\tisMounted,\n\t\tisTransitionComplete,\n\t\tpropGetters,\n\t\tref: presenceRef,\n\t} = usePresence({ onExitComplete, present, variant });\n\n\tconst context = {\n\t\tisMounted,\n\t\tisTransitionComplete,\n\t\tpresent,\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\" ? isMounted || isTransitionComplete : isMounted);\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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A;EACA;EACA;EACA,GACF;EAAC;EAAW;EAAsB;EAAa;EAAI,CAGvC;;;;ACtTd,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,WAAW,aAAa,OAAO,gBAAgB,SAAS,YAAY;CAEtF,MAAM,EACL,WACA,sBACA,aACA,KAAK,gBACF,YAAY;EAAE;EAAgB;EAAS;EAAS,CAAC;CAErD,MAAM,UAAU;EACf;EACA;EACA;EACA;CAED,MAAM,gBAAgB,WAAW,SAAS,GAAG,SAAS,QAAQ,GAAG;CAKjE,MAAM,MAAM,eAAe,aAHT,eAAe,MAAM,OAClC,cAA2C,IAEC;AAKjD,KAAI,EAFH,eAAe,YAAY,eAAe,aAAa,uBAAuB,YAG9E,QAAO;AAGR,QACC,oBAACA,UAAD;EAAgB;EAAK,GAAI,YAAY,iBAAiB,EAAE,WAAW,CAAC;YAClE;EACU,CAAA"}
1
+ {"version":3,"file":"presence-DDuEcp1q.js","names":["Slot.Root"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { 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 PresencePropGetters = {\n\tgetPresenceProps: (innerProps: InferProps<HTMLElement>) => InferProps<HTMLElement>;\n};\n\nexport type UsePresenceResult = {\n\tisMounted: boolean;\n\tisTransitionComplete: boolean;\n\tpropGetters: PresencePropGetters;\n\tref: React.Ref<HTMLElement>;\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 [isTransitionComplete, toggleIsTransitionComplete] = useToggle(false);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevNodeStateRef = useRef({\n\t\tprevAnimationName: \"none\",\n\t\tprevPresent: presentProp,\n\t});\n\n\tconst initialState = presentProp ? \"mounted\" : \"unmounted\";\n\n\tconst [mountState, 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 =\n\t\t\tmountState === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [mountState]);\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(() => toggleIsTransitionComplete(true));\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node): {\n\t\t\t\tif (variant === \"animation\") {\n\t\t\t\t\tconst hasAnimation = currentAnimationName !== \"none\" && styles?.display !== \"none\";\n\n\t\t\t\t\t/**\n\t\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t\t * computed styles) because there is no `animationrun` event (like the `transitionrun` event) and `animationstart`\n\t\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t\t */\n\n\t\t\t\t\tconst isAnimationStarted = hasAnimation && prevAnimationName !== currentAnimationName;\n\n\t\t\t\t\tconst isAnimatingOut = wasPresent && isAnimationStarted;\n\n\t\t\t\t\tsend(isAnimatingOut ? \"ANIMATION_OUT\" : \"UNMOUNT\");\n\t\t\t\t}\n\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, toggleIsTransitionComplete]);\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\tconst setupAnimationListeners = () => {\n\t\t\tlet timeoutId: number;\n\n\t\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t\tprevNodeStateRef.current.prevAnimationName = getAnimationName(stylesRef.current);\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t\t */\n\t\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\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\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t\t// user-provided event handlers would not be called.\n\t\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\t\tif (!prevNodeStateRef.current.prevPresent) {\n\t\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\t\t// eslint-disable-next-line react/immutability -- Ignore\n\t\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t\t// still causes a flash.\n\t\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\t\t// eslint-disable-next-line react/immutability -- Ignore\n\t\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t\t}\n\t\t\t\t\t}) as never;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst onAnimationStartCleanup = on(node, \"animationstart\", handleAnimationStart);\n\t\t\tconst onAnimationEndCleanup = on(node, \"animationend\", handleAnimationEnd);\n\t\t\tconst onAnimationCancelCleanup = on(node, \"animationcancel\", handleAnimationEnd);\n\n\t\t\tconst cleanup = () => {\n\t\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\t\tonAnimationStartCleanup();\n\t\t\t\tonAnimationEndCleanup();\n\t\t\t\tonAnimationCancelCleanup();\n\t\t\t};\n\n\t\t\treturn cleanup;\n\t\t};\n\n\t\tconst setupTransitionListeners = () => {\n\t\t\tconst handleTransitionRun = (event: TransitionEvent) => {\n\t\t\t\tconst isTargetTransitioningNode = event.target === node;\n\n\t\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\t\tsend(\"ANIMATION_OUT\");\n\t\t\t};\n\n\t\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\t\tconst isTargetTransitioningNode =\n\t\t\t\t\tevent.target === node && !prevNodeStateRef.current.prevPresent;\n\n\t\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\t\tsend(\"ANIMATION_END\");\n\t\t\t};\n\n\t\t\tconst onTransitionRunCleanup = on(node, \"transitionrun\", handleTransitionRun);\n\t\t\tconst onTransitionEndCleanup = on(node, \"transitionend\", handleTransitionEnd);\n\t\t\tconst onTransitionCancelCleanup = on(node, \"transitioncancel\", handleTransitionEnd);\n\n\t\t\tconst cleanup = () => {\n\t\t\t\tonTransitionRunCleanup();\n\t\t\t\tonTransitionEndCleanup();\n\t\t\t\tonTransitionCancelCleanup();\n\t\t\t};\n\n\t\t\treturn cleanup;\n\t\t};\n\n\t\tswitch (variant) {\n\t\t\tcase \"animation\": {\n\t\t\t\tconst cleanup = setupAnimationListeners();\n\n\t\t\t\treturn cleanup;\n\t\t\t}\n\n\t\t\tcase \"transition\": {\n\t\t\t\tconst cleanup = setupTransitionListeners();\n\n\t\t\t\treturn cleanup;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tvariant satisfies never;\n\t\t\t\tthrow new Error(`Invalid variant: ${variant}`);\n\t\t\t}\n\t\t}\n\t}, [node, send, variant]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = !presentProp && mountState === \"unmounted\";\n\n\t\tif (isExitCompleted) {\n\t\t\ttoggleIsTransitionComplete(false);\n\t\t\tstableOnExitComplete?.();\n\t\t}\n\t}, [mountState, presentProp, stableOnExitComplete, toggleIsTransitionComplete]);\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 mountState>;\n\tconst isMounted = MOUNTED_STATES.includes(mountState);\n\tconst transitionPhase = presentProp && isTransitionComplete ? \"enter\" : \"exit\";\n\tconst animationPhase = presentProp ? \"enter\" : \"exit\";\n\n\tconst getPresenceProps: PresencePropGetters[\"getPresenceProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t\"data-mounted\": isMounted,\n\t\t\t\t\"data-present\": presentProp,\n\t\t\t\t\"data-variant\": variant,\n\t\t\t\t...(variant === \"animation\" && { \"data-animation-phase\": animationPhase }),\n\t\t\t\t...(variant === \"transition\" && { \"data-transition-phase\": transitionPhase }),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: innerProps.className,\n\t\t\t};\n\t\t},\n\t\t[animationPhase, isMounted, presentProp, transitionPhase, variant]\n\t);\n\n\tconst propGetters = useMemo(\n\t\t() => ({\n\t\t\tgetPresenceProps,\n\t\t}),\n\t\t[getPresenceProps]\n\t);\n\n\tconst result = useMemo<UsePresenceResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tisMounted,\n\t\t\t\tisTransitionComplete,\n\t\t\t\tpropGetters,\n\t\t\t\tref,\n\t\t\t}) satisfies UsePresenceResult,\n\t\t[isMounted, isTransitionComplete, propGetters, ref]\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\t& Pick<UsePresenceOptions, \"present\">;\n\nexport type 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\tisMounted,\n\t\tisTransitionComplete,\n\t\tpropGetters,\n\t\tref: presenceRef,\n\t} = usePresence({ onExitComplete, present, variant });\n\n\tconst context = {\n\t\tisMounted,\n\t\tisTransitionComplete,\n\t\tpresent,\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\" ? isMounted || isTransitionComplete : isMounted);\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":";;;;;;;AAUA,MAAM,mBACL,WACI;CACJ,MAAM,WAAW,WAAmB,UAA0B;EAG7D,OAFiB,OAAO,OAAO,WAAW,UAAU;CAGrD;CAEA,OAAO,WAAW,SAAS,OAAO,OAAO;AAC1C;AAEA,MAAM,oBAAoB,WAAuC,QAAQ,iBAAiB;;;;;AA2B1F,MAAM,eAAe,YAAmD;CACvE,MAAM,EAAE,gBAAgB,SAAS,aAAa,UAAU,gBAAgB;CAExE,MAAM,uBAAuB,eAAe,cAAc;CAE1D,MAAM,CAAC,MAAM,WAAW,SAA6B,IAAI;CAEzD,MAAM,CAAC,sBAAsB,8BAA8B,UAAU,KAAK;CAE1E,MAAM,YAAY,OAAmC,IAAI;CAEzD,MAAM,mBAAmB,OAAO;EAC/B,mBAAmB;EACnB,aAAa;CACd,CAAC;CAID,MAAM,CAAC,YAAY,QAAQ,gBAAgB;EAC1C,SAHoB,cAAc,YAAY;EAI9C,QAAQ;GACP,SAAS;IACR,eAAe;IACf,SAAS;GACV;GACA,WAAW,EACV,OAAO,UACR;GACA,kBAAkB;IACjB,eAAe;IACf,OAAO;GACR;EACD;CACD,CAAC;CAED,gBAAgB;EACf,MAAM,uBAAuB,iBAAiB,UAAU,OAAO;EAE/D,iBAAiB,QAAQ,oBACxB,eAAe,YAAY,uBAAuB;CACpD,GAAG,CAAC,UAAU,CAAC;CAEf,sBAAsB;EACrB,MAAM,SAAS,UAAU;EACzB,MAAM,aAAa,iBAAiB,QAAQ;EAG5C,IAAI,EAFsB,eAAe,cAEjB;EAExB,MAAM,oBAAoB,iBAAiB,QAAQ;EACnD,MAAM,uBAAuB,iBAAi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AY,eAAe,EAAE,wBAAwB,eAAe;GACxE,GAAI,YAAY,gBAAgB,EAAE,yBAAyB,gBAAgB;GAC3E,GAAG;GACH,WAAW,WAAW;EACvB;CACD,GACA;EAAC;EAAgB;EAAW;EAAa;EAAiB;CAAO,CAClE;CAEA,MAAM,cAAc,eACZ,EACN,iBACD,IACA,CAAC,gBAAgB,CAClB;CAaA,OAXe,eAEZ;EACA;EACA;EACA;EACA;CACD,IACD;EAAC;EAAW;EAAsB;EAAa;CAAG,CAGvC;AACb;;;ACvTA,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,WAAW,aAAa,OAAO,gBAAgB,SAAS,YAAY;CAEtF,MAAM,EACL,WACA,sBACA,aACA,KAAK,gBACF,YAAY;EAAE;EAAgB;EAAS;CAAQ,CAAC;CAEpD,MAAM,UAAU;EACf;EACA;EACA;CACD;CAEA,MAAM,gBAAgB,WAAW,QAAQ,IAAI,SAAS,OAAO,IAAI;CAKjE,MAAM,MAAM,eAAe,aAHT,eAAe,MAAM,OAClC,cAA2C,GAEA;CAKhD,IAAI,EAFH,eAAe,YAAY,eAAe,aAAa,uBAAuB,aAG9E,OAAO;CAGR,OACC,oBAACA,UAAD;EAAgB;EAAK,GAAI,YAAY,iBAAiB,EAAE,UAAU,CAAC;YACjE;CACS,CAAA;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"show-CMxdpPiN.js","names":[],"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { getMultipleSlots, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport type ShowRootProps<TWhen> =\n\t| {\n\t\t\tchildren: React.ReactNode;\n\t\t\tcontrol: \"content\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen?: never;\n\t }\n\t| {\n\t\t\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\t\t\tcontrol?: \"root\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen: false | TWhen | null | undefined;\n\t };\n\nexport function ShowRoot<TWhen>(props: ShowRootProps<TWhen>) {\n\tconst { children, control = \"root\", fallback = null, when } = props;\n\n\tif (control === \"content\" && !isFunction(children)) {\n\t\tconst childrenArray = toArray(children) as Array<React.ReactElement<ShowContentProps<TWhen>>>;\n\n\t\tconst foundContentSlot = childrenArray.find((child) => Boolean(child.props.when));\n\n\t\tconst fallBackSlot = getSingleSlot(childrenArray, ShowFallback);\n\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn foundContentSlot ?? fallBackSlot ?? fallback;\n\t}\n\n\tconst resolvedChildren = isFunction(children) ? when && children(when) : children;\n\n\tconst {\n\t\tregularChildren,\n\t\tslots: [contentSlot, fallBackSlot],\n\t} = getMultipleSlots(resolvedChildren, [ShowContent, ShowFallback], {\n\t\terrorMessage: [\n\t\t\t\"Only one <Show.Content> component is allowed\",\n\t\t\t\"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t],\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tif (!when) {\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\treturn contentSlot ?? regularChildren;\n}\n\nexport type ShowContentProps<TWhen> = Pick<ShowRootProps<TWhen>, \"children\" | \"when\">;\n\nexport function ShowContent<TWhen>(props: ShowContentProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\nShowContent.slotSymbol = Symbol(\"show-content\");\n\nexport function ShowFallback(props: { children: React.ReactNode }) {\n\tconst { children } = props;\n\n\treturn children;\n}\nShowFallback.slotSymbol = Symbol(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as Otherwise,\n\tShowRoot as Root,\n} from \"./show\";\n"],"mappings":";;;;;AAoBA,SAAgB,SAAgB,OAA6B;CAC5D,MAAM,EAAE,UAAU,UAAU,QAAQ,WAAW,MAAM,SAAS;AAE9D,KAAI,YAAY,aAAa,CAAC,WAAW,SAAS,EAAE;EACnD,MAAM,gBAAgB,QAAQ,SAAS;EAEvC,MAAM,mBAAmB,cAAc,MAAM,UAAU,QAAQ,MAAM,MAAM,KAAK,CAAC;EAEjF,MAAM,eAAe,cAAc,eAAe,aAAa;AAE/D,SACC,EAAE,gBAAgB,WAClB,yEACA;AAED,SAAO,oBAAoB,gBAAgB;;CAK5C,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,kBAClB,iBALqB,WAAW,SAAS,GAAG,QAAQ,SAAS,KAAK,GAAG,UAKlC,CAAC,aAAa,aAAa,EAAE;EACnE,cAAc,CACb,gDACA,oEACA;EACD,0BAA0B;EAC1B,CAAC;AAEF,KAAI,CAAC,MAAM;AACV,SACC,EAAE,gBAAgB,WAClB,yEACA;AAED,SAAO,gBAAgB;;AAGxB,QAAO,eAAe;;AAKvB,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;AAI3B,QAFyB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;;AAI3E,YAAY,aAAa,OAAO,eAAe;AAE/C,SAAgB,aAAa,OAAsC;CAClE,MAAM,EAAE,aAAa;AAErB,QAAO;;AAER,aAAa,aAAa,OAAO,gBAAgB"}
1
+ {"version":3,"file":"show-CMxdpPiN.js","names":[],"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { getMultipleSlots, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport type ShowRootProps<TWhen> =\n\t| {\n\t\t\tchildren: React.ReactNode;\n\t\t\tcontrol: \"content\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen?: never;\n\t }\n\t| {\n\t\t\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\t\t\tcontrol?: \"root\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen: false | TWhen | null | undefined;\n\t };\n\nexport function ShowRoot<TWhen>(props: ShowRootProps<TWhen>) {\n\tconst { children, control = \"root\", fallback = null, when } = props;\n\n\tif (control === \"content\" && !isFunction(children)) {\n\t\tconst childrenArray = toArray(children) as Array<React.ReactElement<ShowContentProps<TWhen>>>;\n\n\t\tconst foundContentSlot = childrenArray.find((child) => Boolean(child.props.when));\n\n\t\tconst fallBackSlot = getSingleSlot(childrenArray, ShowFallback);\n\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn foundContentSlot ?? fallBackSlot ?? fallback;\n\t}\n\n\tconst resolvedChildren = isFunction(children) ? when && children(when) : children;\n\n\tconst {\n\t\tregularChildren,\n\t\tslots: [contentSlot, fallBackSlot],\n\t} = getMultipleSlots(resolvedChildren, [ShowContent, ShowFallback], {\n\t\terrorMessage: [\n\t\t\t\"Only one <Show.Content> component is allowed\",\n\t\t\t\"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t],\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tif (!when) {\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\treturn contentSlot ?? regularChildren;\n}\n\nexport type ShowContentProps<TWhen> = Pick<ShowRootProps<TWhen>, \"children\" | \"when\">;\n\nexport function ShowContent<TWhen>(props: ShowContentProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\nShowContent.slotSymbol = Symbol(\"show-content\");\n\nexport function ShowFallback(props: { children: React.ReactNode }) {\n\tconst { children } = props;\n\n\treturn children;\n}\nShowFallback.slotSymbol = Symbol(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as Otherwise,\n\tShowRoot as Root,\n} from \"./show\";\n"],"mappings":";;;;;AAoBA,SAAgB,SAAgB,OAA6B;CAC5D,MAAM,EAAE,UAAU,UAAU,QAAQ,WAAW,MAAM,SAAS;CAE9D,IAAI,YAAY,aAAa,CAAC,WAAW,QAAQ,GAAG;EACnD,MAAM,gBAAgB,QAAQ,QAAQ;EAEtC,MAAM,mBAAmB,cAAc,MAAM,UAAU,QAAQ,MAAM,MAAM,IAAI,CAAC;EAEhF,MAAM,eAAe,cAAc,eAAe,YAAY;EAE9D,OACC,EAAE,gBAAgB,WAClB,wEACD;EAEA,OAAO,oBAAoB,gBAAgB;CAC5C;CAIA,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,kBAClB,iBALqB,WAAW,QAAQ,IAAI,QAAQ,SAAS,IAAI,IAAI,UAKlC,CAAC,aAAa,YAAY,GAAG;EACnE,cAAc,CACb,gDACA,mEACD;EACA,0BAA0B;CAC3B,CAAC;CAED,IAAI,CAAC,MAAM;EACV,OACC,EAAE,gBAAgB,WAClB,wEACD;EAEA,OAAO,gBAAgB;CACxB;CAEA,OAAO,eAAe;AACvB;AAIA,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;CAI3B,OAFyB,WAAW,QAAQ,IAAI,SAAS,IAAa,IAAI;AAG3E;AACA,YAAY,aAAa,OAAO,cAAc;AAE9C,SAAgB,aAAa,OAAsC;CAClE,MAAM,EAAE,aAAa;CAErB,OAAO;AACR;AACA,aAAa,aAAa,OAAO,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"slot-B2aEs2RU.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, mergeProps, type InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement> & { ref?: React.Ref<HTMLElement> };\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotRoot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (!slottable) {\n\t\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n\t}\n\n\tif (!isValidElement<SlotProps>(slottable)) {\n\t\treturn null;\n\t}\n\n\t// == The new element to render is the one passed as a child of `Slot.Slottable`\n\tconst childToRender = slottable.props.children;\n\n\tif (Children.count(childToRender) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChildToRender = isArray(childToRender) ? childToRender[0] : childToRender;\n\n\tif (!isValidElement(resolvedChildToRender)) {\n\t\tconsole.error(\"Invalid element passed to Slottable:\", resolvedChildToRender);\n\t\treturn null;\n\t}\n\n\tconst childToRenderChildren = childrenArray.map((child) => {\n\t\tif (child === slottable) {\n\t\t\t// == Because the new element will be the one rendered, we are only interested in grabbing its children (`childToRender.props.children`)\n\t\t\treturn (resolvedChildToRender.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t{cloneElement(resolvedChildToRender, undefined, childToRenderChildren)}\n\t\t</SlotClone>\n\t);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotSlottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === SlotSlottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * ----------------------------------------------------------------------------------------------- */\ntype SlotCloneProps = Pick<SlotProps, \"children\" | \"ref\">;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (Children.count(children) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChild = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\tconsole.error(\"Invalid element passed to Slot:\", resolvedChild);\n\t\treturn null;\n\t}\n\n\tconst childRef = resolvedChild.props.ref as React.Ref<HTMLElement>;\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t// eslint-disable-next-line react/refs -- Ignore\n\t\t...(resolvedChild.type !== ReactFragment && { ref: composeRefs(forwardedRef, childRef) }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;AAUA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,UAAU,GAAG,oBAAoB;CAEzC,MAAM,gBAAgB,QAAyB,SAAS,GAAG,WAAW,CAAC,SAAS;CAEhF,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY,QAAQ,CAAC;AAEvE,KAAI,CAAC,UACJ,QAAO,oBAAC,WAAD;EAAW,GAAI;EAAkB;EAAqB,CAAA;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,gBAAgB,UAAU,MAAM;AAEtC,KAAI,SAAS,MAAM,cAAc,GAAG,EACnC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,wBAAwB,QAAQ,cAAc,GAAG,cAAc,KAAK;AAE1E,KAAI,CAAC,eAAe,sBAAsB,EAAE;AAC3C,UAAQ,MAAM,wCAAwC,sBAAsB;AAC5E,SAAO;;CAGR,MAAM,wBAAwB,cAAc,KAAK,UAAU;AAC1D,MAAI,UAAU,UAEb,QAAQ,sBAAsB,MAAoB;AAGnD,SAAO;GACN;AAEF,QACC,oBAAC,WAAD;EAAW,GAAI;YACb,aAAa,uBAAuB,KAAA,GAAW,sBAAsB;EAC3D,CAAA;;AAQd,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAQhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,cAAc,GAAG,oBAAoB;AAE5D,KAAI,SAAS,MAAM,SAAS,GAAG,EAC9B,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,gBAAgB,QAAQ,SAAS,GAAG,SAAS,KAAK;AAExD,KAAI,CAAC,eAA8B,cAAc,EAAE;AAClD,UAAQ,MAAM,mCAAmC,cAAc;AAC/D,SAAO;;CAGR,MAAM,WAAW,cAAc,MAAM;AAQrC,QAAO,aAAa,eAAe;EALlC,GAAG,WAAW,iBAAiB,cAAc,MAAM;EAEnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK,YAAY,cAAc,SAAS,EAAE;EAG3C,CAAC"}
1
+ {"version":3,"file":"slot-B2aEs2RU.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, mergeProps, type InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement> & { ref?: React.Ref<HTMLElement> };\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotRoot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (!slottable) {\n\t\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n\t}\n\n\tif (!isValidElement<SlotProps>(slottable)) {\n\t\treturn null;\n\t}\n\n\t// == The new element to render is the one passed as a child of `Slot.Slottable`\n\tconst childToRender = slottable.props.children;\n\n\tif (Children.count(childToRender) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChildToRender = isArray(childToRender) ? childToRender[0] : childToRender;\n\n\tif (!isValidElement(resolvedChildToRender)) {\n\t\tconsole.error(\"Invalid element passed to Slottable:\", resolvedChildToRender);\n\t\treturn null;\n\t}\n\n\tconst childToRenderChildren = childrenArray.map((child) => {\n\t\tif (child === slottable) {\n\t\t\t// == Because the new element will be the one rendered, we are only interested in grabbing its children (`childToRender.props.children`)\n\t\t\treturn (resolvedChildToRender.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t{cloneElement(resolvedChildToRender, undefined, childToRenderChildren)}\n\t\t</SlotClone>\n\t);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotSlottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === SlotSlottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * ----------------------------------------------------------------------------------------------- */\ntype SlotCloneProps = Pick<SlotProps, \"children\" | \"ref\">;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (Children.count(children) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChild = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\tconsole.error(\"Invalid element passed to Slot:\", resolvedChild);\n\t\treturn null;\n\t}\n\n\tconst childRef = resolvedChild.props.ref as React.Ref<HTMLElement>;\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t// eslint-disable-next-line react/refs -- Ignore\n\t\t...(resolvedChild.type !== ReactFragment && { ref: composeRefs(forwardedRef, childRef) }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;AAUA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,UAAU,GAAG,oBAAoB;CAEzC,MAAM,gBAAgB,QAAyB,QAAQ,IAAI,WAAW,CAAC,QAAQ;CAE/E,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY,OAAO,CAAC;CAEtE,IAAI,CAAC,WACJ,OAAO,oBAAC,WAAD;EAAW,GAAI;EAAkB;CAAoB,CAAA;CAG7D,IAAI,CAAC,eAA0B,SAAS,GACvC,OAAO;CAIR,MAAM,gBAAgB,UAAU,MAAM;CAEtC,IAAI,SAAS,MAAM,aAAa,IAAI,GACnC,OAAO,SAAS,KAAK,IAAI;CAG1B,MAAM,wBAAwB,QAAQ,aAAa,IAAI,cAAc,KAAK;CAE1E,IAAI,CAAC,eAAe,qBAAqB,GAAG;EAC3C,QAAQ,MAAM,wCAAwC,qBAAqB;EAC3E,OAAO;CACR;CAEA,MAAM,wBAAwB,cAAc,KAAK,UAAU;EAC1D,IAAI,UAAU,WAEb,OAAQ,sBAAsB,MAAoB;EAGnD,OAAO;CACR,CAAC;CAED,OACC,oBAAC,WAAD;EAAW,GAAI;YACb,aAAa,uBAAuB,KAAA,GAAW,qBAAqB;CAC3D,CAAA;AAEb;AAMA,SAAgB,cAAc,EAAE,YAAyC;CACxE,OAAO;AACR;AAEA,MAAM,eAAe,UAAwD;CAC5E,OAAO,eAAe,KAAK,KAAK,MAAM,SAAS;AAChD;AAOA,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,cAAc,GAAG,oBAAoB;CAE5D,IAAI,SAAS,MAAM,QAAQ,IAAI,GAC9B,OAAO,SAAS,KAAK,IAAI;CAG1B,MAAM,gBAAgB,QAAQ,QAAQ,IAAI,SAAS,KAAK;CAExD,IAAI,CAAC,eAA8B,aAAa,GAAG;EAClD,QAAQ,MAAM,mCAAmC,aAAa;EAC9D,OAAO;CACR;CAEA,MAAM,WAAW,cAAc,MAAM;CAQrC,OAAO,aAAa,eAAe;EALlC,GAAG,WAAW,iBAAiB,cAAc,KAAK;EAElD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK,YAAY,cAAc,QAAQ,EAAE;CAG3C,CAAC;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"switch-Dwy5Gzsb.js","names":[],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;\n\nexport type SwitchRootProps<TValue> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tvalue?: TValue;\n};\n\nconst defaultValueSymbol = Symbol(\"default-value\");\n\n// TODO - Add a factory to make this 'when' and 'value' type-safe later following the link below\n// LINK - https://tkdodo.eu/blog/building-type-safe-compound-components#component-factory-pattern\nexport function SwitchRoot<TValue>(props: SwitchRootProps<TValue>) {\n\tconst { children, value = defaultValueSymbol } = props;\n\n\tconst defaultCase = getSingleSlot(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getRegularChildren(children, SwitchDefault) as ValidSwitchComponentType[];\n\n\tconst matchedCase = childrenCasesArray.find((child) => {\n\t\t// == If value is defaultValueSymbol, match the cases in order like switch(true)\n\t\tif (value === defaultValueSymbol) {\n\t\t\treturn Boolean(child.props.when);\n\t\t}\n\n\t\t// == Otherwise, match the cases like switch(value)\n\t\treturn child.props.when === value;\n\t});\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport type SwitchMatchProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slotSymbol = Symbol(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"],"mappings":";;;;AAYA,MAAM,qBAAqB,OAAO,gBAAgB;AAIlD,SAAgB,WAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,QAAQ,uBAAuB;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;EAC1B,CAAC;AAcF,QAZ2B,mBAAmB,UAAU,cAElB,CAAC,MAAM,UAAU;AAEtD,MAAI,UAAU,mBACb,QAAO,QAAQ,MAAM,MAAM,KAAK;AAIjC,SAAO,MAAM,MAAM,SAAS;GAGX,IAAI;;AAQvB,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;AAI3B,QAFyB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;;AAK3E,SAAgB,cAAc,EAAE,YAA2C;AAC1E,QAAO;;AAER,cAAc,aAAa,OAAO,iBAAiB"}
1
+ {"version":3,"file":"switch-Dwy5Gzsb.js","names":[],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;\n\nexport type SwitchRootProps<TValue> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tvalue?: TValue;\n};\n\nconst defaultValueSymbol = Symbol(\"default-value\");\n\n// TODO - Add a factory to make this 'when' and 'value' type-safe later following the link below\n// LINK - https://tkdodo.eu/blog/building-type-safe-compound-components#component-factory-pattern\nexport function SwitchRoot<TValue>(props: SwitchRootProps<TValue>) {\n\tconst { children, value = defaultValueSymbol } = props;\n\n\tconst defaultCase = getSingleSlot(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getRegularChildren(children, SwitchDefault) as ValidSwitchComponentType[];\n\n\tconst matchedCase = childrenCasesArray.find((child) => {\n\t\t// == If value is defaultValueSymbol, match the cases in order like switch(true)\n\t\tif (value === defaultValueSymbol) {\n\t\t\treturn Boolean(child.props.when);\n\t\t}\n\n\t\t// == Otherwise, match the cases like switch(value)\n\t\treturn child.props.when === value;\n\t});\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport type SwitchMatchProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slotSymbol = Symbol(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"],"mappings":";;;;AAYA,MAAM,qBAAqB,OAAO,eAAe;AAIjD,SAAgB,WAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,QAAQ,uBAAuB;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;CAC3B,CAAC;CAcD,OAZ2B,mBAAmB,UAAU,aAEnB,EAAE,MAAM,UAAU;EAEtD,IAAI,UAAU,oBACb,OAAO,QAAQ,MAAM,MAAM,IAAI;EAIhC,OAAO,MAAM,MAAM,SAAS;CAC7B,CAEiB,KAAK;AACvB;AAOA,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;CAI3B,OAFyB,WAAW,QAAQ,IAAI,SAAS,IAAa,IAAI;AAG3E;AAEA,SAAgB,cAAc,EAAE,YAA2C;CAC1E,OAAO;AACR;AACA,cAAc,aAAa,OAAO,gBAAgB"}
@@ -1,31 +1,30 @@
1
1
  import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
2
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
 
4
3
  //#region src/components/ui/card/card.d.ts
5
4
  declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement, {
6
5
  asChild?: boolean;
7
6
  className?: string;
8
- }>): _$react_jsx_runtime0.JSX.Element;
7
+ }>): import("react/jsx-runtime").JSX.Element;
9
8
  declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement, {
10
9
  asChild?: boolean;
11
10
  className?: string;
12
- }>): _$react_jsx_runtime0.JSX.Element;
11
+ }>): import("react/jsx-runtime").JSX.Element;
13
12
  declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement, {
14
13
  className?: string;
15
- }>): _$react_jsx_runtime0.JSX.Element;
14
+ }>): import("react/jsx-runtime").JSX.Element;
16
15
  declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement, {
17
16
  className?: string;
18
- }>): _$react_jsx_runtime0.JSX.Element;
17
+ }>): import("react/jsx-runtime").JSX.Element;
19
18
  declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement, {
20
19
  className?: string;
21
- }>): _$react_jsx_runtime0.JSX.Element;
20
+ }>): import("react/jsx-runtime").JSX.Element;
22
21
  declare function CardAction<TElement extends React.ElementType = "button">(props: PolymorphicProps<TElement, {
23
22
  className?: string;
24
- }>): _$react_jsx_runtime0.JSX.Element;
23
+ }>): import("react/jsx-runtime").JSX.Element;
25
24
  declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
26
25
  asChild?: boolean;
27
26
  className?: string;
28
- }>): _$react_jsx_runtime0.JSX.Element;
27
+ }>): import("react/jsx-runtime").JSX.Element;
29
28
  declare namespace card_parts_d_exports {
30
29
  export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
31
30
  }