@foundrykit/components 2.1.1 → 2.1.3

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 (34) hide show
  1. package/.turbo/turbo-build.log +14 -14
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +16 -0
  4. package/README.md +49 -145
  5. package/dist/index.d.ts +270 -60
  6. package/dist/index.js +2137 -1447
  7. package/dist/index.js.map +1 -1
  8. package/package.json +16 -9
  9. package/src/components/advanced-search-bar/index.tsx +121 -122
  10. package/src/components/calendar/config.ts +1 -1
  11. package/src/components/calendar/index.tsx +37 -25
  12. package/src/components/carousel/config.ts +28 -0
  13. package/src/components/carousel/index.tsx +258 -0
  14. package/src/components/chart/config.ts +28 -0
  15. package/src/components/chart/index.tsx +365 -0
  16. package/src/components/combobox/config.ts +28 -0
  17. package/src/components/combobox/index.tsx +101 -0
  18. package/src/components/command/config.ts +1 -1
  19. package/src/components/command/index.tsx +23 -12
  20. package/src/components/data-table/config.ts +28 -0
  21. package/src/components/data-table/index.tsx +124 -0
  22. package/src/components/date-picker/config.ts +1 -1
  23. package/src/components/date-picker/index.tsx +119 -51
  24. package/src/components/form/index.tsx +29 -11
  25. package/src/components/input-otp/config.ts +28 -0
  26. package/src/components/input-otp/index.tsx +92 -0
  27. package/src/components/pagination/config.ts +1 -1
  28. package/src/components/pagination/index.tsx +16 -8
  29. package/src/components/search-bar/config.ts +1 -1
  30. package/src/components/search-bar/index.tsx +9 -3
  31. package/src/components/sidebar/index.tsx +22 -25
  32. package/src/components/theme-toggle/index.tsx +2 -3
  33. package/src/index.ts +66 -37
  34. package/eslint.config.js +0 -4
@@ -1,21 +1,25 @@
1
1
  'use client';
2
2
 
3
- import * as React from 'react';
4
- import * as LabelPrimitive from '@radix-ui/react-label';
3
+ import { Label } from '@foundrykit/primitives';
4
+ import { cn } from '@foundrykit/utils';
5
+ import type * as LabelPrimitive from '@radix-ui/react-label';
5
6
  import { Slot } from '@radix-ui/react-slot';
7
+ import * as React from 'react';
6
8
  import {
7
9
  Controller,
8
- FormProvider,
9
10
  type ControllerProps,
10
11
  type FieldPath,
11
12
  type FieldValues,
13
+ FormProvider,
12
14
  } from 'react-hook-form';
13
15
 
14
- import { cn } from '@foundrykit/utils';
15
- import { Label } from '@foundrykit/primitives';
16
-
16
+ /** Form context provider — re-export of react-hook-form's `FormProvider`. */
17
17
  const Form = FormProvider;
18
18
 
19
+ /**
20
+ * Connects a single field to react-hook-form via a `Controller` and exposes the
21
+ * field name to the surrounding form components through context.
22
+ */
19
23
  const FormField = <
20
24
  TFieldValues extends FieldValues = FieldValues,
21
25
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
@@ -30,13 +34,17 @@ const FormField = <
30
34
  };
31
35
 
32
36
  import {
33
- useFormField,
34
37
  FormFieldContext,
35
38
  FormItemContext,
39
+ useFormField,
36
40
  } from '@foundrykit/hooks';
37
41
 
38
42
  // FormItemContext is now provided by hooks package
39
43
 
44
+ /**
45
+ * Wrapper for a single form field that generates a unique id shared by its
46
+ * label, control, description, and message for accessible associations.
47
+ */
40
48
  function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
41
49
  const id = React.useId();
42
50
 
@@ -51,6 +59,7 @@ function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
51
59
  );
52
60
  }
53
61
 
