@facter/ds-core 1.9.0 → 1.11.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,10 +17,10 @@ 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 PopoverPrimitive from '@radix-ui/react-popover';
20
21
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
21
22
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
22
23
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
23
- import * as PopoverPrimitive from '@radix-ui/react-popover';
24
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';
@@ -3208,6 +3208,22 @@ function FormInput({
3208
3208
  ) });
3209
3209
  }
3210
3210
  FormInput.displayName = "Form.Input";
3211
+ var Popover = PopoverPrimitive.Root;
3212
+ var PopoverTrigger = PopoverPrimitive.Trigger;
3213
+ var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
3214
+ PopoverPrimitive.Content,
3215
+ {
3216
+ ref,
3217
+ align,
3218
+ sideOffset,
3219
+ className: cn(
3220
+ "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",
3221
+ className
3222
+ ),
3223
+ ...props
3224
+ }
3225
+ ) }));
3226
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
3211
3227
  function FormSelect({
3212
3228
  name,
3213
3229
  label,
@@ -3221,7 +3237,8 @@ function FormSelect({
3221
3237
  hideError = false,
3222
3238
  selectSize = "default",
3223
3239
  emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3224
- loading = false
3240
+ loading = false,
3241
+ variant = "default"
3225
3242
  }) {
3226
3243
  const form = useFormContext();
3227
3244
  const fieldState = form.getFieldState(name, form.formState);
@@ -3232,7 +3249,19 @@ function FormSelect({
3232
3249
  control: form.control,
3233
3250
  name,
3234
3251
  render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-1", className), children: [
3235
- /* @__PURE__ */ jsx(
3252
+ variant === "card" ? /* @__PURE__ */ jsx(
3253
+ CardSelect,
3254
+ {
3255
+ options,
3256
+ value: field.value,
3257
+ onChange: (v) => field.onChange(v || void 0),
3258
+ disabled,
3259
+ label,
3260
+ required,
3261
+ error: !!error,
3262
+ placeholder
3263
+ }
3264
+ ) : /* @__PURE__ */ jsx(
3236
3265
  Select,
3237
3266
  {
3238
3267
  value: field.value ?? "",
@@ -3270,6 +3299,98 @@ function FormSelect({
3270
3299
  ) });
3271
3300
  }
3272
3301
  FormSelect.displayName = "Form.Select";
3302
+ function CardSelect({
3303
+ options,
3304
+ value,
3305
+ onChange,
3306
+ disabled,
3307
+ label,
3308
+ required,
3309
+ error,
3310
+ placeholder = "Selecione..."
3311
+ }) {
3312
+ const [open, setOpen] = React10.useState(false);
3313
+ const selected = options.find((o) => o.value === value);
3314
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
3315
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3316
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs(
3317
+ "button",
3318
+ {
3319
+ type: "button",
3320
+ className: cn(
3321
+ "flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
3322
+ "focus:outline-none focus:border-primary",
3323
+ "disabled:cursor-not-allowed disabled:opacity-50",
3324
+ label ? "h-12 pt-4 pb-2" : "h-9 py-2",
3325
+ error ? "border-red-500" : "border-border",
3326
+ open && !error && "border-primary"
3327
+ ),
3328
+ children: [
3329
+ selected ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
3330
+ selected.icon && /* @__PURE__ */ jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3331
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: selected.label })
3332
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
3333
+ /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 shrink-0 opacity-50" })
3334
+ ]
3335
+ }
3336
+ ) }),
3337
+ label && /* @__PURE__ */ jsxs(
3338
+ "label",
3339
+ {
3340
+ className: cn(
3341
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
3342
+ error ? "text-red-500" : "text-foreground"
3343
+ ),
3344
+ children: [
3345
+ label,
3346
+ required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3347
+ ]
3348
+ }
3349
+ )
3350
+ ] }),
3351
+ /* @__PURE__ */ jsx(
3352
+ PopoverContent,
3353
+ {
3354
+ align: "start",
3355
+ className: "p-2 overflow-y-auto",
3356
+ style: {
3357
+ width: "var(--radix-popover-trigger-width)",
3358
+ maxHeight: "var(--radix-popover-content-available-height)"
3359
+ },
3360
+ children: /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/50", children: options.map((option) => {
3361
+ const isSelected = value === option.value;
3362
+ const isDisabled = option.disabled || disabled;
3363
+ return /* @__PURE__ */ jsxs(
3364
+ "button",
3365
+ {
3366
+ type: "button",
3367
+ disabled: isDisabled,
3368
+ onClick: () => {
3369
+ onChange(option.value);
3370
+ setOpen(false);
3371
+ },
3372
+ className: cn(
3373
+ "flex w-full items-center gap-3 p-3 text-left transition-all",
3374
+ "cursor-pointer hover:bg-accent",
3375
+ isSelected && "bg-primary/5",
3376
+ isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
3377
+ ),
3378
+ children: [
3379
+ option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-5 w-5 text-primary" }) }),
3380
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
3381
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
3382
+ option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
3383
+ ] }),
3384
+ 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" }) })
3385
+ ]
3386
+ },
3387
+ option.value
3388
+ );
3389
+ }) })
3390
+ }
3391
+ )
3392
+ ] });
3393
+ }
3273
3394
  function FormTextarea({
3274
3395
  name,
3275
3396
  label,
@@ -3831,22 +3952,6 @@ var DropdownMenuShortcut = ({
3831
3952
  );
3832
3953
  };
3833
3954
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
3834
- var Popover = PopoverPrimitive.Root;
3835
- var PopoverTrigger = PopoverPrimitive.Trigger;
3836
- var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
3837
- PopoverPrimitive.Content,
3838
- {
3839
- ref,
3840
- align,
3841
- sideOffset,
3842
- className: cn(
3843
- "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",
3844
- className
3845
- ),
3846
- ...props
3847
- }
3848
- ) }));
3849
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
3850
3955
  var TooltipProvider = TooltipPrimitive.Provider;
