@zayne-labs/ui-react 0.10.5 → 0.10.7

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 (124) hide show
  1. package/css/animation.css +47 -0
  2. package/css/theme.css +10 -4
  3. package/dist/esm/{await-fjas2Q-C.js → await-Da5w2vIc.js} +14 -15
  4. package/dist/esm/await-Da5w2vIc.js.map +1 -0
  5. package/dist/esm/{card-TD60Xux0.js → card-DDLJVCwL.js} +10 -10
  6. package/dist/esm/card-DDLJVCwL.js.map +1 -0
  7. package/dist/esm/{carousel-YXXtZ85s.js → carousel-B051PAAX.js} +20 -23
  8. package/dist/esm/carousel-B051PAAX.js.map +1 -0
  9. package/dist/esm/{chunk-Cl8Af3a2.js → chunk-CTAAG5j7.js} +3 -1
  10. package/dist/esm/{cn-_FbtIrlZ.js → cn-s-D7vHW1.js} +1 -1
  11. package/dist/esm/{cn-_FbtIrlZ.js.map → cn-s-D7vHW1.js.map} +1 -1
  12. package/dist/esm/common/await/index.d.ts +4 -0
  13. package/dist/esm/common/await/index.js +8 -0
  14. package/dist/esm/common/client-gate/index.d.ts +33 -0
  15. package/dist/esm/common/client-gate/index.js +35 -0
  16. package/dist/esm/common/client-gate/index.js.map +1 -0
  17. package/dist/esm/{components/common → common}/error-boundary/index.d.ts +1 -1
  18. package/dist/esm/{components/common → common}/error-boundary/index.js +1 -1
  19. package/dist/esm/common/for/index.d.ts +2 -0
  20. package/dist/esm/common/for/index.js +3 -0
  21. package/dist/esm/common/index.d.ts +9 -0
  22. package/dist/esm/common/index.js +11 -0
  23. package/dist/esm/common/presence/index.d.ts +22 -0
  24. package/dist/esm/common/presence/index.js +6 -0
  25. package/dist/esm/{components/common → common}/show/index.d.ts +1 -1
  26. package/dist/esm/{components/common → common}/show/index.js +1 -2
  27. package/dist/esm/{components/common → common}/slot/index.d.ts +1 -1
  28. package/dist/esm/common/slot/index.js +3 -0
  29. package/dist/esm/common/suspense-with-boundary/index.d.ts +3 -0
  30. package/dist/esm/common/suspense-with-boundary/index.js +4 -0
  31. package/dist/esm/{components/common → common}/switch/index.d.ts +1 -1
  32. package/dist/esm/{components/common → common}/switch/index.js +1 -2
  33. package/dist/esm/common/teleport/index.d.ts +2 -0
  34. package/dist/esm/common/teleport/index.js +3 -0
  35. package/dist/esm/{drag-scroll-De6-soln.js → drag-scroll-Bb1SG4On.js} +9 -12
  36. package/dist/esm/{drag-scroll-De6-soln.js.map → drag-scroll-Bb1SG4On.js.map} +1 -1
  37. package/dist/esm/drop-zone-C9VpKJAD.js +1013 -0
  38. package/dist/esm/drop-zone-C9VpKJAD.js.map +1 -0
  39. package/dist/esm/{error-boundary-xM9An3gz.js → error-boundary-y9Samt_s.js} +1 -1
  40. package/dist/esm/error-boundary-y9Samt_s.js.map +1 -0
  41. package/dist/esm/{for-DGs2XZ21.js → for-DK5rEY_m.js} +5 -7
  42. package/dist/esm/for-DK5rEY_m.js.map +1 -0
  43. package/dist/esm/{form-BHfmbX32.js → form-DyGy9LnA.js} +61 -73
  44. package/dist/esm/form-DyGy9LnA.js.map +1 -0
  45. package/dist/esm/{index-Y_2u8pWF.d.ts → index-ATxxr1XS.d.ts} +5 -4
  46. package/dist/esm/{index-Cbg54Lt4.d.ts → index-B4YvRWlE.d.ts} +21 -20
  47. package/dist/esm/{index-lKxE9WPi.d.ts → index-BAywimP3.d.ts} +4 -2
  48. package/dist/esm/index-BT0UvcRp.d.ts +23 -0
  49. package/dist/esm/index-BWD8WVO-.d.ts +340 -0
  50. package/dist/esm/{index-DVr1tbxh.d.ts → index-BsGxDKlt.d.ts} +10 -9
  51. package/dist/esm/{index-BYhH4Fm0.d.ts → index-C1GPFYKG.d.ts} +1 -1
  52. package/dist/esm/{index-D6o1oxQd.d.ts → index-C889t8UO.d.ts} +13 -16
  53. package/dist/esm/{index-CWKQ5V4B.d.ts → index-CZjeBSoQ.d.ts} +1 -1
  54. package/dist/esm/{index-DJjxpXUk.d.ts → index-CffEFE66.d.ts} +1 -1
  55. package/dist/esm/{index-BBJzo-WC.d.ts → index-CuJVxLEc.d.ts} +4 -3
  56. package/dist/esm/{index-BeDmH7lX.d.ts → index-DVBtz0VB.d.ts} +10 -9
  57. package/dist/esm/{index-DqutTJQB.d.ts → index-Dpt8KDv1.d.ts} +13 -12
  58. package/dist/esm/presence-CL5_GHQH.js +156 -0
  59. package/dist/esm/presence-CL5_GHQH.js.map +1 -0
  60. package/dist/esm/{show-BabiXbf7.js → show-N1ZXBhoA.js} +18 -9
  61. package/dist/esm/show-N1ZXBhoA.js.map +1 -0
  62. package/dist/esm/{slot-D1062oA5.js → slot-WVWfOlr3.js} +5 -6
  63. package/dist/esm/{slot-D1062oA5.js.map → slot-WVWfOlr3.js.map} +1 -1
  64. package/dist/esm/{suspense-with-boundary-CEVORL8K.js → suspense-with-boundary-D-1NYDV4.js} +2 -2
  65. package/dist/esm/suspense-with-boundary-D-1NYDV4.js.map +1 -0
  66. package/dist/esm/{switch-CCMD01Rs.js → switch-Ch22z21e.js} +7 -11
  67. package/dist/esm/switch-Ch22z21e.js.map +1 -0
  68. package/dist/esm/{teleport-DfuYOzsj.js → teleport-C8TzRm4M.js} +1 -1
  69. package/dist/esm/teleport-C8TzRm4M.js.map +1 -0
  70. package/dist/esm/{components/ui → ui}/card/index.d.ts +1 -1
  71. package/dist/esm/{components/ui → ui}/card/index.js +3 -3
  72. package/dist/esm/ui/carousel/index.d.ts +2 -0
  73. package/dist/esm/ui/carousel/index.js +16 -0
  74. package/dist/esm/ui/drag-scroll/index.d.ts +2 -0
  75. package/dist/esm/ui/drag-scroll/index.js +4 -0
  76. package/dist/esm/ui/drop-zone/index.d.ts +2 -0
  77. package/dist/esm/ui/drop-zone/index.js +17 -0
  78. package/dist/esm/{components/ui → ui}/form/index.d.ts +1 -1
  79. package/dist/esm/{components/ui → ui}/form/index.js +4 -5
  80. package/dist/esm/ui/index.d.ts +6 -0
  81. package/dist/esm/ui/index.js +18 -0
  82. package/dist/style.css +415 -25
  83. package/package.json +20 -17
  84. package/dist/esm/await-fjas2Q-C.js.map +0 -1
  85. package/dist/esm/card-TD60Xux0.js.map +0 -1
  86. package/dist/esm/carousel-YXXtZ85s.js.map +0 -1
  87. package/dist/esm/components/common/await/index.d.ts +0 -5
  88. package/dist/esm/components/common/await/index.js +0 -10
  89. package/dist/esm/components/common/for/index.d.ts +0 -2
  90. package/dist/esm/components/common/for/index.js +0 -3
  91. package/dist/esm/components/common/index.d.ts +0 -10
  92. package/dist/esm/components/common/index.js +0 -13
  93. package/dist/esm/components/common/slot/index.js +0 -3
  94. package/dist/esm/components/common/suspense-with-boundary/index.d.ts +0 -3
  95. package/dist/esm/components/common/suspense-with-boundary/index.js +0 -4
  96. package/dist/esm/components/common/teleport/index.d.ts +0 -2
  97. package/dist/esm/components/common/teleport/index.js +0 -3
  98. package/dist/esm/components/ui/carousel/index.d.ts +0 -2
  99. package/dist/esm/components/ui/carousel/index.js +0 -18
  100. package/dist/esm/components/ui/drag-scroll/index.d.ts +0 -2
  101. package/dist/esm/components/ui/drag-scroll/index.js +0 -4
  102. package/dist/esm/components/ui/drop-zone/index.d.ts +0 -2
  103. package/dist/esm/components/ui/drop-zone/index.js +0 -18
  104. package/dist/esm/components/ui/index.d.ts +0 -6
  105. package/dist/esm/components/ui/index.js +0 -19
  106. package/dist/esm/drop-zone-BPfSu99L.js +0 -381
  107. package/dist/esm/drop-zone-BPfSu99L.js.map +0 -1
  108. package/dist/esm/error-boundary-xM9An3gz.js.map +0 -1
  109. package/dist/esm/for-DGs2XZ21.js.map +0 -1
  110. package/dist/esm/form-BHfmbX32.js.map +0 -1
  111. package/dist/esm/getSlot-Cf5ON6lE.js +0 -85
  112. package/dist/esm/getSlot-Cf5ON6lE.js.map +0 -1
  113. package/dist/esm/index-B-NUFudm.d.ts +0 -183
  114. package/dist/esm/index-BNrCAe9Y.d.ts +0 -142
  115. package/dist/esm/index-CnvH74ea.d.ts +0 -20
  116. package/dist/esm/lib/utils/index.d.ts +0 -2
  117. package/dist/esm/lib/utils/index.js +0 -4
  118. package/dist/esm/show-BabiXbf7.js.map +0 -1
  119. package/dist/esm/suspense-with-boundary-CEVORL8K.js.map +0 -1
  120. package/dist/esm/switch-CCMD01Rs.js.map +0 -1
  121. package/dist/esm/teleport-DfuYOzsj.js.map +0 -1
  122. package/dist/esm/utils-ChjmDoRe.js +0 -89
  123. package/dist/esm/utils-ChjmDoRe.js.map +0 -1
  124. /package/dist/esm/{common-BYWy8Q78.js → common-PS3X58Pj.js} +0 -0
