omni-rest 0.3.3 → 0.4.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.
@@ -62,18 +62,18 @@ import { Label, LabelRequired, LabelOptional } from "@/components/ui/label";
62
62
 
63
63
  // ── Icons ─────────────────────────────────────────────────────
64
64
  import {
65
- RiCalendarLine,
66
- RiCheckLine,
67
- RiArrowUpDownLine,
68
- RiLoader4Line,
69
- RiCloseLine,
70
- RiEyeLine,
71
- RiEyeOffLine,
72
- RiArrowRightSLine,
73
- RiArrowLeftSLine,
74
- RiCheckDoubleLine,
75
- RiCheckboxBlankCircleLine,
76
- } from "@remixicon/react";
65
+ Calendar as CalendarIcon,
66
+ Check,
67
+ ChevronsUpDown,
68
+ Loader2,
69
+ X,
70
+ Eye,
71
+ EyeOff,
72
+ ChevronRight,
73
+ ChevronLeft,
74
+ CheckCheck,
75
+ Circle,
76
+ } from "lucide-react";
77
77
 
78
78
  // ═══════════════════════════════════════════════════════════════
79
79
  // TYPES
@@ -259,7 +259,7 @@ function PasswordInput<T extends FieldValues>({ field, config, disabled }: { fie
259
259
  <Button type="button" variant="ghost" size="icon" tabIndex={-1}
260
260
  className="absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 text-muted-foreground hover:text-foreground"
261
261
  onClick={() => setShow(s => !s)}>
262
- {show ? <RiEyeOffLine className="h-4 w-4" /> : <RiEyeLine className="h-4 w-4" />}
262
+ {show ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
263
263
  </Button>
264
264
  )}
265
265
  </div>
@@ -287,15 +287,13 @@ function SearchableSelect<T extends FieldValues>({ field, config, disabled }: {
287
287
  const selected = config.options.find(o => o.value === field.value);
288
288
  return (
289
289
  <Popover open={open} onOpenChange={setOpen}>
290
- <PopoverTrigger
291
- render={
292
- <Button variant="outline" role="combobox" aria-expanded={open}
293
- disabled={disabled || config.disabled}
294
- className={cn("w-full justify-between font-normal", !field.value && "text-muted-foreground", config.className)} />
295
- }
296
- >
297
- {selected?.label ?? config.placeholder ?? "Select option…"}
298
- <RiArrowUpDownLine className="ml-2 h-4 w-4 shrink-0 opacity-50" />
290
+ <PopoverTrigger asChild>
291
+ <Button variant="outline" role="combobox" aria-expanded={open}
292
+ disabled={disabled || config.disabled}
293
+ className={cn("w-full justify-between font-normal", !field.value && "text-muted-foreground", config.className)}>
294
+ {selected?.label ?? config.placeholder ?? "Select option…"}
295
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
296
+ </Button>
299
297
  </PopoverTrigger>
300
298
  <PopoverContent className="w-[--radix-popover-trigger-width] p-0">
301
299
  <Command>
@@ -306,7 +304,7 @@ function SearchableSelect<T extends FieldValues>({ field, config, disabled }: {
306
304
  {config.options.map(opt => (
307
305
  <CommandItem key={opt.value} value={opt.value} disabled={opt.disabled}
308
306
  onSelect={val => { field.onChange(val === field.value ? "" : val); setOpen(false); }}>
309
- <RiCheckLine className={cn("mr-2 h-4 w-4", field.value === opt.value ? "opacity-100" : "opacity-0")} />
307
+ <Check className={cn("mr-2 h-4 w-4", field.value === opt.value ? "opacity-100" : "opacity-0")} />
310
308
  {opt.label}
311
309
  {opt.badge && <Badge variant="secondary" className="ml-auto text-xs">{opt.badge}</Badge>}
312
310
  </CommandItem>
@@ -339,21 +337,19 @@ function MultiSelect<T extends FieldValues>({ field, config, disabled }: { field
339
337
  {config.options.find(o => o.value === val)?.label ?? val}
340
338
  <button type="button" onClick={() => toggle(val)} disabled={disabled || config.disabled}
341
339
  className="rounded-sm opacity-70 hover:opacity-100">
342
- <RiCloseLine className="h-3 w-3" />
340
+ <X className="h-3 w-3" />
343
341
  </button>
344
342
  </Badge>
345
343
  ))}
346
344
  </div>
347
345
  )}
348
346
  <Popover open={open} onOpenChange={setOpen}>
349
- <PopoverTrigger
350
- render={
351
- <Button variant="outline" role="combobox" disabled={disabled || config.disabled}
352
- className={cn("w-full justify-between font-normal", selected.length === 0 && "text-muted-foreground")} />
353
- }
354
- >
355
- {selected.length === 0 ? config.placeholder ?? "Select options…" : `${selected.length} selected`}
356
- <RiArrowUpDownLine className="ml-2 h-4 w-4 shrink-0 opacity-50" />
347
+ <PopoverTrigger asChild>
348
+ <Button variant="outline" role="combobox" disabled={disabled || config.disabled}
349
+ className={cn("w-full justify-between font-normal", selected.length === 0 && "text-muted-foreground")}>
350
+ {selected.length === 0 ? config.placeholder ?? "Select options…" : `${selected.length} selected`}
351
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
352
+ </Button>
357
353
  </PopoverTrigger>
358
354
  <PopoverContent className="w-[--radix-popover-trigger-width] p-0">
359
355
  <Command>
@@ -367,7 +363,7 @@ function MultiSelect<T extends FieldValues>({ field, config, disabled }: { field
367
363
  return (
368
364
  <CommandItem key={opt.value} value={opt.value}
369
365
  disabled={opt.disabled || maxed} onSelect={() => toggle(opt.value)}>
370
- <RiCheckLine className={cn("mr-2 h-4 w-4", isSel ? "opacity-100" : "opacity-0")} />
366
+ <Check className={cn("mr-2 h-4 w-4", isSel ? "opacity-100" : "opacity-0")} />
371
367
  {opt.label}
372
368
  {opt.badge && <Badge variant="secondary" className="ml-auto text-xs">{opt.badge}</Badge>}
373
369
  </CommandItem>
@@ -387,14 +383,12 @@ function MultiSelect<T extends FieldValues>({ field, config, disabled }: { field
387
383
  function DatePicker<T extends FieldValues>({ field, config, disabled }: { field: ControllerRenderProps<T, Path<T>>; config: DateField<T>; disabled?: boolean }) {
388
384
  return (
389
385
  <Popover>
390
- <PopoverTrigger
391
- render={
392
- <Button variant="outline" disabled={disabled || config.disabled}
393
- className={cn("w-full justify-start text-left font-normal", !field.value && "text-muted-foreground", config.className)} />
394
- }
395
- >
396
- <RiCalendarLine className="mr-2 h-4 w-4" />
397
- {field.value ? format(field.value, config.dateFormat ?? "PPP") : config.placeholder ?? "Pick a date"}
386
+ <PopoverTrigger asChild>
387
+ <Button variant="outline" disabled={disabled || config.disabled}
388
+ className={cn("w-full justify-start text-left font-normal", !field.value && "text-muted-foreground", config.className)}>
389
+ <CalendarIcon className="mr-2 h-4 w-4" />
390
+ {field.value ? format(field.value, config.dateFormat ?? "PPP") : config.placeholder ?? "Pick a date"}
391
+ </Button>
398
392
  </PopoverTrigger>
399
393
  <PopoverContent className="w-auto p-0" align="start">
400
394
  <Calendar mode="single" selected={field.value} onSelect={field.onChange}
@@ -410,16 +404,15 @@ function DateRangePicker<T extends FieldValues>({ field, config, disabled }: { f
410
404
  const range: DateRange = field.value ?? {};
411
405
  return (
412
406
  <Popover>
413
- <PopoverTrigger
414
- render={
415
- <Button variant="outline" disabled={disabled || config.disabled}
416
- className={cn("w-full justify-start text-left font-normal", !range.from && "text-muted-foreground", config.className)} />
417
- }
418
- >
419
- <RiCalendarLine className="mr-2 h-4 w-4" />
420
- {range.from
421
- ? range.to ? <>{format(range.from, fmt)} – {format(range.to, fmt)}</> : format(range.from, fmt)
422
- : config.placeholder ?? "Pick a date range"}
407
+ <Popover>
408
+ <PopoverTrigger asChild>
409
+ <Button variant="outline" disabled={disabled || config.disabled}
410
+ className={cn("w-full justify-start text-left font-normal", !range.from && "text-muted-foreground", config.className)}>
411
+ <CalendarIcon className="mr-2 h-4 w-4" />
412
+ {range.from
413
+ ? range.to ? <>{format(range.from, fmt)} – {format(range.to, fmt)}</> : format(range.from, fmt)
414
+ : config.placeholder ?? "Pick a date range"}
415
+ </Button>
423
416
  </PopoverTrigger>
424
417
  <PopoverContent className="w-auto p-0" align="start">
425
418
  <Calendar mode="range" selected={range as any} onSelect={field.onChange}
@@ -695,7 +688,7 @@ function ProgressIndicator<T extends FieldValues>({
695
688
  done && "border-primary bg-primary/10 text-primary",
696
689
  !active && !done && "border-muted-foreground/30 bg-background text-muted-foreground"
697
690
  )}>
698
- {done ? <RiCheckLine className="h-3.5 w-3.5" /> : i + 1}
691
+ {done ? <Check className="h-3.5 w-3.5" /> : i + 1}
699
692
  </div>
700
693
  <span className={cn(
701
694
  "text-[11px] font-medium hidden sm:block text-center leading-tight max-w-[72px]",
@@ -730,10 +723,10 @@ function TabsIndicator<T extends FieldValues>({
730
723
  active ? "bg-background shadow-sm text-foreground" : "text-muted-foreground"
731
724
  )}>
732
725
  {done
733
- ? <RiCheckLine className="h-3.5 w-3.5 text-primary flex-shrink-0" />
726
+ ? <Check className="h-3.5 w-3.5 text-primary flex-shrink-0" />
734
727
  : step.icon
735
728
  ? <span className="h-3.5 w-3.5 flex-shrink-0">{step.icon}</span>
736
- : <RiCheckboxBlankCircleLine className={cn("h-3.5 w-3.5 flex-shrink-0", active && "text-primary")} />
729
+ : <Circle className={cn("h-3.5 w-3.5 flex-shrink-0", active && "text-primary")} />
737
730
  }
738
731
  {step.title}
739
732
  </div>
@@ -763,7 +756,7 @@ function SidebarIndicator<T extends FieldValues>({
763
756
  done && "bg-primary/15 text-primary",
764
757
  !active && !done && "bg-muted text-muted-foreground"
765
758
  )}>
766
- {done ? <RiCheckLine className="h-3.5 w-3.5" /> : i + 1}
759
+ {done ? <Check className="h-3.5 w-3.5" /> : i + 1}
767
760
  </div>
768
761
  <div>
769
762
  <p className={cn("text-sm font-medium", active ? "text-foreground" : "text-muted-foreground")}>
@@ -872,12 +865,12 @@ function MultiStepForm<T extends FieldValues>(props: {
872
865
  <div className="mt-6 pt-4 border-t flex items-center justify-between">
873
866
  <Button type="button" variant="outline" onClick={() => goTo(currentStep - 1)}
874
867
  disabled={isFirst || isLoading}>
875
- <RiArrowLeftSLine className="mr-1.5 h-4 w-4" />{prevLabel}
868
+ <ChevronLeft className="mr-1.5 h-4 w-4" />{prevLabel}
876
869
  </Button>
877
870
 
878
871
  {!isLast ? (
879
872
  <Button type="button" onClick={handleNext} disabled={isLoading}>
880
- {nextLabel}<RiArrowRightSLine className="ml-1.5 h-4 w-4" />
873
+ {nextLabel}<ChevronRight className="ml-1.5 h-4 w-4" />
881
874
  </Button>
882
875
  ) : (
883
876
  footer ?? (
@@ -956,7 +949,7 @@ export function FormGenerator<T extends FieldValues = FieldValues>({
956
949
  {footer ?? (
957
950
  <div className="flex items-center gap-3">
958
951
  <Button type="submit" disabled={disabled || isLoading}>
959
- {isLoading && <RiLoader4Line className="mr-2 h-4 w-4 animate-spin" />}
952
+ {isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
960
953
  {submitLabel}
961
954
  </Button>
962
955
  {showReset && (
@@ -1059,4 +1052,4 @@ export function FormGenerator<T extends FieldValues = FieldValues>({
1059
1052
  // onSubmit={console.log}
1060
1053
  // submitLabel="Create Account"
1061
1054
  // nextLabel="Continue →" prevLabel="← Back"
1062
- // />
1055
+ // />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-rest",
3
- "version": "0.3.3",
3
+ "version": "0.4.2",
4
4
  "description": "Auto-generate REST APIs from your Prisma schema — zero config CRUD",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",