@zayne-labs/ui-react 0.10.18 → 0.10.20

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/esm/common/await/index.d.ts +5 -5
  2. package/dist/esm/common/await/index.js +5 -5
  3. package/dist/esm/common/client-gate/index.js +1 -1
  4. package/dist/esm/common/error-boundary/index.d.ts +1 -1
  5. package/dist/esm/common/error-boundary/index.js +1 -1
  6. package/dist/esm/common/for/index.d.ts +3 -3
  7. package/dist/esm/common/presence/index.js +1 -1
  8. package/dist/esm/common/show/index.js +1 -1
  9. package/dist/esm/common/slot/index.d.ts +3 -3
  10. package/dist/esm/common/slot/index.js +1 -1
  11. package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
  12. package/dist/esm/common/suspense-with-boundary/index.js +1 -1
  13. package/dist/esm/common/switch/index.js +2 -2
  14. package/dist/esm/{error-boundary-y9Samt_s.js → error-boundary-BN8yHJjO.js} +2 -2
  15. package/dist/esm/{error-boundary-y9Samt_s.js.map → error-boundary-BN8yHJjO.js.map} +1 -1
  16. package/dist/esm/{index-Cyr9GYYY.d.ts → index-Dc4i5zjT.d.ts} +4 -4
  17. package/dist/esm/{index-dKqa47gp.d.ts → index-DnLP0uwg.d.ts} +2 -2
  18. package/dist/esm/{presence-CAQElNtY.js → presence-CbJsmgRU.js} +2 -2
  19. package/dist/esm/{presence-CAQElNtY.js.map → presence-CbJsmgRU.js.map} +1 -1
  20. package/dist/esm/{show-N1ZXBhoA.js → show-CUDThO_Z.js} +3 -3
  21. package/dist/esm/{show-N1ZXBhoA.js.map → show-CUDThO_Z.js.map} +1 -1
  22. package/dist/esm/{slot-WVWfOlr3.js → slot-S-lscHlK.js} +4 -4
  23. package/dist/esm/{slot-WVWfOlr3.js.map → slot-S-lscHlK.js.map} +1 -1
  24. package/dist/esm/ui/card/index.d.ts +9 -9
  25. package/dist/esm/ui/card/index.js +2 -2
  26. package/dist/esm/ui/carousel/index.d.ts +11 -11
  27. package/dist/esm/ui/carousel/index.js +5 -5
  28. package/dist/esm/ui/carousel/index.js.map +1 -1
  29. package/dist/esm/ui/drag-scroll/index.js +2 -2
  30. package/dist/esm/ui/drop-zone/index.d.ts +38 -39
  31. package/dist/esm/ui/drop-zone/index.js +10 -10
  32. package/dist/esm/ui/drop-zone/index.js.map +1 -1
  33. package/dist/esm/ui/form/index.d.ts +20 -20
  34. package/dist/esm/ui/form/index.js +6 -6
  35. package/dist/esm/ui/form/index.js.map +1 -1
  36. package/package.json +9 -9
@@ -1,8 +1,8 @@
1
- import { ErrorBoundaryProps } from "../../index-dKqa47gp.js";
2
- import { SuspenseWithBoundaryProps } from "../../index-Cyr9GYYY.js";
3
- import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
1
+ import { ErrorBoundaryProps } from "../../index-DnLP0uwg.js";
2
+ import { SuspenseWithBoundaryProps } from "../../index-Dc4i5zjT.js";
4
3
  import * as React from "react";
5
- import * as react_jsx_runtime9 from "react/jsx-runtime";
4
+ import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
5
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/common/await/await.d.ts
8
8
  type RenderPropFn<TValue> = (result: TValue) => React.ReactNode;
@@ -14,7 +14,7 @@ type AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, "errorFallback" |
14
14
  withErrorBoundary?: boolean;
15
15
  withSuspense?: boolean;
16
16
  };
17
- declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime9.JSX.Element;
17
+ declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime7.JSX.Element;
18
18
  type AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<"default", ChildrenType<TValue>>;
19
19
  declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): React.ReactNode;
20
20
  type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["fallback"]>;
@@ -2,12 +2,12 @@
2
2
 
3
3
 
4
4
  import { __export } from "../../chunk-CTAAG5j7.js";
5
- import { ErrorBoundary, useErrorBoundaryContext } from "../../error-boundary-y9Samt_s.js";
6
- import { SlotRoot } from "../../slot-WVWfOlr3.js";
7
- import { getSlotMap, withSlotNameAndSymbol } from "@zayne-labs/toolkit-react/utils";
5
+ import { ErrorBoundary, useErrorBoundaryContext } from "../../error-boundary-BN8yHJjO.js";
6
+ import { SlotRoot } from "../../slot-S-lscHlK.js";
7
+ import { createCustomContext } from "@zayne-labs/toolkit-react";
8
8
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
9
9
  import { Fragment, Suspense, use, useMemo } from "react";
10
- import { createCustomContext } from "@zayne-labs/toolkit-react";
10
+ import { getSlotMap, withSlotNameAndSymbol } from "@zayne-labs/toolkit-react/utils";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
 
13
13
  //#region src/components/common/await/await-context.ts
@@ -78,7 +78,7 @@ const AwaitPending = withSlotNameAndSymbol("pending");
78
78
 
79
79
  //#endregion
80
80
  //#region src/components/common/await/await-parts.ts
