@wistia/ui 0.5.1 → 0.5.2-beta.140d6460.3762ec2
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 +498 -106
- 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 +419 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
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.2-beta.140d6460.3762ec2
|
|
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
|
|
|
@@ -1690,9 +2081,9 @@ var import_react6 = require("react");
|
|
|
1690
2081
|
var import_react5 = require("react");
|
|
1691
2082
|
|
|
1692
2083
|
// src/private/helpers/isObjectRef/isObjectRef.ts
|
|
1693
|
-
var
|
|
2084
|
+
var import_type_guards6 = require("@wistia/type-guards");
|
|
1694
2085
|
var isObjectRef = (value) => {
|
|
1695
|
-
return (0,
|
|
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
|
|
@@ -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,7 @@ 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_guards24 = require("@wistia/type-guards");
|
|
7430
7821
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
7431
7822
|
var inputStyles = import_styled_components41.css`
|
|
7432
7823
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -7514,7 +7905,7 @@ var StyledInputContainer = import_styled_components41.default.div`
|
|
|
7514
7905
|
}
|
|
7515
7906
|
`;
|
|
7516
7907
|
var isValidRef = (ref) => {
|
|
7517
|
-
return typeof ref === "object" && ref !== null && "current" in ref && (0,
|
|
7908
|
+
return typeof ref === "object" && ref !== null && "current" in ref && (0, import_type_guards24.isNotNil)(ref.current);
|
|
7518
7909
|
};
|
|
7519
7910
|
var Input = (0, import_react30.forwardRef)(
|
|
7520
7911
|
({
|
|
@@ -7529,24 +7920,24 @@ var Input = (0, import_react30.forwardRef)(
|
|
|
7529
7920
|
const internalRef = (0, import_react30.useRef)();
|
|
7530
7921
|
const ref = isValidRef(externalRef) ? externalRef : internalRef;
|
|
7531
7922
|
let leftIconToDisplay = leftIcon;
|
|
7532
|
-
if ((0,
|
|
7923
|
+
if ((0, import_type_guards24.isNil)(leftIcon) && type === "search") {
|
|
7533
7924
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Icon, { type: "search" });
|
|
7534
7925
|
}
|
|
7535
|
-
if ((0,
|
|
7926
|
+
if ((0, import_type_guards24.isNotNil)(leftIconToDisplay)) {
|
|
7536
7927
|
leftIconToDisplay = (0, import_react30.cloneElement)(leftIconToDisplay, {
|
|
7537
7928
|
size: "md",
|
|
7538
7929
|
className: "wui-input-left-icon"
|
|
7539
7930
|
});
|
|
7540
7931
|
}
|
|
7541
7932
|
let rightIconToDisplay = rightIcon;
|
|
7542
|
-
if ((0,
|
|
7933
|
+
if ((0, import_type_guards24.isNotNil)(rightIconToDisplay)) {
|
|
7543
7934
|
rightIconToDisplay = (0, import_react30.cloneElement)(rightIconToDisplay, {
|
|
7544
7935
|
size: "md",
|
|
7545
7936
|
className: "wui-input-right-icon"
|
|
7546
7937
|
});
|
|
7547
7938
|
}
|
|
7548
7939
|
const handleFocus = (event) => {
|
|
7549
|
-
if ((0,
|
|
7940
|
+
if ((0, import_type_guards24.isNotNil)(props.onFocus)) {
|
|
7550
7941
|
props.onFocus(event);
|
|
7551
7942
|
}
|
|
7552
7943
|
if (autoSelect && ref && "current" in ref) {
|
|
@@ -7589,7 +7980,7 @@ Input.displayName = "Input";
|
|
|
7589
7980
|
// src/components/Menu/Menu.tsx
|
|
7590
7981
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
7591
7982
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
7592
|
-
var
|
|
7983
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
7593
7984
|
var import_react32 = require("react");
|
|
7594
7985
|
|
|
7595
7986
|
// src/components/Menu/MenuContext.tsx
|
|
@@ -7701,7 +8092,7 @@ var Menu = ({
|
|
|
7701
8092
|
}) => {
|
|
7702
8093
|
const contextValue = (0, import_react32.useMemo)(() => ({ compact }), [compact]);
|
|
7703
8094
|
let controlProps = {
|
|
7704
|
-
...(0,
|
|
8095
|
+
...(0, import_type_guards25.isNotNil)(onOpenChange) && (0, import_type_guards25.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
7705
8096
|
};
|
|
7706
8097
|
if (disabled) {
|
|
7707
8098
|
controlProps = {
|
|
@@ -7715,7 +8106,7 @@ var Menu = ({
|
|
|
7715
8106
|
modal: false,
|
|
7716
8107
|
...controlProps,
|
|
7717
8108
|
children: [
|
|
7718
|
-
/* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
8109
|
+
/* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards25.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
|
|
7719
8110
|
Button,
|
|
7720
8111
|
{
|
|
7721
8112
|
"aria-expanded": isOpen,
|
|
@@ -7776,12 +8167,12 @@ MenuLabel.displayName = "MenuLabel";
|
|
|
7776
8167
|
var import_react34 = require("react");
|
|
7777
8168
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
7778
8169
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
7779
|
-
var
|
|
8170
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
7780
8171
|
|
|
7781
8172
|
// src/components/Menu/MenuItemButton.tsx
|
|
7782
8173
|
var import_react33 = require("react");
|
|
7783
8174
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
7784
|
-
var
|
|
8175
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
7785
8176
|
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
7786
8177
|
var StyledButton3 = (0, import_styled_components44.default)(Button)`
|
|
7787
8178
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -7855,7 +8246,7 @@ var StyledBadgeContainer = import_styled_components44.default.div`
|
|
|
7855
8246
|
var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
7856
8247
|
let { colorScheme, badge } = props;
|
|
7857
8248
|
if (appearance === "dangerous") {
|
|
7858
|
-
if ((0,
|
|
8249
|
+
if ((0, import_type_guards26.isNotUndefined)(colorScheme)) {
|
|
7859
8250
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
7860
8251
|
}
|
|
7861
8252
|
colorScheme = "error";
|
|
@@ -7885,7 +8276,7 @@ var MenuItemButton = (0, import_react33.forwardRef)(({ children, appearance, com
|
|
|
7885
8276
|
children: [
|
|
7886
8277
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
7887
8278
|
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
7888
|
-
(0,
|
|
8279
|
+
(0, import_type_guards26.isNotNil)(badge) || (0, import_type_guards26.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
7889
8280
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
7890
8281
|
]
|
|
7891
8282
|
}
|
|
@@ -7952,7 +8343,7 @@ var SubMenu = ({
|
|
|
7952
8343
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
7953
8344
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
7954
8345
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemLabel, { children: label }),
|
|
7955
|
-
(0,
|
|
8346
|
+
(0, import_type_guards27.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(MenuItemDescription, { children: description }) : null
|
|
7956
8347
|
] }),
|
|
7957
8348
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
7958
8349
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -8132,7 +8523,7 @@ CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
|
8132
8523
|
var import_react39 = require("react");
|
|
8133
8524
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
8134
8525
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
8135
|
-
var
|
|
8526
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
8136
8527
|
|
|
8137
8528
|
// src/components/Modal/ModalHeader.tsx
|
|
8138
8529
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
@@ -8159,7 +8550,7 @@ var ModalCloseButton = () => {
|
|
|
8159
8550
|
|
|
8160
8551
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
8161
8552
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
8162
|
-
var
|
|
8553
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
8163
8554
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
8164
8555
|
var VisuallyHidden = import_styled_components48.default.div({ ...visuallyHiddenStyle });
|
|
8165
8556
|
var VisuallyHiddenButFocusable = import_styled_components48.default.div({
|
|
@@ -8171,7 +8562,7 @@ var ScreenReaderOnly = ({
|
|
|
8171
8562
|
focusable = false,
|
|
8172
8563
|
...otherProps
|
|
8173
8564
|
}) => {
|
|
8174
|
-
const accessibleText = (0,
|
|
8565
|
+
const accessibleText = (0, import_type_guards28.isNotNil)(text) ? text : children;
|
|
8175
8566
|
if (focusable) {
|
|
8176
8567
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
8177
8568
|
}
|
|
@@ -8218,7 +8609,7 @@ var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
|
8218
8609
|
|
|
8219
8610
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
8220
8611
|
var import_react36 = require("react");
|
|
8221
|
-
var
|
|
8612
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
8222
8613
|
var useFocusRestore = () => {
|
|
8223
8614
|
const previouslyFocusedRef = (0, import_react36.useRef)(null);
|
|
8224
8615
|
(0, import_react36.useEffect)(() => {
|
|
@@ -8226,7 +8617,7 @@ var useFocusRestore = () => {
|
|
|
8226
8617
|
}, []);
|
|
8227
8618
|
(0, import_react36.useEffect)(() => {
|
|
8228
8619
|
return () => {
|
|
8229
|
-
if ((0,
|
|
8620
|
+
if ((0, import_type_guards29.isNotNil)(previouslyFocusedRef.current)) {
|
|
8230
8621
|
setTimeout(() => {
|
|
8231
8622
|
previouslyFocusedRef.current?.focus();
|
|
8232
8623
|
}, 0);
|
|
@@ -8373,7 +8764,7 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8373
8764
|
import_react_dialog4.Root,
|
|
8374
8765
|
{
|
|
8375
8766
|
onOpenChange: (open2) => {
|
|
8376
|
-
if (!open2 && (0,
|
|
8767
|
+
if (!open2 && (0, import_type_guards30.isNotNil)(onRequestClose)) {
|
|
8377
8768
|
onRequestClose();
|
|
8378
8769
|
}
|
|
8379
8770
|
},
|
|
@@ -8386,7 +8777,7 @@ var Modal = (0, import_react39.forwardRef)(
|
|
|
8386
8777
|
ref,
|
|
8387
8778
|
fullHeight,
|
|
8388
8779
|
onOpenAutoFocus: (event) => {
|
|
8389
|
-
if ((0,
|
|
8780
|
+
if ((0, import_type_guards30.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
8390
8781
|
event.preventDefault();
|
|
8391
8782
|
requestAnimationFrame(() => {
|
|
8392
8783
|
initialFocusRef.current?.focus();
|
|
@@ -8418,7 +8809,7 @@ Modal.displayName = "Modal";
|
|
|
8418
8809
|
// src/components/Radio/Radio.tsx
|
|
8419
8810
|
var import_react40 = require("react");
|
|
8420
8811
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
8421
|
-
var
|
|
8812
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
8422
8813
|
var import_jsx_runtime202 = require("react/jsx-runtime");
|
|
8423
8814
|
var StyledLabelWrapper2 = import_styled_components53.default.div`
|
|
8424
8815
|
display: flex;
|
|
@@ -8504,7 +8895,7 @@ var Radio = (0, import_react40.forwardRef)(
|
|
|
8504
8895
|
...otherProps
|
|
8505
8896
|
}, ref) => {
|
|
8506
8897
|
const generatedId = (0, import_react40.useId)();
|
|
8507
|
-
const computedId = (0,
|
|
8898
|
+
const computedId = (0, import_type_guards31.isNonEmptyString)(id) ? id : `ui-radio-${generatedId}`;
|
|
8508
8899
|
return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(
|
|
8509
8900
|
StyledRadioWrapper,
|
|
8510
8901
|
{
|
|
@@ -8549,7 +8940,7 @@ Radio.displayName = "Radio";
|
|
|
8549
8940
|
var import_react41 = require("react");
|
|
8550
8941
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
8551
8942
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
8552
|
-
var
|
|
8943
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
8553
8944
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
8554
8945
|
var StyledSegmentedControl = (0, import_styled_components54.default)(import_react_toggle_group.Root)`
|
|
8555
8946
|
display: inline-flex;
|
|
@@ -8568,7 +8959,7 @@ var SegmentedControl = (0, import_react41.forwardRef)(
|
|
|
8568
8959
|
onSelectedValueChange,
|
|
8569
8960
|
...props
|
|
8570
8961
|
}, ref) => {
|
|
8571
|
-
if ((0,
|
|
8962
|
+
if ((0, import_type_guards32.isNil)(children)) {
|
|
8572
8963
|
return null;
|
|
8573
8964
|
}
|
|
8574
8965
|
return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
@@ -8594,7 +8985,7 @@ SegmentedControl.displayName = "SegmentedControl";
|
|
|
8594
8985
|
var import_react42 = require("react");
|
|
8595
8986
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
8596
8987
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
8597
|
-
var
|
|
8988
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
8598
8989
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8599
8990
|
var StyledSegmentedControlItem = (0, import_styled_components55.default)(import_react_toggle_group2.Item)`
|
|
8600
8991
|
all: unset; /* ToggleGroupItem is a button element */
|
|
@@ -8661,8 +9052,8 @@ var SegmentedControlItem = (0, import_react42.forwardRef)(
|
|
|
8661
9052
|
StyledSegmentedControlItem,
|
|
8662
9053
|
{
|
|
8663
9054
|
ref,
|
|
8664
|
-
$hasLabel: (0,
|
|
8665
|
-
"aria-label": (0,
|
|
9055
|
+
$hasLabel: (0, import_type_guards33.isNotNil)(label),
|
|
9056
|
+
"aria-label": (0, import_type_guards33.isNotNil)(label) ? void 0 : ariaLabel,
|
|
8666
9057
|
disabled,
|
|
8667
9058
|
onClick: handleClick,
|
|
8668
9059
|
value,
|
|
@@ -8679,7 +9070,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
8679
9070
|
// src/components/Tag/Tag.tsx
|
|
8680
9071
|
var import_react43 = require("react");
|
|
8681
9072
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
8682
|
-
var
|
|
9073
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
8683
9074
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
8684
9075
|
var TagLabel = import_styled_components56.default.a`
|
|
8685
9076
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -8757,10 +9148,10 @@ var StyledTag = import_styled_components56.default.div`
|
|
|
8757
9148
|
}
|
|
8758
9149
|
`;
|
|
8759
9150
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
8760
|
-
if ((0,
|
|
9151
|
+
if ((0, import_type_guards34.isNil)(onClickRemove)) {
|
|
8761
9152
|
return null;
|
|
8762
9153
|
}
|
|
8763
|
-
if ((0,
|
|
9154
|
+
if ((0, import_type_guards34.isNil)(onClickRemoveLabel)) {
|
|
8764
9155
|
throw new Error(
|
|
8765
9156
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
8766
9157
|
);
|
|
@@ -8789,7 +9180,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
8789
9180
|
};
|
|
8790
9181
|
var Tag = (0, import_react43.forwardRef)(
|
|
8791
9182
|
({ onClickRemove, colorScheme = "inherit", href, label, onClickRemoveLabel, ...otherProps }, ref) => {
|
|
8792
|
-
const labelProps = (0,
|
|
9183
|
+
const labelProps = (0, import_type_guards34.isNotNil)(href) && (0, import_type_guards34.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
8793
9184
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
|
|
8794
9185
|
StyledTag,
|
|
8795
9186
|
{
|
|
@@ -8927,7 +9318,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
8927
9318
|
|
|
8928
9319
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
8929
9320
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
8930
|
-
var
|
|
9321
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
8931
9322
|
var import_jsx_runtime207 = require("react/jsx-runtime");
|
|
8932
9323
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
8933
9324
|
if (iconOnly) {
|
|
@@ -9021,7 +9412,7 @@ var WistiaLogo = ({
|
|
|
9021
9412
|
...otherProps,
|
|
9022
9413
|
children: [
|
|
9023
9414
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("title", { children: title }),
|
|
9024
|
-
(0,
|
|
9415
|
+
(0, import_type_guards35.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("desc", { children: description }) : null,
|
|
9025
9416
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
9026
9417
|
renderLogotype(logotypeColor, iconOnly)
|
|
9027
9418
|
]
|
|
@@ -9217,7 +9608,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
9217
9608
|
|
|
9218
9609
|
// src/components/DataCards/DataCard.tsx
|
|
9219
9610
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
9220
|
-
var
|
|
9611
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
9221
9612
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
9222
9613
|
var StyledDataCard = import_styled_components62.default.div`
|
|
9223
9614
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -9306,8 +9697,8 @@ var DataCard = ({
|
|
|
9306
9697
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledLoadingValue, {}) : value
|
|
9307
9698
|
}
|
|
9308
9699
|
),
|
|
9309
|
-
(0,
|
|
9310
|
-
(0,
|
|
9700
|
+
(0, import_type_guards36.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
9701
|
+
(0, import_type_guards36.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
9311
9702
|
]
|
|
9312
9703
|
}
|
|
9313
9704
|
);
|
|
@@ -9439,6 +9830,7 @@ var DataCardTrend = ({
|
|
|
9439
9830
|
WistiaLogo,
|
|
9440
9831
|
colorSchemeOptions,
|
|
9441
9832
|
copyToClipboard,
|
|
9833
|
+
dateTime,
|
|
9442
9834
|
ellipsisFlexParentStyle,
|
|
9443
9835
|
ellipsisStyle,
|
|
9444
9836
|
iconSizeMap,
|