@zayne-labs/ui-react 0.9.17 → 0.9.19

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 (55) hide show
  1. package/dist/esm/{carousel-Dznupnx8.js → carousel-Dvp-qURP.js} +2 -2
  2. package/dist/esm/{carousel-Dznupnx8.js.map → carousel-Dvp-qURP.js.map} +1 -1
  3. package/dist/esm/components/common/await/index.d.ts +5 -5
  4. package/dist/esm/components/common/await/index.js +1 -1
  5. package/dist/esm/components/common/error-boundary/index.d.ts +1 -1
  6. package/dist/esm/components/common/for/index.d.ts +1 -1
  7. package/dist/esm/components/common/index.d.ts +10 -10
  8. package/dist/esm/components/common/index.js +3 -3
  9. package/dist/esm/components/common/show/index.d.ts +1 -1
  10. package/dist/esm/components/common/show/index.js +2 -2
  11. package/dist/esm/components/common/slot/index.d.ts +1 -1
  12. package/dist/esm/components/common/suspense-with-boundary/index.d.ts +2 -2
  13. package/dist/esm/components/common/switch/index.d.ts +1 -1
  14. package/dist/esm/components/common/switch/index.js +2 -2
  15. package/dist/esm/components/common/teleport/index.d.ts +1 -1
  16. package/dist/esm/components/ui/card/index.d.ts +1 -1
  17. package/dist/esm/components/ui/carousel/index.d.ts +1 -1
  18. package/dist/esm/components/ui/carousel/index.js +4 -4
  19. package/dist/esm/components/ui/drag-scroll/index.d.ts +1 -1
  20. package/dist/esm/components/ui/drop-zone/index.d.ts +2 -2
  21. package/dist/esm/components/ui/drop-zone/index.js +4 -4
  22. package/dist/esm/components/ui/form/index.d.ts +1 -1
  23. package/dist/esm/components/ui/form/index.js +2 -2
  24. package/dist/esm/components/ui/index.d.ts +6 -6
  25. package/dist/esm/components/ui/index.js +6 -6
  26. package/dist/esm/{drop-zone-_YK9C3Xj.js → drop-zone-Beip1k4x.js} +2 -2
  27. package/dist/esm/drop-zone-Beip1k4x.js.map +1 -0
  28. package/dist/esm/{form-DytCfL6R.js → form-CUlTG3KI.js} +2 -2
  29. package/dist/esm/{form-DytCfL6R.js.map → form-CUlTG3KI.js.map} +1 -1
  30. package/dist/esm/{getSlot-BIcGgBwN.js → getSlot-D1_uG-Ym.js} +2 -2
  31. package/dist/esm/{getSlot-BIcGgBwN.js.map → getSlot-D1_uG-Ym.js.map} +1 -1
  32. package/dist/esm/{getSlotMap-DA_uhXqU.d.ts → getSlotMap-DZlQN8--.d.ts} +2 -3
  33. package/dist/esm/{index-DnaUCh8d.d.ts → index-B3N6YbN8.d.ts} +2 -3
  34. package/dist/esm/{index-BuSQsDCX.d.ts → index-BMcv7ELE.d.ts} +2 -5
  35. package/dist/esm/{index-BPeZJS-v.d.ts → index-BilTdK_M.d.ts} +9 -7
  36. package/dist/esm/{index-BSJ30pGj.d.ts → index-BsjcsNQh.d.ts} +4 -5
  37. package/dist/esm/{index-1UCPJf7B.d.ts → index-BwnMUHzm.d.ts} +2 -5
  38. package/dist/esm/{index-DmOz1yDZ.d.ts → index-CFNg1R-m.d.ts} +5 -6
  39. package/dist/esm/{index-C0XZoIZD.d.ts → index-CGI7EVlK.d.ts} +2 -5
  40. package/dist/esm/{index-DQ1yFGd2.d.ts → index-CIM4YPg5.d.ts} +4 -6
  41. package/dist/esm/{index-BhpBx8dH.d.ts → index-CNE9Cime.d.ts} +2 -4
  42. package/dist/esm/{index-BC0r1cBF.d.ts → index-DT8F8QKc.d.ts} +4 -7
  43. package/dist/esm/{index-DKfm0Dyj.d.ts → index-DeBZiR6B.d.ts} +4 -5
  44. package/dist/esm/{index--1COprHP.d.ts → index-UX3DaMVe.d.ts} +2 -5
  45. package/dist/esm/{index-C4ub0yqe.d.ts → index-YFi-sIuR.d.ts} +5 -9
  46. package/dist/esm/{index-CTZr4PTO.d.ts → index-gT9tVHv1.d.ts} +2 -3
  47. package/dist/esm/lib/utils/index.d.ts +2 -2
  48. package/dist/esm/lib/utils/index.js +1 -1
  49. package/dist/esm/{show-BgYrfIxJ.js → show-DNPzdLi-.js} +2 -2
  50. package/dist/esm/{show-BgYrfIxJ.js.map → show-DNPzdLi-.js.map} +1 -1
  51. package/dist/esm/{switch-PF5xTJfr.js → switch-B2gKl94R.js} +2 -2
  52. package/dist/esm/{switch-PF5xTJfr.js.map → switch-B2gKl94R.js.map} +1 -1
  53. package/dist/style.css +1 -1
  54. package/package.json +12 -11
  55. package/dist/esm/drop-zone-_YK9C3Xj.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { GetSlotComponentProps } from "./getSlotMap-DA_uhXqU.js";
