@codapet/design-system 0.5.0 → 0.5.2

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.
package/dist/index.d.mts CHANGED
@@ -15,6 +15,7 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
15
15
  import { Command as Command$1 } from 'cmdk';
16
16
  import * as DialogPrimitive from '@radix-ui/react-dialog';
17
17
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
18
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
18
19
  import { Drawer as Drawer$1 } from 'vaul';
19
20
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
20
21
  import * as react_hook_form from 'react-hook-form';
@@ -25,7 +26,6 @@ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
25
26
  import { OTPInput } from 'input-otp';
26
27
  import * as MenubarPrimitive from '@radix-ui/react-menubar';
27
28
  import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
28
- import * as PopoverPrimitive from '@radix-ui/react-popover';
29
29
  import * as ProgressPrimitive from '@radix-ui/react-progress';
30
30
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
31
31
  import * as ResizablePrimitive from 'react-resizable-panels';
@@ -250,6 +250,11 @@ interface InputProps extends Omit<React$1.ComponentProps<'input'>, 'size'>, Vari
250
250
  }
251
251
  declare const Input: React$1.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
252
252
 
253
+ declare function Popover({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Root>): react_jsx_runtime.JSX.Element;
254
+ declare function PopoverTrigger({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
255
+ declare function PopoverContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Content>): react_jsx_runtime.JSX.Element;
256
+ declare function PopoverAnchor({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Anchor>): react_jsx_runtime.JSX.Element;
257
+
253
258
  type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'MM-DD-YYYY' | 'DD.MM.YYYY' | 'MMMM D, YYYY' | 'D MMMM YYYY';
254
259
  type NativeInputProps = Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max' | 'size' | 'disabled' | 'onSelect'>;
255
260
  type FlattenedCalendarProps$1 = Omit<React$1.ComponentProps<typeof Calendar>, keyof React$1.InputHTMLAttributes<HTMLInputElement> | 'className' | 'mode' | 'selected' | 'onSelect' | 'month' | 'onMonthChange' | 'disabled' | 'captionLayout' | 'showOutsideDays' | 'classNames' | 'components' | 'formatters' | 'buttonVariant'>;
@@ -263,6 +268,8 @@ interface DateInputProps extends NativeInputProps, FlattenedCalendarProps$1 {
263
268
  size?: VariantProps<typeof inputVariants>['size'];
264
269
  inputClassName?: string;
265
270
  calendarClassName?: string;
271
+ popoverContentClassName?: string;
272
+ popoverContentProps?: Omit<React$1.ComponentProps<typeof PopoverContent>, 'children' | 'className'>;
266
273
  dateFormat?: DateFormat;
267
274
  mode?: React$1.ComponentProps<typeof Calendar>['mode'];
268
275
  selected?: Date;
@@ -277,7 +284,7 @@ interface DateInputProps extends NativeInputProps, FlattenedCalendarProps$1 {
277
284
  formatters?: React$1.ComponentProps<typeof Calendar>['formatters'];
278
285
  buttonVariant?: React$1.ComponentProps<typeof Calendar>['buttonVariant'];
279
286
  }
280
- declare function DateInput({ date, setDate, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, inputDisabled, dateFormat, mode, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, components, formatters, buttonVariant, placeholder, onBlur, ...restProps }: DateInputProps): react_jsx_runtime.JSX.Element;
287
+ declare function DateInput({ date, setDate, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, popoverContentClassName, popoverContentProps, inputDisabled, dateFormat, mode, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, components, formatters, buttonVariant, placeholder, onBlur, ...restProps }: DateInputProps): react_jsx_runtime.JSX.Element;
281
288
 
282
289
  type FlattenedCalendarProps = Omit<React$1.ComponentProps<typeof Calendar>, keyof React$1.InputHTMLAttributes<HTMLInputElement> | 'className' | 'mode' | 'selected' | 'onSelect' | 'month' | 'onMonthChange' | 'disabled' | 'captionLayout' | 'showOutsideDays' | 'classNames' | 'components' | 'formatters' | 'buttonVariant'>;
283
290
  interface DateRangeInputProps extends FlattenedCalendarProps {
@@ -291,6 +298,8 @@ interface DateRangeInputProps extends FlattenedCalendarProps {
291
298
  className?: string;
292
299
  inputClassName?: string;
293
300
  calendarClassName?: string;
301
+ popoverContentClassName?: string;
302
+ popoverContentProps?: Omit<React$1.ComponentProps<typeof PopoverContent>, 'children' | 'className'>;
294
303
  dateFormat?: DateFormat;
295
304
  placeholder?: string;
296
305
  selected?: DateRange;
@@ -305,7 +314,7 @@ interface DateRangeInputProps extends FlattenedCalendarProps {
305
314
  formatters?: React$1.ComponentProps<typeof Calendar>['formatters'];
306
315
  buttonVariant?: React$1.ComponentProps<typeof Calendar>['buttonVariant'];
307
316
  }
308
- declare function DateRangeInput({ dateRange, setDateRange, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, inputDisabled, dateFormat, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, components, formatters, buttonVariant, placeholder, size, ...restProps }: DateRangeInputProps): react_jsx_runtime.JSX.Element;
317
+ declare function DateRangeInput({ dateRange, setDateRange, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, popoverContentClassName, popoverContentProps, inputDisabled, dateFormat, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, components, formatters, buttonVariant, placeholder, size, ...restProps }: DateRangeInputProps): react_jsx_runtime.JSX.Element;
309
318
 
310
319
  declare function Drawer({ ...props }: React$1.ComponentProps<typeof Drawer$1.Root>): react_jsx_runtime.JSX.Element;
311
320
  declare function DrawerTrigger({ ...props }: React$1.ComponentProps<typeof Drawer$1.Trigger>): react_jsx_runtime.JSX.Element;
@@ -430,11 +439,6 @@ declare function PaginationPrevious({ className, ...props }: React$1.ComponentPr
430
439
  declare function PaginationNext({ className, ...props }: React$1.ComponentProps<typeof PaginationLink>): react_jsx_runtime.JSX.Element;
431
440
  declare function PaginationEllipsis({ className, ...props }: React$1.ComponentProps<'span'>): react_jsx_runtime.JSX.Element;
432
441
 
433
- declare function Popover({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Root>): react_jsx_runtime.JSX.Element;
434
- declare function PopoverTrigger({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
435
- declare function PopoverContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Content>): react_jsx_runtime.JSX.Element;
436
- declare function PopoverAnchor({ ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Anchor>): react_jsx_runtime.JSX.Element;
437
-
438
442
  declare function Progress({ className, value, ...props }: React$1.ComponentProps<typeof ProgressPrimitive.Root>): react_jsx_runtime.JSX.Element;
439
443
 
440
444
  declare function RadioGroup({ className, ...props }: React$1.ComponentProps<typeof RadioGroupPrimitive.Root>): react_jsx_runtime.JSX.Element;
@@ -597,11 +601,13 @@ interface TimeInputProps {
597
601
  size?: VariantProps<typeof inputVariants>['size'];
598
602
  className?: string;
599
603
  inputClassName?: string;
604
+ popoverContentClassName?: string;
605
+ popoverContentProps?: Omit<React$1.ComponentProps<typeof PopoverContent>, 'children' | 'className'>;
600
606
  placeholder?: string;
601
607
  icon?: React$1.ReactNode;
602
608
  formatDisplay?: (time: TimeValue) => string;
603
609
  }
604
- declare function TimeInput({ time, setTime, timeFormat, minuteStep, inputDisabled, className, inputClassName, size, placeholder, icon, formatDisplay }: TimeInputProps): react_jsx_runtime.JSX.Element;
610
+ declare function TimeInput({ time, setTime, timeFormat, minuteStep, inputDisabled, className, inputClassName, popoverContentClassName, popoverContentProps, size, placeholder, icon, formatDisplay }: TimeInputProps): react_jsx_runtime.JSX.Element;
605
611
 
606
612
  declare const toggleVariants: (props?: ({
607
613
  variant?: "default" | "outline" | null | undefined;
package/dist/index.mjs CHANGED
@@ -2167,6 +2167,8 @@ function DateInput({
2167
2167
  className,
2168
2168
  inputClassName,
2169
2169
  calendarClassName,
2170
+ popoverContentClassName,
2171
+ popoverContentProps,
2170
2172
  inputDisabled,
2171
2173
  dateFormat = "MM/DD/YYYY",
2172
2174
  mode,
@@ -2329,7 +2331,11 @@ function DateInput({
2329
2331
  id: "date",
2330
2332
  value,
2331
2333
  placeholder: resolvedPlaceholder,
2332
- className: cn("bg-background cursor-pointer", "group-data-[state=open]:border-blue-500 group-data-[state=open]:hover:border-blue-500", inputClassName),
2334
+ className: cn(
2335
+ "bg-background cursor-pointer",
2336
+ "group-data-[state=open]:border-blue-500 group-data-[state=open]:hover:border-blue-500",
2337
+ inputClassName
2338
+ ),
2333
2339
  onChange: handleInputChange,
2334
2340
  onBlur: handleBlur,
2335
2341
  disabled: isInputDisabled,
@@ -2345,7 +2351,17 @@ function DateInput({
2345
2351
  ...inputProps
2346
2352
  }
2347
2353
  ) }) }),
2348
- /* @__PURE__ */ jsx22(PopoverContent, { className: "p-2 flex flex-col overflow-y-auto h-[400px] md:h-auto md:w-[350px] ", children: /* @__PURE__ */ jsx22(Calendar, { ...resolvedCalendarProps }) })
2354
+ /* @__PURE__ */ jsx22(
2355
+ PopoverContent,
2356
+ {
2357
+ className: cn(
2358
+ "p-0 overflow-y-auto h-[400px] md:h-auto md:w-[350px]",
2359
+ popoverContentClassName
2360
+ ),
2361
+ ...popoverContentProps,
2362
+ children: /* @__PURE__ */ jsx22("div", { className: "border border-blue-500 h-full w-full rounded-md", children: /* @__PURE__ */ jsx22(Calendar, { ...resolvedCalendarProps }) })
2363
+ }
2364
+ )
2349
2365
  ] }) });
2350
2366
  }
2351
2367
 
@@ -2402,6 +2418,8 @@ function DateRangeInput({
2402
2418
  className,
2403
2419
  inputClassName,
2404
2420
  calendarClassName,
2421
+ popoverContentClassName,
2422
+ popoverContentProps,
2405
2423
  inputDisabled,
2406
2424
  dateFormat = "MM/DD/YYYY",
2407
2425
  selected,
@@ -2494,7 +2512,7 @@ function DateRangeInput({
2494
2512
  onMonthChange: onMonthChange ?? setMonthState,
2495
2513
  showOutsideDays,
2496
2514
  className: cn(
2497
- "w-auto mx-auto h-[350px] overflow-y-auto md:h-auto m-2",
2515
+ "w-auto mx-auto h-fit shrink-0 md:h-auto m-2",
2498
2516
  calendarClassName
2499
2517
  ),
2500
2518
  classNames,
@@ -2524,31 +2542,41 @@ function DateRangeInput({
2524
2542
  ]
2525
2543
  }
2526
2544
  ) }),
2527
- /* @__PURE__ */ jsxs11(PopoverContent, { className: "p-0 flex flex-col overflow-y-auto h-[400px] md:h-auto md:w-[350px] ", children: [
2528
- /* @__PURE__ */ jsx23(Calendar, { ...resolvedCalendarProps }),
2529
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 px-2 py-2", children: [
2530
- /* @__PURE__ */ jsx23(
2531
- Button,
2532
- {
2533
- variant: "ghost-secondary",
2534
- size: "sm",
2535
- onClick: handleClear,
2536
- type: "button",
2537
- children: "Clear"
2538
- }
2545
+ /* @__PURE__ */ jsx23(
2546
+ PopoverContent,
2547
+ {
2548
+ className: cn(
2549
+ "p-0 h-[400px] w-[var(--radix-popper-anchor-width)] md:h-auto md:w-[350px]",
2550
+ popoverContentClassName
2539
2551
  ),
2540
- /* @__PURE__ */ jsx23(
2541
- Button,
2542
- {
2543
- variant: "primary",
2544
- size: "sm",
2545
- onClick: handleAdd,
2546
- type: "button",
2547
- children: "Add"
2548
- }
2549
- )
2550
- ] })
2551
- ] })
2552
+ ...popoverContentProps,
2553
+ children: /* @__PURE__ */ jsxs11("div", { className: "border border-blue-500 h-full w-full rounded-md flex flex-col overflow-y-auto", children: [
2554
+ /* @__PURE__ */ jsx23(Calendar, { ...resolvedCalendarProps }),
2555
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 px-2 py-2 shrink-0", children: [
2556
+ /* @__PURE__ */ jsx23(
2557
+ Button,
2558
+ {
2559
+ variant: "ghost-secondary",
2560
+ size: "sm",
2561
+ onClick: handleClear,
2562
+ type: "button",
2563
+ children: "Clear"
2564
+ }
2565
+ ),
2566
+ /* @__PURE__ */ jsx23(
2567
+ Button,
2568
+ {
2569
+ variant: "primary",
2570
+ size: "sm",
2571
+ onClick: handleAdd,
2572
+ type: "button",
2573
+ children: "Add"
2574
+ }
2575
+ )
2576
+ ] })
2577
+ ] })
2578
+ }
2579
+ )
2552
2580
  ] }) });