@@ -2,22 +2,23 @@ import * as React from "react";
2
2
 
3
3
  //#region src/components/common/show/show.d.ts
4
4
  type ShowProps<TWhen> = {
5
+ children: React.ReactNode;
6
+ control: "content";
7
+ fallback?: React.ReactNode;
8
+ when?: never;
9
+ } | {
5
10
  children: React.ReactNode | ((value: TWhen) => React.ReactNode);
11
+ control?: "root";
6
12
  fallback?: React.ReactNode;
7
13
  when: false | TWhen | null | undefined;
8
14
  };
9
15
  declare function ShowRoot<TWhen>(props: ShowProps<TWhen>): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
10
- declare function ShowContent({
11
- children
12
- }: {
13
- children: React.ReactNode;
14
- }): React.ReactNode;
16
+ type ShowContentProps<TWhen> = Pick<ShowProps<TWhen>, "children" | "when">;
17
+ declare function ShowContent<TWhen>(props: ShowContentProps<TWhen>): React.ReactNode;
15
18
  declare namespace ShowContent {
16
19
  var slotSymbol: symbol;
17
20
  }
18
- declare function ShowFallback({
19
- children
20
- }: {
21
+ declare function ShowFallback(props: {
21
22
  children: React.ReactNode;
22
23
  }): React.ReactNode;
23
24
  declare namespace ShowFallback {
@@ -28,4 +29,4 @@ declare namespace show_parts_d_exports {
28
29
  }
29
30
  //#endregion
30
31
  export { ShowContent, ShowFallback, ShowRoot, show_parts_d_exports };
31
- //# sourceMappingURL=index-DVr1tbxh.d.ts.map
32
+ //# sourceMappingURL=index-BsGxDKlt.d.ts.map
@@ -20,4 +20,4 @@ type DragScrollResult<TElement extends HTMLElement, TItemElement extends HTMLEle
20
20
  declare const useDragScroll: <TElement extends HTMLElement, TItemElement extends HTMLElement = HTMLElement>(props?: DragScrollProps<TElement, TItemElement>) => DragScrollResult<TElement, TItemElement>;
21
21
  //#endregion
22
22
  export { useDragScroll };
23
- //# sourceMappingURL=index-BYhH4Fm0.d.ts.map
23
+ //# sourceMappingURL=index-C1GPFYKG.d.ts.map
@@ -1,7 +1,8 @@
1
- import { GetSlotComponentProps } from "./index-BNrCAe9Y.js";
2
- import { ErrorBoundaryProps } from "./index-lKxE9WPi.js";
3
- import { SuspenseWithBoundaryProps } from "./index-Y_2u8pWF.js";
1
+ import { ErrorBoundaryProps } from "./index-BAywimP3.js";
2
+ import { SuspenseWithBoundaryProps } from "./index-ATxxr1XS.js";
3
+ import { GetSlotComponentProps } from "@zayne-labs/toolkit-react/utils";
4
4
  import * as React from "react";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
6
 
6
7
  //#region src/components/common/await/await.d.ts
7
8
  type RenderPropFn<TValue> = (result: TValue) => React.ReactNode;
@@ -13,26 +14,19 @@ type AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, "errorFallback" |
13
14
  withErrorBoundary?: boolean;
14
15
  withSuspense?: boolean;
15
16
  };
16
- declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): React.JSX.Element;
17
+ declare function AwaitRoot<TValue>(props: AwaitRootProps<TValue>): react_jsx_runtime0.JSX.Element;
17
18
  type AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<"default", ChildrenType<TValue>>;
18
19
  declare function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(props: Pick<AwaitSuccessProps<TValue>, "children">): React.ReactNode;
20
+ type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["fallback"]>;
21
+ declare function AwaitError(props: AwaitErrorProps & {
22
+ asChild?: boolean;
23
+ }): react_jsx_runtime0.JSX.Element;
19
24
  type AwaitPendingProps = GetSlotComponentProps<"pending", React.SuspenseProps["fallback"]>;
20
25
  declare const AwaitPending: {
21
26
  (props: Pick<AwaitPendingProps, "children">): React.ReactNode;
22
27
  readonly slotName?: "pending" | undefined;
23
28
  readonly slotSymbol?: symbol;
24
29
  };
25
- type AwaitErrorProps = GetSlotComponentProps<"error", ErrorBoundaryProps["fallback"]>;
26
- declare const AwaitError: {
27
- (props: Pick<AwaitErrorProps, "children"> & {
28
- asChild?: boolean;
29
- }): React.ReactNode;
30
- readonly slotName?: "error" | undefined;
31
- readonly slotSymbol?: symbol;
32
- };
33
- declare namespace await_parts_d_exports {
34
- export { AwaitError as Error, AwaitPending as Pending, AwaitRoot as Root, AwaitSuccess as Success };
35
- }
36
30
  //#endregion
37
31
  //#region src/components/common/await/await-context.d.ts
38
32
  type AwaitContextType<TValue = unknown> = {
@@ -40,6 +34,9 @@ type AwaitContextType<TValue = unknown> = {
40
34
  result: TValue;
41
35
  };
42
36
  declare const useAwaitContext: <TValue>() => AwaitContextType<TValue>;
37
+ declare namespace await_parts_d_exports {
38
+ export { AwaitError as Error, AwaitPending as Pending, AwaitRoot as Root, AwaitSuccess as Success };
39
+ }
43
40
  //#endregion
44
41
  export { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_d_exports, useAwaitContext };
45
- //# sourceMappingURL=index-D6o1oxQd.d.ts.map
42
+ //# sourceMappingURL=index-C889t8UO.d.ts.map
@@ -11,4 +11,4 @@ type PortalProps = {
11
11
  declare function Teleport(props: PortalProps): React.ReactPortal | null;
12
12
  //#endregion
13
13
  export { Teleport };
14
- //# sourceMappingURL=index-CWKQ5V4B.d.ts.map
14
+ //# sourceMappingURL=index-CZjeBSoQ.d.ts.map
@@ -25,4 +25,4 @@ declare namespace switch_parts_d_exports {
25
25
  }
26
26
  //#endregion
27
27
  export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_d_exports };
28
- //# sourceMappingURL=index-DJjxpXUk.d.ts.map
28
+ //# sourceMappingURL=index-CffEFE66.d.ts.map
@@ -1,9 +1,10 @@
1
- import * as React from "react";
2
1
  import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
+ import * as React from "react";
3
+ import * as react_jsx_runtime31 from "react/jsx-runtime";
3
4
 
4
5
  //#region src/components/common/slot/slot.d.ts
5
6
  type SlotProps = InferProps<HTMLElement>;
6
- declare function SlotRoot(props: SlotProps): React.JSX.Element | null;
7
+ declare function SlotRoot(props: SlotProps): react_jsx_runtime31.JSX.Element | null;
7
8
  declare function SlotSlottable({
8
9
  children
9
10
  }: Pick<SlotProps, "children">): React.ReactNode;
@@ -12,4 +13,4 @@ declare namespace slot_parts_d_exports {
12
13
  }
13
14
  //#endregion
14
15
  export { SlotRoot, SlotSlottable, slot_parts_d_exports };
15
- //# sourceMappingURL=index-BBJzo-WC.d.ts.map
16
+ //# sourceMappingURL=index-CuJVxLEc.d.ts.map
@@ -1,19 +1,20 @@
1
- import * as React from "react";
2
1
  import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
2
+ import * as React from "react";
3
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
4
 
4
5
  //#region src/components/ui/card/card.d.ts
5
- declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): React.JSX.Element;
6
- declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): React.JSX.Element;
7
- declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): React.JSX.Element;
8
- declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): React.JSX.Element;
9
- declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): React.JSX.Element;
10
- declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): React.JSX.Element;
6
+ declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
7
+ declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
8
+ declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
9
+ declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
10
+ declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
11
+ declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime1.JSX.Element;
11
12
  declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
