@mlw-packages/react-components 1.6.0 → 1.6.1

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
@@ -524,6 +524,7 @@ __export(index_exports, {
524
524
  CarouselItemBase: () => CarouselItemBase,
525
525
  CarouselNextBase: () => CarouselNextBase,
526
526
  CarouselPrevious: () => CarouselPrevious,
527
+ ChangeButton: () => ChangeButton,
527
528
  Chart: () => Chart_default,
528
529
  CheckButton: () => CheckButton,
529
530
  CheckboxBase: () => CheckboxBase,
@@ -617,6 +618,16 @@ __export(index_exports, {
617
618
  LineChart: () => LineChart_default,
618
619
  LoadingBase: () => LoadingBase,
619
620
  LockButton: () => LockButton,
621
+ ModalBase: () => ModalBase,
622
+ ModalCloseBase: () => ModalCloseBase,
623
+ ModalContentBase: () => ModalContentBase,
624
+ ModalDescriptionBase: () => ModalDescriptionBase,
625
+ ModalFooterBase: () => ModalFooterBase,
626
+ ModalHeaderBase: () => ModalHeaderBase,
627
+ ModalOverlayBase: () => ModalOverlayBase,
628
+ ModalPortalBase: () => ModalPortalBase,
629
+ ModalTitleBase: () => ModalTitleBase,
630
+ ModalTriggerBase: () => ModalTriggerBase,
620
631
  ModeToggleBase: () => ModeToggleBase,
621
632
  MoreButton: () => MoreButton,
622
633
  MultiCombobox: () => MultiCombobox,
@@ -1851,7 +1862,7 @@ var CommandItemBase = React9.forwardRef(({ className, testid: dataTestId = "comm
1851
1862
  {
1852
1863
  ref,
1853
1864
  className: cn(
1854
- "relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-all data-[disabled=true]:pointer-events-none data-[selected=true]:bg-primary data-[selected=true]:text-background data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:scale-[1.02] active:scale-[0.98]",
1865
+ "relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-all data-[disabled=true]:pointer-events-none data-[selected=true]:bg-muted data-[selected=true]:text-primary data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:scale-[1.02] active:scale-[0.98]",
1855
1866
  className
1856
1867
  ),
1857
1868
  "data-testid": dataTestId,
@@ -2459,20 +2470,22 @@ var PopoverContentBase = React13.forwardRef(({ className, align = "center", side
2459
2470
  PopoverContentBase.displayName = PopoverPrimitive.Content.displayName;
2460
2471
 
2461
2472
  // src/components/selects/ComboboxBase.tsx
2462
- var import_react10 = require("@phosphor-icons/react");
2463
- var import_react11 = require("react");
2464
2473
  var import_framer_motion4 = require("framer-motion");
2474
+ var import_react10 = require("react");
2475
+ var import_react11 = require("@phosphor-icons/react");
2465
2476
  var import_jsx_runtime19 = require("react/jsx-runtime");
2466
2477
  function ComboboxBase({
2467
2478
  items,
2468
2479
  renderSelected,
2469
2480
  handleSelection,
2470
2481
  checkIsSelected,
2482
+ keepOpen = false,
2483
+ closeAll,
2471
2484
  searchPlaceholder,
2472
2485
  errorMessage,
2473
2486
  testIds = {}
2474
2487
  }) {
2475
- const [open, setOpen] = (0, import_react11.useState)(false);
2488
+ const [open, setOpen] = (0, import_react10.useState)(false);
2476
2489
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2477
2490
  "div",
2478
2491
  {
@@ -2498,12 +2511,14 @@ function ComboboxBase({
2498
2511
  "data-testid": testIds.trigger ?? "combobox-trigger",
2499
2512
  children: [
2500
2513
  renderSelected,
2514
+ closeAll,
2501
2515
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2502
2516
  import_framer_motion4.motion.div,
2503
2517
  {
2504
2518
  animate: { rotate: open ? 180 : 0 },
2505
2519
  transition: { duration: 0.3 },
2506
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react10.CaretDownIcon, { size: 16, className: "mt-0.5 flex-shrink-0" })
2520
+ className: "flex",
2521
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react11.CaretDownIcon, { className: " flex-shrink-0" })
2507
2522
  }
2508
2523
  )
2509
2524
  ]
@@ -2519,7 +2534,7 @@ function ComboboxBase({
2519
2534
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2520
2535
  CommandBase,
2521
2536
  {
2522
- className: "dark:text-white",
2537
+ className: "dark:text-white hover:bg-rsecondary",
2523
2538
  "data-testid": testIds.command ?? "combobox-command",
2524
2539
  children: [
2525
2540
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -2541,7 +2556,7 @@ function ComboboxBase({
2541
2556
  value: item.value,
2542
2557
  onSelect: (value) => {
2543
2558
  handleSelection(value);
2544
- setOpen(false);
2559
+ if (!keepOpen) setOpen(false);
2545
2560
  },
2546
2561
  "data-testid": testIds.option ?? "combobox-option",
2547
2562
  children: [
@@ -2556,8 +2571,9 @@ function ComboboxBase({
2556
2571
  stiffness: 500,
2557
2572
  damping: 30
2558
2573
  },
2574
+ className: "ml-auto ",
2559
2575
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2560
- import_react10.CheckIcon,
2576
+ import_react11.CheckIcon,
2561
2577
  {
2562
2578
  className: cn(
2563
2579
  "ml-auto",
@@ -2648,7 +2664,8 @@ function MultiCombobox({
2648
2664
  searchPlaceholder,
2649
2665
  label,
2650
2666
  labelClassname,
2651
- testIds = {}
2667
+ testIds = {},
2668
+ keepOpen = true
2652
2669
  }) {
2653
2670
  const selectedItems = items.filter((item) => selected.includes(item.value));
2654
2671
  const checkIsSelected = (0, import_react13.useCallback)(
@@ -2666,6 +2683,20 @@ function MultiCombobox({
2666
2683
  },
2667
2684
  [selected, onChange]
2668
2685
  );
2686
+ const closeAll = selectedItems.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: " flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2687
+ ButtonBase,
2688
+ {
2689
+ variant: "ghost",
2690
+ "data-testid": testIds.clearAll ?? "combobox-clear-all",
2691
+ size: "icon",
2692
+ onClick: (e) => {
2693
+ e.stopPropagation();
2694
+ onChange([]);
2695
+ },
2696
+ className: "text-xs hover:bg-red-50 hover:text-red-500 transition-colors rounded-md mr-2",
2697
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react14.XIcon, {})
2698
+ }
2699
+ ) }) : null;
2669
2700
  const renderSelected = (0, import_react13.useMemo)(() => {
2670
2701
  if (selectedItems.length === 0) {
2671
2702
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -2741,6 +2772,8 @@ function MultiCombobox({
2741
2772
  renderSelected,
2742
2773
  handleSelection,
2743
2774
  checkIsSelected,
2775
+ keepOpen,
2776
+ closeAll,
2744
2777
  searchPlaceholder
2745
2778
  }
2746
2779
  )
@@ -3197,7 +3230,7 @@ var import_jsx_runtime28 = require("react/jsx-runtime");
3197
3230
  var ProgressBase = React17.forwardRef(
3198
3231
  ({
3199
3232
  className,
3200
- value,
3233
+ value: rawValue,
3201
3234
  label,
3202
3235
  leftIcon,
3203
3236
  rightIcon,
@@ -3205,8 +3238,14 @@ var ProgressBase = React17.forwardRef(
3205
3238
  segments = 5,
3206
3239
  steps = [],
3207
3240
  currentStep = 0,
3241
+ showValue = false,
3242
+ valuePosition = "right",
3243
+ autocolor,
3244
+ plusIndicator,
3208
3245
  ...props
3209
3246
  }, ref) => {
3247
+ const value = Number(rawValue || 0);
3248
+ const indicatorWidth = Math.min(value, 100);
3210
3249
  switch (variant) {
3211
3250
  case "segments":
3212
3251
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -3240,26 +3279,89 @@ var ProgressBase = React17.forwardRef(
3240
3279
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
3241
3280
  label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LabelBase_default, { className: "py-2", children: label }),
3242
3281
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3282
+ showValue && valuePosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-12 text-sm text-right font-extrabold", children: [
3283
+ Math.round(value || 0),
3284
+ "%"
3285
+ ] }),
3243
3286
  leftIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center", children: leftIcon }),
3244
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3287
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3245
3288
  ProgressPrimitive.Root,
3246
3289
  {
3247
3290
  ref,
3248
3291
  className: cn(
3249
- "relative h-3 w-full overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-800 shadow-inner transition-all",
3292
+ " relative h-3 w-full overflow-visible rounded-full bg-muted/80 shadow-inner transition-all ",
3250
3293
  className
3251
3294
  ),
3252
3295
  value,
3253
3296
  ...props,
3254
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3255
- ProgressPrimitive.Indicator,
3256
- {
3257
- className: "h-full w-full flex-1 bg-primary transition-all duration-500 ease-in-out",
3258
- style: { transform: `translateX(-${100 - (value || 0)}%)` }
3259
- }
3260
- )
3297
+ children: [
3298
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3299
+ ProgressPrimitive.Indicator,
3300
+ {
3301
+ className: cn(
3302
+ "h-full w-full flex-1 transition-all duration-500 ease-in-out rounded-lg ",
3303
+ autocolor && autocolor.length >= 2 ? "bg-transparent" : "bg-primary"
3304
+ ),
3305
+ style: { transform: `translateX(-${100 - indicatorWidth}%)` }
3306
+ }
3307
+ ),
3308
+ autocolor && Array.isArray(autocolor) && autocolor.length >= 2 && (() => {
3309
+ const [t1Raw, t2Raw] = autocolor;
3310
+ const [t1, t2] = [Number(t1Raw), Number(t2Raw)].sort(
3311
+ (a, b) => a - b
3312
+ );
3313
+ const v = Number(value || 0);
3314
+ let colorClass = "bg-red-500";
3315
+ if (v <= t1) {
3316
+ colorClass = "bg-red-500";
3317
+ } else if (v <= t2) {
3318
+ colorClass = "bg-yellow-500";
3319
+ } else {
3320
+ colorClass = "bg-emerald-500";
3321
+ }
3322
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3323
+ "div",
3324
+ {
3325
+ "aria-hidden": true,
3326
+ className: cn(
3327
+ "absolute top-0 left-0 h-full transition-all duration-500 ease-in-out rounded-lg",
3328
+ colorClass
3329
+ ),
3330
+ style: { width: `${indicatorWidth}%` }
3331
+ }
3332
+ );
3333
+ })(),
3334
+ plusIndicator && value > 100 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3335
+ "div",
3336
+ {
3337
+ "aria-hidden": "true",
3338
+ className: "absolute top-0 bottom-0 w-0.5 bg-black/70 transition-all duration-500 ease-in-out pointer-events-none",
3339
+ style: {
3340
+ left: `${100 / value * 100}%`
3341
+ },
3342
+ children: value > 115 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute left-full ml-2 top-1/2 -translate-y-1/2 text-xs whitespace-nowrap font-extrabold", children: `+${Math.round(
3343
+ value - 100
3344
+ )}%` })
3345
+ }
3346
+ ),
3347
+ showValue && valuePosition === "inside" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3348
+ "span",
3349
+ {
3350
+ className: "absolute inset-0 flex items-center justify-center text-sm select-none pointer-events-none text-secondary font-extrabold",
3351
+ "aria-hidden": true,
3352
+ children: [
3353
+ Math.round(value || 0),
3354
+ "%"
3355
+ ]
3356
+ }
3357
+ )
3358
+ ]
3261
3359
  }
3262
3360
  ),
3361
+ showValue && valuePosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-12 text-sm font-extrabold text-left", children: [
3362
+ Math.round(value || 0),
3363
+ "%"
3364
+ ] }),
3263
3365
  rightIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center", children: rightIcon })
3264
3366
  ] })
3265
3367
  ] });
@@ -5028,7 +5130,7 @@ function CalendarBase2({
5028
5130
  "div",
5029
5131
  {
5030
5132
  className: cn(
5031
- "rounded-md border bg-background p-4 shadow-lg overflow-hidden w-full h-full flex flex-col",
5133
+ "rounded-md border bg-background p-2 overflow-hidden flex flex-col",
5032
5134
  className
5033
5135
  ),
5034
5136
  children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion9.AnimatePresence, { initial: false, mode: "wait", custom: direction, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -5071,11 +5173,11 @@ function CalendarBase2({
5071
5173
  ),
5072
5174
  day: cn(
5073
5175
  buttonVariantsBase({ variant: "ghost" }),
5074
- "w-full h-full p-0 rounded-lg",
5075
- "aria-selected:opacity-100 hover:bg-muted text-[clamp(0.75rem,2vw,1rem)] flex items-center justify-center",
5076
- "touch-manipulation transition-all duration-200 ease-out hover:scale-105 active:scale-95"
5176
+ "w-full h-full p-0",
5177
+ "aria-selected:opacity-100 hover:bg-muted flex items-center justify-center",
5178
+ " transition-all duration-200 ease-out hover:scale-105 active:scale-95"
5077
5179
  ),
5078
- day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold",
5180
+ day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white",
5079
5181
  day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset",
5080
5182
  day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
5081
5183
  day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
@@ -5605,7 +5707,7 @@ function DateTimePicker({
5605
5707
  variant: "outline",
5606
5708
  className: cn(
5607
5709
  "w-full justify-start text-left min-w-0 overflow-hidden",
5608
- "text-muted-foreground/90",
5710
+ "text-foreground/70",
5609
5711
  "text-sm sm:text-base",
5610
5712
  !date && "text-muted-foreground/"
5611
5713
  ),
@@ -5635,7 +5737,7 @@ function DateTimePicker({
5635
5737
  initialFocus: true,
5636
5738
  fromDate,
5637
5739
  toDate,
5638
- className: "w-full"
5740
+ className: cn("w-full", hideHour && hideMinute && "border-0")
5639
5741
  }
5640
5742
  ),
5641
5743
  !(hideHour && hideMinute) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex justify-center w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
@@ -5661,7 +5763,7 @@ function DateTimePicker({
5661
5763
  ),
5662
5764
  children: [
5663
5765
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react31.ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
5664
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-foreground truncate", children: internalDate ? (0, import_date_fns.format)(internalDate, getTimeFormat() || "HH:mm", {
5766
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-black truncate", children: internalDate ? (0, import_date_fns.format)(internalDate, getTimeFormat() || "HH:mm", {
5665
5767
  locale: import_locale.ptBR
5666
5768
  }) : "00:00" })
5667
5769
  ]
@@ -9269,188 +9371,272 @@ var useChartHighlights = () => {
9269
9371
  };
9270
9372
 
9271
9373
  // src/components/ui/SmallButtons.tsx
9374
+ var React38 = __toESM(require("react"));
9272
9375
  var import_react40 = require("@phosphor-icons/react");
9273
9376
  var import_jsx_runtime61 = require("react/jsx-runtime");
9274
- var EditButton = ({
9275
- disabled,
9276
- onClick,
9277
- testid = "button-edit",
9278
- className,
9279
- iconSize = 18,
9280
- iconColor,
9281
- variant = "default",
9282
- size = "icon",
9283
- ...props
9284
- }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9285
- ButtonBase,
9286
- {
9287
- variant,
9288
- size,
9289
- onClick,
9377
+ var EditButton = React38.forwardRef(
9378
+ ({
9290
9379
  disabled,
9291
- testid,
9292
- className: cn(
9293
- "transition-all duration-200 ease-in-out group",
9294
- "hover:scale-105 hover:bg-primary",
9295
- "active:scale-95",
9296
- "disabled:hover:scale-100",
9297
- className
9298
- ),
9299
- ...props,
9300
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9301
- import_react40.PencilSimpleIcon,
9302
- {
9303
- size: iconSize,
9304
- color: iconColor,
9305
- className: "transition-transform duration-200 group-hover:-rotate-12"
9306
- }
9307
- )
9308
- }
9309
- );
9310
- var SaveButton = ({
9311
- disabled,
9312
- onClick,
9313
- testid = "button-save",
9314
- className,
9315
- iconSize = 18,
9316
- iconColor,
9317
- variant = "default",
9318
- size = "icon",
9319
- ...props
9320
- }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9321
- ButtonBase,
9322
- {
9323
- variant,
9324
- size,
9325
9380
  onClick,
9326
- disabled,
9327
- testid,
9328
- className: cn(
9329
- "transition-all duration-200 ease-in-out group",
9330
- "hover:scale-105",
9331
- "active:scale-95",
9332
- "disabled:hover:scale-100",
9333
- className
9334
- ),
9335
- ...props,
9336
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9337
- import_react40.FloppyDiskIcon,
9338
- {
9339
- size: iconSize,
9340
- color: iconColor,
9341
- className: "transition-transform duration-200 group-hover:scale-110"
9342
- }
9343
- )
9344
- }
9381
+ testid = "button-edit",
9382
+ className,
9383
+ iconSize = 18,
9384
+ iconColor,
9385
+ variant = "default",
9386
+ size = "icon",
9387
+ ...props
9388
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9389
+ ButtonBase,
9390
+ {
9391
+ ref,
9392
+ variant,
9393
+ size,
9394
+ onClick,
9395
+ disabled,
9396
+ testid,
9397
+ className: cn(
9398
+ "transition-all duration-200 ease-in-out group",
9399
+ "hover:scale-105",
9400
+ "active:scale-95",
9401
+ "disabled:hover:scale-100",
9402
+ className
9403
+ ),
9404
+ ...props,
9405
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9406
+ import_react40.PencilSimpleIcon,
9407
+ {
9408
+ size: iconSize,
9409
+ color: iconColor,
9410
+ className: "transition-transform duration-200 group-hover:-rotate-12"
9411
+ }
9412
+ )
9413
+ }
9414
+ )
9345
9415
  );
9346
- var AddButton = ({
9347
- disabled,
9348
- onClick,
9349
- testid = "button-add",
9350
- className,
9351
- iconSize = 18,
9352
- iconColor,
9353
- variant = "default",
9354
- size = "icon",
9355
- ...props
9356
- }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9357
- ButtonBase,
9358
- {
9359
- variant,
9360
- size,
9361
- onClick,
9416
+ EditButton.displayName = "EditButton";
9417
+ var ChangeButton = React38.forwardRef(
9418
+ ({
9362
9419
  disabled,
9363
- testid,
9364
- className: cn(
9365
- "transition-all duration-200 ease-in-out",
9366
- "hover:scale-105",
9367
- "active:scale-95",
9368
- "disabled:hover:scale-100",
9369
- className
9370
- ),
9371
- ...props,
9372
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9373
- import_react40.PlusIcon,
9374
- {
9375
- size: iconSize,
9376
- color: iconColor,
9377
- className: "transition-transform duration-300"
9378
- }
9379
- )
9380
- }
9420
+ onClick,
9421
+ testid = "button-edit",
9422
+ className,
9423
+ iconSize = 18,
9424
+ iconColor,
9425
+ variant = "default",
9426
+ size = "icon",
9427
+ ...props
9428
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9429
+ ButtonBase,
9430
+ {
9431
+ ref,
9432
+ variant,
9433
+ size,
9434
+ onClick,
9435
+ disabled,
9436
+ testid,
9437
+ className: cn(
9438
+ "transition-all duration-200 ease-in-out group",
9439
+ "hover:scale-105",
9440
+ "active:scale-95",
9441
+ "disabled:hover:scale-100",
9442
+ className
9443
+ ),
9444
+ ...props,
9445
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9446
+ import_react40.ArrowsLeftRightIcon,
9447
+ {
9448
+ size: iconSize,
9449
+ color: iconColor,
9450
+ className: "transition-transform duration-200 group-hover:-rotate-180"
9451
+ }
9452
+ )
9453
+ }
9454
+ )
9381
9455
  );
9382
- var CloseButton = ({
9383
- disabled,
9384
- onClick,
9385
- testid = "button-close",
9386
- className,
9387
- iconSize = 18,
9388
- iconColor,
9389
- variant = "ghost",
9390
- size = "icon",
9391
- ...props
9392
- }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9393
- ButtonBase,
9394
- {
9395
- variant,
9396
- size,
9456
+ ChangeButton.displayName = "ChangeButton";
9457
+ var SaveButton = React38.forwardRef(
9458
+ ({
9459
+ disabled,
9397
9460
  onClick,
9461
+ testid = "button-save",
9462
+ className,
9463
+ iconSize = 18,
9464
+ iconColor,
9465
+ variant = "default",
9466
+ size = "icon",
9467
+ ...props
9468
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9469
+ ButtonBase,
9470
+ {
9471
+ ref,
9472
+ variant,
9473
+ size,
9474
+ onClick,
9475
+ disabled,
9476
+ testid,
9477
+ className: cn(
9478
+ "transition-all duration-200 ease-in-out group",
9479
+ "hover:scale-105",
9480
+ "active:scale-95",
9481
+ "disabled:hover:scale-100",
9482
+ className
9483
+ ),
9484
+ ...props,
9485
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9486
+ import_react40.FloppyDiskIcon,
9487
+ {
9488
+ size: iconSize,
9489
+ color: iconColor,
9490
+ className: "transition-transform duration-200 group-hover:scale-110"
9491
+ }
9492
+ )
9493
+ }
9494
+ )
9495
+ );
9496
+ SaveButton.displayName = "SaveButton";
9497
+ var AddButton = React38.forwardRef(
9498
+ ({
9398
9499
  disabled,
9399
- testid,
9400
- className: cn(
9401
- "transition-all duration-200 ease-in-out",
9402
- "hover:scale-110 hover:rotate-90 hover:bg-destructive/10",
9403
- "active:scale-95 active:rotate-0",
9404
- "disabled:hover:scale-100 disabled:hover:rotate-0",
9405
- className
9406
- ),
9407
- ...props,
9408
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9409
- import_react40.XIcon,
9410
- {
9411
- size: iconSize,
9412
- color: iconColor,
9413
- className: "transition-transform duration-300"
9414
- }
9415
- )
9416
- }
9500
+ onClick,
9501
+ testid = "button-add",
9502
+ className,
9503
+ iconSize = 18,
9504
+ iconColor,
9505
+ variant = "default",
9506
+ size = "icon",
9507
+ ...props
9508
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9509
+ ButtonBase,
9510
+ {
9511
+ ref,
9512
+ variant,
9513
+ size,
9514
+ onClick,
9515
+ disabled,
9516
+ testid,
9517
+ className: cn(
9518
+ "transition-all duration-200 ease-in-out",
9519
+ "hover:scale-105",
9520
+ "active:scale-95",
9521
+ "disabled:hover:scale-100",
9522
+ className
9523
+ ),
9524
+ ...props,
9525
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9526
+ import_react40.PlusIcon,
9527
+ {
9528
+ size: iconSize,
9529
+ color: iconColor,
9530
+ className: "transition-transform duration-300"
9531
+ }
9532
+ )
9533
+ }
9534
+ )
9417
9535
  );
9418
- var DeleteButton = ({
9419
- disabled,
9420
- onClick,
9421
- testid = "button-delete",
9422
- className,
9423
- iconSize = 18,
9424
- iconColor,
9425
- variant = "destructive",
9426
- size = "icon",
9427
- ...props
9428
- }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9429
- ButtonBase,
9430
- {
9431
- variant,
9432
- size,
9536
+ AddButton.displayName = "AddButton";
9537
+ var CloseButton = React38.forwardRef(
9538
+ ({
9539
+ disabled,
9433
9540
  onClick,
9541
+ testid = "button-close",
9542
+ className,
9543
+ iconSize = 18,
9544
+ iconColor,
9545
+ variant = "ghost",
9546
+ size = "icon",
9547
+ ...props
9548
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9549
+ ButtonBase,
9550
+ {
9551
+ ref,
9552
+ variant,
9553
+ size,
9554
+ onClick,
9555
+ disabled,
9556
+ testid,
9557
+ className: cn(
9558
+ "transition-all duration-200 ease-in-out",
9559
+ "hover:scale-110 hover:rotate-90 hover:bg-destructive/10",
9560
+ "active:scale-95 active:rotate-0",
9561
+ "disabled:hover:scale-100 disabled:hover:rotate-0",
9562
+ className
9563
+ ),
9564
+ ...props,
9565
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9566
+ import_react40.XIcon,
9567
+ {
9568
+ size: iconSize,
9569
+ color: iconColor,
9570
+ className: "transition-transform duration-300"
9571
+ }
9572
+ )
9573
+ }
9574
+ )
9575
+ );
9576
+ CloseButton.displayName = "CloseButton";
9577
+ var DeleteButton = React38.forwardRef(
9578
+ ({
9434
9579
  disabled,
9435
- testid,
9436
- className: cn(
9437
- "transition-all duration-200 ease-in-out group",
9438
- "hover:scale-105",
9439
- "active:scale-95",
9440
- "disabled:hover:scale-100",
9441
- className
9442
- ),
9443
- ...props,
9444
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9445
- import_react40.TrashIcon,
9580
+ onClick,
9581
+ testid = "button-delete",
9582
+ className,
9583
+ iconSize = 18,
9584
+ iconColor,
9585
+ variant = "destructive",
9586
+ size = "icon",
9587
+ destructiveTitle,
9588
+ destructiveDescription,
9589
+ destructiveOnConfirm,
9590
+ destructiveOnCancel,
9591
+ destructiveTriggerContent,
9592
+ ...props
9593
+ }, ref) => {
9594
+ const effectiveDestructiveTitle = destructiveTitle ?? props.title;
9595
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9596
+ ButtonBase,
9446
9597
  {
9447
- size: iconSize,
9448
- color: iconColor,
9449
- className: "transition-transform duration-200 group-hover:scale-110"
9598
+ ref,
9599
+ variant,
9600
+ size,
9601
+ onClick,
9602
+ disabled,
9603
+ testid,
9604
+ className: cn(
9605
+ "transition-all duration-200 ease-in-out group",
9606
+ "hover:scale-105",
9607
+ "active:scale-95",
9608
+ "disabled:hover:scale-100",
9609
+ className
9610
+ ),
9611
+ ...props,
9612
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9613
+ import_react40.TrashIcon,
9614
+ {
9615
+ size: iconSize,
9616
+ color: iconColor,
9617
+ className: "transition-transform duration-200 group-hover:scale-110"
9618
+ }
9619
+ )
9450
9620
  }
9451
- )
9621
+ );
9622
+ if (effectiveDestructiveTitle) {
9623
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
9624
+ DestructiveDialog,
9625
+ {
9626
+ title: effectiveDestructiveTitle,
9627
+ description: destructiveDescription ?? "Essa a\xE7\xE3o \xE9 irrevers\xEDvel.",
9628
+ onConfirm: destructiveOnConfirm ?? (() => {
9629
+ }),
9630
+ onCancel: destructiveOnCancel,
9631
+ triggerContent: destructiveTriggerContent,
9632
+ children: trigger
9633
+ }
9634
+ );
9635
+ }
9636
+ return trigger;
9452
9637
  }
9453
9638
  );
9639
+ DeleteButton.displayName = "DeleteButton";
9454
9640
  var DownloadButton = ({
9455
9641
  disabled,
9456
9642
  onClick,
@@ -9956,7 +10142,7 @@ var import_react42 = require("@phosphor-icons/react");
9956
10142
  var import_jsx_runtime62 = require("react/jsx-runtime");
9957
10143
 
9958
10144
  // src/components/ui/FileUploader.tsx
9959
- var React38 = __toESM(require("react"));
10145
+ var React39 = __toESM(require("react"));
9960
10146
  var import_framer_motion16 = require("framer-motion");
9961
10147
  var import_react43 = require("@phosphor-icons/react");
9962
10148
  var import_jsx_runtime63 = require("react/jsx-runtime");
@@ -10023,7 +10209,7 @@ var createImagePreview = (file) => {
10023
10209
  reader.readAsDataURL(file);
10024
10210
  });
10025
10211
  };
10026
- var FileUploader = React38.forwardRef(
10212
+ var FileUploader = React39.forwardRef(
10027
10213
  ({
10028
10214
  className,
10029
10215
  accept,
@@ -10039,15 +10225,15 @@ var FileUploader = React38.forwardRef(
10039
10225
  animate = true,
10040
10226
  ...props
10041
10227
  }, ref) => {
10042
- const [isDragging, setIsDragging] = React38.useState(false);
10043
- const [files, setFiles] = React38.useState(value);
10044
- const inputRef = React38.useRef(null);
10045
- const dragCounterRef = React38.useRef(0);
10228
+ const [isDragging, setIsDragging] = React39.useState(false);
10229
+ const [files, setFiles] = React39.useState(value);
10230
+ const inputRef = React39.useRef(null);
10231
+ const dragCounterRef = React39.useRef(0);
10046
10232
  const multiple = maxFiles > 1;
10047
- React38.useEffect(() => {
10233
+ React39.useEffect(() => {
10048
10234
  setFiles(value);
10049
10235
  }, [value]);
10050
- React38.useEffect(() => {
10236
+ React39.useEffect(() => {
10051
10237
  return () => {
10052
10238
  files.forEach((file) => {
10053
10239
  if (file.preview) {
@@ -10397,14 +10583,150 @@ var FileUploader = React38.forwardRef(
10397
10583
  );
10398
10584
  FileUploader.displayName = "FileUploader";
10399
10585
 
10586
+ // src/components/ui/ModalBase.tsx
10587
+ var React40 = __toESM(require("react"));
10588
+ var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"));
10589
+ var import_react44 = require("@phosphor-icons/react");
10590
+ var import_jsx_runtime64 = require("react/jsx-runtime");
10591
+ var ModalBase = DialogPrimitive2.Root;
10592
+ var ModalTriggerBase = DialogPrimitive2.Trigger;
10593
+ var ModalPortalBase = DialogPrimitive2.Portal;
10594
+ var ModalCloseBase = DialogPrimitive2.Close;
10595
+ var ModalOverlayBase = React40.forwardRef(({ className, testid: dataTestId = "modal-overlay", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10596
+ DialogPrimitive2.Overlay,
10597
+ {
10598
+ ref,
10599
+ className: cn(
10600
+ "fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
10601
+ className
10602
+ ),
10603
+ "data-testid": dataTestId,
10604
+ ...props
10605
+ }
10606
+ ));
10607
+ ModalOverlayBase.displayName = DialogPrimitive2.Overlay.displayName;
10608
+ var ModalContentBase = React40.forwardRef(
10609
+ ({
10610
+ className,
10611
+ children,
10612
+ testid: dataTestId = "modal-content",
10613
+ size = "md",
10614
+ centered = true,
10615
+ backdropBlur = true,
10616
+ ...props
10617
+ }, ref) => {
10618
+ const sizeClass = size === "sm" ? "max-w-md" : size === "lg" ? "max-w-4xl" : size === "full" ? "w-full max-w-[calc(100%-2rem)]" : "max-w-2xl";
10619
+ const positionClass = centered ? "left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%]" : "left-[50%] top-20 translate-x-[-50%] translate-y-0 sm:translate-y-0";
10620
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(ModalPortalBase, { children: [
10621
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10622
+ ModalOverlayBase,
10623
+ {
10624
+ className: cn("bg-black/40", backdropBlur ? "backdrop-blur-sm" : "")
10625
+ }
10626
+ ),
10627
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10628
+ "style",
10629
+ {
10630
+ dangerouslySetInnerHTML: {
10631
+ __html: `
10632
+ @keyframes modal-fade-in { from { opacity: 0 } to { opacity: 1 } }
10633
+ @keyframes modal-fade-out { from { opacity: 1 } to { opacity: 0 } }
10634
+ @keyframes modal-scale-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.98) } to { opacity:1; transform: translate(-50%, -50%) scale(1) } }
10635
+ @keyframes modal-scale-out { from { opacity:1; transform: translate(-50%, -50%) scale(1) } to { opacity: 0; transform: translate(-50%, -48%) scale(.98) } }
10636
+ @keyframes overlay-fade-in { from { opacity: 0 } to { opacity: 1 } }
10637
+ @keyframes overlay-fade-out { from { opacity: 1 } to { opacity: 0 } }
10638
+ .data-[state=open]\\:animate-modal-in { animation: modal-fade-in 220ms cubic-bezier(.16,.84,.24,1) both, modal-scale-in 220ms cubic-bezier(.16,.84,.24,1) both }
10639
+ .data-[state=closed]\\:animate-modal-out { animation: modal-scale-out 160ms cubic-bezier(.16,.84,.24,1) both, modal-fade-out 160ms cubic-bezier(.16,.84,.24,1) both }
10640
+ .data-[state=open]\\:animate-overlay-in { animation: overlay-fade-in 220ms cubic-bezier(.16,.84,.24,1) both }
10641
+ .data-[state=closed]\\:animate-overlay-out { animation: overlay-fade-out 160ms cubic-bezier(.16,.84,.24,1) both }
10642
+ `
10643
+ }
10644
+ }
10645
+ ),
10646
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
10647
+ DialogPrimitive2.Content,
10648
+ {
10649
+ ref,
10650
+ className: cn(
10651
+ "fixed z-50 grid w-full gap-4 border bg-background p-6 shadow-lg sm:rounded-lg max-h-[90dvh] overflow-auto",
10652
+ "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out",
10653
+ positionClass,
10654
+ sizeClass,
10655
+ className
10656
+ ),
10657
+ "data-testid": dataTestId,
10658
+ ...props,
10659
+ children: [
10660
+ children,
10661
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DialogPrimitive2.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-md bg-muted/10 p-1.5 opacity-80 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none z-10 hover:bg-muted/20 transition-colors", children: [
10662
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react44.XIcon, { className: "h-5 w-5 sm:h-4 sm:w-4 text-foreground" }),
10663
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "sr-only", children: "Close" })
10664
+ ] })
10665
+ ]
10666
+ }
10667
+ )
10668
+ ] });
10669
+ }
10670
+ );
10671
+ ModalContentBase.displayName = DialogPrimitive2.Content.displayName;
10672
+ var ModalHeaderBase = React40.forwardRef(({ className, testid: dataTestId = "modal-header", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10673
+ "div",
10674
+ {
10675
+ ref,
10676
+ className: cn(
10677
+ "flex flex-col space-y-1.5 text-center sm:text-left",
10678
+ className
10679
+ ),
10680
+ "data-testid": dataTestId,
10681
+ ...props
10682
+ }
10683
+ ));
10684
+ ModalHeaderBase.displayName = "ModalHeader";
10685
+ var ModalFooterBase = React40.forwardRef(({ className, testid: dataTestId = "modal-footer", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10686
+ "div",
10687
+ {
10688
+ ref,
10689
+ className: cn(
10690
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
10691
+ className
10692
+ ),
10693
+ "data-testid": dataTestId,
10694
+ ...props
10695
+ }
10696
+ ));
10697
+ ModalFooterBase.displayName = "ModalFooter";
10698
+ var ModalTitleBase = React40.forwardRef(({ className, testid: dataTestId = "modal-title", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10699
+ DialogPrimitive2.Title,
10700
+ {
10701
+ ref,
10702
+ className: cn(
10703
+ "text-lg font-semibold leading-none tracking-tight",
10704
+ className
10705
+ ),
10706
+ "data-testid": dataTestId,
10707
+ ...props
10708
+ }
10709
+ ));
10710
+ ModalTitleBase.displayName = DialogPrimitive2.Title.displayName;
10711
+ var ModalDescriptionBase = React40.forwardRef(({ className, testid: dataTestId = "modal-description", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10712
+ DialogPrimitive2.Description,
10713
+ {
10714
+ ref,
10715
+ className: cn("text-sm text-muted-foreground", className),
10716
+ "data-testid": dataTestId,
10717
+ ...props
10718
+ }
10719
+ ));
10720
+ ModalDescriptionBase.displayName = DialogPrimitive2.Description.displayName;
10721
+
10400
10722
  // src/hooks/use-drag.tsx
10401
- var import_react44 = require("react");
10723
+ var import_react45 = require("react");
10402
10724
  var useDrag = (options = {}) => {
10403
- const [isDragging, setIsDragging] = (0, import_react44.useState)(null);
10404
- const [positions, setPositions] = (0, import_react44.useState)({});
10405
- const dragStartPos = (0, import_react44.useRef)(null);
10406
- const dragId = (0, import_react44.useRef)(null);
10407
- const handleMouseDown = (0, import_react44.useCallback)((id, e) => {
10725
+ const [isDragging, setIsDragging] = (0, import_react45.useState)(null);
10726
+ const [positions, setPositions] = (0, import_react45.useState)({});
10727
+ const dragStartPos = (0, import_react45.useRef)(null);
10728
+ const dragId = (0, import_react45.useRef)(null);
10729
+ const handleMouseDown = (0, import_react45.useCallback)((id, e) => {
10408
10730
  e.preventDefault();
10409
10731
  const currentPosition = positions[id] || { top: 0, left: 0 };
10410
10732
  dragStartPos.current = {
@@ -10417,7 +10739,7 @@ var useDrag = (options = {}) => {
10417
10739
  setIsDragging(id);
10418
10740
  options.onDragStart?.(id);
10419
10741
  }, [positions, options]);
10420
- const handleMouseMove = (0, import_react44.useCallback)((e) => {
10742
+ const handleMouseMove = (0, import_react45.useCallback)((e) => {
10421
10743
  if (!isDragging || !dragStartPos.current || !dragId.current) return;
10422
10744
  const deltaX = e.clientX - dragStartPos.current.x;
10423
10745
  const deltaY = e.clientY - dragStartPos.current.y;
@@ -10433,7 +10755,7 @@ var useDrag = (options = {}) => {
10433
10755
  }));
10434
10756
  options.onDrag?.(dragId.current, newPosition);
10435
10757
  }, [isDragging, options]);
10436
- const handleMouseUp = (0, import_react44.useCallback)(() => {
10758
+ const handleMouseUp = (0, import_react45.useCallback)(() => {
10437
10759
  if (dragId.current) {
10438
10760
  options.onDragEnd?.(dragId.current);
10439
10761
  }
@@ -10441,7 +10763,7 @@ var useDrag = (options = {}) => {
10441
10763
  dragStartPos.current = null;
10442
10764
  dragId.current = null;
10443
10765
  }, [options]);
10444
- (0, import_react44.useEffect)(() => {
10766
+ (0, import_react45.useEffect)(() => {
10445
10767
  if (isDragging) {
10446
10768
  document.addEventListener("mousemove", handleMouseMove);
10447
10769
  document.addEventListener("mouseup", handleMouseUp);
@@ -10453,16 +10775,16 @@ var useDrag = (options = {}) => {
10453
10775
  };
10454
10776
  }
10455
10777
  }, [isDragging, handleMouseMove, handleMouseUp]);
10456
- const setPosition = (0, import_react44.useCallback)((id, position) => {
10778
+ const setPosition = (0, import_react45.useCallback)((id, position) => {
10457
10779
  setPositions((prev) => ({
10458
10780
  ...prev,
10459
10781
  [id]: position
10460
10782
  }));
10461
10783
  }, []);
10462
- const getPosition = (0, import_react44.useCallback)((id) => {
10784
+ const getPosition = (0, import_react45.useCallback)((id) => {
10463
10785
  return positions[id] || { top: 0, left: 0 };
10464
10786
  }, [positions]);
10465
- const isElementDragging = (0, import_react44.useCallback)((id) => {
10787
+ const isElementDragging = (0, import_react45.useCallback)((id) => {
10466
10788
  return isDragging === id;
10467
10789
  }, [isDragging]);
10468
10790
  return {