@codefast/ui 0.0.60 → 0.0.61

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 (133) hide show
  1. package/dist/{chunk-FJH7XRCZ.mjs → chunk-3WHWDZWS.mjs} +2 -2
  2. package/dist/{chunk-FJH7XRCZ.mjs.map → chunk-3WHWDZWS.mjs.map} +1 -1
  3. package/dist/{chunk-BM5KYF6Y.mjs → chunk-4WTCCXNP.mjs} +2 -2
  4. package/dist/{chunk-BM5KYF6Y.mjs.map → chunk-4WTCCXNP.mjs.map} +1 -1
  5. package/dist/{chunk-RHFF4JNH.js → chunk-63XEM5BB.js} +2 -2
  6. package/dist/{chunk-RHFF4JNH.js.map → chunk-63XEM5BB.js.map} +1 -1
  7. package/dist/{chunk-P2RMYMNK.js → chunk-CSTPYAEI.js} +2 -2
  8. package/dist/chunk-CSTPYAEI.js.map +1 -0
  9. package/dist/{chunk-I7YJNEPR.js → chunk-ITKVRO7K.js} +2 -2
  10. package/dist/{chunk-I7YJNEPR.js.map → chunk-ITKVRO7K.js.map} +1 -1
  11. package/dist/{chunk-QXZKUXR2.mjs → chunk-RIB4B73V.mjs} +2 -2
  12. package/dist/{chunk-QXZKUXR2.mjs.map → chunk-RIB4B73V.mjs.map} +1 -1
  13. package/dist/react/alert-dialog.js +1 -1
  14. package/dist/react/alert-dialog.mjs +1 -1
  15. package/dist/react/alert.js +1 -1
  16. package/dist/react/alert.js.map +1 -1
  17. package/dist/react/alert.mjs +1 -1
  18. package/dist/react/alert.mjs.map +1 -1
  19. package/dist/react/breadcrumb.js +1 -1
  20. package/dist/react/breadcrumb.js.map +1 -1
  21. package/dist/react/breadcrumb.mjs +1 -1
  22. package/dist/react/breadcrumb.mjs.map +1 -1
  23. package/dist/react/button.js +1 -1
  24. package/dist/react/button.mjs +1 -1
  25. package/dist/react/calendar.js +1 -1
  26. package/dist/react/calendar.js.map +1 -1
  27. package/dist/react/calendar.mjs +1 -1
  28. package/dist/react/calendar.mjs.map +1 -1
  29. package/dist/react/carousel.d.mts +1 -1
  30. package/dist/react/carousel.d.ts +1 -1
  31. package/dist/react/carousel.js +1 -1
  32. package/dist/react/carousel.js.map +1 -1
  33. package/dist/react/carousel.mjs +1 -1
  34. package/dist/react/carousel.mjs.map +1 -1
  35. package/dist/react/checkbox-cards.js +1 -1
  36. package/dist/react/checkbox-cards.mjs +1 -1
  37. package/dist/react/checkbox-group.js +1 -1
  38. package/dist/react/checkbox-group.mjs +1 -1
  39. package/dist/react/checkbox-group.primitive.d.mts +9 -9
  40. package/dist/react/checkbox-group.primitive.d.ts +9 -9
  41. package/dist/react/checkbox-group.primitive.js +1 -1
  42. package/dist/react/checkbox-group.primitive.mjs +1 -1
  43. package/dist/react/context-menu.js +1 -1
  44. package/dist/react/context-menu.js.map +1 -1
  45. package/dist/react/context-menu.mjs +1 -1
  46. package/dist/react/context-menu.mjs.map +1 -1
  47. package/dist/react/data-table.js +1 -1
  48. package/dist/react/data-table.js.map +1 -1
  49. package/dist/react/data-table.mjs +1 -1
  50. package/dist/react/data-table.mjs.map +1 -1
  51. package/dist/react/dropdown-menu.js +1 -1
  52. package/dist/react/dropdown-menu.mjs +1 -1
  53. package/dist/react/form.js +1 -1
  54. package/dist/react/form.js.map +1 -1
  55. package/dist/react/form.mjs +1 -1
  56. package/dist/react/form.mjs.map +1 -1
  57. package/dist/react/hover-card.js +1 -1
  58. package/dist/react/hover-card.js.map +1 -1
  59. package/dist/react/hover-card.mjs +1 -1
  60. package/dist/react/hover-card.mjs.map +1 -1
  61. package/dist/react/input-otp.js +1 -1
  62. package/dist/react/input-otp.js.map +1 -1
  63. package/dist/react/input-otp.mjs +1 -1
  64. package/dist/react/input-otp.mjs.map +1 -1
  65. package/dist/react/input.js +1 -1
  66. package/dist/react/input.js.map +1 -1
  67. package/dist/react/input.mjs +1 -1
  68. package/dist/react/input.mjs.map +1 -1
  69. package/dist/react/menubar.js +1 -1
  70. package/dist/react/menubar.js.map +1 -1
  71. package/dist/react/menubar.mjs +1 -1
  72. package/dist/react/menubar.mjs.map +1 -1
  73. package/dist/react/navigation-menu.js +1 -1
  74. package/dist/react/navigation-menu.js.map +1 -1
  75. package/dist/react/navigation-menu.mjs +1 -1
  76. package/dist/react/navigation-menu.mjs.map +1 -1
  77. package/dist/react/pagination.js +1 -1
  78. package/dist/react/pagination.js.map +1 -1
  79. package/dist/react/pagination.mjs +1 -1
  80. package/dist/react/pagination.mjs.map +1 -1
  81. package/dist/react/popover.js +1 -1
  82. package/dist/react/popover.js.map +1 -1
  83. package/dist/react/popover.mjs +1 -1
  84. package/dist/react/popover.mjs.map +1 -1
  85. package/dist/react/radio.js +1 -1
  86. package/dist/react/radio.js.map +1 -1
  87. package/dist/react/radio.mjs +1 -1
  88. package/dist/react/radio.mjs.map +1 -1
  89. package/dist/react/scroll-area.js +1 -1
  90. package/dist/react/scroll-area.js.map +1 -1
  91. package/dist/react/scroll-area.mjs +1 -1
  92. package/dist/react/scroll-area.mjs.map +1 -1
  93. package/dist/react/separator.js +1 -1
  94. package/dist/react/separator.js.map +1 -1
  95. package/dist/react/separator.mjs +1 -1
  96. package/dist/react/separator.mjs.map +1 -1
  97. package/dist/react/sonner.js +1 -1
  98. package/dist/react/sonner.js.map +1 -1
  99. package/dist/react/sonner.mjs +1 -1
  100. package/dist/react/sonner.mjs.map +1 -1
  101. package/dist/react/textarea.js +1 -1
  102. package/dist/react/textarea.js.map +1 -1
  103. package/dist/react/textarea.mjs +1 -1
  104. package/dist/react/textarea.mjs.map +1 -1
  105. package/dist/react/tooltip.js +1 -1
  106. package/dist/react/tooltip.js.map +1 -1
  107. package/dist/react/tooltip.mjs +1 -1
  108. package/dist/react/tooltip.mjs.map +1 -1
  109. package/package.json +9 -9
  110. package/src/react/alert.tsx +1 -1
  111. package/src/react/breadcrumb.tsx +4 -4
  112. package/src/react/button.tsx +1 -1
  113. package/src/react/calendar.tsx +1 -1
  114. package/src/react/carousel.tsx +17 -17
  115. package/src/react/checkbox-group.primitive.tsx +16 -16
  116. package/src/react/context-menu.tsx +1 -1
  117. package/src/react/data-table.tsx +13 -13
  118. package/src/react/dropdown-menu.tsx +2 -2
  119. package/src/react/form.tsx +3 -3
  120. package/src/react/hover-card.tsx +1 -1
  121. package/src/react/input-otp.tsx +1 -1
  122. package/src/react/input.tsx +1 -1
  123. package/src/react/menubar.tsx +2 -2
  124. package/src/react/navigation-menu.tsx +2 -2
  125. package/src/react/pagination.tsx +3 -3
  126. package/src/react/popover.tsx +1 -1
  127. package/src/react/radio.tsx +2 -2
  128. package/src/react/scroll-area.tsx +1 -1
  129. package/src/react/separator.tsx +1 -1
  130. package/src/react/sonner.tsx +1 -1
  131. package/src/react/textarea.tsx +1 -1
  132. package/src/react/tooltip.tsx +1 -1
  133. package/dist/chunk-P2RMYMNK.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/context-menu.tsx"],"names":["React","ContextMenuPrimitive","CheckIcon","ChevronRightIcon","DotFilledIcon","jsx","jsxs","ContextMenu","ContextMenuTrigger","ContextMenuGroup","ContextMenuSub","ContextMenuRadioGroup","ContextMenuSubTrigger","children","className","inset","props","ref","cn","ContextMenuSubContent","ContextMenuContent","ContextMenuItem","ContextMenuCheckboxItem","checked","ContextMenuRadioItem","ContextMenuLabel","ContextMenuSeparator","ContextMenuShortcut","ContextMenuArrow"],"mappings":"sDAEA,UAAYA,MAAW,QACvB,UAAYC,MAA0B,+BACtC,OAAS,aAAAC,EAAW,oBAAAC,EAAkB,iBAAAC,MAAqB,wBAkDvD,OAUE,OAAAC,EAVF,QAAAC,MAAA,oBA1CJ,IAAMC,EAAmC,OAOnCC,EAA0C,UAO1CC,EAAwC,QAOxCC,EAAsC,MAOtCC,EAA6C,aAY7CC,EAA8B,aAClC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IACzCX,EAAsB,aAArB,CACC,IAAKW,EACL,UAAWC,EACT,mNACAH,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IAAKW,EACL,UAAWC,EACT,uNACAJ,CACF,EACC,GAAGE,EAEJ,UAAAX,EAAC,QAAK,UAAU,4DACd,SAAAA,EAAsB,gBAArB,CACC,SAAAA,EAACD,EAAA,CAAc,UAAU,sBAAsB,EACjD,EACF,EACCS,GACH,CAEJ,EAEAW,EAAqB,YAAmC,YAAU,YAYlE,IAAMC,EAAyB,aAC7B,CAAC,CAAE,UAAAX,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAC/BZ,EAAsB,QAArB,CACC,IAAKY,EACL,UAAWC,EAAG,oDAAqDH,GAAS,OAAQD,CAAS,EAC5F,GAAGE,EACN,CAEJ,EAEAS,EAAiB,YAAmC,QAAM,YAS1D,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAAZ,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,YAArB,CAA+B,IAAKY,EAAK,UAAWC,EAAG,4BAA6BJ,CAAS,EAAI,GAAGE,EAAO,CAEhH,EAEAU,EAAqB,YAAmC,YAAU,YAQlE,SAASC,EAAoB,CAAE,UAAAb,EAAW,GAAGE,CAAM,EAAgD,CACjG,OAAOX,EAAC,QAAK,UAAWa,EAAG,wDAAyDJ,CAAS,EAAI,GAAGE,EAAO,CAC7G,CASA,IAAMY,EAAyB,aAC7B,CAAC,CAAE,UAAAd,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,QAArB,CAA2B,IAAKY,EAAK,UAAWC,EAAG,eAAgBJ,CAAS,EAAI,GAAGE,EAAO,CAE/F,EAEAY,EAAiB,YAAmC,QAAM","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from '@radix-ui/react-icons';\nimport { cn } from '../lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenu\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuProps = React.ComponentProps<typeof ContextMenuPrimitive.Root>;\nconst ContextMenu = ContextMenuPrimitive.Root;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuTriggerProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Trigger>;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Group>;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSub\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubProps = React.ComponentProps<typeof ContextMenuPrimitive.Sub>;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioGroup>;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\n\ninterface ContextMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<ContextMenuSubTriggerElement, ContextMenuSubTriggerProps>(\n ({ children, className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n ),\n);\n\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ntype ContextMenuSubContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>;\n\nconst ContextMenuSubContent = React.forwardRef<ContextMenuSubContentElement, ContextMenuSubContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ntype ContextMenuContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>;\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\n\ninterface ContextMenuItemProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n ),\n);\n\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuCheckboxItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>;\n\nconst ContextMenuCheckboxItem = React.forwardRef<ContextMenuCheckboxItemElement, ContextMenuCheckboxItemProps>(\n ({ children, className, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n ),\n);\n\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>;\n\nconst ContextMenuRadioItem = React.forwardRef<ContextMenuRadioItemElement, ContextMenuRadioItemProps>(\n ({ children, className, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"size-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n ),\n);\n\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuLabel\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\n\ninterface ContextMenuLabelProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n ),\n);\n\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSeparator\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ntype ContextMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>;\n\nconst ContextMenuSeparator = React.forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />\n ),\n);\n\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuShortcut\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement>;\n\nfunction ContextMenuShortcut({ className, ...props }: ContextMenuShortcutProps): React.JSX.Element {\n return <span className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuArrow\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuArrowElement = React.ElementRef<typeof ContextMenuPrimitive.Arrow>;\ntype ContextMenuArrowProps = ContextMenuPrimitive.ContextMenuArrowProps;\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Arrow ref={ref} className={cn('fill-popover', className)} {...props} />\n ),\n);\n\nContextMenuArrow.displayName = ContextMenuPrimitive.Arrow.displayName;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n ContextMenuArrow,\n type ContextMenuProps,\n type ContextMenuTriggerProps,\n type ContextMenuContentProps,\n type ContextMenuItemProps,\n type ContextMenuCheckboxItemProps,\n type ContextMenuRadioItemProps,\n type ContextMenuLabelProps,\n type ContextMenuSeparatorProps,\n type ContextMenuShortcutProps,\n type ContextMenuGroupProps,\n type ContextMenuSubProps,\n type ContextMenuSubContentProps,\n type ContextMenuSubTriggerProps,\n type ContextMenuRadioGroupProps,\n type ContextMenuArrowProps,\n};\n"]}
