@wistia/ui 0.5.0 → 0.5.1-beta.4cd1e5cc.3a549dd

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.5.0
3
+ * @license @wistia/ui v0.5.1-beta.4cd1e5cc.3a549dd
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1461,6 +1461,396 @@ var copyToClipboard = async (textToCopy) => {
1461
1461
  });
1462
1462
  };
1463
1463
 
1464
+ // src/helpers/dateTime/constants.ts
1465
+ var defaultLocales = ["en-US"];
1466
+ var defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
1467
+ var secondsInMinute = 60;
1468
+ var minutesInHour = 60;
1469
+ var halfAnHourInMinutes = 30;
1470
+ var hoursInDay = 24;
1471
+ var milisecondsInSecond = 1e3;
1472
+ var millisecondsInDay = hoursInDay * minutesInHour * secondsInMinute * milisecondsInSecond;
1473
+
1474
+ // src/helpers/dateTime/buildTimeDuration.ts
1475
+ var buildTimeDuration = (numberOfMilliseconds) => {
1476
+ const numberOfSeconds = Math.floor(numberOfMilliseconds / milisecondsInSecond);
1477
+ const numberOfMinutes = Math.floor(numberOfSeconds / secondsInMinute);
1478
+ const numberOfHours = Math.floor(numberOfMinutes / minutesInHour);
1479
+ const seconds = numberOfSeconds - numberOfMinutes * secondsInMinute;
1480
+ const minutes = numberOfMinutes - numberOfHours * minutesInHour;
1481
+ return { seconds, minutes, hours: numberOfHours };
1482
+ };
1483
+
1484
+ // src/helpers/dateTime/isDate.ts
1485
+ var isDate = (date) => date instanceof Date;
1486
+
1487
+ // src/helpers/dateTime/isInvalidDate.ts
1488
+ var isInvalidDate = (date) => {
1489
+ if (!isDate(date)) {
1490
+ return true;
1491
+ }
1492
+ const time = date.getTime();
1493
+ return time === 0 || Number.isNaN(time);
1494
+ };
1495
+
1496
+ // src/helpers/dateTime/dateOnlyISOString.ts
1497
+ var dateOnlyISOString = (date, { timeZone = defaultTimeZone } = {}) => {
1498
+ if (!isDate(date) || isInvalidDate(date)) {
1499
+ return "";
1500
+ }
1501
+ try {
1502
+ const formatter = new Intl.DateTimeFormat(defaultLocales, {
1503
+ year: "numeric",
1504
+ month: "2-digit",
1505
+ day: "2-digit",
1506
+ timeZone
1507
+ });
1508
+ const parts = formatter.formatToParts(date);
1509
+ const partsAsObject = parts.reduce(
1510
+ (map, obj) => {
1511
+ map[obj.type] = obj.value;
1512
+ return map;
1513
+ },
1514
+ {}
1515
+ );
1516
+ return `${partsAsObject.year}-${partsAsObject.month}-${partsAsObject.day}`;
1517
+ } catch (error) {
1518
+ console.error(error);
1519
+ return "";
1520
+ }
1521
+ };
1522
+
1523
+ // src/helpers/dateTime/dateOnlyString.ts
1524
+ var dateOnlyString = (date, { timeZone = defaultTimeZone, omitYear = false } = {}) => {
1525
+ if (!isDate(date) || isInvalidDate(date)) {
1526
+ return "";
1527
+ }
1528
+ const formatOptions = omitYear ? { month: "short", day: "numeric", timeZone } : { dateStyle: "medium", timeZone };
1529
+ try {
1530
+ return new Intl.DateTimeFormat(defaultLocales, formatOptions).format(date);
1531
+ } catch (error) {
1532
+ console.error(error);
1533
+ return "";
1534
+ }
1535
+ };
1536
+
1537
+ // src/helpers/dateTime/dateOnlyStringForSentence.ts
1538
+ var dateOnlyStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
1539
+ if (!isDate(date) || isInvalidDate(date)) {
1540
+ return "";
1541
+ }
1542
+ try {
1543
+ return new Intl.DateTimeFormat(defaultLocales, {
1544
+ dateStyle: "long",
1545
+ timeZone
1546
+ }).format(date);
1547
+ } catch (error) {
1548
+ console.error(error);
1549
+ return "";
1550
+ }
1551
+ };
1552
+
1553
+ // src/helpers/dateTime/dateOnlyStringNumeric.ts
1554
+ var dateOnlyStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
1555
+ if (!isDate(date) || isInvalidDate(date)) {
1556
+ return "";
1557
+ }
1558
+ try {
1559
+ return new Intl.DateTimeFormat(defaultLocales, {
1560
+ year: "numeric",
1561
+ month: "2-digit",
1562
+ day: "2-digit",
1563
+ timeZone
1564
+ }).format(date);
1565
+ } catch (error) {
1566
+ console.error(error);
1567
+ return "";
1568
+ }
1569
+ };
1570
+
1571
+ // src/helpers/dateTime/dateTimeToDate.ts
1572
+ var dateTimeToDate = (dateTime2) => {
1573
+ const { year, month, dayOfMonth, hours, minutes } = dateTime2 ?? {};
1574
+ if (year !== void 0 && month !== void 0 && dayOfMonth !== void 0) {
1575
+ return new Date(year, month, dayOfMonth, hours ?? 0, minutes ?? 0);
1576
+ }
1577
+ return null;
1578
+ };
1579
+
1580
+ // src/helpers/dateTime/dateToDateTime.ts
1581
+ var dateToDateTime = (date) => {
1582
+ if (!isDate(date)) {
1583
+ return null;
1584
+ }
1585
+ return {
1586
+ year: date.getFullYear(),
1587
+ month: date.getMonth(),
1588
+ dayOfMonth: date.getDate(),
1589
+ hours: date.getHours(),
1590
+ minutes: date.getMinutes()
1591
+ };
1592
+ };
1593
+
1594
+ // src/helpers/dateTime/dateTimeToISO.ts
1595
+ var dateTimeToISO = (dateTime2) => dateTimeToDate(dateTime2)?.toISOString() ?? null;
1596
+
1597
+ // src/helpers/dateTime/dateTimeRounded.ts
1598
+ var dateTimeRounded = (dateTime2, toISOString = true) => {
1599
+ const first30Min = dateTime2.getMinutes() <= halfAnHourInMinutes;
1600
+ const hours = first30Min ? dateTime2.getHours() : dateTime2.getHours() + 1;
1601
+ const minutes = first30Min ? halfAnHourInMinutes : 0;
1602
+ const dateWithTime = {
1603
+ ...dateToDateTime(dateTime2),
1604
+ hours,
1605
+ minutes
1606
+ };
1607
+ if (toISOString) {
1608
+ return dateTimeToISO(dateWithTime);
1609
+ }
1610
+ return dateTimeToDate(dateWithTime);
1611
+ };
1612
+
1613
+ // src/helpers/dateTime/dateTimeString.ts
1614
+ import { isNil as isNil2 } from "@wistia/type-guards";
1615
+ var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
1616
+ if (isNil2(date)) {
1617
+ return "";
1618
+ }
1619
+ const formattedDate = new Date(date);
1620
+ if (isInvalidDate(formattedDate)) {
1621
+ return "";
1622
+ }
1623
+ try {
1624
+ return new Intl.DateTimeFormat(defaultLocales, {
1625
+ dateStyle: "medium",
1626
+ timeStyle: "short",
1627
+ timeZone
1628
+ }).format(formattedDate);
1629
+ } catch (error) {
1630
+ console.error(error);
1631
+ return "";
1632
+ }
1633
+ };
1634
+
1635
+ // src/helpers/dateTime/dateTimeStringForSentence.ts
1636
+ var dateTimeStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
1637
+ if (!isDate(date) || isInvalidDate(date)) {
1638
+ return "";
1639
+ }
1640
+ try {
1641
+ const { year, month, day, hour, minute, dayPeriod } = new Intl.DateTimeFormat(defaultLocales, {
1642
+ month: "long",
1643
+ day: "numeric",
1644
+ year: "numeric",
1645
+ hour: "numeric",
1646
+ minute: "2-digit",
1647
+ timeZone
1648
+ }).formatToParts(date).reduce((acc, part) => {
1649
+ if (part.type !== "literal") {
1650
+ acc[part.type] = part.value;
1651
+ }
1652
+ return acc;
1653
+ }, {});
1654
+ return `${month} ${day}, ${year}, ${hour}:${minute} ${dayPeriod}`;
1655
+ } catch (error) {
1656
+ console.error(error);
1657
+ return "";
1658
+ }
1659
+ };
1660
+
1661
+ // src/helpers/dateTime/dateUTCOffset.ts
1662
+ var dateUTCOffset = (date) => {
1663
+ const offsetInHours = date.getTimezoneOffset() / minutesInHour * -1;
1664
+ const hours = Math.round(offsetInHours);
1665
+ const minutes = (offsetInHours - hours) * minutesInHour;
1666
+ const prefix = hours >= 0 ? "+" : "";
1667
+ const hoursString = `${hours}`.padStart(2, "0");
1668
+ const minutesString = `${minutes}`.padStart(2, "0");
1669
+ return `${prefix}${hoursString}:${minutesString}`;
1670
+ };
1671
+
1672
+ // src/helpers/dateTime/dayOfWeekString.ts
1673
+ var dayOfWeekString = (date, { timeZone = defaultTimeZone } = {}) => {
1674
+ if (date === null) {
1675
+ return "";
1676
+ }
1677
+ try {
1678
+ return new Intl.DateTimeFormat(defaultLocales, {
1679
+ weekday: "long",
1680
+ timeZone
1681
+ }).format(date);
1682
+ } catch (error) {
1683
+ console.error(error);
1684
+ return "";
1685
+ }
1686
+ };
1687
+
1688
+ // src/helpers/dateTime/padTimeInteger.ts
1689
+ var padTimeInteger = (num) => num.toString().padStart(2, "0");
1690
+
1691
+ // src/helpers/dateTime/mediaDurationString.ts
1692
+ var mediaDurationString = (numberOfMilliseconds) => {
1693
+ const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
1694
+ if (hours < 1) {
1695
+ return `${minutes}:${padTimeInteger(seconds)}`;
1696
+ }
1697
+ return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
1698
+ };
1699
+
1700
+ // src/helpers/dateTime/millisecondsToDurationISOString.ts
1701
+ var millisecondsToDurationISOString = (numberOfMilliseconds) => {
1702
+ const { seconds, minutes, hours } = buildTimeDuration(numberOfMilliseconds);
1703
+ let string = "PT";
1704
+ if (hours) {
1705
+ string += `${hours}H`;
1706
+ }
1707
+ if (minutes) {
1708
+ string += `${minutes}M`;
1709
+ }
1710
+ if (seconds) {
1711
+ string += `${seconds}S`;
1712
+ }
1713
+ if (!(seconds || minutes || hours)) {
1714
+ string += "0S";
1715
+ }
1716
+ return string;
1717
+ };
1718
+
1719
+ // src/helpers/dateTime/monthDayStringNumeric.ts
1720
+ var monthDayStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
1721
+ if (!isDate(date) || isInvalidDate(date)) {
1722
+ return "";
1723
+ }
1724
+ try {
1725
+ return new Intl.DateTimeFormat(defaultLocales, {
1726
+ month: "2-digit",
1727
+ day: "2-digit",
1728
+ timeZone
1729
+ }).format(date);
1730
+ } catch (error) {
1731
+ console.error(error);
1732
+ return "";
1733
+ }
1734
+ };
1735
+
1736
+ // src/helpers/dateTime/sessionDurationString.ts
1737
+ var sessionDurationString = (numberOfMilliseconds) => {
1738
+ const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
1739
+ return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
1740
+ };
1741
+
1742
+ // src/helpers/dateTime/getLocalDateParts.ts
1743
+ import { isNil as isNil3 } from "@wistia/type-guards";
1744
+ var getLocalDateParts = (date) => {
1745
+ const parts = new Intl.DateTimeFormat(defaultLocales, {
1746
+ year: "numeric",
1747
+ month: "numeric",
1748
+ day: "numeric",
1749
+ timeZone: defaultTimeZone
1750
+ }).formatToParts(date);
1751
+ const yearPart = parts.find((part) => part.type === "year");
1752
+ const monthPart = parts.find((part) => part.type === "month");
1753
+ const dayPart = parts.find((part) => part.type === "day");
1754
+ if (isNil3(yearPart) || isNil3(monthPart) || isNil3(dayPart)) {
1755
+ throw new Error("Failed to parse date parts");
1756
+ }
1757
+ const year = parseInt(yearPart.value, 10);
1758
+ const month = parseInt(monthPart.value, 10);
1759
+ const day = parseInt(dayPart.value, 10);
1760
+ return { year, month, day };
1761
+ };
1762
+
1763
+ // src/helpers/dateTime/differenceInCalendarDays.ts
1764
+ var differenceInCalendarDays = (dateLeft, dateRight) => {
1765
+ const leftDate = isDate(dateLeft) ? dateLeft : new Date(dateLeft);
1766
+ const rightDate = isDate(dateRight) ? dateRight : new Date(dateRight);
1767
+ if (Number.isNaN(leftDate.getTime()) || Number.isNaN(rightDate.getTime())) {
1768
+ return NaN;
1769
+ }
1770
+ const { year: y1, month: m1, day: d1 } = getLocalDateParts(leftDate);
1771
+ const { year: y2, month: m2, day: d2 } = getLocalDateParts(rightDate);
1772
+ const startOfDayLeft = new Date(y1, m1 - 1, d1).getTime();
1773
+ const startOfDayRight = new Date(y2, m2 - 1, d2).getTime();
1774
+ const msDiff = startOfDayLeft - startOfDayRight;
1775
+ return Math.round(msDiff / millisecondsInDay);
1776
+ };
1777
+
1778
+ // src/helpers/dateTime/timeAgoString.ts
1779
+ var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
1780
+ if (isInvalidDate(date)) {
1781
+ return "";
1782
+ }
1783
+ const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (secondsInMinute * milisecondsInSecond);
1784
+ const minutesAgoRounded = Math.round(minutesAgo);
1785
+ const differenceInDays = differenceInCalendarDays(nowAnchor, date);
1786
+ if (minutesAgo < 0) {
1787
+ return dateTimeString(date);
1788
+ }
1789
+ if (minutesAgo < 1) {
1790
+ return "< 1 minute ago";
1791
+ }
1792
+ if (minutesAgoRounded < 2) {
1793
+ return "1 minute ago";
1794
+ }
1795
+ if (minutesAgoRounded <= minutesInHour) {
1796
+ return `${minutesAgoRounded} minutes ago`;
1797
+ }
1798
+ if (differenceInDays === 0) {
1799
+ return `Today, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
1800
+ }
1801
+ if (differenceInDays === 1) {
1802
+ return `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
1803
+ }
1804
+ if (date.getFullYear() === nowAnchor.getFullYear()) {
1805
+ return Intl.DateTimeFormat(defaultLocales, {
1806
+ day: "numeric",
1807
+ month: "short",
1808
+ hour: "numeric",
1809
+ minute: "2-digit"
1810
+ }).format(date);
1811
+ }
1812
+ return dateTimeString(date);
1813
+ };
1814
+
1815
+ // src/helpers/dateTime/timeOnlyString.ts
1816
+ var timeOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
1817
+ if (!isDate(date) || isInvalidDate(date)) {
1818
+ return "";
1819
+ }
1820
+ try {
1821
+ return new Intl.DateTimeFormat(defaultLocales, {
1822
+ timeStyle: "short",
1823
+ timeZone
1824
+ }).format(date);
1825
+ } catch (error) {
1826
+ console.error(error);
1827
+ return "";
1828
+ }
1829
+ };
1830
+
1831
+ // src/helpers/dateTime/index.ts
1832
+ var dateTime = {
1833
+ buildTimeDuration,
1834
+ dateOnlyISOString,
1835
+ dateOnlyString,
1836
+ dateOnlyStringForSentence,
1837
+ dateOnlyStringNumeric,
1838
+ dateTimeRounded,
1839
+ dateTimeString,
1840
+ dateTimeStringForSentence,
1841
+ dateTimeToDate,
1842
+ dateTimeToISO,
1843
+ dateToDateTime,
1844
+ dateUTCOffset,
1845
+ dayOfWeekString,
1846
+ mediaDurationString,
1847
+ millisecondsToDurationISOString,
1848
+ monthDayStringNumeric,
1849
+ sessionDurationString,
1850
+ timeAgoString,
1851
+ timeOnlyString
1852
+ };
1853
+
1464
1854
  // src/helpers/mq/mq.ts
