@zayne-labs/ui-react 0.1.5 → 0.2.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 (54) 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-E3UC4AGS.js +119 -0
  4. package/dist/esm/chunk-E3UC4AGS.js.map +1 -0
  5. package/dist/esm/chunk-HKPJTORQ.js +3 -0
  6. package/dist/esm/chunk-HKPJTORQ.js.map +1 -0
  7. package/dist/esm/chunk-JKLRBPJZ.js +40 -0
  8. package/dist/esm/chunk-JKLRBPJZ.js.map +1 -0
  9. package/dist/esm/chunk-NCS3WKFW.js +50 -0
  10. package/dist/esm/chunk-NCS3WKFW.js.map +1 -0
  11. package/dist/esm/chunk-PKN52DWQ.js +363 -0
  12. package/dist/esm/chunk-PKN52DWQ.js.map +1 -0
  13. package/dist/esm/chunk-PNYEIX7F.js +3 -0
  14. package/dist/esm/chunk-PNYEIX7F.js.map +1 -0
  15. package/dist/esm/chunk-PW4AIAWC.js +125 -0
  16. package/dist/esm/chunk-PW4AIAWC.js.map +1 -0
  17. package/dist/esm/chunk-PXYYL2LL.js +45 -0
  18. package/dist/esm/chunk-PXYYL2LL.js.map +1 -0
  19. package/dist/esm/{chunk-MPOYLILK.js → chunk-RJQIINNX.js} +11 -7
  20. package/dist/esm/chunk-RJQIINNX.js.map +1 -0
  21. package/dist/esm/chunk-VMJ2L3VC.js +274 -0
  22. package/dist/esm/chunk-VMJ2L3VC.js.map +1 -0
  23. package/dist/esm/common/for/index.d.ts +20 -5
  24. package/dist/esm/common/for/index.js +1 -1
  25. package/dist/esm/common/index.d.ts +8 -0
  26. package/dist/esm/common/index.js +9 -0
  27. package/dist/esm/common/index.js.map +1 -0
  28. package/dist/esm/common/show/index.d.ts +10 -6
  29. package/dist/esm/common/show/index.js +2 -41
  30. package/dist/esm/common/show/index.js.map +1 -1
  31. package/dist/esm/common/switch/index.d.ts +10 -6
  32. package/dist/esm/common/switch/index.js +2 -31
  33. package/dist/esm/common/switch/index.js.map +1 -1
  34. package/dist/esm/common/teleport/index.js +1 -28
  35. package/dist/esm/common/teleport/index.js.map +1 -1
  36. package/dist/esm/index.d.ts +16 -2
  37. package/dist/esm/index.js +14 -1
  38. package/dist/esm/ui/card/index.js +4 -43
  39. package/dist/esm/ui/card/index.js.map +1 -1
  40. package/dist/esm/ui/carousel/index.d.ts +5 -3
  41. package/dist/esm/ui/carousel/index.js +4 -272
  42. package/dist/esm/ui/carousel/index.js.map +1 -1
  43. package/dist/esm/ui/drag-scroll/index.js +2 -117
  44. package/dist/esm/ui/drag-scroll/index.js.map +1 -1
  45. package/dist/esm/ui/drop-zone/index.js +2 -123
  46. package/dist/esm/ui/drop-zone/index.js.map +1 -1
  47. package/dist/esm/ui/form/index.js +4 -361
  48. package/dist/esm/ui/form/index.js.map +1 -1
  49. package/dist/esm/ui/index.d.ts +11 -0
  50. package/dist/esm/ui/index.js +12 -0
  51. package/dist/esm/ui/index.js.map +1 -0
  52. package/package.json +6 -14
  53. package/dist/esm/chunk-MPOYLILK.js.map +0 -1
  54. package/dist/esm/for-C3T5FbXd.d.ts +0 -15
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/icons/EyeIcon.tsx","../../src/components/ui/form/form-context.ts","../../src/components/ui/form/form.tsx","../../src/components/ui/form/form-parts.ts"],"names":["React","HookFormProvider","ReactFragment","ControllerPrimitive"],"mappings":";;;;;;;;;;AAEO,IAAM,gBAAmB,GAAA,CAAC,KAChC,qBAAAA,MAAA,CAAA,aAAA,CAAC,SAAI,KAAM,EAAA,4BAAA,EAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,OAAQ,EAAA,WAAA,EAAa,GAAG,KACxF,EAAA,kBAAAA,MAAA,CAAA,aAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACA,IAAK,EAAA,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AAA;AAAA,CAAA,CAAA","file":"chunk-PKN52DWQ.js","sourcesContent":["import * as React from \"react\";\n\nexport const EyeIconInvisible = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M15.175 8.325q.725.725 1.063 1.65t.237 1.9q0 .375-.275.638t-.65.262t-.638-.262t-.262-.638q.125-.65-.075-1.25T13.95 9.6t-1.025-.65t-1.275-.1q-.375 0-.638-.275t-.262-.65t.263-.637t.637-.263q.95-.1 1.875.238t1.65 1.062M12 6q-.475 0-.925.037t-.9.138q-.425.075-.763-.125t-.462-.6t.088-.775t.612-.45q.575-.125 1.163-.175T12 4q3.425 0 6.263 1.8t4.337 4.85q.1.2.15.413t.05.437t-.038.438t-.137.412q-.45 1-1.112 1.875t-1.463 1.6q-.3.275-.7.225t-.65-.4t-.212-.763t.337-.687q.6-.575 1.1-1.25t.875-1.45q-1.25-2.525-3.613-4.012T12 6m0 13q-3.35 0-6.125-1.812T1.5 12.425q-.125-.2-.187-.437T1.25 11.5t.05-.475t.175-.45q.5-1 1.163-1.912T4.15 7L2.075 4.9q-.275-.3-.262-.712T2.1 3.5t.7-.275t.7.275l17 17q.275.275.288.688t-.288.712q-.275.275-.7.275t-.7-.275l-3.5-3.45q-.875.275-1.775.413T12 19M5.55 8.4q-.725.65-1.325 1.425T3.2 11.5q1.25 2.525 3.613 4.013T12 17q.5 0 .975-.062t.975-.138l-.9-.95q-.275.075-.525.113T12 16q-1.875 0-3.188-1.312T7.5 11.5q0-.275.038-.525t.112-.525zm4.2 4.2\"\n\t\t/>\n\t</svg>\n);\n\nexport const EyeIconVisible = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<path\n\t\t\tfill=\"currentColor\"\n\t\t\td=\"M12 16q1.875 0 3.188-1.312T16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16m0-1.8q-1.125 0-1.912-.788T9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2m0 4.8q-3.35 0-6.113-1.8t-4.362-4.75q-.125-.225-.187-.462t-.063-.488t.063-.488t.187-.462q1.6-2.95 4.363-4.75T12 4t6.113 1.8t4.362 4.75q.125.225.188.463t.062.487t-.062.488t-.188.462q-1.6 2.95-4.362 4.75T12 19m0-2q2.825 0 5.188-1.487T20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17\"\n\t\t/>\n\t</svg>\n);\n","import { ContextError, createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport { useFormContext } from \"react-hook-form\";\n\nexport const useFormFieldContext = () => {\n\tconst formContext = useFormContext() as ReturnType<typeof useFormContext> | null;\n\n\tif (!formContext) {\n\t\tthrow new ContextError(\n\t\t\t`useFormFieldContext returned \"null\". Did you forget to wrap the necessary components within FormRoot?`\n\t\t);\n\t}\n\n\treturn formContext;\n};\n\nexport type ContextValue = {\n\tname: string;\n\tuniqueId: string;\n};\n\nexport const [StrictFormItemProvider, useStrictFormItemContext] = createCustomContext<ContextValue>({\n\thookName: \"useFormItemContext\",\n\tproviderName: \"FormItem\",\n});\n\nexport const [LaxFormItemProvider, useLaxFormItemContext] = createCustomContext<ContextValue, false>({\n\thookName: \"useLaxFormItemContext\",\n\tproviderName: \"FormItem\",\n\tstrict: false,\n});\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { getElementList } from \"@/components/common/for\";\nimport { EyeIconInvisible, EyeIconVisible } from \"@/components/icons\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { useToggle } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype DiscriminatedRenderProps,\n\ttype InferProps,\n\ttype PolymorphicProps,\n\tgetOtherChildren,\n\tgetSlotElement,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { Fragment as ReactFragment, useEffect, useId, useMemo, useRef } from \"react\";\nimport {\n\ttype Control,\n\ttype ControllerFieldState,\n\tController as ControllerPrimitive,\n\ttype ControllerProps,\n\ttype ControllerRenderProps,\n\ttype FieldPath,\n\ttype FormState,\n\tFormProvider as HookFormProvider,\n\ttype RegisterOptions,\n\ttype UseFormReturn,\n\ttype UseFormStateReturn,\n\tuseFormState,\n} from \"react-hook-form\";\nimport {\n\ttype ContextValue,\n\tLaxFormItemProvider,\n\tStrictFormItemProvider,\n\tuseFormFieldContext,\n\tuseLaxFormItemContext,\n\tuseStrictFormItemContext,\n} from \"./form-context\";\n\ntype FieldValues = Record<string, unknown>;\n\ntype FormRootProps<TValues extends FieldValues> = React.ComponentPropsWithoutRef<\"form\"> & {\n\tchildren: React.ReactNode;\n\tmethods: UseFormReturn<TValues>;\n};\n\nexport function FormRoot<TValues extends FieldValues>(props: FormRootProps<TValues>) {\n\tconst { children, className, methods, ...restOfProps } = props;\n\n\treturn (\n\t\t<HookFormProvider {...methods}>\n\t\t\t<form\n\t\t\t\tclassName={cnMerge(\"flex flex-col\", className)}\n\t\t\t\t{...restOfProps}\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"root\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</form>\n\t\t</HookFormProvider>\n\t);\n}\n\ntype FormItemProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues>\n\t? {\n\t\t\tcontrol?: never;\n\t\t\tname: keyof TValues;\n\t\t}\n\t: {\n\t\t\tcontrol?: Control<TFieldValues>;\n\t\t\tname: keyof TFieldValues;\n\t\t}) & {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\twithWrapper?: boolean;\n};\n\nexport function FormItem<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormItemProps<TControl, TFieldValues>\n) {\n\tconst { children, className, name, withWrapper = true } = props;\n\n\tconst uniqueId = useId();\n\n\tconst value = useMemo(\n\t\t() => ({ name: String(name), uniqueId: `${String(name)}-(${uniqueId})` }),\n\t\t[name, uniqueId]\n\t);\n\n\tconst WrapperElement = withWrapper ? \"div\" : ReactFragment;\n\n\tconst wrapperElementProps = withWrapper && {\n\t\tclassName: cnMerge(\"flex flex-col\", className),\n\t\t\"data-part\": \"item\",\n\t\t\"data-scope\": \"form\",\n\t};\n\n\treturn (\n\t\t<StrictFormItemProvider value={value}>\n\t\t\t<LaxFormItemProvider value={value}>\n\t\t\t\t<WrapperElement {...wrapperElementProps}>{children}</WrapperElement>\n\t\t\t</LaxFormItemProvider>\n\t\t</StrictFormItemProvider>\n\t);\n}\n\ntype FormItemContextProps = DiscriminatedRenderProps<(contextValue: ContextValue) => React.ReactNode>;\n\nexport function FormItemContext(props: FormItemContextProps) {\n\tconst { children, render } = props;\n\tconst contextValues = useStrictFormItemContext();\n\n\tif (typeof children === \"function\") {\n\t\treturn children(contextValues);\n\t}\n\n\treturn render(contextValues);\n}\n\nexport function FormLabel(props: InferProps<\"label\">) {\n\tconst { uniqueId } = useStrictFormItemContext();\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<label data-scope=\"form\" data-part=\"label\" htmlFor={uniqueId} className={className} {...restOfProps}>\n\t\t\t{children}\n\t\t</label>\n\t);\n}\n\nexport function FormInputGroup(props: React.ComponentPropsWithRef<\"div\">) {\n\tconst { children, className, ...restOfProps } = props;\n\tconst LeftItemSlot = getSlotElement(children, FormInputLeftItem);\n\tconst RightItemSlot = getSlotElement(children, FormInputRightItem);\n\n\tconst otherChildren = getOtherChildren(children, [FormInputLeftItem, FormInputRightItem]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"input-group\"\n\t\t\tclassName={cnMerge(\"flex items-center justify-between gap-2\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{LeftItemSlot}\n\t\t\t{otherChildren}\n\t\t\t{RightItemSlot}\n\t\t</div>\n\t);\n}\n\ntype FormSideItemProps = {\n\tchildren?: React.ReactNode;\n\tclassName?: string;\n};\n\nexport function FormInputLeftItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"left-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputLeftItem.slot = Symbol.for(\"leftItem\");\n\nexport function FormInputRightItem<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicProps<TElement, FormSideItemProps>\n) {\n\tconst { as: Element = \"span\", children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"right-item\"\n\t\t\tclassName={cnMerge(\"inline-flex items-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\n\t);\n}\nFormInputRightItem.slot = Symbol.for(\"rightItem\");\n\ntype FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = Omit<\n\tReact.ComponentPropsWithRef<\"input\">,\n\t\"children\"\n> & {\n\tclassNames?: { error?: string; eyeIcon?: string; input?: string; inputGroup?: string };\n\tname?: keyof TFieldValues;\n\twithEyeIcon?: boolean;\n} & (\n\t\t| { control: Control<TFieldValues>; formState?: never }\n\t\t| { control?: never; formState?: FormState<TFieldValues> }\n\t);\n\nconst inputTypesWithoutFullWith = new Set<React.HTMLInputTypeAttribute>([\"checkbox\", \"radio\"]);\n\nexport function FormInputPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormInputPrimitiveProps<TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst {\n\t\tclassName,\n\t\tclassNames,\n\t\tcontrol,\n\t\tformState,\n\t\tid = contextValues?.uniqueId,\n\t\tname = contextValues?.name,\n\t\ttype = \"text\",\n\t\twithEyeIcon = true,\n\t\t...restOfProps\n\t} = props;\n\n\tconst getFormState = (control ? useFormState : () => formState) as typeof useFormState;\n\n\tconst { errors } = (getFormState({ control }) as UseFormStateReturn<TFieldValues> | undefined) ?? {};\n\n\tconst [isPasswordVisible, toggleVisibility] = useToggle(false);\n\n\tconst shouldHaveEyeIcon = withEyeIcon && type === \"password\";\n\n\tconst WrapperElement = shouldHaveEyeIcon ? FormInputGroup : ReactFragment;\n\n\tconst wrapperElementProps = shouldHaveEyeIcon && {\n\t\tclassName: cnMerge(\"w-full\", classNames?.inputGroup, name && errors?.[name] && classNames?.error),\n\t};\n\n\treturn (\n\t\t<WrapperElement {...wrapperElementProps}>\n\t\t\t<input\n\t\t\t\tdata-scope=\"form\"\n\t\t\t\tdata-part=\"input\"\n\t\t\t\tid={id}\n\t\t\t\tname={name}\n\t\t\t\ttype={type === \"password\" && isPasswordVisible ? \"text\" : type}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t!inputTypesWithoutFullWith.has(type) && \"flex w-full\",\n\t\t\t\t\t`bg-transparent text-sm file:border-0 file:bg-transparent\n\t\t\t\t\tplaceholder:text-shadcn-muted-foreground focus-visible:outline-none\n\t\t\t\t\tdisabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\t\tclassName,\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\ttype !== \"password\" && name && errors?.[name] && classNames?.error\n\t\t\t\t)}\n\t\t\t\t{...restOfProps}\n\t\t\t/>\n\n\t\t\t{shouldHaveEyeIcon && (\n\t\t\t\t<FormInputRightItem\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={toggleVisibility}\n\t\t\t\t\tclassName=\"size-5 shrink-0 lg:size-6\"\n\t\t\t\t>\n\t\t\t\t\t{isPasswordVisible ? (\n\t\t\t\t\t\t<EyeIconInvisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EyeIconVisible className={cnMerge(\"size-full\", classNames?.eyeIcon)} />\n\t\t\t\t\t)}\n\t\t\t\t</FormInputRightItem>\n\t\t\t)}\n\t\t</WrapperElement>\n\t);\n}\n\nexport function FormInput(\n\tprops: Omit<FormInputPrimitiveProps, \"control\" | \"formState\" | \"name\" | \"ref\"> & {\n\t\trules?: RegisterOptions;\n\t}\n) {\n\tconst { rules, ...restOfProps } = props;\n\n\tconst { name } = useStrictFormItemContext();\n\tconst { formState, register } = useFormFieldContext();\n\n\treturn (\n\t\t<FormInputPrimitive\n\t\t\tname={name}\n\t\t\tformState={formState}\n\t\t\t{...(Boolean(name) && register(name, rules))}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\ntype FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues> =\n\tReact.ComponentPropsWithRef<\"textarea\"> & {\n\t\terrorClassName?: string;\n\t\tname?: keyof TFieldValues;\n\t} & (\n\t\t\t| { control: Control<TFieldValues>; formState?: never }\n\t\t\t| { control?: never; formState?: FormState<TFieldValues> }\n\t\t);\n\nexport function FormTextAreaPrimitive<TFieldValues extends FieldValues>(\n\tprops: FormTextAreaPrimitiveProps<TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst {\n\t\tclassName,\n\t\tcontrol,\n\t\terrorClassName,\n\t\tformState,\n\t\tid = contextValues?.uniqueId,\n\t\tname = contextValues?.name,\n\t\t...restOfProps\n\t} = props;\n\n\tconst getFormState = (control ? useFormState : () => formState) as typeof useFormState;\n\n\tconst { errors } = (getFormState({ control }) as UseFormStateReturn<TFieldValues> | undefined) ?? {};\n\n\treturn (\n\t\t<textarea\n\t\t\tdata-scope=\"form\"\n\t\t\tdata-part=\"textarea\"\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\tclassName={cnMerge(\n\t\t\t\t`w-full bg-transparent text-sm placeholder:text-shadcn-muted-foreground\n\t\t\t\tfocus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t\tname && errors?.[name] && errorClassName\n\t\t\t)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function FormTextArea(\n\tprops: Omit<FormTextAreaPrimitiveProps, \"control\" | \"formState\" | \"id\" | \"name\" | \"ref\"> & {\n\t\trules?: RegisterOptions;\n\t}\n) {\n\tconst { rules, ...restOfProps } = props;\n\n\tconst { name } = useStrictFormItemContext();\n\tconst { formState, register } = useFormFieldContext();\n\n\treturn (\n\t\t<FormTextAreaPrimitive\n\t\t\tname={name}\n\t\t\tformState={formState}\n\t\t\t{...(Boolean(name) && register(name, rules))}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\ntype FormControllerProps<TFieldValues> = Omit<\n\tControllerProps<FieldValues, FieldPath<FieldValues>>,\n\t\"control\" | \"name\" | \"render\"\n> & {\n\trender: (props: {\n\t\tfield: Omit<ControllerRenderProps, \"value\"> & { value: TFieldValues };\n\t\tfieldState: ControllerFieldState;\n\t\tformState: UseFormStateReturn<FieldValues>;\n\t}) => React.ReactElement;\n};\n\nexport function FormController<TFieldValues = never>(props: FormControllerProps<TFieldValues>) {\n\tconst { control } = useFormFieldContext();\n\tconst { name } = useStrictFormItemContext();\n\n\treturn <ControllerPrimitive name={name} control={control} {...props} />;\n}\n\nexport function FormDescription(props: InferProps<\"p\">) {\n\tconst { className, ...restOfProps } = props;\n\n\treturn <p className={cnMerge(\"text-[12px]\", className)} {...restOfProps} />;\n}\n\ntype ErrorMessageRenderProps = {\n\tclassName: string;\n\t\"data-index\": number;\n\t\"data-part\": string;\n\t\"data-scope\": string;\n\tonAnimationEnd?: React.ReactEventHandler<HTMLElement>;\n};\n\ntype ErrorMessageRenderState = { errorMessage: string; errorMessageArray: string[]; index: number };\n\ntype FormErrorMessagePrimitiveProps<TFieldValues extends FieldValues> = {\n\tclassName?: string;\n\tclassNames?: {\n\t\tcontainer?: string;\n\t\terrorMessage?: string;\n\t\terrorMessageAnimation?: string;\n\t};\n\tcontrol: Control<TFieldValues>; // == Here for type inference of errorField prop\n\trender: (context: {\n\t\tprops: ErrorMessageRenderProps;\n\t\tstate: ErrorMessageRenderState;\n\t}) => React.ReactNode;\n\twithAnimationOnInvalid?: boolean;\n} & (\n\t| {\n\t\t\terrorField: keyof TFieldValues;\n\t\t\ttype?: \"regular\";\n\t }\n\t| {\n\t\t\terrorField: string;\n\t\t\ttype: \"root\";\n\t }\n);\n\ntype FormErrorMessagePrimitiveType = {\n\t<TFieldValues extends FieldValues>(\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type?: \"regular\" }>\n\t): React.ReactNode;\n\t<TFieldValues extends FieldValues>(\n\t\t// eslint-disable-next-line ts-eslint/unified-signatures -- Using overloads are better because it gives better error messages\n\t\tprops: Extract<FormErrorMessagePrimitiveProps<TFieldValues>, { type: \"root\" }>\n\t): React.ReactNode;\n};\n\nexport const FormErrorMessagePrimitive: FormErrorMessagePrimitiveType = <TFieldValues extends FieldValues>(\n\tprops: FormErrorMessagePrimitiveProps<TFieldValues>\n) => {\n\tconst {\n\t\tclassName,\n\t\tclassNames,\n\t\tcontrol,\n\t\terrorField,\n\t\trender,\n\t\ttype = \"regular\",\n\t\twithAnimationOnInvalid = true,\n\t} = props;\n\n\tconst formState = useFormState({ control });\n\n\tconst wrapperRef = useRef<HTMLUListElement>(null);\n\n\tconst errorAnimationClass = classNames?.errorMessageAnimation ?? \"animate-shake\";\n\n\tuseEffect(() => {\n\t\tif (!withAnimationOnInvalid) return;\n\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\tfor (const element of errorMessageElements) {\n\t\t\telement.classList.add(errorAnimationClass);\n\t\t}\n\t}, [errorAnimationClass, withAnimationOnInvalid]);\n\n\tuseEffect(() => {\n\t\tconst errorMessageElements = wrapperRef.current?.children;\n\n\t\tif (!errorMessageElements) return;\n\n\t\t// == Scroll to first error message\n\t\tif (Object.keys(formState.errors).indexOf(errorField as string) === 0) {\n\t\t\terrorMessageElements[0]?.scrollIntoView({\n\t\t\t\tbehavior: \"smooth\",\n\t\t\t\tblock: \"center\",\n\t\t\t});\n\n\t\t\twindow.scrollBy({ behavior: \"smooth\", top: -100 });\n\t\t}\n\t}, [errorField, formState.errors]);\n\n\tconst message = (\n\t\ttype === \"root\"\n\t\t\t? formState.errors.root?.[errorField as string]?.message\n\t\t\t: formState.errors[errorField]?.message\n\t) as string | string[];\n\n\tif (!message) {\n\t\treturn null;\n\t}\n\n\tconst errorMessageArray = toArray(message);\n\n\tconst [ErrorMessageList] = getElementList();\n\n\tconst onAnimationEnd: React.AnimationEventHandler<HTMLElement> | undefined = withAnimationOnInvalid\n\t\t? (event) => event.currentTarget.classList.remove(errorAnimationClass)\n\t\t: undefined;\n\n\tconst getRenderProps = ({ index }: { index: number }) =>\n\t\t({\n\t\t\tclassName: cnMerge(errorAnimationClass, className, classNames?.errorMessage),\n\t\t\t\"data-index\": index,\n\t\t\t\"data-part\": \"error-message\",\n\t\t\t\"data-scope\": \"form\",\n\t\t\tonAnimationEnd,\n\t\t}) satisfies ErrorMessageRenderProps;\n\n\tconst getRenderState = ({ errorMessage, index }: { errorMessage: string; index: number }) =>\n\t\t({\n\t\t\terrorMessage,\n\t\t\terrorMessageArray,\n\t\t\tindex,\n\t\t}) satisfies ErrorMessageRenderState;\n\n\treturn (\n\t\t<ErrorMessageList\n\t\t\tref={wrapperRef}\n\t\t\teach={errorMessageArray}\n\t\t\tclassName={cnMerge(\"flex flex-col\", classNames?.container)}\n\t\t\trender={(errorMessage, index) => {\n\t\t\t\treturn render({\n\t\t\t\t\tprops: getRenderProps({ index }),\n\t\t\t\t\tstate: getRenderState({ errorMessage, index }),\n\t\t\t\t});\n\t\t\t}}\n\t\t/>\n\t);\n};\n\ntype FormErrorMessageProps<TControl, TFieldValues extends FieldValues> =\n\t| (TControl extends Control<infer TValues>\n\t\t\t? {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: never;\n\t\t\t\t\terrorField?: keyof TValues;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tclassName?: string;\n\t\t\t\t\tcontrol?: Control<TFieldValues>; // == Here for type inference of errorField prop\n\t\t\t\t\terrorField?: keyof TFieldValues;\n\t\t\t\t\ttype?: \"regular\";\n\t\t\t\t})\n\t| {\n\t\t\tclassName?: string;\n\t\t\tcontrol?: never;\n\t\t\terrorField: string;\n\t\t\ttype: \"root\";\n\t };\n\nexport function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(\n\tprops: FormErrorMessageProps<TControl, TFieldValues>\n) {\n\tconst contextValues = useLaxFormItemContext();\n\n\tconst { className, errorField = contextValues?.name, type = \"regular\" } = props;\n\n\tconst { control } = useFormFieldContext();\n\n\treturn (\n\t\t<FormErrorMessagePrimitive\n\t\t\tcontrol={control}\n\t\t\terrorField={errorField as string}\n\t\t\ttype={type as \"root\"}\n\t\t\trender={({ props: renderProps, state: { errorMessage } }) => (\n\t\t\t\t<p\n\t\t\t\t\t{...renderProps}\n\t\t\t\t\tkey={errorMessage}\n\t\t\t\t\tclassName={cnMerge(\"text-[13px]\", \"data-[index=0]:mt-1\", renderProps.className, className)}\n\t\t\t\t>\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t/>\n\t);\n}\n","export { Controller as ControllerPrimitive } from \"react-hook-form\";\nexport {\n\tFormController as Controller,\n\tFormDescription as Description,\n\tFormErrorMessage as ErrorMessage,\n\tFormErrorMessagePrimitive as ErrorMessagePrimitive,\n\tFormInput as Input,\n\tFormInputGroup as InputGroup,\n\tFormInputLeftItem as InputLeftItem,\n\tFormInputPrimitive as InputPrimitive,\n\tFormInputRightItem as InputRightItem,\n\tFormItem as Item,\n\tFormItemContext as ItemContext,\n\tFormLabel as Label,\n\tFormRoot as Root,\n\tFormTextArea as TextArea,\n\tFormTextAreaPrimitive as TextAreaPrimitive,\n} from \"./form\";\n"]}
@@ -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,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 { mergeTwoProps, 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 = mergeTwoProps(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 = mergeTwoProps(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-PW4AIAWC.js.map
125
+ //# sourceMappingURL=chunk-PW4AIAWC.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;A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A,QACZ,gBAAiB,CAAA;AAAA,OAClB;AAAA,MACA,kBAAoB,EAAA,UAAA;AAAA,MACpB,WAAa,EAAA,OAAA;AAAA,MACb,YAAc,EAAA,UAAA;AAAA,MACd,QAAA,EAAU,CAAC,KAA+C,KAAA;AACzD,QAAA,gBAAA,CAAiB,KAAK,CAAA;AACtB,QAAA,gBAAA,CAAiB,WAAW,KAAK,CAAA;AAAA,OAClC;AAAA,MACA,KAAK,WAAY,CAAA,CAAC,QAAU,EAAA,gBAAA,CAAiB,GAAG,CAAC,CAAA;AAAA,MACjD,IAAM,EAAA;AAAA,KACP;AAAA,GACD;AAEA,EAAO,OAAA;AAAA,IACN,WAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,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-PW4AIAWC.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, mergeTwoProps } 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 = mergeTwoProps(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 = mergeTwoProps(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,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,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AAClC;AAEO,SAAS,UAAqD,KAAmC,EAAA;AACvG,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,MAAM,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE1D,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,iBAAiB,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAClF;AAEO,SAAS,gBACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAK,SAAW,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEzD,EACC,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,SAAW,EAAA,OAAA,CAAQ,wCAAwC,SAAS,CAAA,EAAI,GAAG,WAAa,EAAA,CAAA;AAEnG;AAEO,SAAS,YACf,KACC,EAAA;AACD,EAAA,MAAM,EAAE,EAAI,EAAA,OAAA,GAAU,KAAO,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEhD,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,UAAU,OAAS,EAAA,GAAG,aAAgB,GAAA,KAAA;AAE5D,EAAM,MAAA,SAAA,GAAY,UAAU,IAAO,GAAA,OAAA;AAEnC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,WAAa,EAAA,CAAA;AACpC;;;ACtDA,IAAA,kBAAA,GAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,WAAA;AAAA,EAAA,WAAA,EAAA,MAAA,eAAA;AAAA,EAAA,MAAA,EAAA,MAAA,UAAA;AAAA,EAAA,MAAA,EAAA,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"]}
@@ -1,13 +1,17 @@
1
1
  import * as React from 'react';
2
- import { isArray } from '@zayne-labs/toolkit-type-helpers';
2
+ import { isNumber, isArray } from '@zayne-labs/toolkit-type-helpers';
3
3
 
4
4
  // src/components/common/for/for.tsx
5
5
  function ForBase(props) {
6
- const { children, each, render } = props;
7
- if (!isArray(each)) {
8
- return each;
6
+ const { children, each, fallback, render } = props;
7
+ if (each == null || isNumber(each) && each === 0 || isArray(each) && each.length === 0) {
8
+ return fallback;
9
9
  }
10
- const JSXElementList = each.map((...params) => {
10
+ const resolvedArray = isNumber(each) ? [...Array(each).keys()] : each;
11
+ if (resolvedArray.length === 0) {
12
+ return fallback;
13
+ }
14
+ const JSXElementList = resolvedArray.map((...params) => {
11
15
  if (typeof children === "function") {
12
16
  return children(...params);
13
17
  }
@@ -36,5 +40,5 @@ var getElementList = (variant) => {
36
40
  };
37
41
 
38
42
  export { ForBase, ForList, getElementList };
39
- //# sourceMappingURL=chunk-MPOYLILK.js.map
40
- //# sourceMappingURL=chunk-MPOYLILK.js.map
43
+ //# sourceMappingURL=chunk-RJQIINNX.js.map
44
+ //# sourceMappingURL=chunk-RJQIINNX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/common/for/for.tsx","../../src/components/common/for/getElementList.ts"],"names":[],"mappings":";;;;AAmCO,SAAS,QAAoB,KAA6B,EAAA;AAChE,EAAA,MAAM,EAAE,QAAA,EAAU,IAAM,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AAG7C,EAAA,IAAI,IAAQ,IAAA,IAAA,IAAS,QAAS,CAAA,IAAI,CAAK,IAAA,IAAA,KAAS,CAAO,IAAA,OAAA,CAAQ,IAAI,CAAA,IAAK,IAAK,CAAA,MAAA,KAAW,CAAI,EAAA;AAC3F,IAAO,OAAA,QAAA;AAAA;AAGR,EAAM,MAAA,aAAA,GAAgB,QAAS,CAAA,IAAI,CAAK,GAAA,CAAC,GAAG,KAAA,CAAM,IAAI,CAAA,CAAE,IAAK,EAAC,CAAqB,GAAA,IAAA;AAEnF,EAAI,IAAA,aAAA,CAAc,WAAW,CAAG,EAAA;AAC/B,IAAO,OAAA,QAAA;AAAA;AAGR,EAAA,MAAM,cAAiB,GAAA,aAAA,CAAc,GAAI,CAAA,CAAA,GAAI,MAAiD,KAAA;AAC7F,IAAI,IAAA,OAAO,aAAa,UAAY,EAAA;AACnC,MAAO,OAAA,QAAA,CAAS,GAAG,MAAM,CAAA;AAAA;AAG1B,IAAO,OAAA,MAAA,CAAO,GAAG,MAAM,CAAA;AAAA,GACvB,CAAA;AAED,EAAO,OAAA,cAAA;AACR;AAEO,SAAS,QACf,KACC,EAAA;AACD,EAAM,MAAA,EAAE,EAAI,EAAA,aAAA,GAAgB,IAAM,EAAA,QAAA,EAAU,SAAW,EAAA,IAAA,EAAM,GAAK,EAAA,MAAA,EAAQ,GAAG,eAAA,EAAoB,GAAA,KAAA;AAEjG,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,GAAU,EAAA,SAAA,EAAuB,GAAG,eAClD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAI,EAAE,QAAA,EAAU,IAAM,EAAA,MAAA,IAAmC,CACpE,CAAA;AAEF;;;AChEM,IAAA,cAAA,GAAiB,CACtB,OACoC,KAAA;AACpC,EAAA,QAAQ,OAAS;AAAA,IAChB,KAAK,MAAQ,EAAA;AACZ,MAAA,OAAO,CAAC,OAAO,CAAA;AAAA;AAChB,IACA,KAAK,aAAe,EAAA;AACnB,MAAA,OAAO,CAAC,OAAO,CAAA;AAAA;AAChB,IACA,SAAS;AACR,MAAA,OAAO,CAAC,OAAO,CAAA;AAAA;AAChB;AAEF","file":"chunk-RJQIINNX.js","sourcesContent":["import * as React from \"react\";\n\nimport type { DiscriminatedRenderProps, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { type Prettify, isArray, isNumber } from \"@zayne-labs/toolkit-type-helpers\";\n\n// prettier-ignore\ntype RenderPropFn<TArrayItem> = (\n\titem: TArrayItem,\n\tindex: number,\n\tarray: TArrayItem[]\n) => React.ReactNode;\n\nexport type ForRenderProps<TArrayItem> = DiscriminatedRenderProps<RenderPropFn<TArrayItem>>;\n\n/* eslint-disable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\ntype ForProps<TArrayItem> = Prettify<\n\t{\n\t\teach: TArrayItem[];\n\t\tfallback?: React.ReactNode;\n\t} & ForRenderProps<TArrayItem>\n>;\n\ntype ForPropsWithNumber<TNumber> = Prettify<\n\t{\n\t\teach: TNumber;\n\t\tfallback?: React.ReactNode;\n\t} & ForRenderProps<TNumber>\n>;\n\n/* eslint-enable perfectionist/sort-intersection-types -- Prefer the object to come first before the render props */\n\nexport function ForBase<TArrayItem>(props: ForProps<TArrayItem>): React.ReactNode[];\n\nexport function ForBase<TNumber>(props: ForPropsWithNumber<TNumber>): React.ReactNode[];\n\nexport function ForBase<TArrayItem>(props: ForProps<TArrayItem>) {\n\tconst { children, each, fallback, render } = props;\n\n\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Each can be undefined or null if user ignores TS\n\tif (each == null || (isNumber(each) && each === 0) || (isArray(each) && each.length === 0)) {\n\t\treturn fallback;\n\t}\n\n\tconst resolvedArray = isNumber(each) ? ([...Array(each).keys()] as TArrayItem[]) : each;\n\n\tif (resolvedArray.length === 0) {\n\t\treturn fallback;\n\t}\n\n\tconst JSXElementList = resolvedArray.map((...params: Parameters<RenderPropFn<TArrayItem>>) => {\n\t\tif (typeof children === \"function\") {\n\t\t\treturn children(...params);\n\t\t}\n\n\t\treturn render(...params);\n\t});\n\n\treturn JSXElementList;\n}\n\nexport function ForList<TArrayItem, TElement extends React.ElementType = \"ul\">(\n\tprops: PolymorphicProps<TElement, ForProps<TArrayItem> & { className?: string }>\n) {\n\tconst { as: ListContainer = \"ul\", children, className, each, ref, render, ...restOfListProps } = props;\n\n\treturn (\n\t\t<ListContainer ref={ref} className={className} {...restOfListProps}>\n\t\t\t<ForBase {...({ children, each, render } as ForProps<TArrayItem>)} />\n\t\t</ListContainer>\n\t);\n}\n","import { ForBase, ForList } from \"./for\";\n\ntype GetElementListResult<TVariant extends \"base\" | \"withWrapper\"> = TVariant extends \"base\"\n\t? [typeof ForBase]\n\t: [typeof ForList];\n\nconst getElementList = <TVariant extends \"base\" | \"withWrapper\" = \"withWrapper\">(\n\tvariant?: TVariant\n): GetElementListResult<TVariant> => {\n\tswitch (variant) {\n\t\tcase \"base\": {\n\t\t\treturn [ForBase] as never;\n\t\t}\n\t\tcase \"withWrapper\": {\n\t\t\treturn [ForList] as never;\n\t\t}\n\t\tdefault: {\n\t\t\treturn [ForList] as never;\n\t\t}\n\t}\n};\n\nexport { getElementList };\n"]}
@@ -0,0 +1,274 @@
1
+ import { cnMerge } from './chunk-OHG7GB7O.js';
2
+ import { getElementList } from './chunk-RJQIINNX.js';
3
+ import { __export } from './chunk-PZ5AY32C.js';
4
+ import * as React3 from 'react';
5
+ import { useEffect, useState } from 'react';
6
+ import { useConstant, useAnimationInterval, useCallbackRef } from '@zayne-labs/toolkit-react';
7
+ import { createZustandContext } from '@zayne-labs/toolkit-react/zustand';
8
+ import { create } from 'zustand';
9
+
10
+ var ChevronLeftIcon = (props) => /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React3.createElement("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }, /* @__PURE__ */ React3.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React3.createElement("path", { d: "m14 16l-4-4l4-4" })));
11
+ var [Provider, useCarouselStoreContext] = createZustandContext({
12
+ hookName: "useCarouselStore",
13
+ name: "CarouselStoreContext",
14
+ providerName: "CarouselContextProvider"
15
+ });
16
+ var createCarouselStore = (storeValues) => {
17
+ const { images, onSlideBtnClick } = storeValues;
18
+ const useInitCarouselStore = create()((set, get) => ({
19
+ currentSlide: 0,
20
+ images,
21
+ maxSlide: images.length - 1,
22
+ /* eslint-disable perfectionist/sort-objects -- actions should be last */
23
+ actions: {
24
+ /* eslint-enable perfectionist/sort-objects -- actions should be last */
25
+ goToNextSlide: () => {
26
+ const { currentSlide, maxSlide } = get();
27
+ const { goToSlide } = get().actions;
28
+ if (currentSlide === maxSlide) {
29
+ goToSlide(0);
30
+ return;
31
+ }
32
+ goToSlide(currentSlide + 1);
33
+ },
34
+ goToPreviousSlide: () => {
35
+ const { currentSlide, maxSlide } = get();
36
+ const { goToSlide } = get().actions;
37
+ if (currentSlide === 0) {
38
+ goToSlide(maxSlide);
39
+ return;
40
+ }
41
+ goToSlide(currentSlide - 1);
42
+ },
43
+ goToSlide: (newValue) => {
44
+ onSlideBtnClick?.();
45
+ set({ currentSlide: newValue });
46
+ }
47
+ }
48
+ }));
49
+ return useInitCarouselStore;
50
+ };
51
+ var useCarousel = (props) => {
52
+ const { images, onSlideBtnClick } = props;
53
+ const useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));
54
+ useEffect(() => {
55
+ useInitCarouselStore.setState({ images });
56
+ }, [images]);
57
+ return useInitCarouselStore;
58
+ };
59
+ function CarouselContextProvider(props) {
60
+ const { children, images, onSlideBtnClick } = props;
61
+ const useInitCarouselStore = useCarousel({ images, onSlideBtnClick });
62
+ return /* @__PURE__ */ React3.createElement(Provider, { value: useInitCarouselStore }, children);
63
+ }
64
+ var useCarouselOptions = (options = {}) => {
65
+ const { autoSlideInterval = 5e3, hasAutoSlide = false, shouldPauseOnHover = false } = options;
66
+ const { goToNextSlide } = useCarouselStoreContext((state) => state.actions);
67
+ const [isPaused, setIsPaused] = useState(false);
68
+ const shouldAutoSlide = hasAutoSlide && !isPaused;
69
+ useAnimationInterval({
70
+ intervalDuration: shouldAutoSlide ? autoSlideInterval : null,
71
+ onAnimation: goToNextSlide
72
+ });
73
+ const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
74
+ const resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));
75
+ return { pauseAutoSlide, resumeAutoSlide };
76
+ };
77
+
78
+ // src/components/ui/carousel/carousel.tsx
79
+ function CarouselContent(props) {
80
+ const {
81
+ as: HtmlElement = "article",
82
+ autoSlideInterval,
83
+ children,
84
+ classNames,
85
+ hasAutoSlide,
86
+ shouldPauseOnHover
87
+ } = props;
88
+ const { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({
89
+ autoSlideInterval,
90
+ hasAutoSlide,
91
+ shouldPauseOnHover
92
+ });
93
+ return /* @__PURE__ */ React3.createElement(
94
+ HtmlElement,
95
+ {
96
+ "data-id": "Carousel",
97
+ className: cnMerge("relative select-none", classNames?.base),
98
+ onMouseEnter: pauseAutoSlide,
99
+ onMouseLeave: resumeAutoSlide
100
+ },
101
+ /* @__PURE__ */ React3.createElement(
102
+ "div",
103
+ {
104
+ "data-id": "Scroll Container",
105
+ className: cnMerge(
106
+ "flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
107
+ classNames?.scrollContainer
108
+ )
109
+ },
110
+ children
111
+ )
112
+ );
113
+ }
114
+ function CarouselButton(props) {
115
+ const { classNames, icon, variant } = props;
116
+ const { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);
117
+ return /* @__PURE__ */ React3.createElement(
118
+ "button",
119
+ {
120
+ type: "button",
121
+ className: cnMerge(
122
+ "z-30 flex h-full w-[15%] items-center",
123
+ variant === "prev" ? "justify-start" : "justify-end",
124
+ classNames?.base
125
+ ),
126
+ onClick: variant === "prev" ? goToPreviousSlide : goToNextSlide
127
+ },
128
+ /* @__PURE__ */ React3.createElement("span", { className: cnMerge("transition-transform active:scale-[1.06]", classNames?.iconContainer) }, icon ?? /* @__PURE__ */ React3.createElement(
129
+ ChevronLeftIcon,
130
+ {
131
+ className: cnMerge(variant === "next" && "rotate-180", classNames?.defaultIcon)
132
+ }
133
+ ))
134
+ );
135
+ }
136
+ function CarouselControls(props) {
137
+ const { classNames, icon } = props;
138
+ return /* @__PURE__ */ React3.createElement("div", { className: cnMerge("absolute inset-0 flex justify-between", classNames?.base) }, icon?.iconType ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
139
+ CarouselButton,
140
+ {
141
+ variant: "prev",
142
+ classNames: {
143
+ defaultIcon: classNames?.defaultIcon,
144
+ iconContainer: cnMerge(
145
+ icon.iconType === "nextIcon" && "rotate-180",
146
+ classNames?.iconContainer
147
+ )
148
+ },
149
+ icon: icon.icon
150
+ }
151
+ ), /* @__PURE__ */ React3.createElement(
152
+ CarouselButton,
153
+ {
154
+ variant: "next",
155
+ classNames: {
156
+ defaultIcon: classNames?.defaultIcon,
157
+ iconContainer: cnMerge(
158
+ icon.iconType === "prevIcon" && "rotate-180",
159
+ classNames?.iconContainer
160
+ )
161
+ },
162
+ icon: icon.icon
163
+ }
164
+ )) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
165
+ CarouselButton,
166
+ {
167
+ variant: "prev",
168
+ classNames: {
169
+ defaultIcon: classNames?.defaultIcon,
170
+ iconContainer: classNames?.iconContainer
171
+ },
172
+ icon: icon?.prev
173
+ }
174
+ ), /* @__PURE__ */ React3.createElement(
175
+ CarouselButton,
176
+ {
177
+ variant: "next",
178
+ classNames: {
179
+ defaultIcon: classNames?.defaultIcon,
180
+ iconContainer: classNames?.iconContainer
181
+ },
182
+ icon: icon?.next
183
+ }
184
+ )));
185
+ }
186
+ function CarouselItemWrapper(props) {
187
+ const { children, className, each, render } = props;
188
+ const [ItemList] = getElementList("base");
189
+ const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
190
+ const images = useCarouselStoreContext((state) => each ?? state.images);
191
+ return /* @__PURE__ */ React3.createElement(
192
+ "ul",
193
+ {
194
+ "data-id": "Carousel Image Wrapper",
195
+ className: cnMerge(
196
+ `flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]
197
+ [transition:transform_800ms_ease]`,
198
+ className
199
+ ),
200
+ style: {
201
+ "--translate-distance": `-${currentSlide * 100}%`
202
+ }
203
+ },
204
+ typeof render === "function" ? /* @__PURE__ */ React3.createElement(ItemList, { each: images, render }) : /* @__PURE__ */ React3.createElement(ItemList, { each: images }, children)
205
+ );
206
+ }
207
+ function CarouselItem({ children, className, ...restOfProps }) {
208
+ return /* @__PURE__ */ React3.createElement(
209
+ "li",
210
+ {
211
+ className: cnMerge("flex w-full shrink-0 snap-center justify-center", className),
212
+ ...restOfProps
213
+ },
214
+ children
215
+ );
216
+ }
217
+ function CarouselCaption(props) {
218
+ const { as: HtmlElement = "div", children, className } = props;
219
+ return /* @__PURE__ */ React3.createElement(HtmlElement, { "data-id": "Carousel Caption", className: cnMerge("absolute z-10", className) }, children);
220
+ }
221
+ function CarouselIndicatorWrapper(props) {
222
+ const { children, className, each, render } = props;
223
+ const images = useCarouselStoreContext((state) => each ?? state.images);
224
+ const [IndicatorList] = getElementList("base");
225
+ return /* @__PURE__ */ React3.createElement(
226
+ "ul",
227
+ {
228
+ "data-id": "Carousel Indicators",
229
+ className: cnMerge(
230
+ "absolute bottom-10 z-[2] flex w-full items-center justify-center gap-6",
231
+ className
232
+ )
233
+ },
234
+ typeof render === "function" ? /* @__PURE__ */ React3.createElement(IndicatorList, { each: images, render }) : /* @__PURE__ */ React3.createElement(IndicatorList, { each: images }, children)
235
+ );
236
+ }
237
+ function CarouselIndicator(props) {
238
+ const { classNames, currentIndex } = props;
239
+ const {
240
+ actions: { goToSlide },
241
+ currentSlide
242
+ } = useCarouselStoreContext((state) => state);
243
+ return /* @__PURE__ */ React3.createElement("li", { className: cnMerge("inline-flex", classNames?.base) }, /* @__PURE__ */ React3.createElement(
244
+ "button",
245
+ {
246
+ "data-active": currentIndex === currentSlide,
247
+ type: "button",
248
+ onClick: () => goToSlide(currentIndex),
249
+ className: cnMerge(
250
+ "size-[6px] rounded-[50%]",
251
+ classNames?.button,
252
+ currentIndex === currentSlide && ["w-14 rounded-lg", classNames?.activeBtn]
253
+ )
254
+ }
255
+ ));
256
+ }
257
+
258
+ // src/components/ui/carousel/carousel-parts.ts
259
+ var carousel_parts_exports = {};
260
+ __export(carousel_parts_exports, {
261
+ Button: () => CarouselButton,
262
+ Caption: () => CarouselCaption,
263
+ Content: () => CarouselContent,
264
+ Controls: () => CarouselControls,
265
+ Indicator: () => CarouselIndicator,
266
+ IndicatorWrapper: () => CarouselIndicatorWrapper,
267
+ Item: () => CarouselItem,
268
+ ItemWrapper: () => CarouselItemWrapper,
269
+ Root: () => CarouselContextProvider
270
+ });
271
+
272
+ export { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorWrapper, CarouselItem, CarouselItemWrapper, carousel_parts_exports };
273
+ //# sourceMappingURL=chunk-VMJ2L3VC.js.map
274
+ //# sourceMappingURL=chunk-VMJ2L3VC.js.map