@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.d.mts CHANGED
@@ -896,6 +896,8 @@ interface FormSelectProps<T extends FieldValues = FieldValues> extends BaseField
896
896
  }>;
897
897
  hideError?: boolean;
898
898
  selectSize?: 'sm' | 'default' | 'lg';
899
+ /** Render as dropdown (default) or visual card grid */
900
+ variant?: 'default' | 'card';
899
901
  }
900
902
  interface FormTextareaProps<T extends FieldValues = FieldValues> extends BaseFieldProps<T>, Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, 'name'> {
901
903
  hideError?: boolean;
@@ -927,7 +929,7 @@ declare namespace FormInput {
927
929
  var displayName: string;
928
930
  }
929
931
 
930
- declare function FormSelect<T extends FieldValues = FieldValues>({ name, label, description, required, disabled, className, options, placeholder, icon, hideError, selectSize, emptyText, loading, }: FormSelectProps<T>): react_jsx_runtime.JSX.Element;
932
+ declare function FormSelect<T extends FieldValues = FieldValues>({ name, label, description, required, disabled, className, options, placeholder, icon, hideError, selectSize, emptyText, loading, variant, }: FormSelectProps<T>): react_jsx_runtime.JSX.Element;
931
933
  declare namespace FormSelect {
932
934
  var displayName: string;
933
935
  }
@@ -2535,6 +2537,8 @@ interface FloatingBarProps extends React$1.HTMLAttributes<HTMLDivElement> {
2535
2537
  visible?: boolean;
2536
2538
  /** Position on screen */
2537
2539
  position?: 'bottom-center' | 'bottom-left' | 'bottom-right';
2540
+ /** Additional classes for the outer positioning wrapper */
2541
+ wrapperClassName?: string;
2538
2542
  }
2539
2543
  declare const actionVariants: (props?: ({
2540
2544
  variant?: "default" | "destructive" | "ghost" | "success" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -896,6 +896,8 @@ interface FormSelectProps<T extends FieldValues = FieldValues> extends BaseField
896
896
  }>;
897
897
  hideError?: boolean;
898
898
  selectSize?: 'sm' | 'default' | 'lg';
899
+ /** Render as dropdown (default) or visual card grid */
900
+ variant?: 'default' | 'card';
899
901
  }
900
902
  interface FormTextareaProps<T extends FieldValues = FieldValues> extends BaseFieldProps<T>, Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, 'name'> {
901
903
  hideError?: boolean;
@@ -927,7 +929,7 @@ declare namespace FormInput {
927
929
  var displayName: string;
928
930
  }
929
931
 
930
- declare function FormSelect<T extends FieldValues = FieldValues>({ name, label, description, required, disabled, className, options, placeholder, icon, hideError, selectSize, emptyText, loading, }: FormSelectProps<T>): react_jsx_runtime.JSX.Element;
932
+ declare function FormSelect<T extends FieldValues = FieldValues>({ name, label, description, required, disabled, className, options, placeholder, icon, hideError, selectSize, emptyText, loading, variant, }: FormSelectProps<T>): react_jsx_runtime.JSX.Element;
931
933
  declare namespace FormSelect {
932
934
  var displayName: string;
933
935
  }
@@ -2535,6 +2537,8 @@ interface FloatingBarProps extends React$1.HTMLAttributes<HTMLDivElement> {
2535
2537
  visible?: boolean;
2536
2538
  /** Position on screen */
2537
2539
  position?: 'bottom-center' | 'bottom-left' | 'bottom-right';
2540
+ /** Additional classes for the outer positioning wrapper */
2541
+ wrapperClassName?: string;
2538
2542
  }
2539
2543
  declare const actionVariants: (props?: ({
2540
2544
  variant?: "default" | "destructive" | "ghost" | "success" | null | undefined;
package/dist/index.js CHANGED
@@ -16,10 +16,10 @@ var DialogPrimitive = require('@radix-ui/react-dialog');
16
16
  var sonner = require('sonner');
17
17
  var SwitchPrimitives = require('@radix-ui/react-switch');
18
18
  var reactHookForm = require('react-hook-form');
19
+ var PopoverPrimitive = require('@radix-ui/react-popover');
19
20
  var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
20
21
  var AvatarPrimitive = require('@radix-ui/react-avatar');
21
22
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
22
- var PopoverPrimitive = require('@radix-ui/react-popover');
23
23
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
24
24
  var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
25
25
  var SeparatorPrimitive = require('@radix-ui/react-separator');
@@ -50,10 +50,10 @@ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
50
50
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
51
51
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
52
52
  var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
53
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
53
54
  var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
54
55
  var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
55
56
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
56
- var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
57
57
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
58
58
  var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
59
59
  var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
@@ -3239,6 +3239,22 @@ function FormInput({
3239
3239
  ) });
3240
3240
  }
3241
3241
  FormInput.displayName = "Form.Input";
3242
+ var Popover = PopoverPrimitive__namespace.Root;
3243
+ var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
3244
+ var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3245
+ PopoverPrimitive__namespace.Content,
3246
+ {
3247
+ ref,
3248
+ align,
3249
+ sideOffset,
3250
+ className: cn(
3251
+ "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",
3252
+ className
3253
+ ),
3254
+ ...props
3255
+ }
3256
+ ) }));
3257
+ PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
3242
3258
  function FormSelect({
3243
3259
  name,
3244
3260
  label,
@@ -3252,7 +3268,8 @@ function FormSelect({
3252
3268
  hideError = false,
3253
3269
  selectSize = "default",
3254
3270
  emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
3255
- loading = false
3271
+ loading = false,
3272
+ variant = "default"
3256
3273
  }) {
3257
3274
  const form = reactHookForm.useFormContext();
3258
3275
  const fieldState = form.getFieldState(name, form.formState);
@@ -3263,7 +3280,19 @@ function FormSelect({
3263
3280
  control: form.control,
3264
3281
  name,
3265
3282
  render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
3266
- /* @__PURE__ */ jsxRuntime.jsx(
3283
+ variant === "card" ? /* @__PURE__ */ jsxRuntime.jsx(
3284
+ CardSelect,
3285
+ {
3286
+ options,
3287
+ value: field.value,
3288
+ onChange: (v) => field.onChange(v || void 0),
3289
+ disabled,
3290
+ label,
3291
+ required,
3292
+ error: !!error,
3293
+ placeholder
3294
+ }
3295
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3267
3296
  Select,
3268
3297
  {
3269
3298
  value: field.value ?? "",
@@ -3301,6 +3330,98 @@ function FormSelect({
3301
3330
  ) });
3302
3331
  }
3303
3332
  FormSelect.displayName = "Form.Select";
3333
+ function CardSelect({
3334
+ options,
3335
+ value,
3336
+ onChange,
3337
+ disabled,
3338
+ label,
3339
+ required,
3340
+ error,
3341
+ placeholder = "Selecione..."
3342
+ }) {
3343
+ const [open, setOpen] = React10__namespace.useState(false);
3344
+ const selected = options.find((o) => o.value === value);
3345
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
3346
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3347
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
3348
+ "button",
3349
+ {
3350
+ type: "button",
3351
+ className: cn(
3352
+ "flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
3353
+ "focus:outline-none focus:border-primary",
3354
+ "disabled:cursor-not-allowed disabled:opacity-50",
3355
+ label ? "h-12 pt-4 pb-2" : "h-9 py-2",
3356
+ error ? "border-red-500" : "border-border",
3357
+ open && !error && "border-primary"
3358
+ ),
3359
+ children: [
3360
+ selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
3361
+ selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3362
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
3363
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
3364
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 shrink-0 opacity-50" })
3365
+ ]
3366
+ }
3367
+ ) }),
3368
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
3369
+ "label",
3370
+ {
3371
+ className: cn(
3372
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
3373
+ error ? "text-red-500" : "text-foreground"
3374
+ ),
3375
+ children: [
3376
+ label,
3377
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3378
+ ]
3379
+ }
3380
+ )
3381
+ ] }),
3382
+ /* @__PURE__ */ jsxRuntime.jsx(
3383
+ PopoverContent,
3384
+ {
3385
+ align: "start",
3386
+ className: "p-2 overflow-y-auto",
3387
+ style: {
3388
+ width: "var(--radix-popover-trigger-width)",
3389
+ maxHeight: "var(--radix-popover-content-available-height)"
3390
+ },
3391
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-border/50", children: options.map((option) => {
3392
+ const isSelected = value === option.value;
3393
+ const isDisabled = option.disabled || disabled;
3394
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3395
+ "button",
3396
+ {
3397
+ type: "button",
3398
+ disabled: isDisabled,
3399
+ onClick: () => {
3400
+ onChange(option.value);
3401
+ setOpen(false);
3402
+ },
3403
+ className: cn(
3404
+ "flex w-full items-center gap-3 p-3 text-left transition-all",
3405
+ "cursor-pointer hover:bg-accent",
3406
+ isSelected && "bg-primary/5",
3407
+ isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
3408
+ ),
3409
+ children: [
3410
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-5 w-5 text-primary" }) }),
3411
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
3412
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
3413
+ option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
3414
+ ] }),
3415
+ isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }) })
3416
+ ]
3417
+ },
3418
+ option.value
3419
+ );
3420
+ }) })
3421
+ }
3422
+ )
3423
+ ] });
3424
+ }
3304
3425
  function FormTextarea({
3305
3426
  name,
3306
3427
  label,
@@ -3862,22 +3983,6 @@ var DropdownMenuShortcut = ({
3862
3983
  );
3863
3984
  };
3864
3985
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
3865
- var Popover = PopoverPrimitive__namespace.Root;
3866
- var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
3867
- var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3868
- PopoverPrimitive__namespace.Content,
3869
- {
3870
- ref,
3871
- align,
3872
- sideOffset,
3873
- className: cn(
3874
- "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",
3875
- className
3876
- ),
3877
- ...props
3878
- }
3879
- ) }));
3880
- PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
3881
3986
  var TooltipProvider = TooltipPrimitive__namespace.Provider;
