eai-frontend-components 2.0.17 → 2.0.19

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.js CHANGED
@@ -37,6 +37,7 @@ var SliderPrimitive = require('@radix-ui/react-slider');
37
37
  var SwitchPrimitives = require('@radix-ui/react-switch');
38
38
  var TabsPrimitive = require('@radix-ui/react-tabs');
39
39
  var ToastPrimitives = require('@radix-ui/react-toast');
40
+ var reactColorful = require('react-colorful');
40
41
  var reactTable = require('@tanstack/react-table');
41
42
  var zod$1 = require('@hookform/resolvers/zod');
42
43
  var zod = require('zod');
@@ -381,22 +382,21 @@ const CarouselNext = React__namespace.forwardRef(({ className, variant = "outlin
381
382
  });
382
383
  CarouselNext.displayName = "CarouselNext";
383
384
 
384
- // Format: { THEME_NAME: CSS_SELECTOR }
385
- const THEMES = { light: "", dark: ".dark" };
385
+ const THEMES = { light: '', dark: '.dark' };
386
386
  const ChartContext = React__namespace.createContext(null);
387
387
  function useChart() {
388
388
  const context = React__namespace.useContext(ChartContext);
389
389
  if (!context) {
390
- throw new Error("useChart must be used within a <ChartContainer />");
390
+ throw new Error('useChart must be used within a <ChartContainer />');
391
391
  }
392
392
  return context;
393
393
  }
394
394
  const ChartContainer = React__namespace.forwardRef(({ id, className, children, config, ...props }, ref) => {
395
395
  const uniqueId = React__namespace.useId();
396
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
396
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
397
397
  return (jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: jsxRuntime.jsxs("div", { "data-chart": chartId, ref: ref, className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className), ...props, children: [jsxRuntime.jsx(ChartStyle, { id: chartId, config: config }), jsxRuntime.jsx(RechartsPrimitive__namespace.ResponsiveContainer, { children: children })] }) }));
398
398
  });