1
+ {"version":3,"sources":["../../src/react/context-menu.tsx"],"names":["React","ContextMenuPrimitive","CheckIcon","ChevronRightIcon","DotFilledIcon","jsx","jsxs","ContextMenu","ContextMenuTrigger","ContextMenuGroup","ContextMenuSub","ContextMenuRadioGroup","ContextMenuSubTrigger","children","className","inset","props","ref","cn","ContextMenuSubContent","ContextMenuContent","ContextMenuItem","ContextMenuCheckboxItem","checked","ContextMenuRadioItem","ContextMenuLabel","ContextMenuSeparator","ContextMenuShortcut","ContextMenuArrow"],"mappings":"sDAEA,UAAYA,MAAW,QACvB,UAAYC,MAA0B,+BACtC,OAAS,aAAAC,EAAW,oBAAAC,EAAkB,iBAAAC,MAAqB,wBAkDvD,OAUE,OAAAC,EAVF,QAAAC,MAAA,oBA1CJ,IAAMC,EAAmC,OAOnCC,EAA0C,UAO1CC,EAAwC,QAOxCC,EAAsC,MAOtCC,EAA6C,aAY7CC,EAA8B,aAClC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IACzC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EAAW,GAAGE,CAAM,EAAGC,IAClCX,EAAsB,YAArB,CACC,IAAKW,EACL,UAAWC,EACT,uNACAJ,CACF,EACC,GAAGE,EAEJ,UAAAX,EAAC,QAAK,UAAU,4DACd,SAAAA,EAAsB,gBAArB,CACC,SAAAA,EAACD,EAAA,CAAc,UAAU,sBAAsB,EACjD,EACF,EACCS,GACH,CAEJ,EAEAW,EAAqB,YAAmC,YAAU,YAYlE,IAAMC,EAAyB,aAC7B,CAAC,CAAE,UAAAX,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAC/BZ,EAAsB,QAArB,CACC,IAAKY,EACL,UAAWC,EAAG,oDAAqDH,GAAS,OAAQD,CAAS,EAC5F,GAAGE,EACN,CAEJ,EAEAS,EAAiB,YAAmC,QAAM,YAS1D,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAAZ,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,YAArB,CAA+B,IAAKY,EAAK,UAAWC,EAAG,4BAA6BJ,CAAS,EAAI,GAAGE,EAAO,CAEhH,EAEAU,EAAqB,YAAmC,YAAU,YAQlE,SAASC,EAAoB,CAAE,UAAAb,EAAW,GAAGE,CAAM,EAAgD,CACjG,OAAOX,EAAC,QAAK,UAAWa,EAAG,wDAAyDJ,CAAS,EAAI,GAAGE,EAAO,CAC7G,CASA,IAAMY,EAAyB,aAC7B,CAAC,CAAE,UAAAd,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,QAArB,CAA2B,IAAKY,EAAK,UAAWC,EAAG,eAAgBJ,CAAS,EAAI,GAAGE,EAAO,CAE/F,EAEAY,EAAiB,YAAmC,QAAM","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from '@radix-ui/react-icons';\nimport { cn } from '../lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenu\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuProps = React.ComponentProps<typeof ContextMenuPrimitive.Root>;\nconst ContextMenu = ContextMenuPrimitive.Root;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuTriggerProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Trigger>;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Group>;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSub\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubProps = React.ComponentProps<typeof ContextMenuPrimitive.Sub>;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioGroup>;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\n\ninterface ContextMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<ContextMenuSubTriggerElement, ContextMenuSubTriggerProps>(\n ({ children, className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n ),\n);\n\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ntype ContextMenuSubContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>;\n\nconst ContextMenuSubContent = React.forwardRef<ContextMenuSubContentElement, ContextMenuSubContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ntype ContextMenuContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>;\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\n\ninterface ContextMenuItemProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n ),\n);\n\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuCheckboxItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>;\n\nconst ContextMenuCheckboxItem = React.forwardRef<ContextMenuCheckboxItemElement, ContextMenuCheckboxItemProps>(\n ({ children, className, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n ),\n);\n\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>;\n\nconst ContextMenuRadioItem = React.forwardRef<ContextMenuRadioItemElement, ContextMenuRadioItemProps>(\n ({ children, className, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"size-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n ),\n);\n\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuLabel\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\n\ninterface ContextMenuLabelProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n ),\n);\n\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSeparator\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ntype ContextMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>;\n\nconst ContextMenuSeparator = React.forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />\n ),\n);\n\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuShortcut\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement>;\n\nfunction ContextMenuShortcut({ className, ...props }: ContextMenuShortcutProps): React.JSX.Element {\n return <span className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuArrow\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuArrowElement = React.ElementRef<typeof ContextMenuPrimitive.Arrow>;\ntype ContextMenuArrowProps = ContextMenuPrimitive.ContextMenuArrowProps;\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Arrow ref={ref} className={cn('fill-popover', className)} {...props} />\n ),\n);\n\nContextMenuArrow.displayName = ContextMenuPrimitive.Arrow.displayName;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n ContextMenuArrow,\n type ContextMenuProps,\n type ContextMenuTriggerProps,\n type ContextMenuContentProps,\n type ContextMenuItemProps,\n type ContextMenuCheckboxItemProps,\n type ContextMenuRadioItemProps,\n type ContextMenuLabelProps,\n type ContextMenuSeparatorProps,\n type ContextMenuShortcutProps,\n type ContextMenuGroupProps,\n type ContextMenuSubProps,\n type ContextMenuSubContentProps,\n type ContextMenuSubTriggerProps,\n type ContextMenuRadioGroupProps,\n type ContextMenuArrowProps,\n};\n"]}
@@ -1,2 +1,2 @@
1
- "use client";import{b as r}from"../chunk-LEUB3C3L.mjs";import*as a from"react";import*as e from"@radix-ui/react-context-menu";import{CheckIcon as m,ChevronRightIcon as C,DotFilledIcon as x}from"@radix-ui/react-icons";import{jsx as i,jsxs as p}from"react/jsx-runtime";var I=e.Root,S=e.Trigger,h=e.Group,N=e.Sub,E=e.RadioGroup,d=a.forwardRef(({children:t,className:o,inset:n,...s},u)=>p(e.SubTrigger,{ref:u,className:r("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none",n&&"pl-8",o),...s,children:[t,i(C,{className:"ml-auto size-4"})]}));d.displayName=e.SubTrigger.displayName;var c=a.forwardRef(({className:t,...o},n)=>i(e.Portal,{children:i(e.SubContent,{ref:n,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md",t),...o})}));c.displayName=e.SubContent.displayName;var l=a.forwardRef(({className:t,...o},n)=>i(e.Portal,{children:i(e.Content,{ref:n,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md",t),...o})}));l.displayName=e.Content.displayName;var M=a.forwardRef(({className:t,inset:o,...n},s)=>i(e.Item,{ref:s,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o&&"pl-8",t),...n}));M.displayName=e.Item.displayName;var f=a.forwardRef(({children:t,className:o,checked:n,...s},u)=>p(e.CheckboxItem,{ref:u,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o),checked:n,...s,children:[i("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:i(e.ItemIndicator,{children:i(m,{className:"size-4"})})}),t]}));f.displayName=e.CheckboxItem.displayName;var P=a.forwardRef(({children:t,className:o,...n},s)=>p(e.RadioItem,{ref:s,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o),...n,children:[i("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:i(e.ItemIndicator,{children:i(x,{className:"size-4 fill-current"})})}),t]}));P.displayName=e.RadioItem.displayName;var y=a.forwardRef(({className:t,inset:o,...n},s)=>i(e.Label,{ref:s,className:r("text-foreground px-2 py-1.5 text-sm font-semibold",o&&"pl-8",t),...n}));y.displayName=e.Label.displayName;var R=a.forwardRef(({className:t,...o},n)=>i(e.Separator,{ref:n,className:r("bg-border -mx-1 my-1 h-px",t),...o}));R.displayName=e.Separator.displayName;function w({className:t,...o}){return i("span",{className:r("text-muted-foreground ml-auto text-xs tracking-widest",t),...o})}var b=a.forwardRef(({className:t,...o},n)=>i(e.Arrow,{ref:n,className:r("fill-popover",t),...o}));b.displayName=e.Arrow.displayName;export{I as ContextMenu,b as ContextMenuArrow,f as ContextMenuCheckboxItem,l as ContextMenuContent,h as ContextMenuGroup,M as ContextMenuItem,y as ContextMenuLabel,E as ContextMenuRadioGroup,P as ContextMenuRadioItem,R as ContextMenuSeparator,w as ContextMenuShortcut,N as ContextMenuSub,c as ContextMenuSubContent,d as ContextMenuSubTrigger,S as ContextMenuTrigger};
1
+ "use client";import{b as r}from"../chunk-LEUB3C3L.mjs";import*as a from"react";import*as e from"@radix-ui/react-context-menu";import{CheckIcon as m,ChevronRightIcon as C,DotFilledIcon as x}from"@radix-ui/react-icons";import{jsx as i,jsxs as p}from"react/jsx-runtime";var I=e.Root,S=e.Trigger,h=e.Group,N=e.Sub,E=e.RadioGroup,d=a.forwardRef(({children:t,className:o,inset:n,...s},u)=>p(e.SubTrigger,{ref:u,className:r("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none",n&&"pl-8",o),...s,children:[t,i(C,{className:"ml-auto size-4"})]}));d.displayName=e.SubTrigger.displayName;var c=a.forwardRef(({className:t,...o},n)=>i(e.Portal,{children:i(e.SubContent,{ref:n,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md",t),...o})}));c.displayName=e.SubContent.displayName;var l=a.forwardRef(({className:t,...o},n)=>i(e.Portal,{children:i(e.Content,{ref:n,className:r("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md",t),...o})}));l.displayName=e.Content.displayName;var M=a.forwardRef(({className:t,inset:o,...n},s)=>i(e.Item,{ref:s,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o&&"pl-8",t),...n}));M.displayName=e.Item.displayName;var f=a.forwardRef(({children:t,className:o,checked:n,...s},u)=>p(e.CheckboxItem,{ref:u,checked:n,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o),...s,children:[i("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:i(e.ItemIndicator,{children:i(m,{className:"size-4"})})}),t]}));f.displayName=e.CheckboxItem.displayName;var P=a.forwardRef(({children:t,className:o,...n},s)=>p(e.RadioItem,{ref:s,className:r("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50",o),...n,children:[i("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:i(e.ItemIndicator,{children:i(x,{className:"size-4 fill-current"})})}),t]}));P.displayName=e.RadioItem.displayName;var y=a.forwardRef(({className:t,inset:o,...n},s)=>i(e.Label,{ref:s,className:r("text-foreground px-2 py-1.5 text-sm font-semibold",o&&"pl-8",t),...n}));y.displayName=e.Label.displayName;var R=a.forwardRef(({className:t,...o},n)=>i(e.Separator,{ref:n,className:r("bg-border -mx-1 my-1 h-px",t),...o}));R.displayName=e.Separator.displayName;function w({className:t,...o}){return i("span",{className:r("text-muted-foreground ml-auto text-xs tracking-widest",t),...o})}var b=a.forwardRef(({className:t,...o},n)=>i(e.Arrow,{ref:n,className:r("fill-popover",t),...o}));b.displayName=e.Arrow.displayName;export{I as ContextMenu,b as ContextMenuArrow,f as ContextMenuCheckboxItem,l as ContextMenuContent,h as ContextMenuGroup,M as ContextMenuItem,y as ContextMenuLabel,E as ContextMenuRadioGroup,P as ContextMenuRadioItem,R as ContextMenuSeparator,w as ContextMenuShortcut,N as ContextMenuSub,c as ContextMenuSubContent,d as ContextMenuSubTrigger,S as ContextMenuTrigger};
2
2
  //# sourceMappingURL=context-menu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/context-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from '@radix-ui/react-icons';\nimport { cn } from '../lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenu\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuProps = React.ComponentProps<typeof ContextMenuPrimitive.Root>;\nconst ContextMenu = ContextMenuPrimitive.Root;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuTriggerProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Trigger>;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Group>;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSub\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubProps = React.ComponentProps<typeof ContextMenuPrimitive.Sub>;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioGroup>;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\n\ninterface ContextMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<ContextMenuSubTriggerElement, ContextMenuSubTriggerProps>(\n ({ children, className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n ),\n);\n\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ntype ContextMenuSubContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>;\n\nconst ContextMenuSubContent = React.forwardRef<ContextMenuSubContentElement, ContextMenuSubContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ntype ContextMenuContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>;\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\n\ninterface ContextMenuItemProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n ),\n);\n\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuCheckboxItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>;\n\nconst ContextMenuCheckboxItem = React.forwardRef<ContextMenuCheckboxItemElement, ContextMenuCheckboxItemProps>(\n ({ children, className, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n ),\n);\n\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>;\n\nconst ContextMenuRadioItem = React.forwardRef<ContextMenuRadioItemElement, ContextMenuRadioItemProps>(\n ({ children, className, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"size-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n ),\n);\n\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuLabel\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\n\ninterface ContextMenuLabelProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n ),\n);\n\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSeparator\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ntype ContextMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>;\n\nconst ContextMenuSeparator = React.forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />\n ),\n);\n\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuShortcut\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement>;\n\nfunction ContextMenuShortcut({ className, ...props }: ContextMenuShortcutProps): React.JSX.Element {\n return <span className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuArrow\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuArrowElement = React.ElementRef<typeof ContextMenuPrimitive.Arrow>;\ntype ContextMenuArrowProps = ContextMenuPrimitive.ContextMenuArrowProps;\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Arrow ref={ref} className={cn('fill-popover', className)} {...props} />\n ),\n);\n\nContextMenuArrow.displayName = ContextMenuPrimitive.Arrow.displayName;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n ContextMenuArrow,\n type ContextMenuProps,\n type ContextMenuTriggerProps,\n type ContextMenuContentProps,\n type ContextMenuItemProps,\n type ContextMenuCheckboxItemProps,\n type ContextMenuRadioItemProps,\n type ContextMenuLabelProps,\n type ContextMenuSeparatorProps,\n type ContextMenuShortcutProps,\n type ContextMenuGroupProps,\n type ContextMenuSubProps,\n type ContextMenuSubContentProps,\n type ContextMenuSubTriggerProps,\n type ContextMenuRadioGroupProps,\n type ContextMenuArrowProps,\n};\n"],"mappings":"uDAEA,UAAYA,MAAW,QACvB,UAAYC,MAA0B,+BACtC,OAAS,aAAAC,EAAW,oBAAAC,EAAkB,iBAAAC,MAAqB,wBAkDvD,OAUE,OAAAC,EAVF,QAAAC,MAAA,oBA1CJ,IAAMC,EAAmC,OAOnCC,EAA0C,UAO1CC,EAAwC,QAOxCC,EAAsC,MAOtCC,EAA6C,aAY7CC,EAA8B,aAClC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IACzCX,EAAsB,aAArB,CACC,IAAKW,EACL,UAAWC,EACT,mNACAH,GAAS,OACTD,CACF,EACC,GAAGE,EAEH,UAAAH,EACDR,EAACc,EAAA,CAAiB,UAAU,i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QAAK,UAAU,4DACd,SAAAA,EAAsB,gBAArB,CACC,SAAAA,EAACsB,EAAA,CAAc,UAAU,sBAAsB,EACjD,EACF,EACCd,GACH,CAEJ,EAEAa,EAAqB,YAAmC,YAAU,YAYlE,IAAME,EAAyB,aAC7B,CAAC,CAAE,UAAAd,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAC/BZ,EAAsB,QAArB,CACC,IAAKY,EACL,UAAWC,EAAG,oDAAqDH,GAAS,OAAQD,CAAS,EAC5F,GAAGE,EACN,CAEJ,EAEAY,EAAiB,YAAmC,QAAM,YAS1D,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAAf,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,YAArB,CAA+B,IAAKY,EAAK,UAAWC,EAAG,4BAA6BJ,CAAS,EAAI,GAAGE,EAAO,CAEhH,EAEAa,EAAqB,YAAmC,YAAU,YAQlE,SAASC,EAAoB,CAAE,UAAAhB,EAAW,GAAGE,CAAM,EAAgD,CACjG,OAAOX,EAAC,QAAK,UAAWa,EAAG,wDAAyDJ,CAAS,EAAI,GAAGE,EAAO,CAC7G,CASA,IAAMe,EAAyB,aAC7B,CAAC,CAAE,UAAAjB,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,QAArB,CAA2B,IAAKY,EAAK,UAAWC,EAAG,eAAgBJ,CAAS,EAAI,GAAGE,EAAO,CAE/F,EAEAe,EAAiB,YAAmC,QAAM","names":["React","ContextMenuPrimitive","CheckIcon","ChevronRightIcon","DotFilledIcon","jsx","jsxs","ContextMenu","ContextMenuTrigger","ContextMenuGroup","ContextMenuSub","ContextMenuRadioGroup","ContextMenuSubTrigger","children","className","inset","props","ref","cn","ChevronRightIcon","ContextMenuSubContent","ContextMenuContent","ContextMenuItem","ContextMenuCheckboxItem","checked","CheckIcon","ContextMenuRadioItem","DotFilledIcon","ContextMenuLabel","ContextMenuSeparator","ContextMenuShortcut","ContextMenuArrow"]}
1
+ {"version":3,"sources":["../../src/react/context-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from '@radix-ui/react-icons';\nimport { cn } from '../lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenu\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuProps = React.ComponentProps<typeof ContextMenuPrimitive.Root>;\nconst ContextMenu = ContextMenuPrimitive.Root;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuTriggerProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Trigger>;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Group>;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSub\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubProps = React.ComponentProps<typeof ContextMenuPrimitive.Sub>;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioGroup\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioGroup>;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubTrigger\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\n\ninterface ContextMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<ContextMenuSubTriggerElement, ContextMenuSubTriggerProps>(\n ({ children, className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n ),\n);\n\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSubContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ntype ContextMenuSubContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>;\n\nconst ContextMenuSubContent = React.forwardRef<ContextMenuSubContentElement, ContextMenuSubContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuContent\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ntype ContextMenuContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>;\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n ),\n);\n\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\n\ninterface ContextMenuItemProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n ),\n);\n\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuCheckboxItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>;\n\nconst ContextMenuCheckboxItem = React.forwardRef<ContextMenuCheckboxItemElement, ContextMenuCheckboxItemProps>(\n ({ children, className, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n ),\n);\n\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuRadioItem\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>;\n\nconst ContextMenuRadioItem = React.forwardRef<ContextMenuRadioItemElement, ContextMenuRadioItemProps>(\n ({ children, className, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"size-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n ),\n);\n\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuLabel\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\n\ninterface ContextMenuLabelProps extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n ),\n);\n\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuSeparator\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ntype ContextMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>;\n\nconst ContextMenuSeparator = React.forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />\n ),\n);\n\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuShortcut\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement>;\n\nfunction ContextMenuShortcut({ className, ...props }: ContextMenuShortcutProps): React.JSX.Element {\n return <span className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ContextMenuArrow\n * -------------------------------------------------------------------------- */\n\ntype ContextMenuArrowElement = React.ElementRef<typeof ContextMenuPrimitive.Arrow>;\ntype ContextMenuArrowProps = ContextMenuPrimitive.ContextMenuArrowProps;\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n ({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Arrow ref={ref} className={cn('fill-popover', className)} {...props} />\n ),\n);\n\nContextMenuArrow.displayName = ContextMenuPrimitive.Arrow.displayName;\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n ContextMenuArrow,\n type ContextMenuProps,\n type ContextMenuTriggerProps,\n type ContextMenuContentProps,\n type ContextMenuItemProps,\n type ContextMenuCheckboxItemProps,\n type ContextMenuRadioItemProps,\n type ContextMenuLabelProps,\n type ContextMenuSeparatorProps,\n type ContextMenuShortcutProps,\n type ContextMenuGroupProps,\n type ContextMenuSubProps,\n type ContextMenuSubContentProps,\n type ContextMenuSubTriggerProps,\n type ContextMenuRadioGroupProps,\n type ContextMenuArrowProps,\n};\n"],"mappings":"uDAEA,UAAYA,MAAW,QACvB,UAAYC,MAA0B,+BACtC,OAAS,aAAAC,EAAW,oBAAAC,EAAkB,iBAAAC,MAAqB,wBAkDvD,OAUE,OAAAC,EAVF,QAAAC,MAAA,oBA1CJ,IAAMC,EAAmC,OAOnCC,EAA0C,UAO1CC,EAAwC,QAOxCC,EAAsC,MAOtCC,EAA6C,aAY7CC,EAA8B,aAClC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IACzCX,EAAsB,aAArB,CACC,IAAKW,EACL,UAAW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,EAAsB,YAArB,CACC,IAAKW,EACL,UAAWC,EACT,uNACAJ,CACF,EACC,GAAGE,EAEJ,UAAAX,EAAC,QAAK,UAAU,4DACd,SAAAA,EAAsB,gBAArB,CACC,SAAAA,EAACsB,EAAA,CAAc,UAAU,sBAAsB,EACjD,EACF,EACCd,GACH,CAEJ,EAEAa,EAAqB,YAAmC,YAAU,YAYlE,IAAME,EAAyB,aAC7B,CAAC,CAAE,UAAAd,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAC/BZ,EAAsB,QAArB,CACC,IAAKY,EACL,UAAWC,EAAG,oDAAqDH,GAAS,OAAQD,CAAS,EAC5F,GAAGE,EACN,CAEJ,EAEAY,EAAiB,YAAmC,QAAM,YAS1D,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAAf,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,YAArB,CAA+B,IAAKY,EAAK,UAAWC,EAAG,4BAA6BJ,CAAS,EAAI,GAAGE,EAAO,CAEhH,EAEAa,EAAqB,YAAmC,YAAU,YAQlE,SAASC,EAAoB,CAAE,UAAAhB,EAAW,GAAGE,CAAM,EAAgD,CACjG,OAAOX,EAAC,QAAK,UAAWa,EAAG,wDAAyDJ,CAAS,EAAI,GAAGE,EAAO,CAC7G,CASA,IAAMe,EAAyB,aAC7B,CAAC,CAAE,UAAAjB,EAAW,GAAGE,CAAM,EAAGC,IACxBZ,EAAsB,QAArB,CAA2B,IAAKY,EAAK,UAAWC,EAAG,eAAgBJ,CAAS,EAAI,GAAGE,EAAO,CAE/F,EAEAe,EAAiB,YAAmC,QAAM","names":["React","ContextMenuPrimitive","CheckIcon","ChevronRightIcon","DotFilledIcon","jsx","jsxs","ContextMenu","ContextMenuTrigger","ContextMenuGroup","ContextMenuSub","ContextMenuRadioGroup","ContextMenuSubTrigger","children","className","inset","props","ref","cn","ChevronRightIcon","ContextMenuSubContent","ContextMenuContent","ContextMenuItem","ContextMenuCheckboxItem","checked","CheckIcon","ContextMenuRadioItem","DotFilledIcon","ContextMenuLabel","ContextMenuSeparator","ContextMenuShortcut","ContextMenuArrow"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkDCDB56BOjs = require('../chunk-DCDB56BO.js');var _chunkRHFF4JNHjs = require('../chunk-RHFF4JNH.js');var _chunkI7YJNEPRjs = require('../chunk-I7YJNEPR.js');require('../chunk-46W6RAYD.js');var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _reacticons = require('@radix-ui/react-icons');var _jsxruntime = require('react/jsx-runtime');function A({table:a}){return _jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[_jsxruntime.jsx.call(void 0, _reacticons.MixerHorizontalIcon,{className:"mr-2 size-4"}),"View"]})}),_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.h,{align:"end",className:"w-36",children:[_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.l,{children:"Toggle columns"}),_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.m,{}),a.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.j,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:s=>{n.toggleVisibility(!!s)},children:n.id},n.id))]})]})}function B({table:a,className:n,...s}){return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkHQ4AUOQMjs.b.call(void 0, "flex items-center justify-between px-2",n),...s,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"text-muted-foreground flex-1 text-sm",children:[a.getFilteredSelectedRowModel().rows.length," of ",a.getFilteredRowModel().rows.length," row(s) selected."]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-6 lg:space-x-8",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",children:"Rows per page"}),_jsxruntime.jsxs.call(void 0, _chunkDCDB56BOjs.a,{value:String(a.getState().pagination.pageSize),onValueChange:i=>{a.setPageSize(Number(i))},children:[_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.d,{className:"w-18 h-8",children:_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.c,{placeholder:a.getState().pagination.pageSize})}),_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.g,{side:"top",children:[10,20,30,40,50].map(i=>_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.i,{value:String(i),children:i},i))})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-28 items-center justify-center text-sm font-medium",children:["Page ",a.getState().pagination.pageIndex+1," of ",a.getPageCount()]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"outline",size:"icon-xs",className:"hidden lg:flex",onClick:()=>{a.setPageIndex(0)},disabled:!a.getCanPreviousPage(),children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to first page"}),_jsxruntime.jsx.call(void 0, _reacticons.DoubleArrowLeftIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"outline",size:"icon-xs",onClick:()=>{a.previousPage()},disabled:!a.getCanPreviousPage(),children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to previous page"}),_jsxruntime.jsx.call(void 0, _reacticons.ChevronLeftIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"outline",size:"icon-xs",onClick:()=>{a.nextPage()},disabled:!a.getCanNextPage(),children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to next page"}),_jsxruntime.jsx.call(void 0, _reacticons.ChevronRightIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"outline",size:"icon-xs",className:"hidden lg:flex",onClick:()=>{a.setPageIndex(a.getPageCount()-1)},disabled:!a.getCanNextPage(),children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to last page"}),_jsxruntime.jsx.call(void 0, _reacticons.DoubleArrowRightIcon,{className:"size-4"})]})]})]})]})}function L({column:a,title:n,className:s}){return a.getCanSort()?_jsxruntime.jsx.call(void 0, "div",{className:_chunkHQ4AUOQMjs.b.call(void 0, "flex items-center space-x-2",s),children:_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, _chunkI7YJNEPRjs.b,{variant:"ghost",size:"xs",className:"data-[state=open]:bg-accent -ml-3",children:[_jsxruntime.jsx.call(void 0, "span",{children:n}),_jsxruntime.jsx.call(void 0, z,{sorted:a.getIsSorted()})]})}),_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.h,{align:"start",children:[_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.i,{onClick:()=>{a.toggleSorting(!1)},children:[_jsxruntime.jsx.call(void 0, _reacticons.ArrowUpIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Asc"]}),_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.i,{onClick:()=>{a.toggleSorting(!0)},children:[_jsxruntime.jsx.call(void 0, _reacticons.ArrowDownIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Desc"]}),_jsxruntime.jsx.call(void 0, _chunkRHFF4JNHjs.m,{}),_jsxruntime.jsxs.call(void 0, _chunkRHFF4JNHjs.i,{onClick:()=>{a.toggleVisibility(!1)},children:[_jsxruntime.jsx.call(void 0, _reacticons.EyeNoneIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Hide"]})]})]})}):_jsxruntime.jsx.call(void 0, "div",{className:s,children:n})}function z({sorted:a}){switch(a){case"desc":return _jsxruntime.jsx.call(void 0, _reacticons.ArrowDownIcon,{className:"ml-2 size-4"});case"asc":return _jsxruntime.jsx.call(void 0, _reacticons.ArrowUpIcon,{className:"ml-2 size-4"});default:return _jsxruntime.jsx.call(void 0, _reacticons.CaretSortIcon,{className:"ml-2 size-4"})}}exports.DataTableColumnHeader = L; exports.DataTablePagination = B; exports.DataTableViewOptions = A;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkDCDB56BOjs = require('../chunk-DCDB56BO.js');var _chunk63XEM5BBjs = require('../chunk-63XEM5BB.js');var _chunkITKVRO7Kjs = require('../chunk-ITKVRO7K.js');require('../chunk-46W6RAYD.js');var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _reacticons = require('@radix-ui/react-icons');var _jsxruntime = require('react/jsx-runtime');function A({table:a}){return _jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{className:"ml-auto hidden h-8 lg:flex",size:"sm",variant:"outline",children:[_jsxruntime.jsx.call(void 0, _reacticons.MixerHorizontalIcon,{className:"mr-2 size-4"}),"View"]})}),_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.h,{align:"end",className:"w-36",children:[_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.l,{children:"Toggle columns"}),_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.m,{}),a.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.j,{checked:n.getIsVisible(),className:"capitalize",onCheckedChange:s=>{n.toggleVisibility(!!s)},children:n.id},n.id))]})]})}function B({table:a,className:n,...s}){return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkHQ4AUOQMjs.b.call(void 0, "flex items-center justify-between px-2",n),...s,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"text-muted-foreground flex-1 text-sm",children:[a.getFilteredSelectedRowModel().rows.length," of ",a.getFilteredRowModel().rows.length," row(s) selected."]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-6 lg:space-x-8",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",children:"Rows per page"}),_jsxruntime.jsxs.call(void 0, _chunkDCDB56BOjs.a,{value:String(a.getState().pagination.pageSize),onValueChange:i=>{a.setPageSize(Number(i))},children:[_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.d,{className:"w-18 h-8",children:_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.c,{placeholder:a.getState().pagination.pageSize})}),_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.g,{side:"top",children:[10,20,30,40,50].map(i=>_jsxruntime.jsx.call(void 0, _chunkDCDB56BOjs.i,{value:String(i),children:i},i))})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-28 items-center justify-center text-sm font-medium",children:["Page ",a.getState().pagination.pageIndex+1," of ",a.getPageCount()]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{className:"hidden lg:flex",disabled:!a.getCanPreviousPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.setPageIndex(0)},children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to first page"}),_jsxruntime.jsx.call(void 0, _reacticons.DoubleArrowLeftIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{disabled:!a.getCanPreviousPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.previousPage()},children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to previous page"}),_jsxruntime.jsx.call(void 0, _reacticons.ChevronLeftIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{disabled:!a.getCanNextPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.nextPage()},children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to next page"}),_jsxruntime.jsx.call(void 0, _reacticons.ChevronRightIcon,{className:"size-4"})]}),_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{className:"hidden lg:flex",disabled:!a.getCanNextPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.setPageIndex(a.getPageCount()-1)},children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Go to last page"}),_jsxruntime.jsx.call(void 0, _reacticons.DoubleArrowRightIcon,{className:"size-4"})]})]})]})]})}function L({column:a,title:n,className:s}){return a.getCanSort()?_jsxruntime.jsx.call(void 0, "div",{className:_chunkHQ4AUOQMjs.b.call(void 0, "flex items-center space-x-2",s),children:_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, _chunkITKVRO7Kjs.b,{className:"data-[state=open]:bg-accent -ml-3",size:"xs",variant:"ghost",children:[_jsxruntime.jsx.call(void 0, "span",{children:n}),_jsxruntime.jsx.call(void 0, z,{sorted:a.getIsSorted()})]})}),_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.h,{align:"start",children:[_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.i,{onClick:()=>{a.toggleSorting(!1)},children:[_jsxruntime.jsx.call(void 0, _reacticons.ArrowUpIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Asc"]}),_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.i,{onClick:()=>{a.toggleSorting(!0)},children:[_jsxruntime.jsx.call(void 0, _reacticons.ArrowDownIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Desc"]}),_jsxruntime.jsx.call(void 0, _chunk63XEM5BBjs.m,{}),_jsxruntime.jsxs.call(void 0, _chunk63XEM5BBjs.i,{onClick:()=>{a.toggleVisibility(!1)},children:[_jsxruntime.jsx.call(void 0, _reacticons.EyeNoneIcon,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Hide"]})]})]})}):_jsxruntime.jsx.call(void 0, "div",{className:s,children:n})}function z({sorted:a}){switch(a){case"desc":return _jsxruntime.jsx.call(void 0, _reacticons.ArrowDownIcon,{className:"ml-2 size-4"});case"asc":return _jsxruntime.jsx.call(void 0, _reacticons.ArrowUpIcon,{className:"ml-2 size-4"});default:return _jsxruntime.jsx.call(void 0, _reacticons.CaretSortIcon,{className:"ml-2 size-4"})}}exports.DataTableColumnHeader = L; exports.DataTablePagination = B; exports.DataTableViewOptions = A;
2
2
  //# sourceMappingURL=data-table.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/data-table.tsx"],"names":["ArrowDownIcon","ArrowUpIcon","CaretSortIcon","ChevronLeftIcon","ChevronRightIcon","DoubleArrowLeftIcon","DoubleArrowRightIcon","EyeNoneIcon","MixerHorizontalIcon","jsx","jsxs","DataTableViewOptions","table","DropdownMenu","DropdownMenuTrigger","Button","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","column","DropdownMenuCheckboxItem","value","DataTablePagination","className","props","cn","Select","SelectTrigger","SelectValue","SelectContent","pageSize","SelectItem","DataTableColumnHeader","title","SortIcon","DropdownMenuItem","sorted"],"mappings":"oRAGA,OACE,iBAAAA,EACA,eAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,eAAAC,EACA,uBAAAC,MACK,wBA2BC,OACE,OAAAC,EADF,QAAAC,MAAA,oBAJR,SAASC,EAA4B,CAAE,MAAAC,CAAM,E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UAAAV,CACF,EAAiE,CAC/D,OAAKJ,EAAO,WAAW,EAKrBV,EAAC,OAAI,UAAWgB,EAAG,8BAA+BF,CAAS,EACzD,SAAAb,EAACG,EAAA,CACC,UAAAJ,EAACK,EAAA,CAAoB,QAAO,GAC1B,SAAAJ,EAACK,EAAA,CAAO,QAAQ,QAAQ,KAAK,KAAK,UAAU,oCAC1C,UAAAN,EAAC,QAAM,SAAAwB,EAAM,EACbxB,EAACyB,EAAA,CAAS,OAAQf,EAAO,YAAY,EAAG,GAC1C,EACF,EACAT,EAACM,EAAA,CAAoB,MAAM,QACzB,UAAAN,EAACyB,EAAA,CACC,QAAS,IAAM,CACbhB,EAAO,cAAc,EAAK,CAC5B,EAEA,UAAAV,EAACR,EAAA,CAAY,UAAU,yCAAyC,EAAE,OAEpE,EACAS,EAACyB,EAAA,CACC,QAAS,IAAM,CACbhB,EAAO,cAAc,EAAI,CAC3B,EAEA,UAAAV,EAACT,EAAA,CAAc,UAAU,yCAAyC,EAAE,QAEtE,EACAS,EAACS,EAAA,EAAsB,EACvBR,EAACyB,EAAA,CACC,QAAS,IAAM,CACbhB,EAAO,iBAAiB,EAAK,CAC/B,EAEA,UAAAV,EAACF,EAAA,CAAY,UAAU,yCAAyC,EAAE,QAEpE,GACF,GACF,EACF,EAxCOE,EAAC,OAAI,UAAWc,EAAY,SAAAU,EAAM,CA0C7C,CAEA,SAASC,EAAS,CAAE,OAAAE,CAAO,EAAoE,CAC7F,OAAQA,EAAQ,CACd,IAAK,OACH,OAAO3B,EAACT,EAAA,CAAc,UAAU,cAAc,EAEhD,IAAK,MACH,OAAOS,EAACR,EAAA,CAAY,UAAU,cAAc,EAE9C,QACE,OAAOQ,EAACP,EAAA,CAAc,UAAU,cAAc,CAClD,CACF","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n ArrowDownIcon,\n ArrowUpIcon,\n CaretSortIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n DoubleArrowLeftIcon,\n DoubleArrowRightIcon,\n EyeNoneIcon,\n MixerHorizontalIcon,\n} from '@radix-ui/react-icons';\nimport type * as ReactTable from '@tanstack/react-table';\nimport { cn } from '../lib/utils';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './dropdown-menu';\nimport { Button } from './button';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableViewOptions\n * -------------------------------------------------------------------------- */\n\ninterface DataTableViewOptionsProps<TData> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"ml-auto hidden h-8 lg:flex\">\n <MixerHorizontalIcon className=\"mr-2 size-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-36\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTablePagination\n * -------------------------------------------------------------------------- */\n\ninterface DataTablePaginationProps<TData> extends React.HTMLAttributes<HTMLDivElement> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTablePagination<TData>({\n table,\n className,\n ...props\n}: DataTablePaginationProps<TData>): React.JSX.Element {\n return (\n <div className={cn('flex items-center justify-between px-2', className)} {...props}>\n <div className=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div className=\"flex items-center space-x-6 lg:space-x-8\">\n <div className=\"flex items-center space-x-2\">\n <p className=\"text-sm font-medium\">Rows per page</p>\n <Select\n value={String(table.getState().pagination.pageSize)}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-18 h-8\">\n <SelectValue placeholder={table.getState().pagination.pageSize} />\n </SelectTrigger>\n <SelectContent side=\"top\">\n {[10, 20, 30, 40, 50].map((pageSize) => (\n <SelectItem key={pageSize} value={String(pageSize)}>\n {pageSize}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"flex w-28 items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}\n </div>\n <div className=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n className=\"hidden lg:flex\"\n onClick={() => {\n table.setPageIndex(0);\n }}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">Go to first page</span>\n <DoubleArrowLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n onClick={() => {\n table.previousPage();\n }}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n onClick={() => {\n table.nextPage();\n }}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">Go to next page</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n className=\"hidden lg:flex\"\n onClick={() => {\n table.setPageIndex(table.getPageCount() - 1);\n }}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">Go to last page</span>\n <DoubleArrowRightIcon className=\"size-4\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableColumnHeader\n * -------------------------------------------------------------------------- */\n\ninterface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {\n column: ReactTable.Column<TData, TValue>;\n title: string;\n}\n\nfunction DataTableColumnHeader<TData, TValue>({\n column,\n title,\n className,\n}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {\n if (!column.getCanSort()) {\n return <div className={className}>{title}</div>;\n }\n\n return (\n <div className={cn('flex items-center space-x-2', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"xs\" className=\"data-[state=open]:bg-accent -ml-3\">\n <span>{title}</span>\n <SortIcon sorted={column.getIsSorted()} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(false);\n }}\n >\n <ArrowUpIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(true);\n }}\n >\n <ArrowDownIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => {\n column.toggleVisibility(false);\n }}\n >\n <EyeNoneIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Hide\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction SortIcon({ sorted }: { sorted: false | ReactTable.SortDirection }): React.JSX.Element {\n switch (sorted) {\n case 'desc':\n return <ArrowDownIcon className=\"ml-2 size-4\" />;\n\n case 'asc':\n return <ArrowUpIcon className=\"ml-2 size-4\" />;\n\n default:\n return <CaretSortIcon className=\"ml-2 size-4\" />;\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n DataTableViewOptions,\n DataTablePagination,\n DataTableColumnHeader,\n type DataTableViewOptionsProps,\n type DataTablePaginationProps,\n type DataTableColumnHeaderProps,\n};\n"]}
1
+ {"version":3,"sources":["../../src/react/data-table.tsx"],"names":["ArrowDownIcon","ArrowUpIcon","CaretSortIcon","ChevronLeftIcon","ChevronRightIcon","DoubleArrowLeftIcon","DoubleArrowRightIcon","EyeNoneIcon","MixerHorizontalIcon","jsx","jsxs","DataTableViewOptions","table","DropdownMenu","DropdownMenuTrigger","Button","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","column","DropdownMenuCheckboxItem","value","DataTablePagination","className","props","cn","Select","SelectTrigger","SelectValue","SelectContent","pageSize","SelectItem","DataTableColumnHeader","title","SortIcon","DropdownMenuItem","sorted"],"mappings":"oRAGA,OACE,iBAAAA,EACA,eAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,eAAAC,EACA,uBAAAC,MACK,wBA2BC,OACE,OAAAC,EADF,QAAAC,MAAA,oBAJR,SAASC,EAA4B,CAAE,MAAAC,CAAM,EAAwD,CACnG,OACEF,EAACG,EAAA,CACC,UAAAJ,EAACK,EAAA,CAAoB,QAAO,GAC1B,SAAAJ,EAACK,EAAA,CAAO,UAAU,6BAA6B,KAAK,KAAK,QAAQ,UAC/D,UAAAN,EAACD,EAAA,CAAoB,UAAU,cAAc,EAAE,QAEjD,EACF,EACAE,EAACM,EAAA,CAAoB,MAAM,MAAM,UAAU,OACzC,UAAAP,EAACQ,EAAA,CAAkB,0BAAc,EACjCR,EAACS,EAAA,EAAsB,EACtBN,EACE,cAAc,EACd,OAAQO,GAAW,OAAOA,EAAO,WAAe,KAAeA,EAAO,WAAW,CAAC,EAClF,IAAKA,GAEFV,EAACW,EAAA,CAEC,QAASD,EAAO,aAAa,EAC7B,UAAU,aACV,gBAAkBE,GAAU,CAC1BF,EAAO,iBAAiB,EAAQE,CAAM,CACxC,EA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AS,IAAM,CACbhB,EAAO,cAAc,EAAI,CAC3B,EAEA,UAAAV,EAACT,EAAA,CAAc,UAAU,yCAAyC,EAAE,QAEtE,EACAS,EAACS,EAAA,EAAsB,EACvBR,EAACyB,EAAA,CACC,QAAS,IAAM,CACbhB,EAAO,iBAAiB,EAAK,CAC/B,EAEA,UAAAV,EAACF,EAAA,CAAY,UAAU,yCAAyC,EAAE,QAEpE,GACF,GACF,EACF,EAxCOE,EAAC,OAAI,UAAWc,EAAY,SAAAU,EAAM,CA0C7C,CAEA,SAASC,EAAS,CAAE,OAAAE,CAAO,EAAoE,CAC7F,OAAQA,EAAQ,CACd,IAAK,OACH,OAAO3B,EAACT,EAAA,CAAc,UAAU,cAAc,EAEhD,IAAK,MACH,OAAOS,EAACR,EAAA,CAAY,UAAU,cAAc,EAE9C,QACE,OAAOQ,EAACP,EAAA,CAAc,UAAU,cAAc,CAClD,CACF","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n ArrowDownIcon,\n ArrowUpIcon,\n CaretSortIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n DoubleArrowLeftIcon,\n DoubleArrowRightIcon,\n EyeNoneIcon,\n MixerHorizontalIcon,\n} from '@radix-ui/react-icons';\nimport type * as ReactTable from '@tanstack/react-table';\nimport { cn } from '../lib/utils';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './dropdown-menu';\nimport { Button } from './button';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableViewOptions\n * -------------------------------------------------------------------------- */\n\ninterface DataTableViewOptionsProps<TData> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"ml-auto hidden h-8 lg:flex\" size=\"sm\" variant=\"outline\">\n <MixerHorizontalIcon className=\"mr-2 size-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-36\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n checked={column.getIsVisible()}\n className=\"capitalize\"\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTablePagination\n * -------------------------------------------------------------------------- */\n\ninterface DataTablePaginationProps<TData> extends React.HTMLAttributes<HTMLDivElement> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTablePagination<TData>({\n table,\n className,\n ...props\n}: DataTablePaginationProps<TData>): React.JSX.Element {\n return (\n <div className={cn('flex items-center justify-between px-2', className)} {...props}>\n <div className=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div className=\"flex items-center space-x-6 lg:space-x-8\">\n <div className=\"flex items-center space-x-2\">\n <p className=\"text-sm font-medium\">Rows per page</p>\n <Select\n value={String(table.getState().pagination.pageSize)}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-18 h-8\">\n <SelectValue placeholder={table.getState().pagination.pageSize} />\n </SelectTrigger>\n <SelectContent side=\"top\">\n {[10, 20, 30, 40, 50].map((pageSize) => (\n <SelectItem key={pageSize} value={String(pageSize)}>\n {pageSize}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"flex w-28 items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}\n </div>\n <div className=\"flex items-center space-x-2\">\n <Button\n className=\"hidden lg:flex\"\n disabled={!table.getCanPreviousPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.setPageIndex(0);\n }}\n >\n <span className=\"sr-only\">Go to first page</span>\n <DoubleArrowLeftIcon className=\"size-4\" />\n </Button>\n <Button\n disabled={!table.getCanPreviousPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.previousPage();\n }}\n >\n <span className=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n <Button\n disabled={!table.getCanNextPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.nextPage();\n }}\n >\n <span className=\"sr-only\">Go to next page</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n <Button\n className=\"hidden lg:flex\"\n disabled={!table.getCanNextPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.setPageIndex(table.getPageCount() - 1);\n }}\n >\n <span className=\"sr-only\">Go to last page</span>\n <DoubleArrowRightIcon className=\"size-4\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableColumnHeader\n * -------------------------------------------------------------------------- */\n\ninterface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {\n column: ReactTable.Column<TData, TValue>;\n title: string;\n}\n\nfunction DataTableColumnHeader<TData, TValue>({\n column,\n title,\n className,\n}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {\n if (!column.getCanSort()) {\n return <div className={className}>{title}</div>;\n }\n\n return (\n <div className={cn('flex items-center space-x-2', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"data-[state=open]:bg-accent -ml-3\" size=\"xs\" variant=\"ghost\">\n <span>{title}</span>\n <SortIcon sorted={column.getIsSorted()} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(false);\n }}\n >\n <ArrowUpIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(true);\n }}\n >\n <ArrowDownIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => {\n column.toggleVisibility(false);\n }}\n >\n <EyeNoneIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Hide\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction SortIcon({ sorted }: { sorted: false | ReactTable.SortDirection }): React.JSX.Element {\n switch (sorted) {\n case 'desc':\n return <ArrowDownIcon className=\"ml-2 size-4\" />;\n\n case 'asc':\n return <ArrowUpIcon className=\"ml-2 size-4\" />;\n\n default:\n return <CaretSortIcon className=\"ml-2 size-4\" />;\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n DataTableViewOptions,\n DataTablePagination,\n DataTableColumnHeader,\n type DataTableViewOptionsProps,\n type DataTablePaginationProps,\n type DataTableColumnHeaderProps,\n};\n"]}
@@ -1,2 +1,2 @@
1
- "use client";import{a as D,c as f,d as T,g as x,i as w}from"../chunk-ZIB4ZTST.mjs";import{a as c,b as d,h as m,i as r,j as p,l as u,m as g}from"../chunk-BM5KYF6Y.mjs";import{b as o}from"../chunk-FJH7XRCZ.mjs";import"../chunk-BNKSZEF2.mjs";import{b as l}from"../chunk-LEUB3C3L.mjs";import{ArrowDownIcon as C,ArrowUpIcon as N,CaretSortIcon as v,ChevronLeftIcon as S,ChevronRightIcon as P,DoubleArrowLeftIcon as b,DoubleArrowRightIcon as M,EyeNoneIcon as I,MixerHorizontalIcon as h}from"@radix-ui/react-icons";import{jsx as e,jsxs as t}from"react/jsx-runtime";function A({table:a}){return t(c,{children:[e(d,{asChild:!0,children:t(o,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e(h,{className:"mr-2 size-4"}),"View"]})}),t(m,{align:"end",className:"w-36",children:[e(u,{children:"Toggle columns"}),e(g,{}),a.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>e(p,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:s=>{n.toggleVisibility(!!s)},children:n.id},n.id))]})]})}function B({table:a,className:n,...s}){return t("div",{className:l("flex items-center justify-between px-2",n),...s,children:[t("div",{className:"text-muted-foreground flex-1 text-sm",children:[a.getFilteredSelectedRowModel().rows.length," of ",a.getFilteredRowModel().rows.length," row(s) selected."]}),t("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[t("div",{className:"flex items-center space-x-2",children:[e("p",{className:"text-sm font-medium",children:"Rows per page"}),t(D,{value:String(a.getState().pagination.pageSize),onValueChange:i=>{a.setPageSize(Number(i))},children:[e(T,{className:"w-18 h-8",children:e(f,{placeholder:a.getState().pagination.pageSize})}),e(x,{side:"top",children:[10,20,30,40,50].map(i=>e(w,{value:String(i),children:i},i))})]})]}),t("div",{className:"flex w-28 items-center justify-center text-sm font-medium",children:["Page ",a.getState().pagination.pageIndex+1," of ",a.getPageCount()]}),t("div",{className:"flex items-center space-x-2",children:[t(o,{variant:"outline",size:"icon-xs",className:"hidden lg:flex",onClick:()=>{a.setPageIndex(0)},disabled:!a.getCanPreviousPage(),children:[e("span",{className:"sr-only",children:"Go to first page"}),e(b,{className:"size-4"})]}),t(o,{variant:"outline",size:"icon-xs",onClick:()=>{a.previousPage()},disabled:!a.getCanPreviousPage(),children:[e("span",{className:"sr-only",children:"Go to previous page"}),e(S,{className:"size-4"})]}),t(o,{variant:"outline",size:"icon-xs",onClick:()=>{a.nextPage()},disabled:!a.getCanNextPage(),children:[e("span",{className:"sr-only",children:"Go to next page"}),e(P,{className:"size-4"})]}),t(o,{variant:"outline",size:"icon-xs",className:"hidden lg:flex",onClick:()=>{a.setPageIndex(a.getPageCount()-1)},disabled:!a.getCanNextPage(),children:[e("span",{className:"sr-only",children:"Go to last page"}),e(M,{className:"size-4"})]})]})]})]})}function L({column:a,title:n,className:s}){return a.getCanSort()?e("div",{className:l("flex items-center space-x-2",s),children:t(c,{children:[e(d,{asChild:!0,children:t(o,{variant:"ghost",size:"xs",className:"data-[state=open]:bg-accent -ml-3",children:[e("span",{children:n}),e(z,{sorted:a.getIsSorted()})]})}),t(m,{align:"start",children:[t(r,{onClick:()=>{a.toggleSorting(!1)},children:[e(N,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Asc"]}),t(r,{onClick:()=>{a.toggleSorting(!0)},children:[e(C,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Desc"]}),e(g,{}),t(r,{onClick:()=>{a.toggleVisibility(!1)},children:[e(I,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Hide"]})]})]})}):e("div",{className:s,children:n})}function z({sorted:a}){switch(a){case"desc":return e(C,{className:"ml-2 size-4"});case"asc":return e(N,{className:"ml-2 size-4"});default:return e(v,{className:"ml-2 size-4"})}}export{L as DataTableColumnHeader,B as DataTablePagination,A as DataTableViewOptions};
1
+ "use client";import{a as D,c as f,d as T,g as x,i as w}from"../chunk-ZIB4ZTST.mjs";import{a as c,b as d,h as m,i as r,j as p,l as u,m as g}from"../chunk-4WTCCXNP.mjs";import{b as o}from"../chunk-3WHWDZWS.mjs";import"../chunk-BNKSZEF2.mjs";import{b as l}from"../chunk-LEUB3C3L.mjs";import{ArrowDownIcon as C,ArrowUpIcon as N,CaretSortIcon as v,ChevronLeftIcon as S,ChevronRightIcon as P,DoubleArrowLeftIcon as b,DoubleArrowRightIcon as M,EyeNoneIcon as I,MixerHorizontalIcon as h}from"@radix-ui/react-icons";import{jsx as e,jsxs as t}from"react/jsx-runtime";function A({table:a}){return t(c,{children:[e(d,{asChild:!0,children:t(o,{className:"ml-auto hidden h-8 lg:flex",size:"sm",variant:"outline",children:[e(h,{className:"mr-2 size-4"}),"View"]})}),t(m,{align:"end",className:"w-36",children:[e(u,{children:"Toggle columns"}),e(g,{}),a.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>e(p,{checked:n.getIsVisible(),className:"capitalize",onCheckedChange:s=>{n.toggleVisibility(!!s)},children:n.id},n.id))]})]})}function B({table:a,className:n,...s}){return t("div",{className:l("flex items-center justify-between px-2",n),...s,children:[t("div",{className:"text-muted-foreground flex-1 text-sm",children:[a.getFilteredSelectedRowModel().rows.length," of ",a.getFilteredRowModel().rows.length," row(s) selected."]}),t("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[t("div",{className:"flex items-center space-x-2",children:[e("p",{className:"text-sm font-medium",children:"Rows per page"}),t(D,{value:String(a.getState().pagination.pageSize),onValueChange:i=>{a.setPageSize(Number(i))},children:[e(T,{className:"w-18 h-8",children:e(f,{placeholder:a.getState().pagination.pageSize})}),e(x,{side:"top",children:[10,20,30,40,50].map(i=>e(w,{value:String(i),children:i},i))})]})]}),t("div",{className:"flex w-28 items-center justify-center text-sm font-medium",children:["Page ",a.getState().pagination.pageIndex+1," of ",a.getPageCount()]}),t("div",{className:"flex items-center space-x-2",children:[t(o,{className:"hidden lg:flex",disabled:!a.getCanPreviousPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.setPageIndex(0)},children:[e("span",{className:"sr-only",children:"Go to first page"}),e(b,{className:"size-4"})]}),t(o,{disabled:!a.getCanPreviousPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.previousPage()},children:[e("span",{className:"sr-only",children:"Go to previous page"}),e(S,{className:"size-4"})]}),t(o,{disabled:!a.getCanNextPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.nextPage()},children:[e("span",{className:"sr-only",children:"Go to next page"}),e(P,{className:"size-4"})]}),t(o,{className:"hidden lg:flex",disabled:!a.getCanNextPage(),size:"icon-xs",variant:"outline",onClick:()=>{a.setPageIndex(a.getPageCount()-1)},children:[e("span",{className:"sr-only",children:"Go to last page"}),e(M,{className:"size-4"})]})]})]})]})}function L({column:a,title:n,className:s}){return a.getCanSort()?e("div",{className:l("flex items-center space-x-2",s),children:t(c,{children:[e(d,{asChild:!0,children:t(o,{className:"data-[state=open]:bg-accent -ml-3",size:"xs",variant:"ghost",children:[e("span",{children:n}),e(z,{sorted:a.getIsSorted()})]})}),t(m,{align:"start",children:[t(r,{onClick:()=>{a.toggleSorting(!1)},children:[e(N,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Asc"]}),t(r,{onClick:()=>{a.toggleSorting(!0)},children:[e(C,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Desc"]}),e(g,{}),t(r,{onClick:()=>{a.toggleVisibility(!1)},children:[e(I,{className:"text-muted-foreground/70 mr-2 size-3.5"}),"Hide"]})]})]})}):e("div",{className:s,children:n})}function z({sorted:a}){switch(a){case"desc":return e(C,{className:"ml-2 size-4"});case"asc":return e(N,{className:"ml-2 size-4"});default:return e(v,{className:"ml-2 size-4"})}}export{L as DataTableColumnHeader,B as DataTablePagination,A as DataTableViewOptions};
2
2
  //# sourceMappingURL=data-table.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/data-table.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n ArrowDownIcon,\n ArrowUpIcon,\n CaretSortIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n DoubleArrowLeftIcon,\n DoubleArrowRightIcon,\n EyeNoneIcon,\n MixerHorizontalIcon,\n} from '@radix-ui/react-icons';\nimport type * as ReactTable from '@tanstack/react-table';\nimport { cn } from '../lib/utils';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './dropdown-menu';\nimport { Button } from './button';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableViewOptions\n * -------------------------------------------------------------------------- */\n\ninterface DataTableViewOptionsProps<TData> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"ml-auto hidden h-8 lg:flex\">\n <MixerHorizontalIcon className=\"mr-2 size-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-36\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTablePagination\n * -------------------------------------------------------------------------- */\n\ninterface DataTablePaginationProps<TData> extends React.HTMLAttributes<HTMLDivElement> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTablePagination<TData>({\n table,\n className,\n ...props\n}: DataTablePaginationProps<TData>): React.JSX.Element {\n return (\n <div className={cn('flex items-center justify-between px-2', className)} {...props}>\n <div className=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div className=\"flex items-center space-x-6 lg:space-x-8\">\n <div className=\"flex items-center space-x-2\">\n <p className=\"text-sm font-medium\">Rows per page</p>\n <Select\n value={String(table.getState().pagination.pageSize)}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-18 h-8\">\n <SelectValue placeholder={table.getState().pagination.pageSize} />\n </SelectTrigger>\n <SelectContent side=\"top\">\n {[10, 20, 30, 40, 50].map((pageSize) => (\n <SelectItem key={pageSize} value={String(pageSize)}>\n {pageSize}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"flex w-28 items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}\n </div>\n <div className=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n className=\"hidden lg:flex\"\n onClick={() => {\n table.setPageIndex(0);\n }}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">Go to first page</span>\n <DoubleArrowLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n onClick={() => {\n table.previousPage();\n }}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n onClick={() => {\n table.nextPage();\n }}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">Go to next page</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-xs\"\n className=\"hidden lg:flex\"\n onClick={() => {\n table.setPageIndex(table.getPageCount() - 1);\n }}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">Go to last page</span>\n <DoubleArrowRightIcon className=\"size-4\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableColumnHeader\n * -------------------------------------------------------------------------- */\n\ninterface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {\n column: ReactTable.Column<TData, TValue>;\n title: string;\n}\n\nfunction DataTableColumnHeader<TData, TValue>({\n column,\n title,\n className,\n}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {\n if (!column.getCanSort()) {\n return <div className={className}>{title}</div>;\n }\n\n return (\n <div className={cn('flex items-center space-x-2', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" size=\"xs\" className=\"data-[state=open]:bg-accent -ml-3\">\n <span>{title}</span>\n <SortIcon sorted={column.getIsSorted()} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(false);\n }}\n >\n <ArrowUpIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(true);\n }}\n >\n <ArrowDownIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => {\n column.toggleVisibility(false);\n }}\n >\n <EyeNoneIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Hide\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction SortIcon({ sorted }: { sorted: false | ReactTable.SortDirection }): React.JSX.Element {\n switch (sorted) {\n case 'desc':\n return <ArrowDownIcon className=\"ml-2 size-4\" />;\n\n case 'asc':\n return <ArrowUpIcon className=\"ml-2 size-4\" />;\n\n default:\n return <CaretSortIcon className=\"ml-2 size-4\" />;\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n DataTableViewOptions,\n DataTablePagination,\n DataTableColumnHeader,\n type DataTableViewOptionsProps,\n type DataTablePaginationProps,\n type DataTableColumnHeaderProps,\n};\n"],"mappings":"yRAGA,OACE,iBAAAA,EACA,eAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,eAAAC,EACA,uBAAAC,MACK,wBA2BC,OACE,OAAAC,EADF,QAAAC,MAAA,oBAJR,SAASC,EAA4B,CAAE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eNoneIcon","MixerHorizontalIcon","jsx","jsxs","DataTableViewOptions","table","DropdownMenu","DropdownMenuTrigger","Button","MixerHorizontalIcon","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","column","DropdownMenuCheckboxItem","value","DataTablePagination","className","props","cn","Select","SelectTrigger","SelectValue","SelectContent","pageSize","SelectItem","DoubleArrowLeftIcon","ChevronLeftIcon","ChevronRightIcon","DoubleArrowRightIcon","DataTableColumnHeader","title","SortIcon","DropdownMenuItem","ArrowUpIcon","ArrowDownIcon","EyeNoneIcon","sorted","CaretSortIcon"]}
1
+ {"version":3,"sources":["../../src/react/data-table.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n ArrowDownIcon,\n ArrowUpIcon,\n CaretSortIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n DoubleArrowLeftIcon,\n DoubleArrowRightIcon,\n EyeNoneIcon,\n MixerHorizontalIcon,\n} from '@radix-ui/react-icons';\nimport type * as ReactTable from '@tanstack/react-table';\nimport { cn } from '../lib/utils';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './dropdown-menu';\nimport { Button } from './button';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableViewOptions\n * -------------------------------------------------------------------------- */\n\ninterface DataTableViewOptionsProps<TData> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"ml-auto hidden h-8 lg:flex\" size=\"sm\" variant=\"outline\">\n <MixerHorizontalIcon className=\"mr-2 size-4\" />\n View\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-36\">\n <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {table\n .getAllColumns()\n .filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n checked={column.getIsVisible()}\n className=\"capitalize\"\n onCheckedChange={(value) => {\n column.toggleVisibility(Boolean(value));\n }}\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTablePagination\n * -------------------------------------------------------------------------- */\n\ninterface DataTablePaginationProps<TData> extends React.HTMLAttributes<HTMLDivElement> {\n table: ReactTable.Table<TData>;\n}\n\nfunction DataTablePagination<TData>({\n table,\n className,\n ...props\n}: DataTablePaginationProps<TData>): React.JSX.Element {\n return (\n <div className={cn('flex items-center justify-between px-2', className)} {...props}>\n <div className=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div className=\"flex items-center space-x-6 lg:space-x-8\">\n <div className=\"flex items-center space-x-2\">\n <p className=\"text-sm font-medium\">Rows per page</p>\n <Select\n value={String(table.getState().pagination.pageSize)}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-18 h-8\">\n <SelectValue placeholder={table.getState().pagination.pageSize} />\n </SelectTrigger>\n <SelectContent side=\"top\">\n {[10, 20, 30, 40, 50].map((pageSize) => (\n <SelectItem key={pageSize} value={String(pageSize)}>\n {pageSize}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"flex w-28 items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}\n </div>\n <div className=\"flex items-center space-x-2\">\n <Button\n className=\"hidden lg:flex\"\n disabled={!table.getCanPreviousPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.setPageIndex(0);\n }}\n >\n <span className=\"sr-only\">Go to first page</span>\n <DoubleArrowLeftIcon className=\"size-4\" />\n </Button>\n <Button\n disabled={!table.getCanPreviousPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.previousPage();\n }}\n >\n <span className=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n <Button\n disabled={!table.getCanNextPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.nextPage();\n }}\n >\n <span className=\"sr-only\">Go to next page</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n <Button\n className=\"hidden lg:flex\"\n disabled={!table.getCanNextPage()}\n size=\"icon-xs\"\n variant=\"outline\"\n onClick={() => {\n table.setPageIndex(table.getPageCount() - 1);\n }}\n >\n <span className=\"sr-only\">Go to last page</span>\n <DoubleArrowRightIcon className=\"size-4\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: DataTableColumnHeader\n * -------------------------------------------------------------------------- */\n\ninterface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {\n column: ReactTable.Column<TData, TValue>;\n title: string;\n}\n\nfunction DataTableColumnHeader<TData, TValue>({\n column,\n title,\n className,\n}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {\n if (!column.getCanSort()) {\n return <div className={className}>{title}</div>;\n }\n\n return (\n <div className={cn('flex items-center space-x-2', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button className=\"data-[state=open]:bg-accent -ml-3\" size=\"xs\" variant=\"ghost\">\n <span>{title}</span>\n <SortIcon sorted={column.getIsSorted()} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\">\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(false);\n }}\n >\n <ArrowUpIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={() => {\n column.toggleSorting(true);\n }}\n >\n <ArrowDownIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => {\n column.toggleVisibility(false);\n }}\n >\n <EyeNoneIcon className=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Hide\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction SortIcon({ sorted }: { sorted: false | ReactTable.SortDirection }): React.JSX.Element {\n switch (sorted) {\n case 'desc':\n return <ArrowDownIcon className=\"ml-2 size-4\" />;\n\n case 'asc':\n return <ArrowUpIcon className=\"ml-2 size-4\" />;\n\n default:\n return <CaretSortIcon className=\"ml-2 size-4\" />;\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n DataTableViewOptions,\n DataTablePagination,\n DataTableColumnHeader,\n type DataTableViewOptionsProps,\n type DataTablePaginationProps,\n type DataTableColumnHeaderProps,\n};\n"],"mappings":"yRAGA,OACE,iBAAAA,EACA,eAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,eAAAC,EACA,uBAAAC,MACK,wBA2BC,OACE,OAAAC,EADF,QAAAC,MAAA,oBAJR,SAASC,EAA4B,CAAE,MAAAC,CAAM,EAAwD,CACnG,OACEF,EAACG,EAAA,CACC,UAAAJ,EAACK,EAAA,CAAoB,QAAO,GAC1B,SAAAJ,EAACK,EAAA,CAAO,UAAU,6BAA6B,KAAK,KAAK,QAAQ,UAC/D,UAAAN,EAACO,EAAA,CAAoB,UAAU,cAAc,EAAE,QAEjD,EACF,EACAN,EAACO,EAAA,CAAoB,MAAM,MAAM,UAAU,OACzC,UAAAR,EAACS,EAAA,CAAkB,0BAAc,EACjCT,EAACU,EAAA,EAAsB,EACtBP,EACE,cAAc,EACd,OAAQQ,GAAW,OAAOA,EAAO,WAA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CAAoB,MAAM,QACzB,UAAAP,EAAC8B,EAAA,CACC,QAAS,IAAM,CACbpB,EAAO,cAAc,EAAK,CAC5B,EAEA,UAAAX,EAACgC,EAAA,CAAY,UAAU,yCAAyC,EAAE,OAEpE,EACA/B,EAAC8B,EAAA,CACC,QAAS,IAAM,CACbpB,EAAO,cAAc,EAAI,CAC3B,EAEA,UAAAX,EAACiC,EAAA,CAAc,UAAU,yCAAyC,EAAE,QAEtE,EACAjC,EAACU,EAAA,EAAsB,EACvBT,EAAC8B,EAAA,CACC,QAAS,IAAM,CACbpB,EAAO,iBAAiB,EAAK,CAC/B,EAEA,UAAAX,EAACkC,EAAA,CAAY,UAAU,yCAAyC,EAAE,QAEpE,GACF,GACF,EACF,EAxCOlC,EAAC,OAAI,UAAWe,EAAY,SAAAc,EAAM,CA0C7C,CAEA,SAASC,EAAS,CAAE,OAAAK,CAAO,EAAoE,CAC7F,OAAQA,EAAQ,CACd,IAAK,OACH,OAAOnC,EAACiC,EAAA,CAAc,UAAU,cAAc,EAEhD,IAAK,MACH,OAAOjC,EAACgC,EAAA,CAAY,UAAU,cAAc,EAE9C,QACE,OAAOhC,EAACoC,EAAA,CAAc,UAAU,cAAc,CAClD,CACF","names":["ArrowDownIcon","ArrowUpIcon","CaretSortIcon","ChevronLeftIcon","ChevronRightIcon","DoubleArrowLeftIcon","DoubleArrowRightIcon","EyeNoneIcon","MixerHorizontalIcon","jsx","jsxs","DataTableViewOptions","table","DropdownMenu","DropdownMenuTrigger","Button","MixerHorizontalIcon","DropdownMenuContent","DropdownMenuLabel","DropdownMenuSeparator","column","DropdownMenuCheckboxItem","value","DataTablePagination","className","props","cn","Select","SelectTrigger","SelectValue","SelectContent","pageSize","SelectItem","DoubleArrowLeftIcon","ChevronLeftIcon","ChevronRightIcon","DoubleArrowRightIcon","DataTableColumnHeader","title","SortIcon","DropdownMenuItem","ArrowUpIcon","ArrowDownIcon","EyeNoneIcon","sorted","CaretSortIcon"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkRHFF4JNHjs = require('../chunk-RHFF4JNH.js');require('../chunk-HQ4AUOQM.js');exports.DropdownMenu = _chunkRHFF4JNHjs.a; exports.DropdownMenuCheckboxItem = _chunkRHFF4JNHjs.j; exports.DropdownMenuContent = _chunkRHFF4JNHjs.h; exports.DropdownMenuGroup = _chunkRHFF4JNHjs.c; exports.DropdownMenuItem = _chunkRHFF4JNHjs.i; exports.DropdownMenuLabel = _chunkRHFF4JNHjs.l; exports.DropdownMenuRadioGroup = _chunkRHFF4JNHjs.e; exports.DropdownMenuRadioItem = _chunkRHFF4JNHjs.k; exports.DropdownMenuSeparator = _chunkRHFF4JNHjs.m; exports.DropdownMenuShortcut = _chunkRHFF4JNHjs.n; exports.DropdownMenuSub = _chunkRHFF4JNHjs.d; exports.DropdownMenuSubContent = _chunkRHFF4JNHjs.g; exports.DropdownMenuSubTrigger = _chunkRHFF4JNHjs.f; exports.DropdownMenuTrigger = _chunkRHFF4JNHjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunk63XEM5BBjs = require('../chunk-63XEM5BB.js');require('../chunk-HQ4AUOQM.js');exports.DropdownMenu = _chunk63XEM5BBjs.a; exports.DropdownMenuCheckboxItem = _chunk63XEM5BBjs.j; exports.DropdownMenuContent = _chunk63XEM5BBjs.h; exports.DropdownMenuGroup = _chunk63XEM5BBjs.c; exports.DropdownMenuItem = _chunk63XEM5BBjs.i; exports.DropdownMenuLabel = _chunk63XEM5BBjs.l; exports.DropdownMenuRadioGroup = _chunk63XEM5BBjs.e; exports.DropdownMenuRadioItem = _chunk63XEM5BBjs.k; exports.DropdownMenuSeparator = _chunk63XEM5BBjs.m; exports.DropdownMenuShortcut = _chunk63XEM5BBjs.n; exports.DropdownMenuSub = _chunk63XEM5BBjs.d; exports.DropdownMenuSubContent = _chunk63XEM5BBjs.g; exports.DropdownMenuSubTrigger = _chunk63XEM5BBjs.f; exports.DropdownMenuTrigger = _chunk63XEM5BBjs.b;
2
2
  //# sourceMappingURL=dropdown-menu.js.map
@@ -1,2 +1,2 @@
1
- "use client";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunk-BM5KYF6Y.mjs";import"../chunk-LEUB3C3L.mjs";export{a as DropdownMenu,j as DropdownMenuCheckboxItem,h as DropdownMenuContent,c as DropdownMenuGroup,i as DropdownMenuItem,l as DropdownMenuLabel,e as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,d as DropdownMenuSub,g as DropdownMenuSubContent,f as DropdownMenuSubTrigger,b as DropdownMenuTrigger};
1
+ "use client";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunk-4WTCCXNP.mjs";import"../chunk-LEUB3C3L.mjs";export{a as DropdownMenu,j as DropdownMenuCheckboxItem,h as DropdownMenuContent,c as DropdownMenuGroup,i as DropdownMenuItem,l as DropdownMenuLabel,e as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,d as DropdownMenuSub,g as DropdownMenuSubContent,f as DropdownMenuSubTrigger,b as DropdownMenuTrigger};
2
2
  //# sourceMappingURL=dropdown-menu.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";var _chunkPRCS3RWNjs = require('../chunk-PRCS3RWN.js');var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _react = require('react'); var t = _interopRequireWildcard(_react);var _reactslot = require('@radix-ui/react-slot');var _reacthookform = require('react-hook-form');var _jsxruntime = require('react/jsx-runtime');var p=t.createContext(null),c=t.createContext(null),n= exports.useFormField =()=>{let e=t.useContext(p),r=t.useContext(c),{getFieldState:o,formState:m}=_reacthookform.useFormContext.call(void 0, );if(!e||!r)throw new Error("useFormField should be used within <FormField>");let s=o(e.name,m),{id:i}=r;return{id:i,name:e.name,formItemId:`form-item-${i}`,formDescriptionId:`form-item-description-${i}`,formMessageId:`form-item-message-${i}`,...s}},b= exports.Form =_reacthookform.FormProvider;function h({...e}){return _jsxruntime.jsx.call(void 0, p.Provider,{value:{name:e.name},children:_jsxruntime.jsx.call(void 0, _reacthookform.Controller,{...e})})}var R=t.forwardRef(({className:e,...r},o)=>{let m=t.useId();return _jsxruntime.jsx.call(void 0, c.Provider,{value:{id:m},children:_jsxruntime.jsx.call(void 0, "div",{ref:o,className:_chunkHQ4AUOQMjs.b.call(void 0, "space-y-2",e),...r})})});R.displayName="FormItem";var g=t.forwardRef(({className:e,...r},o)=>{let{error:m,formItemId:s}=n();return _jsxruntime.jsx.call(void 0, _chunkPRCS3RWNjs.a,{ref:o,className:_chunkHQ4AUOQMjs.b.call(void 0, m&&"text-destructive",e),htmlFor:s,...r})});g.displayName="FormLabel";var I=t.forwardRef(({...e},r)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=n();return _jsxruntime.jsx.call(void 0, _reactslot.Slot,{ref:r,id:m,"aria-describedby":o?`${s} ${i}`:s,"aria-invalid":!!o,...e})});I.displayName="FormControl";var x=t.forwardRef(({className:e,...r},o)=>{let{formDescriptionId:m}=n();return _jsxruntime.jsx.call(void 0, "p",{ref:o,id:m,className:_chunkHQ4AUOQMjs.b.call(void 0, "text-muted-foreground text-xs",e),...r})});x.displayName="FormDescription";var C=t.forwardRef(({children:e,className:r,...o},m)=>{let{error:s,formMessageId:i}=n(),d=_optionalChain([s, 'optionalAccess', _ => _.message])?String(s.message):e;return d?_jsxruntime.jsx.call(void 0, "p",{ref:m,id:i,className:_chunkHQ4AUOQMjs.b.call(void 0, "text-destructive text-xs font-medium",r),...o,children:d}):null});C.displayName="FormMessage";exports.Form = b; exports.FormControl = I; exports.FormDescription = x; exports.FormField = h; exports.FormItem = R; exports.FormLabel = g; exports.FormMessage = C; exports.useFormField = n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";var _chunkPRCS3RWNjs = require('../chunk-PRCS3RWN.js');var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _react = require('react'); var t = _interopRequireWildcard(_react);var _reactslot = require('@radix-ui/react-slot');var _reacthookform = require('react-hook-form');var _jsxruntime = require('react/jsx-runtime');var p=t.createContext(null),c=t.createContext(null),n= exports.useFormField =()=>{let e=t.useContext(p),r=t.useContext(c),{getFieldState:o,formState:m}=_reacthookform.useFormContext.call(void 0, );if(!e||!r)throw new Error("useFormField should be used within <FormField>");let s=o(e.name,m),{id:i}=r;return{id:i,name:e.name,formItemId:`form-item-${i}`,formDescriptionId:`form-item-description-${i}`,formMessageId:`form-item-message-${i}`,...s}},b= exports.Form =_reacthookform.FormProvider;function h({...e}){return _jsxruntime.jsx.call(void 0, p.Provider,{value:{name:e.name},children:_jsxruntime.jsx.call(void 0, _reacthookform.Controller,{...e})})}var R=t.forwardRef(({className:e,...r},o)=>{let m=t.useId();return _jsxruntime.jsx.call(void 0, c.Provider,{value:{id:m},children:_jsxruntime.jsx.call(void 0, "div",{ref:o,className:_chunkHQ4AUOQMjs.b.call(void 0, "space-y-2",e),...r})})});R.displayName="FormItem";var g=t.forwardRef(({className:e,...r},o)=>{let{error:m,formItemId:s}=n();return _jsxruntime.jsx.call(void 0, _chunkPRCS3RWNjs.a,{ref:o,className:_chunkHQ4AUOQMjs.b.call(void 0, m&&"text-destructive",e),htmlFor:s,...r})});g.displayName="FormLabel";var I=t.forwardRef(({...e},r)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=n();return _jsxruntime.jsx.call(void 0, _reactslot.Slot,{ref:r,"aria-describedby":o?`${s} ${i}`:s,"aria-invalid":!!o,id:m,...e})});I.displayName="FormControl";var x=t.forwardRef(({className:e,...r},o)=>{let{formDescriptionId:m}=n();return _jsxruntime.jsx.call(void 0, "p",{ref:o,className:_chunkHQ4AUOQMjs.b.call(void 0, "text-muted-foreground text-xs",e),id:m,...r})});x.displayName="FormDescription";var C=t.forwardRef(({children:e,className:r,...o},m)=>{let{error:s,formMessageId:i}=n(),d=_optionalChain([s, 'optionalAccess', _ => _.message])?String(s.message):e;return d?_jsxruntime.jsx.call(void 0, "p",{ref:m,className:_chunkHQ4AUOQMjs.b.call(void 0, "text-destructive text-xs font-medium",r),id:i,...o,children:d}):null});C.displayName="FormMessage";exports.Form = b; exports.FormControl = I; exports.FormDescription = x; exports.FormField = h; exports.FormItem = R; exports.FormLabel = g; exports.FormMessage = C; exports.useFormField = n;
2
2
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/form.tsx"],"names":["React","Slot","Controller","FormProvider","useFormContext","jsx","FormFieldContext","FormItemContext","useFormField","fieldContext","itemContext","getFieldState","formState","fieldState","id","Form","FormField","props","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","FormDescription","FormMessage","children","body"],"mappings":"+FAEA,UAAYA,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OACE,cAAAC,EAMA,gBAAAC,EAEA,kBAAAC,MACK,kBAgFD,cAAAC,MAAA,oBA5DN,IAAMC,EAAyB,gBAA4C,IAAI,EAEzEC,EAAwB,gBAA2C,IAAI,EAEvEC,EAAe,IAWhB,CACH,IAAMC,EAAqB,aAAWH,CAAgB,EAChDI,EAAoB,aAAWH,CAAe,EAC9C,CAAE,cAAAI,EAAe,UAAAC,CAAU,EAAIR,EAAe,EAEpD,GAAI,CAACK,GAAgB,CAACC,EACpB,MAAM,IAAI,MAAM,gDAAgD,EAGlE,IAAMG,EAAaF,EAAcF,EAAa,KAAMG,CAAS,EAEvD,CAAE,GAAAE,CAAG,EAAIJ,EAEf,MAAO,CACL,GAAAI,EACA,KAAML,EAAa,KACnB,WAAY,aAAaK,CAAE,GAC3B,kBAAmB,yBAAyBA,CAAE,GAC9C,cAAe,qBAAqBA,CAAE,GACtC,GAAGD,CACL,CACF,EAOME,EAAOZ,EAWb,SAASa,EAGP,CAAE,GAAGC,CAAM,EAA2D,CACtE,OACEZ,EAACC,EAAiB,SAAjB,CAA0B,MAAO,CAAE,KAAMW,EAAM,IAAK,EACnD,SAAAZ,EAACH,EAAA,CAAY,GAAGe,EAAO,EACzB,CAEJ,CASA,IAAMC,EAAiB,aAA2C,CAAC,CAAE,UAAAC,EAAW,GAAGF,CAAM,EAAGG,IAAQ,CAClG,IAAMN,EAAW,QAAM,EAEvB,OACET,EAACE,EAAgB,SAAhB,CAAyB,MAAO,CAAE,GAAAO,CAAG,EACpC,SAAAT,EAAC,OAAI,IAAKe,EAAK,UAAWC,EAAG,YAAaF,CAAS,EAAI,GAAGF,EAAO,EACnE,CAEJ,CAAC,EAEDC,EAAS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IAQX,CAAC,EAEDF,EAAY,YAAc","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n type ControllerProps,\n type FieldError,\n type FieldErrorsImpl,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type Merge,\n useFormContext,\n} from 'react-hook-form';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\n/* -----------------------------------------------------------------------------\n * Context: Form\n * -------------------------------------------------------------------------- */\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\n\nconst FormItemContext = React.createContext<FormItemContextValue | null>(null);\n\nconst useFormField = (): {\n error?: FieldError | Merge<FieldError, FieldErrorsImpl> | undefined;\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n} => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n if (!fieldContext || !itemContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `form-item-${id}`,\n formDescriptionId: `form-item-description-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n};\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\ntype FormProps = React.ComponentProps<typeof FormProvider>;\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\ntype FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = ControllerProps<TFieldValues, TName>;\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: FormFieldProps<TFieldValues, TName>): React.JSX.Element {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\ntype FormItemElement = HTMLDivElement;\ntype FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\n\nFormItem.displayName = 'FormItem';\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\ntype FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;\ntype FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;\n});\n\nFormLabel.displayName = 'FormLabel';\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\ntype FormControlElement = React.ElementRef<typeof Slot>;\ntype FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={Boolean(error)}\n {...props}\n />\n );\n});\n\nFormControl.displayName = 'FormControl';\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\ntype FormDescriptionElement = HTMLParagraphElement;\ntype FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} id={formDescriptionId} className={cn('text-muted-foreground text-xs', className)} {...props} />;\n },\n);\n\nFormDescription.displayName = 'FormDescription';\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\ntype FormMessageElement = HTMLParagraphElement;\ntype FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(({ children, className, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p ref={ref} id={formMessageId} className={cn('text-destructive text-xs font-medium', className)} {...props}>\n {body}\n </p>\n );\n});\n\nFormMessage.displayName = 'FormMessage';\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n type FormProps,\n type FormItemProps,\n type FormLabelProps,\n type FormControlProps,\n type FormDescriptionProps,\n type FormMessageProps,\n type FormFieldProps,\n};\n"]}
1
+ {"version":3,"sources":["../../src/react/form.tsx"],"names":["React","Slot","Controller","FormProvider","useFormContext","jsx","FormFieldContext","FormItemContext","useFormField","fieldContext","itemContext","getFieldState","formState","fieldState","id","Form","FormField","props","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","FormDescription","FormMessage","children","body"],"mappings":"+FAEA,UAAYA,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OACE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,UAAWC,EAAGE,GAAS,mBAAoBJ,CAAS,EAAG,QAASK,EAAa,GAAGP,EAAO,CACjH,CAAC,EAEDK,EAAU,YAAc,YASxB,IAAMI,EAAoB,aAAiD,CAAC,CAAE,GAAGT,CAAM,EAAGG,IAAQ,CAChG,GAAM,CAAE,MAAAG,EAAO,WAAAC,EAAY,kBAAAG,EAAmB,cAAAC,CAAc,EAAIpB,EAAa,EAE7E,OACEH,EAACJ,EAAA,CACC,IAAKmB,EACL,mBAAmBG,EAA4B,GAAGI,CAAiB,IAAIC,CAAa,GAAzDD,EAC3B,eAAc,EAAQJ,EACtB,GAAIC,EACH,GAAGP,EACN,CAEJ,CAAC,EAEDS,EAAY,YAAc,cAS1B,IAAMG,EAAwB,aAC5B,CAAC,CAAE,UAAAV,EAAW,GAAGF,CAAM,EAAGG,IAAQ,CAChC,GAAM,CAAE,kBAAAO,CAAkB,EAAInB,EAAa,EAE3C,OAAOH,EAAC,KAAE,IAAKe,EAAK,UAAWC,EAAG,gCAAiCF,CAAS,EAAG,GAAIQ,EAAoB,GAAGV,EAAO,CACnH,CACF,EAEAY,EAAgB,YAAc,kBAS9B,IAAMC,EAAoB,aAAiD,CAAC,CAAE,SAAAC,EAAU,UAAAZ,EAAW,GAAGF,CAAM,EAAGG,IAAQ,CACrH,GAAM,CAAE,MAAAG,EAAO,cAAAK,CAAc,EAAIpB,EAAa,EACxCwB,EAAOT,GAAO,QAAU,OAAOA,EAAM,OAAO,EAAIQ,EAEtD,OAAKC,EAKH3B,EAAC,KAAE,IAAKe,EAAK,UAAWC,EAAG,uCAAwCF,CAAS,EAAG,GAAIS,EAAgB,GAAGX,EACnG,SAAAe,EACH,EANO,IAQX,CAAC,EAEDF,EAAY,YAAc","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n type ControllerProps,\n type FieldError,\n type FieldErrorsImpl,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type Merge,\n useFormContext,\n} from 'react-hook-form';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\n/* -----------------------------------------------------------------------------\n * Context: Form\n * -------------------------------------------------------------------------- */\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\n\nconst FormItemContext = React.createContext<FormItemContextValue | null>(null);\n\nconst useFormField = (): {\n error?: FieldError | Merge<FieldError, FieldErrorsImpl> | undefined;\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n} => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n if (!fieldContext || !itemContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `form-item-${id}`,\n formDescriptionId: `form-item-description-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n};\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\ntype FormProps = React.ComponentProps<typeof FormProvider>;\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\ntype FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = ControllerProps<TFieldValues, TName>;\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: FormFieldProps<TFieldValues, TName>): React.JSX.Element {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\ntype FormItemElement = HTMLDivElement;\ntype FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\n\nFormItem.displayName = 'FormItem';\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\ntype FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;\ntype FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;\n});\n\nFormLabel.displayName = 'FormLabel';\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\ntype FormControlElement = React.ElementRef<typeof Slot>;\ntype FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={Boolean(error)}\n id={formItemId}\n {...props}\n />\n );\n});\n\nFormControl.displayName = 'FormControl';\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\ntype FormDescriptionElement = HTMLParagraphElement;\ntype FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} className={cn('text-muted-foreground text-xs', className)} id={formDescriptionId} {...props} />;\n },\n);\n\nFormDescription.displayName = 'FormDescription';\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\ntype FormMessageElement = HTMLParagraphElement;\ntype FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(({ children, className, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p ref={ref} className={cn('text-destructive text-xs font-medium', className)} id={formMessageId} {...props}>\n {body}\n </p>\n );\n});\n\nFormMessage.displayName = 'FormMessage';\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n type FormProps,\n type FormItemProps,\n type FormLabelProps,\n type FormControlProps,\n type FormDescriptionProps,\n type FormMessageProps,\n type FormFieldProps,\n};\n"]}
@@ -1,2 +1,2 @@
1
- "use client";import{a as F}from"../chunk-HMD2ZU33.mjs";import{b as a}from"../chunk-LEUB3C3L.mjs";import*as t from"react";import{Slot as u}from"@radix-ui/react-slot";import{Controller as f,FormProvider as P,useFormContext as y}from"react-hook-form";import{jsx as l}from"react/jsx-runtime";var p=t.createContext(null),c=t.createContext(null),n=()=>{let e=t.useContext(p),r=t.useContext(c),{getFieldState:o,formState:m}=y();if(!e||!r)throw new Error("useFormField should be used within <FormField>");let s=o(e.name,m),{id:i}=r;return{id:i,name:e.name,formItemId:`form-item-${i}`,formDescriptionId:`form-item-description-${i}`,formMessageId:`form-item-message-${i}`,...s}},b=P;function h({...e}){return l(p.Provider,{value:{name:e.name},children:l(f,{...e})})}var R=t.forwardRef(({className:e,...r},o)=>{let m=t.useId();return l(c.Provider,{value:{id:m},children:l("div",{ref:o,className:a("space-y-2",e),...r})})});R.displayName="FormItem";var g=t.forwardRef(({className:e,...r},o)=>{let{error:m,formItemId:s}=n();return l(F,{ref:o,className:a(m&&"text-destructive",e),htmlFor:s,...r})});g.displayName="FormLabel";var I=t.forwardRef(({...e},r)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=n();return l(u,{ref:r,id:m,"aria-describedby":o?`${s} ${i}`:s,"aria-invalid":!!o,...e})});I.displayName="FormControl";var x=t.forwardRef(({className:e,...r},o)=>{let{formDescriptionId:m}=n();return l("p",{ref:o,id:m,className:a("text-muted-foreground text-xs",e),...r})});x.displayName="FormDescription";var C=t.forwardRef(({children:e,className:r,...o},m)=>{let{error:s,formMessageId:i}=n(),d=s?.message?String(s.message):e;return d?l("p",{ref:m,id:i,className:a("text-destructive text-xs font-medium",r),...o,children:d}):null});C.displayName="FormMessage";export{b as Form,I as FormControl,x as FormDescription,h as FormField,R as FormItem,g as FormLabel,C as FormMessage,n as useFormField};
1
+ "use client";import{a as F}from"../chunk-HMD2ZU33.mjs";import{b as a}from"../chunk-LEUB3C3L.mjs";import*as t from"react";import{Slot as u}from"@radix-ui/react-slot";import{Controller as f,FormProvider as P,useFormContext as y}from"react-hook-form";import{jsx as l}from"react/jsx-runtime";var p=t.createContext(null),c=t.createContext(null),n=()=>{let e=t.useContext(p),r=t.useContext(c),{getFieldState:o,formState:m}=y();if(!e||!r)throw new Error("useFormField should be used within <FormField>");let s=o(e.name,m),{id:i}=r;return{id:i,name:e.name,formItemId:`form-item-${i}`,formDescriptionId:`form-item-description-${i}`,formMessageId:`form-item-message-${i}`,...s}},b=P;function h({...e}){return l(p.Provider,{value:{name:e.name},children:l(f,{...e})})}var R=t.forwardRef(({className:e,...r},o)=>{let m=t.useId();return l(c.Provider,{value:{id:m},children:l("div",{ref:o,className:a("space-y-2",e),...r})})});R.displayName="FormItem";var g=t.forwardRef(({className:e,...r},o)=>{let{error:m,formItemId:s}=n();return l(F,{ref:o,className:a(m&&"text-destructive",e),htmlFor:s,...r})});g.displayName="FormLabel";var I=t.forwardRef(({...e},r)=>{let{error:o,formItemId:m,formDescriptionId:s,formMessageId:i}=n();return l(u,{ref:r,"aria-describedby":o?`${s} ${i}`:s,"aria-invalid":!!o,id:m,...e})});I.displayName="FormControl";var x=t.forwardRef(({className:e,...r},o)=>{let{formDescriptionId:m}=n();return l("p",{ref:o,className:a("text-muted-foreground text-xs",e),id:m,...r})});x.displayName="FormDescription";var C=t.forwardRef(({children:e,className:r,...o},m)=>{let{error:s,formMessageId:i}=n(),d=s?.message?String(s.message):e;return d?l("p",{ref:m,className:a("text-destructive text-xs font-medium",r),id:i,...o,children:d}):null});C.displayName="FormMessage";export{b as Form,I as FormControl,x as FormDescription,h as FormField,R as FormItem,g as FormLabel,C as FormMessage,n as useFormField};
2
2
  //# sourceMappingURL=form.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/form.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n type ControllerProps,\n type FieldError,\n type FieldErrorsImpl,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type Merge,\n useFormContext,\n} from 'react-hook-form';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\n/* -----------------------------------------------------------------------------\n * Context: Form\n * -------------------------------------------------------------------------- */\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\n\nconst FormItemContext = React.createContext<FormItemContextValue | null>(null);\n\nconst useFormField = (): {\n error?: FieldError | Merge<FieldError, FieldErrorsImpl> | undefined;\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n} => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n if (!fieldContext || !itemContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `form-item-${id}`,\n formDescriptionId: `form-item-description-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n};\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\ntype FormProps = React.ComponentProps<typeof FormProvider>;\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\ntype FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = ControllerProps<TFieldValues, TName>;\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: FormFieldProps<TFieldValues, TName>): React.JSX.Element {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\ntype FormItemElement = HTMLDivElement;\ntype FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\n\nFormItem.displayName = 'FormItem';\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\ntype FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;\ntype FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;\n});\n\nFormLabel.displayName = 'FormLabel';\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\ntype FormControlElement = React.ElementRef<typeof Slot>;\ntype FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={Boolean(error)}\n {...props}\n />\n );\n});\n\nFormControl.displayName = 'FormControl';\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\ntype FormDescriptionElement = HTMLParagraphElement;\ntype FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} id={formDescriptionId} className={cn('text-muted-foreground text-xs', className)} {...props} />;\n },\n);\n\nFormDescription.displayName = 'FormDescription';\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\ntype FormMessageElement = HTMLParagraphElement;\ntype FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(({ children, className, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p ref={ref} id={formMessageId} className={cn('text-destructive text-xs font-medium', className)} {...props}>\n {body}\n </p>\n );\n});\n\nFormMessage.displayName = 'FormMessage';\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n type FormProps,\n type FormItemProps,\n type FormLabelProps,\n type FormControlProps,\n type FormDescriptionProps,\n type FormMessageProps,\n type FormFieldProps,\n};\n"],"mappings":"iGAEA,UAAYA,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OACE,cAAAC,EAMA,gBAAAC,EAEA,kBAAAC,MACK,kBAgFD,cAAAC,MAAA,oBA5DN,IAAMC,EAAyB,gBAA4C,IAAI,EAEzEC,EAAwB,gBAA2C,IAAI,EAEvEC,EAAe,IAWhB,CACH,IAAMC,EAAqB,aAAWH,CAAgB,EAChDI,EAAoB,aAAWH,CAAe,EAC9C,CAAE,cAAAI,EAAe,UAAAC,CAAU,EAAIC,EAAe,EAEpD,GAAI,CAACJ,GAAgB,CAACC,EACpB,MAAM,IAAI,MAAM,gDAAgD,EAGlE,IAAMI,EAAaH,EAAcF,EAAa,KAAMG,CAAS,EAEvD,CAAE,GAAAG,CAAG,EAAIL,EAEf,MAAO,CACL,GAAAK,EACA,KAAMN,EAAa,KACnB,WAAY,aAAaM,CAAE,GAC3B,kBAAmB,yBAAyBA,CAAE,GAC9C,cAAe,qBAAqBA,CAAE,GACtC,GAAGD,CACL,CACF,EAOME,EAAOC,EAWb,SAASC,EAGP,CAAE,GAAGC,CAAM,EAA2D,CACtE,OACEd,EAACC,EAAiB,SAAjB,CAA0B,MAAO,CAAE,KAAMa,EAAM,IAAK,EACnD,SAAAd,EAACe,EAAA,CAAY,GAAGD,EAAO,EACzB,CAEJ,CASA,IAAME,EAAiB,aAA2C,CAAC,CAAE,UAAAC,EAAW,GAAGH,CAAM,EAAGI,IAAQ,CAClG,IAAMR,EA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vB,EAAa,EACxC4B,EAAOV,GAAO,QAAU,OAAOA,EAAM,OAAO,EAAIS,EAEtD,OAAKC,EAKH/B,EAAC,KAAE,IAAKkB,EAAK,GAAIQ,EAAe,UAAWP,EAAG,uCAAwCF,CAAS,EAAI,GAAGH,EACnG,SAAAiB,EACH,EANO,IAQX,CAAC,EAEDF,EAAY,YAAc","names":["React","Slot","Controller","FormProvider","useFormContext","jsx","FormFieldContext","FormItemContext","useFormField","fieldContext","itemContext","getFieldState","formState","useFormContext","fieldState","id","Form","FormProvider","FormField","props","Controller","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body"]}
