@zayne-labs/ui-react 0.10.39 → 0.10.41

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 (31) hide show
  1. package/css/preset.css +1 -1
  2. package/dist/esm/common/await/index.d.ts +6 -6
  3. package/dist/esm/common/await/index.js +1 -1
  4. package/dist/esm/common/client-gate/index.d.ts +2 -2
  5. package/dist/esm/common/error-boundary/index.d.ts +1 -1
  6. package/dist/esm/common/for/index.d.ts +4 -4
  7. package/dist/esm/common/presence/index.js +1 -1
  8. package/dist/esm/common/show/index.d.ts +4 -4
  9. package/dist/esm/common/slot/index.d.ts +4 -4
  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/switch/index.d.ts +4 -4
  13. package/dist/esm/common/teleport/index.d.ts +2 -2
  14. package/dist/esm/common/teleport/index.js +21 -12
  15. package/dist/esm/common/teleport/index.js.map +1 -1
  16. package/dist/esm/{index-DYKwNSzB.d.ts → index-ClrHf6FU.d.ts} +5 -5
  17. package/dist/esm/{index-BpohqQE-.d.ts → index-U3_Q7EUG.d.ts} +4 -4
  18. package/dist/esm/{presence-DNwNWipt.js → presence-5mRo32XH.js} +2 -2
  19. package/dist/esm/{presence-DNwNWipt.js.map → presence-5mRo32XH.js.map} +1 -1
  20. package/dist/esm/{slot--lEkrAQf.js → slot-CURylbjq.js} +7 -7
  21. package/dist/esm/{slot--lEkrAQf.js.map → slot-CURylbjq.js.map} +1 -1
  22. package/dist/esm/ui/card/index.d.ts +8 -8
  23. package/dist/esm/ui/card/index.js +1 -1
  24. package/dist/esm/ui/carousel/index.d.ts +9 -9
  25. package/dist/esm/ui/drop-zone/index.d.ts +16 -16
  26. package/dist/esm/ui/drop-zone/index.js +2 -2
  27. package/dist/esm/ui/form/index.d.ts +43 -61
  28. package/dist/esm/ui/form/index.js +37 -26
  29. package/dist/esm/ui/form/index.js.map +1 -1
  30. package/dist/style.css +1 -4
  31. package/package.json +8 -8
package/css/preset.css CHANGED
@@ -2,4 +2,4 @@
2
2
  @import "./animation.css";
3
3
  @import "./utilities.css";
4
4
 
5
- @source "../dist/esm/**/*.js";
5
+ @source "../dist/**/*.js";
@@ -1,8 +1,8 @@
1
- import { a as ErrorBoundaryProps } from "../../index-DYKwNSzB.js";
2
- import { n as SuspenseWithBoundaryProps } from "../../index-BpohqQE-.js";
1
+ import { a as ErrorBoundaryProps } from "../../index-ClrHf6FU.js";
2
+ import { n as SuspenseWithBoundaryProps } from "../../index-U3_Q7EUG.js";
3
3
  import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
4
- import * as react38 from "react";
5
- import * as react_jsx_runtime48 from "react/jsx-runtime";
4
+ import * as react27 from "react";
5
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/common/await/await.d.ts
8
8
  type RenderPropFn<TValue> = (result: TValue) => React.ReactNode;
@@ -14,9 +14,9 @@ type AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, "errorFallback" |
14
14
  withErrorBoundary?: boolean;
15
15
  withSuspense?: boolean;
16
16
  };
17
- declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime48.JSX.Element;
17
+ declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime18.JSX.Element;
18
18
  type AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<"default", ChildrenType<TValue>>;
19
- declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): react38.ReactNode;
19
+ declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): react27.ReactNode;
20
20
  type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["fallback"]>;