3882
3987
  var TooltipRoot = TooltipPrimitive__namespace.Root;
3883
3988
  var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
@@ -7724,30 +7829,35 @@ var Wizard = Object.assign(WizardRoot, {
7724
7829
  Progress: WizardProgress
7725
7830
  });
7726
7831
  var positionClasses = {
7727
- "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
7832
+ "bottom-center": "bottom-6 inset-x-0 flex justify-center",
7728
7833
  "bottom-left": "bottom-6 left-6",
7729
7834
  "bottom-right": "bottom-6 right-6"
7730
7835
  };
7731
7836
  var FloatingBar = React10__namespace.forwardRef(
7732
- ({ className, visible = true, position = "bottom-center", children, style, ...props }, ref) => {
7837
+ ({ className, visible = true, position = "bottom-center", wrapperClassName, children, style, ...props }, ref) => {
7733
7838
  return /* @__PURE__ */ jsxRuntime.jsx(
7734
7839
  "div",
7735
7840
  {
7736
7841
  ref,
7737
- className: cn("fixed z-50", positionClasses[position]),
7842
+ className: cn(
7843
+ "fixed z-50 pointer-events-none",
7844
+ positionClasses[position],
7845
+ wrapperClassName
7846
+ ),
7738
7847
  style,
7739
7848
  ...props,
7740
7849
  children: /* @__PURE__ */ jsxRuntime.jsx(
7741
7850
  "div",
7742
7851
  {
7743
7852
  className: cn(
7744
- "flex items-center gap-1.5 px-2 py-1.5 rounded-full",
7745
- "bg-white/70 dark:bg-gray-900/70 backdrop-blur-xl",
7746
- "border border-white/50 dark:border-white/10",
7747
- "shadow-xl shadow-black/10 dark:shadow-black/30",
7748
- "ring-1 ring-black/5 dark:ring-white/5",
7749
- "transition-all duration-300 ease-out",
7750
- visible ? "translate-y-0 opacity-100" : "translate-y-4 opacity-0 pointer-events-none",
7853
+ "pointer-events-auto",
7854
+ "flex items-center gap-2 px-4 py-2.5 rounded-full",
7855
+ "bg-white/80 dark:bg-gray-900/80 backdrop-blur-xl",
7856
+ "border border-white/60 dark:border-white/10",
7857
+ "shadow-2xl shadow-black/15 dark:shadow-black/40",
7858
+ "ring-1 ring-black/[0.06] dark:ring-white/[0.06]",
7859
+ "transition-all duration-300",
7860
+ visible ? "translate-y-0 opacity-100 scale-100" : "translate-y-6 opacity-0 scale-95 pointer-events-none",
7751
7861
  className
7752
7862
  ),
7753
7863
  children
@@ -7759,18 +7869,18 @@ var FloatingBar = React10__namespace.forwardRef(
7759
7869
  );
7760
7870
  FloatingBar.displayName = "FloatingBar";
7761
7871
  var actionVariants = classVarianceAuthority.cva(
7762
- "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",
7872
+ "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",
7763
7873
  {
7764
7874
  variants: {
7765
7875
  variant: {
7766
- default: "bg-primary hover:bg-primary/90 text-primary-foreground",
7767
- success: "bg-emerald-600 hover:bg-emerald-700 text-white",
7768
- destructive: "bg-red-600 hover:bg-red-700 text-white",
7876
+ default: "bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm",
7877
+ success: "bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm shadow-emerald-600/20",
7878
+ destructive: "bg-red-600 hover:bg-red-700 text-white shadow-sm shadow-red-600/20",
7769
7879
  ghost: "hover:bg-accent text-foreground"
7770
7880
  },
7771
7881
  size: {
7772
- default: "h-8 px-4 text-sm",
7773
- sm: "h-7 px-3 text-xs"
7882
+ default: "h-9 px-5 text-sm",
7883
+ sm: "h-8 px-4 text-xs"
7774
7884
  }
7775
7885
  },
7776
7886
  defaultVariants: {
@@ -7788,7 +7898,7 @@ var FloatingBarAction = React10__namespace.forwardRef(
7788
7898
  className: cn(actionVariants({ variant, size, className })),
7789
7899
  ...props,
7790
7900
  children: [
7791
- Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-3.5 w-3.5" }),
7901
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-4 w-4" }),
7792
7902
  /* @__PURE__ */ jsxRuntime.jsx("span", { children })
7793
7903
  ]
7794
7904
  }
@@ -7797,7 +7907,7 @@ var FloatingBarAction = React10__namespace.forwardRef(
7797
7907
  );
7798
7908
  FloatingBarAction.displayName = "FloatingBarAction";
7799
7909
  var iconActionVariants = classVarianceAuthority.cva(
7800
- "inline-flex items-center justify-center rounded-full transition-colors duration-150 disabled:opacity-50 disabled:pointer-events-none",
7910
+ "inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer disabled:opacity-50 disabled:pointer-events-none",
7801
7911
  {
7802
7912
  variants: {
7803
7913
  variant: {
@@ -7807,8 +7917,8 @@ var iconActionVariants = classVarianceAuthority.cva(
7807
7917
  danger: "text-muted-foreground hover:text-destructive hover:bg-destructive/10"
7808
7918
  },
7809
7919
  size: {
7810
- default: "h-8 w-8",
7811
- sm: "h-7 w-7"
7920
+ default: "h-9 w-9",
7921
+ sm: "h-8 w-8"
7812
7922
  }
7813
7923
  },
7814
7924
  defaultVariants: {
@@ -7839,7 +7949,7 @@ var FloatingBarDivider = React10__namespace.forwardRef(
7839
7949
  "div",
7840
7950
  {
7841
7951
  ref,
7842
- className: cn("w-px h-5 bg-border mx-0.5", className),
7952
+ className: cn("w-px h-6 bg-border/60 mx-0.5", className),
7843
7953
  ...props
7844
7954
  }
7845
7955
  );