@iclips/ui 2.0.2 → 3.0.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.
Files changed (122) hide show
  1. package/MIGRATION-v3.md +244 -0
  2. package/README.md +1 -1
  3. package/dist/alert-theme.css +20 -79
  4. package/dist/components/ui/charts/donut-chart.cjs +1 -1
  5. package/dist/components/ui/charts/donut-chart.cjs.map +1 -1
  6. package/dist/components/ui/charts/donut-chart.js +39 -60
  7. package/dist/components/ui/charts/donut-chart.js.map +1 -1
  8. package/dist/components/ui/charts/kpi-card.cjs +1 -1
  9. package/dist/components/ui/charts/kpi-card.cjs.map +1 -1
  10. package/dist/components/ui/charts/kpi-card.js +19 -19
  11. package/dist/components/ui/charts/kpi-card.js.map +1 -1
  12. package/dist/components/ui/data/comment-system.cjs +1 -1
  13. package/dist/components/ui/data/comment-system.cjs.map +1 -1
  14. package/dist/components/ui/data/comment-system.js +67 -67
  15. package/dist/components/ui/data/comment-system.js.map +1 -1
  16. package/dist/components/ui/data/data-table.cjs +1 -1
  17. package/dist/components/ui/data/data-table.cjs.map +1 -1
  18. package/dist/components/ui/data/data-table.js +112 -101
  19. package/dist/components/ui/data/data-table.js.map +1 -1
  20. package/dist/components/ui/data/editorial-calendar.cjs +1 -1
  21. package/dist/components/ui/data/editorial-calendar.cjs.map +1 -1
  22. package/dist/components/ui/data/editorial-calendar.js +291 -291
  23. package/dist/components/ui/data/editorial-calendar.js.map +1 -1
  24. package/dist/components/ui/data/filter-builder.cjs +1 -1
  25. package/dist/components/ui/data/filter-builder.cjs.map +1 -1
  26. package/dist/components/ui/data/filter-builder.js +1 -1
  27. package/dist/components/ui/data/filter-builder.js.map +1 -1
  28. package/dist/components/ui/feedback/empty-state.cjs +1 -1
  29. package/dist/components/ui/feedback/empty-state.cjs.map +1 -1
  30. package/dist/components/ui/feedback/empty-state.js +14 -14
  31. package/dist/components/ui/feedback/empty-state.js.map +1 -1
  32. package/dist/components/ui/feedback/toast.cjs +1 -1
  33. package/dist/components/ui/feedback/toast.cjs.map +1 -1
  34. package/dist/components/ui/feedback/toast.js +53 -22
  35. package/dist/components/ui/feedback/toast.js.map +1 -1
  36. package/dist/components/ui/forms/calendar.cjs +1 -1
  37. package/dist/components/ui/forms/calendar.cjs.map +1 -1
  38. package/dist/components/ui/forms/calendar.js +16 -16
  39. package/dist/components/ui/forms/calendar.js.map +1 -1
  40. package/dist/components/ui/forms/combobox.cjs +1 -1
  41. package/dist/components/ui/forms/combobox.cjs.map +1 -1
  42. package/dist/components/ui/forms/combobox.js +78 -76
  43. package/dist/components/ui/forms/combobox.js.map +1 -1
  44. package/dist/components/ui/forms/file-attachment-list.cjs +1 -1
  45. package/dist/components/ui/forms/file-attachment-list.cjs.map +1 -1
  46. package/dist/components/ui/forms/file-attachment-list.js +4 -4
  47. package/dist/components/ui/forms/file-attachment-list.js.map +1 -1
  48. package/dist/components/ui/forms/file-upload-zone.cjs +2 -2
  49. package/dist/components/ui/forms/file-upload-zone.cjs.map +1 -1
  50. package/dist/components/ui/forms/file-upload-zone.js +55 -49
  51. package/dist/components/ui/forms/file-upload-zone.js.map +1 -1
  52. package/dist/components/ui/forms/form.cjs +1 -1
  53. package/dist/components/ui/forms/form.cjs.map +1 -1
  54. package/dist/components/ui/forms/form.js +11 -11
  55. package/dist/components/ui/forms/form.js.map +1 -1
  56. package/dist/components/ui/forms/input-validation.cjs +1 -1
  57. package/dist/components/ui/forms/input-validation.cjs.map +1 -1
  58. package/dist/components/ui/forms/input-validation.js +20 -20
  59. package/dist/components/ui/forms/input-validation.js.map +1 -1
  60. package/dist/components/ui/forms/multi-select.cjs +1 -1
  61. package/dist/components/ui/forms/multi-select.cjs.map +1 -1
  62. package/dist/components/ui/forms/multi-select.js +69 -67
  63. package/dist/components/ui/forms/multi-select.js.map +1 -1
  64. package/dist/components/ui/forms/radio-group.cjs +1 -1
  65. package/dist/components/ui/forms/radio-group.cjs.map +1 -1
  66. package/dist/components/ui/forms/radio-group.js +19 -19
  67. package/dist/components/ui/forms/radio-group.js.map +1 -1
  68. package/dist/components/ui/forms/social-button.cjs +1 -1
  69. package/dist/components/ui/forms/social-button.cjs.map +1 -1
  70. package/dist/components/ui/forms/social-button.js +6 -6
  71. package/dist/components/ui/forms/social-button.js.map +1 -1
  72. package/dist/components/ui/forms/toggle.cjs +1 -1
  73. package/dist/components/ui/forms/toggle.cjs.map +1 -1
  74. package/dist/components/ui/forms/toggle.js +7 -7
  75. package/dist/components/ui/forms/toggle.js.map +1 -1
  76. package/dist/components/ui/navigation/navigation-menu.cjs +1 -1
  77. package/dist/components/ui/navigation/navigation-menu.cjs.map +1 -1
  78. package/dist/components/ui/navigation/navigation-menu.js +14 -14
  79. package/dist/components/ui/navigation/navigation-menu.js.map +1 -1
  80. package/dist/components/ui/navigation/sidebar.cjs +1 -1
  81. package/dist/components/ui/navigation/sidebar.cjs.map +1 -1
  82. package/dist/components/ui/navigation/sidebar.js +44 -44
  83. package/dist/components/ui/navigation/sidebar.js.map +1 -1
  84. package/dist/components/ui/overlays/context-menu.cjs +1 -1
  85. package/dist/components/ui/overlays/context-menu.cjs.map +1 -1
  86. package/dist/components/ui/overlays/context-menu.js +1 -1
  87. package/dist/components/ui/overlays/context-menu.js.map +1 -1
  88. package/dist/components/ui/overlays/dropdown-menu.cjs +1 -1
  89. package/dist/components/ui/overlays/dropdown-menu.cjs.map +1 -1
  90. package/dist/components/ui/overlays/dropdown-menu.js +5 -5
  91. package/dist/components/ui/overlays/dropdown-menu.js.map +1 -1
  92. package/dist/components/ui/overlays/menubar.cjs +1 -1
  93. package/dist/components/ui/overlays/menubar.cjs.map +1 -1
  94. package/dist/components/ui/overlays/menubar.js +29 -29
  95. package/dist/components/ui/overlays/menubar.js.map +1 -1
  96. package/dist/components/ui/overlays/tooltip.cjs +1 -1
  97. package/dist/components/ui/overlays/tooltip.cjs.map +1 -1
  98. package/dist/components/ui/overlays/tooltip.js +12 -12
  99. package/dist/components/ui/overlays/tooltip.js.map +1 -1
  100. package/dist/components/ui/primitives/avatar.cjs +1 -1
  101. package/dist/components/ui/primitives/avatar.cjs.map +1 -1
  102. package/dist/components/ui/primitives/avatar.js +20 -27
  103. package/dist/components/ui/primitives/avatar.js.map +1 -1
  104. package/dist/components/ui/primitives/badge.cjs +1 -1
  105. package/dist/components/ui/primitives/badge.cjs.map +1 -1
  106. package/dist/components/ui/primitives/badge.js +13 -13
  107. package/dist/components/ui/primitives/badge.js.map +1 -1
  108. package/dist/components/ui/primitives/button.cjs +1 -1
  109. package/dist/components/ui/primitives/button.cjs.map +1 -1
  110. package/dist/components/ui/primitives/button.js +11 -8
  111. package/dist/components/ui/primitives/button.js.map +1 -1
  112. package/dist/index.cjs +1 -1
  113. package/dist/index.css +1 -1
  114. package/dist/index.d.cts +3 -3
  115. package/dist/index.d.ts +3 -3
  116. package/dist/index.js +34 -35
  117. package/dist/index.js.map +1 -1
  118. package/dist/preset.css +1 -2
  119. package/dist/toast-theme.css +100 -64
  120. package/dist/tokens.css +59 -159
  121. package/package.json +5 -3
  122. package/scripts/check-colors.mjs +208 -0
