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