12
13
  asChild?: boolean;
13
- }>): React.JSX.Element;
14
+ }>): react_jsx_runtime1.JSX.Element;
14
15
  declare namespace card_parts_d_exports {
15
16
  export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
16
17
  }
17
18
  //#endregion
18
19
  export { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports };
19
- //# sourceMappingURL=index-BeDmH7lX.d.ts.map
20
+ //# sourceMappingURL=index-DVBtz0VB.d.ts.map
@@ -1,7 +1,8 @@
1
+ import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
1
2
  import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
2
3
  import * as React$1 from "react";
4
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
3
5
  import { StoreApi } from "@zayne-labs/toolkit-core";
4
- import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
5
6
 
6
7
  //#region src/components/ui/carousel/types.d.ts
7
8
  type ImagesType = Array<Record<string, string>> | string[];
@@ -78,17 +79,17 @@ type OtherCarouselProps = {
78
79
  };
79
80
  //#endregion
80
81
  //#region src/components/ui/carousel/carousel.d.ts
81
- declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicProps<TElement, CarouselRootProps<TImages>>): React$1.JSX.Element;
82
- declare function CarouselButton(props: CarouselButtonsProps): React$1.JSX.Element;
83
- declare function CarouselControls(props: CarouselControlProps): React$1.JSX.Element;
84
- declare function CarouselItemGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): React$1.JSX.Element;
85
- declare function CarouselItem(props: OtherCarouselProps): React$1.JSX.Element;
86
- declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicProps<TElement, OtherCarouselProps>): React$1.JSX.Element;
87
- declare function CarouselIndicatorGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): React$1.JSX.Element;
88
- declare function CarouselIndicator(props: CarouselIndicatorProps): React$1.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;
89
90
  declare namespace carousel_parts_d_exports {
90
- export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorGroup as IndicatorGroup, CarouselItem as Item, CarouselItemGroup as ItemGroup, CarouselRoot as Root };
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
92
  }
