@wistia/ui 0.13.7 → 0.13.8-beta.39055ec4.95b9e2c

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
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.13.7
3
+ * @license @wistia/ui v0.13.8-beta.39055ec4.95b9e2c
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1453,8 +1453,9 @@ var import_styled_components7 = require("styled-components");
1453
1453
  var zIndexTokens = import_styled_components7.css`
1454
1454
  --wui-zindex-under: -1;
1455
1455
  --wui-zindex-backdrop: 500;
1456
- --wui-zindex-modal: 500;
1457
1456
  --wui-zindex-menu: 500;
1457
+ --wui-zindex-modal: 500;
1458
+ --wui-zindex-popover: 500;
1458
1459
  --wui-zindex-select: 500;
1459
1460
  --wui-zindex-tooltip: 500;
1460
1461
  `;
@@ -1673,6 +1674,7 @@ var minutesInHour = 60;
1673
1674
  var halfAnHourInMinutes = 30;
1674
1675
  var hoursInDay = 24;
1675
1676
  var milisecondsInSecond = 1e3;
1677
+ var daysInWeek = 7;
1676
1678
  var millisecondsInDay = hoursInDay * minutesInHour * secondsInMinute * milisecondsInSecond;
1677
1679
 
1678
1680
  // src/helpers/dateTime/buildTimeDuration.ts
@@ -1816,7 +1818,7 @@ var dateTimeRounded = (dateTime2, toISOString = true) => {
1816
1818
 
1817
1819
  // src/helpers/dateTime/dateTimeString.ts
1818
1820
  var import_type_guards3 = require("@wistia/type-guards");
1819
- var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
1821
+ var dateTimeString = (date, { timeZone = defaultTimeZone, omitYear } = {}) => {
1820
1822
  if ((0, import_type_guards3.isNil)(date)) {
1821
1823
  return "";
1822
1824
  }
@@ -1825,11 +1827,15 @@ var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
1825
1827
  return "";
1826
1828
  }
1827
1829
  try {
1828
- return new Intl.DateTimeFormat(defaultLocales, {
1829
- dateStyle: "medium",
1830
- timeStyle: "short",
1830
+ const baseOptions = {
1831
+ month: "short",
1832
+ day: "numeric",
1833
+ hour: "numeric",
1834
+ minute: "2-digit",
1831
1835
  timeZone
1832
- }).format(formattedDate);
1836
+ };
1837
+ const options = omitYear ? baseOptions : { ...baseOptions, year: "numeric" };
1838
+ return formattedDate.toLocaleDateString(defaultLocales, options);
1833
1839
  } catch (error) {
1834
1840
  console.error(error);
1835
1841
  return "";
@@ -1980,13 +1986,12 @@ var differenceInCalendarDays = (dateLeft, dateRight) => {
1980
1986
  };
1981
1987
 
1982
1988
  // src/helpers/dateTime/timeAgoString.ts
1983
- var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
1984
- if (isInvalidDate(date)) {
1985
- return "";
1986
- }
1989
+ var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date(), includeTime = true } = {}) => {
1990
+ if (isInvalidDate(date)) return "";
1987
1991
  const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (secondsInMinute * milisecondsInSecond);
1988
1992
  const minutesAgoRounded = Math.round(minutesAgo);
1989
1993
  const differenceInDays = differenceInCalendarDays(nowAnchor, date);
1994
+ const isSameYear = date.getFullYear() === nowAnchor.getFullYear();
1990
1995
  if (minutesAgo < 0) {
1991
1996
  return dateTimeString(date);
1992
1997
  }
@@ -2000,20 +2005,15 @@ var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
2000
2005
  return `${minutesAgoRounded} minutes ago`;
2001
2006
  }
2002
2007
  if (differenceInDays === 0) {
2003
- return `Today, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
2008
+ return includeTime ? `Today, ${Intl.DateTimeFormat(defaultLocales, { hour: "numeric", minute: "2-digit" }).format(date)}` : "Today";
2004
2009
  }
2005
2010
  if (differenceInDays === 1) {
2006
- return `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
2011
+ return includeTime ? `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { hour: "numeric", minute: "2-digit" }).format(date)}` : "Yesterday";
2007
2012
  }
2008
- if (date.getFullYear() === nowAnchor.getFullYear()) {
2009
- return Intl.DateTimeFormat(defaultLocales, {
2010
- day: "numeric",
2011
- month: "short",
2012
- hour: "numeric",
2013
- minute: "2-digit"
2014
- }).format(date);
2013
+ if (differenceInDays < daysInWeek && !includeTime) {
2014
+ return `on ${dayOfWeekString(date)}`;
2015
2015
  }
2016
- return dateTimeString(date);
2016
+ return includeTime ? dateTimeString(date, { omitYear: isSameYear }) : dateOnlyString(date, { omitYear: isSameYear });
2017
2017
  };
2018
2018
 
2019
2019
  // src/helpers/dateTime/timeOnlyString.ts
@@ -14523,6 +14523,7 @@ PopoverArrow.displayName = "PopoverArrow_UI";
14523
14523
  // src/components/Popover/Popover.tsx
14524
14524
  var import_jsx_runtime282 = require("react/jsx-runtime");
14525
14525
  var StyledContent2 = (0, import_styled_components90.default)(import_react_popover5.Content)`
14526
+ z-index: var(--wui-zindex-popover);
14526
14527
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
14527
14528
  ${({ $unstyled }) => !$unstyled && import_styled_components90.css`
14528
14529
  border-radius: var(--wui-border-radius-02);