1465
1855
  import { getValueAndUnit } from "polished";
1466
1856
 
@@ -1590,9 +1980,9 @@ import { useCallback as useCallback3 } from "react";
1590
1980
  // src/private/hooks/useEvent/useEvent.ts
1591
1981
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
1592
1982
 
1593
- // src/private/helpers/isObjectRef/isObjectRef.ts
1983
+ // src/private/helpers/isValidRef/isValidRef.ts
1594
1984
  import { isNotNil, isRecord } from "@wistia/type-guards";
1595
- var isObjectRef = (value) => {
1985
+ var isValidRef = (value) => {
1596
1986
  return isNotNil(value) && isRecord(value) && "current" in value;
1597
1987
  };
1598
1988
 
@@ -1612,7 +2002,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
1612
2002
  savedEventOptions.current = eventOptions;
1613
2003
  }, [eventOptions]);
1614
2004
  useEffect2(() => {
1615
- const target = isObjectRef(eventTarget) ? eventTarget.current : eventTarget;
2005
+ const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
1616
2006
  if (!eventName || !isEventTargetSupported(target)) {
1617
2007
  return;
1618
2008
  }
@@ -1658,10 +2048,10 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
1658
2048
 
1659
2049
  // src/hooks/useAriaLive/useAriaLive.tsx
1660
2050
  import { useContext } from "react";
1661
- import { isNil as isNil2 } from "@wistia/type-guards";
2051
+ import { isNil as isNil4 } from "@wistia/type-guards";
1662
2052
  var useAriaLive = () => {
1663
2053
  const context = useContext(AriaLiveContext);
1664
- if (isNil2(context)) {
2054
+ if (isNil4(context)) {
1665
2055
  throw new Error("useAriaLive must be used within an AriaLiveProvider");
1666
2056
  }
1667
2057
  return context;
@@ -2160,7 +2550,7 @@ var buttonSizeStyles = {
2160
2550
  };
2161
2551
 
2162
2552
  // src/components/Icon/Icon.tsx
2163
- import { isNil as isNil3 } from "@wistia/type-guards";
2553
+ import { isNil as isNil5 } from "@wistia/type-guards";
2164
2554
  import styled3 from "styled-components";
2165
2555
 
2166
2556
  // src/components/Icon/icons/AbTestIcon.tsx
@@ -5358,13 +5748,13 @@ var Icon = ({
5358
5748
  ...otherProps
5359
5749
  }) => {
5360
5750
  const responsiveSize = useResponsiveProp(size);
5361
- if (isNil3(type)) {
5751
+ if (isNil5(type)) {
5362
5752
  throw new Error("An Icon component requires a `type` prop to be provided");
5363
5753
  }
5364
- if (isNil3(iconMap[type])) {
5754
+ if (isNil5(iconMap[type])) {
5365
5755
  throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
5366
5756
  }
5367
- if (isNil3(iconSizeMap[responsiveSize])) {
5757
+ if (isNil5(iconSizeMap[responsiveSize])) {
5368
5758
  throw new Error(
5369
5759
  `Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
5370
5760
  );
@@ -5396,12 +5786,12 @@ Icon.displayName = "Icon";
5396
5786
 
5397
5787
  // src/components/Link/Link.tsx
5398
5788
  import { forwardRef } from "react";
5399
- import { isNil as isNil4, isNotNil as isNotNil4, isNotUndefined as isNotUndefined2, isUndefined as isUndefined2 } from "@wistia/type-guards";
5789
+ import { isNil as isNil6, isNotNil as isNotNil4, isNotUndefined as isNotUndefined2, isUndefined as isUndefined2 } from "@wistia/type-guards";
5400
5790
  import styled4 from "styled-components";
5401
5791
  import { Link as RouterLink, useInRouterContext } from "react-router-dom";
5402
5792
  import { jsx as jsx161, jsxs as jsxs5 } from "react/jsx-runtime";
5403
5793
  var generateHref = (href, type, disabled) => {
5404
- if (disabled || isNil4(href)) {
5794
+ if (disabled || isNil6(href)) {
5405
5795
  return void 0;
5406
5796
  }
5407
5797
  let to = href;
@@ -5418,7 +5808,7 @@ var isLink = (props) => isNotUndefined2(props.href);
5418
5808
  var StyledLink = styled4.a`
5419
5809
  --link-icon-size: 14px;
5420
5810
 
5421
- ${({ href }) => isNil4(href) && buttonResetCss};
5811
+ ${({ href }) => isNil6(href) && buttonResetCss};
5422
5812
  ${({ $colorScheme }) => getColorScheme($colorScheme)}
5423
5813
  cursor: pointer;
5424
5814
  font-family: var(--wui-typography-family-default);
@@ -5796,7 +6186,7 @@ ActionButton.displayName = "ActionButton";
5796
6186
 
5797
6187
  // src/components/Avatar/Avatar.tsx
5798
6188
  import { useState as useState4, useMemo as useMemo3, useEffect as useEffect3 } from "react";
5799
- import { isNil as isNil6 } from "@wistia/type-guards";
6189
+ import { isNil as isNil8 } from "@wistia/type-guards";
5800
6190
  import styled8 from "styled-components";
5801
6191
 
5802
6192
  // src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
@@ -5839,13 +6229,13 @@ var ColorSchemeWrapper = ({
5839
6229
  ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
5840
6230
 
5841
6231
  // src/components/Avatar/formatNameForDisplay.tsx
5842
- import { isNil as isNil5, isString, isEmptyString } from "@wistia/type-guards";
6232
+ import { isNil as isNil7, isString, isEmptyString } from "@wistia/type-guards";
5843
6233
  var containsEmojiCharacter = (char) => {
5844
6234
  const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
5845
6235
  return emojiRegex.test(char);
5846
6236
  };
5847
6237
  var formatNameForDisplay = (name) => {
5848
- if (isNil5(name) || !isString(name) || isEmptyString(name) || containsEmojiCharacter(name)) {
6238
+ if (isNil7(name) || !isString(name) || isEmptyString(name) || containsEmojiCharacter(name)) {
5849
6239
  return "U";
5850
6240
  }
5851
6241
  const firstChar = name.trim().substring(0, 1);
@@ -5908,7 +6298,7 @@ var AvatarWrapper = styled8.div`
5908
6298
  max-height: ${({ $maxHeight }) => $maxHeight}px;
5909
6299
  `;
5910
6300
  var chooseColorScheme = (name) => {
5911
- if (isNil6(name) || name === "Anonymous") {
6301
+ if (isNil8(name) || name === "Anonymous") {
5912
6302
  return "default";
5913
6303
  }
5914
6304
  const filteredColors = colorSchemeOptions.filter(
@@ -5941,7 +6331,7 @@ var Avatar = ({
5941
6331
  };
5942
6332
  const avatarSize = heightAndWidth ?? avatarSizeMap[size];
5943
6333
  const avatarColor = useMemo3(() => chooseColorScheme(name), [name]);
5944
- const showInitials = isNil6(imageUrl) || imageLoadState === "error";
6334
+ const showInitials = isNil8(imageUrl) || imageLoadState === "error";
5945
6335
  return /* @__PURE__ */ jsx165(
5946
6336
  AvatarWrapper,
5947
6337
  {
@@ -6017,7 +6407,7 @@ Badge.displayName = "Badge";
6017
6407
  // src/components/Box/Box.tsx
6018
6408
  import { Children, cloneElement as cloneElement2, forwardRef as forwardRef5 } from "react";
6019
6409
  import styled10 from "styled-components";
6020
- import { isNotNil as isNotNil7, isNil as isNil7, isRecord as isRecord3 } from "@wistia/type-guards";
6410
+ import { isNotNil as isNotNil7, isNil as isNil9, isRecord as isRecord3 } from "@wistia/type-guards";
6021
6411
 
6022
6412
  // src/private/helpers/makePolymorphic/makePolymorphic.tsx
6023
6413
  var makePolymorphic = (component) => {
@@ -6090,7 +6480,7 @@ var wrapChildren = (children) => {
6090
6480
  if (isNotNil7(children)) {
6091
6481
  if (typeof children === "object" && isDev) {
6092
6482
  return Children.map(children, (child) => {
6093
- if (isNil7(child)) return null;
6483
+ if (isNil9(child)) return null;
6094
6484
  const elementParams = {};
6095
6485
  if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
6096
6486
  elementParams.hasBoxParent = true;
@@ -6237,7 +6627,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
6237
6627
 
6238
6628
  // src/components/ButtonGroup/ButtonGroup.tsx
6239
6629
  import styled13 from "styled-components";
6240
- import { isNil as isNil8 } from "@wistia/type-guards";
6630
+ import { isNil as isNil10 } from "@wistia/type-guards";
6241
6631
  import { jsx as jsx170 } from "react/jsx-runtime";
6242
6632
  var getAlignment = (align) => {
6243
6633
  if (align === "center") {
@@ -6277,7 +6667,7 @@ var ButtonGroup = ({
6277
6667
  fullWidth = false,
6278
6668
  ...otherProps
6279
6669
  }) => {
6280
- if (isNil8(children)) {
6670
+ if (isNil10(children)) {
6281
6671
  return null;
6282
6672
  }
6283
6673
  return /* @__PURE__ */ jsx170(
@@ -6527,7 +6917,7 @@ Label.displayName = "Label";
6527
6917
 
6528
6918
  // src/components/Label/LabelDescription.tsx
6529
6919
  import styled17 from "styled-components";
6530
- import { isNil as isNil9 } from "@wistia/type-guards";
6920
+ import { isNil as isNil11 } from "@wistia/type-guards";
6531
6921
  import { jsx as jsx174 } from "react/jsx-runtime";
6532
6922
  var StyledLabelDescription = styled17.div`
6533
6923
  color: var(--wui-color-text-secondary);
@@ -6539,7 +6929,7 @@ var LabelDescription = ({
6539
6929
  children,
6540
6930
  ...props
6541
6931
  }) => {
6542
- if (isNil9(children)) {
6932
+ if (isNil11(children)) {
6543
6933
  return null;
6544
6934
  }
6545
6935
  return /* @__PURE__ */ jsx174(StyledLabelDescription, { ...props, children });
@@ -7327,7 +7717,18 @@ IconButton.displayName = "IconButton";
7327
7717
  // src/components/Input/Input.tsx
7328
7718
  import { forwardRef as forwardRef12, cloneElement as cloneElement5, useRef as useRef6 } from "react";
7329
7719
  import styled26, { css as css21 } from "styled-components";
7330
- import { isNil as isNil10, isNotNil as isNotNil9 } from "@wistia/type-guards";
7720
+ import { isNil as isNil12, isNotNil as isNotNil10 } from "@wistia/type-guards";
7721
+
7722
+ // src/private/helpers/isReadyRef/isReadyRef.ts
7723
+ import { isNotNil as isNotNil9, isRecord as isRecord4, hasKey } from "@wistia/type-guards";
7724
+ var isReadyRef = (maybeRef) => {
7725
+ if (isRecord4(maybeRef) && hasKey(maybeRef, "current")) {
7726
+ return isNotNil9(maybeRef.current);
7727
+ }
7728
+ return false;
7729
+ };
7730
+
7731
+ // src/components/Input/Input.tsx
7331
7732
  import { jsx as jsx186, jsxs as jsxs15 } from "react/jsx-runtime";
7332
7733
  var inputStyles = css21`
7333
7734
  --wui-input-color-bg: var(--wui-color-bg-surface);
@@ -7414,9 +7815,6 @@ var StyledInputContainer = styled26.div`
7414
7815
  padding-right: 32px;
7415
7816
  }
7416
7817
  `;
7417
- var isValidRef = (ref) => {
7418
- return typeof ref === "object" && ref !== null && "current" in ref && isNotNil9(ref.current);
7419
- };
7420
7818
  var Input = forwardRef12(
7421
7819
  ({
7422
7820
  fullWidth = false,
@@ -7428,26 +7826,26 @@ var Input = forwardRef12(
7428
7826
  ...props
7429
7827
  }, externalRef) => {
7430
7828
  const internalRef = useRef6();
7431
- const ref = isValidRef(externalRef) ? externalRef : internalRef;
7829
+ const ref = isReadyRef(externalRef) ? externalRef : internalRef;
7432
7830
  let leftIconToDisplay = leftIcon;
7433
- if (isNil10(leftIcon) && type === "search") {
7831
+ if (isNil12(leftIcon) && type === "search") {
7434
7832
  leftIconToDisplay = /* @__PURE__ */ jsx186(Icon, { type: "search" });
7435
7833
  }
7436
- if (isNotNil9(leftIconToDisplay)) {
7834
+ if (isNotNil10(leftIconToDisplay)) {
7437
7835
  leftIconToDisplay = cloneElement5(leftIconToDisplay, {
7438
7836
  size: "md",
7439
7837
  className: "wui-input-left-icon"
7440
7838
  });
7441
7839
  }
7442
7840
  let rightIconToDisplay = rightIcon;
7443
- if (isNotNil9(rightIconToDisplay)) {
7841
+ if (isNotNil10(rightIconToDisplay)) {
7444
7842
  rightIconToDisplay = cloneElement5(rightIconToDisplay, {
7445
7843
  size: "md",
7446
7844
  className: "wui-input-right-icon"
7447
7845
  });
7448
7846
  }
7449
7847
  const handleFocus = (event) => {
7450
- if (isNotNil9(props.onFocus)) {
7848
+ if (isNotNil10(props.onFocus)) {
7451
7849
  props.onFocus(event);
7452
7850
  }
7453
7851
  if (autoSelect && ref && "current" in ref) {
@@ -7495,7 +7893,7 @@ import {
7495
7893
  DropdownMenuPortal,
7496
7894
  DropdownMenuContent
7497
7895
  } from "@radix-ui/react-dropdown-menu";
7498
- import { isNotNil as isNotNil10, isNotUndefined as isNotUndefined7 } from "@wistia/type-guards";
7896
+ import { isNotNil as isNotNil11, isNotUndefined as isNotUndefined7 } from "@wistia/type-guards";
7499
7897
  import { useMemo as useMemo7 } from "react";
7500
7898
 
7501
7899
  // src/components/Menu/MenuContext.tsx
@@ -7607,7 +8005,7 @@ var Menu = ({
7607
8005
  }) => {
7608
8006
  const contextValue = useMemo7(() => ({ compact }), [compact]);
7609
8007
  let controlProps = {
7610
- ...isNotNil10(onOpenChange) && isNotNil10(isOpen) ? { open: isOpen, onOpenChange } : {}
8008
+ ...isNotNil11(onOpenChange) && isNotNil11(isOpen) ? { open: isOpen, onOpenChange } : {}
7611
8009
  };
7612
8010
  if (disabled) {
7613
8011
  controlProps = {
@@ -7689,12 +8087,12 @@ import {
7689
8087
  DropdownMenuSubTrigger,
7690
8088
  DropdownMenuItem
7691
8089
  } from "@radix-ui/react-dropdown-menu";
7692
- import { isNotNil as isNotNil12 } from "@wistia/type-guards";
8090
+ import { isNotNil as isNotNil13 } from "@wistia/type-guards";
7693
8091
 
7694
8092
  // src/components/Menu/MenuItemButton.tsx
7695
8093
  import { forwardRef as forwardRef13 } from "react";
7696
8094
  import styled29 from "styled-components";
7697
- import { isNotNil as isNotNil11, isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
8095
+ import { isNotNil as isNotNil12, isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
7698
8096
  import { jsx as jsx189, jsxs as jsxs17 } from "react/jsx-runtime";
7699
8097
  var StyledButton3 = styled29(Button)`
7700
8098
  ${({ colorScheme }) => getColorScheme(colorScheme)};
@@ -7798,7 +8196,7 @@ var MenuItemButton = forwardRef13(({ children, appearance, command, icon, ...pro
7798
8196
  children: [
7799
8197
  props.leftIcon ? /* @__PURE__ */ jsx189(StyledLeftIconContainer, { children: props.leftIcon }) : null,
7800
8198
  /* @__PURE__ */ jsx189(StyledLabelAndDescriptionContainer, { children }),
7801
- isNotNil11(badge) || isNotNil11(command) ? /* @__PURE__ */ jsx189(StyledBadgeContainer, { children: badge ?? command }) : null,
8199
+ isNotNil12(badge) || isNotNil12(command) ? /* @__PURE__ */ jsx189(StyledBadgeContainer, { children: badge ?? command }) : null,
7802
8200
  props.rightIcon ? /* @__PURE__ */ jsx189(StyledRightIconContainer, { children: props.rightIcon }) : null
7803
8201
  ]
7804
8202
  }
@@ -7865,7 +8263,7 @@ var SubMenu = ({
7865
8263
  return isSmAndUp ? /* @__PURE__ */ jsxs18(DropdownMenuSub, { onOpenChange, children: [
7866
8264
  /* @__PURE__ */ jsxs18(SubMenuTrigger, { ...props, children: [
7867
8265
  /* @__PURE__ */ jsx191(MenuItemLabel, { children: label }),
7868
- isNotNil12(description) ? /* @__PURE__ */ jsx191(MenuItemDescription, { children: description }) : null
8266
+ isNotNil13(description) ? /* @__PURE__ */ jsx191(MenuItemDescription, { children: description }) : null
7869
8267
  ] }),
7870
8268
  /* @__PURE__ */ jsx191(DropdownMenuPortal2, { children: /* @__PURE__ */ jsx191(SubMenuContent, { $compact: compact, children }) })
7871
8269
  ] }) : /* @__PURE__ */ jsxs18(DropdownMenuGroup, { children: [
@@ -8052,7 +8450,7 @@ CheckboxMenuItem.displayName = "CheckboxMenuItem";
8052
8450
  import { forwardRef as forwardRef17 } from "react";
8053
8451
  import styled37 from "styled-components";
8054
8452
  import { Root as DialogRoot, Portal as DialogPortal } from "@radix-ui/react-dialog";
8055
- import { isNotNil as isNotNil15 } from "@wistia/type-guards";
8453
+ import { isNotNil as isNotNil16 } from "@wistia/type-guards";
8056
8454
 
8057
8455
  // src/components/Modal/ModalHeader.tsx
8058
8456
  import styled34 from "styled-components";
@@ -8079,7 +8477,7 @@ var ModalCloseButton = () => {
8079
8477
 
8080
8478
  // src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
8081
8479
  import styled33 from "styled-components";
8082
- import { isNotNil as isNotNil13 } from "@wistia/type-guards";
8480
+ import { isNotNil as isNotNil14 } from "@wistia/type-guards";
8083
8481
  import { jsx as jsx197 } from "react/jsx-runtime";
8084
8482
  var VisuallyHidden = styled33.div({ ...visuallyHiddenStyle });
8085
8483
  var VisuallyHiddenButFocusable = styled33.div({
@@ -8091,7 +8489,7 @@ var ScreenReaderOnly = ({
8091
8489
  focusable = false,
8092
8490
  ...otherProps
8093
8491
  }) => {
8094
- const accessibleText = isNotNil13(text) ? text : children;
8492
+ const accessibleText = isNotNil14(text) ? text : children;
8095
8493
  if (focusable) {
8096
8494
  return /* @__PURE__ */ jsx197(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
8097
8495
  }
@@ -8138,7 +8536,7 @@ import { Content as DialogContent } from "@radix-ui/react-dialog";
8138
8536
 
8139
8537
  // src/private/hooks/useFocusRestore/useFocusRestore.ts
8140
8538
  import { useRef as useRef7, useEffect as useEffect4 } from "react";
8141
- import { isNotNil as isNotNil14 } from "@wistia/type-guards";
8539
+ import { isNotNil as isNotNil15 } from "@wistia/type-guards";
8142
8540
  var useFocusRestore = () => {
8143
8541
  const previouslyFocusedRef = useRef7(null);
8144
8542
  useEffect4(() => {
@@ -8146,7 +8544,7 @@ var useFocusRestore = () => {
8146
8544
  }, []);
8147
8545
  useEffect4(() => {
8148
8546
  return () => {
8149
- if (isNotNil14(previouslyFocusedRef.current)) {
8547
+ if (isNotNil15(previouslyFocusedRef.current)) {
8150
8548
  setTimeout(() => {
8151
8549
  previouslyFocusedRef.current?.focus();
8152
8550
  }, 0);
@@ -8182,7 +8580,8 @@ var StyledModalContent = styled35(DialogContent)`
8182
8580
  max-width: 90vw;
8183
8581
  top: 50%;
8184
8582
  transform: translate(-50%, -50%);
8185
- min-width: ${({ $width }) => $width ?? "80vw"};
8583
+ min-width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
8584
+ width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
8186
8585
  }
8187
8586
 
8188
8587
  @keyframes contentShow {
@@ -8269,6 +8668,7 @@ Backdrop.displayName = "Backdrop";
8269
8668
 
8270
8669
  // src/components/Modal/Modal.tsx
8271
8670
  import { jsx as jsx201, jsxs as jsxs22 } from "react/jsx-runtime";
8671
+ var DEFAULT_MODAL_WIDTH = "532px";
8272
8672
  var ModalBody = styled37.div`
8273
8673
  flex-direction: column;
8274
8674
  display: flex;
@@ -8284,14 +8684,14 @@ var Modal = forwardRef17(
8284
8684
  isOpen,
8285
8685
  onRequestClose,
8286
8686
  title,
8287
- width,
8687
+ width = DEFAULT_MODAL_WIDTH,
8288
8688
  ...props
8289
8689
  }, ref) => {
8290
8690
  return /* @__PURE__ */ jsx201(
8291
8691
  DialogRoot,
8292
8692
  {
8293
8693
  onOpenChange: (open2) => {
8294
- if (!open2 && isNotNil15(onRequestClose)) {
8694
+ if (!open2 && isNotNil16(onRequestClose)) {
8295
8695
  onRequestClose();
8296
8696
  }
8297
8697
  },
@@ -8304,7 +8704,7 @@ var Modal = forwardRef17(
8304
8704
  ref,
8305
8705
  fullHeight,
8306
8706
  onOpenAutoFocus: (event) => {
8307
- if (isNotNil15(initialFocusRef) && initialFocusRef.current) {
8707
+ if (isNotNil16(initialFocusRef) && initialFocusRef.current) {
8308
8708
  event.preventDefault();
8309
8709
  requestAnimationFrame(() => {
8310
8710
  initialFocusRef.current?.focus();
@@ -8467,7 +8867,7 @@ Radio.displayName = "Radio";
8467
8867
  import { forwardRef as forwardRef19 } from "react";
8468
8868
  import styled39 from "styled-components";
8469
8869
  import { Root as ToggleGroupRoot } from "@radix-ui/react-toggle-group";
8470
- import { isNil as isNil11 } from "@wistia/type-guards";
8870
+ import { isNil as isNil13 } from "@wistia/type-guards";
8471
8871
  import { jsx as jsx203 } from "react/jsx-runtime";
8472
8872
  var StyledSegmentedControl = styled39(ToggleGroupRoot)`
8473
8873
  display: inline-flex;
@@ -8486,7 +8886,7 @@ var SegmentedControl = forwardRef19(
8486
8886
  onSelectedValueChange,
8487
8887
  ...props
8488
8888
  }, ref) => {
8489
- if (isNil11(children)) {
8889
+ if (isNil13(children)) {
8490
8890
  return null;
8491
8891
  }
8492
8892
  return /* @__PURE__ */ jsx203(
@@ -8512,7 +8912,7 @@ SegmentedControl.displayName = "SegmentedControl";
8512
8912
  import { forwardRef as forwardRef20 } from "react";
8513
8913
  import styled40 from "styled-components";
8514
8914
  import { Item as ToggleGroupItem } from "@radix-ui/react-toggle-group";
8515
- import { isNotNil as isNotNil16 } from "@wistia/type-guards";
8915
+ import { isNotNil as isNotNil17 } from "@wistia/type-guards";
8516
8916
  import { jsxs as jsxs24 } from "react/jsx-runtime";
8517
8917
  var StyledSegmentedControlItem = styled40(ToggleGroupItem)`
8518
8918
  all: unset; /* ToggleGroupItem is a button element */
@@ -8579,8 +8979,8 @@ var SegmentedControlItem = forwardRef20(
8579
8979
  StyledSegmentedControlItem,
8580
8980
  {
8581
8981
  ref,
8582
- $hasLabel: isNotNil16(label),
8583
- "aria-label": isNotNil16(label) ? void 0 : ariaLabel,
8982
+ $hasLabel: isNotNil17(label),
8983
+ "aria-label": isNotNil17(label) ? void 0 : ariaLabel,
8584
8984
  disabled,
8585
8985
  onClick: handleClick,
8586
8986
  value,
@@ -8597,7 +8997,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
8597
8997
  // src/components/Tag/Tag.tsx
8598
8998
  import { forwardRef as forwardRef21 } from "react";
8599
8999
  import styled41 from "styled-components";
8600
- import { isNil as isNil12, isNotNil as isNotNil17, isNonEmptyString as isNonEmptyString4 } from "@wistia/type-guards";
9000
+ import { isNil as isNil14, isNotNil as isNotNil18, isNonEmptyString as isNonEmptyString4 } from "@wistia/type-guards";
8601
9001
  import { Fragment as Fragment4, jsx as jsx204, jsxs as jsxs25 } from "react/jsx-runtime";
8602
9002
  var TagLabel = styled41.a`
8603
9003
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
@@ -8675,10 +9075,10 @@ var StyledTag = styled41.div`
8675
9075
  }
8676
9076
  `;
8677
9077
  var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
8678
- if (isNil12(onClickRemove)) {
9078
+ if (isNil14(onClickRemove)) {
8679
9079
  return null;
8680
9080
  }
8681
- if (isNil12(onClickRemoveLabel)) {
9081
+ if (isNil14(onClickRemoveLabel)) {
8682
9082
  throw new Error(
8683
9083
  "for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
8684
9084
  );
@@ -8707,7 +9107,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
8707
9107
  };
8708
9108
  var Tag = forwardRef21(
8709
9109
  ({ onClickRemove, colorScheme = "inherit", href, label, onClickRemoveLabel, ...otherProps }, ref) => {
8710
- const labelProps = isNotNil17(href) && isNonEmptyString4(href) ? { href, as: "a" } : { as: "span" };
9110
+ const labelProps = isNotNil18(href) && isNonEmptyString4(href) ? { href, as: "a" } : { as: "span" };
8711
9111
  return /* @__PURE__ */ jsxs25(
8712
9112
  StyledTag,
8713
9113
  {
@@ -8851,7 +9251,7 @@ Tooltip.displayName = "Tooltip";
8851
9251
 
8852
9252
  // src/components/WistiaLogo/WistiaLogo.tsx
8853
9253
  import styled43 from "styled-components";
8854
- import { isNotNil as isNotNil18 } from "@wistia/type-guards";
9254
+ import { isNotNil as isNotNil19 } from "@wistia/type-guards";
8855
9255
  import { jsx as jsx206, jsxs as jsxs27 } from "react/jsx-runtime";
8856
9256
  var renderBrandmark = (brandmarkColor, iconOnly) => {
8857
9257
  if (iconOnly) {
@@ -8945,7 +9345,7 @@ var WistiaLogo = ({
8945
9345
  ...otherProps,
8946
9346
  children: [
8947
9347
  /* @__PURE__ */ jsx206("title", { children: title }),
8948
- isNotNil18(description) ? /* @__PURE__ */ jsx206("desc", { children: description }) : null,
9348
+ isNotNil19(description) ? /* @__PURE__ */ jsx206("desc", { children: description }) : null,
8949
9349
  renderBrandmark(brandmarkColor, iconOnly),
8950
9350
  renderLogotype(logotypeColor, iconOnly)
8951
9351
  ]
@@ -9371,6 +9771,7 @@ export {
9371
9771
  WistiaLogo,
9372
9772
  colorSchemeOptions,
9373
9773
  copyToClipboard,
9774
+ dateTime,
9374
9775
  ellipsisFlexParentStyle,
9375
9776
  ellipsisStyle,
9376
9777
  iconSizeMap,