3
- import { ErrorBoundaryProps } from "./index-BSJ30pGj.js";
4
- import { SuspenseWithBoundaryProps } from "./index-DmOz1yDZ.js";
2
+ import { GetSlotComponentProps } from "./getSlotMap-DZlQN8--.js";
3
+ import { ErrorBoundaryProps } from "./index-BsjcsNQh.js";
4
+ import { SuspenseWithBoundaryProps } from "./index-CFNg1R-m.js";
5
5
  import * as React from "react";
6
6
 
7
7
  //#region src/components/common/await/await.d.ts
@@ -30,9 +30,6 @@ declare const AwaitError: {
30
30
  readonly slotName?: "error" | undefined;
31
31
  readonly slotSymbol?: symbol;
32
32
  };
33
-
34
- //#endregion
35
- //#region src/components/common/await/await-parts.d.ts
36
33
  declare namespace await_parts_d_exports {
37
34
  export { AwaitError as Error, AwaitPending as Pending, AwaitRoot as Root, AwaitSuccess as Success };
38
35
  }
@@ -43,7 +40,6 @@ type AwaitContextType<TValue = unknown> = {
43
40
  result: TValue;
44
41
  };
45
42
  declare const useAwaitContext: <TValue>() => AwaitContextType<TValue>;
46
-
47
43
  //#endregion
48
- export { AwaitError as AwaitError$1, AwaitPending as AwaitPending$1, AwaitRoot as AwaitRoot$1, AwaitSuccess as AwaitSuccess$1, await_parts_d_exports, useAwaitContext as useAwaitContext$1 };
49
- //# sourceMappingURL=index-C4ub0yqe.d.ts.map
44
+ export { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_d_exports, useAwaitContext };
45
+ //# sourceMappingURL=index-YFi-sIuR.d.ts.map
@@ -18,7 +18,6 @@ type DragScrollResult<TElement extends HTMLElement, TItemElement extends HTMLEle
18
18
  getRootProps: (rootProps?: RootProps<TElement>) => RootProps<TElement>;
19
19
  };
20
20
  declare const useDragScroll: <TElement extends HTMLElement, TItemElement extends HTMLElement = HTMLElement>(props?: DragScrollProps<TElement, TItemElement>) => DragScrollResult<TElement, TItemElement>;
21
-
22
21
  //#endregion
23
- export { useDragScroll as useDragScroll$1 };
24
- //# sourceMappingURL=index-CTZr4PTO.d.ts.map
22
+ export { useDragScroll };
23
+ //# sourceMappingURL=index-gT9tVHv1.d.ts.map
@@ -1,3 +1,3 @@
1
- import { GetSlotComponentProps, GetSlotMapResult, createSlotComponent$1 as createSlotComponent, getSlotMap$1 as getSlotMap, slotComponentSymbol$1 as slotComponentSymbol, withSlotNameAndSymbol$1 as withSlotNameAndSymbol } from "../../getSlotMap-DA_uhXqU.js";
2
- import { FunctionalComponent, getMultipleSlots, getRegularChildren, getSingleSlot, matchesAnySlotComponent, matchesSlotComponent } from "../../index-DKfm0Dyj.js";
1
+ import { GetSlotComponentProps, GetSlotMapResult, createSlotComponent, getSlotMap, slotComponentSymbol, withSlotNameAndSymbol } from "../../getSlotMap-DZlQN8--.js";
2
+ import { FunctionalComponent, getMultipleSlots, getRegularChildren, getSingleSlot, matchesAnySlotComponent, matchesSlotComponent } from "../../index-DeBZiR6B.js";
3
3
  export { FunctionalComponent, GetSlotComponentProps, GetSlotMapResult, createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, slotComponentSymbol, withSlotNameAndSymbol };
@@ -1,4 +1,4 @@
1
1
  import { createSlotComponent, getSlotMap, slotComponentSymbol, withSlotNameAndSymbol } from "../../utils-D4YNWj2X.js";
2
- import { getMultipleSlots$1 as getMultipleSlots, getRegularChildren$1 as getRegularChildren, getSingleSlot$1 as getSingleSlot, matchesAnySlotComponent$1 as matchesAnySlotComponent, matchesSlotComponent$1 as matchesSlotComponent } from "../../getSlot-BIcGgBwN.js";
2
+ import { getMultipleSlots, getRegularChildren, getSingleSlot, matchesAnySlotComponent, matchesSlotComponent } from "../../getSlot-D1_uG-Ym.js";
3
3
 
4
4
  export { createSlotComponent, getMultipleSlots, getRegularChildren, getSingleSlot, getSlotMap, matchesAnySlotComponent, matchesSlotComponent, slotComponentSymbol, withSlotNameAndSymbol };
@@ -1,5 +1,5 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { getMultipleSlots$1 as getMultipleSlots } from "./getSlot-BIcGgBwN.js";
2
+ import { getMultipleSlots } from "./getSlot-D1_uG-Ym.js";
3
3
  import "react";
4
4
  import { assert, isFunction } from "@zayne-labs/toolkit-type-helpers";
5
5
 
@@ -38,4 +38,4 @@ __export(show_parts_exports, {
38
38
 
39
39
  //#endregion
40
40
  export { ShowContent, ShowFallback, ShowRoot, show_parts_exports };
41
- //# sourceMappingURL=show-BgYrfIxJ.js.map
41
+ //# sourceMappingURL=show-DNPzdLi-.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"show-BgYrfIxJ.js","names":["props: ShowProps<TWhen>"],"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getMultipleSlots } from \"@/lib/utils/getSlot\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\tfallback?: React.ReactNode;\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function ShowRoot<TWhen>(props: ShowProps<TWhen>) {\n\tconst { children, fallback = null, when } = props;\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\nexport function ShowContent({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowContent.slotSymbol = Symbol(\"show-content\");\n\nexport function ShowFallback({ children }: { children: React.ReactNode }) {\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":";;;;;;AAaA,SAAgB,SAAgBA,OAAyB;CACxD,MAAM,EAAE,UAAU,WAAW,MAAM,MAAM,GAAG;CAE5C,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;CAE1E,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,aAAa,EAClC,GAAG,iBAAiB,kBAAkB,CAAC,aAAa,YAAa,GAAE;EACnE,cAAc,CACb,gDACA,mEACA;EACD,0BAA0B;CAC1B,EAAC;AAEF,MAAK,MAAM;AACV,WACG,gBAAgB,WAClB,yEACA;AAED,SAAO,gBAAgB;CACvB;AAED,QAAO,eAAe;AACtB;AAED,SAAgB,YAAY,EAAE,UAAyC,EAAE;AACxE,QAAO;AACP;AACD,YAAY,aAAa,OAAO,eAAe;AAE/C,SAAgB,aAAa,EAAE,UAAyC,EAAE;AACzE,QAAO;AACP;AACD,aAAa,aAAa,OAAO,gBAAgB"}
1
+ {"version":3,"file":"show-DNPzdLi-.js","names":["props: ShowProps<TWhen>"],"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getMultipleSlots } from \"@/lib/utils/getSlot\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\ntype ShowProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\tfallback?: React.ReactNode;\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function ShowRoot<TWhen>(props: ShowProps<TWhen>) {\n\tconst { children, fallback = null, when } = props;\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\nexport function ShowContent({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nShowContent.slotSymbol = Symbol(\"show-content\");\n\nexport function ShowFallback({ children }: { children: React.ReactNode }) {\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":";;;;;;AAaA,SAAgB,SAAgBA,OAAyB;CACxD,MAAM,EAAE,UAAU,WAAW,MAAM,MAAM,GAAG;CAE5C,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;CAE1E,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,aAAa,EAClC,GAAG,iBAAiB,kBAAkB,CAAC,aAAa,YAAa,GAAE;EACnE,cAAc,CACb,gDACA,mEACA;EACD,0BAA0B;CAC1B,EAAC;AAEF,MAAK,MAAM;AACV,WACG,gBAAgB,WAClB,yEACA;AAED,SAAO,gBAAgB;CACvB;AAED,QAAO,eAAe;AACtB;AAED,SAAgB,YAAY,EAAE,UAAyC,EAAE;AACxE,QAAO;AACP;AACD,YAAY,aAAa,OAAO,eAAe;AAE/C,SAAgB,aAAa,EAAE,UAAyC,EAAE;AACzE,QAAO;AACP;AACD,aAAa,aAAa,OAAO,gBAAgB"}
@@ -1,5 +1,5 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { getRegularChildren$1 as getRegularChildren, getSingleSlot$1 as getSingleSlot } from "./getSlot-BIcGgBwN.js";
2
+ import { getRegularChildren, getSingleSlot } from "./getSlot-D1_uG-Ym.js";
3
3
  import "react";
4
4
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
5
5
 
@@ -39,4 +39,4 @@ __export(switch_parts_exports, {
39
39
 
40
40
  //#endregion
41
41
  export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports };
42
- //# sourceMappingURL=switch-PF5xTJfr.js.map
42
+ //# sourceMappingURL=switch-B2gKl94R.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch-PF5xTJfr.js","names":["props: SwitchProps","props: SwitchMatchProps<TWhen>"],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getRegularChildren, getSingleSlot } from \"@/lib/utils/getSlot\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\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":";;;;;;AAcA,MAAM,qBAAqB,OAAO,gBAAgB;AAElD,SAAgB,WAAWA,OAAoB;CAC9C,MAAM,EAAE,UAAU,QAAQ,oBAAoB,GAAG;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;CAC1B,EAAC;CAEF,MAAM,qBAAqB,mBAAmB,UAAU,cAAc;CAEtE,MAAM,cAAc,mBAAmB,KAAK,CAAC,UAAU;AAEtD,MAAI,UAAU,mBACb,QAAO,QAAQ,MAAM,MAAM,KAAK;AAIjC,SAAO,MAAM,MAAM,SAAS;CAC5B,EAAC;AAEF,QAAO,eAAe;AACtB;AAOD,SAAgB,YAAmBC,OAAgC;CAClE,MAAM,EAAE,UAAU,MAAM,GAAG;CAE3B,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;AAE1E,QAAO;AACP;AAED,SAAgB,cAAc,EAAE,UAAyC,EAAE;AAC1E,QAAO;AACP;AACD,cAAc,aAAa,OAAO,iBAAiB"}
1
+ {"version":3,"file":"switch-B2gKl94R.js","names":["props: SwitchProps","props: SwitchMatchProps<TWhen>"],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { getRegularChildren, getSingleSlot } from \"@/lib/utils/getSlot\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\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":";;;;;;AAcA,MAAM,qBAAqB,OAAO,gBAAgB;AAElD,SAAgB,WAAWA,OAAoB;CAC9C,MAAM,EAAE,UAAU,QAAQ,oBAAoB,GAAG;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;CAC1B,EAAC;CAEF,MAAM,qBAAqB,mBAAmB,UAAU,cAAc;CAEtE,MAAM,cAAc,mBAAmB,KAAK,CAAC,UAAU;AAEtD,MAAI,UAAU,mBACb,QAAO,QAAQ,MAAM,MAAM,KAAK;AAIjC,SAAO,MAAM,MAAM,SAAS;CAC5B,EAAC;AAEF,QAAO,eAAe;AACtB;AAOD,SAAgB,YAAmBC,OAAgC;CAClE,MAAM,EAAE,UAAU,MAAM,GAAG;CAE3B,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;AAE1E,QAAO;AACP;AAED,SAAgB,cAAc,EAAE,UAAyC,EAAE;AAC1E,QAAO;AACP;AACD,cAAc,aAAa,OAAO,iBAAiB"}
package/dist/style.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.7 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/ui-react",
3
3
  "type": "module",
4
- "version": "0.9.17",
4
+ "version": "0.9.19",
5
5
  "description": "A composable UI/UI-utilities components library. ",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -52,18 +52,18 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@zayne-labs/toolkit-core": "0.9.46",
56
- "@zayne-labs/toolkit-react": "0.9.46",
57
- "@zayne-labs/toolkit-type-helpers": "0.9.46"
55
+ "@zayne-labs/toolkit-core": "0.9.48",
56
+ "@zayne-labs/toolkit-react": "0.9.48",
57
+ "@zayne-labs/toolkit-type-helpers": "0.9.48"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@arethetypeswrong/cli": "0.18.1",
61
61
  "@size-limit/esbuild-why": "11.2.0",
62
62
  "@size-limit/preset-small-lib": "11.2.0",
63
- "@tailwindcss/cli": "^4.1.7",
63
+ "@tailwindcss/cli": "^4.1.8",
64
64
  "@total-typescript/ts-reset": "0.6.1",
65
- "@types/react": "19.1.5",
66
- "@types/react-dom": "19.1.5",
65
+ "@types/react": "19.1.6",
66
+ "@types/react-dom": "19.1.6",
67
67
  "@zayne-labs/tsconfig": "0.9.1",
68
68
  "concurrently": "9.1.2",
69
69
  "cross-env": "7.0.3",
@@ -71,11 +71,12 @@
71
71
  "publish": "^0.6.0",
72
72
  "react": "19.1.0",
73
73
  "react-dom": "19.1.0",
74
- "react-hook-form": "7.56.4",
74
+ "react-hook-form": "7.57.0",
75
75
  "size-limit": "11.2.0",
76
76
  "tailwind-merge": "3.3.0",
77
- "tailwindcss": "^4.1.7",
78
- "tsdown": "^0.12.3",
77
+ "tailwindcss": "^4.1.8",
78
+ "tsdown": "^0.12.7",
79
+ "tsup": "^8.5.0",
79
80
  "typescript": "5.8.3",
80
81
  "zustand": "5.0.5"
81
82
  },
@@ -96,7 +97,7 @@
96
97
  ],
97
98
  "scripts": {
98
99
  "build": "concurrently 'pnpm:build:tailwind' 'tsdown'",
99
- "build:dev": "cross-env NODE_ENV=development tsdown",
100
+ "build:dev": "cross-env NODE_ENV=development tsup",
100
101
  "build:tailwind": "tailwindcss -i css/style.css -o ./dist/style.css",
101
102
  "build:test": "concurrently --prefix-colors \"yellow.bold,#7da4f8.bold,magenta\" --names PUBLINT,TSUP 'pnpm:lint:publint' 'pnpm:build:dev'",
102
103
  "dev": "pnpm build:dev --watch",
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop-zone-_YK9C3Xj.js","names":["file: File | FileMeta","file: File","disallowPreviewForNonImageFiles: boolean","fileWithPreview: FileWithPreview | undefined","props?: UseDropZoneProps","value: boolean","addFiles: DropZoneActions[\"addFiles\"]","filesWithPreview: FileWithPreview[]","clearFiles: DropZoneActions[\"clearFiles\"]","removeFile: DropZoneActions[\"removeFile\"]","clearErrors: DropZoneActions[\"clearErrors\"]","handleFileUpload: DropZoneActions[\"handleFileUpload\"]","handleDragEnter: DropZoneActions[\"handleDragEnter\"]","handleDragOver: DropZoneActions[\"handleDragOver\"]","handleDragLeave: DropZoneActions[\"handleDragLeave\"]","openFilePicker: DropZoneActions[\"openFilePicker\"]","getContainerProps: UseDropZoneResult[\"getContainerProps\"]","getInputProps: UseDropZoneResult[\"getInputProps\"]","props: DropZoneRootProps","ReactFragment","props: DropZoneInputProps","Component","props: PolymorphicProps<TElement, DropZoneContainerProps>","props: { children: RenderPropFn }"],"sources":["../../src/components/ui/drop-zone/drop-context.ts","../../src/components/ui/drop-zone/utils.ts","../../src/components/ui/drop-zone/use-drop-zone.ts","../../src/components/ui/drop-zone/drop-zone.tsx","../../src/components/ui/drop-zone/drop-zone-parts.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport type { UseDropZoneResult } from \"./use-drop-zone\";\n\ntype DropZoneContext = UseDropZoneResult;\n\nexport const [DropZoneContextProvider, useDropZoneContext] = createCustomContext<DropZoneContext>({\n\thookName: \"useDropZoneContext\",\n\tname: \"DropZoneContext\",\n\tproviderName: \"DropZoneRoot\",\n});\n","import { type FileMeta, createImagePreview } from \"@zayne-labs/toolkit-core\";\nimport { isFile } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { FileWithPreview } from \"./use-drop-zone\";\n\nexport const generateUniqueId = (file: File | FileMeta): string => {\n\tif (!isFile(file)) {\n\t\treturn file.id;\n\t}\n\n\treturn `${file.name}-(${Math.round(performance.now())})-${crypto.randomUUID().slice(0, 8)}`;\n};\n\nexport const createObjectURL = (file: File, disallowPreviewForNonImageFiles: boolean) => {\n\tif (disallowPreviewForNonImageFiles && !file.type.startsWith(\"image/\")) return;\n\n\treturn createImagePreview(file);\n};\n\nexport const clearObjectURL = (\n\tfileWithPreview: FileWithPreview | undefined,\n\tdisallowPreviewForNonImageFiles: boolean\n) => {\n\tif (!isFile(fileWithPreview?.file)) return;\n\n\tif (disallowPreviewForNonImageFiles && !fileWithPreview.file.type.startsWith(\"image/\")) return;\n\n\tif (!fileWithPreview.preview) return;\n\n\tURL.revokeObjectURL(fileWithPreview.preview);\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { dataAttr } from \"@zayne-labs/toolkit-core\";\nimport {\n\ttype FileMeta,\n\ttype FileValidationErrorContext,\n\ttype FileValidationOptions,\n\thandleFileValidation,\n\ttoArray,\n} from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype InferProps,\n\tcomposeRefs,\n\tcomposeTwoEventHandlers,\n\tmergeTwoProps,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { type Prettify, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { clearObjectURL, createObjectURL, generateUniqueId } from \"./utils\";\n\nexport type ContainerProps = InferProps<HTMLElement> & {\n\tclassNames?: {\n\t\tbase?: string;\n\t\tisDragging?: string;\n\t};\n};\n\nexport type InputProps = InferProps<\"input\">;\n\nexport type FileWithPreview = {\n\t/**\n\t * File object or file metadata\n\t */\n\tfile: File | FileMeta;\n\t/**\n\t * Unique ID for the file\n\t */\n\tid: string;\n\t/**\n\t * Preview URL for the file\n\t * - Will be undefined if `disallowPreviewForNonImageFiles` is set to `true` and the file is not an image\n\t * - Can also be undefined if `URL.createObjectURL` fails\n\t */\n\tpreview: string | undefined;\n};\n\nexport type DropZoneState = {\n\t/**\n\t * List of validation errors\n\t */\n\terrors: FileValidationErrorContext[];\n\t/**\n\t * List of files with their preview URLs and unique IDs\n\t */\n\tfilesWithPreview: FileWithPreview[];\n\t/**\n\t * Whether or not a file is currently being dragged over the drop zone\n\t */\n\tisDragging: boolean;\n};\n\ntype ChangeOrDragEvent = React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>;\n\nexport type DropZoneActions = {\n\taddFiles: (fileList: File[] | FileList | null, event?: ChangeOrDragEvent) => void;\n\tclearErrors: () => void;\n\tclearFiles: () => void;\n\thandleDragEnter: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragLeave: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragOver: (event: React.DragEvent<HTMLElement>) => void;\n\thandleFileUpload: (event: ChangeOrDragEvent) => void;\n\topenFilePicker: () => void;\n\tremoveFile: (fileToRemoveOrId: string | FileWithPreview) => void;\n};\n\nexport type UseDropZoneResult = {\n\tdropZoneActions: DropZoneActions;\n\tdropZoneState: DropZoneState;\n\tgetContainerProps: (containerProps?: ContainerProps) => ContainerProps;\n\tgetInputProps: (inputProps?: InputProps) => InputProps;\n\tinputRef: React.RefObject<HTMLInputElement | null>;\n};\n\nexport type UseDropZoneProps = {\n\t/**\n\t * Allowed file types to be uploaded.\n\t */\n\tallowedFileTypes?: string[];\n\n\t/**\n\t * CSS classes to apply to the various parts of the drop zone\n\t */\n\tclassNames?: Prettify<ContainerProps[\"classNames\"] & { input?: string }>;\n\n\t/**\n\t * Whether to disallow duplicate files\n\t * @default true\n\t */\n\tdisallowDuplicates?: boolean;\n\n\t/**\n\t * Whether to disallow preview for non-image files\n\t * @default true\n\t */\n\tdisallowPreviewForNonImageFiles?: boolean;\n\n\t/**\n\t * Extra props to pass to the container element\n\t */\n\textraContainerProps?: ContainerProps;\n\n\t/**\n\t * Extra props to pass to the input element\n\t */\n\textraInputProps?: InputProps;\n\n\t/**\n\t * Initial files to populate the drop zone\n\t */\n\tinitialFiles?: FileMeta | FileMeta[] | null;\n\n\t/**\n\t * Maximum number of files that can be uploaded.\n\t */\n\tmaxFileCount?: number;\n\n\t/**\n\t * Maximum file size in MB\n\t */\n\tmaxFileSize?: number;\n\n\t/**\n\t * Whether to allow multiple files to be uploaded\n\t */\n\tmultiple?: boolean;\n\n\t/**\n\t * Callback function to be called when internal files state changes\n\t */\n\tonFilesChange?: (context: { filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called when the render props change\n\t */\n\tonRenderPropsChange?: (props: UseDropZoneResult) => void;\n\n\t/**\n\t * Callback function to be called when new files are uploaded\n\t */\n\tonUpload?: (context: { event: ChangeOrDragEvent; filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called on each file upload as they occur\n\t */\n\tonUploadError?: FileValidationOptions[\"onError\"];\n\n\t/**\n\t * Callback function to be called once after all file upload errors have occurred\n\t */\n\tonUploadErrors?: FileValidationOptions[\"onErrors\"];\n\n\t/**\n\t * Callback function to be called on file upload success\n\t */\n\tonUploadSuccess?: FileValidationOptions[\"onSuccess\"];\n\n\t/**\n\t * Custom validation function.\n\t *\n\t * If the function returns false, the file will be rejected\n\t */\n\tvalidator?: NonNullable<FileValidationOptions[\"validationSettings\"]>[\"validator\"];\n\n\t/**\n\t * Custom validation function that runs after all file validation has occurred\n\t */\n\tvalidatorForAllFiles?: FileValidationOptions[\"validatorForAllFiles\"];\n\n\t/**\n\t * Whether to allow the default file picker via the file input element\n\t * @default true\n\t */\n\twithDefaultFilePicker?: boolean;\n};\n\nexport const useDropZone = (props?: UseDropZoneProps): UseDropZoneResult => {\n\tconst {\n\t\tallowedFileTypes,\n\t\tclassNames,\n\t\tdisallowDuplicates = true,\n\t\tdisallowPreviewForNonImageFiles = true,\n\t\textraContainerProps,\n\t\textraInputProps,\n\t\tinitialFiles,\n\t\tmaxFileCount,\n\t\tmaxFileSize,\n\t\tmultiple,\n\t\tonFilesChange,\n\t\tonRenderPropsChange,\n\t\tonUpload,\n\t\tonUploadError,\n\t\tonUploadErrors,\n\t\tonUploadSuccess,\n\t\tvalidator,\n\t\tvalidatorForAllFiles,\n\t\twithDefaultFilePicker = true,\n\t} = props ?? {};\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst initialFileArray = toArray(initialFiles).filter(Boolean);\n\n\tconst [dropZoneState, setDropZoneState] = useState<DropZoneState>({\n\t\terrors: [],\n\t\tfilesWithPreview: initialFileArray.map((fileMeta) => ({\n\t\t\tfile: fileMeta,\n\t\t\tid: fileMeta.id,\n\t\t\tpreview: fileMeta.url,\n\t\t})),\n\t\tisDragging: false,\n\t});\n\n\tconst toggleIsDragging = (value: boolean) => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, isDragging: value }));\n\t};\n\n\tconst addFiles: DropZoneActions[\"addFiles\"] = useCallbackRef((fileList, event) => {\n\t\tif (!fileList || fileList.length === 0) {\n\t\t\tconsole.warn(\"No file selected!\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear existing errors when new files are uploaded\n\t\tclearErrors();\n\n\t\t// In single file mode, clear existing files first\n\t\tif (!multiple) {\n\t\t\tclearFiles();\n\t\t}\n\n\t\tconst { errors, validFiles } = handleFileValidation({\n\t\t\texistingFiles: dropZoneState.filesWithPreview.map((fileWithPreview) => fileWithPreview.file),\n\t\t\tnewFiles: fileList,\n\t\t\tonError: onUploadError,\n\t\t\tonErrors: onUploadErrors,\n\t\t\tonSuccess: onUploadSuccess,\n\t\t\tvalidationSettings: {\n\t\t\t\tallowedFileTypes,\n\t\t\t\tdisallowDuplicates,\n\t\t\t\tmaxFileCount,\n\t\t\t\tmaxFileSize,\n\t\t\t\tvalidator,\n\t\t\t},\n\t\t\tvalidatorForAllFiles,\n\t\t});\n\n\t\tif (validFiles.length === 0) {\n\t\t\tsetDropZoneState((prevState) => ({ ...prevState, errors }));\n\t\t\treturn;\n\t\t}\n\n\t\tconst filesWithPreview: FileWithPreview[] = validFiles.map((file) => ({\n\t\t\tfile,\n\t\t\tid: generateUniqueId(file),\n\t\t\tpreview: createObjectURL(file, disallowPreviewForNonImageFiles),\n\t\t}));\n\n\t\t// == Only call onUpload callback if event is provided, which indicates that new files were uploaded from an event handler\n\n\t\tif (event) {\n\t\t\tonUpload?.({ event, filesWithPreview });\n\t\t}\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors,\n\t\t\t...(event?.type === \"drop\" && { isDragging: false }),\n\t\t\tfilesWithPreview: multiple\n\t\t\t\t? [...dropZoneState.filesWithPreview, ...filesWithPreview]\n\t\t\t\t: filesWithPreview,\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after adding files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst clearFiles: DropZoneActions[\"clearFiles\"] = useCallbackRef(() => {\n\t\t// == Clean up object URLs if any\n\t\tdropZoneState.filesWithPreview.forEach((fileWithPreview) =>\n\t\t\tclearObjectURL(fileWithPreview, disallowPreviewForNonImageFiles)\n\t\t);\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: [],\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after clearing files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst removeFile: DropZoneActions[\"removeFile\"] = useCallbackRef((fileToRemoveOrId) => {\n\t\tconst actualFileToRemove = isString(fileToRemoveOrId)\n\t\t\t? dropZoneState.filesWithPreview.find((file) => file.id === fileToRemoveOrId)\n\t\t\t: fileToRemoveOrId;\n\n\t\tif (!actualFileToRemove) return;\n\n\t\tclearObjectURL(actualFileToRemove, disallowPreviewForNonImageFiles);\n\n\t\tconst newFilesWithPreview = dropZoneState.filesWithPreview.filter(\n\t\t\t(file) => file.id !== actualFileToRemove.id\n\t\t);\n\n\t\tonFilesChange?.({ filesWithPreview: newFilesWithPreview });\n\n\t\tsetDropZoneState({\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: newFilesWithPreview,\n\t\t});\n\t});\n\n\tconst clearErrors: DropZoneActions[\"clearErrors\"] = useCallbackRef(() => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, errors: [] }));\n\t});\n\n\tconst handleFileUpload: DropZoneActions[\"handleFileUpload\"] = useCallbackRef((event) => {\n\t\tif (inputRef.current?.disabled) return;\n\n\t\tif (event.type === \"drop\") {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tconst fileList =\n\t\t\tevent.type === \"drop\"\n\t\t\t\t? (event as React.DragEvent).dataTransfer.files\n\t\t\t\t: (event as React.ChangeEvent<HTMLInputElement>).target.files;\n\n\t\t// == In single file mode, only use the first file\n\t\tif (!multiple) {\n\t\t\tconst firstFile = fileList?.[0];\n\n\t\t\tfirstFile && addFiles([firstFile], event);\n\n\t\t\treturn;\n\t\t}\n\n\t\taddFiles(fileList, event);\n\t});\n\n\tconst handleDragEnter: DropZoneActions[\"handleDragEnter\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragOver: DropZoneActions[\"handleDragOver\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragLeave: DropZoneActions[\"handleDragLeave\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(false);\n\t});\n\n\tconst openFilePicker: DropZoneActions[\"openFilePicker\"] = useCallbackRef(() => {\n\t\tinputRef.current?.click();\n\t});\n\n\tconst getContainerProps: UseDropZoneResult[\"getContainerProps\"] = useCallback(\n\t\t(containerProps) => {\n\t\t\tconst mergedContainerProps = mergeTwoProps(extraContainerProps, containerProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedContainerProps,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\"relative isolate flex flex-col\",\n\t\t\t\t\tmergedContainerProps.className,\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tdropZoneState.isDragging && [\n\t\t\t\t\t\t\"opacity-60\",\n\t\t\t\t\t\tclassNames?.isDragging,\n\t\t\t\t\t\tcontainerProps?.classNames?.isDragging,\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"container\",\n\t\t\t\t\"data-slot\": \"dropzone-container\",\n\t\t\t\tonDragEnter: composeTwoEventHandlers(handleDragEnter, mergedContainerProps.onDragEnter),\n\t\t\t\tonDragLeave: composeTwoEventHandlers(handleDragLeave, mergedContainerProps.onDragLeave),\n\t\t\t\tonDragOver: composeTwoEventHandlers(handleDragOver, mergedContainerProps.onDragOver),\n\t\t\t\tonDrop: composeTwoEventHandlers(handleFileUpload, mergedContainerProps.onDrop),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclassNames?.base,\n\t\t\tclassNames?.isDragging,\n\t\t\textraContainerProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleDragEnter,\n\t\t\thandleDragLeave,\n\t\t\thandleDragOver,\n\t\t\thandleFileUpload,\n\t\t]\n\t);\n\n\tconst getInputProps: UseDropZoneResult[\"getInputProps\"] = useCallback(\n\t\t(inputProps) => {\n\t\t\tconst mergedInputProps = mergeTwoProps(extraInputProps, inputProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedInputProps,\n\t\t\t\taccept: allowedFileTypes ? allowedFileTypes.join(\", \") : mergedInputProps.accept,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\twithDefaultFilePicker ? \"absolute inset-0 z-[100] cursor-pointer opacity-0\" : \"hidden\",\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\tmergedInputProps.className\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"input\",\n\t\t\t\t\"data-slot\": \"dropzone-input\",\n\t\t\t\tmultiple: multiple ?? mergedInputProps.multiple,\n\t\t\t\tonChange: composeTwoEventHandlers(handleFileUpload, mergedInputProps.onChange),\n\t\t\t\tref: composeRefs(inputRef, mergedInputProps.ref),\n\t\t\t\ttype: \"file\",\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tallowedFileTypes,\n\t\t\tclassNames?.input,\n\t\t\textraInputProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleFileUpload,\n\t\t\tmultiple,\n\t\t\twithDefaultFilePicker,\n\t\t]\n\t);\n\n\tconst savedOnRenderPropsChange = useCallbackRef(onRenderPropsChange);\n\n\tconst dropZoneResult = useMemo(() => {\n\t\tconst propsForRenderFn = {\n\t\t\tdropZoneActions: {\n\t\t\t\taddFiles,\n\t\t\t\tclearErrors,\n\t\t\t\tclearFiles,\n\t\t\t\thandleDragEnter,\n\t\t\t\thandleDragLeave,\n\t\t\t\thandleDragOver,\n\t\t\t\thandleFileUpload,\n\t\t\t\topenFilePicker,\n\t\t\t\tremoveFile,\n\t\t\t},\n\t\t\tdropZoneState,\n\t\t\tgetContainerProps,\n\t\t\tgetInputProps,\n\t\t\tinputRef,\n\t\t} satisfies UseDropZoneResult;\n\n\t\tsavedOnRenderPropsChange(propsForRenderFn);\n\n\t\treturn propsForRenderFn;\n\t}, [\n\t\tsavedOnRenderPropsChange,\n\t\taddFiles,\n\t\tclearErrors,\n\t\tclearFiles,\n\t\tdropZoneState,\n\t\tgetInputProps,\n\t\tgetContainerProps,\n\t\thandleDragEnter,\n\t\thandleDragLeave,\n\t\thandleDragOver,\n\t\thandleFileUpload,\n\t\topenFilePicker,\n\t\tremoveFile,\n\t]);\n\n\treturn dropZoneResult;\n};\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Show, Slot } from \"@/components/common\";\nimport { type GetSlotComponentProps, getSlotMap, withSlotNameAndSymbol } from \"@/lib/utils/getSlotMap\";\nimport type { DiscriminatedRenderProps, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, isValidElement } from \"react\";\nimport { DropZoneContextProvider, useDropZoneContext } from \"./drop-context\";\nimport {\n\ttype ContainerProps,\n\ttype InputProps,\n\ttype UseDropZoneProps,\n\ttype UseDropZoneResult,\n\tuseDropZone,\n} from \"./use-drop-zone\";\n\nexport type DropZoneRenderPropType = DiscriminatedRenderProps<\n\tReact.ReactNode | ((props: UseDropZoneResult) => React.ReactNode)\n>;\n\nexport type DropZoneRootProps = DropZoneRenderPropType\n\t& UseDropZoneProps & {\n\t\t/**\n\t\t * Controls whether to include internal elements (root and input) or not.\n\t\t */\n\t\twithInternalElements?: boolean;\n\t};\n\nexport function DropZoneRoot(props: DropZoneRootProps) {\n\tconst { children, render, withInternalElements = true, ...restOfProps } = props;\n\n\tconst dropZone = useDropZone(restOfProps);\n\n\tconst ContainerComponent = withInternalElements ? DropZoneContainer : ReactFragment;\n\tconst InputComponent = withInternalElements ? DropZoneInput : ReactFragment;\n\n\tconst selectedChildren = children ?? render;\n\n\tconst resolvedChildren = isFunction(selectedChildren) ? selectedChildren(dropZone) : selectedChildren;\n\n\tconst couldChildrenContainSlots =\n\t\tisArray(resolvedChildren)\n\t\t|| (isValidElement(resolvedChildren) && resolvedChildren.type === ReactFragment);\n\n\tconst slots =\n\t\twithInternalElements && couldChildrenContainSlots\n\t\t\t? getSlotMap<SlotComponentProps>(resolvedChildren)\n\t\t\t: ({ default: resolvedChildren } as ReturnType<typeof getSlotMap<SlotComponentProps>>);\n\n\treturn (\n\t\t<DropZoneContextProvider value={dropZone}>\n\t\t\t<ContainerComponent>\n\t\t\t\t<InputComponent />\n\n\t\t\t\t{slots.default}\n\t\t\t</ContainerComponent>\n\n\t\t\t{slots.preview}\n\t\t</DropZoneContextProvider>\n\t);\n}\n\ntype DropZoneInputProps = InputProps & { asChild?: boolean };\n\nexport function DropZoneInput(props: DropZoneInputProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : \"input\";\n\n\treturn <Component {...dropZoneContext.getInputProps(restOfProps)} />;\n}\n\ntype DropZoneContainerProps = ContainerProps & { asChild?: boolean };\n\nexport function DropZoneContainer<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement, DropZoneContainerProps>\n) {\n\tconst { as: Element = \"div\", asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...dropZoneContext.getContainerProps(restOfProps)} />;\n}\n\ntype RenderPropFn = (props: UseDropZoneResult) => React.ReactNode;\n\ntype SlotComponentProps = GetSlotComponentProps<\"preview\", React.ReactNode | RenderPropFn>;\n\nexport function DropZoneContext(props: { children: RenderPropFn }) {\n\tconst { children } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\treturn children(dropZoneContext);\n}\n\nexport const DropZoneImagePreview = withSlotNameAndSymbol<SlotComponentProps>(\"preview\", (props) => {\n\tconst { children } = props;\n\n\tif (isFunction(children)) {\n\t\treturn (\n\t\t\t<DropZoneContext>\n\t\t\t\t{(dropZoneCtx) => (\n\t\t\t\t\t<Show.Root when={dropZoneCtx.dropZoneState.filesWithPreview.length > 0}>\n\t\t\t\t\t\t{children(dropZoneCtx)}\n\t\t\t\t\t</Show.Root>\n\t\t\t\t)}\n\t\t\t</DropZoneContext>\n\t\t);\n\t}\n\n\treturn children;\n});\n","export {\n\tDropZoneRoot as Root,\n\tDropZoneImagePreview as ImagePreview,\n\tDropZoneContext as Context,\n\tDropZoneInput as Input,\n\tDropZoneContainer as Container,\n} from \"./drop-zone\";\n"],"mappings":";;;;;;;;;;;;;AAKA,MAAa,CAAC,yBAAyB,mBAAmB,GAAG,oBAAqC;CACjG,UAAU;CACV,MAAM;CACN,cAAc;AACd,EAAC;;;;ACLF,MAAa,mBAAmB,CAACA,SAAkC;AAClE,MAAK,OAAO,KAAK,CAChB,QAAO,KAAK;AAGb,SAAQ,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,YAAY,KAAK,CAAC,CAAC,IAAI,OAAO,YAAY,CAAC,MAAM,GAAG,EAAE,CAAC;AAC1F;AAED,MAAa,kBAAkB,CAACC,MAAYC,oCAA6C;AACxF,KAAI,oCAAoC,KAAK,KAAK,WAAW,SAAS,CAAE;AAExE,QAAO,mBAAmB,KAAK;AAC/B;AAED,MAAa,iBAAiB,CAC7BC,iBACAD,oCACI;AACJ,MAAK,OAAO,iBAAiB,KAAK,CAAE;AAEpC,KAAI,oCAAoC,gBAAgB,KAAK,KAAK,WAAW,SAAS,CAAE;AAExF,MAAK,gBAAgB,QAAS;AAE9B,KAAI,gBAAgB,gBAAgB,QAAQ;AAC5C;;;;AC4JD,MAAa,cAAc,CAACE,UAAgD;CAC3E,MAAM,EACL,kBACA,YACA,qBAAqB,MACrB,kCAAkC,MAClC,qBACA,iBACA,cACA,cACA,aACA,UACA,eACA,qBACA,UACA,eACA,gBACA,iBACA,WACA,sBACA,wBAAwB,MACxB,GAAG,SAAS,CAAE;CAEf,MAAM,WAAW,OAAyB,KAAK;CAE/C,MAAM,mBAAmB,QAAQ,aAAa,CAAC,OAAO,QAAQ;CAE9D,MAAM,CAAC,eAAe,iBAAiB,GAAG,SAAwB;EACjE,QAAQ,CAAE;EACV,kBAAkB,iBAAiB,IAAI,CAAC,cAAc;GACrD,MAAM;GACN,IA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