2553
2581
  }
2554
2582
 
@@ -5237,6 +5265,8 @@ function TimeInput({
5237
5265
  inputDisabled,
5238
5266
  className,
5239
5267
  inputClassName,
5268
+ popoverContentClassName,
5269
+ popoverContentProps,
5240
5270
  size,
5241
5271
  placeholder,
5242
5272
  icon,
@@ -5323,9 +5353,10 @@ function TimeInput({
5323
5353
  /* @__PURE__ */ jsx49(
5324
5354
  PopoverContent,
5325
5355
  {
5326
- className: "w-auto p-0 ",
5356
+ className: cn("w-auto p-0", popoverContentClassName),
5327
5357
  onOpenAutoFocus: (e) => e.preventDefault(),
5328
- children: /* @__PURE__ */ jsxs24("div", { className: "flex divide-x", children: [
5358
+ ...popoverContentProps,
5359
+ children: /* @__PURE__ */ jsxs24("div", { className: "flex divide-x border border-blue-500 rounded-md", children: [
5329
5360
  /* @__PURE__ */ jsx49("div", { className: "h-56 w-16 overflow-y-auto overscroll-y-contain [-webkit-overflow-scrolling:touch]", children: /* @__PURE__ */ jsx49("div", { ref: hoursRef, className: "flex flex-col p-1 ", children: hoursList.map((h) => /* @__PURE__ */ jsx49(
5330
5361
  Button,
5331
5362
  {
@@ -5341,21 +5372,31 @@ function TimeInput({
5341
5372
  },
5342
5373
  h
5343
5374
  )) }) }),
5344
- /* @__PURE__ */ jsx49("div", { className: "h-56 w-16 overflow-y-auto overscroll-y-contain [-webkit-overflow-scrolling:touch]", children: /* @__PURE__ */ jsx49("div", { ref: minutesRef, className: cn("flex flex-col p-1", minutesList.length <= 12 && "h-full justify-center"), children: minutesList.map((m) => /* @__PURE__ */ jsx49(
5345
- Button,
5375
+ /* @__PURE__ */ jsx49("div", { className: "h-56 w-16 overflow-y-auto overscroll-y-contain [-webkit-overflow-scrolling:touch]", children: /* @__PURE__ */ jsx49(
5376
+ "div",
5346
5377
  {
5347
- variant: "ghost",
5348
- size: "sm",
5349
- "data-selected": selectedMinute === m,
5378
+ ref: minutesRef,
5350
5379
  className: cn(
5351
- "w-full justify-center font-mono text-sm",
5352
- selectedMinute === m && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground"
5380
+ "flex flex-col p-1",
5381
+ minutesList.length <= 12 && "h-full justify-center"
5353
5382
  ),
5354
- onClick: () => handleMinuteSelect(m),
5355
- children: String(m).padStart(2, "0")
5356
- },
5357
- m
5358
- )) }) }),
5383
+ children: minutesList.map((m) => /* @__PURE__ */ jsx49(
5384
+ Button,
5385
+ {
5386
+ variant: "ghost",
5387
+ size: "sm",
5388
+ "data-selected": selectedMinute === m,
5389
+ className: cn(
5390
+ "w-full justify-center font-mono text-sm",
5391
+ selectedMinute === m && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground"
5392
+ ),
5393
+ onClick: () => handleMinuteSelect(m),
5394
+ children: String(m).padStart(2, "0")
5395
+ },
5396
+ m
5397
+ ))
5398
+ }
5399
+ ) }),
5359
5400
  !is24HourFormat(timeFormat) && /* @__PURE__ */ jsx49("div", { className: "flex flex-col p-1 justify-center gap-1", children: ["AM", "PM"].map((p) => /* @__PURE__ */ jsx49(
5360
5401
  Button,
5361
5402
  {