399
- ChartContainer.displayName = "Chart";
399
+ ChartContainer.displayName = 'Chart';
400
400
  const ChartStyle = ({ id, config }) => {
401
401
  const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
402
402
  if (!colorConfig.length) {
@@ -410,103 +410,83 @@ const ChartStyle = ({ id, config }) => {
410
410
  ${prefix} [data-chart=${id}] {
411
411
  ${colorConfig
412
412
  .map(([key, itemConfig]) => {
413
- const color = itemConfig.theme?.[theme] ||
414
- itemConfig.color;
413
+ const color = itemConfig.theme?.[theme] || itemConfig.color;
415
414
  return color ? ` --color-${key}: ${color};` : null;
416
415
  })
417
- .join("\n")}
416
+ .join('\n')}
418
417
  }
419
418
  `)
420
- .join("\n"),
419
+ .join('\n'),
421
420
  } }));
422
421
  };
423
422
  const ChartTooltip = RechartsPrimitive__namespace.Tooltip;
424
- const ChartTooltipContent = React__namespace.forwardRef(({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }, ref) => {
423
+ const ChartTooltipContent = React__namespace.forwardRef(({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }, ref) => {
425
424
  const { config } = useChart();
426
425
  const tooltipLabel = React__namespace.useMemo(() => {
427
426
  if (hideLabel || !payload?.length) {
428
427
  return null;
429
428
  }
430
429
  const [item] = payload;
431
- const key = `${labelKey || item.dataKey || item.name || "value"}`;
430
+ const key = `${labelKey || item.dataKey || item.name || 'value'}`;
432
431
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
433
- const value = !labelKey && typeof label === "string"
434
- ? config[label]?.label || label
435
- : itemConfig?.label;
432
+ const value = !labelKey && typeof label === 'string' ? config[label]?.label || label : itemConfig?.label;
436
433
  if (labelFormatter) {
437
- return (jsxRuntime.jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
434
+ return jsxRuntime.jsx("div", { className: cn('font-medium', labelClassName), children: labelFormatter(value, payload) });
438
435
  }
439
436
  if (!value) {
440
437
  return null;
441
438
  }
442
- return jsxRuntime.jsx("div", { className: cn("font-medium", labelClassName), children: value });
443
- }, [
444
- label,
445
- labelFormatter,
446
- payload,
447
- hideLabel,
448
- labelClassName,
449
- config,
450
- labelKey,
451
- ]);
439
+ return jsxRuntime.jsx("div", { className: cn('font-medium', labelClassName), children: value });
440
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
452
441
  if (!active || !payload?.length) {
453
442
  return null;
454
443
  }
455
- const nestLabel = payload.length === 1 && indicator !== "dot";
456
- return (jsxRuntime.jsxs("div", { ref: ref, className: cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className), children: [!nestLabel ? tooltipLabel : null, jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
457
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
444
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
445
+ return (jsxRuntime.jsxs("div", { ref: ref, className: cn('grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl', className), children: [!nestLabel ? tooltipLabel : null, jsxRuntime.jsx("div", { className: 'grid gap-1.5', children: payload.map((item, index) => {
446
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
458
447
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
459
448
  const indicatorColor = color || item.payload.fill || item.color;
460
- return (jsxRuntime.jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"), children: formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [itemConfig?.icon ? (jsxRuntime.jsx(itemConfig.icon, {})) : (!hideIndicator && (jsxRuntime.jsx("div", { className: cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
461
- "h-2.5 w-2.5": indicator === "dot",
462
- "w-1": indicator === "line",
463
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
464
- "my-0.5": nestLabel && indicator === "dashed",
449
+ return (jsxRuntime.jsx("div", { className: cn('flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground', indicator === 'dot' && 'items-center'), children: formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [itemConfig?.icon ? (jsxRuntime.jsx(itemConfig.icon, {})) : (!hideIndicator && (jsxRuntime.jsx("div", { className: cn('shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]', {
450
+ 'h-2.5 w-2.5': indicator === 'dot',
451
+ 'w-1': indicator === 'line',
452
+ 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',
453
+ 'my-0.5': nestLabel && indicator === 'dashed',
465
454
  }), style: {
466
- "--color-bg": indicatorColor,
467
- "--color-border": indicatorColor,
468
- } }))), jsxRuntime.jsxs("div", { className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"), children: [jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, jsxRuntime.jsx("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })] }), item.value && (jsxRuntime.jsx("span", { className: "font-mono font-medium tabular-nums text-foreground", children: item.value.toLocaleString() }))] })] })) }, item.dataKey));
455
+ '--color-bg': indicatorColor,
456
+ '--color-border': indicatorColor,
457
+ } }))), jsxRuntime.jsxs("div", { className: cn('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'), children: [jsxRuntime.jsxs("div", { className: 'grid gap-1.5', children: [nestLabel ? tooltipLabel : null, jsxRuntime.jsx("span", { className: 'text-muted-foreground', children: itemConfig?.label || item.name })] }), item.value && (jsxRuntime.jsx("span", { className: 'font-mono font-medium tabular-nums text-foreground', children: item.value.toLocaleString() }))] })] })) }, item.dataKey));
469
458
  }) })] }));
470
459
  });
471
- ChartTooltipContent.displayName = "ChartTooltip";
460
+ ChartTooltipContent.displayName = 'ChartTooltip';
472
461
  const ChartLegend = RechartsPrimitive__namespace.Legend;
473
- const ChartLegendContent = React__namespace.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
462
+ const ChartLegendContent = React__namespace.forwardRef(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {
474
463
  const { config } = useChart();
475
464
  if (!payload?.length) {
476
465
  return null;
477
466
  }
478
- return (jsxRuntime.jsx("div", { ref: ref, className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload.map((item) => {
479
- const key = `${nameKey || item.dataKey || "value"}`;
467
+ return (jsxRuntime.jsx("div", { ref: ref, className: cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className), children: payload.map((item) => {
468
+ const key = `${nameKey || item.dataKey || 'value'}`;
480
469
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
481
- return (jsxRuntime.jsxs("div", { className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (jsxRuntime.jsx(itemConfig.icon, {})) : (jsxRuntime.jsx("div", { className: "h-2 w-2 shrink-0 rounded-[2px]", style: {
470
+ return (jsxRuntime.jsxs("div", { className: cn('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground'), children: [itemConfig?.icon && !hideIcon ? (jsxRuntime.jsx(itemConfig.icon, {})) : (jsxRuntime.jsx("div", { className: 'h-2 w-2 shrink-0 rounded-[2px]', style: {
482
471
  backgroundColor: item.color,
483
472
  } })), itemConfig?.label] }, item.value));
484
473
  }) }));
485
474
  });
486
- ChartLegendContent.displayName = "ChartLegend";
475
+ ChartLegendContent.displayName = 'ChartLegend';
487
476
  // Helper to extract item config from a payload.
488
477
  function getPayloadConfigFromPayload(config, payload, key) {
489
- if (typeof payload !== "object" || payload === null) {
478
+ if (typeof payload !== 'object' || payload === null) {
490
479
  return undefined;
491
480
  }
492
- const payloadPayload = "payload" in payload &&
493
- typeof payload.payload === "object" &&
494
- payload.payload !== null
495
- ? payload.payload
496
- : undefined;
481
+ const payloadPayload = 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null ? payload.payload : undefined;
497
482
  let configLabelKey = key;
498
- if (key in payload &&
499
- typeof payload[key] === "string") {
483
+ if (key in payload && typeof payload[key] === 'string') {
500
484
  configLabelKey = payload[key];
501
485
  }
502
- else if (payloadPayload &&
503
- key in payloadPayload &&
504
- typeof payloadPayload[key] === "string") {
486
+ else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {
505
487
  configLabelKey = payloadPayload[key];
506
488
  }
507
- return configLabelKey in config
508
- ? config[configLabelKey]
509
- : config[key];
489
+ return configLabelKey in config ? config[configLabelKey] : config[key];
510
490
  }
511
491
 
512
492
  const Checkbox = React__namespace.forwardRef(({ className, value, ...props }, ref) => (jsxRuntime.jsx(CheckboxPrimitive__namespace.Root, { ref: ref, checked: !!value, className: cn('peer h-4 w-4 shrink-0 rounded-sm border ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-background-primary data-[state=checked]:text-primary-foreground', className), ...props, children: jsxRuntime.jsx(CheckboxPrimitive__namespace.Indicator, { className: cn('flex items-center justify-center text-current'), children: jsxRuntime.jsx(lucideReact.Check, { className: 'h-4 w-4' }) }) })));
@@ -2557,6 +2537,130 @@ const formMessage = (FormMessage) => {
2557
2537
  return jsxRuntime.jsx(FormMessage, { className: 'text-red-600 mt-1' });
2558
2538
  };
2559
2539
 
2540
+ const FormInputCheckbox = ({ control, name, label, helpText, className, disabled, onCheckedChange }) => {
2541
+ const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
2542
+ return (jsxRuntime.jsx(FormField, { control: control, name: name, render: ({ field }) => (jsxRuntime.jsxs(FormItem, { className: className, children: [jsxRuntime.jsxs("div", { className: 'flex items-center gap-2', children: [jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx(Checkbox, { value: field.value, className: `${field.value
2543
+ ? 'bg-purple-700 border border-purple-900 text-white rounded-[3px]'
2544
+ : 'bg-white border border-black text-black'}`, onCheckedChange: (checked) => {
2545
+ field?.onChange?.(checked);
2546
+ onCheckedChange?.(checked);
2547
+ }, disabled: disabled }) }), jsxRuntime.jsxs("div", { className: 'flex h-full items-center space-x-1.5', children: [label && formLabel(FormLabel, label), helpText && formHelpText(helpText)] })] }), formMessage(FormMessage)] })) }));
2548
+ };
2549
+
2550
+ const rgbToHex = ({ r, g, b }) => {
2551
+ const toHex = (n) => Math.max(0, Math.min(255, n)).toString(16).padStart(2, '0').toUpperCase();
2552
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
2553
+ };
2554
+ const hexToRgb = (hex) => {
2555
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
2556
+ return result
2557
+ ? {
2558
+ r: Number.parseInt(result[1], 16),
2559
+ g: Number.parseInt(result[2], 16),
2560
+ b: Number.parseInt(result[3], 16),
2561
+ }
2562
+ : null;
2563
+ };
2564
+
2565
+ const FormInputColor = ({ control, name, label, subLabel, helpText, placeholder, className, disabled, required }) => {
2566
+ const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
2567
+ const DEFAULT_COLOR = '#000000';
2568
+ const [currentColor, setCurrentColor] = React.useState(DEFAULT_COLOR);
2569
+ const rgb = hexToRgb(currentColor) || { r: 0, g: 0, b: 0 };
2570
+ const handleColorChange = (newColor, onChange) => {
2571
+ onChange?.(newColor);
2572
+ setCurrentColor(newColor);
2573
+ };
2574
+ const handleHexChange = (hex, onChange) => {
2575
+ if (/^#[0-9A-Fa-f]{6}$/.test(hex)) {
2576
+ handleColorChange(hex, onChange);
2577
+ }
2578
+ else {
2579
+ setCurrentColor(hex);
2580
+ }
2581
+ };
2582
+ const handleRgbChange = (key, value, onChange) => {
2583
+ const numValue = Number.parseInt(value);
2584
+ if (!Number.isNaN(numValue) && numValue >= 0 && numValue <= 255) {
2585
+ const newRgb = { ...rgb, [key]: numValue };
2586
+ handleColorChange(rgbToHex(newRgb), onChange);
2587
+ }
2588
+ };
2589
+ return (jsxRuntime.jsx(FormField, { control: control, name: name, render: ({ field, formState }) => (jsxRuntime.jsxs(FormItem, { className: className, children: [jsxRuntime.jsxs("div", { className: 'flex items-center space-x-1.5', children: [label && formLabelAndSubLabel(FormLabel, label, subLabel, required), helpText && formHelpText(helpText)] }), jsxRuntime.jsxs(Popover, { children: [jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx(Button, { variant: 'outline', className: cn('w-[240px] justify-start text-left font-normal', !field.value && 'text-zinc-500', className), disabled: disabled || formState.isSubmitting, children: jsxRuntime.jsxs("div", { className: 'w-full flex items-center gap-2', children: [field.value ? (jsxRuntime.jsx("div", { className: 'h-4 w-4 rounded !bg-center !bg-cover transition-all border', style: { backgroundColor: field.value } })) : (jsxRuntime.jsx(lucideReact.Paintbrush, { className: 'h-4 w-4' })), jsxRuntime.jsx("div", { className: 'truncate flex-1 text-sm', children: field.value ? field.value : placeholder || 'Selecione uma cor' })] }) }) }) }), jsxRuntime.jsx(PopoverContent, { className: cn('w-80', className), children: jsxRuntime.jsxs("div", { className: 'flex flex-col gap-4', children: [jsxRuntime.jsx("section", { className: '[&_.react-colorful]:w-auto', children: jsxRuntime.jsx(reactColorful.HexColorPicker, { color: field.value ?? DEFAULT_COLOR, onChange: (newColor) => handleColorChange(newColor, field.onChange) }) }), jsxRuntime.jsxs("div", { className: 'flex gap-2', children: [jsxRuntime.jsxs("div", { className: 'flex flex-col gap-1', children: [jsxRuntime.jsx(Label, { children: "Hex" }), jsxRuntime.jsx(Input, { value: currentColor, onChange: (e) => handleHexChange(e.target.value, field.onChange), maxLength: 7 })] }), jsxRuntime.jsxs("div", { className: 'flex gap-2', children: [jsxRuntime.jsxs("div", { className: 'flex flex-col gap-1', children: [jsxRuntime.jsx(Label, { children: "R" }), jsxRuntime.jsx(Input, { value: rgb.r, onChange: (e) => handleRgbChange('r', e.target.value, field.onChange), className: 'w-14' })] }), jsxRuntime.jsxs("div", { className: 'flex flex-col gap-1', children: [jsxRuntime.jsx(Label, { children: "G" }), jsxRuntime.jsx(Input, { value: rgb.g, onChange: (e) => handleRgbChange('g', e.target.value, field.onChange), className: 'w-14' })] }), jsxRuntime.jsxs("div", { className: 'flex flex-col gap-1', children: [jsxRuntime.jsx(Label, { children: "B" }), jsxRuntime.jsx(Input, { value: rgb.b, onChange: (e) => handleRgbChange('b', e.target.value, field.onChange), className: 'w-14' })] })] })] })] }) })] }), formMessage(FormMessage)] })) }));
2590
+ };
2591
+
2592
+ const FormCombobox = ({ control, name, label, subLabel, helpText, placeholder, className, disabled, required, options, selectedOption, iconLeft, iconRight, addEmptyOption, canUnselect = false, closePopUpOnChange = true, runInternalSearch = true, disabledSearch = false, onChange, onSearch, footerAction, }) => {
2593
+ const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
2594
+ const [open, setOpen] = React.useState(false);
2595
+ const [loading, setLoading] = React.useState(false);
2596
+ const [searchString, setSearchString] = React.useState('');
2597
+ const DEFAULT_PLACEHOLDER = 'Digite para buscar...';
2598
+ React.useEffect(() => {
2599
+ setLoading(false);
2600
+ }, [options]);
2601
+ const getOptions = () => {
2602
+ if (options.length === 0) {
2603
+ return [];
2604
+ }
2605
+ let filteredOptions = options;
2606
+ if (runInternalSearch) {
2607
+ filteredOptions = options.filter((option) => {
2608
+ const title = option.title
2609
+ .toLowerCase()
2610
+ .normalize('NFD')
2611
+ .replace(/[^a-z0-9\s]/gi, '');
2612
+ const subTitle = option.subTitle
2613
+ ?.toLowerCase()
2614
+ .normalize('NFD')
2615
+ .replace(/[^a-z0-9\s]/gi, '');
2616
+ const search = searchString
2617
+ .toLowerCase()
2618
+ .normalize('NFD')
2619
+ .replace(/[^a-z0-9\s]/gi, '');
2620
+ return title.includes(search) || subTitle?.includes(search);
2621
+ });
2622
+ }
2623
+ if (addEmptyOption) {
2624
+ filteredOptions.unshift({ value: undefined, title: '--Selecione--', subTitle: '' });
2625
+ }
2626
+ return filteredOptions;
2627
+ };
2628
+ const getSelectedOption = (value) => {
2629
+ const option = options.find((option) => option.value === value);
2630
+ if (option) {
2631
+ return option;
2632
+ }
2633
+ return selectedOption;
2634
+ };
2635
+ const handleSelect = (value, field) => {
2636
+ const option = value ? getSelectedOption(value) : undefined;
2637
+ if (canUnselect) {
2638
+ field.onChange(field.value === value ? undefined : value);
2639
+ }
2640
+ else {
2641
+ field.onChange(value);
2642
+ }
2643
+ if (onChange) {
2644
+ onChange(option);
2645
+ }
2646
+ if (closePopUpOnChange) {
2647
+ setOpen(false);
2648
+ }
2649
+ };
2650
+ const handleKeyUp = (event) => {
2651
+ const searchString = event.target.value;
2652
+ if (onSearch) {
2653
+ setLoading(true);
2654
+ onSearch(searchString);
2655
+ }
2656
+ setSearchString(searchString);
2657
+ };
2658
+ return (jsxRuntime.jsx(FormField, { control: control, name: name, render: ({ field, formState }) => (jsxRuntime.jsxs(FormItem, { className: className, children: [jsxRuntime.jsxs("div", { className: 'flex items-center space-x-1.5', children: [label && formLabelAndSubLabel(FormLabel, label, subLabel, required), helpText && formHelpText(helpText)] }), jsxRuntime.jsxs(Popover, { open: open, onOpenChange: (open) => {
2659
+ if (!disabled)
2660
+ setOpen(open);
2661
+ }, children: [jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx("div", { className: cn(`rounded-sm outline-none ${open ? 'ring-2 ring-ring ring-offset-2' : 'ring-0'}`, className), children: jsxRuntime.jsxs(Button, { type: 'button', variant: 'outline', role: 'combobox', "aria-expanded": open, className: cn('justify-between disabled:border-disabled disabled:cursor-not-allowed disabled:opacity-50', formState.errors[name] ? 'border-red-600' : '', className), disabled: disabled || formState.isSubmitting, children: [iconLeft, jsxRuntime.jsx("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: jsxRuntime.jsx("span", { className: 'truncate font-normal', children: getSelectedOption(field.value) ? (jsxRuntime.jsxs("div", { className: 'flex gap-2', children: [getSelectedOption(field.value)?.icon, getSelectedOption(field.value)?.title] })) : (jsxRuntime.jsx("span", { className: 'text-zinc-500', children: placeholder ?? DEFAULT_PLACEHOLDER })) }) }), iconRight ?? jsxRuntime.jsx(lucideReact.ChevronsUpDown, { size: 20, className: 'stroke-zinc-500' })] }) }) }) }), jsxRuntime.jsxs(PopoverContent, { className: cn('p-0', className, 'w-[--radix-popover-trigger-width]'), children: [jsxRuntime.jsxs(Command, { shouldFilter: false, children: [!disabledSearch && jsxRuntime.jsx(CommandInput, { placeholder: placeholder ?? DEFAULT_PLACEHOLDER, onKeyUp: handleKeyUp }), jsxRuntime.jsxs(CommandList, { children: [jsxRuntime.jsx(CommandEmpty, { className: 'flex flex-col justify-between items-center p-3 font-normal text-sm', children: loading ? (jsxRuntime.jsx(lucideReact.LoaderCircle, { size: 16, className: 'text-muted-foreground animate-spin mr-2' })) : getOptions()?.length === 0 && (searchString !== '' || disabledSearch) ? ('Nenhum resultado encontrado') : ('Utilize o campo de busca acima') }), options.length > 0 && (jsxRuntime.jsx(CommandGroup, { children: getOptions().map((option) => (jsxRuntime.jsxs(CommandItem, { value: option.value, className: 'group', onSelect: () => handleSelect(option.value, field), children: [jsxRuntime.jsxs("div", { className: cn('grid flex-1 text-left text-sm leading-tight', option.className), children: [jsxRuntime.jsxs("div", { className: 'flex gap-2', children: [option.icon, jsxRuntime.jsx("span", { className: 'truncate font-normal', children: option.title })] }), jsxRuntime.jsx("span", { className: 'truncate text-xs text-zinc-500', children: option.subTitle })] }), jsxRuntime.jsxs("div", { className: `ml-auto text-zinc-500 ${field.value === option.value ? 'opacity-100' : 'opacity-0'}`, children: [jsxRuntime.jsx(lucideReact.Check, { className: cn('flex', canUnselect && 'group-hover:hidden hover:hidden'), size: 16 }), jsxRuntime.jsx(lucideReact.X, { className: cn('hidden', canUnselect && 'group-hover:flex hover:flex'), size: 16 })] })] }, `key-opt-${option.value}`))) }))] })] }), footerAction && (jsxRuntime.jsx("div", { className: 'grid w-full p-1 border-t', children: jsxRuntime.jsxs(Button, { type: 'button', variant: 'ghost', className: 'h-8', onClick: () => footerAction.onClick(), children: [footerAction.icon, footerAction.label] }) }))] })] }), formMessage(FormMessage)] })) }));
2662
+ };
2663
+
2560
2664
  const masks$1 = ['999.999.999-999', '99.999.999/9999-99'];
2561
2665
  const FormInputCpfCnpj = ({ control, name, label, subLabel, helpText, placeholder, className, disabled, required, onChange, onKeyUp, }) => {
2562
2666
  const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
@@ -3399,11 +3503,14 @@ exports.DropdownMenuSubContent = DropdownMenuSubContent;
3399
3503
  exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
3400
3504
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
3401
3505
  exports.Form = Form;
3506
+ exports.FormCombobox = FormCombobox;
3402
3507
  exports.FormControl = FormControl;
3403
3508
  exports.FormDataRange = FormDataRange;
3404
3509
  exports.FormDescription = FormDescription;
3405
3510
  exports.FormField = FormField;
3406
3511
  exports.FormInput = FormInput;
3512
+ exports.FormInputCheckbox = FormInputCheckbox;
3513
+ exports.FormInputColor = FormInputColor;
3407
3514
  exports.FormInputCpfCnpj = FormInputCpfCnpj;
3408
3515
  exports.FormInputCurrency = FormInputCurrency;
3409
3516
  exports.FormInputDate = FormInputDate;