@facter/ds-core 1.33.10 → 1.34.0

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.mjs CHANGED
@@ -17,11 +17,11 @@ import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
17
17
  import * as SwitchPrimitives from '@radix-ui/react-switch';
18
18
  import { FormProvider, useFormContext, Controller } from 'react-hook-form';
19
19
  export { FormProvider, useFormContext } from 'react-hook-form';
20
- import * as PopoverPrimitive2 from '@radix-ui/react-popover';
20
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
21
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
21
22
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
22
23
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
23
24
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
24
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
25
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
26
26
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
27
27
  import { Slot } from '@radix-ui/react-slot';
@@ -165,6 +165,7 @@ var Input = React10.forwardRef(
165
165
  label,
166
166
  icon: Icon2,
167
167
  required,
168
+ labelSuffix,
168
169
  containerClassName,
169
170
  labelClassName,
170
171
  ...props
@@ -209,7 +210,7 @@ var Input = React10.forwardRef(
209
210
  "label",
210
211
  {
211
212
  className: cn(
212
- "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 cursor-pointer",
213
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 cursor-pointer inline-flex items-center gap-1",
213
214
  error ? "text-red-500" : "text-foreground",
214
215
  Icon2 && "left-10",
215
216
  labelClassName
@@ -217,7 +218,8 @@ var Input = React10.forwardRef(
217
218
  onClick: focusInput,
218
219
  children: [
219
220
  label,
220
- required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
221
+ required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" }),
222
+ labelSuffix
221
223
  ]
222
224
  }
223
225
  ),
@@ -3225,6 +3227,266 @@ function FormFieldProvider({ name, children }) {
3225
3227
  );
3226
3228
  return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value, children });
3227
3229
  }
