@embedreach/components 0.2.49 → 0.2.51

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.
@@ -10004,7 +10004,7 @@ const CalendarPlus2 = createLucideIcon("CalendarPlus2", [
10004
10004
  * This source code is licensed under the ISC license.
10005
10005
  * See the LICENSE file in the root directory of this source tree.
10006
10006
  */
10007
- const Calendar$1 = createLucideIcon("Calendar", [
10007
+ const Calendar = createLucideIcon("Calendar", [
10008
10008
  ["path", { d: "M8 2v4", key: "1cmpym" }],
10009
10009
  ["path", { d: "M16 2v4", key: "4m81vk" }],
10010
10010
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
@@ -46978,7 +46978,7 @@ const IconDefinitions = {
46978
46978
  UserIcon: User,
46979
46979
  UsersIcon: Users,
46980
46980
  UserEdit: UserPen,
46981
- ScheduleButton: Calendar$1,
46981
+ ScheduleButton: Calendar,
46982
46982
  SendButton: Send,
46983
46983
  BackButton: ChevronLeft,
46984
46984
  NextButton: ChevronRight,
@@ -46996,7 +46996,7 @@ const IconDefinitions = {
46996
46996
  */
46997
46997
  OneTimeBroadcast: Radio,
46998
46998
  PatronEntersList: List$1,
46999
- DateMilestone: Calendar$1,
46999
+ DateMilestone: Calendar,
47000
47000
  RealtimeActivity: CalendarPlus2,
47001
47001
  DuplicateIcon: Copy,
47002
47002
  /**
@@ -58307,10 +58307,9 @@ var Portal$2 = PopoverPortal;
58307
58307
  var Content2$1 = PopoverContent$1;
58308
58308
  const Popover = Root2$3;
58309
58309
  const PopoverTrigger = Trigger$2;
58310
- const PopoverContent = React__default.forwardRef(({ className: className2, align = "center", sideOffset = 4, ...props2 }, ref) => /* @__PURE__ */ jsx(Portal$2, { "data-reach-root": true, children: /* @__PURE__ */ jsx(
58310
+ const PopoverContent = React__default.forwardRef(({ className: className2, align = "center", sideOffset = 4, ...props2 }, ref) => /* @__PURE__ */ jsx(Portal$2, { children: /* @__PURE__ */ jsx(
58311
58311
  Content2$1,
58312
58312
  {
58313
- "data-reach-root": true,
58314
58313
  ref,
58315
58314
  align,
58316
58315
  sideOffset,
@@ -77621,57 +77620,58 @@ function RootProvider(props2) {
77621
77620
  function DayPicker(props2) {
77622
77621
  return jsx(RootProvider, __assign({}, props2, { children: jsx(Root$3, { initialProps: props2 }) }));
77623
77622
  }
77624
- function Calendar({
77623
+ function ReactCalendar({
77625
77624
  className: className2,
77626
77625
  classNames,
77627
77626
  showOutsideDays = true,
77628
77627
  ...props2
77629
77628
  }) {
77630
- return /* @__PURE__ */ jsx("div", { "data-reach-root": true, children: /* @__PURE__ */ jsx(
77629
+ const finalClassNames = {
77630
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
77631
+ month: "space-y-4",
77632
+ caption: "flex justify-center pt-1 relative items-center",
77633
+ caption_label: "text-sm font-medium",
77634
+ nav: "space-x-1 flex items-center",
77635
+ nav_button: cn$1(
77636
+ buttonVariants({ variant: "outline" }),
77637
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
77638
+ ),
77639
+ nav_button_previous: "absolute left-1",
77640
+ nav_button_next: "absolute right-1",
77641
+ table: "w-full border-collapse space-y-1",
77642
+ head_row: "flex",
77643
+ head_cell: "text-[#6b7280] rounded-md w-8 font-normal text-[0.8rem]",
77644
+ row: "flex w-full mt-2",
77645
+ cell: "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-[#f1f5f9] [&:has([aria-selected].day-outside)]:bg-[#f1f5f9]/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
77646
+ day: cn$1(
77647
+ buttonVariants({ variant: "ghost" }),
77648
+ "h-8 w-8 p-0 font-normal aria-selected:opacity-100"
77649
+ ),
77650
+ day_range_start: "day-range-start",
77651
+ day_range_end: "day-range-end",
77652
+ day_selected: "!bg-black !text-gray-200 hover:!bg-black hover:!text-gray-200 focus:!bg-black focus:!text-black",
77653
+ day_today: "bg-gray-200 text-black",
77654
+ day_outside: "day-outside text-[#94a3b8] aria-selected:bg-[#f1f5f9]/50 aria-selected:text-[#94a3b8]",
77655
+ day_disabled: "text-[#94a3b8] opacity-50",
77656
+ day_range_middle: "aria-selected:bg-[#f1f5f9] aria-selected:text-black",
77657
+ day_hidden: "invisible",
77658
+ ...classNames
77659
+ };
77660
+ return /* @__PURE__ */ jsx(
77631
77661
  DayPicker,
77632
77662
  {
77633
77663
  showOutsideDays,
77634
77664
  className: cn$1("p-3", className2),
77635
- classNames: {
77636
- months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
77637
- month: "space-y-4",
77638
- caption: "flex justify-center pt-1 relative items-center",
77639
- caption_label: "text-sm font-medium",
77640
- nav: "space-x-1 flex items-center",
77641
- nav_button: cn$1(
77642
- buttonVariants({ variant: "outline" }),
77643
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
77644
- ),
77645
- nav_button_previous: "absolute left-1",
77646
- nav_button_next: "absolute right-1",
77647
- table: "w-full border-collapse space-y-1",
77648
- head_row: "flex",
77649
- head_cell: "text-[#6b7280] rounded-md w-8 font-normal text-[0.8rem]",
77650
- row: "flex w-full mt-2",
77651
- cell: "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-[#f1f5f9] [&:has([aria-selected].day-outside)]:bg-[#f1f5f9]/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
77652
- day: cn$1(
77653
- buttonVariants({ variant: "ghost" }),
77654
- "h-8 w-8 p-0 font-normal aria-selected:opacity-100"
77655
- ),
77656
- day_range_start: "day-range-start",
77657
- day_range_end: "day-range-end",
77658
- day_selected: "!bg-black !text-gray-200 hover:!bg-black hover:!text-gray-200 focus:!bg-black focus:!text-black",
77659
- day_today: "bg-gray-200 text-black",
77660
- day_outside: "day-outside text-[#94a3b8] aria-selected:bg-[#f1f5f9]/50 aria-selected:text-[#94a3b8]",
77661
- day_disabled: "text-[#94a3b8] opacity-50",
77662
- day_range_middle: "aria-selected:bg-[#f1f5f9] aria-selected:text-black",
77663
- day_hidden: "invisible",
77664
- ...classNames
77665
- },
77665
+ classNames: finalClassNames,
77666
77666
  components: {
77667
77667
  IconLeft: () => /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
77668
77668
  IconRight: () => /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
77669
77669
  },
77670
77670
  ...props2
77671
77671
  }
77672
- ) });
77672
+ );
77673
77673
  }
77674
- Calendar.displayName = "Calendar";
77674
+ ReactCalendar.displayName = "Calendar";
77675
77675
  const ComboboxDemo = ({
77676
77676
  data,
77677
77677
  placeholder,
@@ -77797,13 +77797,13 @@ const SetScheduleTime = ({ setScheduleTime, setTimezone, timezone, scheduleTime,
77797
77797
  !scheduleTime && "text-muted-foreground"
77798
77798
  ),
77799
77799
  children: [
77800
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
77800
+ /* @__PURE__ */ jsx(Calendar, { className: "mr-2 h-4 w-4" }),
77801
77801
  scheduleTime ? scheduleTime === "now" ? "Send immediately" : format$1(new Date(scheduleTime), "PPP") : /* @__PURE__ */ jsx("span", { children: "Pick a date" })
77802
77802
  ]
77803
77803
  }
77804
77804
  ) }),
77805
77805
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 z-[60] pointer-events-auto", children: /* @__PURE__ */ jsx(
77806
- Calendar,
77806
+ ReactCalendar,
77807
77807
  {
77808
77808
  mode: "single",
77809
77809
  selected: scheduleTime ? new Date(scheduleTime) : void 0,
@@ -77815,6 +77815,7 @@ const SetScheduleTime = ({ setScheduleTime, setTimezone, timezone, scheduleTime,
77815
77815
  },
77816
77816
  initialFocus: true,
77817
77817
  classNames: {
77818
+ head_cell: "text-[#6b7280] rounded-md w-8 font-normal text-[0.8rem]",
77818
77819
  cell: "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-[#f1f5f9] [&:has([aria-selected].day-outside)]:bg-[#f1f5f9]/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
77819
77820
  day_range_start: "day-range-start",
77820
77821
  day_range_end: "day-range-end",
@@ -79451,7 +79452,7 @@ function MultiSelectDialog({
79451
79452
  emptyMessage = "No items found",
79452
79453
  handleSearchInput,
79453
79454
  extraCommandItems = [],
79454
- disabled = false
79455
+ canOpen = true
79455
79456
  }) {
79456
79457
  const [open, setOpen] = React.useState(false);
79457
79458
  const [searchQuery, setSearchQuery] = React.useState("");
@@ -79472,7 +79473,6 @@ function MultiSelectDialog({
79472
79473
  });
79473
79474
  }, [selectedValues, options]);
79474
79475
  const handleItemToggle = (optionValue) => {
79475
- if (disabled) return;
79476
79476
  setTempSelected((prev) => {
79477
79477
  const isSelected = prev.includes(optionValue);
79478
79478
  if (isSelected) {
@@ -79486,7 +79486,6 @@ function MultiSelectDialog({
79486
79486
  });
79487
79487
  };
79488
79488
  const handleSelectAll = () => {
79489
- if (disabled) return;
79490
79489
  const availableOptions = filteredOptions.filter(
79491
79490
  (option) => !tempSelected.includes(option.value)
79492
79491
  );
@@ -79494,24 +79493,20 @@ function MultiSelectDialog({
79494
79493
  setTempSelected((prev) => [...prev, ...toAdd.map((opt) => opt.value)]);
79495
79494
  };
79496
79495
  const handleDeselectAll = () => {
79497
- if (disabled) return;
79498
79496
  const filteredValues = new Set(filteredOptions.map((option) => option.value));
79499
79497
  setTempSelected((prev) => prev.filter((item) => !filteredValues.has(item)));
79500
79498
  };
79501
79499
  const handleApply = () => {
79502
- if (disabled) return;
79503
79500
  onValueChange(tempSelected);
79504
79501
  setSelectedValues(tempSelected);
79505
79502
  setOpen(false);
79506
79503
  };
79507
79504
  const handleCancel = () => {
79508
- if (disabled) return;
79509
79505
  setTempSelected(selectedValues);
79510
79506
  setSearchQuery("");
79511
79507
  setOpen(false);
79512
79508
  };
79513
79509
  const handleSearchKeyDown = (e4) => {
79514
- if (disabled) return;
79515
79510
  if (e4.key === "Enter" && searchQuery.trim() && handleSearchInput) {
79516
79511
  e4.preventDefault();
79517
79512
  handleSearchInput(searchQuery.trim());
@@ -79530,13 +79525,12 @@ function MultiSelectDialog({
79530
79525
  ).length;
79531
79526
  const selectedDisplay = getSelectedOptionsDisplay();
79532
79527
  const canSelectMore = !maxCount || tempSelected.length < maxCount;
79533
- return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: setOpen, children: [
79528
+ return /* @__PURE__ */ jsxs(Dialog, { open: open && canOpen, onOpenChange: setOpen, children: [
79534
79529
  /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
79535
79530
  Button$1,
79536
79531
  {
79537
79532
  variant: "outline",
79538
79533
  className: "w-full justify-between text-left font-normal h-9 p-3",
79539
- disabled,
79540
79534
  children: [
79541
79535
  /* @__PURE__ */ jsx("div", { className: "flex flex-nowrap items-center gap-1 max-w-[70%]", children: selectedDisplay.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) : selectedDisplay.length <= 2 ? selectedDisplay.map((item) => /* @__PURE__ */ jsx(
79542
79536
  Badge,
@@ -79587,8 +79581,7 @@ function MultiSelectDialog({
79587
79581
  value: searchQuery,
79588
79582
  onChange: (e4) => setSearchQuery(e4.target.value),
79589
79583
  onKeyDown: handleSearchKeyDown,
79590
- className: "pl-10 h-11",
79591
- disabled
79584
+ className: "pl-10 h-11"
79592
79585
  }
79593
79586
  ),
79594
79587
  handleSearchInput && searchQuery.trim() && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx(
@@ -79598,11 +79591,9 @@ function MultiSelectDialog({
79598
79591
  variant: "ghost",
79599
79592
  className: "h-6 w-6 p-0",
79600
79593
  onClick: () => {
79601
- if (disabled) return;
79602
79594
  handleSearchInput(searchQuery.trim());
79603
79595
  setSearchQuery("");
79604
79596
  },
79605
- disabled,
79606
79597
  children: /* @__PURE__ */ jsx(IconDefinitions.PlusIcon, { className: "h-3 w-3" })
79607
79598
  }
79608
79599
  ) })
@@ -79622,7 +79613,7 @@ function MultiSelectDialog({
79622
79613
  variant: "ghost",
79623
79614
  size: "sm",
79624
79615
  onClick: handleSelectAll,
79625
- disabled: disabled || !canSelectMore || filteredSelectedCount === filteredOptions.length,
79616
+ disabled: !canSelectMore || filteredSelectedCount === filteredOptions.length,
79626
79617
  className: "h-8 text-xs",
79627
79618
  children: "Select All"
79628
79619
  }
@@ -79633,7 +79624,7 @@ function MultiSelectDialog({
79633
79624
  variant: "ghost",
79634
79625
  size: "sm",
79635
79626
  onClick: handleDeselectAll,
79636
- disabled: disabled || filteredSelectedCount === 0,
79627
+ disabled: filteredSelectedCount === 0,
79637
79628
  className: "h-8 text-xs",
79638
79629
  children: "Clear All"
79639
79630
  }
@@ -79656,11 +79647,9 @@ function MultiSelectDialog({
79656
79647
  size: "sm",
79657
79648
  className: "mt-3",
79658
79649
  onClick: () => {
79659
- if (disabled) return;
79660
79650
  handleSearchInput(searchQuery.trim());
79661
79651
  setSearchQuery("");
79662
79652
  },
79663
- disabled,
79664
79653
  children: [
79665
79654
  /* @__PURE__ */ jsx(IconDefinitions.PlusIcon, { className: "h-3 w-3 mr-1" }),
79666
79655
  'Add "',
@@ -79671,7 +79660,7 @@ function MultiSelectDialog({
79671
79660
  )
79672
79661
  ] }) : filteredOptions.map((option) => {
79673
79662
  const isSelected = tempSelected.includes(option.value);
79674
- const isDisabled = disabled || !isSelected && !canSelectMore;
79663
+ const isDisabled = !isSelected && !canSelectMore;
79675
79664
  return /* @__PURE__ */ jsxs(
79676
79665
  CommandItem,
79677
79666
  {
@@ -79697,22 +79686,12 @@ function MultiSelectDialog({
79697
79686
  ] }) }) }),
79698
79687
  /* @__PURE__ */ jsx(Separator, {}),
79699
79688
  /* @__PURE__ */ jsx("div", { className: "p-6 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
79700
- /* @__PURE__ */ jsx(
79701
- Button$1,
79702
- {
79703
- variant: "outline",
79704
- onClick: handleCancel,
79705
- className: "flex-1",
79706
- disabled,
79707
- children: "Cancel"
79708
- }
79709
- ),
79689
+ /* @__PURE__ */ jsx(Button$1, { variant: "outline", onClick: handleCancel, className: "flex-1", children: "Cancel" }),
79710
79690
  /* @__PURE__ */ jsxs(
79711
79691
  Button$1,
79712
79692
  {
79713
79693
  onClick: handleApply,
79714
79694
  className: "flex-1 bg-primary hover:bg-primary/90",
79715
- disabled,
79716
79695
  children: [
79717
79696
  "Apply (",
79718
79697
  selectedCount,
@@ -79886,13 +79865,13 @@ const DateSegmentSelector = ({
79886
79865
  !date2 && "text-muted-foreground"
79887
79866
  ),
79888
79867
  children: [
79889
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
79868
+ /* @__PURE__ */ jsx(Calendar, { className: "mr-2 h-4 w-4" }),
79890
79869
  date2 ? format$1(date2, monthDayOnly ? "MMMM d" : "PPP") : /* @__PURE__ */ jsx("span", { children: placeholder })
79891
79870
  ]
79892
79871
  }
79893
79872
  ) }),
79894
79873
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
79895
- Calendar,
79874
+ ReactCalendar,
79896
79875
  {
79897
79876
  mode: "single",
79898
79877
  selected: date2,
@@ -81405,9 +81384,10 @@ const RecipientsTable = ({ recipients }) => {
81405
81384
  ] }, index2)) })
81406
81385
  ] }) }) });
81407
81386
  };
81408
- const AllOrSelectSegmentPicker = ({ onSelectionChange, defaultValue = "all" }) => {
81387
+ const AllOrSelectSegmentPicker = ({ onSelectionChange, defaultValue = "all", canEditAudience = true }) => {
81409
81388
  const [selected, setSelected] = useState(defaultValue);
81410
81389
  const handleSelect = (value) => {
81390
+ if (!canEditAudience) return;
81411
81391
  setSelected(value);
81412
81392
  onSelectionChange?.(value);
81413
81393
  };
@@ -81442,7 +81422,8 @@ const SegmentSection = ({
81442
81422
  allSegments,
81443
81423
  onAddSegment,
81444
81424
  onRemoveSegment,
81445
- setOpenCreateSegmentDialog
81425
+ setOpenCreateSegmentDialog,
81426
+ canEditAudience = true
81446
81427
  }) => {
81447
81428
  const handleValueChange = (newValues) => {
81448
81429
  const segmentsToAdd = newValues.filter((id2) => !segments.includes(id2));
@@ -81461,6 +81442,7 @@ const SegmentSection = ({
81461
81442
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
81462
81443
  MultiSelectDialog,
81463
81444
  {
81445
+ canAddValues: canEditAudience,
81464
81446
  selectedValues: segmentSelectedIds,
81465
81447
  setSelectedValues: setSegmentSelectedIds,
81466
81448
  options,
@@ -81494,7 +81476,8 @@ const SelectSegmentsContent = ({
81494
81476
  handleRemoveSegment,
81495
81477
  setOpenCreateSegmentDialog,
81496
81478
  segments,
81497
- defaultIsExcludeOpen = false
81479
+ defaultIsExcludeOpen = false,
81480
+ canEditAudience = true
81498
81481
  }) => {
81499
81482
  const [isExcludeOpen, setIsExcludeOpen] = useState(defaultIsExcludeOpen);
81500
81483
  return /* @__PURE__ */ jsxs("div", { children: [
@@ -81513,7 +81496,10 @@ const SelectSegmentsContent = ({
81513
81496
  /* @__PURE__ */ jsxs(
81514
81497
  Button$1,
81515
81498
  {
81516
- onClick: () => setIsExcludeOpen(!isExcludeOpen),
81499
+ onClick: () => {
81500
+ if (!canEditAudience) return;
81501
+ setIsExcludeOpen(!isExcludeOpen);
81502
+ },
81517
81503
  className: "flex items-center gap-1 transition-colors",
81518
81504
  size: "sm",
81519
81505
  children: [
@@ -81539,6 +81525,7 @@ const SelectSegmentsContent = ({
81539
81525
  children: /* @__PURE__ */ jsx(
81540
81526
  SegmentSection,
81541
81527
  {
81528
+ canEditAudience,
81542
81529
  segments: excludedSegments,
81543
81530
  allSegments: segments || [],
81544
81531
  onAddSegment: (id2) => handleAddSegment(id2, "exclude"),
@@ -81647,6 +81634,7 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81647
81634
  setIncludedSegments((prev) => [...prev, id2]);
81648
81635
  }
81649
81636
  };
81637
+ const canEditAudience = automation2?.status !== AutomationStatus.DRAFT;
81650
81638
  return /* @__PURE__ */ jsxs(MainPageWrapper, { title: title2, children: [
81651
81639
  isLoading || !segments || !initialStateSet ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching segments", "Finishing up"] }) }) : /* @__PURE__ */ jsxs("div", { className: "flex gap-8 w-full pb-4 px-4", children: [
81652
81640
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: [
@@ -81655,7 +81643,8 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81655
81643
  AllOrSelectSegmentPicker,
81656
81644
  {
81657
81645
  onSelectionChange: handleAudienceSelectionChange,
81658
- defaultValue: selectedAudience
81646
+ defaultValue: selectedAudience,
81647
+ canEditAudience
81659
81648
  }
81660
81649
  ),
81661
81650
  /* @__PURE__ */ jsx(AnimatePresence, { children: selectedAudience === "segments" && /* @__PURE__ */ jsx(
@@ -81669,6 +81658,7 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81669
81658
  children: /* @__PURE__ */ jsx(
81670
81659
  SelectSegmentsContent,
81671
81660
  {
81661
+ canEditAudience,
81672
81662
  includedSegments,
81673
81663
  excludedSegments,
81674
81664
  handleAddSegment,