@wistia/ui 3.2.1 → 3.4.0-beta.c11d84ab.4d9268a
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.d.ts +65 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +252 -117
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2576
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v3.
|
|
3
|
+
* @license @wistia/ui v3.4.0-beta.c11d84ab.4d9268a
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
11
|
-
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
11
|
+
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
12
12
|
import { createGlobalStyle, css, keyframes, styled } from "styled-components";
|
|
13
13
|
import { isArray, isBoolean, isDate, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isRecord, isString, isUndefined, noOpFn } from "@wistia/type-guards";
|
|
14
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1224,13 +1224,24 @@ const mergeRefs = (refs) => (value) => {
|
|
|
1224
1224
|
};
|
|
1225
1225
|
//#endregion
|
|
1226
1226
|
//#region src/css/breakpoints.ts
|
|
1227
|
-
const
|
|
1227
|
+
const breakpointsEm = {
|
|
1228
1228
|
xs: "0em",
|
|
1229
1229
|
sm: "37.5em",
|
|
1230
1230
|
md: "56.5625em",
|
|
1231
1231
|
lg: "77.5em",
|
|
1232
1232
|
xl: "90em"
|
|
1233
1233
|
};
|
|
1234
|
+
/**
|
|
1235
|
+
* The minimum viewport width, in px, of each breakpoint (at the default 16px font size).
|
|
1236
|
+
* A breakpoint's range runs from its own value up to, but not including, the next one.
|
|
1237
|
+
*/
|
|
1238
|
+
const breakpoints = {
|
|
1239
|
+
xs: 0,
|
|
1240
|
+
sm: 600,
|
|
1241
|
+
md: 905,
|
|
1242
|
+
lg: 1240,
|
|
1243
|
+
xl: 1440
|
|
1244
|
+
};
|
|
1234
1245
|
//#endregion
|
|
1235
1246
|
//#region src/helpers/mq/mq.ts
|
|
1236
1247
|
const getMaxWidth = (breakpoint) => {
|
|
@@ -1238,15 +1249,15 @@ const getMaxWidth = (breakpoint) => {
|
|
|
1238
1249
|
const [value, unit] = getValueAndUnit(breakpoint);
|
|
1239
1250
|
return `@media (max-width: ${Math.max(value - breakpointBuffer, 0)}${unit})`;
|
|
1240
1251
|
};
|
|
1241
|
-
const xsAndUp = () => `@media (min-width: ${
|
|
1242
|
-
const smAndUp = () => `@media (min-width: ${
|
|
1243
|
-
const mdAndUp = () => `@media (min-width: ${
|
|
1244
|
-
const lgAndUp = () => `@media (min-width: ${
|
|
1245
|
-
const xlAndUp = () => `@media (min-width: ${
|
|
1246
|
-
const xsAndDown = () => getMaxWidth(
|
|
1247
|
-
const smAndDown = () => getMaxWidth(
|
|
1248
|
-
const mdAndDown = () => getMaxWidth(
|
|
1249
|
-
const lgAndDown = () => getMaxWidth(
|
|
1252
|
+
const xsAndUp = () => `@media (min-width: ${breakpointsEm.xs})`;
|
|
1253
|
+
const smAndUp = () => `@media (min-width: ${breakpointsEm.sm})`;
|
|
1254
|
+
const mdAndUp = () => `@media (min-width: ${breakpointsEm.md})`;
|
|
1255
|
+
const lgAndUp = () => `@media (min-width: ${breakpointsEm.lg})`;
|
|
1256
|
+
const xlAndUp = () => `@media (min-width: ${breakpointsEm.xl})`;
|
|
1257
|
+
const xsAndDown = () => getMaxWidth(breakpointsEm.sm);
|
|
1258
|
+
const smAndDown = () => getMaxWidth(breakpointsEm.md);
|
|
1259
|
+
const mdAndDown = () => getMaxWidth(breakpointsEm.lg);
|
|
1260
|
+
const lgAndDown = () => getMaxWidth(breakpointsEm.xl);
|
|
1250
1261
|
const xlAndDown = () => "@media all";
|
|
1251
1262
|
const mq = {
|
|
1252
1263
|
xsAndUp,
|
|
@@ -1546,21 +1557,34 @@ const scopeTab = (node, event) => {
|
|
|
1546
1557
|
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
1547
1558
|
if (target) target.focus();
|
|
1548
1559
|
};
|
|
1560
|
+
const ariaHiderState = /* @__PURE__ */ new WeakMap();
|
|
1549
1561
|
const createAriaHider = (containerNode, selector = "body > :not(script)") => {
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1562
|
+
const hiddenNodes = [...document.querySelectorAll(selector)].filter((node) => !node.contains(containerNode));
|
|
1563
|
+
hiddenNodes.forEach((node) => {
|
|
1564
|
+
const state = ariaHiderState.get(node);
|
|
1565
|
+
if (state) {
|
|
1566
|
+
state.count += 1;
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
const originalAriaHidden = node.getAttribute("aria-hidden");
|
|
1570
|
+
ariaHiderState.set(node, {
|
|
1571
|
+
count: 1,
|
|
1572
|
+
originalAriaHidden
|
|
1573
|
+
});
|
|
1574
|
+
if (originalAriaHidden === null || originalAriaHidden === "false") node.setAttribute("aria-hidden", "true");
|
|
1558
1575
|
});
|
|
1576
|
+
let isRestored = false;
|
|
1559
1577
|
return () => {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1578
|
+
if (isRestored) return;
|
|
1579
|
+
isRestored = true;
|
|
1580
|
+
hiddenNodes.forEach((node) => {
|
|
1581
|
+
const state = ariaHiderState.get(node);
|
|
1582
|
+
if (!state) return;
|
|
1583
|
+
state.count -= 1;
|
|
1584
|
+
if (state.count > 0) return;
|
|
1585
|
+
ariaHiderState.delete(node);
|
|
1586
|
+
if (state.originalAriaHidden === null) node.removeAttribute("aria-hidden");
|
|
1587
|
+
else node.setAttribute("aria-hidden", state.originalAriaHidden);
|
|
1564
1588
|
});
|
|
1565
1589
|
};
|
|
1566
1590
|
};
|
|
@@ -1570,47 +1594,53 @@ const isRef = (val) => {
|
|
|
1570
1594
|
return val !== null && typeof val === "object" && "current" in val;
|
|
1571
1595
|
};
|
|
1572
1596
|
const useFocusTrap = (active = true, options = {}) => {
|
|
1573
|
-
const
|
|
1574
|
-
const
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1577
|
-
|
|
1597
|
+
const { disableAriaHider = false, focusSelector } = options;
|
|
1598
|
+
const [node, setNode] = useState(null);
|
|
1599
|
+
const nodeRef = useRef(null);
|
|
1600
|
+
const setRef = useCallback((nextNode) => {
|
|
1601
|
+
nodeRef.current = nextNode ?? null;
|
|
1602
|
+
setNode(nextNode ?? null);
|
|
1603
|
+
}, []);
|
|
1604
|
+
useLayoutEffect(() => {
|
|
1605
|
+
if (!active || node === null) return;
|
|
1606
|
+
setupScopedFocus(node);
|
|
1607
|
+
markForFocusLater();
|
|
1608
|
+
let restoreAria = null;
|
|
1609
|
+
const processNode = () => {
|
|
1610
|
+
restoreAria = disableAriaHider ? null : createAriaHider(node);
|
|
1611
|
+
let focusElement = null;
|
|
1612
|
+
if (isNotUndefined(focusSelector)) {
|
|
1613
|
+
if (isRef(focusSelector)) focusElement = focusSelector.current;
|
|
1614
|
+
else focusElement = typeof focusSelector === "string" ? node.querySelector(focusSelector) : focusSelector;
|
|
1615
|
+
}
|
|
1616
|
+
if (!focusElement) {
|
|
1617
|
+
const children = [...node.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)];
|
|
1618
|
+
focusElement = children.find((element) => isTabbableElement(element)) ?? children.find((element) => isFocusableElement(element)) ?? null;
|
|
1619
|
+
if (!focusElement && isFocusableElement(node)) focusElement = node;
|
|
1620
|
+
}
|
|
1621
|
+
if (focusElement) focusElement.focus();
|
|
1622
|
+
if (!focusElement) console.warn("[useFocusTrap]: Failed to find a focusable element after activating the focus trap. Make sure to include at an element that can recieve focus. As a fallback, you can also set \"tabIndex={-1}\" on the focus trap node.", node);
|
|
1623
|
+
};
|
|
1624
|
+
const timeoutId = setTimeout(() => {
|
|
1625
|
+
if (node.ownerDocument) processNode();
|
|
1626
|
+
if (!node.ownerDocument) console.warn("[useFocusTrap]: The focus trap is not part of the DOM yet, so it is unable to correctly set focus. Make sure to render the ref node.", node);
|
|
1627
|
+
}, 0);
|
|
1628
|
+
return () => {
|
|
1629
|
+
clearTimeout(timeoutId);
|
|
1630
|
+
restoreAria?.();
|
|
1578
1631
|
returnFocus();
|
|
1579
1632
|
teardownScopedFocus();
|
|
1580
|
-
}
|
|
1581
|
-
if (active && node !== null && node !== void 0) {
|
|
1582
|
-
setupScopedFocus(node);
|
|
1583
|
-
markForFocusLater();
|
|
1584
|
-
const processNode = (node2) => {
|
|
1585
|
-
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
1586
|
-
let focusElement = null;
|
|
1587
|
-
if (isNotUndefined(options.focusSelector)) {
|
|
1588
|
-
if (isRef(options.focusSelector)) focusElement = options.focusSelector.current;
|
|
1589
|
-
else focusElement = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
1590
|
-
}
|
|
1591
|
-
if (!focusElement) {
|
|
1592
|
-
const children = [...node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)];
|
|
1593
|
-
focusElement = children.find((element) => isTabbableElement(element)) ?? children.find((element) => isFocusableElement(element)) ?? null;
|
|
1594
|
-
if (!focusElement && isFocusableElement(node2)) focusElement = node2;
|
|
1595
|
-
}
|
|
1596
|
-
if (focusElement) focusElement.focus();
|
|
1597
|
-
if (!focusElement) console.warn("[useFocusTrap]: Failed to find a focusable element after activating the focus trap. Make sure to include at an element that can recieve focus. As a fallback, you can also set \"tabIndex={-1}\" on the focus trap node.", node2);
|
|
1598
|
-
};
|
|
1599
|
-
setTimeout(() => {
|
|
1600
|
-
if (node.ownerDocument) processNode(node);
|
|
1601
|
-
if (!node.ownerDocument) console.warn("[useFocusTrap]: The focus trap is not part of the DOM yet, so it is unable to correctly set focus. Make sure to render the ref node.", node);
|
|
1602
|
-
}, 0);
|
|
1603
|
-
ref.current = node;
|
|
1604
|
-
} else ref.current = null;
|
|
1633
|
+
};
|
|
1605
1634
|
}, [
|
|
1606
1635
|
active,
|
|
1607
|
-
|
|
1608
|
-
|
|
1636
|
+
node,
|
|
1637
|
+
focusSelector,
|
|
1638
|
+
disableAriaHider
|
|
1609
1639
|
]);
|
|
1610
1640
|
useEffect(() => {
|
|
1611
1641
|
if (!active) return;
|
|
1612
1642
|
const handleKeyDown = (event) => {
|
|
1613
|
-
if (event.key === "Tab" &&
|
|
1643
|
+
if (event.key === "Tab" && nodeRef.current) scopeTab(nodeRef.current, event);
|
|
1614
1644
|
};
|
|
1615
1645
|
document.addEventListener("keydown", handleKeyDown);
|
|
1616
1646
|
return () => {
|
|
@@ -1785,65 +1815,86 @@ const useLockBodyScroll = (locked) => {
|
|
|
1785
1815
|
}, [locked]);
|
|
1786
1816
|
};
|
|
1787
1817
|
//#endregion
|
|
1788
|
-
//#region src/
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
const
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1818
|
+
//#region src/hooks/useMq/useMq.ts
|
|
1819
|
+
const reachedKeys = [
|
|
1820
|
+
"sm",
|
|
1821
|
+
"md",
|
|
1822
|
+
"lg",
|
|
1823
|
+
"xl"
|
|
1824
|
+
];
|
|
1825
|
+
const toFlags = ([sm, md, lg, xl]) => ({
|
|
1826
|
+
isXlAndUp: xl,
|
|
1827
|
+
isLgAndUp: lg,
|
|
1828
|
+
isMdAndUp: md,
|
|
1829
|
+
isSmAndUp: sm,
|
|
1830
|
+
isXsAndUp: true,
|
|
1831
|
+
isXsAndDown: !sm,
|
|
1832
|
+
isSmAndDown: !md,
|
|
1833
|
+
isMdAndDown: !lg,
|
|
1834
|
+
isLgAndDown: !xl,
|
|
1835
|
+
isXlAndDown: true
|
|
1836
|
+
});
|
|
1837
|
+
const readReached = () => reachedKeys.map((key) => window.innerWidth >= breakpoints[key]);
|
|
1838
|
+
const serverSnapshot = toFlags([
|
|
1839
|
+
false,
|
|
1840
|
+
false,
|
|
1841
|
+
false,
|
|
1842
|
+
false
|
|
1843
|
+
]);
|
|
1844
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
1845
|
+
let snapshotKey = "";
|
|
1846
|
+
let snapshot = serverSnapshot;
|
|
1847
|
+
const refresh = () => {
|
|
1848
|
+
const reached = readReached();
|
|
1849
|
+
const key = reached.join();
|
|
1850
|
+
if (key === snapshotKey) return false;
|
|
1851
|
+
snapshotKey = key;
|
|
1852
|
+
snapshot = toFlags(reached);
|
|
1853
|
+
return true;
|
|
1854
|
+
};
|
|
1855
|
+
const notifyIfChanged = () => {
|
|
1856
|
+
if (refresh()) subscribers.forEach((subscriber) => {
|
|
1857
|
+
subscriber();
|
|
1799
1858
|
});
|
|
1800
|
-
useLayoutEffect(() => {
|
|
1801
|
-
const updateDimensions = () => {
|
|
1802
|
-
const { innerWidth: width, innerHeight: height } = window;
|
|
1803
|
-
setDimensions((prev) => prev.width === width && prev.height === height ? prev : {
|
|
1804
|
-
width,
|
|
1805
|
-
height
|
|
1806
|
-
});
|
|
1807
|
-
};
|
|
1808
|
-
const handleResize = debounce(interval, updateDimensions);
|
|
1809
|
-
updateDimensions();
|
|
1810
|
-
window.addEventListener("resize", handleResize);
|
|
1811
|
-
return () => {
|
|
1812
|
-
window.removeEventListener("resize", handleResize);
|
|
1813
|
-
handleResize.cancel();
|
|
1814
|
-
};
|
|
1815
|
-
}, [interval]);
|
|
1816
|
-
return dimensions;
|
|
1817
1859
|
};
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
const isSmAndUp = viewportWidth >= Number.parseFloat(breakpoints.sm);
|
|
1826
|
-
const isMdAndUp = viewportWidth >= Number.parseFloat(breakpoints.md);
|
|
1827
|
-
const isLgAndUp = viewportWidth >= Number.parseFloat(breakpoints.lg);
|
|
1828
|
-
return {
|
|
1829
|
-
isXlAndUp: viewportWidth >= Number.parseFloat(breakpoints.xl),
|
|
1830
|
-
isLgAndUp,
|
|
1831
|
-
isMdAndUp,
|
|
1832
|
-
isSmAndUp,
|
|
1833
|
-
isXsAndUp,
|
|
1834
|
-
isXsAndDown: viewportWidth < Number.parseFloat(breakpoints.sm),
|
|
1835
|
-
isSmAndDown: viewportWidth < Number.parseFloat(breakpoints.md),
|
|
1836
|
-
isMdAndDown: viewportWidth < Number.parseFloat(breakpoints.lg),
|
|
1837
|
-
isLgAndDown: viewportWidth < Number.parseFloat(breakpoints.xl),
|
|
1838
|
-
isXlAndDown: true
|
|
1860
|
+
const subscribe = (subscriber) => {
|
|
1861
|
+
subscribers.add(subscriber);
|
|
1862
|
+
if (subscribers.size === 1) window.addEventListener("resize", notifyIfChanged);
|
|
1863
|
+
notifyIfChanged();
|
|
1864
|
+
return () => {
|
|
1865
|
+
subscribers.delete(subscriber);
|
|
1866
|
+
if (subscribers.size === 0) window.removeEventListener("resize", notifyIfChanged);
|
|
1839
1867
|
};
|
|
1840
1868
|
};
|
|
1869
|
+
const getSnapshot = () => {
|
|
1870
|
+
if (subscribers.size === 0) refresh();
|
|
1871
|
+
return snapshot;
|
|
1872
|
+
};
|
|
1873
|
+
/**
|
|
1874
|
+
* Returns which breakpoints the viewport is in. Components re-render only when a
|
|
1875
|
+
* breakpoint is crossed, and the returned object keeps its identity until then.
|
|
1876
|
+
*/
|
|
1877
|
+
const useMq = () => useSyncExternalStore(subscribe, getSnapshot, () => serverSnapshot);
|
|
1878
|
+
/**
|
|
1879
|
+
* Returns the largest breakpoint the viewport has reached.
|
|
1880
|
+
*/
|
|
1881
|
+
const useBreakpoint = () => {
|
|
1882
|
+
const { isSmAndUp, isMdAndUp, isLgAndUp, isXlAndUp } = useMq();
|
|
1883
|
+
return reachedKeys[[
|
|
1884
|
+
isSmAndUp,
|
|
1885
|
+
isMdAndUp,
|
|
1886
|
+
isLgAndUp,
|
|
1887
|
+
isXlAndUp
|
|
1888
|
+
].lastIndexOf(true)] ?? "xs";
|
|
1889
|
+
};
|
|
1841
1890
|
const useActiveMq = () => {
|
|
1842
|
-
const
|
|
1843
|
-
return
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1891
|
+
const mqState = useMq();
|
|
1892
|
+
return useMemo(() => {
|
|
1893
|
+
return Object.keys(mqState).filter((key) => {
|
|
1894
|
+
const value = mqState[key];
|
|
1895
|
+
return isBoolean(value) && value;
|
|
1896
|
+
});
|
|
1897
|
+
}, [mqState]);
|
|
1847
1898
|
};
|
|
1848
1899
|
//#endregion
|
|
1849
1900
|
//#region src/hooks/useOnClickOutside/useOnClickOutside.ts
|
|
@@ -1887,6 +1938,14 @@ const lineClampCss = ($lines = 1) => css`
|
|
|
1887
1938
|
white-space: initial;
|
|
1888
1939
|
`;
|
|
1889
1940
|
//#endregion
|
|
1941
|
+
//#region src/css/wordBreakCss.tsx
|
|
1942
|
+
const wordBreakCss = (wordBreak = "anywhere") => {
|
|
1943
|
+
if (wordBreak === "word") return css`
|
|
1944
|
+
word-break: normal;
|
|
1945
|
+
overflow-wrap: anywhere;
|
|
1946
|
+
`;
|
|
1947
|
+
};
|
|
1948
|
+
//#endregion
|
|
1890
1949
|
//#region src/components/Ellipsis/Ellipsis.tsx
|
|
1891
1950
|
const ellipsisStyle = css`
|
|
1892
1951
|
overflow: hidden;
|
|
@@ -1918,12 +1977,14 @@ const EllipsisComponent = styled.span`
|
|
|
1918
1977
|
${({ $lines }) => {
|
|
1919
1978
|
if (isNotNil($lines)) return lineClampCss($lines);
|
|
1920
1979
|
}}
|
|
1980
|
+
${({ $wordBreak }) => wordBreakCss($wordBreak)};
|
|
1921
1981
|
`;
|
|
1922
1982
|
/**
|
|
1923
1983
|
* Truncate text with an ellispsis visble at the end
|
|
1924
1984
|
*/
|
|
1925
|
-
const Ellipsis = ({ children, lines, ...props }) => /* @__PURE__ */ jsx(EllipsisComponent, {
|
|
1985
|
+
const Ellipsis = ({ children, lines, wordBreak = "anywhere", ...props }) => /* @__PURE__ */ jsx(EllipsisComponent, {
|
|
1926
1986
|
$lines: lines,
|
|
1987
|
+
$wordBreak: wordBreak,
|
|
1927
1988
|
...props,
|
|
1928
1989
|
children
|
|
1929
1990
|
});
|
|
@@ -2146,6 +2207,37 @@ const useToast = () => {
|
|
|
2146
2207
|
}, [toasterId]);
|
|
2147
2208
|
};
|
|
2148
2209
|
//#endregion
|
|
2210
|
+
//#region src/private/helpers/isClient/isClient.ts
|
|
2211
|
+
/**
|
|
2212
|
+
* @returns {boolean} - whether running in a browser environment
|
|
2213
|
+
*/
|
|
2214
|
+
const isClient = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
2215
|
+
//#endregion
|
|
2216
|
+
//#region src/hooks/useWindowSize/useWindowSize.ts
|
|
2217
|
+
const useWindowSize = (interval = 0) => {
|
|
2218
|
+
const [dimensions, setDimensions] = useState({
|
|
2219
|
+
width: isClient() ? window.innerWidth : 0,
|
|
2220
|
+
height: isClient() ? window.innerHeight : 0
|
|
2221
|
+
});
|
|
2222
|
+
useLayoutEffect(() => {
|
|
2223
|
+
const updateDimensions = () => {
|
|
2224
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
2225
|
+
setDimensions((prev) => prev.width === width && prev.height === height ? prev : {
|
|
2226
|
+
width,
|
|
2227
|
+
height
|
|
2228
|
+
});
|
|
2229
|
+
};
|
|
2230
|
+
const handleResize = debounce(interval, updateDimensions);
|
|
2231
|
+
updateDimensions();
|
|
2232
|
+
window.addEventListener("resize", handleResize);
|
|
2233
|
+
return () => {
|
|
2234
|
+
window.removeEventListener("resize", handleResize);
|
|
2235
|
+
handleResize.cancel();
|
|
2236
|
+
};
|
|
2237
|
+
}, [interval]);
|
|
2238
|
+
return dimensions;
|
|
2239
|
+
};
|
|
2240
|
+
//#endregion
|
|
2149
2241
|
//#region src/private/hooks/useGatedIcon/useGatedIcon.ts
|
|
2150
2242
|
/** The icon marking a gated feature — `sparkle` unless `UIProvider` overrides it. */
|
|
2151
2243
|
const useGatedIcon = () => useContext(GatedIconContext);
|
|
@@ -2811,6 +2903,20 @@ const ChatIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
2811
2903
|
})
|
|
2812
2904
|
});
|
|
2813
2905
|
//#endregion
|
|
2906
|
+
//#region src/components/Icon/icons/ChatSparkleIcon.tsx
|
|
2907
|
+
const ChatSparkleIcon = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
2908
|
+
...props,
|
|
2909
|
+
viewBox: "0 0 24 24",
|
|
2910
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2911
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
2912
|
+
d: "M18.333 2.667A3.667 3.667 0 0 1 22 6.334v3.88a1 1 0 0 1-2 0v-3.88c0-.92-.746-1.667-1.667-1.667H5.667C4.747 4.667 4 5.414 4 6.334v13.25l3.375-2.699A1 1 0 0 1 8 16.667h3a1 1 0 1 1 0 2H8.352l-4.727 3.78A1.001 1.001 0 0 1 2 21.668V6.334a3.667 3.667 0 0 1 3.667-3.667z",
|
|
2913
|
+
fill: "currentColor"
|
|
2914
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2915
|
+
d: "M19 12.669a1 1 0 0 1 .948.681l.843 2.526 2.525.841a1 1 0 0 1 0 1.899l-2.525.842-.843 2.525a1 1 0 0 1-1.896 0l-.843-2.525-2.525-.842a1 1 0 0 1 0-1.899l2.525-.841.843-2.526a1 1 0 0 1 .948-.68",
|
|
2916
|
+
fill: "currentColor"
|
|
2917
|
+
})]
|
|
2918
|
+
});
|
|
2919
|
+
//#endregion
|
|
2814
2920
|
//#region src/components/Icon/icons/CheckmarkCircleIcon.tsx
|
|
2815
2921
|
const CheckmarkCircleIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
2816
2922
|
...props,
|
|
@@ -3190,6 +3296,17 @@ const DiamondIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
3190
3296
|
})
|
|
3191
3297
|
});
|
|
3192
3298
|
//#endregion
|
|
3299
|
+
//#region src/components/Icon/icons/DockRightIcon.tsx
|
|
3300
|
+
const DockRightIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
3301
|
+
...props,
|
|
3302
|
+
viewBox: "0 0 24 24",
|
|
3303
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3304
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3305
|
+
d: "M19 3.333H5A3.67 3.67 0 0 0 1.333 7v10A3.67 3.67 0 0 0 5 20.667h14A3.67 3.67 0 0 0 22.667 17V7A3.67 3.67 0 0 0 19 3.333M20.667 17c0 .92-.747 1.667-1.667 1.667h-2.667c-.92 0-1.666-.747-1.666-1.667V7c0-.92.746-1.667 1.666-1.667H19c.92 0 1.667.747 1.667 1.667z",
|
|
3306
|
+
fill: "currentColor"
|
|
3307
|
+
})
|
|
3308
|
+
});
|
|
3309
|
+
//#endregion
|
|
3193
3310
|
//#region src/components/Icon/icons/DocsDevIcon.tsx
|
|
3194
3311
|
const DocsDevIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
3195
3312
|
...props,
|
|
@@ -5436,6 +5553,17 @@ const WebinarSeriesIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
5436
5553
|
})
|
|
5437
5554
|
});
|
|
5438
5555
|
//#endregion
|
|
5556
|
+
//#region src/components/Icon/icons/WistiaIcon.tsx
|
|
5557
|
+
const WistiaIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
5558
|
+
...props,
|
|
5559
|
+
viewBox: "0 0 24 24",
|
|
5560
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5561
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
5562
|
+
d: "M11.312 14.304H8.087c-.98 0-1.91.422-2.549 1.16l-4.074 4.688c2.964.155 6.065.155 8.248.155 11.355 0 12.955-6.99 12.955-10.264-.986 1.197-3.759 4.26-11.362 4.26zm9.953-10.605c-.05.57-.366 2.909-7.014 2.909-5.408 0-7.59 0-12.918-.106l3.994 4.59a4.13 4.13 0 0 0 3.076 1.426c1.321.018 3.132.037 3.43.037 6.827 0 10.66-3.132 10.66-6.133 0-1.247-.415-2.134-1.222-2.729z",
|
|
5563
|
+
fill: "currentColor"
|
|
5564
|
+
})
|
|
5565
|
+
});
|
|
5566
|
+
//#endregion
|
|
5439
5567
|
//#region src/components/Icon/icons/WriteIcon.tsx
|
|
5440
5568
|
const WriteIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
5441
5569
|
...props,
|
|
@@ -5523,6 +5651,7 @@ const iconMap = {
|
|
|
5523
5651
|
channel: ChannelIcon,
|
|
5524
5652
|
chapters: ChaptersIcon,
|
|
5525
5653
|
chat: ChatIcon,
|
|
5654
|
+
"chat-sparkle": ChatSparkleIcon,
|
|
5526
5655
|
checkmark: CheckmarkIcon,
|
|
5527
5656
|
"checkmark-circle": CheckmarkCircleIcon,
|
|
5528
5657
|
"checkmark-circle-outline": CheckmarkCircleOutlineIcon,
|
|
@@ -5554,6 +5683,7 @@ const iconMap = {
|
|
|
5554
5683
|
delete: DeleteIcon,
|
|
5555
5684
|
desktop: DesktopIcon,
|
|
5556
5685
|
diamond: DiamondIcon,
|
|
5686
|
+
"dock-right": DockRightIcon,
|
|
5557
5687
|
"docs-dev": DocsDevIcon,
|
|
5558
5688
|
"dots-horizontal": DotsHorizontalIcon,
|
|
5559
5689
|
download: DownloadIcon,
|
|
@@ -5728,6 +5858,7 @@ const iconMap = {
|
|
|
5728
5858
|
waveform: WaveformIcon,
|
|
5729
5859
|
webhook: WebhookIcon,
|
|
5730
5860
|
"webinar-series": WebinarSeriesIcon,
|
|
5861
|
+
wistia: WistiaIcon,
|
|
5731
5862
|
write: WriteIcon,
|
|
5732
5863
|
"zoom-in": ZoomInIcon,
|
|
5733
5864
|
"zoom-out": ZoomOutIcon
|
|
@@ -6871,10 +7002,11 @@ const PolymorphicStyledHeading = withPolymorphicAs(styled.div`
|
|
|
6871
7002
|
line-height: var(--line-height);
|
|
6872
7003
|
color: var(--text-color);
|
|
6873
7004
|
${({ $variant }) => headingVariantStyleMap[$variant]}
|
|
6874
|
-
${({ $maxLines }) => {
|
|
7005
|
+
${({ $maxLines, $wordBreak }) => {
|
|
6875
7006
|
if (isNotNil($maxLines)) return css`
|
|
6876
7007
|
${ellipsisStyle};
|
|
6877
7008
|
${lineClampCss($maxLines)};
|
|
7009
|
+
${wordBreakCss($wordBreak)};
|
|
6878
7010
|
`;
|
|
6879
7011
|
}}
|
|
6880
7012
|
${({ $inline }) => $inline && css`
|
|
@@ -6902,7 +7034,7 @@ const headingVariantElementMap = {
|
|
|
6902
7034
|
heading5: "h5",
|
|
6903
7035
|
heading6: "h6"
|
|
6904
7036
|
};
|
|
6905
|
-
const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, variant = "heading1", renderAs, ...props }) => {
|
|
7037
|
+
const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, wordBreak = "anywhere", variant = "heading1", renderAs, ...props }) => {
|
|
6906
7038
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
6907
7039
|
return /* @__PURE__ */ jsx(PolymorphicStyledHeading, {
|
|
6908
7040
|
ref,
|
|
@@ -6915,6 +7047,7 @@ const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inheri
|
|
|
6915
7047
|
$prominence: prominence,
|
|
6916
7048
|
$textTransform: textTransform,
|
|
6917
7049
|
$variant: variant,
|
|
7050
|
+
$wordBreak: wordBreak,
|
|
6918
7051
|
as: renderAs ?? headingVariantElementMap[variant] ?? DEFAULT_ELEMENT$3,
|
|
6919
7052
|
...props,
|
|
6920
7053
|
children: processedChildren
|
|
@@ -7098,10 +7231,11 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7098
7231
|
font-style: normal;
|
|
7099
7232
|
margin: 0;
|
|
7100
7233
|
${({ $variant }) => textVariantStyleMap[$variant]}
|
|
7101
|
-
${({ $maxLines }) => {
|
|
7234
|
+
${({ $maxLines, $wordBreak }) => {
|
|
7102
7235
|
if (isNotNil($maxLines)) return css`
|
|
7103
7236
|
${ellipsisStyle};
|
|
7104
7237
|
${lineClampCss($maxLines)};
|
|
7238
|
+
${wordBreakCss($wordBreak)};
|
|
7105
7239
|
`;
|
|
7106
7240
|
}}
|
|
7107
7241
|
${({ $inline }) => $inline && css`
|
|
@@ -7127,7 +7261,7 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7127
7261
|
}
|
|
7128
7262
|
`}
|
|
7129
7263
|
`);
|
|
7130
|
-
const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, variant = "body2", renderAs, ...props }) => {
|
|
7264
|
+
const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, wordBreak = "anywhere", variant = "body2", renderAs, ...props }) => {
|
|
7131
7265
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
7132
7266
|
return /* @__PURE__ */ jsx(PolymorphicStyledText, {
|
|
7133
7267
|
ref,
|
|
@@ -7140,6 +7274,7 @@ const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit",
|
|
|
7140
7274
|
$prominence: prominence,
|
|
7141
7275
|
$textTransform: textTransform,
|
|
7142
7276
|
$variant: variant,
|
|
7277
|
+
$wordBreak: wordBreak,
|
|
7143
7278
|
as: renderAs ?? textVariantElementMap[variant] ?? DEFAULT_ELEMENT$2,
|
|
7144
7279
|
...props,
|
|
7145
7280
|
children: processedChildren
|
|
@@ -18087,6 +18222,6 @@ const WistiaLogo = ({ description, height = 100, hoverColor, href, iconOnly = fa
|
|
|
18087
18222
|
};
|
|
18088
18223
|
WistiaLogo.displayName = "WistiaLogo_UI";
|
|
18089
18224
|
//#endregion
|
|
18090
|
-
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox, CheckboxCard, CheckboxGroup, CheckboxMenuItem, ClickRegion, Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleTriggerIcon, ColorGrid, ColorGridOption, ColorList, ColorListGroup, ColorListOption, ColorPicker, ColorPickerPopoverContent, ColorPickerSection, ColorPickerTrigger, ColorSchemeWrapper, Combobox, ComboboxOption, ContextMenu, ContrastControls, ContrastEnforcerSwitch, ContrastIndicator, ContrastPreview, CustomizableThemeWrapper, DOCUMENT_COLOR_MODE_ATTRIBUTE, DataCard, DataCardHoverArrow, DataCardTrend, DataCards, DataList, DataListItem, DataListItemLabel, DataListItemValue, DatePicker, Dimmer, Divider, EditableHeading, EditableText, EditableTextCancelButton, EditableTextContext, EditableTextDisplay, EditableTextInput, EditableTextLabel, EditableTextRoot, EditableTextSubmitButton, EditableTextTrigger, Ellipsis, FeatureCard, FeatureCardImage, FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, FilterMenu, FilterMenuItem, Form, FormErrorSummary, FormField, FormGroup, Grid, Heading, HexColorInput, HueSlider, Icon, IconButton, IconChip, Image, ImageDimensionsValidator, Input, InputClickToCopy, InputDuration, InputPassword, KeyboardShortcut, Label, Link, List, ListItem, Mark, Markdown, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Meter, Modal, ModalCallout, ModalCallouts, PersistentFileAmountLimitValidator, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverCloseButton, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, PreviewCard, ProgressBar, Radio, RadioCard, RadioCardImage, RadioGroup, RadioMenuItem, SaturationAndValuePicker, ScreenReaderOnly, ScrollArea, SegmentedControl, SegmentedControlItem, Select, SelectOption, SelectOptionGroup, Sidebar, SidebarButton, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarSearchInput, SidebarTitle, Slider, SplitButton, Stack, SubMenu, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Text, Thumbnail, ThumbnailBadge, ThumbnailCollage, TileButton, Tooltip, UIProvider, ValueNameOrHexCode, ValueSwatch, WistiaLogo, buildTimeDuration, calculateContrast, coerceToBoolean, colorModeOptions, colorSchemeOptions, copyToClipboard, dateOnlyISOString, dateOnlyString, dateOnlyStringForSentence, dateOnlyStringNumeric, dateTime, dateTimeRounded, dateTimeString, dateTimeStringForSentence, dateTimeToDate, dateTimeToISO, dateToDateTime, dateUTCOffset, dayOfWeekString, documentColorModeOptions, getBackgroundGradient, getDocumentColorMode, getSemiRandomBackgroundGradient, iconSizeMap, isKeyboardKey, isUrl, mediaDurationString, mergeRefs, millisecondsToDurationISOString, monthDayStringNumeric, mq, parseDateString, sessionDurationString, setDocumentColorMode, stripExtension, timeAgoString, timeOnlyString, useActiveMq, useAriaLive, useBoolean, useClipboard, useDocumentColorMode, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
18225
|
+
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox, CheckboxCard, CheckboxGroup, CheckboxMenuItem, ClickRegion, Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleTriggerIcon, ColorGrid, ColorGridOption, ColorList, ColorListGroup, ColorListOption, ColorPicker, ColorPickerPopoverContent, ColorPickerSection, ColorPickerTrigger, ColorSchemeWrapper, Combobox, ComboboxOption, ContextMenu, ContrastControls, ContrastEnforcerSwitch, ContrastIndicator, ContrastPreview, CustomizableThemeWrapper, DOCUMENT_COLOR_MODE_ATTRIBUTE, DataCard, DataCardHoverArrow, DataCardTrend, DataCards, DataList, DataListItem, DataListItemLabel, DataListItemValue, DatePicker, Dimmer, Divider, EditableHeading, EditableText, EditableTextCancelButton, EditableTextContext, EditableTextDisplay, EditableTextInput, EditableTextLabel, EditableTextRoot, EditableTextSubmitButton, EditableTextTrigger, Ellipsis, FeatureCard, FeatureCardImage, FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, FilterMenu, FilterMenuItem, Form, FormErrorSummary, FormField, FormGroup, Grid, Heading, HexColorInput, HueSlider, Icon, IconButton, IconChip, Image, ImageDimensionsValidator, Input, InputClickToCopy, InputDuration, InputPassword, KeyboardShortcut, Label, Link, List, ListItem, Mark, Markdown, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Meter, Modal, ModalCallout, ModalCallouts, PersistentFileAmountLimitValidator, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverCloseButton, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, PreviewCard, ProgressBar, Radio, RadioCard, RadioCardImage, RadioGroup, RadioMenuItem, SaturationAndValuePicker, ScreenReaderOnly, ScrollArea, SegmentedControl, SegmentedControlItem, Select, SelectOption, SelectOptionGroup, Sidebar, SidebarButton, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarSearchInput, SidebarTitle, Slider, SplitButton, Stack, SubMenu, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Text, Thumbnail, ThumbnailBadge, ThumbnailCollage, TileButton, Tooltip, UIProvider, ValueNameOrHexCode, ValueSwatch, WistiaLogo, breakpoints, breakpointsEm, buildTimeDuration, calculateContrast, coerceToBoolean, colorModeOptions, colorSchemeOptions, copyToClipboard, dateOnlyISOString, dateOnlyString, dateOnlyStringForSentence, dateOnlyStringNumeric, dateTime, dateTimeRounded, dateTimeString, dateTimeStringForSentence, dateTimeToDate, dateTimeToISO, dateToDateTime, dateUTCOffset, dayOfWeekString, documentColorModeOptions, getBackgroundGradient, getDocumentColorMode, getSemiRandomBackgroundGradient, iconSizeMap, isKeyboardKey, isUrl, mediaDurationString, mergeRefs, millisecondsToDurationISOString, monthDayStringNumeric, mq, parseDateString, sessionDurationString, setDocumentColorMode, stripExtension, timeAgoString, timeOnlyString, useActiveMq, useAriaLive, useBoolean, useBreakpoint, useClipboard, useDocumentColorMode, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
18091
18226
|
|
|
18092
18227
|
//# sourceMappingURL=index.js.map
|