3230
+ var TooltipProvider = TooltipPrimitive.Provider;
3231
+ var TooltipRoot = TooltipPrimitive.Root;
3232
+ var TooltipTrigger = TooltipPrimitive.Trigger;
3233
+ var TooltipPortal = TooltipPrimitive.Portal;
3234
+ var TooltipArrow = React10.forwardRef(({ className, variant = "light", ...props }, ref) => /* @__PURE__ */ jsx(
3235
+ TooltipPrimitive.Arrow,
3236
+ {
3237
+ ref,
3238
+ className: cn(
3239
+ "z-50",
3240
+ variant === "dark" ? "fill-popover" : "fill-background",
3241
+ className
3242
+ ),
3243
+ ...props
3244
+ }
3245
+ ));
3246
+ TooltipArrow.displayName = "TooltipArrow";
3247
+ var tooltipContentVariants = cva(
3248
+ "z-50 overflow-hidden rounded-lg shadow-lg outline-none animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
3249
+ {
3250
+ variants: {
3251
+ variant: {
3252
+ light: "bg-background text-foreground border border-border",
3253
+ dark: "bg-popover text-popover-foreground border border-border"
3254
+ },
3255
+ size: {
3256
+ sm: "max-w-[200px] p-2",
3257
+ md: "max-w-[280px] p-3",
3258
+ lg: "max-w-[360px] p-4"
3259
+ }
3260
+ },
3261
+ defaultVariants: {
3262
+ variant: "light",
3263
+ size: "md"
3264
+ }
3265
+ }
3266
+ );
3267
+ var TooltipContent = React10.forwardRef(
3268
+ ({
3269
+ className,
3270
+ variant = "light",
3271
+ size = "md",
3272
+ sideOffset = 8,
3273
+ showArrow = true,
3274
+ onDismiss,
3275
+ children,
3276
+ ...props
3277
+ }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
3278
+ TooltipPrimitive.Content,
3279
+ {
3280
+ ref,
3281
+ sideOffset,
3282
+ className: cn(tooltipContentVariants({ variant, size }), className),
3283
+ ...props,
3284
+ children: [
3285
+ onDismiss && /* @__PURE__ */ jsx(
3286
+ "button",
3287
+ {
3288
+ onClick: onDismiss,
3289
+ className: "absolute top-2 right-2 p-1 rounded-full transition-colors hover:bg-muted text-muted-foreground hover:text-foreground",
3290
+ "aria-label": "Fechar",
3291
+ children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
3292
+ }
3293
+ ),
3294
+ children,
3295
+ showArrow && /* @__PURE__ */ jsx(TooltipArrow, { variant: variant ?? "light", width: 12, height: 6 })
3296
+ ]
3297
+ }
3298
+ ) })
3299
+ );
3300
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
3301
+ var TooltipHeader = React10.forwardRef(
3302
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1", className), ...props })
3303
+ );
3304
+ TooltipHeader.displayName = "TooltipHeader";
3305
+ var TooltipTitle = React10.forwardRef(
3306
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3307
+ "h4",
3308
+ {
3309
+ ref,
3310
+ className: cn("text-sm font-semibold leading-tight", className),
3311
+ ...props
3312
+ }
3313
+ )
3314
+ );
3315
+ TooltipTitle.displayName = "TooltipTitle";
3316
+ var TooltipDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3317
+ "p",
3318
+ {
3319
+ ref,
3320
+ className: cn("text-xs leading-relaxed text-muted-foreground", className),
3321
+ ...props
3322
+ }
3323
+ ));
3324
+ TooltipDescription.displayName = "TooltipDescription";
3325
+ var TooltipActions = React10.forwardRef(
3326
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3327
+ "div",
3328
+ {
3329
+ ref,
3330
+ className: cn("flex items-center gap-2 mt-3", className),
3331
+ ...props
3332
+ }
3333
+ )
3334
+ );
3335
+ TooltipActions.displayName = "TooltipActions";
3336
+ var tooltipActionVariants = cva(
3337
+ "inline-flex items-center justify-center text-xs font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
3338
+ {
3339
+ variants: {
3340
+ variant: {
3341
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90 px-3 py-1.5",
3342
+ secondary: "bg-transparent text-muted-foreground hover:text-foreground hover:underline px-2 py-1.5",
3343
+ outline: "border border-border bg-background text-foreground hover:bg-muted px-3 py-1.5"
3344
+ }
3345
+ },
3346
+ defaultVariants: {
3347
+ variant: "primary"
3348
+ }
3349
+ }
3350
+ );
3351
+ var TooltipAction = React10.forwardRef(
3352
+ ({ className, variant = "primary", ...props }, ref) => /* @__PURE__ */ jsx(
3353
+ "button",
3354
+ {
3355
+ ref,
3356
+ className: cn(tooltipActionVariants({ variant }), className),
3357
+ ...props
3358
+ }
3359
+ )
3360
+ );
3361
+ TooltipAction.displayName = "TooltipAction";
3362
+ var TooltipIcon = React10.forwardRef(
3363
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
3364
+ "div",
3365
+ {
3366
+ ref,
3367
+ className: cn(
3368
+ "flex items-center justify-center w-10 h-10 rounded-full mb-3 bg-muted",
3369
+ className
3370
+ ),
3371
+ ...props,
3372
+ children
3373
+ }
3374
+ )
3375
+ );
3376
+ TooltipIcon.displayName = "TooltipIcon";
3377
+ var SimpleTooltip = ({
3378
+ children,
3379
+ content,
3380
+ variant = "light",
3381
+ side = "top",
3382
+ align = "center",
3383
+ delayDuration = 200,
3384
+ open,
3385
+ defaultOpen,
3386
+ onOpenChange
3387
+ }) => /* @__PURE__ */ jsxs(
3388
+ TooltipRoot,
3389
+ {
3390
+ open,
3391
+ defaultOpen,
3392
+ onOpenChange,
3393
+ delayDuration,
3394
+ children: [
3395
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children }),
3396
+ /* @__PURE__ */ jsx(TooltipContent, { variant, side, align, size: "sm", children: /* @__PURE__ */ jsx("span", { className: "text-xs", children: content }) })
3397
+ ]
3398
+ }
3399
+ );
3400
+ SimpleTooltip.displayName = "SimpleTooltip";
3401
+ var Tooltip = Object.assign(TooltipRoot, {
3402
+ Provider: TooltipProvider,
3403
+ Trigger: TooltipTrigger,
3404
+ Portal: TooltipPortal,
3405
+ Content: TooltipContent,
3406
+ Arrow: TooltipArrow,
3407
+ Header: TooltipHeader,
3408
+ Title: TooltipTitle,
3409
+ Description: TooltipDescription,
3410
+ Actions: TooltipActions,
3411
+ Action: TooltipAction,
3412
+ Icon: TooltipIcon,
3413
+ Simple: SimpleTooltip
3414
+ });
3415
+ var FormLabel = React10.forwardRef(
3416
+ ({ className, required, children, ...props }, ref) => {
3417
+ const fieldContext = useFormFieldContextOptional();
3418
+ return /* @__PURE__ */ jsxs(
3419
+ "label",
3420
+ {
3421
+ ref,
3422
+ htmlFor: fieldContext?.id,
3423
+ className: cn(
3424
+ "text-sm font-medium leading-none",
3425
+ fieldContext?.error && "text-red-500",
3426
+ className
3427
+ ),
3428
+ ...props,
3429
+ children: [
3430
+ children,
3431
+ (required || fieldContext?.isRequired) && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3432
+ ]
3433
+ }
3434
+ );
3435
+ }
3436
+ );
3437
+ FormLabel.displayName = "Form.Label";
3438
+ var FormDescription = React10.forwardRef(({ className, ...props }, ref) => {
3439
+ const fieldContext = useFormFieldContextOptional();
3440
+ if (fieldContext?.error) {
3441
+ return null;
3442
+ }
3443
+ return /* @__PURE__ */ jsx(
3444
+ "p",
3445
+ {
3446
+ ref,
3447
+ className: cn("text-xs text-muted-foreground", className),
3448
+ ...props
3449
+ }
3450
+ );
3451
+ });
3452
+ FormDescription.displayName = "Form.Description";
3453
+ var FormError = React10.forwardRef(
3454
+ ({ className, message, children, ...props }, ref) => {
3455
+ const fieldContext = useFormFieldContextOptional();
3456
+ const errorMessage = message ?? fieldContext?.error;
3457
+ if (!errorMessage && !children) {
3458
+ return null;
3459
+ }
3460
+ return /* @__PURE__ */ jsx(
3461
+ "p",
3462
+ {
3463
+ ref,
3464
+ className: cn("text-xs text-red-500", className),
3465
+ ...props,
3466
+ children: children || errorMessage
3467
+ }
3468
+ );
3469
+ }
3470
+ );
3471
+ FormError.displayName = "Form.Error";
3472
+ var FormFieldWrapper = React10.forwardRef(({ className, label, description, required, error, children, ...props }, ref) => {
3473
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("space-y-1", className), ...props, children: [
3474
+ label && /* @__PURE__ */ jsx(FormLabel, { required, children: label }),
3475
+ children,
3476
+ description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
3477
+ error && /* @__PURE__ */ jsx(FormError, { message: error })
3478
+ ] });
3479
+ });
3480
+ FormFieldWrapper.displayName = "Form.FieldWrapper";
3481
+ function FieldTooltipIcon({ tooltip }) {
3482
+ return /* @__PURE__ */ jsxs(TooltipRoot, { delayDuration: 200, children: [
3483
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-primary cursor-help shrink-0" }) }),
3484
+ /* @__PURE__ */ jsx(TooltipContent, { side: "top", size: "md", children: typeof tooltip === "string" ? /* @__PURE__ */ jsx("span", { className: "text-xs", children: tooltip }) : /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
3485
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold leading-snug", children: tooltip.title }),
3486
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground leading-snug", children: tooltip.description })
3487
+ ] }) })
3488
+ ] });
3489
+ }
3228
3490
  function applyMask(value, mask) {
3229
3491
  const digits = value.replace(/\D/g, "");
3230
3492
  switch (mask) {
@@ -3307,6 +3569,7 @@ function FormInput({
3307
3569
  name,
3308
3570
  label,
3309
3571
  description,
3572
+ tooltip,
3310
3573
  required,
3311
3574
  disabled,
3312
3575
  className,
@@ -3368,7 +3631,8 @@ function FormInput({
3368
3631
  error: !!error,
3369
3632
  icon,
3370
3633
  inputSize,
3371
- maxLength: maxLength ?? getMaxLength(mask)
3634
+ maxLength: maxLength ?? getMaxLength(mask),
3635
+ labelSuffix: tooltip ? /* @__PURE__ */ jsx(FieldTooltipIcon, { tooltip }) : void 0
3372
3636
  }
3373
3637
  ),
3374
3638
  description && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground px-1", children: description }),
@@ -3379,26 +3643,41 @@ function FormInput({
3379
3643
  ) });
3380
3644
  }
3381
3645
  FormInput.displayName = "Form.Input";
3646
+ var Popover = PopoverPrimitive.Root;
3647
+ var PopoverTrigger = PopoverPrimitive.Trigger;
3648
+ var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
3649
+ PopoverPrimitive.Content,
3650
+ {
3651
+ ref,
3652
+ align,
3653
+ sideOffset,
3654
+ className: cn(
3655
+ "z-50 w-auto rounded-md border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
3656
+ className
3657
+ ),
3658
+ ...props
3659
+ }
3660
+ ) }));
3661
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
3382
3662
  function FormSelect({
3383
3663
  name,
3384
3664
  label,
3385
3665
  description,
3666
+ tooltip,
3386
3667
  required,
3387
3668
  disabled,
3388
3669
  className,
3389
3670
  options,
3390
3671
  placeholder = "Selecione...",
3391
- icon,
3392
3672
  hideError = false,
3393
- selectSize = "default",
3394
3673
  emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3395
3674
  loading = false,
3396
- variant = "default",
3397
3675
  searchable = false,
3398
3676
  onSearch,
3399
3677
  onLoadMore,
3400
3678
  hasMore,
3401
- searchPlaceholder = "Buscar..."
3679
+ searchPlaceholder = "Buscar...",
3680
+ dropdownPosition = "bottom"
3402
3681
  }) {
3403
3682
  const form = useFormContext();
3404
3683
  const fieldState = form.getFieldState(name, form.formState);
@@ -3409,14 +3688,15 @@ function FormSelect({
3409
3688
  control: form.control,
3410
3689
  name,
3411
3690
  render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-1", className), children: [
3412
- variant === "card" ? /* @__PURE__ */ jsx(
3413
- CardSelect,
3691
+ /* @__PURE__ */ jsx(
3692
+ SelectDropdown,
3414
3693
  {
3415
3694
  options,
3416
3695
  value: field.value,
3417
3696
  onChange: (v) => field.onChange(v || void 0),
3418
3697
  disabled,
3419
3698
  label,
3699
+ tooltip,
3420
3700
  required,
3421
3701
  error: !!error,
3422
3702
  placeholder,
@@ -3426,31 +3706,8 @@ function FormSelect({
3426
3706
  hasMore,
3427
3707
  loading,
3428
3708
  emptyText,
3429
- searchPlaceholder
3430
- }
3431
- ) : /* @__PURE__ */ jsx(
3432
- Select,
3433
- {
3434
- value: field.value ?? "",
3435
- onValueChange: (value) => {
3436
- field.onChange(value || void 0);
3437
- },
3438
- disabled: disabled || loading,
3439
- label,
3440
- required,
3441
- error: !!error,
3442
- icon,
3443
- selectSize,
3444
- placeholder,
3445
- children: loading ? /* @__PURE__ */ jsx(SelectItem, { value: "__loading__", disabled: true, children: "Carregando..." }) : options.length === 0 ? /* @__PURE__ */ jsx(SelectItem, { value: "__empty__", disabled: true, children: emptyText }) : options.map((option) => /* @__PURE__ */ jsx(
3446
- SelectItem,
3447
- {
3448
- value: option.value,
3449
- disabled: option.disabled,
3450
- children: option.label
3451
- },
3452
- option.value
3453
- ))
3709
+ searchPlaceholder,
3710
+ dropdownPosition
3454
3711
  }
3455
3712
  ),
3456
3713
  description && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground px-1", children: description }),
@@ -3460,12 +3717,13 @@ function FormSelect({
3460
3717
  ) });
3461
3718
  }
3462
3719
  FormSelect.displayName = "Form.Select";
3463
- function CardSelect({
3720
+ function SelectDropdown({
3464
3721
  options,
3465
3722
  value,
3466
3723
  onChange,
3467
3724
  disabled,
3468
3725
  label,
3726
+ tooltip,
3469
3727
  required,
3470
3728
  error,
3471
3729
  placeholder = "Selecione...",
@@ -3475,11 +3733,13 @@ function CardSelect({
3475
3733
  hasMore,
3476
3734
  loading,
3477
3735
  emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3478
- searchPlaceholder = "Buscar..."
3736
+ searchPlaceholder = "Buscar...",
3737
+ dropdownPosition = "bottom"
3479
3738
  }) {
3480
3739
  const [open, setOpen] = React10.useState(false);
3481
3740
  const [search, setSearch] = React10.useState("");
3482
3741
  const selected = options.find((o) => o.value === value);
3742
+ const contentRef = React10.useRef(null);
3483
3743
  const listRef = React10.useRef(null);
3484
3744
  const searchRef = React10.useRef(null);
3485
3745
  const filteredOptions = React10.useMemo(() => {
@@ -3490,9 +3750,9 @@ function CardSelect({
3490
3750
  );
3491
3751
  }, [options, search, searchable, onSearch]);
3492
3752
  const handleSearch = React10.useCallback(
3493
- (value2) => {
3494
- setSearch(value2);
3495
- if (onSearch) onSearch(value2);
3753
+ (val) => {
3754
+ setSearch(val);
3755
+ if (onSearch) onSearch(val);
3496
3756
  },
3497
3757
  [onSearch]
3498
3758
  );
@@ -3515,9 +3775,36 @@ function CardSelect({
3515
3775
  onLoadMore();
3516
3776
  }
3517
3777
  }, [onLoadMore, hasMore, loading]);
3518
- return /* @__PURE__ */ jsxs(PopoverPrimitive2.Root, { open, onOpenChange: handleOpenChange, children: [
3778
+ React10.useEffect(() => {
3779
+ if (!open) return;
3780
+ let cancelled = false;
3781
+ let removeHandler;
3782
+ requestAnimationFrame(() => {
3783
+ if (cancelled) return;
3784
+ const content = contentRef.current;
3785
+ const list = listRef.current;
3786
+ if (!content || !list) return;
3787
+ const handleWheel = (e) => {
3788
+ if (!content.contains(e.target)) return;
3789
+ const { scrollTop, scrollHeight, clientHeight } = list;
3790
+ if (scrollHeight <= clientHeight) return;
3791
+ e.preventDefault();
3792
+ e.stopPropagation();
3793
+ list.scrollTop = Math.max(0, Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight));
3794
+ };
3795
+ document.addEventListener("wheel", handleWheel, { passive: false, capture: true });
3796
+ removeHandler = () => document.removeEventListener("wheel", handleWheel, { capture: true });
3797
+ });
3798
+ return () => {
3799
+ cancelled = true;
3800
+ removeHandler?.();
3801
+ };
3802
+ }, [open]);
3803
+ const side = dropdownPosition === "top" ? "top" : "bottom";
3804
+ const avoidCollisions = dropdownPosition === "auto";
3805
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
3519
3806
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3520
- /* @__PURE__ */ jsx(PopoverPrimitive2.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
3807
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
3521
3808
  "button",
3522
3809
  {
3523
3810
  type: "button",
@@ -3543,30 +3830,36 @@ function CardSelect({
3543
3830
  "label",
3544
3831
  {
3545
3832
  className: cn(
3546
- "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
3833
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 inline-flex items-center gap-1",
3834
+ tooltip ? "pointer-events-auto" : "pointer-events-none",
3547
3835
  error ? "text-red-500" : "text-foreground"
3548
3836
  ),
3549
3837
  children: [
3550
3838
  label,
3551
- required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3839
+ required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" }),
3840
+ tooltip && /* @__PURE__ */ jsx(FieldTooltipIcon, { tooltip })
3552
3841
  ]
3553
3842
  }
3554
3843
  )
3555
3844
  ] }),
3556
3845
  /* @__PURE__ */ jsxs(
3557
- PopoverPrimitive2.Content,
3846
+ PopoverContent,
3558
3847
  {
3848
+ ref: contentRef,
3849
+ side,
3559
3850
  align: "start",
3560
3851
  sideOffset: 4,
3561
- className: cn(
3562
- "z-50 rounded-md border bg-popover text-popover-foreground shadow-lg p-0 overflow-hidden",
3563
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2"
3564
- ),
3565
- style: { width: "var(--radix-popover-trigger-width)" },
3852
+ avoidCollisions,
3853
+ collisionPadding: 16,
3854
+ className: "p-0 overflow-hidden flex flex-col",
3855
+ style: {
3856
+ width: "var(--radix-popover-trigger-width)",
3857
+ maxHeight: "min(340px, var(--radix-popover-content-available-height, 340px))"
3858
+ },
3566
3859
  onOpenAutoFocus: (e) => {
3567
3860
  e.preventDefault();
3568
3861
  if (searchable) {
3569
- searchRef.current?.focus();
3862
+ setTimeout(() => searchRef.current?.focus(), 0);
3570
3863
  }
3571
3864
  },
3572
3865
  children: [
@@ -3588,10 +3881,9 @@ function CardSelect({
3588
3881
  "div",
3589
3882
  {
3590
3883
  ref: listRef,
3591
- className: "overflow-y-auto overscroll-contain",
3592
- style: { maxHeight: "min(300px, var(--radix-popover-content-available-height, 300px))" },
3884
+ className: "overflow-y-auto overscroll-contain min-h-0 flex-1",
3593
3885
  onScroll: handleScroll,
3594
- children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
3886
+ children: /* @__PURE__ */ jsxs("div", { className: "p-1", children: [
3595
3887
  filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
3596
3888
  const isSelected = value === option.value;
3597
3889
  const isDisabled = option.disabled || disabled;
@@ -3602,21 +3894,361 @@ function CardSelect({
3602
3894
  disabled: isDisabled,
3603
3895
  onClick: () => {
3604
3896
  onChange(option.value);
3605
- handleOpenChange(false);
3897
+ setOpen(false);
3606
3898
  },
3607
3899
  className: cn(
3608
- "flex w-full items-center gap-3 p-3 text-left transition-all",
3609
- "cursor-pointer hover:bg-accent",
3610
- isSelected && "bg-primary/5",
3611
- isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
3900
+ "flex w-full items-center gap-2 rounded-sm px-2 text-left text-sm outline-none",
3901
+ "cursor-pointer hover:bg-accent hover:text-accent-foreground",
3902
+ isSelected && "bg-accent/50",
3903
+ isDisabled && "pointer-events-none opacity-50",
3904
+ option.description ? "py-2" : "py-1.5"
3612
3905
  ),
3613
3906
  children: [
3614
- option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
3907
+ option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3 w-3 text-primary" }) }),
3615
3908
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
3616
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
3617
- option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
3909
+ /* @__PURE__ */ jsx("span", { className: "block leading-tight", children: option.label }),
3910
+ option.description && /* @__PURE__ */ jsx("span", { className: "block text-xs leading-tight text-muted-foreground", children: option.description })
3618
3911
  ] }),
3619
- isSelected && /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) })
3912
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 shrink-0 text-primary" })
3913
+ ]
3914
+ },
3915
+ option.value
3916
+ );
3917
+ }),
3918
+ loading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
3919
+ ] })
3920
+ }
3921
+ )
3922
+ ]
3923
+ }
3924
+ )
3925
+ ] });
3926
+ }
3927
+ function FormMultiSelect({
3928
+ name,
3929
+ label,
3930
+ description,
3931
+ tooltip,
3932
+ required,
3933
+ disabled,
3934
+ className,
3935
+ options,
3936
+ placeholder = "Selecione...",
3937
+ hideError = false,
3938
+ emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3939
+ loading = false,
3940
+ searchable = false,
3941
+ searchPlaceholder = "Buscar...",
3942
+ clearable = true,
3943
+ maxVisibleChips = 3,
3944
+ dropdownPosition = "bottom"
3945
+ }) {
3946
+ const form = useFormContext();
3947
+ const fieldState = form.getFieldState(name, form.formState);
3948
+ const error = fieldState.error?.message;
3949
+ return /* @__PURE__ */ jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsx(
3950
+ Controller,
3951
+ {
3952
+ control: form.control,
3953
+ name,
3954
+ render: ({ field }) => {
3955
+ const values = Array.isArray(field.value) ? field.value : [];
3956
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1", className), children: [
3957
+ /* @__PURE__ */ jsx(
3958
+ MultiSelectDropdown,
3959
+ {
3960
+ options,
3961
+ value: values,
3962
+ onChange: (v) => field.onChange(v),
3963
+ disabled,
3964
+ label,
3965
+ tooltip,
3966
+ required,
3967
+ error: !!error,
3968
+ placeholder,
3969
+ searchable,
3970
+ loading,
3971
+ emptyText,
3972
+ searchPlaceholder,
3973
+ clearable,
3974
+ maxVisibleChips,
3975
+ dropdownPosition
3976
+ }
3977
+ ),
3978
+ description && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground px-1", children: description }),
3979
+ !hideError && error && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500 px-1", children: error })
3980
+ ] });
3981
+ }
3982
+ }
3983
+ ) });
3984
+ }
3985
+ FormMultiSelect.displayName = "Form.MultiSelect";
3986
+ function MultiSelectDropdown({
3987
+ options,
3988
+ value,
3989
+ onChange,
3990
+ disabled,
3991
+ label,
3992
+ tooltip,
3993
+ required,
3994
+ error,
3995
+ placeholder = "Selecione...",
3996
+ searchable,
3997
+ loading,
3998
+ emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3999
+ searchPlaceholder = "Buscar...",
4000
+ clearable = true,
4001
+ maxVisibleChips = 3,
4002
+ dropdownPosition = "bottom"
4003
+ }) {
4004
+ const [open, setOpen] = React10.useState(false);
4005
+ const [search, setSearch] = React10.useState("");
4006
+ const [computedMax, setComputedMax] = React10.useState(maxVisibleChips);
4007
+ const [prevValueKey, setPrevValueKey] = React10.useState(() => value.join(","));
4008
+ const contentRef = React10.useRef(null);
4009
+ const listRef = React10.useRef(null);
4010
+ const searchRef = React10.useRef(null);
4011
+ const chipsRef = React10.useRef(null);
4012
+ const selectedOptions = React10.useMemo(
4013
+ () => options.filter((o) => value.includes(o.value)),
4014
+ [options, value]
4015
+ );
4016
+ const valueKey = value.join(",");
4017
+ if (valueKey !== prevValueKey) {
4018
+ setPrevValueKey(valueKey);
4019
+ setComputedMax(maxVisibleChips);
4020
+ }
4021
+ React10.useLayoutEffect(() => {
4022
+ const container = chipsRef.current;
4023
+ if (!container || selectedOptions.length === 0) return;
4024
+ const containerRect = container.getBoundingClientRect();
4025
+ const containerWidth = containerRect.width;
4026
+ const chips = container.querySelectorAll("[data-chip]");
4027
+ if (chips.length === 0 || containerWidth === 0) return;
4028
+ const gap = 4;
4029
+ const buffer = 4;
4030
+ const badge = container.querySelector("[data-badge]");
4031
+ const badgeWidth = badge ? badge.getBoundingClientRect().width : 28;
4032
+ const availableWidth = containerWidth - buffer;
4033
+ let usedWidth = 0;
4034
+ let fits = 0;
4035
+ for (let i = 0; i < chips.length; i++) {
4036
+ const chipWidth = chips[i].getBoundingClientRect().width;
4037
+ const widthWithGap = fits > 0 ? chipWidth + gap : chipWidth;
4038
+ const remaining = selectedOptions.length - (fits + 1);
4039
+ const needsBadge = remaining > 0;
4040
+ const badgeSpace = needsBadge ? badgeWidth + gap : 0;
4041
+ if (usedWidth + widthWithGap + badgeSpace > availableWidth && fits > 0) {
4042
+ break;
4043
+ }
4044
+ usedWidth += widthWithGap;
4045
+ fits++;
4046
+ }
4047
+ const newMax = Math.max(1, fits);
4048
+ if (newMax !== computedMax) {
4049
+ setComputedMax(newMax);
4050
+ }
4051
+ });
4052
+ const filteredOptions = React10.useMemo(() => {
4053
+ if (!searchable || !search) return options;
4054
+ const q = search.toLowerCase();
4055
+ return options.filter(
4056
+ (o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)
4057
+ );
4058
+ }, [options, search, searchable]);
4059
+ const toggleOption = React10.useCallback(
4060
+ (optionValue) => {
4061
+ if (value.includes(optionValue)) {
4062
+ onChange(value.filter((v) => v !== optionValue));
4063
+ } else {
4064
+ onChange([...value, optionValue]);
4065
+ }
4066
+ },
4067
+ [value, onChange]
4068
+ );
4069
+ const handleClearAll = React10.useCallback(
4070
+ (e) => {
4071
+ e.stopPropagation();
4072
+ onChange([]);
4073
+ },
4074
+ [onChange]
4075
+ );
4076
+ const handleRemoveChip = React10.useCallback(
4077
+ (e, optionValue) => {
4078
+ e.stopPropagation();
4079
+ onChange(value.filter((v) => v !== optionValue));
4080
+ },
4081
+ [value, onChange]
4082
+ );
4083
+ const handleOpenChange = React10.useCallback((nextOpen) => {
4084
+ setOpen(nextOpen);
4085
+ if (!nextOpen) {
4086
+ setSearch("");
4087
+ }
4088
+ }, []);
4089
+ React10.useEffect(() => {
4090
+ if (!open) return;
4091
+ let cancelled = false;
4092
+ let removeHandler;
4093
+ requestAnimationFrame(() => {
4094
+ if (cancelled) return;
4095
+ const content = contentRef.current;
4096
+ const list = listRef.current;
4097
+ if (!content || !list) return;
4098
+ const handleWheel = (e) => {
4099
+ if (!content.contains(e.target)) return;
4100
+ const { scrollTop, scrollHeight, clientHeight } = list;
4101
+ if (scrollHeight <= clientHeight) return;
4102
+ e.preventDefault();
4103
+ e.stopPropagation();
4104
+ list.scrollTop = Math.max(0, Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight));
4105
+ };
4106
+ document.addEventListener("wheel", handleWheel, { passive: false, capture: true });
4107
+ removeHandler = () => document.removeEventListener("wheel", handleWheel, { capture: true });
4108
+ });
4109
+ return () => {
4110
+ cancelled = true;
4111
+ removeHandler?.();
4112
+ };
4113
+ }, [open]);
4114
+ const side = dropdownPosition === "top" ? "top" : "bottom";
4115
+ const avoidCollisions = dropdownPosition === "auto";
4116
+ const visibleChips = selectedOptions.slice(0, computedMax);
4117
+ const overflowCount = selectedOptions.length - computedMax;
4118
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
4119
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
4120
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
4121
+ "button",
4122
+ {
4123
+ type: "button",
4124
+ disabled,
4125
+ className: cn(
4126
+ "flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
4127
+ "focus:outline-none focus:border-primary",
4128
+ "disabled:cursor-not-allowed disabled:opacity-50",
4129
+ label ? "min-h-[3rem] pt-4 pb-1.5" : "min-h-[2.25rem] py-1.5",
4130
+ error ? "border-red-500" : "border-border",
4131
+ open && !error && "border-primary"
4132
+ ),
4133
+ children: [
4134
+ /* @__PURE__ */ jsx("div", { ref: chipsRef, className: "flex gap-1 items-center flex-1 overflow-hidden", children: selectedOptions.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
4135
+ visibleChips.map((option) => /* @__PURE__ */ jsxs(
4136
+ "span",
4137
+ {
4138
+ "data-chip": true,
4139
+ className: "inline-flex items-center gap-1 max-w-[150px] shrink-0 rounded-sm bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary",
4140
+ children: [
4141
+ option.icon && /* @__PURE__ */ jsx(option.icon, { className: "h-3 w-3 shrink-0" }),
4142
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label }),
4143
+ /* @__PURE__ */ jsx(
4144
+ X,
4145
+ {
4146
+ className: "h-3 w-3 shrink-0 cursor-pointer hover:text-destructive",
4147
+ onClick: (e) => handleRemoveChip(e, option.value)
4148
+ }
4149
+ )
4150
+ ]
4151
+ },
4152
+ option.value
4153
+ )),
4154
+ overflowCount > 0 && /* @__PURE__ */ jsxs("span", { "data-badge": true, className: "inline-flex items-center justify-center h-5 min-w-5 px-1.5 shrink-0 rounded-full bg-gray-100 text-gray-500 text-[10px] font-medium", children: [
4155
+ "+",
4156
+ overflowCount
4157
+ ] })
4158
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
4159
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 ml-1 shrink-0", children: [
4160
+ clearable && selectedOptions.length > 0 && /* @__PURE__ */ jsx(
4161
+ X,
4162
+ {
4163
+ className: "h-4 w-4 text-muted-foreground hover:text-foreground cursor-pointer",
4164
+ onClick: handleClearAll
4165
+ }
4166
+ ),
4167
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn("h-4 w-4 opacity-50 transition-transform", open && "rotate-180") })
4168
+ ] })
4169
+ ]
4170
+ }
4171
+ ) }),
4172
+ label && /* @__PURE__ */ jsxs(
4173
+ "label",
4174
+ {
4175
+ className: cn(
4176
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 inline-flex items-center gap-1",
4177
+ tooltip ? "pointer-events-auto" : "pointer-events-none",
4178
+ error ? "text-red-500" : "text-foreground"
4179
+ ),
4180
+ children: [
4181
+ label,
4182
+ required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" }),
4183
+ tooltip && /* @__PURE__ */ jsx(FieldTooltipIcon, { tooltip })
4184
+ ]
4185
+ }
4186
+ )
4187
+ ] }),
4188
+ /* @__PURE__ */ jsxs(
4189
+ PopoverContent,
4190
+ {
4191
+ ref: contentRef,
4192
+ side,
4193
+ align: "start",
4194
+ sideOffset: 4,
4195
+ avoidCollisions,
4196
+ collisionPadding: 16,
4197
+ className: "p-0 overflow-hidden flex flex-col",
4198
+ style: {
4199
+ width: "var(--radix-popover-trigger-width)",
4200
+ maxHeight: "min(340px, var(--radix-popover-content-available-height, 340px))"
4201
+ },
4202
+ onOpenAutoFocus: (e) => {
4203
+ e.preventDefault();
4204
+ if (searchable) {
4205
+ setTimeout(() => searchRef.current?.focus(), 0);
4206
+ }
4207
+ },
4208
+ children: [
4209
+ searchable && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
4210
+ /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
4211
+ /* @__PURE__ */ jsx(
4212
+ "input",
4213
+ {
4214
+ ref: searchRef,
4215
+ type: "text",
4216
+ value: search,
4217
+ onChange: (e) => setSearch(e.target.value),
4218
+ placeholder: searchPlaceholder,
4219
+ className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
4220
+ }
4221
+ )
4222
+ ] }),
4223
+ /* @__PURE__ */ jsx(
4224
+ "div",
4225
+ {
4226
+ ref: listRef,
4227
+ className: "overflow-y-auto overscroll-contain min-h-0 flex-1",
4228
+ children: /* @__PURE__ */ jsxs("div", { className: "p-1", children: [
4229
+ filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
4230
+ const isSelected = value.includes(option.value);
4231
+ const isDisabled = option.disabled || disabled;
4232
+ return /* @__PURE__ */ jsxs(
4233
+ "button",
4234
+ {
4235
+ type: "button",
4236
+ disabled: isDisabled,
4237
+ onClick: () => toggleOption(option.value),
4238
+ className: cn(
4239
+ "flex w-full items-center gap-2 rounded-sm px-2 text-left text-sm outline-none",
4240
+ "cursor-pointer hover:bg-accent hover:text-accent-foreground",
4241
+ isSelected && "bg-accent/50",
4242
+ isDisabled && "pointer-events-none opacity-50",
4243
+ option.description ? "py-2" : "py-1.5"
4244
+ ),
4245
+ children: [
4246
+ option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3 w-3 text-primary" }) }),
4247
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
4248
+ /* @__PURE__ */ jsx("span", { className: "block leading-tight", children: option.label }),
4249
+ option.description && /* @__PURE__ */ jsx("span", { className: "block text-xs leading-tight text-muted-foreground", children: option.description })
4250
+ ] }),
4251
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 shrink-0 text-primary" })
3620
4252
  ]
3621
4253
  },
3622
4254
  option.value
@@ -3930,72 +4562,6 @@ function FormRadioGroup({
3930
4562
  ) });
3931
4563
  }
3932
4564
  FormRadioGroup.displayName = "Form.RadioGroup";
3933
- var FormLabel = React10.forwardRef(
3934
- ({ className, required, children, ...props }, ref) => {
3935
- const fieldContext = useFormFieldContextOptional();
3936
- return /* @__PURE__ */ jsxs(
3937
- "label",
3938
- {
3939
- ref,
3940
- htmlFor: fieldContext?.id,
3941
- className: cn(
3942
- "text-sm font-medium leading-none",
3943
- fieldContext?.error && "text-red-500",
3944
- className
3945
- ),
3946
- ...props,
3947
- children: [
3948
- children,
3949
- (required || fieldContext?.isRequired) && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3950
- ]
3951
- }
3952
- );
3953
- }
3954
- );
3955
- FormLabel.displayName = "Form.Label";
3956
- var FormDescription = React10.forwardRef(({ className, ...props }, ref) => {
3957
- const fieldContext = useFormFieldContextOptional();
3958
- if (fieldContext?.error) {
3959
- return null;
3960
- }
3961
- return /* @__PURE__ */ jsx(
3962
- "p",
3963
- {
3964
- ref,
3965
- className: cn("text-xs text-muted-foreground", className),
3966
- ...props
3967
- }
3968
- );
3969
- });
3970
- FormDescription.displayName = "Form.Description";
3971
- var FormError = React10.forwardRef(
3972
- ({ className, message, children, ...props }, ref) => {
3973
- const fieldContext = useFormFieldContextOptional();
3974
- const errorMessage = message ?? fieldContext?.error;
3975
- if (!errorMessage && !children) {
3976
- return null;
3977
- }
3978
- return /* @__PURE__ */ jsx(
3979
- "p",
3980
- {
3981
- ref,
3982
- className: cn("text-xs text-red-500", className),
3983
- ...props,
3984
- children: children || errorMessage
3985
- }
3986
- );
3987
- }
3988
- );
3989
- FormError.displayName = "Form.Error";
3990
- var FormFieldWrapper = React10.forwardRef(({ className, label, description, required, error, children, ...props }, ref) => {
3991
- return /* @__PURE__ */ jsxs("div", { ref, className: cn("space-y-1", className), ...props, children: [
3992
- label && /* @__PURE__ */ jsx(FormLabel, { required, children: label }),
3993
- children,
3994
- description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
3995
- error && /* @__PURE__ */ jsx(FormError, { message: error })
3996
- ] });
3997
- });
3998
- FormFieldWrapper.displayName = "Form.FieldWrapper";
3999
4565
  function FormRoot({
4000
4566
  form,
4001
4567
  onSubmit,
@@ -4019,6 +4585,7 @@ var Form = Object.assign(FormRoot, {
4019
4585
  // Campos com auto-bind
4020
4586
  Input: FormInput,
4021
4587
  Select: FormSelect,
4588
+ MultiSelect: FormMultiSelect,
4022
4589
  Textarea: FormTextarea,
4023
4590
  Checkbox: FormCheckbox,
4024
4591
  Switch: FormSwitch,
@@ -4192,207 +4759,6 @@ var DropdownMenuShortcut = ({
4192
4759
  );
4193
4760
  };
4194
4761
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
4195
- var Popover = PopoverPrimitive2.Root;
4196
- var PopoverTrigger = PopoverPrimitive2.Trigger;
4197
- var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx(
4198
- PopoverPrimitive2.Content,
4199
- {
4200
- ref,
4201
- align,
4202
- sideOffset,
4203
- className: cn(
4204
- "z-50 w-auto rounded-md border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4205
- className
4206
- ),
4207
- ...props
4208
- }
4209
- ) }));
4210
- PopoverContent.displayName = PopoverPrimitive2.Content.displayName;
4211
- var TooltipProvider = TooltipPrimitive.Provider;
4212
- var TooltipRoot = TooltipPrimitive.Root;
4213
- var TooltipTrigger = TooltipPrimitive.Trigger;
4214
- var TooltipPortal = TooltipPrimitive.Portal;
4215
- var TooltipArrow = React10.forwardRef(({ className, variant = "light", ...props }, ref) => /* @__PURE__ */ jsx(
4216
- TooltipPrimitive.Arrow,
4217
- {
4218
- ref,
4219
- className: cn(
4220
- "z-50",
4221
- variant === "dark" ? "fill-popover" : "fill-background",
4222
- className
4223
- ),
4224
- ...props
4225
- }
4226
- ));
4227
- TooltipArrow.displayName = "TooltipArrow";
4228
- var tooltipContentVariants = cva(
4229
- "z-50 overflow-hidden rounded-lg shadow-lg outline-none animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4230
- {
4231
- variants: {
4232
- variant: {
4233
- light: "bg-background text-foreground border border-border",
4234
- dark: "bg-popover text-popover-foreground border border-border"
4235
- },
4236
- size: {
4237
- sm: "max-w-[200px] p-2",
4238
- md: "max-w-[280px] p-3",
4239
- lg: "max-w-[360px] p-4"
4240
- }
4241
- },
4242
- defaultVariants: {
4243
- variant: "light",
4244
- size: "md"
4245
- }
4246
- }
4247
- );
4248
- var TooltipContent = React10.forwardRef(
4249
- ({
4250
- className,
4251
- variant = "light",
4252
- size = "md",
4253
- sideOffset = 8,
4254
- showArrow = true,
4255
- onDismiss,
4256
- children,
4257
- ...props
4258
- }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
4259
- TooltipPrimitive.Content,
4260
- {
4261
- ref,
4262
- sideOffset,
4263
- className: cn(tooltipContentVariants({ variant, size }), className),
4264
- ...props,
4265
- children: [
4266
- onDismiss && /* @__PURE__ */ jsx(
4267
- "button",
4268
- {
4269
- onClick: onDismiss,
4270
- className: "absolute top-2 right-2 p-1 rounded-full transition-colors hover:bg-muted text-muted-foreground hover:text-foreground",
4271
- "aria-label": "Fechar",
4272
- children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
4273
- }
4274
- ),
4275
- children,
4276
- showArrow && /* @__PURE__ */ jsx(TooltipArrow, { variant: variant ?? "light", width: 12, height: 6 })
4277
- ]
4278
- }
4279
- ) })
4280
- );
4281
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
4282
- var TooltipHeader = React10.forwardRef(
4283
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1", className), ...props })
4284
- );
4285
- TooltipHeader.displayName = "TooltipHeader";
4286
- var TooltipTitle = React10.forwardRef(
4287
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4288
- "h4",
4289
- {
4290
- ref,
4291
- className: cn("text-sm font-semibold leading-tight", className),
4292
- ...props
4293
- }
4294
- )
4295
- );
4296
- TooltipTitle.displayName = "TooltipTitle";
4297
- var TooltipDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4298
- "p",
4299
- {
4300
- ref,
4301
- className: cn("text-xs leading-relaxed text-muted-foreground", className),
4302
- ...props
4303
- }
4304
- ));
4305
- TooltipDescription.displayName = "TooltipDescription";
4306
- var TooltipActions = React10.forwardRef(
4307
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4308
- "div",
4309
- {
4310
- ref,
4311
- className: cn("flex items-center gap-2 mt-3", className),
4312
- ...props
4313
- }
4314
- )
4315
- );
4316
- TooltipActions.displayName = "TooltipActions";
4317
- var tooltipActionVariants = cva(
4318
- "inline-flex items-center justify-center text-xs font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
4319
- {
4320
- variants: {
4321
- variant: {
4322
- primary: "bg-primary text-primary-foreground hover:bg-primary/90 px-3 py-1.5",
4323
- secondary: "bg-transparent text-muted-foreground hover:text-foreground hover:underline px-2 py-1.5",
4324
- outline: "border border-border bg-background text-foreground hover:bg-muted px-3 py-1.5"
4325
- }
4326
- },
4327
- defaultVariants: {
4328
- variant: "primary"
4329
- }
4330
- }
4331
- );
4332
- var TooltipAction = React10.forwardRef(
4333
- ({ className, variant = "primary", ...props }, ref) => /* @__PURE__ */ jsx(
4334
- "button",
4335
- {
4336
- ref,
4337
- className: cn(tooltipActionVariants({ variant }), className),
4338
- ...props
4339
- }
4340
- )
4341
- );
4342
- TooltipAction.displayName = "TooltipAction";
4343
- var TooltipIcon = React10.forwardRef(
4344
- ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
4345
- "div",
4346
- {
4347
- ref,
4348
- className: cn(
4349
- "flex items-center justify-center w-10 h-10 rounded-full mb-3 bg-muted",
4350
- className
4351
- ),
4352
- ...props,
4353
- children
4354
- }
4355
- )
4356
- );
4357
- TooltipIcon.displayName = "TooltipIcon";
4358
- var SimpleTooltip = ({
4359
- children,
4360
- content,
4361
- variant = "light",
4362
- side = "top",
4363
- align = "center",
4364
- delayDuration = 200,
4365
- open,
4366
- defaultOpen,
4367
- onOpenChange
4368
- }) => /* @__PURE__ */ jsxs(
4369
- TooltipRoot,
4370
- {
4371
- open,
4372
- defaultOpen,
4373
- onOpenChange,
4374
- delayDuration,
4375
- children: [
4376
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children }),
4377
- /* @__PURE__ */ jsx(TooltipContent, { variant, side, align, size: "sm", children: /* @__PURE__ */ jsx("span", { className: "text-xs", children: content }) })
4378
- ]
4379
- }
4380
- );
4381
- SimpleTooltip.displayName = "SimpleTooltip";
4382
- var Tooltip = Object.assign(TooltipRoot, {
4383
- Provider: TooltipProvider,
4384
- Trigger: TooltipTrigger,
4385
- Portal: TooltipPortal,
4386
- Content: TooltipContent,
4387
- Arrow: TooltipArrow,
4388
- Header: TooltipHeader,
4389
- Title: TooltipTitle,
4390
- Description: TooltipDescription,
4391
- Actions: TooltipActions,
4392
- Action: TooltipAction,
4393
- Icon: TooltipIcon,
4394
- Simple: SimpleTooltip
4395
- });
4396
4762
  var AuthLayoutContext = React10.createContext({
4397
4763
  imagePosition: "left"
4398
4764
  });