@humu-tech/ui 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -208,9 +208,8 @@ function SuspenseSkeleton({
208
208
 
209
209
  // src/lib/platform.ts
210
210
  function isMacOS() {
211
- var _a;
212
211
  if (typeof navigator === "undefined") return false;
213
- const platform = (((_a = navigator.userAgentData) == null ? void 0 : _a.platform) || navigator.platform || navigator.userAgent || "").toLowerCase();
212
+ const platform = (navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || "").toLowerCase();
214
213
  return platform.includes("mac");
215
214
  }
216
215
  function getShortcutLabel(key) {
@@ -232,8 +231,7 @@ var IMAGE_EXTENSIONS = [
232
231
  "avif"
233
232
  ];
234
233
  function getExtension(fileName) {
235
- var _a;
236
- return ((_a = fileName == null ? void 0 : fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase()) ?? "";
234
+ return fileName?.split(".").pop()?.toLowerCase() ?? "";
237
235
  }
238
236
  function isImageFile(mimeType, fileName) {
239
237
  if (mimeType) {
@@ -507,7 +505,7 @@ var Button = forwardRef4(
507
505
  event.stopPropagation();
508
506
  return;
509
507
  }
510
- onClick == null ? void 0 : onClick(event);
508
+ onClick?.(event);
511
509
  };
512
510
  const inactivityProps = asChild ? {
513
511
  "data-disabled": isInactive || void 0,
@@ -772,7 +770,7 @@ var MaskedInput = forwardRef7(
772
770
  const activeMask = selectMask(mask, raw);
773
771
  const formatted = applyMask(activeMask, raw);
774
772
  if (!isControlled) setInternalValue(formatted);
775
- onValueChange == null ? void 0 : onValueChange(formatted, raw);
773
+ onValueChange?.(formatted, raw);
776
774
  };
777
775
  if (floating && label) {
778
776
  const { placeholder: userPlaceholder, ...restNoPlaceholder } = rest;
@@ -1111,7 +1109,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
1111
1109
  // src/primitives/Popover/Popover.styles.ts
1112
1110
  import { cva as cva6 } from "class-variance-authority";
1113
1111
  var popoverContentStyles = cva6(
1114
- "z-50 rounded-v2-md border border-v2-border-default bg-v2-panel p-4 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none",
1112
+ "pointer-events-auto z-50 rounded-v2-md border border-v2-border-default bg-v2-panel p-4 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none",
1115
1113
  {
1116
1114
  variants: {
1117
1115
  size: {
@@ -1205,7 +1203,7 @@ var ColorPicker = forwardRef11(
1205
1203
  color: swatchColor,
1206
1204
  onChange: (c) => {
1207
1205
  setPickerColor(c);
1208
- onValueChange == null ? void 0 : onValueChange(c);
1206
+ onValueChange?.(c);
1209
1207
  }
1210
1208
  }
1211
1209
  ) })
@@ -1221,11 +1219,11 @@ var ColorPicker = forwardRef11(
1221
1219
  maxLength: 7,
1222
1220
  error,
1223
1221
  "aria-label": "Cor (hex)",
1224
- onChange: (e) => onValueChange == null ? void 0 : onValueChange(e.target.value),
1222
+ onChange: (e) => onValueChange?.(e.target.value),
1225
1223
  onBlur: (e) => {
1226
1224
  const trimmed = e.target.value.trim();
1227
1225
  if (trimmed && !trimmed.startsWith("#")) {
1228
- onValueChange == null ? void 0 : onValueChange(`#${trimmed}`);
1226
+ onValueChange?.(`#${trimmed}`);
1229
1227
  }
1230
1228
  }
1231
1229
  }
@@ -1291,7 +1289,7 @@ var Combobox = forwardRef12(
1291
1289
  );
1292
1290
  const handleSelect = (next) => {
1293
1291
  if (value === void 0) setInternalValue(next ?? "");
1294
- onValueChange == null ? void 0 : onValueChange(next ?? "");
1292
+ onValueChange?.(next ?? "");
1295
1293
  setOpen(false);
1296
1294
  setQuery("");
1297
1295
  };
@@ -1332,10 +1330,9 @@ var Combobox = forwardRef12(
1332
1330
  }
1333
1331
  };
1334
1332
  useEffect3(() => {
1335
- var _a, _b;
1336
1333
  if (open) {
1337
- setHighlightedValue(((_a = filteredItems[0]) == null ? void 0 : _a.value) ?? null);
1338
- (_b = searchInputRef.current) == null ? void 0 : _b.focus();
1334
+ setHighlightedValue(filteredItems[0]?.value ?? null);
1335
+ searchInputRef.current?.focus();
1339
1336
  } else {
1340
1337
  setQuery("");
1341
1338
  }
@@ -1717,6 +1714,7 @@ import {
1717
1714
  forwardRef as forwardRef14,
1718
1715
  useEffect as useEffect4,
1719
1716
  useId as useId6,
1717
+ useMemo,
1720
1718
  useRef as useRef2,
1721
1719
  useState as useState6
1722
1720
  } from "react";
@@ -1724,9 +1722,8 @@ import { format, isValid, parse } from "date-fns";
1724
1722
  import { ptBR } from "date-fns/locale";
1725
1723
  import { DayPicker } from "react-day-picker";
1726
1724
  import { CalendarBlank, CaretDown as CaretDown2 } from "@phosphor-icons/react";
1727
- import "./DateInput-Y73Z32X6.css";
1728
- import "./DateRangeInput-GFYTBAQ7.css";
1729
- import "react-day-picker/dist/style.css";
1725
+ import "./DateInput-ASNJQV43.css";
1726
+ import "react-day-picker/style.css";
1730
1727
  import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
1731
1728
  var DEFAULT_PATTERN = "dd/MM/yyyy";
1732
1729
  function maskDefaultPattern(raw) {
@@ -1781,6 +1778,14 @@ var DateInput = forwardRef14(
1781
1778
  const [open, setOpen] = useState6(false);
1782
1779
  const [month, setMonth] = useState6(value ?? /* @__PURE__ */ new Date());
1783
1780
  const [showYearPicker, setShowYearPicker] = useState6(false);
1781
+ const diasDesabilitados = useMemo(() => {
1782
+ const regras = [];
1783
+ if (fromDate) regras.push({ before: fromDate });
1784
+ if (toDate) regras.push({ after: toDate });
1785
+ if (Array.isArray(disabledDates)) regras.push(...disabledDates);
1786
+ else if (disabledDates !== void 0) regras.push(disabledDates);
1787
+ return regras;
1788
+ }, [fromDate, toDate, disabledDates]);
1784
1789
  const selectedYearRef = useRef2(null);
1785
1790
  const yearListRef = useRef2(null);
1786
1791
  const generatedId = useId6();
@@ -1796,7 +1801,7 @@ var DateInput = forwardRef14(
1796
1801
  }, [displayValueText]);
1797
1802
  const commitValue = (next) => {
1798
1803
  if (!isControlled) setUncontrolled(next);
1799
- onValueChange == null ? void 0 : onValueChange(next);
1804
+ onValueChange?.(next);
1800
1805
  };
1801
1806
  const handleSelect = (next) => {
1802
1807
  commitValue(next);
@@ -1825,7 +1830,7 @@ var DateInput = forwardRef14(
1825
1830
  };
1826
1831
  const handleTextBlur = (event) => {
1827
1832
  setText(value ? formatValue(value) : "");
1828
- onBlur == null ? void 0 : onBlur(event);
1833
+ onBlur?.(event);
1829
1834
  };
1830
1835
  const hasValue = Boolean(value);
1831
1836
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
@@ -1834,9 +1839,8 @@ var DateInput = forwardRef14(
1834
1839
  const years = [];
1835
1840
  for (let y = dropdownFromYear; y <= dropdownToYear; y += 1) years.push(y);
1836
1841
  useEffect4(() => {
1837
- var _a;
1838
1842
  if (!showYearPicker) return;
1839
- (_a = selectedYearRef.current) == null ? void 0 : _a.scrollIntoView({ block: "center" });
1843
+ selectedYearRef.current?.scrollIntoView({ block: "center" });
1840
1844
  const list = yearListRef.current;
1841
1845
  if (!list) return;
1842
1846
  const handleWheel = (event) => {
@@ -1986,17 +1990,28 @@ var DateInput = forwardRef14(
1986
1990
  ) : /* @__PURE__ */ jsx20(
1987
1991
  DayPicker,
1988
1992
  {
1993
+ navLayout: "around",
1989
1994
  mode: "single",
1990
1995
  selected: value,
1991
1996
  onSelect: handleSelect,
1992
1997
  month,
1993
1998
  onMonthChange: setMonth,
1994
- captionLayout: "buttons",
1995
- fromDate,
1996
- toDate,
1997
- disabled: disabledDates,
1999
+ captionLayout: "label",
2000
+ startMonth: fromDate,
2001
+ endMonth: toDate,
2002
+ disabled: diasDesabilitados,
1998
2003
  locale,
1999
- className: "rdp-v2-range rdp-v2-single p-3",
2004
+ className: "rdp-v2 rdp-v2-single p-3",
2005
+ labels: {
2006
+ labelDayButton: (date, modifiers) => {
2007
+ let texto = format(date, "PPPP", { locale });
2008
+ if (modifiers.today) texto = `Hoje, ${texto}`;
2009
+ if (modifiers.selected) texto = `${texto}, selecionado`;
2010
+ return texto;
2011
+ },
2012
+ labelPrevious: () => "M\xEAs anterior",
2013
+ labelNext: () => "Pr\xF3ximo m\xEAs"
2014
+ },
2000
2015
  formatters: {
2001
2016
  formatCaption: (caption) => {
2002
2017
  const text2 = format(caption, "LLLL", { locale });
@@ -2053,8 +2068,8 @@ import { format as format2, parse as parse2, isValid as isValid2 } from "date-fn
2053
2068
  import { ptBR as ptBR2 } from "date-fns/locale";
2054
2069
  import { DayPicker as DayPicker2 } from "react-day-picker";
2055
2070
  import { CalendarBlank as CalendarBlank2, CaretDown as CaretDown3 } from "@phosphor-icons/react";
2056
- import "react-day-picker/dist/style.css";
2057
- import "./DateRangeInput-GFYTBAQ7.css";
2071
+ import "react-day-picker/style.css";
2072
+ import "./DateRangeInput-PC5F3TTS.css";
2058
2073
  import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
2059
2074
  function canScrollElementInWheelDirection2(element, deltaY) {
2060
2075
  const hasVerticalScroll = element.scrollHeight > element.clientHeight;
@@ -2092,6 +2107,8 @@ var DateRangeInput = forwardRef15(
2092
2107
  error,
2093
2108
  required,
2094
2109
  closeLabel = "Aplicar",
2110
+ fromLabel = "De",
2111
+ toLabel = "At\xE9",
2095
2112
  id,
2096
2113
  className,
2097
2114
  disabled,
@@ -2104,7 +2121,7 @@ var DateRangeInput = forwardRef15(
2104
2121
  const value = isControlled ? controlledValue : uncontrolled;
2105
2122
  const [open, setOpen] = useState7(false);
2106
2123
  const [month, setMonth] = useState7(
2107
- isoToDate(value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date()
2124
+ isoToDate(value?.from) ?? /* @__PURE__ */ new Date()
2108
2125
  );
2109
2126
  const [showYearPicker, setShowYearPicker] = useState7(false);
2110
2127
  const selectedYearRef = useRef3(null);
@@ -2112,9 +2129,8 @@ var DateRangeInput = forwardRef15(
2112
2129
  const years = [];
2113
2130
  for (let y = 1900; y <= (/* @__PURE__ */ new Date()).getFullYear() + 10; y += 1) years.push(y);
2114
2131
  useEffect5(() => {
2115
- var _a;
2116
2132
  if (!showYearPicker) return;
2117
- (_a = selectedYearRef.current) == null ? void 0 : _a.scrollIntoView({ block: "center" });
2133
+ selectedYearRef.current?.scrollIntoView({ block: "center" });
2118
2134
  const list = yearListRef.current;
2119
2135
  if (!list) return;
2120
2136
  const handleWheel = (event) => {
@@ -2129,37 +2145,38 @@ var DateRangeInput = forwardRef15(
2129
2145
  const helperId = helper ? `${triggerId}-helper` : void 0;
2130
2146
  const errorId = error ? `${triggerId}-error` : void 0;
2131
2147
  const describedBy = [helperId, errorId].filter(Boolean).join(" ") || void 0;
2132
- const fromDisplay = formatDisplay(value == null ? void 0 : value.from);
2133
- const toDisplay = formatDisplay(value == null ? void 0 : value.to);
2134
- const hasValue = Boolean((value == null ? void 0 : value.from) || (value == null ? void 0 : value.to));
2148
+ const fromDisplay = formatDisplay(value?.from);
2149
+ const toDisplay = formatDisplay(value?.to);
2150
+ const hasValue = Boolean(value?.from || value?.to);
2135
2151
  const rangeValue = (() => {
2136
- const from = isoToDate(value == null ? void 0 : value.from);
2137
- const to = isoToDate(value == null ? void 0 : value.to);
2152
+ const from = isoToDate(value?.from);
2153
+ const to = isoToDate(value?.to);
2138
2154
  if (!from && !to) return void 0;
2139
2155
  return { from, to };
2140
2156
  })();
2141
2157
  const handleSelect = (range) => {
2142
2158
  const next = {
2143
- from: dateToIso(range == null ? void 0 : range.from),
2144
- to: dateToIso(range == null ? void 0 : range.to)
2159
+ from: dateToIso(range?.from),
2160
+ to: dateToIso(range?.to)
2145
2161
  };
2146
2162
  if (!isControlled) setUncontrolled(next);
2147
- onChange == null ? void 0 : onChange(next);
2163
+ onChange?.(next);
2148
2164
  };
2149
2165
  const handleClear = () => {
2150
2166
  const next = {};
2151
2167
  if (!isControlled) setUncontrolled(next);
2152
- onChange == null ? void 0 : onChange(next);
2168
+ onChange?.(next);
2153
2169
  };
2154
2170
  const displayText = hasValue ? `${fromDisplay || "\u2014"} \u2192 ${toDisplay || "\u2014"}` : "";
2155
- const headerRange = (() => {
2156
- const fromD = isoToDate(value == null ? void 0 : value.from);
2157
- const toD = isoToDate(value == null ? void 0 : value.to);
2158
- const fromTxt = fromD ? format2(fromD, "d MMM", { locale: ptBR2 }) : null;
2159
- const toTxt = toD ? format2(toD, "d MMM", { locale: ptBR2 }) : null;
2160
- if (!fromTxt && !toTxt) return "Selecionar per\xEDodo";
2161
- return `${fromTxt ?? "\u2026"} \u2013 ${toTxt ?? "\u2026"}`;
2171
+ const headerFrom = (() => {
2172
+ const d = isoToDate(value?.from);
2173
+ return d ? format2(d, "d MMM", { locale: ptBR2 }) : "\u2014";
2174
+ })();
2175
+ const headerTo = (() => {
2176
+ const d = isoToDate(value?.to);
2177
+ return d ? format2(d, "d MMM", { locale: ptBR2 }) : "\u2014";
2162
2178
  })();
2179
+ const proximoCampo = !value?.from ? "from" : !value?.to ? "to" : null;
2163
2180
  return /* @__PURE__ */ jsxs13("div", { className: "relative w-full", children: [
2164
2181
  /* @__PURE__ */ jsxs13(
2165
2182
  Popover,
@@ -2168,7 +2185,7 @@ var DateRangeInput = forwardRef15(
2168
2185
  onOpenChange: (next) => {
2169
2186
  setOpen(next);
2170
2187
  if (next) {
2171
- setMonth(isoToDate(value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date());
2188
+ setMonth(isoToDate(value?.from) ?? /* @__PURE__ */ new Date());
2172
2189
  setShowYearPicker(false);
2173
2190
  }
2174
2191
  },
@@ -2219,37 +2236,85 @@ var DateRangeInput = forwardRef15(
2219
2236
  }
2220
2237
  ),
2221
2238
  /* @__PURE__ */ jsx21(Popover.Content, { size: "auto", align: "start", className: "p-0", children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col overflow-hidden rounded-v2-md", children: [
2222
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-3 bg-v2-action-primary px-4 py-3 text-v2-action-on-primary", children: [
2223
- /* @__PURE__ */ jsx21("div", { className: "text-v2-xl font-bold leading-tight", children: headerRange }),
2224
- /* @__PURE__ */ jsxs13(
2225
- "button",
2226
- {
2227
- type: "button",
2228
- onClick: () => setShowYearPicker((prev) => !prev),
2229
- "aria-expanded": showYearPicker,
2230
- "aria-label": "Selecionar ano",
2231
- className: cn(
2232
- "inline-flex shrink-0 items-center gap-1 rounded-v2-pill border border-v2-action-on-primary/40 px-2.5 py-1 text-v2-sm font-bold tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-action-on-primary/50",
2233
- showYearPicker ? "bg-v2-action-on-primary/20" : "hover:bg-v2-action-on-primary/15"
2234
- ),
2235
- children: [
2236
- format2(month, "yyyy", { locale: ptBR2 }),
2237
- /* @__PURE__ */ jsx21(
2238
- CaretDown3,
2239
+ /* @__PURE__ */ jsxs13(
2240
+ "div",
2241
+ {
2242
+ className: "relative flex items-center gap-3 bg-v2-action-primary px-4 py-3 text-v2-action-on-primary",
2243
+ "aria-live": "polite",
2244
+ children: [
2245
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-1 gap-6", children: [
2246
+ /* @__PURE__ */ jsxs13(
2247
+ "div",
2239
2248
  {
2240
- size: 12,
2241
- weight: "bold",
2242
- "aria-hidden": "true",
2243
- className: cn(
2244
- "transition-transform",
2245
- showYearPicker && "rotate-180"
2246
- )
2249
+ className: "flex min-w-0 flex-1 flex-col items-center px-20 text-center",
2250
+ "aria-current": proximoCampo === "from" ? "step" : void 0,
2251
+ children: [
2252
+ /* @__PURE__ */ jsx21("span", { className: "max-w-full truncate text-[11px] font-bold uppercase tracking-wide text-v2-action-on-primary/75", children: fromLabel }),
2253
+ /* @__PURE__ */ jsx21(
2254
+ "span",
2255
+ {
2256
+ className: cn(
2257
+ "truncate text-v2-lg font-bold leading-tight",
2258
+ proximoCampo === "from" && "underline decoration-2 underline-offset-4"
2259
+ ),
2260
+ children: headerFrom
2261
+ }
2262
+ )
2263
+ ]
2264
+ }
2265
+ ),
2266
+ /* @__PURE__ */ jsxs13(
2267
+ "div",
2268
+ {
2269
+ className: "flex min-w-0 flex-1 flex-col items-center px-20 text-center",
2270
+ "aria-current": proximoCampo === "to" ? "step" : void 0,
2271
+ children: [
2272
+ /* @__PURE__ */ jsx21("span", { className: "max-w-full truncate text-[11px] font-bold uppercase tracking-wide text-v2-action-on-primary/75", children: toLabel }),
2273
+ /* @__PURE__ */ jsx21(
2274
+ "span",
2275
+ {
2276
+ className: cn(
2277
+ "truncate text-v2-lg font-bold leading-tight",
2278
+ proximoCampo === "to" && "underline decoration-2 underline-offset-4"
2279
+ ),
2280
+ children: headerTo
2281
+ }
2282
+ )
2283
+ ]
2247
2284
  }
2248
2285
  )
2249
- ]
2250
- }
2251
- )
2252
- ] }),
2286
+ ] }),
2287
+ /* @__PURE__ */ jsxs13(
2288
+ "button",
2289
+ {
2290
+ type: "button",
2291
+ onClick: () => setShowYearPicker((prev) => !prev),
2292
+ "aria-expanded": showYearPicker,
2293
+ "aria-label": "Selecionar ano",
2294
+ className: cn(
2295
+ "absolute right-4 inline-flex shrink-0 items-center gap-1 rounded-v2-pill border border-v2-action-on-primary/40 px-2.5 py-1 text-v2-sm font-bold tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-action-on-primary/50",
2296
+ showYearPicker ? "bg-v2-action-on-primary/20" : "hover:bg-v2-action-on-primary/15"
2297
+ ),
2298
+ children: [
2299
+ format2(month, "yyyy", { locale: ptBR2 }),
2300
+ /* @__PURE__ */ jsx21(
2301
+ CaretDown3,
2302
+ {
2303
+ size: 12,
2304
+ weight: "bold",
2305
+ "aria-hidden": "true",
2306
+ className: cn(
2307
+ "transition-transform",
2308
+ showYearPicker && "rotate-180"
2309
+ )
2310
+ }
2311
+ )
2312
+ ]
2313
+ }
2314
+ )
2315
+ ]
2316
+ }
2317
+ ),
2253
2318
  showYearPicker ? /* @__PURE__ */ jsx21(
2254
2319
  "div",
2255
2320
  {
@@ -2287,6 +2352,7 @@ var DateRangeInput = forwardRef15(
2287
2352
  ) : /* @__PURE__ */ jsx21(
2288
2353
  DayPicker2,
2289
2354
  {
2355
+ navLayout: "around",
2290
2356
  mode: "range",
2291
2357
  numberOfMonths: 2,
2292
2358
  month,
@@ -2294,7 +2360,22 @@ var DateRangeInput = forwardRef15(
2294
2360
  selected: rangeValue,
2295
2361
  onSelect: handleSelect,
2296
2362
  locale: ptBR2,
2297
- className: "rdp-v2 rdp-v2-range p-3",
2363
+ className: "rdp-v2-range p-3",
2364
+ labels: {
2365
+ labelDayButton: (date, modifiers) => {
2366
+ let texto = format2(date, "PPPP", { locale: ptBR2 });
2367
+ if (modifiers.today) texto = `Hoje, ${texto}`;
2368
+ if (modifiers.range_start)
2369
+ texto = `${texto}, in\xEDcio do per\xEDodo`;
2370
+ else if (modifiers.range_end)
2371
+ texto = `${texto}, fim do per\xEDodo`;
2372
+ else if (modifiers.selected)
2373
+ texto = `${texto}, dentro do per\xEDodo`;
2374
+ return texto;
2375
+ },
2376
+ labelPrevious: () => "M\xEAs anterior",
2377
+ labelNext: () => "Pr\xF3ximo m\xEAs"
2378
+ },
2298
2379
  formatters: {
2299
2380
  formatCaption: (caption) => {
2300
2381
  const text = format2(caption, "LLLL", { locale: ptBR2 });
@@ -2530,7 +2611,7 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2530
2611
  // src/primitives/Dropdown/Dropdown.styles.ts
2531
2612
  import { cva as cva9 } from "class-variance-authority";
2532
2613
  var dropdownContentStyles = cva9(
2533
- "z-50 min-w-[10rem] overflow-hidden rounded-v2-md border border-v2-border-default bg-v2-panel p-1 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none"
2614
+ "pointer-events-auto z-50 min-w-[10rem] overflow-hidden rounded-v2-md border border-v2-border-default bg-v2-panel p-1 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none"
2534
2615
  );
2535
2616
  var dropdownItemStyles = cva9(
2536
2617
  "relative flex cursor-pointer select-none items-center gap-2 rounded-v2-sm px-2 py-1.5 text-v2-sm outline-none transition-colors data-[highlighted]:bg-v2-row-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -2613,7 +2694,7 @@ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
2613
2694
  // src/primitives/ContextMenu/ContextMenu.styles.ts
2614
2695
  import { cva as cva10 } from "class-variance-authority";
2615
2696
  var contextMenuContentStyles = cva10(
2616
- "z-50 min-w-[10rem] overflow-hidden rounded-v2-md border border-v2-border-default bg-v2-panel p-1 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 motion-reduce:animate-none"
2697
+ "pointer-events-auto z-50 min-w-[10rem] overflow-hidden rounded-v2-md border border-v2-border-default bg-v2-panel p-1 text-v2-fg-default shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 motion-reduce:animate-none"
2617
2698
  );
2618
2699
  var contextMenuItemStyles = cva10(
2619
2700
  "relative flex cursor-pointer select-none items-center gap-2 rounded-v2-sm px-2 py-1.5 text-v2-sm outline-none transition-colors data-[highlighted]:bg-v2-row-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -2696,13 +2777,13 @@ var CopyButton = forwardRef19(
2696
2777
  ({ textToCopy, children, unstyled = false, className, onClick, ...props }, ref) => {
2697
2778
  const [copied, setCopied] = useState8(false);
2698
2779
  function handleClick(event) {
2699
- if (navigator == null ? void 0 : navigator.clipboard) {
2780
+ if (navigator?.clipboard) {
2700
2781
  navigator.clipboard.writeText(textToCopy).then(() => {
2701
2782
  setCopied(true);
2702
2783
  window.setTimeout(() => setCopied(false), 1500);
2703
2784
  });
2704
2785
  }
2705
- onClick == null ? void 0 : onClick(event);
2786
+ onClick?.(event);
2706
2787
  }
2707
2788
  return /* @__PURE__ */ jsxs15(
2708
2789
  "button",
@@ -2882,8 +2963,7 @@ var FileUpload = forwardRef21(
2882
2963
  if (accept) {
2883
2964
  const accepted = accept.split(",").map((s) => s.trim());
2884
2965
  const invalid = selectedFiles.find((f) => {
2885
- var _a;
2886
- const ext = "." + ((_a = f.name.split(".").pop()) == null ? void 0 : _a.toLowerCase());
2966
+ const ext = "." + f.name.split(".").pop()?.toLowerCase();
2887
2967
  const mimeType = f.type;
2888
2968
  return !accepted.some((a) => {
2889
2969
  if (a.startsWith(".")) return a.toLowerCase() === ext;
@@ -2948,15 +3028,11 @@ var FileUpload = forwardRef21(
2948
3028
  role: "button",
2949
3029
  tabIndex: disabled ? -1 : 0,
2950
3030
  "aria-disabled": disabled || void 0,
2951
- onClick: () => {
2952
- var _a;
2953
- return !disabled && ((_a = inputRef.current) == null ? void 0 : _a.click());
2954
- },
3031
+ onClick: () => !disabled && inputRef.current?.click(),
2955
3032
  onKeyDown: (e) => {
2956
- var _a;
2957
3033
  if ((e.key === "Enter" || e.key === " ") && !disabled) {
2958
3034
  e.preventDefault();
2959
- (_a = inputRef.current) == null ? void 0 : _a.click();
3035
+ inputRef.current?.click();
2960
3036
  }
2961
3037
  },
2962
3038
  onDragEnter: (e) => {
@@ -3084,9 +3160,9 @@ function AttachedFile({
3084
3160
  }, [file, isImage]);
3085
3161
  function replaceWith(next) {
3086
3162
  if (!next) return;
3087
- const validationError = validate == null ? void 0 : validate(next);
3163
+ const validationError = validate?.(next);
3088
3164
  if (validationError) {
3089
- onValidationError == null ? void 0 : onValidationError(validationError);
3165
+ onValidationError?.(validationError);
3090
3166
  return;
3091
3167
  }
3092
3168
  onSelect(next);
@@ -3100,10 +3176,9 @@ function AttachedFile({
3100
3176
  },
3101
3177
  onDragLeave: () => setDragOver(false),
3102
3178
  onDrop: (event) => {
3103
- var _a;
3104
3179
  event.preventDefault();
3105
3180
  setDragOver(false);
3106
- replaceWith((_a = event.dataTransfer.files) == null ? void 0 : _a[0]);
3181
+ replaceWith(event.dataTransfer.files?.[0]);
3107
3182
  },
3108
3183
  className: cn(
3109
3184
  "flex items-center gap-3 rounded-v2-md border bg-v2-panel p-2.5 transition-colors",
@@ -3118,8 +3193,7 @@ function AttachedFile({
3118
3193
  accept,
3119
3194
  className: "hidden",
3120
3195
  onChange: (event) => {
3121
- var _a;
3122
- replaceWith((_a = event.target.files) == null ? void 0 : _a[0]);
3196
+ replaceWith(event.target.files?.[0]);
3123
3197
  event.target.value = "";
3124
3198
  }
3125
3199
  }
@@ -3157,10 +3231,7 @@ function AttachedFile({
3157
3231
  "button",
3158
3232
  {
3159
3233
  type: "button",
3160
- onClick: () => {
3161
- var _a;
3162
- return (_a = inputRef.current) == null ? void 0 : _a.click();
3163
- },
3234
+ onClick: () => inputRef.current?.click(),
3164
3235
  "aria-label": "Trocar arquivo",
3165
3236
  title: "Trocar",
3166
3237
  className: "inline-flex size-7 items-center justify-center rounded-v2-sm text-v2-fg-muted transition-colors hover:bg-v2-raised hover:text-v2-action-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-v2-action-primary",
@@ -3613,8 +3684,7 @@ var ImageUpload = forwardRef25(
3613
3684
  const [internalError, setInternalError] = useState13(null);
3614
3685
  const displayError = error ?? internalError;
3615
3686
  const handleSelect = async (e) => {
3616
- var _a;
3617
- const file = ((_a = e.currentTarget.files) == null ? void 0 : _a[0]) ?? null;
3687
+ const file = e.currentTarget.files?.[0] ?? null;
3618
3688
  if (!file) return;
3619
3689
  if (maxSize && file.size > maxSize) {
3620
3690
  setInternalError(
@@ -3641,10 +3711,7 @@ var ImageUpload = forwardRef25(
3641
3711
  {
3642
3712
  type: "button",
3643
3713
  disabled,
3644
- onClick: () => {
3645
- var _a;
3646
- return (_a = inputRef.current) == null ? void 0 : _a.click();
3647
- },
3714
+ onClick: () => inputRef.current?.click(),
3648
3715
  className: triggerClassName,
3649
3716
  children: [
3650
3717
  /* @__PURE__ */ jsx37(UploadSimple, { size: 14, weight: "bold", "aria-hidden": "true" }),
@@ -3758,7 +3825,7 @@ function MoneyInput({
3758
3825
  }, [formatted]);
3759
3826
  const handleChange = (e) => {
3760
3827
  const next = e.target.value.replace(/\D/g, "");
3761
- onValueChange == null ? void 0 : onValueChange(formatBRL(next), next);
3828
+ onValueChange?.(formatBRL(next), next);
3762
3829
  };
3763
3830
  const handleFocus = (e) => {
3764
3831
  setCaretToEnd(e.currentTarget);
@@ -3823,7 +3890,7 @@ var MultiCombobox = forwardRef26(
3823
3890
  );
3824
3891
  const setValue = (next) => {
3825
3892
  if (value === void 0) setInternalValue(next);
3826
- onValueChange == null ? void 0 : onValueChange(next);
3893
+ onValueChange?.(next);
3827
3894
  };
3828
3895
  const handleToggle = (itemValue) => {
3829
3896
  if (currentValue.includes(itemValue)) {
@@ -3845,9 +3912,8 @@ var MultiCombobox = forwardRef26(
3845
3912
  }
3846
3913
  };
3847
3914
  useEffect9(() => {
3848
- var _a;
3849
3915
  if (open) {
3850
- (_a = searchInputRef.current) == null ? void 0 : _a.focus();
3916
+ searchInputRef.current?.focus();
3851
3917
  } else {
3852
3918
  setQuery("");
3853
3919
  }
@@ -4260,7 +4326,7 @@ function PercentInput({
4260
4326
  }, [formatted]);
4261
4327
  const handleChange = (e) => {
4262
4328
  const next = e.target.value.replace(/\D/g, "").slice(0, 5);
4263
- onValueChange == null ? void 0 : onValueChange(formatPercent(next), next);
4329
+ onValueChange?.(formatPercent(next), next);
4264
4330
  };
4265
4331
  const handleFocus = (e) => {
4266
4332
  setCaretToEditEnd(e.currentTarget);
@@ -4819,7 +4885,7 @@ var ThemeToggle = forwardRef36(
4819
4885
  } catch (error) {
4820
4886
  console.warn("[ThemeToggle] localStorage write failed", error);
4821
4887
  }
4822
- onClick == null ? void 0 : onClick(event);
4888
+ onClick?.(event);
4823
4889
  },
4824
4890
  [preference, storageKey, onClick]
4825
4891
  );
@@ -5377,7 +5443,7 @@ var Sidebar = forwardRef39(function Sidebar2({
5377
5443
  window.localStorage.setItem(COLLAPSED_STORAGE_KEY, String(next));
5378
5444
  } catch {
5379
5445
  }
5380
- onCollapseChange == null ? void 0 : onCollapseChange(next);
5446
+ onCollapseChange?.(next);
5381
5447
  }, [collapsed, isControlled, onCollapseChange]);
5382
5448
  useEffect11(() => {
5383
5449
  if (!enableShortcut || typeof window === "undefined") return;
@@ -5570,7 +5636,7 @@ var DEFAULT_HEADER_SLOT = /* @__PURE__ */ jsxs37("span", { className: "flex item
5570
5636
  ] });
5571
5637
  function AppShell({
5572
5638
  children,
5573
- sidebarGroups = DEFAULT_GROUPS,
5639
+ sidebarGroups,
5574
5640
  currentPath,
5575
5641
  linkComponent,
5576
5642
  pageTitle,
@@ -5578,7 +5644,7 @@ function AppShell({
5578
5644
  notificationCenter,
5579
5645
  themeToggle,
5580
5646
  userMenu,
5581
- headerSlot = DEFAULT_HEADER_SLOT,
5647
+ headerSlot,
5582
5648
  defaultSidebarCollapsed = false
5583
5649
  }) {
5584
5650
  return /* @__PURE__ */ jsxs37("div", { className: "flex h-screen overflow-hidden bg-v2-canvas text-v2-fg-default", children: [
@@ -5593,11 +5659,11 @@ function AppShell({
5593
5659
  /* @__PURE__ */ jsx59(
5594
5660
  Sidebar,
5595
5661
  {
5596
- groups: sidebarGroups,
5662
+ groups: sidebarGroups ?? DEFAULT_GROUPS,
5597
5663
  currentPath,
5598
5664
  linkComponent,
5599
5665
  defaultCollapsed: defaultSidebarCollapsed,
5600
- headerSlot
5666
+ headerSlot: headerSlot ?? DEFAULT_HEADER_SLOT
5601
5667
  }
5602
5668
  ),
5603
5669
  /* @__PURE__ */ jsxs37("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
@@ -5824,7 +5890,7 @@ var markdownComponents = {
5824
5890
  ol: ({ children }) => /* @__PURE__ */ jsx62("ol", { className: "ml-6 flex list-decimal flex-col gap-1 text-v2-base text-v2-fg-default", children }),
5825
5891
  li: ({ children }) => /* @__PURE__ */ jsx62("li", { children }),
5826
5892
  a: ({ href, children }) => {
5827
- const isExternal = href == null ? void 0 : href.startsWith("http");
5893
+ const isExternal = href?.startsWith("http");
5828
5894
  return /* @__PURE__ */ jsx62(
5829
5895
  "a",
5830
5896
  {
@@ -5940,7 +6006,7 @@ var SortableColumnHeader = forwardRef41(
5940
6006
  className
5941
6007
  ),
5942
6008
  onClick: (event) => {
5943
- onClick == null ? void 0 : onClick(event);
6009
+ onClick?.(event);
5944
6010
  if (event.defaultPrevented) return;
5945
6011
  onDirectionChange(nextDirection(direction, cycleMode));
5946
6012
  },
@@ -6063,7 +6129,7 @@ function DataTableInner({
6063
6129
  className: cn(
6064
6130
  "border-b border-v2-border-default transition-colors hover:bg-v2-row-hover",
6065
6131
  zebra && index % 2 === 1 && "bg-v2-bg-subtle/50",
6066
- rowClassName == null ? void 0 : rowClassName(row, index)
6132
+ rowClassName?.(row, index)
6067
6133
  ),
6068
6134
  children: columns.map((col) => /* @__PURE__ */ jsx64(
6069
6135
  "td",
@@ -6316,17 +6382,17 @@ function ReadOnlyDataView({
6316
6382
  const handleHeaderClick = (column) => {
6317
6383
  if (column.type === "action") return;
6318
6384
  if (!column.sortable || !onSortChange) return;
6319
- const next = (sortValue == null ? void 0 : sortValue.column) === column.key && sortValue.direction === "asc" ? "desc" : "asc";
6385
+ const next = sortValue?.column === column.key && sortValue.direction === "asc" ? "desc" : "asc";
6320
6386
  onSortChange(column.key, next);
6321
6387
  };
6322
6388
  const handleCellClick = async (column, row) => {
6323
6389
  if (column.type === "action") return;
6324
- const dialog = detailsDialogs == null ? void 0 : detailsDialogs.find((d) => d.triggerColumn === column.key);
6390
+ const dialog = detailsDialogs?.find((d) => d.triggerColumn === column.key);
6325
6391
  if (!dialog) return;
6326
6392
  const result = await dialog.fetchDetails(row);
6327
6393
  setActiveDialog({ dialog, row, details: result });
6328
6394
  };
6329
- const hasTriggerColumn = (column) => column.type !== "action" && Boolean(detailsDialogs == null ? void 0 : detailsDialogs.some((d) => d.triggerColumn === column.key));
6395
+ const hasTriggerColumn = (column) => column.type !== "action" && Boolean(detailsDialogs?.some((d) => d.triggerColumn === column.key));
6330
6396
  return /* @__PURE__ */ jsxs44(Fragment9, { children: [
6331
6397
  /* @__PURE__ */ jsx66(
6332
6398
  Card,
@@ -6338,7 +6404,7 @@ function ReadOnlyDataView({
6338
6404
  caption && /* @__PURE__ */ jsx66("caption", { className: "sr-only", children: caption }),
6339
6405
  /* @__PURE__ */ jsx66("thead", { className: "bg-v2-bg-subtle", children: /* @__PURE__ */ jsx66("tr", { children: columns.map((column) => {
6340
6406
  const isSortable = column.type !== "action" && Boolean(column.sortable);
6341
- const isSorted = column.type !== "action" && (sortValue == null ? void 0 : sortValue.column) === column.key;
6407
+ const isSorted = column.type !== "action" && sortValue?.column === column.key;
6342
6408
  return /* @__PURE__ */ jsx66(
6343
6409
  "th",
6344
6410
  {
@@ -6350,7 +6416,7 @@ function ReadOnlyDataView({
6350
6416
  column.type === "text" || column.type === "action" ? column.align : "left"
6351
6417
  )
6352
6418
  ),
6353
- "aria-sort": isSorted ? (sortValue == null ? void 0 : sortValue.direction) === "asc" ? "ascending" : "descending" : isSortable ? "none" : void 0,
6419
+ "aria-sort": isSorted ? sortValue?.direction === "asc" ? "ascending" : "descending" : isSortable ? "none" : void 0,
6354
6420
  children: isSortable ? /* @__PURE__ */ jsxs44(
6355
6421
  "button",
6356
6422
  {
@@ -6359,7 +6425,7 @@ function ReadOnlyDataView({
6359
6425
  className: "inline-flex items-center gap-1 text-v2-fg-muted hover:text-v2-fg-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-v2-focus-ring/30 motion-reduce:transition-none",
6360
6426
  children: [
6361
6427
  column.label,
6362
- isSorted ? (sortValue == null ? void 0 : sortValue.direction) === "asc" ? /* @__PURE__ */ jsx66(
6428
+ isSorted ? sortValue?.direction === "asc" ? /* @__PURE__ */ jsx66(
6363
6429
  CaretUp2,
6364
6430
  {
6365
6431
  size: 12,
@@ -6450,7 +6516,6 @@ function ReadOnlyDataView({
6450
6516
  }
6451
6517
  ReadOnlyDataView.displayName = "ReadOnlyDataView";
6452
6518
  function renderCell(column, row) {
6453
- var _a;
6454
6519
  if (column.type === "action") {
6455
6520
  return column.render(row);
6456
6521
  }
@@ -6462,7 +6527,7 @@ function renderCell(column, row) {
6462
6527
  if (raw === null || raw === void 0) return "\u2014";
6463
6528
  const value = String(raw);
6464
6529
  const variant = column.variantMap[value] ?? "default";
6465
- const display = ((_a = column.labelMap) == null ? void 0 : _a[value]) ?? value;
6530
+ const display = column.labelMap?.[value] ?? value;
6466
6531
  return /* @__PURE__ */ jsx66(Badge, { variant, children: display });
6467
6532
  }
6468
6533
  if (column.type === "date") {
@@ -6587,7 +6652,7 @@ var NotificationCenter = forwardRef44(
6587
6652
  "button",
6588
6653
  {
6589
6654
  type: "button",
6590
- onClick: () => onItemClick == null ? void 0 : onItemClick(n),
6655
+ onClick: () => onItemClick?.(n),
6591
6656
  className: cn(
6592
6657
  "flex w-full items-start gap-3 border-b border-v2-border-default px-4 py-3 text-left transition-colors hover:bg-v2-bg-subtle last:border-b-0",
6593
6658
  !n.read && "bg-v2-brand-bg-soft/30"
@@ -6909,15 +6974,13 @@ function CommandPalette({
6909
6974
  const flatItems = groups.flatMap((g) => g.items.filter((i) => !i.disabled));
6910
6975
  const filteredGroups = groups.filter((g) => g.loading || g.items.length > 0);
6911
6976
  useEffect12(() => {
6912
- var _a;
6913
6977
  if (open) {
6914
- (_a = inputRef.current) == null ? void 0 : _a.focus();
6978
+ inputRef.current?.focus();
6915
6979
  }
6916
6980
  }, [open]);
6917
6981
  useEffect12(() => {
6918
- var _a;
6919
6982
  if (open) {
6920
- setHighlightedId(((_a = flatItems[0]) == null ? void 0 : _a.id) ?? null);
6983
+ setHighlightedId(flatItems[0]?.id ?? null);
6921
6984
  }
6922
6985
  }, [open, groups]);
6923
6986
  useEffect12(() => {
@@ -6932,13 +6995,11 @@ function CommandPalette({
6932
6995
  return () => window.removeEventListener("keydown", handler);
6933
6996
  }, [enableShortcut, open, onOpenChange]);
6934
6997
  const selectItem = (item) => {
6935
- var _a;
6936
- onItemSelect == null ? void 0 : onItemSelect(item);
6937
- (_a = item.onSelect) == null ? void 0 : _a.call(item);
6998
+ onItemSelect?.(item);
6999
+ item.onSelect?.();
6938
7000
  onOpenChange(false);
6939
7001
  };
6940
7002
  const handleInputKeyDown = (e) => {
6941
- var _a, _b;
6942
7003
  if (e.key === "Escape") {
6943
7004
  e.preventDefault();
6944
7005
  onOpenChange(false);
@@ -6948,11 +7009,11 @@ function CommandPalette({
6948
7009
  const idx = flatItems.findIndex((i) => i.id === highlightedId);
6949
7010
  if (e.key === "ArrowDown") {
6950
7011
  e.preventDefault();
6951
- setHighlightedId(((_a = flatItems[(idx + 1) % flatItems.length]) == null ? void 0 : _a.id) ?? null);
7012
+ setHighlightedId(flatItems[(idx + 1) % flatItems.length]?.id ?? null);
6952
7013
  } else if (e.key === "ArrowUp") {
6953
7014
  e.preventDefault();
6954
7015
  setHighlightedId(
6955
- ((_b = flatItems[(idx - 1 + flatItems.length) % flatItems.length]) == null ? void 0 : _b.id) ?? null
7016
+ flatItems[(idx - 1 + flatItems.length) % flatItems.length]?.id ?? null
6956
7017
  );
6957
7018
  } else if (e.key === "Enter") {
6958
7019
  e.preventDefault();
@@ -7003,7 +7064,7 @@ function CommandPalette({
7003
7064
  onChange: (e) => {
7004
7065
  const v = e.target.value;
7005
7066
  setQueryValue(v);
7006
- onQueryChange == null ? void 0 : onQueryChange(v);
7067
+ onQueryChange?.(v);
7007
7068
  },
7008
7069
  onKeyDown: handleInputKeyDown,
7009
7070
  className: "flex-1 bg-transparent text-v2-base font-medium text-v2-fg-default placeholder:font-normal placeholder:text-v2-fg-subtle focus:outline-none"
@@ -7147,7 +7208,7 @@ var ChartTimeSeries = forwardRef50(
7147
7208
  const activeRange = range ?? internalRange;
7148
7209
  const handleRangeChange = (next) => {
7149
7210
  if (range === void 0) setInternalRange(next);
7150
- onRangeChange == null ? void 0 : onRangeChange(next);
7211
+ onRangeChange?.(next);
7151
7212
  };
7152
7213
  const id = useId16();
7153
7214
  const gradientId = `chart-ts-${id.replace(/[:]/g, "")}`;
@@ -7309,8 +7370,7 @@ function ChartTooltip({
7309
7370
  valueFormatter,
7310
7371
  secondaryFormatter
7311
7372
  }) {
7312
- var _a;
7313
- const slice = (_a = payload == null ? void 0 : payload[0]) == null ? void 0 : _a.payload;
7373
+ const slice = payload?.[0]?.payload;
7314
7374
  if (!active || !slice) return null;
7315
7375
  return /* @__PURE__ */ jsxs53("div", { className: "rounded-v2-md border border-v2-border-default bg-v2-panel px-3 py-2 text-v2-xs shadow-lg", children: [
7316
7376
  /* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-2", children: [
@@ -8019,7 +8079,7 @@ function FilterBarV2({
8019
8079
  const open = isOpenControlled ? controlledOpen : internalOpen;
8020
8080
  const setOpen = (next) => {
8021
8081
  if (!isOpenControlled) setInternalOpen(next);
8022
- onOpenChange == null ? void 0 : onOpenChange(next);
8082
+ onOpenChange?.(next);
8023
8083
  };
8024
8084
  const [draftValues, setDraftValues] = useState24(
8025
8085
  controlledValues ?? defaultValues ?? {}
@@ -8454,7 +8514,7 @@ function ChartTooltip2({
8454
8514
  formatValue,
8455
8515
  formatLabel
8456
8516
  }) {
8457
- if (!active || !(payload == null ? void 0 : payload.length)) return null;
8517
+ if (!active || !payload?.length) return null;
8458
8518
  return /* @__PURE__ */ jsxs62("div", { className: "rounded-v2-md border border-v2-border-default bg-v2-panel px-3 py-2 text-v2-xs shadow-lg", children: [
8459
8519
  /* @__PURE__ */ jsx84("p", { className: "font-semibold text-v2-fg-default", children: formatLabel(label ?? "") }),
8460
8520
  /* @__PURE__ */ jsx84("div", { className: "mt-1 flex flex-col gap-0.5", children: payload.map((p) => /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
@@ -8746,7 +8806,7 @@ function ChartTooltip3({
8746
8806
  formatValue,
8747
8807
  formatLabel
8748
8808
  }) {
8749
- if (!active || !(payload == null ? void 0 : payload.length)) return null;
8809
+ if (!active || !payload?.length) return null;
8750
8810
  const total = payload.reduce(
8751
8811
  (sum, p) => sum + (typeof p.value === "number" ? p.value : 0),
8752
8812
  0
@@ -8878,9 +8938,8 @@ function NodeCard({
8878
8938
  selected,
8879
8939
  onSelect
8880
8940
  }) {
8881
- var _a, _b;
8882
- const rulesCount = ((_a = node.rules) == null ? void 0 : _a.length) ?? 0;
8883
- const actionsCount = ((_b = node.actions) == null ? void 0 : _b.length) ?? 0;
8941
+ const rulesCount = node.rules?.length ?? 0;
8942
+ const actionsCount = node.actions?.length ?? 0;
8884
8943
  return /* @__PURE__ */ jsxs66(
8885
8944
  "button",
8886
8945
  {
@@ -8967,7 +9026,7 @@ function WorkflowDesigner({
8967
9026
  }) {
8968
9027
  const showPanel = showSidePanel !== false && selectedNodeId !== void 0;
8969
9028
  const handleNodeSelect = (id) => {
8970
- onNodeSelect == null ? void 0 : onNodeSelect(id === selectedNodeId ? null : id);
9029
+ onNodeSelect?.(id === selectedNodeId ? null : id);
8971
9030
  };
8972
9031
  const colCount = phases.length;
8973
9032
  return /* @__PURE__ */ jsxs66("div", { className: cn("flex gap-4", className), ...props, children: [