@wistia/ui 0.5.0-beta.c2166ce5.bf657fa → 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.cjs +516 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +32 -56
- package/dist/index.d.ts +32 -56
- package/dist/index.mjs +460 -212
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.5.
|
|
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
|
*
|
|
@@ -56,7 +56,6 @@ __export(index_exports, {
|
|
|
56
56
|
DataCardTrend: () => DataCardTrend,
|
|
57
57
|
DataCards: () => DataCards,
|
|
58
58
|
Divider: () => Divider,
|
|
59
|
-
EditableHeading: () => EditableHeading,
|
|
60
59
|
Ellipsis: () => Ellipsis,
|
|
61
60
|
Form: () => Form,
|
|
62
61
|
FormErrorSummary: () => FormErrorSummary,
|
|
@@ -93,6 +92,7 @@ __export(index_exports, {
|
|
|
93
92
|
WistiaLogo: () => WistiaLogo,
|
|
94
93
|
colorSchemeOptions: () => colorSchemeOptions,
|
|
95
94
|
copyToClipboard: () => copyToClipboard,
|
|
95
|
+
dateTime: () => dateTime,
|
|
96
96
|
ellipsisFlexParentStyle: () => ellipsisFlexParentStyle,
|
|
97
97
|
ellipsisStyle: () => ellipsisStyle,
|
|
98
98
|
iconSizeMap: () => iconSizeMap,
|
|
@@ -1561,6 +1561,396 @@ var copyToClipboard = async (textToCopy) => {
|
|
|
1561
1561
|
});
|
|
1562
1562
|
};
|
|
1563
1563
|
|
|
1564
|
+
// src/helpers/dateTime/constants.ts
|
|
1565
|
+
var defaultLocales = ["en-US"];
|
|
1566
|
+
var defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
1567
|
+
var secondsInMinute = 60;
|
|
1568
|
+
var minutesInHour = 60;
|
|
1569
|
+
var halfAnHourInMinutes = 30;
|
|
1570
|
+
var hoursInDay = 24;
|
|
1571
|
+
var milisecondsInSecond = 1e3;
|
|
1572
|
+
var millisecondsInDay = hoursInDay * minutesInHour * secondsInMinute * milisecondsInSecond;
|
|
1573
|
+
|
|
1574
|
+
// src/helpers/dateTime/buildTimeDuration.ts
|
|
1575
|
+
var buildTimeDuration = (numberOfMilliseconds) => {
|
|
1576
|
+
const numberOfSeconds = Math.floor(numberOfMilliseconds / milisecondsInSecond);
|
|
1577
|
+
const numberOfMinutes = Math.floor(numberOfSeconds / secondsInMinute);
|
|
1578
|
+
const numberOfHours = Math.floor(numberOfMinutes / minutesInHour);
|
|
1579
|
+
const seconds = numberOfSeconds - numberOfMinutes * secondsInMinute;
|
|
1580
|
+
const minutes = numberOfMinutes - numberOfHours * minutesInHour;
|
|
1581
|
+
return { seconds, minutes, hours: numberOfHours };
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
// src/helpers/dateTime/isDate.ts
|
|
1585
|
+
var isDate = (date) => date instanceof Date;
|
|
1586
|
+
|
|
1587
|
+
// src/helpers/dateTime/isInvalidDate.ts
|
|
1588
|
+
var isInvalidDate = (date) => {
|
|
1589
|
+
if (!isDate(date)) {
|
|
1590
|
+
return true;
|
|
1591
|
+
}
|
|
1592
|
+
const time = date.getTime();
|
|
1593
|
+
return time === 0 || Number.isNaN(time);
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
// src/helpers/dateTime/dateOnlyISOString.ts
|
|
1597
|
+
var dateOnlyISOString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1598
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1599
|
+
return "";
|
|
1600
|
+
}
|
|
1601
|
+
try {
|
|
1602
|
+
const formatter = new Intl.DateTimeFormat(defaultLocales, {
|
|
1603
|
+
year: "numeric",
|
|
1604
|
+
month: "2-digit",
|
|
1605
|
+
day: "2-digit",
|
|
1606
|
+
timeZone
|
|
1607
|
+
});
|
|
1608
|
+
const parts = formatter.formatToParts(date);
|
|
1609
|
+
const partsAsObject = parts.reduce(
|
|
1610
|
+
(map, obj) => {
|
|
1611
|
+
map[obj.type] = obj.value;
|
|
1612
|
+
return map;
|
|
1613
|
+
},
|
|
1614
|
+
{}
|
|
1615
|
+
);
|
|
1616
|
+
return `${partsAsObject.year}-${partsAsObject.month}-${partsAsObject.day}`;
|
|
1617
|
+
} catch (error) {
|
|
1618
|
+
console.error(error);
|
|
1619
|
+
return "";
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
// src/helpers/dateTime/dateOnlyString.ts
|
|
1624
|
+
var dateOnlyString = (date, { timeZone = defaultTimeZone, omitYear = false } = {}) => {
|
|
1625
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1626
|
+
return "";
|
|
1627
|
+
}
|
|
1628
|
+
const formatOptions = omitYear ? { month: "short", day: "numeric", timeZone } : { dateStyle: "medium", timeZone };
|
|
1629
|
+
try {
|
|
1630
|
+
return new Intl.DateTimeFormat(defaultLocales, formatOptions).format(date);
|
|
1631
|
+
} catch (error) {
|
|
1632
|
+
console.error(error);
|
|
1633
|
+
return "";
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
// src/helpers/dateTime/dateOnlyStringForSentence.ts
|
|
1638
|
+
var dateOnlyStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1639
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1640
|
+
return "";
|
|
1641
|
+
}
|
|
1642
|
+
try {
|
|
1643
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1644
|
+
dateStyle: "long",
|
|
1645
|
+
timeZone
|
|
1646
|
+
}).format(date);
|
|
1647
|
+
} catch (error) {
|
|
1648
|
+
console.error(error);
|
|
1649
|
+
return "";
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
// src/helpers/dateTime/dateOnlyStringNumeric.ts
|
|
1654
|
+
var dateOnlyStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1655
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1656
|
+
return "";
|
|
1657
|
+
}
|
|
1658
|
+
try {
|
|
1659
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1660
|
+
year: "numeric",
|
|
1661
|
+
month: "2-digit",
|
|
1662
|
+
day: "2-digit",
|
|
1663
|
+
timeZone
|
|
1664
|
+
}).format(date);
|
|
1665
|
+
} catch (error) {
|
|
1666
|
+
console.error(error);
|
|
1667
|
+
return "";
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
// src/helpers/dateTime/dateTimeToDate.ts
|
|
1672
|
+
var dateTimeToDate = (dateTime2) => {
|
|
1673
|
+
const { year, month, dayOfMonth, hours, minutes } = dateTime2 ?? {};
|
|
1674
|
+
if (year !== void 0 && month !== void 0 && dayOfMonth !== void 0) {
|
|
1675
|
+
return new Date(year, month, dayOfMonth, hours ?? 0, minutes ?? 0);
|
|
1676
|
+
}
|
|
1677
|
+
return null;
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
// src/helpers/dateTime/dateToDateTime.ts
|
|
1681
|
+
var dateToDateTime = (date) => {
|
|
1682
|
+
if (!isDate(date)) {
|
|
1683
|
+
return null;
|
|
1684
|
+
}
|
|
1685
|
+
return {
|
|
1686
|
+
year: date.getFullYear(),
|
|
1687
|
+
month: date.getMonth(),
|
|
1688
|
+
dayOfMonth: date.getDate(),
|
|
1689
|
+
hours: date.getHours(),
|
|
1690
|
+
minutes: date.getMinutes()
|
|
1691
|
+
};
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
// src/helpers/dateTime/dateTimeToISO.ts
|
|
1695
|
+
var dateTimeToISO = (dateTime2) => dateTimeToDate(dateTime2)?.toISOString() ?? null;
|
|
1696
|
+
|
|
1697
|
+
// src/helpers/dateTime/dateTimeRounded.ts
|
|
1698
|
+
var dateTimeRounded = (dateTime2, toISOString = true) => {
|
|
1699
|
+
const first30Min = dateTime2.getMinutes() <= halfAnHourInMinutes;
|
|
1700
|
+
const hours = first30Min ? dateTime2.getHours() : dateTime2.getHours() + 1;
|
|
1701
|
+
const minutes = first30Min ? halfAnHourInMinutes : 0;
|
|
1702
|
+
const dateWithTime = {
|
|
1703
|
+
...dateToDateTime(dateTime2),
|
|
1704
|
+
hours,
|
|
1705
|
+
minutes
|
|
1706
|
+
};
|
|
1707
|
+
if (toISOString) {
|
|
1708
|
+
return dateTimeToISO(dateWithTime);
|
|
1709
|
+
}
|
|
1710
|
+
return dateTimeToDate(dateWithTime);
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
// src/helpers/dateTime/dateTimeString.ts
|
|
1714
|
+
var import_type_guards3 = require("@wistia/type-guards");
|
|
1715
|
+
var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1716
|
+
if ((0, import_type_guards3.isNil)(date)) {
|
|
1717
|
+
return "";
|
|
1718
|
+
}
|
|
1719
|
+
const formattedDate = new Date(date);
|
|
1720
|
+
if (isInvalidDate(formattedDate)) {
|
|
1721
|
+
return "";
|
|
1722
|
+
}
|
|
1723
|
+
try {
|
|
1724
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1725
|
+
dateStyle: "medium",
|
|
1726
|
+
timeStyle: "short",
|
|
1727
|
+
timeZone
|
|
1728
|
+
}).format(formattedDate);
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
console.error(error);
|
|
1731
|
+
return "";
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
// src/helpers/dateTime/dateTimeStringForSentence.ts
|
|
1736
|
+
var dateTimeStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1737
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1738
|
+
return "";
|
|
1739
|
+
}
|
|
1740
|
+
try {
|
|
1741
|
+
const { year, month, day, hour, minute, dayPeriod } = new Intl.DateTimeFormat(defaultLocales, {
|
|
1742
|
+
month: "long",
|
|
1743
|
+
day: "numeric",
|
|
1744
|
+
year: "numeric",
|
|
1745
|
+
hour: "numeric",
|
|
1746
|
+
minute: "2-digit",
|
|
1747
|
+
timeZone
|
|
1748
|
+
}).formatToParts(date).reduce((acc, part) => {
|
|
1749
|
+
if (part.type !== "literal") {
|
|
1750
|
+
acc[part.type] = part.value;
|
|
1751
|
+
}
|
|
1752
|
+
return acc;
|
|
1753
|
+
}, {});
|
|
1754
|
+
return `${month} ${day}, ${year}, ${hour}:${minute} ${dayPeriod}`;
|
|
1755
|
+
} catch (error) {
|
|
1756
|
+
console.error(error);
|
|
1757
|
+
return "";
|
|
1758
|
+
}
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
// src/helpers/dateTime/dateUTCOffset.ts
|
|
1762
|
+
var dateUTCOffset = (date) => {
|
|
1763
|
+
const offsetInHours = date.getTimezoneOffset() / minutesInHour * -1;
|
|
1764
|
+
const hours = Math.round(offsetInHours);
|
|
1765
|
+
const minutes = (offsetInHours - hours) * minutesInHour;
|
|
1766
|
+
const prefix = hours >= 0 ? "+" : "";
|
|
1767
|
+
const hoursString = `${hours}`.padStart(2, "0");
|
|
1768
|
+
const minutesString = `${minutes}`.padStart(2, "0");
|
|
1769
|
+
return `${prefix}${hoursString}:${minutesString}`;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
// src/helpers/dateTime/dayOfWeekString.ts
|
|
1773
|
+
var dayOfWeekString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1774
|
+
if (date === null) {
|
|
1775
|
+
return "";
|
|
1776
|
+
}
|
|
1777
|
+
try {
|
|
1778
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1779
|
+
weekday: "long",
|
|
1780
|
+
timeZone
|
|
1781
|
+
}).format(date);
|
|
1782
|
+
} catch (error) {
|
|
1783
|
+
console.error(error);
|
|
1784
|
+
return "";
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
// src/helpers/dateTime/padTimeInteger.ts
|
|
1789
|
+
var padTimeInteger = (num) => num.toString().padStart(2, "0");
|
|
1790
|
+
|
|
1791
|
+
// src/helpers/dateTime/mediaDurationString.ts
|
|
1792
|
+
var mediaDurationString = (numberOfMilliseconds) => {
|
|
1793
|
+
const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
|
|
1794
|
+
if (hours < 1) {
|
|
1795
|
+
return `${minutes}:${padTimeInteger(seconds)}`;
|
|
1796
|
+
}
|
|
1797
|
+
return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
// src/helpers/dateTime/millisecondsToDurationISOString.ts
|
|
1801
|
+
var millisecondsToDurationISOString = (numberOfMilliseconds) => {
|
|
1802
|
+
const { seconds, minutes, hours } = buildTimeDuration(numberOfMilliseconds);
|
|
1803
|
+
let string = "PT";
|
|
1804
|
+
if (hours) {
|
|
1805
|
+
string += `${hours}H`;
|
|
1806
|
+
}
|
|
1807
|
+
if (minutes) {
|
|
1808
|
+
string += `${minutes}M`;
|
|
1809
|
+
}
|
|
1810
|
+
if (seconds) {
|
|
1811
|
+
string += `${seconds}S`;
|
|
1812
|
+
}
|
|
1813
|
+
if (!(seconds || minutes || hours)) {
|
|
1814
|
+
string += "0S";
|
|
1815
|
+
}
|
|
1816
|
+
return string;
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
// src/helpers/dateTime/monthDayStringNumeric.ts
|
|
1820
|
+
var monthDayStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1821
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1822
|
+
return "";
|
|
1823
|
+
}
|
|
1824
|
+
try {
|
|
1825
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1826
|
+
month: "2-digit",
|
|
1827
|
+
day: "2-digit",
|
|
1828
|
+
timeZone
|
|
1829
|
+
}).format(date);
|
|
1830
|
+
} catch (error) {
|
|
1831
|
+
console.error(error);
|
|
1832
|
+
return "";
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
// src/helpers/dateTime/sessionDurationString.ts
|
|
1837
|
+
var sessionDurationString = (numberOfMilliseconds) => {
|
|
1838
|
+
const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
|
|
1839
|
+
return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
|
|
1840
|
+
};
|
|
1841
|
+
|
|
1842
|
+
// src/helpers/dateTime/getLocalDateParts.ts
|
|
1843
|
+
var import_type_guards4 = require("@wistia/type-guards");
|
|
1844
|
+
var getLocalDateParts = (date) => {
|
|
1845
|
+
const parts = new Intl.DateTimeFormat(defaultLocales, {
|
|
1846
|
+
year: "numeric",
|
|
1847
|
+
month: "numeric",
|
|
1848
|
+
day: "numeric",
|
|
1849
|
+
timeZone: defaultTimeZone
|
|
1850
|
+
}).formatToParts(date);
|
|
1851
|
+
const yearPart = parts.find((part) => part.type === "year");
|
|
1852
|
+
const monthPart = parts.find((part) => part.type === "month");
|
|
1853
|
+
const dayPart = parts.find((part) => part.type === "day");
|
|
1854
|
+
if ((0, import_type_guards4.isNil)(yearPart) || (0, import_type_guards4.isNil)(monthPart) || (0, import_type_guards4.isNil)(dayPart)) {
|
|
1855
|
+
throw new Error("Failed to parse date parts");
|
|
1856
|
+
}
|
|
1857
|
+
const year = parseInt(yearPart.value, 10);
|
|
1858
|
+
const month = parseInt(monthPart.value, 10);
|
|
1859
|
+
const day = parseInt(dayPart.value, 10);
|
|
1860
|
+
return { year, month, day };
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
// src/helpers/dateTime/differenceInCalendarDays.ts
|
|
1864
|
+
var differenceInCalendarDays = (dateLeft, dateRight) => {
|
|
1865
|
+
const leftDate = isDate(dateLeft) ? dateLeft : new Date(dateLeft);
|
|
1866
|
+
const rightDate = isDate(dateRight) ? dateRight : new Date(dateRight);
|
|
1867
|
+
if (Number.isNaN(leftDate.getTime()) || Number.isNaN(rightDate.getTime())) {
|
|
1868
|
+
return NaN;
|
|
1869
|
+
}
|
|
1870
|
+
const { year: y1, month: m1, day: d1 } = getLocalDateParts(leftDate);
|
|
1871
|
+
const { year: y2, month: m2, day: d2 } = getLocalDateParts(rightDate);
|
|
1872
|
+
const startOfDayLeft = new Date(y1, m1 - 1, d1).getTime();
|
|
1873
|
+
const startOfDayRight = new Date(y2, m2 - 1, d2).getTime();
|
|
1874
|
+
const msDiff = startOfDayLeft - startOfDayRight;
|
|
1875
|
+
return Math.round(msDiff / millisecondsInDay);
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
// src/helpers/dateTime/timeAgoString.ts
|
|
1879
|
+
var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
|
|
1880
|
+
if (isInvalidDate(date)) {
|
|
1881
|
+
return "";
|
|
1882
|
+
}
|
|
1883
|
+
const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (secondsInMinute * milisecondsInSecond);
|
|
1884
|
+
const minutesAgoRounded = Math.round(minutesAgo);
|
|
1885
|
+
const differenceInDays = differenceInCalendarDays(nowAnchor, date);
|
|
1886
|
+
if (minutesAgo < 0) {
|
|
1887
|
+
return dateTimeString(date);
|
|
1888
|
+
}
|
|
1889
|
+
if (minutesAgo < 1) {
|
|
1890
|
+
return "< 1 minute ago";
|
|
1891
|
+
}
|
|
1892
|
+
if (minutesAgoRounded < 2) {
|
|
1893
|
+
return "1 minute ago";
|
|
1894
|
+
}
|
|
1895
|
+
if (minutesAgoRounded <= minutesInHour) {
|
|
1896
|
+
return `${minutesAgoRounded} minutes ago`;
|
|
1897
|
+
}
|
|
1898
|
+
if (differenceInDays === 0) {
|
|
1899
|
+
return `Today, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
1900
|
+
}
|
|
1901
|
+
if (differenceInDays === 1) {
|
|
1902
|
+
return `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
1903
|
+
}
|
|
1904
|
+
if (date.getFullYear() === nowAnchor.getFullYear()) {
|
|
1905
|
+
return Intl.DateTimeFormat(defaultLocales, {
|
|
1906
|
+
day: "numeric",
|
|
1907
|
+
month: "short",
|
|
1908
|
+
hour: "numeric",
|
|
1909
|
+
minute: "2-digit"
|
|
1910
|
+
}).format(date);
|
|
1911
|
+
}
|
|
1912
|
+
return dateTimeString(date);
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
// src/helpers/dateTime/timeOnlyString.ts
|
|
1916
|
+
var timeOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1917
|
+
if (!isDate(date) || isInvalidDate(date)) {
|
|
1918
|
+
return "";
|
|
1919
|
+
}
|
|
1920
|
+
try {
|
|
1921
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1922
|
+
timeStyle: "short",
|
|
1923
|
+
timeZone
|
|
1924
|
+
}).format(date);
|
|
1925
|
+
} catch (error) {
|
|
1926
|
+
console.error(error);
|
|
1927
|
+
return "";
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
// src/helpers/dateTime/index.ts
|
|
1932
|
+
var dateTime = {
|
|
1933
|
+
buildTimeDuration,
|
|
1934
|
+
dateOnlyISOString,
|
|
1935
|
+
dateOnlyString,
|
|
1936
|
+
dateOnlyStringForSentence,
|
|
1937
|
+
dateOnlyStringNumeric,
|
|
1938
|
+
dateTimeRounded,
|
|
1939
|
+
dateTimeString,
|
|
1940
|
+
dateTimeStringForSentence,
|
|
1941
|
+
dateTimeToDate,
|
|
1942
|
+
dateTimeToISO,
|
|
1943
|
+
dateToDateTime,
|
|
1944
|
+
dateUTCOffset,
|
|
1945
|
+
dayOfWeekString,
|
|
1946
|
+
mediaDurationString,
|
|
1947
|
+
millisecondsToDurationISOString,
|
|
1948
|
+
monthDayStringNumeric,
|
|
1949
|
+
sessionDurationString,
|
|
1950
|
+
timeAgoString,
|
|
1951
|
+
timeOnlyString
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1564
1954
|
// src/helpers/mq/mq.ts
|
|
1565
1955
|
var import_polished = require("polished");
|
|
1566
1956
|
|
|
@@ -1618,7 +2008,7 @@ var useBoolean = (initialValue = false) => {
|
|
|
1618
2008
|
};
|
|
1619
2009
|
|
|
1620
2010
|
// src/hooks/useMq/useMq.ts
|
|
1621
|
-
var
|
|
2011
|
+
var import_type_guards5 = require("@wistia/type-guards");
|
|
1622
2012
|
|
|
1623
2013
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
1624
2014
|
var import_react4 = require("react");
|
|
@@ -1680,7 +2070,7 @@ var useActiveMq = () => {
|
|
|
1680
2070
|
const keys = Object.keys(mq2);
|
|
1681
2071
|
return keys.filter((key) => {
|
|
1682
2072
|
const value = mq2[key];
|
|
1683
|
-
return (0,
|
|
2073
|
+
return (0, import_type_guards5.isBoolean)(value) && value;
|
|
1684
2074
|
});
|
|
1685
2075
|
};
|
|
1686
2076
|
|
|
@@ -1690,10 +2080,10 @@ var import_react6 = require("react");
|
|
|
1690
2080
|
// src/private/hooks/useEvent/useEvent.ts
|
|
1691
2081
|
var import_react5 = require("react");
|
|
1692
2082
|
|
|
1693
|
-
// src/private/helpers/
|
|
1694
|
-
var
|
|
1695
|
-
var
|
|
1696
|
-
return (0,
|
|
2083
|
+
// src/private/helpers/isValidRef/isValidRef.ts
|
|
2084
|
+
var import_type_guards6 = require("@wistia/type-guards");
|
|
2085
|
+
var isValidRef = (value) => {
|
|
2086
|
+
return (0, import_type_guards6.isNotNil)(value) && (0, import_type_guards6.isRecord)(value) && "current" in value;
|
|
1697
2087
|
};
|
|
1698
2088
|
|
|
1699
2089
|
// src/private/hooks/useEvent/useEvent.ts
|
|
@@ -1712,7 +2102,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
|
|
|
1712
2102
|
savedEventOptions.current = eventOptions;
|
|
1713
2103
|
}, [eventOptions]);
|
|
1714
2104
|
(0, import_react5.useEffect)(() => {
|
|
1715
|
-
const target =
|
|
2105
|
+
const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
|
|
1716
2106
|
if (!eventName || !isEventTargetSupported(target)) {
|
|
1717
2107
|
return;
|
|
1718
2108
|
}
|
|
@@ -1758,10 +2148,10 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
1758
2148
|
|
|
1759
2149
|
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
1760
2150
|
var import_react7 = require("react");
|
|
1761
|
-
var
|
|
2151
|
+
var import_type_guards7 = require("@wistia/type-guards");
|
|
1762
2152
|
var useAriaLive = () => {
|
|
1763
2153
|
const context = (0, import_react7.useContext)(AriaLiveContext);
|
|
1764
|
-
if ((0,
|
|
2154
|
+
if ((0, import_type_guards7.isNil)(context)) {
|
|
1765
2155
|
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
1766
2156
|
}
|
|
1767
2157
|
return context;
|
|
@@ -1774,10 +2164,10 @@ var import_sonner2 = require("sonner");
|
|
|
1774
2164
|
// src/private/components/Toast/Toast.tsx
|
|
1775
2165
|
var import_react8 = require("react");
|
|
1776
2166
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1777
|
-
var
|
|
2167
|
+
var import_type_guards9 = require("@wistia/type-guards");
|
|
1778
2168
|
|
|
1779
2169
|
// src/components/Ellipsis/Ellipsis.tsx
|
|
1780
|
-
var
|
|
2170
|
+
var import_type_guards8 = require("@wistia/type-guards");
|
|
1781
2171
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1782
2172
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1783
2173
|
var ellipsisStyle = import_styled_components13.css`
|
|
@@ -1809,7 +2199,7 @@ var ellipsisFlexParentStyle = import_styled_components13.css`
|
|
|
1809
2199
|
var EllipsisComponent = import_styled_components13.default.div`
|
|
1810
2200
|
${ellipsisStyle};
|
|
1811
2201
|
${({ $lines }) => {
|
|
1812
|
-
if ((0,
|
|
2202
|
+
if ((0, import_type_guards8.isNotNil)($lines)) {
|
|
1813
2203
|
return import_styled_components13.css`
|
|
1814
2204
|
-webkit-box-orient: vertical;
|
|
1815
2205
|
-webkit-line-clamp: ${$lines};
|
|
@@ -1991,7 +2381,7 @@ var StyledToast = import_styled_components15.default.div`
|
|
|
1991
2381
|
}
|
|
1992
2382
|
`;
|
|
1993
2383
|
var Action = ({ actionButton }) => {
|
|
1994
|
-
if ((0,
|
|
2384
|
+
if ((0, import_type_guards9.isNotNil)(actionButton) && (0, import_react8.isValidElement)(actionButton)) {
|
|
1995
2385
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react8.cloneElement)(actionButton, {
|
|
1996
2386
|
variant: "soft",
|
|
1997
2387
|
// force Button variant
|
|
@@ -2015,7 +2405,7 @@ var Toast = ({
|
|
|
2015
2405
|
$colorScheme: colorScheme,
|
|
2016
2406
|
children: [
|
|
2017
2407
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageWrapper, { children: [
|
|
2018
|
-
(0,
|
|
2408
|
+
(0, import_type_guards9.isNotNil)(icon) ? icon : null,
|
|
2019
2409
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Message, { lines: 3, children: message })
|
|
2020
2410
|
] }),
|
|
2021
2411
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Action, { actionButton: action })
|
|
@@ -2056,7 +2446,7 @@ var import_styled_components21 = __toESM(require("styled-components"));
|
|
|
2056
2446
|
// src/components/Button/Button.tsx
|
|
2057
2447
|
var import_react12 = require("react");
|
|
2058
2448
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2059
|
-
var
|
|
2449
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
2060
2450
|
|
|
2061
2451
|
// src/css/buttonResetCss.tsx
|
|
2062
2452
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2260,7 +2650,7 @@ var buttonSizeStyles = {
|
|
|
2260
2650
|
};
|
|
2261
2651
|
|
|
2262
2652
|
// src/components/Icon/Icon.tsx
|
|
2263
|
-
var
|
|
2653
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2264
2654
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2265
2655
|
|
|
2266
2656
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -5421,7 +5811,7 @@ var iconMap = {
|
|
|
5421
5811
|
};
|
|
5422
5812
|
|
|
5423
5813
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
5424
|
-
var
|
|
5814
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
5425
5815
|
var import_react10 = require("react");
|
|
5426
5816
|
var isResponsiveObject = (values) => {
|
|
5427
5817
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
@@ -5429,9 +5819,9 @@ var isResponsiveObject = (values) => {
|
|
|
5429
5819
|
var useResponsiveProp = (values) => {
|
|
5430
5820
|
const activeMediaQueries = useActiveMq();
|
|
5431
5821
|
return (0, import_react10.useMemo)(() => {
|
|
5432
|
-
if ((0,
|
|
5822
|
+
if ((0, import_type_guards10.isRecord)(values) && isResponsiveObject(values)) {
|
|
5433
5823
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
5434
|
-
return (0,
|
|
5824
|
+
return (0, import_type_guards10.isNotUndefined)(mq2) && (0, import_type_guards10.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
5435
5825
|
}
|
|
5436
5826
|
return values;
|
|
5437
5827
|
}, [activeMediaQueries, values]);
|
|
@@ -5458,13 +5848,13 @@ var Icon = ({
|
|
|
5458
5848
|
...otherProps
|
|
5459
5849
|
}) => {
|
|
5460
5850
|
const responsiveSize = useResponsiveProp(size);
|
|
5461
|
-
if ((0,
|
|
5851
|
+
if ((0, import_type_guards11.isNil)(type)) {
|
|
5462
5852
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
5463
5853
|
}
|
|
5464
|
-
if ((0,
|
|
5854
|
+
if ((0, import_type_guards11.isNil)(iconMap[type])) {
|
|
5465
5855
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
5466
5856
|
}
|
|
5467
|
-
if ((0,
|
|
5857
|
+
if ((0, import_type_guards11.isNil)(iconSizeMap[responsiveSize])) {
|
|
5468
5858
|
throw new Error(
|
|
5469
5859
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
5470
5860
|
);
|
|
@@ -5496,12 +5886,12 @@ Icon.displayName = "Icon";
|
|
|
5496
5886
|
|
|
5497
5887
|
// src/components/Link/Link.tsx
|
|
5498
5888
|
var import_react11 = require("react");
|
|
5499
|
-
var
|
|
5889
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
5500
5890
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
5501
5891
|
var import_react_router_dom = require("react-router-dom");
|
|
5502
5892
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
5503
5893
|
var generateHref = (href, type, disabled) => {
|
|
5504
|
-
if (disabled || (0,
|
|
5894
|
+
if (disabled || (0, import_type_guards12.isNil)(href)) {
|
|
5505
5895
|
return void 0;
|
|
5506
5896
|
}
|
|
5507
5897
|
let to = href;
|
|
@@ -5513,12 +5903,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
5513
5903
|
}
|
|
5514
5904
|
return to;
|
|
5515
5905
|
};
|
|
5516
|
-
var isButton = (props) => (0,
|
|
5517
|
-
var isLink = (props) => (0,
|
|
5906
|
+
var isButton = (props) => (0, import_type_guards12.isUndefined)(props.href);
|
|
5907
|
+
var isLink = (props) => (0, import_type_guards12.isNotUndefined)(props.href);
|
|
5518
5908
|
var StyledLink = import_styled_components19.default.a`
|
|
5519
5909
|
--link-icon-size: 14px;
|
|
5520
5910
|
|
|
5521
|
-
${({ href }) => (0,
|
|
5911
|
+
${({ href }) => (0, import_type_guards12.isNil)(href) && buttonResetCss};
|
|
5522
5912
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
5523
5913
|
cursor: pointer;
|
|
5524
5914
|
font-family: var(--wui-typography-family-default);
|
|
@@ -5562,7 +5952,7 @@ var Link = (0, import_react11.forwardRef)(
|
|
|
5562
5952
|
} finally {
|
|
5563
5953
|
if (routingCallback !== null) {
|
|
5564
5954
|
routingCallback();
|
|
5565
|
-
} else if ((0,
|
|
5955
|
+
} else if ((0, import_type_guards12.isNotNil)(to)) {
|
|
5566
5956
|
window.location.assign(to);
|
|
5567
5957
|
} else {
|
|
5568
5958
|
}
|
|
@@ -5625,7 +6015,7 @@ Link.displayName = "Link";
|
|
|
5625
6015
|
|
|
5626
6016
|
// src/components/Button/Button.tsx
|
|
5627
6017
|
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
5628
|
-
var isLink2 = (props) => (0,
|
|
6018
|
+
var isLink2 = (props) => (0, import_type_guards13.isNotUndefined)(props.href);
|
|
5629
6019
|
var StyledButton = import_styled_components20.default.button`
|
|
5630
6020
|
${buttonResetCss}
|
|
5631
6021
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -5666,8 +6056,8 @@ var ButtonContent = ({
|
|
|
5666
6056
|
/* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
|
|
5667
6057
|
StyledButtonContent,
|
|
5668
6058
|
{
|
|
5669
|
-
$hasLeftIcon: (0,
|
|
5670
|
-
$hasRightIcon: (0,
|
|
6059
|
+
$hasLeftIcon: (0, import_type_guards13.isNotNil)(leftIcon),
|
|
6060
|
+
$hasRightIcon: (0, import_type_guards13.isNotNil)(rightIcon),
|
|
5671
6061
|
$isLoading: isLoading,
|
|
5672
6062
|
children: [
|
|
5673
6063
|
leftIcon ?? null,
|
|
@@ -5735,7 +6125,7 @@ var Button = (0, import_react12.forwardRef)(
|
|
|
5735
6125
|
event.preventDefault();
|
|
5736
6126
|
return;
|
|
5737
6127
|
}
|
|
5738
|
-
if ((0,
|
|
6128
|
+
if ((0, import_type_guards13.isNotNil)(onClick)) {
|
|
5739
6129
|
onClick(event);
|
|
5740
6130
|
}
|
|
5741
6131
|
};
|
|
@@ -5896,7 +6286,7 @@ ActionButton.displayName = "ActionButton";
|
|
|
5896
6286
|
|
|
5897
6287
|
// src/components/Avatar/Avatar.tsx
|
|
5898
6288
|
var import_react14 = require("react");
|
|
5899
|
-
var
|
|
6289
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
5900
6290
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
5901
6291
|
|
|
5902
6292
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -5939,13 +6329,13 @@ var ColorSchemeWrapper = ({
|
|
|
5939
6329
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
5940
6330
|
|
|
5941
6331
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
5942
|
-
var
|
|
6332
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
5943
6333
|
var containsEmojiCharacter = (char) => {
|
|
5944
6334
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
5945
6335
|
return emojiRegex.test(char);
|
|
5946
6336
|
};
|
|
5947
6337
|
var formatNameForDisplay = (name) => {
|
|
5948
|
-
if ((0,
|
|
6338
|
+
if ((0, import_type_guards14.isNil)(name) || !(0, import_type_guards14.isString)(name) || (0, import_type_guards14.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
5949
6339
|
return "U";
|
|
5950
6340
|
}
|
|
5951
6341
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -6008,7 +6398,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
6008
6398
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
6009
6399
|
`;
|
|
6010
6400
|
var chooseColorScheme = (name) => {
|
|
6011
|
-
if ((0,
|
|
6401
|
+
if ((0, import_type_guards15.isNil)(name) || name === "Anonymous") {
|
|
6012
6402
|
return "default";
|
|
6013
6403
|
}
|
|
6014
6404
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -6041,7 +6431,7 @@ var Avatar = ({
|
|
|
6041
6431
|
};
|
|
6042
6432
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
6043
6433
|
const avatarColor = (0, import_react14.useMemo)(() => chooseColorScheme(name), [name]);
|
|
6044
|
-
const showInitials = (0,
|
|
6434
|
+
const showInitials = (0, import_type_guards15.isNil)(imageUrl) || imageLoadState === "error";
|
|
6045
6435
|
return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
6046
6436
|
AvatarWrapper,
|
|
6047
6437
|
{
|
|
@@ -6072,7 +6462,7 @@ Avatar.displayName = "Avatar";
|
|
|
6072
6462
|
// src/components/Badge/Badge.tsx
|
|
6073
6463
|
var import_react15 = require("react");
|
|
6074
6464
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
6075
|
-
var
|
|
6465
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
6076
6466
|
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
6077
6467
|
var StyledBadge = import_styled_components24.default.div`
|
|
6078
6468
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -6096,7 +6486,7 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
6096
6486
|
`;
|
|
6097
6487
|
var Badge = (0, import_react15.forwardRef)(
|
|
6098
6488
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
6099
|
-
const hasIcon = (0,
|
|
6489
|
+
const hasIcon = (0, import_type_guards16.isNotNil)(icon);
|
|
6100
6490
|
return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
|
|
6101
6491
|
StyledBadge,
|
|
6102
6492
|
{
|
|
@@ -6117,7 +6507,7 @@ Badge.displayName = "Badge";
|
|
|
6117
6507
|
// src/components/Box/Box.tsx
|
|
6118
6508
|
var import_react16 = require("react");
|
|
6119
6509
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
6120
|
-
var
|
|
6510
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
6121
6511
|
|
|
6122
6512
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
6123
6513
|
var makePolymorphic = (component) => {
|
|
@@ -6128,8 +6518,8 @@ var makePolymorphic = (component) => {
|
|
|
6128
6518
|
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
6129
6519
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
6130
6520
|
var getGapStyle = (gap) => {
|
|
6131
|
-
if ((0,
|
|
6132
|
-
if ((0,
|
|
6521
|
+
if ((0, import_type_guards17.isNotNil)(gap)) {
|
|
6522
|
+
if ((0, import_type_guards17.isRecord)(gap)) {
|
|
6133
6523
|
return Object.entries(gap).map(([key, value]) => {
|
|
6134
6524
|
return `${key}-gap: var(--wui-${value})};`;
|
|
6135
6525
|
}).join("");
|
|
@@ -6172,25 +6562,25 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
6172
6562
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
6173
6563
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
6174
6564
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
6175
|
-
display: ${({ $inline }) => (0,
|
|
6176
|
-
flex-basis: ${({ $basis }) => (0,
|
|
6565
|
+
display: ${({ $inline }) => (0, import_type_guards17.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
6566
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards17.isNotNil)($basis) ? $basis : null};
|
|
6177
6567
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
6178
6568
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
6179
6569
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
6180
6570
|
|
|
6181
6571
|
/* Box children styles */
|
|
6182
|
-
flex-grow: ${({ $grow }) => (0,
|
|
6183
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
6572
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards17.isNotNil)($grow) ? $grow : null};
|
|
6573
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards17.isNotNil)($shrink) ? $shrink : null};
|
|
6184
6574
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
6185
6575
|
${({ $gap }) => getGapStyle($gap)};
|
|
6186
6576
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
6187
|
-
order: ${({ $order }) => (0,
|
|
6577
|
+
order: ${({ $order }) => (0, import_type_guards17.isNotNil)($order) ? $order : null};
|
|
6188
6578
|
`;
|
|
6189
6579
|
var wrapChildren = (children) => {
|
|
6190
|
-
if ((0,
|
|
6580
|
+
if ((0, import_type_guards17.isNotNil)(children)) {
|
|
6191
6581
|
if (typeof children === "object" && isDev) {
|
|
6192
6582
|
return import_react16.Children.map(children, (child) => {
|
|
6193
|
-
if ((0,
|
|
6583
|
+
if ((0, import_type_guards17.isNil)(child)) return null;
|
|
6194
6584
|
const elementParams = {};
|
|
6195
6585
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
6196
6586
|
elementParams.hasBoxParent = true;
|
|
@@ -6337,7 +6727,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
6337
6727
|
|
|
6338
6728
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
6339
6729
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
6340
|
-
var
|
|
6730
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
6341
6731
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
6342
6732
|
var getAlignment = (align) => {
|
|
6343
6733
|
if (align === "center") {
|
|
@@ -6377,7 +6767,7 @@ var ButtonGroup = ({
|
|
|
6377
6767
|
fullWidth = false,
|
|
6378
6768
|
...otherProps
|
|
6379
6769
|
}) => {
|
|
6380
|
-
if ((0,
|
|
6770
|
+
if ((0, import_type_guards18.isNil)(children)) {
|
|
6381
6771
|
return null;
|
|
6382
6772
|
}
|
|
6383
6773
|
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
@@ -6447,7 +6837,7 @@ Card.displayName = "Card";
|
|
|
6447
6837
|
var import_react19 = require("react");
|
|
6448
6838
|
var import_react_checkbox = require("@radix-ui/react-checkbox");
|
|
6449
6839
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
6450
|
-
var
|
|
6840
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
6451
6841
|
|
|
6452
6842
|
// src/components/Label/Label.tsx
|
|
6453
6843
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
@@ -6627,7 +7017,7 @@ Label.displayName = "Label";
|
|
|
6627
7017
|
|
|
6628
7018
|
// src/components/Label/LabelDescription.tsx
|
|
6629
7019
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
6630
|
-
var
|
|
7020
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
6631
7021
|
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
6632
7022
|
var StyledLabelDescription = import_styled_components32.default.div`
|
|
6633
7023
|
color: var(--wui-color-text-secondary);
|
|
@@ -6639,7 +7029,7 @@ var LabelDescription = ({
|
|
|
6639
7029
|
children,
|
|
6640
7030
|
...props
|
|
6641
7031
|
}) => {
|
|
6642
|
-
if ((0,
|
|
7032
|
+
if ((0, import_type_guards19.isNil)(children)) {
|
|
6643
7033
|
return null;
|
|
6644
7034
|
}
|
|
6645
7035
|
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(StyledLabelDescription, { ...props, children });
|
|
@@ -6736,7 +7126,7 @@ var Checkbox = (0, import_react19.forwardRef)(
|
|
|
6736
7126
|
...otherProps
|
|
6737
7127
|
}, ref) => {
|
|
6738
7128
|
const generatedId = (0, import_react19.useId)();
|
|
6739
|
-
const computedId = (0,
|
|
7129
|
+
const computedId = (0, import_type_guards20.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-group-${generatedId}`;
|
|
6740
7130
|
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(StyledCheckboxWrapper, { children: [
|
|
6741
7131
|
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
6742
7132
|
StyledCheckboxRoot,
|
|
@@ -6829,7 +7219,7 @@ Divider.displayName = "Divider";
|
|
|
6829
7219
|
// src/components/Form/Form.tsx
|
|
6830
7220
|
var import_react21 = require("react");
|
|
6831
7221
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
6832
|
-
var
|
|
7222
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
6833
7223
|
|
|
6834
7224
|
// src/components/Stack/Stack.tsx
|
|
6835
7225
|
var import_react20 = require("react");
|
|
@@ -6883,7 +7273,7 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
|
|
|
6883
7273
|
const id = props.id ?? autoId;
|
|
6884
7274
|
const handleValidate = (nextFormData) => {
|
|
6885
7275
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
6886
|
-
if ((0,
|
|
7276
|
+
if ((0, import_type_guards21.isUndefined)(validate)) {
|
|
6887
7277
|
return {};
|
|
6888
7278
|
}
|
|
6889
7279
|
return validate(nextData);
|
|
@@ -6893,7 +7283,7 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
|
|
|
6893
7283
|
props.onBlur(event);
|
|
6894
7284
|
}
|
|
6895
7285
|
const formData = new FormData(event.currentTarget);
|
|
6896
|
-
if ((0,
|
|
7286
|
+
if ((0, import_type_guards21.isNotUndefined)(validate)) {
|
|
6897
7287
|
handleValidate(formData);
|
|
6898
7288
|
}
|
|
6899
7289
|
};
|
|
@@ -6989,7 +7379,7 @@ var useFormState = (action, initialData = {}) => {
|
|
|
6989
7379
|
|
|
6990
7380
|
// src/components/Form/FormErrorSummary.tsx
|
|
6991
7381
|
var import_react23 = require("react");
|
|
6992
|
-
var
|
|
7382
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
6993
7383
|
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
6994
7384
|
var ErrorItem = ({ name, error, formId }) => {
|
|
6995
7385
|
return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(Link, { href: `${formId}-${name}`, children: error }) }, name);
|
|
@@ -7003,8 +7393,8 @@ var FormErrorSummary = ({ description }) => {
|
|
|
7003
7393
|
}
|
|
7004
7394
|
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { ref, children: [
|
|
7005
7395
|
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("p", { children: description }),
|
|
7006
|
-
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
7007
|
-
([name, error]) => (0,
|
|
7396
|
+
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards22.isNotUndefined)(error)).map(
|
|
7397
|
+
([name, error]) => (0, import_type_guards22.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
7008
7398
|
ErrorItem,
|
|
7009
7399
|
{
|
|
7010
7400
|
error: err,
|
|
@@ -7028,7 +7418,7 @@ var FormErrorSummary = ({ description }) => {
|
|
|
7028
7418
|
// src/components/FormField/FormField.tsx
|
|
7029
7419
|
var import_react27 = require("react");
|
|
7030
7420
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
7031
|
-
var
|
|
7421
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7032
7422
|
|
|
7033
7423
|
// src/components/Text/Text.tsx
|
|
7034
7424
|
var import_react24 = require("react");
|
|
@@ -7283,7 +7673,7 @@ var StyledErrorList = import_styled_components39.default.ul`
|
|
|
7283
7673
|
gap: var(--wui-space-01);
|
|
7284
7674
|
`;
|
|
7285
7675
|
var ErrorMessages = ({ errors, id }) => {
|
|
7286
|
-
const isMultipleErrors = (0,
|
|
7676
|
+
const isMultipleErrors = (0, import_type_guards23.isArray)(errors);
|
|
7287
7677
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
7288
7678
|
Text,
|
|
7289
7679
|
{
|
|
@@ -7326,19 +7716,19 @@ var FormField = ({
|
|
|
7326
7716
|
label: isInlineLabel ? label : void 0,
|
|
7327
7717
|
...props
|
|
7328
7718
|
};
|
|
7329
|
-
if ((0,
|
|
7719
|
+
if ((0, import_type_guards23.isUndefined)(value) && (0, import_type_guards23.isNotUndefined)(defaultValue)) {
|
|
7330
7720
|
childProps = {
|
|
7331
7721
|
...childProps,
|
|
7332
7722
|
defaultValue
|
|
7333
7723
|
};
|
|
7334
7724
|
}
|
|
7335
|
-
if ((0,
|
|
7336
|
-
const computedName = (0,
|
|
7725
|
+
if ((0, import_type_guards23.isNotNil)(checkboxGroup)) {
|
|
7726
|
+
const computedName = (0, import_type_guards23.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
7337
7727
|
const handleChange = (event) => {
|
|
7338
|
-
if ((0,
|
|
7728
|
+
if ((0, import_type_guards23.isNotUndefined)(props.onChange)) {
|
|
7339
7729
|
props.onChange(event);
|
|
7340
7730
|
}
|
|
7341
|
-
if ((0,
|
|
7731
|
+
if ((0, import_type_guards23.isNotUndefined)(checkboxGroup.onChange)) {
|
|
7342
7732
|
checkboxGroup.onChange(event);
|
|
7343
7733
|
}
|
|
7344
7734
|
};
|
|
@@ -7346,15 +7736,15 @@ var FormField = ({
|
|
|
7346
7736
|
...childProps,
|
|
7347
7737
|
name: computedName,
|
|
7348
7738
|
onChange: handleChange,
|
|
7349
|
-
"aria-invalid": (0,
|
|
7350
|
-
"aria-describedby": (0,
|
|
7739
|
+
"aria-invalid": (0, import_type_guards23.isNotNil)(error),
|
|
7740
|
+
"aria-describedby": (0, import_type_guards23.isNotNil)(error) ? `${id}-error` : void 0
|
|
7351
7741
|
};
|
|
7352
7742
|
}
|
|
7353
7743
|
import_react27.Children.only(children);
|
|
7354
7744
|
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(StyledFormField, { ...props, children: [
|
|
7355
7745
|
!isInlineLabel && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(Label, { htmlFor: id, children: label }),
|
|
7356
7746
|
(0, import_react27.cloneElement)(children, childProps),
|
|
7357
|
-
(0,
|
|
7747
|
+
(0, import_type_guards23.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
7358
7748
|
ErrorMessages,
|
|
7359
7749
|
{
|
|
7360
7750
|
errors: computedError,
|
|
@@ -7427,7 +7817,18 @@ IconButton.displayName = "IconButton";
|
|
|
7427
7817
|
// src/components/Input/Input.tsx
|
|
7428
7818
|
var import_react30 = require("react");
|
|
7429
7819
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
7430
|
-
var
|
|
7820
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
7821
|
+
|
|
7822
|
+
// src/private/helpers/isReadyRef/isReadyRef.ts
|
|
7823
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
7824
|
+
var isReadyRef = (maybeRef) => {
|
|
7825
|
+
if ((0, import_type_guards24.isRecord)(maybeRef) && (0, import_type_guards24.hasKey)(maybeRef, "current")) {
|
|
7826
|
+
return (0, import_type_guards24.isNotNil)(maybeRef.current);
|
|
7827
|
+
}
|
|
7828
|
+
return false;
|
|
7829
|
+
};
|
|
7830
|
+
|
|
7831
|
+
// src/components/Input/Input.tsx
|
|
7431
7832
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
7432
7833
|
var inputStyles = import_styled_components41.css`
|
|
7433
7834
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -7514,9 +7915,6 @@ var StyledInputContainer = import_styled_components41.default.div`
|
|
|
7514
7915
|
padding-right: 32px;
|
|
7515
7916
|
}
|
|
7516
7917
|
`;
|
|
7517
|
-
var isValidRef = (ref) => {
|
|
7518
|
-
return typeof ref === "object" && ref !== null && "current" in ref && (0, import_type_guards22.isNotNil)(ref.current);
|
|
7519
|
-
};
|
|
7520
7918
|
var Input = (0, import_react30.forwardRef)(
|
|
7521
7919
|
({
|
|
7522
7920
|
fullWidth = false,
|
|
@@ -7528,26 +7926,26 @@ var Input = (0, import_react30.forwardRef)(
|
|
|
7528
7926
|
...props
|
|
7529
7927
|
}, externalRef) => {
|
|
7530
7928
|
const internalRef = (0, import_react30.useRef)();
|
|
7531
|
-
const ref =
|
|
7929
|
+
const ref = isReadyRef(externalRef) ? externalRef : internalRef;
|
|
7532
7930
|
let leftIconToDisplay = leftIcon;
|
|
7533
|
-
if ((0,
|
|
7931
|
+
if ((0, import_type_guards25.isNil)(leftIcon) && type === "search") {
|
|
7534
7932
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Icon, { type: "search" });
|
|
7535
7933
|
}
|
|
7536
|
-
if ((0,
|
|
7934
|
+
if ((0, import_type_guards25.isNotNil)(leftIconToDisplay)) {
|
|
7537
7935
|
leftIconToDisplay = (0, import_react30.cloneElement)(leftIconToDisplay, {
|
|
7538
7936
|
size: "md",
|
|
7539
7937
|
className: "wui-input-left-icon"
|
|
7540
7938
|
});
|
|
7541
7939
|
}
|
|
7542
7940
|
let rightIconToDisplay = rightIcon;
|
|
7543
|
-
if ((0,
|
|
7941
|
+
if ((0, import_type_guards25.isNotNil)(rightIconToDisplay)) {
|
|
7544
7942
|
rightIconToDisplay = (0, import_react30.cloneElement)(rightIconToDisplay, {
|
|
7545
7943
|
size: "md",
|
|
7546
7944
|
className: "wui-input-right-icon"
|
|
7547
7945
|
});
|
|
7548
7946
|
}
|
|
7549
7947
|
const handleFocus = (event) => {
|
|
7550
|
-
if ((0,
|
|
7948
|
+
if ((0, import_type_guards25.isNotNil)(props.onFocus)) {
|
|
7551
7949
|
props.onFocus(event);
|
|
7552
7950
|
}
|
|
7553
7951
|
if (autoSelect && ref && "current" in ref) {
|
|
@@ -7590,7 +7988,7 @@ Input.displayName = "Input";
|
|
|
7590
7988
|
// src/components/Menu/Menu.tsx
|
|
7591
7989
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
7592
7990
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
7593
|
-
var
|
|
7991
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
7594
7992
|
var import_react32 = require("react");
|
|
7595
7993
|
|
|
7596
7994
|
// src/components/Menu/MenuContext.tsx
|
|
@@ -7702,7 +8100,7 @@ var Menu = ({
|
|
|
7702
8100
|
}) => {
|
|
7703
8101
|
const contextValue = (0, import_react32.useMemo)(() => ({ compact }), [compact]);
|
|
7704
8102
|
let controlProps = {
|
|
7705
|
-
...(0,
|
|
8103
|
+
...(0, import_type_guards26.isNotNil)(onOpenChange) && (0, import_type_guards26.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
7706
8104
|
};
|
|
7707
8105
|
if (disabled) {
|
|
7708
8106
|
controlProps = {
|
|
@@ -7716,7 +8114,7 @@ var Menu = ({
|
|
|
7716
8114
|
modal: false,
|
|
7717
8115
|
...controlProps,
|
|
7718
8116
|
children: [
|
|
7719
|
-
/* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
8117
|
+
/* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards26.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
|
|
7720
8118
|
Button,
|
|
7721
8119
|
{
|
|
7722
8120
|
"aria-expanded": isOpen,
|
|
@@ -7777,12 +8175,12 @@ MenuLabel.displayName = "MenuLabel";
|
|
|
7777
8175
|
var import_react34 = require("react");
|
|
7778
8176
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
7779
8177
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
7780
|
-
var
|
|
8178
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
7781
8179
|
|
|
7782
8180
|
// src/components/Menu/MenuItemButton.tsx
|
|
7783
8181
|
var import_react33 = require("react");
|
|
7784
8182
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
7785
|
-
var
|
|
8183
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
7786
8184
|
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
7787
8185
|
var StyledButton3 = (0, import_styled_components44.default)(Button)`
|
|
7788
8186
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -7856,7 +8254,7 @@ var StyledBadgeContainer = import_styled_components44.default.div`
|
|
|
7856
8254
|
var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
7857
8255
|
let { colorScheme, badge } = props;
|
|
7858
8256
|
if (appearance === "dangerous") {
|
|
7859
|
-
if ((0,
|
|
8257
|
+
if ((0, import_type_guards27.isNotUndefined)(colorScheme)) {
|
|
7860
8258
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
7861
8259
|
}
|
|
7862
8260
|
colorScheme = "error";
|
|
@@ -7886,7 +8284,7 @@ var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, com
|
|
|
7886
8284
|
children: [
|
|
7887
8285
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
7888
8286
|
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
7889
|
-
(0,
|
|
8287
|
+
(0, import_type_guards27.isNotNil)(badge) || (0, import_type_guards27.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
7890
8288
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
7891
8289
|
]
|
|
7892
8290
|
}
|
|
@@ -7953,7 +8351,7 @@ var SubMenu = ({
|
|
|
7953
8351
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
7954
8352
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
7955
8353
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemLabel, { children: label }),
|
|
7956
|
-
(0,
|
|
8354
|
+
(0, import_type_guards28.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemDescription, { children: description }) : null
|
|
7957
8355
|
] }),
|
|
7958
8356
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
7959
8357
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -8133,7 +8531,7 @@ CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
|
8133
8531
|
var import_react39 = require("react");
|
|
8134
8532
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
8135
8533
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
8136
|
-
var
|
|
8534
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
8137
8535
|
|
|
8138
8536
|
// src/components/Modal/ModalHeader.tsx
|
|
8139
8537
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
@@ -8160,7 +8558,7 @@ var ModalCloseButton = () => {
|
|
|
8160
8558
|
|
|
8161
8559
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
8162
8560
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
8163
|
-
var
|
|
8561
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
8164
8562
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
8165
8563
|
var VisuallyHidden = import_styled_components48.default.div({ ...visuallyHiddenStyle });
|
|
8166
8564
|
var VisuallyHiddenButFocusable = import_styled_components48.default.div({
|
|
@@ -8172,7 +8570,7 @@ var ScreenReaderOnly = ({
|
|
|
8172
8570
|
focusable = false,
|
|
8173
8571
|
...otherProps
|
|
8174
8572
|
}) => {
|
|
8175
|
-
const accessibleText = (0,
|
|
8573
|
+
const accessibleText = (0, import_type_guards29.isNotNil)(text) ? text : children;
|
|
8176
8574
|
if (focusable) {
|
|
8177
8575
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
8178
8576
|
}
|
|
@@ -8219,7 +8617,7 @@ var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
|
8219
8617
|
|
|
8220
8618
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
8221
8619
|
var import_react36 = require("react");
|
|
8222
|
-
var
|
|
8620
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
8223
8621
|
var useFocusRestore = () => {
|
|
8224
8622
|
const previouslyFocusedRef = (0, import_react36.useRef)(null);
|
|
8225
8623
|
(0, import_react36.useEffect)(() => {
|
|
@@ -8227,7 +8625,7 @@ var useFocusRestore = () => {
|
|
|
8227
8625
|
}, []);
|
|
8228
8626
|
(0, import_react36.useEffect)(() => {
|
|
8229
8627
|
return () => {
|
|
8230
|
-
if ((0,
|
|
8628
|
+
if ((0, import_type_guards30.isNotNil)(previouslyFocusedRef.current)) {
|
|
8231
8629
|
setTimeout(() => {
|
|
8232
8630
|
previouslyFocusedRef.current?.focus();
|
|
8233
8631
|
}, 0);
|
|
@@ -8263,7 +8661,8 @@ var StyledModalContent = (0, import_styled_components50.default)(import_react_di
|
|
|
8263
8661
|
max-width: 90vw;
|
|
8264
8662
|
top: 50%;
|
|
8265
8663
|
transform: translate(-50%, -50%);
|
|
8266
|
-
min-width: ${({ $width }) => $width ??
|
|
8664
|
+
min-width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
|
|
8665
|
+
width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
|
|
8267
8666
|
}
|
|
8268
8667
|
|
|
8269
8668
|
@keyframes contentShow {
|
|
@@ -8350,6 +8749,7 @@ Backdrop.displayName = "Backdrop";
|
|
|
8350
8749
|
|
|
8351
8750
|
// src/components/Modal/Modal.tsx
|
|
8352
8751
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
8752
|
+
var DEFAULT_MODAL_WIDTH = "532px";
|
|
8353
8753
|
var ModalBody = import_styled_components52.default.div`
|
|
8354
8754
|
flex-direction: column;
|
|
8355
8755
|
display: flex;
|
|
@@ -8365,14 +8765,14 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8365
8765
|
isOpen,
|
|
8366
8766
|
onRequestClose,
|
|
8367
8767
|
title,
|
|
8368
|
-
width,
|
|
8768
|
+
width = DEFAULT_MODAL_WIDTH,
|
|
8369
8769
|
...props
|
|
8370
8770
|
}, ref) => {
|
|
8371
8771
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
8372
8772
|
import_react_dialog4.Root,
|
|
8373
8773
|
{
|
|
8374
8774
|
onOpenChange: (open2) => {
|
|
8375
|
-
if (!open2 && (0,
|
|
8775
|
+
if (!open2 && (0, import_type_guards31.isNotNil)(onRequestClose)) {
|
|
8376
8776
|
onRequestClose();
|
|
8377
8777
|
}
|
|
8378
8778
|
},
|
|
@@ -8385,7 +8785,7 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8385
8785
|
ref,
|
|
8386
8786
|
fullHeight,
|
|
8387
8787
|
onOpenAutoFocus: (event) => {
|
|
8388
|
-
if ((0,
|
|
8788
|
+
if ((0, import_type_guards31.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
8389
8789
|
event.preventDefault();
|
|
8390
8790
|
requestAnimationFrame(() => {
|
|
8391
8791
|
initialFocusRef.current?.focus();
|
|
@@ -8417,7 +8817,7 @@ Modal.displayName = "Modal";
|
|
|
8417
8817
|
// src/components/Radio/Radio.tsx
|
|
8418
8818
|
var import_react40 = require("react");
|
|
8419
8819
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
8420
|
-
var
|
|
8820
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
8421
8821
|
var import_jsx_runtime202 = require("react/jsx-runtime");
|
|
8422
8822
|
var StyledLabelWrapper2 = import_styled_components53.default.div`
|
|
8423
8823
|
display: flex;
|
|
@@ -8503,7 +8903,7 @@ var Radio = (0, import_react40.forwardRef)(
|
|
|
8503
8903
|
...otherProps
|
|
8504
8904
|
}, ref) => {
|
|
8505
8905
|
const generatedId = (0, import_react40.useId)();
|
|
8506
|
-
const computedId = (0,
|
|
8906
|
+
const computedId = (0, import_type_guards32.isNonEmptyString)(id) ? id : `ui-radio-${generatedId}`;
|
|
8507
8907
|
return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(
|
|
8508
8908
|
StyledRadioWrapper,
|
|
8509
8909
|
{
|
|
@@ -8548,7 +8948,7 @@ Radio.displayName = "Radio";
|
|
|
8548
8948
|
var import_react41 = require("react");
|
|
8549
8949
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
8550
8950
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
8551
|
-
var
|
|
8951
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
8552
8952
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
8553
8953
|
var StyledSegmentedControl = (0, import_styled_components54.default)(import_react_toggle_group.Root)`
|
|
8554
8954
|
display: inline-flex;
|
|
@@ -8567,7 +8967,7 @@ var SegmentedControl = (0, import_react41.forwardRef)(
|
|
|
8567
8967
|
onSelectedValueChange,
|
|
8568
8968
|
...props
|
|
8569
8969
|
}, ref) => {
|
|
8570
|
-
if ((0,
|
|
8970
|
+
if ((0, import_type_guards33.isNil)(children)) {
|
|
8571
8971
|
return null;
|
|
8572
8972
|
}
|
|
8573
8973
|
return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
@@ -8593,7 +8993,7 @@ SegmentedControl.displayName = "SegmentedControl";
|
|
|
8593
8993
|
var import_react42 = require("react");
|
|
8594
8994
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
8595
8995
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
8596
|
-
var
|
|
8996
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
8597
8997
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8598
8998
|
var StyledSegmentedControlItem = (0, import_styled_components55.default)(import_react_toggle_group2.Item)`
|
|
8599
8999
|
all: unset; /* ToggleGroupItem is a button element */
|
|
@@ -8660,8 +9060,8 @@ var SegmentedControlItem = (0, import_react42.forwardRef)(
|
|
|
8660
9060
|
StyledSegmentedControlItem,
|
|
8661
9061
|
{
|
|
8662
9062
|
ref,
|
|
8663
|
-
$hasLabel: (0,
|
|
8664
|
-
"aria-label": (0,
|
|
9063
|
+
$hasLabel: (0, import_type_guards34.isNotNil)(label),
|
|
9064
|
+
"aria-label": (0, import_type_guards34.isNotNil)(label) ? void 0 : ariaLabel,
|
|
8665
9065
|
disabled,
|
|
8666
9066
|
onClick: handleClick,
|
|
8667
9067
|
value,
|
|
@@ -8678,7 +9078,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
8678
9078
|
// src/components/Tag/Tag.tsx
|
|
8679
9079
|
var import_react43 = require("react");
|
|
8680
9080
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
8681
|
-
var
|
|
9081
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
8682
9082
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
8683
9083
|
var TagLabel = import_styled_components56.default.a`
|
|
8684
9084
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -8756,10 +9156,10 @@ var StyledTag = import_styled_components56.default.div`
|
|
|
8756
9156
|
}
|
|
8757
9157
|
`;
|
|
8758
9158
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
8759
|
-
if ((0,
|
|
9159
|
+
if ((0, import_type_guards35.isNil)(onClickRemove)) {
|
|
8760
9160
|
return null;
|
|
8761
9161
|
}
|
|
8762
|
-
if ((0,
|
|
9162
|
+
if ((0, import_type_guards35.isNil)(onClickRemoveLabel)) {
|
|
8763
9163
|
throw new Error(
|
|
8764
9164
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
8765
9165
|
);
|
|
@@ -8788,7 +9188,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
8788
9188
|
};
|
|
8789
9189
|
var Tag = (0, import_react43.forwardRef)(
|
|
8790
9190
|
({ onClickRemove, colorScheme = "inherit", href, label, onClickRemoveLabel, ...otherProps }, ref) => {
|
|
8791
|
-
const labelProps = (0,
|
|
9191
|
+
const labelProps = (0, import_type_guards35.isNotNil)(href) && (0, import_type_guards35.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
8792
9192
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
|
|
8793
9193
|
StyledTag,
|
|
8794
9194
|
{
|
|
@@ -8926,7 +9326,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
8926
9326
|
|
|
8927
9327
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
8928
9328
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
8929
|
-
var
|
|
9329
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
8930
9330
|
var import_jsx_runtime207 = require("react/jsx-runtime");
|
|
8931
9331
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
8932
9332
|
if (iconOnly) {
|
|
@@ -9020,7 +9420,7 @@ var WistiaLogo = ({
|
|
|
9020
9420
|
...otherProps,
|
|
9021
9421
|
children: [
|
|
9022
9422
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("title", { children: title }),
|
|
9023
|
-
(0,
|
|
9423
|
+
(0, import_type_guards36.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("desc", { children: description }) : null,
|
|
9024
9424
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
9025
9425
|
renderLogotype(logotypeColor, iconOnly)
|
|
9026
9426
|
]
|
|
@@ -9216,7 +9616,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
9216
9616
|
|
|
9217
9617
|
// src/components/DataCards/DataCard.tsx
|
|
9218
9618
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
9219
|
-
var
|
|
9619
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
9220
9620
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
9221
9621
|
var StyledDataCard = import_styled_components62.default.div`
|
|
9222
9622
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -9305,8 +9705,8 @@ var DataCard = ({
|
|
|
9305
9705
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledLoadingValue, {}) : value
|
|
9306
9706
|
}
|
|
9307
9707
|
),
|
|
9308
|
-
(0,
|
|
9309
|
-
(0,
|
|
9708
|
+
(0, import_type_guards37.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
9709
|
+
(0, import_type_guards37.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
9310
9710
|
]
|
|
9311
9711
|
}
|
|
9312
9712
|
);
|
|
@@ -9383,158 +9783,6 @@ var DataCardTrend = ({
|
|
|
9383
9783
|
)
|
|
9384
9784
|
] });
|
|
9385
9785
|
};
|
|
9386
|
-
|
|
9387
|
-
// src/components/EditableHeading/EditableHeading.tsx
|
|
9388
|
-
var import_styled_components65 = __toESM(require("styled-components"));
|
|
9389
|
-
var import_react46 = require("react");
|
|
9390
|
-
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
9391
|
-
var sharedInputStyles = import_styled_components65.css`
|
|
9392
|
-
padding: var(--wui-space-02);
|
|
9393
|
-
border-radius: var(--wui-border-radius-01);
|
|
9394
|
-
overflow-wrap: anywhere;
|
|
9395
|
-
`;
|
|
9396
|
-
var StyledEditableHeadingInput = import_styled_components65.default.textarea`
|
|
9397
|
-
:not([rows]) {
|
|
9398
|
-
min-height: unset;
|
|
9399
|
-
}
|
|
9400
|
-
|
|
9401
|
-
${sharedInputStyles}
|
|
9402
|
-
font-size: var(--wui-typography-heading-1-size);
|
|
9403
|
-
font-weight: var(--wui-typography-heading-1-weight);
|
|
9404
|
-
line-height: var(--wui-typography-heading-1-line-height);
|
|
9405
|
-
font-family: var(--wui-typography-heading-1-family);
|
|
9406
|
-
width: 100%;
|
|
9407
|
-
box-sizing: border-box;
|
|
9408
|
-
margin: 0;
|
|
9409
|
-
display: block;
|
|
9410
|
-
overflow: hidden;
|
|
9411
|
-
resize: vertical;
|
|
9412
|
-
height: ${({ $headingHeight }) => `${$headingHeight}px`};
|
|
9413
|
-
background: transparent;
|
|
9414
|
-
border: none;
|
|
9415
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
9416
|
-
outline-offset: -2px;
|
|
9417
|
-
|
|
9418
|
-
&:focus {
|
|
9419
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
9420
|
-
outline-offset: -2px;
|
|
9421
|
-
}
|
|
9422
|
-
`;
|
|
9423
|
-
var StyledHeading2 = (0, import_styled_components65.default)(Heading)`
|
|
9424
|
-
${sharedInputStyles}
|
|
9425
|
-
transition: all var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
9426
|
-
${({ $editingDisabled }) => !$editingDisabled && import_styled_components65.css`
|
|
9427
|
-
cursor: pointer;
|
|
9428
|
-
|
|
9429
|
-
&:hover {
|
|
9430
|
-
background: var(--wui-color-bg-surface-hover);
|
|
9431
|
-
}
|
|
9432
|
-
`}
|
|
9433
|
-
`;
|
|
9434
|
-
var EditableHeading = ({
|
|
9435
|
-
children,
|
|
9436
|
-
onValueChange,
|
|
9437
|
-
onEditingChange,
|
|
9438
|
-
tooltipText = "Click to edit title",
|
|
9439
|
-
ariaLabel = "Edit title",
|
|
9440
|
-
forceEditing = false,
|
|
9441
|
-
editingDisabled = false,
|
|
9442
|
-
textareaProps,
|
|
9443
|
-
headingProps,
|
|
9444
|
-
dataTestId
|
|
9445
|
-
}) => {
|
|
9446
|
-
const [isEditing, setIsEditing] = (0, import_react46.useState)(false);
|
|
9447
|
-
const [value, setValue] = (0, import_react46.useState)(children);
|
|
9448
|
-
const [previousValue, setPreviousValue] = (0, import_react46.useState)(children);
|
|
9449
|
-
const [headingHeight, setHeadingHeight] = (0, import_react46.useState)("60");
|
|
9450
|
-
const headingRef = (0, import_react46.useRef)(null);
|
|
9451
|
-
const handleSetEditing = (editing) => {
|
|
9452
|
-
if (editingDisabled) return;
|
|
9453
|
-
if (editing && headingRef.current) {
|
|
9454
|
-
setHeadingHeight(`${headingRef.current.offsetHeight}`);
|
|
9455
|
-
}
|
|
9456
|
-
if (editing) {
|
|
9457
|
-
setPreviousValue(value);
|
|
9458
|
-
}
|
|
9459
|
-
setIsEditing(editing);
|
|
9460
|
-
onEditingChange?.(editing);
|
|
9461
|
-
};
|
|
9462
|
-
const handleFinishEditing = () => {
|
|
9463
|
-
const trimmedValue = value.trim();
|
|
9464
|
-
if (trimmedValue === "") {
|
|
9465
|
-
setValue(previousValue);
|
|
9466
|
-
} else if (trimmedValue !== previousValue && onValueChange) {
|
|
9467
|
-
onValueChange(trimmedValue);
|
|
9468
|
-
} else {
|
|
9469
|
-
setValue(trimmedValue);
|
|
9470
|
-
}
|
|
9471
|
-
handleSetEditing(false);
|
|
9472
|
-
};
|
|
9473
|
-
const handleKeyDown = (event) => {
|
|
9474
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
9475
|
-
event.preventDefault();
|
|
9476
|
-
handleFinishEditing();
|
|
9477
|
-
}
|
|
9478
|
-
if (event.key === "Escape") {
|
|
9479
|
-
setValue(previousValue);
|
|
9480
|
-
handleSetEditing(false);
|
|
9481
|
-
}
|
|
9482
|
-
};
|
|
9483
|
-
const HeadingComponent2 = /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
9484
|
-
StyledHeading2,
|
|
9485
|
-
{
|
|
9486
|
-
...headingProps,
|
|
9487
|
-
ref: headingRef,
|
|
9488
|
-
$editingDisabled: editingDisabled,
|
|
9489
|
-
"data-testid": dataTestId,
|
|
9490
|
-
onClick: () => handleSetEditing(true),
|
|
9491
|
-
variant: "heading1",
|
|
9492
|
-
children: value
|
|
9493
|
-
}
|
|
9494
|
-
);
|
|
9495
|
-
if (editingDisabled) {
|
|
9496
|
-
return HeadingComponent2;
|
|
9497
|
-
}
|
|
9498
|
-
if (isEditing || forceEditing) {
|
|
9499
|
-
return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
9500
|
-
StyledEditableHeadingInput,
|
|
9501
|
-
{
|
|
9502
|
-
...textareaProps,
|
|
9503
|
-
$headingHeight: headingHeight,
|
|
9504
|
-
"aria-label": ariaLabel,
|
|
9505
|
-
autoFocus: true,
|
|
9506
|
-
"data-testid": dataTestId,
|
|
9507
|
-
onBlur: handleFinishEditing,
|
|
9508
|
-
onChange: (event) => setValue(event.target.value),
|
|
9509
|
-
onFocus: (event) => {
|
|
9510
|
-
const { length } = event.currentTarget.value;
|
|
9511
|
-
event.currentTarget.setSelectionRange(length, length);
|
|
9512
|
-
},
|
|
9513
|
-
onKeyDown: handleKeyDown,
|
|
9514
|
-
value,
|
|
9515
|
-
children: value
|
|
9516
|
-
}
|
|
9517
|
-
);
|
|
9518
|
-
}
|
|
9519
|
-
return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_jsx_runtime214.Fragment, { children: [
|
|
9520
|
-
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
9521
|
-
Tooltip,
|
|
9522
|
-
{
|
|
9523
|
-
compact: true,
|
|
9524
|
-
content: tooltipText,
|
|
9525
|
-
children: HeadingComponent2
|
|
9526
|
-
}
|
|
9527
|
-
),
|
|
9528
|
-
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(ScreenReaderOnly, { children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
9529
|
-
"button",
|
|
9530
|
-
{
|
|
9531
|
-
"aria-label": ariaLabel,
|
|
9532
|
-
onClick: () => handleSetEditing(true),
|
|
9533
|
-
type: "button"
|
|
9534
|
-
}
|
|
9535
|
-
) })
|
|
9536
|
-
] });
|
|
9537
|
-
};
|
|
9538
9786
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9539
9787
|
0 && (module.exports = {
|
|
9540
9788
|
ActionButton,
|
|
@@ -9554,7 +9802,6 @@ var EditableHeading = ({
|
|
|
9554
9802
|
DataCardTrend,
|
|
9555
9803
|
DataCards,
|
|
9556
9804
|
Divider,
|
|
9557
|
-
EditableHeading,
|
|
9558
9805
|
Ellipsis,
|
|
9559
9806
|
Form,
|
|
9560
9807
|
FormErrorSummary,
|
|
@@ -9591,6 +9838,7 @@ var EditableHeading = ({
|
|
|
9591
9838
|
WistiaLogo,
|
|
9592
9839
|
colorSchemeOptions,
|
|
9593
9840
|
copyToClipboard,
|
|
9841
|
+
dateTime,
|
|
9594
9842
|
ellipsisFlexParentStyle,
|
|
9595
9843
|
ellipsisStyle,
|
|
9596
9844
|
iconSizeMap,
|