@kubetail/ui 2.7.1 → 3.0.0-rc1

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 (91) hide show
  1. package/dist/elements/avatar.cjs +1 -1
  2. package/dist/elements/avatar.cjs.map +1 -1
  3. package/dist/elements/avatar.d.ts +1 -1
  4. package/dist/elements/avatar.js +1 -1
  5. package/dist/elements/avatar.js.map +1 -1
  6. package/dist/elements/button.cjs +1 -1
  7. package/dist/elements/button.cjs.map +1 -1
  8. package/dist/elements/button.d.ts +5 -4
  9. package/dist/elements/button.js +17 -14
  10. package/dist/elements/button.js.map +1 -1
  11. package/dist/elements/checkbox.cjs +1 -1
  12. package/dist/elements/checkbox.cjs.map +1 -1
  13. package/dist/elements/checkbox.d.ts +1 -1
  14. package/dist/elements/checkbox.js +2 -2
  15. package/dist/elements/checkbox.js.map +1 -1
  16. package/dist/elements/context-menu.cjs +1 -1
  17. package/dist/elements/context-menu.cjs.map +1 -1
  18. package/dist/elements/context-menu.d.ts +8 -7
  19. package/dist/elements/context-menu.js +26 -31
  20. package/dist/elements/context-menu.js.map +1 -1
  21. package/dist/elements/dialog.cjs +1 -1
  22. package/dist/elements/dialog.cjs.map +1 -1
  23. package/dist/elements/dialog.d.ts +3 -3
  24. package/dist/elements/dialog.js +16 -25
  25. package/dist/elements/dialog.js.map +1 -1
  26. package/dist/elements/dropdown-menu.cjs +1 -1
  27. package/dist/elements/dropdown-menu.cjs.map +1 -1
  28. package/dist/elements/dropdown-menu.d.ts +11 -8
  29. package/dist/elements/dropdown-menu.js +27 -31
  30. package/dist/elements/dropdown-menu.js.map +1 -1
  31. package/dist/elements/form.cjs +1 -1
  32. package/dist/elements/form.cjs.map +1 -1
  33. package/dist/elements/form.d.ts +5 -4
  34. package/dist/elements/form.js +39 -42
  35. package/dist/elements/form.js.map +1 -1
  36. package/dist/elements/label.cjs +1 -1
  37. package/dist/elements/label.cjs.map +1 -1
  38. package/dist/elements/label.d.ts +1 -2
  39. package/dist/elements/label.js +5 -6
  40. package/dist/elements/label.js.map +1 -1
  41. package/dist/elements/link.cjs +1 -1
  42. package/dist/elements/link.cjs.map +1 -1
  43. package/dist/elements/link.d.ts +6 -5
  44. package/dist/elements/link.js +18 -13
  45. package/dist/elements/link.js.map +1 -1
  46. package/dist/elements/popover.cjs +1 -1
  47. package/dist/elements/popover.cjs.map +1 -1
  48. package/dist/elements/popover.d.ts +8 -5
  49. package/dist/elements/popover.js +13 -19
  50. package/dist/elements/popover.js.map +1 -1
  51. package/dist/elements/select.cjs +1 -1
  52. package/dist/elements/select.cjs.map +1 -1
  53. package/dist/elements/select.d.ts +13 -8
  54. package/dist/elements/select.js +32 -37
  55. package/dist/elements/select.js.map +1 -1
  56. package/dist/elements/separator.cjs +1 -1
  57. package/dist/elements/separator.cjs.map +1 -1
  58. package/dist/elements/separator.d.ts +2 -2
  59. package/dist/elements/separator.js +4 -5
  60. package/dist/elements/separator.js.map +1 -1
  61. package/dist/elements/sheet.cjs +1 -1
  62. package/dist/elements/sheet.cjs.map +1 -1
  63. package/dist/elements/sheet.d.ts +2 -2
  64. package/dist/elements/sheet.js +8 -14
  65. package/dist/elements/sheet.js.map +1 -1
  66. package/dist/elements/sidebar.cjs +1 -1
  67. package/dist/elements/sidebar.cjs.map +1 -1
  68. package/dist/elements/sidebar.d.ts +15 -14
  69. package/dist/elements/sidebar.js +63 -46
  70. package/dist/elements/sidebar.js.map +1 -1
  71. package/dist/elements/switch.cjs +1 -1
  72. package/dist/elements/switch.cjs.map +1 -1
  73. package/dist/elements/switch.d.ts +1 -1
  74. package/dist/elements/switch.js +3 -3
  75. package/dist/elements/switch.js.map +1 -1
  76. package/dist/elements/tabs.cjs +1 -1
  77. package/dist/elements/tabs.cjs.map +1 -1
  78. package/dist/elements/tabs.d.ts +3 -3
  79. package/dist/elements/tabs.js +4 -4
  80. package/dist/elements/tabs.js.map +1 -1
  81. package/dist/elements/toggle.cjs +1 -1
  82. package/dist/elements/toggle.cjs.map +1 -1
  83. package/dist/elements/toggle.d.ts +2 -2
  84. package/dist/elements/toggle.js +3 -3
  85. package/dist/elements/toggle.js.map +1 -1
  86. package/dist/elements/tooltip.cjs +1 -1
  87. package/dist/elements/tooltip.cjs.map +1 -1
  88. package/dist/elements/tooltip.d.ts +7 -3
  89. package/dist/elements/tooltip.js +14 -14
  90. package/dist/elements/tooltip.js.map +1 -1
  91. package/package.json +3 -71
