@wistia/ui 3.3.0 → 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 +60 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +213 -117
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2582
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);
|
|
@@ -6910,10 +7002,11 @@ const PolymorphicStyledHeading = withPolymorphicAs(styled.div`
|
|
|
6910
7002
|
line-height: var(--line-height);
|
|
6911
7003
|
color: var(--text-color);
|
|
6912
7004
|
${({ $variant }) => headingVariantStyleMap[$variant]}
|
|
6913
|
-
${({ $maxLines }) => {
|
|
7005
|
+
${({ $maxLines, $wordBreak }) => {
|
|
6914
7006
|
if (isNotNil($maxLines)) return css`
|
|
6915
7007
|
${ellipsisStyle};
|
|
6916
7008
|
${lineClampCss($maxLines)};
|
|
7009
|
+
${wordBreakCss($wordBreak)};
|
|
6917
7010
|
`;
|
|
6918
7011
|
}}
|
|
6919
7012
|
${({ $inline }) => $inline && css`
|
|
@@ -6941,7 +7034,7 @@ const headingVariantElementMap = {
|
|
|
6941
7034
|
heading5: "h5",
|
|
6942
7035
|
heading6: "h6"
|
|
6943
7036
|
};
|
|
6944
|
-
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 }) => {
|
|
6945
7038
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
6946
7039
|
return /* @__PURE__ */ jsx(PolymorphicStyledHeading, {
|
|
6947
7040
|
ref,
|
|
@@ -6954,6 +7047,7 @@ const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inheri
|
|
|
6954
7047
|
$prominence: prominence,
|
|
6955
7048
|
$textTransform: textTransform,
|
|
6956
7049
|
$variant: variant,
|
|
7050
|
+
$wordBreak: wordBreak,
|
|
6957
7051
|
as: renderAs ?? headingVariantElementMap[variant] ?? DEFAULT_ELEMENT$3,
|
|
6958
7052
|
...props,
|
|
6959
7053
|
children: processedChildren
|
|
@@ -7137,10 +7231,11 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7137
7231
|
font-style: normal;
|
|
7138
7232
|
margin: 0;
|
|
7139
7233
|
${({ $variant }) => textVariantStyleMap[$variant]}
|
|
7140
|
-
${({ $maxLines }) => {
|
|
7234
|
+
${({ $maxLines, $wordBreak }) => {
|
|
7141
7235
|
if (isNotNil($maxLines)) return css`
|
|
7142
7236
|
${ellipsisStyle};
|
|
7143
7237
|
${lineClampCss($maxLines)};
|
|
7238
|
+
${wordBreakCss($wordBreak)};
|
|
7144
7239
|
`;
|
|
7145
7240
|
}}
|
|
7146
7241
|
${({ $inline }) => $inline && css`
|
|
@@ -7166,7 +7261,7 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7166
7261
|
}
|
|
7167
7262
|
`}
|
|
7168
7263
|
`);
|
|
7169
|
-
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 }) => {
|
|
7170
7265
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
7171
7266
|
return /* @__PURE__ */ jsx(PolymorphicStyledText, {
|
|
7172
7267
|
ref,
|
|
@@ -7179,6 +7274,7 @@ const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit",
|
|
|
7179
7274
|
$prominence: prominence,
|
|
7180
7275
|
$textTransform: textTransform,
|
|
7181
7276
|
$variant: variant,
|
|
7277
|
+
$wordBreak: wordBreak,
|
|
7182
7278
|
as: renderAs ?? textVariantElementMap[variant] ?? DEFAULT_ELEMENT$2,
|
|
7183
7279
|
...props,
|
|
7184
7280
|
children: processedChildren
|
|
@@ -18126,6 +18222,6 @@ const WistiaLogo = ({ description, height = 100, hoverColor, href, iconOnly = fa
|
|
|
18126
18222
|
};
|
|
18127
18223
|
WistiaLogo.displayName = "WistiaLogo_UI";
|
|
18128
18224
|
//#endregion
|
|
18129
|
-
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 };
|
|
18130
18226
|
|
|
18131
18227
|
//# sourceMappingURL=index.js.map
|