@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.js CHANGED
@@ -340,9 +340,8 @@ function SuspenseSkeleton({
340
340
 
341
341
  // src/lib/platform.ts
342
342
  function isMacOS() {
343
- var _a;
344
343
  if (typeof navigator === "undefined") return false;
345
- const platform = (((_a = navigator.userAgentData) == null ? void 0 : _a.platform) || navigator.platform || navigator.userAgent || "").toLowerCase();
344
+ const platform = (navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || "").toLowerCase();
346
345
  return platform.includes("mac");
347
346
  }
348
347
  function getShortcutLabel(key) {
@@ -364,8 +363,7 @@ var IMAGE_EXTENSIONS = [
364
363
  "avif"
365
364
  ];
366
365
  function getExtension(fileName) {
367
- var _a;
368
- return ((_a = fileName == null ? void 0 : fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase()) ?? "";
366
+ return fileName?.split(".").pop()?.toLowerCase() ?? "";
369
367
  }
370
368
  function isImageFile(mimeType, fileName) {
371
369
  if (mimeType) {
@@ -639,7 +637,7 @@ var Button = (0, import_react7.forwardRef)(
639
637
  event.stopPropagation();
640
638
  return;
641
639
  }
642
- onClick == null ? void 0 : onClick(event);
640
+ onClick?.(event);
643
641
  };
644
642
  const inactivityProps = asChild ? {
645
643
  "data-disabled": isInactive || void 0,
@@ -904,7 +902,7 @@ var MaskedInput = (0, import_react10.forwardRef)(
904
902
  const activeMask = selectMask(mask, raw);
905
903
  const formatted = applyMask(activeMask, raw);
906
904
  if (!isControlled) setInternalValue(formatted);
907
- onValueChange == null ? void 0 : onValueChange(formatted, raw);
905
+ onValueChange?.(formatted, raw);
908
906
  };
909
907
  if (floating && label) {
910
908
  const { placeholder: userPlaceholder, ...restNoPlaceholder } = rest;
@@ -1235,7 +1233,7 @@ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
1235
1233
  // src/primitives/Popover/Popover.styles.ts
1236
1234
  var import_class_variance_authority6 = require("class-variance-authority");
1237
1235
  var popoverContentStyles = (0, import_class_variance_authority6.cva)(
1238
- "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",
1236
+ "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",
1239
1237
  {
1240
1238
  variants: {
1241
1239
  size: {
@@ -1329,7 +1327,7 @@ var ColorPicker = (0, import_react15.forwardRef)(
1329
1327
  color: swatchColor,
1330
1328
  onChange: (c) => {
1331
1329
  setPickerColor(c);
1332
- onValueChange == null ? void 0 : onValueChange(c);
1330
+ onValueChange?.(c);
1333
1331
  }
1334
1332
  }
1335
1333
  ) })
@@ -1345,11 +1343,11 @@ var ColorPicker = (0, import_react15.forwardRef)(
1345
1343
  maxLength: 7,
1346
1344
  error,
1347
1345
  "aria-label": "Cor (hex)",
1348
- onChange: (e) => onValueChange == null ? void 0 : onValueChange(e.target.value),
1346
+ onChange: (e) => onValueChange?.(e.target.value),
1349
1347
  onBlur: (e) => {
1350
1348
  const trimmed = e.target.value.trim();
1351
1349
  if (trimmed && !trimmed.startsWith("#")) {
1352
- onValueChange == null ? void 0 : onValueChange(`#${trimmed}`);
1350
+ onValueChange?.(`#${trimmed}`);
1353
1351
  }
1354
1352
  }
1355
1353
  }
@@ -1415,7 +1413,7 @@ var Combobox = (0, import_react16.forwardRef)(
1415
1413
  );
1416
1414
  const handleSelect = (next) => {
1417
1415
  if (value === void 0) setInternalValue(next ?? "");
1418
- onValueChange == null ? void 0 : onValueChange(next ?? "");
1416
+ onValueChange?.(next ?? "");
1419
1417
  setOpen(false);
1420
1418
  setQuery("");
1421
1419
  };
@@ -1456,10 +1454,9 @@ var Combobox = (0, import_react16.forwardRef)(
1456
1454
  }
1457
1455
  };
1458
1456
  (0, import_react16.useEffect)(() => {
1459
- var _a, _b;
1460
1457
  if (open) {
1461
- setHighlightedValue(((_a = filteredItems[0]) == null ? void 0 : _a.value) ?? null);
1462
- (_b = searchInputRef.current) == null ? void 0 : _b.focus();
1458
+ setHighlightedValue(filteredItems[0]?.value ?? null);
1459
+ searchInputRef.current?.focus();
1463
1460
  } else {
1464
1461
  setQuery("");
1465
1462
  }
@@ -1840,9 +1837,8 @@ var import_date_fns = require("date-fns");
1840
1837
  var import_locale = require("date-fns/locale");
1841
1838
  var import_react_day_picker = require("react-day-picker");
1842
1839
  var import_react23 = require("@phosphor-icons/react");
1843
- var import_DateInput = require("./DateInput-Y73Z32X6.css");
1844
- var import_DateRangeInput = require("./DateRangeInput-GFYTBAQ7.css");
1845
- var import_style = require("react-day-picker/dist/style.css");
1840
+ var import_DateInput = require("./DateInput-ASNJQV43.css");
1841
+ var import_style = require("react-day-picker/style.css");
1846
1842
  var import_jsx_runtime20 = require("react/jsx-runtime");
1847
1843
  var DEFAULT_PATTERN = "dd/MM/yyyy";
1848
1844
  function maskDefaultPattern(raw) {
@@ -1897,6 +1893,14 @@ var DateInput = (0, import_react22.forwardRef)(
1897
1893
  const [open, setOpen] = (0, import_react22.useState)(false);
1898
1894
  const [month, setMonth] = (0, import_react22.useState)(value ?? /* @__PURE__ */ new Date());
1899
1895
  const [showYearPicker, setShowYearPicker] = (0, import_react22.useState)(false);
1896
+ const diasDesabilitados = (0, import_react22.useMemo)(() => {
1897
+ const regras = [];
1898
+ if (fromDate) regras.push({ before: fromDate });
1899
+ if (toDate) regras.push({ after: toDate });
1900
+ if (Array.isArray(disabledDates)) regras.push(...disabledDates);
1901
+ else if (disabledDates !== void 0) regras.push(disabledDates);
1902
+ return regras;
1903
+ }, [fromDate, toDate, disabledDates]);
1900
1904
  const selectedYearRef = (0, import_react22.useRef)(null);
1901
1905
  const yearListRef = (0, import_react22.useRef)(null);
1902
1906
  const generatedId = (0, import_react22.useId)();
@@ -1912,7 +1916,7 @@ var DateInput = (0, import_react22.forwardRef)(
1912
1916
  }, [displayValueText]);
1913
1917
  const commitValue = (next) => {
1914
1918
  if (!isControlled) setUncontrolled(next);
1915
- onValueChange == null ? void 0 : onValueChange(next);
1919
+ onValueChange?.(next);
1916
1920
  };
1917
1921
  const handleSelect = (next) => {
1918
1922
  commitValue(next);
@@ -1941,7 +1945,7 @@ var DateInput = (0, import_react22.forwardRef)(
1941
1945
  };
1942
1946
  const handleTextBlur = (event) => {
1943
1947
  setText(value ? formatValue(value) : "");
1944
- onBlur == null ? void 0 : onBlur(event);
1948
+ onBlur?.(event);
1945
1949
  };
1946
1950
  const hasValue = Boolean(value);
1947
1951
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
@@ -1950,9 +1954,8 @@ var DateInput = (0, import_react22.forwardRef)(
1950
1954
  const years = [];
1951
1955
  for (let y = dropdownFromYear; y <= dropdownToYear; y += 1) years.push(y);
1952
1956
  (0, import_react22.useEffect)(() => {
1953
- var _a;
1954
1957
  if (!showYearPicker) return;
1955
- (_a = selectedYearRef.current) == null ? void 0 : _a.scrollIntoView({ block: "center" });
1958
+ selectedYearRef.current?.scrollIntoView({ block: "center" });
1956
1959
  const list = yearListRef.current;
1957
1960
  if (!list) return;
1958
1961
  const handleWheel = (event) => {
@@ -2102,17 +2105,28 @@ var DateInput = (0, import_react22.forwardRef)(
2102
2105
  ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2103
2106
  import_react_day_picker.DayPicker,
2104
2107
  {
2108
+ navLayout: "around",
2105
2109
  mode: "single",
2106
2110
  selected: value,
2107
2111
  onSelect: handleSelect,
2108
2112
  month,
2109
2113
  onMonthChange: setMonth,
2110
- captionLayout: "buttons",
2111
- fromDate,
2112
- toDate,
2113
- disabled: disabledDates,
2114
+ captionLayout: "label",
2115
+ startMonth: fromDate,
2116
+ endMonth: toDate,
2117
+ disabled: diasDesabilitados,
2114
2118
  locale,
2115
- className: "rdp-v2-range rdp-v2-single p-3",
2119
+ className: "rdp-v2 rdp-v2-single p-3",
2120
+ labels: {
2121
+ labelDayButton: (date, modifiers) => {
2122
+ let texto = (0, import_date_fns.format)(date, "PPPP", { locale });
2123
+ if (modifiers.today) texto = `Hoje, ${texto}`;
2124
+ if (modifiers.selected) texto = `${texto}, selecionado`;
2125
+ return texto;
2126
+ },
2127
+ labelPrevious: () => "M\xEAs anterior",
2128
+ labelNext: () => "Pr\xF3ximo m\xEAs"
2129
+ },
2116
2130
  formatters: {
2117
2131
  formatCaption: (caption) => {
2118
2132
  const text2 = (0, import_date_fns.format)(caption, "LLLL", { locale });
@@ -2169,8 +2183,8 @@ var import_date_fns2 = require("date-fns");
2169
2183
  var import_locale2 = require("date-fns/locale");
2170
2184
  var import_react_day_picker2 = require("react-day-picker");
2171
2185
  var import_react25 = require("@phosphor-icons/react");
2172
- var import_style2 = require("react-day-picker/dist/style.css");
2173
- var import_DateRangeInput2 = require("./DateRangeInput-GFYTBAQ7.css");
2186
+ var import_style2 = require("react-day-picker/style.css");
2187
+ var import_DateRangeInput = require("./DateRangeInput-PC5F3TTS.css");
2174
2188
  var import_jsx_runtime21 = require("react/jsx-runtime");
2175
2189
  function canScrollElementInWheelDirection2(element, deltaY) {
2176
2190
  const hasVerticalScroll = element.scrollHeight > element.clientHeight;
@@ -2208,6 +2222,8 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2208
2222
  error,
2209
2223
  required,
2210
2224
  closeLabel = "Aplicar",
2225
+ fromLabel = "De",
2226
+ toLabel = "At\xE9",
2211
2227
  id,
2212
2228
  className,
2213
2229
  disabled,
@@ -2220,7 +2236,7 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2220
2236
  const value = isControlled ? controlledValue : uncontrolled;
2221
2237
  const [open, setOpen] = (0, import_react24.useState)(false);
2222
2238
  const [month, setMonth] = (0, import_react24.useState)(
2223
- isoToDate(value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date()
2239
+ isoToDate(value?.from) ?? /* @__PURE__ */ new Date()
2224
2240
  );
2225
2241
  const [showYearPicker, setShowYearPicker] = (0, import_react24.useState)(false);
2226
2242
  const selectedYearRef = (0, import_react24.useRef)(null);
@@ -2228,9 +2244,8 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2228
2244
  const years = [];
2229
2245
  for (let y = 1900; y <= (/* @__PURE__ */ new Date()).getFullYear() + 10; y += 1) years.push(y);
2230
2246
  (0, import_react24.useEffect)(() => {
2231
- var _a;
2232
2247
  if (!showYearPicker) return;
2233
- (_a = selectedYearRef.current) == null ? void 0 : _a.scrollIntoView({ block: "center" });
2248
+ selectedYearRef.current?.scrollIntoView({ block: "center" });
2234
2249
  const list = yearListRef.current;
2235
2250
  if (!list) return;
2236
2251
  const handleWheel = (event) => {
@@ -2245,37 +2260,38 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2245
2260
  const helperId = helper ? `${triggerId}-helper` : void 0;
2246
2261
  const errorId = error ? `${triggerId}-error` : void 0;
2247
2262
  const describedBy = [helperId, errorId].filter(Boolean).join(" ") || void 0;
2248
- const fromDisplay = formatDisplay(value == null ? void 0 : value.from);
2249
- const toDisplay = formatDisplay(value == null ? void 0 : value.to);
2250
- const hasValue = Boolean((value == null ? void 0 : value.from) || (value == null ? void 0 : value.to));
2263
+ const fromDisplay = formatDisplay(value?.from);
2264
+ const toDisplay = formatDisplay(value?.to);
2265
+ const hasValue = Boolean(value?.from || value?.to);
2251
2266
  const rangeValue = (() => {
2252
- const from = isoToDate(value == null ? void 0 : value.from);
2253
- const to = isoToDate(value == null ? void 0 : value.to);
2267
+ const from = isoToDate(value?.from);
2268
+ const to = isoToDate(value?.to);
2254
2269
  if (!from && !to) return void 0;
2255
2270
  return { from, to };
2256
2271
  })();
2257
2272
  const handleSelect = (range) => {
2258
2273
  const next = {
2259
- from: dateToIso(range == null ? void 0 : range.from),
2260
- to: dateToIso(range == null ? void 0 : range.to)
2274
+ from: dateToIso(range?.from),
2275
+ to: dateToIso(range?.to)
2261
2276
  };
2262
2277
  if (!isControlled) setUncontrolled(next);
2263
- onChange == null ? void 0 : onChange(next);
2278
+ onChange?.(next);
2264
2279
  };
2265
2280
  const handleClear = () => {
2266
2281
  const next = {};
2267
2282
  if (!isControlled) setUncontrolled(next);
2268
- onChange == null ? void 0 : onChange(next);
2283
+ onChange?.(next);
2269
2284
  };
2270
2285
  const displayText = hasValue ? `${fromDisplay || "\u2014"} \u2192 ${toDisplay || "\u2014"}` : "";
2271
- const headerRange = (() => {
2272
- const fromD = isoToDate(value == null ? void 0 : value.from);
2273
- const toD = isoToDate(value == null ? void 0 : value.to);
2274
- const fromTxt = fromD ? (0, import_date_fns2.format)(fromD, "d MMM", { locale: import_locale2.ptBR }) : null;
2275
- const toTxt = toD ? (0, import_date_fns2.format)(toD, "d MMM", { locale: import_locale2.ptBR }) : null;
2276
- if (!fromTxt && !toTxt) return "Selecionar per\xEDodo";
2277
- return `${fromTxt ?? "\u2026"} \u2013 ${toTxt ?? "\u2026"}`;
2286
+ const headerFrom = (() => {
2287
+ const d = isoToDate(value?.from);
2288
+ return d ? (0, import_date_fns2.format)(d, "d MMM", { locale: import_locale2.ptBR }) : "\u2014";
2289
+ })();
2290
+ const headerTo = (() => {
2291
+ const d = isoToDate(value?.to);
2292
+ return d ? (0, import_date_fns2.format)(d, "d MMM", { locale: import_locale2.ptBR }) : "\u2014";
2278
2293
  })();
2294
+ const proximoCampo = !value?.from ? "from" : !value?.to ? "to" : null;
2279
2295
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative w-full", children: [
2280
2296
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2281
2297
  Popover,
@@ -2284,7 +2300,7 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2284
2300
  onOpenChange: (next) => {
2285
2301
  setOpen(next);
2286
2302
  if (next) {
2287
- setMonth(isoToDate(value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date());
2303
+ setMonth(isoToDate(value?.from) ?? /* @__PURE__ */ new Date());
2288
2304
  setShowYearPicker(false);
2289
2305
  }
2290
2306
  },
@@ -2335,37 +2351,85 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2335
2351
  }
2336
2352
  ),
2337
2353
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Popover.Content, { size: "auto", align: "start", className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col overflow-hidden rounded-v2-md", children: [
2338
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-3 bg-v2-action-primary px-4 py-3 text-v2-action-on-primary", children: [
2339
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-v2-xl font-bold leading-tight", children: headerRange }),
2340
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2341
- "button",
2342
- {
2343
- type: "button",
2344
- onClick: () => setShowYearPicker((prev) => !prev),
2345
- "aria-expanded": showYearPicker,
2346
- "aria-label": "Selecionar ano",
2347
- className: cn(
2348
- "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",
2349
- showYearPicker ? "bg-v2-action-on-primary/20" : "hover:bg-v2-action-on-primary/15"
2350
- ),
2351
- children: [
2352
- (0, import_date_fns2.format)(month, "yyyy", { locale: import_locale2.ptBR }),
2353
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2354
- import_react25.CaretDown,
2354
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2355
+ "div",
2356
+ {
2357
+ className: "relative flex items-center gap-3 bg-v2-action-primary px-4 py-3 text-v2-action-on-primary",
2358
+ "aria-live": "polite",
2359
+ children: [
2360
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-1 gap-6", children: [
2361
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2362
+ "div",
2355
2363
  {
2356
- size: 12,
2357
- weight: "bold",
2358
- "aria-hidden": "true",
2359
- className: cn(
2360
- "transition-transform",
2361
- showYearPicker && "rotate-180"
2362
- )
2364
+ className: "flex min-w-0 flex-1 flex-col items-center px-20 text-center",
2365
+ "aria-current": proximoCampo === "from" ? "step" : void 0,
2366
+ children: [
2367
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "max-w-full truncate text-[11px] font-bold uppercase tracking-wide text-v2-action-on-primary/75", children: fromLabel }),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2369
+ "span",
2370
+ {
2371
+ className: cn(
2372
+ "truncate text-v2-lg font-bold leading-tight",
2373
+ proximoCampo === "from" && "underline decoration-2 underline-offset-4"
2374
+ ),
2375
+ children: headerFrom
2376
+ }
2377
+ )
2378
+ ]
2379
+ }
2380
+ ),
2381
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2382
+ "div",
2383
+ {
2384
+ className: "flex min-w-0 flex-1 flex-col items-center px-20 text-center",
2385
+ "aria-current": proximoCampo === "to" ? "step" : void 0,
2386
+ children: [
2387
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "max-w-full truncate text-[11px] font-bold uppercase tracking-wide text-v2-action-on-primary/75", children: toLabel }),
2388
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2389
+ "span",
2390
+ {
2391
+ className: cn(
2392
+ "truncate text-v2-lg font-bold leading-tight",
2393
+ proximoCampo === "to" && "underline decoration-2 underline-offset-4"
2394
+ ),
2395
+ children: headerTo
2396
+ }
2397
+ )
2398
+ ]
2363
2399
  }
2364
2400
  )
2365
- ]
2366
- }
2367
- )
2368
- ] }),
2401
+ ] }),
2402
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2403
+ "button",
2404
+ {
2405
+ type: "button",
2406
+ onClick: () => setShowYearPicker((prev) => !prev),
2407
+ "aria-expanded": showYearPicker,
2408
+ "aria-label": "Selecionar ano",
2409
+ className: cn(
2410
+ "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",
2411
+ showYearPicker ? "bg-v2-action-on-primary/20" : "hover:bg-v2-action-on-primary/15"
2412
+ ),
2413
+ children: [
2414
+ (0, import_date_fns2.format)(month, "yyyy", { locale: import_locale2.ptBR }),
2415
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2416
+ import_react25.CaretDown,
2417
+ {
2418
+ size: 12,
2419
+ weight: "bold",
2420
+ "aria-hidden": "true",
2421
+ className: cn(
2422
+ "transition-transform",
2423
+ showYearPicker && "rotate-180"
2424
+ )
2425
+ }
2426
+ )
2427
+ ]
2428
+ }
2429
+ )
2430
+ ]
2431
+ }
2432
+ ),
2369
2433
  showYearPicker ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2370
2434
  "div",
2371
2435
  {
@@ -2403,6 +2467,7 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2403
2467
  ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2404
2468
  import_react_day_picker2.DayPicker,
2405
2469
  {
2470
+ navLayout: "around",
2406
2471
  mode: "range",
2407
2472
  numberOfMonths: 2,
2408
2473
  month,
@@ -2410,7 +2475,22 @@ var DateRangeInput = (0, import_react24.forwardRef)(
2410
2475
  selected: rangeValue,
2411
2476
  onSelect: handleSelect,
2412
2477
  locale: import_locale2.ptBR,
2413
- className: "rdp-v2 rdp-v2-range p-3",
2478
+ className: "rdp-v2-range p-3",
2479
+ labels: {
2480
+ labelDayButton: (date, modifiers) => {
2481
+ let texto = (0, import_date_fns2.format)(date, "PPPP", { locale: import_locale2.ptBR });
2482
+ if (modifiers.today) texto = `Hoje, ${texto}`;
2483
+ if (modifiers.range_start)
2484
+ texto = `${texto}, in\xEDcio do per\xEDodo`;
2485
+ else if (modifiers.range_end)
2486
+ texto = `${texto}, fim do per\xEDodo`;
2487
+ else if (modifiers.selected)
2488
+ texto = `${texto}, dentro do per\xEDodo`;
2489
+ return texto;
2490
+ },
2491
+ labelPrevious: () => "M\xEAs anterior",
2492
+ labelNext: () => "Pr\xF3ximo m\xEAs"
2493
+ },
2414
2494
  formatters: {
2415
2495
  formatCaption: (caption) => {
2416
2496
  const text = (0, import_date_fns2.format)(caption, "LLLL", { locale: import_locale2.ptBR });
@@ -2642,7 +2722,7 @@ var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
2642
2722
  // src/primitives/Dropdown/Dropdown.styles.ts
2643
2723
  var import_class_variance_authority9 = require("class-variance-authority");
2644
2724
  var dropdownContentStyles = (0, import_class_variance_authority9.cva)(
2645
- "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"
2725
+ "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"
2646
2726
  );
2647
2727
  var dropdownItemStyles = (0, import_class_variance_authority9.cva)(
2648
2728
  "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",
@@ -2723,7 +2803,7 @@ var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"));
2723
2803
  // src/primitives/ContextMenu/ContextMenu.styles.ts
2724
2804
  var import_class_variance_authority10 = require("class-variance-authority");
2725
2805
  var contextMenuContentStyles = (0, import_class_variance_authority10.cva)(
2726
- "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"
2806
+ "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"
2727
2807
  );
2728
2808
  var contextMenuItemStyles = (0, import_class_variance_authority10.cva)(
2729
2809
  "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",
@@ -2803,13 +2883,13 @@ var CopyButton = (0, import_react30.forwardRef)(
2803
2883
  ({ textToCopy, children, unstyled = false, className, onClick, ...props }, ref) => {
2804
2884
  const [copied, setCopied] = (0, import_react30.useState)(false);
2805
2885
  function handleClick(event) {
2806
- if (navigator == null ? void 0 : navigator.clipboard) {
2886
+ if (navigator?.clipboard) {
2807
2887
  navigator.clipboard.writeText(textToCopy).then(() => {
2808
2888
  setCopied(true);
2809
2889
  window.setTimeout(() => setCopied(false), 1500);
2810
2890
  });
2811
2891
  }
2812
- onClick == null ? void 0 : onClick(event);
2892
+ onClick?.(event);
2813
2893
  }
2814
2894
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2815
2895
  "button",
@@ -2989,8 +3069,7 @@ var FileUpload = (0, import_react34.forwardRef)(
2989
3069
  if (accept) {
2990
3070
  const accepted = accept.split(",").map((s) => s.trim());
2991
3071
  const invalid = selectedFiles.find((f) => {
2992
- var _a;
2993
- const ext = "." + ((_a = f.name.split(".").pop()) == null ? void 0 : _a.toLowerCase());
3072
+ const ext = "." + f.name.split(".").pop()?.toLowerCase();
2994
3073
  const mimeType = f.type;
2995
3074
  return !accepted.some((a) => {
2996
3075
  if (a.startsWith(".")) return a.toLowerCase() === ext;
@@ -3055,15 +3134,11 @@ var FileUpload = (0, import_react34.forwardRef)(
3055
3134
  role: "button",
3056
3135
  tabIndex: disabled ? -1 : 0,
3057
3136
  "aria-disabled": disabled || void 0,
3058
- onClick: () => {
3059
- var _a;
3060
- return !disabled && ((_a = inputRef.current) == null ? void 0 : _a.click());
3061
- },
3137
+ onClick: () => !disabled && inputRef.current?.click(),
3062
3138
  onKeyDown: (e) => {
3063
- var _a;
3064
3139
  if ((e.key === "Enter" || e.key === " ") && !disabled) {
3065
3140
  e.preventDefault();
3066
- (_a = inputRef.current) == null ? void 0 : _a.click();
3141
+ inputRef.current?.click();
3067
3142
  }
3068
3143
  },
3069
3144
  onDragEnter: (e) => {
@@ -3191,9 +3266,9 @@ function AttachedFile({
3191
3266
  }, [file, isImage]);
3192
3267
  function replaceWith(next) {
3193
3268
  if (!next) return;
3194
- const validationError = validate == null ? void 0 : validate(next);
3269
+ const validationError = validate?.(next);
3195
3270
  if (validationError) {
3196
- onValidationError == null ? void 0 : onValidationError(validationError);
3271
+ onValidationError?.(validationError);
3197
3272
  return;
3198
3273
  }
3199
3274
  onSelect(next);
@@ -3207,10 +3282,9 @@ function AttachedFile({
3207
3282
  },
3208
3283
  onDragLeave: () => setDragOver(false),
3209
3284
  onDrop: (event) => {
3210
- var _a;
3211
3285
  event.preventDefault();
3212
3286
  setDragOver(false);
3213
- replaceWith((_a = event.dataTransfer.files) == null ? void 0 : _a[0]);
3287
+ replaceWith(event.dataTransfer.files?.[0]);
3214
3288
  },
3215
3289
  className: cn(
3216
3290
  "flex items-center gap-3 rounded-v2-md border bg-v2-panel p-2.5 transition-colors",
@@ -3225,8 +3299,7 @@ function AttachedFile({
3225
3299
  accept,
3226
3300
  className: "hidden",
3227
3301
  onChange: (event) => {
3228
- var _a;
3229
- replaceWith((_a = event.target.files) == null ? void 0 : _a[0]);
3302
+ replaceWith(event.target.files?.[0]);
3230
3303
  event.target.value = "";
3231
3304
  }
3232
3305
  }
@@ -3264,10 +3337,7 @@ function AttachedFile({
3264
3337
  "button",
3265
3338
  {
3266
3339
  type: "button",
3267
- onClick: () => {
3268
- var _a;
3269
- return (_a = inputRef.current) == null ? void 0 : _a.click();
3270
- },
3340
+ onClick: () => inputRef.current?.click(),
3271
3341
  "aria-label": "Trocar arquivo",
3272
3342
  title: "Trocar",
3273
3343
  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",
@@ -3713,8 +3783,7 @@ var ImageUpload = (0, import_react45.forwardRef)(
3713
3783
  const [internalError, setInternalError] = (0, import_react45.useState)(null);
3714
3784
  const displayError = error ?? internalError;
3715
3785
  const handleSelect = async (e) => {
3716
- var _a;
3717
- const file = ((_a = e.currentTarget.files) == null ? void 0 : _a[0]) ?? null;
3786
+ const file = e.currentTarget.files?.[0] ?? null;
3718
3787
  if (!file) return;
3719
3788
  if (maxSize && file.size > maxSize) {
3720
3789
  setInternalError(
@@ -3741,10 +3810,7 @@ var ImageUpload = (0, import_react45.forwardRef)(
3741
3810
  {
3742
3811
  type: "button",
3743
3812
  disabled,
3744
- onClick: () => {
3745
- var _a;
3746
- return (_a = inputRef.current) == null ? void 0 : _a.click();
3747
- },
3813
+ onClick: () => inputRef.current?.click(),
3748
3814
  className: triggerClassName,
3749
3815
  children: [
3750
3816
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react46.UploadSimple, { size: 14, weight: "bold", "aria-hidden": "true" }),
@@ -3855,7 +3921,7 @@ function MoneyInput({
3855
3921
  }, [formatted]);
3856
3922
  const handleChange = (e) => {
3857
3923
  const next = e.target.value.replace(/\D/g, "");
3858
- onValueChange == null ? void 0 : onValueChange(formatBRL(next), next);
3924
+ onValueChange?.(formatBRL(next), next);
3859
3925
  };
3860
3926
  const handleFocus = (e) => {
3861
3927
  setCaretToEnd(e.currentTarget);
@@ -3920,7 +3986,7 @@ var MultiCombobox = (0, import_react48.forwardRef)(
3920
3986
  );
3921
3987
  const setValue = (next) => {
3922
3988
  if (value === void 0) setInternalValue(next);
3923
- onValueChange == null ? void 0 : onValueChange(next);
3989
+ onValueChange?.(next);
3924
3990
  };
3925
3991
  const handleToggle = (itemValue) => {
3926
3992
  if (currentValue.includes(itemValue)) {
@@ -3942,9 +4008,8 @@ var MultiCombobox = (0, import_react48.forwardRef)(
3942
4008
  }
3943
4009
  };
3944
4010
  (0, import_react48.useEffect)(() => {
3945
- var _a;
3946
4011
  if (open) {
3947
- (_a = searchInputRef.current) == null ? void 0 : _a.focus();
4012
+ searchInputRef.current?.focus();
3948
4013
  } else {
3949
4014
  setQuery("");
3950
4015
  }
@@ -4354,7 +4419,7 @@ function PercentInput({
4354
4419
  }, [formatted]);
4355
4420
  const handleChange = (e) => {
4356
4421
  const next = e.target.value.replace(/\D/g, "").slice(0, 5);
4357
- onValueChange == null ? void 0 : onValueChange(formatPercent(next), next);
4422
+ onValueChange?.(formatPercent(next), next);
4358
4423
  };
4359
4424
  const handleFocus = (e) => {
4360
4425
  setCaretToEditEnd(e.currentTarget);
@@ -4901,7 +4966,7 @@ var ThemeToggle = (0, import_react64.forwardRef)(
4901
4966
  } catch (error) {
4902
4967
  console.warn("[ThemeToggle] localStorage write failed", error);
4903
4968
  }
4904
- onClick == null ? void 0 : onClick(event);
4969
+ onClick?.(event);
4905
4970
  },
4906
4971
  [preference, storageKey, onClick]
4907
4972
  );
@@ -5445,7 +5510,7 @@ var Sidebar = (0, import_react71.forwardRef)(function Sidebar2({
5445
5510
  window.localStorage.setItem(COLLAPSED_STORAGE_KEY, String(next));
5446
5511
  } catch {
5447
5512
  }
5448
- onCollapseChange == null ? void 0 : onCollapseChange(next);
5513
+ onCollapseChange?.(next);
5449
5514
  }, [collapsed, isControlled, onCollapseChange]);
5450
5515
  (0, import_react71.useEffect)(() => {
5451
5516
  if (!enableShortcut || typeof window === "undefined") return;
@@ -5638,7 +5703,7 @@ var DEFAULT_HEADER_SLOT = /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span",
5638
5703
  ] });
5639
5704
  function AppShell({
5640
5705
  children,
5641
- sidebarGroups = DEFAULT_GROUPS,
5706
+ sidebarGroups,
5642
5707
  currentPath,
5643
5708
  linkComponent,
5644
5709
  pageTitle,
@@ -5646,7 +5711,7 @@ function AppShell({
5646
5711
  notificationCenter,
5647
5712
  themeToggle,
5648
5713
  userMenu,
5649
- headerSlot = DEFAULT_HEADER_SLOT,
5714
+ headerSlot,
5650
5715
  defaultSidebarCollapsed = false
5651
5716
  }) {
5652
5717
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex h-screen overflow-hidden bg-v2-canvas text-v2-fg-default", children: [
@@ -5661,11 +5726,11 @@ function AppShell({
5661
5726
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
5662
5727
  Sidebar,
5663
5728
  {
5664
- groups: sidebarGroups,
5729
+ groups: sidebarGroups ?? DEFAULT_GROUPS,
5665
5730
  currentPath,
5666
5731
  linkComponent,
5667
5732
  defaultCollapsed: defaultSidebarCollapsed,
5668
- headerSlot
5733
+ headerSlot: headerSlot ?? DEFAULT_HEADER_SLOT
5669
5734
  }
5670
5735
  ),
5671
5736
  /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
@@ -5892,7 +5957,7 @@ var markdownComponents = {
5892
5957
  ol: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ol", { className: "ml-6 flex list-decimal flex-col gap-1 text-v2-base text-v2-fg-default", children }),
5893
5958
  li: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("li", { children }),
5894
5959
  a: ({ href, children }) => {
5895
- const isExternal = href == null ? void 0 : href.startsWith("http");
5960
+ const isExternal = href?.startsWith("http");
5896
5961
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
5897
5962
  "a",
5898
5963
  {
@@ -6008,7 +6073,7 @@ var SortableColumnHeader = (0, import_react76.forwardRef)(
6008
6073
  className
6009
6074
  ),
6010
6075
  onClick: (event) => {
6011
- onClick == null ? void 0 : onClick(event);
6076
+ onClick?.(event);
6012
6077
  if (event.defaultPrevented) return;
6013
6078
  onDirectionChange(nextDirection(direction, cycleMode));
6014
6079
  },
@@ -6131,7 +6196,7 @@ function DataTableInner({
6131
6196
  className: cn(
6132
6197
  "border-b border-v2-border-default transition-colors hover:bg-v2-row-hover",
6133
6198
  zebra && index % 2 === 1 && "bg-v2-bg-subtle/50",
6134
- rowClassName == null ? void 0 : rowClassName(row, index)
6199
+ rowClassName?.(row, index)
6135
6200
  ),
6136
6201
  children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
6137
6202
  "td",
@@ -6384,17 +6449,17 @@ function ReadOnlyDataView({
6384
6449
  const handleHeaderClick = (column) => {
6385
6450
  if (column.type === "action") return;
6386
6451
  if (!column.sortable || !onSortChange) return;
6387
- const next = (sortValue == null ? void 0 : sortValue.column) === column.key && sortValue.direction === "asc" ? "desc" : "asc";
6452
+ const next = sortValue?.column === column.key && sortValue.direction === "asc" ? "desc" : "asc";
6388
6453
  onSortChange(column.key, next);
6389
6454
  };
6390
6455
  const handleCellClick = async (column, row) => {
6391
6456
  if (column.type === "action") return;
6392
- const dialog = detailsDialogs == null ? void 0 : detailsDialogs.find((d) => d.triggerColumn === column.key);
6457
+ const dialog = detailsDialogs?.find((d) => d.triggerColumn === column.key);
6393
6458
  if (!dialog) return;
6394
6459
  const result = await dialog.fetchDetails(row);
6395
6460
  setActiveDialog({ dialog, row, details: result });
6396
6461
  };
6397
- const hasTriggerColumn = (column) => column.type !== "action" && Boolean(detailsDialogs == null ? void 0 : detailsDialogs.some((d) => d.triggerColumn === column.key));
6462
+ const hasTriggerColumn = (column) => column.type !== "action" && Boolean(detailsDialogs?.some((d) => d.triggerColumn === column.key));
6398
6463
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
6399
6464
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
6400
6465
  Card,
@@ -6406,7 +6471,7 @@ function ReadOnlyDataView({
6406
6471
  caption && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("caption", { className: "sr-only", children: caption }),
6407
6472
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-v2-bg-subtle", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tr", { children: columns.map((column) => {
6408
6473
  const isSortable = column.type !== "action" && Boolean(column.sortable);
6409
- const isSorted = column.type !== "action" && (sortValue == null ? void 0 : sortValue.column) === column.key;
6474
+ const isSorted = column.type !== "action" && sortValue?.column === column.key;
6410
6475
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
6411
6476
  "th",
6412
6477
  {
@@ -6418,7 +6483,7 @@ function ReadOnlyDataView({
6418
6483
  column.type === "text" || column.type === "action" ? column.align : "left"
6419
6484
  )
6420
6485
  ),
6421
- "aria-sort": isSorted ? (sortValue == null ? void 0 : sortValue.direction) === "asc" ? "ascending" : "descending" : isSortable ? "none" : void 0,
6486
+ "aria-sort": isSorted ? sortValue?.direction === "asc" ? "ascending" : "descending" : isSortable ? "none" : void 0,
6422
6487
  children: isSortable ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
6423
6488
  "button",
6424
6489
  {
@@ -6427,7 +6492,7 @@ function ReadOnlyDataView({
6427
6492
  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",
6428
6493
  children: [
6429
6494
  column.label,
6430
- isSorted ? (sortValue == null ? void 0 : sortValue.direction) === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
6495
+ isSorted ? sortValue?.direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
6431
6496
  import_react82.CaretUp,
6432
6497
  {
6433
6498
  size: 12,
@@ -6518,7 +6583,6 @@ function ReadOnlyDataView({
6518
6583
  }
6519
6584
  ReadOnlyDataView.displayName = "ReadOnlyDataView";
6520
6585
  function renderCell(column, row) {
6521
- var _a;
6522
6586
  if (column.type === "action") {
6523
6587
  return column.render(row);
6524
6588
  }
@@ -6530,7 +6594,7 @@ function renderCell(column, row) {
6530
6594
  if (raw === null || raw === void 0) return "\u2014";
6531
6595
  const value = String(raw);
6532
6596
  const variant = column.variantMap[value] ?? "default";
6533
- const display = ((_a = column.labelMap) == null ? void 0 : _a[value]) ?? value;
6597
+ const display = column.labelMap?.[value] ?? value;
6534
6598
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Badge, { variant, children: display });
6535
6599
  }
6536
6600
  if (column.type === "date") {
@@ -6655,7 +6719,7 @@ var NotificationCenter = (0, import_react83.forwardRef)(
6655
6719
  "button",
6656
6720
  {
6657
6721
  type: "button",
6658
- onClick: () => onItemClick == null ? void 0 : onItemClick(n),
6722
+ onClick: () => onItemClick?.(n),
6659
6723
  className: cn(
6660
6724
  "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",
6661
6725
  !n.read && "bg-v2-brand-bg-soft/30"
@@ -6977,15 +7041,13 @@ function CommandPalette({
6977
7041
  const flatItems = groups.flatMap((g) => g.items.filter((i) => !i.disabled));
6978
7042
  const filteredGroups = groups.filter((g) => g.loading || g.items.length > 0);
6979
7043
  (0, import_react92.useEffect)(() => {
6980
- var _a;
6981
7044
  if (open) {
6982
- (_a = inputRef.current) == null ? void 0 : _a.focus();
7045
+ inputRef.current?.focus();
6983
7046
  }
6984
7047
  }, [open]);
6985
7048
  (0, import_react92.useEffect)(() => {
6986
- var _a;
6987
7049
  if (open) {
6988
- setHighlightedId(((_a = flatItems[0]) == null ? void 0 : _a.id) ?? null);
7050
+ setHighlightedId(flatItems[0]?.id ?? null);
6989
7051
  }
6990
7052
  }, [open, groups]);
6991
7053
  (0, import_react92.useEffect)(() => {
@@ -7000,13 +7062,11 @@ function CommandPalette({
7000
7062
  return () => window.removeEventListener("keydown", handler);
7001
7063
  }, [enableShortcut, open, onOpenChange]);
7002
7064
  const selectItem = (item) => {
7003
- var _a;
7004
- onItemSelect == null ? void 0 : onItemSelect(item);
7005
- (_a = item.onSelect) == null ? void 0 : _a.call(item);
7065
+ onItemSelect?.(item);
7066
+ item.onSelect?.();
7006
7067
  onOpenChange(false);
7007
7068
  };
7008
7069
  const handleInputKeyDown = (e) => {
7009
- var _a, _b;
7010
7070
  if (e.key === "Escape") {
7011
7071
  e.preventDefault();
7012
7072
  onOpenChange(false);
@@ -7016,11 +7076,11 @@ function CommandPalette({
7016
7076
  const idx = flatItems.findIndex((i) => i.id === highlightedId);
7017
7077
  if (e.key === "ArrowDown") {
7018
7078
  e.preventDefault();
7019
- setHighlightedId(((_a = flatItems[(idx + 1) % flatItems.length]) == null ? void 0 : _a.id) ?? null);
7079
+ setHighlightedId(flatItems[(idx + 1) % flatItems.length]?.id ?? null);
7020
7080
  } else if (e.key === "ArrowUp") {
7021
7081
  e.preventDefault();
7022
7082
  setHighlightedId(
7023
- ((_b = flatItems[(idx - 1 + flatItems.length) % flatItems.length]) == null ? void 0 : _b.id) ?? null
7083
+ flatItems[(idx - 1 + flatItems.length) % flatItems.length]?.id ?? null
7024
7084
  );
7025
7085
  } else if (e.key === "Enter") {
7026
7086
  e.preventDefault();
@@ -7071,7 +7131,7 @@ function CommandPalette({
7071
7131
  onChange: (e) => {
7072
7132
  const v = e.target.value;
7073
7133
  setQueryValue(v);
7074
- onQueryChange == null ? void 0 : onQueryChange(v);
7134
+ onQueryChange?.(v);
7075
7135
  },
7076
7136
  onKeyDown: handleInputKeyDown,
7077
7137
  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"
@@ -7215,7 +7275,7 @@ var ChartTimeSeries = (0, import_react94.forwardRef)(
7215
7275
  const activeRange = range ?? internalRange;
7216
7276
  const handleRangeChange = (next) => {
7217
7277
  if (range === void 0) setInternalRange(next);
7218
- onRangeChange == null ? void 0 : onRangeChange(next);
7278
+ onRangeChange?.(next);
7219
7279
  };
7220
7280
  const id = (0, import_react94.useId)();
7221
7281
  const gradientId = `chart-ts-${id.replace(/[:]/g, "")}`;
@@ -7377,8 +7437,7 @@ function ChartTooltip({
7377
7437
  valueFormatter,
7378
7438
  secondaryFormatter
7379
7439
  }) {
7380
- var _a;
7381
- const slice = (_a = payload == null ? void 0 : payload[0]) == null ? void 0 : _a.payload;
7440
+ const slice = payload?.[0]?.payload;
7382
7441
  if (!active || !slice) return null;
7383
7442
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "rounded-v2-md border border-v2-border-default bg-v2-panel px-3 py-2 text-v2-xs shadow-lg", children: [
7384
7443
  /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -8085,7 +8144,7 @@ function FilterBarV2({
8085
8144
  const open = isOpenControlled ? controlledOpen : internalOpen;
8086
8145
  const setOpen = (next) => {
8087
8146
  if (!isOpenControlled) setInternalOpen(next);
8088
- onOpenChange == null ? void 0 : onOpenChange(next);
8147
+ onOpenChange?.(next);
8089
8148
  };
8090
8149
  const [draftValues, setDraftValues] = (0, import_react101.useState)(
8091
8150
  controlledValues ?? defaultValues ?? {}
@@ -8504,7 +8563,7 @@ function ChartTooltip2({
8504
8563
  formatValue,
8505
8564
  formatLabel
8506
8565
  }) {
8507
- if (!active || !(payload == null ? void 0 : payload.length)) return null;
8566
+ if (!active || !payload?.length) return null;
8508
8567
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "rounded-v2-md border border-v2-border-default bg-v2-panel px-3 py-2 text-v2-xs shadow-lg", children: [
8509
8568
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "font-semibold text-v2-fg-default", children: formatLabel(label ?? "") }),
8510
8569
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "mt-1 flex flex-col gap-0.5", children: payload.map((p) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -8787,7 +8846,7 @@ function ChartTooltip3({
8787
8846
  formatValue,
8788
8847
  formatLabel
8789
8848
  }) {
8790
- if (!active || !(payload == null ? void 0 : payload.length)) return null;
8849
+ if (!active || !payload?.length) return null;
8791
8850
  const total = payload.reduce(
8792
8851
  (sum, p) => sum + (typeof p.value === "number" ? p.value : 0),
8793
8852
  0
@@ -8919,9 +8978,8 @@ function NodeCard({
8919
8978
  selected,
8920
8979
  onSelect
8921
8980
  }) {
8922
- var _a, _b;
8923
- const rulesCount = ((_a = node.rules) == null ? void 0 : _a.length) ?? 0;
8924
- const actionsCount = ((_b = node.actions) == null ? void 0 : _b.length) ?? 0;
8981
+ const rulesCount = node.rules?.length ?? 0;
8982
+ const actionsCount = node.actions?.length ?? 0;
8925
8983
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
8926
8984
  "button",
8927
8985
  {
@@ -9008,7 +9066,7 @@ function WorkflowDesigner({
9008
9066
  }) {
9009
9067
  const showPanel = showSidePanel !== false && selectedNodeId !== void 0;
9010
9068
  const handleNodeSelect = (id) => {
9011
- onNodeSelect == null ? void 0 : onNodeSelect(id === selectedNodeId ? null : id);
9069
+ onNodeSelect?.(id === selectedNodeId ? null : id);
9012
9070
  };
9013
9071
  const colCount = phases.length;
9014
9072
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: cn("flex gap-4", className), ...props, children: [