@gentleduck/registry-ui 0.2.6 → 0.2.8

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.
@@ -4,15 +4,10 @@ import { cn } from '@gentleduck/libs/cn'
4
4
  import * as SliderPrimitive from '@gentleduck/primitives/slider'
5
5
  import * as React from 'react'
6
6
 
7
- function Slider({
8
- className,
9
- defaultValue,
10
- orientation = 'horizontal',
11
- value,
12
- min = 0,
13
- max = 100,
14
- ...props
15
- }: React.ComponentProps<typeof SliderPrimitive.Root>) {
7
+ const Slider = React.forwardRef<
8
+ React.ComponentRef<typeof SliderPrimitive.Root>,
9
+ React.ComponentProps<typeof SliderPrimitive.Root>
10
+ >(({ className, defaultValue, orientation = 'horizontal', value, min = 0, max = 100, ...props }, ref) => {
16
11
  const _values = React.useMemo(
17
12
  () => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]),
18
13
  [value, defaultValue, min, max],
@@ -20,6 +15,7 @@ function Slider({
20
15
 
21
16
  return (
22
17
  <SliderPrimitive.Root
18
+ ref={ref}
23
19
  data-slot="slider"
24
20
  data-orientation={orientation}
25
21
  defaultValue={defaultValue}
@@ -53,6 +49,7 @@ function Slider({
53
49
  ))}
54
50
  </SliderPrimitive.Root>
55
51
  )
56
- }
52
+ })
53
+ Slider.displayName = 'Slider'
57
54
 
58
55
  export { Slider }
@@ -78,4 +78,6 @@ const SonnerUpload = ({
78
78
  )
79
79
  }
80
80
 
81
+ SonnerUpload.displayName = 'SonnerUpload'
82
+
81
83
  export { SonnerUpload }
@@ -3,29 +3,32 @@
3
3
  import { cn } from '@gentleduck/libs/cn'
4
4
  import { type Direction, useDirection } from '@gentleduck/primitives/direction'
5
5
  import { useTheme } from 'next-themes'
6
- import type * as React from 'react'
6
+ import React from 'react'
7
7
  import { Toaster as Sonner, type ToasterProps } from 'sonner'
8
8
 
9
- const Toaster = ({ dir, className, ...props }: ToasterProps) => {
10
- const { theme = 'system' } = useTheme()
11
- const direction = useDirection(dir as Direction)
9
+ const Toaster = React.forwardRef<React.ComponentRef<typeof Sonner>, ToasterProps>(
10
+ ({ dir, className, ...props }, ref) => {
11
+ const { theme = 'system' } = useTheme()
12
+ const direction = useDirection(dir as Direction)
12
13
 
13
- return (
14
- <Sonner
15
- className={cn('toaster group [&_li>div]:w-full', className)}
16
- dir={direction}
17
- style={
18
- {
19
- '--normal-bg': 'var(--popover)',
20
- '--normal-border': 'var(--border)',
21
- '--normal-text': 'var(--popover-foreground)',
22
- } as React.CSSProperties
23
- }
24
- theme={theme as ToasterProps['theme']}
25
- {...props}
26
- />
27
- )
28
- }
14
+ return (
15
+ <Sonner
16
+ ref={ref}
17
+ className={cn('toaster group [&_li>div]:w-full', className)}
18
+ dir={direction}
19
+ style={
20
+ {
21
+ '--normal-bg': 'var(--popover)',
22
+ '--normal-border': 'var(--border)',
23
+ '--normal-text': 'var(--popover-foreground)',
24
+ } as React.CSSProperties
25
+ }
26
+ theme={theme as ToasterProps['theme']}
27
+ {...props}
28
+ />
29
+ )
30
+ },
31
+ )
29
32
  Toaster.displayName = 'Toaster'
30
33
 
31
34
  export { Toaster }
@@ -10,8 +10,8 @@ export const toggleVariants = cva(
10
10
  variants: {
11
11
  size: {
12
12
  default: 'h-9 px-4 py-2 has-[>svg]:px-3',
13
- lg: 'h-10 min-w-11 px-5 px-6 has-[>svg]:px-4',
14
- sm: 'h-8 min-w-9 gap-1.5 px-2.5 px-3 has-[>svg]:px-2.5',
13
+ lg: 'h-10 min-w-11 px-6 has-[>svg]:px-4',
14
+ sm: 'h-8 min-w-9 gap-1.5 px-3 has-[>svg]:px-2.5',
15
15
  },
16
16
  variant: {
17
17
  default: 'bg-transparent',
@@ -5,10 +5,13 @@ import * as TooltipPrimitive from '@gentleduck/primitives/tooltip'
5
5
  import * as React from 'react'
6
6
 
7
7
  const TooltipProvider = TooltipPrimitive.Provider
8
+ TooltipProvider.displayName = 'TooltipProvider'
8
9
 
9
10
  const Tooltip = TooltipPrimitive.Root
11
+ Tooltip.displayName = 'Tooltip'
10
12
 
11
13
  const TooltipTrigger = TooltipPrimitive.Trigger
14
+ TooltipTrigger.displayName = 'TooltipTrigger'
12
15
 
13
16
  const TooltipContent = React.forwardRef<
14
17
  React.ComponentRef<typeof TooltipPrimitive.Content>,
package/tsconfig.json CHANGED
@@ -24,7 +24,6 @@
24
24
  "dist",
25
25
  "./src/_old",
26
26
  "**/__test__/**",
27
- "**/__test__/**",
28
27
  "**/*.test.ts",
29
28
  "**/*.test.tsx",
30
29
  "**/*.tsbuildinfo",