@@ -1 +1 @@
1
- {"version":3,"file":"form.cjs","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useId, useMemo } from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":"yWAkBA,IAAM,EAAO,EAAA,aASP,GAAA,EAAA,EAAA,eAAwD,EAAE,CAA0B,CAMpF,GAAA,EAAA,EAAA,eAAsD,EAAE,CAAyB,CAEjF,GAGJ,CACA,GAAG,KACuC,CAC1C,IAAM,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAM,EAAM,KAAM,EAAG,CAAC,EAAM,KAAK,CAAC,CAEjE,OACE,EAAA,EAAA,KAAC,EAAiB,SAAlB,CAAkC,kBAChC,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,GAAI,EAAS,CAAA,CACC,CAAA,EAI1B,MAAqB,CACzB,IAAM,GAAA,EAAA,EAAA,YAA0B,EAAiB,CAC3C,GAAA,EAAA,EAAA,YAAyB,EAAgB,CACzC,CAAE,kBAAA,EAAA,EAAA,iBAAkC,CACpC,GAAA,EAAA,EAAA,cAAyB,CAAE,KAAM,EAAa,KAAM,CAAC,CACrD,EAAa,EAAc,EAAa,KAAM,EAAU,CAE9D,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,GAAM,CAAE,MAAO,EAEf,MAAO,CACL,KACA,KAAM,EAAa,KACnB,WAAY,GAAG,EAAG,YAClB,kBAAmB,GAAG,EAAG,wBACzB,cAAe,GAAG,EAAG,oBACrB,GAAG,EACJ,EAGH,SAAS,EAAS,CAAE,YAAW,GAAG,GAAsC,CACtE,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAI,EAAG,CAAC,EAAG,CAAC,CAE3C,OACE,EAAA,EAAA,KAAC,EAAgB,SAAjB,CAAiC,kBAC/B,EAAA,EAAA,KAAC,MAAD,CAAK,YAAU,YAAY,UAAW,EAAA,GAAG,aAAc,EAAU,CAAE,GAAI,EAAS,CAAA,CACvD,CAAA,CAI/B,SAAS,EAAU,CAAE,YAAW,GAAG,GAA2D,CAC5F,GAAM,CAAE,QAAO,cAAe,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,EAAA,MAAD,CACE,YAAU,aACV,aAAY,CAAC,CAAC,EACd,UAAW,EAAA,GAAG,qCAAsC,EAAU,CAC9D,QAAS,EACT,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,GAAG,GAA4C,CACpE,GAAM,CAAE,QAAO,aAAY,oBAAmB,iBAAkB,GAAc,CAE9E,OACE,EAAA,EAAA,KAAC,EAAA,KAAD,CACE,YAAU,eACV,GAAI,EACJ,mBAAmB,EAA4B,GAAG,EAAkB,GAAG,IAA5C,EAC3B,eAAc,CAAC,CAAC,EAChB,GAAI,EACJ,CAAA,CAIN,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,IAAD,CACE,YAAU,mBACV,GAAI,EACJ,UAAW,EAAA,GAAG,gCAAiC,EAAU,CACzD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAAW,GAAG,GAAoC,CACvE,GAAM,CAAE,QAAO,iBAAkB,GAAc,CACzC,EAAO,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,EAAM,SAM1D,OAJK,GAKH,EAAA,EAAA,KAAC,IAAD,CAAG,YAAU,eAAe,GAAI,EAAe,UAAW,EAAA,GAAG,2BAA4B,EAAU,CAAE,GAAI,WACtG,EACC,CAAA,CANG"}
1
+ {"version":3,"file":"form.cjs","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { Children, cloneElement, createContext, isValidElement, useContext, useId, useMemo } from 'react';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ children }: { children: React.ReactNode }) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n const child = Children.only(children);\n\n if (!isValidElement<Record<string, unknown>>(child)) {\n return <>{children}</>;\n }\n\n return cloneElement(child, {\n 'data-slot': 'form-control',\n id: formItemId,\n 'aria-describedby': !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`,\n 'aria-invalid': !!error,\n });\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":"6QAgBA,IAAM,EAAO,EAAA,aASP,GAAA,EAAA,EAAA,eAAwD,EAAE,CAA0B,CAMpF,GAAA,EAAA,EAAA,eAAsD,EAAE,CAAyB,CAEjF,GAGJ,CACA,GAAG,KACuC,CAC1C,IAAM,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAM,EAAM,KAAM,EAAG,CAAC,EAAM,KAAK,CAAC,CAEjE,OACE,EAAA,EAAA,KAAC,EAAiB,SAAlB,CAAkC,kBAChC,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,GAAI,EAAS,CAAA,CACC,CAAA,EAI1B,MAAqB,CACzB,IAAM,GAAA,EAAA,EAAA,YAA0B,EAAiB,CAC3C,GAAA,EAAA,EAAA,YAAyB,EAAgB,CACzC,CAAE,kBAAA,EAAA,EAAA,iBAAkC,CACpC,GAAA,EAAA,EAAA,cAAyB,CAAE,KAAM,EAAa,KAAM,CAAC,CACrD,EAAa,EAAc,EAAa,KAAM,EAAU,CAE9D,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,GAAM,CAAE,MAAO,EAEf,MAAO,CACL,KACA,KAAM,EAAa,KACnB,WAAY,GAAG,EAAG,YAClB,kBAAmB,GAAG,EAAG,wBACzB,cAAe,GAAG,EAAG,oBACrB,GAAG,EACJ,EAGH,SAAS,EAAS,CAAE,YAAW,GAAG,GAAsC,CACtE,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAI,EAAG,CAAC,EAAG,CAAC,CAE3C,OACE,EAAA,EAAA,KAAC,EAAgB,SAAjB,CAAiC,kBAC/B,EAAA,EAAA,KAAC,MAAD,CAAK,YAAU,YAAY,UAAW,EAAA,GAAG,aAAc,EAAU,CAAE,GAAI,EAAS,CAAA,CACvD,CAAA,CAI/B,SAAS,EAAU,CAAE,YAAW,GAAG,GAA6C,CAC9E,GAAM,CAAE,QAAO,cAAe,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,EAAA,MAAD,CACE,YAAU,aACV,aAAY,CAAC,CAAC,EACd,UAAW,EAAA,GAAG,qCAAsC,EAAU,CAC9D,QAAS,EACT,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAA2C,CAChE,GAAM,CAAE,QAAO,aAAY,oBAAmB,iBAAkB,GAAc,CACxE,EAAQ,EAAA,SAAS,KAAK,EAAS,CAMrC,OAJI,EAAA,EAAA,gBAAyC,EAAM,EAInD,EAAA,EAAA,cAAoB,EAAO,CACzB,YAAa,eACb,GAAI,EACJ,mBAAqB,EAA4B,GAAG,EAAkB,GAAG,IAA5C,EAC7B,eAAgB,CAAC,CAAC,EACnB,CAAC,EARO,EAAA,EAAA,KAAA,EAAA,SAAA,CAAG,WAAY,CAAA,CAW1B,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,IAAD,CACE,YAAU,mBACV,GAAI,EACJ,UAAW,EAAA,GAAG,gCAAiC,EAAU,CACzD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAAW,GAAG,GAAoC,CACvE,GAAM,CAAE,QAAO,iBAAkB,GAAc,CACzC,EAAO,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,EAAM,SAM1D,OAJK,GAKH,EAAA,EAAA,KAAC,IAAD,CAAG,YAAU,eAAe,GAAI,EAAe,UAAW,EAAA,GAAG,2BAA4B,EAAU,CAAE,GAAI,WACtG,EACC,CAAA,CANG"}
@@ -1,6 +1,5 @@
1
- import * as LabelPrimitive from '@radix-ui/react-label';
2
- import { Slot } from '@radix-ui/react-slot';
3
1
  import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
2
+ import { Label } from '@/elements/label';
4
3
  declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
4
  declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