@@ -1,21 +1,21 @@
1
1
  "use client";
2
- import { jsx as t } from "react/jsx-runtime";
2
+ import { jsx as r } from "react/jsx-runtime";
3
3
  import { DayPicker as m } from "react-day-picker";
4
4
  import { ptBR as l } from "date-fns/locale";
5
5
  import { ChevronLeft as u, ChevronRight as f } from "lucide-react";
6
6
  import { cn as e } from "../utils.js";
7
- import { buttonVariants as r } from "../primitives/button.js";
7
+ import { buttonVariants as t } from "../primitives/button.js";
8
8
  function g({
9
9
  className: a,
10
- classNames: n,
11
- showOutsideDays: d = !0,
10
+ classNames: d,
11
+ showOutsideDays: n = !0,
12
12
  locale: i = l,
13
- ...c
13
+ ...s
14
14
  }) {
15
- return /* @__PURE__ */ t(
15
+ return /* @__PURE__ */ r(
16
16
  m,
17
17
  {
18
- showOutsideDays: d,
18
+ showOutsideDays: n,
19
19
  locale: i,
20
20
  className: e("p-3 relative", a),
21
21
  classNames: {
@@ -25,36 +25,36 @@ function g({
25
25
  caption_label: "text-sm font-medium",
26
26
  nav: "absolute top-3 inset-x-3 flex items-center justify-between z-10",
27
27
  button_previous: e(
28
- r({ variant: "outline" }),
28
+ t({ variant: "outline" }),
29
29
  "size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border"
30
30
  ),
31
31
  button_next: e(
32
- r({ variant: "outline" }),
32
+ t({ variant: "outline" }),
33
33
  "size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border"
34
34
  ),
35
35
  month_grid: "w-full border-collapse space-y-1",
36
36
  weekdays: "flex",
37
37
  weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
38
38
  week: "flex w-full mt-2",
39
- day: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20 rounded-md",
39
+ day: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].outside)]:bg-secondary/50 [&:has([aria-selected])]:bg-secondary first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20 rounded-md",
40
40
  day_button: e(
41
- r({ variant: "ghost" }),
41
+ t({ variant: "ghost" }),
42
42
  "h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md"
43
43
  ),
44
44
  range_end: "range-end",
45
45
  range_start: "range-start",
46
46
  selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",
47
47
  today: "bg-accent text-accent-foreground rounded-md",
48
- outside: "outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
48
+ outside: "outside text-muted-foreground aria-selected:bg-secondary/50 aria-selected:text-muted-foreground",
49
49
  disabled: "text-muted-foreground opacity-50",
50
- range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
50
+ range_middle: "aria-selected:bg-secondary aria-selected:text-secondary-foreground",
51
51
  hidden: "invisible",
52
- ...n
52
+ ...d
53
53
  },
54
54
  components: {
55
- Chevron: ({ orientation: s, ...o }) => s === "left" ? /* @__PURE__ */ t(u, { className: "h-4 w-4", ...o }) : /* @__PURE__ */ t(f, { className: "h-4 w-4", ...o })
55
+ Chevron: ({ orientation: c, ...o }) => c === "left" ? /* @__PURE__ */ r(u, { className: "h-4 w-4", ...o }) : /* @__PURE__ */ r(f, { className: "h-4 w-4", ...o })
56
56
  },
57
- ...c
57
+ ...s
58
58
  }
59
59
  );
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sources":["../../../../src/components/ui/forms/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\nimport { ptBR } from \"date-fns/locale\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../utils\";\nimport { buttonVariants } from \"../primitives/button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\n/**\n * Calendar - Componente base de calendário\n *\n * Grid de dias para seleção de datas. Usado internamente pelo DatePicker\n * e DateRangePicker, mas também pode ser usado standalone.\n *\n * @example\n * // Seleção única\n * <Calendar\n * mode=\"single\"\n * selected={date}\n * onSelect={setDate}\n * />\n *\n * @example\n * // Seleção de intervalo\n * <Calendar\n * mode=\"range\"\n * selected={dateRange}\n * onSelect={setDateRange}\n * />\n */\n// react-day-picker's DayPicker is a plain function with no ref support -- cannot be forwardRef'd.\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n locale = ptBR,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n locale={locale}\n className={cn(\"p-3 relative\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row gap-4\",\n month: \"flex flex-col gap-4\",\n month_caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"absolute top-3 inset-x-3 flex items-center justify-between z-10\",\n button_previous: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border\"\n ),\n button_next: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border\"\n ),\n month_grid: \"w-full border-collapse space-y-1\",\n weekdays: \"flex\",\n weekday: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n week: \"flex w-full mt-2\",\n day: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20 rounded-md\",\n day_button: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md\"\n ),\n range_end: \"range-end\",\n range_start: \"range-start\",\n selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md\",\n today: \"bg-accent text-accent-foreground rounded-md\",\n outside:\n \"outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground\",\n disabled: \"text-muted-foreground opacity-50\",\n range_middle:\n \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n hidden: \"invisible\",\n ...classNames,\n }}\n components={{\n Chevron: ({ orientation, ...rest }) =>\n orientation === \"left\" ? (\n <ChevronLeft className=\"h-4 w-4\" {...rest} />\n ) : (\n <ChevronRight className=\"h-4 w-4\" {...rest} />\n ),\n }}\n {...props}\n />\n );\n}\n\nCalendar.displayName = \"Calendar\";\n\nexport { Calendar };\n"],"names":["Calendar","className","classNames","showOutsideDays","locale","ptBR","props","jsx","DayPicker","cn","buttonVariants","orientation","rest","ChevronLeft","ChevronRight"],"mappings":";;;;;;;AAmCA,SAASA,EAAS;AAAA,EAChB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,QAAAC,IAASC;AAAA,EACT,GAAGC;AACL,GAAkB;AAChB,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,iBAAAL;AAAA,MACA,QAAAC;AAAA,MACA,WAAWK,EAAG,gBAAgBR,CAAS;AAAA,MACvC,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAe;AAAA,QACf,eAAe;AAAA,QACf,KAAK;AAAA,QACL,iBAAiBQ;AAAA,UACfC,EAAe,EAAE,SAAS,WAAW;AAAA,UACrC;AAAA,QAAA;AAAA,QAEF,aAAaD;AAAA,UACXC,EAAe,EAAE,SAAS,WAAW;AAAA,UACrC;AAAA,QAAA;AAAA,QAEF,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,KAAK;AAAA,QACL,YAAYD;AAAA,UACVC,EAAe,EAAE,SAAS,SAAS;AAAA,UACnC;AAAA,QAAA;AAAA,QAEF,WAAW;AAAA,QACX,aAAa;AAAA,QACb,UACE;AAAA,QACF,OAAO;AAAA,QACP,SACE;AAAA,QACF,UAAU;AAAA,QACV,cACE;AAAA,QACF,QAAQ;AAAA,QACR,GAAGR;AAAA,MAAA;AAAA,MAEL,YAAY;AAAA,QACV,SAAS,CAAC,EAAE,aAAAS,GAAa,GAAGC,EAAA,MAC1BD,MAAgB,SACd,gBAAAJ,EAACM,KAAY,WAAU,WAAW,GAAGD,EAAA,CAAM,sBAE1CE,GAAA,EAAa,WAAU,WAAW,GAAGF,EAAA,CAAM;AAAA,MAAA;AAAA,MAGjD,GAAGN;AAAA,IAAA;AAAA,EAAA;AAGV;AAEAN,EAAS,cAAc;"}
1
+ {"version":3,"file":"calendar.js","sources":["../../../../src/components/ui/forms/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\nimport { ptBR } from \"date-fns/locale\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../utils\";\nimport { buttonVariants } from \"../primitives/button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\n/**\n * Calendar - Componente base de calendário\n *\n * Grid de dias para seleção de datas. Usado internamente pelo DatePicker\n * e DateRangePicker, mas também pode ser usado standalone.\n *\n * @example\n * // Seleção única\n * <Calendar\n * mode=\"single\"\n * selected={date}\n * onSelect={setDate}\n * />\n *\n * @example\n * // Seleção de intervalo\n * <Calendar\n * mode=\"range\"\n * selected={dateRange}\n * onSelect={setDateRange}\n * />\n */\n// react-day-picker's DayPicker is a plain function with no ref support -- cannot be forwardRef'd.\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n locale = ptBR,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n locale={locale}\n className={cn(\"p-3 relative\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row gap-4\",\n month: \"flex flex-col gap-4\",\n month_caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"absolute top-3 inset-x-3 flex items-center justify-between z-10\",\n button_previous: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border\"\n ),\n button_next: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-background p-1.5 hover:bg-accent hover:text-accent-foreground rounded-md border-border\"\n ),\n month_grid: \"w-full border-collapse space-y-1\",\n weekdays: \"flex\",\n weekday: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n week: \"flex w-full mt-2\",\n day: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].outside)]:bg-secondary/50 [&:has([aria-selected])]:bg-secondary first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20 rounded-md\",\n day_button: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md\"\n ),\n range_end: \"range-end\",\n range_start: \"range-start\",\n selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md\",\n today: \"bg-accent text-accent-foreground rounded-md\",\n outside:\n \"outside text-muted-foreground aria-selected:bg-secondary/50 aria-selected:text-muted-foreground\",\n disabled: \"text-muted-foreground opacity-50\",\n range_middle:\n \"aria-selected:bg-secondary aria-selected:text-secondary-foreground\",\n hidden: \"invisible\",\n ...classNames,\n }}\n components={{\n Chevron: ({ orientation, ...rest }) =>\n orientation === \"left\" ? (\n <ChevronLeft className=\"h-4 w-4\" {...rest} />\n ) : (\n <ChevronRight className=\"h-4 w-4\" {...rest} />\n ),\n }}\n {...props}\n />\n );\n}\n\nCalendar.displayName = \"Calendar\";\n\nexport { Calendar };\n"],"names":["Calendar","className","classNames","showOutsideDays","locale","ptBR","props","jsx","DayPicker","cn","buttonVariants","orientation","rest","ChevronLeft","ChevronRight"],"mappings":";;;;;;;AAmCA,SAASA,EAAS;AAAA,EAChB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,QAAAC,IAASC;AAAA,EACT,GAAGC;AACL,GAAkB;AAChB,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,iBAAAL;AAAA,MACA,QAAAC;AAAA,MACA,WAAWK,EAAG,gBAAgBR,CAAS;AAAA,MACvC,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAe;AAAA,QACf,eAAe;AAAA,QACf,KAAK;AAAA,QACL,iBAAiBQ;AAAA,UACfC,EAAe,EAAE,SAAS,WAAW;AAAA,UACrC;AAAA,QAAA;AAAA,QAEF,aAAaD;AAAA,UACXC,EAAe,EAAE,SAAS,WAAW;AAAA,UACrC;AAAA,QAAA;AAAA,QAEF,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,SAAS;AAAA,QACT,MAAM;AAAA,QACN,KAAK;AAAA,QACL,YAAYD;AAAA,UACVC,EAAe,EAAE,SAAS,SAAS;AAAA,UACnC;AAAA,QAAA;AAAA,QAEF,WAAW;AAAA,QACX,aAAa;AAAA,QACb,UACE;AAAA,QACF,OAAO;AAAA,QACP,SACE;AAAA,QACF,UAAU;AAAA,QACV,cACE;AAAA,QACF,QAAQ;AAAA,QACR,GAAGR;AAAA,MAAA;AAAA,MAEL,YAAY;AAAA,QACV,SAAS,CAAC,EAAE,aAAAS,GAAa,GAAGC,EAAA,MAC1BD,MAAgB,SACd,gBAAAJ,EAACM,KAAY,WAAU,WAAW,GAAGD,EAAA,CAAM,sBAE1CE,GAAA,EAAa,WAAU,WAAW,GAAGF,EAAA,CAAM;AAAA,MAAA;AAAA,MAGjD,GAAGN;AAAA,IAAA;AAAA,EAAA;AAGV;AAEAN,EAAS,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),A=require("react"),b=require("lucide-react"),i=require("../utils.cjs"),g=require("../primitives/button.cjs"),h=require("../overlays/popover.cjs"),E=require("./input.cjs");function H(s){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(c,r,a.get?a:{enumerable:!0,get:()=>s[r]})}}return c.default=s,Object.freeze(c)}const d=H(A),O=d.forwardRef(({value:s,onValueChange:c,options:r,groups:a,placeholder:R="Selecionar...",searchPlaceholder:S="Buscar...",emptyMessage:L="Nenhum resultado encontrado",disabled:M=!1,loading:x=!1,className:P,popoverWidth:q,maxHeight:T="300px",align:F="start",clearable:B=!1,filterFn:D,"aria-label":_,"aria-labelledby":W},v)=>{var C;const[p,w]=d.useState(!1),[o,j]=d.useState(""),y=d.useRef(null),z=d.useMemo(()=>i.mergeRefs(y,v),[v]),m=D||((e,l)=>{const n=l.toLowerCase();return e.label.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)}),N=d.useMemo(()=>r?o?r.filter(e=>m(e,o)):r:[],[r,o,m]),u=d.useMemo(()=>{if(!a)return;if(!o)return a;const e=o.toLowerCase();return a.map(l=>l.label.toLowerCase().includes(e)?l:{...l,options:l.options.filter(n=>m(n,o))}).filter(l=>l.options.length>0||l.label.toLowerCase().includes(e))},[a,o,m]),k=d.useMemo(()=>a?a.flatMap(e=>[...e.value?[{value:e.value,label:e.label}]:[],...e.options]):r??[],[r,a]).find(e=>e.value===s),I=a?((u==null?void 0:u.length)??0)>0:N.length>0,U=e=>{w(e),e||j("")},f=e=>{s===e&&B?c==null||c(""):c==null||c(e),w(!1)};return t.jsxs(h.Popover,{open:p,onOpenChange:U,children:[t.jsx(h.PopoverTrigger,{asChild:!0,children:t.jsxs(g.Button,{ref:z,variant:"outline",role:"combobox","aria-expanded":p,"aria-label":_,"aria-labelledby":W,className:i.cn("w-full justify-between font-normal",!s&&"text-muted-foreground",P),disabled:M||x,children:[t.jsx("span",{className:"truncate",children:x?"Carregando...":k?k.label:R}),t.jsx(b.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(h.PopoverContent,{className:"overflow-hidden p-0",style:{width:q||((C=y.current)==null?void 0:C.offsetWidth)||"auto"},align:F,children:t.jsxs("div",{className:"flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(b.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t.jsx(E.Input,{placeholder:S,value:o,onChange:e=>j(e.target.value),className:"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})]}),t.jsx("div",{className:"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50",style:{maxHeight:T},onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),children:t.jsx("div",{className:"p-1",children:I?a?u==null?void 0:u.map((e,l)=>t.jsxs("div",{className:i.cn(l>0&&"mt-1.5 border-t border-border pt-1.5"),children:[e.value?t.jsxs("button",{type:"button",onClick:()=>f(e.value),className:i.cn("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm","font-semibold uppercase tracking-wide","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground",s===e.value&&"bg-accent"),children:[t.jsx("span",{className:"truncate",children:e.label}),t.jsx(b.Check,{className:i.cn("h-4 w-4 shrink-0",s===e.value?"opacity-100":"opacity-0")})]}):t.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e.label}),e.options.map(n=>t.jsxs("button",{type:"button",onClick:()=>f(n.value),disabled:n.disabled,className:i.cn("flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50",s===n.value&&"bg-accent"),children:[t.jsx("span",{className:"truncate",children:n.label}),t.jsx(b.Check,{className:i.cn("h-4 w-4 shrink-0",s===n.value?"opacity-100":"opacity-0")})]},n.value))]},e.value??e.label)):N.map(e=>t.jsxs(g.Button,{variant:"ghost",className:i.cn("w-full justify-start font-normal",s===e.value&&"bg-accent"),onClick:()=>f(e.value),disabled:e.disabled,children:[t.jsx(b.Check,{className:i.cn("mr-2 h-4 w-4",s===e.value?"opacity-100":"opacity-0")}),t.jsx("span",{className:"truncate",children:e.label})]},e.value)):t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:L})})})]})})]})});O.displayName="Combobox";exports.Combobox=O;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),A=require("react"),b=require("lucide-react"),c=require("../utils.cjs"),C=require("../primitives/button.cjs"),h=require("../overlays/popover.cjs"),E=require("./input.cjs");function H(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(o,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}return o.default=r,Object.freeze(o)}const d=H(A),O=d.forwardRef(({value:r,onValueChange:o,options:a,groups:s,placeholder:R="Selecionar...",searchPlaceholder:S="Buscar...",emptyMessage:L="Nenhum resultado encontrado",disabled:M=!1,loading:v=!1,className:P,popoverWidth:q,maxHeight:T="300px",align:F="start",clearable:B=!1,filterFn:D,"aria-label":_,"aria-labelledby":W},x)=>{var k;const[y,p]=d.useState(!1),[i,w]=d.useState(""),j=d.useRef(null),z=d.useMemo(()=>c.mergeRefs(j,x),[x]),f=D||((e,n)=>{const l=n.toLowerCase();return e.label.toLowerCase().includes(l)||e.value.toLowerCase().includes(l)}),g=d.useMemo(()=>a?i?a.filter(e=>f(e,i)):a:[],[a,i,f]),u=d.useMemo(()=>{if(!s)return;if(!i)return s;const e=i.toLowerCase();return s.map(n=>n.label.toLowerCase().includes(e)?n:{...n,options:n.options.filter(l=>f(l,i))}).filter(n=>n.options.length>0||n.label.toLowerCase().includes(e))},[s,i,f]),N=d.useMemo(()=>s?s.flatMap(e=>[...e.value?[{value:e.value,label:e.label}]:[],...e.options]):a??[],[a,s]).find(e=>e.value===r),I=s?((u==null?void 0:u.length)??0)>0:g.length>0,U=e=>{p(e),e||w("")},m=e=>{r===e&&B?o==null||o(""):o==null||o(e),p(!1)};return t.jsxs(h.Popover,{open:y,onOpenChange:U,children:[t.jsx(h.PopoverTrigger,{asChild:!0,children:t.jsxs(C.Button,{ref:z,variant:"outline",role:"combobox","aria-expanded":y,"aria-label":_,"aria-labelledby":W,className:c.cn("w-full justify-between font-normal",!r&&"text-muted-foreground",P),disabled:M||v,children:[t.jsx("span",{className:"truncate",children:v?"Carregando...":N?N.label:R}),t.jsx(b.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(h.PopoverContent,{className:"overflow-hidden p-0",style:{width:q||((k=j.current)==null?void 0:k.offsetWidth)||"auto"},align:F,children:t.jsxs("div",{className:"flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(b.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t.jsx(E.Input,{placeholder:S,value:i,onChange:e=>w(e.target.value),className:"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})]}),t.jsx("div",{className:"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50",style:{maxHeight:T},onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),children:t.jsx("div",{className:"p-1",children:I?s?u==null?void 0:u.map((e,n)=>t.jsxs("div",{className:c.cn(n>0&&"mt-1.5 border-t border-border pt-1.5"),children:[e.value?t.jsxs("button",{type:"button",onClick:()=>m(e.value),className:c.cn("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm","font-semibold uppercase tracking-wide","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",r===e.value&&"bg-secondary text-secondary-foreground hover:bg-secondary hover:text-secondary-foreground"),children:[t.jsx("span",{className:"truncate",children:e.label}),t.jsx(b.Check,{className:c.cn("h-4 w-4 shrink-0",r===e.value?"opacity-100":"opacity-0")})]}):t.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e.label}),e.options.map(l=>t.jsxs("button",{type:"button",onClick:()=>m(l.value),disabled:l.disabled,className:c.cn("flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",r===l.value&&"bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground"),children:[t.jsx("span",{className:"truncate",children:l.label}),t.jsx(b.Check,{className:c.cn("h-4 w-4 shrink-0",r===l.value?"opacity-100":"opacity-0")})]},l.value))]},e.value??e.label)):g.map(e=>t.jsxs(C.Button,{variant:"ghost",className:c.cn("w-full justify-start font-normal",r===e.value&&"bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground dark:hover:bg-secondary"),onClick:()=>m(e.value),disabled:e.disabled,children:[t.jsx(b.Check,{className:c.cn("mr-2 h-4 w-4",r===e.value?"opacity-100":"opacity-0")}),t.jsx("span",{className:"truncate",children:e.label})]},e.value)):t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:L})})})]})})]})});O.displayName="Combobox";exports.Combobox=O;
2
2
  //# sourceMappingURL=combobox.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.cjs","sources":["../../../../src/components/ui/forms/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Check, ChevronsUpDown, Search } from \"lucide-react\";\nimport { cn, mergeRefs } from \"../utils\";\nimport { Button } from \"../primitives/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../overlays/popover\";\nimport { Input } from \"./input\";\n\nexport interface ComboboxOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface ComboboxGroup {\n /**\n * Rótulo do grupo — renderizado em negrito e caixa alta\n */\n label: string;\n\n /**\n * Quando presente, o cabeçalho do grupo é selecionável e representa o próprio grupo.\n * Sem `value`, o cabeçalho é apenas um rótulo visual não clicável.\n */\n value?: string;\n\n /**\n * Opções pertencentes ao grupo — renderizadas indentadas, em peso normal\n */\n options: ComboboxOption[];\n}\n\nexport interface ComboboxProps {\n /** Rótulo acessível do gatilho quando não há `<Label>` associado */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n\n /**\n * Valor selecionado atual\n */\n value?: string;\n\n /**\n * Callback quando o valor muda\n */\n onValueChange?: (value: string) => void;\n\n /**\n * Lista de opções disponíveis.\n * Use `options` OU `groups` — nunca os dois ao mesmo tempo.\n */\n options?: ComboboxOption[];\n\n /**\n * Opções agrupadas hierarquicamente.\n * Use `options` OU `groups` — nunca os dois ao mesmo tempo.\n */\n groups?: ComboboxGroup[];\n\n /**\n * Placeholder quando nenhum valor está selecionado\n */\n placeholder?: string;\n \n /**\n * Placeholder do campo de busca\n */\n searchPlaceholder?: string;\n \n /**\n * Mensagem quando não há resultados\n */\n emptyMessage?: string;\n \n /**\n * Se o campo está desabilitado\n */\n disabled?: boolean;\n \n /**\n * Se está carregando opções\n */\n loading?: boolean;\n \n /**\n * Classes adicionais para o trigger\n */\n className?: string;\n \n /**\n * Largura do popover (padrão: mesma largura do trigger)\n */\n popoverWidth?: string | number;\n \n /**\n * Altura máxima da lista de opções\n */\n maxHeight?: string;\n \n /**\n * Alinhamento do popover\n */\n align?: \"start\" | \"center\" | \"end\";\n \n /**\n * Se deve permitir limpar seleção\n */\n clearable?: boolean;\n\n /**\n * Função customizada de filtro\n */\n filterFn?: (option: ComboboxOption, searchTerm: string) => boolean;\n}\n\n/**\n * ComboBox - Componente de seleção com busca\n * \n * Combina um Select tradicional com capacidade de pesquisa.\n * Ideal para listas grandes onde o usuário precisa buscar valores.\n *\n * @example\n * ```tsx\n * // Lista plana\n * <Combobox\n * value={clienteId}\n * onValueChange={setClienteId}\n * options={clientes}\n * placeholder=\"Selecione o cliente\"\n * searchPlaceholder=\"Buscar cliente...\"\n * />\n *\n * // Lista hierárquica — grupos selecionáveis com seus clientes indentados\n * <Combobox\n * value={selecao}\n * onValueChange={setSelecao}\n * groups={grupos.map(g => ({\n * label: g.nomeGrupo,\n * value: `g-${g.grupoClienteId}`,\n * options: g.clientes.map(c => ({ value: String(c.id), label: c.nome })),\n * }))}\n * />\n * ```\n */\nexport const Combobox = React.forwardRef<\n React.ElementRef<typeof Button>,\n ComboboxProps\n>(({\n value,\n onValueChange,\n options,\n groups,\n placeholder = \"Selecionar...\",\n searchPlaceholder = \"Buscar...\",\n emptyMessage = \"Nenhum resultado encontrado\",\n disabled = false,\n loading = false,\n className,\n popoverWidth,\n maxHeight = \"300px\",\n align = \"start\",\n clearable = false,\n filterFn,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n}, ref) => {\n const [open, setOpen] = React.useState(false);\n const [searchTerm, setSearchTerm] = React.useState(\"\");\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const mergedTriggerRef = React.useMemo(() => mergeRefs(triggerRef, ref), [ref]);\n\n // Função de filtro padrão\n const defaultFilterFn = (option: ComboboxOption, term: string) => {\n const searchLower = term.toLowerCase();\n return (\n option.label.toLowerCase().includes(searchLower) ||\n option.value.toLowerCase().includes(searchLower)\n );\n };\n\n const filter = filterFn || defaultFilterFn;\n\n // Filtrar opções baseado no termo de busca\n const filteredOptions = React.useMemo(() => {\n if (!options) return [];\n if (!searchTerm) return options;\n return options.filter((option) => filter(option, searchTerm));\n }, [options, searchTerm, filter]);\n\n // Filtrar grupos preservando a hierarquia: um grupo permanece visível quando o próprio\n // rótulo casa com a busca (com todas as suas opções) ou quando alguma opção casa.\n const filteredGroups = React.useMemo(() => {\n if (!groups) return undefined;\n if (!searchTerm) return groups;\n\n const termLower = searchTerm.toLowerCase();\n\n return groups\n .map((group) => {\n if (group.label.toLowerCase().includes(termLower)) return group;\n return { ...group, options: group.options.filter((o) => filter(o, searchTerm)) };\n })\n .filter(\n (group) =>\n group.options.length > 0 || group.label.toLowerCase().includes(termLower)\n );\n }, [groups, searchTerm, filter]);\n\n // Todas as opções selecionáveis — inclui os cabeçalhos de grupo que têm `value`,\n // para que o trigger consiga exibir o rótulo de um grupo selecionado.\n const allOptions = React.useMemo<ComboboxOption[]>(() => {\n if (groups) {\n return groups.flatMap((group) => [\n ...(group.value ? [{ value: group.value, label: group.label }] : []),\n ...group.options,\n ]);\n }\n return options ?? [];\n }, [options, groups]);\n\n // Encontrar a opção selecionada\n const selectedOption = allOptions.find((option) => option.value === value);\n\n const hasResults = groups\n ? (filteredGroups?.length ?? 0) > 0\n : filteredOptions.length > 0;\n\n // Resetar busca ao fechar\n const handleOpenChange = (newOpen: boolean) => {\n setOpen(newOpen);\n if (!newOpen) {\n setSearchTerm(\"\");\n }\n };\n\n // Selecionar opção\n const handleSelect = (selectedValue: string) => {\n if (value === selectedValue && clearable) {\n onValueChange?.(\"\");\n } else {\n onValueChange?.(selectedValue);\n }\n setOpen(false);\n };\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={mergedTriggerRef}\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n className={cn(\n \"w-full justify-between font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n disabled={disabled || loading}\n >\n <span className=\"truncate\">\n {loading\n ? \"Carregando...\"\n : selectedOption\n ? selectedOption.label\n : placeholder}\n </span>\n <ChevronsUpDown className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className=\"overflow-hidden p-0\"\n style={{\n width: popoverWidth || triggerRef.current?.offsetWidth || 'auto',\n }}\n align={align}\n >\n <div className=\"flex flex-col overflow-hidden\">\n {/* Search Input */}\n <div className=\"flex items-center border-b px-3\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <Input\n placeholder={searchPlaceholder}\n value={searchTerm}\n onChange={(e) => setSearchTerm(e.target.value)}\n className=\"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0\"\n autoFocus\n />\n </div>\n\n {/* Options List */}\n <div\n className=\"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50\"\n style={{ maxHeight }}\n onWheel={(e) => e.stopPropagation()}\n onTouchMove={(e) => e.stopPropagation()}\n >\n <div className=\"p-1\">\n {!hasResults ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </div>\n ) : groups ? (\n // Itens de grupo usam <button> nativo, não o componente Button: a variante\n // `has-[>svg]:px-3` do Button entra em conflito com o recuo dos filhos e\n // anula a indentação. Mesmo padrão adotado no MultiSelect.\n filteredGroups?.map((group, groupIndex) => (\n <div\n key={group.value ?? group.label}\n className={cn(\n // Separador entre blocos de grupo\n groupIndex > 0 && \"mt-1.5 border-t border-border pt-1.5\"\n )}\n >\n {group.value ? (\n // Cabeçalho selecionável — representa o próprio grupo\n <button\n type=\"button\"\n onClick={() => handleSelect(group.value!)}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm\",\n \"font-semibold uppercase tracking-wide\",\n \"transition-colors duration-100 hover:bg-accent hover:text-accent-foreground\",\n value === group.value && \"bg-accent\"\n )}\n >\n <span className=\"truncate\">{group.label}</span>\n <Check\n className={cn(\n \"h-4 w-4 shrink-0\",\n value === group.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n </button>\n ) : (\n // Cabeçalho apenas visual\n <div className=\"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground\">\n {group.label}\n </div>\n )}\n {group.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => handleSelect(option.value)}\n disabled={option.disabled}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm\",\n \"transition-colors duration-100 hover:bg-accent hover:text-accent-foreground\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n value === option.value && \"bg-accent\"\n )}\n >\n <span className=\"truncate\">{option.label}</span>\n <Check\n className={cn(\n \"h-4 w-4 shrink-0\",\n value === option.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n </button>\n ))}\n </div>\n ))\n ) : (\n filteredOptions.map((option) => (\n <Button\n key={option.value}\n variant=\"ghost\"\n className={cn(\n \"w-full justify-start font-normal\",\n value === option.value && \"bg-accent\"\n )}\n onClick={() => handleSelect(option.value)}\n disabled={option.disabled}\n >\n <Check\n className={cn(\n \"mr-2 h-4 w-4\",\n value === option.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n <span className=\"truncate\">{option.label}</span>\n </Button>\n ))\n )}\n </div>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n});\nCombobox.displayName = \"Combobox\";\n"],"names":["Combobox","React","value","onValueChange","options","groups","placeholder","searchPlaceholder","emptyMessage","disabled","loading","className","popoverWidth","maxHeight","align","clearable","filterFn","ariaLabel","ariaLabelledby","ref","open","setOpen","searchTerm","setSearchTerm","triggerRef","mergedTriggerRef","mergeRefs","filter","option","term","searchLower","filteredOptions","filteredGroups","termLower","group","o","selectedOption","hasResults","handleOpenChange","newOpen","handleSelect","selectedValue","jsxs","Popover","jsx","PopoverTrigger","Button","cn","ChevronsUpDown","PopoverContent","_a","Search","Input","groupIndex","Check"],"mappings":"ukBAiJaA,EAAWC,EAAM,WAG5B,CAAC,CACD,MAAAC,EACA,cAAAC,EACA,QAAAC,EACA,OAAAC,EACA,YAAAC,EAAc,gBACd,kBAAAC,EAAoB,YACpB,aAAAC,EAAe,8BACf,SAAAC,EAAW,GACX,QAAAC,EAAU,GACV,UAAAC,EACA,aAAAC,EACA,UAAAC,EAAY,QACZ,MAAAC,EAAQ,QACR,UAAAC,EAAY,GACZ,SAAAC,EACA,aAAcC,EACd,kBAAmBC,CACrB,EAAGC,IAAQ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gB,WAAA,CAC3C,CAAA,CACF,CAAA,EAjBKA,EAAO,KAAA,CAmBf,CAAA,CAAA,EArDIM,EAAM,OAASA,EAAM,KAAA,GAyD9BH,EAAgB,IAAKH,GACnBc,EAAAA,KAACI,EAAAA,OAAA,CAEC,QAAQ,QACR,UAAWC,EAAAA,GACT,mCACA7C,IAAU0B,EAAO,OAAS,WAAA,EAE5B,QAAS,IAAMY,EAAaZ,EAAO,KAAK,EACxC,SAAUA,EAAO,SAEjB,SAAA,CAAAgB,EAAAA,IAACU,EAAAA,MAAA,CACC,UAAWP,EAAAA,GACT,eACA7C,IAAU0B,EAAO,MAAQ,cAAgB,WAAA,CAC3C,CAAA,EAEFgB,EAAAA,IAAC,OAAA,CAAK,UAAU,WAAY,WAAO,KAAA,CAAM,CAAA,CAAA,EAfpChB,EAAO,KAAA,CAiBf,EArFDgB,EAAAA,IAAC,MAAA,CAAI,UAAU,iDACZ,SAAApC,CAAA,CACH,CAmFC,CAEL,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CACF,EACF,CAEJ,CAAC,EACDR,EAAS,YAAc"}
1
+ {"version":3,"file":"combobox.cjs","sources":["../../../../src/components/ui/forms/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Check, ChevronsUpDown, Search } from \"lucide-react\";\nimport { cn, mergeRefs } from \"../utils\";\nimport { Button } from \"../primitives/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../overlays/popover\";\nimport { Input } from \"./input\";\n\nexport interface ComboboxOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface ComboboxGroup {\n /**\n * Rótulo do grupo — renderizado em negrito e caixa alta\n */\n label: string;\n\n /**\n * Quando presente, o cabeçalho do grupo é selecionável e representa o próprio grupo.\n * Sem `value`, o cabeçalho é apenas um rótulo visual não clicável.\n */\n value?: string;\n\n /**\n * Opções pertencentes ao grupo — renderizadas indentadas, em peso normal\n */\n options: ComboboxOption[];\n}\n\nexport interface ComboboxProps {\n /** Rótulo acessível do gatilho quando não há `<Label>` associado */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n\n /**\n * Valor selecionado atual\n */\n value?: string;\n\n /**\n * Callback quando o valor muda\n */\n onValueChange?: (value: string) => void;\n\n /**\n * Lista de opções disponíveis.\n * Use `options` OU `groups` — nunca os dois ao mesmo tempo.\n */\n options?: ComboboxOption[];\n\n /**\n * Opções agrupadas hierarquicamente.\n * Use `options` OU `groups` — nunca os dois ao mesmo tempo.\n */\n groups?: ComboboxGroup[];\n\n /**\n * Placeholder quando nenhum valor está selecionado\n */\n placeholder?: string;\n \n /**\n * Placeholder do campo de busca\n */\n searchPlaceholder?: string;\n \n /**\n * Mensagem quando não há resultados\n */\n emptyMessage?: string;\n \n /**\n * Se o campo está desabilitado\n */\n disabled?: boolean;\n \n /**\n * Se está carregando opções\n */\n loading?: boolean;\n \n /**\n * Classes adicionais para o trigger\n */\n className?: string;\n \n /**\n * Largura do popover (padrão: mesma largura do trigger)\n */\n popoverWidth?: string | number;\n \n /**\n * Altura máxima da lista de opções\n */\n maxHeight?: string;\n \n /**\n * Alinhamento do popover\n */\n align?: \"start\" | \"center\" | \"end\";\n \n /**\n * Se deve permitir limpar seleção\n */\n clearable?: boolean;\n\n /**\n * Função customizada de filtro\n */\n filterFn?: (option: ComboboxOption, searchTerm: string) => boolean;\n}\n\n/**\n * ComboBox - Componente de seleção com busca\n * \n * Combina um Select tradicional com capacidade de pesquisa.\n * Ideal para listas grandes onde o usuário precisa buscar valores.\n *\n * @example\n * ```tsx\n * // Lista plana\n * <Combobox\n * value={clienteId}\n * onValueChange={setClienteId}\n * options={clientes}\n * placeholder=\"Selecione o cliente\"\n * searchPlaceholder=\"Buscar cliente...\"\n * />\n *\n * // Lista hierárquica — grupos selecionáveis com seus clientes indentados\n * <Combobox\n * value={selecao}\n * onValueChange={setSelecao}\n * groups={grupos.map(g => ({\n * label: g.nomeGrupo,\n * value: `g-${g.grupoClienteId}`,\n * options: g.clientes.map(c => ({ value: String(c.id), label: c.nome })),\n * }))}\n * />\n * ```\n */\nexport const Combobox = React.forwardRef<\n React.ElementRef<typeof Button>,\n ComboboxProps\n>(({\n value,\n onValueChange,\n options,\n groups,\n placeholder = \"Selecionar...\",\n searchPlaceholder = \"Buscar...\",\n emptyMessage = \"Nenhum resultado encontrado\",\n disabled = false,\n loading = false,\n className,\n popoverWidth,\n maxHeight = \"300px\",\n align = \"start\",\n clearable = false,\n filterFn,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n}, ref) => {\n const [open, setOpen] = React.useState(false);\n const [searchTerm, setSearchTerm] = React.useState(\"\");\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const mergedTriggerRef = React.useMemo(() => mergeRefs(triggerRef, ref), [ref]);\n\n // Função de filtro padrão\n const defaultFilterFn = (option: ComboboxOption, term: string) => {\n const searchLower = term.toLowerCase();\n return (\n option.label.toLowerCase().includes(searchLower) ||\n option.value.toLowerCase().includes(searchLower)\n );\n };\n\n const filter = filterFn || defaultFilterFn;\n\n // Filtrar opções baseado no termo de busca\n const filteredOptions = React.useMemo(() => {\n if (!options) return [];\n if (!searchTerm) return options;\n return options.filter((option) => filter(option, searchTerm));\n }, [options, searchTerm, filter]);\n\n // Filtrar grupos preservando a hierarquia: um grupo permanece visível quando o próprio\n // rótulo casa com a busca (com todas as suas opções) ou quando alguma opção casa.\n const filteredGroups = React.useMemo(() => {\n if (!groups) return undefined;\n if (!searchTerm) return groups;\n\n const termLower = searchTerm.toLowerCase();\n\n return groups\n .map((group) => {\n if (group.label.toLowerCase().includes(termLower)) return group;\n return { ...group, options: group.options.filter((o) => filter(o, searchTerm)) };\n })\n .filter(\n (group) =>\n group.options.length > 0 || group.label.toLowerCase().includes(termLower)\n );\n }, [groups, searchTerm, filter]);\n\n // Todas as opções selecionáveis — inclui os cabeçalhos de grupo que têm `value`,\n // para que o trigger consiga exibir o rótulo de um grupo selecionado.\n const allOptions = React.useMemo<ComboboxOption[]>(() => {\n if (groups) {\n return groups.flatMap((group) => [\n ...(group.value ? [{ value: group.value, label: group.label }] : []),\n ...group.options,\n ]);\n }\n return options ?? [];\n }, [options, groups]);\n\n // Encontrar a opção selecionada\n const selectedOption = allOptions.find((option) => option.value === value);\n\n const hasResults = groups\n ? (filteredGroups?.length ?? 0) > 0\n : filteredOptions.length > 0;\n\n // Resetar busca ao fechar\n const handleOpenChange = (newOpen: boolean) => {\n setOpen(newOpen);\n if (!newOpen) {\n setSearchTerm(\"\");\n }\n };\n\n // Selecionar opção\n const handleSelect = (selectedValue: string) => {\n if (value === selectedValue && clearable) {\n onValueChange?.(\"\");\n } else {\n onValueChange?.(selectedValue);\n }\n setOpen(false);\n };\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={mergedTriggerRef}\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n className={cn(\n \"w-full justify-between font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n disabled={disabled || loading}\n >\n <span className=\"truncate\">\n {loading\n ? \"Carregando...\"\n : selectedOption\n ? selectedOption.label\n : placeholder}\n </span>\n <ChevronsUpDown className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className=\"overflow-hidden p-0\"\n style={{\n width: popoverWidth || triggerRef.current?.offsetWidth || 'auto',\n }}\n align={align}\n >\n <div className=\"flex flex-col overflow-hidden\">\n {/* Search Input */}\n <div className=\"flex items-center border-b px-3\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <Input\n placeholder={searchPlaceholder}\n value={searchTerm}\n onChange={(e) => setSearchTerm(e.target.value)}\n className=\"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0\"\n autoFocus\n />\n </div>\n\n {/* Options List */}\n <div\n className=\"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50\"\n style={{ maxHeight }}\n onWheel={(e) => e.stopPropagation()}\n onTouchMove={(e) => e.stopPropagation()}\n >\n <div className=\"p-1\">\n {!hasResults ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </div>\n ) : groups ? (\n // Itens de grupo usam <button> nativo, não o componente Button: a variante\n // `has-[>svg]:px-3` do Button entra em conflito com o recuo dos filhos e\n // anula a indentação. Mesmo padrão adotado no MultiSelect.\n filteredGroups?.map((group, groupIndex) => (\n <div\n key={group.value ?? group.label}\n className={cn(\n // Separador entre blocos de grupo\n groupIndex > 0 && \"mt-1.5 border-t border-border pt-1.5\"\n )}\n >\n {group.value ? (\n // Cabeçalho selecionável — representa o próprio grupo\n <button\n type=\"button\"\n onClick={() => handleSelect(group.value!)}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm\",\n \"font-semibold uppercase tracking-wide\",\n \"transition-colors duration-100 hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n value === group.value && \"bg-secondary text-secondary-foreground hover:bg-secondary hover:text-secondary-foreground\"\n )}\n >\n <span className=\"truncate\">{group.label}</span>\n <Check\n className={cn(\n \"h-4 w-4 shrink-0\",\n value === group.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n </button>\n ) : (\n // Cabeçalho apenas visual\n <div className=\"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground\">\n {group.label}\n </div>\n )}\n {group.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => handleSelect(option.value)}\n disabled={option.disabled}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm\",\n \"transition-colors duration-100 hover:bg-accent hover:text-accent-foreground\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n value === option.value && \"bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground\"\n )}\n >\n <span className=\"truncate\">{option.label}</span>\n <Check\n className={cn(\n \"h-4 w-4 shrink-0\",\n value === option.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n </button>\n ))}\n </div>\n ))\n ) : (\n filteredOptions.map((option) => (\n <Button\n key={option.value}\n variant=\"ghost\"\n className={cn(\n \"w-full justify-start font-normal\",\n value === option.value && \"bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground dark:hover:bg-secondary\"\n )}\n onClick={() => handleSelect(option.value)}\n disabled={option.disabled}\n >\n <Check\n className={cn(\n \"mr-2 h-4 w-4\",\n value === option.value ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n <span className=\"truncate\">{option.label}</span>\n </Button>\n ))\n )}\n </div>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n});\nCombobox.displayName = \"Combobox\";\n"],"names":["Combobox","React","value","onValueChange","options","groups","placeholder","searchPlaceholder","emptyMessage","disabled","loading","className","popoverWidth","maxHeight","align","clearable","filterFn","ariaLabel","ariaLabelledby","ref","open","setOpen","searchTerm","setSearchTerm","triggerRef","mergedTriggerRef","mergeRefs","filter","option","term","searchLower","filteredOptions","filteredGroups","termLower","group","o","selectedOption","hasResults","handleOpenChange","newOpen","handleSelect","selectedValue","jsxs","Popover","jsx","PopoverTrigger","Button","cn","ChevronsUpDown","PopoverContent","_a","Search","Input","groupIndex","Check"],"mappings":"ukBAiJaA,EAAWC,EAAM,WAG5B,CAAC,CACD,MAAAC,EACA,cAAAC,EACA,QAAAC,EACA,OAAAC,EACA,YAAAC,EAAc,gBACd,kBAAAC,EAAoB,YACpB,aAAAC,EAAe,8BACf,SAAAC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GAAA,EAG5B,SAAA,CAAAgB,EAAAA,IAAC,OAAA,CAAK,UAAU,WAAY,SAAAhB,EAAO,MAAM,EACzCgB,EAAAA,IAACU,EAAAA,MAAA,CACC,UAAWP,EAAAA,GACT,mBACA7C,IAAU0B,EAAO,MAAQ,cAAgB,WAAA,CAC3C,CAAA,CACF,CAAA,EAlBKA,EAAO,KAAA,CAoBf,CAAA,CAAA,EAvDIM,EAAM,OAASA,EAAM,KAAA,GA2D9BH,EAAgB,IAAKH,GACnBc,EAAAA,KAACI,EAAAA,OAAA,CAEC,QAAQ,QACR,UAAWC,EAAAA,GACT,mCACA7C,IAAU0B,EAAO,OAAS,+HAAA,EAE5B,QAAS,IAAMY,EAAaZ,EAAO,KAAK,EACxC,SAAUA,EAAO,SAEjB,SAAA,CAAAgB,EAAAA,IAACU,EAAAA,MAAA,CACC,UAAWP,EAAAA,GACT,eACA7C,IAAU0B,EAAO,MAAQ,cAAgB,WAAA,CAC3C,CAAA,EAEFgB,EAAAA,IAAC,OAAA,CAAK,UAAU,WAAY,WAAO,KAAA,CAAM,CAAA,CAAA,EAfpChB,EAAO,KAAA,CAiBf,EAvFDgB,EAAAA,IAAC,MAAA,CAAI,UAAU,iDACZ,SAAApC,CAAA,CACH,CAqFC,CAEL,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CACF,EACF,CAEJ,CAAC,EACDR,EAAS,YAAc"}
@@ -1,22 +1,22 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
3
3
  import * as i from "react";
4
4
  import { ChevronsUpDown as A, Search as E, Check as h } from "lucide-react";
5
- import { mergeRefs as H, cn as o } from "../utils.js";
6
- import { Button as R } from "../primitives/button.js";
5
+ import { mergeRefs as H, cn as c } from "../utils.js";
6
+ import { Button as L } from "../primitives/button.js";
7
7
  import { Popover as J, PopoverTrigger as K, PopoverContent as Q } from "../overlays/popover.js";
8
8
  import { Input as X } from "./input.js";
9
9
  const Y = i.forwardRef(({
10
- value: l,
10
+ value: s,
11
11
  onValueChange: d,
12
12
  options: m,
13
- groups: s,
14
- placeholder: j = "Selecionar...",
15
- searchPlaceholder: M = "Buscar...",
16
- emptyMessage: O = "Nenhum resultado encontrado",
17
- disabled: S = !1,
13
+ groups: l,
14
+ placeholder: R = "Selecionar...",
15
+ searchPlaceholder: j = "Buscar...",
16
+ emptyMessage: M = "Nenhum resultado encontrado",
17
+ disabled: O = !1,
18
18
  loading: v = !1,
19
- className: g,
19
+ className: S,
20
20
  popoverWidth: F,
21
21
  maxHeight: P = "300px",
22
22
  align: T = "start",
@@ -24,110 +24,111 @@ const Y = i.forwardRef(({
24
24
  filterFn: W,
25
25
  "aria-label": D,
26
26
  "aria-labelledby": I
27
- }, w) => {
28
- var L;
29
- const [p, x] = i.useState(!1), [n, y] = i.useState(""), N = i.useRef(null), U = i.useMemo(() => H(N, w), [w]), f = W || ((e, a) => {
30
- const r = a.toLowerCase();
31
- return e.label.toLowerCase().includes(r) || e.value.toLowerCase().includes(r);
32
- }), k = i.useMemo(() => m ? n ? m.filter((e) => f(e, n)) : m : [], [m, n, f]), b = i.useMemo(() => {
33
- if (!s) return;
34
- if (!n) return s;
35
- const e = n.toLowerCase();
36
- return s.map((a) => a.label.toLowerCase().includes(e) ? a : { ...a, options: a.options.filter((r) => f(r, n)) }).filter(
37
- (a) => a.options.length > 0 || a.label.toLowerCase().includes(e)
27
+ }, y) => {
28
+ var C;
29
+ const [w, x] = i.useState(!1), [o, p] = i.useState(""), N = i.useRef(null), U = i.useMemo(() => H(N, y), [y]), b = W || ((e, t) => {
30
+ const a = t.toLowerCase();
31
+ return e.label.toLowerCase().includes(a) || e.value.toLowerCase().includes(a);
32
+ }), g = i.useMemo(() => m ? o ? m.filter((e) => b(e, o)) : m : [], [m, o, b]), f = i.useMemo(() => {
33
+ if (!l) return;
34
+ if (!o) return l;
35
+ const e = o.toLowerCase();
36
+ return l.map((t) => t.label.toLowerCase().includes(e) ? t : { ...t, options: t.options.filter((a) => b(a, o)) }).filter(
37
+ (t) => t.options.length > 0 || t.label.toLowerCase().includes(e)
38
38
  );
39
- }, [s, n, f]), C = i.useMemo(() => s ? s.flatMap((e) => [
39
+ }, [l, o, b]), k = i.useMemo(() => l ? l.flatMap((e) => [
40
40
  ...e.value ? [{ value: e.value, label: e.label }] : [],
41
41
  ...e.options
42
- ]) : m ?? [], [m, s]).find((e) => e.value === l), q = s ? ((b == null ? void 0 : b.length) ?? 0) > 0 : k.length > 0, z = (e) => {
43
- x(e), e || y("");
42
+ ]) : m ?? [], [m, l]).find((e) => e.value === s), q = l ? ((f == null ? void 0 : f.length) ?? 0) > 0 : g.length > 0, z = (e) => {
43
+ x(e), e || p("");
44
44
  }, u = (e) => {
45
- l === e && B ? d == null || d("") : d == null || d(e), x(!1);
45
+ s === e && B ? d == null || d("") : d == null || d(e), x(!1);
46
46
  };
47
- return /* @__PURE__ */ c(J, { open: p, onOpenChange: z, children: [
48
- /* @__PURE__ */ t(K, { asChild: !0, children: /* @__PURE__ */ c(
49
- R,
47
+ return /* @__PURE__ */ n(J, { open: w, onOpenChange: z, children: [
48
+ /* @__PURE__ */ r(K, { asChild: !0, children: /* @__PURE__ */ n(
49
+ L,
50
50
  {
51
51
  ref: U,
52
52
  variant: "outline",
53
53
  role: "combobox",
54
- "aria-expanded": p,
54
+ "aria-expanded": w,
55
55
  "aria-label": D,
56
56
  "aria-labelledby": I,
57
- className: o(
57
+ className: c(
58
58
  "w-full justify-between font-normal",
59
- !l && "text-muted-foreground",
60
- g
59
+ !s && "text-muted-foreground",
60
+ S
61
61
  ),
62
- disabled: S || v,
62
+ disabled: O || v,
63
63
  children: [
64
- /* @__PURE__ */ t("span", { className: "truncate", children: v ? "Carregando..." : C ? C.label : j }),
65
- /* @__PURE__ */ t(A, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
64
+ /* @__PURE__ */ r("span", { className: "truncate", children: v ? "Carregando..." : k ? k.label : R }),
65
+ /* @__PURE__ */ r(A, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
66
66
  ]
67
67
  }
68
68
  ) }),
69
- /* @__PURE__ */ t(
69
+ /* @__PURE__ */ r(
70
70
  Q,
71
71
  {
72
72
  className: "overflow-hidden p-0",
73
73
  style: {
74
- width: F || ((L = N.current) == null ? void 0 : L.offsetWidth) || "auto"
74
+ width: F || ((C = N.current) == null ? void 0 : C.offsetWidth) || "auto"
75
75
  },
76
76
  align: T,
77
- children: /* @__PURE__ */ c("div", { className: "flex flex-col overflow-hidden", children: [
78
- /* @__PURE__ */ c("div", { className: "flex items-center border-b px-3", children: [
79
- /* @__PURE__ */ t(E, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
80
- /* @__PURE__ */ t(
77
+ children: /* @__PURE__ */ n("div", { className: "flex flex-col overflow-hidden", children: [
78
+ /* @__PURE__ */ n("div", { className: "flex items-center border-b px-3", children: [
79
+ /* @__PURE__ */ r(E, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
80
+ /* @__PURE__ */ r(
81
81
  X,
82
82
  {
83
- placeholder: M,
84
- value: n,
85
- onChange: (e) => y(e.target.value),
83
+ placeholder: j,
84
+ value: o,
85
+ onChange: (e) => p(e.target.value),
86
86
  className: "h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0",
87
87
  autoFocus: !0
88
88
  }
89
89
  )
90
90
  ] }),
91
- /* @__PURE__ */ t(
91
+ /* @__PURE__ */ r(
92
92
  "div",
93
93
  {
94
94
  className: "overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50",
95
95
  style: { maxHeight: P },
96
96
  onWheel: (e) => e.stopPropagation(),
97
97
  onTouchMove: (e) => e.stopPropagation(),
98
- children: /* @__PURE__ */ t("div", { className: "p-1", children: q ? s ? (
98
+ children: /* @__PURE__ */ r("div", { className: "p-1", children: q ? l ? (
99
99
  // Itens de grupo usam <button> nativo, não o componente Button: a variante
100
100
  // `has-[>svg]:px-3` do Button entra em conflito com o recuo dos filhos e
101
101
  // anula a indentação. Mesmo padrão adotado no MultiSelect.
102
- b == null ? void 0 : b.map((e, a) => /* @__PURE__ */ c(
102
+ f == null ? void 0 : f.map((e, t) => /* @__PURE__ */ n(
103
103
  "div",
104
104
  {
105
- className: o(
105
+ className: c(
106
106
  // Separador entre blocos de grupo
107
- a > 0 && "mt-1.5 border-t border-border pt-1.5"
107
+ t > 0 && "mt-1.5 border-t border-border pt-1.5"
108
108
  ),
109
109
  children: [
110
110
  e.value ? (
111
111
  // Cabeçalho selecionável — representa o próprio grupo
112
- /* @__PURE__ */ c(
112
+ /* @__PURE__ */ n(
113
113
  "button",
114
114
  {
115
115
  type: "button",
116
116
  onClick: () => u(e.value),
117
- className: o(
117
+ className: c(
118
118
  "flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm",
119
119
  "font-semibold uppercase tracking-wide",
120
120
  "transition-colors duration-100 hover:bg-accent hover:text-accent-foreground",
121
- l === e.value && "bg-accent"
121
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
122
+ s === e.value && "bg-secondary text-secondary-foreground hover:bg-secondary hover:text-secondary-foreground"
122
123
  ),
123
124
  children: [
124
- /* @__PURE__ */ t("span", { className: "truncate", children: e.label }),
125
- /* @__PURE__ */ t(
125
+ /* @__PURE__ */ r("span", { className: "truncate", children: e.label }),
126
+ /* @__PURE__ */ r(
126
127
  h,
127
128
  {
128
- className: o(
129
+ className: c(
129
130
  "h-4 w-4 shrink-0",
130
- l === e.value ? "opacity-100" : "opacity-0"
131
+ s === e.value ? "opacity-100" : "opacity-0"
131
132
  )
132
133
  }
133
134
  )
@@ -136,64 +137,65 @@ const Y = i.forwardRef(({
136
137
  )
137
138
  ) : (
138
139
  // Cabeçalho apenas visual
139
- /* @__PURE__ */ t("div", { className: "px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: e.label })
140
+ /* @__PURE__ */ r("div", { className: "px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: e.label })
140
141
  ),
141
- e.options.map((r) => /* @__PURE__ */ c(
142
+ e.options.map((a) => /* @__PURE__ */ n(
142
143
  "button",
143
144
  {
144
145
  type: "button",
145
- onClick: () => u(r.value),
146
- disabled: r.disabled,
147
- className: o(
146
+ onClick: () => u(a.value),
147
+ disabled: a.disabled,
148
+ className: c(
148
149
  "flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm",
149
150
  "transition-colors duration-100 hover:bg-accent hover:text-accent-foreground",
150
151
  "disabled:pointer-events-none disabled:opacity-50",
151
- l === r.value && "bg-accent"
152
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
153
+ s === a.value && "bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground"
152
154
  ),
153
155
  children: [
154
- /* @__PURE__ */ t("span", { className: "truncate", children: r.label }),
155
- /* @__PURE__ */ t(
156
+ /* @__PURE__ */ r("span", { className: "truncate", children: a.label }),
157
+ /* @__PURE__ */ r(
156
158
  h,
157
159
  {
158
- className: o(
160
+ className: c(
159
161
  "h-4 w-4 shrink-0",
160
- l === r.value ? "opacity-100" : "opacity-0"
162
+ s === a.value ? "opacity-100" : "opacity-0"
161
163
  )
162
164
  }
163
165
  )
164
166
  ]
165
167
  },
166
- r.value
168
+ a.value
167
169
  ))
168
170
  ]
169
171
  },
170
172
  e.value ?? e.label
171
173
  ))
172
- ) : k.map((e) => /* @__PURE__ */ c(
173
- R,
174
+ ) : g.map((e) => /* @__PURE__ */ n(
175
+ L,
174
176
  {
175
177
  variant: "ghost",
176
- className: o(
178
+ className: c(
177
179
  "w-full justify-start font-normal",
178
- l === e.value && "bg-accent"
180
+ s === e.value && "bg-secondary text-secondary-foreground font-medium hover:bg-secondary hover:text-secondary-foreground dark:hover:bg-secondary"
179
181
  ),
180
182
  onClick: () => u(e.value),
181
183
  disabled: e.disabled,
182
184
  children: [
183
- /* @__PURE__ */ t(
185
+ /* @__PURE__ */ r(
184
186
  h,
185
187
  {
186
- className: o(
188
+ className: c(
187
189
  "mr-2 h-4 w-4",
188
- l === e.value ? "opacity-100" : "opacity-0"
190
+ s === e.value ? "opacity-100" : "opacity-0"
189
191
  )
190
192
  }
191
193
  ),
192
- /* @__PURE__ */ t("span", { className: "truncate", children: e.label })
194
+ /* @__PURE__ */ r("span", { className: "truncate", children: e.label })
193
195
  ]
194
196
  },
195
197
  e.value
196
- )) : /* @__PURE__ */ t("div", { className: "py-6 text-center text-sm text-muted-foreground", children: O }) })
198
+ )) : /* @__PURE__ */ r("div", { className: "py-6 text-center text-sm text-muted-foreground", children: M }) })
197
199
  }
198
200
  )
199
201
  ] })