@mieweb/ui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3869,7 +3869,7 @@ var MessageBubble = React48__namespace.forwardRef(
3869
3869
  "div",
3870
3870
  {
3871
3871
  className: chunkOR5DRJCW_cjs.cn(
3872
- "flex flex-col",
3872
+ "flex flex-1 flex-col min-w-0",
3873
3873
  isOutgoing ? "items-end" : "items-start"
3874
3874
  ),
3875
3875
  children: [
@@ -11463,32 +11463,103 @@ function getDefaultPresets(labels = {}) {
11463
11463
  { key: "last-30-days", label: last30Days }
11464
11464
  ];
11465
11465
  }
11466
+ function getExtendedPresets(labels = {}) {
11467
+ const {
11468
+ today = "Today",
11469
+ yesterday = "Yesterday",
11470
+ thisWeek = "This Week",
11471
+ lastWeek = "Last Week",
11472
+ thisMonth = "This Month",
11473
+ lastMonth = "Last Month",
11474
+ thisQuarter = "This Quarter",
11475
+ lastQuarter = "Last Quarter",
11476
+ thisYear = "This Year",
11477
+ lastYear = "Last Year",
11478
+ last24Hours = "Last 24 Hours",
11479
+ last7Days = "Last 7 Days",
11480
+ last30Days = "Last 30 Days",
11481
+ last90Days = "Last 90 Days",
11482
+ last365Days = "Last 365 Days"
11483
+ } = labels;
11484
+ return [
11485
+ { key: "today", label: today },
11486
+ { key: "yesterday", label: yesterday },
11487
+ { key: "last-24-hours", label: last24Hours },
11488
+ { key: "this-week", label: thisWeek },
11489
+ { key: "last-week", label: lastWeek },
11490
+ { key: "last-7-days", label: last7Days },
11491
+ { key: "this-month", label: thisMonth },
11492
+ { key: "last-month", label: lastMonth },
11493
+ { key: "last-30-days", label: last30Days },
11494
+ { key: "this-quarter", label: thisQuarter },
11495
+ { key: "last-quarter", label: lastQuarter },
11496
+ { key: "last-90-days", label: last90Days },
11497
+ { key: "this-year", label: thisYear },
11498
+ { key: "last-year", label: lastYear },
11499
+ { key: "last-365-days", label: last365Days }
11500
+ ];
11501
+ }
11502
+ function endOfDay(d) {
11503
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
11504
+ }
11466
11505
  function calculateDateRange(presetKey) {
11467
11506
  const now = /* @__PURE__ */ new Date();
11468
11507
  const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
11469
11508
  switch (presetKey) {
11470
11509
  case "today":
11471
- return {
11472
- start: today,
11473
- end: new Date(today.getTime() + 24 * 60 * 60 * 1e3 - 1)
11474
- };
11510
+ return { start: today, end: endOfDay(today) };
11511
+ case "yesterday": {
11512
+ const yesterday = new Date(today);
11513
+ yesterday.setDate(today.getDate() - 1);
11514
+ return { start: yesterday, end: endOfDay(yesterday) };
11515
+ }
11475
11516
  case "this-week": {
11476
11517
  const dayOfWeek = today.getDay();
11477
11518
  const sunday = new Date(today);
11478
11519
  sunday.setDate(today.getDate() - dayOfWeek);
11479
11520
  const saturday = new Date(sunday);
11480
11521
  saturday.setDate(sunday.getDate() + 6);
11481
- return { start: sunday, end: saturday };
11522
+ return { start: sunday, end: endOfDay(saturday) };
11523
+ }
11524
+ case "last-week": {
11525
+ const dayOfWeek = today.getDay();
11526
+ const lastSunday = new Date(today);
11527
+ lastSunday.setDate(today.getDate() - dayOfWeek - 7);
11528
+ const lastSaturday = new Date(lastSunday);
11529
+ lastSaturday.setDate(lastSunday.getDate() + 6);
11530
+ return { start: lastSunday, end: endOfDay(lastSaturday) };
11482
11531
  }
11483
11532
  case "this-month": {
11484
11533
  const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
11485
11534
  const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
11486
- return { start: firstDay, end: lastDay };
11535
+ return { start: firstDay, end: endOfDay(lastDay) };
11487
11536
  }
11488
11537
  case "last-month": {
11489
11538
  const firstDay = new Date(now.getFullYear(), now.getMonth() - 1, 1);
11490
11539
  const lastDay = new Date(now.getFullYear(), now.getMonth(), 0);
11491
- return { start: firstDay, end: lastDay };
11540
+ return { start: firstDay, end: endOfDay(lastDay) };
11541
+ }
11542
+ case "this-quarter": {
11543
+ const quarter = Math.floor(now.getMonth() / 3);
11544
+ const firstDay = new Date(now.getFullYear(), quarter * 3, 1);
11545
+ const lastDay = new Date(now.getFullYear(), quarter * 3 + 3, 0);
11546
+ return { start: firstDay, end: endOfDay(lastDay) };
11547
+ }
11548
+ case "last-quarter": {
11549
+ const quarter = Math.floor(now.getMonth() / 3);
11550
+ const firstDay = new Date(now.getFullYear(), (quarter - 1) * 3, 1);
11551
+ const lastDay = new Date(now.getFullYear(), quarter * 3, 0);
11552
+ return { start: firstDay, end: endOfDay(lastDay) };
11553
+ }
11554
+ case "this-year": {
11555
+ const firstDay = new Date(now.getFullYear(), 0, 1);
11556
+ const lastDay = new Date(now.getFullYear(), 11, 31);
11557
+ return { start: firstDay, end: endOfDay(lastDay) };
11558
+ }
11559
+ case "last-year": {
11560
+ const firstDay = new Date(now.getFullYear() - 1, 0, 1);
11561
+ const lastDay = new Date(now.getFullYear() - 1, 11, 31);
11562
+ return { start: firstDay, end: endOfDay(lastDay) };
11492
11563
  }
11493
11564
  case "last-24-hours":
11494
11565
  return {
@@ -11505,6 +11576,16 @@ function calculateDateRange(presetKey) {
11505
11576
  start: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3),
11506
11577
  end: now
11507
11578
  };
11579
+ case "last-90-days":
11580
+ return {
11581
+ start: new Date(now.getTime() - 90 * 24 * 60 * 60 * 1e3),
11582
+ end: now
11583
+ };
11584
+ case "last-365-days":
11585
+ return {
11586
+ start: new Date(now.getTime() - 365 * 24 * 60 * 60 * 1e3),
11587
+ end: now
11588
+ };
11508
11589
  default:
11509
11590
  return { start: null, end: null };
11510
11591
  }
@@ -40238,6 +40319,7 @@ exports.WebcamModal = WebcamModal;
40238
40319
  exports.WebsiteInput = WebsiteInput;
40239
40320
  exports.WebsiteInputGroup = WebsiteInputGroup;
40240
40321
  exports.bubbleVariants = bubbleVariants2;
40322
+ exports.calculateDateRange = calculateDateRange;
40241
40323
  exports.countBadgeVariants = countBadgeVariants;
40242
40324
  exports.countChipVariants = countChipVariants;
40243
40325
  exports.create24HourSchedule = create24HourSchedule;
@@ -40255,6 +40337,8 @@ exports.generateAttachmentId = generateAttachmentId;
40255
40337
  exports.generateId = generateId;
40256
40338
  exports.getConversationSubtitle = getConversationSubtitle;
40257
40339
  exports.getConversationTitle = getConversationTitle;
40340
+ exports.getDefaultPresets = getDefaultPresets;
40341
+ exports.getExtendedPresets = getExtendedPresets;
40258
40342
  exports.getFileType = getFileType;
40259
40343
  exports.getGoogleMapsSearchUrl = getGoogleMapsSearchUrl;
40260
40344
  exports.getGoogleMapsUrl = getGoogleMapsUrl;