6
5
  declare const useFormField: () => {
@@ -16,8 +15,10 @@ declare const useFormField: () => {
16
15
  formMessageId: string;
17
16
  };
18
17
  declare function FormItem({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
19
- declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
20
- declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): import("react/jsx-runtime").JSX.Element;
18
+ declare function FormLabel({ className, ...props }: React.ComponentProps<typeof Label>): import("react/jsx-runtime").JSX.Element;
19
+ declare function FormControl({ children }: {
20
+ children: React.ReactNode;
21
+ }): import("react/jsx-runtime").JSX.Element;
21
22
  declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
22
23
  declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element | null;
23
24
  export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
@@ -1,82 +1,79 @@
1
1
  "use client";
2
2
  import { cn as e } from "../lib/utils.js";
3
3
  import { Label as t } from "./label.js";
4
- import { jsx as n } from "react/jsx-runtime";
5
- import { Slot as r } from "@radix-ui/react-slot";
6
- import { createContext as i, useContext as a, useId as o, useMemo as s } from "react";
7
- import "@radix-ui/react-label";
8
- import { Controller as c, FormProvider as l, useFormContext as u, useFormState as d } from "react-hook-form";
4
+ import { Fragment as n, jsx as r } from "react/jsx-runtime";
5
+ import { Children as i, cloneElement as a, createContext as o, isValidElement as s, useContext as c, useId as l, useMemo as u } from "react";
6
+ import { Controller as d, FormProvider as f, useFormContext as p, useFormState as m } from "react-hook-form";
9
7
  //#region src/elements/form.tsx
10
- var f = l, p = i({}), m = i({}), h = ({ ...e }) => {
11
- let t = s(() => ({ name: e.name }), [e.name]);
12
- return /* @__PURE__ */ n(p.Provider, {
8
+ var h = f, g = o({}), _ = o({}), v = ({ ...e }) => {
9
+ let t = u(() => ({ name: e.name }), [e.name]);
10
+ return /* @__PURE__ */ r(g.Provider, {
13
11
  value: t,
14
- children: /* @__PURE__ */ n(c, { ...e })
12
+ children: /* @__PURE__ */ r(d, { ...e })
15
13
  });
16
- }, g = () => {
17
- let e = a(p), t = a(m), { getFieldState: n } = u(), r = d({ name: e.name }), i = n(e.name, r);
14
+ }, y = () => {
15
+ let e = c(g), t = c(_), { getFieldState: n } = p(), r = m({ name: e.name }), i = n(e.name, r);
18
16
  if (!e) throw Error("useFormField should be used within <FormField>");
19
- let { id: o } = t;
17
+ let { id: a } = t;
20
18
  return {
21
- id: o,
19
+ id: a,
22
20
  name: e.name,
23
- formItemId: `${o}-form-item`,
24
- formDescriptionId: `${o}-form-item-description`,
25
- formMessageId: `${o}-form-item-message`,
21
+ formItemId: `${a}-form-item`,
22
+ formDescriptionId: `${a}-form-item-description`,
23
+ formMessageId: `${a}-form-item-message`,
26
24
  ...i
27
25
  };
28
26
  };
29
- function _({ className: t, ...r }) {
30
- let i = o(), a = s(() => ({ id: i }), [i]);
31
- return /* @__PURE__ */ n(m.Provider, {
27
+ function b({ className: t, ...n }) {
28
+ let i = l(), a = u(() => ({ id: i }), [i]);
29
+ return /* @__PURE__ */ r(_.Provider, {
32
30
  value: a,
33
- children: /* @__PURE__ */ n("div", {
31
+ children: /* @__PURE__ */ r("div", {
34
32
  "data-slot": "form-item",
35
33
  className: e("grid gap-2", t),
36
- ...r
34
+ ...n
37
35
  })
38
36
  });
39
37
  }
40
- function v({ className: r, ...i }) {
41
- let { error: a, formItemId: o } = g();
42
- return /* @__PURE__ */ n(t, {
38
+ function x({ className: n, ...i }) {
39
+ let { error: a, formItemId: o } = y();
40
+ return /* @__PURE__ */ r(t, {
43
41
  "data-slot": "form-label",
44
42
  "data-error": !!a,
45
- className: e("data-[error=true]:text-destructive", r),
43
+ className: e("data-[error=true]:text-destructive", n),
46
44
  htmlFor: o,
47
45
  ...i
48
46
  });
49
47
  }
50
- function y({ ...e }) {
51
- let { error: t, formItemId: i, formDescriptionId: a, formMessageId: o } = g();
52
- return /* @__PURE__ */ n(r, {
48
+ function S({ children: e }) {
49
+ let { error: t, formItemId: o, formDescriptionId: c, formMessageId: l } = y(), u = i.only(e);
50
+ return s(u) ? a(u, {
53
51
  "data-slot": "form-control",
54
- id: i,
55
- "aria-describedby": t ? `${a} ${o}` : a,
56
- "aria-invalid": !!t,
57
- ...e
58
- });
52
+ id: o,
53
+ "aria-describedby": t ? `${c} ${l}` : c,
54
+ "aria-invalid": !!t
55
+ }) : /* @__PURE__ */ r(n, { children: e });
59
56
  }
60
- function b({ className: t, ...r }) {
61
- let { formDescriptionId: i } = g();
62
- return /* @__PURE__ */ n("p", {
57
+ function C({ className: t, ...n }) {
58
+ let { formDescriptionId: i } = y();
59
+ return /* @__PURE__ */ r("p", {
63
60
  "data-slot": "form-description",
64
61
  id: i,
65
62
  className: e("text-muted-foreground text-sm", t),
66
- ...r
63
+ ...n
67
64
  });
68
65
  }
69
- function x({ className: t, ...r }) {
70
- let { error: i, formMessageId: a } = g(), o = i ? String(i?.message ?? "") : r.children;
71
- return o ? /* @__PURE__ */ n("p", {
66
+ function w({ className: t, ...n }) {
67
+ let { error: i, formMessageId: a } = y(), o = i ? String(i?.message ?? "") : n.children;
68
+ return o ? /* @__PURE__ */ r("p", {
72
69
  "data-slot": "form-message",
73
70
  id: a,
74
71
  className: e("text-destructive text-sm", t),
75
- ...r,
72
+ ...n,
76
73
  children: o
77
74
  }) : null;
78
75
  }
79
76
  //#endregion
80
- export { f as Form, y as FormControl, b as FormDescription, h as FormField, _ as FormItem, v as FormLabel, x as FormMessage, g as useFormField };
77
+ export { h as Form, S as FormControl, C as FormDescription, v as FormField, b as FormItem, x as FormLabel, w as FormMessage, y as useFormField };
81
78
 
82
79
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useId, useMemo } from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":";;;;;;;;;AAkBA,IAAM,IAAO,GASP,IAAmB,EAAqC,EAAE,CAA0B,EAMpF,IAAkB,EAAoC,EAAE,CAAyB,EAEjF,KAGJ,EACA,GAAG,QACuC;CAC1C,IAAM,IAAQ,SAAe,EAAE,MAAM,EAAM,MAAM,GAAG,CAAC,EAAM,KAAK,CAAC;AAEjE,QACE,kBAAC,EAAiB,UAAlB;EAAkC;YAChC,kBAAC,GAAD,EAAY,GAAI,GAAS,CAAA;EACC,CAAA;GAI1B,UAAqB;CACzB,IAAM,IAAe,EAAW,EAAiB,EAC3C,IAAc,EAAW,EAAgB,EACzC,EAAE,qBAAkB,GAAgB,EACpC,IAAY,EAAa,EAAE,MAAM,EAAa,MAAM,CAAC,EACrD,IAAa,EAAc,EAAa,MAAM,EAAU;AAE9D,KAAI,CAAC,EACH,OAAU,MAAM,iDAAiD;CAGnE,IAAM,EAAE,UAAO;AAEf,QAAO;EACL;EACA,MAAM,EAAa;EACnB,YAAY,GAAG,EAAG;EAClB,mBAAmB,GAAG,EAAG;EACzB,eAAe,GAAG,EAAG;EACrB,GAAG;EACJ;;AAGH,SAAS,EAAS,EAAE,cAAW,GAAG,KAAsC;CACtE,IAAM,IAAK,GAAO,EACZ,IAAQ,SAAe,EAAE,OAAI,GAAG,CAAC,EAAG,CAAC;AAE3C,QACE,kBAAC,EAAgB,UAAjB;EAAiC;YAC/B,kBAAC,OAAD;GAAK,aAAU;GAAY,WAAW,EAAG,cAAc,EAAU;GAAE,GAAI;GAAS,CAAA;EACvD,CAAA;;AAI/B,SAAS,EAAU,EAAE,cAAW,GAAG,KAA2D;CAC5F,IAAM,EAAE,UAAO,kBAAe,GAAc;AAE5C,QACE,kBAAC,GAAD;EACE,aAAU;EACV,cAAY,CAAC,CAAC;EACd,WAAW,EAAG,sCAAsC,EAAU;EAC9D,SAAS;EACT,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,GAAG,KAA4C;CACpE,IAAM,EAAE,UAAO,eAAY,sBAAmB,qBAAkB,GAAc;AAE9E,QACE,kBAAC,GAAD;EACE,aAAU;EACV,IAAI;EACJ,oBAAmB,IAA4B,GAAG,EAAkB,GAAG,MAA5C;EAC3B,gBAAc,CAAC,CAAC;EAChB,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAgB,EAAE,cAAW,GAAG,KAAoC;CAC3E,IAAM,EAAE,yBAAsB,GAAc;AAE5C,QACE,kBAAC,KAAD;EACE,aAAU;EACV,IAAI;EACJ,WAAW,EAAG,iCAAiC,EAAU;EACzD,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,cAAW,GAAG,KAAoC;CACvE,IAAM,EAAE,UAAO,qBAAkB,GAAc,EACzC,IAAO,IAAQ,OAAO,GAAO,WAAW,GAAG,GAAG,EAAM;AAM1D,QAJK,IAKH,kBAAC,KAAD;EAAG,aAAU;EAAe,IAAI;EAAe,WAAW,EAAG,4BAA4B,EAAU;EAAE,GAAI;YACtG;EACC,CAAA,GANG"}
1
+ {"version":3,"file":"form.js","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { Children, cloneElement, createContext, isValidElement, useContext, useId, useMemo } from 'react';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ children }: { children: React.ReactNode }) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n const child = Children.only(children);\n\n if (!isValidElement<Record<string, unknown>>(child)) {\n return <>{children}</>;\n }\n\n return cloneElement(child, {\n 'data-slot': 'form-control',\n id: formItemId,\n 'aria-describedby': !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`,\n 'aria-invalid': !!error,\n });\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":";;;;;;;AAgBA,IAAM,IAAO,GASP,IAAmB,EAAqC,EAAE,CAA0B,EAMpF,IAAkB,EAAoC,EAAE,CAAyB,EAEjF,KAGJ,EACA,GAAG,QACuC;CAC1C,IAAM,IAAQ,SAAe,EAAE,MAAM,EAAM,MAAM,GAAG,CAAC,EAAM,KAAK,CAAC;AAEjE,QACE,kBAAC,EAAiB,UAAlB;EAAkC;YAChC,kBAAC,GAAD,EAAY,GAAI,GAAS,CAAA;EACC,CAAA;GAI1B,UAAqB;CACzB,IAAM,IAAe,EAAW,EAAiB,EAC3C,IAAc,EAAW,EAAgB,EACzC,EAAE,qBAAkB,GAAgB,EACpC,IAAY,EAAa,EAAE,MAAM,EAAa,MAAM,CAAC,EACrD,IAAa,EAAc,EAAa,MAAM,EAAU;AAE9D,KAAI,CAAC,EACH,OAAU,MAAM,iDAAiD;CAGnE,IAAM,EAAE,UAAO;AAEf,QAAO;EACL;EACA,MAAM,EAAa;EACnB,YAAY,GAAG,EAAG;EAClB,mBAAmB,GAAG,EAAG;EACzB,eAAe,GAAG,EAAG;EACrB,GAAG;EACJ;;AAGH,SAAS,EAAS,EAAE,cAAW,GAAG,KAAsC;CACtE,IAAM,IAAK,GAAO,EACZ,IAAQ,SAAe,EAAE,OAAI,GAAG,CAAC,EAAG,CAAC;AAE3C,QACE,kBAAC,EAAgB,UAAjB;EAAiC;YAC/B,kBAAC,OAAD;GAAK,aAAU;GAAY,WAAW,EAAG,cAAc,EAAU;GAAE,GAAI;GAAS,CAAA;EACvD,CAAA;;AAI/B,SAAS,EAAU,EAAE,cAAW,GAAG,KAA6C;CAC9E,IAAM,EAAE,UAAO,kBAAe,GAAc;AAE5C,QACE,kBAAC,GAAD;EACE,aAAU;EACV,cAAY,CAAC,CAAC;EACd,WAAW,EAAG,sCAAsC,EAAU;EAC9D,SAAS;EACT,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,eAA2C;CAChE,IAAM,EAAE,UAAO,eAAY,sBAAmB,qBAAkB,GAAc,EACxE,IAAQ,EAAS,KAAK,EAAS;AAMrC,QAJK,EAAwC,EAAM,GAI5C,EAAa,GAAO;EACzB,aAAa;EACb,IAAI;EACJ,oBAAqB,IAA4B,GAAG,EAAkB,GAAG,MAA5C;EAC7B,gBAAgB,CAAC,CAAC;EACnB,CAAC,GARO,kBAAA,GAAA,EAAG,aAAY,CAAA;;AAW1B,SAAS,EAAgB,EAAE,cAAW,GAAG,KAAoC;CAC3E,IAAM,EAAE,yBAAsB,GAAc;AAE5C,QACE,kBAAC,KAAD;EACE,aAAU;EACV,IAAI;EACJ,WAAW,EAAG,iCAAiC,EAAU;EACzD,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,cAAW,GAAG,KAAoC;CACvE,IAAM,EAAE,UAAO,qBAAkB,GAAc,EACzC,IAAO,IAAQ,OAAO,GAAO,WAAW,GAAG,GAAG,EAAM;AAM1D,QAJK,IAKH,kBAAC,KAAD;EAAG,aAAU;EAAe,IAAI;EAAe,WAAW,EAAG,4BAA4B,EAAU;EAAE,GAAI;YACtG;EACC,CAAA,GANG"}
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../lib/utils.cjs`);let n=require(`react/jsx-runtime`),r=require(`@radix-ui/react-label`);r=e.__toESM(r,1);function i({className:e,...i}){return(0,n.jsx)(r.Root,{"data-slot":`label`,className:t.cn(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...i})}exports.Label=i;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`);function n({className:n,...r}){return(0,t.jsx)(`label`,{"data-slot":`label`,className:e.cn(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,n),...r})}exports.Label=n;
2
2
  //# sourceMappingURL=label.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"label.cjs","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":"0PAMA,SAAS,EAAM,CAAE,YAAW,GAAG,GAA2D,CACxF,OACE,EAAA,EAAA,KAAC,EAAe,KAAhB,CACE,YAAU,QACV,UAAW,EAAA,GACT,sNACA,EACD,CACD,GAAI,EACJ,CAAA"}
1
+ {"version":3,"file":"label.cjs","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<'label'>) {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":"oMAIA,SAAS,EAAM,CAAE,YAAW,GAAG,GAAwC,CACrE,OAEE,EAAA,EAAA,KAAC,QAAD,CACE,YAAU,QACV,UAAW,EAAA,GACT,sNACA,EACD,CACD,GAAI,EACJ,CAAA"}
@@ -1,3 +1,2 @@
1
- import * as LabelPrimitive from '@radix-ui/react-label';
2
- declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
1
+ declare function Label({ className, ...props }: React.ComponentProps<'label'>): import("react/jsx-runtime").JSX.Element;
3
2
  export { Label };
@@ -1,16 +1,15 @@
1
1
  "use client";
2
2
  import { cn as e } from "../lib/utils.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
- import * as n from "@radix-ui/react-label";
5
4
  //#region src/elements/label.tsx
6
- function r({ className: r, ...i }) {
7
- return /* @__PURE__ */ t(n.Root, {
5
+ function n({ className: n, ...r }) {
6
+ return /* @__PURE__ */ t("label", {
8
7
  "data-slot": "label",
9
- className: e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", r),
10
- ...i
8
+ className: e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", n),
9
+ ...r
11
10
  });
12
11
  }
13
12
  //#endregion
14
- export { r as Label };
13
+ export { n as Label };
15
14
 
16
15
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":";;;;;AAMA,SAAS,EAAM,EAAE,cAAW,GAAG,KAA2D;AACxF,QACE,kBAAC,EAAe,MAAhB;EACE,aAAU;EACV,WAAW,EACT,uNACA,EACD;EACD,GAAI;EACJ,CAAA"}
1
+ {"version":3,"file":"label.js","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<'label'>) {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":";;;;AAIA,SAAS,EAAM,EAAE,cAAW,GAAG,KAAwC;AACrE,QAEE,kBAAC,SAAD;EACE,aAAU;EACV,WAAW,EACT,uNACA,EACD;EACD,GAAI;EACJ,CAAA"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`class-variance-authority`),r=require(`@radix-ui/react-slot`);var i=(0,n.cva)(`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer`,{variants:{variant:{default:``,external:``}},defaultVariants:{variant:`default`}}),a=null;function o(e){a=e}function s(){return a}function c({className:n,variant:a,asChild:o=!1,...s}){return(0,t.jsx)(o?r.Slot:`a`,{"data-slot":`link`,className:e.cn(i({variant:a,className:n})),...a===`external`&&!o?{target:`_blank`,rel:`noopener noreferrer`}:{},...s})}function l({className:n,variant:r,...o}){let s=a||`a`;return(0,t.jsx)(s,{"data-slot":`link`,className:e.cn(i({variant:r,className:n})),...r===`external`&&s===`a`?{target:`_blank`,rel:`noopener noreferrer`}:{},...o})}exports.Link=c,exports.RouterLink=l,exports.getLinkComponent=s,exports.linkStyles=i,exports.setLinkComponent=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`class-variance-authority`),r=require(`@base-ui/react/use-render`);var i=(0,n.cva)(`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer`,{variants:{variant:{default:``,external:``}},defaultVariants:{variant:`default`}}),a=null;function o(e){a=e}function s(){return a}function c({className:t,variant:n,render:a,...o}){let s=n===`external`&&!a?{target:`_blank`,rel:`noopener noreferrer`}:{};return(0,r.useRender)({render:a,defaultTagName:`a`,props:{"data-slot":`link`,className:e.cn(i({variant:n,className:t})),...s,...o}})}function l({className:n,variant:r,...o}){let s=a||`a`;return(0,t.jsx)(s,{"data-slot":`link`,className:e.cn(i({variant:r,className:n})),...r===`external`&&s===`a`?{target:`_blank`,rel:`noopener noreferrer`}:{},...o})}exports.Link=c,exports.RouterLink=l,exports.getLinkComponent=s,exports.linkStyles=i,exports.setLinkComponent=o;
2
2
  //# sourceMappingURL=link.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.cjs","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n asChild?: boolean;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `asChild` via Radix UI Slot for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.asChild - render as child element via Radix Slot\n */\nfunction Link({ className, variant, asChild = false, ...props }: LinkProps) {\n const Comp = asChild ? Slot : 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && !asChild ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'asChild'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":"+PAKA,IAAM,GAAA,EAAA,EAAA,KACJ,8LACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,GACT,SAAU,GACX,CACF,CACD,gBAAiB,CACf,QAAS,UACV,CACF,CACF,CAMG,EAAgD,KAUpD,SAAS,EAAiB,EAA0B,CAClD,EAA0B,EAM5B,SAAS,GAAyC,CAChD,OAAO,EAgBT,SAAS,EAAK,CAAE,YAAW,UAAS,UAAU,GAAO,GAAG,GAAoB,CAG1E,OACE,EAAA,EAAA,KAHW,EAAU,EAAA,KAAO,IAG5B,CACE,YAAU,OACV,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAK,IAAY,YAAc,CAAC,EAAU,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CAC/F,GAAI,EACJ,CAAA,CAmBN,SAAS,EAAW,CAAE,YAAW,UAAS,GAAG,GAA0B,CACrE,IAAM,EAAO,GAA2B,IAExC,OACE,EAAA,EAAA,KAAC,EAAD,CACE,YAAU,OACV,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAK,IAAY,YAAc,IAAS,IAAM,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CACnG,GAAI,EACJ,CAAA"}
1
+ {"version":3,"file":"link.cjs","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n render?: useRender.RenderProp;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `render` for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.render - render as a different element (e.g. `render={<RouterLink to=\"...\" />}`)\n */\nfunction Link({ className, variant, render, ...props }: LinkProps) {\n const externalProps = variant === 'external' && !render ? { target: '_blank', rel: 'noopener noreferrer' } : {};\n\n return useRender({\n render,\n defaultTagName: 'a',\n props: {\n 'data-slot': 'link',\n className: cn(linkStyles({ variant, className })),\n ...externalProps,\n ...props,\n },\n });\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":"oQAKA,IAAM,GAAA,EAAA,EAAA,KACJ,8LACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,GACT,SAAU,GACX,CACF,CACD,gBAAiB,CACf,QAAS,UACV,CACF,CACF,CAMG,EAAgD,KAUpD,SAAS,EAAiB,EAA0B,CAClD,EAA0B,EAM5B,SAAS,GAAyC,CAChD,OAAO,EAgBT,SAAS,EAAK,CAAE,YAAW,UAAS,SAAQ,GAAG,GAAoB,CACjE,IAAM,EAAgB,IAAY,YAAc,CAAC,EAAS,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CAE/G,OAAA,EAAA,EAAA,WAAiB,CACf,SACA,eAAgB,IAChB,MAAO,CACL,YAAa,OACb,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAG,EACH,GAAG,EACJ,CACF,CAAC,CAkBJ,SAAS,EAAW,CAAE,YAAW,UAAS,GAAG,GAA0B,CACrE,IAAM,EAAO,GAA2B,IAExC,OACE,EAAA,EAAA,KAAC,EAAD,CACE,YAAU,OACV,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAK,IAAY,YAAc,IAAS,IAAM,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CACnG,GAAI,EACJ,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { useRender } from '@base-ui/react/use-render';
1
2
  import { type VariantProps } from 'class-variance-authority';
2
3
  declare const linkStyles: (props?: ({
3
4
  variant?: "default" | "external" | null | undefined;
@@ -18,18 +19,18 @@ declare function setLinkComponent(component: LinkComponent): void;
18
19
  */
19
20
  declare function getLinkComponent(): LinkComponent | null;
20
21
  type LinkProps = React.ComponentProps<'a'> & LinkVariantProps & {
21
- asChild?: boolean;
22
+ render?: useRender.RenderProp;
22
23
  };
23
24
  /**
24
25
  * `Link` renders a styled anchor element.
25
26
  *
26
- * Supports `asChild` via Radix UI Slot for composition with custom components.
27
+ * Supports `render` for composition with custom components.
27
28
  *
28
29
  * @param props.variant - "default" | "external" (adds target="_blank" and rel="noopener noreferrer")
29
- * @param props.asChild - render as child element via Radix Slot
30
+ * @param props.render - render as a different element (e.g. `render={<RouterLink to="..." />}`)
30
31
  */
31
- declare function Link({ className, variant, asChild, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
32
- type RouterLinkProps = Omit<LinkProps, 'asChild'> & Record<string, unknown>;
32
+ declare function Link({ className, variant, render, ...props }: LinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
33
+ type RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;
33
34
  /**
34
35
  * `RouterLink` renders using the component set via `setLinkComponent()`,
35
36
  * falling back to a plain `<a>` tag if none has been configured.
@@ -1,7 +1,7 @@
1
1
  import { cn as e } from "../lib/utils.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  import { cva as n } from "class-variance-authority";
4
- import { Slot as r } from "@radix-ui/react-slot";
4
+ import { useRender as r } from "@base-ui/react/use-render";
5
5
  //#region src/elements/link.tsx
6
6
  var i = n("inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer", {
7
7
  variants: { variant: {
@@ -16,18 +16,23 @@ function o(e) {
16
16
  function s() {
17
17
  return a;
18
18
  }
19
- function c({ className: n, variant: a, asChild: o = !1, ...s }) {
20
- return /* @__PURE__ */ t(o ? r : "a", {
21
- "data-slot": "link",
22
- className: e(i({
23
- variant: a,
24
- className: n
25
- })),
26
- ...a === "external" && !o ? {
27
- target: "_blank",
28
- rel: "noopener noreferrer"
29
- } : {},
30
- ...s
19
+ function c({ className: t, variant: n, render: a, ...o }) {
20
+ let s = n === "external" && !a ? {
21
+ target: "_blank",
22
+ rel: "noopener noreferrer"
23
+ } : {};
24
+ return r({
25
+ render: a,
26
+ defaultTagName: "a",
27
+ props: {
28
+ "data-slot": "link",
29
+ className: e(i({
30
+ variant: n,
31
+ className: t
32
+ })),
33
+ ...s,
34
+ ...o
35
+ }
31
36
  });
32
37
  }
33
38
  function l({ className: n, variant: r, ...o }) {
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n asChild?: boolean;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `asChild` via Radix UI Slot for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.asChild - render as child element via Radix Slot\n */\nfunction Link({ className, variant, asChild = false, ...props }: LinkProps) {\n const Comp = asChild ? Slot : 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && !asChild ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'asChild'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":";;;;;AAKA,IAAM,IAAa,EACjB,+LACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EACT,UAAU;EACX,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF,EAMG,IAAgD;AAUpD,SAAS,EAAiB,GAA0B;AAClD,KAA0B;;AAM5B,SAAS,IAAyC;AAChD,QAAO;;AAgBT,SAAS,EAAK,EAAE,cAAW,YAAS,aAAU,IAAO,GAAG,KAAoB;AAG1E,QACE,kBAHW,IAAU,IAAO,KAG5B;EACE,aAAU;EACV,WAAW,EAAG,EAAW;GAAE;GAAS;GAAW,CAAC,CAAC;EACjD,GAAK,MAAY,cAAc,CAAC,IAAU;GAAE,QAAQ;GAAU,KAAK;GAAuB,GAAG,EAAE;EAC/F,GAAI;EACJ,CAAA;;AAmBN,SAAS,EAAW,EAAE,cAAW,YAAS,GAAG,KAA0B;CACrE,IAAM,IAAO,KAA2B;AAExC,QACE,kBAAC,GAAD;EACE,aAAU;EACV,WAAW,EAAG,EAAW;GAAE;GAAS;GAAW,CAAC,CAAC;EACjD,GAAK,MAAY,cAAc,MAAS,MAAM;GAAE,QAAQ;GAAU,KAAK;GAAuB,GAAG,EAAE;EACnG,GAAI;EACJ,CAAA"}
1
+ {"version":3,"file":"link.js","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n render?: useRender.RenderProp;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `render` for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.render - render as a different element (e.g. `render={<RouterLink to=\"...\" />}`)\n */\nfunction Link({ className, variant, render, ...props }: LinkProps) {\n const externalProps = variant === 'external' && !render ? { target: '_blank', rel: 'noopener noreferrer' } : {};\n\n return useRender({\n render,\n defaultTagName: 'a',\n props: {\n 'data-slot': 'link',\n className: cn(linkStyles({ variant, className })),\n ...externalProps,\n ...props,\n },\n });\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":";;;;;AAKA,IAAM,IAAa,EACjB,+LACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EACT,UAAU;EACX,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF,EAMG,IAAgD;AAUpD,SAAS,EAAiB,GAA0B;AAClD,KAA0B;;AAM5B,SAAS,IAAyC;AAChD,QAAO;;AAgBT,SAAS,EAAK,EAAE,cAAW,YAAS,WAAQ,GAAG,KAAoB;CACjE,IAAM,IAAgB,MAAY,cAAc,CAAC,IAAS;EAAE,QAAQ;EAAU,KAAK;EAAuB,GAAG,EAAE;AAE/G,QAAO,EAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GACL,aAAa;GACb,WAAW,EAAG,EAAW;IAAE;IAAS;IAAW,CAAC,CAAC;GACjD,GAAG;GACH,GAAG;GACJ;EACF,CAAC;;AAkBJ,SAAS,EAAW,EAAE,cAAW,YAAS,GAAG,KAA0B;CACrE,IAAM,IAAO,KAA2B;AAExC,QACE,kBAAC,GAAD;EACE,aAAU;EACV,WAAW,EAAG,EAAW;GAAE;GAAS;GAAW,CAAC,CAAC;EACjD,GAAK,MAAY,cAAc,MAAS,MAAM;GAAE,QAAQ;GAAU,KAAK;GAAuB,GAAG,EAAE;EACnG,GAAI;EACJ,CAAA"}
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../lib/utils.cjs`);let n=require(`react/jsx-runtime`),r=require(`@radix-ui/react-popover`);r=e.__toESM(r,1);function i({...e}){return(0,n.jsx)(r.Root,{"data-slot":`popover`,...e})}function a({...e}){return(0,n.jsx)(r.Trigger,{"data-slot":`popover-trigger`,...e})}function o({className:e,align:i=`center`,sideOffset:a=4,...o}){return(0,n.jsx)(r.Portal,{children:(0,n.jsx)(r.Content,{"data-slot":`popover-content`,align:i,sideOffset:a,className:t.cn(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...o})})}function s({...e}){return(0,n.jsx)(r.Anchor,{"data-slot":`popover-anchor`,...e})}var c=r.Close;exports.Popover=i,exports.PopoverAnchor=s,exports.PopoverClose=c,exports.PopoverContent=o,exports.PopoverTrigger=a;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`@base-ui/react/popover`);function r({...e}){return(0,t.jsx)(n.Popover.Root,{...e})}function i({...e}){return(0,t.jsx)(n.Popover.Trigger,{"data-slot":`popover-trigger`,...e})}function a({className:r,align:i=`center`,side:a,sideOffset:o=4,...s}){return(0,t.jsx)(n.Popover.Portal,{children:(0,t.jsx)(n.Popover.Positioner,{align:i,side:a,sideOffset:o,children:(0,t.jsx)(n.Popover.Popup,{"data-slot":`popover-content`,className:e.cn(`bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden`,r),...s})})})}var o=n.Popover.Close;exports.Popover=r,exports.PopoverClose=o,exports.PopoverContent=a,exports.PopoverTrigger=i;
2
2
  //# sourceMappingURL=popover.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.cjs","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":"4PAMA,SAAS,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAAA,EAAA,KAAC,EAAiB,KAAlB,CAAuB,YAAU,UAAU,GAAI,EAAS,CAAA,CAGjE,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAAA,EAAA,KAAC,EAAiB,QAAlB,CAA0B,YAAU,kBAAkB,GAAI,EAAS,CAAA,CAG5E,SAAS,EAAe,CACtB,YACA,QAAQ,SACR,aAAa,EACb,GAAG,GACqD,CACxD,OACE,EAAA,EAAA,KAAC,EAAiB,OAAlB,CAAA,UACE,EAAA,EAAA,KAAC,EAAiB,QAAlB,CACE,YAAU,kBACH,QACK,aACZ,UAAW,EAAA,GACT,ieACA,EACD,CACD,GAAI,EACJ,CAAA,CACsB,CAAA,CAI9B,SAAS,EAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAAA,EAAA,KAAC,EAAiB,OAAlB,CAAyB,YAAU,iBAAiB,GAAI,EAAS,CAAA,CAG1E,IAAM,EAAe,EAAiB"}
1
+ {"version":3,"file":"popover.cjs","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n side,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];\n side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];\n sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];\n}) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner align={align} side={side} sideOffset={sideOffset}>\n <PopoverPrimitive.Popup\n data-slot=\"popover-content\"\n className={cn(\n 'bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":"wOAMA,SAAS,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAG7C,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,QAAlB,CAA0B,YAAU,kBAAkB,GAAI,EAAS,CAAA,CAG5E,SAAS,EAAe,CACtB,YACA,QAAQ,SACR,OACA,aAAa,EACb,GAAG,GAKF,CACD,OACE,EAAA,EAAA,KAAC,EAAA,QAAiB,OAAlB,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,QAAiB,WAAlB,CAAoC,QAAa,OAAkB,uBACjE,EAAA,EAAA,KAAC,EAAA,QAAiB,MAAlB,CACE,YAAU,kBACV,UAAW,EAAA,GACT,uaACA,EACD,CACD,GAAI,EACJ,CAAA,CAC0B,CAAA,CACN,CAAA,CAI9B,IAAM,EAAe,EAAA,QAAiB"}
@@ -1,7 +1,10 @@
1
- import * as PopoverPrimitive from '@radix-ui/react-popover';
1
+ import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
2
2
  declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
3
3
  declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
4
- declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
5
- declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
6
- declare const PopoverClose: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
7
- export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger };
4
+ declare function PopoverContent({ className, align, side, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Popup> & {
5
+ align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];
6
+ side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];
7
+ sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ declare const PopoverClose: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
10
+ export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -1,13 +1,10 @@
1
1
  "use client";
2
2
  import { cn as e } from "../lib/utils.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
- import * as n from "@radix-ui/react-popover";
4
+ import { Popover as n } from "@base-ui/react/popover";
5
5
  //#region src/elements/popover.tsx
6
6
  function r({ ...e }) {
7
- return /* @__PURE__ */ t(n.Root, {
8
- "data-slot": "popover",
9
- ...e
10
- });
7
+ return /* @__PURE__ */ t(n.Root, { ...e });
11
8
  }
12
9
  function i({ ...e }) {
13
10
  return /* @__PURE__ */ t(n.Trigger, {
@@ -15,23 +12,20 @@ function i({ ...e }) {
15
12
  ...e
16
13
  });
17
14
  }
18
- function a({ className: r, align: i = "center", sideOffset: a = 4, ...o }) {
19
- return /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.Content, {
20
- "data-slot": "popover-content",
15
+ function a({ className: r, align: i = "center", side: a, sideOffset: o = 4, ...s }) {
16
+ return /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.Positioner, {
21
17
  align: i,
22
- sideOffset: a,
23
- className: e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", r),
24
- ...o
18
+ side: a,
19
+ sideOffset: o,
20
+ children: /* @__PURE__ */ t(n.Popup, {
21
+ "data-slot": "popover-content",
22
+ className: e("bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden", r),
23
+ ...s
24
+ })
25
25
  }) });
26
26
  }
27
- function o({ ...e }) {
28
- return /* @__PURE__ */ t(n.Anchor, {
29
- "data-slot": "popover-anchor",
30
- ...e
31
- });
32
- }
33
- var s = n.Close;
27
+ var o = n.Close;
34
28
  //#endregion
35
- export { r as Popover, o as PopoverAnchor, s as PopoverClose, a as PopoverContent, i as PopoverTrigger };
29
+ export { r as Popover, o as PopoverClose, a as PopoverContent, i as PopoverTrigger };
36
30
 
37
31
  //# sourceMappingURL=popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":";;;;;AAMA,SAAS,EAAQ,EAAE,GAAG,KAA6D;AACjF,QAAO,kBAAC,EAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;EAAS,CAAA;;AAGjE,SAAS,EAAe,EAAE,GAAG,KAAgE;AAC3F,QAAO,kBAAC,EAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;EAAS,CAAA;;AAG5E,SAAS,EAAe,EACtB,cACA,WAAQ,UACR,gBAAa,GACb,GAAG,KACqD;AACxD,QACE,kBAAC,EAAiB,QAAlB,EAAA,UACE,kBAAC,EAAiB,SAAlB;EACE,aAAU;EACH;EACK;EACZ,WAAW,EACT,keACA,EACD;EACD,GAAI;EACJ,CAAA,EACsB,CAAA;;AAI9B,SAAS,EAAc,EAAE,GAAG,KAA+D;AACzF,QAAO,kBAAC,EAAiB,QAAlB;EAAyB,aAAU;EAAiB,GAAI;EAAS,CAAA;;AAG1E,IAAM,IAAe,EAAiB"}
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n side,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];\n side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];\n sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];\n}) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner align={align} side={side} sideOffset={sideOffset}>\n <PopoverPrimitive.Popup\n data-slot=\"popover-content\"\n className={cn(\n 'bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":";;;;;AAMA,SAAS,EAAQ,EAAE,GAAG,KAA6D;AACjF,QAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,GAAS,CAAA;;AAG7C,SAAS,EAAe,EAAE,GAAG,KAAgE;AAC3F,QAAO,kBAAC,EAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;EAAS,CAAA;;AAG5E,SAAS,EAAe,EACtB,cACA,WAAQ,UACR,SACA,gBAAa,GACb,GAAG,KAKF;AACD,QACE,kBAAC,EAAiB,QAAlB,EAAA,UACE,kBAAC,EAAiB,YAAlB;EAAoC;EAAa;EAAkB;YACjE,kBAAC,EAAiB,OAAlB;GACE,aAAU;GACV,WAAW,EACT,waACA,EACD;GACD,GAAI;GACJ,CAAA;EAC0B,CAAA,EACN,CAAA;;AAI9B,IAAM,IAAe,EAAiB"}
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../lib/utils.cjs`);let n=require(`react/jsx-runtime`),r=require(`lucide-react`),i=require(`@radix-ui/react-select`);i=e.__toESM(i,1);function a({...e}){return(0,n.jsx)(i.Root,{"data-slot":`select`,...e})}function o({...e}){return(0,n.jsx)(i.Group,{"data-slot":`select-group`,...e})}function s({...e}){return(0,n.jsx)(i.Value,{"data-slot":`select-value`,...e})}function c({className:e,size:a=`default`,children:o,asChild:s=!1,...c}){return s?(0,n.jsx)(i.Trigger,{...c,asChild:!0,children:o}):(0,n.jsxs)(i.Trigger,{"data-slot":`select-trigger`,"data-size":a,className:t.cn(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...c,children:[o,(0,n.jsx)(i.Icon,{asChild:!0,children:(0,n.jsx)(r.ChevronDownIcon,{className:`size-4 opacity-50`})})]})}function l({className:e,...a}){return(0,n.jsx)(i.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:t.cn(`flex cursor-default items-center justify-center py-1`,e),...a,children:(0,n.jsx)(r.ChevronUpIcon,{className:`size-4`})})}function u({className:e,...a}){return(0,n.jsx)(i.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:t.cn(`flex cursor-default items-center justify-center py-1`,e),...a,children:(0,n.jsx)(r.ChevronDownIcon,{className:`size-4`})})}function d({className:e,children:r,position:a=`popper`,...o}){return(0,n.jsx)(i.Portal,{children:(0,n.jsxs)(i.Content,{"data-slot":`select-content`,className:t.cn(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md`,a===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:a,...o,children:[(0,n.jsx)(l,{}),(0,n.jsx)(i.Viewport,{className:t.cn(`p-1`,a===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:r}),(0,n.jsx)(u,{})]})})}function f({className:e,...r}){return(0,n.jsx)(i.Label,{"data-slot":`select-label`,className:t.cn(`text-muted-foreground px-2 py-1.5 text-xs`,e),...r})}function p({className:e,children:a,...o}){return(0,n.jsxs)(i.Item,{"data-slot":`select-item`,className:t.cn(`focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...o,children:[(0,n.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,n.jsx)(i.ItemIndicator,{children:(0,n.jsx)(r.CheckIcon,{className:`size-4`})})}),(0,n.jsx)(i.ItemText,{children:a})]})}function m({className:e,...r}){return(0,n.jsx)(i.Separator,{"data-slot":`select-separator`,className:t.cn(`bg-border pointer-events-none -mx-1 my-1 h-px`,e),...r})}exports.Select=a,exports.SelectContent=d,exports.SelectGroup=o,exports.SelectItem=p,exports.SelectLabel=f,exports.SelectScrollDownButton=u,exports.SelectScrollUpButton=l,exports.SelectSeparator=m,exports.SelectTrigger=c,exports.SelectValue=s;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`lucide-react`),r=require(`@base-ui/react/select`);function i({...e}){return(0,t.jsx)(r.Select.Root,{...e})}function a({...e}){return(0,t.jsx)(r.Select.Group,{"data-slot":`select-group`,...e})}function o({placeholder:e,...n}){return(0,t.jsx)(r.Select.Value,{"data-slot":`select-value`,...n,children:t=>t==null||t===``?e:String(t)})}function s({className:i,size:a=`default`,children:o,...s}){return(0,t.jsxs)(r.Select.Trigger,{"data-slot":`select-trigger`,"data-size":a,className:e.cn(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),...s,children:[o,(0,t.jsx)(r.Select.Icon,{render:(0,t.jsx)(n.ChevronDownIcon,{className:`size-4 opacity-50`})})]})}function c({className:i,...a}){return(0,t.jsx)(r.Select.ScrollUpArrow,{"data-slot":`select-scroll-up-button`,className:e.cn(`flex cursor-default items-center justify-center py-1`,i),...a,children:(0,t.jsx)(n.ChevronUpIcon,{className:`size-4`})})}function l({className:i,...a}){return(0,t.jsx)(r.Select.ScrollDownArrow,{"data-slot":`select-scroll-down-button`,className:e.cn(`flex cursor-default items-center justify-center py-1`,i),...a,children:(0,t.jsx)(n.ChevronDownIcon,{className:`size-4`})})}function u({className:n,children:i,side:a,align:o,...s}){return(0,t.jsx)(r.Select.Portal,{children:(0,t.jsx)(r.Select.Positioner,{side:a,align:o,children:(0,t.jsxs)(r.Select.Popup,{"data-slot":`select-content`,className:e.cn(`bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md`,n),...s,children:[(0,t.jsx)(c,{}),(0,t.jsx)(r.Select.List,{className:`p-1`,children:i}),(0,t.jsx)(l,{})]})})})}function d({className:n,...i}){return(0,t.jsx)(r.Select.GroupLabel,{"data-slot":`select-label`,className:e.cn(`text-muted-foreground px-2 py-1.5 text-xs`,n),...i})}function f({className:i,children:a,...o}){return(0,t.jsxs)(r.Select.Item,{"data-slot":`select-item`,className:e.cn(`data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,i),...o,children:[(0,t.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,t.jsx)(r.Select.ItemIndicator,{children:(0,t.jsx)(n.CheckIcon,{className:`size-4`})})}),(0,t.jsx)(r.Select.ItemText,{children:a})]})}function p({className:n,...r}){return(0,t.jsx)(`div`,{role:`separator`,"data-slot":`select-separator`,className:e.cn(`bg-border pointer-events-none -mx-1 my-1 h-px`,n),...r})}exports.Select=i,exports.SelectContent=u,exports.SelectGroup=a,exports.SelectItem=f,exports.SelectLabel=d,exports.SelectScrollDownButton=l,exports.SelectScrollUpButton=c,exports.SelectSeparator=p,exports.SelectTrigger=s,exports.SelectValue=o;
2
2
  //# sourceMappingURL=select.cjs.map