@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.cjs +516 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.mjs +460 -59
- 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
|
*
|
|
@@ -92,6 +92,7 @@ __export(index_exports, {
|
|
|
92
92
|
WistiaLogo: () => WistiaLogo,
|
|
93
93
|
colorSchemeOptions: () => colorSchemeOptions,
|
|
94
94
|
copyToClipboard: () => copyToClipboard,
|
|
95
|
+
dateTime: () => dateTime,
|
|
95
96
|
ellipsisFlexParentStyle: () => ellipsisFlexParentStyle,
|
|
96
97
|
ellipsisStyle: () => ellipsisStyle,
|
|
97
98
|
iconSizeMap: () => iconSizeMap,
|
|
@@ -1560,6 +1561,396 @@ var copyToClipboard = async (textToCopy) => {
|
|
|
1560
1561
|
});
|
|
1561
1562
|
};
|
|
1562
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
|
+
|
|
1563
1954
|
// src/helpers/mq/mq.ts
|
|
1564
1955
|
var import_polished = require("polished");
|
|
1565
1956
|
|
|
@@ -1617,7 +2008,7 @@ var useBoolean = (initialValue = false) => {
|
|
|
1617
2008
|
};
|
|
1618
2009
|
|
|
1619
2010
|
// src/hooks/useMq/useMq.ts
|
|
1620
|
-
var
|
|
2011
|
+
var import_type_guards5 = require("@wistia/type-guards");
|
|
1621
2012
|
|
|
1622
2013
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
1623
2014
|
var import_react4 = require("react");
|
|
@@ -1679,7 +2070,7 @@ var useActiveMq = () => {
|
|
|
1679
2070
|
const keys = Object.keys(mq2);
|
|
1680
2071
|
return keys.filter((key) => {
|
|
1681
2072
|
const value = mq2[key];
|
|
1682
|
-
return (0,
|
|
2073
|
+
return (0, import_type_guards5.isBoolean)(value) && value;
|
|
1683
2074
|
});
|
|
1684
2075
|
};
|
|
1685
2076
|
|
|
@@ -1689,10 +2080,10 @@ var import_react6 = require("react");
|
|
|
1689
2080
|
// src/private/hooks/useEvent/useEvent.ts
|
|
1690
2081
|
var import_react5 = require("react");
|
|
1691
2082
|
|
|
1692
|
-
// src/private/helpers/
|
|
1693
|
-
var
|
|
1694
|
-
var
|
|
1695
|
-
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;
|
|
1696
2087
|
};
|
|
1697
2088
|
|
|
1698
2089
|
// src/private/hooks/useEvent/useEvent.ts
|
|
@@ -1711,7 +2102,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
|
|
|
1711
2102
|
savedEventOptions.current = eventOptions;
|
|
1712
2103
|
}, [eventOptions]);
|
|
1713
2104
|
(0, import_react5.useEffect)(() => {
|
|
1714
|
-
const target =
|
|
2105
|
+
const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
|
|
1715
2106
|
if (!eventName || !isEventTargetSupported(target)) {
|
|
1716
2107
|
return;
|
|
1717
2108
|
}
|
|
@@ -1757,10 +2148,10 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
1757
2148
|
|
|
1758
2149
|
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
1759
2150
|
var import_react7 = require("react");
|
|
1760
|
-
var
|
|
2151
|
+
var import_type_guards7 = require("@wistia/type-guards");
|
|
1761
2152
|
var useAriaLive = () => {
|
|
1762
2153
|
const context = (0, import_react7.useContext)(AriaLiveContext);
|
|
1763
|
-
if ((0,
|
|
2154
|
+
if ((0, import_type_guards7.isNil)(context)) {
|
|
1764
2155
|
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
1765
2156
|
}
|
|
1766
2157
|
return context;
|
|
@@ -1773,10 +2164,10 @@ var import_sonner2 = require("sonner");
|
|
|
1773
2164
|
// src/private/components/Toast/Toast.tsx
|
|
1774
2165
|
var import_react8 = require("react");
|
|
1775
2166
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1776
|
-
var
|
|
2167
|
+
var import_type_guards9 = require("@wistia/type-guards");
|
|
1777
2168
|
|
|
1778
2169
|
// src/components/Ellipsis/Ellipsis.tsx
|
|
1779
|
-
var
|
|
2170
|
+
var import_type_guards8 = require("@wistia/type-guards");
|
|
1780
2171
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1781
2172
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1782
2173
|
var ellipsisStyle = import_styled_components13.css`
|
|
@@ -1808,7 +2199,7 @@ var ellipsisFlexParentStyle = import_styled_components13.css`
|
|
|
1808
2199
|
var EllipsisComponent = import_styled_components13.default.div`
|
|
1809
2200
|
${ellipsisStyle};
|
|
1810
2201
|
${({ $lines }) => {
|
|
1811
|
-
if ((0,
|
|
2202
|
+
if ((0, import_type_guards8.isNotNil)($lines)) {
|
|
1812
2203
|
return import_styled_components13.css`
|
|
1813
2204
|
-webkit-box-orient: vertical;
|
|
1814
2205
|
-webkit-line-clamp: ${$lines};
|
|
@@ -1990,7 +2381,7 @@ var StyledToast = import_styled_components15.default.div`
|
|
|
1990
2381
|
}
|
|
1991
2382
|
`;
|
|
1992
2383
|
var Action = ({ actionButton }) => {
|
|
1993
|
-
if ((0,
|
|
2384
|
+
if ((0, import_type_guards9.isNotNil)(actionButton) && (0, import_react8.isValidElement)(actionButton)) {
|
|
1994
2385
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react8.cloneElement)(actionButton, {
|
|
1995
2386
|
variant: "soft",
|
|
1996
2387
|
// force Button variant
|
|
@@ -2014,7 +2405,7 @@ var Toast = ({
|
|
|
2014
2405
|
$colorScheme: colorScheme,
|
|
2015
2406
|
children: [
|
|
2016
2407
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageWrapper, { children: [
|
|
2017
|
-
(0,
|
|
2408
|
+
(0, import_type_guards9.isNotNil)(icon) ? icon : null,
|
|
2018
2409
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Message, { lines: 3, children: message })
|
|
2019
2410
|
] }),
|
|
2020
2411
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Action, { actionButton: action })
|
|
@@ -2055,7 +2446,7 @@ var import_styled_components21 = __toESM(require("styled-components"));
|
|
|
2055
2446
|
// src/components/Button/Button.tsx
|
|
2056
2447
|
var import_react12 = require("react");
|
|
2057
2448
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2058
|
-
var
|
|
2449
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
2059
2450
|
|
|
2060
2451
|
// src/css/buttonResetCss.tsx
|
|
2061
2452
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2259,7 +2650,7 @@ var buttonSizeStyles = {
|
|
|
2259
2650
|
};
|
|
2260
2651
|
|
|
2261
2652
|
// src/components/Icon/Icon.tsx
|
|
2262
|
-
var
|
|
2653
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2263
2654
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2264
2655
|
|
|
2265
2656
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -5420,7 +5811,7 @@ var iconMap = {
|
|
|
5420
5811
|
};
|
|
5421
5812
|
|
|
5422
5813
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
5423
|
-
var
|
|
5814
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
5424
5815
|
var import_react10 = require("react");
|
|
5425
5816
|
var isResponsiveObject = (values) => {
|
|
5426
5817
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
@@ -5428,9 +5819,9 @@ var isResponsiveObject = (values) => {
|
|
|
5428
5819
|
var useResponsiveProp = (values) => {
|
|
5429
5820
|
const activeMediaQueries = useActiveMq();
|
|
5430
5821
|
return (0, import_react10.useMemo)(() => {
|
|
5431
|
-
if ((0,
|
|
5822
|
+
if ((0, import_type_guards10.isRecord)(values) && isResponsiveObject(values)) {
|
|
5432
5823
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
5433
|
-
return (0,
|
|
5824
|
+
return (0, import_type_guards10.isNotUndefined)(mq2) && (0, import_type_guards10.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
5434
5825
|
}
|
|
5435
5826
|
return values;
|
|
5436
5827
|
}, [activeMediaQueries, values]);
|
|
@@ -5457,13 +5848,13 @@ var Icon = ({
|
|
|
5457
5848
|
...otherProps
|
|
5458
5849
|
}) => {
|
|
5459
5850
|
const responsiveSize = useResponsiveProp(size);
|
|
5460
|
-
if ((0,
|
|
5851
|
+
if ((0, import_type_guards11.isNil)(type)) {
|
|
5461
5852
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
5462
5853
|
}
|
|
5463
|
-
if ((0,
|
|
5854
|
+
if ((0, import_type_guards11.isNil)(iconMap[type])) {
|
|
5464
5855
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
5465
5856
|
}
|
|
5466
|
-
if ((0,
|
|
5857
|
+
if ((0, import_type_guards11.isNil)(iconSizeMap[responsiveSize])) {
|
|
5467
5858
|
throw new Error(
|
|
5468
5859
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
5469
5860
|
);
|
|
@@ -5495,12 +5886,12 @@ Icon.displayName = "Icon";
|
|
|
5495
5886
|
|
|
5496
5887
|
// src/components/Link/Link.tsx
|
|
5497
5888
|
var import_react11 = require("react");
|
|
5498
|
-
var
|
|
5889
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
5499
5890
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
5500
5891
|
var import_react_router_dom = require("react-router-dom");
|
|
5501
5892
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
5502
5893
|
var generateHref = (href, type, disabled) => {
|
|
5503
|
-
if (disabled || (0,
|
|
5894
|
+
if (disabled || (0, import_type_guards12.isNil)(href)) {
|
|
5504
5895
|
return void 0;
|
|
5505
5896
|
}
|
|
5506
5897
|
let to = href;
|
|
@@ -5512,12 +5903,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
5512
5903
|
}
|
|
5513
5904
|
return to;
|
|
5514
5905
|
};
|
|
5515
|
-
var isButton = (props) => (0,
|
|
5516
|
-
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);
|
|
5517
5908
|
var StyledLink = import_styled_components19.default.a`
|
|
5518
5909
|
--link-icon-size: 14px;
|
|
5519
5910
|
|
|
5520
|
-
${({ href }) => (0,
|
|
5911
|
+
${({ href }) => (0, import_type_guards12.isNil)(href) && buttonResetCss};
|
|
5521
5912
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
5522
5913
|
cursor: pointer;
|
|
5523
5914
|
font-family: var(--wui-typography-family-default);
|
|
@@ -5561,7 +5952,7 @@ var Link = (0, import_react11.forwardRef)(
|
|
|
5561
5952
|
} finally {
|
|
5562
5953
|
if (routingCallback !== null) {
|
|
5563
5954
|
routingCallback();
|
|
5564
|
-
} else if ((0,
|
|
5955
|
+
} else if ((0, import_type_guards12.isNotNil)(to)) {
|
|
5565
5956
|
window.location.assign(to);
|
|
5566
5957
|
} else {
|
|
5567
5958
|
}
|
|
@@ -5624,7 +6015,7 @@ Link.displayName = "Link";
|
|
|
5624
6015
|
|
|
5625
6016
|
// src/components/Button/Button.tsx
|
|
5626
6017
|
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
5627
|
-
var isLink2 = (props) => (0,
|
|
6018
|
+
var isLink2 = (props) => (0, import_type_guards13.isNotUndefined)(props.href);
|
|
5628
6019
|
var StyledButton = import_styled_components20.default.button`
|
|
5629
6020
|
${buttonResetCss}
|
|
5630
6021
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -5665,8 +6056,8 @@ var ButtonContent = ({
|
|
|
5665
6056
|
/* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
|
|
5666
6057
|
StyledButtonContent,
|
|
5667
6058
|
{
|
|
5668
|
-
$hasLeftIcon: (0,
|
|
5669
|
-
$hasRightIcon: (0,
|
|
6059
|
+
$hasLeftIcon: (0, import_type_guards13.isNotNil)(leftIcon),
|
|
6060
|
+
$hasRightIcon: (0, import_type_guards13.isNotNil)(rightIcon),
|
|
5670
6061
|
$isLoading: isLoading,
|
|
5671
6062
|
children: [
|
|
5672
6063
|
leftIcon ?? null,
|
|
@@ -5734,7 +6125,7 @@ var Button = (0, import_react12.forwardRef)(
|
|
|
5734
6125
|
event.preventDefault();
|
|
5735
6126
|
return;
|
|
5736
6127
|
}
|
|
5737
|
-
if ((0,
|
|
6128
|
+
if ((0, import_type_guards13.isNotNil)(onClick)) {
|
|
5738
6129
|
onClick(event);
|
|
5739
6130
|
}
|
|
5740
6131
|
};
|
|
@@ -5895,7 +6286,7 @@ ActionButton.displayName = "ActionButton";
|
|
|
5895
6286
|
|
|
5896
6287
|
// src/components/Avatar/Avatar.tsx
|
|
5897
6288
|
var import_react14 = require("react");
|
|
5898
|
-
var
|
|
6289
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
5899
6290
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
5900
6291
|
|
|
5901
6292
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -5938,13 +6329,13 @@ var ColorSchemeWrapper = ({
|
|
|
5938
6329
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
5939
6330
|
|
|
5940
6331
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
5941
|
-
var
|
|
6332
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
5942
6333
|
var containsEmojiCharacter = (char) => {
|
|
5943
6334
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
5944
6335
|
return emojiRegex.test(char);
|
|
5945
6336
|
};
|
|
5946
6337
|
var formatNameForDisplay = (name) => {
|
|
5947
|
-
if ((0,
|
|
6338
|
+
if ((0, import_type_guards14.isNil)(name) || !(0, import_type_guards14.isString)(name) || (0, import_type_guards14.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
5948
6339
|
return "U";
|
|
5949
6340
|
}
|
|
5950
6341
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -6007,7 +6398,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
6007
6398
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
6008
6399
|
`;
|
|
6009
6400
|
var chooseColorScheme = (name) => {
|
|
6010
|
-
if ((0,
|
|
6401
|
+
if ((0, import_type_guards15.isNil)(name) || name === "Anonymous") {
|
|
6011
6402
|
return "default";
|
|
6012
6403
|
}
|
|
6013
6404
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -6040,7 +6431,7 @@ var Avatar = ({
|
|
|
6040
6431
|
};
|
|
6041
6432
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
6042
6433
|
const avatarColor = (0, import_react14.useMemo)(() => chooseColorScheme(name), [name]);
|
|
6043
|
-
const showInitials = (0,
|
|
6434
|
+
const showInitials = (0, import_type_guards15.isNil)(imageUrl) || imageLoadState === "error";
|
|
6044
6435
|
return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
6045
6436
|
AvatarWrapper,
|
|
6046
6437
|
{
|
|
@@ -6071,7 +6462,7 @@ Avatar.displayName = "Avatar";
|
|
|
6071
6462
|
// src/components/Badge/Badge.tsx
|
|
6072
6463
|
var import_react15 = require("react");
|
|
6073
6464
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
6074
|
-
var
|
|
6465
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
6075
6466
|
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
6076
6467
|
var StyledBadge = import_styled_components24.default.div`
|
|
6077
6468
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -6095,7 +6486,7 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
6095
6486
|
`;
|
|
6096
6487
|
var Badge = (0, import_react15.forwardRef)(
|
|
6097
6488
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
6098
|
-
const hasIcon = (0,
|
|
6489
|
+
const hasIcon = (0, import_type_guards16.isNotNil)(icon);
|
|
6099
6490
|
return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
|
|
6100
6491
|
StyledBadge,
|
|
6101
6492
|
{
|
|
@@ -6116,7 +6507,7 @@ Badge.displayName = "Badge";
|
|
|
6116
6507
|
// src/components/Box/Box.tsx
|
|
6117
6508
|
var import_react16 = require("react");
|
|
6118
6509
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
6119
|
-
var
|
|
6510
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
6120
6511
|
|
|
6121
6512
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
6122
6513
|
var makePolymorphic = (component) => {
|
|
@@ -6127,8 +6518,8 @@ var makePolymorphic = (component) => {
|
|
|
6127
6518
|
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
6128
6519
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
6129
6520
|
var getGapStyle = (gap) => {
|
|
6130
|
-
if ((0,
|
|
6131
|
-
if ((0,
|
|
6521
|
+
if ((0, import_type_guards17.isNotNil)(gap)) {
|
|
6522
|
+
if ((0, import_type_guards17.isRecord)(gap)) {
|
|
6132
6523
|
return Object.entries(gap).map(([key, value]) => {
|
|
6133
6524
|
return `${key}-gap: var(--wui-${value})};`;
|
|
6134
6525
|
}).join("");
|
|
@@ -6171,25 +6562,25 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
6171
6562
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
6172
6563
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
6173
6564
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
6174
|
-
display: ${({ $inline }) => (0,
|
|
6175
|
-
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};
|
|
6176
6567
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
6177
6568
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
6178
6569
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
6179
6570
|
|
|
6180
6571
|
/* Box children styles */
|
|
6181
|
-
flex-grow: ${({ $grow }) => (0,
|
|
6182
|
-
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};
|
|
6183
6574
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
6184
6575
|
${({ $gap }) => getGapStyle($gap)};
|
|
6185
6576
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
6186
|
-
order: ${({ $order }) => (0,
|
|
6577
|
+
order: ${({ $order }) => (0, import_type_guards17.isNotNil)($order) ? $order : null};
|
|
6187
6578
|
`;
|
|
6188
6579
|
var wrapChildren = (children) => {
|
|
6189
|
-
if ((0,
|
|
6580
|
+
if ((0, import_type_guards17.isNotNil)(children)) {
|
|
6190
6581
|
if (typeof children === "object" && isDev) {
|
|
6191
6582
|
return import_react16.Children.map(children, (child) => {
|
|
6192
|
-
if ((0,
|
|
6583
|
+
if ((0, import_type_guards17.isNil)(child)) return null;
|
|
6193
6584
|
const elementParams = {};
|
|
6194
6585
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
6195
6586
|
elementParams.hasBoxParent = true;
|
|
@@ -6336,7 +6727,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
6336
6727
|
|
|
6337
6728
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
6338
6729
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
6339
|
-
var
|
|
6730
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
6340
6731
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
6341
6732
|
var getAlignment = (align) => {
|
|
6342
6733
|
if (align === "center") {
|
|
@@ -6376,7 +6767,7 @@ var ButtonGroup = ({
|
|
|
6376
6767
|
fullWidth = false,
|
|
6377
6768
|
...otherProps
|
|
6378
6769
|
}) => {
|
|
6379
|
-
if ((0,
|
|
6770
|
+
if ((0, import_type_guards18.isNil)(children)) {
|
|
6380
6771
|
return null;
|
|
6381
6772
|
}
|
|
6382
6773
|
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
@@ -6446,7 +6837,7 @@ Card.displayName = "Card";
|
|
|
6446
6837
|
var import_react19 = require("react");
|
|
6447
6838
|
var import_react_checkbox = require("@radix-ui/react-checkbox");
|
|
6448
6839
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
6449
|
-
var
|
|
6840
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
6450
6841
|
|
|
6451
6842
|
// src/components/Label/Label.tsx
|
|
6452
6843
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
@@ -6626,7 +7017,7 @@ Label.displayName = "Label";
|
|
|
6626
7017
|
|
|
6627
7018
|
// src/components/Label/LabelDescription.tsx
|
|
6628
7019
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
6629
|
-
var
|
|
7020
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
6630
7021
|
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
6631
7022
|
var StyledLabelDescription = import_styled_components32.default.div`
|
|
6632
7023
|
color: var(--wui-color-text-secondary);
|
|
@@ -6638,7 +7029,7 @@ var LabelDescription = ({
|
|
|
6638
7029
|
children,
|
|
6639
7030
|
...props
|
|
6640
7031
|
}) => {
|
|
6641
|
-
if ((0,
|
|
7032
|
+
if ((0, import_type_guards19.isNil)(children)) {
|
|
6642
7033
|
return null;
|
|
6643
7034
|
}
|
|
6644
7035
|
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(StyledLabelDescription, { ...props, children });
|
|
@@ -6735,7 +7126,7 @@ var Checkbox = (0, import_react19.forwardRef)(
|
|
|
6735
7126
|
...otherProps
|
|
6736
7127
|
}, ref) => {
|
|
6737
7128
|
const generatedId = (0, import_react19.useId)();
|
|
6738
|
-
const computedId = (0,
|
|
7129
|
+
const computedId = (0, import_type_guards20.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-group-${generatedId}`;
|
|
6739
7130
|
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(StyledCheckboxWrapper, { children: [
|
|
6740
7131
|
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
6741
7132
|
StyledCheckboxRoot,
|
|
@@ -6828,7 +7219,7 @@ Divider.displayName = "Divider";
|
|
|
6828
7219
|
// src/components/Form/Form.tsx
|
|
6829
7220
|
var import_react21 = require("react");
|
|
6830
7221
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
6831
|
-
var
|
|
7222
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
6832
7223
|
|
|
6833
7224
|
// src/components/Stack/Stack.tsx
|
|
6834
7225
|
var import_react20 = require("react");
|
|
@@ -6882,7 +7273,7 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
|
|
|
6882
7273
|
const id = props.id ?? autoId;
|
|
6883
7274
|
const handleValidate = (nextFormData) => {
|
|
6884
7275
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
6885
|
-
if ((0,
|
|
7276
|
+
if ((0, import_type_guards21.isUndefined)(validate)) {
|
|
6886
7277
|
return {};
|
|
6887
7278
|
}
|
|
6888
7279
|
return validate(nextData);
|
|
@@ -6892,7 +7283,7 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
|
|
|
6892
7283
|
props.onBlur(event);
|
|
6893
7284
|
}
|
|
6894
7285
|
const formData = new FormData(event.currentTarget);
|
|
6895
|
-
if ((0,
|
|
7286
|
+
if ((0, import_type_guards21.isNotUndefined)(validate)) {
|
|
6896
7287
|
handleValidate(formData);
|
|
6897
7288
|
}
|
|
6898
7289
|
};
|
|
@@ -6988,7 +7379,7 @@ var useFormState = (action, initialData = {}) => {
|
|
|
6988
7379
|
|
|
6989
7380
|
// src/components/Form/FormErrorSummary.tsx
|
|
6990
7381
|
var import_react23 = require("react");
|
|
6991
|
-
var
|
|
7382
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
6992
7383
|
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
6993
7384
|
var ErrorItem = ({ name, error, formId }) => {
|
|
6994
7385
|
return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(Link, { href: `${formId}-${name}`, children: error }) }, name);
|
|
@@ -7002,8 +7393,8 @@ var FormErrorSummary = ({ description }) => {
|
|
|
7002
7393
|
}
|
|
7003
7394
|
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)("div", { ref, children: [
|
|
7004
7395
|
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("p", { children: description }),
|
|
7005
|
-
/* @__PURE__ */ (0, import_jsx_runtime179.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
7006
|
-
([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)(
|
|
7007
7398
|
ErrorItem,
|
|
7008
7399
|
{
|
|
7009
7400
|
error: err,
|
|
@@ -7027,7 +7418,7 @@ var FormErrorSummary = ({ description }) => {
|
|
|
7027
7418
|
// src/components/FormField/FormField.tsx
|
|
7028
7419
|
var import_react27 = require("react");
|
|
7029
7420
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
7030
|
-
var
|
|
7421
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7031
7422
|
|
|
7032
7423
|
// src/components/Text/Text.tsx
|
|
7033
7424
|
var import_react24 = require("react");
|
|
@@ -7282,7 +7673,7 @@ var StyledErrorList = import_styled_components39.default.ul`
|
|
|
7282
7673
|
gap: var(--wui-space-01);
|
|
7283
7674
|
`;
|
|
7284
7675
|
var ErrorMessages = ({ errors, id }) => {
|
|
7285
|
-
const isMultipleErrors = (0,
|
|
7676
|
+
const isMultipleErrors = (0, import_type_guards23.isArray)(errors);
|
|
7286
7677
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
7287
7678
|
Text,
|
|
7288
7679
|
{
|
|
@@ -7325,19 +7716,19 @@ var FormField = ({
|
|
|
7325
7716
|
label: isInlineLabel ? label : void 0,
|
|
7326
7717
|
...props
|
|
7327
7718
|
};
|
|
7328
|
-
if ((0,
|
|
7719
|
+
if ((0, import_type_guards23.isUndefined)(value) && (0, import_type_guards23.isNotUndefined)(defaultValue)) {
|
|
7329
7720
|
childProps = {
|
|
7330
7721
|
...childProps,
|
|
7331
7722
|
defaultValue
|
|
7332
7723
|
};
|
|
7333
7724
|
}
|
|
7334
|
-
if ((0,
|
|
7335
|
-
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;
|
|
7336
7727
|
const handleChange = (event) => {
|
|
7337
|
-
if ((0,
|
|
7728
|
+
if ((0, import_type_guards23.isNotUndefined)(props.onChange)) {
|
|
7338
7729
|
props.onChange(event);
|
|
7339
7730
|
}
|
|
7340
|
-
if ((0,
|
|
7731
|
+
if ((0, import_type_guards23.isNotUndefined)(checkboxGroup.onChange)) {
|
|
7341
7732
|
checkboxGroup.onChange(event);
|
|
7342
7733
|
}
|
|
7343
7734
|
};
|
|
@@ -7345,15 +7736,15 @@ var FormField = ({
|
|
|
7345
7736
|
...childProps,
|
|
7346
7737
|
name: computedName,
|
|
7347
7738
|
onChange: handleChange,
|
|
7348
|
-
"aria-invalid": (0,
|
|
7349
|
-
"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
|
|
7350
7741
|
};
|
|
7351
7742
|
}
|
|
7352
7743
|
import_react27.Children.only(children);
|
|
7353
7744
|
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(StyledFormField, { ...props, children: [
|
|
7354
7745
|
!isInlineLabel && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(Label, { htmlFor: id, children: label }),
|
|
7355
7746
|
(0, import_react27.cloneElement)(children, childProps),
|
|
7356
|
-
(0,
|
|
7747
|
+
(0, import_type_guards23.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
7357
7748
|
ErrorMessages,
|
|
7358
7749
|
{
|
|
7359
7750
|
errors: computedError,
|
|
@@ -7426,7 +7817,18 @@ IconButton.displayName = "IconButton";
|
|
|
7426
7817
|
// src/components/Input/Input.tsx
|
|
7427
7818
|
var import_react30 = require("react");
|
|
7428
7819
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
7429
|
-
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
|
|
7430
7832
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
7431
7833
|
var inputStyles = import_styled_components41.css`
|
|
7432
7834
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -7513,9 +7915,6 @@ var StyledInputContainer = import_styled_components41.default.div`
|
|
|
7513
7915
|
padding-right: 32px;
|
|
7514
7916
|
}
|
|
7515
7917
|
`;
|
|
7516
|
-
var isValidRef = (ref) => {
|
|
7517
|
-
return typeof ref === "object" && ref !== null && "current" in ref && (0, import_type_guards22.isNotNil)(ref.current);
|
|
7518
|
-
};
|
|
7519
7918
|
var Input = (0, import_react30.forwardRef)(
|
|
7520
7919
|
({
|
|
7521
7920
|
fullWidth = false,
|
|
@@ -7527,26 +7926,26 @@ var Input = (0, import_react30.forwardRef)(
|
|
|
7527
7926
|
...props
|
|
7528
7927
|
}, externalRef) => {
|
|
7529
7928
|
const internalRef = (0, import_react30.useRef)();
|
|
7530
|
-
const ref =
|
|
7929
|
+
const ref = isReadyRef(externalRef) ? externalRef : internalRef;
|
|
7531
7930
|
let leftIconToDisplay = leftIcon;
|
|
7532
|
-
if ((0,
|
|
7931
|
+
if ((0, import_type_guards25.isNil)(leftIcon) && type === "search") {
|
|
7533
7932
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Icon, { type: "search" });
|
|
7534
7933
|
}
|
|
7535
|
-
if ((0,
|
|
7934
|
+
if ((0, import_type_guards25.isNotNil)(leftIconToDisplay)) {
|
|
7536
7935
|
leftIconToDisplay = (0, import_react30.cloneElement)(leftIconToDisplay, {
|
|
7537
7936
|
size: "md",
|
|
7538
7937
|
className: "wui-input-left-icon"
|
|
7539
7938
|
});
|
|
7540
7939
|
}
|
|
7541
7940
|
let rightIconToDisplay = rightIcon;
|
|
7542
|
-
if ((0,
|
|
7941
|
+
if ((0, import_type_guards25.isNotNil)(rightIconToDisplay)) {
|
|
7543
7942
|
rightIconToDisplay = (0, import_react30.cloneElement)(rightIconToDisplay, {
|
|
7544
7943
|
size: "md",
|
|
7545
7944
|
className: "wui-input-right-icon"
|
|
7546
7945
|
});
|
|
7547
7946
|
}
|
|
7548
7947
|
const handleFocus = (event) => {
|
|
7549
|
-
if ((0,
|
|
7948
|
+
if ((0, import_type_guards25.isNotNil)(props.onFocus)) {
|
|
7550
7949
|
props.onFocus(event);
|
|
7551
7950
|
}
|
|
7552
7951
|
if (autoSelect && ref && "current" in ref) {
|
|
@@ -7589,7 +7988,7 @@ Input.displayName = "Input";
|
|
|
7589
7988
|
// src/components/Menu/Menu.tsx
|
|
7590
7989
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
7591
7990
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
7592
|
-
var
|
|
7991
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
7593
7992
|
var import_react32 = require("react");
|
|
7594
7993
|
|
|
7595
7994
|
// src/components/Menu/MenuContext.tsx
|
|
@@ -7701,7 +8100,7 @@ var Menu = ({
|
|
|
7701
8100
|
}) => {
|
|
7702
8101
|
const contextValue = (0, import_react32.useMemo)(() => ({ compact }), [compact]);
|
|
7703
8102
|
let controlProps = {
|
|
7704
|
-
...(0,
|
|
8103
|
+
...(0, import_type_guards26.isNotNil)(onOpenChange) && (0, import_type_guards26.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
7705
8104
|
};
|
|
7706
8105
|
if (disabled) {
|
|
7707
8106
|
controlProps = {
|
|
@@ -7715,7 +8114,7 @@ var Menu = ({
|
|
|
7715
8114
|
modal: false,
|
|
7716
8115
|
...controlProps,
|
|
7717
8116
|
children: [
|
|
7718
|
-
/* @__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)(
|
|
7719
8118
|
Button,
|
|
7720
8119
|
{
|
|
7721
8120
|
"aria-expanded": isOpen,
|
|
@@ -7776,12 +8175,12 @@ MenuLabel.displayName = "MenuLabel";
|
|
|
7776
8175
|
var import_react34 = require("react");
|
|
7777
8176
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
7778
8177
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
7779
|
-
var
|
|
8178
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
7780
8179
|
|
|
7781
8180
|
// src/components/Menu/MenuItemButton.tsx
|
|
7782
8181
|
var import_react33 = require("react");
|
|
7783
8182
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
7784
|
-
var
|
|
8183
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
7785
8184
|
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
7786
8185
|
var StyledButton3 = (0, import_styled_components44.default)(Button)`
|
|
7787
8186
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -7855,7 +8254,7 @@ var StyledBadgeContainer = import_styled_components44.default.div`
|
|
|
7855
8254
|
var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
7856
8255
|
let { colorScheme, badge } = props;
|
|
7857
8256
|
if (appearance === "dangerous") {
|
|
7858
|
-
if ((0,
|
|
8257
|
+
if ((0, import_type_guards27.isNotUndefined)(colorScheme)) {
|
|
7859
8258
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
7860
8259
|
}
|
|
7861
8260
|
colorScheme = "error";
|
|
@@ -7885,7 +8284,7 @@ var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, com
|
|
|
7885
8284
|
children: [
|
|
7886
8285
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
7887
8286
|
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
7888
|
-
(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,
|
|
7889
8288
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
7890
8289
|
]
|
|
7891
8290
|
}
|
|
@@ -7952,7 +8351,7 @@ var SubMenu = ({
|
|
|
7952
8351
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
7953
8352
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
7954
8353
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemLabel, { children: label }),
|
|
7955
|
-
(0,
|
|
8354
|
+
(0, import_type_guards28.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemDescription, { children: description }) : null
|
|
7956
8355
|
] }),
|
|
7957
8356
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
7958
8357
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -8132,7 +8531,7 @@ CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
|
8132
8531
|
var import_react39 = require("react");
|
|
8133
8532
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
8134
8533
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
8135
|
-
var
|
|
8534
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
8136
8535
|
|
|
8137
8536
|
// src/components/Modal/ModalHeader.tsx
|
|
8138
8537
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
@@ -8159,7 +8558,7 @@ var ModalCloseButton = () => {
|
|
|
8159
8558
|
|
|
8160
8559
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
8161
8560
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
8162
|
-
var
|
|
8561
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
8163
8562
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
8164
8563
|
var VisuallyHidden = import_styled_components48.default.div({ ...visuallyHiddenStyle });
|
|
8165
8564
|
var VisuallyHiddenButFocusable = import_styled_components48.default.div({
|
|
@@ -8171,7 +8570,7 @@ var ScreenReaderOnly = ({
|
|
|
8171
8570
|
focusable = false,
|
|
8172
8571
|
...otherProps
|
|
8173
8572
|
}) => {
|
|
8174
|
-
const accessibleText = (0,
|
|
8573
|
+
const accessibleText = (0, import_type_guards29.isNotNil)(text) ? text : children;
|
|
8175
8574
|
if (focusable) {
|
|
8176
8575
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
8177
8576
|
}
|
|
@@ -8218,7 +8617,7 @@ var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
|
8218
8617
|
|
|
8219
8618
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
8220
8619
|
var import_react36 = require("react");
|
|
8221
|
-
var
|
|
8620
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
8222
8621
|
var useFocusRestore = () => {
|
|
8223
8622
|
const previouslyFocusedRef = (0, import_react36.useRef)(null);
|
|
8224
8623
|
(0, import_react36.useEffect)(() => {
|
|
@@ -8226,7 +8625,7 @@ var useFocusRestore = () => {
|
|
|
8226
8625
|
}, []);
|
|
8227
8626
|
(0, import_react36.useEffect)(() => {
|
|
8228
8627
|
return () => {
|
|
8229
|
-
if ((0,
|
|
8628
|
+
if ((0, import_type_guards30.isNotNil)(previouslyFocusedRef.current)) {
|
|
8230
8629
|
setTimeout(() => {
|
|
8231
8630
|
previouslyFocusedRef.current?.focus();
|
|
8232
8631
|
}, 0);
|
|
@@ -8262,7 +8661,8 @@ var StyledModalContent = (0, import_styled_components50.default)(import_react_di
|
|
|
8262
8661
|
max-width: 90vw;
|
|
8263
8662
|
top: 50%;
|
|
8264
8663
|
transform: translate(-50%, -50%);
|
|
8265
|
-
min-width: ${({ $width }) => $width ??
|
|
8664
|
+
min-width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
|
|
8665
|
+
width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
|
|
8266
8666
|
}
|
|
8267
8667
|
|
|
8268
8668
|
@keyframes contentShow {
|
|
@@ -8349,6 +8749,7 @@ Backdrop.displayName = "Backdrop";
|
|
|
8349
8749
|
|
|
8350
8750
|
// src/components/Modal/Modal.tsx
|
|
8351
8751
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
8752
|
+
var DEFAULT_MODAL_WIDTH = "532px";
|
|
8352
8753
|
var ModalBody = import_styled_components52.default.div`
|
|
8353
8754
|
flex-direction: column;
|
|
8354
8755
|
display: flex;
|
|
@@ -8364,14 +8765,14 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8364
8765
|
isOpen,
|
|
8365
8766
|
onRequestClose,
|
|
8366
8767
|
title,
|
|
8367
|
-
width,
|
|
8768
|
+
width = DEFAULT_MODAL_WIDTH,
|
|
8368
8769
|
...props
|
|
8369
8770
|
}, ref) => {
|
|
8370
8771
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
8371
8772
|
import_react_dialog4.Root,
|
|
8372
8773
|
{
|
|
8373
8774
|
onOpenChange: (open2) => {
|
|
8374
|
-
if (!open2 && (0,
|
|
8775
|
+
if (!open2 && (0, import_type_guards31.isNotNil)(onRequestClose)) {
|
|
8375
8776
|
onRequestClose();
|
|
8376
8777
|
}
|
|
8377
8778
|
},
|
|
@@ -8384,7 +8785,7 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8384
8785
|
ref,
|
|
8385
8786
|
fullHeight,
|
|
8386
8787
|
onOpenAutoFocus: (event) => {
|
|
8387
|
-
if ((0,
|
|
8788
|
+
if ((0, import_type_guards31.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
8388
8789
|
event.preventDefault();
|
|
8389
8790
|
requestAnimationFrame(() => {
|
|
8390
8791
|
initialFocusRef.current?.focus();
|
|
@@ -8416,7 +8817,7 @@ Modal.displayName = "Modal";
|
|
|
8416
8817
|
// src/components/Radio/Radio.tsx
|
|
8417
8818
|
var import_react40 = require("react");
|
|
8418
8819
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
8419
|
-
var
|
|
8820
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
8420
8821
|
var import_jsx_runtime202 = require("react/jsx-runtime");
|
|
8421
8822
|
var StyledLabelWrapper2 = import_styled_components53.default.div`
|
|
8422
8823
|
display: flex;
|
|
@@ -8502,7 +8903,7 @@ var Radio = (0, import_react40.forwardRef)(
|
|
|
8502
8903
|
...otherProps
|
|
8503
8904
|
}, ref) => {
|
|
8504
8905
|
const generatedId = (0, import_react40.useId)();
|
|
8505
|
-
const computedId = (0,
|
|
8906
|
+
const computedId = (0, import_type_guards32.isNonEmptyString)(id) ? id : `ui-radio-${generatedId}`;
|
|
8506
8907
|
return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(
|
|
8507
8908
|
StyledRadioWrapper,
|
|
8508
8909
|
{
|
|
@@ -8547,7 +8948,7 @@ Radio.displayName = "Radio";
|
|
|
8547
8948
|
var import_react41 = require("react");
|
|
8548
8949
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
8549
8950
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
8550
|
-
var
|
|
8951
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
8551
8952
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
8552
8953
|
var StyledSegmentedControl = (0, import_styled_components54.default)(import_react_toggle_group.Root)`
|
|
8553
8954
|
display: inline-flex;
|
|
@@ -8566,7 +8967,7 @@ var SegmentedControl = (0, import_react41.forwardRef)(
|
|
|
8566
8967
|
onSelectedValueChange,
|
|
8567
8968
|
...props
|
|
8568
8969
|
}, ref) => {
|
|
8569
|
-
if ((0,
|
|
8970
|
+
if ((0, import_type_guards33.isNil)(children)) {
|
|
8570
8971
|
return null;
|
|
8571
8972
|
}
|
|
8572
8973
|
return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
@@ -8592,7 +8993,7 @@ SegmentedControl.displayName = "SegmentedControl";
|
|
|
8592
8993
|
var import_react42 = require("react");
|
|
8593
8994
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
8594
8995
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
8595
|
-
var
|
|
8996
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
8596
8997
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8597
8998
|
var StyledSegmentedControlItem = (0, import_styled_components55.default)(import_react_toggle_group2.Item)`
|
|
8598
8999
|
all: unset; /* ToggleGroupItem is a button element */
|
|
@@ -8659,8 +9060,8 @@ var SegmentedControlItem = (0, import_react42.forwardRef)(
|
|
|
8659
9060
|
StyledSegmentedControlItem,
|
|
8660
9061
|
{
|
|
8661
9062
|
ref,
|
|
8662
|
-
$hasLabel: (0,
|
|
8663
|
-
"aria-label": (0,
|
|
9063
|
+
$hasLabel: (0, import_type_guards34.isNotNil)(label),
|
|
9064
|
+
"aria-label": (0, import_type_guards34.isNotNil)(label) ? void 0 : ariaLabel,
|
|
8664
9065
|
disabled,
|
|
8665
9066
|
onClick: handleClick,
|
|
8666
9067
|
value,
|
|
@@ -8677,7 +9078,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
8677
9078
|
// src/components/Tag/Tag.tsx
|
|
8678
9079
|
var import_react43 = require("react");
|
|
8679
9080
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
8680
|
-
var
|
|
9081
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
8681
9082
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
8682
9083
|
var TagLabel = import_styled_components56.default.a`
|
|
8683
9084
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -8755,10 +9156,10 @@ var StyledTag = import_styled_components56.default.div`
|
|
|
8755
9156
|
}
|
|
8756
9157
|
`;
|
|
8757
9158
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
8758
|
-
if ((0,
|
|
9159
|
+
if ((0, import_type_guards35.isNil)(onClickRemove)) {
|
|
8759
9160
|
return null;
|
|
8760
9161
|
}
|
|
8761
|
-
if ((0,
|
|
9162
|
+
if ((0, import_type_guards35.isNil)(onClickRemoveLabel)) {
|
|
8762
9163
|
throw new Error(
|
|
8763
9164
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
8764
9165
|
);
|
|
@@ -8787,7 +9188,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
8787
9188
|
};
|
|
8788
9189
|
var Tag = (0, import_react43.forwardRef)(
|
|
8789
9190
|
({ onClickRemove, colorScheme = "inherit", href, label, onClickRemoveLabel, ...otherProps }, ref) => {
|
|
8790
|
-
const labelProps = (0,
|
|
9191
|
+
const labelProps = (0, import_type_guards35.isNotNil)(href) && (0, import_type_guards35.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
8791
9192
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
|
|
8792
9193
|
StyledTag,
|
|
8793
9194
|
{
|
|
@@ -8925,7 +9326,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
8925
9326
|
|
|
8926
9327
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
8927
9328
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
8928
|
-
var
|
|
9329
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
8929
9330
|
var import_jsx_runtime207 = require("react/jsx-runtime");
|
|
8930
9331
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
8931
9332
|
if (iconOnly) {
|
|
@@ -9019,7 +9420,7 @@ var WistiaLogo = ({
|
|
|
9019
9420
|
...otherProps,
|
|
9020
9421
|
children: [
|
|
9021
9422
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("title", { children: title }),
|
|
9022
|
-
(0,
|
|
9423
|
+
(0, import_type_guards36.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("desc", { children: description }) : null,
|
|
9023
9424
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
9024
9425
|
renderLogotype(logotypeColor, iconOnly)
|
|
9025
9426
|
]
|
|
@@ -9215,7 +9616,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
9215
9616
|
|
|
9216
9617
|
// src/components/DataCards/DataCard.tsx
|
|
9217
9618
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
9218
|
-
var
|
|
9619
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
9219
9620
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
9220
9621
|
var StyledDataCard = import_styled_components62.default.div`
|
|
9221
9622
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -9304,8 +9705,8 @@ var DataCard = ({
|
|
|
9304
9705
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledLoadingValue, {}) : value
|
|
9305
9706
|
}
|
|
9306
9707
|
),
|
|
9307
|
-
(0,
|
|
9308
|
-
(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 })
|
|
9309
9710
|
]
|
|
9310
9711
|
}
|
|
9311
9712
|
);
|
|
@@ -9437,6 +9838,7 @@ var DataCardTrend = ({
|
|
|
9437
9838
|
WistiaLogo,
|
|
9438
9839
|
colorSchemeOptions,
|
|
9439
9840
|
copyToClipboard,
|
|
9841
|
+
dateTime,
|
|
9440
9842
|
ellipsisFlexParentStyle,
|
|
9441
9843
|
ellipsisStyle,
|
|
9442
9844
|
iconSizeMap,
|