62
+ /** Label bound to the field's control; styled as an error when the field is invalid. */
54
63
  function FormLabel({
55
64
  className,
56
65
  ...props
@@ -68,6 +77,10 @@ function FormLabel({
68
77
  );
69
78
  }
70
79
 
80
+ /**
81
+ * Wires the field's control element with the correct `id`, `aria-describedby`,
82
+ * and `aria-invalid` attributes. Render the input as its single child.
83
+ */
71
84
  function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
72
85
  const { error, formItemId, formDescriptionId, formMessageId } =
73
86
  useFormField();
@@ -87,6 +100,7 @@ function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
87
100
  );
88
101
  }
89
102
 
103
+ /** Helper text describing the field, linked to the control via `aria-describedby`. */
90
104
  function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
91
105
  const { formDescriptionId } = useFormField();
92
106
 
@@ -100,6 +114,10 @@ function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
100
114
  );
101
115
  }
102
116
 
117
+ /**
118
+ * Displays the field's validation error message, or its children when there is
119
+ * no error. Renders nothing when there is no content to show.
120
+ */
103
121
  function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
104
122
  const { error, formMessageId } = useFormField();
105
123
  const body = error ? String(error?.message ?? '') : props.children;
@@ -121,12 +139,12 @@ function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
121
139
  }
122
140
 
123
141
  export {
124
- useFormField,
125
142
  Form,
126
- FormItem,
127
- FormLabel,
128
143
  FormControl,
129
144
  FormDescription,
130
- FormMessage,
131
145
  FormField,
146
+ FormItem,
147
+ FormLabel,
148
+ FormMessage,
149
+ useFormField,
132
150
  };