81
- var await_parts_exports = __export({
81
+ var await_parts_exports = /* @__PURE__ */ __export({
82
82
  Error: () => AwaitError,
83
83
  Pending: () => AwaitPending,
84
84
  Root: () => AwaitRoot,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
 
3
3
 
4
+ import { useIsHydrated } from "@zayne-labs/toolkit-react";
4
5
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
5
6
  import "react";
6
- import { useIsHydrated } from "@zayne-labs/toolkit-react";
7
7
 
8
8
  //#region src/components/common/client-gate/client-gate.tsx
9
9
  /**
@@ -1,2 +1,2 @@
1
- import { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from "../../index-dKqa47gp.js";
1
+ import { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from "../../index-DnLP0uwg.js";
2
2
  export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from "../../error-boundary-y9Samt_s.js";
4
+ import { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from "../../error-boundary-BN8yHJjO.js";
5
5
 
6
6
  export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext };
@@ -1,7 +1,7 @@
1
- import { DiscriminatedRenderItemProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
1
  import { Prettify } from "@zayne-labs/toolkit-type-helpers";
3
2
  import * as React from "react";
4
- import * as react_jsx_runtime17 from "react/jsx-runtime";
3
+ import { DiscriminatedRenderItemProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
4
+ import * as react_jsx_runtime35 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/common/for/for.d.ts
7
7
  type ArrayOrNumber = number | readonly unknown[];
@@ -13,7 +13,7 @@ type ForProps<TArray extends ArrayOrNumber> = Prettify<{
13
13
  fallback?: React.ReactNode;
14
14
  } & ForRenderProps<TArray>>;
15
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;
16
- declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, ForProps<TArray>>): react_jsx_runtime17.JSX.Element;
16
+ declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, ForProps<TArray>>): react_jsx_runtime35.JSX.Element;
17
17
  //#endregion
18
18
  //#region src/components/common/for/getElementList.d.ts
19
19
  type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import { Presence } from "../../presence-CAQElNtY.js";
4
+ import { Presence } from "../../presence-CbJsmgRU.js";
5
5
 
6
6
  export { Presence };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../show-N1ZXBhoA.js";
4
+ import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../show-CUDThO_Z.js";
5
5
 
6
6
  export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
@@ -1,10 +1,10 @@
1
- import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
1
  import * as React from "react";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { InferProps } from "@zayne-labs/toolkit-react/utils";
3
+ import * as react_jsx_runtime34 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/common/slot/slot.d.ts
6
6
  type SlotProps = InferProps<HTMLElement>;
7
- declare function SlotRoot(props: SlotProps): react_jsx_runtime0.JSX.Element | null;
7
+ declare function SlotRoot(props: SlotProps): react_jsx_runtime34.JSX.Element | null;
8
8
  declare function SlotSlottable({
9
9
  children
10
10
  }: Pick<SlotProps, "children">): React.ReactNode;
@@ -1,3 +1,3 @@
1
- import { SlotRoot, SlotSlottable, slot_parts_exports } from "../../slot-WVWfOlr3.js";
1
+ import { SlotRoot, SlotSlottable, slot_parts_exports } from "../../slot-S-lscHlK.js";
2
2
 
3
3
  export { slot_parts_exports as Slot, SlotRoot, SlotSlottable };
@@ -1,3 +1,3 @@
1
- import "../../index-dKqa47gp.js";
2
- import { SuspenseWithBoundary, SuspenseWithBoundaryProps } from "../../index-Cyr9GYYY.js";
1
+ import "../../index-DnLP0uwg.js";
2
+ import { SuspenseWithBoundary, SuspenseWithBoundaryProps } from "../../index-Dc4i5zjT.js";
3
3
  export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
@@ -1,4 +1,4 @@
1
- import { ErrorBoundary } from "../../error-boundary-y9Samt_s.js";
1
+ import { ErrorBoundary } from "../../error-boundary-BN8yHJjO.js";
2
2
  import { Suspense } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
@@ -2,9 +2,9 @@
2
2
 
3
3
 
4
4
  import { __export } from "../../chunk-CTAAG5j7.js";
5
- import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
6
5
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
7
6
  import "react";
7
+ import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
8
8
 
9
9
  //#region src/components/common/switch/switch.tsx
10
10
  const defaultValueSymbol = Symbol("default-value");
@@ -30,7 +30,7 @@ SwitchDefault.slotSymbol = Symbol("switch-default");
30
30
 
31
31
  //#endregion
32
32
  //#region src/components/common/switch/switch-parts.ts
33
- var switch_parts_exports = __export({
33
+ var switch_parts_exports = /* @__PURE__ */ __export({
34
34
  Default: () => SwitchDefault,
35
35
  Match: () => SwitchMatch,
36
36
  Root: () => SwitchRoot
@@ -1,6 +1,6 @@
1
+ import { createCustomContext, useCallbackRef } from "@zayne-labs/toolkit-react";
1
2
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
2
3
  import { Component, useState } from "react";
3
- import { createCustomContext, useCallbackRef } from "@zayne-labs/toolkit-react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/common/error-boundary/error-boundary-context.ts
@@ -122,4 +122,4 @@ const useErrorBoundary = () => {
122
122
 
123
123
  //#endregion
124
124
  export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext };
125
- //# sourceMappingURL=error-boundary-y9Samt_s.js.map
125
+ //# sourceMappingURL=error-boundary-BN8yHJjO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary-y9Samt_s.js","names":["initialState: ErrorBoundaryState","#resetErrorBoundary"],"sources":["../../src/components/common/error-boundary/error-boundary-context.ts","../../src/components/common/error-boundary/error-boundary.tsx","../../src/components/common/error-boundary/useErrorBoundary.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type ErrorBoundaryContextType = {\n\terror: unknown;\n\thasError: boolean;\n\tresetErrorBoundary: (...args: unknown[]) => void;\n};\n\nexport const [ErrorBoundaryContext, useErrorBoundaryContext] =\n\tcreateCustomContext<ErrorBoundaryContextType>({\n\t\thookName: \"useErrorBoundaryContext\",\n\t\tname: \"ErrorBoundaryContext\",\n\t\tproviderName: \"ErrorBoundaryContextProvider\",\n\t});\n","import { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Component } from \"react\";\nimport { ErrorBoundaryContext, type ErrorBoundaryContextType } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps, FallbackProps } from \"./types\";\n\ntype ErrorBoundaryState =\n\t| {\n\t\t\terror: Error;\n\t\t\thasError: true;\n\t }\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t };\n\nconst initialState: ErrorBoundaryState = {\n\terror: null,\n\thasError: false,\n};\n\nconst hasArrayChanged = (arrayOne: unknown[] = [], arrayTwo: unknown[] = []) => {\n\treturn (\n\t\tarrayOne.length !== arrayTwo.length\n\t\t|| arrayOne.some((item, index) => !Object.is(item, arrayTwo[index]))\n\t);\n};\n\n/**\n * Copied from react-error-boundary package\n * @see https://github.com/bvaughn/react-error-boundary\n */\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n\tconstructor(props: ErrorBoundaryProps) {\n\t\tsuper(props);\n\n\t\tthis.state = initialState;\n\t}\n\n\tstatic getDerivedStateFromError(error: Error) {\n\t\treturn { error, hasError: true };\n\t}\n\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tthis.props.onError?.({ error, info });\n\t}\n\n\toverride componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n\t\tconst { hasError } = this.state;\n\t\tconst { resetKeys } = this.props;\n\n\t\t// == There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array, we'd end up resetting the error boundary immediately.\n\t\t// == This would likely trigger a second error to be thrown.\n\t\t// == So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n\t\tif (hasError && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\tnext: resetKeys,\n\t\t\t\tprev: prevProps.resetKeys,\n\t\t\t\treason: \"keys\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback } = this.props;\n\t\tconst { error, hasError } = this.state;\n\n\t\tlet childToRender = children;\n\n\t\tif (hasError) {\n\t\t\tswitch (true) {\n\t\t\t\tcase isFunction(fallback): {\n\t\t\t\t\tconst fallbackRenderProps = {\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t} satisfies FallbackProps;\n\n\t\t\t\t\tchildToRender = fallback(fallbackRenderProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(fallback): {\n\t\t\t\t\tchildToRender = fallback;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.warn(\"No fallback provided to error boundary\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst contextValue = {\n\t\t\terror,\n\t\t\thasError,\n\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t} satisfies ErrorBoundaryContextType;\n\n\t\treturn <ErrorBoundaryContext value={contextValue}>{childToRender}</ErrorBoundaryContext>;\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error !== null) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\targs: parameters,\n\t\t\t\treason: \"imperative-api\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t};\n}\n","import { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useErrorBoundaryContext } from \"./error-boundary-context\";\n\ntype UseErrorBoundaryState<TError extends Error> =\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t }\n\t| {\n\t\t\terror: TError;\n\t\t\thasError: true;\n\t };\n\nexport const useErrorBoundary = <TError extends Error>() => {\n\tconst { resetErrorBoundary } = useErrorBoundaryContext();\n\n\tconst [state, setState] = useState<UseErrorBoundaryState<TError>>({\n\t\terror: null,\n\t\thasError: false,\n\t});\n\n\tif (state.hasError) {\n\t\tthrow state.error;\n\t}\n\n\tconst resetBoundary = useCallbackRef(() => {\n\t\tresetErrorBoundary();\n\n\t\tsetState({\n\t\t\terror: null,\n\t\t\thasError: false,\n\t\t});\n\t});\n\n\tconst showBoundary = useCallbackRef((error: TError) => {\n\t\tsetState({\n\t\t\terror,\n\t\t\thasError: true,\n\t\t});\n\t});\n\n\treturn { resetBoundary, showBoundary };\n};\n"],"mappings":";;;;;;AAQA,MAAa,CAAC,sBAAsB,2BACnC,oBAA8C;CAC7C,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;;;;ACGH,MAAMA,eAAmC;CACxC,OAAO;CACP,UAAU;CACV;AAED,MAAM,mBAAmB,WAAsB,EAAE,EAAE,WAAsB,EAAE,KAAK;AAC/E,QACC,SAAS,WAAW,SAAS,UAC1B,SAAS,MAAM,MAAM,UAAU,CAAC,OAAO,GAAG,MAAM,SAAS,OAAO,CAAC;;;;;;AAStE,IAAa,gBAAb,cAAmC,UAAkD;CACpF,YAAY,OAA2B;AACtC,QAAM,MAAM;AAEZ,OAAK,QAAQ;;CAGd,OAAO,yBA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AAoB;AAEpB,WAAS;GACR,OAAO;GACP,UAAU;GACV,CAAC;GACD;CAEF,MAAM,eAAe,gBAAgB,UAAkB;AACtD,WAAS;GACR;GACA,UAAU;GACV,CAAC;GACD;AAEF,QAAO;EAAE;EAAe;EAAc"}
1
+ {"version":3,"file":"error-boundary-BN8yHJjO.js","names":["initialState: ErrorBoundaryState","#resetErrorBoundary"],"sources":["../../src/components/common/error-boundary/error-boundary-context.ts","../../src/components/common/error-boundary/error-boundary.tsx","../../src/components/common/error-boundary/useErrorBoundary.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type ErrorBoundaryContextType = {\n\terror: unknown;\n\thasError: boolean;\n\tresetErrorBoundary: (...args: unknown[]) => void;\n};\n\nexport const [ErrorBoundaryContext, useErrorBoundaryContext] =\n\tcreateCustomContext<ErrorBoundaryContextType>({\n\t\thookName: \"useErrorBoundaryContext\",\n\t\tname: \"ErrorBoundaryContext\",\n\t\tproviderName: \"ErrorBoundaryContextProvider\",\n\t});\n","import { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Component } from \"react\";\nimport { ErrorBoundaryContext, type ErrorBoundaryContextType } from \"./error-boundary-context\";\nimport type { ErrorBoundaryProps, FallbackProps } from \"./types\";\n\ntype ErrorBoundaryState =\n\t| {\n\t\t\terror: Error;\n\t\t\thasError: true;\n\t }\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t };\n\nconst initialState: ErrorBoundaryState = {\n\terror: null,\n\thasError: false,\n};\n\nconst hasArrayChanged = (arrayOne: unknown[] = [], arrayTwo: unknown[] = []) => {\n\treturn (\n\t\tarrayOne.length !== arrayTwo.length\n\t\t|| arrayOne.some((item, index) => !Object.is(item, arrayTwo[index]))\n\t);\n};\n\n/**\n * Copied from react-error-boundary package\n * @see https://github.com/bvaughn/react-error-boundary\n */\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n\tconstructor(props: ErrorBoundaryProps) {\n\t\tsuper(props);\n\n\t\tthis.state = initialState;\n\t}\n\n\tstatic getDerivedStateFromError(error: Error) {\n\t\treturn { error, hasError: true };\n\t}\n\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tthis.props.onError?.({ error, info });\n\t}\n\n\toverride componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n\t\tconst { hasError } = this.state;\n\t\tconst { resetKeys } = this.props;\n\n\t\t// == There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array, we'd end up resetting the error boundary immediately.\n\t\t// == This would likely trigger a second error to be thrown.\n\t\t// == So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n\t\tif (hasError && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\tnext: resetKeys,\n\t\t\t\tprev: prevProps.resetKeys,\n\t\t\t\treason: \"keys\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback } = this.props;\n\t\tconst { error, hasError } = this.state;\n\n\t\tlet childToRender = children;\n\n\t\tif (hasError) {\n\t\t\tswitch (true) {\n\t\t\t\tcase isFunction(fallback): {\n\t\t\t\t\tconst fallbackRenderProps = {\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t\t\t\t} satisfies FallbackProps;\n\n\t\t\t\t\tchildToRender = fallback(fallbackRenderProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase Boolean(fallback): {\n\t\t\t\t\tchildToRender = fallback;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.warn(\"No fallback provided to error boundary\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst contextValue = {\n\t\t\terror,\n\t\t\thasError,\n\t\t\tresetErrorBoundary: this.#resetErrorBoundary,\n\t\t} satisfies ErrorBoundaryContextType;\n\n\t\treturn <ErrorBoundaryContext value={contextValue}>{childToRender}</ErrorBoundaryContext>;\n\t}\n\n\t#resetErrorBoundary = (...parameters: unknown[]) => {\n\t\tconst { error } = this.state;\n\n\t\tif (error !== null) {\n\t\t\tthis.props.onReset?.({\n\t\t\t\targs: parameters,\n\t\t\t\treason: \"imperative-api\",\n\t\t\t});\n\n\t\t\tthis.setState(initialState);\n\t\t}\n\t};\n}\n","import { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useErrorBoundaryContext } from \"./error-boundary-context\";\n\ntype UseErrorBoundaryState<TError extends Error> =\n\t| {\n\t\t\terror: null;\n\t\t\thasError: false;\n\t }\n\t| {\n\t\t\terror: TError;\n\t\t\thasError: true;\n\t };\n\nexport const useErrorBoundary = <TError extends Error>() => {\n\tconst { resetErrorBoundary } = useErrorBoundaryContext();\n\n\tconst [state, setState] = useState<UseErrorBoundaryState<TError>>({\n\t\terror: null,\n\t\thasError: false,\n\t});\n\n\tif (state.hasError) {\n\t\tthrow state.error;\n\t}\n\n\tconst resetBoundary = useCallbackRef(() => {\n\t\tresetErrorBoundary();\n\n\t\tsetState({\n\t\t\terror: null,\n\t\t\thasError: false,\n\t\t});\n\t});\n\n\tconst showBoundary = useCallbackRef((error: TError) => {\n\t\tsetState({\n\t\t\terror,\n\t\t\thasError: true,\n\t\t});\n\t});\n\n\treturn { resetBoundary, showBoundary };\n};\n"],"mappings":";;;;;;AAQA,MAAa,CAAC,sBAAsB,2BACnC,oBAA8C;CAC7C,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;;;;ACGH,MAAMA,eAAmC;CACxC,OAAO;CACP,UAAU;CACV;AAED,MAAM,mBAAmB,WAAsB,EAAE,EAAE,WAAsB,EAAE,KAAK;AAC/E,QACC,SAAS,WAAW,SAAS,UAC1B,SAAS,MAAM,MAAM,UAAU,CAAC,OAAO,GAAG,MAAM,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CAAC,OAAO,YAAY,SAAwC;EACjE,OAAO;EACP,UAAU;EACV,CAAC;AAEF,KAAI,MAAM,SACT,OAAM,MAAM;CAGb,MAAM,gBAAgB,qBAAqB;AAC1C,sBAAoB;AAEpB,WAAS;GACR,OAAO;GACP,UAAU;GACV,CAAC;GACD;CAEF,MAAM,eAAe,gBAAgB,UAAkB;AACtD,WAAS;GACR;GACA,UAAU;GACV,CAAC;GACD;AAEF,QAAO;EAAE;EAAe;EAAc"}
@@ -1,6 +1,6 @@
1
- import { ErrorBoundaryProps } from "./index-dKqa47gp.js";
1
+ import { ErrorBoundaryProps } from "./index-DnLP0uwg.js";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime30 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/common/suspense-with-boundary/suspense-with-boundary.d.ts
6
6
  type SuspenseWithBoundaryProps = {
@@ -8,7 +8,7 @@ type SuspenseWithBoundaryProps = {
8
8
  errorFallback?: ErrorBoundaryProps["fallback"];
9
9
  fallback?: React.ReactNode;
10
10
  };
11
- declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): react_jsx_runtime30.JSX.Element;
11
+ declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): react_jsx_runtime8.JSX.Element;
12
12
  //#endregion
13
13
  export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
14
- //# sourceMappingURL=index-Cyr9GYYY.d.ts.map
14
+ //# sourceMappingURL=index-Dc4i5zjT.d.ts.map
@@ -1,6 +1,6 @@
1
+ import "@zayne-labs/toolkit-react";
1
2
  import * as React$1 from "react";
2
3
  import { Component } from "react";
3
- import "@zayne-labs/toolkit-react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/common/error-boundary/types.d.ts
@@ -66,4 +66,4 @@ declare const useErrorBoundary: <TError extends Error>() => {
66
66
  };
67
67
  //#endregion
68
68
  export { ErrorBoundary, type ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
69
- //# sourceMappingURL=index-dKqa47gp.d.ts.map
69
+ //# sourceMappingURL=index-DnLP0uwg.d.ts.map
@@ -1,6 +1,6 @@
1
+ import { useCallbackRef, useComposeRefs } from "@zayne-labs/toolkit-react";
1
2
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
2
3
  import { Children, cloneElement, useEffect, useLayoutEffect, useReducer, useRef, useState } from "react";
3
- import { useCallbackRef, useComposeRefs } from "@zayne-labs/toolkit-react";
4
4
  import { on } from "@zayne-labs/toolkit-core";
5
5
 
6
6
  //#region src/components/common/presence/use-presence.ts
@@ -153,4 +153,4 @@ function Presence(props) {
153
153
 
154
154
  //#endregion
155
155
  export { Presence };
156
- //# sourceMappingURL=presence-CAQElNtY.js.map
156
+ //# sourceMappingURL=presence-CbJsmgRU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"presence-CAQElNtY.js","names":["timeoutId: number"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useEffect, useLayoutEffect, 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};\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) => {\n\tconst { onExitComplete, present } = options;\n\n\tconst saveOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst [node, setNode] = useState<HTMLElement | null>(null);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevPresentRef = useRef(present);\n\tconst prevAnimationNameRef = useRef<string>(\"none\");\n\n\tconst initialState = present ? \"mounted\" : \"unmounted\";\n\n\tconst [state, send] = useStateMachine({\n\t\tinitial: initialState,\n\t\tstates: {\n\t\t\tmounted: {\n\t\t\t\tANIMATION_OUT: \"unmountSuspended\",\n\t\t\t\tUNMOUNT: \"unmounted\",\n\t\t\t},\n\t\t\tunmounted: {\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t\tunmountSuspended: {\n\t\t\t\tANIMATION_END: \"unmounted\",\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t},\n\t});\n\n\tuseEffect(() => {\n\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\t\tprevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [state]);\n\n\tuseLayoutEffect(() => {\n\t\tconst styles = stylesRef.current;\n\t\tconst wasPresent = prevPresentRef.current;\n\t\tconst hasPresentChanged = wasPresent !== present;\n\n\t\tif (!hasPresentChanged) return;\n\n\t\tconst prevAnimationName = prevAnimationNameRef.current;\n\t\tconst currentAnimationName = getAnimationName(styles);\n\n\t\tswitch (true) {\n\t\t\tcase present: {\n\t\t\t\tsend(\"MOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node): {\n\t\t\t\tconst hasAnimation =\n\t\t\t\t\t(currentAnimationName !== \"none\" && styles?.display !== \"none\")\n\t\t\t\t\t|| (styles?.transitionProperty !== \"none\" && Number(styles?.transitionDuration) > 0);\n\n\t\t\t\t/* If there is no exit animation or the element is hidden, animations won't run, so we unmount instantly */\n\t\t\t\tif (!hasAnimation) {\n\t\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t * computed styles) because there is no `animationrun` event and `animationstart`\n\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t */\n\n\t\t\t\tconst isAnimating = prevAnimationName !== currentAnimationName;\n\n\t\t\t\tconst isAnimatingOut = wasPresent && isAnimating;\n\n\t\t\t\tif (!isAnimatingOut) {\n\t\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tsend(\"ANIMATION_OUT\");\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\tprevPresentRef.current = present;\n\t}, [present, node, send]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!node) {\n\t\t\t// Transition to the unmounted state if the node is removed prematurely.\n\t\t\t// We avoid doing so during cleanup as the node may change but still exist.\n\t\t\tsend(\"ANIMATION_END\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet timeoutId: number;\n\n\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\t/**\n\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t */\n\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\t\t// The event.animationName is unescaped for CSS syntax, so we need to escape it to compare with the animationName computed from the style.\n\t\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t// user-provided event handlers would not be called.\n\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\tif (!prevPresentRef.current) {\n\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t// still causes a flash.\n\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t}\n\t\t\t\t}) as never;\n\t\t\t}\n\t\t};\n\n\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node && !prevPresentRef.current;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_END\");\n\t\t};\n\n\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\tprevAnimationNameRef.current = getAnimationName(stylesRef.current);\n\t\t};\n\n\t\tconst onAnimationStartCleanup = on(\"animationstart\", node, handleAnimationStart);\n\t\tconst onAnimationEndCleanup = on(\"animationend\", node, handleAnimationEnd);\n\t\tconst onAnimationCancelCleanup = on(\"animationcancel\", node, handleAnimationEnd);\n\t\tconst onTransitionEndCleanup = on(\"transitionend\", node, handleTransitionEnd);\n\t\tconst onTransitionCancelCleanup = on(\"transitioncancel\", node, handleTransitionEnd);\n\n\t\treturn () => {\n\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\tonAnimationStartCleanup();\n\t\t\tonAnimationEndCleanup();\n\t\t\tonAnimationCancelCleanup();\n\t\t\tonTransitionEndCleanup();\n\t\t\tonTransitionCancelCleanup();\n\t\t};\n\t}, [node, send]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = state === \"unmounted\" && !present;\n\n\t\tif (!isExitCompleted) return;\n\n\t\tsaveOnExitComplete();\n\t}, [state, present, saveOnExitComplete]);\n\n\tconst isPresent = ([\"mounted\", \"unmountSuspended\"] satisfies Array<typeof state>).includes(state);\n\n\tconst ref = useCallbackRef((refNode: HTMLElement | null) => {\n\t\trefNode && (stylesRef.current = getComputedStyle(refNode));\n\t\tsetNode(refNode);\n\t});\n\n\treturn {\n\t\tisPresent,\n\t\tref,\n\t};\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 * as React from \"react\";\nimport { Children, cloneElement } from \"react\";\nimport { type UsePresenceOptions, usePresence } from \"./use-presence\";\n\ntype RefProp = { ref?: React.Ref<HTMLElement> };\n\ntype PresenceProps = UsePresenceOptions & {\n\tchildren?:\n\t\t| React.ReactElement<RefProp>\n\t\t| ((props: { isPresent: boolean }) => React.ReactElement<RefProp>);\n\tforceMount?: boolean;\n};\n\nfunction Presence(props: PresenceProps) {\n\tconst { children, forceMount = false, onExitComplete, present } = props;\n\n\tconst presence = usePresence({ onExitComplete, present });\n\n\tconst resolvedChild =\n\t\tisFunction(children) ? children({ isPresent: presence.isPresent }) : Children.only(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(presence.ref, childRef);\n\n\tconst shouldRender = forceMount || presence.isPresent;\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\treturn resolvedChild && cloneElement(resolvedChild, { ref });\n}\n\nexport { Presence };\n"],"mappings":";;;;;;AASA,MAAM,mBACL,WACI;CACJ,MAAM,WAAW,WAAmB,UAA0B;AAG7D,SAFiB,OAAO,OAAO,WAAW,UAAU;;AAKrD,QAAO,WAAW,SAAS,OAAO,QAAQ;;AAG3C,MAAM,oBAAoB,WAAuC,QAAQ,iBAAiB;;;;;AAY1F,MAAM,eAAe,YAAgC;CACpD,MAAM,EAAE,gBAAgB,YAAY;CAEpC,MAAM,qBAAqB,eAAe,eAAe;CAEzD,MAAM,CAAC,MAAM,WAAW,SAA6B,KAAK;CAE1D,MAAM,YAAY,OAAmC,KAAK;CAE1D,MAAM,iBAAiB,OAAO,QAAQ;CACtC,MAAM,uBAAuB,OAAe,OAAO;CAInD,MAAM,CAAC,OAAO,QAAQ,gBAAgB;EACrC,SAHoB,UAAU,YAAY;EAI1C,QAAQ;GACP,SAAS;IACR,eAAe;IACf,SAAS;IACT;GACD,WAAW,EACV,OAAO,WACP;GACD,kBAAkB;IACjB,eAAe;IACf,OAAO;IACP;GACD;EACD,CAAC;AAEF,iBAAgB;EACf,MAAM,uBAAuB,iBAAiB,UAAU,QAAQ;AAChE,uBAAqB,UAAU,UAAU,YAAY,uBAAuB;IAC1E,CAAC,MAAM,CAAC;AAEX,uBAAsB;EACrB,MAAM,SAAS,UAAU;EACzB,MAAM,aAAa,eAAe;AAGlC,MAAI,EAFsB,eAAe,SAEjB;EAExB,MAAM,oBAAoB,qBAAqB;EAC/C,MAAM,uBAAuB,iBAAiB,OAAO;AAErD,UAAQ,MAAR;GACC,KAAK;AACJ,SAAK,QAAQ;AACb;GAGD,KAAK,QAAQ,KAAK;AAMjB,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AAM,4BAA4B,GAAG,oBAAoB,MAAM,oBAAoB;AAEnF,eAAa;AACZ,eAAY,aAAa,UAAU;AACnC,4BAAyB;AACzB,0BAAuB;AACvB,6BAA0B;AAC1B,2BAAwB;AACxB,8BAA2B;;IAE1B,CAAC,MAAM,KAAK,CAAC;AAEhB,iBAAgB;AAGf,MAAI,EAFoB,UAAU,eAAe,CAAC,SAE5B;AAEtB,sBAAoB;IAClB;EAAC;EAAO;EAAS;EAAmB,CAAC;CAExC,MAAM,YAAa,CAAC,WAAW,mBAAmB,CAAgC,SAAS,MAAM;CAEjG,MAAM,MAAM,gBAAgB,YAAgC;AAC3D,cAAY,UAAU,UAAU,iBAAiB,QAAQ;AACzD,UAAQ,QAAQ;GACf;AAEF,QAAO;EACN;EACA;EACA;;;;;ACrNF,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,aAAa,OAAO,gBAAgB,YAAY;CAElE,MAAM,WAAW,YAAY;EAAE;EAAgB;EAAS,CAAC;CAEzD,MAAM,gBACL,WAAW,SAAS,GAAG,SAAS,EAAE,WAAW,SAAS,WAAW,CAAC,GAAG,SAAS,KAAK,SAAS;CAE7F,MAAM,WAAY,eAAe,MAAM,OAClC,cAA2C;CAEhD,MAAM,MAAM,eAAe,SAAS,KAAK,SAAS;AAIlD,KAAI,EAFiB,cAAc,SAAS,WAG3C,QAAO;AAGR,QAAO,iBAAiB,aAAa,eAAe,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"presence-CbJsmgRU.js","names":["timeoutId: number"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useEffect, useLayoutEffect, 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};\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) => {\n\tconst { onExitComplete, present } = options;\n\n\tconst saveOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst [node, setNode] = useState<HTMLElement | null>(null);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevPresentRef = useRef(present);\n\tconst prevAnimationNameRef = useRef<string>(\"none\");\n\n\tconst initialState = present ? \"mounted\" : \"unmounted\";\n\n\tconst [state, send] = useStateMachine({\n\t\tinitial: initialState,\n\t\tstates: {\n\t\t\tmounted: {\n\t\t\t\tANIMATION_OUT: \"unmountSuspended\",\n\t\t\t\tUNMOUNT: \"unmounted\",\n\t\t\t},\n\t\t\tunmounted: {\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t\tunmountSuspended: {\n\t\t\t\tANIMATION_END: \"unmounted\",\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t},\n\t});\n\n\tuseEffect(() => {\n\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\t\tprevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [state]);\n\n\tuseLayoutEffect(() => {\n\t\tconst styles = stylesRef.current;\n\t\tconst wasPresent = prevPresentRef.current;\n\t\tconst hasPresentChanged = wasPresent !== present;\n\n\t\tif (!hasPresentChanged) return;\n\n\t\tconst prevAnimationName = prevAnimationNameRef.current;\n\t\tconst currentAnimationName = getAnimationName(styles);\n\n\t\tswitch (true) {\n\t\t\tcase present: {\n\t\t\t\tsend(\"MOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node): {\n\t\t\t\tconst hasAnimation =\n\t\t\t\t\t(currentAnimationName !== \"none\" && styles?.display !== \"none\")\n\t\t\t\t\t|| (styles?.transitionProperty !== \"none\" && Number(styles?.transitionDuration) > 0);\n\n\t\t\t\t/* If there is no exit animation or the element is hidden, animations won't run, so we unmount instantly */\n\t\t\t\tif (!hasAnimation) {\n\t\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t * computed styles) because there is no `animationrun` event and `animationstart`\n\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t */\n\n\t\t\t\tconst isAnimating = prevAnimationName !== currentAnimationName;\n\n\t\t\t\tconst isAnimatingOut = wasPresent && isAnimating;\n\n\t\t\t\tif (!isAnimatingOut) {\n\t\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tsend(\"ANIMATION_OUT\");\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\tprevPresentRef.current = present;\n\t}, [present, node, send]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!node) {\n\t\t\t// Transition to the unmounted state if the node is removed prematurely.\n\t\t\t// We avoid doing so during cleanup as the node may change but still exist.\n\t\t\tsend(\"ANIMATION_END\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet timeoutId: number;\n\n\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\t/**\n\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t */\n\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\t\t// The event.animationName is unescaped for CSS syntax, so we need to escape it to compare with the animationName computed from the style.\n\t\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t// user-provided event handlers would not be called.\n\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\tif (!prevPresentRef.current) {\n\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t// still causes a flash.\n\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t}\n\t\t\t\t}) as never;\n\t\t\t}\n\t\t};\n\n\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node && !prevPresentRef.current;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_END\");\n\t\t};\n\n\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\tprevAnimationNameRef.current = getAnimationName(stylesRef.current);\n\t\t};\n\n\t\tconst onAnimationStartCleanup = on(\"animationstart\", node, handleAnimationStart);\n\t\tconst onAnimationEndCleanup = on(\"animationend\", node, handleAnimationEnd);\n\t\tconst onAnimationCancelCleanup = on(\"animationcancel\", node, handleAnimationEnd);\n\t\tconst onTransitionEndCleanup = on(\"transitionend\", node, handleTransitionEnd);\n\t\tconst onTransitionCancelCleanup = on(\"transitioncancel\", node, handleTransitionEnd);\n\n\t\treturn () => {\n\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\tonAnimationStartCleanup();\n\t\t\tonAnimationEndCleanup();\n\t\t\tonAnimationCancelCleanup();\n\t\t\tonTransitionEndCleanup();\n\t\t\tonTransitionCancelCleanup();\n\t\t};\n\t}, [node, send]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = state === \"unmounted\" && !present;\n\n\t\tif (!isExitCompleted) return;\n\n\t\tsaveOnExitComplete();\n\t}, [state, present, saveOnExitComplete]);\n\n\tconst isPresent = ([\"mounted\", \"unmountSuspended\"] satisfies Array<typeof state>).includes(state);\n\n\tconst ref = useCallbackRef((refNode: HTMLElement | null) => {\n\t\trefNode && (stylesRef.current = getComputedStyle(refNode));\n\t\tsetNode(refNode);\n\t});\n\n\treturn {\n\t\tisPresent,\n\t\tref,\n\t};\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 * as React from \"react\";\nimport { Children, cloneElement } from \"react\";\nimport { type UsePresenceOptions, usePresence } from \"./use-presence\";\n\ntype RefProp = { ref?: React.Ref<HTMLElement> };\n\ntype PresenceProps = UsePresenceOptions & {\n\tchildren?:\n\t\t| React.ReactElement<RefProp>\n\t\t| ((props: { isPresent: boolean }) => React.ReactElement<RefProp>);\n\tforceMount?: boolean;\n};\n\nfunction Presence(props: PresenceProps) {\n\tconst { children, forceMount = false, onExitComplete, present } = props;\n\n\tconst presence = usePresence({ onExitComplete, present });\n\n\tconst resolvedChild =\n\t\tisFunction(children) ? children({ isPresent: presence.isPresent }) : Children.only(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(presence.ref, childRef);\n\n\tconst shouldRender = forceMount || presence.isPresent;\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\treturn resolvedChild && cloneElement(resolvedChild, { ref });\n}\n\nexport { Presence };\n"],"mappings":";;;;;;AASA,MAAM,mBACL,WACI;CACJ,MAAM,WAAW,WAAmB,UAA0B;AAG7D,SAFiB,OAAO,OAAO,WAAW,UAAU;;AAKrD,QAAO,WAAW,SAAS,OAAO,QAAQ;;AAG3C,MAAM,oBAAoB,WAAuC,QAAQ,iBAAiB;;;;;AAY1F,MAAM,eAAe,YAAgC;CACpD,MAAM,EAAE,gBAAgB,YAAY;CAEpC,MAAM,qBAAqB,eAAe,eAAe;CAEzD,MAAM,CAAC,MAAM,WAAW,SAA6B,KAAK;CAE1D,MAAM,YAAY,OAAmC,KAAK;CAE1D,MAAM,iBAAiB,OAAO,QAAQ;CACtC,MAAM,uBAAuB,OAAe,OAAO;CAInD,MAAM,CAAC,OAAO,QAAQ,gBAAgB;EACrC,SAHoB,UAAU,YAAY;EAI1C,QAAQ;GACP,SAAS;IACR,eAAe;IACf,SAAS;IACT;GACD,WAAW,EACV,OAAO,WACP;GACD,kBAAkB;IACjB,eAAe;IACf,OAAO;IACP;GACD;EACD,CAAC;AAEF,iBAAgB;EACf,MAAM,uBAAuB,iB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@@ -1,7 +1,7 @@
1
1
  import { __export } from "./chunk-CTAAG5j7.js";
2
- import { getMultipleSlots, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
3
2
  import { assert, isFunction } from "@zayne-labs/toolkit-type-helpers";
4
3
  import "react";
4
+ import { getMultipleSlots, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
5
5
  import { toArray } from "@zayne-labs/toolkit-core";
6
6
 
7
7
  //#region src/components/common/show/show.tsx
@@ -38,7 +38,7 @@ ShowFallback.slotSymbol = Symbol("show-fallback");
38
38
 
39
39
  //#endregion
40
40
  //#region src/components/common/show/show-parts.ts
41
- var show_parts_exports = __export({
41
+ var show_parts_exports = /* @__PURE__ */ __export({
42
42
  Content: () => ShowContent,
43
43
  Fallback: () => ShowFallback,
44
44
  Otherwise: () => ShowFallback,
@@ -47,4 +47,4 @@ var show_parts_exports = __export({
47
47
 
48
48
  //#endregion
49
49
  export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
50
- //# sourceMappingURL=show-N1ZXBhoA.js.map
50
+ //# sourceMappingURL=show-CUDThO_Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"show-N1ZXBhoA.js","names":["fallBackSlot"],"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\";\nimport * as React from \"react\";\n\ntype ShowProps<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: ShowProps<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) ? children(when as TWhen) : 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\ntype ShowContentProps<TWhen> = Pick<ShowProps<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}\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":";;;;;;;AAqBA,SAAgB,SAAgB,OAAyB;CACxD,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,MAAMA,iBAAe,cAAc,eAAe,aAAa;AAE/D,SACC,EAAEA,kBAAgB,WAClB,yEACA;AAED,SAAO,oBAAoBA,kBAAgB;;CAG5C,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;CAE1E,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,kBAClB,iBAAiB,kBAAkB,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;;AAK3E,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-CUDThO_Z.js","names":["fallBackSlot"],"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\";\nimport * as React from \"react\";\n\ntype ShowProps<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: ShowProps<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) ? children(when as TWhen) : 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\ntype ShowContentProps<TWhen> = Pick<ShowProps<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}\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":";;;;;;;AAqBA,SAAgB,SAAgB,OAAyB;CACxD,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,MAAMA,iBAAe,cAAc,eAAe,aAAa;AAE/D,SACC,EAAEA,kBAAgB,WAClB,yEACA;AAED,SAAO,oBAAoBA,kBAAgB;;CAG5C,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;CAE1E,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,kBAClB,iBAAiB,kBAAkB,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;;AAK3E,YAAY,aAAa,OAAO,eAAe;AAE/C,SAAgB,aAAa,OAAsC;CAClE,MAAM,EAAE,aAAa;AAErB,QAAO;;AAER,aAAa,aAAa,OAAO,gBAAgB"}
@@ -1,7 +1,7 @@
1
1
  import { __export } from "./chunk-CTAAG5j7.js";
2
- import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
3
2
  import { isArray } from "@zayne-labs/toolkit-type-helpers";
4
3
  import { Children, Fragment, cloneElement, isValidElement } from "react";
4
+ import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/common/slot/slot.tsx
@@ -34,7 +34,7 @@ const isSlottable = (child) => {
34
34
  };
35
35
  function SlotClone(props) {
36
36
  const { children, ref: forwardedRef,...restOfSlotProps } = props;
37
- const resolvedChild = Children.only(children);
37
+ const resolvedChild = children;
38
38
  if (!isValidElement(resolvedChild)) return null;
39
39
  if (Children.count(resolvedChild) > 1) return Children.only(null);
40
40
  const childRef = resolvedChild.props.ref ?? resolvedChild.ref;
@@ -48,11 +48,11 @@ function SlotClone(props) {
48
48
 
49
49
  //#endregion
50
50
  //#region src/components/common/slot/slot-parts.ts
51
- var slot_parts_exports = __export({
51
+ var slot_parts_exports = /* @__PURE__ */ __export({
52
52
  Root: () => SlotRoot,
53
53
  Slottable: () => SlotSlottable
54
54
  });
55
55
 
56
56
  //#endregion
57
57
  export { SlotRoot, SlotSlottable, slot_parts_exports };
58
- //# sourceMappingURL=slot-WVWfOlr3.js.map
58
+ //# sourceMappingURL=slot-S-lscHlK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot-WVWfOlr3.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, type InferProps, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<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 newElement = slottable.props.children;\n\n\tif (!isValidElement(newElement)) {\n\t\treturn null;\n\t}\n\n\tif (Children.count(newElement) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst newChildren = 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 (`newElement.props.children`)\n\t\t\treturn (newElement.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn <SlotClone {...restOfSlotProps}>{cloneElement(newElement, undefined, newChildren)}</SlotClone>;\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 = {\n\tchildren: React.ReactNode;\n\tref?: React.RefObject<HTMLElement>;\n};\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tconst resolvedChild = Children.only(children);\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\treturn null;\n\t}\n\n\tif (Children.count(resolvedChild) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst childRef = (resolvedChild.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = forwardedRef ? composeRefs(forwardedRef, childRef) : childRef;\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t...(resolvedChild.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;;AAWA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,SAAU,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;EAAU,GAAI;EAAkB;GAAqB;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,aAAa,UAAU,MAAM;AAEnC,KAAI,CAAC,eAAe,WAAW,CAC9B,QAAO;AAGR,KAAI,SAAS,MAAM,WAAW,GAAG,EAChC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,cAAc,cAAc,KAAK,UAAU;AAChD,MAAI,UAAU,UAEb,QAAQ,WAAW,MAAoB;AAGxC,SAAO;GACN;AAEF,QAAO,oBAAC;EAAU,GAAI;YAAkB,aAAa,YAAY,QAAW,YAAY;GAAa;;AAOtG,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAWhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,aAAc,GAAG,oBAAoB;CAE5D,MAAM,gBAAgB,SAAS,KAAK,SAAS;AAE7C,KAAI,CAAC,eAA8B,cAAc,CAChD,QAAO;AAGR,KAAI,SAAS,MAAM,cAAc,GAAG,EACnC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,WAAY,cAAc,MAAM,OACjC,cAA2C;CAEhD,MAAM,MAAM,eAAe,YAAY,cAAc,SAAS,GAAG;CAEjE,MAAM,cAAc;EACnB,GAAG,WAAW,iBAAiB,cAAc,MAAM;EACnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD;AAED,QAAO,aAAa,eAAe,YAAY"}
1
+ {"version":3,"file":"slot-S-lscHlK.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, type InferProps, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<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 newElement = slottable.props.children;\n\n\tif (!isValidElement(newElement)) {\n\t\treturn null;\n\t}\n\n\tif (Children.count(newElement) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst newChildren = 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 (`newElement.props.children`)\n\t\t\treturn (newElement.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn <SlotClone {...restOfSlotProps}>{cloneElement(newElement, undefined, newChildren)}</SlotClone>;\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 = {\n\tchildren: React.ReactNode;\n\tref?: React.RefObject<HTMLElement>;\n};\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tconst resolvedChild = children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\treturn null;\n\t}\n\n\tif (Children.count(resolvedChild) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst childRef = (resolvedChild.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = forwardedRef ? composeRefs(forwardedRef, childRef) : childRef;\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t...(resolvedChild.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;;AAWA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,SAAU,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;EAAU,GAAI;EAAkB;GAAqB;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,aAAa,UAAU,MAAM;AAEnC,KAAI,CAAC,eAAe,WAAW,CAC9B,QAAO;AAGR,KAAI,SAAS,MAAM,WAAW,GAAG,EAChC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,cAAc,cAAc,KAAK,UAAU;AAChD,MAAI,UAAU,UAEb,QAAQ,WAAW,MAAoB;AAGxC,SAAO;GACN;AAEF,QAAO,oBAAC;EAAU,GAAI;YAAkB,aAAa,YAAY,QAAW,YAAY;GAAa;;AAOtG,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAWhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,aAAc,GAAG,oBAAoB;CAE5D,MAAM,gBAAgB;AAEtB,KAAI,CAAC,eAA8B,cAAc,CAChD,QAAO;AAGR,KAAI,SAAS,MAAM,cAAc,GAAG,EACnC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,WAAY,cAAc,MAAM,OACjC,cAA2C;CAEhD,MAAM,MAAM,eAAe,YAAY,cAAc,SAAS,GAAG;CAEjE,MAAM,cAAc;EACnB,GAAG,WAAW,iBAAiB,cAAc,MAAM;EACnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD;AAED,QAAO,aAAa,eAAe,YAAY"}
@@ -1,17 +1,17 @@
1
- import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
2
1
  import * as React from "react";
3
- import * as react_jsx_runtime10 from "react/jsx-runtime";
2
+ import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/ui/card/card.d.ts
6
- declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
7
- declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
8
- declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
9
- declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
10
- declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
11
- declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime10.JSX.Element;
6
+ declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
7
+ declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
8
+ declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
9
+ declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
10
+ declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
11
+ declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
12
12
  declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
13
13
  asChild?: boolean;
14
- }>): react_jsx_runtime10.JSX.Element;
14
+ }>): react_jsx_runtime0.JSX.Element;
15
15
  declare namespace card_parts_d_exports {
16
16
  export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
17
17
  }
@@ -1,5 +1,5 @@
1
1
  import { __export } from "../../chunk-CTAAG5j7.js";
2
- import { SlotRoot } from "../../slot-WVWfOlr3.js";
2
+ import { SlotRoot } from "../../slot-S-lscHlK.js";
3
3
  import { cnMerge } from "../../cn-DdD3uYxA.js";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -80,7 +80,7 @@ function CardFooter(props) {
80
80
 
81
81
  //#endregion
82
82
  //#region src/components/ui/card/card-parts.ts
83
- var card_parts_exports = __export({
83
+ var card_parts_exports = /* @__PURE__ */ __export({
84
84
  Action: () => CardAction,
85
85
  Content: () => CardContent,
86
86
  Description: () => CardDescription,
@@ -1,7 +1,7 @@
1
- import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
1
  import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
3
2
  import * as React$1 from "react";
4
- import * as react_jsx_runtime1 from "react/jsx-runtime";
3
+ import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
4
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
5
5
  import { StoreApi } from "@zayne-labs/toolkit-core";
6
6
 
7
7
  //#region src/components/ui/carousel/types.d.ts
@@ -79,16 +79,16 @@ type OtherCarouselProps = {
79
79
  };
80
80
  //#endregion
81
81
  //#region src/components/ui/carousel/carousel.d.ts
82
- declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime1.JSX.Element;
83
- declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime1.JSX.Element;
84
- declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime1.JSX.Element;
85
- declare function CarouselItemList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime1.JSX.Element;
86
- declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime1.JSX.Element;
87
- declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime1.JSX.Element;
88
- declare function CarouselIndicatorList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime1.JSX.Element;
89
- declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime1.JSX.Element;
82
+ declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime9.JSX.Element;
83
+ declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime9.JSX.Element;
84
+ declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime9.JSX.Element;
85
+ declare function CarouselItemList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime9.JSX.Element;
86
+ declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime9.JSX.Element;
87
+ declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime9.JSX.Element;
88
+ declare function CarouselIndicatorList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime9.JSX.Element;
89
+ declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime9.JSX.Element;
90
90
  declare namespace carousel_parts_d_exports {
91
- export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorGroup, CarouselItem as Item, CarouselItemList as ItemGroup, CarouselRoot as Root };
91
+ export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorList, CarouselItem as Item, CarouselItemList as ItemList, CarouselRoot as Root };
92
92
  }
93
93
  //#endregion
94
94
  export { carousel_parts_d_exports as Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps };
@@ -3,11 +3,11 @@
3
3
 
4
4
  import { __export } from "../../chunk-CTAAG5j7.js";
5
5
  import { For } from "../../for-BYsFEk3R.js";
6
- import { ShowContent, ShowFallback, ShowRoot } from "../../show-N1ZXBhoA.js";
6
+ import { ShowContent, ShowFallback, ShowRoot } from "../../show-CUDThO_Z.js";
7
7
  import { cnMerge } from "../../cn-DdD3uYxA.js";
8
+ import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
8
9
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
9
10
  import { useMemo, useState } from "react";
10
- import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
12
  import { createStore } from "@zayne-labs/toolkit-core";
13
13
  import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
@@ -272,14 +272,14 @@ function CarouselIndicator(props) {
272
272
 
273
273
  //#endregion
274
274
  //#region src/components/ui/carousel/carousel-parts.ts
275
- var carousel_parts_exports = __export({
275
+ var carousel_parts_exports = /* @__PURE__ */ __export({
276
276
  Button: () => CarouselButton,
277
277
  Caption: () => CarouselCaption,
278
278
  Controls: () => CarouselControls,
279
279
  Indicator: () => CarouselIndicator,
280
- IndicatorGroup: () => CarouselIndicatorList,
280
+ IndicatorList: () => CarouselIndicatorList,
281
281
  Item: () => CarouselItem,
282
- ItemGroup: () => CarouselItemList,
282
+ ItemList: () => CarouselItemList,
283
283
  Root: () => CarouselRoot
284
284
  });
285
285