21
21
  declare const AwaitError: {
22
22
  (props: Pick<AwaitErrorProps, "children"> & {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { t as __export } from "../../chunk-BL-4obUL.js";
4
4
  import { n as ErrorBoundary, r as useErrorBoundaryContext } from "../../error-boundary-TM4xzQfq.js";
5
- import { n as SlotRoot } from "../../slot--lEkrAQf.js";
5
+ import { n as SlotRoot } from "../../slot-CURylbjq.js";
6
6
  import { getSlotMap, withSlotNameAndSymbol } from "@zayne-labs/toolkit-react/utils";
7
7
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
8
8
  import { Fragment, Suspense, use, useMemo } from "react";
@@ -1,4 +1,4 @@
1
- import * as react13 from "react";
1
+ import * as react21 from "react";
2
2
 
3
3
  //#region src/components/common/client-gate/client-gate.d.ts
4
4
  type ClientGateProps = {
@@ -27,7 +27,7 @@ type ClientGateProps = {
27
27
  * );
28
28
  * ```
29
29
  */
30
- declare function ClientGate(props: ClientGateProps): react13.ReactNode;
30
+ declare function ClientGate(props: ClientGateProps): react21.ReactNode;
31
31
  //#endregion
32
32
  export { ClientGate };
33
33
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import { a as ErrorBoundaryProps, i as ErrorBoundary, n as ErrorBoundaryContextType, o as FallbackProps, r as useErrorBoundaryContext, t as useErrorBoundary } from "../../index-DYKwNSzB.js";
1
+ import { a as ErrorBoundaryProps, i as ErrorBoundary, n as ErrorBoundaryContextType, o as FallbackProps, r as useErrorBoundaryContext, t as useErrorBoundary } from "../../index-ClrHf6FU.js";
2
2
  export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
@@ -1,7 +1,7 @@
1
1
  import { DiscriminatedRenderItemProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
2
  import { Prettify } from "@zayne-labs/toolkit-type-helpers";
3
- import * as react26 from "react";
4
- import * as react_jsx_runtime47 from "react/jsx-runtime";
3
+ import * as react8 from "react";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/common/for/for.d.ts
7
7
  type ArrayOrNumber = number | readonly unknown[];
@@ -12,10 +12,10 @@ type ForProps<TArray extends ArrayOrNumber> = Prettify<{
12
12
  each: TArray;
13
13
  fallback?: React.ReactNode;
14
14
  } & ForRenderProps<TArray>>;
15
- declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean | react26.ReactElement<unknown, string | react26.JSXElementConstructor<any>> | Iterable<react26.ReactNode> | Promise<string | number | bigint | boolean | react26.ReactPortal | react26.ReactElement<unknown, string | react26.JSXElementConstructor<any>> | Iterable<react26.ReactNode> | null | undefined> | null;
15
+ declare function For<const TArray extends ArrayOrNumber>(props: ForProps<TArray>): string | number | bigint | boolean | react8.ReactElement<unknown, string | react8.JSXElementConstructor<any>> | Iterable<react8.ReactNode> | Promise<string | number | bigint | boolean | react8.ReactPortal | react8.ReactElement<unknown, string | react8.JSXElementConstructor<any>> | Iterable<react8.ReactNode> | null | undefined> | null;
16
16
  declare function ForWithWrapper<const TArray extends ArrayOrNumber, TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, ForProps<TArray>> & {
17
17
  displayFallBackWhenEmpty?: boolean;
18
- }): string | number | bigint | boolean | react_jsx_runtime47.JSX.Element | Iterable<react26.ReactNode> | Promise<string | number | bigint | boolean | react26.ReactPortal | react26.ReactElement<unknown, string | react26.JSXElementConstructor<any>> | Iterable<react26.ReactNode> | null | undefined> | null;
18
+ }): string | number | bigint | boolean | react_jsx_runtime0.JSX.Element | Iterable<react8.ReactNode> | Promise<string | number | bigint | boolean | react8.ReactPortal | react8.ReactElement<unknown, string | react8.JSXElementConstructor<any>> | Iterable<react8.ReactNode> | null | undefined> | null;
19
19
  //#endregion
20
20
  //#region src/components/common/for/getElementList.d.ts
21
21
  type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
@@ -1,5 +1,5 @@
1
1
  "use client";
2
2
 
3
- import { t as Presence } from "../../presence-DNwNWipt.js";
3
+ import { t as Presence } from "../../presence-5mRo32XH.js";
4
4
 
5
5
  export { Presence };
@@ -1,4 +1,4 @@
1
- import * as react4 from "react";
1
+ import * as react0 from "react";
2
2
 
3
3
  //#region src/components/common/show/show.d.ts
4
4
  type ShowProps<TWhen> = {
@@ -12,15 +12,15 @@ type ShowProps<TWhen> = {
12
12
  fallback?: React.ReactNode;
13
13
  when: false | TWhen | null | undefined;
14
14
  };
15
- declare function ShowRoot<TWhen>(props: ShowProps<TWhen>): string | number | bigint | boolean | react4.ReactElement<unknown, string | react4.JSXElementConstructor<any>> | Iterable<react4.ReactNode> | Promise<string | number | bigint | boolean | react4.ReactPortal | react4.ReactElement<unknown, string | react4.JSXElementConstructor<any>> | Iterable<react4.ReactNode> | null | undefined> | null;
15
+ declare function ShowRoot<TWhen>(props: ShowProps<TWhen>): string | number | bigint | boolean | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<react0.ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<react0.ReactNode> | null | undefined> | null;
16
16
  type ShowContentProps<TWhen> = Pick<ShowProps<TWhen>, "children" | "when">;
17
- declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): react4.ReactNode;
17
+ declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): react0.ReactNode;
18
18
  declare namespace ShowContent {
19
19
  var slotSymbol: symbol;
20
20
  }
21
21
  declare function ShowFallback(props: {
22
22
  children: React.ReactNode;
23
- }): react4.ReactNode;
23
+ }): react0.ReactNode;
24
24
  declare namespace ShowFallback {
25
25
  var slotSymbol: symbol;
26
26
  }
@@ -1,15 +1,15 @@
1
1
  import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
- import * as react3 from "react";
3
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react26 from "react";
3
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/common/slot/slot.d.ts
6
6
  type SlotProps = InferProps<HTMLElement> & {
7
7
  ref?: React.Ref<HTMLElement>;
8
8
  };
9
- declare function SlotRoot(props: SlotProps): react_jsx_runtime1.JSX.Element | null;
9
+ declare function SlotRoot(props: SlotProps): react_jsx_runtime17.JSX.Element | null;
10
10
  declare function SlotSlottable({
11
11
  children
12
- }: Pick<SlotProps, "children">): react3.ReactNode;
12
+ }: Pick<SlotProps, "children">): react26.ReactNode;
13
13
  declare namespace slot_parts_d_exports {
14
14
  export { SlotRoot as Root, SlotSlottable as Slottable };
15
15
  }
@@ -1,3 +1,3 @@
1
- import { n as SlotRoot, r as SlotSlottable, t as slot_parts_exports } from "../../slot--lEkrAQf.js";
1
+ import { n as SlotRoot, r as SlotSlottable, t as slot_parts_exports } from "../../slot-CURylbjq.js";
2
2
 
3
3
  export { slot_parts_exports as Slot, SlotRoot, SlotSlottable };
@@ -1,3 +1,3 @@
1
- import "../../index-DYKwNSzB.js";
2
- import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-BpohqQE-.js";
1
+ import "../../index-ClrHf6FU.js";
2
+ import { n as SuspenseWithBoundaryProps, t as SuspenseWithBoundary } from "../../index-U3_Q7EUG.js";
3
3
  export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
@@ -1,4 +1,4 @@
1
- import * as react0 from "react";
1
+ import * as react23 from "react";
2
2
 
3
3
  //#region src/components/common/switch/switch.d.ts
4
4
  type ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;
@@ -6,17 +6,17 @@ type SwitchProps = {
6
6
  children: ValidSwitchComponentType | ValidSwitchComponentType[];
7
7
  value?: unknown;
8
8
  };
9
- declare function SwitchRoot(props: SwitchProps): react0.ReactNode;
9
+ declare function SwitchRoot(props: SwitchProps): react23.ReactNode;
10
10
  type SwitchMatchProps<TWhen> = {
11
11
  children: React.ReactNode | ((value: TWhen) => React.ReactNode);
12
12
  when: false | TWhen | null | undefined;
13
13
  };
14
- declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>): react0.ReactNode;
14
+ declare function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>): react23.ReactNode;
15
15
  declare function SwitchDefault({
16
16
  children
17
17
  }: {
18
18
  children: React.ReactNode;
19
- }): react0.ReactNode;
19
+ }): react23.ReactNode;
20
20
  declare namespace SwitchDefault {
21
21
  var slotSymbol: symbol;
22
22
  }
@@ -1,5 +1,5 @@
1
1
  import { AnyString } from "@zayne-labs/toolkit-type-helpers";
2
- import * as react0 from "react";
2
+ import * as react22 from "react";
3
3
 
4
4
  //#region src/components/common/teleport/teleport.d.ts
5
5
  type ValidHtmlTags = keyof HTMLElementTagNameMap;
@@ -8,7 +8,7 @@ type PortalProps = {
8
8
  insertPosition?: InsertPosition;
9
9
  to: AnyString | HTMLElement | ValidHtmlTags | null;
10
10
  };
11
- declare function Teleport(props: PortalProps): react0.ReactPortal | null;
11
+ declare function Teleport(props: PortalProps): react22.ReactPortal | null;
12
12
  //#endregion
13
13
  export { Teleport };
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1,33 +1,42 @@
1
1
  import { isString } from "@zayne-labs/toolkit-type-helpers";
2
- import { useEffectEvent, useLayoutEffect, useState } from "react";
2
+ import { useLayoutEffect, useState } from "react";
3
+ import { useCallbackRef } from "@zayne-labs/toolkit-react";
3
4
  import { createPortal } from "react-dom";
4
5
 
5
6
  //#region src/components/common/teleport/teleport.tsx
7
+ const TELEPORT_KEY = "teleport-wrapper";
6
8
  function Teleport(props) {
7
9
  const { children, insertPosition, to } = props;
8
10
  const [portalContainer, setPortalContainer] = useState(null);
9
- const updatePortalContainer = useEffectEvent((destination) => {
11
+ const stableUpdatePortalContainer = useCallbackRef((destination) => {
10
12
  setPortalContainer(destination);
11
13
  });
12
14
  useLayoutEffect(() => {
13
15
  if (!to) return;
14
- if (insertPosition) return;
15
- const destination = isString(to) ? document.querySelector(to) : to;
16
- destination && updatePortalContainer(destination);
17
- }, [to, insertPosition]);
18
- useLayoutEffect(() => {
19
- if (!to) return;
20
- if (!insertPosition) return;
21
16
  const destination = isString(to) ? document.querySelector(to) : to;
17
+ if (!insertPosition) {
18
+ destination && stableUpdatePortalContainer(destination);
19
+ return;
20
+ }
22
21
  const tempWrapper = document.createElement("div");
22
+ tempWrapper.id = TELEPORT_KEY;
23
23
  tempWrapper.style.display = "contents";
24
24
  destination?.insertAdjacentElement(insertPosition, tempWrapper);
25
- updatePortalContainer(tempWrapper);
25
+ const timeoutId = setTimeout(() => {
26
+ tempWrapper.replaceWith(...tempWrapper.children);
27
+ }, 0);
28
+ stableUpdatePortalContainer(tempWrapper);
26
29
  return () => {
27
30
  tempWrapper.remove();
31
+ clearTimeout(timeoutId);
28
32
  };
29
- }, [to, insertPosition]);
30
- return portalContainer && createPortal(children, portalContainer);
33
+ }, [
34
+ to,
35
+ insertPosition,
36
+ stableUpdatePortalContainer
37
+ ]);
38
+ if (!portalContainer) return null;
39
+ return createPortal(children, portalContainer, TELEPORT_KEY);
31
40
  }
32
41
 
33
42
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { type AnyString, isString } from \"@zayne-labs/toolkit-type-helpers\";\n\nimport { useEffectEvent, useLayoutEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\ntype PortalProps = {\n\tchildren: React.ReactNode;\n\tinsertPosition?: InsertPosition;\n\tto: AnyString | HTMLElement | ValidHtmlTags | null;\n};\n\nfunction Teleport(props: PortalProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\tconst updatePortalContainer = useEffectEvent((destination: HTMLElement | null) => {\n\t\tsetPortalContainer(destination);\n\t});\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\tif (insertPosition) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tdestination && updatePortalContainer(destination);\n\t}, [to, insertPosition]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\tif (!insertPosition) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tconst tempWrapper = document.createElement(\"div\");\n\t\ttempWrapper.style.display = \"contents\";\n\n\t\tdestination?.insertAdjacentElement(insertPosition, tempWrapper);\n\n\t\tupdatePortalContainer(tempWrapper);\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t};\n\t}, [to, insertPosition]);\n\n\treturn portalContainer && createPortal(children, portalContainer);\n}\n\nexport { Teleport };\n"],"mappings":";;;;;AAeA,SAAS,SAAS,OAAoB;CACrC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,KAAK;CAEhF,MAAM,wBAAwB,gBAAgB,gBAAoC;AACjF,qBAAmB,YAAY;GAC9B;AAEF,uBAAsB;AACrB,MAAI,CAAC,GAAI;AAET,MAAI,eAAgB;EAEpB,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;AAE7E,iBAAe,sBAAsB,YAAY;IAC/C,CAAC,IAAI,eAAe,CAAC;AAExB,uBAAsB;AACrB,MAAI,CAAC,GAAI;AAET,MAAI,CAAC,eAAgB;EAErB,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;EAE7E,MAAM,cAAc,SAAS,cAAc,MAAM;AACjD,cAAY,MAAM,UAAU;AAE5B,eAAa,sBAAsB,gBAAgB,YAAY;AAE/D,wBAAsB,YAAY;AAElC,eAAa;AACZ,eAAY,QAAQ;;IAEnB,CAAC,IAAI,eAAe,CAAC;AAExB,QAAO,mBAAmB,aAAa,UAAU,gBAAgB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { type AnyString, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useLayoutEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\ntype PortalProps = {\n\tchildren: React.ReactNode;\n\tinsertPosition?: InsertPosition;\n\tto: AnyString | HTMLElement | ValidHtmlTags | null;\n};\n\nconst TELEPORT_KEY = \"teleport-wrapper\";\n\nfunction Teleport(props: PortalProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\tconst stableUpdatePortalContainer = useCallbackRef((destination: HTMLElement | null) => {\n\t\tsetPortalContainer(destination);\n\t});\n\n\tuseLayoutEffect(() => {\n\t\tif (!to) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tif (!insertPosition) {\n\t\t\tdestination && stableUpdatePortalContainer(destination);\n\t\t\treturn;\n\t\t}\n\n\t\tconst tempWrapper = document.createElement(\"div\");\n\t\ttempWrapper.id = TELEPORT_KEY;\n\t\ttempWrapper.style.display = \"contents\";\n\n\t\tdestination?.insertAdjacentElement(insertPosition, tempWrapper);\n\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\ttempWrapper.replaceWith(...tempWrapper.children);\n\t\t}, 0);\n\n\t\tstableUpdatePortalContainer(tempWrapper);\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t\tclearTimeout(timeoutId);\n\t\t};\n\t}, [to, insertPosition, stableUpdatePortalContainer]);\n\n\tif (!portalContainer) {\n\t\treturn null;\n\t}\n\n\treturn createPortal(children, portalContainer, TELEPORT_KEY);\n}\n\nexport { Teleport };\n"],"mappings":";;;;;;AAeA,MAAM,eAAe;AAErB,SAAS,SAAS,OAAoB;CACrC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,KAAK;CAEhF,MAAM,8BAA8B,gBAAgB,gBAAoC;AACvF,qBAAmB,YAAY;GAC9B;AAEF,uBAAsB;AACrB,MAAI,CAAC,GAAI;EAET,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;AAE7E,MAAI,CAAC,gBAAgB;AACpB,kBAAe,4BAA4B,YAAY;AACvD;;EAGD,MAAM,cAAc,SAAS,cAAc,MAAM;AACjD,cAAY,KAAK;AACjB,cAAY,MAAM,UAAU;AAE5B,eAAa,sBAAsB,gBAAgB,YAAY;EAE/D,MAAM,YAAY,iBAAiB;AAClC,eAAY,YAAY,GAAG,YAAY,SAAS;KAC9C,EAAE;AAEL,8BAA4B,YAAY;AAExC,eAAa;AACZ,eAAY,QAAQ;AACpB,gBAAa,UAAU;;IAEtB;EAAC;EAAI;EAAgB;EAA4B,CAAC;AAErD,KAAI,CAAC,gBACJ,QAAO;AAGR,QAAO,aAAa,UAAU,iBAAiB,aAAa"}
@@ -1,7 +1,7 @@
1
- import * as react14 from "react";
1
+ import * as react20 from "react";
2
2
  import { Component } from "react";
3
3
  import * as _zayne_labs_toolkit_react0 from "@zayne-labs/toolkit-react";
4
- import * as react_jsx_runtime10 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/common/error-boundary/types.d.ts
7
7
  type FallbackProps = {
@@ -49,7 +49,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
49
49
  };
50
50
  componentDidCatch(error: Error, info: React.ErrorInfo): void;
51
51
  componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
52
- render(): react_jsx_runtime10.JSX.Element;
52
+ render(): react_jsx_runtime1.JSX.Element;
53
53
  }
54
54
  //#endregion
55
55
  //#region src/components/common/error-boundary/error-boundary-context.d.ts
@@ -58,7 +58,7 @@ type ErrorBoundaryContextType = {
58
58
  hasError: boolean;
59
59
  resetErrorBoundary: (...args: unknown[]) => void;
60
60
  };
61
- declare const ErrorBoundaryContext: react14.Context<ErrorBoundaryContextType>, useErrorBoundaryContext: _zayne_labs_toolkit_react0.UseCustomContext<ErrorBoundaryContextType, true>;
61
+ declare const ErrorBoundaryContext: react20.Context<ErrorBoundaryContextType>, useErrorBoundaryContext: _zayne_labs_toolkit_react0.UseCustomContext<ErrorBoundaryContextType, true>;
62
62
  //#endregion
63
63
  //#region src/components/common/error-boundary/useErrorBoundary.d.ts
64
64
  declare const useErrorBoundary: <TError extends Error>() => {
@@ -67,4 +67,4 @@ declare const useErrorBoundary: <TError extends Error>() => {
67
67
  };
68
68
  //#endregion
69
69
  export { ErrorBoundaryProps as a, ErrorBoundary as i, ErrorBoundaryContextType as n, FallbackProps as o, useErrorBoundaryContext as r, useErrorBoundary as t };
70
- //# sourceMappingURL=index-DYKwNSzB.d.ts.map
70
+ //# sourceMappingURL=index-ClrHf6FU.d.ts.map
@@ -1,5 +1,5 @@
1
- import { a as ErrorBoundaryProps } from "./index-DYKwNSzB.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import { a as ErrorBoundaryProps } from "./index-ClrHf6FU.js";
2
+ import * as react_jsx_runtime48 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/common/suspense-with-boundary/suspense-with-boundary.d.ts
5
5
  type SuspenseWithBoundaryProps = {
@@ -7,7 +7,7 @@ type SuspenseWithBoundaryProps = {
7
7
  errorFallback?: ErrorBoundaryProps["fallback"];
8
8
  fallback?: React.ReactNode;
9
9
  };
10
- declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): react_jsx_runtime0.JSX.Element;
10
+ declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): react_jsx_runtime48.JSX.Element;
11
11
  //#endregion
12
12
  export { SuspenseWithBoundaryProps as n, SuspenseWithBoundary as t };
13
- //# sourceMappingURL=index-BpohqQE-.d.ts.map
13
+ //# sourceMappingURL=index-U3_Q7EUG.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as SlotRoot } from "./slot--lEkrAQf.js";
1
+ import { n as SlotRoot } from "./slot-CURylbjq.js";
2
2
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
3
3
  import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
4
4
  import { useCallbackRef, useComposeRefs, useToggle } from "@zayne-labs/toolkit-react";
@@ -208,4 +208,4 @@ function Presence(props) {
208
208
 
209
209
  //#endregion
210
210
  export { Presence as t };
211
- //# sourceMappingURL=presence-DNwNWipt.js.map
211
+ //# sourceMappingURL=presence-5mRo32XH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"presence-DNwNWipt.js","names":["timeoutId: number","getPresenceProps: UsePresenceResult[\"propGetters\"][\"getPresenceProps\"]","Slot.Root"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { dataAttr, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useToggle } from \"@zayne-labs/toolkit-react\";\nimport type { InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from \"react\";\n\ntype StateMachineConfig<TState extends string, TEvent extends string> = {\n\tinitial: TState;\n\tstates: Record<TState, Partial<Record<TEvent, TState>>>;\n};\n\nconst useStateMachine = <TState extends string, TEvent extends string>(\n\tconfig: StateMachineConfig<TState, TEvent>\n) => {\n\tconst reducer = (prevState: TState, event: TEvent): TState => {\n\t\tconst newState = config.states[prevState][event] ?? prevState;\n\n\t\treturn newState;\n\t};\n\n\treturn useReducer(reducer, config.initial);\n};\n\nconst getAnimationName = (styles: CSSStyleDeclaration | null) => styles?.animationName ?? \"none\";\n\nexport type UsePresenceOptions = {\n\tonExitComplete?: () => void;\n\tpresent: boolean;\n\t/**\n\t * @default \"animation\"\n\t */\n\tvariant?: \"animation\" | \"transition\";\n};\n\nexport type UsePresenceResult = {\n\tisPresent: boolean;\n\tisPresentOrIsTransitionComplete: boolean;\n\tpropGetters: {\n\t\tgetPresenceProps: (innerProps: InferProps<HTMLElement>) => InferProps<HTMLElement>;\n\t};\n\tref: React.Ref<HTMLElement>;\n\tshouldStartTransition: boolean;\n};\n\n/**\n * React hook that provides the ability to animate the mount/unmount of a component.\n * @see https://github.com/radix-ui/primitives/blob/main/packages/react/presence/src/presence.tsx\n */\n\nconst usePresence = (options: UsePresenceOptions): UsePresenceResult => {\n\tconst { onExitComplete, present: presentProp, variant = \"animation\" } = options;\n\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst [node, setNode] = useState<HTMLElement | null>(null);\n\n\tconst [hasTransitioned, toggleHasTransitioned] = useToggle(false);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevNodeStateRef = useRef<{\n\t\tprevAnimationName: string;\n\t\tprevPresent: boolean;\n\t}>({\n\t\tprevAnimationName: \"none\",\n\t\tprevPresent: presentProp,\n\t});\n\n\tconst initialState = presentProp ? \"mounted\" : \"unmounted\";\n\n\tconst [state, send] = useStateMachine({\n\t\tinitial: initialState,\n\t\tstates: {\n\t\t\tmounted: {\n\t\t\t\tANIMATION_OUT: \"unmountSuspended\",\n\t\t\t\tUNMOUNT: \"unmounted\",\n\t\t\t},\n\t\t\tunmounted: {\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t\tunmountSuspended: {\n\t\t\t\tANIMATION_END: \"unmounted\",\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t},\n\t});\n\n\tuseEffect(() => {\n\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\tprevNodeStateRef.current.prevAnimationName = state === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [state]);\n\n\tuseLayoutEffect(() => {\n\t\tconst styles = stylesRef.current;\n\t\tconst wasPresent = prevNodeStateRef.current.prevPresent;\n\t\tconst hasPresentChanged = wasPresent !== presentProp;\n\n\t\tif (!hasPresentChanged) return;\n\n\t\tconst prevAnimationName = prevNodeStateRef.current.prevAnimationName;\n\t\tconst currentAnimationName = getAnimationName(styles);\n\n\t\tswitch (true) {\n\t\t\tcase presentProp: {\n\t\t\t\tsend(\"MOUNT\");\n\n\t\t\t\tif (variant === \"transition\") {\n\t\t\t\t\trequestAnimationFrame(() => toggleHasTransitioned(true));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node) && variant === \"animation\": {\n\t\t\t\tconst hasAnimation = currentAnimationName !== \"none\" && styles?.display !== \"none\";\n\n\t\t\t\t/**\n\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t * computed styles) because there is no `animationrun` event (like the `transitionrun` event) and `animationstart`\n\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t */\n\n\t\t\t\tconst isAnimationStarted = hasAnimation && prevAnimationName !== currentAnimationName;\n\n\t\t\t\tconst isAnimatingOut = wasPresent && isAnimationStarted;\n\n\t\t\t\tsend(isAnimatingOut ? \"ANIMATION_OUT\" : \"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprevNodeStateRef.current.prevPresent = presentProp;\n\t}, [presentProp, node, send, variant, toggleHasTransitioned]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!node) {\n\t\t\t// Transition to the unmounted state if the node is removed prematurely.\n\t\t\t// We avoid doing so during cleanup as the node may change but still exist.\n\t\t\tsend(\"ANIMATION_END\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet timeoutId: number;\n\n\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\tprevNodeStateRef.current.prevAnimationName = getAnimationName(stylesRef.current);\n\t\t};\n\n\t\t/**\n\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t */\n\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\t\t// The event.animationName is unescaped for CSS syntax, so we need to escape it to compare with the animationName computed from the style.\n\t\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t// user-provided event handlers would not be called.\n\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\tif (!prevNodeStateRef.current.prevPresent) {\n\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t// still causes a flash.\n\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t}\n\t\t\t\t}) as never;\n\t\t\t}\n\t\t};\n\n\t\tconst handleTransitionRun = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_OUT\");\n\t\t};\n\n\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node && !prevNodeStateRef.current.prevPresent;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_END\");\n\t\t};\n\n\t\tconst onAnimationStartCleanup = on(\"animationstart\", node, handleAnimationStart);\n\t\tconst onAnimationEndCleanup = on(\"animationend\", node, handleAnimationEnd);\n\t\tconst onAnimationCancelCleanup = on(\"animationcancel\", node, handleAnimationEnd);\n\n\t\tconst onTransitionRunCleanup = on(\"transitionrun\", node, handleTransitionRun);\n\t\tconst onTransitionEndCleanup = on(\"transitionend\", node, handleTransitionEnd);\n\t\tconst onTransitionCancelCleanup = on(\"transitioncancel\", node, handleTransitionEnd);\n\n\t\treturn () => {\n\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\tonAnimationStartCleanup();\n\t\t\tonAnimationEndCleanup();\n\t\t\tonAnimationCancelCleanup();\n\n\t\t\tonTransitionRunCleanup();\n\t\t\tonTransitionEndCleanup();\n\t\t\tonTransitionCancelCleanup();\n\t\t};\n\t}, [node, send]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = state === \"unmounted\" && !presentProp;\n\n\t\tif (isExitCompleted) {\n\t\t\ttoggleHasTransitioned(false);\n\t\t\tstableOnExitComplete?.();\n\t\t}\n\t}, [state, presentProp, stableOnExitComplete, toggleHasTransitioned]);\n\n\tconst ref = useCallbackRef((refNode: HTMLElement | null) => {\n\t\tsetNode(refNode);\n\n\t\tif (refNode) {\n\t\t\tstylesRef.current = getComputedStyle(refNode);\n\t\t}\n\t});\n\n\tconst MOUNTED_STATES = [\"mounted\", \"unmountSuspended\"] satisfies Array<typeof state>;\n\tconst isPresent = MOUNTED_STATES.includes(state);\n\tconst isPresentOrIsTransitionComplete = isPresent || hasTransitioned;\n\tconst shouldStartTransition = presentProp && hasTransitioned;\n\n\tconst getPresenceProps: UsePresenceResult[\"propGetters\"][\"getPresenceProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst transitionState = shouldStartTransition ? \"active\" : \"inactive\";\n\n\t\t\treturn {\n\t\t\t\t\"data-present\": dataAttr(isPresent),\n\t\t\t\t\"data-present-or-transition-complete\": dataAttr(isPresentOrIsTransitionComplete),\n\t\t\t\t\"data-state\": state,\n\t\t\t\t...(variant === \"transition\" && { \"data-transition\": transitionState }),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: innerProps.className,\n\t\t\t};\n\t\t},\n\t\t[isPresent, isPresentOrIsTransitionComplete, shouldStartTransition, state, variant]\n\t);\n\n\tconst propGetters = useMemo(() => ({ getPresenceProps }), [getPresenceProps]);\n\n\tconst result = useMemo<UsePresenceResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tisPresent,\n\t\t\t\tisPresentOrIsTransitionComplete,\n\t\t\t\tpropGetters,\n\t\t\t\tref,\n\t\t\t\tshouldStartTransition,\n\t\t\t}) satisfies UsePresenceResult,\n\t\t[isPresent, isPresentOrIsTransitionComplete, propGetters, ref, shouldStartTransition]\n\t);\n\n\treturn result;\n};\n\nexport { usePresence };\n","\"use client\";\n\nimport { useComposeRefs } from \"@zayne-labs/toolkit-react\";\nimport { isFunction, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\n\nimport { Slot } from \"../slot\";\nimport { usePresence, type UsePresenceOptions, type UsePresenceResult } from \"./use-presence\";\n\ntype RefProp = { ref?: React.Ref<HTMLElement> };\n\ntype RenderPropContext = Omit<UsePresenceResult, \"propGetters\" | \"ref\">;\n\ntype PresenceProps = UsePresenceOptions & {\n\tchildren?: React.ReactElement<RefProp> | ((props: RenderPropContext) => React.ReactElement<RefProp>);\n\tclassName?: string;\n\tforceMount?: boolean;\n};\n\nfunction Presence(props: PresenceProps) {\n\tconst { children, className, forceMount = false, onExitComplete, present, variant } = props;\n\n\tconst {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tpropGetters,\n\t\tref: presenceRef,\n\t\tshouldStartTransition,\n\t} = usePresence({ onExitComplete, present, variant });\n\n\tconst context = {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tshouldStartTransition,\n\t} satisfies RenderPropContext;\n\n\tconst resolvedChild = isFunction(children) ? children(context) : children;\n\n\tconst childRef = (resolvedChild?.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = useComposeRefs(presenceRef, childRef);\n\n\tconst shouldRender =\n\t\tforceMount || (variant === \"transition\" ? isPresentOrIsTransitionComplete : isPresent);\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Slot.Root ref={ref} {...propGetters.getPresenceProps({ className })}>\n\t\t\t{resolvedChild}\n\t\t</Slot.Root>\n\t);\n}\n\nexport { Presence };\n"],"mappings":";;;;;;;;AAUA,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;;;;;AA0B1F,MAAM,eAAe,YAAmD;CACvE,MAAM,EAAE,gBAAgB,SAAS,aAAa,UAAU,gBAAgB;CAExE,MAAM,uBAAuB,eAAe,eAAe;CAE3D,MAAM,CAAC,MAAM,WAAW,SAA6B,KAAK;CAE1D,MAAM,CAAC,iBAAiB,yBAAyB,UAAU,MAAM;CAEjE,MAAM,YAAY,OAAmC,KAAK;CAE1D,MAAM,mBAAmB,OAGtB;EACF,mBAAmB;EACnB,aAAa;EACb,CAAC;CAIF,MAAM,CAAC,OAAO,QAAQ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M,kCAAkC,aAAa;CACrD,MAAM,wBAAwB,eAAe;CAE7C,MAAMC,mBAAyE,aAC7E,eAAe;EACf,MAAM,kBAAkB,wBAAwB,WAAW;AAE3D,SAAO;GACN,gBAAgB,SAAS,UAAU;GACnC,uCAAuC,SAAS,gCAAgC;GAChF,cAAc;GACd,GAAI,YAAY,gBAAgB,EAAE,mBAAmB,iBAAiB;GACtE,GAAG;GACH,WAAW,WAAW;GACtB;IAEF;EAAC;EAAW;EAAiC;EAAuB;EAAO;EAAQ,CACnF;CAED,MAAM,cAAc,eAAe,EAAE,kBAAkB,GAAG,CAAC,iBAAiB,CAAC;AAc7E,QAZe,eAEZ;EACA;EACA;EACA;EACA;EACA;EACA,GACF;EAAC;EAAW;EAAiC;EAAa;EAAK;EAAsB,CACrF;;;;;AC9QF,SAAS,SAAS,OAAsB;CACvC,MAAM,EAAE,UAAU,WAAW,aAAa,OAAO,gBAAgB,SAAS,YAAY;CAEtF,MAAM,EACL,WACA,iCACA,aACA,KAAK,aACL,0BACG,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,kCAAkC,YAG5E,QAAO;AAGR,QACC,oBAACC;EAAe;EAAK,GAAI,YAAY,iBAAiB,EAAE,WAAW,CAAC;YAClE;GACU"}
1
+ {"version":3,"file":"presence-5mRo32XH.js","names":["timeoutId: number","getPresenceProps: UsePresenceResult[\"propGetters\"][\"getPresenceProps\"]","Slot.Root"],"sources":["../../src/components/common/presence/use-presence.ts","../../src/components/common/presence/presence.tsx"],"sourcesContent":["import { dataAttr, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useToggle } from \"@zayne-labs/toolkit-react\";\nimport type { InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from \"react\";\n\ntype StateMachineConfig<TState extends string, TEvent extends string> = {\n\tinitial: TState;\n\tstates: Record<TState, Partial<Record<TEvent, TState>>>;\n};\n\nconst useStateMachine = <TState extends string, TEvent extends string>(\n\tconfig: StateMachineConfig<TState, TEvent>\n) => {\n\tconst reducer = (prevState: TState, event: TEvent): TState => {\n\t\tconst newState = config.states[prevState][event] ?? prevState;\n\n\t\treturn newState;\n\t};\n\n\treturn useReducer(reducer, config.initial);\n};\n\nconst getAnimationName = (styles: CSSStyleDeclaration | null) => styles?.animationName ?? \"none\";\n\nexport type UsePresenceOptions = {\n\tonExitComplete?: () => void;\n\tpresent: boolean;\n\t/**\n\t * @default \"animation\"\n\t */\n\tvariant?: \"animation\" | \"transition\";\n};\n\nexport type UsePresenceResult = {\n\tisPresent: boolean;\n\tisPresentOrIsTransitionComplete: boolean;\n\tpropGetters: {\n\t\tgetPresenceProps: (innerProps: InferProps<HTMLElement>) => InferProps<HTMLElement>;\n\t};\n\tref: React.Ref<HTMLElement>;\n\tshouldStartTransition: boolean;\n};\n\n/**\n * React hook that provides the ability to animate the mount/unmount of a component.\n * @see https://github.com/radix-ui/primitives/blob/main/packages/react/presence/src/presence.tsx\n */\n\nconst usePresence = (options: UsePresenceOptions): UsePresenceResult => {\n\tconst { onExitComplete, present: presentProp, variant = \"animation\" } = options;\n\n\tconst stableOnExitComplete = useCallbackRef(onExitComplete);\n\n\tconst [node, setNode] = useState<HTMLElement | null>(null);\n\n\tconst [hasTransitioned, toggleHasTransitioned] = useToggle(false);\n\n\tconst stylesRef = useRef<CSSStyleDeclaration | null>(null);\n\n\tconst prevNodeStateRef = useRef<{\n\t\tprevAnimationName: string;\n\t\tprevPresent: boolean;\n\t}>({\n\t\tprevAnimationName: \"none\",\n\t\tprevPresent: presentProp,\n\t});\n\n\tconst initialState = presentProp ? \"mounted\" : \"unmounted\";\n\n\tconst [state, send] = useStateMachine({\n\t\tinitial: initialState,\n\t\tstates: {\n\t\t\tmounted: {\n\t\t\t\tANIMATION_OUT: \"unmountSuspended\",\n\t\t\t\tUNMOUNT: \"unmounted\",\n\t\t\t},\n\t\t\tunmounted: {\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t\tunmountSuspended: {\n\t\t\t\tANIMATION_END: \"unmounted\",\n\t\t\t\tMOUNT: \"mounted\",\n\t\t\t},\n\t\t},\n\t});\n\n\tuseEffect(() => {\n\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\tprevNodeStateRef.current.prevAnimationName = state === \"mounted\" ? currentAnimationName : \"none\";\n\t}, [state]);\n\n\tuseLayoutEffect(() => {\n\t\tconst styles = stylesRef.current;\n\t\tconst wasPresent = prevNodeStateRef.current.prevPresent;\n\t\tconst hasPresentChanged = wasPresent !== presentProp;\n\n\t\tif (!hasPresentChanged) return;\n\n\t\tconst prevAnimationName = prevNodeStateRef.current.prevAnimationName;\n\t\tconst currentAnimationName = getAnimationName(styles);\n\n\t\tswitch (true) {\n\t\t\tcase presentProp: {\n\t\t\t\tsend(\"MOUNT\");\n\n\t\t\t\tif (variant === \"transition\") {\n\t\t\t\t\trequestAnimationFrame(() => toggleHasTransitioned(true));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Boolean(node) && variant === \"animation\": {\n\t\t\t\tconst hasAnimation = currentAnimationName !== \"none\" && styles?.display !== \"none\";\n\n\t\t\t\t/**\n\t\t\t\t * When `present` changes to `false`, we check changes to animation-name to\n\t\t\t\t * determine whether an animation has started. We chose this approach (reading\n\t\t\t\t * computed styles) because there is no `animationrun` event (like the `transitionrun` event) and `animationstart`\n\t\t\t\t * fires after `animation-delay` has expired which would be too late.\n\t\t\t\t */\n\n\t\t\t\tconst isAnimationStarted = hasAnimation && prevAnimationName !== currentAnimationName;\n\n\t\t\t\tconst isAnimatingOut = wasPresent && isAnimationStarted;\n\n\t\t\t\tsend(isAnimatingOut ? \"ANIMATION_OUT\" : \"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tsend(\"UNMOUNT\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprevNodeStateRef.current.prevPresent = presentProp;\n\t}, [presentProp, node, send, variant, toggleHasTransitioned]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!node) {\n\t\t\t// Transition to the unmounted state if the node is removed prematurely.\n\t\t\t// We avoid doing so during cleanup as the node may change but still exist.\n\t\t\tsend(\"ANIMATION_END\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet timeoutId: number;\n\n\t\tconst ownerWindow = node.ownerDocument.defaultView ?? globalThis;\n\n\t\tconst handleAnimationStart = (event: AnimationEvent) => {\n\t\t\tconst isTargetAnimatingNode = event.target === node;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\tprevNodeStateRef.current.prevAnimationName = getAnimationName(stylesRef.current);\n\t\t};\n\n\t\t/**\n\t\t * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`\n\t\t * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we\n\t\t * make sure we only trigger ANIMATION_END for the currently active animation.\n\t\t */\n\t\tconst handleAnimationEnd = (event: AnimationEvent) => {\n\t\t\tconst currentAnimationName = getAnimationName(stylesRef.current);\n\n\t\t\t// The event.animationName is unescaped for CSS syntax, so we need to escape it to compare with the animationName computed from the style.\n\t\t\tconst isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n\n\t\t\tconst isTargetAnimatingNode = event.target === node && isCurrentAnimation;\n\n\t\t\tif (!isTargetAnimatingNode) return;\n\n\t\t\t// With React 18 concurrency this update is applied a frame after the\n\t\t\t// animation ends, creating a flash of visible content. By setting the\n\t\t\t// animation fill mode to \"forwards\", we force the node to keep the\n\t\t\t// styles of the last keyframe, removing the flash.\n\n\t\t\t// Previously we flushed the update via ReactDom.flushSync, but with\n\t\t\t// exit animations this resulted in the node being removed from the\n\t\t\t// DOM before the synthetic animationEnd event was dispatched, meaning\n\t\t\t// user-provided event handlers would not be called.\n\t\t\t// https://github.com/radix-ui/primitives/pull/1849\n\t\t\tsend(\"ANIMATION_END\");\n\n\t\t\tif (!prevNodeStateRef.current.prevPresent) {\n\t\t\t\tconst currentFillMode = node.style.animationFillMode;\n\t\t\t\tnode.style.animationFillMode = \"forwards\";\n\n\t\t\t\t// Reset the style after the node had time to unmount (for cases\n\t\t\t\t// where the component chooses not to unmount). Doing this any\n\t\t\t\t// sooner than `setTimeout` (e.g. with `requestAnimationFrame`)\n\t\t\t\t// still causes a flash.\n\t\t\t\ttimeoutId = ownerWindow.setTimeout(() => {\n\t\t\t\t\tif (node.style.animationFillMode === \"forwards\") {\n\t\t\t\t\t\tnode.style.animationFillMode = currentFillMode;\n\t\t\t\t\t}\n\t\t\t\t}) as never;\n\t\t\t}\n\t\t};\n\n\t\tconst handleTransitionRun = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_OUT\");\n\t\t};\n\n\t\tconst handleTransitionEnd = (event: TransitionEvent) => {\n\t\t\tconst isTargetTransitioningNode = event.target === node && !prevNodeStateRef.current.prevPresent;\n\n\t\t\tif (!isTargetTransitioningNode) return;\n\n\t\t\tsend(\"ANIMATION_END\");\n\t\t};\n\n\t\tconst onAnimationStartCleanup = on(\"animationstart\", node, handleAnimationStart);\n\t\tconst onAnimationEndCleanup = on(\"animationend\", node, handleAnimationEnd);\n\t\tconst onAnimationCancelCleanup = on(\"animationcancel\", node, handleAnimationEnd);\n\n\t\tconst onTransitionRunCleanup = on(\"transitionrun\", node, handleTransitionRun);\n\t\tconst onTransitionEndCleanup = on(\"transitionend\", node, handleTransitionEnd);\n\t\tconst onTransitionCancelCleanup = on(\"transitioncancel\", node, handleTransitionEnd);\n\n\t\treturn () => {\n\t\t\townerWindow.clearTimeout(timeoutId);\n\t\t\tonAnimationStartCleanup();\n\t\t\tonAnimationEndCleanup();\n\t\t\tonAnimationCancelCleanup();\n\n\t\t\tonTransitionRunCleanup();\n\t\t\tonTransitionEndCleanup();\n\t\t\tonTransitionCancelCleanup();\n\t\t};\n\t}, [node, send]);\n\n\tuseEffect(() => {\n\t\tconst isExitCompleted = state === \"unmounted\" && !presentProp;\n\n\t\tif (isExitCompleted) {\n\t\t\ttoggleHasTransitioned(false);\n\t\t\tstableOnExitComplete?.();\n\t\t}\n\t}, [state, presentProp, stableOnExitComplete, toggleHasTransitioned]);\n\n\tconst ref = useCallbackRef((refNode: HTMLElement | null) => {\n\t\tsetNode(refNode);\n\n\t\tif (refNode) {\n\t\t\tstylesRef.current = getComputedStyle(refNode);\n\t\t}\n\t});\n\n\tconst MOUNTED_STATES = [\"mounted\", \"unmountSuspended\"] satisfies Array<typeof state>;\n\tconst isPresent = MOUNTED_STATES.includes(state);\n\tconst isPresentOrIsTransitionComplete = isPresent || hasTransitioned;\n\tconst shouldStartTransition = presentProp && hasTransitioned;\n\n\tconst getPresenceProps: UsePresenceResult[\"propGetters\"][\"getPresenceProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst transitionState = shouldStartTransition ? \"active\" : \"inactive\";\n\n\t\t\treturn {\n\t\t\t\t\"data-present\": dataAttr(isPresent),\n\t\t\t\t\"data-present-or-transition-complete\": dataAttr(isPresentOrIsTransitionComplete),\n\t\t\t\t\"data-state\": state,\n\t\t\t\t...(variant === \"transition\" && { \"data-transition\": transitionState }),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: innerProps.className,\n\t\t\t};\n\t\t},\n\t\t[isPresent, isPresentOrIsTransitionComplete, shouldStartTransition, state, variant]\n\t);\n\n\tconst propGetters = useMemo(() => ({ getPresenceProps }), [getPresenceProps]);\n\n\tconst result = useMemo<UsePresenceResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tisPresent,\n\t\t\t\tisPresentOrIsTransitionComplete,\n\t\t\t\tpropGetters,\n\t\t\t\tref,\n\t\t\t\tshouldStartTransition,\n\t\t\t}) satisfies UsePresenceResult,\n\t\t[isPresent, isPresentOrIsTransitionComplete, propGetters, ref, shouldStartTransition]\n\t);\n\n\treturn result;\n};\n\nexport { usePresence };\n","\"use client\";\n\nimport { useComposeRefs } from \"@zayne-labs/toolkit-react\";\nimport { isFunction, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\n\nimport { Slot } from \"../slot\";\nimport { usePresence, type UsePresenceOptions, type UsePresenceResult } from \"./use-presence\";\n\ntype RefProp = { ref?: React.Ref<HTMLElement> };\n\ntype RenderPropContext = Omit<UsePresenceResult, \"propGetters\" | \"ref\">;\n\ntype PresenceProps = UsePresenceOptions & {\n\tchildren?: React.ReactElement<RefProp> | ((props: RenderPropContext) => React.ReactElement<RefProp>);\n\tclassName?: string;\n\tforceMount?: boolean;\n};\n\nfunction Presence(props: PresenceProps) {\n\tconst { children, className, forceMount = false, onExitComplete, present, variant } = props;\n\n\tconst {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tpropGetters,\n\t\tref: presenceRef,\n\t\tshouldStartTransition,\n\t} = usePresence({ onExitComplete, present, variant });\n\n\tconst context = {\n\t\tisPresent,\n\t\tisPresentOrIsTransitionComplete,\n\t\tshouldStartTransition,\n\t} satisfies RenderPropContext;\n\n\tconst resolvedChild = isFunction(children) ? children(context) : children;\n\n\tconst childRef = (resolvedChild?.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = useComposeRefs(presenceRef, childRef);\n\n\tconst shouldRender =\n\t\tforceMount || (variant === \"transition\" ? isPresentOrIsTransitionComplete : isPresent);\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Slot.Root ref={ref} {...propGetters.getPresenceProps({ className })}>\n\t\t\t{resolvedChild}\n\t\t</Slot.Root>\n\t);\n}\n\nex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U;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,kCAAkC,YAG5E,QAAO;AAGR,QACC,oBAACC;EAAe;EAAK,GAAI,YAAY,iBAAiB,EAAE,WAAW,CAAC;YAClE;GACU"}
@@ -36,12 +36,12 @@ const isSlottable = (child) => {
36
36
  function SlotClone(props) {
37
37
  const { children, ref: forwardedRef, ...restOfSlotProps } = props;
38
38
  if (Children.count(children) > 1) return Children.only(null);
39
- const resolvedChildren = isArray(children) ? children[0] : children;
40
- if (!isValidElement(resolvedChildren)) return null;
41
- const ref = composeRefs(forwardedRef, resolvedChildren.props.ref ?? resolvedChildren.ref);
42
- return cloneElement(resolvedChildren, {
43
- ...mergeProps(restOfSlotProps, resolvedChildren.props),
44
- ...resolvedChildren.type !== Fragment && { ref }
39
+ const resolvedChild = isArray(children) ? children[0] : children;
40
+ if (!isValidElement(resolvedChild)) return null;
41
+ const ref = composeRefs(forwardedRef, resolvedChild.props.ref ?? resolvedChild.ref);
42
+ return cloneElement(resolvedChild, {
43
+ ...mergeProps(restOfSlotProps, resolvedChild.props),
44
+ ...resolvedChild.type !== Fragment && { ref }
45
45
  });
46
46
  }
47
47
 
@@ -54,4 +54,4 @@ var slot_parts_exports = /* @__PURE__ */ __export({
54
54
 
55
55
  //#endregion
56
56
  export { SlotRoot as n, SlotSlottable as r, slot_parts_exports as t };
57
- //# sourceMappingURL=slot--lEkrAQf.js.map
57
+ //# sourceMappingURL=slot-CURylbjq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot--lEkrAQf.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\";\n\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 newElement = slottable.props.children;\n\n\tif (Children.count(newElement) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedNewElement = isArray(newElement) ? newElement[0] : newElement;\n\n\tif (!isValidElement(resolvedNewElement)) {\n\t\treturn 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 (resolvedNewElement.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(resolvedNewElement, undefined, newChildren)}\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 resolvedChildren = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChildren)) {\n\t\treturn null;\n\t}\n\n\tconst childRef = (resolvedChildren.props.ref\n\t\t?? (resolvedChildren as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = composeRefs(forwardedRef, childRef);\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChildren.props),\n\t\t...(resolvedChildren.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChildren, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;;AAWA,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;EAAU,GAAI;EAAkB;GAAqB;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,aAAa,UAAU,MAAM;AAEnC,KAAI,SAAS,MAAM,WAAW,GAAG,EAChC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,qBAAqB,QAAQ,WAAW,GAAG,WAAW,KAAK;AAEjE,KAAI,CAAC,eAAe,mBAAmB,CACtC,QAAO;CAGR,MAAM,cAAc,cAAc,KAAK,UAAU;AAChD,MAAI,UAAU,UAEb,QAAQ,mBAAmB,MAAoB;AAGhD,SAAO;GACN;AAEF,QACC,oBAAC;EAAU,GAAI;YACb,aAAa,oBAAoB,QAAW,YAAY;GAC9C;;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,mBAAmB,QAAQ,SAAS,GAAG,SAAS,KAAK;AAE3D,KAAI,CAAC,eAA8B,iBAAiB,CACnD,QAAO;CAMR,MAAM,MAAM,YAAY,cAHN,iBAAiB,MAAM,OACpC,iBAA8C,IAEJ;AAO/C,QAAO,aAAa,kBALA;EACnB,GAAG,WAAW,iBAAiB,iBAAiB,MAAM;EACtD,GAAI,iBAAiB,SAASA,YAAiB,EAAE,KAAK;EACtD,CAEiD"}
1
+ {"version":3,"file":"slot-CURylbjq.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\";\n\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 newElement = slottable.props.children;\n\n\tif (Children.count(newElement) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedNewElement = isArray(newElement) ? newElement[0] : newElement;\n\n\tif (!isValidElement(resolvedNewElement)) {\n\t\treturn 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 (resolvedNewElement.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(resolvedNewElement, undefined, newChildren)}\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\treturn 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 = composeRefs(forwardedRef, 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,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it-react/utils";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/ui/card/card.d.ts
5
- declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
6
- declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
7
- declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
8
- declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
9
- declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
10
- declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime11.JSX.Element;
5
+ declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
6
+ declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
7
+ declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
8
+ declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
9
+ declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
10
+ declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
11
11
  declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
12
12
  asChild?: boolean;
13
- }>): react_jsx_runtime11.JSX.Element;
13
+ }>): react_jsx_runtime2.JSX.Element;
14
14
  declare namespace card_parts_d_exports {
15
15
  export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import { t as __export } from "../../chunk-BL-4obUL.js";
2
- import { n as SlotRoot } from "../../slot--lEkrAQf.js";
2
+ import { n as SlotRoot } from "../../slot-CURylbjq.js";
3
3
  import { t as cnMerge } from "../../cn-Ba8kxuby.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
2
  import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
3
- import * as react_jsx_runtime2 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
4
4
  import { StoreApi } from "@zayne-labs/toolkit-core";
5
5
 
6
6
  //#region src/components/ui/carousel/types.d.ts
@@ -78,14 +78,14 @@ type OtherCarouselProps = {
78
78
  };
79
79
  //#endregion
80
80
  //#region src/components/ui/carousel/carousel.d.ts
81
- declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime2.JSX.Element;
82
- declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime2.JSX.Element;
83
- declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime2.JSX.Element;
84
- declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime2.JSX.Element;
85
- declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime2.JSX.Element;
86
- declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime2.JSX.Element;
87
- declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime2.JSX.Element;
88
- declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime2.JSX.Element;
81
+ declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime9.JSX.Element;
82
+ declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime9.JSX.Element;
83
+ declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime9.JSX.Element;
84
+ declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime9.JSX.Element;
85
+ declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime9.JSX.Element;
86
+ declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime9.JSX.Element;
87
+ declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime9.JSX.Element;
88
+ declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime9.JSX.Element;
89
89
  declare namespace carousel_parts_d_exports {
90
90
  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 };
91
91
  }