@@ -0,0 +1,28 @@
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const InputOTPConfig: ComponentConfig = {
4
+ name: 'Input OTP',
5
+ description:
6
+ 'An accessible one-time-password input with individually styled character slots.',
7
+ category: 'components',
8
+ tags: ['otp', 'input', 'form', 'verification', 'accessible'],
9
+ preview: {
10
+ type: 'static',
11
+ html: '<div class="flex items-center gap-2"><div class="flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white text-sm text-gray-600">1</div><div class="flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white text-sm text-gray-600">2</div><div class="flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white text-sm text-gray-600">3</div></div>',
12
+ },
13
+ variants: [
14
+ {
15
+ name: 'Default',
16
+ description: 'Default six-digit OTP input',
17
+ code: '<InputOTP maxLength={6}><InputOTPGroup><InputOTPSlot index={0} /></InputOTPGroup></InputOTP>',
18
+ preview: {
19
+ type: 'component',
20
+ component: 'InputOTP',
21
+ props: {},
22
+ },
23
+ },
24
+ ],
25
+ dependencies: ['utils'],
26
+ packageDependencies: ['input-otp', 'lucide-react'],
27
+ files: ['components/input-otp/index.tsx'],
28
+ };
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+
3
+ import { cn } from '@foundrykit/utils';
4
+ import { OTPInput, OTPInputContext } from 'input-otp';
5
+ import { MinusIcon } from 'lucide-react';
6
+ import * as React from 'react';
7
+
8
+ /**
9
+ * Accessible one-time-password input with individually styled character slots.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <InputOTP maxLength={6}>
14
+ * <InputOTPGroup>
15
+ * <InputOTPSlot index={0} />
16
+ * <InputOTPSlot index={1} />
17
+ * </InputOTPGroup>
18
+ * </InputOTP>
19
+ * ```
20
+ */
21
+ function InputOTP({
22
+ className,
23
+ containerClassName,
24
+ ...props
25
+ }: React.ComponentProps<typeof OTPInput> & {
26
+ containerClassName?: string;
27
+ }) {
28
+ return (
29
+ <OTPInput
30
+ data-slot='input-otp'
31
+ containerClassName={cn(
32
+ 'flex items-center gap-2 has-disabled:opacity-50',
33
+ containerClassName
34
+ )}
35
+ className={cn('disabled:cursor-not-allowed', className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ /** Groups related OTP slots together with a shared border. */
42
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
43
+ return (
44
+ <div
45
+ data-slot='input-otp-group'
46
+ className={cn('flex items-center', className)}
47
+ {...props}
48
+ />
49
+ );
50
+ }
51
+
52
+ /** A single character slot, driven by the OTP input context. */
53
+ function InputOTPSlot({
54
+ index,
55
+ className,
56
+ ...props
57
+ }: React.ComponentProps<'div'> & {
58
+ index: number;
59
+ }) {
60
+ const inputOTPContext = React.useContext(OTPInputContext);
61
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
62
+
63
+ return (
64
+ <div
65
+ data-slot='input-otp-slot'
66
+ data-active={isActive}
67
+ className={cn(
68
+ 'data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]',
69
+ className
70
+ )}
71
+ {...props}
72
+ >
73
+ {char}
74
+ {hasFakeCaret && (
75
+ <div className='pointer-events-none absolute inset-0 flex items-center justify-center'>
76
+ <div className='animate-caret-blink bg-foreground h-4 w-px duration-1000' />
77
+ </div>
78
+ )}
79
+ </div>
80
+ );
81
+ }
82
+
83
+ /** Visual separator rendered between OTP groups. */
84
+ function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
85
+ return (
86
+ <div data-slot='input-otp-separator' role='separator' {...props}>
87
+ <MinusIcon />
88
+ </div>
89
+ );
90
+ }
91
+
92
+ export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
@@ -1,4 +1,4 @@
1
- import { ComponentConfig } from '@foundrykit/types';
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
2
 
3
3
  export const paginationConfig: ComponentConfig = {
4
4
  name: 'Pagination',
@@ -1,17 +1,16 @@
1
- import * as React from 'react';
1
+ import { type Button, buttonVariants } from '@foundrykit/primitives';
2
+ import { cn } from '@foundrykit/utils';
2
3
  import {
3
4
  ChevronLeftIcon,
4
5
  ChevronRightIcon,
5
6
  MoreHorizontalIcon,
6
7
  } from 'lucide-react';
8
+ import type * as React from 'react';
7
9
 
8
- import { cn } from '@foundrykit/utils';
9
- import { Button, buttonVariants } from '@foundrykit/primitives';
10
-
10
+ /** Navigation landmark that wraps a set of pagination controls. */
11
11
  function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
12
12
  return (
13
13
  <nav
14
- role='navigation'
15
14
  aria-label='pagination'
16
15
  data-slot='pagination'
17
16
  className={cn('mx-auto flex w-full justify-center', className)}
@@ -20,6 +19,7 @@ function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
20
19
  );
21
20
  }
22
21
 
22
+ /** Horizontal list container for pagination items. */
23
23
  function PaginationContent({
24
24
  className,
25
25
  ...props
@@ -33,6 +33,7 @@ function PaginationContent({
33
33
  );
34
34
  }
35
35
 
36
+ /** List item wrapping a single pagination control. */
36
37
  function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
37
38
  return <li data-slot='pagination-item' {...props} />;
38
39
  }
@@ -42,6 +43,10 @@ type PaginationLinkProps = {
42
43
  } & Pick<React.ComponentProps<typeof Button>, 'size'> &
43
44
  React.ComponentProps<'a'>;
44
45
 
46
+ /**
47
+ * Anchor styled as a page-number button. Set `isActive` to mark the current
48
+ * page (applies `aria-current="page"` and an outlined style).
49
+ */
45
50
  function PaginationLink({
46
51
  className,
47
52
  isActive,
@@ -65,6 +70,7 @@ function PaginationLink({
65
70
  );
66
71
  }
67
72
 
73
+ /** Pagination link for navigating to the previous page. */
68
74
  function PaginationPrevious({
69
75
  className,
70
76
  ...props
@@ -82,6 +88,7 @@ function PaginationPrevious({
82
88
  );
83
89
  }
84
90
 
91
+ /** Pagination link for navigating to the next page. */
85
92
  function PaginationNext({
86
93
  className,
87
94
  ...props
@@ -99,6 +106,7 @@ function PaginationNext({
99
106
  );
100
107
  }
101
108
 
109
+ /** Non-interactive ellipsis indicating skipped page numbers. */
102
110
  function PaginationEllipsis({
103
111
  className,
104
112
  ...props
@@ -119,9 +127,9 @@ function PaginationEllipsis({
119
127
  export {
120
128
  Pagination,
121
129
  PaginationContent,
122
- PaginationLink,
130
+ PaginationEllipsis,
123
131
  PaginationItem,
124
- PaginationPrevious,
132
+ PaginationLink,
125
133
  PaginationNext,
126
- PaginationEllipsis,
134
+ PaginationPrevious,
127
135
  };
@@ -1,4 +1,4 @@
1
- import { ComponentConfig } from '@foundrykit/types';
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
2
 
3
3
  export const searchBarConfig: ComponentConfig = {
4
4
  name: 'Search Bar',
@@ -1,8 +1,9 @@
1
- import * as React from 'react';
2
- import { Search } from 'lucide-react';
1
+ 'use client';
3
2
 
4
3
  import { Input } from '@foundrykit/primitives';
5
4
  import { cn } from '@foundrykit/utils';
5
+ import { Search } from 'lucide-react';
6
+ import * as React from 'react';
6
7
 
7
8
  export interface SearchBarProps
8
9
  extends React.InputHTMLAttributes<HTMLInputElement> {
@@ -13,6 +14,11 @@ export interface SearchBarProps
13
14
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
14
15
  }
15
16
 
17
+ /**
18
+ * Search input with a leading search icon. Works uncontrolled or controlled
19
+ * (pass `value`/`onChange`); `onSearch` is called with the current query text on
20
+ * every change.
21
+ */
16
22
  const SearchBar = React.forwardRef<HTMLInputElement, SearchBarProps>(
17
23
  (
18
24
  {
@@ -44,7 +50,7 @@ const SearchBar = React.forwardRef<HTMLInputElement, SearchBarProps>(
44
50
 
45
51
  return (
46
52
  <div className={cn('relative', className)}>
47
- <Search className='text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2' />
53
+ <Search className='text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2' />
48
54
  <Input
49
55
  ref={ref}
50
56
  type='search'
@@ -1,29 +1,26 @@
1
1
  'use client';
2
2
 
3
- import * as React from 'react';
4
- import { Slot } from '@radix-ui/react-slot';
5
- import { cva, VariantProps } from 'class-variance-authority';
6
- import { PanelLeftIcon } from 'lucide-react';
7
-
8
3
  import { useIsMobile } from '@foundrykit/hooks';
9
- import { cn } from '@foundrykit/utils';
10
- import { Button } from '@foundrykit/primitives';
11
- import { Input } from '@foundrykit/primitives';
12
- import { Separator } from '@foundrykit/primitives';
13
4
  import {
5
+ Button,
6
+ Input,
7
+ Separator,
14
8
  Sheet,
15
9
  SheetContent,
16
10
  SheetDescription,
17
11
  SheetHeader,
18
12
  SheetTitle,
19
- } from '@foundrykit/primitives';
20
- import { Skeleton } from '@foundrykit/primitives';
21
- import {
13
+ Skeleton,
22
14
  Tooltip,
23
15
  TooltipContent,
24
16
  TooltipProvider,
25
17
  TooltipTrigger,
26
18
  } from '@foundrykit/primitives';
19
+ import { cn } from '@foundrykit/utils';
20
+ import { Slot } from '@radix-ui/react-slot';
21
+ import { cva, type VariantProps } from 'class-variance-authority';
22
+ import { PanelLeftIcon } from 'lucide-react';
23
+ import * as React from 'react';
27
24
 
28
25
  const SIDEBAR_COOKIE_NAME = 'sidebar_state';
29
26
  const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
@@ -170,7 +167,7 @@ function Sidebar({
170
167
  <div
171
168
  data-slot='sidebar'
172
169
  className={cn(
173
- 'bg-sidebar text-sidebar-foreground w-(--sidebar-width) flex h-full flex-col',
170
+ 'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
174
171
  className
175
172
  )}
176
173
  {...props}
@@ -218,7 +215,7 @@ function Sidebar({
218
215
  <div
219
216
  data-slot='sidebar-gap'
220
217
  className={cn(
221
- 'w-(--sidebar-width) relative bg-transparent transition-[width] duration-200 ease-linear',
218
+ 'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
222
219
  'group-data-[collapsible=offcanvas]:w-0',
223
220
  'group-data-[side=right]:rotate-180',
224
221
  variant === 'floating' || variant === 'inset'
@@ -229,7 +226,7 @@ function Sidebar({
229
226
  <div
230
227
  data-slot='sidebar-container'
231
228
  className={cn(
232
- 'w-(--sidebar-width) fixed inset-y-0 z-10 hidden h-svh transition-[left,right,width] duration-200 ease-linear md:flex',
229
+ 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
233
230
  side === 'left'
234
231
  ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
235
232
  : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
@@ -291,7 +288,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
291
288
  onClick={toggleSidebar}
292
289
  title='Toggle Sidebar'
293
290
  className={cn(
294
- 'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',
291
+ 'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex',
295
292
  'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
296
293
  '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
297
294
  'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
@@ -310,7 +307,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
310
307
  data-slot='sidebar-inset'
311
308
  className={cn(
312
309
  'bg-background relative flex w-full flex-1 flex-col',
313
- 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm',
310
+ 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
314
311
  className
315
312
  )}
316
313
  {...props}
@@ -405,7 +402,7 @@ function SidebarGroupLabel({
405
402
  data-slot='sidebar-group-label'
406
403
  data-sidebar='group-label'
407
404
  className={cn(
408
- 'text-sidebar-foreground/70 ring-sidebar-ring outline-hidden flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
405
+ 'text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
409
406
  'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
410
407
  className
411
408
  )}
@@ -426,7 +423,7 @@ function SidebarGroupAction({
426
423
  data-slot='sidebar-group-action'
427
424
  data-sidebar='group-action'
428
425
  className={cn(
429
- 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground outline-hidden absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
426
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
430
427
  // Increases the hit area of the button on mobile.
431
428
  'after:absolute after:-inset-2 md:after:hidden',
432
429
  'group-data-[collapsible=icon]:hidden',
@@ -474,13 +471,13 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
474
471
  }
475
472
 
476
473
  const sidebarMenuButtonVariants = cva(
477
- 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
474
+ 'peer/menu-button ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
478
475
  {
479
476
  variants: {
480
477
  variant: {
481
478
  default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
482
479
  outline:
483
- 'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
480
+ 'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
484
481
  },
485
482
  size: {
486
483
  default: 'h-8 text-sm',
@@ -561,7 +558,7 @@ function SidebarMenuAction({
561
558
  data-slot='sidebar-menu-action'
562
559
  data-sidebar='menu-action'
563
560
  className={cn(
564
- 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground outline-hidden absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
561
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
565
562
  // Increases the hit area of the button on mobile.
566
563
  'after:absolute after:-inset-2 md:after:hidden',
567
564
  'peer-data-[size=sm]/menu-button:top-1',
@@ -586,7 +583,7 @@ function SidebarMenuBadge({
586
583
  data-slot='sidebar-menu-badge'
587
584
  data-sidebar='menu-badge'
588
585
  className={cn(
589
- 'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums',
586
+ 'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none',
590
587
  'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
591
588
  'peer-data-[size=sm]/menu-button:top-1',
592
589
  'peer-data-[size=default]/menu-button:top-1.5',
@@ -625,7 +622,7 @@ function SidebarMenuSkeleton({
625
622
  />
626
623
  )}
627
624
  <Skeleton
628
- className='max-w-(--skeleton-width) h-4 flex-1'
625
+ className='h-4 max-w-(--skeleton-width) flex-1'
629
626
  data-sidebar='menu-skeleton-text'
630
627
  style={
631
628
  {
@@ -686,7 +683,7 @@ function SidebarMenuSubButton({
686
683
  data-size={size}
687
684
  data-active={isActive}
688
685
  className={cn(
689
- 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground outline-hidden flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
686
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
690
687
  'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
691
688
  size === 'sm' && 'text-xs',
692
689
  size === 'md' && 'text-sm',
@@ -1,9 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { useState } from 'react';
4
- import { MoonIcon, SunIcon } from 'lucide-react';
5
-
6
3
  import { Toggle } from '@foundrykit/primitives';
4
+ import { MoonIcon, SunIcon } from 'lucide-react';
5
+ import { useState } from 'react';
7
6
 
8
7
  export default function ThemeToggle() {
9
8
  const [theme, setTheme] = useState<string>('light');
package/src/index.ts CHANGED
@@ -1,53 +1,82 @@
1
- // Export all components
2
- export { SearchBar } from './components/search-bar/index.js';
3
- export { DatePicker } from './components/date-picker/index.js';
1
+ 'use client';
2
+
3
+ // Export types from types package
4
+ export type {
5
+ SearchResult,
6
+ SearchSection as SearchSectionType,
7
+ } from '@foundrykit/types';
8
+ // Export utilities from utils package
9
+ export { cn } from '@foundrykit/utils';
10
+ export {
11
+ AdvancedSearchBar,
12
+ AdvancedSearchBarWrapper,
13
+ AdvancedSearchProvider,
14
+ SearchInput,
15
+ SearchItem,
16
+ SearchResults,
17
+ SearchSection,
18
+ SearchTrigger,
19
+ } from './components/advanced-search-bar/index.js';
4
20
  export { Calendar } from './components/calendar/index.js';
5
21
  export {
6
- Pagination,
7
- PaginationContent,
8
- PaginationItem,
9
- PaginationLink,
10
- PaginationPrevious,
11
- PaginationNext,
12
- PaginationEllipsis,
13
- } from './components/pagination/index.js';
22
+ Carousel,
23
+ type CarouselApi,
24
+ CarouselContent,
25
+ CarouselItem,
26
+ CarouselNext,
27
+ CarouselPrevious,
28
+ } from './components/carousel/index.js';
29
+ export {
30
+ type ChartConfig,
31
+ ChartContainer,
32
+ ChartLegend,
33
+ ChartLegendContent,
34
+ ChartStyle,
35
+ ChartTooltip,
36
+ ChartTooltipContent,
37
+ useChart,
38
+ } from './components/chart/index.js';
39
+ // --- Added components ---
40
+ export { Combobox } from './components/combobox/index.js';
14
41
  export {
15
42
  Command,
16
43
  CommandDialog,
17
- CommandInput,
18
- CommandList,
19
44
  CommandEmpty,
20
45
  CommandGroup,
46
+ CommandInput,
21
47
  CommandItem,
22
- CommandShortcut,
48
+ CommandList,
23
49
  CommandSeparator,
50
+ CommandShortcut,
24
51
  } from './components/command/index.js';
52
+ export { DataTable } from './components/data-table/index.js';
53
+ export { DatePicker } from './components/date-picker/index.js';
25
54
  export {
26
- AdvancedSearchProvider,
27
- AdvancedSearchBar,
28
- SearchInput,
29
- SearchTrigger,
30
- SearchResults,
31
- SearchSection,
32
- SearchItem,
33
- AdvancedSearchBarWrapper,
34
- } from './components/advanced-search-bar/index.js';
35
- export {
36
- useFormField,
37
55
  Form,
38
- FormItem,
39
- FormLabel,
40
56
  FormControl,
41
57
  FormDescription,
42
- FormMessage,
43
58
  FormField,
59
+ FormItem,
60
+ FormLabel,
61
+ FormMessage,
62
+ useFormField,
44
63
  } from './components/form/index.js';
45
-
46
- // Export types from types package
47
- export type {
48
- SearchResult,
49
- SearchSection as SearchSectionType,
50
- } from '@foundrykit/types';
51
-
52
- // Export utilities from utils package
53
- export { cn } from '@foundrykit/utils';
64
+ export {
65
+ InputOTP,
66
+ InputOTPGroup,
67
+ InputOTPSeparator,
68
+ InputOTPSlot,
69
+ } from './components/input-otp/index.js';
70
+ export {
71
+ Pagination,
72
+ PaginationContent,
73
+ PaginationEllipsis,
74
+ PaginationItem,
75
+ PaginationLink,
76
+ PaginationNext,
77
+ PaginationPrevious,
78
+ } from './components/pagination/index.js';
79
+ // Bundled as a single entry, and every component here is interactive
80
+ // (react-hook-form, cmdk, date pickers, search), so the whole module is client.
81
+ // Export all components
82
+ export { SearchBar } from './components/search-bar/index.js';
package/eslint.config.js DELETED
@@ -1,4 +0,0 @@
1
- import { config } from "@foundrykit/eslint-config/react-internal"
2
-
3
- /** @type {import("eslint").Linter.Config} */
4
- export default config