@zayne-labs/ui-react 0.1.4 → 0.2.0

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 (49) hide show
  1. package/dist/esm/chunk-CB2EZJYW.js +31 -0
  2. package/dist/esm/chunk-CB2EZJYW.js.map +1 -0
  3. package/dist/esm/chunk-DL646TEP.js +119 -0
  4. package/dist/esm/chunk-DL646TEP.js.map +1 -0
  5. package/dist/esm/chunk-EFGQDB4D.js +125 -0
  6. package/dist/esm/chunk-EFGQDB4D.js.map +1 -0
  7. package/dist/esm/chunk-FYVREWDP.js +43 -0
  8. package/dist/esm/chunk-FYVREWDP.js.map +1 -0
  9. package/dist/esm/chunk-HKPJTORQ.js +3 -0
  10. package/dist/esm/chunk-HKPJTORQ.js.map +1 -0
  11. package/dist/esm/chunk-PNYEIX7F.js +3 -0
  12. package/dist/esm/chunk-PNYEIX7F.js.map +1 -0
  13. package/dist/esm/chunk-PXYYL2LL.js +45 -0
  14. package/dist/esm/chunk-PXYYL2LL.js.map +1 -0
  15. package/dist/esm/chunk-W4DCQY55.js +33 -0
  16. package/dist/esm/chunk-W4DCQY55.js.map +1 -0
  17. package/dist/esm/chunk-XLI7WVBJ.js +363 -0
  18. package/dist/esm/chunk-XLI7WVBJ.js.map +1 -0
  19. package/dist/esm/chunk-ZKEUZZVP.js +274 -0
  20. package/dist/esm/chunk-ZKEUZZVP.js.map +1 -0
  21. package/dist/esm/common/for/index.d.ts +2 -2
  22. package/dist/esm/common/index.d.ts +9 -0
  23. package/dist/esm/common/index.js +9 -0
  24. package/dist/esm/common/index.js.map +1 -0
  25. package/dist/esm/common/show/index.js +2 -41
  26. package/dist/esm/common/show/index.js.map +1 -1
  27. package/dist/esm/common/switch/index.js +2 -31
  28. package/dist/esm/common/switch/index.js.map +1 -1
  29. package/dist/esm/common/teleport/index.js +1 -28
  30. package/dist/esm/common/teleport/index.js.map +1 -1
  31. package/dist/esm/{for-C3T5FbXd.d.ts → for-TpNYqkYV.d.ts} +1 -1
  32. package/dist/esm/index.d.ts +17 -2
  33. package/dist/esm/index.js +14 -1
  34. package/dist/esm/ui/card/index.js +4 -43
  35. package/dist/esm/ui/card/index.js.map +1 -1
  36. package/dist/esm/ui/carousel/index.d.ts +1 -1
  37. package/dist/esm/ui/carousel/index.js +4 -272
  38. package/dist/esm/ui/carousel/index.js.map +1 -1
  39. package/dist/esm/ui/drag-scroll/index.d.ts +3 -3
  40. package/dist/esm/ui/drag-scroll/index.js +2 -121
  41. package/dist/esm/ui/drag-scroll/index.js.map +1 -1
  42. package/dist/esm/ui/drop-zone/index.js +2 -123
  43. package/dist/esm/ui/drop-zone/index.js.map +1 -1
  44. package/dist/esm/ui/form/index.js +4 -361
  45. package/dist/esm/ui/form/index.js.map +1 -1
  46. package/dist/esm/ui/index.d.ts +12 -0
  47. package/dist/esm/ui/index.js +12 -0
  48. package/dist/esm/ui/index.js.map +1 -0
  49. package/package.json +4 -11
