@gentleduck/registry-ui 0.2.5 → 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.
Files changed (51) hide show
  1. package/.turbo/turbo-check-types.log +1 -0
  2. package/.turbo/turbo-test.log +23 -0
  3. package/CHANGELOG.md +21 -0
  4. package/package.json +9 -8
  5. package/src/_old/_table/index.ts +9 -0
  6. package/src/_old/_table/table.tsx +7 -7
  7. package/src/_old/_upload/index.ts +13 -0
  8. package/src/_old/_upload/upload-sonner.tsx +1 -1
  9. package/src/alert-dialog/alert-dialog.tsx +11 -4
  10. package/src/aspect-ratio/aspect-ratio.tsx +9 -11
  11. package/src/audio/audio-visualizer.tsx +28 -2
  12. package/src/audio/audio.types.ts +1 -2
  13. package/src/button/__test__/button.test.tsx +80 -0
  14. package/src/button/button.tsx +1 -1
  15. package/src/button-group/button-group.tsx +1 -0
  16. package/src/calendar/calendar.tsx +161 -141
  17. package/src/carousel/carousel.tsx +1 -0
  18. package/src/chart/__test__/chart.test.tsx +40 -0
  19. package/src/chart/chart.tsx +16 -7
  20. package/src/checkbox/checkbox.tsx +1 -0
  21. package/src/collapsible/collapsible.tsx +2 -1
  22. package/src/combobox/combobox.tsx +96 -69
  23. package/src/command/command.tsx +34 -37
  24. package/src/context-menu/context-menu.tsx +11 -3
  25. package/src/dialog/dialog-responsive.tsx +12 -1
  26. package/src/dialog/dialog.tsx +12 -4
  27. package/src/dropdown-menu/dropdown-menu.tsx +11 -3
  28. package/src/empty/empty.tsx +30 -17
  29. package/src/field/field.tsx +138 -109
  30. package/src/input-group/input-group.tsx +3 -0
  31. package/src/item/item.tsx +1 -0
  32. package/src/json-editor/json-editor.tsx +59 -60
  33. package/src/json-editor/json-editor.view.tsx +1 -0
  34. package/src/label/label.tsx +1 -0
  35. package/src/menubar/menubar.tsx +10 -3
  36. package/src/popover/popover.tsx +4 -0
  37. package/src/preview-panel/preview-panel-dialog.tsx +86 -80
  38. package/src/preview-panel/preview-panel.tsx +280 -273
  39. package/src/resizable/resizable.tsx +17 -15
  40. package/src/select/select.tsx +3 -0
  41. package/src/separator/separator.tsx +0 -1
  42. package/src/sheet/sheet.tsx +16 -4
  43. package/src/sidebar/sidebar.tsx +436 -378
  44. package/src/slider/slider.tsx +8 -10
  45. package/src/sonner/sonner.chunks.tsx +3 -0
  46. package/src/sonner/sonner.tsx +23 -20
  47. package/src/switch/switch.tsx +1 -0
  48. package/src/tabs/tabs.tsx +2 -2
  49. package/src/toggle/toggle.constants.ts +2 -2
  50. package/src/tooltip/tooltip.tsx +3 -0
  51. package/tsconfig.json +10 -1
@@ -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}
@@ -46,12 +42,14 @@ function Slider({
46
42
  <SliderPrimitive.Thumb
47
43
  data-orientation={orientation}
48
44
  data-slot="slider-thumb"
45
+ // biome-ignore lint/suspicious/noArrayIndexKey: thumbs are positional, index is the stable key
49
46
  key={index}
50
47
  className="relative block size-4 shrink-0 select-none rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] after:absolute after:-inset-2 hover:ring-3 focus-visible:outline-hidden focus-visible:ring-3 active:ring-3 disabled:pointer-events-none disabled:opacity-50"
51
48
  />
52
49
  ))}
53
50
  </SliderPrimitive.Root>
54
51
  )
55
- }
52
+ })
53
+ Slider.displayName = 'Slider'
56
54
 
57
55
  export { Slider }
@@ -31,6 +31,7 @@ const SonnerUpload = ({
31
31
  )}
32
32
  />
33
33
  <div className="flex w-full flex-col gap-2">
34
+ {/* biome-ignore lint/a11y/useSemanticElements: status role on div is intentional for live region announcements */}
34
35
  <div className="flex w-full justify-between" role="status">
35
36
  <p className="text-foreground text-sm">
36
37
  {progress >= 100
@@ -77,4 +78,6 @@ const SonnerUpload = ({
77
78
  )
78
79
  }
79
80
 
81
+ SonnerUpload.displayName = 'SonnerUpload'
82
+
80
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 }
@@ -46,6 +46,7 @@ const Switch = React.forwardRef<
46
46
  onChange?.(e)
47
47
  onCheckedChange?.(e.target.checked)
48
48
  }}
49
+ aria-checked={props.checked}
49
50
  ref={ref}
50
51
  role="switch"
51
52
  dir={direction}
package/src/tabs/tabs.tsx CHANGED
@@ -35,7 +35,7 @@ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
35
35
 
36
36
  React.useEffect(() => {
37
37
  if (onValueChange) onValueChange(activeItem)
38
- }, [activeItem])
38
+ }, [activeItem, onValueChange])
39
39
 
40
40
  return (
41
41
  <TabsContext.Provider value={{ activeItem, setActiveItem, tabsId }}>
@@ -74,7 +74,7 @@ const TabsTrigger = React.forwardRef<HTMLButtonElement, TabsTriggerProps>(
74
74
 
75
75
  React.useEffect(() => {
76
76
  if (defaultChecked) setActiveItem(value)
77
- }, [defaultChecked])
77
+ }, [defaultChecked, setActiveItem, value])
78
78
 
79
79
  return (
80
80
  <button
@@ -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
@@ -19,7 +19,16 @@
19
19
  ],
20
20
  "rootDir": "./"
21
21
  },
22
- "exclude": ["node_modules", "dist", "./src/_old", "**/*.tsbuildinfo", "tsconfig.tsbuildinfo"],
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist",
25
+ "./src/_old",
26
+ "**/__test__/**",
27
+ "**/*.test.ts",
28
+ "**/*.test.tsx",
29
+ "**/*.tsbuildinfo",
30
+ "tsconfig.tsbuildinfo"
31
+ ],
23
32
  "extends": "@gentleduck/typescript-config/base.json",
24
33
  "include": ["./**/*.ts", "./**/*.tsx"]
25
34
  }