92
93
  //#endregion
93
- export { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem, CarouselItemGroup, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports };
94
- //# sourceMappingURL=index-DqutTJQB.d.ts.map
94
+ export { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports };
95
+ //# sourceMappingURL=index-Dpt8KDv1.d.ts.map
@@ -0,0 +1,156 @@
1
+ import { isFunction } from "@zayne-labs/toolkit-type-helpers";
2
+ import { Children, cloneElement, useEffect, useLayoutEffect, useReducer, useRef, useState } from "react";
3
+ import { useCallbackRef, useComposeRefs } from "@zayne-labs/toolkit-react";
4
+ import { on } from "@zayne-labs/toolkit-core";
5
+
6
+ //#region src/components/common/presence/use-presence.ts
7
+ const useStateMachine = (config) => {
8
+ const reducer = (prevState, event) => {
9
+ return config.states[prevState][event] ?? prevState;
10
+ };
11
+ return useReducer(reducer, config.initial);
12
+ };
13
+ const getAnimationName = (styles) => styles?.animationName ?? "none";
14
+ /**
15
+ * React hook that provides the ability to animate the mount/unmount of a component.
16
+ * @see https://github.com/radix-ui/primitives/blob/main/packages/react/presence/src/presence.tsx
17
+ */
18
+ const usePresence = (options) => {
19
+ const { onExitComplete, present } = options;
20
+ const saveOnExitComplete = useCallbackRef(onExitComplete);
21
+ const [node, setNode] = useState(null);
22
+ const stylesRef = useRef(null);
23
+ const prevPresentRef = useRef(present);
24
+ const prevAnimationNameRef = useRef("none");
25
+ const [state, send] = useStateMachine({
26
+ initial: present ? "mounted" : "unmounted",
27
+ states: {
28
+ mounted: {
29
+ ANIMATION_OUT: "unmountSuspended",
30
+ UNMOUNT: "unmounted"
31
+ },
32
+ unmounted: { MOUNT: "mounted" },
33
+ unmountSuspended: {
34
+ ANIMATION_END: "unmounted",
35
+ MOUNT: "mounted"
36
+ }
37
+ }
38
+ });
39
+ useEffect(() => {
40
+ const currentAnimationName = getAnimationName(stylesRef.current);
41
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
42
+ }, [state]);
43
+ useLayoutEffect(() => {
44
+ const styles = stylesRef.current;
45
+ const wasPresent = prevPresentRef.current;
46
+ if (!(wasPresent !== present)) return;
47
+ const prevAnimationName = prevAnimationNameRef.current;
48
+ const currentAnimationName = getAnimationName(styles);
49
+ switch (true) {
50
+ case present:
51
+ send("MOUNT");
52
+ break;
53
+ case Boolean(node):
54
+ if (!(currentAnimationName !== "none" && styles?.display !== "none" || styles?.transitionProperty !== "none" && Number(styles?.transitionDuration) > 0)) {
55
+ send("UNMOUNT");
56
+ break;
57
+ }
58
+ if (!(wasPresent && prevAnimationName !== currentAnimationName)) {
59
+ send("UNMOUNT");
60
+ break;
61
+ }
62
+ send("ANIMATION_OUT");
63
+ break;
64
+ default:
65
+ send("UNMOUNT");
66
+ break;
67
+ }
68
+ prevPresentRef.current = present;
69
+ }, [
70
+ present,
71
+ node,
72
+ send
73
+ ]);
74
+ useLayoutEffect(() => {
75
+ if (!node) {
76
+ send("ANIMATION_END");
77
+ return;
78
+ }
79
+ let timeoutId;
80
+ const ownerWindow = node.ownerDocument.defaultView ?? globalThis;
81
+ /**
82
+ * @description Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
83
+ * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
84
+ * make sure we only trigger ANIMATION_END for the currently active animation.
85
+ */
86
+ const handleAnimationEnd = (event) => {
87
+ const isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(event.animationName));
88
+ if (!(event.target === node && isCurrentAnimation)) return;
89
+ send("ANIMATION_END");
90
+ if (!prevPresentRef.current) {
91
+ const currentFillMode = node.style.animationFillMode;
92
+ node.style.animationFillMode = "forwards";
93
+ timeoutId = ownerWindow.setTimeout(() => {
94
+ if (node.style.animationFillMode === "forwards") node.style.animationFillMode = currentFillMode;
95
+ });
96
+ }
97
+ };
98
+ const handleTransitionEnd = (event) => {
99
+ if (!(event.target === node && !prevPresentRef.current)) return;
100
+ send("ANIMATION_END");
101
+ };
102
+ const handleAnimationStart = (event) => {
103
+ if (!(event.target === node)) return;
104
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
105
+ };
106
+ const onAnimationStartCleanup = on("animationstart", node, handleAnimationStart);
107
+ const onAnimationEndCleanup = on("animationend", node, handleAnimationEnd);
108
+ const onAnimationCancelCleanup = on("animationcancel", node, handleAnimationEnd);
109
+ const onTransitionEndCleanup = on("transitionend", node, handleTransitionEnd);
110
+ const onTransitionCancelCleanup = on("transitioncancel", node, handleTransitionEnd);
111
+ return () => {
112
+ ownerWindow.clearTimeout(timeoutId);
113
+ onAnimationStartCleanup();
114
+ onAnimationEndCleanup();
115
+ onAnimationCancelCleanup();
116
+ onTransitionEndCleanup();
117
+ onTransitionCancelCleanup();
118
+ };
119
+ }, [node, send]);
120
+ useEffect(() => {
121
+ if (!(state === "unmounted" && !present)) return;
122
+ saveOnExitComplete();
123
+ }, [
124
+ state,
125
+ present,
126
+ saveOnExitComplete
127
+ ]);
128
+ const isPresent = ["mounted", "unmountSuspended"].includes(state);
129
+ const ref = useCallbackRef((refNode) => {
130
+ refNode && (stylesRef.current = getComputedStyle(refNode));
131
+ setNode(refNode);
132
+ });
133
+ return {
134
+ isPresent,
135
+ ref
136
+ };
137
+ };
138
+
139
+ //#endregion
140
+ //#region src/components/common/presence/presence.tsx
141
+ function Presence(props) {
142
+ const { children, forceMount = false, onExitComplete, present } = props;
143
+ const presence = usePresence({
144
+ onExitComplete,
145
+ present
146
+ });
147
+ const resolvedChild = isFunction(children) ? children({ isPresent: presence.isPresent }) : Children.only(children);
148
+ const childRef = resolvedChild?.props.ref ?? resolvedChild.ref;
149
+ const ref = useComposeRefs(presence.ref, childRef);
150
+ if (!(forceMount || presence.isPresent)) return null;
151
+ return resolvedChild && cloneElement(resolvedChild, { ref });
152
+ }
153
+
154
+ //#endregion
155
+ export { Presence };
156
+ //# sourceMappingURL=presence-CL5_GHQH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence-CL5_GHQH.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,QAAI,EAJF,yBAAyB,UAAU,QAAQ,YAAY,UACpD,QAAQ,uBAAuB,UAAU,OAAO,QAAQ,mBAAmB,GAAG,IAGhE;AAClB,UAAK,UAAU;AACf;;AAcD,QAAI,EAFmB,cAFH,sBAAsB,uBAIrB;AACpB,UAAK,UAAU;AACf;;AAGD,SAAK,gBAAgB;AACrB;GAGD;AACC,SAAK,UAAU;AACf;;AAIF,iBAAe,UAAU;IACvB;EAAC;EAAS;EAAM;EAAK,CAAC;AAEzB,uBAAsB;AACrB,MAAI,CAAC,MAAM;AAGV,QAAK,gBAAgB;AACrB;;EAGD,IAAIA;EAEJ,MAAM,cAAc,KAAK,cAAc,eAAe;;;;;;EAOtD,MAAM,sBAAsB,UAA0B;GAIrD,MAAM,qBAHuB,iBAAiB,UAAU,QAAQ,CAGhB,SAAS,IAAI,OAAO,MAAM,cAAc,CAAC;AAIzF,OAAI,EAF0B,MAAM,WAAW,QAAQ,oBAE3B;AAY5B,QAAK,gBAAgB;AAErB,OAAI,CAAC,eAAe,SAAS;IAC5B,MAAM,kBAAkB,KAAK,MAAM;AACnC,SAAK,MAAM,oBAAoB;AAM/B,gBAAY,YAAY,iBAAiB;AACxC,SAAI,KAAK,MAAM,sBAAsB,WACpC,MAAK,MAAM,oBAAoB;MAE/B;;;EAIJ,MAAM,uBAAuB,UAA2B;AAGvD,OAAI,EAF8B,MAAM,WAAW,QAAQ,CAAC,eAAe,SAE3C;AAEhC,QAAK,gBAAgB;;EAGtB,MAAM,wBAAwB,UAA0B;AAGvD,OAAI,EAF0B,MAAM,WAAW,MAEnB;AAE5B,wBAAqB,UAAU,iBAAiB,UAAU,QAAQ;;EAGnE,MAAM,0BAA0B,GAAG,kBAAkB,MAAM,qBAAqB;EAChF,MAAM,wBAAwB,GAAG,gBAAgB,MAAM,mBAAmB;EAC1E,MAAM,2BAA2B,GAAG,mBAAmB,MAAM,mBAAmB;EAChF,MAAM,yBAAyB,GAAG,iBAAiB,MAAM,oBAAoB;EAC7E,MAAM,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,11 +1,19 @@
1
- import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { getMultipleSlots } from "./getSlot-Cf5ON6lE.js";
1
+ import { __export } from "./chunk-CTAAG5j7.js";
2
+ import { getMultipleSlots, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
3
3
  import { assert, isFunction } from "@zayne-labs/toolkit-type-helpers";
4
4
  import "react";
5
+ import { toArray } from "@zayne-labs/toolkit-core";
5
6
 
6
7
  //#region src/components/common/show/show.tsx
7
8
  function ShowRoot(props) {
8
- const { children, fallback = null, when } = props;
9
+ const { children, control = "root", fallback = null, when } = props;
10
+ if (control === "content" && !isFunction(children)) {
11
+ const childrenArray = toArray(children);
12
+ const foundContentSlot = childrenArray.find((child) => Boolean(child.props.when));
13
+ const fallBackSlot$1 = getSingleSlot(childrenArray, ShowFallback);
14
+ assert(!(fallBackSlot$1 && fallback), "The fallback prop and <Show.Fallback> cannot be used at the same time.");
15
+ return foundContentSlot ?? fallBackSlot$1 ?? fallback;
16
+ }
9
17
  const resolvedChildren = isFunction(children) ? children(when) : children;
10
18
  const { regularChildren, slots: [contentSlot, fallBackSlot] } = getMultipleSlots(resolvedChildren, [ShowContent, ShowFallback], {
11
19
  errorMessage: ["Only one <Show.Content> component is allowed", "Only one <Show.Fallback> or <Show.OtherWise> component is allowed"],
@@ -17,19 +25,20 @@ function ShowRoot(props) {
17
25
  }
18
26
  return contentSlot ?? regularChildren;
19
27
  }
20
- function ShowContent({ children }) {
21
- return children;
28
+ function ShowContent(props) {
29
+ const { children, when } = props;
30
+ return isFunction(children) ? children(when) : children;
22
31
  }
23
32
  ShowContent.slotSymbol = Symbol("show-content");
24
- function ShowFallback({ children }) {
33
+ function ShowFallback(props) {
34
+ const { children } = props;
25
35
  return children;
26
36
  }
27
37
  ShowFallback.slotSymbol = Symbol("show-fallback");
28
38
 
29
39
  //#endregion
30
40
  //#region src/components/common/show/show-parts.ts
31
- var show_parts_exports = {};
32
- __export(show_parts_exports, {
41
+ var show_parts_exports = __export({
33
42
  Content: () => ShowContent,
34
43
  Fallback: () => ShowFallback,
35
44
  Otherwise: () => ShowFallback,
@@ -38,4 +47,4 @@ __export(show_parts_exports, {
38
47
 
39
48
  //#endregion
40
49
  export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
41
- //# sourceMappingURL=show-BabiXbf7.js.map
50
+ //# sourceMappingURL=show-N1ZXBhoA.js.map
@@ -0,0 +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,8 +1,8 @@
1
- import { __export } from "./chunk-Cl8Af3a2.js";
1
+ import { __export } from "./chunk-CTAAG5j7.js";
2
+ import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
2
3
  import { isArray } from "@zayne-labs/toolkit-type-helpers";
3
4
  import { Children, Fragment, cloneElement, isValidElement } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
- import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
6
6
 
7
7
  //#region src/components/common/slot/slot.tsx
8
8
  function SlotRoot(props) {
@@ -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 = isArray(children) && children.length === 1 ? children[0] : children;
37
+ const resolvedChild = Children.only(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,12 +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 = {};
52
- __export(slot_parts_exports, {
51
+ var slot_parts_exports = __export({
53
52
  Root: () => SlotRoot,
54
53
  Slottable: () => SlotSlottable
55
54
  });
56
55
 
57
56
  //#endregion
58
57
  export { SlotRoot, SlotSlottable, slot_parts_exports };
59
- //# sourceMappingURL=slot-D1062oA5.js.map
58
+ //# sourceMappingURL=slot-WVWfOlr3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot-D1062oA5.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 = isArray(children) && children.length === 1 ? children[0] : 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,iBAAiB,GAAG;CAEzC,MAAM,gBAAgB,QAAyB,YAAY,WAAW,CAAC,SAAS;CAEhF,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY;AAE9D,KAAI,CAAC,UACJ,QAAO,oBAAC;EAAU,GAAI;EAAkB;;AAGzC,KAAI,CAAC,eAA0B,WAC9B,QAAO;CAIR,MAAM,aAAa,UAAU,MAAM;AAEnC,KAAI,CAAC,eAAe,YACnB,QAAO;AAGR,KAAI,SAAS,MAAM,cAAc,EAChC,QAAO,SAAS,KAAK;CAGtB,MAAM,cAAc,cAAc,KAAK,UAAU;AAChD,MAAI,UAAU,UAEb,QAAQ,WAAW,MAAoB;AAGxC,SAAO;CACP;AAED,QAAO,oBAAC;EAAU,GAAI;YAAkB,aAAa,YAAY,QAAW;;AAC5E;AAMD,SAAgB,cAAc,EAAE,UAAuC,EAAE;AACxE,QAAO;AACP;AAED,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,UAAU,MAAM,SAAS;AAC/C;AAUD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,aAAc,GAAG,iBAAiB,GAAG;CAE5D,MAAM,gBAAgB,QAAQ,aAAa,SAAS,WAAW,IAAI,SAAS,KAAK;AAEjF,KAAI,CAAC,eAA8B,eAClC,QAAO;AAGR,KAAI,SAAS,MAAM,iBAAiB,EACnC,QAAO,SAAS,KAAK;CAGtB,MAAM,WAAY,cAAc,MAAM,OACjC,cAA2C;CAEhD,MAAM,MAAM,eAAe,YAAY,cAAc,YAAY;CAEjE,MAAM,cAAc;EACnB,GAAG,WAAW,iBAAiB,cAAc;EAC7C,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD;AAED,QAAO,aAAa,eAAe;AACnC"}
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,4 +1,4 @@
1
- import { ErrorBoundary } from "./error-boundary-xM9An3gz.js";
1
+ import { ErrorBoundary } from "./error-boundary-y9Samt_s.js";
2
2
  import { Suspense } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
@@ -18,4 +18,4 @@ function SuspenseWithBoundary(props) {
18
18
 
19
19
  //#endregion
20
20
  export { SuspenseWithBoundary };
21
- //# sourceMappingURL=suspense-with-boundary-CEVORL8K.js.map
21
+ //# sourceMappingURL=suspense-with-boundary-D-1NYDV4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suspense-with-boundary-D-1NYDV4.js","names":[],"sources":["../../src/components/common/suspense-with-boundary/suspense-with-boundary.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Suspense } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\nexport type SuspenseWithBoundaryProps = {\n\tchildren: React.ReactNode;\n\terrorFallback?: ErrorBoundaryProps[\"fallback\"];\n\tfallback?: React.ReactNode;\n};\n\nexport function SuspenseWithBoundary(props: SuspenseWithBoundaryProps) {\n\tconst { children, errorFallback, fallback } = props;\n\n\tconst errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };\n\tconst suspenseProps = Boolean(fallback) && { fallback };\n\n\treturn (\n\t\t<ErrorBoundary {...errorBoundaryProps}>\n\t\t\t<Suspense {...suspenseProps}>{children}</Suspense>\n\t\t</ErrorBoundary>\n\t);\n}\n"],"mappings":";;;;;AAUA,SAAgB,qBAAqB,OAAkC;CACtE,MAAM,EAAE,UAAU,eAAe,aAAa;CAE9C,MAAM,qBAAqB,QAAQ,cAAc,IAAI,EAAE,UAAU,eAAe;CAChF,MAAM,gBAAgB,QAAQ,SAAS,IAAI,EAAE,UAAU;AAEvD,QACC,oBAAC;EAAc,GAAI;YAClB,oBAAC;GAAS,GAAI;GAAgB;IAAoB;GACnC"}
@@ -1,5 +1,5 @@
1
- import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { getRegularChildren, getSingleSlot } from "./getSlot-Cf5ON6lE.js";
1
+ import { __export } from "./chunk-CTAAG5j7.js";
2
+ import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
3
3
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
4
4
  import "react";
5
5
 
@@ -11,17 +11,14 @@ function SwitchRoot(props) {
11
11
  errorMessage: "Only one <Switch.Default> component is allowed",
12
12
  throwOnMultipleSlotMatch: true
13
13
  });
14
- const childrenCasesArray = getRegularChildren(children, SwitchDefault);
15
- const matchedCase = childrenCasesArray.find((child) => {
14
+ return getRegularChildren(children, SwitchDefault).find((child) => {
16
15
  if (value === defaultValueSymbol) return Boolean(child.props.when);
17
16
  return child.props.when === value;
18
- });
19
- return matchedCase ?? defaultCase;
17
+ }) ?? defaultCase;
20
18
  }
21
19
  function SwitchMatch(props) {
22
20
  const { children, when } = props;
23
- const resolvedChildren = isFunction(children) ? children(when) : children;
24
- return resolvedChildren;
21
+ return isFunction(children) ? children(when) : children;
25
22
  }
26
23
  function SwitchDefault({ children }) {
27
24
  return children;
@@ -30,8 +27,7 @@ SwitchDefault.slotSymbol = Symbol("switch-default");
30
27
 
31
28
  //#endregion
32
29
  //#region src/components/common/switch/switch-parts.ts
33
- var switch_parts_exports = {};
34
- __export(switch_parts_exports, {
30
+ var switch_parts_exports = __export({
35
31
  Default: () => SwitchDefault,
36
32
  Match: () => SwitchMatch,
37
33
  Root: () => SwitchRoot
@@ -39,4 +35,4 @@ __export(switch_parts_exports, {
39
35
 
40
36
  //#endregion
41
37
  export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports };
42
- //# sourceMappingURL=switch-CCMD01Rs.js.map
38
+ //# sourceMappingURL=switch-Ch22z21e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-Ch22z21e.js","names":[],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;\n\ntype SwitchProps = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tvalue?: unknown;\n};\n\nconst defaultValueSymbol = Symbol(\"default-value\");\n\nexport function SwitchRoot(props: SwitchProps) {\n\tconst { children, value = defaultValueSymbol } = props;\n\n\tconst defaultCase = getSingleSlot(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getRegularChildren(children, SwitchDefault) as ValidSwitchComponentType[];\n\n\tconst matchedCase = childrenCasesArray.find((child) => {\n\t\t// == If value is defaultValueSymbol, match the cases in order like switch(true)\n\t\tif (value === defaultValueSymbol) {\n\t\t\treturn Boolean(child.props.when);\n\t\t}\n\n\t\t// == Otherwise, match the cases like switch(value)\n\t\treturn child.props.when === value;\n\t});\n\n\treturn matchedCase ?? defaultCase;\n}\n\ntype SwitchMatchProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slotSymbol = Symbol(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"],"mappings":";;;;;;AAaA,MAAM,qBAAqB,OAAO,gBAAgB;AAElD,SAAgB,WAAW,OAAoB;CAC9C,MAAM,EAAE,UAAU,QAAQ,uBAAuB;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;EAC1B,CAAC;AAcF,QAZ2B,mBAAmB,UAAU,cAAc,CAE/B,MAAM,UAAU;AAEtD,MAAI,UAAU,mBACb,QAAO,QAAQ,MAAM,MAAM,KAAK;AAIjC,SAAO,MAAM,MAAM,SAAS;GAC3B,IAEoB;;AAQvB,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;AAI3B,QAFyB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;;AAK3E,SAAgB,cAAc,EAAE,YAA2C;AAC1E,QAAO;;AAER,cAAc,aAAa,OAAO,iBAAiB"}
@@ -29,4 +29,4 @@ function Teleport(props) {
29
29
 
30
30
  //#endregion
31
31
  export { Teleport };
32
- //# sourceMappingURL=teleport-DfuYOzsj.js.map
32
+ //# sourceMappingURL=teleport-C8TzRm4M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teleport-C8TzRm4M.js","names":[],"sources":["../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { type AnyString, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { useEffect, 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\t/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect -- Allow */\n\n\tuseEffect(() => {\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 && setPortalContainer(destination);\n\t}, [to, insertPosition]);\n\n\tuseEffect(() => {\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\tsetPortalContainer(tempWrapper);\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t};\n\t}, [to, insertPosition]);\n\n\t/* eslint-enable react-hooks-extra/no-direct-set-state-in-use-effect -- Allow */\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;AAIhF,iBAAgB;AACf,MAAI,CAAC,GAAI;AAET,MAAI,eAAgB;EAEpB,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;AAE7E,iBAAe,mBAAmB,YAAY;IAC5C,CAAC,IAAI,eAAe,CAAC;AAExB,iBAAgB;AACf,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,qBAAmB,YAAY;AAE/B,eAAa;AACZ,eAAY,QAAQ;;IAEnB,CAAC,IAAI,eAAe,CAAC;AAIxB,QAAO,mBAAmB,aAAa,UAAU,gBAAgB"}
@@ -1,2 +1,2 @@
1
- import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports } from "../../../index-BeDmH7lX.js";
1
+ import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports } from "../../index-DVBtz0VB.js";
2
2
  export { card_parts_d_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
@@ -1,5 +1,5 @@
1
- import "../../../slot-D1062oA5.js";
2
- import "../../../cn-_FbtIrlZ.js";
3
- import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports } from "../../../card-TD60Xux0.js";
1
+ import "../../slot-WVWfOlr3.js";
2
+ import "../../cn-s-D7vHW1.js";
3
+ import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports } from "../../card-DDLJVCwL.js";
4
4
 
5
5
  export { card_parts_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
@@ -0,0 +1,2 @@
1
+ import { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports } from "../../index-Dpt8KDv1.js";
2
+ export { carousel_parts_d_exports as Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps };