@zayne-labs/ui-react 0.10.53 → 0.11.1

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 (43) hide show
  1. package/css/animation.css +13 -0
  2. package/dist/esm/{cn-Bbh2G587.js → cn-CIbU5eI0.js} +1 -1
  3. package/dist/esm/{cn-Bbh2G587.js.map → cn-CIbU5eI0.js.map} +1 -1
  4. package/dist/esm/common/await/index.d.ts +2 -2
  5. package/dist/esm/common/await/index.js +3 -3
  6. package/dist/esm/common/error-boundary/index.d.ts +1 -1
  7. package/dist/esm/common/error-boundary/index.js +1 -1
  8. package/dist/esm/common/for/index.d.ts +1 -1
  9. package/dist/esm/common/presence/index.d.ts +7 -7
  10. package/dist/esm/common/presence/index.js +1 -1
  11. package/dist/esm/common/show/index.js +1 -1
  12. package/dist/esm/common/slot/index.js +1 -1
  13. package/dist/esm/common/suspense-with-boundary/index.d.ts +1 -1
  14. package/dist/esm/common/suspense-with-boundary/index.js +1 -1
  15. package/dist/esm/common/switch/index.js +1 -34
  16. package/dist/esm/common/teleport/index.js +2 -6
  17. package/dist/esm/common/teleport/index.js.map +1 -1
  18. package/dist/esm/{error-boundary-C4btQhu_.js → error-boundary-C9o5EzC9.js} +2 -2
  19. package/dist/esm/{error-boundary-C4btQhu_.js.map → error-boundary-C9o5EzC9.js.map} +1 -1
  20. package/dist/esm/{index-ClV6w6nv.d.ts → index-CaUmIQiv.d.ts} +2 -2
  21. package/dist/esm/{index-BUIvQ2wP.d.ts → index-DpVwG1sA.d.ts} +2 -2
  22. package/dist/esm/presence-DgJvW30C.js +225 -0
  23. package/dist/esm/presence-DgJvW30C.js.map +1 -0
  24. package/dist/esm/{show-BzfAw7y3.js → show-mvRnLPj8.js} +1 -1
  25. package/dist/esm/{show-BzfAw7y3.js.map → show-mvRnLPj8.js.map} +1 -1
  26. package/dist/esm/{slot-DuwoiC2C.js → slot-CHR5Li4r.js} +1 -1
  27. package/dist/esm/{slot-DuwoiC2C.js.map → slot-CHR5Li4r.js.map} +1 -1
  28. package/dist/esm/switch-Dwy5Gzsb.js +35 -0
  29. package/dist/esm/switch-Dwy5Gzsb.js.map +1 -0
  30. package/dist/esm/ui/card/index.js +2 -2
  31. package/dist/esm/ui/carousel/index.js +3 -3
  32. package/dist/esm/ui/drag-scroll/index.d.ts +97 -63
  33. package/dist/esm/ui/drag-scroll/index.js +99 -15
  34. package/dist/esm/ui/drag-scroll/index.js.map +1 -1
  35. package/dist/esm/ui/drop-zone/index.d.ts +19 -2
  36. package/dist/esm/ui/drop-zone/index.js +65 -55
  37. package/dist/esm/ui/drop-zone/index.js.map +1 -1
  38. package/dist/esm/ui/form/index.js +3 -3
  39. package/dist/style.css +16 -0
  40. package/package.json +8 -8
  41. package/dist/esm/common/switch/index.js.map +0 -1
  42. package/dist/esm/presence-CWOGx-be.js +0 -209
  43. package/dist/esm/presence-CWOGx-be.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"slot-DuwoiC2C.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, mergeProps, type InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement> & { ref?: React.Ref<HTMLElement> };\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotRoot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (!slottable) {\n\t\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n\t}\n\n\tif (!isValidElement<SlotProps>(slottable)) {\n\t\treturn null;\n\t}\n\n\t// == The new element to render is the one passed as a child of `Slot.Slottable`\n\tconst childToRender = slottable.props.children;\n\n\tif (Children.count(childToRender) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChildToRender = isArray(childToRender) ? childToRender[0] : childToRender;\n\n\tif (!isValidElement(resolvedChildToRender)) {\n\t\t// eslint-disable-next-line react-x/purity -- Ignore\n\t\tconsole.error(\"Invalid element passed to Slottable:\", resolvedChildToRender);\n\t\treturn null;\n\t}\n\n\tconst childToRenderChildren = 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 (`childToRender.props.children`)\n\t\t\treturn (resolvedChildToRender.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t{cloneElement(resolvedChildToRender, undefined, childToRenderChildren)}\n\t\t</SlotClone>\n\t);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotSlottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === SlotSlottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * ----------------------------------------------------------------------------------------------- */\ntype SlotCloneProps = Pick<SlotProps, \"children\" | \"ref\">;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (Children.count(children) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChild = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\t// eslint-disable-next-line react-x/purity -- Ignore\n\t\tconsole.error(\"Invalid element passed to Slot:\", resolvedChild);\n\t\treturn null;\n\t}\n\n\tconst childRef = resolvedChild.props.ref as React.Ref<HTMLElement>;\n\n\tconst ref = composeRefs(forwardedRef, childRef);\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t...(resolvedChild.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;AAUA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,UAAU,GAAG,oBAAoB;CAEzC,MAAM,gBAAgB,QAAyB,SAAS,GAAG,WAAW,CAAC,SAAS;CAEhF,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY,QAAQ,CAAC;AAEvE,KAAI,CAAC,UACJ,QAAO,oBAAC,WAAD;EAAW,GAAI;EAAkB;EAAqB,CAAA;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,gBAAgB,UAAU,MAAM;AAEtC,KAAI,SAAS,MAAM,cAAc,GAAG,EACnC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,wBAAwB,QAAQ,cAAc,GAAG,cAAc,KAAK;AAE1E,KAAI,CAAC,eAAe,sBAAsB,EAAE;AAE3C,UAAQ,MAAM,wCAAwC,sBAAsB;AAC5E,SAAO;;CAGR,MAAM,wBAAwB,cAAc,KAAK,UAAU;AAC1D,MAAI,UAAU,UAEb,QAAQ,sBAAsB,MAAoB;AAGnD,SAAO;GACN;AAEF,QACC,oBAAC,WAAD;EAAW,GAAI;YACb,aAAa,uBAAuB,KAAA,GAAW,sBAAsB;EAC3D,CAAA;;AAQd,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAQhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,cAAc,GAAG,oBAAoB;AAE5D,KAAI,SAAS,MAAM,SAAS,GAAG,EAC9B,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,gBAAgB,QAAQ,SAAS,GAAG,SAAS,KAAK;AAExD,KAAI,CAAC,eAA8B,cAAc,EAAE;AAElD,UAAQ,MAAM,mCAAmC,cAAc;AAC/D,SAAO;;CAGR,MAAM,WAAW,cAAc,MAAM;CAErC,MAAM,MAAM,YAAY,cAAc,SAAS;AAO/C,QAAO,aAAa,eALA;EACnB,GAAG,WAAW,iBAAiB,cAAc,MAAM;EACnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD,CAE8C"}
1
+ {"version":3,"file":"slot-CHR5Li4r.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, mergeProps, type InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement> & { ref?: React.Ref<HTMLElement> };\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotRoot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (!slottable) {\n\t\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n\t}\n\n\tif (!isValidElement<SlotProps>(slottable)) {\n\t\treturn null;\n\t}\n\n\t// == The new element to render is the one passed as a child of `Slot.Slottable`\n\tconst childToRender = slottable.props.children;\n\n\tif (Children.count(childToRender) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChildToRender = isArray(childToRender) ? childToRender[0] : childToRender;\n\n\tif (!isValidElement(resolvedChildToRender)) {\n\t\t// eslint-disable-next-line react-x/purity -- Ignore\n\t\tconsole.error(\"Invalid element passed to Slottable:\", resolvedChildToRender);\n\t\treturn null;\n\t}\n\n\tconst childToRenderChildren = 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 (`childToRender.props.children`)\n\t\t\treturn (resolvedChildToRender.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t{cloneElement(resolvedChildToRender, undefined, childToRenderChildren)}\n\t\t</SlotClone>\n\t);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotSlottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === SlotSlottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * ----------------------------------------------------------------------------------------------- */\ntype SlotCloneProps = Pick<SlotProps, \"children\" | \"ref\">;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (Children.count(children) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChild = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\t// eslint-disable-next-line react-x/purity -- Ignore\n\t\tconsole.error(\"Invalid element passed to Slot:\", resolvedChild);\n\t\treturn null;\n\t}\n\n\tconst childRef = resolvedChild.props.ref as React.Ref<HTMLElement>;\n\n\tconst ref = composeRefs(forwardedRef, childRef);\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t...(resolvedChild.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;AAUA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,UAAU,GAAG,oBAAoB;CAEzC,MAAM,gBAAgB,QAAyB,SAAS,GAAG,WAAW,CAAC,SAAS;CAEhF,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY,QAAQ,CAAC;AAEvE,KAAI,CAAC,UACJ,QAAO,oBAAC,WAAD;EAAW,GAAI;EAAkB;EAAqB,CAAA;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,gBAAgB,UAAU,MAAM;AAEtC,KAAI,SAAS,MAAM,cAAc,GAAG,EACnC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,wBAAwB,QAAQ,cAAc,GAAG,cAAc,KAAK;AAE1E,KAAI,CAAC,eAAe,sBAAsB,EAAE;AAE3C,UAAQ,MAAM,wCAAwC,sBAAsB;AAC5E,SAAO;;CAGR,MAAM,wBAAwB,cAAc,KAAK,UAAU;AAC1D,MAAI,UAAU,UAEb,QAAQ,sBAAsB,MAAoB;AAGnD,SAAO;GACN;AAEF,QACC,oBAAC,WAAD;EAAW,GAAI;YACb,aAAa,uBAAuB,KAAA,GAAW,sBAAsB;EAC3D,CAAA;;AAQd,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAQhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,cAAc,GAAG,oBAAoB;AAE5D,KAAI,SAAS,MAAM,SAAS,GAAG,EAC9B,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,gBAAgB,QAAQ,SAAS,GAAG,SAAS,KAAK;AAExD,KAAI,CAAC,eAA8B,cAAc,EAAE;AAElD,UAAQ,MAAM,mCAAmC,cAAc;AAC/D,SAAO;;CAGR,MAAM,WAAW,cAAc,MAAM;CAErC,MAAM,MAAM,YAAY,cAAc,SAAS;AAO/C,QAAO,aAAa,eALA;EACnB,GAAG,WAAW,iBAAiB,cAAc,MAAM;EACnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD,CAE8C"}
@@ -0,0 +1,35 @@
1
+ import { t as __exportAll } from "./chunk-pbuEa-1d.js";
2
+ import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
3
+ import { isFunction } from "@zayne-labs/toolkit-type-helpers";
4
+ //#region src/components/common/switch/switch.tsx
5
+ const defaultValueSymbol = Symbol("default-value");
6
+ function SwitchRoot(props) {
7
+ const { children, value = defaultValueSymbol } = props;
8
+ const defaultCase = getSingleSlot(children, SwitchDefault, {
9
+ errorMessage: "Only one <Switch.Default> component is allowed",
10
+ throwOnMultipleSlotMatch: true
11
+ });
12
+ return getRegularChildren(children, SwitchDefault).find((child) => {
13
+ if (value === defaultValueSymbol) return Boolean(child.props.when);
14
+ return child.props.when === value;
15
+ }) ?? defaultCase;
16
+ }
17
+ function SwitchMatch(props) {
18
+ const { children, when } = props;
19
+ return isFunction(children) ? children(when) : children;
20
+ }
21
+ function SwitchDefault({ children }) {
22
+ return children;
23
+ }
24
+ SwitchDefault.slotSymbol = Symbol("switch-default");
25
+ //#endregion
26
+ //#region src/components/common/switch/switch-parts.ts
27
+ var switch_parts_exports = /* @__PURE__ */ __exportAll({
28
+ Default: () => SwitchDefault,
29
+ Match: () => SwitchMatch,
30
+ Root: () => SwitchRoot
31
+ });
32
+ //#endregion
33
+ export { SwitchRoot as i, SwitchDefault as n, SwitchMatch as r, switch_parts_exports as t };
34
+
35
+ //# sourceMappingURL=switch-Dwy5Gzsb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-Dwy5Gzsb.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\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;\n\nexport type SwitchRootProps<TValue> = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tvalue?: TValue;\n};\n\nconst defaultValueSymbol = Symbol(\"default-value\");\n\n// TODO - Add a factory to make this 'when' and 'value' type-safe later following the link below\n// LINK - https://tkdodo.eu/blog/building-type-safe-compound-components#component-factory-pattern\nexport function SwitchRoot<TValue>(props: SwitchRootProps<TValue>) {\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\nexport type 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":";;;;AAYA,MAAM,qBAAqB,OAAO,gBAAgB;AAIlD,SAAgB,WAAmB,OAAgC;CAClE,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"}
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "../../chunk-pbuEa-1d.js";
2
- import { n as SlotRoot } from "../../slot-DuwoiC2C.js";
3
- import { t as cnMerge } from "../../cn-Bbh2G587.js";
2
+ import { n as SlotRoot } from "../../slot-CHR5Li4r.js";
3
+ import { t as cnMerge } from "../../cn-CIbU5eI0.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/ui/card/card.tsx
6
6
  function CardRoot(props) {
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { t as __exportAll } from "../../chunk-pbuEa-1d.js";
3
+ import { t as cnMerge } from "../../cn-CIbU5eI0.js";
3
4
  import { n as For } from "../../for-DGTMIS0w.js";
4
- import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-BzfAw7y3.js";
5
- import { t as cnMerge } from "../../cn-Bbh2G587.js";
5
+ import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-mvRnLPj8.js";
6
6
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
7
7
  import { useMemo, useState } from "react";
8
- import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
9
8
  import { jsx, jsxs } from "react/jsx-runtime";
10
9
  import { createStore } from "@zayne-labs/toolkit-core";
10
+ import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
11
11
  import { createReactStoreContext } from "@zayne-labs/toolkit-react/zustand";
12
12
  //#region src/components/ui/carousel/carousel-store-context.ts
13
13
  const [CarouselStoreContextProvider, useCarouselStoreContext] = createReactStoreContext({
@@ -1,114 +1,124 @@
1
- import { InferProps } from "@zayne-labs/toolkit-react/utils";
1
+ import { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
2
  import * as _zayne_labs_toolkit_type_helpers0 from "@zayne-labs/toolkit-type-helpers";
3
+ import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
3
4
  import * as react from "react";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
  import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
5
-
6
7
  //#region src/components/ui/drag-scroll/drag-scroll-context.d.ts
7
8
  declare const DragScrollStoreContextProvider: (props: {
8
9
  children: React.ReactNode;
9
10
  store: {
10
- getInitialState: () => DragScrollStore<HTMLElement>;
11
- getListeners: () => Set<(state: DragScrollStore<HTMLElement>, prevState: DragScrollStore<HTMLElement>) => void>;
12
- getState: () => DragScrollStore<HTMLElement>;
11
+ getInitialState: () => DragScrollStore;
12
+ getListeners: () => Set<(state: DragScrollStore, prevState: DragScrollStore) => void>;
13
+ getState: () => DragScrollStore;
13
14
  resetState: () => void;
14
15
  setState: {
15
- (stateUpdate: Partial<DragScrollStore<HTMLElement>> | ((prevState: DragScrollStore<HTMLElement>) => Partial<DragScrollStore<HTMLElement>>), options?: ({
16
- onNotifySync?: ((previousState: DragScrollStore<HTMLElement>) => void) | undefined;
17
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<HTMLElement>) => void) | undefined;
16
+ (stateUpdate: Partial<DragScrollStore> | ((prevState: DragScrollStore) => Partial<DragScrollStore>), options?: ({
17
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
18
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
18
19
  shouldNotifySync?: boolean | undefined;
19
20
  } & {
20
21
  shouldReplace?: false;
21
22
  }) | undefined): void;
22
- (stateUpdate: DragScrollStore<HTMLElement> | ((prevState: DragScrollStore<HTMLElement>) => DragScrollStore<HTMLElement>), options?: ({
23
- onNotifySync?: ((previousState: DragScrollStore<HTMLElement>) => void) | undefined;
24
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<HTMLElement>) => void) | undefined;
23
+ (stateUpdate: DragScrollStore | ((prevState: DragScrollStore) => DragScrollStore), options?: ({
24
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
25
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
25
26
  shouldNotifySync?: boolean | undefined;
26
27
  } & {
27
28
  shouldReplace: true;
28
29
  }) | undefined): void;
29
30
  };
30
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore<HTMLElement>>;
31
+ subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
31
32
  };
32
33
  }) => react.FunctionComponentElement<react.ProviderProps<{
33
- getInitialState: () => DragScrollStore<HTMLElement>;
34
- getListeners: () => Set<(state: DragScrollStore<HTMLElement>, prevState: DragScrollStore<HTMLElement>) => void>;
35
- getState: () => DragScrollStore<HTMLElement>;
34
+ getInitialState: () => DragScrollStore;
35
+ getListeners: () => Set<(state: DragScrollStore, prevState: DragScrollStore) => void>;
36
+ getState: () => DragScrollStore;
36
37
  resetState: () => void;
37
38
  setState: {
38
- (stateUpdate: Partial<DragScrollStore<HTMLElement>> | ((prevState: DragScrollStore<HTMLElement>) => Partial<DragScrollStore<HTMLElement>>), options?: ({
39
- onNotifySync?: ((previousState: DragScrollStore<HTMLElement>) => void) | undefined;
40
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<HTMLElement>) => void) | undefined;
39
+ (stateUpdate: Partial<DragScrollStore> | ((prevState: DragScrollStore) => Partial<DragScrollStore>), options?: ({
40
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
41
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
41
42
  shouldNotifySync?: boolean | undefined;
42
43
  } & {
43
44
  shouldReplace?: false;
44
45
  }) | undefined): void;
45
- (stateUpdate: DragScrollStore<HTMLElement> | ((prevState: DragScrollStore<HTMLElement>) => DragScrollStore<HTMLElement>), options?: ({
46
- onNotifySync?: ((previousState: DragScrollStore<HTMLElement>) => void) | undefined;
47
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<HTMLElement>) => void) | undefined;
46
+ (stateUpdate: DragScrollStore | ((prevState: DragScrollStore) => DragScrollStore), options?: ({
47
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
48
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
48
49
  shouldNotifySync?: boolean | undefined;
49
50
  } & {
50
51
  shouldReplace: true;
51
52
  }) | undefined): void;
52
53
  };
53
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore<HTMLElement>>;
54
- }>>, useDragScrollStoreContext: <TResult = DragScrollStore<HTMLElement>>(selector?: _zayne_labs_toolkit_type_helpers0.SelectorFn<DragScrollStore<HTMLElement>, TResult> | undefined) => TResult;
54
+ subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
55
+ }>>, useDragScrollStoreContext: <TResult = DragScrollStore>(selector?: _zayne_labs_toolkit_type_helpers0.SelectorFn<DragScrollStore, TResult> | undefined) => TResult;
55
56
  //#endregion
56
57
  //#region src/components/ui/drag-scroll/drag-scroll-store.d.ts
57
58
  type RequiredUseDragScrollProps = { [Key in keyof Required<UseDragScrollProps>]: UseDragScrollProps[Key] | undefined };
58
59
  type InitStoreValues = Pick<RequiredUseDragScrollProps, "orientation" | "scrollAmount" | "usage">;
59
- declare const createDragScrollStore: <TElement extends HTMLElement = HTMLElement>(initStoreValues: InitStoreValues) => {
60
- getInitialState: () => DragScrollStore<TElement>;
61
- getListeners: () => Set<(state: DragScrollStore<TElement>, prevState: DragScrollStore<TElement>) => void>;
62
- getState: () => DragScrollStore<TElement>;
60
+ declare const createDragScrollStore: (initStoreValues: InitStoreValues) => {
61
+ getInitialState: () => DragScrollStore;
62
+ getListeners: () => Set<(state: DragScrollStore, prevState: DragScrollStore) => void>;
63
+ getState: () => DragScrollStore;
63
64
  resetState: () => void;
64
65
  setState: {
65
- (stateUpdate: Partial<DragScrollStore<TElement>> | ((prevState: DragScrollStore<TElement>) => Partial<DragScrollStore<TElement>>), options?: ({
66
- onNotifySync?: ((previousState: DragScrollStore<TElement>) => void) | undefined;
67
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<TElement>) => void) | undefined;
66
+ (stateUpdate: Partial<DragScrollStore> | ((prevState: DragScrollStore) => Partial<DragScrollStore>), options?: ({
67
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
68
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
68
69
  shouldNotifySync?: boolean | undefined;
69
70
  } & {
70
71
  shouldReplace?: false;
71
72
  }) | undefined): void;
72
- (stateUpdate: DragScrollStore<TElement> | ((prevState: DragScrollStore<TElement>) => DragScrollStore<TElement>), options?: ({
73
- onNotifySync?: ((previousState: DragScrollStore<TElement>) => void) | undefined;
74
- onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore<TElement>) => void) | undefined;
73
+ (stateUpdate: DragScrollStore | ((prevState: DragScrollStore) => DragScrollStore), options?: ({
74
+ onNotifySync?: ((previousState: DragScrollStore) => void) | undefined;
75
+ onNotifyViaBatch?: ((previousStateSnapshot: DragScrollStore) => void) | undefined;
75
76
  shouldNotifySync?: boolean | undefined;
76
77
  } & {
77
78
  shouldReplace: true;
78
79
  }) | undefined): void;
79
80
  };
80
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore<TElement>>;
81
+ subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
81
82
  };
82
83
  //#endregion
83
84
  //#region src/components/ui/drag-scroll/types.d.ts
84
85
  type RecordForDataAttr = Record<`data-${string}`, unknown>;
85
- interface PartProps<TElement extends HTMLElement> {
86
- backButton: {
87
- input: PartProps<TElement>["backButton"]["output"];
88
- output: InferProps<"button"> & RecordForDataAttr;
86
+ type SharedInputProps = {
87
+ /**
88
+ * Set to `true` to disable the default styling
89
+ */
90
+ unstyled?: boolean;
91
+ };
92
+ type PartProps<TContainerElement extends HTMLElement = HTMLElement> = {
93
+ container: {
94
+ input: PartProps<TContainerElement>["container"]["output"] & SharedInputProps;
95
+ output: RecordForDataAttr & InferProps<TContainerElement>;
89
96
  };
90
97
  item: {
91
- input: PartProps<TElement>["item"]["output"];
98
+ input: PartProps<TContainerElement>["item"]["output"] & SharedInputProps;
92
99
  output: InferProps<HTMLElement> & RecordForDataAttr;
93
100
  };
94
101
  nextButton: {
95
- input: PartProps<TElement>["nextButton"]["output"];
96
- output: InferProps<"button"> & RecordForDataAttr;
102
+ input: PartProps<TContainerElement>["nextButton"]["output"] & SharedInputProps;
103
+ output: RecordForDataAttr & InferProps<"button">;
104
+ };
105
+ prevButton: {
106
+ input: PartProps<TContainerElement>["prevButton"]["output"] & SharedInputProps;
107
+ output: RecordForDataAttr & InferProps<"button">;
97
108
  };
98
109
  root: {
99
- input: PartProps<TElement>["root"]["output"];
100
- output: InferProps<TElement> & RecordForDataAttr & {
101
- ref?: React.Ref<TElement>;
102
- };
110
+ input: PartProps<TContainerElement>["root"]["output"] & SharedInputProps;
111
+ output: RecordForDataAttr & InferProps<"div">;
103
112
  };
104
- }
105
- type DragScrollPropGetters<TElement extends HTMLElement> = { [Key in keyof PartProps<TElement> as `get${Capitalize<Key>}Props`]: (props?: PartProps<TElement>[Key]["input"]) => PartProps<TElement>[Key]["output"] };
113
+ };
114
+ type DragScrollPropGetters<TContainerElement extends HTMLElement = HTMLElement> = { [Key in keyof PartProps<TContainerElement> as `get${Capitalize<Key>}Props`]: (props?: PartProps<TContainerElement>[Key]["input"]) => PartProps<TContainerElement>[Key]["output"] };
115
+ type PartInputProps<TContainerElement extends HTMLElement = HTMLElement> = { [Key in keyof PartProps<TContainerElement>]: PartProps<TContainerElement>[Key]["input"] };
106
116
  type DragScrollState = {
107
117
  /** Whether the container can scroll forward (right/down) */canGoToNext: boolean; /** Whether the container can scroll backward (left/up) */
108
118
  canGoToPrev: boolean; /** Whether the user is currently dragging */
109
119
  isDragging: boolean;
110
120
  };
111
- type DragScrollActions<TElement extends HTMLElement> = {
121
+ type DragScrollActions = {
112
122
  actions: {
113
123
  cleanupDragListeners: () => void;
114
124
  goToNext: () => void;
@@ -118,19 +128,12 @@ type DragScrollActions<TElement extends HTMLElement> = {
118
128
  handleMouseUpOrLeave: () => void;
119
129
  handleScroll: () => void;
120
130
  initializeResizeObserver: () => (() => void) | undefined;
121
- setContainerRef: (element: TElement | null) => void;
131
+ setContainerRef: (element: HTMLElement | null) => void;
122
132
  updateScrollState: () => void;
123
133
  };
124
134
  };
125
- type DragScrollStore<TElement extends HTMLElement> = DragScrollActions<TElement> & DragScrollState;
135
+ type DragScrollStore = DragScrollActions & DragScrollState;
126
136
  type UseDragScrollProps = {
127
- /**
128
- * Custom class names for the root container and items
129
- */
130
- classNames?: {
131
- base?: string;
132
- item?: string;
133
- };
134
137
  /**
135
138
  * Whether to disable the internal state subscription for setting things like data attributes
136
139
  * - This is useful if you want to subscribe to the state yourself
@@ -161,15 +164,46 @@ type UseDragScrollProps = {
161
164
  */
162
165
  usage?: "allScreens" | "desktopOnly" | "mobileAndTabletOnly";
163
166
  };
164
- type UseDragScrollResult<TElement extends HTMLElement> = Pick<UseDragScrollProps, "disableInternalStateSubscription"> & {
165
- containerRef: React.RefObject<TElement | null>;
166
- propGetters: DragScrollPropGetters<TElement>;
167
- storeApi: ReturnType<typeof createDragScrollStore<TElement>>;
167
+ type UseDragScrollResult<TContainerElement extends HTMLElement> = Pick<UseDragScrollProps, "disableInternalStateSubscription"> & {
168
+ containerRef: React.RefObject<TContainerElement | null>;
169
+ propGetters: DragScrollPropGetters<TContainerElement>;
170
+ storeApi: ReturnType<typeof createDragScrollStore>;
168
171
  useDragScrollStore: typeof useDragScrollStoreContext;
169
172
  };
170
173
  //#endregion
171
174
  //#region src/components/ui/drag-scroll/use-drag-scroll.d.ts
172
- declare const useDragScroll: <TElement extends HTMLElement>(props?: UseDragScrollProps) => UseDragScrollResult<TElement>;
175
+ declare const useDragScroll: <TContainerElement extends HTMLElement = HTMLElement>(props?: UseDragScrollProps) => UseDragScrollResult<TContainerElement>;
176
+ //#endregion
177
+ //#region src/components/ui/drag-scroll/drag-scroll.d.ts
178
+ type DragScrollRootProps = UseDragScrollProps & {
179
+ asChild?: boolean;
180
+ children: React.ReactNode;
181
+ } & PartInputProps["root"];
182
+ declare function DragScrollRoot<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DragScrollRootProps>): react_jsx_runtime0.JSX.Element;
183
+ type DragScrollContextProps<TSlice> = {
184
+ children: React.ReactNode | ((context: TSlice) => React.ReactNode);
185
+ selector?: SelectorFn<DragScrollStore, TSlice>;
186
+ };
187
+ declare function DragScrollContext<TSlice = DragScrollStore>(props: DragScrollContextProps<TSlice>): react.ReactNode;
188
+ type DragScrollContainerProps = {
189
+ asChild?: boolean;
190
+ } & PartInputProps["container"];
191
+ declare function DragScrollContainer<TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DragScrollContainerProps>): react_jsx_runtime0.JSX.Element;
192
+ type DragScrollItemProps = {
193
+ asChild?: boolean;
194
+ } & PartInputProps["item"];
195
+ declare function DragScrollItem<TElement extends React.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DragScrollItemProps>): react_jsx_runtime0.JSX.Element;
196
+ type DragScrollPrevProps = {
197
+ asChild?: boolean;
198
+ } & PartInputProps["prevButton"];
199
+ declare function DragScrollPrev(props: DragScrollPrevProps): react_jsx_runtime0.JSX.Element;
200
+ type DragScrollNextProps = {
201
+ asChild?: boolean;
202
+ } & PartInputProps["nextButton"];
203
+ declare function DragScrollNext(props: DragScrollNextProps): react_jsx_runtime0.JSX.Element;
204
+ declare namespace drag_scroll_parts_d_exports {
205
+ export { DragScrollContainer as Container, DragScrollContext as Context, DragScrollItem as Item, DragScrollNext as Next, DragScrollPrev as Prev, DragScrollRoot as Root };
206
+ }
173
207
  //#endregion
174
- export { type DragScrollStore, type UseDragScrollProps, type UseDragScrollResult, useDragScroll };
208
+ export { drag_scroll_parts_d_exports as DragScroll, DragScrollContainer, DragScrollContainerProps, DragScrollContext, DragScrollContextProps, DragScrollItem, DragScrollItemProps, DragScrollNext, DragScrollNextProps, DragScrollPrev, DragScrollPrevProps, DragScrollRoot, DragScrollRootProps, type DragScrollStore, type UseDragScrollProps, type UseDragScrollResult, useDragScroll, useDragScrollStoreContext };
175
209
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,14 @@
1
- import { t as cnMerge } from "../../cn-Bbh2G587.js";
1
+ "use client";
2
+ import { t as __exportAll } from "../../chunk-pbuEa-1d.js";
3
+ import { n as SlotRoot } from "../../slot-CHR5Li4r.js";
4
+ import { t as cnMerge } from "../../cn-CIbU5eI0.js";
2
5
  import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
3
- import { isNumber } from "@zayne-labs/toolkit-type-helpers";
6
+ import { isFunction, isNumber } from "@zayne-labs/toolkit-type-helpers";
4
7
  import { useCallback, useEffect, useMemo, useRef } from "react";
5
- import { useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
8
+ import { jsx } from "react/jsx-runtime";
6
9
  import { checkIsDeviceMobile, createStore, dataAttr, on, throttleByFrame } from "@zayne-labs/toolkit-core";
10
+ import { createCustomContext, useCallbackRef, useCompareSelector, useStore } from "@zayne-labs/toolkit-react";
11
+ import { createReactStoreContext } from "@zayne-labs/toolkit-react/zustand";
7
12
  //#region src/components/ui/drag-scroll/utils.ts
8
13
  const updateCursor = (element) => {
9
14
  element.style.cursor = "grabbing";
@@ -174,7 +179,7 @@ const getScopeAttrs = (part) => ({
174
179
  "data-slot": `drag-scroll-${part}`
175
180
  });
176
181
  const useDragScroll = (props) => {
177
- const { classNames, disableInternalStateSubscription = false, orientation = "horizontal", scrollAmount = "item", usage = "allScreens" } = props ?? {};
182
+ const { disableInternalStateSubscription = false, orientation = "horizontal", scrollAmount = "item", usage = "allScreens" } = props ?? {};
178
183
  const containerRef = useRef(null);
179
184
  const storeApi = useMemo(() => {
180
185
  return createDragScrollStore({
@@ -208,33 +213,39 @@ const useDragScroll = (props) => {
208
213
  useEffect(() => {
209
214
  return actions.initializeResizeObserver();
210
215
  }, [actions]);
211
- const getRootProps = useCallback((innerProps) => {
216
+ const getRootProps = useCallbackRef((innerProps) => {
212
217
  return {
213
218
  ...getScopeAttrs("root"),
219
+ ...innerProps,
220
+ className: cnMerge("relative", innerProps?.className)
221
+ };
222
+ });
223
+ const getContainerProps = useCallback((innerProps) => {
224
+ return {
225
+ ...getScopeAttrs("container"),
214
226
  ...!disableInternalStateSubscription && { "data-dragging": dataAttr(isDragging) },
215
227
  ...innerProps,
216
- className: cnMerge(`scrollbar-hidden flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-hidden`, orientation === "horizontal" && "flex-row", orientation === "vertical" && "flex-col", usage === "mobileAndTabletOnly" && "md:cursor-default md:flex-col", usage === "desktopOnly" && "max-md:cursor-default max-md:flex-col", classNames?.base, innerProps?.className),
228
+ className: cnMerge(`scrollbar-hidden flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-hidden`, orientation === "horizontal" && "flex-row", orientation === "vertical" && "flex-col", usage === "mobileAndTabletOnly" && "md:cursor-default md:flex-col", usage === "desktopOnly" && "max-md:cursor-default max-md:flex-col", innerProps?.className),
217
229
  ref: composeRefs(refCallback, innerProps?.ref)
218
230
  };
219
231
  }, [
220
- classNames?.base,
221
232
  disableInternalStateSubscription,
222
233
  isDragging,
223
234
  orientation,
224
235
  refCallback,
225
236
  usage
226
237
  ]);
227
- const getItemProps = useCallback((innerProps) => {
238
+ const getItemProps = useCallbackRef((innerProps) => {
228
239
  return {
229
240
  ...getScopeAttrs("item"),
230
241
  ...innerProps,
231
- className: cnMerge("snap-center snap-always", classNames?.item, innerProps?.className)
242
+ className: cnMerge("snap-center snap-always", innerProps?.className)
232
243
  };
233
- }, [classNames?.item]);
234
- const getBackButtonProps = useCallback((innerProps) => {
244
+ });
245
+ const getPrevButtonProps = useCallback((innerProps) => {
235
246
  const isDisabled = innerProps?.disabled ?? !canGoToPrev;
236
247
  return {
237
- ...getScopeAttrs("back-button"),
248
+ ...getScopeAttrs("prev-button"),
238
249
  type: "button",
239
250
  ...innerProps,
240
251
  "aria-disabled": dataAttr(isDisabled),
@@ -258,12 +269,14 @@ const useDragScroll = (props) => {
258
269
  };
259
270
  }, [actions.goToNext, canGoToNext]);
260
271
  const propGetters = useMemo(() => ({
261
- getBackButtonProps,
272
+ getContainerProps,
262
273
  getItemProps,
263
274
  getNextButtonProps,
275
+ getPrevButtonProps,
264
276
  getRootProps
265
277
  }), [
266
- getBackButtonProps,
278
+ getPrevButtonProps,
279
+ getContainerProps,
267
280
  getItemProps,
268
281
  getNextButtonProps,
269
282
  getRootProps
@@ -283,6 +296,77 @@ const useDragScroll = (props) => {
283
296
  ]);
284
297
  };
285
298
  //#endregion
286
- export { useDragScroll };
299
+ //#region src/components/ui/drag-scroll/drag-scroll-context.ts
300
+ const [DragScrollStoreContextProvider, useDragScrollStoreContext] = createReactStoreContext({
301
+ hookName: "useDragScrollStoreContext",
302
+ name: "DragScrollStoreContext",
303
+ providerName: "DragScrollRoot"
304
+ });
305
+ const [DragScrollRootContextProvider, useDragScrollRootContext] = createCustomContext({
306
+ hookName: "useDragScrollRootContext",
307
+ name: "DragScrollRootContext",
308
+ providerName: "DragScrollRoot"
309
+ });
310
+ //#endregion
311
+ //#region src/components/ui/drag-scroll/drag-scroll.tsx
312
+ function DragScrollRoot(props) {
313
+ const { as: Element = "div", asChild, children, ...restOfProps } = props;
314
+ const { containerRef, disableInternalStateSubscription, propGetters, storeApi } = useDragScroll(restOfProps);
315
+ return /* @__PURE__ */ jsx(DragScrollStoreContextProvider, {
316
+ store: storeApi,
317
+ children: /* @__PURE__ */ jsx(DragScrollRootContextProvider, {
318
+ value: useMemo(() => ({
319
+ containerRef,
320
+ disableInternalStateSubscription,
321
+ propGetters
322
+ }), [
323
+ containerRef,
324
+ disableInternalStateSubscription,
325
+ propGetters
326
+ ]),
327
+ children: /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, {
328
+ ...propGetters.getRootProps(restOfProps),
329
+ children
330
+ })
331
+ })
332
+ });
333
+ }
334
+ function DragScrollContext(props) {
335
+ const { children, selector } = props;
336
+ const dragScrollCtx = useDragScrollStoreContext(useCompareSelector(selector));
337
+ return isFunction(children) ? children(dragScrollCtx) : children;
338
+ }
339
+ function DragScrollContainer(props) {
340
+ const { as: Element = "ul", asChild, ...restOfProps } = props;
341
+ const { propGetters } = useDragScrollRootContext();
342
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, { ...propGetters.getContainerProps(restOfProps) });
343
+ }
344
+ function DragScrollItem(props) {
345
+ const { as: Element = "li", asChild, ...restOfProps } = props;
346
+ const { propGetters } = useDragScrollRootContext();
347
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, { ...propGetters.getItemProps(restOfProps) });
348
+ }
349
+ function DragScrollPrev(props) {
350
+ const { asChild, ...restOfProps } = props;
351
+ const { propGetters } = useDragScrollRootContext();
352
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : "button", { ...propGetters.getPrevButtonProps(restOfProps) });
353
+ }
354
+ function DragScrollNext(props) {
355
+ const { asChild, ...restOfProps } = props;
356
+ const { propGetters } = useDragScrollRootContext();
357
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : "button", { ...propGetters.getNextButtonProps(restOfProps) });
358
+ }
359
+ //#endregion
360
+ //#region src/components/ui/drag-scroll/drag-scroll-parts.ts
361
+ var drag_scroll_parts_exports = /* @__PURE__ */ __exportAll({
362
+ Container: () => DragScrollContainer,
363
+ Context: () => DragScrollContext,
364
+ Item: () => DragScrollItem,
365
+ Next: () => DragScrollNext,
366
+ Prev: () => DragScrollPrev,
367
+ Root: () => DragScrollRoot
368
+ });
369
+ //#endregion
370
+ export { drag_scroll_parts_exports as DragScroll, DragScrollContainer, DragScrollContext, DragScrollItem, DragScrollNext, DragScrollPrev, DragScrollRoot, useDragScroll, useDragScrollStoreContext };
287
371
 
288
372
  //# sourceMappingURL=index.js.map