3851
3956
  var TooltipRoot = TooltipPrimitive.Root;
3852
3957
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -7693,30 +7798,35 @@ var Wizard = Object.assign(WizardRoot, {
7693
7798
  Progress: WizardProgress
7694
7799
  });
7695
7800
  var positionClasses = {
7696
- "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
7801
+ "bottom-center": "bottom-6 inset-x-0 flex justify-center",
7697
7802
  "bottom-left": "bottom-6 left-6",
7698
7803
  "bottom-right": "bottom-6 right-6"
7699
7804
  };
7700
7805
  var FloatingBar = React10.forwardRef(
7701
- ({ className, visible = true, position = "bottom-center", children, style, ...props }, ref) => {
7806
+ ({ className, visible = true, position = "bottom-center", wrapperClassName, children, style, ...props }, ref) => {
7702
7807
  return /* @__PURE__ */ jsx(
7703
7808
  "div",
7704
7809
  {
7705
7810
  ref,
7706
- className: cn("fixed z-50", positionClasses[position]),
7811
+ className: cn(
7812
+ "fixed z-50 pointer-events-none",
7813
+ positionClasses[position],
7814
+ wrapperClassName
7815
+ ),
7707
7816
  style,
7708
7817
  ...props,
7709
7818
  children: /* @__PURE__ */ jsx(
7710
7819
  "div",
7711
7820
  {
7712
7821
  className: cn(
7713
- "flex items-center gap-1.5 px-2 py-1.5 rounded-full",
7714
- "bg-white/70 dark:bg-gray-900/70 backdrop-blur-xl",
7715
- "border border-white/50 dark:border-white/10",
7716
- "shadow-xl shadow-black/10 dark:shadow-black/30",
7717
- "ring-1 ring-black/5 dark:ring-white/5",
7718
- "transition-all duration-300 ease-out",
7719
- visible ? "translate-y-0 opacity-100" : "translate-y-4 opacity-0 pointer-events-none",
7822
+ "pointer-events-auto",
7823
+ "flex items-center gap-2 px-4 py-2.5 rounded-full",
7824
+ "bg-white/80 dark:bg-gray-900/80 backdrop-blur-xl",
7825
+ "border border-white/60 dark:border-white/10",
7826
+ "shadow-2xl shadow-black/15 dark:shadow-black/40",
7827
+ "ring-1 ring-black/[0.06] dark:ring-white/[0.06]",
7828
+ "transition-all duration-300",
7829
+ visible ? "translate-y-0 opacity-100 scale-100" : "translate-y-6 opacity-0 scale-95 pointer-events-none",
7720
7830
  className
7721
7831
  ),
7722
7832
  children
@@ -7728,18 +7838,18 @@ var FloatingBar = React10.forwardRef(
7728
7838
  );
7729
7839
  FloatingBar.displayName = "FloatingBar";
7730
7840
  var actionVariants = cva(
7731
- "inline-flex items-center gap-2 rounded-full font-medium transition-all duration-150 active:scale-[0.97] disabled:opacity-50 disabled:pointer-events-none",
7841
+ "inline-flex items-center gap-2 rounded-full font-medium transition-all duration-150 active:scale-[0.97] disabled:opacity-50 disabled:pointer-events-none cursor-pointer",
7732
7842
  {
7733
7843
  variants: {
7734
7844
  variant: {
7735
- default: "bg-primary hover:bg-primary/90 text-primary-foreground",
7736
- success: "bg-emerald-600 hover:bg-emerald-700 text-white",
7737
- destructive: "bg-red-600 hover:bg-red-700 text-white",
7845
+ default: "bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm",
7846
+ success: "bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm shadow-emerald-600/20",
7847
+ destructive: "bg-red-600 hover:bg-red-700 text-white shadow-sm shadow-red-600/20",
7738
7848
  ghost: "hover:bg-accent text-foreground"
7739
7849
  },
7740
7850
  size: {
7741
- default: "h-8 px-4 text-sm",
7742
- sm: "h-7 px-3 text-xs"
7851
+ default: "h-9 px-5 text-sm",
7852
+ sm: "h-8 px-4 text-xs"
7743
7853
  }
7744
7854
  },
7745
7855
  defaultVariants: {
@@ -7757,7 +7867,7 @@ var FloatingBarAction = React10.forwardRef(
7757
7867
  className: cn(actionVariants({ variant, size, className })),
7758
7868
  ...props,
7759
7869
  children: [
7760
- Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-3.5 w-3.5" }),
7870
+ Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4" }),
7761
7871
  /* @__PURE__ */ jsx("span", { children })
7762
7872
  ]
7763
7873
  }
@@ -7766,7 +7876,7 @@ var FloatingBarAction = React10.forwardRef(
7766
7876
  );
7767
7877
  FloatingBarAction.displayName = "FloatingBarAction";
7768
7878
  var iconActionVariants = cva(
7769
- "inline-flex items-center justify-center rounded-full transition-colors duration-150 disabled:opacity-50 disabled:pointer-events-none",
7879
+ "inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer disabled:opacity-50 disabled:pointer-events-none",
7770
7880
  {
7771
7881
  variants: {
7772
7882
  variant: {
@@ -7776,8 +7886,8 @@ var iconActionVariants = cva(
7776
7886
  danger: "text-muted-foreground hover:text-destructive hover:bg-destructive/10"
7777
7887
  },
7778
7888
  size: {
7779
- default: "h-8 w-8",
7780
- sm: "h-7 w-7"
7889
+ default: "h-9 w-9",
7890
+ sm: "h-8 w-8"
7781
7891
  }
7782
7892
  },
7783
7893
  defaultVariants: {
@@ -7808,7 +7918,7 @@ var FloatingBarDivider = React10.forwardRef(
7808
7918
  "div",
7809
7919
  {
7810
7920
  ref,
7811
- className: cn("w-px h-5 bg-border mx-0.5", className),
7921
+ className: cn("w-px h-6 bg-border/60 mx-0.5", className),
7812
7922
  ...props
7813
7923
  }
7814
7924
  );