1
+ {"version":3,"sources":["../../src/react/form.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n type ControllerProps,\n type FieldError,\n type FieldErrorsImpl,\n type FieldPath,\n type FieldValues,\n FormProvider,\n type Merge,\n useFormContext,\n} from 'react-hook-form';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\n/* -----------------------------------------------------------------------------\n * Context: Form\n * -------------------------------------------------------------------------- */\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\n\nconst FormItemContext = React.createContext<FormItemContextValue | null>(null);\n\nconst useFormField = (): {\n error?: FieldError | Merge<FieldError, FieldErrorsImpl> | undefined;\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n} => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n if (!fieldContext || !itemContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `form-item-${id}`,\n formDescriptionId: `form-item-description-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n};\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\ntype FormProps = React.ComponentProps<typeof FormProvider>;\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\ntype FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = ControllerProps<TFieldValues, TName>;\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: FormFieldProps<TFieldValues, TName>): React.JSX.Element {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\ntype FormItemElement = HTMLDivElement;\ntype FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\n\nFormItem.displayName = 'FormItem';\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\ntype FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;\ntype FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;\n});\n\nFormLabel.displayName = 'FormLabel';\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\ntype FormControlElement = React.ElementRef<typeof Slot>;\ntype FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={Boolean(error)}\n id={formItemId}\n {...props}\n />\n );\n});\n\nFormControl.displayName = 'FormControl';\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\ntype FormDescriptionElement = HTMLParagraphElement;\ntype FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} className={cn('text-muted-foreground text-xs', className)} id={formDescriptionId} {...props} />;\n },\n);\n\nFormDescription.displayName = 'FormDescription';\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\ntype FormMessageElement = HTMLParagraphElement;\ntype FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(({ children, className, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p ref={ref} className={cn('text-destructive text-xs font-medium', className)} id={formMessageId} {...props}>\n {body}\n </p>\n );\n});\n\nFormMessage.displayName = 'FormMessage';\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n type FormProps,\n type FormItemProps,\n type FormLabelProps,\n type FormControlProps,\n type FormDescriptionProps,\n type FormMessageProps,\n type FormFieldProps,\n};\n"],"mappings":"iGAEA,UAAYA,MAAW,QACvB,OAAS,QAAAC,MAAY,uBACrB,OACE,cAAAC,EAMA,gBAAAC,EAEA,kBAAAC,MACK,kBAgFD,cAAAC,MAAA,oBA5DN,IAAMC,EAAyB,gBAA4C,IAAI,EAEzEC,EAAwB,gBAA2C,IAAI,EAEvEC,EAAe,IAWhB,CACH,IAAMC,EAAqB,aAAWH,CAAgB,EAChDI,EAAoB,aAAWH,CAAe,EAC9C,CAAE,cAAAI,EAAe,UAAAC,CAAU,EAAIC,EAAe,EAEpD,GAAI,CAACJ,GAAgB,CAACC,EACpB,MAAM,IAAI,MAAM,gDAAgD,EAGlE,IAAMI,EAAaH,EAAcF,EAAa,KAAMG,CAAS,EAEvD,CAAE,GAAAG,CAAG,EAAIL,EAEf,MAAO,CACL,GAAAK,EACA,KAAMN,EAAa,KACnB,WAAY,aAAaM,CAAE,GAC3B,kBAAmB,yBAAyBA,CAAE,GAC9C,cAAe,qBAAqBA,CAAE,GACtC,GAAGD,CACL,CACF,EAOME,EAAOC,EAWb,SAASC,EAGP,CAAE,GAAGC,CAAM,EAA2D,CACtE,OACEd,EAACC,EAAiB,SAAjB,CAA0B,MAAO,CAAE,KAAMa,EAAM,IAAK,EACnD,SAAAd,EAACe,EAAA,CAAY,GAAGD,EAAO,EACzB,CAEJ,CASA,IAAME,EAAiB,aAA2C,CAAC,CAAE,UAAAC,EAAW,GAAGH,CAAM,EAAGI,IAAQ,CAClG,IAAMR,EAAW,QAAM,EAEvB,OACEV,EAACE,EAAgB,SAAhB,CAAyB,MAAO,CAAE,GAAAQ,CAAG,EACpC,SAAAV,EAAC,OAAI,IAAKkB,EAAK,UAAWC,EAAG,YAAaF,CAAS,EAAI,GAAGH,EAAO,EACnE,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Z,EACnG,SAAAiB,EACH,EANO,IAQX,CAAC,EAEDF,EAAY,YAAc","names":["React","Slot","Controller","FormProvider","useFormContext","jsx","FormFieldContext","FormItemContext","useFormField","fieldContext","itemContext","getFieldState","formState","useFormContext","fieldState","id","Form","FormProvider","FormField","props","Controller","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _react = require('react'); var i = _interopRequireWildcard(_react);var _reacthovercard = require('@radix-ui/react-hover-card'); var e = _interopRequireWildcard(_reacthovercard);var _jsxruntime = require('react/jsx-runtime');var C=e.Root,l= exports.HoverCardTrigger =e.Trigger,p= exports.HoverCardContent =i.forwardRef(({className:t,align:o="center",sideOffset:r=6,...s},n)=>_jsxruntime.jsx.call(void 0, e.Portal,{children:_jsxruntime.jsx.call(void 0, e.Content,{ref:n,align:o,sideOffset:r,className:_chunkHQ4AUOQMjs.b.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 z-50 min-w-32 rounded-md border p-4 shadow-md",t),...s})}));p.displayName=e.Content.displayName;var m=i.forwardRef(({className:t,...o},r)=>_jsxruntime.jsx.call(void 0, e.Arrow,{ref:r,className:_chunkHQ4AUOQMjs.b.call(void 0, "fill-popover",t),...o}));m.displayName=e.Arrow.displayName;exports.HoverCard = C; exports.HoverCardArrow = m; exports.HoverCardContent = p; exports.HoverCardTrigger = l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";var _chunkHQ4AUOQMjs = require('../chunk-HQ4AUOQM.js');var _react = require('react'); var i = _interopRequireWildcard(_react);var _reacthovercard = require('@radix-ui/react-hover-card'); var e = _interopRequireWildcard(_reacthovercard);var _jsxruntime = require('react/jsx-runtime');var C=e.Root,l= exports.HoverCardTrigger =e.Trigger,p= exports.HoverCardContent =i.forwardRef(({className:t,align:o="center",sideOffset:r=6,...s},n)=>_jsxruntime.jsx.call(void 0, e.Portal,{children:_jsxruntime.jsx.call(void 0, e.Content,{ref:n,align:o,className:_chunkHQ4AUOQMjs.b.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 z-50 min-w-32 rounded-md border p-4 shadow-md",t),sideOffset:r,...s})}));p.displayName=e.Content.displayName;var m=i.forwardRef(({className:t,...o},r)=>_jsxruntime.jsx.call(void 0, e.Arrow,{ref:r,className:_chunkHQ4AUOQMjs.b.call(void 0, "fill-popover",t),...o}));m.displayName=e.Arrow.displayName;exports.HoverCard = C; exports.HoverCardArrow = m; exports.HoverCardContent = p; exports.HoverCardTrigger = l;
2
2
  //# sourceMappingURL=hover-card.js.map