@@ -0,0 +1,31 @@
1
+ import { useState } from 'react';
2
+ import { useEffectOnce, useMountEffect } from '@zayne-labs/toolkit-react';
3
+ import { isString } from '@zayne-labs/toolkit-type-helpers';
4
+ import { createPortal } from 'react-dom';
5
+
6
+ // src/components/common/teleport/teleport.tsx
7
+ function Teleport(props) {
8
+ const { children, insertPosition, to } = props;
9
+ const [reactPortal, setReactPortal] = useState(null);
10
+ useEffectOnce(() => {
11
+ if (!to || !insertPosition) return;
12
+ const destination = isString(to) ? document.querySelector(to) : to;
13
+ const tempWrapper = document.createElement("div");
14
+ tempWrapper.style.display = "contents";
15
+ destination?.insertAdjacentElement(insertPosition, tempWrapper);
16
+ setReactPortal(createPortal(children, tempWrapper));
17
+ return () => {
18
+ tempWrapper.remove();
19
+ };
20
+ });
21
+ useMountEffect(() => {
22
+ if (!to || insertPosition) return;
23
+ const destination = isString(to) ? document.querySelector(to) : to;
24
+ destination && setReactPortal(createPortal(children, destination));
25
+ });
26
+ return reactPortal;
27
+ }
28
+
29
+ export { Teleport };
30
+ //# sourceMappingURL=chunk-CB2EZJYW.js.map
31
+ //# sourceMappingURL=chunk-CB2EZJYW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/common/teleport/teleport.tsx"],"names":[],"mappings":";;;;;;AAeA,SAAS,SAAS,KAAoB,EAAA;AACrC,EAAA,MAAM,EAAE,QAAA,EAAU,cAAgB,EAAA,EAAA,EAAO,GAAA,KAAA;AAEzC,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAmC,IAAI,CAAA;AAE7E,EAAA,aAAA,CAAc,MAAM;AACnB,IAAI,IAAA,CAAC,EAAM,IAAA,CAAC,cAAgB,EAAA;AAE5B,IAAA,MAAM,cAAc,QAAS,CAAA,EAAE,IAAI,QAAS,CAAA,aAAA,CAA2B,EAAE,CAAI,GAAA,EAAA;AAE7E,IAAM,MAAA,WAAA,GAAc,QAAS,CAAA,aAAA,CAAc,KAAK,CAAA;AAChD,IAAA,WAAA,CAAY,MAAM,OAAU,GAAA,UAAA;AAE5B,IAAa,WAAA,EAAA,qBAAA,CAAsB,gBAAgB,WAAW,CAAA;AAE9D,IAAe,cAAA,CAAA,YAAA,CAAa,QAAU,EAAA,WAAW,CAAC,CAAA;AAElD,IAAA,OAAO,MAAM;AACZ,MAAA,WAAA,CAAY,MAAO,EAAA;AAAA,KACpB;AAAA,GACA,CAAA;AAED,EAAA,cAAA,CAAe,MAAM;AACpB,IAAI,IAAA,CAAC,MAAM,cAAgB,EAAA;AAE3B,IAAA,MAAM,cAAc,QAAS,CAAA,EAAE,IAAI,QAAS,CAAA,aAAA,CAA2B,EAAE,CAAI,GAAA,EAAA;AAE7E,IAAA,WAAA,IAAe,cAAe,CAAA,YAAA,CAAa,QAAU,EAAA,WAAW,CAAC,CAAA;AAAA,GACjE,CAAA;AAED,EAAO,OAAA,WAAA;AACR","file":"chunk-CB2EZJYW.js","sourcesContent":["import * as React from \"react\";\n\nimport { useEffectOnce, useMountEffect } from \"@zayne-labs/toolkit-react\";\nimport { type AnyString, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { 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 [reactPortal, setReactPortal] = useState<React.ReactPortal | null>(null);\n\n\tuseEffectOnce(() => {\n\t\tif (!to || !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\tsetReactPortal(createPortal(children, tempWrapper));\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t};\n\t});\n\n\tuseMountEffect(() => {\n\t\tif (!to || insertPosition) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tdestination && setReactPortal(createPortal(children, destination));\n\t});\n\n\treturn reactPortal;\n}\n\nexport { Teleport };\n"]}
@@ -0,0 +1,119 @@
1
+ import { cnMerge } from './chunk-OHG7GB7O.js';
2
+ import { off, on, checkIsDeviceMobileOrTablet } from '@zayne-labs/toolkit-core';
3
+ import { useCallbackRef } from '@zayne-labs/toolkit-react';
4
+ import { mergeProps, composeRefs } from '@zayne-labs/toolkit-react/utils';
5
+ import { useRef } from 'react';
6
+
7
+ var updateCursor = (element) => {
8
+ element.style.cursor = "grabbing";
9
+ element.style.userSelect = "none";
10
+ };
11
+ var onScrollSnap = (action, element) => {
12
+ if (action === "remove") {
13
+ element.style.scrollSnapType = "none";
14
+ return;
15
+ }
16
+ element.style.scrollSnapType = "";
17
+ };
18
+ var resetCursor = (element) => {
19
+ element.style.cursor = "";
20
+ element.style.userSelect = "";
21
+ };
22
+ var handleScrollSnap = (dragContainer) => {
23
+ const isMobileOrTablet = checkIsDeviceMobileOrTablet();
24
+ if (!isMobileOrTablet) {
25
+ onScrollSnap("remove", dragContainer);
26
+ } else {
27
+ onScrollSnap("reset", dragContainer);
28
+ }
29
+ };
30
+
31
+ // src/components/ui/drag-scroll/use-drag-scroll.ts
32
+ var useDragScroll = (props = {}) => {
33
+ const {
34
+ classNames,
35
+ extraItemProps,
36
+ extraRootProps,
37
+ orientation = "horizontal",
38
+ usage = "allScreens"
39
+ } = props;
40
+ const dragContainerRef = useRef(null);
41
+ const positionRef = useRef({ left: 0, top: 0, x: 0, y: 0 });
42
+ const handleMouseMove = useCallbackRef((event) => {
43
+ if (!dragContainerRef.current) return;
44
+ if (orientation === "horizontal" || orientation === "both") {
45
+ const dx = event.clientX - positionRef.current.x;
46
+ dragContainerRef.current.scrollLeft = positionRef.current.left - dx;
47
+ }
48
+ if (orientation === "vertical" || orientation === "both") {
49
+ const dy = event.clientY - positionRef.current.y;
50
+ dragContainerRef.current.scrollTop = positionRef.current.top - dy;
51
+ }
52
+ });
53
+ const handleMouseUpOrLeave = useCallbackRef(() => {
54
+ if (!dragContainerRef.current) return;
55
+ off("mousemove", dragContainerRef.current, handleMouseMove);
56
+ off("mouseup", dragContainerRef.current, handleMouseUpOrLeave);
57
+ off("mouseleave", dragContainerRef.current, handleMouseUpOrLeave);
58
+ resetCursor(dragContainerRef.current);
59
+ });
60
+ const handleMouseDown = useCallbackRef((event) => {
61
+ if (usage === "mobileAndTabletOnly" && window.innerWidth >= 768) return;
62
+ if (usage === "desktopOnly" && window.innerWidth < 768) return;
63
+ if (!dragContainerRef.current) return;
64
+ if (orientation === "horizontal" || orientation === "both") {
65
+ positionRef.current.x = event.clientX;
66
+ positionRef.current.left = dragContainerRef.current.scrollLeft;
67
+ }
68
+ if (orientation === "vertical" || orientation === "both") {
69
+ positionRef.current.y = event.clientY;
70
+ positionRef.current.top = dragContainerRef.current.scrollTop;
71
+ }
72
+ updateCursor(dragContainerRef.current);
73
+ on("mousemove", dragContainerRef.current, handleMouseMove);
74
+ on("mouseup", dragContainerRef.current, handleMouseUpOrLeave);
75
+ on("mouseleave", dragContainerRef.current, handleMouseUpOrLeave);
76
+ });
77
+ const refCallBack = useCallbackRef((node) => {
78
+ dragContainerRef.current = node;
79
+ node && handleScrollSnap(node);
80
+ const cleanup = on("mousedown", dragContainerRef.current, handleMouseDown);
81
+ return cleanup;
82
+ });
83
+ const getRootProps = (rootProps) => {
84
+ const mergedRootProps = mergeProps(extraRootProps, rootProps);
85
+ return {
86
+ ...mergedRootProps,
87
+ className: cnMerge(
88
+ `flex w-full cursor-grab snap-x snap-mandatory overflow-y-clip overflow-x-scroll
89
+ [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,
90
+ orientation === "horizontal" && "flex-row",
91
+ orientation === "vertical" && "flex-col",
92
+ usage === "mobileAndTabletOnly" && "md:cursor-default md:flex-col",
93
+ usage === "desktopOnly" && "max-md:cursor-default max-md:flex-col",
94
+ classNames?.base,
95
+ mergedRootProps.className
96
+ ),
97
+ "data-part": "root",
98
+ "data-scope": "drag-scroll",
99
+ ref: composeRefs([
100
+ refCallBack,
101
+ mergedRootProps?.ref
102
+ ])
103
+ };
104
+ };
105
+ const getItemProps = (itemProps) => {
106
+ const mergedItemProps = mergeProps(extraItemProps, itemProps);
107
+ return {
108
+ ...mergedItemProps,
109
+ className: cnMerge("snap-center snap-always", classNames?.item, mergedItemProps.className),
110
+ "data-part": "item",
111
+ "data-scope": "drag-scroll"
112
+ };
113
+ };
114
+ return { getItemProps, getRootProps };
115
+ };
116
+
117
+ export { useDragScroll };
118
+ //# sourceMappingURL=chunk-DL646TEP.js.map
119
+ //# sourceMappingURL=chunk-DL646TEP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/ui/drag-scroll/utils.ts","../../src/components/ui/drag-scroll/use-drag-scroll.ts"],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AA,MACH,SAAW,EAAA,OAAA;AAAA,QACV,CAAA;AAAA,kFAAA,CAAA;AAAA,QAEA,gBAAgB,YAAgB,IAAA,UAAA;AAAA,QAChC,gBAAgB,UAAc,IAAA,UAAA;AAAA,QAC9B,UAAU,qBAAyB,IAAA,+BAAA;AAAA,QACnC,UAAU,aAAiB,IAAA,uCAAA;AAAA,QAC3B,UAAY,EAAA,IAAA;AAAA,QACZ,eAAgB,CAAA;AAAA,OACjB;AAAA,MACA,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA,aAAA;AAAA,MACd,KAAK,WAAY,CAAA;AAAA,QAChB,WAAA;AAAA,QACC,eAA+D,EAAA;AAAA,OAChE;AAAA,KACF;AAAA,GACD;AAEA,EAAM,MAAA,YAAA,GAAe,CACpB,SACI,KAAA;AACJ,IAAM,MAAA,eAAA,GAAkB,UAAW,CAAA,cAAA,EAAgB,SAAS,CAAA;AAE5D,IAAO,OAAA;AAAA,MACN,GAAG,eAAA;AAAA,MACH,WAAW,OAAQ,CAAA,yBAAA,EAA2B,UAAY,EAAA,IAAA,EAAM,gBAAgB,SAAS,CAAA;AAAA,MACzF,WAAa,EAAA,MAAA;AAAA,MACb,YAAc,EAAA;AAAA,KACf;AAAA,GACD;AAEA,EAAO,OAAA,EAAE,cAAc,YAAa,EAAA;AACrC","file":"chunk-DL646TEP.js","sourcesContent":["import { checkIsDeviceMobileOrTablet } from \"@zayne-labs/toolkit-core\";\n\n/* eslint-disable no-param-reassign -- Mutation is needed here since it's an element */\nexport const updateCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"grabbing\";\n\telement.style.userSelect = \"none\";\n};\n\nexport const onScrollSnap = <TElement extends HTMLElement>(\n\taction: \"remove\" | \"reset\",\n\telement: TElement\n) => {\n\tif (action === \"remove\") {\n\t\telement.style.scrollSnapType = \"none\";\n\t\treturn;\n\t}\n\n\telement.style.scrollSnapType = \"\";\n};\n\nexport const resetCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"\";\n\telement.style.userSelect = \"\";\n};\n/* eslint-enable no-param-reassign -- Mutation is needed here since it's an element */\n\nexport const handleScrollSnap = (dragContainer: HTMLElement) => {\n\tconst isMobileOrTablet = checkIsDeviceMobileOrTablet();\n\n\tif (!isMobileOrTablet) {\n\t\tonScrollSnap(\"remove\", dragContainer);\n\t} else {\n\t\tonScrollSnap(\"reset\", dragContainer);\n\t}\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { off, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { type InferProps, composeRefs, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type RefCallback, useRef } from \"react\";\nimport { handleScrollSnap, resetCursor, updateCursor } from \"./utils\";\n\ntype DragScrollProps<TElement extends HTMLElement> = {\n\tclassNames?: { base?: string; item?: string };\n\textraItemProps?: InferProps<HTMLElement>;\n\textraRootProps?: Omit<InferProps<TElement>, \"children\">;\n\torientation?: \"both\" | \"horizontal\" | \"vertical\";\n\tusage?: \"allScreens\" | \"desktopOnly\" | \"mobileAndTabletOnly\";\n};\n\nconst useDragScroll = <TElement extends HTMLElement>(props: DragScrollProps<TElement> = {}) => {\n\tconst {\n\t\tclassNames,\n\t\textraItemProps,\n\t\textraRootProps,\n\t\torientation = \"horizontal\",\n\t\tusage = \"allScreens\",\n\t} = props;\n\n\tconst dragContainerRef = useRef<TElement>(null);\n\n\tconst positionRef = useRef({ left: 0, top: 0, x: 0, y: 0 });\n\n\tconst handleMouseMove = useCallbackRef((event: MouseEvent) => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the horizontal scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dx = event.clientX - positionRef.current.x;\n\n\t\t\t// == Assign the scrollLeft of the container to the difference between its previous horizontal scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollLeft = positionRef.current.left - dx;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t// == calculate the current change in the vertical scroll position based on the difference between the previous mouse position and the new mouse position\n\t\t\tconst dy = event.clientY - positionRef.current.y;\n\n\t\t\t// == Assign the scrollTop of the container to the difference between its previous vertical scroll position and the change in the mouse position\n\t\t\tdragContainerRef.current.scrollTop = positionRef.current.top - dy;\n\t\t}\n\t});\n\n\tconst handleMouseUpOrLeave = useCallbackRef(() => {\n\t\tif (!dragContainerRef.current) return;\n\n\t\toff(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\toff(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\toff(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\n\t\tresetCursor(dragContainerRef.current);\n\t});\n\n\tconst handleMouseDown = useCallbackRef((event: MouseEvent) => {\n\t\tif (usage === \"mobileAndTabletOnly\" && window.innerWidth >= 768) return;\n\t\tif (usage === \"desktopOnly\" && window.innerWidth < 768) return;\n\n\t\tif (!dragContainerRef.current) return;\n\n\t\t// == Update all initial position properties stored in the positionRef\n\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\tpositionRef.current.x = event.clientX;\n\t\t\tpositionRef.current.left = dragContainerRef.current.scrollLeft;\n\t\t}\n\n\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\tpositionRef.current.y = event.clientY;\n\t\t\tpositionRef.current.top = dragContainerRef.current.scrollTop;\n\t\t}\n\n\t\tupdateCursor(dragContainerRef.current);\n\n\t\ton(\"mousemove\", dragContainerRef.current, handleMouseMove);\n\t\ton(\"mouseup\", dragContainerRef.current, handleMouseUpOrLeave);\n\t\ton(\"mouseleave\", dragContainerRef.current, handleMouseUpOrLeave);\n\t});\n\n\tconst refCallBack: RefCallback<TElement> = useCallbackRef((node) => {\n\t\tdragContainerRef.current = node;\n\n\t\tnode && handleScrollSnap(node);\n\n\t\tconst cleanup = on(\"mousedown\", dragContainerRef.current, handleMouseDown);\n\n\t\treturn cleanup;\n\t});\n\n\tconst getRootProps = (rootProps?: DragScrollProps<TElement>[\"extraRootProps\"]) => {\n\t\tconst mergedRootProps = mergeProps(extraRootProps, rootProps);\n\n\t\treturn {\n\t\t\t...mergedRootProps,\n\t\t\tclassName: cnMerge(\n\t\t\t\t`flex w-full cursor-grab snap-x snap-mandatory overflow-y-clip overflow-x-scroll\n\t\t\t\t[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,\n\t\t\t\torientation === \"horizontal\" && \"flex-row\",\n\t\t\t\torientation === \"vertical\" && \"flex-col\",\n\t\t\t\tusage === \"mobileAndTabletOnly\" && \"md:cursor-default md:flex-col\",\n\t\t\t\tusage === \"desktopOnly\" && \"max-md:cursor-default max-md:flex-col\",\n\t\t\t\tclassNames?.base,\n\t\t\t\tmergedRootProps.className\n\t\t\t),\n\t\t\t\"data-part\": \"root\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t\tref: composeRefs([\n\t\t\t\trefCallBack,\n\t\t\t\t(mergedRootProps as { ref?: React.Ref<TElement> } | undefined)?.ref,\n\t\t\t]),\n\t\t};\n\t};\n\n\tconst getItemProps = <TItemElement extends HTMLElement>(\n\t\titemProps?: DragScrollProps<TItemElement>[\"extraItemProps\"]\n\t) => {\n\t\tconst mergedItemProps = mergeProps(extraItemProps, itemProps);\n\n\t\treturn {\n\t\t\t...mergedItemProps,\n\t\t\tclassName: cnMerge(\"snap-center snap-always\", classNames?.item, mergedItemProps.className),\n\t\t\t\"data-part\": \"item\",\n\t\t\t\"data-scope\": \"drag-scroll\",\n\t\t};\n\t};\n\n\treturn { getItemProps, getRootProps };\n};\n\nexport { useDragScroll };\n"]}
@@ -0,0 +1,125 @@
1
+ import { cnMerge } from './chunk-OHG7GB7O.js';
2
+ import * as React from 'react';
3
+ import { useRef, useState } from 'react';
4
+ import { handleFileValidation } from '@zayne-labs/toolkit-core';
5
+ import { useToggle, useCallbackRef } from '@zayne-labs/toolkit-react';
6
+ import { mergeProps, composeRefs } from '@zayne-labs/toolkit-react/utils';
7
+ import { isObject, isFunction } from '@zayne-labs/toolkit-type-helpers';
8
+
9
+ var useDropZone = (props) => {
10
+ const inputRef = useRef(null);
11
+ const {
12
+ allowedFileTypes,
13
+ children,
14
+ classNames,
15
+ disableInbuiltValidation,
16
+ existingFiles,
17
+ extraInputProps,
18
+ extraRootProps,
19
+ onUpload,
20
+ onUploadError,
21
+ onUploadSuccess,
22
+ validationSettings,
23
+ validator
24
+ // eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Can be undefined
25
+ } = props ?? {};
26
+ const [isDragging, toggleIsDragging] = useToggle(false);
27
+ const [acceptedFiles, setAcceptedFiles] = useState([]);
28
+ const handleFileUpload = useCallbackRef(
29
+ (event) => {
30
+ if (event.defaultPrevented) return;
31
+ if (event.type === "drop") {
32
+ event.preventDefault();
33
+ toggleIsDragging(false);
34
+ }
35
+ const fileList = event.type === "drop" ? event.dataTransfer.files : event.target.files;
36
+ if (fileList === null) {
37
+ console.warn("No file selected");
38
+ return;
39
+ }
40
+ const inbuiltValidatedFilesArray = !disableInbuiltValidation ? handleFileValidation({
41
+ existingFileArray: existingFiles,
42
+ newFileList: fileList,
43
+ onError: onUploadError,
44
+ onSuccess: onUploadSuccess,
45
+ validationSettings: isObject(validationSettings) ? { ...validationSettings, allowedFileTypes } : {}
46
+ }) : [];
47
+ const validatorFnFileArray = validator ? validator({ existingFileArray: existingFiles, newFileList: fileList }) : [];
48
+ const validFilesArray = [...inbuiltValidatedFilesArray, ...validatorFnFileArray];
49
+ if (validFilesArray.length === 0) return;
50
+ setAcceptedFiles(validFilesArray);
51
+ onUpload?.({ acceptedFiles: validFilesArray, event });
52
+ }
53
+ );
54
+ const handleDragOver = (event) => {
55
+ event.preventDefault();
56
+ toggleIsDragging(true);
57
+ };
58
+ const handleDragLeave = (event) => {
59
+ event.preventDefault();
60
+ toggleIsDragging(false);
61
+ };
62
+ const getRenderProps = () => ({ acceptedFiles, inputRef, isDragging });
63
+ const getChildren = () => isFunction(children) ? children(getRenderProps()) : children;
64
+ const getRootProps = (rootProps) => {
65
+ const mergedRootProps = mergeProps(extraRootProps, rootProps);
66
+ return {
67
+ ...mergedRootProps,
68
+ className: cnMerge(
69
+ "relative isolate flex flex-col",
70
+ mergedRootProps.className,
71
+ classNames?.base,
72
+ isDragging && ["opacity-60", classNames?.activeDrag, rootProps?.classNames?.activeDrag]
73
+ ),
74
+ "data-active-drag": isDragging,
75
+ "data-part": "root",
76
+ "data-scope": "dropzone",
77
+ onDragEnter: handleDragOver,
78
+ onDragLeave: handleDragLeave,
79
+ onDragOver: handleDragOver,
80
+ onDrop: handleFileUpload
81
+ };
82
+ };
83
+ const getInputProps = (inputProps) => {
84
+ const mergedInputProps = mergeProps(extraInputProps, inputProps);
85
+ return {
86
+ ...mergedInputProps,
87
+ accept: allowedFileTypes ? allowedFileTypes.join(", ") : mergedInputProps.accept,
88
+ className: cnMerge(
89
+ "absolute inset-0 z-[100] cursor-pointer opacity-0",
90
+ classNames?.input,
91
+ mergedInputProps.className
92
+ ),
93
+ "data-active-drag": isDragging,
94
+ "data-part": "input",
95
+ "data-scope": "dropzone",
96
+ onChange: (event) => {
97
+ handleFileUpload(event);
98
+ mergedInputProps.onChange?.(event);
99
+ },
100
+ ref: composeRefs([inputRef, mergedInputProps.ref]),
101
+ type: "file"
102
+ };
103
+ };
104
+ return {
105
+ getChildren,
106
+ getInputProps,
107
+ getRenderProps,
108
+ getRootProps,
109
+ handleDragLeave,
110
+ handleDragOver,
111
+ handleFileUpload,
112
+ inputRef,
113
+ isDragging
114
+ };
115
+ };
116
+
117
+ // src/components/ui/drop-zone/drop-zone.tsx
118
+ function DropZone(props) {
119
+ const api = useDropZone(props);
120
+ return /* @__PURE__ */ React.createElement("div", { ...api.getRootProps() }, /* @__PURE__ */ React.createElement("input", { ...api.getInputProps() }), api.getChildren());
121
+ }
122
+
123
+ export { DropZone, useDropZone };
124
+ //# sourceMappingURL=chunk-EFGQDB4D.js.map
125
+ //# sourceMappingURL=chunk-EFGQDB4D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/ui/drop-zone/use-drop-zone.ts","../../src/components/ui/drop-zone/drop-zone.tsx"],"names":[],"mappings":";;;;;;;;AAmDa,IAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACvD,EAAM,MAAA,QAAA,GAAW,OAAyB,IAAI,CAAA;AAE9C,EAAM,MAAA;AAAA,IACL,gBAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,wBAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA;AAAA,GAED,GAAI,SAAS,EAAC;AAEd,EAAA,MAAM,CAAC,UAAA,EAAY,gBAAgB,CAAA,GAAI,UAAU,KAAK,CAAA;AAEtD,EAAA,MAAM,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA,CAAiB,EAAE,CAAA;AAE7D,EAAA,MAAM,gBAAmB,GAAA,cAAA;AAAA,IACxB,CAAC,KAAiF,KAAA;AACjF,MAAA,IAAI,MAAM,gBAAkB,EAAA;AAE5B,MAAI,IAAA,KAAA,CAAM,SAAS,MAAQ,EAAA;AAC1B,QAAA,KAAA,CAAM,cAAe,EAAA;AACrB,QAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA;AAGvB,MAAM,MAAA,QAAA,GACL,MAAM,IAAS,KAAA,MAAA,GACX,MAA0B,YAAa,CAAA,KAAA,GACvC,MAA8C,MAAO,CAAA,KAAA;AAE1D,MAAA,IAAI,aAAa,IAAM,EAAA;AACtB,QAAA,OAAA,CAAQ,KAAK,kBAAkB,CAAA;AAE/B,QAAA;AAAA;AAGD,MAAM,MAAA,0BAAA,GAA6B,CAAC,wBAAA,GACjC,oBAAqB,CAAA;AAAA,QACrB,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A,YAAA;AAAA,IACA,eAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACD;AACD;;;AC7LA,SAAS,SAAS,KAAyB,EAAA;AAC1C,EAAM,MAAA,GAAA,GAAM,YAAY,KAAK,CAAA;AAE7B,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,GAAG,GAAA,CAAI,cACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAA,GAAG,IAAI,aAAc,EAAA,EAAG,CAE/B,EAAA,GAAA,CAAI,aACN,CAAA;AAEF","file":"chunk-EFGQDB4D.js","sourcesContent":["\"use client\";\n\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport { type FileValidationOptions, handleFileValidation } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useToggle } from \"@zayne-labs/toolkit-react\";\nimport { type InferProps, composeRefs, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction, isObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useRef, useState } from \"react\";\n\ntype RenderProps = {\n\tacceptedFiles: File[];\n\tinputRef: React.RefObject<HTMLInputElement | null>;\n\tisDragging: boolean;\n};\n\nexport type RootProps = InferProps<\"div\"> & { classNames?: { activeDrag?: string; base?: string } };\n\nexport type InputProps = InferProps<\"input\">;\n\nexport type UseDropZoneProps = {\n\tallowedFileTypes?: string[];\n\n\tchildren?: React.ReactNode | ((props: RenderProps) => React.ReactNode);\n\n\tclassNames?: { activeDrag?: string; base?: string; input?: string };\n\n\tdisableInbuiltValidation?: boolean;\n\n\texistingFiles?: File[];\n\n\textraInputProps?: InputProps;\n\n\textraRootProps?: RootProps;\n\n\tonUpload?: (details: {\n\t\tacceptedFiles: File[];\n\t\tevent: React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLDivElement>;\n\t}) => void;\n\n\tonUploadError?: FileValidationOptions[\"onError\"];\n\n\tonUploadSuccess?: FileValidationOptions[\"onSuccess\"];\n\n\tvalidationSettings?: {\n\t\tdisallowDuplicates?: boolean;\n\t\tfileLimit?: number;\n\t\tmaxFileSize?: number;\n\t};\n\tvalidator?: (context: { existingFileArray: File[] | undefined; newFileList: FileList }) => File[];\n};\n\nexport const useDropZone = (props: UseDropZoneProps) => {\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst {\n\t\tallowedFileTypes,\n\t\tchildren,\n\t\tclassNames,\n\t\tdisableInbuiltValidation,\n\t\texistingFiles,\n\t\textraInputProps,\n\t\textraRootProps,\n\t\tonUpload,\n\t\tonUploadError,\n\t\tonUploadSuccess,\n\t\tvalidationSettings,\n\t\tvalidator,\n\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Can be undefined\n\t} = props ?? {};\n\n\tconst [isDragging, toggleIsDragging] = useToggle(false);\n\n\tconst [acceptedFiles, setAcceptedFiles] = useState<File[]>([]);\n\n\tconst handleFileUpload = useCallbackRef(\n\t\t(event: React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLDivElement>) => {\n\t\t\tif (event.defaultPrevented) return;\n\n\t\t\tif (event.type === \"drop\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttoggleIsDragging(false);\n\t\t\t}\n\n\t\t\tconst fileList =\n\t\t\t\tevent.type === \"drop\"\n\t\t\t\t\t? (event as React.DragEvent).dataTransfer.files\n\t\t\t\t\t: (event as React.ChangeEvent<HTMLInputElement>).target.files;\n\n\t\t\tif (fileList === null) {\n\t\t\t\tconsole.warn(\"No file selected\");\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst inbuiltValidatedFilesArray = !disableInbuiltValidation\n\t\t\t\t? handleFileValidation({\n\t\t\t\t\t\texistingFileArray: existingFiles,\n\t\t\t\t\t\tnewFileList: fileList,\n\t\t\t\t\t\tonError: onUploadError,\n\t\t\t\t\t\tonSuccess: onUploadSuccess,\n\t\t\t\t\t\tvalidationSettings: isObject(validationSettings)\n\t\t\t\t\t\t\t? { ...validationSettings, allowedFileTypes }\n\t\t\t\t\t\t\t: {},\n\t\t\t\t\t})\n\t\t\t\t: [];\n\n\t\t\tconst validatorFnFileArray = validator\n\t\t\t\t? validator({ existingFileArray: existingFiles, newFileList: fileList })\n\t\t\t\t: [];\n\n\t\t\tconst validFilesArray = [...inbuiltValidatedFilesArray, ...validatorFnFileArray];\n\n\t\t\tif (validFilesArray.length === 0) return;\n\n\t\t\tsetAcceptedFiles(validFilesArray);\n\n\t\t\tonUpload?.({ acceptedFiles: validFilesArray, event });\n\t\t}\n\t);\n\n\tconst handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {\n\t\tevent.preventDefault();\n\t\ttoggleIsDragging(true);\n\t};\n\n\tconst handleDragLeave = (event: React.DragEvent<HTMLDivElement>) => {\n\t\tevent.preventDefault();\n\t\ttoggleIsDragging(false);\n\t};\n\n\tconst getRenderProps = () => ({ acceptedFiles, inputRef, isDragging }) satisfies RenderProps;\n\n\tconst getChildren = () => (isFunction(children) ? children(getRenderProps()) : children);\n\n\t/* TODO: take inspiration from ark's implementation to merge extraRootProps with the props you pass to getRootProps\n\t * @see https://github.com/chakra-ui/ark/blob/main/packages/react/src/components/steps/steps-separator.tsx\n\t */\n\n\tconst getRootProps = (rootProps?: RootProps) => {\n\t\tconst mergedRootProps = mergeProps(extraRootProps, rootProps);\n\n\t\treturn {\n\t\t\t...mergedRootProps,\n\t\t\tclassName: cnMerge(\n\t\t\t\t\"relative isolate flex flex-col\",\n\t\t\t\tmergedRootProps.className,\n\t\t\t\tclassNames?.base,\n\t\t\t\tisDragging && [\"opacity-60\", classNames?.activeDrag, rootProps?.classNames?.activeDrag]\n\t\t\t),\n\t\t\t\"data-active-drag\": isDragging,\n\t\t\t\"data-part\": \"root\",\n\t\t\t\"data-scope\": \"dropzone\",\n\t\t\tonDragEnter: handleDragOver,\n\t\t\tonDragLeave: handleDragLeave,\n\t\t\tonDragOver: handleDragOver,\n\t\t\tonDrop: handleFileUpload,\n\t\t};\n\t};\n\n\tconst getInputProps = (inputProps?: InputProps) => {\n\t\tconst mergedInputProps = mergeProps(extraInputProps, inputProps);\n\n\t\treturn {\n\t\t\t...mergedInputProps,\n\t\t\taccept: allowedFileTypes ? allowedFileTypes.join(\", \") : mergedInputProps.accept,\n\t\t\tclassName: cnMerge(\n\t\t\t\t\"absolute inset-0 z-[100] cursor-pointer opacity-0\",\n\t\t\t\tclassNames?.input,\n\t\t\t\tmergedInputProps.className\n\t\t\t),\n\t\t\t\"data-active-drag\": isDragging,\n\t\t\t\"data-part\": \"input\",\n\t\t\t\"data-scope\": \"dropzone\",\n\t\t\tonChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\t\thandleFileUpload(event);\n\t\t\t\tmergedInputProps.onChange?.(event);\n\t\t\t},\n\t\t\tref: composeRefs([inputRef, mergedInputProps.ref]),\n\t\t\ttype: \"file\",\n\t\t};\n\t};\n\n\treturn {\n\t\tgetChildren,\n\t\tgetInputProps,\n\t\tgetRenderProps,\n\t\tgetRootProps,\n\t\thandleDragLeave,\n\t\thandleDragOver,\n\t\thandleFileUpload,\n\t\tinputRef,\n\t\tisDragging,\n\t};\n};\n","import * as React from \"react\";\n\nimport { type UseDropZoneProps, useDropZone } from \"./use-drop-zone\";\n\nfunction DropZone(props: UseDropZoneProps) {\n\tconst api = useDropZone(props);\n\n\treturn (\n\t\t<div {...api.getRootProps()}>\n\t\t\t<input {...api.getInputProps()} />\n\n\t\t\t{api.getChildren()}\n\t\t</div>\n\t);\n}\n\nexport { DropZone };\n"]}
@@ -0,0 +1,43 @@
1
+ import { __export } from './chunk-PZ5AY32C.js';
2
+ import 'react';
3
+ import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
4
+ import { AssertionError } from '@zayne-labs/toolkit-type-helpers';
5
+
6
+ function ShowRoot({ children, fallback, when }) {
7
+ const fallBackSlot = getSlotElement(children, ShowFallback, {
8
+ errorMessage: "Only one <Show.Fallback> or <Show.OtherWise> component is allowed",
9
+ throwOnMultipleSlotMatch: true
10
+ });
11
+ const contentSlot = getSlotElement(children, ShowContent, {
12
+ errorMessage: "Only one <Show.Content> component is allowed",
13
+ throwOnMultipleSlotMatch: true
14
+ });
15
+ const otherChildren = getOtherChildren(children, [ShowFallback, ShowContent]);
16
+ if (fallBackSlot && fallback) {
17
+ throw new AssertionError(`
18
+ The fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.
19
+ `);
20
+ }
21
+ return when ? contentSlot ?? otherChildren : fallBackSlot ?? fallback;
22
+ }
23
+ function ShowContent({ children }) {
24
+ return children;
25
+ }
26
+ ShowContent.slot = Symbol.for("content");
27
+ function ShowFallback({ children }) {
28
+ return children;
29
+ }
30
+ ShowFallback.slot = Symbol.for("show-fallback");
31
+
32
+ // src/components/common/show/show-parts.ts
33
+ var show_parts_exports = {};
34
+ __export(show_parts_exports, {
35
+ Content: () => ShowContent,
36
+ Fallback: () => ShowFallback,
37
+ OtherWise: () => ShowFallback,
38
+ Root: () => ShowRoot
39
+ });
40
+
41
+ export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
42
+ //# sourceMappingURL=chunk-FYVREWDP.js.map
43
+ //# sourceMappingURL=chunk-FYVREWDP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,QAAS,CAAA,EAAE,QAAU,EAAA,QAAA,EAAU,MAAmB,EAAA;AACjE,EAAM,MAAA,YAAA,GAAe,cAAe,CAAA,QAAA,EAAU,YAAc,EAAA;AAAA,IAC3D,YAAc,EAAA,mEAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,WAAa,EAAA;AAAA,IACzD,YAAc,EAAA,8CAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,gBAAgB,gBAAiB,CAAA,QAAA,EAAU,CAAC,YAAA,EAAc,WAAW,CAAC,CAAA;AAE5E,EAAA,IAAI,gBAAgB,QAAU,EAAA;AAC7B,IAAA,MAAM,IAAI,cAAe,CAAA;AAAA;AAAA,EAExB,CAAA,CAAA;AAAA;AAGF,EAAO,OAAA,IAAA,GAAQ,WAAe,IAAA,aAAA,GAAkB,YAAgB,IAAA,QAAA;AACjE;AAEO,SAAS,WAAA,CAAY,EAAE,QAAA,EAAyC,EAAA;AACtE,EAAO,OAAA,QAAA;AACR;AACA,WAAY,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,SAAS,CAAA;AAEhC,SAAS,YAAA,CAAa,EAAE,QAAA,EAAyC,EAAA;AACvE,EAAO,OAAA,QAAA;AACR;AACA,YAAa,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,eAAe,CAAA;;;AC3C9C,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,QAAA,EAAA,MAAA,YAAA;AAAA,EAAA,SAAA,EAAA,MAAA,YAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-FYVREWDP.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\nimport { AssertionError } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps = {\n\tchildren: React.ReactNode;\n\tfallback?: React.ReactNode;\n\twhen: boolean;\n};\n\nexport function ShowRoot({ children, fallback, when }: ShowProps) {\n\tconst fallBackSlot = getSlotElement(children, ShowFallback, {\n\t\terrorMessage: \"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst contentSlot = getSlotElement(children, ShowContent, {\n\t\terrorMessage: \"Only one <Show.Content> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst otherChildren = getOtherChildren(children, [ShowFallback, ShowContent]);\n\n\tif (fallBackSlot && fallback) {\n\t\tthrow new AssertionError(`\n\t\t\tThe fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.\n\t\t`);\n\t}\n\n\treturn when ? (contentSlot ?? otherChildren) : (fallBackSlot ?? fallback);\n}\n\nexport function ShowContent({ children }: Pick<ShowProps, \"children\">) {\n\treturn children;\n}\nShowContent.slot = Symbol.for(\"content\");\n\nexport function ShowFallback({ children }: Pick<ShowProps, \"children\">) {\n\treturn children;\n}\nShowFallback.slot = Symbol.for(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as OtherWise,\n\tShowRoot as Root,\n} from \"./show\";\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-HKPJTORQ.js.map
3
+ //# sourceMappingURL=chunk-HKPJTORQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-HKPJTORQ.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-PNYEIX7F.js.map
3
+ //# sourceMappingURL=chunk-PNYEIX7F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PNYEIX7F.js"}
@@ -0,0 +1,45 @@
1
+ import { cnMerge } from './chunk-OHG7GB7O.js';
2
+ import { Slot } from './chunk-ENDWJXPF.js';
3
+ import { __export } from './chunk-PZ5AY32C.js';
4
+ import * as React from 'react';
5
+
6
+ function CardRoot(props) {
7
+ const { as: Element = "article", ...restOfProps } = props;
8
+ return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
9
+ }
10
+ function CardHeader(props) {
11
+ const { as: Element = "header", ...restOfProps } = props;
12
+ return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
13
+ }
14
+ function CardTitle(props) {
15
+ const { as: Element = "h3", className, ...restOfProps } = props;
16
+ return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("font-semibold", className), ...restOfProps });
17
+ }
18
+ function CardDescription(props) {
19
+ const { as: Element = "p", className, ...restOfProps } = props;
20
+ return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("text-sm text-shadcn-muted-foreground", className), ...restOfProps });
21
+ }
22
+ function CardContent(props) {
23
+ const { as: Element = "div", ...restOfProps } = props;
24
+ return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
25
+ }
26
+ function CardFooter(props) {
27
+ const { as: Element = "footer", asChild, ...restOfProps } = props;
28
+ const Component = asChild ? Slot : Element;
29
+ return /* @__PURE__ */ React.createElement(Component, { ...restOfProps });
30
+ }
31
+
32
+ // src/components/ui/card/card-parts.ts
33
+ var card_parts_exports = {};
34
+ __export(card_parts_exports, {
35
+ Content: () => CardContent,
36
+ Description: () => CardDescription,
37
+ Footer: () => CardFooter,
38
+ Header: () => CardHeader,
39
+ Root: () => CardRoot,
40
+ Title: () => CardTitle
41
+ });
42
+
43
+ export { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports };
44
+ //# sourceMappingURL=chunk-PXYYL2LL.js.map
45
+ //# sourceMappingURL=chunk-PXYYL2LL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/ui/card/card.tsx","../../src/components/ui/card/card-parts.ts"],"names":[],"mappings":";;;;;AAMO,SAAS,SACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEpD,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,WACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,QAAU,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEnD,EAAO,uBAAA,KAAA,CAAA,a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MAAA,UAAA;AAAA,EAAA,IAAA,EAAA,MAAA,QAAA;AAAA,EAAA,KAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-PXYYL2LL.js","sourcesContent":["import * as React from \"react\";\n\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn <Element className={cnMerge(\"font-semibold\", className)} {...restOfProps} />;\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element className={cnMerge(\"text-sm text-shadcn-muted-foreground\", className)} {...restOfProps} />\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", ...restOfProps } = props;\n\n\treturn <Element {...restOfProps} />;\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot : Element;\n\n\treturn <Component {...restOfProps} />;\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"]}
@@ -0,0 +1,33 @@
1
+ import { __export } from './chunk-PZ5AY32C.js';
2
+ import 'react';
3
+ import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
4
+
5
+ function SwitchRoot(props) {
6
+ const { children, condition = true } = props;
7
+ const defaultCase = getSlotElement(children, SwitchDefault, {
8
+ errorMessage: "Only one <Switch.Default> component is allowed",
9
+ throwOnMultipleSlotMatch: true
10
+ });
11
+ const childrenCasesArray = getOtherChildren(children, SwitchDefault);
12
+ const matchedCase = childrenCasesArray.find((child) => child.props.when === condition);
13
+ return matchedCase ?? defaultCase;
14
+ }
15
+ function SwitchMatch({ children }) {
16
+ return children;
17
+ }
18
+ function SwitchDefault({ children }) {
19
+ return children;
20
+ }
21
+ SwitchDefault.slot = Symbol.for("switch-default");
22
+
23
+ // src/components/common/switch/switch-parts.ts
24
+ var switch_parts_exports = {};
25
+ __export(switch_parts_exports, {
26
+ Default: () => SwitchDefault,
27
+ Match: () => SwitchMatch,
28
+ Root: () => SwitchRoot
29
+ });
30
+
31
+ export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports };
32
+ //# sourceMappingURL=chunk-W4DCQY55.js.map
33
+ //# sourceMappingURL=chunk-W4DCQY55.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"names":[],"mappings":";;;;AAkBO,SAAS,WAA8B,KAAgC,EAAA;AAC7E,EAAA,MAAM,EAAE,QAAA,EAAU,SAAY,GAAA,IAAA,EAAS,GAAA,KAAA;AAEvC,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,QAAA,EAAU,aAAe,EAAA;AAAA,IAC3D,YAAc,EAAA,gDAAA;AAAA,IACd,wBAA0B,EAAA;AAAA,GAC1B,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,gBAAiB,CAAA,QAAA,EAAU,aAAa,CAAA;AAEnE,EAAM,MAAA,WAAA,GAAc,mBAAmB,IAAK,CAAA,CAAC,UAAU,KAAM,CAAA,KAAA,CAAM,SAAS,SAAS,CAAA;AAErF,EAAA,OAAO,WAAe,IAAA,WAAA;AACvB;AAEO,SAAS,WAAA,CAAmB,EAAE,QAAA,EAAqC,EAAA;AACzE,EAAO,OAAA,QAAA;AACR;AAEO,SAAS,aAAA,CAAc,EAAE,QAAA,EAAgD,EAAA;AAC/E,EAAO,OAAA,QAAA;AACR;AACA,aAAc,CAAA,IAAA,GAAO,MAAO,CAAA,GAAA,CAAI,gBAAgB,CAAA;;;ACxChD,IAAA,oBAAA,GAAA;AAAA,QAAA,CAAA,oBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,aAAA;AAAA,EAAA,KAAA,EAAA,MAAA,WAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-W4DCQY55.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getOtherChildren, getSlotElement } from \"@zayne-labs/toolkit-react/utils\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps>;\n\ntype SwitchProps<TCondition> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tcondition?: TCondition;\n};\n\ntype SwitchMatchProps<TWhen = boolean> = {\n\tchildren: React.ReactNode;\n\twhen: TWhen;\n};\n\nexport function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>) {\n\tconst { children, condition = true } = props;\n\n\tconst defaultCase = getSlotElement(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getOtherChildren(children, SwitchDefault);\n\n\tconst matchedCase = childrenCasesArray.find((child) => child.props.when === condition);\n\n\treturn matchedCase ?? defaultCase;\n}\n\nexport function SwitchMatch<TWhen>({ children }: SwitchMatchProps<TWhen>) {\n\treturn children;\n}\n\nexport function SwitchDefault({ children }: Pick<SwitchMatchProps, \"children\">) {\n\treturn children;\n}\nSwitchDefault.slot = Symbol.for(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"]}